• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

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/w/e/Webware-for-Python-1.1.1/WebKit/Examples/Colors.py   Webware for Python(Download)
        h = h[1:]
    h = h[:2], h[2:4], h[4:]
    return map(lambda x: int(x, 16), h)
 
# Prepare HTML for color table

src/c/l/clearsilver-0.10.1/clearsilver/python/examples/base/odb_sqlite.py   clearsilver(Download)
    def subfn(m):
        hexnum = int(m.group(1),16)
        return "%c" % hexnum
    return re.sub("%(..)",subfn,str)
 

src/p/y/PySide-1.1.2/sources/pyside-examples/examples/tools/settingseditor/settingseditor.py   PySide(Download)
        if isinstance(originalValue, QtGui.QColor):
            self.colorExp.exactMatch(text)
            value = QtGui.QColor(min(int(self.colorExp.cap(1)), 255),
                                 min(int(self.colorExp.cap(2)), 255),
                                 min(int(self.colorExp.cap(3)), 255),
                                 min(int(self.colorExp.cap(4)), 255))
        elif isinstance(originalValue, QtCore.QPoint):
            self.pointExp.exactMatch(text)
            value = QtCore.QPoint(int(self.pointExp.cap(1)),
                                  int(self.pointExp.cap(2)))
        elif isinstance(originalValue, QtCore.QRect):

src/p/y/pyglet-1.1.4/examples/astraea/astraea.py   pyglet(Download)
    def __init__(self, img, x, y, batch=None):
        super(WrappingSprite, self).__init__(img, x, y, batch=batch)
        self.collision_radius = self.image.width / COLLISION_RESOLUTION / 2 
 
    def update(self, dt):
        x = self.x + self.dx * dt
        y = self.y + self.dy * dt
        rotation = self.rotation + self.rotation_speed * dt
 
        self.x = wrap(x, ARENA_WIDTH)
 
        self.x = wrap(x, ARENA_WIDTH)
        self.y = wrap(y, ARENA_HEIGHT)
        self.rotation = wrap(rotation, 360.)
 
    def collision_cells(self):
        '''Generate a sequence of (x, y) cells this object covers,
        approximately.''' 
        radius = self.collision_radius
        cellx = int(self.x / COLLISION_RESOLUTION)

src/h/t/HTMLtoRST-HEAD/generate_pdf_examples/BeautifulSoup.py   HTMLtoRST(Download)
            # Handle numeric entities
            if len(x) > 1 and x[1] == 'x':
                return unichr(int(x[2:], 16))
            else:
                return unichr(int(x[1:]))
    def convert_charref(self, name):
        """This method fixes a bug in Python's SGMLParser."""
        try:
            n = int(name)
        except ValueError:
    def handle_charref(self, ref):
        "Handle character references as data."
        if self.convertEntities:
            data = unichr(int(ref))
        else:

src/q/u/quickflash-HEAD/branch_tags/octave-swig/QuickFlash-1.0.0-Octave-1.0/examples/particle_extract/particle_worker.py   quickflash(Download)
 
 
MPI_Tag_tag = int(0)
MPI_Tag_times = int(1)
MPI_Tag_part_data = int(2)
 
MPI_Signal_end = int(-1)
        self.__output_prefix = None
 
        self.__start_file_index = int(0)
        self.__num_files = int(0)
 

src/t/w/twitstream-HEAD/examples/textori.py   twitstream(Download)
            try:
                if text[:3] == "&#x":
                    return unichr(int(text[3:-1], 16))
                else:
                    return unichr(int(text[2:-1]))

src/t/w/twitstream-HEAD/examples/fixreplies.py   twitstream(Download)
            try:
                if text[:3] == "&#x":
                    return unichr(int(text[3:-1], 16))
                else:
                    return unichr(int(text[2:-1]))

src/p/d/pdfrw-0.1/examples/rl2/decodegraphics.py   pdfrw(Download)
        else:
            # TODO: Adjust spacing between characters here
            int(x)
    text = ''.join(result)
    self.tpath.textOut(text)
        for x in info:
            assert x[0] == '<' and x[-1] == '>' and len(x) in (4,6), x
            i = int(x[1:-1], 16)
            info2.append(i)
        self.remap = dict((x,chr(y)) for (x,y) in zip(info2[::2], info2[1::2])).get

src/p/a/paddle-1.0.2/paddle/examples/exp_MNIST.py   paddle(Download)
 
    # check if a previously drawn sample is already there
    patchesfn = 'MNIST_patches_%dx%d_%dk.npy' % (W, W, M)
    if os.access(patchesfn, os.R_OK):
        print 'Loading a previously drawn sample from', patchesfn
        # sampling M samples from the entire dataset
        # X = X[:,NP.arange(0,M)]
        X = X[:,NP.random.permutation(int(N))[:M]]
        # map the intensities of the input images to the range [0,1]
        X /=255.

Previous  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  Next