rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
while self.pos < len(self.field): if self.field[self.pos] in self.atomends:
if atomends is None: atomends = self.atomends while self.pos < len(self.field): if self.field[self.pos] in atomends:
def getatom(self): """Parse an RFC-822 atom.""" atomlist = ['']
1fb22bb24fd395a12a225b2418ea8d22d5b37610 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1fb22bb24fd395a12a225b2418ea8d22d5b37610/_parseaddr.py
"""Parse a sequence of RFC-822 phrases. A phrase is a sequence of words, which are in turn either RFC-822 atoms or quoted-strings. Phrases are canonicalized by squeezing all runs of continuous whitespace into one space.
"""Parse a sequence of RFC 2822 phrases. A phrase is a sequence of words, which are in turn either RFC 2822 atoms or quoted-strings. Phrases are canonicalized by squeezing all runs of continuous whitespace into one space.
def getphraselist(self): """Parse a sequence of RFC-822 phrases.
1fb22bb24fd395a12a225b2418ea8d22d5b37610 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1fb22bb24fd395a12a225b2418ea8d22d5b37610/_parseaddr.py
elif self.field[self.pos] in self.atomends: break else: plist.append(self.getatom())
elif self.field[self.pos] in self.phraseends: break else: plist.append(self.getatom(self.phraseends))
def getphraselist(self): """Parse a sequence of RFC-822 phrases.
1fb22bb24fd395a12a225b2418ea8d22d5b37610 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1fb22bb24fd395a12a225b2418ea8d22d5b37610/_parseaddr.py
"""An AddressList encapsulates a list of parsed RFC822 addresses."""
"""An AddressList encapsulates a list of parsed RFC 2822 addresses."""
def getphraselist(self): """Parse a sequence of RFC-822 phrases.
1fb22bb24fd395a12a225b2418ea8d22d5b37610 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1fb22bb24fd395a12a225b2418ea8d22d5b37610/_parseaddr.py
childNodeTypes = (Node.TEXT_NODE, Node.ENTITY_REFERENCE_NODE)
def _getElementsByTagNameNSHelper(parent, nsURI, localName, rc): for node in parent.childNodes: if node.nodeType == Node.ELEMENT_NODE: if ((localName == "*" or node.tagName == localName) and (nsURI == "*" or node.namespaceURI == nsURI)): rc.append(node) _getElementsByTagNameNSHelper(node, nsURI, localName, rc) return r...
291ed4fb3f9b6cc7697c7ac8c0c70ecdc5e245e2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/291ed4fb3f9b6cc7697c7ac8c0c70ecdc5e245e2/minidom.py
childNodeTypes = (Node.ELEMENT_NODE, Node.PROCESSING_INSTRUCTION_NODE, Node.COMMENT_NODE, Node.TEXT_NODE, Node.CDATA_SECTION_NODE, Node.ENTITY_REFERENCE_NODE)
def __delitem__(self, attname_or_tuple): node = self[attname_or_tuple] node.unlink() del self._attrs[node.name] del self._attrsNS[(node.namespaceURI, node.localName)] self.length = len(self._attrs)
291ed4fb3f9b6cc7697c7ac8c0c70ecdc5e245e2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/291ed4fb3f9b6cc7697c7ac8c0c70ecdc5e245e2/minidom.py
childNodeTypes = ()
def _get_attributes(self): return AttributeList(self._attrs, self._attrsNS)
291ed4fb3f9b6cc7697c7ac8c0c70ecdc5e245e2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/291ed4fb3f9b6cc7697c7ac8c0c70ecdc5e245e2/minidom.py
childNodeTypes = ()
def writexml(self, writer): writer.write("<!--%s-->" % self.data)
291ed4fb3f9b6cc7697c7ac8c0c70ecdc5e245e2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/291ed4fb3f9b6cc7697c7ac8c0c70ecdc5e245e2/minidom.py
childNodeTypes = ()
def writexml(self, writer): writer.write("<?%s %s?>" % (self.target, self.data))
291ed4fb3f9b6cc7697c7ac8c0c70ecdc5e245e2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/291ed4fb3f9b6cc7697c7ac8c0c70ecdc5e245e2/minidom.py
f = file(fullname, "rU")
f = open(fullname, "rU")
def addpackage(sitedir, name, known_paths): """Add a new path to known_paths by combining sitedir and 'name' or execute sitedir if it starts with 'import'""" if known_paths is None: _init_pathinfo() reset = 1 else: reset = 0 fullname = os.path.join(sitedir, name) try: f = file(fullname, "rU") except IOError: return try...
4d0bddfee66383e746a79d60cd64e40fc1ab1df7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4d0bddfee66383e746a79d60cd64e40fc1ab1df7/site.py
d = _init_pathinfo()
known_paths = _init_pathinfo()
def addsitedir(sitedir, known_paths=None): """Add 'sitedir' argument to sys.path if missing and handle .pth files in 'sitedir'""" if known_paths is None: d = _init_pathinfo() reset = 1 else: reset = 0 sitedir, sitedircase = makepath(sitedir) if not sitedircase in known_paths: sys.path.append(sitedir) # Add path ...
4d0bddfee66383e746a79d60cd64e40fc1ab1df7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4d0bddfee66383e746a79d60cd64e40fc1ab1df7/site.py
if name[-4:] == os.extsep + "pth":
if name.endswith(os.extsep + "pth"):
def addsitedir(sitedir, known_paths=None): """Add 'sitedir' argument to sys.path if missing and handle .pth files in 'sitedir'""" if known_paths is None: d = _init_pathinfo() reset = 1 else: reset = 0 sitedir, sitedircase = makepath(sitedir) if not sitedircase in known_paths: sys.path.append(sitedir) # Add path ...
4d0bddfee66383e746a79d60cd64e40fc1ab1df7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4d0bddfee66383e746a79d60cd64e40fc1ab1df7/site.py
compiler = self.compiler
def build_libraries (self, libraries):
f4aa684132a2752118af9a2412f0acc90c258035 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f4aa684132a2752118af9a2412f0acc90c258035/build_clib.py
f2 = self.tar.extractfile("/S-SPARSE-WITH-NULLS")
f2 = self.tar.extractfile("S-SPARSE-WITH-NULLS")
def test_sparse(self): """Test sparse member extraction. """ if self.sep != "|": f1 = self.tar.extractfile("S-SPARSE") f2 = self.tar.extractfile("/S-SPARSE-WITH-NULLS") self.assert_(f1.read() == f2.read(), "_FileObject failed on sparse file member")
149a8993b0cc7a4c3a252b9387a28b8c75bc1116 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/149a8993b0cc7a4c3a252b9387a28b8c75bc1116/test_tarfile.py
filename = "/0-REGTYPE-TEXT"
filename = "0-REGTYPE-TEXT"
def test_readlines(self): """Test readlines() method of _FileObject. """ if self.sep != "|": filename = "/0-REGTYPE-TEXT" self.tar.extract(filename, dirname()) lines1 = file(os.path.join(dirname(), filename), "rU").readlines() lines2 = self.tar.extractfile(filename).readlines() self.assert_(lines1 == lines2, "_FileObje...
149a8993b0cc7a4c3a252b9387a28b8c75bc1116 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/149a8993b0cc7a4c3a252b9387a28b8c75bc1116/test_tarfile.py
filename = "/0-REGTYPE"
filename = "0-REGTYPE"
def test_seek(self): """Test seek() method of _FileObject, incl. random reading. """ if self.sep != "|": filename = "/0-REGTYPE" self.tar.extract(filename, dirname()) data = file(os.path.join(dirname(), filename), "rb").read()
149a8993b0cc7a4c3a252b9387a28b8c75bc1116 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/149a8993b0cc7a4c3a252b9387a28b8c75bc1116/test_tarfile.py
"contact_email", "licence", "classifiers",
"contact_email", "license", "classifiers",
def is_pure (self): return (self.has_pure_modules() and not self.has_ext_modules() and not self.has_c_libraries())
a52b85262ae7c0ce3ba92ee7e933f5a449690b8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a52b85262ae7c0ce3ba92ee7e933f5a449690b8c/dist.py
exts.append( Extension('_locale', ['_localemodule.c']) )
if platform in ['cygwin']: locale_libs = ['intl'] else: locale_libs = [] exts.append( Extension('_locale', ['_localemodule.c'], libraries=locale_libs ) )
def detect_modules(self): # Ensure that /usr/local is always used add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
d28216b279743ed680d84fe37da190e9754e6be4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d28216b279743ed680d84fe37da190e9754e6be4/setup.py
except socket.err, exc:
except socket.error, exc:
def test_timeout(): test_support.requires('network') if test_support.verbose: print "test_timeout ..." # A service which issues a welcome banner (without need to write # anything). # XXX ("gmail.org", 995) has been unreliable so far, from time to time # XXX non-responsive for hours on end (& across all buildbot slave...
115ecb9211ec083494d90c88dcbca2da558d1994 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/115ecb9211ec083494d90c88dcbca2da558d1994/test_socket_ssl.py
basename, ext = os.path.splitext (output_filename) output_filename = basename + '_d' + ext
def link_shared_object (self, objects, output_filename, output_dir=None, libraries=None, library_dirs=None, runtime_library_dirs=None, debug=0, extra_preargs=None, extra_postargs=None):
95c0b269de14f56a5b5d8fd0b57871b373b4b100 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/95c0b269de14f56a5b5d8fd0b57871b373b4b100/msvccompiler.py
('two', '(compound, (argument, list))',))
('two', '(compound, (argument, list))', 'compound', 'argument', 'list',))
def f5((compound, first), two): pass
4ab7adbd944c72b9f308e940524ca31a10e52bd8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4ab7adbd944c72b9f308e940524ca31a10e52bd8/test_grammar.py
child.id = None
child.my_id = None
def my_ringer(child): child.id = None stdwin.fleep()
0e71dc1106575f26cb55e55daec7c96955fffafa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0e71dc1106575f26cb55e55daec7c96955fffafa/TestSched.py
WindowSched.enter(child.my_number*1000, 0, my_ringer, child)
WindowSched.enter(child.my_number*1000, 0, my_ringer, (child,))
def my_hook(child): # schedule for the bell to ring in N seconds; cancel previous if child.my_id: WindowSched.cancel(child.my_id) child.my_id = \ WindowSched.enter(child.my_number*1000, 0, my_ringer, child)
0e71dc1106575f26cb55e55daec7c96955fffafa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0e71dc1106575f26cb55e55daec7c96955fffafa/TestSched.py
t0 = time.millitimer()
t0 = time.time()
def record(v, info, filename, audiofilename, mono, grey, greybits, \ monotreshold, fields, preallocspace): import thread format, x, y, qsize, rate = info fps = 59.64 # Fields per second # XXX (Strange: need fps of Indigo monitor, not of PAL or NTSC!) tpf = 1000.0 / fps # Time per field in msec if filename: vout = VFile...
0efafb39da32880543cd890590a4185b05040479 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0efafb39da32880543cd890590a4185b05040479/Vrec.py
def record(v, info, filename, audiofilename, mono, grey, greybits, \ monotreshold, fields, preallocspace): import thread format, x, y, qsize, rate = info fps = 59.64 # Fields per second # XXX (Strange: need fps of Indigo monitor, not of PAL or NTSC!) tpf = 1000.0 / fps # Time per field in msec if filename: vout = VFile...
0efafb39da32880543cd890590a4185b05040479 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0efafb39da32880543cd890590a4185b05040479/Vrec.py
t1 = time.millitimer()
t1 = time.time()
def record(v, info, filename, audiofilename, mono, grey, greybits, \ monotreshold, fields, preallocspace): import thread format, x, y, qsize, rate = info fps = 59.64 # Fields per second # XXX (Strange: need fps of Indigo monitor, not of PAL or NTSC!) tpf = 1000.0 / fps # Time per field in msec if filename: vout = VFile...
0efafb39da32880543cd890590a4185b05040479 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0efafb39da32880543cd890590a4185b05040479/Vrec.py
print lastid, 'fields in', t1-t0, 'msec', print '--', 0.1 * int(lastid * 10000.0 / (t1-t0)), 'fields/sec'
print lastid, 'fields in', round(t1-t0, 3), 'sec', print '--', round(lastid/(t1-t0), 1), 'fields/sec'
def record(v, info, filename, audiofilename, mono, grey, greybits, \ monotreshold, fields, preallocspace): import thread format, x, y, qsize, rate = info fps = 59.64 # Fields per second # XXX (Strange: need fps of Indigo monitor, not of PAL or NTSC!) tpf = 1000.0 / fps # Time per field in msec if filename: vout = VFile...
0efafb39da32880543cd890590a4185b05040479 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0efafb39da32880543cd890590a4185b05040479/Vrec.py
print 0.1*int(count*20000.0/(t1-t0)), 'f/s',
print round(count*2/(t1-t0), 1), 'f/s',
def record(v, info, filename, audiofilename, mono, grey, greybits, \ monotreshold, fields, preallocspace): import thread format, x, y, qsize, rate = info fps = 59.64 # Fields per second # XXX (Strange: need fps of Indigo monitor, not of PAL or NTSC!) tpf = 1000.0 / fps # Time per field in msec if filename: vout = VFile...
0efafb39da32880543cd890590a4185b05040479 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0efafb39da32880543cd890590a4185b05040479/Vrec.py
print count*200.0/lastid, '%,', print count*rate*200.0/lastid, '% of wanted rate',
print '(', print round(count*200.0/lastid), '%, or', print round(count*rate*200.0/lastid), '% of wanted rate )',
def record(v, info, filename, audiofilename, mono, grey, greybits, \ monotreshold, fields, preallocspace): import thread format, x, y, qsize, rate = info fps = 59.64 # Fields per second # XXX (Strange: need fps of Indigo monitor, not of PAL or NTSC!) tpf = 1000.0 / fps # Time per field in msec if filename: vout = VFile...
0efafb39da32880543cd890590a4185b05040479 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0efafb39da32880543cd890590a4185b05040479/Vrec.py
dict = {}
r=[]
def parse_qs(qs, keep_blank_values=0, strict_parsing=0): """Parse a query given as a string argument. Arguments: qs: URL-encoded query string to be parsed keep_blank_values: flag indicating whether blank values in URL encoded queries should be treated as blank strings. A true value inicates that blanks should be ret...
1946f0d6f22987b1616b0935f577e805ca494db8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1946f0d6f22987b1616b0935f577e805ca494db8/cgi.py
if len(value) or keep_blank_values: if dict.has_key (name): dict[name].append(value) else: dict[name] = [value] return dict
r.append(name, value) return r
def parse_qs(qs, keep_blank_values=0, strict_parsing=0): """Parse a query given as a string argument. Arguments: qs: URL-encoded query string to be parsed keep_blank_values: flag indicating whether blank values in URL encoded queries should be treated as blank strings. A true value inicates that blanks should be ret...
1946f0d6f22987b1616b0935f577e805ca494db8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1946f0d6f22987b1616b0935f577e805ca494db8/cgi.py
dict = parse_qs(qs, self.keep_blank_values, self.strict_parsing) self.list = [] for key, valuelist in dict.items(): for value in valuelist: self.list.append(MiniFieldStorage(key, value))
self.list = list = [] for key, value in parse_qsl(qs, self.keep_blank_values, self.strict_parsing): list.append(MiniFieldStorage(key, value))
def read_urlencoded(self): """Internal: read data in query string format.""" qs = self.fp.read(self.length) dict = parse_qs(qs, self.keep_blank_values, self.strict_parsing) self.list = [] for key, valuelist in dict.items(): for value in valuelist: self.list.append(MiniFieldStorage(key, value)) self.skip_lines()
1946f0d6f22987b1616b0935f577e805ca494db8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1946f0d6f22987b1616b0935f577e805ca494db8/cgi.py
elif _isfunction(v) or _isclass(v):
elif _isfunction(v) or _isclass(v) or _ismethod(v):
def run__test__(self, d, name): """d, name -> Treat dict d like module.__test__.
5f8b0b1fd4801b4808223077643c24d41130b81e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5f8b0b1fd4801b4808223077643c24d41130b81e/doctest.py
"dict must be strings, functions "
"dict must be strings, functions, methods, "
def run__test__(self, d, name): """d, name -> Treat dict d like module.__test__.
5f8b0b1fd4801b4808223077643c24d41130b81e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5f8b0b1fd4801b4808223077643c24d41130b81e/doctest.py
if verbose: print "compiling string with syntax error"
def test_complex_args(self):
exec 'def f(a, a): pass'
8a99b5023931c5a01540bda67516235a8dfe8470 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8a99b5023931c5a01540bda67516235a8dfe8470/test_compile.py
try: compile("1+*3", "filename", "exec") except SyntaxError, detail: if not detail.filename == "filename": raise TestFailed, "expected 'filename', got %r" % detail.filename
def comp_args((a, b)): return a,b self.assertEqual(comp_args((1, 2)), (1, 2))
exec 'def f(a, a): pass'
8a99b5023931c5a01540bda67516235a8dfe8470 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8a99b5023931c5a01540bda67516235a8dfe8470/test_compile.py
try: exec 'def f(a = 0, a = 1): pass' raise TestFailed, "duplicate keyword arguments" except SyntaxError: pass
def comp_args((a, b)=(3, 4)): return a, b self.assertEqual(comp_args((1, 2)), (1, 2)) self.assertEqual(comp_args(), (3, 4))
exec 'def f(a, a): pass'
8a99b5023931c5a01540bda67516235a8dfe8470 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8a99b5023931c5a01540bda67516235a8dfe8470/test_compile.py
try: exec 'def f(a): global a; a = 1' raise TestFailed, "variable is global and local" except SyntaxError: pass
def comp_args(a, (b, c)): return a, b, c self.assertEqual(comp_args(1, (2, 3)), (1, 2, 3))
exec 'def f(a = 0, a = 1): pass'
8a99b5023931c5a01540bda67516235a8dfe8470 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8a99b5023931c5a01540bda67516235a8dfe8470/test_compile.py
if verbose: print "testing complex args"
def comp_args(a=2, (b, c)=(3, 4)): return a, b, c self.assertEqual(comp_args(1, (2, 3)), (1, 2, 3)) self.assertEqual(comp_args(), (2, 3, 4))
exec 'def f(a): global a; a = 1'
8a99b5023931c5a01540bda67516235a8dfe8470 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8a99b5023931c5a01540bda67516235a8dfe8470/test_compile.py
def comp_args((a, b)): print a,b
def test_argument_order(self): try: exec 'def f(a=1, (b, c)): pass' self.fail("non-default args after default") except SyntaxError: pass
def comp_args((a, b)): print a,b
8a99b5023931c5a01540bda67516235a8dfe8470 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8a99b5023931c5a01540bda67516235a8dfe8470/test_compile.py
comp_args((1, 2))
def test_float_literals(self): self.assertRaises(SyntaxError, eval, "2e") self.assertRaises(SyntaxError, eval, "2.0e+") self.assertRaises(SyntaxError, eval, "1e-") self.assertRaises(SyntaxError, eval, "3-4e/21")
def comp_args((a, b)): print a,b
8a99b5023931c5a01540bda67516235a8dfe8470 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8a99b5023931c5a01540bda67516235a8dfe8470/test_compile.py
def comp_args((a, b)=(3, 4)): print a, b comp_args((1, 2)) comp_args() def comp_args(a, (b, c)): print a, b, c comp_args(1, (2, 3)) def comp_args(a=2, (b, c)=(3, 4)): print a, b, c comp_args(1, (2, 3)) comp_args() try: exec 'def f(a=1, (b, c)): pass' raise TestFailed, "non-default args after default" except Synta...
def test_indentation(self): s = """
def comp_args((a, b)=(3, 4)): print a, b
8a99b5023931c5a01540bda67516235a8dfe8470 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8a99b5023931c5a01540bda67516235a8dfe8470/test_compile.py
compile(s, "<string>", "exec")
compile(s, "<string>", "exec") def test_literals_with_leading_zeroes(self): for arg in ["077787", "0xj", "0x.", "0e", "090000000000000", "080000000000000", "000000000000009", "000000000000008"]: self.assertRaises(SyntaxError, eval, arg) self.assertEqual(eval("0777"), 511) self.assertEqual(eval("0777L"), 511) self.as...
def expect_error(s): try: eval(s) raise TestFailed("%r accepted" % s) except SyntaxError: pass
8a99b5023931c5a01540bda67516235a8dfe8470 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8a99b5023931c5a01540bda67516235a8dfe8470/test_compile.py
if verbose: print "testing literals with leading zeroes"
def test_main(): test_support.run_unittest(TestSpecifics)
def expect_error(s): try: eval(s) raise TestFailed("%r accepted" % s) except SyntaxError: pass
8a99b5023931c5a01540bda67516235a8dfe8470 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8a99b5023931c5a01540bda67516235a8dfe8470/test_compile.py
def expect_same(test_source, expected): got = eval(test_source) if got != expected: raise TestFailed("eval(%r) gave %r, but expected %r" % (test_source, got, expected)) expect_error("077787") expect_error("0xj") expect_error("0x.") expect_error("0e") expect_same("0777", 511) expect_same("0777L", 511) expect_same("0007...
if __name__ == "__main__": test_main()
def expect_same(test_source, expected): got = eval(test_source) if got != expected: raise TestFailed("eval(%r) gave %r, but expected %r" % (test_source, got, expected))
8a99b5023931c5a01540bda67516235a8dfe8470 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8a99b5023931c5a01540bda67516235a8dfe8470/test_compile.py
elif platform == 'cygwin': x11_inc = find_file('X11/Xlib.h', [], inc_dirs) if x11_inc is None: return
def detect_tkinter(self, inc_dirs, lib_dirs): # The _tkinter module.
9181c94e05250b8f69615a96634d55afe532e406 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9181c94e05250b8f69615a96634d55afe532e406/setup.py
_StringType = type('')
_StringTypes = (str, unicode)
def rfind(s, *args): """rfind(s, sub [,start [,end]]) -> int Return the highest index in s where substring sub is found, such that sub is contained within s[start,end]. Optional arguments start and end are interpreted as in slice notation. Return -1 on failure. """ return s.rfind(*args)
102d1208a8dcf9a502a8720fe5642ee33520d84f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/102d1208a8dcf9a502a8720fe5642ee33520d84f/string.py
if type(x) == type(''): s = x else: s = `x` n = len(s) if n >= width: return s
if not isinstance(x, _StringTypes): x = str(x) n = len(x) if n >= width: return x
def zfill(x, width): """zfill(x, width) -> string Pad a numeric string x with zeros on the left, to fill a field of the specified width. The string x is never truncated. """ if type(x) == type(''): s = x else: s = `x` n = len(s) if n >= width: return s sign = '' if s[0] in ('-', '+'): sign, s = s[0], s[1:] return si...
102d1208a8dcf9a502a8720fe5642ee33520d84f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/102d1208a8dcf9a502a8720fe5642ee33520d84f/string.py
if s[0] in ('-', '+'): sign, s = s[0], s[1:] return sign + '0'*(width-n) + s
if x[0] in '-+': sign, x = x[0], x[1:] return sign + '0'*(width-n) + x
def zfill(x, width): """zfill(x, width) -> string Pad a numeric string x with zeros on the left, to fill a field of the specified width. The string x is never truncated. """ if type(x) == type(''): s = x else: s = `x` n = len(s) if n >= width: return s sign = '' if s[0] in ('-', '+'): sign, s = s[0], s[1:] return si...
102d1208a8dcf9a502a8720fe5642ee33520d84f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/102d1208a8dcf9a502a8720fe5642ee33520d84f/string.py
global DEBUG DEBUG=1
def main(): global DEBUG DEBUG=1 # Find the template # (there's no point in proceeding if we can't find it) template = findtemplate() if DEBUG: print 'Using template', template # Ask for source text if not specified in sys.argv[1:] if not sys.argv[1:]: srcfss, ok = macfs.PromptGetFile('Select Python source file:', ...
f428c9e3173b18eb5bf019769064be196e77914e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f428c9e3173b18eb5bf019769064be196e77914e/BuildApplet.py
directory already exists, return silently. Raise DistutilsFileError if unable to create some directory along the way (eg. some sub-path exists, but is a file rather than a directory). If 'verbose' is true, print a one-line summary of each mkdir to stdout."""
directory already exists (or if 'name' is the empty string, which means the current directory, which of course exists), then do nothing. Raise DistutilsFileError if unable to create some directory along the way (eg. some sub-path exists, but is a file rather than a directory). If 'verbose' is true, print a one-line s...
def mkpath (name, mode=0777, verbose=0, dry_run=0): """Create a directory and any missing ancestor directories. If the directory already exists, return silently. Raise DistutilsFileError if unable to create some directory along the way (eg. some sub-path exists, but is a file rather than a directory). If 'verbose' i...
739d06689dfd37e9233599c3fd95852bb96f71a1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/739d06689dfd37e9233599c3fd95852bb96f71a1/util.py
except os.error, (errno, errstr):
except OSError, exc:
def mkpath (name, mode=0777, verbose=0, dry_run=0): """Create a directory and any missing ancestor directories. If the directory already exists, return silently. Raise DistutilsFileError if unable to create some directory along the way (eg. some sub-path exists, but is a file rather than a directory). If 'verbose' i...
739d06689dfd37e9233599c3fd95852bb96f71a1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/739d06689dfd37e9233599c3fd95852bb96f71a1/util.py
"could not create '%s': %s" % (head, errstr)
"could not create '%s': %s" % (head, exc[-1])
def mkpath (name, mode=0777, verbose=0, dry_run=0): """Create a directory and any missing ancestor directories. If the directory already exists, return silently. Raise DistutilsFileError if unable to create some directory along the way (eg. some sub-path exists, but is a file rather than a directory). If 'verbose' i...
739d06689dfd37e9233599c3fd95852bb96f71a1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/739d06689dfd37e9233599c3fd95852bb96f71a1/util.py
def __init__(self, filename=None, mode=None,
b16a3b84509f6f66f60bb3c7521b2bee70ac1b1c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b16a3b84509f6f66f60bb3c7521b2bee70ac1b1c/gzip.py
if not size:
readsize = 1024 if not size:
def read(self,size=None):
b16a3b84509f6f66f60bb3c7521b2bee70ac1b1c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b16a3b84509f6f66f60bb3c7521b2bee70ac1b1c/gzip.py
self._read()
self._read(readsize) readsize = readsize * 2
def read(self,size=None):
b16a3b84509f6f66f60bb3c7521b2bee70ac1b1c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b16a3b84509f6f66f60bb3c7521b2bee70ac1b1c/gzip.py
else:
else:
def read(self,size=None):
b16a3b84509f6f66f60bb3c7521b2bee70ac1b1c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b16a3b84509f6f66f60bb3c7521b2bee70ac1b1c/gzip.py
self._read()
self._read(readsize) readsize = readsize * 2
def read(self,size=None):
b16a3b84509f6f66f60bb3c7521b2bee70ac1b1c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b16a3b84509f6f66f60bb3c7521b2bee70ac1b1c/gzip.py
def _read(self): buf = self.fileobj.read(1024)
def _unread(self, buf): self.extrabuf = buf + self.extrabuf self.extrasize = len(buf) + self.extrasize def _read(self, size=1024): try: buf = self.fileobj.read(size) except AttributeError: raise EOFError, "Reached EOF"
def _read(self):
b16a3b84509f6f66f60bb3c7521b2bee70ac1b1c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b16a3b84509f6f66f60bb3c7521b2bee70ac1b1c/gzip.py
line=""
bufs = [] readsize = 100
def readline(self):
b16a3b84509f6f66f60bb3c7521b2bee70ac1b1c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b16a3b84509f6f66f60bb3c7521b2bee70ac1b1c/gzip.py
c = self.read(1) line = line + c if c=='\n' or c=="": break return line
c = self.read(readsize) i = string.find(c, '\n') if i >= 0 or c == '': bufs.append(c[:i]) self._unread(c[i+1:]) return string.join(bufs, '') bufs.append(c) readsize = readsize * 2
def readline(self):
b16a3b84509f6f66f60bb3c7521b2bee70ac1b1c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b16a3b84509f6f66f60bb3c7521b2bee70ac1b1c/gzip.py
L=[] line = self.readline() while line!="": L.append(line) line = self.readline() return L
buf = self.read() return string.split(buf, '\n')
def readlines(self):
b16a3b84509f6f66f60bb3c7521b2bee70ac1b1c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b16a3b84509f6f66f60bb3c7521b2bee70ac1b1c/gzip.py
This is the normal interface: it return a stripped
This is the normal interface: it returns a stripped
def getheader(self, name, default=None): """Get the header value for a name. This is the normal interface: it return a stripped version of the header value for a given header name, or None if it doesn't exist. This uses the dictionary version which finds the *last* such header. """ try: return self.dict[string.lower(...
ddf22c4243c38e819a07cbad53b8711c08e5563f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ddf22c4243c38e819a07cbad53b8711c08e5563f/rfc822.py
l.append (fd, flags)
l.append ((fd, flags))
def poll2 (timeout=0.0): import poll # timeout is in milliseconds timeout = int(timeout*1000) if socket_map: fd_map = {} for s in socket_map.keys(): fd_map[s.fileno()] = s l = [] for fd, s in fd_map.items(): flags = 0 if s.readable(): flags = poll.POLLIN if s.writable(): flags = flags | poll.POLLOUT if flags: l.append ...
2341794667e5420782fb92a2d3258ade862265eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2341794667e5420782fb92a2d3258ade862265eb/asyncore.py
tbinfo.append (
tbinfo.append ((
def compact_traceback (): t,v,tb = sys.exc_info() tbinfo = [] while 1: tbinfo.append ( tb.tb_frame.f_code.co_filename, tb.tb_frame.f_code.co_name, str(tb.tb_lineno) ) tb = tb.tb_next if not tb: break # just to be safe del tb file, function, line = tbinfo[-1] info = '[' + string.join ( map ( lambda x: string.join (x, ...
2341794667e5420782fb92a2d3258ade862265eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2341794667e5420782fb92a2d3258ade862265eb/asyncore.py
tb.tb_frame.f_code.co_name,
tb.tb_frame.f_code.co_name,
def compact_traceback (): t,v,tb = sys.exc_info() tbinfo = [] while 1: tbinfo.append ( tb.tb_frame.f_code.co_filename, tb.tb_frame.f_code.co_name, str(tb.tb_lineno) ) tb = tb.tb_next if not tb: break # just to be safe del tb file, function, line = tbinfo[-1] info = '[' + string.join ( map ( lambda x: string.join (x, ...
2341794667e5420782fb92a2d3258ade862265eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2341794667e5420782fb92a2d3258ade862265eb/asyncore.py
)
))
def compact_traceback (): t,v,tb = sys.exc_info() tbinfo = [] while 1: tbinfo.append ( tb.tb_frame.f_code.co_filename, tb.tb_frame.f_code.co_name, str(tb.tb_lineno) ) tb = tb.tb_next if not tb: break # just to be safe del tb file, function, line = tbinfo[-1] info = '[' + string.join ( map ( lambda x: string.join (x, ...
2341794667e5420782fb92a2d3258ade862265eb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2341794667e5420782fb92a2d3258ade862265eb/asyncore.py
self.tabCols=IntVar(self)
def CreatePageFontTab(self): #tkVars self.fontSize=StringVar(self) self.fontBold=BooleanVar(self) self.fontName=StringVar(self) self.spaceNum=IntVar(self) self.tabCols=IntVar(self) self.indentBySpaces=BooleanVar(self) self.editFont=tkFont.Font(self,('courier',12,'normal')) ##widget creation #body frame frame=self.tabPa...
9d142adfce027096a5c80dcaf7193b510cf7f984 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9d142adfce027096a5c80dcaf7193b510cf7f984/configDialog.py
orient='horizontal',tickinterval=2,from_=2,to=8)
orient='horizontal',tickinterval=2,from_=2,to=10)
def CreatePageFontTab(self): #tkVars self.fontSize=StringVar(self) self.fontBold=BooleanVar(self) self.fontName=StringVar(self) self.spaceNum=IntVar(self) self.tabCols=IntVar(self) self.indentBySpaces=BooleanVar(self) self.editFont=tkFont.Font(self,('courier',12,'normal')) ##widget creation #body frame frame=self.tabPa...
9d142adfce027096a5c80dcaf7193b510cf7f984 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9d142adfce027096a5c80dcaf7193b510cf7f984/configDialog.py
self.tabCols.trace_variable('w',self.VarChanged_tabCols)
def AttachVarCallbacks(self): self.fontSize.trace_variable('w',self.VarChanged_fontSize) self.fontName.trace_variable('w',self.VarChanged_fontName) self.fontBold.trace_variable('w',self.VarChanged_fontBold) self.spaceNum.trace_variable('w',self.VarChanged_spaceNum) self.tabCols.trace_variable('w',self.VarChanged_tabCol...
9d142adfce027096a5c80dcaf7193b510cf7f984 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9d142adfce027096a5c80dcaf7193b510cf7f984/configDialog.py
def VarChanged_tabCols(self,*params): value=self.tabCols.get() self.AddChangedItem('main','Indent','tab-cols',value)
def VarChanged_tabCols(self,*params): value=self.tabCols.get() self.AddChangedItem('main','Indent','tab-cols',value)
9d142adfce027096a5c80dcaf7193b510cf7f984 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9d142adfce027096a5c80dcaf7193b510cf7f984/configDialog.py
if sys.argv[-1] == "Release":
if sys.argv[1] == "Release":
def main(): build_all = "-a" in sys.argv if sys.argv[-1] == "Release": arch = "x86" debug = False configure = "VC-WIN32" makefile = "32.mak" elif sys.argv[-1] == "Debug": arch = "x86" debug = True configure = "VC-WIN32" makefile="d32.mak" elif sys.argv[-1] == "ReleaseItanium": arch = "ia64" debug = False configure = "V...
c7990b5b985d5619478b184acd62c49b2a4f24e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c7990b5b985d5619478b184acd62c49b2a4f24e6/build_ssl.py
elif sys.argv[-1] == "Debug":
elif sys.argv[1] == "Debug":
def main(): build_all = "-a" in sys.argv if sys.argv[-1] == "Release": arch = "x86" debug = False configure = "VC-WIN32" makefile = "32.mak" elif sys.argv[-1] == "Debug": arch = "x86" debug = True configure = "VC-WIN32" makefile="d32.mak" elif sys.argv[-1] == "ReleaseItanium": arch = "ia64" debug = False configure = "V...
c7990b5b985d5619478b184acd62c49b2a4f24e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c7990b5b985d5619478b184acd62c49b2a4f24e6/build_ssl.py
elif sys.argv[-1] == "ReleaseItanium":
elif sys.argv[1] == "ReleaseItanium":
def main(): build_all = "-a" in sys.argv if sys.argv[-1] == "Release": arch = "x86" debug = False configure = "VC-WIN32" makefile = "32.mak" elif sys.argv[-1] == "Debug": arch = "x86" debug = True configure = "VC-WIN32" makefile="d32.mak" elif sys.argv[-1] == "ReleaseItanium": arch = "ia64" debug = False configure = "V...
c7990b5b985d5619478b184acd62c49b2a4f24e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c7990b5b985d5619478b184acd62c49b2a4f24e6/build_ssl.py
elif sys.argv[-1] == "ReleaseAMD64":
elif sys.argv[1] == "ReleaseAMD64":
def main(): build_all = "-a" in sys.argv if sys.argv[-1] == "Release": arch = "x86" debug = False configure = "VC-WIN32" makefile = "32.mak" elif sys.argv[-1] == "Debug": arch = "x86" debug = True configure = "VC-WIN32" makefile="d32.mak" elif sys.argv[-1] == "ReleaseItanium": arch = "ia64" debug = False configure = "V...
c7990b5b985d5619478b184acd62c49b2a4f24e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c7990b5b985d5619478b184acd62c49b2a4f24e6/build_ssl.py
eq(int(time.mktime(timetup)), 1044470846)
t = int(time.mktime(timetup)) eq(time.localtime(t)[:6], timetup[:6])
def test_parsedate_acceptable_to_time_functions(self): eq = self.assertEqual timetup = Utils.parsedate('5 Feb 2003 13:47:26 -0800') eq(int(time.mktime(timetup)), 1044470846) eq(int(time.strftime('%Y', timetup)), 2003) timetup = Utils.parsedate_tz('5 Feb 2003 13:47:26 -0800') eq(int(time.mktime(timetup[:9])), 1044470846...
e3dd5b2c87dbab223d32fae544595cc5b54baf69 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e3dd5b2c87dbab223d32fae544595cc5b54baf69/test_email.py
eq(int(time.mktime(timetup[:9])), 1044470846)
t = int(time.mktime(timetup[:9])) eq(time.localtime(t)[:6], timetup[:6])
def test_parsedate_acceptable_to_time_functions(self): eq = self.assertEqual timetup = Utils.parsedate('5 Feb 2003 13:47:26 -0800') eq(int(time.mktime(timetup)), 1044470846) eq(int(time.strftime('%Y', timetup)), 2003) timetup = Utils.parsedate_tz('5 Feb 2003 13:47:26 -0800') eq(int(time.mktime(timetup[:9])), 1044470846...
e3dd5b2c87dbab223d32fae544595cc5b54baf69 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e3dd5b2c87dbab223d32fae544595cc5b54baf69/test_email.py
if type(f) == type(''):
if isinstance(f, basestring):
def __init__(self, f): self._i_opened_the_file = None if type(f) == type(''): f = __builtin__.open(f, 'rb') self._i_opened_the_file = f # else, assume it is an open file object already self.initfp(f)
0e67fd478f04d8634ea1e196e6ade2c4394984ee /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0e67fd478f04d8634ea1e196e6ade2c4394984ee/wave.py
if type(f) == type(''):
if isinstance(f, basestring):
def __init__(self, f): self._i_opened_the_file = None if type(f) == type(''): f = __builtin__.open(f, 'wb') self._i_opened_the_file = f self.initfp(f)
0e67fd478f04d8634ea1e196e6ade2c4394984ee /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0e67fd478f04d8634ea1e196e6ade2c4394984ee/wave.py
return self._qsize - self.getfilled()
return (self._qsize / self._nchannels / self._sampwidth) - self.getfilled()
def getfillable(self): return self._qsize - self.getfilled()
195e33efa29db8eb4c5350572b5c92394db0c4a0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/195e33efa29db8eb4c5350572b5c92394db0c4a0/Audio_mac.py
self._link(body, headers, include_dirs, libraries, library_dirs, lang)
src, obj, exe = self._link(body, headers, include_dirs, libraries, library_dirs, lang)
def try_run (self, body, headers=None, include_dirs=None, libraries=None, library_dirs=None, lang="c"): """Try to compile, link to an executable, and run a program built from 'body' and 'headers'. Return true on success, false otherwise. """ from distutils.ccompiler import CompileError, LinkError self._check_compiler(...
246c425964ba742db85076538f14e206a90706b8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/246c425964ba742db85076538f14e206a90706b8/config.py
"timzone value not set to -1")
"timezone value not set to -1")
def test_timezone(self): # Test timezone directives. # When gmtime() is used with %Z, entire result of strftime() is empty. # Check for equal timezone names deals with bad locale info when this # occurs; first found in FreeBSD 4.4. strp_output = _strptime.strptime("UTC", "%Z") self.failUnlessEqual(strp_output.tm_isdst,...
3106817c68a79c5e718ff61db34b7d363724ffd5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3106817c68a79c5e718ff61db34b7d363724ffd5/test_strptime.py
__slots__ = ('_exp','_int','_sign') def __init__(self, value="0", context=None):
__slots__ = ('_exp','_int','_sign', '_is_special') def __new__(cls, value="0", context=None):
def setcontext(context, _local=local): """Set this thread's context to context.""" if context in (DefaultContext, BasicContext, ExtendedContext): context = context.copy() context.clear_flags() _local.__decimal_context__ = context
636a6b100fe6083388bc5315758326078abe65b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/636a6b100fe6083388bc5315758326078abe65b4/decimal.py
if context is None: context = getcontext()
self = object.__new__(cls) self._is_special = False if isinstance(value, _WorkRep): if value.sign == 1: self._sign = 0 else: self._sign = 1 self._int = tuple(map(int, str(value.int))) self._exp = int(value.exp) return self if isinstance(value, Decimal): self._exp = value._exp self._sign = value._sign self._int =...
def __init__(self, value="0", context=None): """Create a decimal point instance.
636a6b100fe6083388bc5315758326078abe65b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/636a6b100fe6083388bc5315758326078abe65b4/decimal.py
value = str(value) if isinstance(value, basestring): if _isinfinity(value): self._exp = 'F' self._int = (0,) sign = _isinfinity(value) if sign == 1: self._sign = 0 else: self._sign = 1 return if _isnan(value): sig, sign, diag = _isnan(value) if len(diag) > context.prec: self._sign, self._int, self._exp = \ context._...
if value >= 0: self._sign = 0 else: self._sign = 1 self._exp = 0 self._int = tuple(map(int, str(abs(value)))) return self
def __init__(self, value="0", context=None): """Create a decimal point instance.
636a6b100fe6083388bc5315758326078abe65b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/636a6b100fe6083388bc5315758326078abe65b4/decimal.py
return if isinstance(value, _WorkRep): if value.sign == 1: self._sign = 0 else: self._sign = 1 self._int = tuple(value.int) self._exp = int(value.exp) return if isinstance(value, Decimal): self._exp = value._exp self._sign = value._sign self._int = value._int return
return self
def __init__(self, value="0", context=None): """Create a decimal point instance.
636a6b100fe6083388bc5315758326078abe65b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/636a6b100fe6083388bc5315758326078abe65b4/decimal.py
raise TypeError("Cannot convert %r" % value) def _convert_other(self, other): """Convert other to Decimal. Verifies that it's ok to use in an implicit construction. """ if isinstance(other, Decimal): return other if isinstance(other, (int, long)): other = Decimal(other) return other raise TypeError, "You can interac...
if context is None: context = getcontext() if isinstance(value, basestring): if _isinfinity(value): self._exp = 'F' self._int = (0,) self._is_special = True if _isinfinity(value) == 1: self._sign = 0 else: self._sign = 1 return self if _isnan(value): sig, sign, diag = _isnan(value) self._is_special = True if len(di...
def __init__(self, value="0", context=None): """Create a decimal point instance.
636a6b100fe6083388bc5315758326078abe65b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/636a6b100fe6083388bc5315758326078abe65b4/decimal.py
if self._exp == 'n': return 1 elif self._exp == 'N': return 2
if self._is_special: exp = self._exp if exp == 'n': return 1 elif exp == 'N': return 2
def _isnan(self): """Returns whether the number is not actually one.
636a6b100fe6083388bc5315758326078abe65b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/636a6b100fe6083388bc5315758326078abe65b4/decimal.py
if context is None: context = getcontext() if self._isnan() == 2: return context._raise_error(InvalidOperation, 'sNaN', 1, self) if other is not None and other._isnan() == 2: return context._raise_error(InvalidOperation, 'sNaN', 1, other) if self._isnan(): return self if other is not None and other._isnan():
self_is_nan = self._isnan() if other is None: other_is_nan = False else: other_is_nan = other._isnan() if self_is_nan or other_is_nan: if context is None: context = getcontext() if self_is_nan == 2: return context._raise_error(InvalidOperation, 'sNaN', 1, self) if other_is_nan == 2: return context._raise_error(Inval...
def _check_nans(self, other = None, context=None): """Returns whether the number is not actually one.
636a6b100fe6083388bc5315758326078abe65b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/636a6b100fe6083388bc5315758326078abe65b4/decimal.py
if isinstance(self._exp, str):
if self._is_special:
def __nonzero__(self): """Is the number non-zero?
636a6b100fe6083388bc5315758326078abe65b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/636a6b100fe6083388bc5315758326078abe65b4/decimal.py
return self._int != (0,)*len(self._int)
return sum(self._int) != 0
def __nonzero__(self): """Is the number non-zero?
636a6b100fe6083388bc5315758326078abe65b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/636a6b100fe6083388bc5315758326078abe65b4/decimal.py
if context is None: context = getcontext() other = self._convert_other(other) ans = self._check_nans(other, context) if ans: return 1
other = _convert_other(other) if self._is_special or other._is_special: ans = self._check_nans(other, context) if ans: return 1 return cmp(self._isinfinity(), other._isinfinity())
def __cmp__(self, other, context=None): if context is None: context = getcontext() other = self._convert_other(other)
636a6b100fe6083388bc5315758326078abe65b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/636a6b100fe6083388bc5315758326078abe65b4/decimal.py
if self._isinfinity() and other._isinfinity(): return 0 if self._isinfinity(): return (-1)**self._sign if other._isinfinity(): return -((-1)**other._sign) if self.adjusted() == other.adjusted() and \
self_adjusted = self.adjusted() other_adjusted = other.adjusted() if self_adjusted == other_adjusted and \
def __cmp__(self, other, context=None): if context is None: context = getcontext() other = self._convert_other(other)
636a6b100fe6083388bc5315758326078abe65b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/636a6b100fe6083388bc5315758326078abe65b4/decimal.py
elif self.adjusted() > other.adjusted() and self._int[0] != 0:
elif self_adjusted > other_adjusted and self._int[0] != 0:
def __cmp__(self, other, context=None): if context is None: context = getcontext() other = self._convert_other(other)
636a6b100fe6083388bc5315758326078abe65b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/636a6b100fe6083388bc5315758326078abe65b4/decimal.py
elif self.adjusted < other.adjusted() and other._int[0] != 0:
elif self_adjusted < other_adjusted and other._int[0] != 0:
def __cmp__(self, other, context=None): if context is None: context = getcontext() other = self._convert_other(other)
636a6b100fe6083388bc5315758326078abe65b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/636a6b100fe6083388bc5315758326078abe65b4/decimal.py
if context is None: context = getcontext() other = self._convert_other(other)
other = _convert_other(other)
def compare(self, other, context=None): """Compares one to another.
636a6b100fe6083388bc5315758326078abe65b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/636a6b100fe6083388bc5315758326078abe65b4/decimal.py
ans = self._check_nans(other, context) if ans: return ans
if (self._is_special or other and other._is_special): ans = self._check_nans(other, context) if ans: return ans
def compare(self, other, context=None): """Compares one to another.
636a6b100fe6083388bc5315758326078abe65b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/636a6b100fe6083388bc5315758326078abe65b4/decimal.py
if context is None: context = getcontext()
def to_eng_string(self, context=None): """Convert to engineering-type string.
636a6b100fe6083388bc5315758326078abe65b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/636a6b100fe6083388bc5315758326078abe65b4/decimal.py
if context is None: context = getcontext() ans = self._check_nans(context=context) if ans: return ans
if self._is_special: ans = self._check_nans(context=context) if ans: return ans
def __neg__(self, context=None): """Returns a copy with the sign switched.
636a6b100fe6083388bc5315758326078abe65b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/636a6b100fe6083388bc5315758326078abe65b4/decimal.py
if context is None: context = getcontext() ans = self._check_nans(context=context) if ans: return ans
if self._is_special: ans = self._check_nans(context=context) if ans: return ans
def __pos__(self, context=None): """Returns a copy, unless it is a sNaN.
636a6b100fe6083388bc5315758326078abe65b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/636a6b100fe6083388bc5315758326078abe65b4/decimal.py