bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def read_template (self): """Read and parse the manifest template file named by 'self.template' (usually "MANIFEST.in"). Process all file specifications (include and exclude) in the manifest template and add the resulting filenames to 'self.files'.""" | def read_template (self): """Read and parse the manifest template file named by 'self.template' (usually "MANIFEST.in"). Process all file specifications (include and exclude) in the manifest template and add the resulting filenames to 'self.files'.""" | 10,400 |
def read_template (self): """Read and parse the manifest template file named by 'self.template' (usually "MANIFEST.in"). Process all file specifications (include and exclude) in the manifest template and add the resulting filenames to 'self.files'.""" | def read_template (self): """Read and parse the manifest template file named by 'self.template' (usually "MANIFEST.in"). Process all file specifications (include and exclude) in the manifest template and add the resulting filenames to 'self.files'.""" | 10,401 |
def read_template (self): """Read and parse the manifest template file named by 'self.template' (usually "MANIFEST.in"). Process all file specifications (include and exclude) in the manifest template and add the resulting filenames to 'self.files'.""" | def read_template (self): """Read and parse the manifest template file named by 'self.template' (usually "MANIFEST.in"). Process all file specifications (include and exclude) in the manifest template and add the resulting filenames to 'self.files'.""" | 10,402 |
def read_template (self): """Read and parse the manifest template file named by 'self.template' (usually "MANIFEST.in"). Process all file specifications (include and exclude) in the manifest template and add the resulting filenames to 'self.files'.""" | def read_template (self): """Read and parse the manifest template file named by 'self.template' (usually "MANIFEST.in"). Process all file specifications (include and exclude) in the manifest template and add the resulting filenames to 'self.files'.""" | 10,403 |
def read_template (self): """Read and parse the manifest template file named by 'self.template' (usually "MANIFEST.in"). Process all file specifications (include and exclude) in the manifest template and add the resulting filenames to 'self.files'.""" | def read_template (self): """Read and parse the manifest template file named by 'self.template' (usually "MANIFEST.in"). Process all file specifications (include and exclude) in the manifest template and add the resulting filenames to 'self.files'.""" | 10,404 |
def read_template (self): """Read and parse the manifest template file named by 'self.template' (usually "MANIFEST.in"). Process all file specifications (include and exclude) in the manifest template and add the resulting filenames to 'self.files'.""" | def read_template (self): """Read and parse the manifest template file named by 'self.template' (usually "MANIFEST.in"). Process all file specifications (include and exclude) in the manifest template and add the resulting filenames to 'self.files'.""" | 10,405 |
def read_template (self): """Read and parse the manifest template file named by 'self.template' (usually "MANIFEST.in"). Process all file specifications (include and exclude) in the manifest template and add the resulting filenames to 'self.files'.""" | def read_template (self): """Read and parse the manifest template file named by 'self.template' (usually "MANIFEST.in"). Process all file specifications (include and exclude) in the manifest template and add the resulting filenames to 'self.files'.""" | 10,406 |
def read_template (self): """Read and parse the manifest template file named by 'self.template' (usually "MANIFEST.in"). Process all file specifications (include and exclude) in the manifest template and add the resulting filenames to 'self.files'.""" | def read_template (self): """Read and parse the manifest template file named by 'self.template' (usually "MANIFEST.in"). Process all file specifications (include and exclude) in the manifest template and add the resulting filenames to 'self.files'.""" | 10,407 |
def read_template (self): """Read and parse the manifest template file named by 'self.template' (usually "MANIFEST.in"). Process all file specifications (include and exclude) in the manifest template and add the resulting filenames to 'self.files'.""" | def read_template (self): """Read and parse the manifest template file named by 'self.template' (usually "MANIFEST.in"). Process all file specifications (include and exclude) in the manifest template and add the resulting filenames to 'self.files'.""" | 10,408 |
def read_template (self): """Read and parse the manifest template file named by 'self.template' (usually "MANIFEST.in"). Process all file specifications (include and exclude) in the manifest template and add the resulting filenames to 'self.files'.""" | def read_template (self): """Read and parse the manifest template file named by 'self.template' (usually "MANIFEST.in"). Process all file specifications (include and exclude) in the manifest template and add the resulting filenames to 'self.files'.""" | 10,409 |
def read_template (self): """Read and parse the manifest template file named by 'self.template' (usually "MANIFEST.in"). Process all file specifications (include and exclude) in the manifest template and add the resulting filenames to 'self.files'.""" | def read_template (self): """Read and parse the manifest template file named by 'self.template' (usually "MANIFEST.in"). Process all file specifications (include and exclude) in the manifest template and add the resulting filenames to 'self.files'.""" | 10,410 |
def test_clean(self): # Remove old files from 'tmp' foo_path = os.path.join(self._path, 'tmp', 'foo') bar_path = os.path.join(self._path, 'tmp', 'bar') file(foo_path, 'w').close() file(bar_path, 'w').close() self._box.clean() self.assert_(os.path.exists(foo_path)) self.assert_(os.path.exists(bar_path)) foo_stat = os.st... | def test_clean(self): # Remove old files from 'tmp' foo_path = os.path.join(self._path, 'tmp', 'foo') bar_path = os.path.join(self._path, 'tmp', 'bar') f = open(foo_path, 'w') f.write("@") f.close() f = open(bar_path, 'w') f.write("@") f.close() self._box.clean() self.assert_(os.path.exists(foo_path)) self.assert_(os.p... | 10,411 |
def test_clean(self): # Remove old files from 'tmp' foo_path = os.path.join(self._path, 'tmp', 'foo') bar_path = os.path.join(self._path, 'tmp', 'bar') file(foo_path, 'w').close() file(bar_path, 'w').close() self._box.clean() self.assert_(os.path.exists(foo_path)) self.assert_(os.path.exists(bar_path)) foo_stat = os.st... | def test_clean(self): # Remove old files from 'tmp' foo_path = os.path.join(self._path, 'tmp', 'foo') bar_path = os.path.join(self._path, 'tmp', 'bar') file(foo_path, 'w').close() file(bar_path, 'w').close() self._box.clean() self.assert_(os.path.exists(foo_path)) self.assert_(os.path.exists(bar_path)) foo_stat = os.st... | 10,412 |
def walk(top, func, arg): """walk(top,func,arg) calls func(arg, d, files) for each directory "d" in the tree rooted at "top" (including "top" itself). "files" is a list of all the files and subdirs in directory "d". """ try: names = os.listdir(top) except os.error: return func(arg, top, names) for name in names: name... | def walk(top, func, arg): """walk(top,func,arg) calls func(arg, d, files) for each directory "d" in the tree rooted at "top" (including "top" itself). "files" is a list of all the files and subdirs in directory "d". """ try: names = os.listdir(top) except os.error: return func(arg, top, names) for name in names: name... | 10,413 |
def __repr__(self): s = "Module(%r" % % (self.__name__,) if self.__file__ is not None: s = s + ", %r" % (self.__file__,) if self.__path__ is not None: s = s + ", %r" % (self.__path__,) s = s + ")" return s | def __repr__(self): s = "Module(%r" % (self.__name__,) if self.__file__ is not None: s = s + ", %r" % (self.__file__,) if self.__path__ is not None: s = s + ", %r" % (self.__path__,) s = s + ")" return s | 10,414 |
def run(self, test): "Run the given test case or test suite." result = self._makeResult() startTime = time.time() test(result) stopTime = time.time() timeTaken = float(stopTime - startTime) result.printErrors() self.stream.writeln(result.separator2) run = result.testsRun self.stream.writeln("Ran %d test%s in %.3fs" % (... | def run(self, test): "Run the given test case or test suite." result = self._makeResult() startTime = time.time() test(result) stopTime = time.time() timeTaken = float(stopTime - startTime) result.printErrors() self.stream.writeln(result.separator2) run = result.testsRun self.stream.writeln("Ran %d test%s in %.3fs" % (... | 10,415 |
def IN_CLASSA(a): return ((((in_addr_t)(a)) & 0x80000000) == 0) | def IN_CLASSA(a): return ((((in_addr_t)(a)) & 0x80000000) == 0) | 10,416 |
def IN_CLASSA(a): return ((((in_addr_t)(a)) & 0x80000000) == 0) | def IN_CLASSA(a): return ((((in_addr_t)(a)) & 0x80000000) == 0) | 10,417 |
def IN_CLASSB(a): return ((((in_addr_t)(a)) & 0xc0000000) == 0x80000000) | def IN_CLASSB(a): return ((((in_addr_t)(a)) & 0xc0000000) == 0x80000000) | 10,418 |
def IN_CLASSB(a): return ((((in_addr_t)(a)) & 0xc0000000) == 0x80000000) | def IN_CLASSB(a): return ((((in_addr_t)(a)) & 0xc0000000) == 0x80000000) | 10,419 |
def IN_CLASSC(a): return ((((in_addr_t)(a)) & 0xe0000000) == 0xc0000000) | def IN_CLASSC(a): return ((((in_addr_t)(a)) & 0xe0000000) == 0xc0000000) | 10,420 |
def IN_CLASSC(a): return ((((in_addr_t)(a)) & 0xe0000000) == 0xc0000000) | def IN_CLASSC(a): return ((((in_addr_t)(a)) & 0xe0000000) == 0xc0000000) | 10,421 |
def IN_EXPERIMENTAL(a): return ((((in_addr_t)(a)) & 0xe0000000) == 0xe0000000) | def IN_EXPERIMENTAL(a): return ((((in_addr_t)(a)) & 0xe0000000) == 0xe0000000) | 10,422 |
def IN_BADCLASS(a): return ((((in_addr_t)(a)) & 0xf0000000) == 0xf0000000) | def IN_BADCLASS(a): return ((((in_addr_t)(a)) & 0xf0000000) == 0xf0000000) | 10,423 |
def IN_BADCLASS(a): return ((((in_addr_t)(a)) & 0xf0000000) == 0xf0000000) | def IN_BADCLASS(a): return ((((in_addr_t)(a)) & 0xf0000000) == 0xf0000000) | 10,424 |
def IN_BADCLASS(a): return ((((in_addr_t)(a)) & 0xf0000000) == 0xf0000000) | def IN_BADCLASS(a): return ((((in_addr_t)(a)) & 0xf0000000) == 0xf0000000) | 10,425 |
def run_script(self, pathname): self.msg(2, "run_script", pathname) fp = open(pathname) stuff = ("", "r", imp.PY_SOURCE) self.load_module('__main__', fp, pathname, stuff) | def run_script(self, pathname): self.msg(2, "run_script", pathname) fp = open(pathname, "U") stuff = ("", "r", imp.PY_SOURCE) self.load_module('__main__', fp, pathname, stuff) | 10,426 |
def load_file(self, pathname): dir, name = os.path.split(pathname) name, ext = os.path.splitext(name) fp = open(pathname) stuff = (ext, "r", imp.PY_SOURCE) self.load_module(name, fp, pathname, stuff) | def load_file(self, pathname): dir, name = os.path.split(pathname) name, ext = os.path.splitext(name) fp = open(pathname, "U") stuff = (ext, "r", imp.PY_SOURCE) self.load_module(name, fp, pathname, stuff) | 10,427 |
def build_extensions(self): | def build_extensions(self): | 10,428 |
def __init__(self, fp=None, headers=None, outerboundary="", environ=os.environ, keep_blank_values=0, strict_parsing=0): """Constructor. Read multipart/* until last part. | def __init__(self, fp=None, headers=None, outerboundary="", environ=os.environ, keep_blank_values=0, strict_parsing=0): """Constructor. Read multipart/* until last part. | 10,429 |
def read_multi(self): """Internal: read a part that is itself multipart.""" self.list = [] part = self.__class__(self.fp, {}, self.innerboundary) # Throw first part away while not part.done: headers = rfc822.Message(self.fp) part = self.__class__(self.fp, headers, self.innerboundary) self.list.append(part) self.skip_li... | def read_multi(self, environ, keep_blank_values, strict_parsing): """Internal: read a part that is itself multipart.""" self.list = [] part = self.__class__(self.fp, {}, self.innerboundary) # Throw first part away while not part.done: headers = rfc822.Message(self.fp) part = self.__class__(self.fp, headers, self.innerb... | 10,430 |
def read_multi(self): """Internal: read a part that is itself multipart.""" self.list = [] part = self.__class__(self.fp, {}, self.innerboundary) # Throw first part away while not part.done: headers = rfc822.Message(self.fp) part = self.__class__(self.fp, headers, self.innerboundary) self.list.append(part) self.skip_li... | def read_multi(self): """Internal: read a part that is itself multipart.""" self.list = [] part = self.__class__(self.fp, {}, self.innerboundary, environ, keep_blank_values, strict_parsing) # Throw first part away while not part.done: headers = rfc822.Message(self.fp) part = self.__class__(self.fp, headers, self.innerb... | 10,431 |
def read_multi(self): """Internal: read a part that is itself multipart.""" self.list = [] part = self.__class__(self.fp, {}, self.innerboundary) # Throw first part away while not part.done: headers = rfc822.Message(self.fp) part = self.__class__(self.fp, headers, self.innerboundary) self.list.append(part) self.skip_li... | def read_multi(self): """Internal: read a part that is itself multipart.""" self.list = [] part = self.__class__(self.fp, {}, self.innerboundary) # Throw first part away while not part.done: headers = rfc822.Message(self.fp) part = self.__class__(self.fp, headers, self.innerboundary, environ, keep_blank_values, strict_... | 10,432 |
def test_main(): tests = [ GeneralModuleTests, BasicTCPTest ] if sys.platform != 'mac': tests.append(BasicUDPTest) tests.extend([ NonBlockingTCPTests, FileObjectClassTestCase, UnbufferedFileObjectClassTestCase, LineBufferedFileObjectClassTestCase, SmallBufferedFileObjectClassTestCase ]) test_support.run_unittest(*test... | def test_main(): tests = [GeneralModuleTests, BasicTCPTest, TCPTimeoutTest, TestExceptions] if sys.platform != 'mac': tests.append(BasicUDPTest) tests.extend([ NonBlockingTCPTests, FileObjectClassTestCase, UnbufferedFileObjectClassTestCase, LineBufferedFileObjectClassTestCase, SmallBufferedFileObjectClassTestCase ]) t... | 10,433 |
def test_main(): tests = [ GeneralModuleTests, BasicTCPTest ] if sys.platform != 'mac': tests.append(BasicUDPTest) tests.extend([ NonBlockingTCPTests, FileObjectClassTestCase, UnbufferedFileObjectClassTestCase, LineBufferedFileObjectClassTestCase, SmallBufferedFileObjectClassTestCase ]) test_support.run_unittest(*test... | def test_main(): tests = [ GeneralModuleTests, BasicTCPTest ] if sys.platform != 'mac': tests.extend([ BasicUDPTest, UDPTimeoutTest ]) tests.extend([ NonBlockingTCPTests, FileObjectClassTestCase, UnbufferedFileObjectClassTestCase, LineBufferedFileObjectClassTestCase, SmallBufferedFileObjectClassTestCase ]) test_suppor... | 10,434 |
def proxy_open(self, req, proxy, type): orig_type = req.get_type() type, r_type = splittype(proxy) host, XXX = splithost(r_type) if '@' in host: user_pass, host = host.split('@', 1) user_pass = base64.encodestring(unquote(user_pass)).strip() req.add_header('Proxy-Authorization', 'Basic '+user_pass) host = unquote(host)... | def proxy_open(self, req, proxy, type): orig_type = req.get_type() type, r_type = splittype(proxy) host, XXX = splithost(r_type) if '@' in host: user_pass, host = host.split('@', 1) if ':' in user_pass: user, password = user_pass.split(':', 1) user_pass = base64.encodestring('%s:%s' % (unquote(user), unquote(password))... | 10,435 |
def do_open(self, http_class, req): host = req.get_host() if not host: raise URLError('no host given') | def do_open(self, http_class, req): host = req.get_host() if not host: raise URLError('no host given') | 10,436 |
def askdirectory (**options): "Ask for a directory, and return the file name" return Directory(**options).show() | def askdirectory (**options): "Ask for a directory, and return the file name" return Directory(**options).show() | 10,437 |
def _get_fqdn_hostname(name): name = string.strip(name) if len(name) == 0: name = socket.gethostname() try: hostname, aliases, ipaddrs = socket.gethostbyaddr(name) except socket.error: pass else: aliases.insert(0, hostname) for name in aliases: if '.' in name: break else: name = hostname return name | def make_fqdn(name = ''): """Get fully qualified domain name from name. An empty argument is interpreted as meaning the local host. First the hostname returned by socket.gethostbyaddr() is checked, then possibly existing aliases. In case no FQDN is available, hostname is returned. """ name = string.strip(name) if len... | 10,438 |
def _get_fqdn_hostname(name): name = string.strip(name) if len(name) == 0: name = socket.gethostname() try: hostname, aliases, ipaddrs = socket.gethostbyaddr(name) except socket.error: pass else: aliases.insert(0, hostname) for name in aliases: if '.' in name: break else: name = hostname return name | def _get_fqdn_hostname(name): name = string.strip(name) if len(name) == 0: name = socket.gethostname() try: hostname, aliases, ipaddrs = socket.gethostbyaddr(name) except socket.error: pass else: aliases.insert(0, hostname) for name in aliases: if '.' in name: break else: aliases.insert(0, hostname) for name in aliases... | 10,439 |
def _get_fqdn_hostname(name): name = string.strip(name) if len(name) == 0: name = socket.gethostname() try: hostname, aliases, ipaddrs = socket.gethostbyaddr(name) except socket.error: pass else: aliases.insert(0, hostname) for name in aliases: if '.' in name: break else: name = hostname return name | def _get_fqdn_hostname(name): name = string.strip(name) if len(name) == 0: name = socket.gethostname() try: hostname, aliases, ipaddrs = socket.gethostbyaddr(name) except socket.error: pass else: name = hostname return name | 10,440 |
def helo(self, name=''): """SMTP 'helo' command. Hostname to send for this command defaults to the FQDN of the local host. """ self.putcmd("helo", _get_fqdn_hostname(name)) (code,msg)=self.getreply() self.helo_resp=msg return (code,msg) | def helo(self, name=''): """SMTP 'helo' command. Hostname to send for this command defaults to the FQDN of the local host. """ if name: self.putcmd("helo", name) else: self.putcmd("helo", make_fqdn()) (code,msg)=self.getreply() self.helo_resp=msg return (code,msg) | 10,441 |
def ehlo(self, name=''): """ SMTP 'ehlo' command. Hostname to send for this command defaults to the FQDN of the local host. """ self.putcmd("ehlo", _get_fqdn_hostname(name)) (code,msg)=self.getreply() # According to RFC1869 some (badly written) # MTA's will disconnect on an ehlo. Toss an exception if # that happens -dd... | def ehlo(self, name=''): """ SMTP 'ehlo' command. Hostname to send for this command defaults to the FQDN of the local host. """ if name: self.putcmd("ehlo", name) else: self.putcmd("ehlo", make_fqdn()) (code,msg)=self.getreply() # According to RFC1869 some (badly written) # MTA's will disconnect on an ehlo. Toss an exc... | 10,442 |
def startElementNS(self, name, tagName , attrs): uri, localname = name if uri: # When using namespaces, the reader may or may not # provide us with the original name. If not, create # *a* valid tagName from the current context. if tagName is None: tagName = self._current_context[uri] + ":" + localname node = self.docum... | def startElementNS(self, name, tagName , attrs): uri, localname = name if uri: # When using namespaces, the reader may or may not # provide us with the original name. If not, create # *a* valid tagName from the current context. if tagName is None: prefix = self._current_context[uri] if prefix: tagName = prefix + ":" + ... | 10,443 |
def startElementNS(self, name, tagName , attrs): uri, localname = name if uri: # When using namespaces, the reader may or may not # provide us with the original name. If not, create # *a* valid tagName from the current context. if tagName is None: tagName = self._current_context[uri] + ":" + localname node = self.docum... | def startElementNS(self, name, tagName , attrs): uri, localname = name if uri: # When using namespaces, the reader may or may not # provide us with the original name. If not, create # *a* valid tagName from the current context. if tagName is None: tagName = self._current_context[uri] + ":" + localname node = self.docum... | 10,444 |
def __init__ (self, attrs=None): """Construct a new Distribution instance: initialize all the attributes of a Distribution, and then uses 'attrs' (a dictionary mapping attribute names to values) to assign some of those attributes their "real" values. (Any attributes not mentioned in 'attrs' will be assigned to some nu... | def __init__ (self, attrs=None): """Construct a new Distribution instance: initialize all the attributes of a Distribution, and then uses 'attrs' (a dictionary mapping attribute names to values) to assign some of those attributes their "real" values. (Any attributes not mentioned in 'attrs' will be assigned to some nu... | 10,445 |
def register_X_browsers(): # The default Gnome browser if _iscommand("gconftool-2"): # get the web browser string from gconftool gc = 'gconftool-2 -g /desktop/gnome/url-handlers/http/command 2>/dev/null' out = os.popen(gc) commd = out.read().strip() retncode = out.close() # if successful, register it if retncode is No... | def register_X_browsers(): # The default Gnome browser if _iscommand("gconftool-2"): # get the web browser string from gconftool gc = 'gconftool-2 -g /desktop/gnome/url-handlers/http/command 2>/dev/null' out = os.popen(gc) commd = out.read().strip() retncode = out.close() # if successful, register it if retncode is No... | 10,446 |
def get_package_dir (self, package): """Return the directory, relative to the top of the source distribution, where package 'package' should be found (at least according to the 'package_dir' option, if any).""" | def get_package_dir (self, package): """Return the directory, relative to the top of the source distribution, where package 'package' should be found (at least according to the 'package_dir' option, if any).""" | 10,447 |
def check_package (self, package, package_dir): | def check_package (self, package, package_dir): | 10,448 |
def find_modules (self): # Map package names to tuples of useful info about the package: # (package_dir, checked) # package_dir - the directory where we'll find source files for # this package # checked - true if we have checked that the package directory # is valid (exists, contains __init__.py, ... ?) packages... | def find_modules (self): # Map package names to tuples of useful info about the package: # (package_dir, checked) # package_dir - the directory where we'll find source files for # this package # checked - true if we have checked that the package directory # is valid (exists, contains __init__.py, ... ?) packages... | 10,449 |
def find_modules (self): # Map package names to tuples of useful info about the package: # (package_dir, checked) # package_dir - the directory where we'll find source files for # this package # checked - true if we have checked that the package directory # is valid (exists, contains __init__.py, ... ?) packages... | def find_modules (self): # Map package names to tuples of useful info about the package: # (package_dir, checked) # package_dir - the directory where we'll find source files for # this package # checked - true if we have checked that the package directory # is valid (exists, contains __init__.py, ... ?) packages... | 10,450 |
def find_modules (self): # Map package names to tuples of useful info about the package: # (package_dir, checked) # package_dir - the directory where we'll find source files for # this package # checked - true if we have checked that the package directory # is valid (exists, contains __init__.py, ... ?) packages... | def find_modules (self): # Map package names to tuples of useful info about the package: # (package_dir, checked) # package_dir - the directory where we'll find source files for # this package # checked - true if we have checked that the package directory # is valid (exists, contains __init__.py, ... ?) packages... | 10,451 |
def startDocument(self): self._out.write('<?xml version="1.0" encoding="%s"?>\n' % self._encoding) | def startDocument(self): self._write('<?xml version="1.0" encoding="%s"?>\n' % self._encoding) | 10,452 |
def startElement(self, name, attrs): self._out.write('<' + name) for (name, value) in attrs.items(): self._out.write(' %s=%s' % (name, quoteattr(value))) self._out.write('>') | def startElement(self, name, attrs): self._write('<' + name) for (name, value) in attrs.items(): self._out.write(' %s=%s' % (name, quoteattr(value))) self._out.write('>') | 10,453 |
def startElement(self, name, attrs): self._out.write('<' + name) for (name, value) in attrs.items(): self._out.write(' %s=%s' % (name, quoteattr(value))) self._out.write('>') | def startElement(self, name, attrs): self._out.write('<' + name) for (name, value) in attrs.items(): self._out.write(' %s=%s' % (name, quoteattr(value))) self._out.write('>') | 10,454 |
def endElement(self, name): self._out.write('</%s>' % name) | def endElement(self, name): self._out.write('</%s>' % name) | 10,455 |
def startElementNS(self, name, qname, attrs): if name[0] is None: # if the name was not namespace-scoped, use the unqualified part name = name[1] else: # else try to restore the original prefix from the namespace name = self._current_context[name[0]] + ":" + name[1] self._out.write('<' + name) | def startElementNS(self, name, qname, attrs): if name[0] is None: # if the name was not namespace-scoped, use the unqualified part name = name[1] else: # else try to restore the original prefix from the namespace name = self._current_context[name[0]] + ":" + name[1] self._out.write('<' + name) | 10,456 |
def startElementNS(self, name, qname, attrs): if name[0] is None: # if the name was not namespace-scoped, use the unqualified part name = name[1] else: # else try to restore the original prefix from the namespace name = self._current_context[name[0]] + ":" + name[1] self._out.write('<' + name) | def startElementNS(self, name, qname, attrs): if name[0] is None: # if the name was not namespace-scoped, use the unqualified part name = name[1] else: # else try to restore the original prefix from the namespace name = self._current_context[name[0]] + ":" + name[1] self._out.write('<' + name) | 10,457 |
def startElementNS(self, name, qname, attrs): if name[0] is None: # if the name was not namespace-scoped, use the unqualified part name = name[1] else: # else try to restore the original prefix from the namespace name = self._current_context[name[0]] + ":" + name[1] self._out.write('<' + name) | def startElementNS(self, name, qname, attrs): if name[0] is None: # if the name was not namespace-scoped, use the unqualified part name = name[1] else: # else try to restore the original prefix from the namespace name = self._current_context[name[0]] + ":" + name[1] self._out.write('<' + name) | 10,458 |
def endElementNS(self, name, qname): if name[0] is None: name = name[1] else: name = self._current_context[name[0]] + ":" + name[1] self._out.write('</%s>' % name) | def endElementNS(self, name, qname): if name[0] is None: name = name[1] else: name = self._current_context[name[0]] + ":" + name[1] self._out.write('</%s>' % name) | 10,459 |
def characters(self, content): self._out.write(escape(content)) | def characters(self, content): self._out.write(escape(content)) | 10,460 |
def ignorableWhitespace(self, content): self._out.write(content) | def ignorableWhitespace(self, content): self._out.write(content) | 10,461 |
def processingInstruction(self, target, data): self._out.write('<?%s %s?>' % (target, data)) | def processingInstruction(self, target, data): self._out.write('<?%s %s?>' % (target, data)) | 10,462 |
def main(): # overridable context prefix = None # settable with -p option exec_prefix = None # settable with -P option extensions = [] path = sys.path odir = '' # output files frozen_c = 'frozen.c' config_c = 'config.c' target = 'a.out' # normally derived from script name makefile = 'Makefile' # parse command lin... | def main(): # overridable context prefix = None # settable with -p option exec_prefix = None # settable with -P option extensions = [] path = sys.path odir = '' # output files frozen_c = 'frozen.c' config_c = 'config.c' target = 'a.out' # normally derived from script name makefile = 'Makefile' # parse command lin... | 10,463 |
def __getitem__(self, i): if i < 0 or i > 2: raise IndexError return i + 4 | def __getitem__(self, i): if i < 0 or i > 2: raise IndexError return i + 4 | 10,464 |
def __getitem__(self, i): if i < 0 or i > 2: raise IndexError return i + 4 | def __getitem__(self, i): if i < 0 or i > 2: raise IndexError return i + 4 | 10,465 |
def recolorize_main(self): next = "1.0" was_ok = is_ok = 0 while 1: item = self.tag_nextrange("TODO", next) if not item: break head, tail = item self.tag_remove("SYNC", head, tail) item = self.tag_prevrange("SYNC", head) if item: head = item[1] else: head = "1.0" | def recolorize_main(self): next = "1.0" was_ok = is_ok = 0 while 1: item = self.tag_nextrange("TODO", next) if not item: break head, tail = item self.tag_remove("SYNC", head, tail) item = self.tag_prevrange("SYNC", head) if item: head = item[1] else: head = "1.0" | 10,466 |
def build_extension(self, ext): | def build_extension(self, ext): | 10,467 |
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') | 10,468 |
def dynamics(): if verbose: print "Testing __dynamic__..." verify(object.__dynamic__ == 0) verify(list.__dynamic__ == 0) class S1: __metaclass__ = type verify(S1.__dynamic__ == 0) class S(object): pass verify(C.__dynamic__ == 0) class D(object): __dynamic__ = 1 verify(D.__dynamic__ == 1) class E(D, S): pass verify(E.__... | def dynamics(): if verbose: print "Testing __dynamic__..." verify(object.__dynamic__ == 0) verify(list.__dynamic__ == 0) class S1: __metaclass__ = type verify(S1.__dynamic__ == 0) class S(object): pass verify(S.__dynamic__ == 0) class D(object): __dynamic__ = 1 verify(D.__dynamic__ == 1) class E(D, S): pass verify(E.__... | 10,469 |
def __bootstrap(self): try: self.__started = True _active_limbo_lock.acquire() _active[_get_ident()] = self del _limbo[self] _active_limbo_lock.release() if __debug__: self._note("%s.__bootstrap(): thread started", self) | def __bootstrap(self): try: self.__started = True _active_limbo_lock.acquire() _active[_get_ident()] = self del _limbo[self] _active_limbo_lock.release() if __debug__: self._note("%s.__bootstrap(): thread started", self) | 10,470 |
def _show(title=None, message=None, icon=None, type=None, **options): if icon: options["icon"] = icon if type: options["type"] = type if title: options["title"] = title if message: options["message"] = message res = Message(**options).show() # In some Tcl installations, Tcl converts yes/no into a boolean if isi... | def _show(title=None, message=None, _icon=None, _type=None, **options): if _icon and "icon" not in options: options["icon"] = _icon if _type and "type" not in options: options["type"] = _type if title: options["title"] = title if message: options["message"] = message res = Message(**options).show() # In some T... | 10,471 |
def __init__(self, s=None, charset=None, maxlinelen=None, header_name=None, continuation_ws=' '): """Create a MIME-compliant header that can contain many character sets. | def __init__(self, s=None, charset=None, maxlinelen=None, header_name=None, continuation_ws=' ', errors='strict'): """Create a MIME-compliant header that can contain many character sets. | 10,472 |
def __init__(self, s=None, charset=None, maxlinelen=None, header_name=None, continuation_ws=' '): """Create a MIME-compliant header that can contain many character sets. | def __init__(self, s=None, charset=None, maxlinelen=None, header_name=None, continuation_ws=' '): """Create a MIME-compliant header that can contain many character sets. | 10,473 |
def append(self, s, charset=None): """Append a string to the MIME header. | def append(self, s, charset=None, errors='strict'): """Append a string to the MIME header. | 10,474 |
def append(self, s, charset=None): """Append a string to the MIME header. | def append(self, s, charset=None): """Append a string to the MIME header. | 10,475 |
def append(self, s, charset=None): """Append a string to the MIME header. | def append(self, s, charset=None): """Append a string to the MIME header. | 10,476 |
def append(self, s, charset=None): """Append a string to the MIME header. | def append(self, s, charset=None): """Append a string to the MIME header. | 10,477 |
def _ipaddress(str): if type(str) == type(1): return str # Already numeric ptr = macdnr.StrToAddr(str) ptr.wait() return ptr.ip0 | def _ipaddress(str): if type(str) == type(1): return str # Already numeric ptr = macdnr.StrToAddr(str) ptr.wait() return ptr.ip0 | 10,478 |
def gethostbyname(str): id = _ipaddress(str) return macdnr.AddrToStr(id) | def gethostbyname(str): id = _ipaddress(str) return macdnr.AddrToStr(id) | 10,479 |
def _gethostaddress(): global _myaddrstr if _myaddrstr == None: id = _myipaddress() _myaddrstr = macdnr.AddrToStr(id) return _myaddrstr | def _gethostaddress(): global _myaddrstr if _myaddrstr == None: id = _myipaddress() _myaddrstr = macdnr.AddrToStr(id) return _myaddrstr | 10,480 |
def socket(family, type, *which): if family <> AF_INET: raise my_error, 'Protocol family not supported' if type == SOCK_DGRAM: return _udpsocket() elif type == SOCK_STREAM: return _tcpsocket() raise my_error, 'Protocol type not supported' | def socket(family, type, *which): if family <> AF_INET: raise my_error, 'Protocol family %d not supported' % type if type == SOCK_DGRAM: return _udpsocket() elif type == SOCK_STREAM: return _tcpsocket() raise my_error, 'Protocol type not supported' | 10,481 |
def socket(family, type, *which): if family <> AF_INET: raise my_error, 'Protocol family not supported' if type == SOCK_DGRAM: return _udpsocket() elif type == SOCK_STREAM: return _tcpsocket() raise my_error, 'Protocol type not supported' | def socket(family, type, *which): if family <> AF_INET: raise my_error, 'Protocol family not supported' if type == SOCK_DGRAM: return _udpsocket() elif type == SOCK_STREAM: return _tcpsocket() raise my_error, 'Protocol type not supported' | 10,482 |
def fromfd(*args): raise my_error, 'Operation not supported on a mac' | def fromfd(*args): raise my_error, 'Operation not supported on a mac' | 10,483 |
def accept(self, *args): raise my_error, 'Operation not supported on this socket' | def unsupported(self, *args): raise my_error, 'Operation not supported on this socket' | 10,484 |
def accept(self, *args): raise my_error, 'Operation not supported on this socket' | def accept(self, *args): raise my_error, 'Operation not supported on this socket' | 10,485 |
def accept(self): if not self.listening: raise my_error, 'Not listening' self.listening = 0 self.stream.wait() self.accepted = 1 return self, self.getsockname() | def accept(self): if not self.listening: raise my_error, 'Not listening' self.listening = 0 self.stream.wait() self.accepted = 1 return self, self.getsockname() | 10,486 |
def close(self): if self.accepted: self.accepted = 0 return self.stream.Abort() | def close(self): if self.accepted: self.accepted = 0 return self.stream.Abort() | 10,487 |
def makefile(self, rw): return _socketfile(self) | def makefile(self, rw = 'r'): return _socketfile(self, rw) | 10,488 |
def bytes_writeable(self): st = self.stream.Status() return st.sendWindow - st.sendUnacked; | def bytes_writeable(self): st = self.stream.Status() return st.sendWindow - st.sendUnacked; | 10,489 |
def __init__(self): pass | def __init__(self): pass | 10,490 |
def __init__(self, sock): self.sock = sock self.buf = '' | def __init__(self, sock, rw): if rw not in ('r', 'w'): raise ValueError, "mode must be 'r' or 'w'" self.sock = sock self.buf = '' | 10,491 |
def read(self, *arg): if arg: length = arg else: length = 0x7fffffff while len(self.buf) < length: new = self.sock.recv(0x7fffffff) if not new: break self.buf = self.buf + new rv = self.buf[:length] self.buf = self.buf[length:] return rv | def read(self, length = 0): if length <= 0: length = 0x7fffffff while len(self.buf) < length: new = self.sock.recv(0x7fffffff) if not new: break self.buf = self.buf + new rv = self.buf[:length] self.buf = self.buf[length:] return rv | 10,492 |
def readline(self): import string while not '\n' in self.buf: new = self.sock.recv(0x7fffffff) if not new: break self.buf = self.buf + new if not '\n' in self.buf: rv = self.buf self.buf = '' else: i = string.index(self.buf, '\n') rv = self.buf[:i+1] self.buf = self.buf[i+1:] return rv | def readline(self): import string while not '\n' in self.buf: new = self.sock.recv(0x7fffffff) if not new: break self.buf = self.buf + new if not '\n' in self.buf: rv = self.buf self.buf = '' else: i = string.index(self.buf, '\n') rv = self.buf[:i+1] self.buf = self.buf[i+1:] return rv | 10,493 |
def write(self, buf): self.sock.send(buf) | def write(self, buf): self.sock.send(buf) | 10,494 |
def close(self): self.sock.close() del self.sock | def close(self): self.flush() del self.sock | 10,495 |
def close(self): self.sock.close() del self.sock | def close(self): self.sock.close() del self.sock | 10,496 |
def process_request_thread(self, request, client_address): """Same as in BaseServer but as a thread.""" self.finish_request(request, client_address) self.close_request(request) | def process_request_thread(self, request, client_address): """Same as in BaseServer but as a thread.""" self.finish_request(request, client_address) self.close_request(request) | 10,497 |
def parseArgumentList(self, args): args0, arg1, argsrest = args[:1], args[1], args[2:] t0, n0, m0 = arg1 args = args0 + argsrest if m0 != InMode: raise ValueError, "method's 'self' must be 'InMode'" self.itself = Variable(t0, "_self->ob_itself", SelfMode) FunctionGenerator.parseArgumentList(self, args) self.argumentLis... | def parseArgumentList(self, args): args0, arg1, argsrest = args[:1], args[1], args[2:] t0, n0, m0 = arg1 args = args0 + argsrest if m0 != InMode: raise ValueError, "method's 'self' must be 'InMode'" self.itself = Variable(t0, "_self->ob_itself", SelfMode) FunctionGenerator.parseArgumentList(self, args) self.argumentLis... | 10,498 |
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... | def test_parsedate_acceptable_to_time_functions(self): eq = self.assertEqual timetup = Utils.parsedate('5 Feb 2003 13:47:26 -0800') t = int(time.mktime(timetup)) eq(time.localtime(t)[:6], timetup[:6]) eq(int(time.strftime('%Y', timetup)), 2003) timetup = Utils.parsedate_tz('5 Feb 2003 13:47:26 -0800') eq(int(time.mktim... | 10,499 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.