bugged stringlengths 4 228k | fixed stringlengths 0 96.3M | __index_level_0__ int64 0 481k |
|---|---|---|
def __init__(self): pass | def __init__(self): pass | 22,000 |
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 = '' | 22,001 |
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 | 22,002 |
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 | 22,003 |
def write(self, buf): self.sock.send(buf) | def write(self, buf): self.sock.send(buf) | 22,004 |
def close(self): self.sock.close() del self.sock | def close(self): self.flush() del self.sock | 22,005 |
def close(self): self.sock.close() del self.sock | def close(self): self.sock.close() del self.sock | 22,006 |
def test_basic_proxy(self): o = C() self.check_proxy(o, weakref.proxy(o)) | def test_basic_proxy(self): o = C() self.check_proxy(o, weakref.proxy(o)) | 22,007 |
def check_iters(self, dict): # item iterator: items = dict.items() for item in dict.iteritems(): items.remove(item) self.assert_(len(items) == 0, "iteritems() did not touch all items") | def check_iters(self, dict): # item iterator: items = dict.items() for item in dict.iteritems(): items.remove(item) self.assert_(len(items) == 0, "iteritems() did not touch all items") | 22,008 |
def __eq__(self, other): if mutate: # Side effect that mutates the dict, by removing the # last strong reference to a key. del objs[-1] return self.value == other.value | def __eq__(self, other): if mutate: # Side effect that mutates the dict, by removing the # last strong reference to a key. del objs[-1] return self.value == other.value | 22,009 |
def _reference(self): return self.__ref.copy() | def _reference(self): return self.__ref.copy() | 22,010 |
def test_main(): test_support.run_unittest( ReferencesTestCase, MappingTestCase, WeakValueDictionaryTestCase, WeakKeyDictionaryTestCase ) | def test_main(): test_support.run_unittest( ReferencesTestCase, MappingTestCase, WeakValueDictionaryTestCase, WeakKeyDictionaryTestCase, ) | 22,011 |
def server_bind(self): """Override server_bind to store the server name.""" SocketServer.TCPServer.server_bind(self) host, port = self.socket.getsockname() self.server_name = socket.getfqdn(host) self.server_port = port | def server_bind(self): """Override server_bind to store the server name.""" SocketServer.TCPServer.server_bind(self) host, port = self.socket.getsockname()[:2] self.server_name = socket.getfqdn(host) self.server_port = port | 22,012 |
def address_string(self): """Return the client address formatted for logging. | def address_string(self): """Return the client address formatted for logging. | 22,013 |
def __str__(self): if self.__den == 1: return str(self.__num) else: return '%s/%s' % (str(self.__num), str(self.__den)) | def __str__(self): if self.__den == 1: return str(self.__num) else: return '%s/%s' % (str(self.__num), str(self.__den)) | 22,014 |
def __cmp__(a, b): diff = a - b if diff.__num < 0: return -1 elif diff.__num > 0: return 1 else: return 0 | def __cmp__(a, b): diff = Rat(a - b) if diff.__num < 0: return -1 elif diff.__num > 0: return 1 else: return 0 | 22,015 |
def test(): '''\ Test function for rat module. The expected output is (module some differences in floating precission): -1 -1 0 0L 0.1 (0.1+0j) [Rat(1,2), Rat(-3,10), Rat(1,25), Rat(1,4)] [Rat(-3,10), Rat(1,25), Rat(1,4), Rat(1,2)] 0 11/10 11/10 1.1 OK 2 1.5 3/2 (1.5+1.5j) 15707963/5000000 2 2 2.0 (2+0j) 4 0 4 1 4 0 ... | def test(): '''\ Test function for rat module. The expected output is (module some differences in floating precission): -1 -1 0 0L 0.1 (0.1+0j) [Rat(1,2), Rat(-3,10), Rat(1,25), Rat(1,4)] [Rat(-3,10), Rat(1,25), Rat(1,4), Rat(1,2)] 0 (11/10) (11/10) 1.1 OK 2 1.5 3/2 (1.5+1.5j) 15707963/5000000 2 2 2.0 (2+0j) 4 0 4 1 ... | 22,016 |
def test(): '''\ Test function for rat module. The expected output is (module some differences in floating precission): -1 -1 0 0L 0.1 (0.1+0j) [Rat(1,2), Rat(-3,10), Rat(1,25), Rat(1,4)] [Rat(-3,10), Rat(1,25), Rat(1,4), Rat(1,2)] 0 11/10 11/10 1.1 OK 2 1.5 3/2 (1.5+1.5j) 15707963/5000000 2 2 2.0 (2+0j) 4 0 4 1 4 0 ... | def test(): '''\ Test function for rat module. The expected output is (module some differences in floating precission): -1 -1 0 0L 0.1 (0.1+0j) [Rat(1,2), Rat(-3,10), Rat(1,25), Rat(1,4)] [Rat(-3,10), Rat(1,25), Rat(1,4), Rat(1,2)] 0 11/10 11/10 1.1 OK 2 1.5 (3/2) (1.5+1.5j) (15707963/5000000) 2 2 2.0 (2+0j) 4 0 4 1 ... | 22,017 |
def test(): '''\ Test function for rat module. The expected output is (module some differences in floating precission): -1 -1 0 0L 0.1 (0.1+0j) [Rat(1,2), Rat(-3,10), Rat(1,25), Rat(1,4)] [Rat(-3,10), Rat(1,25), Rat(1,4), Rat(1,2)] 0 11/10 11/10 1.1 OK 2 1.5 3/2 (1.5+1.5j) 15707963/5000000 2 2 2.0 (2+0j) 4 0 4 1 4 0 ... | def test(): '''\ Test function for rat module. The expected output is (module some differences in floating precission): -1 -1 0 0L 0.1 (0.1+0j) [Rat(1,2), Rat(-3,10), Rat(1,25), Rat(1,4)] [Rat(-3,10), Rat(1,25), Rat(1,4), Rat(1,2)] 0 11/10 11/10 1.1 OK 2 1.5 3/2 (1.5+1.5j) 15707963/5000000 2 2 2.0 (2+0j) 4 0 4 1 4 0 ... | 22,018 |
def test(): '''\ Test function for rat module. The expected output is (module some differences in floating precission): -1 -1 0 0L 0.1 (0.1+0j) [Rat(1,2), Rat(-3,10), Rat(1,25), Rat(1,4)] [Rat(-3,10), Rat(1,25), Rat(1,4), Rat(1,2)] 0 11/10 11/10 1.1 OK 2 1.5 3/2 (1.5+1.5j) 15707963/5000000 2 2 2.0 (2+0j) 4 0 4 1 4 0 ... | def test(): '''\ Test function for rat module. The expected output is (module some differences in floating precission): -1 -1 0 0L 0.1 (0.1+0j) [Rat(1,2), Rat(-3,10), Rat(1,25), Rat(1,4)] [Rat(-3,10), Rat(1,25), Rat(1,4), Rat(1,2)] 0 11/10 11/10 1.1 OK 2 1.5 3/2 (1.5+1.5j) 15707963/5000000 2 2 2.0 (2+0j) 4 0 4 1 4 0 ... | 22,019 |
def test(): '''\ Test function for rat module. The expected output is (module some differences in floating precission): -1 -1 0 0L 0.1 (0.1+0j) [Rat(1,2), Rat(-3,10), Rat(1,25), Rat(1,4)] [Rat(-3,10), Rat(1,25), Rat(1,4), Rat(1,2)] 0 11/10 11/10 1.1 OK 2 1.5 3/2 (1.5+1.5j) 15707963/5000000 2 2 2.0 (2+0j) 4 0 4 1 4 0 ... | def test(): '''\ Test function for rat module. The expected output is (module some differences in floating precission): -1 -1 0 0L 0.1 (0.1+0j) [Rat(1,2), Rat(-3,10), Rat(1,25), Rat(1,4)] [Rat(-3,10), Rat(1,25), Rat(1,4), Rat(1,2)] 0 11/10 11/10 1.1 OK 2 1.5 3/2 (1.5+1.5j) 15707963/5000000 2 2 2.0 (2+0j) 4 0 4 1 4 0 ... | 22,020 |
def __init__(self): self.quitting = 0 # Initialize menu self.appleid = 1 self.quitid = 2 Menu.ClearMenuBar() self.applemenu = applemenu = Menu.NewMenu(self.appleid, "\024") applemenu.AppendMenu("All about cgitest...;(-") applemenu.AppendResMenu('DRVR') applemenu.InsertMenu(0) self.quitmenu = Menu.NewMenu(self.quitid, "... | def __init__(self): self.quitting = 0 # Initialize menu self.appleid = 1 self.quitid = 2 Menu.ClearMenuBar() self.applemenu = applemenu = Menu.NewMenu(self.appleid, "\024") applemenu.AppendMenu("About %s...;(-" % self.__class__.__name__) applemenu.AppendResMenu('DRVR') applemenu.InsertMenu(0) self.quitmenu = Menu.NewMe... | 22,021 |
def __del__(self): self.close() | def __del__(self): self.close() | 22,022 |
def close(self): pass | def close(self): pass | 22,023 |
def mainloop(self, mask = everyEvent, timeout = 60*60): while not self.quitting: self.dooneevent(mask, timeout) | def mainloop(self, mask = everyEvent, timeout = 60*60): while not self.quitting: self.dooneevent(mask, timeout) | 22,024 |
def lowlevelhandler(self, event): what, message, when, where, modifiers = event h, v = where if what == kHighLevelEvent: msg = "High Level Event: %s %s" % \ (`code(message)`, `code(h | (v<<16))`) try: AE.AEProcessAppleEvent(event) except AE.Error, err: print 'AE error: ', err print 'in', msg traceback.print_exc() retur... | def lowlevelhandler(self, event): what, message, when, where, modifiers = event h, v = where if what == kHighLevelEvent: msg = "High Level Event: %s %s" % \ (`code(message)`, `code(h | (v<<16))`) try: AE.AEProcessAppleEvent(event) except AE.Error, err: print 'AE error: ', err print 'in', msg traceback.print_exc() retur... | 22,025 |
def lowlevelhandler(self, event): what, message, when, where, modifiers = event h, v = where if what == kHighLevelEvent: msg = "High Level Event: %s %s" % \ (`code(message)`, `code(h | (v<<16))`) try: AE.AEProcessAppleEvent(event) except AE.Error, err: print 'AE error: ', err print 'in', msg traceback.print_exc() retur... | def lowlevelhandler(self, event): what, message, when, where, modifiers = event h, v = where if what == kHighLevelEvent: msg = "High Level Event: %s %s" % \ (`code(message)`, `code(h | (v<<16))`) try: AE.AEProcessAppleEvent(event) except AE.Error, err: print 'AE error: ', err print 'in', msg traceback.print_exc() retur... | 22,026 |
def lowlevelhandler(self, event): what, message, when, where, modifiers = event h, v = where if what == kHighLevelEvent: msg = "High Level Event: %s %s" % \ (`code(message)`, `code(h | (v<<16))`) try: AE.AEProcessAppleEvent(event) except AE.Error, err: print 'AE error: ', err print 'in', msg traceback.print_exc() retur... | def lowlevelhandler(self, event): what, message, when, where, modifiers = event h, v = where if what == kHighLevelEvent: msg = "High Level Event: %s %s" % \ (`code(message)`, `code(h | (v<<16))`) try: AE.AEProcessAppleEvent(event) except AE.Error, err: print 'AE error: ', err print 'in', msg traceback.print_exc() retur... | 22,027 |
def lowlevelhandler(self, event): what, message, when, where, modifiers = event h, v = where if what == kHighLevelEvent: msg = "High Level Event: %s %s" % \ (`code(message)`, `code(h | (v<<16))`) try: AE.AEProcessAppleEvent(event) except AE.Error, err: print 'AE error: ', err print 'in', msg traceback.print_exc() retur... | def lowlevelhandler(self, event): what, message, when, where, modifiers = event h, v = where if what == kHighLevelEvent: msg = "High Level Event: %s %s" % \ (`code(message)`, `code(h | (v<<16))`) try: AE.AEProcessAppleEvent(event) except AE.Error, err: print 'AE error: ', err print 'in', msg traceback.print_exc() retur... | 22,028 |
def __init__(self): self.ae_handlers = {} | def __init__(self): self.ae_handlers = {} | 22,029 |
def close(self): for classe, type in self.ae_handlers.keys(): AE.AERemoveEventHandler(classe, type) | def close(self): for classe, type in self.ae_handlers.keys(): AE.AERemoveEventHandler(classe, type) | 22,030 |
def callback_wrapper(self, _request, _reply): _parameters, _attributes = aetools.unpackevent(_request) _class = _attributes['evcl'].type _type = _attributes['evid'].type if self.ae_handlers.has_key((_class, _type)): _function = self.ae_handlers[(_class, _type)] elif self.ae_handlers.has_key((_class, '****')): _functio... | def callback_wrapper(self, _request, _reply): _parameters, _attributes = aetools.unpackevent(_request) _class = _attributes['evcl'].type _type = _attributes['evid'].type if self.ae_handlers.has_key((_class, _type)): _function = self.ae_handlers[(_class, _type)] elif self.ae_handlers.has_key((_cl... | 22,031 |
def finalize_options (self): | def finalize_options (self): | 22,032 |
def test_tz_aware_arithmetic(self): import random | def test_tz_aware_arithmetic(self): import random | 22,033 |
def test_tz_aware_arithmetic(self): import random | def test_tz_aware_arithmetic(self): import random | 22,034 |
def parse_starttag(self, i): rawdata = self.rawdata if shorttagopen.match(rawdata, i): # SGML shorthand: <tag/data/ == <tag>data</tag> # XXX Can data contain &... (entity or char refs)? # XXX Can data contain < or > (tag characters)? # XXX Can there be whitespace before the first /? match = shorttag.match(rawdata, i) i... | def parse_starttag(self, i): rawdata = self.rawdata if shorttagopen.match(rawdata, i): # SGML shorthand: <tag/data/ == <tag>data</tag> # XXX Can data contain &... (entity or char refs)? # XXX Can data contain < or > (tag characters)? # XXX Can there be whitespace before the first /? match = shorttag.match(rawdata, i) i... | 22,035 |
def _generate_one_template(self, tmpl): resultname, datasource, dataname, key = tmpl result = '' if key: # This is a multi-element rule. Run for every item in dict[key] if self.dict.has_key(key): keyvalues = self.dict[key] try: if not type(keyvalues) in (type(()), type([])): raise Error, "List or tuple expected for %s"... | def _generate_one_template(self, tmpl): resultname, datasource, dataname, key = tmpl result = '' if key: # This is a multi-element rule. Run for every item in dict[key] if self.dict.has_key(key): keyvalues = self.dict[key] try: if not type(keyvalues) in (type(()), type([])): raise Error, "List or tuple expected for %s"... | 22,036 |
def parse_command_line (self, args): """Parse the setup script's command line: set any Distribution attributes tied to command-line options, create all command objects, and set their options from the command-line. 'args' must be a list of command-line arguments, most likely 'sys.argv[1:]' (see the 'setup()' function).... | def parse_command_line (self, args): """Parse the setup script's command line: set any Distribution attributes tied to command-line options, create all command objects, and set their options from the command-line. 'args' must be a list of command-line arguments, most likely 'sys.argv[1:]' (see the 'setup()' function).... | 22,037 |
def save_newobj(self, obj): # Save a new-style class instance, using protocol 2. # XXX This is still experimental. assert self.proto >= 2 # This only works for protocol 2 t = type(obj) getnewargs = getattr(obj, "__getnewargs__", None) if getnewargs: args = getnewargs() # This bette not reference obj el... | def save_newobj(self, obj): # Save a new-style class instance, using protocol 2. # XXX This is still experimental. assert self.proto >= 2 # This only works for protocol 2 t = type(obj) getnewargs = getattr(obj, "__getnewargs__", None) if getnewargs: args = getnewargs() # This bette not reference obj el... | 22,038 |
def fcmp(x, y): # fuzzy comparison function if type(x) == type(0.0) or type(y) == type(0.0): try: x, y = coerce(x, y) fuzz = (abs(x) + abs(y)) * FUZZ if abs(x-y) <= fuzz: return 0 except: pass elif type(x) == type(y) and type(x) in (type(()), type([])): for i in range(min(len(x), len(y))): outcome = fcmp(x[i], y[i]) if... | def fcmp(x, y): # fuzzy comparison function if type(x) == type(0.0) or type(y) == type(0.0): try: x, y = coerce(x, y) fuzz = (abs(x) + abs(y)) * FUZZ if abs(x-y) <= fuzz: return 0 except: pass elif type(x) == type(y) and type(x) in (type(()), type([])): for i in range(min(len(x), len(y))): outcome = fcmp(x[i], y[i]) if... | 22,039 |
def _execvpe(file, args, env=None): if env is not None: func = execve argrest = (args, env) else: func = execv argrest = (args,) env = environ global _notfound head, tail = path.split(file) if head: apply(func, (file,) + argrest) return if env.has_key('PATH'): envpath = env['PATH'] else: envpath = defpath PATH = envpat... | def _execvpe(file, args, env=None): if env is not None: func = execve argrest = (args, env) else: func = execv argrest = (args,) env = environ global _notfound head, tail = path.split(file) if head: apply(func, (file,) + argrest) return if env.has_key('PATH'): envpath = env['PATH'] else: envpath = defpath PATH = envpat... | 22,040 |
def make_zipfile (self, base_dir): | def make_zipfile (self, base_dir): | 22,041 |
def readheaders(self): """Read header lines. | def readheaders(self): """Read header lines. | 22,042 |
def isheader(self, line): """Determine whether a given line is a legal header. | def isheader(self, line): """Determine whether a given line is a legal header. | 22,043 |
def islast(self, line): """Determine whether a line is a legal end of RFC-822 headers. | def islast(self, line): """Determine whether a line is a legal end of RFC-822 headers. | 22,044 |
def iscomment(self, line): """Determine whether a line should be skipped entirely. | def iscomment(self, line): """Determine whether a line should be skipped entirely. | 22,045 |
def getallmatchingheaders(self, name): """Find all header lines matching a given header name. | def getallmatchingheaders(self, name): """Find all header lines matching a given header name. | 22,046 |
def getfirstmatchingheader(self, name): """Get the first header line matching name. | def getfirstmatchingheader(self, name): """Get the first header line matching name. | 22,047 |
def getrawheader(self, name): """A higher-level interface to getfirstmatchingheader(). | def getrawheader(self, name): """A higher-level interface to getfirstmatchingheader(). | 22,048 |
def getheader(self, name, default=None): """Get the header value for a name. | def getheader(self, name, default=None): """Get the header value for a name. | 22,049 |
def getheaders(self, name): """Get all values for a header. | def getheaders(self, name): """Get all values for a header. | 22,050 |
def getaddrlist(self, name): """Get a list of addresses from a header. | defgetaddrlist(self,name):"""Getalistofaddressesfromaheader. | 22,051 |
def getdate(self, name): """Retrieve a date field from a header. | def getdate(self, name): """Retrieve a date field from a header. | 22,052 |
def getdate_tz(self, name): """Retrieve a date field from a header as a 10-tuple. | def getdate_tz(self, name): """Retrieve a date field from a header as a 10-tuple. | 22,053 |
def __setitem__(self, name, value): """Set the value of a header. | def __setitem__(self, name, value): """Set the value of a header. | 22,054 |
def parseaddr(address): """Parse an address into a (realname, mailaddr) tuple.""" a = AddrlistClass(address) list = a.getaddrlist() if not list: return (None, None) else: return list[0] | def parseaddr(address): """Parse an address into a (realname, mailaddr) tuple.""" a = AddrlistClass(address) list = a.getaddrlist() if not list: return (None, None) else: return list[0] | 22,055 |
def __init__(self, field): """Initialize a new instance. | def __init__(self, field): """Initialize a new instance. | 22,056 |
def getaddrspec(self): """Parse an RFC-822 addr-spec.""" aslist = [] | def getaddrspec(self): """Parse an RFC 2822 addr-spec.""" aslist = [] | 22,057 |
def getdelimited(self, beginchar, endchars, allowcomments = 1): """Parse a header fragment delimited by special characters. | def getdelimited(self, beginchar, endchars, allowcomments = 1): """Parse a header fragment delimited by special characters. | 22,058 |
def getdelimited(self, beginchar, endchars, allowcomments = 1): """Parse a header fragment delimited by special characters. | def getdelimited(self, beginchar, endchars, allowcomments = 1): """Parse a header fragment delimited by special characters. | 22,059 |
def getdomainliteral(self): """Parse an RFC-822 domain-literal.""" return '[%s]' % self.getdelimited('[', ']\r', 0) | def getdomainliteral(self): """Parse an RFC 2822 domain-literal.""" return '[%s]' % self.getdelimited('[', ']\r', 0) | 22,060 |
def getatom(self): """Parse an RFC-822 atom.""" atomlist = [''] | def getatom(self, atomends=None): """Parse an RFC 2822 atom. Optional atomends specifies a different set of end token delimiters (the default is to use self.atomends). This is used e.g. in getphraselist() since phrase endings must not include the `.' (which is legal in phrases).""" atomlist = [''] | 22,061 |
def getatom(self): """Parse an RFC-822 atom.""" atomlist = [''] | def getatom(self): """Parse an RFC-822 atom.""" atomlist = [''] | 22,062 |
def getphraselist(self): """Parse a sequence of RFC-822 phrases. | def getphraselist(self): """Parse a sequence of RFC-822 phrases. | 22,063 |
def getphraselist(self): """Parse a sequence of RFC-822 phrases. | def getphraselist(self): """Parse a sequence of RFC-822 phrases. | 22,064 |
def getphraselist(self): """Parse a sequence of RFC-822 phrases. | def getphraselist(self): """Parse a sequence of RFC-822 phrases. | 22,065 |
def getphraselist(self): """Parse a sequence of RFC-822 phrases. | def getphraselist(self): """Parse a sequence of RFC-822 phrases. | 22,066 |
def hide(self, event=None): self.stop() self.collapse() | def hide(self, event=None): self.stop() self.collapse() | 22,067 |
def CreateWidgets(self): frameMain = Frame(self, borderwidth=2, relief=SUNKEN) frameButtons = Frame(self) frameButtons.pack(side=BOTTOM, fill=X) frameMain.pack(side=TOP, expand=TRUE, fill=BOTH) self.buttonOk = Button(frameButtons, text='Close', command=self.Ok) self.buttonOk.pack(padx=5, pady=5) #self.picture = Image('... | def CreateWidgets(self): frameMain = Frame(self, borderwidth=2, relief=SUNKEN) frameButtons = Frame(self) frameButtons.pack(side=BOTTOM, fill=X) frameMain.pack(side=TOP, expand=TRUE, fill=BOTH) self.buttonOk = Button(frameButtons, text='Close', command=self.Ok) self.buttonOk.pack(padx=5, pady=5) #self.picture = Image('... | 22,068 |
def CreateWidgets(self): frameMain = Frame(self, borderwidth=2, relief=SUNKEN) frameButtons = Frame(self) frameButtons.pack(side=BOTTOM, fill=X) frameMain.pack(side=TOP, expand=TRUE, fill=BOTH) self.buttonOk = Button(frameButtons, text='Close', command=self.Ok) self.buttonOk.pack(padx=5, pady=5) #self.picture = Image('... | def CreateWidgets(self): frameMain = Frame(self, borderwidth=2, relief=SUNKEN) frameButtons = Frame(self) frameButtons.pack(side=BOTTOM, fill=X) frameMain.pack(side=TOP, expand=TRUE, fill=BOTH) self.buttonOk = Button(frameButtons, text='Close', command=self.Ok) self.buttonOk.pack(padx=5, pady=5) #self.picture = Image('... | 22,069 |
def ViewFile(self, viewTitle, viewFile, encoding=None): fn=os.path.join(os.path.abspath(os.path.dirname(__file__)),viewFile) if encoding: import codecs try: textFile = codecs.open(fn, 'r') except IOError: tkMessageBox.showerror(title='File Load Error', message='Unable to load file '+ `fileName`+' .') return else: data ... | def ViewFile(self, viewTitle, viewFile, encoding=None): fn = os.path.join(os.path.abspath(os.path.dirname(__file__)), viewFile) if encoding: import codecs try: textFile = codecs.open(fn, 'r') except IOError: tkMessageBox.showerror(title='File Load Error', message='Unable to load file '+ `fileName`+' .') return else: da... | 22,070 |
def run(): import aboutDialog aboutDialog.AboutDialog(root,'About') | def run(): import aboutDialog aboutDialog.AboutDialog(root,'About') | 22,071 |
def __init__(self, master=None, cnf=None, **kw): if cnf is None: cnf = {} if kw: cnf = _cnfmerge((cnf, kw)) fcnf = {} for k in cnf.keys(): if type(k) == ClassType or k == 'name': fcnf[k] = cnf[k] del cnf[k] self.frame = apply(Frame, (master,), fcnf) self.vbar = Scrollbar(self.frame, name='vbar') self.vbar.pack(side=RIG... | def __init__(self, master=None, cnf=None, **kw): if cnf is None: cnf = {} if kw: cnf = _cnfmerge((cnf, kw)) fcnf = {} for k in cnf.keys(): if type(k) == ClassType or k == 'name': fcnf[k] = cnf[k] del cnf[k] self.frame = apply(Frame, (master,), fcnf) self.vbar = Scrollbar(self.frame, name='vbar') self.vbar.pack(side=RIG... | 22,072 |
def select(self, _object, _attributes={}, **_arguments): """select: Select the specified object(s) Required argument: the object to select Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'misc' _subcode = 'slct' | def select(self, _object, _attributes={}, **_arguments): """select: Select the specified object(s) Required argument: the object to select Keyword argument _attributes: AppleEvent attribute dictionary """ _code = 'misc' _subcode = 'slct' | 22,073 |
def islink(s): """Return true if the pathname refers to a symbolic link.""" try: import macfs return macfs.ResolveAliasFile(s)[2] except: return False | def islink(s): """Return true if the pathname refers to a symbolic link.""" try: import macfs return macfs.ResolveAliasFile(s)[2] except: return False | 22,074 |
def add_dir_to_list(dirlist, dir): """Add the directory 'dir' to the list 'dirlist' (at the front) if 1) 'dir' is not already in 'dirlist' 2) 'dir' actually exists, and is a directory.""" if os.path.isdir(dir) and dir not in dirlist: dirlist.insert(0, dir) | def add_dir_to_list(dirlist, dir): """Add the directory 'dir' to the list 'dirlist' (at the front) if 1) 'dir' is not already in 'dirlist' 2) 'dir' actually exists, and is a directory.""" if dir is not None and os.path.isdir(dir) and dir not in dirlist: dirlist.insert(0, dir) | 22,075 |
def build_extensions(self): | def build_extensions(self): | 22,076 |
def build_extensions(self): | def build_extensions(self): | 22,077 |
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') | 22,078 |
def convert_path (pathname): """Return 'pathname' as a name that will work on the native filesystem, i.e. split it on '/' and put it back together again using the current directory separator. Needed because filenames in the setup script are always supplied in Unix style, and have to be converted to the local conventio... | def convert_path (pathname): """Return 'pathname' as a name that will work on the native filesystem, i.e. split it on '/' and put it back together again using the current directory separator. Needed because filenames in the setup script are always supplied in Unix style, and have to be converted to the local conventio... | 22,079 |
def convert_path (pathname): """Return 'pathname' as a name that will work on the native filesystem, i.e. split it on '/' and put it back together again using the current directory separator. Needed because filenames in the setup script are always supplied in Unix style, and have to be converted to the local conventio... | def convert_path (pathname): """Return 'pathname' as a name that will work on the native filesystem, i.e. split it on '/' and put it back together again using the current directory separator. Needed because filenames in the setup script are always supplied in Unix style, and have to be converted to the local conventio... | 22,080 |
def __str__(self): return self.x | def __str__(self): return self.x | 22,081 |
def strops(): try: 'a' + 5 except TypeError: pass else: raise TestFailed, "'' + 5 doesn't raise TypeError" try: ''.split('') except ValueError: pass else: raise TestFailed, "''.split('') doesn't raise ValueError" try: ''.join([0]) except TypeError: pass else: raise TestFailed, "''.join([0]) doesn't raise TypeError" ... | defdef deepcopyrecursive(): if verbose: print "Testing deepcopy of recursive objects..." class Node: pass a = Node() b = Node() a.b = b b.a = a z = deepcopy(a) strops():def deepcopyrecursive(): if verbose: print "Testing deepcopy of recursive objects..." class Node: pass a = Node() b = Node() a.b = b b.a = a z = deepco... | 22,082 |
def goahead(self, end): rawdata = self.rawdata i = 0 n = len(rawdata) while i < n: match = self.interesting.search(rawdata, i) # < or & if match: j = match.start() else: j = n if i < j: self.handle_data(rawdata[i:j]) i = self.updatepos(i, j) if i == n: break if rawdata[i] == '<': if starttagopen.match(rawdata, i): # < ... | def goahead(self, end): rawdata = self.rawdata i = 0 n = len(rawdata) while i < n: match = self.interesting.search(rawdata, i) # < or & if match: j = match.start() elif (i + 1) < n: j = n if i < j: self.handle_data(rawdata[i:j]) i = self.updatepos(i, j) if i == n: break if rawdata[i] == '<': if starttagopen.match(rawda... | 22,083 |
def goahead(self, end): rawdata = self.rawdata i = 0 n = len(rawdata) while i < n: match = self.interesting.search(rawdata, i) # < or & if match: j = match.start() else: j = n if i < j: self.handle_data(rawdata[i:j]) i = self.updatepos(i, j) if i == n: break if rawdata[i] == '<': if starttagopen.match(rawdata, i): # < ... | def goahead(self, end): rawdata = self.rawdata i = 0 n = len(rawdata) while i < n: match = self.interesting.search(rawdata, i) # < or & if match: j = match.start() else: j = n if i < j: self.handle_data(rawdata[i:j]) i = self.updatepos(i, j) if i == n: break if rawdata[i] == '<': if starttagopen.match(rawdata, i): # < ... | 22,084 |
def goahead(self, end): rawdata = self.rawdata i = 0 n = len(rawdata) while i < n: match = self.interesting.search(rawdata, i) # < or & if match: j = match.start() else: j = n if i < j: self.handle_data(rawdata[i:j]) i = self.updatepos(i, j) if i == n: break if rawdata[i] == '<': if starttagopen.match(rawdata, i): # < ... | def goahead(self, end): rawdata = self.rawdata i = 0 n = len(rawdata) while i < n: match = self.interesting.search(rawdata, i) # < or & if match: j = match.start() else: j = n if i < j: self.handle_data(rawdata[i:j]) i = self.updatepos(i, j) if i == n: break if rawdata[i] == '<': if starttagopen.match(rawdata, i): # < ... | 22,085 |
def goahead(self, end): rawdata = self.rawdata i = 0 n = len(rawdata) while i < n: match = self.interesting.search(rawdata, i) # < or & if match: j = match.start() else: j = n if i < j: self.handle_data(rawdata[i:j]) i = self.updatepos(i, j) if i == n: break if rawdata[i] == '<': if starttagopen.match(rawdata, i): # < ... | def goahead(self, end): rawdata = self.rawdata i = 0 n = len(rawdata) while i < n: match = self.interesting.search(rawdata, i) # < or & if match: j = match.start() else: j = n if i < j: self.handle_data(rawdata[i:j]) i = self.updatepos(i, j) if i == n: break if rawdata[i] == '<': if starttagopen.match(rawdata, i): # < ... | 22,086 |
def parse_comment(self, i): rawdata = self.rawdata assert rawdata[i:i+4] == '<!--', 'unexpected call to parse_comment()' match = commentclose.search(rawdata, i+4) if not match: return -1 j = match.start() self.handle_comment(rawdata[i+4: j]) j = match.end() return j | def parse_comment(self, i, report=1): rawdata = self.rawdata assert rawdata[i:i+4] == '<!--', 'unexpected call to parse_comment()' match = commentclose.search(rawdata, i+4) if not match: return -1 j = match.start() self.handle_comment(rawdata[i+4: j]) j = match.end() return j | 22,087 |
def parse_comment(self, i): rawdata = self.rawdata assert rawdata[i:i+4] == '<!--', 'unexpected call to parse_comment()' match = commentclose.search(rawdata, i+4) if not match: return -1 j = match.start() self.handle_comment(rawdata[i+4: j]) j = match.end() return j | def parse_comment(self, i): rawdata = self.rawdata assert rawdata[i:i+4] == '<!--', 'unexpected call to parse_comment()' match = commentclose.search(rawdata, i+4) if not match: return -1 if report: j = match.start() self.handle_comment(rawdata[i+4: j]) j = match.end() return j | 22,088 |
def parse_declaration(self, i): # This is some sort of declaration; in "HTML as # deployed," this should only be the document type # declaration ("<!DOCTYPE html...>"). rawdata = self.rawdata j = i + 2 assert rawdata[i:j] == "<!", "unexpected call to parse_declaration" if rawdata[j:j+1] in ("-", ""): # Start of comment... | def parse_declaration(self, i): # This is some sort of declaration; in "HTML as # deployed," this should only be the document type # declaration ("<!DOCTYPE html...>"). rawdata = self.rawdata j = i + 2 assert rawdata[i:j] == "<!", "unexpected call to parse_declaration" if rawdata[j:j+1] in ("-", ""): # Start of comment... | 22,089 |
def gauss(mu, sigma): # When x and y are two variables from [0, 1), uniformly # distributed, then # # cos(2*pi*x)*log(1-y) # sin(2*pi*x)*log(1-y) # # are two *independent* variables with normal distribution # (mu = 0, sigma = 1). # (Lambert Meertens) global gauss_next if gauss_next != None: z = gauss_next gaus... | def gauss(mu, sigma): # When x and y are two variables from [0, 1), uniformly # distributed, then # # cos(2*pi*x)*log(1-y) # sin(2*pi*x)*log(1-y) # # are two *independent* variables with normal distribution # (mu = 0, sigma = 1). # (Lambert Meertens) global gauss_next if gauss_next != None: z = gauss_next gaus... | 22,090 |
def gauss(mu, sigma): # When x and y are two variables from [0, 1), uniformly # distributed, then # # cos(2*pi*x)*log(1-y) # sin(2*pi*x)*log(1-y) # # are two *independent* variables with normal distribution # (mu = 0, sigma = 1). # (Lambert Meertens) global gauss_next if gauss_next != None: z = gauss_next gaus... | def gauss(mu, sigma): # When x and y are two variables from [0, 1), uniformly # distributed, then # # cos(2*pi*x)*log(1-y) # sin(2*pi*x)*log(1-y) # # are two *independent* variables with normal distribution # (mu = 0, sigma = 1). # (Lambert Meertens) global gauss_next if gauss_next != None: z = gauss_next gaus... | 22,091 |
def report(self): # XXX something decent pass | def report(self): # XXX something decent pass | 22,092 |
def report(self): # XXX something decent pass | def report(self): # XXX something decent pass | 22,093 |
def report(self): # XXX something decent pass | def report(self): # XXX something decent pass | 22,094 |
def addPythonModules(self): self.message("Adding Python modules", 1) | def addPythonModules(self): self.message("Adding Python modules", 1) | 22,095 |
def addPythonModules(self): self.message("Adding Python modules", 1) | def addPythonModules(self): self.message("Adding Python modules", 1) | 22,096 |
def findDependencies(self): self.message("Finding module dependencies", 1) import modulefinder mf = modulefinder.ModuleFinder(excludes=self.excludeModules) # manually add our own site.py site = mf.add_module("site") site.__code__ = SITE_CO mf.scan_code(SITE_CO, site) | def findDependencies(self): self.message("Finding module dependencies", 1) import modulefinder mf = modulefinder.ModuleFinder(excludes=self.excludeModules) # manually add our own site.py site = mf.add_module("site") site.__code__ = SITE_CO mf.scan_code(SITE_CO, site) | 22,097 |
def findDependencies(self): self.message("Finding module dependencies", 1) import modulefinder mf = modulefinder.ModuleFinder(excludes=self.excludeModules) # manually add our own site.py site = mf.add_module("site") site.__code__ = SITE_CO mf.scan_code(SITE_CO, site) | def findDependencies(self): self.message("Finding module dependencies", 1) import modulefinder mf = modulefinder.ModuleFinder(excludes=self.excludeModules) # manually add our own site.py site = mf.add_module("site") site.__code__ = SITE_CO mf.scan_code(SITE_CO, site) | 22,098 |
def findDependencies(self): self.message("Finding module dependencies", 1) import modulefinder mf = modulefinder.ModuleFinder(excludes=self.excludeModules) # manually add our own site.py site = mf.add_module("site") site.__code__ = SITE_CO mf.scan_code(SITE_CO, site) | def findDependencies(self): self.message("Finding module dependencies", 1) import modulefinder mf = modulefinder.ModuleFinder(excludes=self.excludeModules) # manually add our own site.py site = mf.add_module("site") site.__code__ = SITE_CO mf.scan_code(SITE_CO, site) | 22,099 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.