• 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/b/a/badger-lib-HEAD/packages/pyparsing/examples/wordsToNum.py   badger-lib(Download)
 
majorDefinitions = [
    ("thousand",    int(1e3)),
    ("million",     int(1e6)),
    ("billion",     int(1e9)),
    ("trillion",    int(1e12)),
    ("quadrillion", int(1e15)),

src/b/a/badger-lib-HEAD/packages/pyparsing/examples/pymicko.py   badger-lib(Download)
    TYPE_BIT_SIZE = 16
    #min/max values of constants
    MIN_INT = -2 ** (TYPE_BIT_SIZE - 1)
    MAX_INT = 2 ** (TYPE_BIT_SIZE - 1) - 1
    MAX_UNSIGNED = 2 ** TYPE_BIT_SIZE - 1
        index = self.lookup_symbol(cname, stype=ctype)
        if index == None:
            num = int(cname)
            if ctype == SharedData.TYPES.INT:
                if (num < SharedData.MIN_INT) or (num > SharedData.MAX_INT):
    def global_variable_action(self, text, loc, var):
        """Code executed after recognising a global variable"""
        exshared.setpos(loc, text)
        if DEBUG > 0:
            print "GLOBAL_VAR:",var

src/p/y/pyformex-0.8.6/pyformex/examples/OpticalIllusions.py   pyformex(Download)
    C = circle(a1=360./N).points()
    O =[0,0,0]
    F = Formex([[C[i,0],C[i+1,0],O] for i in arange(0,2*N,2)]).scale([R,R,0])
    F.setProp([0,7])
    p = circle(a1=360./N).vertices()
    b = b1+b2
    col = [random.rand(3)/3,[1,1,1]-random.rand(3)/8]
    for i in range(4*N):
        b = b.rotate(360./N/4)
        dr = draw(b,bbox=box,color=col)
    if not res: return
    shift,per,amp = res['Spacing between lines'],res['Periods'],res['Amplitude']
    n = int(2*pi/shift*per)
    F = Formex('2').replic(n,shift)
    for i in F:

src/s/h/shedskin-HEAD/examples/amaze.py   shedskin(Download)
        data = raw_input('Enter the dimension of the maze as Width X Height: ')
        w1, h1 = data.split() # XXX SS 
        w, h  = int(w1), int(h1)
 
        for x in range(h):
            row = ''
            while not row:
                row = raw_input('Enter row number %d: ' % (x+1))
            rowsplit = [int(y) for y in row.split()] # XXX SS
            w = len(lines[0].split())
            for line in lines:
                row = [int(y) for y in line.split()]
                if len(row) != w:
                    raise MazeReaderException('Invalid maze file - error in maze dimensions')
    def readMaze(self, source=STDIN):
        if source==STDIN:
            self.readStdin()
        elif source == FILE_:
            self.readFile()

src/p/y/python-synapse-HEAD/examples/test_smtpserver.py   python-synapse(Download)
            raise SystemExit(1)
        MAXLEN = 1024
        (data, addr) = s.recvfrom(MAXLEN)
        s.close()
        smtp_srv = None
    def __init__(self, config):
        node.Node.__init__(self, config)
        host, port = re.findall('smtp://([^:]+):([0-9]+)', config['uri'])[0]
        self._host = host if host != '*' else '0.0.0.0'
        self._port = int(port, 10)

src/q/u/quickflash-HEAD/branch_tags/octave-swig/QuickFlash-1.0.0-Octave-1.0/examples/expansion_correct/show_map.py   quickflash(Download)
        self.__traj = list()
 
        self.__num_times = int(0)
        self.__num_parts = int(0)
 
        self.__traj = list()
 
        self.__num_times = int(0)
        self.__num_parts = int(0)
 
                raise ValueError("Improper format for map file")
 
            file_timesteps = int(words[0])
 
            num_parts = int(words[1])

src/b/a/badger-lib-HEAD/packages/freshen/examples/docu/features/step/page_steps.py   badger-lib(Download)
def create_doc(num_pages):
    scc.doc = Document(int(num_pages))
 
@Given('the page is (\d+)')
def set_page_doc(page):
    scc.doc.set_page(int(page))
def check_page(expected_page):
    assert_equals(int(expected_page), scc.doc.get_page())
 
@Then('the document has (\d+) pages?')
def check_num_pages(expected_num_pages):
    assert_equals(int(expected_num_pages), scc.doc.get_num_pages())

src/e/x/expsuite-HEAD/examples/crossvalidation/suite.py   expsuite(Download)
            raise SystemExit('%i-fold cross validation does not make sense. Use at least 2 repetitions.'%params['repetitions'])
 
        key = int(hashlib.sha1(dataset).hexdigest()[:7], 16)
        indices = range(dataset.shape[0])
        if shuffle:

src/q/u/quickflash-HEAD/branch_tags/octave-swig/QuickFlash-1.0.0-Octave-1.0/examples/raytracer/build_tasklist.py   quickflash(Download)
    argc = len(argv)
 
    min_args = int(4)
 
    if (argc < min_args) :
 
 
    argptr = int(1)
 
 
    width_pixels = int(argv[argptr])
        exit(-1)
 
    height_pixels = int(argv[argptr])
    argptr += 1
 
    if (height_pixels < 1) :
        stderr.write("Error: Height pixels must be positive\n\n")
        exit(-1)
 
    task_size =  int(argv[argptr])

src/c/l/clearsilver-0.10.1/clearsilver/python/examples/trans/trans.py   clearsilver(Download)
 
TIER2_DIV = 11
TIER1_DIV = 11 * TIER2_DIV
 
if not DEBUG: LOGGING_STATUS[DEV_UPDATE] = 0
    def parseHTML(self, data, reset=1):
        if reset: self._html_state = 0
        if DEBUG: print "- %d ---------\n%s\n- E ---------" % (self._html_state, data)
 
        results = []
            self._html_state = 0
        while i < n:
            if DEBUG: print "MATCHING>%s<MATCHING" % data[i:]
            cmt_b = string.find(data[i:], '<!--')
            cmt_e = string.find(data[i:], '-->')
            tag_b = string.find(data[i:], '<')
            tag_e = string.find(data[i:], '>')
            if DEBUG: print "B> %d %d %d %d <B" % (cmt_b, cmt_e, tag_b, tag_e)

Previous  4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12  Next