bugged
stringlengths 4
228k
| fixed
stringlengths 0
96.3M
| __index_level_0__
int64 0
481k
|
|---|---|---|
def _set_command_options (self, command_obj, option_dict=None): """Set the options for 'command_obj' from 'option_dict'. Basically this means copying elements of a dictionary ('option_dict') to attributes of an instance ('command').
|
def _set_command_options (self, command_obj, option_dict=None): """Set the options for 'command_obj' from 'option_dict'. Basically this means copying elements of a dictionary ('option_dict') to attributes of an instance ('command').
| 7,200
|
def _set_command_options (self, command_obj, option_dict=None): """Set the options for 'command_obj' from 'option_dict'. Basically this means copying elements of a dictionary ('option_dict') to attributes of an instance ('command').
|
def _set_command_options (self, command_obj, option_dict=None): """Set the options for 'command_obj' from 'option_dict'. Basically this means copying elements of a dictionary ('option_dict') to attributes of an instance ('command').
| 7,201
|
>>> def f(x):
|
>>> def f(x):
| 7,202
|
>>> def f(x):
|
>>> def f(x):
| 7,203
|
>>> def f(x):
|
>>> def f(x):
| 7,204
|
>>> def f(x):
|
>>> def f(x):
| 7,205
|
>>> def f(x):
|
>>> def f(x):
| 7,206
|
>>> def f(x):
|
>>> def f(x):
| 7,207
|
>>> def f(x):
|
>>> def f(x):
| 7,208
|
>>> def f(x):
|
>>> def f(x):
| 7,209
|
>>> def f(x):
|
>>> def f(x):
| 7,210
|
>>> def f(x):
|
>>> def f(x):
| 7,211
|
>>> def f(x):
|
>>> def f(x):
| 7,212
|
>>> def f(x):
|
>>> def f(x):
| 7,213
|
def readheaders(self): """Read header lines.
|
def readheaders(self): """Read header lines.
| 7,214
|
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.
| 7,215
|
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.
| 7,216
|
def iscomment(self, line): """Determine whether a line should be skipped entirely.
|
def iscomment(self, line): """Determine whether a line should be skipped entirely.
| 7,217
|
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.
| 7,218
|
def getfirstmatchingheader(self, name): """Get the first header line matching name.
|
def getfirstmatchingheader(self, name): """Get the first header line matching name.
| 7,219
|
def getrawheader(self, name): """A higher-level interface to getfirstmatchingheader().
|
def getrawheader(self, name): """A higher-level interface to getfirstmatchingheader().
| 7,220
|
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.
| 7,221
|
def getheaders(self, name): """Get all values for a header.
|
def getheaders(self, name): """Get all values for a header.
| 7,222
|
def getaddrlist(self, name): """Get a list of addresses from a header.
|
defgetaddrlist(self,name):"""Getalistofaddressesfromaheader.
| 7,223
|
def getdate(self, name): """Retrieve a date field from a header.
|
def getdate(self, name): """Retrieve a date field from a header.
| 7,224
|
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.
| 7,225
|
def __setitem__(self, name, value): """Set the value of a header.
|
def __setitem__(self, name, value): """Set the value of a header.
| 7,226
|
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]
| 7,227
|
def __init__(self, field): """Initialize a new instance.
|
def __init__(self, field): """Initialize a new instance.
| 7,228
|
def getaddrspec(self): """Parse an RFC-822 addr-spec.""" aslist = []
|
def getaddrspec(self): """Parse an RFC 2822 addr-spec.""" aslist = []
| 7,229
|
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.
| 7,230
|
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.
| 7,231
|
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)
| 7,232
|
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 = ['']
| 7,233
|
def getatom(self): """Parse an RFC-822 atom.""" atomlist = ['']
|
def getatom(self): """Parse an RFC-822 atom.""" atomlist = ['']
| 7,234
|
def getphraselist(self): """Parse a sequence of RFC-822 phrases.
|
def getphraselist(self): """Parse a sequence of RFC-822 phrases.
| 7,235
|
def getphraselist(self): """Parse a sequence of RFC-822 phrases.
|
def getphraselist(self): """Parse a sequence of RFC-822 phrases.
| 7,236
|
def getphraselist(self): """Parse a sequence of RFC-822 phrases.
|
def getphraselist(self): """Parse a sequence of RFC-822 phrases.
| 7,237
|
def getphraselist(self): """Parse a sequence of RFC-822 phrases.
|
def getphraselist(self): """Parse a sequence of RFC-822 phrases.
| 7,238
|
def test_main(): # Historically, these tests have sloppy about removing TESTFN. So get # rid of it no matter what. try: run_unittest(AutoFileTests, OtherFileTests) finally: if os.path.exists(TESTFN): os.unlink(TESTFN)
|
def test_main(): # Historically, these tests have sloppy about removing TESTFN. So get # rid of it no matter what. try: run_unittest(AutoFileTests, OtherFileTests) finally: if os.path.exists(TESTFN): os.unlink(TESTFN)
| 7,239
|
def xover(self,start,end): resp, lines = self.longcmd('XOVER ' + start + '-' + end) xover_lines = [] for line in lines: elem = string.splitfields(line,"\t") try: xover_lines.append(elem[0], elem[1], elem[2], elem[3], elem[4], elem[5:-2], elem[-2], elem[-1]) except IndexError: raise error_data,line return resp,xover_lines
|
def xover(self,start,end): resp, lines = self.longcmd('XOVER ' + start + '-' + end) xover_lines = [] for line in lines: elem = string.splitfields(line,"\t") try: xover_lines.append((elem[0], elem[1], elem[2], elem[3], elem[4], string.split(elem[5]), elem[6], elem[7])) except IndexError: raise error_data,line return resp,xover_lines
| 7,240
|
def __%(method)s__(self, *args): print "__%(method)s__:", args
|
def __%(method)s__(self, *args): print "__%(method)s__:", args
| 7,241
|
def __cmp__(self, other): return 0
|
def __cmp__(self, other): return 0
| 7,242
|
def __eq__(self, other): return 1
|
def __eq__(self, other): return 1
| 7,243
|
def NamedTemporaryFile(mode='w+b', bufsize=-1, suffix="", prefix=template, dir=None): """Create and return a temporary file. Arguments: 'prefix', 'suffix', 'dir' -- as for mkstemp. 'mode' -- the mode argument to os.fdopen (default "w+b"). 'bufsize' -- the buffer size argument to os.fdopen (default -1). The file is created as mkstemp() would do it. Returns a file object; the name of the file is accessible as file.name. The file will be automatically deleted when it is closed. """ if dir is None: dir = gettempdir() if 'b' in mode: flags = _bin_openflags else: flags = _text_openflags # Setting O_TEMPORARY in the flags causes the OS to delete # the file when it is closed. This is only supported by Windows. if _os.name == 'nt': flags |= _os.O_TEMPORARY (fd, name) = _mkstemp_inner(dir, prefix, suffix, flags) file = _os.fdopen(fd, mode, bufsize) return _TemporaryFileWrapper(file, name)
|
def NamedTemporaryFile(mode='w+b', bufsize=-1, suffix="", prefix=template, dir=None): """Create and return a temporary file. Arguments: 'prefix', 'suffix', 'dir' -- as for mkstemp. 'mode' -- the mode argument to os.fdopen (default "w+b"). 'bufsize' -- the buffer size argument to os.fdopen (default -1). The file is created as mkstemp() would do it. Returns an object with a file-like interface; the name of the file is accessible as file.name. The file will be automatically deleted when it is closed. """ if dir is None: dir = gettempdir() if 'b' in mode: flags = _bin_openflags else: flags = _text_openflags # Setting O_TEMPORARY in the flags causes the OS to delete # the file when it is closed. This is only supported by Windows. if _os.name == 'nt': flags |= _os.O_TEMPORARY (fd, name) = _mkstemp_inner(dir, prefix, suffix, flags) file = _os.fdopen(fd, mode, bufsize) return _TemporaryFileWrapper(file, name)
| 7,244
|
def TemporaryFile(mode='w+b', bufsize=-1, suffix="", prefix=template, dir=None): """Create and return a temporary file. Arguments: 'prefix', 'suffix', 'directory' -- as for mkstemp. 'mode' -- the mode argument to os.fdopen (default "w+b"). 'bufsize' -- the buffer size argument to os.fdopen (default -1). The file is created as mkstemp() would do it.
|
def TemporaryFile(mode='w+b', bufsize=-1, suffix="", prefix=template, dir=None): """Create and return a temporary file. Arguments: 'prefix', 'suffix', 'directory' -- as for mkstemp. 'mode' -- the mode argument to os.fdopen (default "w+b"). 'bufsize' -- the buffer size argument to os.fdopen (default -1). The file is created as mkstemp() would do it.
| 7,245
|
def iteritems(self): try: cur = self._make_iter_cursor()
|
def iteritems(self): try: cur = self._make_iter_cursor()
| 7,246
|
def installSinglePackage(self, output=None): """Download, unpack and install a single package. If output is given it should be a file-like object and it will receive a log of what happened.""" if not self._dict['Download-URL']: return "%s: This package needs to be installed manually (no Download-URL field)" % _fmtpackagename(self) msg = self.downloadPackageOnly(output) if msg: return "%s: download: %s" % (self.fullname(), msg) msg = self.unpackPackageOnly(output) if msg: return "%s: unpack: %s" % (self.fullname(), msg) return self.installPackageOnly(output)
|
def installSinglePackage(self, output=None): """Download, unpack and install a single package. If output is given it should be a file-like object and it will receive a log of what happened.""" if not self._dict.get('Download-URL'): return "%s: This package needs to be installed manually (no Download-URL field)" % self.fullname() msg = self.downloadPackageOnly(output) if msg: return "%s: download: %s" % (self.fullname(), msg) msg = self.unpackPackageOnly(output) if msg: return "%s: unpack: %s" % (self.fullname(), msg) return self.installPackageOnly(output)
| 7,247
|
def simple_err(func, *args): try: apply(func, args) except struct.error: pass else: raise TestFailed, "%s%s did not raise struct.error" % ( func.__name__, args)
|
def simple_err(func, *args): try: apply(func, args) except struct.error: pass else: raise TestFailed, "%s%s did not raise struct.error" % ( func.__name__, args)
| 7,248
|
def badpack(fmt, arg, got, exp): return
|
def badpack(fmt, arg, got, exp): return
| 7,249
|
def setquit(): """Define new built-ins 'quit' and 'exit'. These are simply strings that display a hint on how to exit. """ if os.sep == ':': exit = 'Use Cmd-Q to quit.' elif os.sep == '\\': exit = 'Use Ctrl-Z plus Return to exit.' else: exit = 'Use Ctrl-D (i.e. EOF) to exit.' __builtin__.quit = __builtin__.exit = exit
|
def setquit(): """Define new built-ins 'quit' and 'exit'. These are simply strings that display a hint on how to exit. """ if os.sep == ':': eof = 'Cmd-Q' elif os.sep == '\\': exit = 'Use Ctrl-Z plus Return to exit.' else: exit = 'Use Ctrl-D (i.e. EOF) to exit.' __builtin__.quit = __builtin__.exit = exit
| 7,250
|
def setquit(): """Define new built-ins 'quit' and 'exit'. These are simply strings that display a hint on how to exit. """ if os.sep == ':': exit = 'Use Cmd-Q to quit.' elif os.sep == '\\': exit = 'Use Ctrl-Z plus Return to exit.' else: exit = 'Use Ctrl-D (i.e. EOF) to exit.' __builtin__.quit = __builtin__.exit = exit
|
def setquit(): """Define new built-ins 'quit' and 'exit'. These are simply strings that display a hint on how to exit. """ if os.sep == ':': exit = 'Use Cmd-Q to quit.' elif os.sep == '\\': eof = 'Ctrl-Z plus Return' else: exit = 'Use Ctrl-D (i.e. EOF) to exit.' __builtin__.quit = __builtin__.exit = exit
| 7,251
|
def setquit(): """Define new built-ins 'quit' and 'exit'. These are simply strings that display a hint on how to exit. """ if os.sep == ':': exit = 'Use Cmd-Q to quit.' elif os.sep == '\\': exit = 'Use Ctrl-Z plus Return to exit.' else: exit = 'Use Ctrl-D (i.e. EOF) to exit.' __builtin__.quit = __builtin__.exit = exit
|
def setquit(): """Define new built-ins 'quit' and 'exit'. These are simply strings that display a hint on how to exit. """ if os.sep == ':': exit = 'Use Cmd-Q to quit.' elif os.sep == '\\': exit = 'Use Ctrl-Z plus Return to exit.' else: eof = 'Ctrl-D (i.e. EOF)' class Quitter(object): def __init__(self, name): self.name = name def __repr__(self): return 'Use %s() or %s to exit' % (self.name, eof) def __call__(self, code=None): raise SystemExit(code) __builtin__.quit = Quitter('quit') __builtin__.exit = Quitter('exit')
| 7,252
|
def send(self, str): """Send `str' to the server.""" if self.sock is None: if self.auto_open: self.connect() else: raise NotConnected()
|
def send(self, str): """Send `str' to the server.""" if self.sock is None: if self.auto_open: self.connect() else: raise NotConnected()
| 7,253
|
def putrequest(self, method, url, skip_host=0): """Send a request to the server.
|
def putrequest(self, method, url, skip_host=0): """Send a request to the server.
| 7,254
|
def putheader(self, header, value): """Send a request header line to the server.
|
def putheader(self, header, value): """Send a request header line to the server.
| 7,255
|
def endheaders(self): """Indicate that the last header line has been sent to the server."""
|
def endheaders(self): """Indicate that the last header line has been sent to the server."""
| 7,256
|
def test(): """Test this module. A hodge podge of tests collected here, because they have too many external dependencies for the regular test suite. """ import sys import getopt opts, args = getopt.getopt(sys.argv[1:], 'd') dl = 0 for o, a in opts: if o == '-d': dl = dl + 1 host = 'www.python.org' selector = '/' if args[0:]: host = args[0] if args[1:]: selector = args[1] h = HTTP() h.set_debuglevel(dl) h.connect(host) h.putrequest('GET', selector) h.endheaders() status, reason, headers = h.getreply() print 'status =', status print 'reason =', reason print "read", len(h.getfile().read()) print if headers: for header in headers.headers: print header.strip() print # minimal test that code to extract host from url works class HTTP11(HTTP): _http_vsn = 11 _http_vsn_str = 'HTTP/1.1' h = HTTP11('www.python.org') h.putrequest('GET', 'http://www.python.org/~jeremy/') h.endheaders() h.getreply() h.close() if hasattr(socket, 'ssl'): for host, selector in (('sourceforge.net', '/projects/python'), ('dbserv2.theopalgroup.com', '/mediumfile'), ('dbserv2.theopalgroup.com', '/smallfile'), ): print "https://%s%s" % (host, selector) hs = HTTPS() hs.connect(host) hs.putrequest('GET', selector) hs.endheaders() status, reason, headers = hs.getreply() print 'status =', status print 'reason =', reason print "read", len(hs.getfile().read()) print if headers: for header in headers.headers: print header.strip() print return # Test a buggy server -- returns garbled status line. # http://www.yahoo.com/promotions/mom_com97/supermom.html c = HTTPConnection("promotions.yahoo.com") c.set_debuglevel(1) c.connect() c.request("GET", "/promotions/mom_com97/supermom.html") r = c.getresponse() print r.status, r.version lines = r.read().split("\n") print "\n".join(lines[:5]) c = HTTPConnection("promotions.yahoo.com", strict=1) c.set_debuglevel(1) c.connect() c.request("GET", "/promotions/mom_com97/supermom.html") try: r = c.getresponse() except BadStatusLine, err: print "strict mode failed as expected" print err else: print "XXX strict mode should have failed" for strict in 0, 1: h = HTTP(strict=strict) h.connect("promotions.yahoo.com") h.putrequest('GET', "/promotions/mom_com97/supermom.html") h.endheaders() status, reason, headers = h.getreply() assert (strict and status == -1) or status == 200, (strict, status)
|
def test(): """Test this module. A hodge podge of tests collected here, because they have too many external dependencies for the regular test suite. """ import sys import getopt opts, args = getopt.getopt(sys.argv[1:], 'd') dl = 0 for o, a in opts: if o == '-d': dl = dl + 1 host = 'www.python.org' selector = '/' if args[0:]: host = args[0] if args[1:]: selector = args[1] h = HTTP() h.set_debuglevel(dl) h.connect(host) h.putrequest('GET', selector) h.endheaders() status, reason, headers = h.getreply() print 'status =', status print 'reason =', reason print "read", len(h.getfile().read()) print if headers: for header in headers.headers: print header.strip() print # minimal test that code to extract host from url works class HTTP11(HTTP): _http_vsn = 11 _http_vsn_str = 'HTTP/1.1' h = HTTP11('www.python.org') h.putrequest('GET', 'http://www.python.org/~jeremy/') h.endheaders() h.getreply() h.close() if hasattr(socket, 'ssl'): for host, selector in (('sourceforge.net', '/projects/python'), ('dbserv2.theopalgroup.com', '/mediumfile'), ('dbserv2.theopalgroup.com', '/smallfile'), ): print "https://%s%s" % (host, selector) hs = HTTPS() hs.connect(host) hs.putrequest('GET', selector) hs.endheaders() status, reason, headers = hs.getreply() print 'status =', status print 'reason =', reason print "read", len(hs.getfile().read()) print if headers: for header in headers.headers: print header.strip() print # Test a buggy server -- returns garbled status line. # http://www.yahoo.com/promotions/mom_com97/supermom.html c = HTTPConnection("promotions.yahoo.com") c.set_debuglevel(1) c.connect() c.request("GET", "/promotions/mom_com97/supermom.html") r = c.getresponse() print r.status, r.version lines = r.read().split("\n") print "\n".join(lines[:5]) c = HTTPConnection("promotions.yahoo.com", strict=1) c.set_debuglevel(1) c.connect() c.request("GET", "/promotions/mom_com97/supermom.html") try: r = c.getresponse() except BadStatusLine, err: print "strict mode failed as expected" print err else: print "XXX strict mode should have failed" for strict in 0, 1: h = HTTP(strict=strict) h.connect("promotions.yahoo.com") h.putrequest('GET', "/promotions/mom_com97/supermom.html") h.endheaders() status, reason, headers = h.getreply() assert (strict and status == -1) or status == 200, (strict, status)
| 7,257
|
def __call__(self, result=None): if result is None: result = self.defaultTestResult() result.startTest(self) testMethod = getattr(self, self.__testMethodName) try: try: self.setUp() except: result.addError(self,self.__exc_info()) return
|
def __call__(self, result=None): if result is None: result = self.defaultTestResult() result.startTest(self) testMethod = getattr(self, self.__testMethodName) try: try: self.setUp() except: result.addError(self,sys.exc_info()) return
| 7,258
|
def __call__(self, result=None): if result is None: result = self.defaultTestResult() result.startTest(self) testMethod = getattr(self, self.__testMethodName) try: try: self.setUp() except: result.addError(self,self.__exc_info()) return
|
def __call__(self, result=None): if result is None: result = self.defaultTestResult() result.startTest(self) testMethod = getattr(self, self.__testMethodName) try: try: self.setUp() except: result.addError(self,self.__exc_info()) return
| 7,259
|
def __call__(self, result=None): if result is None: result = self.defaultTestResult() result.startTest(self) testMethod = getattr(self, self.__testMethodName) try: try: self.setUp() except: result.addError(self,self.__exc_info()) return
|
def __call__(self, result=None): if result is None: result = self.defaultTestResult() result.startTest(self) testMethod = getattr(self, self.__testMethodName) try: try: self.setUp() except: result.addError(self,sys.exc_info()) return
| 7,260
|
def __call__(self, result=None): if result is None: result = self.defaultTestResult() result.startTest(self) testMethod = getattr(self, self.__testMethodName) try: try: self.setUp() except: result.addError(self,self.__exc_info()) return
|
def __call__(self, result=None): if result is None: result = self.defaultTestResult() result.startTest(self) testMethod = getattr(self, self.__testMethodName) try: try: self.setUp() except: result.addError(self,sys.exc_info()) return
| 7,261
|
def __exc_info(self): """Return a version of sys.exc_info() with the traceback frame minimised; usually the top level of the traceback frame is not needed. """ exctype, excvalue, tb = sys.exc_info() newtb = tb.tb_next if newtb is None: return (exctype, excvalue, tb) return (exctype, excvalue, newtb)
|
def __exc_info(self): """Return a version of sys.exc_info() with the traceback frame minimised; usually the top level of the traceback frame is not needed. """ exctype, excvalue, tb = sys.exc_info() newtb = tb.tb_next if newtb is None: return (exctype, excvalue, tb) return (exctype, excvalue, newtb)
| 7,262
|
def loadTestsFromName(self, name, module=None): parts = string.split(name, '.') if module is None: if not parts: raise ValueError, "incomplete test name: %s" % name else: module = __import__(parts) parts = parts[1:] obj = module for part in parts: obj = getattr(obj, part)
|
def loadTestsFromName(self, name, module=None): parts = string.split(name, '.') if module is None: if not parts: raise ValueError, "incomplete test name: %s" % name else: parts_copy = parts[:] while parts_copy: try: module = __import__(string.join(parts_copy,'.')) break except ImportError: del parts_copy[-1] if not parts_copy: raise parts = parts[1:] obj = module for part in parts: obj = getattr(obj, part)
| 7,263
|
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" % (run, run == 1 and "" or "s", timeTaken)) self.stream.writeln() if not result.wasSuccessful(): self.stream.write("FAILED (") failed, errored = map(len, (result.failures, result.errors)) if failed: self.stream.write("failures=%d" % failed) if errored: if failed: self.stream.write(", ") self.stream.write("errors=%d" % errored) self.stream.writeln(")") else: self.stream.writeln("OK") return result
|
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" % (run, run == 1 and "" or "s", timeTaken)) self.stream.writeln() if not result.wasSuccessful(): self.stream.write("FAILED (") failed, errored = map(len, (result.failures, result.errors)) if failed: self.stream.write("failures=%d" % failed) if errored: if failed: self.stream.write(", ") self.stream.write("errors=%d" % errored) self.stream.writeln(")") else: self.stream.writeln("OK") return result
| 7,264
|
def __getitem__(self, item): if item > self.len-1 or item < -self.len: raise IndexError if item < 0: item += self.len return strftime(self.format, (item,)*9).capitalize()
|
def __getitem__(self, item): if item > self.len-1 or item < -self.len: raise IndexError if item < 0: item += self.len return strftime(self.format, (item,)*9).capitalize()
| 7,265
|
def __len__(self): return self.len
|
def __len__(self): return self.len
| 7,266
|
def __init__ (self, verbose=0, dry_run=0, force=0):
|
def __init__ (self, verbose=0, dry_run=0, force=0):
| 7,267
|
def __init__ (self, verbose=0, dry_run=0, force=0):
|
def __init__ (self, verbose=0, dry_run=0, force=0):
| 7,268
|
def __init__ (self, verbose=0, dry_run=0, force=0):
|
def __init__ (self, verbose=0, dry_run=0, force=0):
| 7,269
|
def grab_rgb8(w, h, pf): if gl.getdisplaymode() <> DMRGB: raise Error, 'Sorry, can only grab rgb8 in single-buf rgbmode' if pf <> 1 and pf <> 0: raise Error, 'Sorry, can only grab rgb8 with packfactor 1' r = gl.getgdesc(GL.GD_BITS_NORM_SNG_RED) g = gl.getgdesc(GL.GD_BITS_NORM_SNG_GREEN) b = gl.getgdesc(GL.GD_BITS_NORM_SNG_BLUE) if (r, g, b) <> (3, 3, 2): raise Error, 'Sorry, can only grab rgb8 on 8-bit Indigo' # XXX Dirty Dirty here. # XXX Set buffer to cmap mode, grab image and set it back. # XXX (Shouldn't be necessary???) gl.cmode() gl.gconfig() gl.pixmode(GL.PM_SIZE, 8) data = gl.lrectread(0, 0, w-1, h-1) data = data[:w*h] # BUG FIX for python lrectread gl.RGBmode() gl.gconfig() gl.pixmode(GL.PM_SIZE, 32) return data, None
|
def grab_rgb8(w, h, pf): if gl.getdisplaymode() <> DMRGB: raise Error, 'Sorry, can only grab rgb8 in single-buf rgbmode' if pf <> 1 and pf <> 0: raise Error, 'Sorry, can only grab rgb8 with packfactor 1' if not is_entry_indigo(): raise Error, 'Sorry, can only grab rgb8 on entry level Indigo' # XXX Dirty Dirty here. # XXX Set buffer to cmap mode, grab image and set it back. # XXX (Shouldn't be necessary???) gl.cmode() gl.gconfig() gl.pixmode(GL.PM_SIZE, 8) data = gl.lrectread(0, 0, w-1, h-1) data = data[:w*h] # BUG FIX for python lrectread gl.RGBmode() gl.gconfig() gl.pixmode(GL.PM_SIZE, 32) return data, None
| 7,270
|
def grab_rgb8(w, h, pf): if gl.getdisplaymode() <> DMRGB: raise Error, 'Sorry, can only grab rgb8 in single-buf rgbmode' if pf <> 1 and pf <> 0: raise Error, 'Sorry, can only grab rgb8 with packfactor 1' r = gl.getgdesc(GL.GD_BITS_NORM_SNG_RED) g = gl.getgdesc(GL.GD_BITS_NORM_SNG_GREEN) b = gl.getgdesc(GL.GD_BITS_NORM_SNG_BLUE) if (r, g, b) <> (3, 3, 2): raise Error, 'Sorry, can only grab rgb8 on 8-bit Indigo' # XXX Dirty Dirty here. # XXX Set buffer to cmap mode, grab image and set it back. # XXX (Shouldn't be necessary???) gl.cmode() gl.gconfig() gl.pixmode(GL.PM_SIZE, 8) data = gl.lrectread(0, 0, w-1, h-1) data = data[:w*h] # BUG FIX for python lrectread gl.RGBmode() gl.gconfig() gl.pixmode(GL.PM_SIZE, 32) return data, None
|
defgrab_rgb8(w,h,pf):ifgl.getdisplaymode()<>DMRGB:raiseError,'Sorry,canonlygrabrgb8insingle-bufrgbmode'ifpf<>1andpf<>0:raiseError,'Sorry,canonlygrabrgb8withpackfactor1'r=gl.getgdesc(GL.GD_BITS_NORM_SNG_RED)g=gl.getgdesc(GL.GD_BITS_NORM_SNG_GREEN)b=gl.getgdesc(GL.GD_BITS_NORM_SNG_BLUE)if(r,g,b)<>(3,3,2):raiseError,'Sorry,canonlygrabrgb8on8-bitIndigo'#XXXDirtyDirtyhere.#XXXSetbuffertocmapmode,grabimageandsetitback.#XXX(Shouldn'tbenecessary???)gl.cmode()gl.gconfig()gl.pixmode(GL.PM_SIZE,8)data=gl.lrectread(0,0,w-1,h-1)data=data[:w*h] #BUGFIXforpythonlrectreadgl.RGBmode()gl.gconfig()gl.pixmode(GL.PM_SIZE,32)returndata,None
| 7,271
|
def printinfo(self): print 'Format: ', self.format print 'Size: ', self.width, 'x', self.height print 'Pack: ', self.packfactor, '; chrom:', self.chrompack print 'Bits: ', self.c0bits, self.c1bits, self.c2bits print 'Offset: ', self.offset
|
def printinfo(self): print 'Format: ', self.format print 'Size: ', self.width, 'x', self.height print 'Pack: ', self.packfactor, '; chrom:', self.chrompack print 'Bits: ', self.c0bits, self.c1bits, self.c2bits print 'Offset: ', self.offset
| 7,272
|
def initcolormap(self): if self.format == 'rgb': gl.RGBmode() gl.gconfig() self.colormapinited = 1 gl.RGBcolor(200, 200, 200) # XXX rather light grey gl.clear() return gl.cmode() gl.gconfig() self.skipchrom = 0 if self.offset == 0: self.mask = 0x7ff else: self.mask = 0xfff if not self.quiet: sys.stderr.write('Initializing color map...') self._initcmap() self.colormapinited = 1 self.clear() if not self.quiet: sys.stderr.write(' Done.\n')
|
def initcolormap(self): if self.format == 'rgb': gl.RGBmode() gl.gconfig() gl.RGBcolor(200, 200, 200) # XXX rather light grey gl.clear() return gl.cmode() gl.gconfig() self.skipchrom = 0 if self.offset == 0: self.mask = 0x7ff else: self.mask = 0xfff if not self.quiet: sys.stderr.write('Initializing color map...') self._initcmap() self.clear() if not self.quiet: sys.stderr.write(' Done.\n')
| 7,273
|
def initcolormap(self): if self.format == 'rgb': gl.RGBmode() gl.gconfig() self.colormapinited = 1 gl.RGBcolor(200, 200, 200) # XXX rather light grey gl.clear() return gl.cmode() gl.gconfig() self.skipchrom = 0 if self.offset == 0: self.mask = 0x7ff else: self.mask = 0xfff if not self.quiet: sys.stderr.write('Initializing color map...') self._initcmap() self.colormapinited = 1 self.clear() if not self.quiet: sys.stderr.write(' Done.\n')
|
def initcolormap(self): if self.format == 'rgb': gl.RGBmode() gl.gconfig() self.colormapinited = 1 gl.RGBcolor(200, 200, 200) # XXX rather light grey gl.clear() return gl.cmode() gl.gconfig() self.skipchrom = 0 if self.offset == 0: self.mask = 0x7ff else: self.mask = 0xfff if not self.quiet: sys.stderr.write('Initializing color map...') self._initcmap() gl.clear() if not self.quiet: sys.stderr.write(' Done.\n')
| 7,274
|
def initcolormap(self): if self.format == 'rgb': gl.RGBmode() gl.gconfig() self.colormapinited = 1 gl.RGBcolor(200, 200, 200) # XXX rather light grey gl.clear() return gl.cmode() gl.gconfig() self.skipchrom = 0 if self.offset == 0: self.mask = 0x7ff else: self.mask = 0xfff if not self.quiet: sys.stderr.write('Initializing color map...') self._initcmap() self.colormapinited = 1 self.clear() if not self.quiet: sys.stderr.write(' Done.\n')
|
def initcolormap(self): if self.format == 'rgb': gl.RGBmode() gl.gconfig() self.colormapinited = 1 gl.RGBcolor(200, 200, 200) # XXX rather light grey gl.clear() return gl.cmode() gl.gconfig() self.skipchrom = 0 if self.offset == 0: self.mask = 0x7ff else: self.mask = 0xfff if not self.quiet: sys.stderr.write('Initializing color map...') self._initcmap() self.colormapinited = 1 self.clear() if not self.quiet: sys.stderr.write(' Done.\n')
| 7,275
|
def clear(self): if not self.colormapinited: raise CallError if self.offset == 0: gl.color(0x800) gl.clear() else: gl.clear()
|
def clear(self): if not self.colormapinited: raise CallError if gl.getdisplaymode() in (DMRGB, DMRGBDOUBLE): gl.RGBcolor(200, 200, 200) gl.clear() else: gl.clear()
| 7,276
|
def clear(self): if not self.colormapinited: raise CallError if self.offset == 0: gl.color(0x800) gl.clear() else: gl.clear()
|
def clear(self): if not self.colormapinited: raise CallError if self.offset == 0: gl.color(0x800) gl.clear() return gl.writemask(0xffffffff) gl.clear() def clearto(self, r, g, b): if not self.colormapinited: raise CallError if gl.getdisplaymode() in (DMRGB, DMRGBDOUBLE): gl.RGBcolor(r, g, b) gl.clear()
| 7,277
|
def clear(self): if not self.colormapinited: raise CallError if self.offset == 0: gl.color(0x800) gl.clear() else: gl.clear()
|
def clear(self): if not self.colormapinited: raise CallError if self.offset == 0: gl.color(0x800) gl.clear() else: gl.clear()
| 7,278
|
def _initcmap(self): convcolor = choose_conversion(self.format) maxbits = gl.getgdesc(GL.GD_BITS_NORM_SNG_CMODE) if maxbits > 11: maxbits = 11 c0bits, c1bits, c2bits = self.c0bits, self.c1bits, self.c2bits if c0bits+c1bits+c2bits > maxbits: if self.fallback and c0bits < maxbits: # Cannot display frames in this mode, use grey self.skipchrom = 1 c1bits = c2bits = 0 convcolor = choose_conversion('grey') else: raise Error, 'Sorry, '+`maxbits`+ \ ' bits max on this machine' maxc0 = 1 << c0bits maxc1 = 1 << c1bits maxc2 = 1 << c2bits if self.offset == 0 and maxbits == 11: offset = 2048 else: offset = self.offset if maxbits <> 11: offset = offset & ((1<<maxbits)-1) # XXX why is this here? # for i in range(512, MAXMAP): # gl.mapcolor(i, 0, 0, 0) # gl.gflush() for c0 in range(maxc0): c0v = c0/float(maxc0-1) for c1 in range(maxc1): if maxc1 == 1: c1v = 0 else: c1v = c1/float(maxc1-1) for c2 in range(maxc2): if maxc2 == 1: c2v = 0 else: c2v = c2/float(maxc2-1) index = offset + c0 + (c1<<c0bits) + \ (c2 << (c0bits+c1bits)) if index < MAXMAP: rv, gv, bv = \ convcolor(c0v, c1v, c2v) r, g, b = int(rv*255.0), \ int(gv*255.0), \ int(bv*255.0) gl.mapcolor(index, r, g, b) gl.gflush() # send the colormap changes to the X server
|
def _initcmap(self): convcolor = choose_conversion(self.format) maxbits = gl.getgdesc(GL.GD_BITS_NORM_SNG_CMODE) if maxbits > 11: maxbits = 11 c0bits = self.c0bits c1bits = self.c1bits c2bits = self.c2bits if c0bits+c1bits+c2bits > maxbits: if self.fallback and c0bits < maxbits: # Cannot display frames in this mode, use grey self.skipchrom = 1 c1bits = c2bits = 0 convcolor = choose_conversion('grey') else: raise Error, 'Sorry, '+`maxbits`+ \ ' bits max on this machine' maxc0 = 1 << c0bits maxc1 = 1 << c1bits maxc2 = 1 << c2bits if self.offset == 0 and maxbits == 11: offset = 2048 else: offset = self.offset if maxbits <> 11: offset = offset & ((1<<maxbits)-1) # XXX why is this here? # for i in range(512, MAXMAP): # gl.mapcolor(i, 0, 0, 0) # gl.gflush() for c0 in range(maxc0): c0v = c0/float(maxc0-1) for c1 in range(maxc1): if maxc1 == 1: c1v = 0 else: c1v = c1/float(maxc1-1) for c2 in range(maxc2): if maxc2 == 1: c2v = 0 else: c2v = c2/float(maxc2-1) index = offset + c0 + (c1<<c0bits) + \ (c2 << (c0bits+c1bits)) if index < MAXMAP: rv, gv, bv = \ convcolor(c0v, c1v, c2v) r, g, b = int(rv*255.0), \ int(gv*255.0), \ int(bv*255.0) gl.mapcolor(index, r, g, b) gl.gflush() # send the colormap changes to the X server
| 7,279
|
def _initcmap(self): convcolor = choose_conversion(self.format) maxbits = gl.getgdesc(GL.GD_BITS_NORM_SNG_CMODE) if maxbits > 11: maxbits = 11 c0bits, c1bits, c2bits = self.c0bits, self.c1bits, self.c2bits if c0bits+c1bits+c2bits > maxbits: if self.fallback and c0bits < maxbits: # Cannot display frames in this mode, use grey self.skipchrom = 1 c1bits = c2bits = 0 convcolor = choose_conversion('grey') else: raise Error, 'Sorry, '+`maxbits`+ \ ' bits max on this machine' maxc0 = 1 << c0bits maxc1 = 1 << c1bits maxc2 = 1 << c2bits if self.offset == 0 and maxbits == 11: offset = 2048 else: offset = self.offset if maxbits <> 11: offset = offset & ((1<<maxbits)-1) # XXX why is this here? # for i in range(512, MAXMAP): # gl.mapcolor(i, 0, 0, 0) # gl.gflush() for c0 in range(maxc0): c0v = c0/float(maxc0-1) for c1 in range(maxc1): if maxc1 == 1: c1v = 0 else: c1v = c1/float(maxc1-1) for c2 in range(maxc2): if maxc2 == 1: c2v = 0 else: c2v = c2/float(maxc2-1) index = offset + c0 + (c1<<c0bits) + \ (c2 << (c0bits+c1bits)) if index < MAXMAP: rv, gv, bv = \ convcolor(c0v, c1v, c2v) r, g, b = int(rv*255.0), \ int(gv*255.0), \ int(bv*255.0) gl.mapcolor(index, r, g, b) gl.gflush() # send the colormap changes to the X server
|
def _initcmap(self): convcolor = choose_conversion(self.format) maxbits = gl.getgdesc(GL.GD_BITS_NORM_SNG_CMODE) if maxbits > 11: maxbits = 11 c0bits, c1bits, c2bits = self.c0bits, self.c1bits, self.c2bits if c0bits+c1bits+c2bits > maxbits: if self.fallback and c0bits < maxbits: # Cannot display frames in this mode, use grey self.skipchrom = 1 c1bits = c2bits = 0 convcolor = choose_conversion('grey') else: raise Error, 'Sorry, '+`maxbits`+ \ ' bits max on this machine' maxc0 = 1 << c0bits maxc1 = 1 << c1bits maxc2 = 1 << c2bits if self.offset == 0 and maxbits == 11: offset = 2048 else: offset = self.offset if maxbits <> 11: offset = offset & ((1<<maxbits)-1) # XXX why is this here? # for i in range(512, MAXMAP): # gl.mapcolor(i, 0, 0, 0) # gl.gflush() for c0 in range(maxc0): c0v = c0/float(maxc0-1) for c1 in range(maxc1): if maxc1 == 1: c1v = 0 else: c1v = c1/float(maxc1-1) for c2 in range(maxc2): if maxc2 == 1: c2v = 0 else: c2v = c2/float(maxc2-1) index = offset + c0 + (c1<<c0bits) + \ (c2 << (c0bits+c1bits)) if index < MAXMAP: rv, gv, bv = \ convcolor(c0v, c1v, c2v) r, g, b = int(rv*255.0), \ int(gv*255.0), \ int(bv*255.0) gl.mapcolor(index, r, g, b) gl.gflush() # send the colormap changes to the X server
| 7,280
|
def warmcache(self): pass
|
def warmcache(self): pass
| 7,281
|
def getnextframedata(self, ds, cs): if self.atframeheader: raise CallError if ds: data = self.fp.read(ds) if len(data) < ds: raise EOFError else: data = '' if cs: cdata = self.fp.read(cs) if len(cdata) < cs: raise EOFerror else: cdata = '' self.atframeheader = 1 self.framecount = self.framecount + 1 return (data, cdata)
|
def getnextframedata(self, ds, cs): if self.atframeheader: raise CallError if ds: data = self.fp.read(ds) if len(data) < ds: self.eofseen = 1 raise EOFError else: data = '' if cs: cdata = self.fp.read(cs) if len(cdata) < cs: raise EOFerror else: cdata = '' self.atframeheader = 1 self.framecount = self.framecount + 1 return (data, cdata)
| 7,282
|
def getnextframedata(self, ds, cs): if self.atframeheader: raise CallError if ds: data = self.fp.read(ds) if len(data) < ds: raise EOFError else: data = '' if cs: cdata = self.fp.read(cs) if len(cdata) < cs: raise EOFerror else: cdata = '' self.atframeheader = 1 self.framecount = self.framecount + 1 return (data, cdata)
|
def getnextframedata(self, ds, cs): if self.atframeheader: raise CallError if ds: data = self.fp.read(ds) if len(data) < ds: raise EOFError else: data = '' if cs: cdata = self.fp.read(cs) if len(cdata) < cs: self.eofseen = 1 raise EOFError else: cdata = '' self.atframeheader = 1 self.framecount = self.framecount + 1 return (data, cdata)
| 7,283
|
def initfp(self, fp, filename): self = VideoParams.init(self) self.fp = fp self.filename = filename self.version = 3.0 # In case anyone inquires self.headerwritten = 0 return self
|
def initfp(self, fp, filename): self = VideoParams.init(self) self.fp = fp self.filename = filename self.version = 3.0 # In case anyone inquires self.headerwritten = 0 return self
| 7,284
|
def writeframeheader(self, t, ds, cs): if not self.headerwritten: self.writeheader() if not self.atheader: raise CallError self.fp.write(`(t, ds, cs)` + '\n') self.atheader = 0
|
def writeframeheader(self, t, ds, cs): if not self.headerwritten: self.writeheader() if not self.atheader: raise CallError data = `(t, ds, cs)` n = len(data) if n < 63: data = data + ' '*(63-n) self.fp.write(data + '\n') self.atheader = 0
| 7,285
|
def writeframedata(self, data, cdata): if not self.headerwritten or self.atheader: raise CallError if data: self.fp.write(data) if cdata: self.fp.write(cdata) self.atheader = 1 self.framecount = self.framecount + 1
|
def writeframedata(self, data, cdata): if not self.headerwritten or self.atheader: raise CallError if data: self.fp.write(data) if cdata: self.fp.write(cdata) self.atheader = 1 self.framecount = self.framecount + 1
| 7,286
|
def initfp(self, fp, filename): self = Displayer.init(self) return BasicVinFile.initfp(self, fp, filename)
|
def initfp(self, fp, filename): self = Displayer.init(self) return BasicVinFile.initfp(self, fp, filename)
| 7,287
|
def test_compare(self): t1 = timedelta(2, 3, 4) t2 = timedelta(2, 3, 4) self.failUnless(t1 == t2) self.failUnless(t1 <= t2) self.failUnless(t1 >= t2) self.failUnless(not t1 != t2) self.failUnless(not t1 < t2) self.failUnless(not t1 > t2) self.assertEqual(cmp(t1, t2), 0) self.assertEqual(cmp(t2, t1), 0)
|
def test_compare(self): t1 = timedelta(2, 3, 4) t2 = timedelta(2, 3, 4) self.failUnless(t1 == t2) self.failUnless(t1 <= t2) self.failUnless(t1 >= t2) self.failUnless(not t1 != t2) self.failUnless(not t1 < t2) self.failUnless(not t1 > t2) self.assertEqual(cmp(t1, t2), 0) self.assertEqual(cmp(t2, t1), 0)
| 7,288
|
def test_compare(self): t1 = timedelta(2, 3, 4) t2 = timedelta(2, 3, 4) self.failUnless(t1 == t2) self.failUnless(t1 <= t2) self.failUnless(t1 >= t2) self.failUnless(not t1 != t2) self.failUnless(not t1 < t2) self.failUnless(not t1 > t2) self.assertEqual(cmp(t1, t2), 0) self.assertEqual(cmp(t2, t1), 0)
|
def test_compare(self): t1 = timedelta(2, 3, 4) t2 = timedelta(2, 3, 4) self.failUnless(t1 == t2) self.failUnless(t1 <= t2) self.failUnless(t1 >= t2) self.failUnless(not t1 != t2) self.failUnless(not t1 < t2) self.failUnless(not t1 > t2) self.assertEqual(cmp(t1, t2), 0) self.assertEqual(cmp(t2, t1), 0)
| 7,289
|
def test_compare(self): t1 = self.theclass(2, 3, 4) t2 = self.theclass(2, 3, 4) self.failUnless(t1 == t2) self.failUnless(t1 <= t2) self.failUnless(t1 >= t2) self.failUnless(not t1 != t2) self.failUnless(not t1 < t2) self.failUnless(not t1 > t2) self.assertEqual(cmp(t1, t2), 0) self.assertEqual(cmp(t2, t1), 0)
|
def test_compare(self): t1 = self.theclass(2, 3, 4) t2 = self.theclass(2, 3, 4) self.failUnless(t1 == t2) self.failUnless(t1 <= t2) self.failUnless(t1 >= t2) self.failUnless(not t1 != t2) self.failUnless(not t1 < t2) self.failUnless(not t1 > t2) self.assertEqual(cmp(t1, t2), 0) self.assertEqual(cmp(t2, t1), 0)
| 7,290
|
def test_compare(self): t1 = self.theclass(2, 3, 4) t2 = self.theclass(2, 3, 4) self.failUnless(t1 == t2) self.failUnless(t1 <= t2) self.failUnless(t1 >= t2) self.failUnless(not t1 != t2) self.failUnless(not t1 < t2) self.failUnless(not t1 > t2) self.assertEqual(cmp(t1, t2), 0) self.assertEqual(cmp(t2, t1), 0)
|
def test_compare(self): t1 = self.theclass(2, 3, 4) t2 = self.theclass(2, 3, 4) self.failUnless(t1 == t2) self.failUnless(t1 <= t2) self.failUnless(t1 >= t2) self.failUnless(not t1 != t2) self.failUnless(not t1 < t2) self.failUnless(not t1 > t2) self.assertEqual(cmp(t1, t2), 0) self.assertEqual(cmp(t2, t1), 0)
| 7,291
|
def test_comparing(self): args = [1, 2, 3, 4] t1 = self.theclass(*args) t2 = self.theclass(*args) self.failUnless(t1 == t2) self.failUnless(t1 <= t2) self.failUnless(t1 >= t2) self.failUnless(not t1 != t2) self.failUnless(not t1 < t2) self.failUnless(not t1 > t2) self.assertEqual(cmp(t1, t2), 0) self.assertEqual(cmp(t2, t1), 0)
|
def test_comparing(self): args = [1, 2, 3, 4] t1 = self.theclass(*args) t2 = self.theclass(*args) self.failUnless(t1 == t2) self.failUnless(t1 <= t2) self.failUnless(t1 >= t2) self.failUnless(not t1 != t2) self.failUnless(not t1 < t2) self.failUnless(not t1 > t2) self.assertEqual(cmp(t1, t2), 0) self.assertEqual(cmp(t2, t1), 0)
| 7,292
|
def test_comparing(self): args = [1, 2, 3, 4] t1 = self.theclass(*args) t2 = self.theclass(*args) self.failUnless(t1 == t2) self.failUnless(t1 <= t2) self.failUnless(t1 >= t2) self.failUnless(not t1 != t2) self.failUnless(not t1 < t2) self.failUnless(not t1 > t2) self.assertEqual(cmp(t1, t2), 0) self.assertEqual(cmp(t2, t1), 0)
|
def test_comparing(self): args = [1, 2, 3, 4] t1 = self.theclass(*args) t2 = self.theclass(*args) self.failUnless(t1 == t2) self.failUnless(t1 <= t2) self.failUnless(t1 >= t2) self.failUnless(not t1 != t2) self.failUnless(not t1 < t2) self.failUnless(not t1 > t2) self.assertEqual(cmp(t1, t2), 0) self.assertEqual(cmp(t2, t1), 0)
| 7,293
|
def test_mixed_compare(self): t1 = time(1, 2, 3) t2 = time(1, 2, 3) self.assertEqual(t1, t2) t2 = t2.replace(tzinfo=None) self.assertEqual(t1, t2) t2 = t2.replace(tzinfo=FixedOffset(None, "")) self.assertEqual(t1, t2) if CMP_BUG_FIXED: t2 = t2.replace(tzinfo=FixedOffset(0, "")) self.assertRaises(TypeError, lambda: t1 == t2)
|
def test_mixed_compare(self): t1 = time(1, 2, 3) t2 = time(1, 2, 3) self.assertEqual(t1, t2) t2 = t2.replace(tzinfo=None) self.assertEqual(t1, t2) t2 = t2.replace(tzinfo=FixedOffset(None, "")) self.assertEqual(t1, t2) if CMP_BUG_FIXED: t2 = t2.replace(tzinfo=FixedOffset(0, "")) self.assertRaises(TypeError, lambda: t1 == t2)
| 7,294
|
def test_mixed_compare(self): t1 = datetime(1, 2, 3, 4, 5, 6, 7) t2 = datetime(1, 2, 3, 4, 5, 6, 7) self.assertEqual(t1, t2) t2 = t2.replace(tzinfo=None) self.assertEqual(t1, t2) t2 = t2.replace(tzinfo=FixedOffset(None, "")) self.assertEqual(t1, t2) if CMP_BUG_FIXED: t2 = t2.replace(tzinfo=FixedOffset(0, "")) self.assertRaises(TypeError, lambda: t1 == t2)
|
def test_mixed_compare(self): t1 = datetime(1, 2, 3, 4, 5, 6, 7) t2 = datetime(1, 2, 3, 4, 5, 6, 7) self.assertEqual(t1, t2) t2 = t2.replace(tzinfo=None) self.assertEqual(t1, t2) t2 = t2.replace(tzinfo=FixedOffset(None, "")) self.assertEqual(t1, t2) if CMP_BUG_FIXED: t2 = t2.replace(tzinfo=FixedOffset(0, "")) self.assertRaises(TypeError, lambda: t1 == t2)
| 7,295
|
def __del__(self): try: if self.delete_font: self._call("font", "delete", self.name) except (AttributeError, Tkinter.TclError): pass
|
def __del__(self): try: if self.delete_font: self._call("font", "delete", self.name) except (KeyboardInterrupt, SystemExit): raise except Exception: pass
| 7,296
|
def _handle_long_word(self, chunks, cur_line, cur_len, width): """_handle_long_word(chunks : [string], cur_line : [string], cur_len : int, width : int)
|
def _handle_long_word(self, reversed_chunks, cur_line, cur_len, width): """_handle_long_word(chunks : [string], cur_line : [string], cur_len : int, width : int)
| 7,297
|
def _handle_long_word(self, chunks, cur_line, cur_len, width): """_handle_long_word(chunks : [string], cur_line : [string], cur_len : int, width : int)
|
def _handle_long_word(self, chunks, cur_line, cur_len, width): """_handle_long_word(chunks : [string], cur_line : [string], cur_len : int, width : int)
| 7,298
|
def _handle_long_word(self, chunks, cur_line, cur_len, width): """_handle_long_word(chunks : [string], cur_line : [string], cur_len : int, width : int)
|
def _handle_long_word(self, chunks, cur_line, cur_len, width): """_handle_long_word(chunks : [string], cur_line : [string], cur_len : int, width : int)
| 7,299
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.