# int

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.
```

```
majorDefinitions = [
("thousand",    int(1e3)),
("million",     int(1e6)),
("billion",     int(1e9)),
("trillion",    int(1e12)),
```

```    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
```

```    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:
```

```        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:
elif source == FILE_:
```

```            raise SystemExit(1)
MAXLEN = 1024
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)
```

```        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])
```

```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())```

```            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:
```

```    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)

```

```
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