All Samples(195712) | Call(195207) | Derive(505) | Import(0)
int(x[, base]) -> integer Convert a string or number to an integer, if possible. A floating point argument will be truncated towards zero (this does not include a string representation of a floating point number!) When converting a string, use the optional base. It is an error to supply a base when converting a non-string. If base is zero, the proper base is guessed based on the string content. If the argument is outside the integer range a long object will be returned instead.
src/p/y/pyallegro-HEAD/alpy/trunk/examples/demo.py pyallegro(Download)
self.dead = self.shot = 0
self.xspeed = self.yspeed = self.ycounter = 0
self.pos = (screen.w/2) << SPEED_SHIFT
self.bullet = Ship.Bullet()
if screen.w < 400:
def move(self):
global skip_count
if self.shot:
if skip_count <= 0:
if self.state >= EXPLODE_FLAG + EXPLODE_FRAMES -1:
if skip_count <= 0:
if key[KEY_LEFT]:
if self.xspeed > -MAX_SPEED:
self.xspeed -= 2
elif key[KEY_RIGHT]:
if self.xspeed < MAX_SPEED:
src/p/y/PySide-1.1.2/sources/pyside-examples/examples/tools/qtdemo/displayshape.py PySide(Download)
penAlpha = penColor.alpha()
brushAlpha = brushColor.alpha()
fadeMinimum = int(self.metadata.get("fade minimum", "0"))
if penAlpha != fadeMinimum or brushAlpha != fadeMinimum or self.metadata["fade"] > 0:
penAlpha = penColor.alpha()
penAlpha = max(int(self.metadata.get("fade minimum", "0")), min(penAlpha + self.metadata["fade"], 255))
penColor.setAlpha(penAlpha)
scale = min(min(self.maxSize.width() / self.source.width(), self.maxSize.height() / self.source.height()), 1.0)
self.source = self.source.scaled(int(ceil(self.source.width() * scale)),
int(ceil(self.source.height() * scale)),
QtCore.Qt.KeepAspectRatio,
if "destroy" not in self.metadata:
if "fade" in self.metadata:
self.alpha = max(int(self.metadata.get("fade minimum", "0")), min(self.alpha + self.metadata["fade"], 255))
self.redraw()
src/v/t/VT-USRP-daughterboard-drivers_python-HEAD/gnuradio-examples/python/usrp/usrp_benchmark_usb.py VT-USRP-daughterboard-drivers_python(Download)
nsec = 1
stream_length = int (usb_throughput/2 * nsec) # length of stream to examine
adc_freq = 64e6
# allocate usb throughput 50/50 between Tx and Rx
tx_interp = int (dac_freq) / int (usb_throughput_in_samples / 2)
rx_decim = int (adc_freq) / int (usb_throughput_in_samples / 2)
src/b/u/bunny1-HEAD/src/b1_example.py bunny1(Download)
def is_int(x):
"""tells whether something can be turned into an int or not"""
try:
int(x)
return True
# check to see if this is a valid API key
if len(arg) == 32:
int(arg, 16)
return "http://www.facebook.com/apps/application.php?api_key=%s" % qp(arg)
except ValueError:
src/r/a/ramp-0.1.4/examples/classify_insults.py ramp(Download)
def probability_of_insult(config, ctx, txt):
# create a unique index for this text
idx = int(md5(txt).hexdigest()[:10], 16)
# add the new comment to our DataFrame
src/d/j/django-navbar-0.3.0/examples/dbgp/server.py django-navbar(Download)
errmsg = ex.args[0]
try:
errno = int(ex.args[1]) # sometimes this is a string
except ValueError:
errno = 0
self.filename = node.getAttribute('filename')
if node.hasAttribute('lineno'):
self.lineno = int(node.getAttribute('lineno'))
if node.hasAttribute('function'):
self.functionName = node.getAttribute('function')
self.exceptionName = node.getAttribute('exception')
if node.hasAttribute('temporary'):
self.temporary = int(node.getAttribute('temporary'))
if node.hasAttribute('hit_count'):
self.hitCount = int(node.getAttribute('hit_count'))
if node.hasAttribute('hit_value'):
self.hitValue = int(node.getAttribute('hit_value'))
src/n/o/noise-1.1.1/examples/planet.py noise(Download)
def create_bands_texture(bands=14.0, stretch=2.0, turbulence=8.0, color1=(1.0, 0.8, 0.6), color2=(0.1, -0.3, -0.4)): coords = range(TEXTURE_SIZE) texel = (ctypes.c_ubyte * (3 * TEXTURE_SIZE**2))() for y in coords: for x in coords: p = pnoise2(x * 15.0 / TEXTURE_SIZE, y * 15.0 / TEXTURE_SIZE, octaves=5,
py = (y + math.cos(p) * turbulence) v = pnoise2( px / stretch / TEXTURE_SIZE, py * bands / TEXTURE_SIZE, octaves=4, repeaty=bands, repeatx=1.0/stretch) r, g, b = blend((v + 1.0) / 2.0, color1, color2, 1.75 + (p**5)*0.003)
src/p/e/peyote-HEAD/examples/sandStrokem.py peyote(Download)
clear((255,255,255))
g = int(HEIGHT/float(k))
for y in range(k):
if (self.x > WIDTH): self.selfinit()
tpoint(int(self.x), int(self.y), self.myc, 0.07)
self.sg += random.uniform(-0.042,0.042)
w = self.sg / wd
for i in range(int(wd)):
dy = self.gage*sin(i*w)
a = 0.1 - i/(wd*10+10)
tpoint(int(self.x),int(self.y + dy), self.myc, a)
src/k/a/kamaelia-HEAD/trunk/Sketches/MH/Layout/Example/VisibleParticle.py kamaelia(Download)
def renderBonds(self, surface):
"""Renders lines representing the bonds going from this particle"""
for p in self.bondedTo:
pygame.draw.line(surface, (128,128,255), [int(i) for i in self.pos], [int(i) for i in p.pos])
def renderSelf(self, surface):
"""Renders a circle with the particle name in it"""
pygame.draw.circle(surface, (255,128,128), (int(self.pos[0]), int(self.pos[1])), self.radius)
surface.blit(self.label, (int(self.pos[0]) - self.label.get_width()/2, int(self.pos[1]) - self.label.get_height()/2))
src/k/a/kamaelia-HEAD/trunk/Sketches/MH/Layout/Example/PhysApp1.py kamaelia(Download)
def renderBonds(self, surface):
"""Renders lines representing the bonds going from this particle"""
for p in self.bondedTo:
pygame.draw.line(surface, (128,128,255), [int(i) for i in self.pos], [int(i) for i in p.pos])
def renderSelf(self, surface):
"""Renders a circle with the particle name in it"""
pygame.draw.circle(surface, (255,128,128), (int(self.pos[0]), int(self.pos[1])), self.radius)
surface.blit(self.label, (int(self.pos[0]) - self.label.get_width()/2, int(self.pos[1]) - self.label.get_height()/2))
Previous 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 Next