bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def main(): global new_interpreter usage = ('usage: %s -i /interpreter file-or-directory ...\n' % sys.argv[0]) try: opts, args = getopt.getopt(sys.argv[1:], 'i:') except getopt.error as msg: err(msg + '\n') err(usage) sys.exit(2) for o, a in opts: if o == '-i': new_interpreter = a.encode() if not new_interpreter or not... | def main(): global new_interpreter usage = ('usage: %s -i /interpreter file-or-directory ...\n' % sys.argv[0]) try: opts, args = getopt.getopt(sys.argv[1:], 'i:p') except getopt.error as msg: err(msg + '\n') err(usage) sys.exit(2) for o, a in opts: if o == '-i': new_interpreter = a.encode() if not new_interpreter or no... | 456,300 |
def main(): global new_interpreter usage = ('usage: %s -i /interpreter file-or-directory ...\n' % sys.argv[0]) try: opts, args = getopt.getopt(sys.argv[1:], 'i:') except getopt.error as msg: err(msg + '\n') err(usage) sys.exit(2) for o, a in opts: if o == '-i': new_interpreter = a.encode() if not new_interpreter or not... | def main(): global new_interpreter usage = ('usage: %s -i /interpreter file-or-directory ...\n' % sys.argv[0]) try: opts, args = getopt.getopt(sys.argv[1:], 'i:') except getopt.error as msg: err(str(msg) + '\n') err(usage) sys.exit(2) for o, a in opts: if o == '-i': new_interpreter = a.encode() if not new_interpreter o... | 456,301 |
def __init__(self, sock=None, keyfile=None, certfile=None, server_side=False, cert_reqs=CERT_NONE, ssl_version=PROTOCOL_SSLv23, ca_certs=None, do_handshake_on_connect=True, family=AF_INET, type=SOCK_STREAM, proto=0, fileno=None, suppress_ragged_eofs=True, ciphers=None): | def __init__(self, sock=None, keyfile=None, certfile=None, server_side=False, cert_reqs=CERT_NONE, ssl_version=PROTOCOL_SSLv23, ca_certs=None, do_handshake_on_connect=True, family=AF_INET, type=SOCK_STREAM, proto=0, fileno=None, suppress_ragged_eofs=True, ciphers=None): | 456,302 |
def __init__(self, sock=None, keyfile=None, certfile=None, server_side=False, cert_reqs=CERT_NONE, ssl_version=PROTOCOL_SSLv23, ca_certs=None, do_handshake_on_connect=True, family=AF_INET, type=SOCK_STREAM, proto=0, fileno=None, suppress_ragged_eofs=True, ciphers=None): | def __init__(self, sock=None, keyfile=None, certfile=None, server_side=False, cert_reqs=CERT_NONE, ssl_version=PROTOCOL_SSLv23, ca_certs=None, do_handshake_on_connect=True, family=AF_INET, type=SOCK_STREAM, proto=0, fileno=None, suppress_ragged_eofs=True, ciphers=None): | 456,303 |
def _check_duration(option, opt, value): try: if value[-1].isdigit(): return int(value) else: return int(value[:-1]) * _time_units[value[-1]] except ValueError, IndexError: raise OptionValueError( 'option %s: invalid duration: %r' % (opt, value)) | def _check_duration(option, opt, value): try: if value[-1].isdigit(): return int(value) else: return int(value[:-1]) * _time_units[value[-1]] except (ValueError, IndexError): raise OptionValueError( 'option %s: invalid duration: %r' % (opt, value)) | 456,304 |
def __call__(self, parser, namespace, values, option_string=None): parser_name = values[0] arg_strings = values[1:] | def __call__(self, parser, namespace, values, option_string=None): parser_name = values[0] arg_strings = values[1:] | 456,305 |
def __call__(self, string): # the special argument "-" means sys.std{in,out} if string == '-': if 'r' in self._mode: return _sys.stdin elif 'w' in self._mode: return _sys.stdout else: msg = _('argument "-" with mode %r' % self._mode) raise ValueError(msg) | def __call__(self, string): # the special argument "-" means sys.std{in,out} if string == '-': if 'r' in self._mode: return _sys.stdin elif 'w' in self._mode: return _sys.stdout else: msg = _('argument "-" with mode %r') % self._mode raise ValueError(msg) | 456,306 |
def f(x, y): x // y | def f(x, y): x // y | 456,307 |
def run_command(code): p = subprocess.Popen([sys.executable, "-c", code], stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = p.communicate() self.assertEqual(p.returncode, 0) self.assertEqual(stdout.strip(), b"") return strip_python_stderr(stderr) | def run_command(code): p = subprocess.Popen([sys.executable, "-c", code], stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = p.communicate() self.assertEqual(p.returncode, 0) self.assertEqual(stdout.strip(), b"") return strip_python_stderr(stderr) | 456,308 |
def run_command(code): p = subprocess.Popen([sys.executable, "-c", code], stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = p.communicate() self.assertEqual(p.returncode, 0) self.assertEqual(stdout.strip(), b"") return strip_python_stderr(stderr) | def run_command(code): p = subprocess.Popen([sys.executable, "-c", code], stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = p.communicate() self.assertEqual(p.returncode, 0) self.assertEqual(stdout.strip(), b"") return strip_python_stderr(stderr) | 456,309 |
def format_date_time(timestamp): year, month, day, hh, mm, ss, wd, y, z = time.gmtime(timestamp) return "%s, %02d %3s %4d %02d:%02d:%02d GMT" % ( _weekdayname[wd], day, _monthname[month], year, hh, mm, ss ) | def format_date_time(timestamp): year, month, day, hh, mm, ss, wd, y, z = time.gmtime(timestamp) return "%s, %02d %3s %4d %02d:%02d:%02d GMT" % ( _weekdayname[wd], day, _monthname[month], year, hh, mm, ss ) | 456,310 |
def test_richcompare(self): self.assertRaises(OverflowError, complex.__eq__, 1+1j, 1<<10000) self.assertIs(complex.__lt__(1+1j, None), NotImplemented) self.assertIs(complex.__eq__(1+1j, 1+1j), True) self.assertIs(complex.__eq__(1+1j, 2+2j), False) self.assertIs(complex.__ne__(1+1j, 1+1j), False) self.assertIs(complex._... | def test_richcompare(self): self.assertIs(complex.__eq__(1+1j, 1<<10000), False) self.assertIs(complex.__lt__(1+1j, None), NotImplemented) self.assertIs(complex.__eq__(1+1j, 1+1j), True) self.assertIs(complex.__eq__(1+1j, 2+2j), False) self.assertIs(complex.__ne__(1+1j, 1+1j), False) self.assertIs(complex.__ne__(1+1j, ... | 456,311 |
def test_strict(self): for orig, expect in parse_strict_test_cases: # Test basic parsing d = do_test(orig, "GET") self.assertEqual(d, expect, "Error parsing %s" % repr(orig)) d = do_test(orig, "POST") self.assertEqual(d, expect, "Error parsing %s" % repr(orig)) | def test_strict(self): for orig, expect in parse_strict_test_cases: # Test basic parsing d = do_test(orig, "GET") self.assertEqual(d, expect, "Error parsing %s" % repr(orig)) d = do_test(orig, "POST") self.assertEqual(d, expect, "Error parsing %s" % repr(orig)) | 456,312 |
def test_strict(self): for orig, expect in parse_strict_test_cases: # Test basic parsing d = do_test(orig, "GET") self.assertEqual(d, expect, "Error parsing %s" % repr(orig)) d = do_test(orig, "POST") self.assertEqual(d, expect, "Error parsing %s" % repr(orig)) | def test_strict(self): for orig, expect in parse_strict_test_cases: # Test basic parsing d = do_test(orig, "GET") self.assertEqual(d, expect, "Error parsing %s" % repr(orig)) d = do_test(orig, "POST") self.assertEqual(d, expect, "Error parsing %s" % repr(orig)) | 456,313 |
def _mac_ver_xml(): fn = '/System/Library/CoreServices/SystemVersion.plist' if not os.path.exists(fn): return None try: import plistlib except ImportError: return None pl = plistlib.readPlist(fn) release = pl['ProductVersion'] versioninfo=('', '', '') machine = os.uname()[4] if machine == 'ppc': # for compatibility w... | def _mac_ver_xml(): fn = '/System/Library/CoreServices/SystemVersion.plist' if not os.path.exists(fn): return None try: import plistlib except ImportError: return None pl = plistlib.readPlist(fn) release = pl['ProductVersion'] versioninfo=('', '', '') machine = os.uname()[4] if machine in ('ppc', 'Power Macintosh'): ... | 456,314 |
def test_functions(self): # Check presence of all functions funcs = [] for suffix in "base64", "hqx", "uu", "hex": prefixes = ["a2b_", "b2a_"] if suffix == "hqx": prefixes.extend(["crc_", "rlecode_", "rledecode_"]) for prefix in prefixes: name = prefix + suffix self.assert_(callable(getattr(binascii, name))) self.asser... | def test_functions(self): # Check presence of all functions funcs = [] for suffix in "base64", "hqx", "uu", "hex": prefixes = ["a2b_", "b2a_"] if suffix == "hqx": prefixes.extend(["crc_", "rlecode_", "rledecode_"]) for prefix in prefixes: name = prefix + suffix self.assertTrue(hasattr(getattr(binascii, name), '__call__... | 456,315 |
def test_functions(self): # Check presence of all functions funcs = [] for suffix in "base64", "hqx", "uu", "hex": prefixes = ["a2b_", "b2a_"] if suffix == "hqx": prefixes.extend(["crc_", "rlecode_", "rledecode_"]) for prefix in prefixes: name = prefix + suffix self.assert_(callable(getattr(binascii, name))) self.asser... | def test_functions(self): # Check presence of all functions funcs = [] for suffix in "base64", "hqx", "uu", "hex": prefixes = ["a2b_", "b2a_"] if suffix == "hqx": prefixes.extend(["crc_", "rlecode_", "rledecode_"]) for prefix in prefixes: name = prefix + suffix self.assertTrue(hasattr(getattr(binascii, name), '__call__... | 456,316 |
def test_registry(self): class myexceltsv(csv.excel): delimiter = "\t" name = "myexceltsv" expected_dialects = csv.list_dialects() + [name] expected_dialects.sort() csv.register_dialect(name, myexceltsv) try: self.assertTrue(csv.get_dialect(name).delimiter, '\t') got_dialects = csv.list_dialects() got_dialects.sort() s... | def test_registry(self): class myexceltsv(csv.excel): delimiter = "\t" name = "myexceltsv" expected_dialects = csv.list_dialects() + [name] expected_dialects.sort() csv.register_dialect(name, myexceltsv) try: self.assertTrue(csv.get_dialect(name).delimiter, '\t') got_dialects = csv.list_dialects() got_dialects.sort() s... | 456,317 |
def test_register_kwargs(self): name = 'fedcba' csv.register_dialect(name, delimiter=';') try: self.assertTrue(csv.get_dialect(name).delimiter, '\t') self.assertTrue(list(csv.reader('X;Y;Z', name)), ['X', 'Y', 'Z']) finally: csv.unregister_dialect(name) | def test_register_kwargs(self): name = 'fedcba' csv.register_dialect(name, delimiter=';') try: self.assertTrue(csv.get_dialect(name).delimiter, '\t') self.assertTrue(list(csv.reader('X;Y;Z', name)), ['X', 'Y', 'Z']) finally: csv.unregister_dialect(name) | 456,318 |
def __init__(self, buffer, encoding=None, errors=None, newline=None, line_buffering=False): if newline is not None and not isinstance(newline, basestring): raise TypeError("illegal newline type: %r" % (type(newline),)) if newline not in (None, "", "\n", "\r", "\r\n"): raise ValueError("illegal newline value: %r" % (new... | def __init__(self, buffer, encoding=None, errors=None, newline=None, line_buffering=False): if newline is not None and not isinstance(newline, basestring): raise TypeError("illegal newline type: %r" % (type(newline),)) if newline not in (None, "", "\n", "\r", "\r\n"): raise ValueError("illegal newline value: %r" % (new... | 456,319 |
def _dumps(object, protocol): return cPickle.dumps(object, bin=protocol) | def _dumps(object, protocol): return cPickle.dumps(object, bin=protocol) | 456,320 |
def open(filename, flags=db.DB_CREATE, mode=0660, filetype=db.DB_HASH, dbenv=None, dbname=None): """ A simple factory function for compatibility with the standard shleve.py module. It can be used like this, where key is a string and data is a pickleable object: from bsddb import dbshelve db = dbshelve.open(filename) ... | def open(filename, flags=db.DB_CREATE, mode=0660, filetype=db.DB_HASH, dbenv=None, dbname=None): """ A simple factory function for compatibility with the standard shleve.py module. It can be used like this, where key is a string and data is a pickleable object: from bsddb import dbshelve db = dbshelve.open(filename) ... | 456,321 |
def keys(self, txn=None): if txn is not None: return self.db.keys(txn) else: return self.db.keys() | def keys(self, txn=None): if txn is not None: return self.db.keys(txn) else: return self.db.keys() | 456,322 |
def test_issue4228(self): # Packing a long may yield either 32 or 64 bits with _check_py3k_warnings(("struct integer overflow masking is deprecated", DeprecationWarning), quiet=True): x = struct.pack('L', -1)[:4] self.assertEqual(x, '\xff'*4) | def test_issue4228(self): # Packing a long may yield either 32 or 64 bits with check_warnings(quiet=True): x = struct.pack('L', -1)[:4] self.assertEqual(x, '\xff'*4) | 456,323 |
def fcmp(x, y): # fuzzy comparison function if isinstance(x, float) or isinstance(y, float): try: fuzz = (abs(x) + abs(y)) * FUZZ if abs(x-y) <= fuzz: return 0 except: pass elif type(x) == type(y) and isinstance(x, (tuple, list)): for i in range(min(len(x), len(y))): outcome = fcmp(x[i], y[i]) if outcome != 0: return o... | def fcmp(x, y): # fuzzy comparison function if isinstance(x, float) or isinstance(y, float): try: fuzz = (abs(x) + abs(y)) * FUZZ if abs(x-y) <= fuzz: return 0 except: pass elif type(x) == type(y) and isinstance(x, (tuple, list)): for i in range(min(len(x), len(y))): outcome = fcmp(x[i], y[i]) if outcome != 0: return o... | 456,324 |
def _wait_on_event(self, handle): if sys.platform.startswith('win'): r = ctypes.windll.kernel32.WaitForSingleObject(handle, 5 * 1000) assert r == 0 else: self.CALL_LOCKS[handle].wait() | def _wait_on_event(self, handle): if sys.platform.startswith('win'): r = ctypes.windll.kernel32.WaitForSingleObject(handle, 60 * 1000) assert r == 0 else: self.CALL_LOCKS[handle].wait() | 456,325 |
def wait_test(): while not future1._waiters: pass call1.set_can() | def wait_test(): while not future1._waiters: pass call1.set_can() | 456,326 |
def test_map_timeout(self): results = [] timeout_call = MapCall() try: try: for i in self.executor.map(timeout_call, [False, False, True], timeout=1): results.append(i) except futures.TimeoutError: pass else: self.fail('expected TimeoutError') finally: timeout_call.close() | def test_map_timeout(self): results = [] timeout_call = MapCall() try: try: for i in self.executor.map(timeout_call, [False, False, True], timeout=5): results.append(i) except futures.TimeoutError: pass else: self.fail('expected TimeoutError') finally: timeout_call.close() | 456,327 |
def f(): pass | def f(): pass | 456,328 |
def test_main(verbose=None): testclasses = (EnumerateTestCase, SubclassTestCase, TestEmpty, TestBig, TestReversed) test_support.run_unittest(*testclasses) # verify reference counting import sys if verbose and hasattr(sys, "gettotalrefcount"): counts = [None] * 5 for i in xrange(len(counts)): test_support.run_unittest(... | def test_main(verbose=None): test_support.run_unittest(__name__) # verify reference counting import sys if verbose and hasattr(sys, "gettotalrefcount"): counts = [None] * 5 for i in xrange(len(counts)): test_support.run_unittest(*testclasses) counts[i] = sys.gettotalrefcount() print counts | 456,329 |
def test_main(verbose=None): testclasses = (EnumerateTestCase, SubclassTestCase, TestEmpty, TestBig, TestReversed) test_support.run_unittest(*testclasses) # verify reference counting import sys if verbose and hasattr(sys, "gettotalrefcount"): counts = [None] * 5 for i in xrange(len(counts)): test_support.run_unittest(... | def test_main(verbose=None): testclasses = (EnumerateTestCase, SubclassTestCase, TestEmpty, TestBig, TestReversed) test_support.run_unittest(*testclasses) # verify reference counting if verbose and hasattr(sys, "gettotalrefcount"): counts = [None] * 5 for i in xrange(len(counts)): test_support.run_unittest(*testclasse... | 456,330 |
def handle_command_def(self,line): """ Handles one command line during command list definition. """ cmd, arg, line = self.parseline(line) if cmd == 'silent': self.commands_silent[self.commands_bnum] = True return # continue to handle other cmd def in the cmd list elif cmd == 'end': self.cmdqueue = [] return 1 # end of ... | def handle_command_def(self,line): """Handles one command line during command list definition.""" cmd, arg, line = self.parseline(line) if cmd == 'silent': self.commands_silent[self.commands_bnum] = True return # continue to handle other cmd def in the cmd list elif cmd == 'end': self.cmdqueue = [] return 1 # end of cm... | 456,331 |
return # continue to handle other cmd def in the cmd list | return # continue to handle other cmd def in the cmd list | 456,332 |
def do_commands(self, arg): """Defines a list of commands associated to a breakpoint. | def do_commands(self, arg): """Defines a list of commands associated to a breakpoint. | 456,333 |
def get_platform (): """Return a string that identifies the current platform. This is used mainly to distinguish platform-specific build directories and platform-specific built distributions. Typically includes the OS name and version and the architecture (as supplied by 'os.uname()'), although the exact information ... | def get_platform (): """Return a string that identifies the current platform. This is used mainly to distinguish platform-specific build directories and platform-specific built distributions. Typically includes the OS name and version and the architecture (as supplied by 'os.uname()'), although the exact information ... | 456,334 |
def test_main(): support.run_unittest(FnmatchTestCase) | def test_main(): support.run_unittest(FnmatchTestCase, TranslateTestCase, FilterTestCase) | 456,335 |
def test_main(verbose=None): run_unittest(ImportTests, PycacheTests, PycRewritingTests, PathsTests, RelativeImportTests, OverridingImportBuiltinTests) | def test_main(verbose=None): run_unittest(ImportTests, PycacheTests, PycRewritingTests, PathsTests, RelativeImportTests, OverridingImportBuiltinTests, RelativeImportTests) | 456,336 |
def tearDown(self): signal.set_wakeup_fd(self.old_wakeup) os.close(self.read) os.close(self.write) signal.signal(signal.SIGALRM, self.alrm) | def tearDown(self): signal.set_wakeup_fd(self.old_wakeup) os.close(self.read) os.close(self.write) signal.signal(signal.SIGALRM, self.alrm) | 456,337 |
def test_siginterrupt_off(self): """If a signal handler is installed and siginterrupt is called with a false value for the second argument, when that signal arrives, it does not interrupt a syscall that's in progress. """ signal.siginterrupt(self.signum, 0) i = self.readpipe_interrupted() self.assertFalse(i) # Arrival ... | def@unittest.skipIf(sys.platform == "win32", "Not valid on Windows") test_siginterrupt_off(self):@unittest.skipIf(sys.platform == "win32", "Not valid on Windows") """If@unittest.skipIf(sys.platform == "win32", "Not valid on Windows") a@unittest.skipIf(sys.platform == "win32", "Not valid on Windows") signal@unittest.ski... | 456,338 |
def test_main(): support.run_unittest(BasicSignalTests, InterProcessSignalTests, WakeupSignalTests, SiginterruptTest, ItimerTest) | def test_main(): if sys.platform == "win32": support.run_unittest(WindowsSignalTests) else: support.run_unittest(BasicSignalTests, InterProcessSignalTests, WakeupSignalTests, SiginterruptTest, ItimerTest) | 456,339 |
def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple (0 is valid for *all* values). | def _bounds_checking(self, func=time.strftime): # Make sure that strftime() checks the bounds of the various parts #of the time tuple (0 is valid for *all* values). | 456,340 |
def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple (0 is valid for *all* values). | def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple (0 is valid for *all* values). | 456,341 |
def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple (0 is valid for *all* values). | def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple (0 is valid for *all* values). | 456,342 |
def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple (0 is valid for *all* values). | def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple (0 is valid for *all* values). | 456,343 |
def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple (0 is valid for *all* values). | def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple (0 is valid for *all* values). | 456,344 |
def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple (0 is valid for *all* values). | def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple (0 is valid for *all* values). | 456,345 |
def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple (0 is valid for *all* values). | def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple (0 is valid for *all* values). | 456,346 |
def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple (0 is valid for *all* values). | def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple (0 is valid for *all* values). | 456,347 |
def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple (0 is valid for *all* values). | def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple (0 is valid for *all* values). | 456,348 |
def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple (0 is valid for *all* values). | def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple (0 is valid for *all* values). | 456,349 |
def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple (0 is valid for *all* values). | def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple (0 is valid for *all* values). | 456,350 |
def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple (0 is valid for *all* values). | def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple (0 is valid for *all* values). | 456,351 |
def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple (0 is valid for *all* values). | def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple (0 is valid for *all* values). | 456,352 |
def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple (0 is valid for *all* values). | def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple (0 is valid for *all* values). | 456,353 |
def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple (0 is valid for *all* values). | def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple (0 is valid for *all* values). | 456,354 |
def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple (0 is valid for *all* values). | def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple (0 is valid for *all* values). | 456,355 |
def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple (0 is valid for *all* values). | def test_strftime_bounds_checking(self): # Make sure that strftime() checks the bounds of the various parts #of the time tuple (0 is valid for *all* values). | 456,356 |
def __str__(self): return "Command '%s' returned non-zero exit status %d" % (self.cmd, self.returncode) | def __str__(self): return "Command '%s' returned non-zero exit status %d" % (self.cmd, self.returncode) | 456,357 |
def __del__(self, sys=sys): if not self._child_created: # We didn't get to successfully create a child process. return # In case the child hasn't been waited on, check if it's done. self._internal_poll(_deadstate=sys.maxint) if self.returncode is None and _active is not None: # Child is still running, keep us alive unt... | def __del__(self, _maxint=sys.maxint, _active=_active): if not self._child_created: # We didn't get to successfully create a child process. return # In case the child hasn't been waited on, check if it's done. self._internal_poll(_deadstate=sys.maxint) if self.returncode is None and _active is not None: # Child is stil... | 456,358 |
def __del__(self, sys=sys): if not self._child_created: # We didn't get to successfully create a child process. return # In case the child hasn't been waited on, check if it's done. self._internal_poll(_deadstate=sys.maxint) if self.returncode is None and _active is not None: # Child is still running, keep us alive unt... | def __del__(self, sys=sys): if not self._child_created: # We didn't get to successfully create a child process. return # In case the child hasn't been waited on, check if it's done. self._internal_poll(_deadstate=_maxint) if self.returncode is None and _active is not None: # Child is still running, keep us alive until ... | 456,359 |
def _internal_poll(self, _deadstate=None): """Check if child process has terminated. Returns returncode attribute.""" if self.returncode is None: if(_subprocess.WaitForSingleObject(self._handle, 0) == _subprocess.WAIT_OBJECT_0): self.returncode = _subprocess.GetExitCodeProcess(self._handle) return self.returncode | def _internal_poll(self, _deadstate=None, _WaitForSingleObject=WaitForSingleObject, _WAIT_OBJECT_0=WAIT_OBJECT_0, _GetExitCodeProcess=GetExitCodeProcess): """Check if child process has terminated. Returns returncode attribute.""" if self.returncode is None: if(_subprocess.WaitForSingleObject(self._handle, 0) == _subpr... | 456,360 |
def _internal_poll(self, _deadstate=None): """Check if child process has terminated. Returns returncode attribute.""" if self.returncode is None: if(_subprocess.WaitForSingleObject(self._handle, 0) == _subprocess.WAIT_OBJECT_0): self.returncode = _subprocess.GetExitCodeProcess(self._handle) return self.returncode | def _internal_poll(self, _deadstate=None): """Check if child process has terminated. Returns returncode attribute. This method is called by __del__, so it can only refer to objects in its local scope. """ if self.returncode is None: if(_subprocess.WaitForSingleObject(self._handle, 0) == _subprocess.WAIT_OBJECT_0): s... | 456,361 |
def _internal_poll(self, _deadstate=None): """Check if child process has terminated. Returns returncode attribute.""" if self.returncode is None: if(_subprocess.WaitForSingleObject(self._handle, 0) == _subprocess.WAIT_OBJECT_0): self.returncode = _subprocess.GetExitCodeProcess(self._handle) return self.returncode | def _internal_poll(self, _deadstate=None): """Check if child process has terminated. Returns returncode attribute.""" if self.returncode is None: if _WaitForSingleObject(self._handle, 0) == _WAIT_OBJECT_0: self.returncode = _GetExitCodeProcess(self._handle) return self.returncode | 456,362 |
def _handle_exitstatus(self, sts): if os.WIFSIGNALED(sts): self.returncode = -os.WTERMSIG(sts) elif os.WIFEXITED(sts): self.returncode = os.WEXITSTATUS(sts) else: # Should never happen raise RuntimeError("Unknown child exit status!") | def _handle_exitstatus(self, sts, _WIFSIGNALED=os.WIFSIGNALED, _WTERMSIG=os.WTERMSIG, _WIFEXITED=os.WIFEXITED, _WEXITSTATUS=os.WEXITSTATUS): if _WIFSIGNALED(sts): self.returncode = -_WTERMSIG(sts) elif _WIFEXITED(sts): self.returncode = _WEXITSTATUS(sts) else: # Should never happen raise RuntimeError("Unknown child e... | 456,363 |
def _internal_poll(self, _deadstate=None): """Check if child process has terminated. Returns returncode attribute.""" if self.returncode is None: try: pid, sts = os.waitpid(self.pid, os.WNOHANG) if pid == self.pid: self._handle_exitstatus(sts) except os.error: if _deadstate is not None: self.returncode = _deadstate re... | def _internal_poll(self, _deadstate=None, _waitpid=os.waitpid, _WNOHANG=os.WNOHANG, _os_error=os.error): """Check if child process has terminated. Returns returncode attribute.""" if self.returncode is None: try: pid, sts = os.waitpid(self.pid, os.WNOHANG) if pid == self.pid: self._handle_exitstatus(sts) except os.err... | 456,364 |
def _internal_poll(self, _deadstate=None): """Check if child process has terminated. Returns returncode attribute.""" if self.returncode is None: try: pid, sts = os.waitpid(self.pid, os.WNOHANG) if pid == self.pid: self._handle_exitstatus(sts) except os.error: if _deadstate is not None: self.returncode = _deadstate re... | def _internal_poll(self, _deadstate=None): """Check if child process has terminated. Returns returncode attribute. This method is called by __del__, so it cannot reference anything outside of the local scope (nor can any methods it calls). """ if self.returncode is None: try: pid, sts = os.waitpid(self.pid, os.WNOHA... | 456,365 |
def _internal_poll(self, _deadstate=None): """Check if child process has terminated. Returns returncode attribute.""" if self.returncode is None: try: pid, sts = os.waitpid(self.pid, os.WNOHANG) if pid == self.pid: self._handle_exitstatus(sts) except os.error: if _deadstate is not None: self.returncode = _deadstate re... | def _internal_poll(self, _deadstate=None): """Check if child process has terminated. Returns returncode attribute.""" if self.returncode is None: try: pid, sts = _waitpid(self.pid, _WNOHANG) if pid == self.pid: self._handle_exitstatus(sts) except os.error: if _deadstate is not None: self.returncode = _deadstate return... | 456,366 |
def _internal_poll(self, _deadstate=None): """Check if child process has terminated. Returns returncode attribute.""" if self.returncode is None: try: pid, sts = os.waitpid(self.pid, os.WNOHANG) if pid == self.pid: self._handle_exitstatus(sts) except os.error: if _deadstate is not None: self.returncode = _deadstate re... | def _internal_poll(self, _deadstate=None): """Check if child process has terminated. Returns returncode attribute.""" if self.returncode is None: try: pid, sts = os.waitpid(self.pid, os.WNOHANG) if pid == self.pid: self._handle_exitstatus(sts) except _os_error: if _deadstate is not None: self.returncode = _deadstate r... | 456,367 |
def get_enUS_locale(): global enUS_locale if sys.platform == 'darwin': raise unittest.SkipTest("Locale support on MacOSX is minimal") if sys.platform.startswith("win"): tlocs = ("En", "English") else: tlocs = ("en_US.UTF-8", "en_US.US-ASCII", "en_US") oldlocale = locale.setlocale(locale.LC_NUMERIC) for tloc in tlocs: t... | def get_enUS_locale(): global enUS_locale if sys.platform == 'darwin': import os tlocs = ("en_US.UTF-8", "en_US.ISO8859-1", "en_US") if int(os.uname()[2].split('.')[0]) < 10: raise unittest.SkipTest("Locale support on MacOSX is minimal") if sys.platform.startswith("win"): tlocs = ("En", "English") else: tlocs = ("en... | 456,368 |
def _do_test_commandline(self, cmdline, expected): cmd = '%s -c "import sys;print sys.argv" %s' % (python, cmdline) data = os.popen(cmd).read() got = eval(data)[1:] # strip off argv[0] self.assertEqual(got, expected) | def _do_test_commandline(self, cmdline, expected): cmd = '%r -c "import sys;print sys.argv" %s' % (python, cmdline) data = os.popen(cmd).read() got = eval(data)[1:] # strip off argv[0] self.assertEqual(got, expected) | 456,369 |
def test_unicode(self): 'Verify the pretty-printing of unicode values' # Test the empty unicode string: self.assertGdbRepr(u'') | def test_unicode(self): 'Verify the pretty-printing of unicode values' # Test the empty unicode string: self.assertGdbRepr(u'') | 456,370 |
def assertSane(self, source, corruption, exp_type='unknown'): '''Run Python under gdb, corrupting variables in the inferior process immediately before taking a backtrace. | def assertSane(self, source, corruption, expvalue=None, exptype=None): '''Run Python under gdb, corrupting variables in the inferior process immediately before taking a backtrace. | 456,371 |
def assertSane(self, source, corruption, exp_type='unknown'): '''Run Python under gdb, corrupting variables in the inferior process immediately before taking a backtrace. | def assertSane(self, source, corruption, exp_type='unknown'): '''Run Python under gdb, corrupting variables in the inferior process immediately before taking a backtrace. | 456,372 |
def test_corrupt_ob_type(self): 'Ensure that a PyObject* with a corrupt ob_type is handled gracefully' self.assertSane('print 42', 'set op->ob_type=0xDEADBEEF') | def test_corrupt_ob_type(self): 'Ensure that a PyObject* with a corrupt ob_type is handled gracefully' self.assertSane('print 42', 'set op->ob_type=0xDEADBEEF') | 456,373 |
def test_corrupt_tp_flags(self): 'Ensure that a PyObject* with a type with corrupt tp_flags is handled' self.assertSane('print 42', 'set op->ob_type->tp_flags=0x0', exp_type='int') | def test_corrupt_tp_flags(self): 'Ensure that a PyObject* with a type with corrupt tp_flags is handled' self.assertSane('print 42', 'set op->ob_type->tp_flags=0x0', exp_type='int') | 456,374 |
def test_corrupt_tp_name(self): 'Ensure that a PyObject* with a type with corrupt tp_name is handled' self.assertSane('print 42', 'set op->ob_type->tp_name=0xDEADBEEF') | def test_corrupt_tp_name(self): 'Ensure that a PyObject* with a type with corrupt tp_name is handled' self.assertSane('print 42', 'set op->ob_type->tp_name=0xDEADBEEF') | 456,375 |
def test_NULL_instance_dict(self): 'Ensure that a PyInstanceObject with with a NULL in_dict is handled' self.assertSane(''' | def test_NULL_instance_dict(self): 'Ensure that a PyInstanceObject with with a NULL in_dict is handled' self.assertSane(''' | 456,376 |
def test_http_timeout(self): u = _urlopen_with_retry("http://www.python.org", timeout=120) self.assertEqual(u.fp._sock.fp._sock.gettimeout(), 120) | def test_http_timeout(self): u = _urlopen_with_retry("http://www.python.org", timeout=120) self.assertEqual(u.fp._sock.fp._sock.gettimeout(), 120) | 456,377 |
def open_local_file(self, req): import email.utils import mimetypes host = req.get_host() filename = req.get_selector() localfile = url2pathname(filename) try: stats = os.stat(localfile) size = stats.st_size modified = email.utils.formatdate(stats.st_mtime, usegmt=True) mtype = mimetypes.guess_type(filename)[0] headers... | def open_local_file(self, req): import email.utils import mimetypes host = req.get_host() filename = req.get_selector() localfile = url2pathname(filename) try: stats = os.stat(localfile) size = stats.st_size modified = email.utils.formatdate(stats.st_mtime, usegmt=True) mtype = mimetypes.guess_type(filename)[0] headers... | 456,378 |
def test_getfilesystemencoding(self): import codecs | def test_getfilesystemencoding(self): import codecs | 456,379 |
def check_fsencoding(fs_encoding, expected=None): self.assertIsNotNone(fs_encoding) if sys.platform == 'darwin': self.assertEqual(fs_encoding, 'utf-8') codecs.lookup(fs_encoding) if expected: self.assertEqual(fs_encoding, expected) | def check_fsencoding(fs_encoding, expected=None): self.assertIsNotNone(fs_encoding) if sys.platform == 'darwin': self.assertEqual(fs_encoding, 'utf-8') codecs.lookup(fs_encoding) if expected: self.assertEqual(fs_encoding, expected) | 456,380 |
def get_fsencoding(env): output = subprocess.check_output( [sys.executable, "-c", "import sys; print(sys.getfilesystemencoding())"], env=env) return output.rstrip().decode('ascii') | def get_fsencoding(env): output = subprocess.check_output( [sys.executable, "-c", "import sys; print(sys.getfilesystemencoding())"], env=env) return output.rstrip().decode('ascii') | 456,381 |
def get_fsencoding(env): output = subprocess.check_output( [sys.executable, "-c", "import sys; print(sys.getfilesystemencoding())"], env=env) return output.rstrip().decode('ascii') | def get_fsencoding(env): output = subprocess.check_output( [sys.executable, "-c", "import sys; print(sys.getfilesystemencoding())"], env=env) return output.rstrip().decode('ascii') | 456,382 |
def test_filter_basic(self): result = StringIO() gen = XMLGenerator(result) filter = XMLFilterBase() filter.setContentHandler(gen) | def test_filter_basic(self): result = StringIO() gen = XMLGenerator(result) filter = XMLFilterBase() filter.setContentHandler(gen) | 456,383 |
def test_expat_file(self): parser = create_parser() result = StringIO() xmlgen = XMLGenerator(result) | def test_expat_file(self): parser = create_parser() result = StringIO() xmlgen = XMLGenerator(result) | 456,384 |
def test_expat_inpsource_stream(self): parser = create_parser() result = StringIO() xmlgen = XMLGenerator(result) | def test_expat_inpsource_stream(self): parser = create_parser() result = StringIO() xmlgen = XMLGenerator(result) | 456,385 |
def WriteTestData(self, root_key): # Set the default value for this key. SetValue(root_key, test_key_name, REG_SZ, "Default value") key = CreateKey(root_key, test_key_name) # Create a sub-key sub_key = CreateKey(key, "sub_key") # Give the sub-key some named values | def _write_test_data(self, root_key, CreateKey=CreateKey): # Set the default value for this key. SetValue(root_key, test_key_name, REG_SZ, "Default value") key = CreateKey(root_key, test_key_name) # Create a sub-key sub_key = CreateKey(key, "sub_key") # Give the sub-key some named values | 456,386 |
def ReadTestData(self, root_key): # Check we can get default value for this key. val = QueryValue(root_key, test_key_name) self.assertEquals(val, "Default value", "Registry didn't give back the correct value") | def _read_test_data(self, root_key, OpenKey=OpenKey): # Check we can get default value for this key. val = QueryValue(root_key, test_key_name) self.assertEquals(val, "Default value", "Registry didn't give back the correct value") | 456,387 |
def DeleteTestData(self, root_key): key = OpenKey(root_key, test_key_name, 0, KEY_ALL_ACCESS) sub_key = OpenKey(key, "sub_key", 0, KEY_ALL_ACCESS) # It is not necessary to delete the values before deleting # the key (although subkeys must not exist). We delete them # manually just to prove we can :-) for value_name, v... | def _delete_test_data(self, root_key): key = OpenKey(root_key, test_key_name, 0, KEY_ALL_ACCESS) sub_key = OpenKey(key, "sub_key", 0, KEY_ALL_ACCESS) # It is not necessary to delete the values before deleting # the key (although subkeys must not exist). We delete them # manually just to prove we can :-) for value_name... | 456,388 |
def TestAll(self, root_key): self.WriteTestData(root_key) self.ReadTestData(root_key) self.DeleteTestData(root_key) | def TestAll(self, root_key): self.WriteTestData(root_key) self.ReadTestData(root_key) self.DeleteTestData(root_key) | 456,389 |
def testConnectRegistryToLocalMachineWorks(self): # perform minimal ConnectRegistry test which just invokes it h = ConnectRegistry(None, HKEY_LOCAL_MACHINE) h.Close() | def testConnectRegistryToLocalMachineWorks(self): # perform minimal ConnectRegistry test which just invokes it h = ConnectRegistry(None, HKEY_LOCAL_MACHINE) h.Close() | 456,390 |
def test_main(): test_support.run_unittest(WinregTests) | def test_main(): test_support.run_unittest(LocalWinregTests, RemoteWinregTests, Win64WinregTests) | 456,391 |
def test_main(): test_support.run_unittest(WinregTests) | def test_main(): test_support.run_unittest(WinregTests) | 456,392 |
def test_main(): test_support.run_unittest(WinregTests) | def test_main(): test_support.run_unittest(WinregTests) | 456,393 |
def _test_urls(self, urls, handlers, retry=True): import time import logging debug = logging.getLogger("test_urllib2").debug | def _test_urls(self, urls, handlers, retry=True): import time import logging debug = logging.getLogger("test_urllib2").debug | 456,394 |
def _test_urls(self, urls, handlers, retry=True): import time import logging debug = logging.getLogger("test_urllib2").debug | def _test_urls(self, urls, handlers, retry=True): import time import logging debug = logging.getLogger("test_urllib2").debug | 456,395 |
def _test_urls(self, urls, handlers, retry=True): import time import logging debug = logging.getLogger("test_urllib2").debug | def _test_urls(self, urls, handlers, retry=True): import time import logging debug = logging.getLogger("test_urllib2").debug | 456,396 |
def main(argv=None): import getopt if argv is None: argv = sys.argv try: opts, prog_argv = getopt.getopt(argv[1:], "tcrRf:d:msC:lTg", ["help", "version", "trace", "count", "report", "no-report", "summary", "file=", "missing", "ignore-module=", "ignore-dir=", "coverdir=", "listfuncs", "trackcalls", "timing"]) except g... | def main(argv=None): import getopt if argv is None: argv = sys.argv try: opts, prog_argv = getopt.getopt(argv[1:], "tcrRf:d:msC:lTg", ["help", "version", "trace", "count", "report", "no-report", "summary", "file=", "missing", "ignore-module=", "ignore-dir=", "coverdir=", "listfuncs", "trackcalls", "timing"]) except g... | 456,397 |
def detect_modules(self): # Ensure that /usr/local is always used add_dir_to_list(self.compiler_obj.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler_obj.include_dirs, '/usr/local/include') | def detect_modules(self): # Ensure that /usr/local is always used add_dir_to_list(self.compiler_obj.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler_obj.include_dirs, '/usr/local/include') | 456,398 |
def detect_modules(self): # Ensure that /usr/local is always used add_dir_to_list(self.compiler_obj.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler_obj.include_dirs, '/usr/local/include') | def detect_modules(self): # Ensure that /usr/local is always used add_dir_to_list(self.compiler_obj.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler_obj.include_dirs, '/usr/local/include') | 456,399 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.