bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
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,400 |
def add_option(self, *args, **kwargs): """add_option(Option) add_option(opt_str, ..., kwarg=val, ...) """ if type(args[0]) is types.StringType: option = self.option_class(*args, **kwargs) elif len(args) == 1 and not kwargs: option = args[0] if not isinstance(option, Option): raise TypeError, "not an Option instance: %r... | def add_option(self, *args, **kwargs): """add_option(Option) add_option(opt_str, ..., kwarg=val, ...) """ if type(args[0]) in types.StringTypes: option = self.option_class(*args, **kwargs) elif len(args) == 1 and not kwargs: option = args[0] if not isinstance(option, Option): raise TypeError, "not an Option instance: %... | 456,401 |
def setIcon(filePath, icnsPath): """ Set the custom icon for the specified file or directory. """ toolPath = os.path.join(os.path.dirname(__file__), "seticon.app/Contents/MacOS/seticon") dirPath = os.path.dirname(__file__) if not os.path.exists(toolPath) or os.stat(toolPath).st_mtime < os.stat(dirPath + '/seticon.m').... | def setIcon(filePath, icnsPath): """ Set the custom icon for the specified file or directory. """ dirPath = os.path.normpath(os.path.dirname(__file__)) toolPath = os.path.join(dirPath, "seticon.app/Contents/MacOS/seticon") if not os.path.exists(toolPath) or os.stat(toolPath).st_mtime < os.stat(dirPath + '/seticon.m').... | 456,402 |
def setIcon(filePath, icnsPath): """ Set the custom icon for the specified file or directory. """ toolPath = os.path.join(os.path.dirname(__file__), "seticon.app/Contents/MacOS/seticon") dirPath = os.path.dirname(__file__) if not os.path.exists(toolPath) or os.stat(toolPath).st_mtime < os.stat(dirPath + '/seticon.m').... | def setIcon(filePath, icnsPath): """ Set the custom icon for the specified file or directory. """ toolPath = os.path.join(os.path.dirname(__file__), "seticon.app/Contents/MacOS/seticon") dirPath = os.path.dirname(__file__) if not os.path.exists(toolPath) or os.stat(toolPath).st_mtime < os.stat(dirPath + '/seticon.m').... | 456,403 |
def test_crlf_newlines(self): old_sep = os.linesep os.linesep = "\r\n" try: fn = os.path.join(TEST_DATA_DIR, "crlf.py") fixes = refactor.get_fixers_from_package("lib2to3.fixes") self.check_file_refactoring(fn, fixes) finally: os.linesep = old_sep | def test_crlf_newlines(self): old_sep = os.linesep os.linesep = "\r\n" try: fn = os.path.join(TEST_DATA_DIR, "crlf.py") fixes = refactor.get_fixers_from_package("lib2to3.fixes") self.check_file_refactoring(fn, fixes) finally: os.linesep = old_sep | 456,404 |
def test_environ(self): for k, v in posix.environ.items(): self.assertEqual(type(k), str) self.assertEqual(type(v), str) | def test_environ(self): for k, v in posix.environ.items(): self.assertEqual(type(k), str) self.assertEqual(type(v), str) | 456,405 |
def test_UCS4(self): # unicodedata should work with code points outside the BMP # even on a narrow Unicode build self.assertEqual(self.db.category(u"\U0001012A"), "No") self.assertEqual(self.db.numeric(u"\U0001012A"), 9000) | def test_UCS4(self): # unicodedata should work with code points outside the BMP # even on a narrow Unicode build self.assertEqual(self.db.category(u"\U0001012A"), "No") self.assertEqual(self.db.numeric(u"\U0001012A"), 9000) | 456,406 |
def open(self, url, new=0, autoraise=True): if new == 0: action = self.remote_action elif new == 1: action = self.remote_action_newwin elif new == 2: if self.remote_action_newtab is None: action = self.remote_action_newwin else: action = self.remote_action_newtab else: raise Error("Bad 'new' parameter to open(); " + "e... | defopen(self,url,new=0,autoraise=True):ifnew==0:action=self.remote_actionelifnew==1:action=self.remote_action_newwinelifnew==2:ifself.remote_action_newtabisNone:action=self.remote_action_newwinelse:action=self.remote_action_newtabelse:raiseError("Bad'new'parametertoopen();"+"expected0,1,or2,got%s"%new) | 456,407 |
def open(self, url, new=0, autoraise=True): if new == 0: action = self.remote_action elif new == 1: action = self.remote_action_newwin elif new == 2: if self.remote_action_newtab is None: action = self.remote_action_newwin else: action = self.remote_action_newtab else: raise Error("Bad 'new' parameter to open(); " + "e... | defopen(self,url,new=0,autoraise=True):ifnew==0:action=self.remote_actionelifnew==1:action=self.remote_action_newwinelifnew==2:ifself.remote_action_newtabisNone:action=self.remote_action_newwinelse:action=self.remote_action_newtabelse:raiseError("Bad'new'parametertoopen();"+"expected0,1,or2,got%s"%new) | 456,408 |
def open(self, url, new=0, autoraise=True): if new == 0: action = self.remote_action elif new == 1: action = self.remote_action_newwin elif new == 2: if self.remote_action_newtab is None: action = self.remote_action_newwin else: action = self.remote_action_newtab else: raise Error("Bad 'new' parameter to open(); " + "e... | defopen(self,url,new=0,autoraise=True):ifnew==0:action=self.remote_actionelifnew==1:action=self.remote_action_newwinelifnew==2:ifself.remote_action_newtabisNone:action=self.remote_action_newwinelse:action=self.remote_action_newtabelse:raiseError("Bad'new'parametertoopen();"+"expected0,1,or2,got%s"%new) | 456,409 |
def open(self, url, new=0, autoraise=True): if new == 0: action = self.remote_action elif new == 1: action = self.remote_action_newwin elif new == 2: if self.remote_action_newtab is None: action = self.remote_action_newwin else: action = self.remote_action_newtab else: raise Error("Bad 'new' parameter to open(); " + "e... | def open(self, url, new=0, autoraise=True): if new == 0: action = self.remote_action elif new == 1: action = self.remote_action_newwin elif new == 2: if self.remote_action_newtab is None: action = self.remote_action_newwin else: action = self.remote_action_newtab else: raise Error("Bad 'new' parameter to open(); " + "e... | 456,410 |
def test_operator(self): import operator self.assertIs(operator.truth(0), False) self.assertIs(operator.truth(1), True) with test_support._check_py3k_warnings(): self.assertIs(operator.isCallable(0), False) self.assertIs(operator.isCallable(len), True) self.assertIs(operator.isNumberType(None), False) self.assertIs(ope... | def test_operator(self): import operator self.assertIs(operator.truth(0), False) self.assertIs(operator.truth(1), True) self.assertIs(operator.isCallable(0), False) self.assertIs(operator.isCallable(len), True) self.assertIs(operator.isNumberType(None), False) self.assertIs(operator.isNumberType(0), True) self.assertIs... | 456,411 |
def handle_close(self): self.baseclass.push('226 transfer complete') self.close() | def handle_close(self): self.baseclass.push('226 transfer complete') self.close() | 456,412 |
def close(self): try: if isinstance(self.socket, ssl.SSLSocket): if self.socket._sslobj is not None: self.socket.unwrap() finally: super(SSLConnection, self).close() | def close(self): try: if isinstance(self.socket, ssl.SSLSocket): if self.socket._sslobj is not None: self.socket.unwrap() finally: super(SSLConnection, self).close() | 456,413 |
def test_data_connection(self): # clear text sock = self.client.transfercmd('list') self.assertNotIsInstance(sock, ssl.SSLSocket) sock.close() self.client.voidresp() | def test_data_connection(self): # clear text sock = self.client.transfercmd('list') self.assertNotIsInstance(sock, ssl.SSLSocket) sock.close() self.client.voidresp() | 456,414 |
def test_data_connection(self): # clear text sock = self.client.transfercmd('list') self.assertNotIsInstance(sock, ssl.SSLSocket) sock.close() self.client.voidresp() | def test_data_connection(self): # clear text sock = self.client.transfercmd('list') self.assertNotIsInstance(sock, ssl.SSLSocket) sock.close() self.client.voidresp() | 456,415 |
def test_data_connection(self): # clear text sock = self.client.transfercmd('list') self.assertNotIsInstance(sock, ssl.SSLSocket) sock.close() self.client.voidresp() | def test_data_connection(self): # clear text sock = self.client.transfercmd('list') self.assertNotIsInstance(sock, ssl.SSLSocket) sock.close() self.client.voidresp() | 456,416 |
def setUp(self): support.root_deiconify() self.widget = ttk.Button() self.widget.pack() self.widget.wait_visibility() | def setUp(self): support.root_deiconify() self.widget = ttk.Button(width=0, text="Text") self.widget.pack() self.widget.wait_visibility() | 456,417 |
def test_identify(self): self.widget.update_idletasks() self.assertEqual(self.widget.identify(5, 5), "label") self.assertEqual(self.widget.identify(-1, -1), "") | def test_identify(self): self.widget.update_idletasks() self.assertEqual(self.widget.identify( int(self.widget.winfo_width() / 2), int(self.widget.winfo_height() / 2) ), "label") self.assertEqual(self.widget.identify(-1, -1), "") | 456,418 |
def setUp(self): support.root_deiconify() self.nb = ttk.Notebook() self.child1 = ttk.Label() self.child2 = ttk.Label() self.nb.add(self.child1, text='a') self.nb.add(self.child2, text='b') | def setUp(self): support.root_deiconify() self.nb = ttk.Notebook(padding=0) self.child1 = ttk.Label() self.child2 = ttk.Label() self.nb.add(self.child1, text='a') self.nb.add(self.child2, text='b') | 456,419 |
def setUp(self): support.root_deiconify() self.tv = ttk.Treeview() | def setUp(self): support.root_deiconify() self.tv = ttk.Treeview() | 456,420 |
def test_richcompare(self): self.assertRaises(OverflowError, complex.__eq__, 1+1j, 1L<<10000) self.assertEqual(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(compl... | def test_richcompare(self): self.assertEqual(complex.__eq__(1+1j, 1L<<10000), False) self.assertEqual(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__... | 456,421 |
def __exit__(self, *exc_info): if not self._entered: raise RuntimeError("Cannot exit %r without entering first" % self) self._module.filters = self._filters self._module.showwarning = self._showwarning | def __exit__(self, *exc_info): if not self._entered: raise RuntimeError("Cannot exit %r without entering first" % self) self._module.filters = self._filters self._module.showwarning = self._showwarning | 456,422 |
def make(filename, outfile): ID = 1 STR = 2 # Compute .mo name from .po name and arguments if filename.endswith('.po'): infile = filename else: infile = filename + '.po' if outfile is None: outfile = os.path.splitext(infile)[0] + '.mo' try: lines = open(infile, 'rb').readlines() except IOError as msg: print(msg, file... | def make(filename, outfile): ID = 1 STR = 2 # Compute .mo name from .po name and arguments if filename.endswith('.po'): infile = filename else: infile = filename + '.po' if outfile is None: outfile = os.path.splitext(infile)[0] + '.mo' try: lines = open(infile, 'rb').readlines() except IOError as msg: print(msg, file... | 456,423 |
def make(filename, outfile): ID = 1 STR = 2 # Compute .mo name from .po name and arguments if filename.endswith('.po'): infile = filename else: infile = filename + '.po' if outfile is None: outfile = os.path.splitext(infile)[0] + '.mo' try: lines = open(infile, 'rb').readlines() except IOError as msg: print(msg, file... | def make(filename, outfile): ID = 1 STR = 2 # Compute .mo name from .po name and arguments if filename.endswith('.po'): infile = filename else: infile = filename + '.po' if outfile is None: outfile = os.path.splitext(infile)[0] + '.mo' try: lines = open(infile, 'rb').readlines() except IOError as msg: print(msg, file... | 456,424 |
def _setup_compile(self, outdir, macros, incdirs, sources, depends, extra): """Process arguments and decide which source files to compile. | def _setup_compile(self, outdir, macros, incdirs, sources, depends, extra): """Process arguments and decide which source files to compile. | 456,425 |
def _setup_compile(self, outdir, macros, incdirs, sources, depends, extra): """Process arguments and decide which source files to compile. | def _setup_compile(self, outdir, macros, incdirs, sources, depends, extra): """Process arguments and decide which source files to compile. | 456,426 |
def _setup_compile(self, outdir, macros, incdirs, sources, depends, extra): """Process arguments and decide which source files to compile. | def _setup_compile(self, outdir, macros, incdirs, sources, depends, extra): """Process arguments and decide which source files to compile. | 456,427 |
def _fix_compile_args (self, output_dir, macros, include_dirs): """Typecheck and fix-up some of the arguments to the 'compile()' method, and return fixed-up values. Specifically: if 'output_dir' is None, replaces it with 'self.output_dir'; ensures that 'macros' is a list, and augments it with 'self.macros'; ensures th... | def _fix_compile_args (self, output_dir, macros, include_dirs): """Typecheck and fix-up some of the arguments to the 'compile()' method, and return fixed-up values. Specifically: if 'output_dir' is None, replaces it with 'self.output_dir'; ensures that 'macros' is a list, and augments it with 'self.macros'; ensures th... | 456,428 |
def compile(self, sources, output_dir=None, macros=None, include_dirs=None, debug=0, extra_preargs=None, extra_postargs=None, depends=None): """Compile one or more source files. | defcompile(self,sources,output_dir=None,macros=None,include_dirs=None,debug=0,extra_preargs=None,extra_postargs=None,depends=None):"""Compileoneormoresourcefiles. | 456,429 |
def test_normalize(self): files = set(f for f in self.files if isinstance(f, unicode)) others = set() for nf in set(['NFC', 'NFD', 'NFKC', 'NFKD']): others |= set(normalize(nf, file) for file in files) others -= files if sys.platform == 'darwin': files = set(normalize('NFD', file) for file in files) for name in others:... | def test_normalize(self): files = set(f for f in self.files if isinstance(f, unicode)) others = set() for nf in set(['NFC', 'NFD', 'NFKC', 'NFKD']): others |= set(normalize(nf, file) for file in files) others -= files if sys.platform == 'darwin': files = set(normalize('NFD', file) for file in files) for name in others:... | 456,430 |
def test_listdir(self): sf0 = set(self.files) f1 = os.listdir(test_support.TESTFN) f2 = os.listdir(unicode(test_support.TESTFN, sys.getfilesystemencoding())) if sys.platform == 'darwin': # Mac OS X returns canonically decomposed Unicode (Normal Form D) # http://developer.apple.com/mac/library/qa/qa2001/qa1173.html sf0 ... | def test_listdir(self): sf0 = set(self.files) f1 = os.listdir(test_support.TESTFN) f2 = os.listdir(unicode(test_support.TESTFN, sys.getfilesystemencoding())) if sys.platform == 'darwin': # Mac OS X returns canonically decomposed Unicode (Normal Form D) # http://developer.apple.com/mac/library/qa/qa2001/qa1173.html sf0 ... | 456,431 |
def test_undecodable_env(self): for key, value in (('test', 'abc\uDCFF'), ('test\uDCFF', '42')): # test str with surrogates script = "import os; print(repr(os.getenv(%s)))" % repr(key) env = os.environ.copy() env[key] = value stdout = subprocess.check_output( [sys.executable, "-c", script], env=env) stdout = stdout.rst... | def test_undecodable_env(self): for key, value in (('test', 'abc\uDCFF'), ('test\uDCFF', '42')): # test str with surrogates script = "import os; print(ascii(os.getenv(%s)))" % repr(key) env = os.environ.copy() env[key] = value stdout = subprocess.check_output( [sys.executable, "-c", script], env=env) stdout = stdout.rs... | 456,432 |
def test_undecodable_env(self): for key, value in (('test', 'abc\uDCFF'), ('test\uDCFF', '42')): # test str with surrogates script = "import os; print(repr(os.getenv(%s)))" % repr(key) env = os.environ.copy() env[key] = value stdout = subprocess.check_output( [sys.executable, "-c", script], env=env) stdout = stdout.rst... | def test_undecodable_env(self): for key, value in (('test', 'abc\uDCFF'), ('test\uDCFF', '42')): # test str with surrogates script = "import os; print(repr(os.getenv(%s)))" % repr(key) env = os.environ.copy() env[key] = value stdout = subprocess.check_output( [sys.executable, "-c", script], env=env) stdout = stdout.rst... | 456,433 |
def test_undecodable_env(self): for key, value in (('test', 'abc\uDCFF'), ('test\uDCFF', '42')): # test str with surrogates script = "import os; print(repr(os.getenv(%s)))" % repr(key) env = os.environ.copy() env[key] = value stdout = subprocess.check_output( [sys.executable, "-c", script], env=env) stdout = stdout.rst... | def test_undecodable_env(self): for key, value in (('test', 'abc\uDCFF'), ('test\uDCFF', '42')): # test str with surrogates script = "import os; print(repr(os.getenv(%s)))" % repr(key) env = os.environ.copy() env[key] = value stdout = subprocess.check_output( [sys.executable, "-c", script], env=env) stdout = stdout.rst... | 456,434 |
def test_undecodable_env(self): for key, value in (('test', 'abc\uDCFF'), ('test\uDCFF', '42')): # test str with surrogates script = "import os; print(repr(os.getenv(%s)))" % repr(key) env = os.environ.copy() env[key] = value stdout = subprocess.check_output( [sys.executable, "-c", script], env=env) stdout = stdout.rst... | def test_undecodable_env(self): for key, value in (('test', 'abc\uDCFF'), ('test\uDCFF', '42')): # test str with surrogates script = "import os; print(repr(os.getenv(%s)))" % repr(key) env = os.environ.copy() env[key] = value stdout = subprocess.check_output( [sys.executable, "-c", script], env=env) stdout = stdout.rst... | 456,435 |
def open_remote_stack_viewer(self): """Initiate the remote stack viewer from a separate thread. | def open_remote_stack_viewer(self): """Initiate the remote stack viewer from a separate thread. | 456,436 |
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,437 |
def _get_handles(self, stdin, stdout, stderr): """Construct and return tuple with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite """ if stdin is None and stdout is None and stderr is None: return (None, None, None, None, None, None) | def _get_handles(self, stdin, stdout, stderr): """Construct and return tuple with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite """ if stdin is None and stdout is None and stderr is None: return (None, None, None, None, None, None) | 456,438 |
def _get_handles(self, stdin, stdout, stderr): """Construct and return tuple with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite """ if stdin is None and stdout is None and stderr is None: return (None, None, None, None, None, None) | def _get_handles(self, stdin, stdout, stderr): """Construct and return tuple with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite """ if stdin is None and stdout is None and stderr is None: return (None, None, None, None, None, None) | 456,439 |
def _get_handles(self, stdin, stdout, stderr): """Construct and return tuple with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite """ if stdin is None and stdout is None and stderr is None: return (None, None, None, None, None, None) | def _get_handles(self, stdin, stdout, stderr): """Construct and return tuple with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite """ if stdin is None and stdout is None and stderr is None: return (None, None, None, None, None, None) | 456,440 |
def _get_handles(self, stdin, stdout, stderr): """Construct and return tuple with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite """ if stdin is None and stdout is None and stderr is None: return (None, None, None, None, None, None) | def _get_handles(self, stdin, stdout, stderr): """Construct and return tuple with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite """ if stdin is None and stdout is None and stderr is None: return (None, None, None, None, None, None) | 456,441 |
def _get_handles(self, stdin, stdout, stderr): """Construct and return tuple with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite """ if stdin is None and stdout is None and stderr is None: return (None, None, None, None, None, None) | def _get_handles(self, stdin, stdout, stderr): """Construct and return tuple with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite """ if stdin is None and stdout is None and stderr is None: return (None, None, None, None, None, None) | 456,442 |
def _get_handles(self, stdin, stdout, stderr): """Construct and return tuple with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite """ if stdin is None and stdout is None and stderr is None: return (None, None, None, None, None, None) | def _get_handles(self, stdin, stdout, stderr): """Construct and return tuple with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite """ if stdin is None and stdout is None and stderr is None: return (None, None, None, None, None, None) | 456,443 |
def _get_handles(self, stdin, stdout, stderr): """Construct and return tuple with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite """ if stdin is None and stdout is None and stderr is None: return (None, None, None, None, None, None) | def _get_handles(self, stdin, stdout, stderr): """Construct and return tuple with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite """ if stdin is None and stdout is None and stderr is None: return (None, None, None, None, None, None) | 456,444 |
def _get_handles(self, stdin, stdout, stderr): """Construct and return tuple with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite """ if stdin is None and stdout is None and stderr is None: return (None, None, None, None, None, None) | def _get_handles(self, stdin, stdout, stderr): """Construct and return tuple with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite """ if stdin is None and stdout is None and stderr is None: return (None, None, None, None, None, None) | 456,445 |
def _get_handles(self, stdin, stdout, stderr): """Construct and return tuple with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite """ if stdin is None and stdout is None and stderr is None: return (None, None, None, None, None, None) | def _get_handles(self, stdin, stdout, stderr): """Construct and return tuple with IO objects: p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite """ if stdin is None and stdout is None and stderr is None: return (None, None, None, None, None, None) | 456,446 |
def _make_inheritable(self, handle): """Return a duplicate of handle, which is inheritable""" return DuplicateHandle(GetCurrentProcess(), handle, GetCurrentProcess(), 0, 1, DUPLICATE_SAME_ACCESS) | def _make_inheritable(self, handle): """Return a duplicate of handle, which is inheritable""" return DuplicateHandle(GetCurrentProcess(), handle, GetCurrentProcess(), 0, 1, DUPLICATE_SAME_ACCESS) | 456,447 |
def _find_w9xpopen(self): """Find and return absolut path to w9xpopen.exe""" w9xpopen = os.path.join(os.path.dirname(GetModuleFileName(0)), "w9xpopen.exe") if not os.path.exists(w9xpopen): # Eeek - file-not-found - possibly an embedding # situation - see if we can locate it in sys.exec_prefix w9xpopen = os.path.join(os... | def _find_w9xpopen(self): """Find and return absolut path to w9xpopen.exe""" w9xpopen = os.path.join( os.path.dirname(_subprocess.GetModuleFileName(0)), "w9xpopen.exe") if not os.path.exists(w9xpopen): # Eeek - file-not-found - possibly an embedding # situation - see if we can locate it in sys.exec_prefix w9xpopen = os... | 456,448 |
def _execute_child(self, args, executable, preexec_fn, close_fds, cwd, env, universal_newlines, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite): """Execute program (MS Windows version)""" | def _execute_child(self, args, executable, preexec_fn, close_fds, cwd, env, universal_newlines, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite): """Execute program (MS Windows version)""" | 456,449 |
def _execute_child(self, args, executable, preexec_fn, close_fds, cwd, env, universal_newlines, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite): """Execute program (MS Windows version)""" | def _execute_child(self, args, executable, preexec_fn, close_fds, cwd, env, universal_newlines, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite): """Execute program (MS Windows version)""" | 456,450 |
def _execute_child(self, args, executable, preexec_fn, close_fds, cwd, env, universal_newlines, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite): """Execute program (MS Windows version)""" | def _execute_child(self, args, executable, preexec_fn, close_fds, cwd, env, universal_newlines, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite): """Execute program (MS Windows version)""" | 456,451 |
def _execute_child(self, args, executable, preexec_fn, close_fds, cwd, env, universal_newlines, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite): """Execute program (MS Windows version)""" | def _execute_child(self, args, executable, preexec_fn, close_fds, cwd, env, universal_newlines, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite): """Execute program (MS Windows version)""" | 456,452 |
def _execute_child(self, args, executable, preexec_fn, close_fds, cwd, env, universal_newlines, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite): """Execute program (MS Windows version)""" | def _execute_child(self, args, executable, preexec_fn, close_fds, cwd, env, universal_newlines, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite): """Execute program (MS Windows version)""" | 456,453 |
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 | 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 | 456,454 |
def wait(self): """Wait for child process to terminate. Returns returncode attribute.""" if self.returncode is None: WaitForSingleObject(self._handle, INFINITE) self.returncode = GetExitCodeProcess(self._handle) return self.returncode | def wait(self): """Wait for child process to terminate. Returns returncode attribute.""" if self.returncode is None: _subprocess.WaitForSingleObject(self._handle, _subprocess.INFINITE) self.returncode = _subprocess.GetExitCodeProcess(self._handle) return self.returncode | 456,455 |
def terminate(self): """Terminates the process """ TerminateProcess(self._handle, 1) | def terminate(self): """Terminates the process """ TerminateProcess(self._handle, 1) | 456,456 |
def addHandler(self, hdlr): """ Add the specified handler to this logger. """ if not (hdlr in self.handlers): self.handlers.append(hdlr) | def addHandler(self, hdlr): """ Add the specified handler to this logger. """ if not (hdlr in self.handlers): self.handlers.append(hdlr) | 456,457 |
def removeHandler(self, hdlr): """ Remove the specified handler from this logger. """ if hdlr in self.handlers: #hdlr.close() hdlr.acquire() try: self.handlers.remove(hdlr) finally: hdlr.release() | def removeHandler(self, hdlr): """ Remove the specified handler from this logger. """ if hdlr in self.handlers: #hdlr.close() hdlr.acquire() try: self.handlers.remove(hdlr) finally: hdlr.release() | 456,458 |
def removeHandler(self, hdlr): """ Remove the specified handler from this logger. """ if hdlr in self.handlers: #hdlr.close() hdlr.acquire() try: self.handlers.remove(hdlr) finally: hdlr.release() | def removeHandler(self, hdlr): """ Remove the specified handler from this logger. """ if hdlr in self.handlers: #hdlr.close() hdlr.acquire() try: self.handlers.remove(hdlr) finally: hdlr.release() | 456,459 |
def test_encode_empty_payload(self): eq = self.assertEqual msg = Message() msg.set_charset('us-ascii') eq(msg['content-transfer-encoding'], '7bit') | def test_encode_empty_payload(self): eq = self.assertEqual msg = Message() msg.set_charset('us-ascii') eq(msg['content-transfer-encoding'], '7bit') | 456,460 |
def __index__(self): return self | def __index__(self): return self | 456,461 |
def setUp(self): self.o = oldstyle() self.n = newstyle() | def setUp(self): self.o = newstyle() self.n = newstyle() | 456,462 |
def test_subclasses(self): r = list(range(10)) self.assertEqual(r[TrapInt(5):TrapInt(10)], r[5:10]) self.assertEqual(r[TrapLong(5):TrapLong(10)], r[5:10]) self.assertEqual(slice(TrapInt()).indices(0), (0,0,1)) self.assertEqual(slice(TrapLong(0)).indices(0), (0,0,1)) | def test_subclasses(self): r = list(range(10)) self.assertEqual(r[TrapInt(5):TrapInt(10)], r[5:10]) self.assertEqual(slice(TrapInt()).indices(0), (0,0,1)) self.assertEqual(slice(TrapLong(0)).indices(0), (0,0,1)) | 456,463 |
def test_subclasses(self): r = list(range(10)) self.assertEqual(r[TrapInt(5):TrapInt(10)], r[5:10]) self.assertEqual(r[TrapLong(5):TrapLong(10)], r[5:10]) self.assertEqual(slice(TrapInt()).indices(0), (0,0,1)) self.assertEqual(slice(TrapLong(0)).indices(0), (0,0,1)) | def test_subclasses(self): r = list(range(10)) self.assertEqual(r[TrapInt(5):TrapInt(10)], r[5:10]) self.assertEqual(r[TrapLong(5):TrapLong(10)], r[5:10]) self.assertEqual(slice(TrapInt()).indices(0), (0,0,1)) self.assertEqual(slice(TrapLong(0)).indices(0), (0,0,1)) | 456,464 |
def setUp(self): self.o = oldstyle() self.n = newstyle() self.o2 = oldstyle() self.n2 = newstyle() | def setUp(self): self.o = newstyle() self.n = newstyle() self.o2 = oldstyle() self.n2 = newstyle() | 456,465 |
def setUp(self): self.o = oldstyle() self.n = newstyle() self.o2 = oldstyle() self.n2 = newstyle() | def setUp(self): self.o = oldstyle() self.n = newstyle() self.o2 = newstyle() self.n2 = newstyle() | 456,466 |
def test_subclasses(self): self.assertEqual(self.seq[TrapInt()], self.seq[0]) self.assertEqual(self.seq[TrapLong()], self.seq[0]) | def test_subclasses(self): self.assertEqual(self.seq[TrapInt()], self.seq[0]) self.assertEqual(self.seq[TrapLong()], self.seq[0]) | 456,467 |
def test_inplace_repeat(self): self.o.ind = 2 self.n.ind = 3 lst = [6, 4] lst *= self.o self.assertEqual(lst, [6, 4, 6, 4]) lst *= self.n self.assertEqual(lst, [6, 4, 6, 4] * 3) | def test_inplace_repeat(self): self.o.ind = 2 self.n.ind = 3 lst = [6, 4] lst *= self.o self.assertEqual(lst, [6, 4, 6, 4]) lst *= self.n self.assertEqual(lst, [6, 4, 6, 4] * 3) | 456,468 |
def test_getitem(self): class GetItem(object): def __len__(self): return sys.maxsize def __getitem__(self, key): return key x = GetItem() self.assertEqual(x[self.pos], self.pos) self.assertEqual(x[self.neg], self.neg) self.assertEqual(x[self.neg:self.pos].indices(maxsize), (0, maxsize, 1)) | def test_getitem(self): class GetItem: def __len__(self): return sys.maxsize def __getitem__(self, key): return key x = GetItem() self.assertEqual(x[self.pos], self.pos) self.assertEqual(x[self.neg], self.neg) self.assertEqual(x[self.neg:self.pos].indices(maxsize), (0, maxsize, 1)) | 456,469 |
def __len__(self): return sys.maxsize | def __len__(self): return sys.maxsize | 456,470 |
def test_main(): support.run_unittest( BaseTestCase, ListTestCase, TupleTestCase, StringTestCase, UnicodeTestCase, OverflowTestCase, ) | def test_main(): support.run_unittest( BaseTestCase, ListTestCase, TupleTestCase, StringTestCase, NewSeqTestCase, RangeTestCase, OverflowTestCase, ) | 456,471 |
def __init__(self, prec=None, rounding=None, traps=None, flags=None, Emin=None, Emax=None, capitals=None, _clamp=0, _ignored_flags=None): if flags is None: flags = [] if _ignored_flags is None: _ignored_flags = [] if not isinstance(flags, dict): flags = dict([(s, int(s in flags)) for s in _signals]) del s if traps is n... | def __init__(self, prec=None, rounding=None, traps=None, flags=None, Emin=None, Emax=None, capitals=None, _clamp=0, _ignored_flags=None): if flags is None: flags = [] if _ignored_flags is None: _ignored_flags = [] if not isinstance(flags, dict): flags = dict([(s, int(s in flags)) for s in _signals]) del s if traps is n... | 456,472 |
def do_request_(self, request): host = request.host if not host: raise URLError('no host given') | def do_request_(self, request): host = request.host if not host: raise URLError('no host given') | 456,473 |
def _expand_attrs(self, attrs): for attr in attrs: val = getattr(self, attr) if val is not None: if os.name == 'posix' or os.name == 'nt': val = os.path.expanduser(val) try: val = _subst_vars(val, self.config_vars) except: import pdb; pdb.set_trace() setattr(self, attr, val) | def _expand_attrs(self, attrs): for attr in attrs: val = getattr(self, attr) if val is not None: if os.name == 'posix' or os.name == 'nt': val = os.path.expanduser(val) val = _subst_vars(val, self.config_vars) setattr(self, attr, val) | 456,474 |
def test_long(self): self.assertEqual(int(False), 0L) self.assertIsNot(int(False), False) self.assertEqual(int(True), 1L) self.assertIsNot(int(True), True) | def test_long(self): self.assertEqual(int(False), 0L) self.assertIsNot(int(False), False) self.assertEqual(int(True), 1L) self.assertIsNot(int(True), True) | 456,475 |
def test1(self): 1/0 | def test1(self): 1/0 | 456,476 |
def __init__(self, filename, when='h', interval=1, backupCount=0, encoding=None, delay=0, utc=False): BaseRotatingHandler.__init__(self, filename, 'a', encoding, delay) self.when = when.upper() self.backupCount = backupCount self.utc = utc # Calculate the real rollover interval, which is just the number of # seconds be... | def __init__(self, filename, when='h', interval=1, backupCount=0, encoding=None, delay=0, utc=False): BaseRotatingHandler.__init__(self, filename, 'a', encoding, delay) self.when = when.upper() self.backupCount = backupCount self.utc = utc # Calculate the real rollover interval, which is just the number of # seconds be... | 456,477 |
def assertSameElements(self, expected_seq, actual_seq, msg=None): """An unordered sequence specific comparison. | def assertSameElements(self, expected_seq, actual_seq, msg=None): """An unordered sequence specific comparison. | 456,478 |
def assertSameElements(self, expected_seq, actual_seq, msg=None): """An unordered sequence specific comparison. | def assertSameElements(self, expected_seq, actual_seq, msg=None): """An unordered sequence specific comparison. | 456,479 |
def encode_7or8bit(msg): """Set the Content-Transfer-Encoding header to 7bit or 8bit.""" orig = msg.get_payload() if orig is None: # There's no payload. For backwards compatibility we use 7bit msg['Content-Transfer-Encoding'] = '7bit' return # We play a trick to make this go fast. If encoding to ASCII succeeds, we # ... | def encode_7or8bit(msg): """Set the Content-Transfer-Encoding header to 7bit or 8bit.""" orig = msg.get_payload() if orig is None: # There's no payload. For backwards compatibility we use 7bit msg['Content-Transfer-Encoding'] = '7bit' return # We play a trick to make this go fast. If encoding to ASCII succeeds, we # ... | 456,480 |
def print_window(self, event): m = tkMessageBox.Message( title="Print", message="Print to Default Printer", icon=tkMessageBox.QUESTION, type=tkMessageBox.OKCANCEL, default=tkMessageBox.OK, master=self.text) reply = m.show() if reply != tkMessageBox.OK: self.text.focus_set() return "break" tempfilename = None saved = se... | def print_window(self, event): m = tkMessageBox.Message( title="Print", message="Print to Default Printer", icon=tkMessageBox.QUESTION, type=tkMessageBox.OKCANCEL, default=tkMessageBox.OK, master=self.text) reply = m.show() if reply != tkMessageBox.OK: self.text.focus_set() return "break" tempfilename = None saved = se... | 456,481 |
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') | 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') | 456,482 |
def test_getwindowsversion(self): # Raise SkipTest if sys doesn't have getwindowsversion attribute test.test_support.get_attribute(sys, "getwindowsversion") v = sys.getwindowsversion() self.assertEqual(len(v), 5) self.assertIsInstance(v[0], int) self.assertIsInstance(v[1], int) self.assertIsInstance(v[2], int) self.ass... | def test_getwindowsversion(self): # Raise SkipTest if sys doesn't have getwindowsversion attribute test.support.get_attribute(sys, "getwindowsversion") v = sys.getwindowsversion() self.assertEqual(len(v), 5) self.assertIsInstance(v[0], int) self.assertIsInstance(v[1], int) self.assertIsInstance(v[2], int) self.assertIs... | 456,483 |
def setquit(): """Define new built-ins 'quit' and 'exit'. These are simply strings that display a hint on how to exit. """ if os.sep == ':': eof = 'Cmd-Q' elif os.sep == '\\': eof = 'Ctrl-Z plus Return' else: eof = 'Ctrl-D (i.e. EOF)' class Quitter(object): def __init__(self, name): self.name = name def __repr__(self... | def setquit(): """Define new builtins 'quit' and 'exit'. These are objects which make the interpreter exit when called. The repr of each object contains a hint at how it works. """ if os.sep == ':': eof = 'Cmd-Q' elif os.sep == '\\': eof = 'Ctrl-Z plus Return' else: eof = 'Ctrl-D (i.e. EOF)' class Quitter(object): d... | 456,484 |
def setcopyright(): """Set 'copyright' and 'credits' in __builtin__""" __builtin__.copyright = _Printer("copyright", sys.copyright) if sys.platform[:4] == 'java': __builtin__.credits = _Printer( "credits", "Jython is maintained by the Jython developers (www.jython.org).") else: __builtin__.credits = _Printer("credits",... | def setcopyright(): """Set 'copyright' and 'credits' in __builtin__""" __builtin__.copyright = _Printer("copyright", sys.copyright) if sys.platform[:4] == 'java': __builtin__.credits = _Printer( "credits", "Jython is maintained by the Jython developers (www.jython.org).") else: __builtin__.credits = _Printer("credits",... | 456,485 |
def test_while_else(self): self.check_roundtrip(forelse) | def test_while_else(self): self.check_roundtrip(forelse) | 456,486 |
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') | 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') | 456,487 |
def findCaller(self): """ Find the stack frame of the caller so that we can note the source file name, line number and function name. """ f = currentframe() #On some versions of IronPython, currentframe() returns None if #IronPython isn't run with -X:Frames. if f is not None: f = f.f_back rv = "(unknown file)", 0, "(un... | def findCaller(self): """ Find the stack frame of the caller so that we can note the source file name, line number and function name. """ f = currentframe() #On some versions of IronPython, currentframe() returns None if #IronPython isn't run with -X:Frames. if f is not None: f = f.f_back rv = "(unknown file)", 0, "(un... | 456,488 |
def test_main(): support.run_unittest(PosixTester) | def test_main(): support.run_unittest(PosixTester, PosixGroupsTester) | 456,489 |
def show_compilers(): from distutils.ccompiler import show_compilers show_compilers() | def show_compilers(): from distutils.ccompiler import show_compilers show_compilers() | 456,490 |
def show_compilers(): from distutils.ccompiler import show_compilers show_compilers() | def show_compilers(): from distutils.ccompiler import show_compilers show_compilers() | 456,491 |
def execusercustomize(): """Run custom user specific code, if available.""" try: import usercustomize except ImportError: pass except Exception: if sys.flags.verbose: sys.excepthook(*sys.exc_info()) else: print>>sys.stderr, \ "'import sitecustomize' failed; use -v for traceback" | def execusercustomize(): """Run custom user specific code, if available.""" try: import usercustomize except ImportError: pass except Exception: if sys.flags.verbose: sys.excepthook(*sys.exc_info()) else: print>>sys.stderr, \ "'import usercustomize' failed; use -v for traceback" | 456,492 |
def test_undecodable_env(self): for key, value in (('test', 'abc\uDCFF'), ('test\uDCFF', '42')): value_repr = repr(value).encode("ascii") | def test_undecodable_env(self): for key, value in (('test', 'abc\uDCFF'), ('test\uDCFF', '42')): value_repr = repr(value).encode("ascii") | 456,493 |
def test_undecodable_env(self): for key, value in (('test', 'abc\uDCFF'), ('test\uDCFF', '42')): value_repr = repr(value).encode("ascii") | def test_undecodable_env(self): for key, value in (('test', 'abc\uDCFF'), ('test\uDCFF', '42')): value_repr = repr(value).encode("ascii") | 456,494 |
def test_import_pyc_path(self): self.assertFalse(os.path.exists('__pycache__')) __import__(TESTFN) self.assertTrue(os.path.exists('__pycache__')) self.assertTrue(os.path.exists(os.path.join( '__pycache__', '{}.{}.pyc'.format(TESTFN, self.tag)))) | def test_import_pyc_path(self): self.assertFalse(os.path.exists('__pycache__')) __import__(TESTFN) self.assertTrue(os.path.exists('__pycache__')) self.assertTrue(os.path.exists(os.path.join( '__pycache__', '{}.{}.pyc'.format(TESTFN, self.tag)))) | 456,495 |
def test_listdir(self): sf0 = set(self.files) f1 = os.listdir(support.TESTFN.encode(sys.getfilesystemencoding())) f2 = os.listdir(support.TESTFN) if sys.platform == 'darwin': # Mac OS X decomposes Unicode names. See comment above. sf0 = set(normalize('NFD', f) for f in self.files) f2 = [normalize('NFD', f) for f in f2... | def test_listdir(self): sf0 = set(self.files) f1 = os.listdir(support.TESTFN.encode(sys.getfilesystemencoding())) f2 = os.listdir(support.TESTFN) if sys.platform == 'darwin': # Mac OS X decomposes Unicode names. See comment above. sf0 = set(normalize('NFD', f) for f in self.files) f2 = [normalize('NFD', f) for f in f2... | 456,496 |
def app(environ, respond): fn = os.path.join(path, environ['PATH_INFO'][1:]) if '.' not in fn.split(os.path.sep)[-1]: fn = os.path.join(fn, 'index.html') type = mimetypes.guess_type(fn)[0] if os.path.exists(fn): respond('200 OK', [('Content-Type', type)]) return util.FileWrapper(open(fn)) else: respond('404 Not Found... | def app(environ, respond): fn = os.path.join(path, environ['PATH_INFO'][1:]) if '.' not in fn.split(os.path.sep)[-1]: fn = os.path.join(fn, 'index.html') type = mimetypes.guess_type(fn)[0] if os.path.exists(fn): respond('200 OK', [('Content-Type', type)]) return util.FileWrapper(open(fn, "rb")) else: respond('404 Not... | 456,497 |
def test_total_ordering_no_overwrite(self): # new methods should not overwrite existing @functools.total_ordering class A(int): pass self.assert_(A(1) < A(2)) self.assert_(A(2) > A(1)) self.assert_(A(1) <= A(2)) self.assert_(A(2) >= A(1)) self.assert_(A(2) <= A(2)) self.assert_(A(2) >= A(2)) | def test_total_ordering_no_overwrite(self): # new methods should not overwrite existing @functools.total_ordering class A(int): pass self.assert_(A(1) < A(2)) self.assert_(A(2) > A(1)) self.assert_(A(1) <= A(2)) self.assert_(A(2) >= A(1)) self.assert_(A(2) <= A(2)) self.assert_(A(2) >= A(2)) | 456,498 |
def testboth(formatstr, *args): testformat(formatstr, *args) if have_unicode: testformat(unicode(formatstr), *args) | def testboth(formatstr, *args, **kwargs): testformat(formatstr, *args, **kwargs) if have_unicode: testformat(unicode(formatstr), *args) | 456,499 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.