rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
mod = imp.new_module(fullname) sys.modules[fullname] = mod | mod = sys.modules.setdefault(fullname,imp.new_module(fullname)) | def load_module(self, fullname): ispkg, code = self.modules[fullname] mod = imp.new_module(fullname) sys.modules[fullname] = mod mod.__file__ = "<%s>" % self.__class__.__name__ mod.__loader__ = self if ispkg: mod.__path__ = self._get__path__() exec code in mod.__dict__ return mod |
def generate_help (header=None): | def generate_help (self, header=None): | def generate_help (header=None): """Generate help text (a list of strings, one per suggested line of output) from the option table for this FancyGetopt object.""" |
def print_help (self, file=None, header=None): | def print_help (self, header=None, file=None): | def print_help (self, file=None, header=None): if file is None: file = sys.stdout for line in self.generate_help (header): file.write (line + "\n") |
testtype('u', u'\u263a') | if have_unicode: testtype('u', unicode(r'\u263a', 'unicode-escape')) | def main(): testtype('c', 'c') testtype('u', u'\u263a') for type in (['b', 'h', 'i', 'l', 'f', 'd']): testtype(type, 1) testunicode() testsubclassing() unlink(TESTFN) |
testunicode() | if have_unicode: testunicode() | def main(): testtype('c', 'c') testtype('u', u'\u263a') for type in (['b', 'h', 'i', 'l', 'f', 'd']): testtype(type, 1) testunicode() testsubclassing() unlink(TESTFN) |
array.array('b', u'foo') | array.array('b', unicode('foo', 'ascii')) | def testunicode(): try: array.array('b', u'foo') except TypeError: pass else: raise TestFailed("creating a non-unicode array from " "a Unicode string should fail") x = array.array('u', u'\xa0\xc2\u1234') x.fromunicode(u' ') x.fromunicode(u'') x.fromunicode(u'') x.fromunicode(u'\x11abc\xff\u1234') s = x.tounicode() if ... |
x = array.array('u', u'\xa0\xc2\u1234') x.fromunicode(u' ') x.fromunicode(u'') x.fromunicode(u'') x.fromunicode(u'\x11abc\xff\u1234') | x = array.array('u', unicode(r'\xa0\xc2\u1234', 'unicode-escape')) x.fromunicode(unicode(' ', 'ascii')) x.fromunicode(unicode('', 'ascii')) x.fromunicode(unicode('', 'ascii')) x.fromunicode(unicode(r'\x11abc\xff\u1234', 'unicode-escape')) | def testunicode(): try: array.array('b', u'foo') except TypeError: pass else: raise TestFailed("creating a non-unicode array from " "a Unicode string should fail") x = array.array('u', u'\xa0\xc2\u1234') x.fromunicode(u' ') x.fromunicode(u'') x.fromunicode(u'') x.fromunicode(u'\x11abc\xff\u1234') s = x.tounicode() if ... |
if s != u'\xa0\xc2\u1234 \x11abc\xff\u1234': | if s != unicode(r'\xa0\xc2\u1234 \x11abc\xff\u1234', 'unicode-escape'): | def testunicode(): try: array.array('b', u'foo') except TypeError: pass else: raise TestFailed("creating a non-unicode array from " "a Unicode string should fail") x = array.array('u', u'\xa0\xc2\u1234') x.fromunicode(u' ') x.fromunicode(u'') x.fromunicode(u'') x.fromunicode(u'\x11abc\xff\u1234') s = x.tounicode() if ... |
s = u'\x00="\'a\\b\x80\xff\u0000\u0001\u1234' | s = unicode(r'\x00="\'a\\b\x80\xff\u0000\u0001\u1234', 'unicode-escape') | def testunicode(): try: array.array('b', u'foo') except TypeError: pass else: raise TestFailed("creating a non-unicode array from " "a Unicode string should fail") x = array.array('u', u'\xa0\xc2\u1234') x.fromunicode(u' ') x.fromunicode(u'') x.fromunicode(u'') x.fromunicode(u'\x11abc\xff\u1234') s = x.tounicode() if ... |
def test(): root = Tk() def doit(root=root): d = SimpleDialog(root, | if __name__ == '__main__': def test(): root = Tk() def doit(root=root): d = SimpleDialog(root, | def test(): root = Tk() def doit(root=root): d = SimpleDialog(root, text="This is a test dialog. " "Would this have been an actual dialog, " "the buttons below would have been glowing " "in soft pink light.\n" "Do you believe this?", buttons=["Yes", "No", "Cancel"], default=0, cancel=2, title="Test Dialog") print d.go... |
if __name__ == '__main__': | def doit(root=root): d = SimpleDialog(root, text="This is a test dialog. " "Would this have been an actual dialog, " "the buttons below would have been glowing " "in soft pink light.\n" "Do you believe this?", buttons=["Yes", "No", "Cancel"], default=0, cancel=2, title="Test Dialog") print d.go() | |
args=(), kwargs={}, verbose=None): | args=(), kwargs=None, verbose=None): | def __init__(self, group=None, target=None, name=None, args=(), kwargs={}, verbose=None): assert group is None, "group argument must be None for now" _Verbose.__init__(self, verbose) self.__target = target self.__name = str(name or _newname()) self.__args = args self.__kwargs = kwargs self.__daemonic = self._set_daemon... |
libraries, extradirs, extraexportsymbols, outputdir) | libraries, extradirs, extraexportsymbols, outputdir, libraryflags, stdlibraryflags, prefixname) | def genpluginproject(architecture, module, project=None, projectdir=None, sources=[], sourcedirs=[], libraries=[], extradirs=[], extraexportsymbols=[], outputdir=":::Lib:lib-dynload", libraryflags=None, stdlibraryflags=None, prefixname=None): if architecture == "all": # For the time being we generate two project files.... |
genpluginproject("all", "_Res", outputdir="::Lib:Carbon") | genpluginproject("all", "_Res", stdlibraryflags="Debug, WeakImport", outputdir="::Lib:Carbon") | def genpluginproject(architecture, module, project=None, projectdir=None, sources=[], sourcedirs=[], libraries=[], extradirs=[], extraexportsymbols=[], outputdir=":::Lib:lib-dynload", libraryflags=None, stdlibraryflags=None, prefixname=None): if architecture == "all": # For the time being we generate two project files.... |
nil = fp.read() fp.close() | def http_error_302(self, req, fp, code, msg, headers): if headers.has_key('location'): newurl = headers['location'] elif headers.has_key('uri'): newurl = headers['uri'] else: return nil = fp.read() fp.close() | |
self.inf_msg + msg, headers) | self.inf_msg + msg, headers, fp) | def http_error_302(self, req, fp, code, msg, headers): if headers.has_key('location'): newurl = headers['location'] elif headers.has_key('uri'): newurl = headers['uri'] else: return nil = fp.read() fp.close() |
p | def do_proxy(self, p, req): p return self.parent.open(req) | |
passwd = HTTPPassowrdMgr() | passwd = HTTPPasswordMgr() | def __init__(self, passwd=None): if passwd is None: passwd = HTTPPassowrdMgr() self.passwd = passwd self.add_password = self.passwd.add_password self.__current_realm = None |
opener = OpenerDirectory() | opener = OpenerDirector() | def build_opener(self): opener = OpenerDirectory() for ph in self.proxy_handlers: if type(ph) == types.ClassType: ph = ph() opener.add_handler(ph) |
a[8] and b[17] match for 6 elements a[14] and b[23] match for 15 elements | a[8] and b[17] match for 21 elements | def _calculate_ratio(matches, length): if length: return 2.0 * matches / length return 1.0 |
equal a[8:14] b[17:23] equal a[14:29] b[23:38] | equal a[8:29] b[17:38] | def _calculate_ratio(matches, length): if length: return 2.0 * matches / length return 1.0 |
i and in j. | i and in j. New in Python 2.5, it's also guaranteed that if (i, j, n) and (i', j', n') are adjacent triples in the list, and the second is not the last triple in the list, then i+n != i' or j+n != j'. IOW, adjacent triples never describe adjacent equal blocks. | def get_matching_blocks(self): """Return list of triples describing matching subsequences. |
self.matching_blocks = matching_blocks = [] | def get_matching_blocks(self): """Return list of triples describing matching subsequences. | |
matching_blocks.append( (la, lb, 0) ) return matching_blocks | i1 = j1 = k1 = 0 non_adjacent = [] for i2, j2, k2 in matching_blocks: if i1 + k1 == i2 and j1 + k1 == j2: k1 += k2 else: if k1: non_adjacent.append((i1, j1, k1)) i1, j1, k1 = i2, j2, k2 if k1: non_adjacent.append((i1, j1, k1)) non_adjacent.append( (la, lb, 0) ) self.matching_blocks = non_adjacent return self.ma... | def get_matching_blocks(self): """Return list of triples describing matching subsequences. |
self.msg('IAC %s %d', c == DO and 'DO' or 'DONT', ord(c)) self.sock.send(IAC + WONT + opt) | self.msg('IAC %s %d', c == DO and 'DO' or 'DONT', ord(opt)) if self.option_callback: self.option_callback(self.sock, c, opt) else: self.sock.send(IAC + WONT + opt) | def process_rawq(self): """Transfer from raw queue to cooked queue. |
c == WILL and 'WILL' or 'WONT', ord(c)) self.sock.send(IAC + DONT + opt) | c == WILL and 'WILL' or 'WONT', ord(opt)) if self.option_callback: self.option_callback(self.sock, c, opt) else: self.sock.send(IAC + DONT + opt) | def process_rawq(self): """Transfer from raw queue to cooked queue. |
self.msg('IAC %s not recognized' % `c`) | self.msg('IAC %d not recognized' % ord(opt)) | def process_rawq(self): """Transfer from raw queue to cooked queue. |
for l in text[1:]: lines.append (big_indent + l) | def generate_help (self, header=None): """Generate help text (a list of strings, one per suggested line of output) from the option table for this FancyGetopt object.""" | |
def putrequest(self, method, url, skip_host=0): | def putrequest(self, method, url, skip_host=0, skip_accept_encoding=0): | def putrequest(self, method, url, skip_host=0): """Send a request to the server. |
self.putheader('Accept-Encoding', 'identity') | if not skip_accept_encoding: self.putheader('Accept-Encoding', 'identity') | def putrequest(self, method, url, skip_host=0): """Send a request to the server. |
verify(float(a).__class__ is float) | def __repr__(self): return "%.*g" % (self.prec, self) | |
self.announce(e.msg, log.ERROR) | self.announce(str(e), log.ERROR) | def upload_file(self, command, pyversion, filename): # Sign if requested if self.sign: gpg_args = ["gpg", "--detach-sign", "-a", filename] if self.identity: gpg_args[2:2] = ["--local-user", self.identity] spawn(gpg_args, dry_run=self.dry_run) |
except IOError: | except IOError, reason: | def main(self): |
if timeout is None: while not self.__stopped: self.__block.wait() if __debug__: self._note("%s.join(): thread stopped", self) else: deadline = _time() + timeout while not self.__stopped: delay = deadline - _time() if delay <= 0: if __debug__: self._note("%s.join(): timed out", self) break self.__block.wait(delay) else: | try: if timeout is None: while not self.__stopped: self.__block.wait() | def join(self, timeout=None): assert self.__initialized, "Thread.__init__() not called" assert self.__started, "cannot join thread before it is started" assert self is not currentThread(), "cannot join current thread" if __debug__: if not self.__stopped: self._note("%s.join(): waiting until thread stops", self) self.__... |
self.__block.release() | else: deadline = _time() + timeout while not self.__stopped: delay = deadline - _time() if delay <= 0: if __debug__: self._note("%s.join(): timed out", self) break self.__block.wait(delay) else: if __debug__: self._note("%s.join(): thread stopped", self) finally: self.__block.release() | def join(self, timeout=None): assert self.__initialized, "Thread.__init__() not called" assert self.__started, "cannot join thread before it is started" assert self is not currentThread(), "cannot join current thread" if __debug__: if not self.__stopped: self._note("%s.join(): waiting until thread stops", self) self.__... |
except pickle.UnpicklingError: | except pickle.PicklingError: | def putmessage(self, message): self.debug("putmessage:%d:" % message[0]) try: s = pickle.dumps(message) except pickle.UnpicklingError: print >>sys.__stderr__, "Cannot pickle:", `message` raise s = struct.pack("<i", len(s)) + s while len(s) > 0: try: n = self.sock.send(s) except (AttributeError, socket.error): # socket ... |
n = self.sock.send(s) | r, w, x = select.select([], [self.sock], []) n = self.sock.send(s[:BUFSIZE]) | def putmessage(self, message): self.debug("putmessage:%d:" % message[0]) try: s = pickle.dumps(message) except pickle.UnpicklingError: print >>sys.__stderr__, "Cannot pickle:", `message` raise s = struct.pack("<i", len(s)) + s while len(s) > 0: try: n = self.sock.send(s) except (AttributeError, socket.error): # socket ... |
def ioready(self, wait): r, w, x = select.select([self.sock.fileno()], [], [], wait) return len(r) | def ioready(self, wait): r, w, x = select.select([self.sock.fileno()], [], [], wait) return len(r) | |
if not self.ioready(wait): | r, w, x = select.select([self.sock.fileno()], [], [], wait) if len(r) == 0: | def pollpacket(self, wait): self._stage0() if len(self.buffer) < self.bufneed: if not self.ioready(wait): return None try: s = self.sock.recv(BUFSIZE) except socket.error: raise EOFError if len(s) == 0: raise EOFError self.buffer += s self._stage0() return self._stage1() |
except: | except pickle.UnpicklingError: | def pollmessage(self, wait): packet = self.pollpacket(wait) if packet is None: return None try: message = pickle.loads(packet) except: print >>sys.__stderr__, "-----------------------" print >>sys.__stderr__, "cannot unpickle packet:", `packet` traceback.print_stack(file=sys.__stderr__) print >>sys.__stderr__, "-------... |
for data in f[1]: data = convert_path(data) (out, _) = self.copy_file(data, dir) self.outfiles.append(out) | if f[1] == []: self.outfiles.append(dir) else: for data in f[1]: data = convert_path(data) (out, _) = self.copy_file(data, dir) self.outfiles.append(out) | def run (self): self.mkpath(self.install_dir) for f in self.data_files: if type(f) == StringType: # it's a simple file, so copy it f = convert_path(f) if self.warn_dir: self.warn("setup script did not provide a directory for " "'%s' -- installing right in '%s'" % (f, self.install_dir)) (out, _) = self.copy_file(f, self... |
from Carbon import Qd | def close(self): if self.editgroup.editor.changed: import EasyDialogs from Carbon import Qd Qd.InitCursor() save = EasyDialogs.AskYesNoCancel('Save window "%s" before closing?' % self.title, default=1, no="Don\xd5t save") if save > 0: if self.domenu_save(): return 1 elif save < 0: return 1 self.globals = None W.Window.... | |
import Qd; Qd.InitCursor() | Qd.InitCursor() | def _run(self): if self.run_with_interpreter: if self.editgroup.editor.changed: import EasyDialogs import Qd; Qd.InitCursor() save = EasyDialogs.AskYesNoCancel('Save "%s" before running?' % self.title, 1) if save > 0: if self.domenu_save(): return elif save < 0: return if not self.path: raise W.AlertError, "Can't run u... |
if self._eoln != '\n': import EasyDialogs ok = EasyDialogs.AskYesNoCancel('Warning: "%s" does not have Unix line-endings' % self.title, 1, yes='OK', no='') if not ok: return | def _run(self): if self.run_with_interpreter: if self.editgroup.editor.changed: import EasyDialogs import Qd; Qd.InitCursor() save = EasyDialogs.AskYesNoCancel('Save "%s" before running?' % self.title, 1) if save > 0: if self.domenu_save(): return elif save < 0: return if not self.path: raise W.AlertError, "Can't run u... | |
if type(value) != type([]): | if type(value) not in (type([]), type( () )): | def post_to_server(self, data, auth=None): ''' Post a query to the server, and return a string response. ''' |
def seek(self, pos, whence=0): if whence==1: self.pos = self.pos + pos if whence==2: self.pos = self.stop + pos else: self.pos = self.start + pos | def __init__(self, fp, factory=rfc822.Message): self.fp = fp self.seekp = 0 self.factory = factory | |
self.closed = 0 | self.closed = False | def __init__(self, buf = ''): # Force self.buf to be a string or unicode if not isinstance(buf, basestring): buf = str(buf) self.buf = buf self.len = len(buf) self.buflist = [] self.pos = 0 self.closed = 0 self.softspace = 0 |
self.closed = 1 | self.closed = True | def close(self): """Free the memory buffer. """ if not self.closed: self.closed = 1 del self.buf, self.pos |
if self.closed: raise ValueError, "I/O operation on closed file" | _complain_ifclosed(self.closed) | def isatty(self): if self.closed: raise ValueError, "I/O operation on closed file" return False |
if self.closed: raise ValueError, "I/O operation on closed file" | _complain_ifclosed(self.closed) | def seek(self, pos, mode = 0): if self.closed: raise ValueError, "I/O operation on closed file" if self.buflist: self.buf += ''.join(self.buflist) self.buflist = [] if mode == 1: pos += self.pos elif mode == 2: pos += self.len self.pos = max(0, pos) |
if self.closed: raise ValueError, "I/O operation on closed file" | _complain_ifclosed(self.closed) | def tell(self): if self.closed: raise ValueError, "I/O operation on closed file" return self.pos |
if self.closed: raise ValueError, "I/O operation on closed file" | _complain_ifclosed(self.closed) | def read(self, n = -1): if self.closed: raise ValueError, "I/O operation on closed file" if self.buflist: self.buf += ''.join(self.buflist) self.buflist = [] if n < 0: newpos = self.len else: newpos = min(self.pos+n, self.len) r = self.buf[self.pos:newpos] self.pos = newpos return r |
if self.closed: raise ValueError, "I/O operation on closed file" | _complain_ifclosed(self.closed) | def readline(self, length=None): if self.closed: raise ValueError, "I/O operation on closed file" if self.buflist: self.buf += ''.join(self.buflist) self.buflist = [] i = self.buf.find('\n', self.pos) if i < 0: newpos = self.len else: newpos = i+1 if length is not None: if self.pos + length < newpos: newpos = self.pos ... |
if self.closed: raise ValueError, "I/O operation on closed file" | _complain_ifclosed(self.closed) | def truncate(self, size=None): if self.closed: raise ValueError, "I/O operation on closed file" if size is None: size = self.pos elif size < 0: raise IOError(EINVAL, "Negative size not allowed") elif size < self.pos: self.pos = size self.buf = self.getvalue()[:size] |
if self.closed: raise ValueError, "I/O operation on closed file" | _complain_ifclosed(self.closed) | def write(self, s): if self.closed: raise ValueError, "I/O operation on closed file" if not s: return # Force s to be a string or unicode if not isinstance(s, basestring): s = str(s) if self.pos == self.len: self.buflist.append(s) self.len = self.pos = self.pos + len(s) return if self.pos > self.len: self.buflist.appen... |
if self.closed: raise ValueError, "I/O operation on closed file" | _complain_ifclosed(self.closed) | def flush(self): if self.closed: raise ValueError, "I/O operation on closed file" |
except TypeError: | except (AttributeError, TypeError): | def softspace(file, newvalue): oldvalue = 0 try: oldvalue = file.softspace except AttributeError: pass try: file.softspace = newvalue except TypeError: # "attribute-less object" or "read-only attributes" pass return oldvalue |
raise ValueError("time data did not match format") | raise ValueError("time data did not match format: data=%s fmt=%s" % (data_string, format)) | def strptime(data_string, format="%a %b %d %H:%M:%S %Y"): """Return a time struct based on the input data and the format string.""" global _locale_cache global _regex_cache locale_time = _locale_cache.locale_time # If the language changes, caches are invalidated, so clear them if locale_time.lang != _getlang(): _locale... |
'marshal', 'math', 'md5', 'operator', | 'math', 'md5', 'operator', | def reload(self, module, path=None): if path is None and hasattr(module, '__filename__'): head, tail = os.path.split(module.__filename__) path = [os.path.join(head, '')] return ihooks.ModuleImporter.reload(self, module, path) |
'Content-Type: %s\n' % (mtype or 'text/plain'))) host, file = splithost(url) | 'Content-Type: %s\nContent-Length: %d\nLast-modified: %s\n' % (mtype or 'text/plain', size, modified))) | def open_local_file(self, url): """Use local file.""" import mimetypes, mimetools, StringIO mtype = mimetypes.guess_type(url)[0] headers = mimetools.Message(StringIO.StringIO( 'Content-Type: %s\n' % (mtype or 'text/plain'))) host, file = splithost(url) if not host: urlfile = file if file[:1] == '/': urlfile = 'file://'... |
return addinfourl(open(url2pathname(file), 'rb'), | return addinfourl(open(localname, 'rb'), | def open_local_file(self, url): """Use local file.""" import mimetypes, mimetools, StringIO mtype = mimetypes.guess_type(url)[0] headers = mimetools.Message(StringIO.StringIO( 'Content-Type: %s\n' % (mtype or 'text/plain'))) host, file = splithost(url) if not host: urlfile = file if file[:1] == '/': urlfile = 'file://'... |
"exclude=", "include=", "package=", "strip") | "exclude=", "include=", "package=", "strip", "iconfile=") | def main(builder=None): if builder is None: builder = AppBuilder(verbosity=1) shortopts = "b:n:r:e:m:c:p:lx:i:hvq" longopts = ("builddir=", "name=", "resource=", "executable=", "mainprogram=", "creator=", "nib=", "plist=", "link", "link-exec", "help", "verbose", "quiet", "standalone", "exclude=", "include=", "package=... |
p = Parser() | p = Parser(strict=1) | def test_bogus_boundary(self): fp = openfile(findfile('msg_15.txt')) try: data = fp.read() finally: fp.close() p = Parser() # Note, under a future non-strict parsing mode, this would parse the # message into the intended message tree. self.assertRaises(Errors.BoundaryError, p.parsestr, data) |
ExistingwasteObj_New, &we) ) return NULL; | WEOObj_Convert, &we) ) return NULL; | def outputCheckNewArg(self): Output("""if (itself == NULL) { Py_INCREF(Py_None); return Py_None; }""") |
def join(a, b): if isabs(b): return b if a == '' or a[-1:] in '/\\': return a + b return a + os.sep + b | def join(a, *p): path = a for b in p: if isabs(b): path = b elif path == '' or path[-1:] in '/\\': path = path + b else: path = path + os.sep + b return path | def isabs(s): s = splitdrive(s)[1] return s != '' and s[:1] in '/\\' |
option = string.lower(option) | option = self.optionxform(option) | def get(self, section, option, raw=0, vars=None): """Get an option value for a given section. |
__SECTCRE = re.compile( | SECTCRE = re.compile( | def getboolean(self, section, option): v = self.get(section, option) val = string.atoi(v) if val not in (0, 1): raise ValueError, 'Not a boolean: %s' % v return val |
__OPTCRE = re.compile( | OPTCRE = re.compile( | def getboolean(self, section, option): v = self.get(section, option) val = string.atoi(v) if val not in (0, 1): raise ValueError, 'Not a boolean: %s' % v return val |
mo = self.__SECTCRE.match(line) | mo = self.SECTCRE.match(line) | def __read(self, fp): """Parse a sectioned setup file. |
mo = self.__OPTCRE.match(line) | mo = self.OPTCRE.match(line) | def __read(self, fp): """Parse a sectioned setup file. |
opts, args = getopt.getopt(sys.argv[1:], 'e:p:') | opts, args = getopt.getopt(sys.argv[1:], 'e:p:P:') | def main(): # overridable context prefix = PREFIX # settable with -p option extensions = [] path = sys.path # output files frozen_c = 'frozen.c' config_c = 'config.c' target = 'a.out' # normally derived from script name makefile = 'Makefile' # parse command line try: opts, args = getopt.getopt(sys.argv[1:], 'e:p:'... |
binlib = os.path.join(prefix, 'lib/python/lib') | binlib = os.path.join(exec_prefix, 'lib/python/lib') | def main(): # overridable context prefix = PREFIX # settable with -p option extensions = [] path = sys.path # output files frozen_c = 'frozen.c' config_c = 'config.c' target = 'a.out' # normally derived from script name makefile = 'Makefile' # parse command line try: opts, args = getopt.getopt(sys.argv[1:], 'e:p:'... |
defines = ['-DHAVE_CONFIG_H', '-DUSE_FROZEN', '-DNO_MAIN', | defines = ['-DHAVE_CONFIG_H', | def main(): # overridable context prefix = PREFIX # settable with -p option extensions = [] path = sys.path # output files frozen_c = 'frozen.c' config_c = 'config.c' target = 'a.out' # normally derived from script name makefile = 'Makefile' # parse command line try: opts, args = getopt.getopt(sys.argv[1:], 'e:p:'... |
for dir in [prefix, binlib, incldir] + extensions: | for dir in [prefix, exec_prefix, binlib, incldir] + extensions: | def main(): # overridable context prefix = PREFIX # settable with -p option extensions = [] path = sys.path # output files frozen_c = 'frozen.c' config_c = 'config.c' target = 'a.out' # normally derived from script name makefile = 'Makefile' # parse command line try: opts, args = getopt.getopt(sys.argv[1:], 'e:p:'... |
for file in config_c_in, makefile_in, frozenmain_c: | for file in [config_c_in, makefile_in] + supp_sources: | def main(): # overridable context prefix = PREFIX # settable with -p option extensions = [] path = sys.path # output files frozen_c = 'frozen.c' config_c = 'config.c' target = 'a.out' # normally derived from script name makefile = 'Makefile' # parse command line try: opts, args = getopt.getopt(sys.argv[1:], 'e:p:'... |
files = ['$(OPT)', config_c, frozen_c, frozenmain_c] + \ addfiles + libs + \ | files = ['$(OPT)', config_c, frozen_c] + \ supp_sources + addfiles + libs + \ | def main(): # overridable context prefix = PREFIX # settable with -p option extensions = [] path = sys.path # output files frozen_c = 'frozen.c' config_c = 'config.c' target = 'a.out' # normally derived from script name makefile = 'Makefile' # parse command line try: opts, args = getopt.getopt(sys.argv[1:], 'e:p:'... |
doc(arg) | help.help(arg) | def stopped(): print 'pydoc server stopped' |
function, module, or package, or a dotted reference to a class or function within a module or module in a package. If <name> contains a '%s', it is used as the path to a Python source file to document. | Python keyword, topic, function, module, or package, or a dotted reference to a class or function within a module or module in a package. If <name> contains a '%s', it is used as the path to a Python source file to document. If name is 'keywords', 'topics', or 'modules', a listing of these things is displayed. | def stopped(): print 'pydoc server stopped' |
self.c_func_name = arg | self.c_func_name = repr(arg) | def trace_dispatch(self, frame, event, arg): timer = self.timer t = timer() t = t[0] + t[1] - self.t - self.bias |
self.c_func_name = arg | self.c_func_name = repr(arg) | def trace_dispatch_i(self, frame, event, arg): timer = self.timer t = timer() - self.t - self.bias |
self.c_func_name = arg | self.c_func_name = repr(arg) | def trace_dispatch_mac(self, frame, event, arg): timer = self.timer t = timer()/60.0 - self.t - self.bias |
self.c_func_name = arg | self.c_func_name = repr(arg) | def trace_dispatch_l(self, frame, event, arg): get_time = self.get_time t = get_time() - self.t - self.bias |
'Copyright: ' + self.distribution.get_license(), | 'License: ' + self.distribution.get_license(), | def _make_spec_file(self): """Generate the text of an RPM spec file and return it as a list of strings (one per line). """ # definitions and headers spec_file = [ '%define name ' + self.distribution.get_name(), '%define version ' + self.distribution.get_version(), '%define release ' + self.release, '', 'Summary: ' + se... |
'include_dirs', if given, must be a list of strings, the directories to add to the default include file search path for this compilation only. | 'include_dirs', if given, must be a list of strings, the directories to add to the default include file search path for this compilation only. 'debug' is a boolean; if true, the compiler will be instructed to output debug symbols in (or alongside) the object file(s). | def compile (self, sources, output_dir=None, macros=None, include_dirs=None, extra_preargs=None, extra_postargs=None): """Compile one or more C/C++ source files. 'sources' must be a list of strings, each one the name of a C/C++ source file. Return a list of the object filenames generated (one for each source filename... |
output_dir=None): | output_dir=None, debug=0): | def link_static_lib (self, objects, output_libname, output_dir=None): """Link a bunch of stuff together to create a static library file. The "bunch of stuff" consists of the list of object files supplied as 'objects', the extra object files supplied to 'add_link_object()' and/or 'set_link_objects()', the libraries sup... |
'output_libname' should be a library name, not a filename; the filename will be inferred from the library name. | 'output_libname' should be a library name, not a filename; the filename will be inferred from the library name. 'output_dir' is the directory where the library file will be put. 'debug' is a boolean; if true, debugging information will be included in the library (note that on most platforms, it is the compile step wh... | def link_static_lib (self, objects, output_libname, output_dir=None): """Link a bunch of stuff together to create a static library file. The "bunch of stuff" consists of the list of object files supplied as 'objects', the extra object files supplied to 'add_link_object()' and/or 'set_link_objects()', the libraries sup... |
for the particular linker being used).""" pass def link_shared_lib (self, objects, output_libname, output_dir=None, libraries=None, library_dirs=None, extra_preargs=None, extra_postargs=None): """Link a bunch of stuff together to create a shared library file. Has the same effect as 'link_static_lib()' except that t... | for the particular linker being used).""" | def link_static_lib (self, objects, output_libname, output_dir=None): """Link a bunch of stuff together to create a static library file. The "bunch of stuff" consists of the list of object files supplied as 'objects', the extra object files supplied to 'add_link_object()' and/or 'set_link_objects()', the libraries sup... |
base = base.replace("/", ".") | base = base.replace(os.sep, ".") if os.altsep: base = base.replace(os.altsep, ".") | def fullmodname(path): """Return a plausible module name for the path.""" # If the file 'path' is part of a package, then the filename isn't # enough to uniquely identify it. Try to do the right thing by # looking in sys.path for the longest matching prefix. We'll # assume that the rest is the package name. longest... |
return | return 0, 0 | def write_results_file(self, path, lines, lnotab, lines_hit): """Return a coverage results file in path.""" |
RA("%s=%s;" % (self.key, self.coded_value)) | RA("%s=%s" % (self.key, self.coded_value)) | def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append |
RA("%s=%s;" % (self._reserved[K], _getdate(V))) | RA("%s=%s" % (self._reserved[K], _getdate(V))) | def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append |
RA("%s=%d;" % (self._reserved[K], V)) | RA("%s=%d" % (self._reserved[K], V)) | def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append |
RA("%s;" % self._reserved[K]) | RA(str(self._reserved[K])) | def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append |
RA("%s=%s;" % (self._reserved[K], V)) | RA("%s=%s" % (self._reserved[K], V)) | def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append |
return _spacejoin(result) | return _semispacejoin(result) | def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append |
def output(self, attrs=None, header="Set-Cookie:", sep="\n"): | def output(self, attrs=None, header="Set-Cookie:", sep="\015\012"): | def output(self, attrs=None, header="Set-Cookie:", sep="\n"): """Return a string suitable for HTTP.""" result = [] items = self.items() items.sort() for K,V in items: result.append( V.output(attrs, header) ) return sep.join(result) |
return '<%s: %s>' % (self.__class__.__name__, _spacejoin(L)) | return '<%s: %s>' % (self.__class__.__name__, _semispacejoin(L)) | def __repr__(self): L = [] items = self.items() items.sort() for K,V in items: L.append( '%s=%s' % (K,repr(V.value) ) ) return '<%s: %s>' % (self.__class__.__name__, _spacejoin(L)) |
self.socket = socket.socket(self.address_family, self.socket_type) self.server_bind() self.server_activate() def server_bind(self): """Called by constructor to bind the socket. May be overridden. """ if self.allow_reuse_address: self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) self.socket.bind(self.... | def __init__(self, server_address, RequestHandlerClass): """Constructor. May be extended, do not override.""" self.server_address = server_address self.RequestHandlerClass = RequestHandlerClass self.socket = socket.socket(self.address_family, self.socket_type) self.server_bind() self.server_activate() | |
self.socket.listen(self.request_queue_size) def fileno(self): """Return socket file number. Interface required by select(). """ return self.socket.fileno() | pass | def server_activate(self): """Called by constructor to activate the server. |
def get_request(self): """Get the request and client address from the socket. May be overridden. """ return self.socket.accept() | def get_request(self): """Get the request and client address from the socket. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.