bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def _addResources(self): "Add Welcome/ReadMe/License files, .lproj folders and scripts."
def _addResources(self): "Add Welcome/ReadMe/License files, .lproj folders and scripts."
6,700
def _addResources(self): "Add Welcome/ReadMe/License files, .lproj folders and scripts."
def _addResources(self): "Add Welcome/ReadMe/License files, .lproj folders and scripts."
6,701
def _addResources(self): "Add Welcome/ReadMe/License files, .lproj folders and scripts."
def _addResources(self): "Add Welcome/ReadMe/License files, .lproj folders and scripts."
6,702
def _addResources(self): "Add Welcome/ReadMe/License files, .lproj folders and scripts."
def _addResources(self): "Add Welcome/ReadMe/License files, .lproj folders and scripts."
6,703
def _addResources(self): "Add Welcome/ReadMe/License files, .lproj folders and scripts."
def _addResources(self): "Add Welcome/ReadMe/License files, .lproj folders and scripts."
6,704
def _addResources(self): "Add Welcome/ReadMe/License files, .lproj folders and scripts."
def _addResources(self): "Add Welcome/ReadMe/License files, .lproj folders and scripts."
6,705
def _addResources(self): "Add Welcome/ReadMe/License files, .lproj folders and scripts."
def _addResources(self): "Add Welcome/ReadMe/License files, .lproj folders and scripts."
6,706
def _addResources(self): "Add Welcome/ReadMe/License files, .lproj folders and scripts."
def _addResources(self): "Add Welcome/ReadMe/License files, .lproj folders and scripts."
6,707
def _addResources(self): "Add Welcome/ReadMe/License files, .lproj folders and scripts."
def _addResources(self): "Add Welcome/ReadMe/License files, .lproj folders and scripts."
6,708
def _addResources(self): "Add Welcome/ReadMe/License files, .lproj folders and scripts."
def _addResources(self): "Add Welcome/ReadMe/License files, .lproj folders and scripts."
6,709
def _addSizes(self): "Write .sizes file with info about number and size of files."
def _addSizes(self): "Write .sizes file with info about number and size of files."
6,710
def _addSizes(self): "Write .sizes file with info about number and size of files."
def _addSizes(self): "Write .sizes file with info about number and size of files."
6,711
def _addSizes(self): "Write .sizes file with info about number and size of files."
def _addSizes(self): "Write .sizes file with info about number and size of files."
6,712
def _addSizes(self): "Write .sizes file with info about number and size of files."
def _addSizes(self): "Write .sizes file with info about number and size of files."
6,713
def read(self, length = None): self._read(length, self.fp.read)
def read(self, length = None): self._read(length, self.fp.read)
6,714
def readline(self, length = None): self._read(length, self.fp.readline)
def readline(self, length = None): self._read(length, self.fp.readline)
6,715
def __init__(self, allow_none): self.funcs = {} self.instance = None self.allow_none = allow_none
def __init__(self, allow_none, encoding): self.funcs = {} self.instance = None self.allow_none = allow_none
6,716
def _marshaled_dispatch(self, data, dispatch_method = None): """Dispatches an XML-RPC method from marshalled (XML) data.
def _marshaled_dispatch(self, data, dispatch_method = None): """Dispatches an XML-RPC method from marshalled (XML) data.
6,717
def _marshaled_dispatch(self, data, dispatch_method = None): """Dispatches an XML-RPC method from marshalled (XML) data.
def _marshaled_dispatch(self, data, dispatch_method = None): """Dispatches an XML-RPC method from marshalled (XML) data.
6,718
def _marshaled_dispatch(self, data, dispatch_method = None): """Dispatches an XML-RPC method from marshalled (XML) data.
def _marshaled_dispatch(self, data, dispatch_method = None): """Dispatches an XML-RPC method from marshalled (XML) data.
6,719
def __init__(self, addr, requestHandler=SimpleXMLRPCRequestHandler, logRequests=True, allow_none=False): self.logRequests = logRequests
def __init__(self, addr, requestHandler=SimpleXMLRPCRequestHandler, logRequests=True, allow_none=False, encoding=None): self.logRequests = logRequests
6,720
def __init__(self, addr, requestHandler=SimpleXMLRPCRequestHandler, logRequests=True, allow_none=False): self.logRequests = logRequests
def __init__(self, addr, requestHandler=SimpleXMLRPCRequestHandler, logRequests=True, allow_none=False): self.logRequests = logRequests
6,721
def __init__(self, allow_none=False): SimpleXMLRPCDispatcher.__init__(self, allow_none)
def __init__(self, allow_none=False): SimpleXMLRPCDispatcher.__init__(self, allow_none)
6,722
def nti(s): """Convert a number field to a python number. """ # There are two possible encodings for a number field, see # itn() below. if s[0] != chr(0200): n = int(s.rstrip(NUL) or "0", 8) else: n = 0L for i in xrange(len(s) - 1): n <<= 8 n += ord(s[i + 1]) return n
def nti(s): """Convert a number field to a python number. """ # There are two possible encodings for a number field, see # itn() below. if s[0] != chr(0200): n = int(s.rstrip(NUL + " ") or "0", 8) else: n = 0L for i in xrange(len(s) - 1): n <<= 8 n += ord(s[i + 1]) return n
6,723
def read(self, n = 0): if n <= 0: newpos = len(self.buf) else: newpos = min(self.pos+n, len(self.buf)) r = self.buf[self.pos:newpos] self.pos = newpos return r
def read(self, n = -1): if n < 0: newpos = len(self.buf) else: newpos = min(self.pos+n, len(self.buf)) r = self.buf[self.pos:newpos] self.pos = newpos return r
6,724
def testConnectTimeout(self): # Test connect() timeout _timeout = 0.001 self.sock.settimeout(_timeout)
def testConnectTimeout(self): # Test connect() timeout _timeout = 0.001 self.sock.settimeout(_timeout)
6,725
def print_environ(): """Dump the shell environment as HTML.""" keys = environ.keys() keys.sort() print print "<H3>Shell environment:</H3>" print "<DL>" for key in keys: print "<DT>", escape(key), "<DD>", escape(environ[key]) print "</DL>" print
def print_environ(): """Dump the shell environment as HTML.""" keys = environ.keys() keys.sort() print print "<H3>Shell Environment:</H3>" print "<DL>" for key in keys: print "<DT>", escape(key), "<DD>", escape(environ[key]) print "</DL>" print
6,726
def print_form(form): """Dump the contents of a form as HTML.""" keys = form.keys() keys.sort() print print "<H3>Form contents:</H3>" print "<DL>" for key in keys: print "<DT>" + escape(key) + ":", value = form[key] print "<i>" + escape(`type(value)`) + "</i>" print "<DD>" + escape(`value`) print "</DL>" print
def print_form(form): """Dump the contents of a form as HTML.""" keys = form.keys() keys.sort() print print "<H3>Form Contents:</H3>" print "<DL>" for key in keys: print "<DT>" + escape(key) + ":", value = form[key] print "<i>" + escape(`type(value)`) + "</i>" print "<DD>" + escape(`value`) print "</DL>" print
6,727
def print_arguments(): print print "<H3>Command line Arguments:</H3>" print print sys.argv print
def print_arguments(): print print "<H3>Command Line Arguments:</H3>" print print sys.argv print
6,728
def make_pat(): kw = r"\b" + any("KEYWORD", keyword.kwlist) + r"\b" comment = any("COMMENT", [r"#[^\n]*"]) sqstring = r"(\b[rR])?'([^'\\\n]|\\.)*'?" dqstring = r'(\b[rR])?"([^"\\\n]|\\.)*"?' sq3string = r"(\b[rR])?'''([^'\\]|\\.|'(?!''))*(''')?" dq3string = r'(\b[rR])?"""([^"\\]|\\.|"(?!""))*(""")?' string = any("STRIN...
def make_pat(): kw = r"\b" + any("KEYWORD", keyword.kwlist) + r"\b" comment = any("COMMENT", [r"#[^\n]*"]) sqstring = r"(\b[rR])?'[^'\\\n]*(\\.[^'\\\n]*)*'?" dqstring = r'(\b[rR])?"[^"\\\n]*(\\.[^"\\\n]*)*"?' sq3string = r"(\b[rR])?'''[^'\\]*((\\.|'(?!''))[^'\\]*)*(''')?" dq3string = r'(\b[rR])?"""[^"\\]*((\\.|"(?!""))...
6,729
def open_local_file(self, url): 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: return addinfourl(open(url2pathname(file), 'rb'), headers, 'file:'+pathname2...
def open_local_file(self, url): 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: return addinfourl(open(url2pathname(file), 'rb'), headers, 'file:'+file) hos...
6,730
def open_local_file(self, url): 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: return addinfourl(open(url2pathname(file), 'rb'), headers, 'file:'+pathname2...
def open_local_file(self, url): 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: return addinfourl(open(url2pathname(file), 'rb'), headers, 'file:'+file) hos...
6,731
def doTest(self, expected_ext, files, *modules): z = ZipFile(TEMP_ZIP, "w") try: for name, (mtime, data) in files.items(): zinfo = ZipInfo(name, time.localtime(mtime)) zinfo.compress_type = self.compression z.writestr(zinfo, data) z.close() sys.path.insert(0, TEMP_ZIP)
def doTest(self, expected_ext, files, *modules): z = ZipFile(TEMP_ZIP, "w") try: for name, (mtime, data) in files.items(): zinfo = ZipInfo(name, time.localtime(mtime)) zinfo.compress_type = self.compression z.writestr(zinfo, data) z.close() sys.path.insert(0, TEMP_ZIP)
6,732
>>> def sorted(seq):
>>> def sorted(seq):
6,733
def read(self, filenames): """Read and parse a list of filenames.""" if type(filenames) is type(''): filenames = [filenames] for file in filenames: fp = open(file) self.__read(fp) fp.close()
def read(self, filenames): """Read and parse a filename or a list of filenames. Files that cannot be opened are silently ignored; this is designed so that you can specifiy a list of potential configuration file locations (e.g. current directory, user's home directory, systemwide directory), and all existing configura...
6,734
def read(self, filenames): """Read and parse a list of filenames.""" if type(filenames) is type(''): filenames = [filenames] for file in filenames: fp = open(file) self.__read(fp) fp.close()
def read(self, filenames): """Read and parse a list of filenames.""" if type(filenames) is type(''): filenames = [filenames] for filename in filenames: try: fp = open(filename) except IOError: continue self.__read(fp, filename) fp.close()
6,735
def __read(self, fp): """Parse a sectioned setup file.
def __read(self, fp, fpname): """Parse a sectioned setup file.
6,736
def __read(self, fp): """Parse a sectioned setup file.
def __read(self, fp): """Parse a sectioned setup file.
6,737
def __read(self, fp): """Parse a sectioned setup file.
def __read(self, fp): """Parse a sectioned setup file.
6,738
def genpluginproject(architecture, module, project=None, projectdir=None, sources=[], sourcedirs=[], libraries=[], extradirs=[], extraexportsymbols=[], outputdir=":::Lib:lib-dynload", libraryflags=None, stdlibraryflags=None, prefixname=None, initialize=None): if CARBON_ONLY and architecture == "ppc": return if architec...
def genpluginproject(architecture, module, project=None, projectdir=None, sources=[], sourcedirs=[], libraries=[], extradirs=[], extraexportsymbols=[], outputdir=":::Lib:lib-dynload", libraryflags=None, stdlibraryflags=None, prefixname=None, initialize=None): if CARBON_ONLY and architecture == "ppc": return if architec...
6,739
def item_cget(self, col, opt): return self.tk.call(self._w, 'item', 'cget', col, opt)
def item_cget(self, col, opt): return self.tk.call(self._w, 'item', 'cget', col, opt)
6,740
def formatwarning(message, category, filename, lineno): """Function to format a warning the standard way.""" import linecache s = "%s:%s: %s: %s\n" % (filename, lineno, category.__name__, message) line = linecache.getline(filename, lineno).strip() if line: s = s + " " + line + "\n" return s
def formatwarning(message, category, filename, lineno): """Function to format a warning the standard way.""" s = "%s:%s: %s: %s\n" % (filename, lineno, category.__name__, message) line = linecache.getline(filename, lineno).strip() if line: s = s + " " + line + "\n" return s
6,741
def play_sound_file(data, rate, ssize, nchannels): try: dsp = ossaudiodev.open('w') except IOError, msg: if msg[0] in (errno.EACCES, errno.ENODEV, errno.EBUSY): raise TestSkipped, msg raise TestFailed, msg # set the data format if sys.byteorder == 'little': fmt = ossaudiodev.AFMT_S16_LE else: fmt = ossaudiodev.AFMT_S1...
def play_sound_file(data, rate, ssize, nchannels): try: dsp = ossaudiodev.open('w') except IOError, msg: if msg[0] in (errno.EACCES, errno.ENODEV, errno.EBUSY): raise TestSkipped, msg raise TestFailed, msg # set the data format# at least check that these methods can be invoked dsp.bufsize() dsp.obufcount() dsp.obuffre...
6,742
def play_sound_file(data, rate, ssize, nchannels): try: dsp = ossaudiodev.open('w') except IOError, msg: if msg[0] in (errno.EACCES, errno.ENODEV, errno.EBUSY): raise TestSkipped, msg raise TestFailed, msg # set the data format if sys.byteorder == 'little': fmt = ossaudiodev.AFMT_S16_LE else: fmt = ossaudiodev.AFMT_S1...
def play_sound_file(data, rate, ssize, nchannels): try: dsp = ossaudiodev.open('w') except IOError, msg: if msg[0] in (errno.EACCES, errno.ENODEV, errno.EBUSY): raise TestSkipped, msg raise TestFailed, msg # set the data format if sys.byteorder == 'little': fmt = ossaudiodev.AFMT_S16_LE else: fmt = ossaudiodev.AFMT_S1...
6,743
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().replace('-','_'), '%define release ' + self.release.repl...
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().replace('-','_'), '%define release ' + self.release.repl...
6,744
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().replace('-','_'), '%define release ' + self.release.repl...
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().replace('-','_'), '%define release ' + self.release.repl...
6,745
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().replace('-','_'), '%define release ' + self.release.repl...
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().replace('-','_'), '%define release ' + self.release.repl...
6,746
def join(a, *p): """Join two or more pathname components, inserting "\\" as needed""" 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 join(a, *p): """Join two or more pathname components, inserting "\\" as needed""" 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
6,747
def splitdrive(p): """Split a pathname into drive and path specifiers. Return a 2-tuple (drive, path); either part may be empty. This recognizes UNC paths (e.g. '\\\\host\\mountpoint\\dir\\file')""" if p[1:2] == ':': return p[0:2], p[2:] firstTwo = p[0:2] if firstTwo == '//' or firstTwo == '\\\\': # is a UNC path: # v...
def splitdrive(p): """Split a pathname into drive and path specifiers. Returns a 2-tuple "(drive,path)"; either part may be empty""" if p[1:2] == ':': return p[0:2], p[2:] firstTwo = p[0:2] if firstTwo == '//' or firstTwo == '\\\\': # is a UNC path: # vvvvvvvvvvvvvvvvvvvv equivalent to drive letter # \\machine\mountpo...
6,748
def isfile(path): """Test whether a path is a regular file""" try: st = os.stat(path) except os.error: return 0 return stat.S_ISREG(st[stat.ST_MODE])
def isfile(path): """Test whether a path is a regular file""" try: st = os.stat(path) except os.error: return 0 return stat.S_ISREG(st[stat.ST_MODE])
6,749
def check_all(modname): names = {} try: exec "import %s" % modname in names except ImportError: # silent fail here seems the best route since some modules # may not be available in all environments return verify(hasattr(sys.modules[modname], "__all__"), "%s has no __all__ attribute" % modname) names = {} exec "from %s ...
def check_all(modname): names = {} try: exec "import %s" % modname in names except ImportError: # silent fail here seems the best route since some modules # may not be available in all environments return verify(hasattr(sys.modules[modname], "__all__"), "%s has no __all__ attribute" % modname) names = {} exec "from %s ...
6,750
def makerepairinstructions(self): return [ ([('ListBounds_ptr', '*', 'InMode')], [('Rect_ptr', '*', 'InMode')]),
def makerepairinstructions(self): return [ ([('ListBounds_ptr', '*', 'InMode')], [('Rect_ptr', '*', 'InMode')]),
6,751
def sample(self, population, k, int=int): """Chooses k unique random elements from a population sequence.
def sample(self, population, k): """Chooses k unique random elements from a population sequence.
6,752
def sample(self, population, k, int=int): """Chooses k unique random elements from a population sequence.
def sample(self, population, k, int=int): """Chooses k unique random elements from a population sequence.
6,753
def sample(self, population, k, int=int): """Chooses k unique random elements from a population sequence.
def sample(self, population, k, int=int): """Chooses k unique random elements from a population sequence.
6,754
def sample(self, population, k, int=int): """Chooses k unique random elements from a population sequence.
def sample(self, population, k, int=int): """Chooses k unique random elements from a population sequence.
6,755
def __contains__(self, element): """Report whether an element is a member of a set.
def __contains__(self, element): """Report whether an element is a member of a set.
6,756
def update(self, iterable): """Add all values from an iterable (such as a list or file).""" data = self._data value = True for elt in iterable: try: transform = elt._as_immutable except AttributeError: pass else: elt = transform() data[elt] = value
def update(self, iterable): """Add all values from an iterable (such as a list or file).""" data = self._data value = True for element in iterable: try: transform = elt._as_immutable except AttributeError: pass else: elt = transform() data[elt] = value
6,757
def update(self, iterable): """Add all values from an iterable (such as a list or file).""" data = self._data value = True for elt in iterable: try: transform = elt._as_immutable except AttributeError: pass else: elt = transform() data[elt] = value
def update(self, iterable): """Add all values from an iterable (such as a list or file).""" data = self._data value = True for elt in iterable: try: transform = elt._as_immutable except AttributeError: pass else: elt = transform() data[elt] = value
6,758
def add(self, element): """Add an element to a set.
def add(self, element): """Add an element to a set.
6,759
def remove(self, element): """Remove an element from a set; it must be a member.
def remove(self, element): """Remove an element from a set; it must be a member.
6,760
def showpartframe(self, data, chromdata, (x,y,w,h)): pmsize = self.bpp xpf, ypf = self.xpf, self.ypf if self.upside_down: gl.pixmode(GL.PM_TTOB, 1) if self.mirror_image: gp.pixmode(GL.PM_RTOL, 1) if self.format in ('jpeg', 'jpeggrey'): import jpeg data, width, height, bytes = jpeg.decompress(data) pmsize = bytes*8 elif...
def showpartframe(self, data, chromdata, (x,y,w,h)): pmsize = self.bpp xpf, ypf = self.xpf, self.ypf if self.upside_down: gl.pixmode(GL.PM_TTOB, 1) if self.mirror_image: gl.pixmode(GL.PM_RTOL, 1) if self.format in ('jpeg', 'jpeggrey'): import jpeg data, width, height, bytes = jpeg.decompress(data) pmsize = bytes*8 elif...
6,761
def __init__( self ): self.childNodes=[] if Node._debug: index=repr( id( self ))+repr( self.__class__ ) Node.allnodes[index]=repr( self.__dict__ ) if Node.debug==None: Node.debug=open( "debug4.out", "w" ) Node.debug.write( "create %s\n"%index )
def __init__( self ): self.childNodes=[] if Node._debug: index=repr( id( self ))+repr( self.__class__ ) Node.allnodes[index]=repr( self.__dict__ ) if Node.debug==None: Node.debug=StringIO() Node.debug.write( "create %s\n"%index )
6,762
def __getitem__( self, attname_or_tuple ): if type( attname_or_tuple ) == type( () ): return self._attrsNS[attname_or_tuple] else: return self._attrs[attname_or_tuple]
def __getitem__( self, attname_or_tuple ): if type( attname_or_tuple ) == types.TupleType: return self._attrsNS[attname_or_tuple] else: return self._attrs[attname_or_tuple]
6,763
def __setitem__( self, attname ): raise TypeError, "object does not support item assignment"
def __setitem__( self, attname ): raise TypeError, "object does not support item assignment"
6,764
def test_hex_baseline(self): # Baseline tests self.assertEqual(0x0, 0) self.assertEqual(0x10, 16) self.assertEqual(0x7fffffff, 2147483647) # Ditto with a minus sign and parentheses self.assertEqual(-(0x0), 0) self.assertEqual(-(0x10), -16) self.assertEqual(-(0x7fffffff), -2147483647) # Ditto with a minus sign and NO pa...
def test_hex_baseline(self): # Baseline tests self.assertEqual(0x0, 0) self.assertEqual(0x10, 16) if platform_long_is_32_bits: self.assertEqual(0x7fffffff, 2147483647) else: self.assertEqual(0x7fffffffffffffff, 9223372036854775807) # Ditto with a minus sign and parentheses self.assertEqual(-(0x0), 0) self.assertEqual(-...
6,765
def test_hex_baseline(self): # Baseline tests self.assertEqual(0x0, 0) self.assertEqual(0x10, 16) self.assertEqual(0x7fffffff, 2147483647) # Ditto with a minus sign and parentheses self.assertEqual(-(0x0), 0) self.assertEqual(-(0x10), -16) self.assertEqual(-(0x7fffffff), -2147483647) # Ditto with a minus sign and NO pa...
def test_hex_baseline(self): # Baseline tests self.assertEqual(0x0, 0) self.assertEqual(0x10, 16) self.assertEqual(0x7fffffff, 2147483647) # Ditto with a minus sign and parentheses self.assertEqual(-(0x0), 0) self.assertEqual(-(0x10), -16) if platform_long_is_32_bits: self.assertEqual(-(0x7fffffff), -2147483647) else: ...
6,766
def test_hex_baseline(self): # Baseline tests self.assertEqual(0x0, 0) self.assertEqual(0x10, 16) self.assertEqual(0x7fffffff, 2147483647) # Ditto with a minus sign and parentheses self.assertEqual(-(0x0), 0) self.assertEqual(-(0x10), -16) self.assertEqual(-(0x7fffffff), -2147483647) # Ditto with a minus sign and NO pa...
def test_hex_baseline(self): # Baseline tests self.assertEqual(0x0, 0) self.assertEqual(0x10, 16) self.assertEqual(0x7fffffff, 2147483647) # Ditto with a minus sign and parentheses self.assertEqual(-(0x0), 0) self.assertEqual(-(0x10), -16) self.assertEqual(-(0x7fffffff), -2147483647) # Ditto with a minus sign and NO pa...
6,767
def test_hex_unsigned(self): # This test is in a <string> so we can ignore the warnings exec """if 1: # Positive-looking constants with negavive values self.assertEqual(0x80000000, -2147483648L) self.assertEqual(0xffffffff, -1) # Ditto with a minus sign and parentheses self.assertEqual(-(0x80000000), 2147483648L) self....
def test_hex_unsigned(self): # This test is in a <string> so we can ignore the warnings exec """if 1: # Positive-looking constants with negavive values self.assertEqual(0x80000000, -2147483648L) self.assertEqual(0xffffffff, -1) # Ditto with a minus sign and parentheses self.assertEqual(-(0x80000000), 2147483648L) self....
6,768
def test_oct_baseline(self): # Baseline tests self.assertEqual(00, 0) self.assertEqual(020, 16) self.assertEqual(017777777777, 2147483647) # Ditto with a minus sign and parentheses self.assertEqual(-(00), 0) self.assertEqual(-(020), -16) self.assertEqual(-(017777777777), -2147483647) # Ditto with a minus sign and NO pa...
def test_oct_baseline(self): # Baseline tests self.assertEqual(00, 0) self.assertEqual(020, 16) if platform_long_is_32_bits: self.assertEqual(017777777777, 2147483647) else: self.assertEqual(0777777777777777777777, 9223372036854775807) # Ditto with a minus sign and parentheses self.assertEqual(-(00), 0) self.assertEqua...
6,769
def test_oct_baseline(self): # Baseline tests self.assertEqual(00, 0) self.assertEqual(020, 16) self.assertEqual(017777777777, 2147483647) # Ditto with a minus sign and parentheses self.assertEqual(-(00), 0) self.assertEqual(-(020), -16) self.assertEqual(-(017777777777), -2147483647) # Ditto with a minus sign and NO pa...
def test_oct_baseline(self): # Baseline tests self.assertEqual(00, 0) self.assertEqual(020, 16) self.assertEqual(017777777777, 2147483647) # Ditto with a minus sign and parentheses self.assertEqual(-(00), 0) self.assertEqual(-(020), -16) if platform_long_is_32_bits: self.assertEqual(-(017777777777), -2147483647) else: ...
6,770
def test_oct_baseline(self): # Baseline tests self.assertEqual(00, 0) self.assertEqual(020, 16) self.assertEqual(017777777777, 2147483647) # Ditto with a minus sign and parentheses self.assertEqual(-(00), 0) self.assertEqual(-(020), -16) self.assertEqual(-(017777777777), -2147483647) # Ditto with a minus sign and NO pa...
def test_oct_baseline(self): # Baseline tests self.assertEqual(00, 0) self.assertEqual(020, 16) self.assertEqual(017777777777, 2147483647) # Ditto with a minus sign and parentheses self.assertEqual(-(00), 0) self.assertEqual(-(020), -16) self.assertEqual(-(017777777777), -2147483647) # Ditto with a minus sign and NO pa...
6,771
def test_oct_unsigned(self): # This test is in a <string> so we can ignore the warnings exec """if 1: # Positive-looking constants with negavive values self.assertEqual(020000000000, -2147483648L) self.assertEqual(037777777777, -1) # Ditto with a minus sign and parentheses self.assertEqual(-(020000000000), 2147483648L)...
def test_oct_unsigned(self): # This test is in a <string> so we can ignore the warnings exec """if 1: # Positive-looking constants with negavive values self.assertEqual(020000000000, -2147483648L) self.assertEqual(037777777777, -1) # Ditto with a minus sign and parentheses self.assertEqual(-(020000000000), 2147483648L)...
6,772
def randrange(n): """Return a random shuffle of range(n).""" fn = os.path.join(td, "rr%06d" % n) try: fp = open(fn, "rb") except IOError: result = [] for i in range(n): result.append(random.random()) try: try: fp = open(fn, "wb") marshal.dump(result, fp) fp.close() fp = None finally: if fp: try: os.unlink(fn) except os...
def randfloats(n): """Return a list of n random floats in [0, 1).""" fn = os.path.join(td, "rr%06d" % n) try: fp = open(fn, "rb") except IOError: result = [] for i in range(n): result.append(random.random()) try: try: fp = open(fn, "wb") marshal.dump(result, fp) fp.close() fp = None finally: if fp: try: os.unlink(fn...
6,773
def randrange(n): """Return a random shuffle of range(n).""" fn = os.path.join(td, "rr%06d" % n) try: fp = open(fn, "rb") except IOError: result = [] for i in range(n): result.append(random.random()) try: try: fp = open(fn, "wb") marshal.dump(result, fp) fp.close() fp = None finally: if fp: try: os.unlink(fn) except os...
def randrange(n): """Return a random shuffle of range(n).""" fn = os.path.join(td, "rr%06d" % n) try: fp = open(fn, "rb") except IOError: r = random.random result = [r() for i in xrange(n)] try: try: fp = open(fn, "wb") marshal.dump(result, fp) fp.close() fp = None finally: if fp: try: os.unlink(fn) except os.error: pa...
6,774
def randrange(n): """Return a random shuffle of range(n).""" fn = os.path.join(td, "rr%06d" % n) try: fp = open(fn, "rb") except IOError: result = [] for i in range(n): result.append(random.random()) try: try: fp = open(fn, "wb") marshal.dump(result, fp) fp.close() fp = None finally: if fp: try: os.unlink(fn) except os...
defrandrange(n):"""Returnarandomshuffleofrange(n)."""fn=os.path.join(td,"rr%06d"%n)try:fp=open(fn,"rb")exceptIOError:result=[]foriinrange(n):result.append(random.random())try:try:fp=open(fn,"wb")marshal.dump(result,fp)fp.close()fp=Nonefinally:iffp:try:os.unlink(fn)exceptos.error:passexceptIOError,msg:print"can'twrite",...
6,775
def randrange(n): """Return a random shuffle of range(n).""" fn = os.path.join(td, "rr%06d" % n) try: fp = open(fn, "rb") except IOError: result = [] for i in range(n): result.append(random.random()) try: try: fp = open(fn, "wb") marshal.dump(result, fp) fp.close() fp = None finally: if fp: try: os.unlink(fn) except os...
def randrange(n): """Return a random shuffle of range(n).""" fn = os.path.join(td, "rr%06d" % n) try: fp = open(fn, "rb") except IOError: result = [] for i in range(n): result.append(random.random()) try: try: fp = open(fn, "wb") marshal.dump(result, fp) fp.close() fp = None finally: if fp: try: os.unlink(fn) except os...
6,776
def randrange(n): """Return a random shuffle of range(n).""" fn = os.path.join(td, "rr%06d" % n) try: fp = open(fn, "rb") except IOError: result = [] for i in range(n): result.append(random.random()) try: try: fp = open(fn, "wb") marshal.dump(result, fp) fp.close() fp = None finally: if fp: try: os.unlink(fn) except os...
def randrange(n): """Return a random shuffle of range(n).""" fn = os.path.join(td, "rr%06d" % n) try: fp = open(fn, "rb") except IOError: result = [] for i in range(n): result.append(random.random()) try: try: fp = open(fn, "wb") marshal.dump(result, fp) fp.close() fp = None finally: if fp: try: os.unlink(fn) except os...
6,777
def fl(): sys.stdout.flush()
def flush(): sys.stdout.flush()
6,778
def doit(L): t0 = time.clock() L.sort() t1 = time.clock() print "%6.2f" % (t1-t0), fl()
def doit(L): t0 = time.clock() L.sort() t1 = time.clock() print "%6.2f" % (t1-t0), flush()
6,779
def tabulate(r): """Tabulate sort speed for lists of various sizes. The sizes are 2**i for i in r (the argument, a list). The output displays i, 2**i, and the time to sort arrays of 2**i floating point numbers with the following properties: *sort: random data \sort: descending data /sort: ascending data ~sort: many ...
def tabulate(r): """Tabulate sort speed for lists of various sizes. The sizes are 2**i for i in r (the argument, a list). The output displays i, 2**i, and the time to sort arrays of 2**i floating point numbers with the following properties: *sort: random data \sort: descending data /sort: ascending data ~sort: many ...
6,780
def tabulate(r): """Tabulate sort speed for lists of various sizes. The sizes are 2**i for i in r (the argument, a list). The output displays i, 2**i, and the time to sort arrays of 2**i floating point numbers with the following properties: *sort: random data \sort: descending data /sort: ascending data ~sort: many ...
def tabulate(r): """Tabulate sort speed for lists of various sizes. The sizes are 2**i for i in r (the argument, a list). The output displays i, 2**i, and the time to sort arrays of 2**i floating point numbers with the following properties: *sort: random data \sort: descending data /sort: ascending data ~sort: many ...
6,781
def tabulate(r): """Tabulate sort speed for lists of various sizes. The sizes are 2**i for i in r (the argument, a list). The output displays i, 2**i, and the time to sort arrays of 2**i floating point numbers with the following properties: *sort: random data \sort: descending data /sort: ascending data ~sort: many ...
def tabulate(r): """Tabulate sort speed for lists of various sizes. The sizes are 2**i for i in r (the argument, a list). The output displays i, 2**i, and the time to sort arrays of 2**i floating point numbers with the following properties: *sort: random data \sort: descending data /sort: ascending data ~sort: many ...
6,782
def tabulate(r): """Tabulate sort speed for lists of various sizes. The sizes are 2**i for i in r (the argument, a list). The output displays i, 2**i, and the time to sort arrays of 2**i floating point numbers with the following properties: *sort: random data \sort: descending data /sort: ascending data ~sort: many ...
def tabulate(r): """Tabulate sort speed for lists of various sizes. The sizes are 2**i for i in r (the argument, a list). The output displays i, 2**i, and the time to sort arrays of 2**i floating point numbers with the following properties: *sort: random data \sort: descending data /sort: ascending data ~sort: many ...
6,783
def tabulate(r): """Tabulate sort speed for lists of various sizes. The sizes are 2**i for i in r (the argument, a list). The output displays i, 2**i, and the time to sort arrays of 2**i floating point numbers with the following properties: *sort: random data \sort: descending data /sort: ascending data ~sort: many ...
def tabulate(r): """Tabulate sort speed for lists of various sizes. The sizes are 2**i for i in r (the argument, a list). The output displays i, 2**i, and the time to sort arrays of 2**i floating point numbers with the following properties: *sort: random data \sort: descending data /sort: ascending data ~sort: many ...
6,784
def main(): """Main program when invoked as a script. One argument: tabulate a single row. Two arguments: tabulate a range (inclusive). Extra arguments are used to seed the random generator. """ # default range (inclusive) k1 = 15 k2 = 19 if sys.argv[1:]: # one argument: single point k1 = k2 = int(sys.argv[1]) if sys...
def main(): """Main program when invoked as a script. One argument: tabulate a single row. Two arguments: tabulate a range (inclusive). Extra arguments are used to seed the random generator. """ # default range (inclusive) k1 = 15 k2 = 20 if sys.argv[1:]: # one argument: single point k1 = k2 = int(sys.argv[1]) if sys...
6,785
def main(): """Main program when invoked as a script. One argument: tabulate a single row. Two arguments: tabulate a range (inclusive). Extra arguments are used to seed the random generator. """ # default range (inclusive) k1 = 15 k2 = 19 if sys.argv[1:]: # one argument: single point k1 = k2 = int(sys.argv[1]) if sys...
def main(): """Main program when invoked as a script. One argument: tabulate a single row. Two arguments: tabulate a range (inclusive). Extra arguments are used to seed the random generator. """ # default range (inclusive) k1 = 15 k2 = 19 if sys.argv[1:]: # one argument: single point k1 = k2 = int(sys.argv[1]) if sys...
6,786
def main(): """Main program when invoked as a script. One argument: tabulate a single row. Two arguments: tabulate a range (inclusive). Extra arguments are used to seed the random generator. """ # default range (inclusive) k1 = 15 k2 = 19 if sys.argv[1:]: # one argument: single point k1 = k2 = int(sys.argv[1]) if sys...
def main(): """Main program when invoked as a script. One argument: tabulate a single row. Two arguments: tabulate a range (inclusive). Extra arguments are used to seed the random generator. """ # default range (inclusive) k1 = 15 k2 = 19 if sys.argv[1:]: # one argument: single point k1 = k2 = int(sys.argv[1]) if sys...
6,787
def outputFreeIt(self, itselfname): Output("DisposeDialog(%s);", itselfname)
def outputFreeIt(self, itselfname): Output("DisposeDialog(%s);", itselfname)
6,788
def enter_callback(self, event): if self.executing and not self.reading: return # Let the default binding (insert '\n') take over # If some text is selected, recall the selection # (but only if this before the I/O mark) try: sel = self.text.get("sel.first", "sel.last") if sel: if self.text.compare("sel.last", "<=", "io...
def enter_callback(self, event): if self.executing and not self.reading: return # Let the default binding (insert '\n') take over # If some text is selected, recall the selection # (but only if this before the I/O mark) try: sel = self.text.get("sel.first", "sel.last") if sel: if self.text.compare("sel.last", "<=", "io...
6,789
def enter_callback(self, event): if self.executing and not self.reading: return # Let the default binding (insert '\n') take over # If some text is selected, recall the selection # (but only if this before the I/O mark) try: sel = self.text.get("sel.first", "sel.last") if sel: if self.text.compare("sel.last", "<=", "io...
def enter_callback(self, event): if self.executing and not self.reading: return # Let the default binding (insert '\n') take over # If some text is selected, recall the selection # (but only if this before the I/O mark) try: sel = self.text.get("sel.first", "sel.last") if sel: if self.text.compare("sel.last", "<=", "io...
6,790
def enter_callback(self, event): if self.executing and not self.reading: return # Let the default binding (insert '\n') take over # If some text is selected, recall the selection # (but only if this before the I/O mark) try: sel = self.text.get("sel.first", "sel.last") if sel: if self.text.compare("sel.last", "<=", "io...
def enter_callback(self, event): if self.executing and not self.reading: return # Let the default binding (insert '\n') take over # If some text is selected, recall the selection # (but only if this before the I/O mark) try: sel = self.text.get("sel.first", "sel.last") if sel: if self.text.compare("sel.last", "<=", "io...
6,791
def enter_callback(self, event): if self.executing and not self.reading: return # Let the default binding (insert '\n') take over # If some text is selected, recall the selection # (but only if this before the I/O mark) try: sel = self.text.get("sel.first", "sel.last") if sel: if self.text.compare("sel.last", "<=", "io...
def enter_callback(self, event): if self.executing and not self.reading: return # Let the default binding (insert '\n') take over # If some text is selected, recall the selection # (but only if this before the I/O mark) try: sel = self.text.get("sel.first", "sel.last") if sel: if self.text.compare("sel.last", "<=", "io...
6,792
def recall(self, s): if self.history: self.history.recall(s)
def recall(self, s): if self.history: self.history.recall(s)
6,793
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...
6,794
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...
6,795
def append(self, mailbox, flags, date_time, message): """Append message to named mailbox.
def append(self, mailbox, flags, date_time, message): """Append message to named mailbox.
6,796
def response(self, code): """Return data for response 'code' if received, or None.
def response(self, code): """Return data for response 'code' if received, or None.
6,797
def select(self, mailbox='INBOX', readonly=None): """Select a mailbox.
def select(self, mailbox='INBOX', readonly=None): """Select a mailbox.
6,798
def store(self, message_set, command, flag_list): """Alters flag dispositions for messages in mailbox.
def store(self, message_set, command, flag_list): """Alters flag dispositions for messages in mailbox.
6,799