rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
print "Will rollover at %d, %d seconds from now" % (self.rolloverAt, self.rolloverAt - currentTime) | def __init__(self, filename, when='h', interval=1, backupCount=0): BaseRotatingHandler.__init__(self, filename, 'a') self.when = string.upper(when) self.backupCount = backupCount # Calculate the real rollover interval, which is just the number of # seconds between rollovers. Also set the filename suffix used when # a rollover occurs. Current 'when' events supported: # S - Seconds # M - Minutes # H - Hours # D - Days # midnight - roll over at midnight # W{0-6} - roll over on a certain day; 0 - Monday # # Case of the 'when' specifier is not important; lower or upper case # will work. currentTime = int(time.time()) if self.when == 'S': self.interval = 1 # one second self.suffix = "%Y-%m-%d_%H-%M-%S" elif self.when == 'M': self.interval = 60 # one minute self.suffix = "%Y-%m-%d_%H-%M" elif self.when == 'H': self.interval = 60 * 60 # one hour self.suffix = "%Y-%m-%d_%H" elif self.when == 'D' or self.when == 'MIDNIGHT': self.interval = 60 * 60 * 24 # one day self.suffix = "%Y-%m-%d" elif self.when.startswith('W'): self.interval = 60 * 60 * 24 * 7 # one week if len(self.when) != 2: raise ValueError("You must specify a day for weekly rollover from 0 to 6 (0 is Monday): %s" % self.when) if self.when[1] < '0' or self.when[1] > '6': raise ValueError("Invalid day specified for weekly rollover: %s" % self.when) self.dayOfWeek = int(self.when[1]) self.suffix = "%Y-%m-%d" else: raise ValueError("Invalid rollover interval specified: %s" % self.when) | 5e9e9e19f7fae86e5d234a5cd8386bc6e34a36ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5e9e9e19f7fae86e5d234a5cd8386bc6e34a36ab/handlers.py |
|
print "No need to rollover: %d, %d" % (t, self.rolloverAt) | def shouldRollover(self, record): """ Determine if rollover should occur | 5e9e9e19f7fae86e5d234a5cd8386bc6e34a36ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5e9e9e19f7fae86e5d234a5cd8386bc6e34a36ab/handlers.py |
|
print "%s -> %s" % (self.baseFilename, dfn) | def doRollover(self): """ do a rollover; in this case, a date/time stamp is appended to the filename when the rollover happens. However, you want the file to be named for the start of the interval, not the current time. If there is a backup count, then we have to get a list of matching filenames, sort them and remove the one with the oldest suffix. """ self.stream.close() # get the time that this sequence started at and make it a TimeTuple t = self.rolloverAt - self.interval timeTuple = time.localtime(t) dfn = self.baseFilename + "." + time.strftime(self.suffix, timeTuple) if os.path.exists(dfn): os.remove(dfn) os.rename(self.baseFilename, dfn) if self.backupCount > 0: # find the oldest log file and delete it s = glob.glob(self.baseFilename + ".20*") if len(s) > self.backupCount: os.remove(s[0]) print "%s -> %s" % (self.baseFilename, dfn) self.stream = open(self.baseFilename, "w") self.rolloverAt = int(time.time()) + self.interval | 5e9e9e19f7fae86e5d234a5cd8386bc6e34a36ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5e9e9e19f7fae86e5d234a5cd8386bc6e34a36ab/handlers.py |
|
__version__ = " | __version__ = " | def testMultiply(self): self.assertEquals((0 * 10), 0) self.assertEquals((5 * 8), 40) | 397b45d4bacc057884c8ba18f83ef15d9bfb6149 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/397b45d4bacc057884c8ba18f83ef15d9bfb6149/unittest.py |
Note that decimal places (from zero) is usually not the same | Note that decimal places (from zero) are usually not the same | def failUnlessAlmostEqual(self, first, second, places=7, msg=None): """Fail if the two objects are unequal as determined by their difference rounded to the given number of decimal places (default 7) and comparing to zero. | 397b45d4bacc057884c8ba18f83ef15d9bfb6149 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/397b45d4bacc057884c8ba18f83ef15d9bfb6149/unittest.py |
import unittest | def loadTestsFromName(self, name, module=None): """Return a suite of all tests cases given a string specifier. | 397b45d4bacc057884c8ba18f83ef15d9bfb6149 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/397b45d4bacc057884c8ba18f83ef15d9bfb6149/unittest.py |
|
issubclass(obj, unittest.TestCase)): | issubclass(obj, TestCase)): | def loadTestsFromName(self, name, module=None): """Return a suite of all tests cases given a string specifier. | 397b45d4bacc057884c8ba18f83ef15d9bfb6149 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/397b45d4bacc057884c8ba18f83ef15d9bfb6149/unittest.py |
elif isinstance(obj, unittest.TestSuite): | elif isinstance(obj, TestSuite): | def loadTestsFromName(self, name, module=None): """Return a suite of all tests cases given a string specifier. | 397b45d4bacc057884c8ba18f83ef15d9bfb6149 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/397b45d4bacc057884c8ba18f83ef15d9bfb6149/unittest.py |
if not isinstance(test, (unittest.TestCase, unittest.TestSuite)): | if not isinstance(test, (TestCase, TestSuite)): | def loadTestsFromName(self, name, module=None): """Return a suite of all tests cases given a string specifier. | 397b45d4bacc057884c8ba18f83ef15d9bfb6149 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/397b45d4bacc057884c8ba18f83ef15d9bfb6149/unittest.py |
timeTaken = float(stopTime - startTime) | timeTaken = stopTime - startTime | 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 "s" or "", 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 | 397b45d4bacc057884c8ba18f83ef15d9bfb6149 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/397b45d4bacc057884c8ba18f83ef15d9bfb6149/unittest.py |
vsbase = r"Software\Microsoft\VisualStudio\%s.0" % version | vsbase = r"Software\Microsoft\VisualStudio\%0.1f" % version | def load_macros(self, version): vsbase = r"Software\Microsoft\VisualStudio\%s.0" % version self.set_macro("VCInstallDir", vsbase + r"\Setup\VC", "productdir") self.set_macro("VSInstallDir", vsbase + r"\Setup\VS", "productdir") net = r"Software\Microsoft\.NETFramework" self.set_macro("FrameworkDir", net, "installroot") self.set_macro("FrameworkSDKDir", net, "sdkinstallroot") | e9a92aa03ac91c307a90db8eefff22cea1b97399 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e9a92aa03ac91c307a90db8eefff22cea1b97399/msvccompiler.py |
self.set_macro("FrameworkSDKDir", net, "sdkinstallroot") | if version > 7.0: self.set_macro("FrameworkSDKDir", net, "sdkinstallrootv1.1") else: self.set_macro("FrameworkSDKDir", net, "sdkinstallroot") | def load_macros(self, version): vsbase = r"Software\Microsoft\VisualStudio\%s.0" % version self.set_macro("VCInstallDir", vsbase + r"\Setup\VC", "productdir") self.set_macro("VSInstallDir", vsbase + r"\Setup\VS", "productdir") net = r"Software\Microsoft\.NETFramework" self.set_macro("FrameworkDir", net, "installroot") self.set_macro("FrameworkSDKDir", net, "sdkinstallroot") | e9a92aa03ac91c307a90db8eefff22cea1b97399 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e9a92aa03ac91c307a90db8eefff22cea1b97399/msvccompiler.py |
n = int(s[:-2]) if n == 12: return 6 elif n == 13: return 7 | majorVersion = int(s[:-2]) - 6 minorVersion = int(s[2:3]) / 10.0 if majorVersion == 6: minorVersion = 0 if majorVersion >= 6: return majorVersion + minorVersion | def get_build_version(): """Return the version of MSVC that was used to build Python. For Python 2.3 and up, the version number is included in sys.version. For earlier versions, assume the compiler is MSVC 6. """ prefix = "MSC v." i = string.find(sys.version, prefix) if i == -1: return 6 i = i + len(prefix) s, rest = sys.version[i:].split(" ", 1) n = int(s[:-2]) if n == 12: return 6 elif n == 13: return 7 # else we don't know what version of the compiler this is return None | e9a92aa03ac91c307a90db8eefff22cea1b97399 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e9a92aa03ac91c307a90db8eefff22cea1b97399/msvccompiler.py |
if self.__version == 7: | if self.__version >= 7: | def __init__ (self, verbose=0, dry_run=0, force=0): CCompiler.__init__ (self, verbose, dry_run, force) self.__version = get_build_version() if self.__version == 7: self.__root = r"Software\Microsoft\VisualStudio" self.__macros = MacroExpander(self.__version) else: self.__root = r"Software\Microsoft\Devstudio" self.__paths = self.get_msvc_paths("path") | e9a92aa03ac91c307a90db8eefff22cea1b97399 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e9a92aa03ac91c307a90db8eefff22cea1b97399/msvccompiler.py |
if self.__version == 7: key = (r"%s\7.0\VC\VC_OBJECTS_PLATFORM_INFO\Win32\Directories" % (self.__root,)) | if self.__version >= 7: key = (r"%s\%0.1f\VC\VC_OBJECTS_PLATFORM_INFO\Win32\Directories" % (self.__root, self.__version)) | def get_msvc_paths(self, path, platform='x86'): """Get a list of devstudio directories (include, lib or path). | e9a92aa03ac91c307a90db8eefff22cea1b97399 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e9a92aa03ac91c307a90db8eefff22cea1b97399/msvccompiler.py |
if self.__version == 7: | if self.__version >= 7: | def get_msvc_paths(self, path, platform='x86'): """Get a list of devstudio directories (include, lib or path). | e9a92aa03ac91c307a90db8eefff22cea1b97399 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e9a92aa03ac91c307a90db8eefff22cea1b97399/msvccompiler.py |
def send(self, str): """Send `str' to the server.""" if self.sock is None: if self.auto_open: self.connect() else: raise NotConnected() | 8531b1b28de5356f1154e13704d499121ea72af8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8531b1b28de5356f1154e13704d499121ea72af8/httplib.py |
||
str = '%s %s %s\r\n' % (method, url, self._http_vsn_str) try: self.send(str) except socket.error, v: if v[0] != 32 or not self.auto_open: raise self.send(str) | str = '%s %s %s' % (method, url, self._http_vsn_str) self._output(str) | def putrequest(self, method, url, skip_host=0): """Send a request to the server. | 8531b1b28de5356f1154e13704d499121ea72af8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8531b1b28de5356f1154e13704d499121ea72af8/httplib.py |
str = '%s: %s\r\n' % (header, value) self.send(str) | str = '%s: %s' % (header, value) self._output(str) | def putheader(self, header, value): """Send a request header line to the server. | 8531b1b28de5356f1154e13704d499121ea72af8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8531b1b28de5356f1154e13704d499121ea72af8/httplib.py |
self.send('\r\n') | self._send_output() | def endheaders(self): """Indicate that the last header line has been sent to the server.""" | 8531b1b28de5356f1154e13704d499121ea72af8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8531b1b28de5356f1154e13704d499121ea72af8/httplib.py |
return | 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) | 8531b1b28de5356f1154e13704d499121ea72af8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8531b1b28de5356f1154e13704d499121ea72af8/httplib.py |
|
install = self.find_peer ('install') inputs = install.get_inputs () outputs = install.get_outputs () assert (len (inputs) == len (outputs)) | def run (self): | ba0506b3492a13f5c8cec7598bf2b5f9735ac7b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ba0506b3492a13f5c8cec7598bf2b5f9735ac7b2/bdist_dumb.py |
|
self.strip_base_dirs (outputs, install) | install = self.distribution.find_command_obj('install') install.root = self.bdist_dir | def run (self): | ba0506b3492a13f5c8cec7598bf2b5f9735ac7b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ba0506b3492a13f5c8cec7598bf2b5f9735ac7b2/bdist_dumb.py |
build_base = self.get_peer_option ('build', 'build_base') output_dir = os.path.join (build_base, "bdist") self.make_install_tree (output_dir, inputs, outputs) | self.announce ("installing to %s" % self.bdist_dir) install.ensure_ready() install.run() | def run (self): | ba0506b3492a13f5c8cec7598bf2b5f9735ac7b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ba0506b3492a13f5c8cec7598bf2b5f9735ac7b2/bdist_dumb.py |
print "output_dir = %s" % output_dir | print "self.bdist_dir = %s" % self.bdist_dir | def run (self): | ba0506b3492a13f5c8cec7598bf2b5f9735ac7b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ba0506b3492a13f5c8cec7598bf2b5f9735ac7b2/bdist_dumb.py |
root_dir=output_dir) | root_dir=self.bdist_dir) | def run (self): | ba0506b3492a13f5c8cec7598bf2b5f9735ac7b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ba0506b3492a13f5c8cec7598bf2b5f9735ac7b2/bdist_dumb.py |
remove_tree (output_dir, self.verbose, self.dry_run) | remove_tree (self.bdist_dir, self.verbose, self.dry_run) | def run (self): | ba0506b3492a13f5c8cec7598bf2b5f9735ac7b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ba0506b3492a13f5c8cec7598bf2b5f9735ac7b2/bdist_dumb.py |
def strip_base_dirs (self, outputs, install_cmd): base = install_cmd.install_base + os.sep platbase = install_cmd.install_platbase + os.sep b_len = len (base) pb_len = len (platbase) for i in range (len (outputs)): if outputs[i][0:b_len] == base: outputs[i] = outputs[i][b_len:] elif outputs[i][0:pb_len] == platbase: outputs[i] = outputs[i][pb_len:] else: raise DistutilsInternalError, \ ("installation output filename '%s' doesn't start " + "with either install_base ('%s') or " + "install_platbase ('%s')") % \ (outputs[i], base, platbase) def make_install_tree (self, output_dir, inputs, outputs): assert (len(inputs) == len(outputs)) create_tree (output_dir, outputs, verbose=self.verbose, dry_run=self.dry_run) if hasattr (os, 'link'): link = 'hard' msg = "making hard links in %s..." % output_dir else: link = None msg = "copying files to %s..." % output_dir for i in range (len(inputs)): output = os.path.join (output_dir, outputs[i]) self.copy_file (inputs[i], output, link=link) | def run (self): | ba0506b3492a13f5c8cec7598bf2b5f9735ac7b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ba0506b3492a13f5c8cec7598bf2b5f9735ac7b2/bdist_dumb.py |
|
lexer.whitepace = ' \t' | lexer.whitespace = ' \t' | # Look for a machine, default, or macdef top-level keyword | 366a1df7f1a940a77d2d3b8ac6425fe7353f43c6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/366a1df7f1a940a77d2d3b8ac6425fe7353f43c6/netrc.py |
if not line or line == '\012' and tt == '\012': lexer.whitepace = ' \t\r\n' | if not line or line == '\012': lexer.whitespace = ' \t\r\n' | # Look for a machine, default, or macdef top-level keyword | 366a1df7f1a940a77d2d3b8ac6425fe7353f43c6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/366a1df7f1a940a77d2d3b8ac6425fe7353f43c6/netrc.py |
tt = line | # Look for a machine, default, or macdef top-level keyword | 366a1df7f1a940a77d2d3b8ac6425fe7353f43c6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/366a1df7f1a940a77d2d3b8ac6425fe7353f43c6/netrc.py |
|
if toplevel == 'machine': login = account = password = None self.hosts[entryname] = {} | login = account = password = None self.hosts[entryname] = {} | # Look for a machine, default, or macdef top-level keyword | 366a1df7f1a940a77d2d3b8ac6425fe7353f43c6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/366a1df7f1a940a77d2d3b8ac6425fe7353f43c6/netrc.py |
if tt=='' or tt == 'machine' or tt == 'default' or tt == 'macdef': if toplevel == 'macdef': break elif login and password: | if (tt=='' or tt == 'machine' or tt == 'default' or tt =='macdef'): if login and password: | # Look for a machine, default, or macdef top-level keyword | 366a1df7f1a940a77d2d3b8ac6425fe7353f43c6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/366a1df7f1a940a77d2d3b8ac6425fe7353f43c6/netrc.py |
def testNtoH(self): for func in socket.htonl, socket.ntohl: for i in (0, 1, ~0xffff, 2L): self.assertEqual(i, func(func(i))) biglong = 2**32L - 1 swapped = func(biglong) self.assert_(swapped == biglong or swapped == -1) self.assertRaises(OverflowError, func, 2L**34) | def testNtoHL(self): sizes = {socket.htonl: 32, socket.ntohl: 32, socket.htons: 16, socket.ntohs: 16} for func, size in sizes.items(): mask = (1L<<size) - 1 for i in (0, 1, 0xffff, ~0xffff, 2, 0x01234567, 0x76543210): self.assertEqual(i & mask, func(func(i&mask)) & mask) swapped = func(mask) self.assertEqual(swapped & mask, mask) self.assertRaises(OverflowError, func, 1L<<34) | def testNtoH(self): for func in socket.htonl, socket.ntohl: for i in (0, 1, ~0xffff, 2L): self.assertEqual(i, func(func(i))) | a2627afe370dc6607be45d5b4cf7f73077507441 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a2627afe370dc6607be45d5b4cf7f73077507441/test_socket.py |
root.add_file("PC/py.ico") root.add_file("PC/pyc.ico") | def add_files(db): cab = CAB("python") tmpfiles = [] # Add all executables, icons, text files into the TARGETDIR component root = PyDirectory(db, cab, None, srcdir, "TARGETDIR", "SourceDir") default_feature.set_current() if not msilib.Win64: root.add_file("PCBuild/w9xpopen.exe") root.add_file("PC/py.ico") root.add_file("PC/pyc.ico") root.add_file("README.txt", src="README") root.add_file("NEWS.txt", src="Misc/NEWS") root.add_file("LICENSE.txt", src="LICENSE") root.start_component("python.exe", keyfile="python.exe") root.add_file("PCBuild/python.exe") root.start_component("pythonw.exe", keyfile="pythonw.exe") root.add_file("PCBuild/pythonw.exe") # msidbComponentAttributesSharedDllRefCount = 8, see "Component Table" dlldir = PyDirectory(db, cab, root, srcdir, "DLLDIR", ".") pydll = "python%s%s.dll" % (major, minor) pydllsrc = srcdir + "/PCBuild/" + pydll dlldir.start_component("DLLDIR", flags = 8, keyfile = pydll, uuid = pythondll_uuid) installer = msilib.MakeInstaller() pyversion = installer.FileVersion(pydllsrc, 0) if not snapshot: # For releases, the Python DLL has the same version as the # installer package. assert pyversion.split(".")[:3] == current_version.split(".") dlldir.add_file("PCBuild/python%s%s.dll" % (major, minor), version=pyversion, language=installer.FileVersion(pydllsrc, 1)) # XXX determine dependencies version, lang = extract_msvcr71() dlldir.start_component("msvcr71", flags=8, keyfile="msvcr71.dll", uuid=msvcr71_uuid) dlldir.add_file("msvcr71.dll", src=os.path.abspath("msvcr71.dll"), version=version, language=lang) tmpfiles.append("msvcr71.dll") # Add all .py files in Lib, except lib-tk, test dirs={} pydirs = [(root,"Lib")] while pydirs: parent, dir = pydirs.pop() if dir == ".svn" or dir.startswith("plat-"): continue elif dir in ["lib-tk", "idlelib", "Icons"]: if not have_tcl: continue tcltk.set_current() elif dir in ['test', 'tests', 'data', 'output']: # test: Lib, Lib/email, Lib/bsddb, Lib/ctypes, Lib/sqlite3 # tests: Lib/distutils # data: Lib/email/test # output: Lib/test testsuite.set_current() else: default_feature.set_current() lib = PyDirectory(db, cab, parent, dir, dir, "%s|%s" % (parent.make_short(dir), dir)) # Add additional files dirs[dir]=lib lib.glob("*.txt") if dir=='site-packages': lib.add_file("README.txt", src="README") continue files = lib.glob("*.py") files += lib.glob("*.pyw") if files: # Add an entry to the RemoveFile table to remove bytecode files. lib.remove_pyc() if dir.endswith('.egg-info'): lib.add_file('entry_points.txt') lib.add_file('PKG-INFO') lib.add_file('top_level.txt') lib.add_file('zip-safe') continue if dir=='test' and parent.physical=='Lib': lib.add_file("185test.db") lib.add_file("audiotest.au") lib.add_file("cfgparser.1") lib.add_file("test.xml") lib.add_file("test.xml.out") lib.add_file("testtar.tar") lib.add_file("test_difflib_expect.html") lib.add_file("check_soundcard.vbs") lib.add_file("empty.vbs") lib.glob("*.uue") lib.add_file("readme.txt", src="README") if dir=='decimaltestdata': lib.glob("*.decTest") if dir=='output': lib.glob("test_*") if dir=='idlelib': lib.glob("*.def") lib.add_file("idle.bat") if dir=="Icons": lib.glob("*.gif") lib.add_file("idle.icns") if dir=="command" and parent.physical=="distutils": lib.add_file("wininst-6.exe") lib.add_file("wininst-7.1.exe") if dir=="setuptools": lib.add_file("cli.exe") lib.add_file("gui.exe") if dir=="data" and parent.physical=="test" and parent.basedir.physical=="email": # This should contain all non-.svn files listed in subversion for f in os.listdir(lib.absolute): if f.endswith(".txt") or f==".svn":continue if f.endswith(".au") or f.endswith(".gif"): lib.add_file(f) else: print "WARNING: New file %s in email/test/data" % f for f in os.listdir(lib.absolute): if os.path.isdir(os.path.join(lib.absolute, f)): pydirs.append((lib, f)) # Add DLLs default_feature.set_current() lib = PyDirectory(db, cab, root, srcdir+"/PCBuild", "DLLs", "DLLS|DLLs") dlls = [] tclfiles = [] for f in extensions: if f=="_tkinter.pyd": continue if not os.path.exists(srcdir+"/PCBuild/"+f): print "WARNING: Missing extension", f continue dlls.append(f) lib.add_file(f) if have_tcl: if not os.path.exists(srcdir+"/PCBuild/_tkinter.pyd"): print "WARNING: Missing _tkinter.pyd" else: lib.start_component("TkDLLs", tcltk) lib.add_file("_tkinter.pyd") dlls.append("_tkinter.pyd") tcldir = os.path.normpath(srcdir+"/../tcltk/bin") for f in glob.glob1(tcldir, "*.dll"): lib.add_file(f, src=os.path.join(tcldir, f)) # Add sqlite if msilib.msi_type=="Intel64;1033": sqlite_arch = "/ia64" elif msilib.msi_type=="x64;1033": sqlite_arch = "/amd64" else: sqlite_arch = "" lib.add_file(srcdir+"/"+sqlite_dir+sqlite_arch+"/sqlite3.dll") # check whether there are any unknown extensions for f in glob.glob1(srcdir+"/PCBuild", "*.pyd"): if f.endswith("_d.pyd"): continue # debug version if f in dlls: continue print "WARNING: Unknown extension", f # Add headers default_feature.set_current() lib = PyDirectory(db, cab, root, "include", "include", "INCLUDE|include") lib.glob("*.h") lib.add_file("pyconfig.h", src="../PC/pyconfig.h") # Add import libraries lib = PyDirectory(db, cab, root, "PCBuild", "libs", "LIBS|libs") for f in dlls: lib.add_file(f.replace('pyd','lib')) lib.add_file('python%s%s.lib' % (major, minor)) # Add the mingw-format library if have_mingw: lib.add_file('libpython%s%s.a' % (major, minor)) if have_tcl: # Add Tcl/Tk tcldirs = [(root, '../tcltk/lib', 'tcl')] tcltk.set_current() while tcldirs: parent, phys, dir = tcldirs.pop() lib = PyDirectory(db, cab, parent, phys, dir, "%s|%s" % (parent.make_short(dir), dir)) if not os.path.exists(lib.absolute): continue for f in os.listdir(lib.absolute): if os.path.isdir(os.path.join(lib.absolute, f)): tcldirs.append((lib, f, f)) else: lib.add_file(f) # Add tools tools.set_current() tooldir = PyDirectory(db, cab, root, "Tools", "Tools", "TOOLS|Tools") for f in ['i18n', 'pynche', 'Scripts', 'versioncheck', 'webchecker']: lib = PyDirectory(db, cab, tooldir, f, f, "%s|%s" % (tooldir.make_short(f), f)) lib.glob("*.py") lib.glob("*.pyw", exclude=['pydocgui.pyw']) lib.remove_pyc() lib.glob("*.txt") if f == "pynche": x = PyDirectory(db, cab, lib, "X", "X", "X|X") x.glob("*.txt") if os.path.exists(os.path.join(lib.absolute, "README")): lib.add_file("README.txt", src="README") if f == 'Scripts': if have_tcl: lib.start_component("pydocgui.pyw", tcltk, keyfile="pydocgui.pyw") lib.add_file("pydocgui.pyw") # Add documentation htmlfiles.set_current() lib = PyDirectory(db, cab, root, "Doc", "Doc", "DOC|Doc") lib.start_component("documentation", keyfile="Python%s%s.chm" % (major,minor)) lib.add_file("Python%s%s.chm" % (major, minor)) cab.commit(db) for f in tmpfiles: os.unlink(f) | 1319bb1c2e357ce6792543fc74a5cdd42762cafd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1319bb1c2e357ce6792543fc74a5cdd42762cafd/msi.py |
|
r'[TARGETDIR]py.ico', "REGISTRY.def"), | r'[DLLs]py.ico', "REGISTRY.def"), | # File extensions, associated with the REGISTRY.def component | 1319bb1c2e357ce6792543fc74a5cdd42762cafd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1319bb1c2e357ce6792543fc74a5cdd42762cafd/msi.py |
r'[TARGETDIR]py.ico', "REGISTRY.def"), | r'[DLLs]py.ico', "REGISTRY.def"), | # File extensions, associated with the REGISTRY.def component | 1319bb1c2e357ce6792543fc74a5cdd42762cafd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1319bb1c2e357ce6792543fc74a5cdd42762cafd/msi.py |
r'[TARGETDIR]pyc.ico', "REGISTRY.def"), | r'[DLLs]pyc.ico', "REGISTRY.def"), | # File extensions, associated with the REGISTRY.def component | 1319bb1c2e357ce6792543fc74a5cdd42762cafd /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1319bb1c2e357ce6792543fc74a5cdd42762cafd/msi.py |
try: class C(object, Classic): pass except TypeError: pass else: verify(0, "inheritance from object and Classic should be illegal") | def errors(): if verbose: print "Testing errors..." try: class C(list, dict): pass except TypeError: pass else: verify(0, "inheritance from both list and dict should be illegal") try: class C(object, None): pass except TypeError: pass else: verify(0, "inheritance from non-type should be illegal") class Classic: pass try: class C(object, Classic): pass except TypeError: pass else: verify(0, "inheritance from object and Classic should be illegal") try: class C(type(len)): pass except TypeError: pass else: verify(0, "inheritance from CFunction should be illegal") try: class C(object): __slots__ = 1 except TypeError: pass else: verify(0, "__slots__ = 1 should be illegal") try: class C(object): __slots__ = [1] except TypeError: pass else: verify(0, "__slots__ = [1] should be illegal") | a91e9646e0f916498e812de467f8ac50574e22b1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/a91e9646e0f916498e812de467f8ac50574e22b1/test_descr.py |
|
def makefile(self, mode, bufsize=None): if mode != 'r' and mode != 'rb': raise httplib.UnimplementedFileMode() return StringIO.StringIO(self.text) | ba60319a78ed6be5a57d5288e0e131c4bc6c8cf8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ba60319a78ed6be5a57d5288e0e131c4bc6c8cf8/test_httplib.py |
||
body = "HTTP/1.1 200 Ok\r\n\r\nText" sock = FakeSocket(body) resp = httplib.HTTPResponse(sock, 1) resp.begin() print resp.read() resp.close() | import sys | def makefile(self, mode, bufsize=None): if mode != 'r' and mode != 'rb': raise httplib.UnimplementedFileMode() return StringIO.StringIO(self.text) | ba60319a78ed6be5a57d5288e0e131c4bc6c8cf8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ba60319a78ed6be5a57d5288e0e131c4bc6c8cf8/test_httplib.py |
body = "HTTP/1.1 400.100 Not Ok\r\n\r\nText" sock = FakeSocket(body) resp = httplib.HTTPResponse(sock, 1) try: | def test(): buf = StringIO.StringIO() _stdout = sys.stdout try: sys.stdout = buf _test() finally: sys.stdout = _stdout s = buf.getvalue() for line in s.split("\n"): print line.strip() def _test(): body = "HTTP/1.1 200 Ok\r\n\r\nText" sock = FakeSocket(body) resp = httplib.HTTPResponse(sock, 1) | def makefile(self, mode, bufsize=None): if mode != 'r' and mode != 'rb': raise httplib.UnimplementedFileMode() return StringIO.StringIO(self.text) | ba60319a78ed6be5a57d5288e0e131c4bc6c8cf8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ba60319a78ed6be5a57d5288e0e131c4bc6c8cf8/test_httplib.py |
except httplib.BadStatusLine: print "BadStatusLine raised as expected" else: print "Expect BadStatusLine" | print resp.read() resp.close() | def makefile(self, mode, bufsize=None): if mode != 'r' and mode != 'rb': raise httplib.UnimplementedFileMode() return StringIO.StringIO(self.text) | ba60319a78ed6be5a57d5288e0e131c4bc6c8cf8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ba60319a78ed6be5a57d5288e0e131c4bc6c8cf8/test_httplib.py |
body = "HTTP/1.1 400.100 Not Ok\r\n\r\nText" sock = FakeSocket(body) resp = httplib.HTTPResponse(sock, 1) try: resp.begin() except httplib.BadStatusLine: print "BadStatusLine raised as expected" else: print "Expect BadStatusLine" | def makefile(self, mode, bufsize=None): if mode != 'r' and mode != 'rb': raise httplib.UnimplementedFileMode() return StringIO.StringIO(self.text) | ba60319a78ed6be5a57d5288e0e131c4bc6c8cf8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ba60319a78ed6be5a57d5288e0e131c4bc6c8cf8/test_httplib.py |
|
for hp in ("www.python.org:abc", "www.python.org:"): try: h = httplib.HTTP(hp) except httplib.InvalidURL: print "InvalidURL raised as expected" else: print "Expect InvalidURL" | def makefile(self, mode, bufsize=None): if mode != 'r' and mode != 'rb': raise httplib.UnimplementedFileMode() return StringIO.StringIO(self.text) | ba60319a78ed6be5a57d5288e0e131c4bc6c8cf8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ba60319a78ed6be5a57d5288e0e131c4bc6c8cf8/test_httplib.py |
|
text = ('HTTP/1.1 200 OK\r\n' 'Set-Cookie: Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"\r\n' 'Set-Cookie: Part_Number="Rocket_Launcher_0001"; Version="1";' ' Path="/acme"\r\n' '\r\n' 'No body\r\n') hdr = ('Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"' ', ' 'Part_Number="Rocket_Launcher_0001"; Version="1"; Path="/acme"') s = FakeSocket(text) r = httplib.HTTPResponse(s, 1) r.begin() cookies = r.getheader("Set-Cookie") if cookies != hdr: raise AssertionError, "multiple headers not combined properly" | for hp in ("www.python.org:abc", "www.python.org:"): try: h = httplib.HTTP(hp) except httplib.InvalidURL: print "InvalidURL raised as expected" else: print "Expect InvalidURL" text = ('HTTP/1.1 200 OK\r\n' 'Set-Cookie: Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"\r\n' 'Set-Cookie: Part_Number="Rocket_Launcher_0001"; Version="1";' ' Path="/acme"\r\n' '\r\n' 'No body\r\n') hdr = ('Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"' ', ' 'Part_Number="Rocket_Launcher_0001"; Version="1"; Path="/acme"') s = FakeSocket(text) r = httplib.HTTPResponse(s, 1) r.begin() cookies = r.getheader("Set-Cookie") if cookies != hdr: raise AssertionError, "multiple headers not combined properly" test() | def makefile(self, mode, bufsize=None): if mode != 'r' and mode != 'rb': raise httplib.UnimplementedFileMode() return StringIO.StringIO(self.text) | ba60319a78ed6be5a57d5288e0e131c4bc6c8cf8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ba60319a78ed6be5a57d5288e0e131c4bc6c8cf8/test_httplib.py |
self._note("%s.acquire(%s): initial succes", self, blocking) | self._note("%s.acquire(%s): initial success", self, blocking) | def acquire(self, blocking=1): me = currentThread() if self.__owner is me: self.__count = self.__count + 1 if __debug__: self._note("%s.acquire(%s): recursive success", self, blocking) return 1 rc = self.__block.acquire(blocking) if rc: self.__owner = me self.__count = 1 if __debug__: self._note("%s.acquire(%s): initial succes", self, blocking) else: if __debug__: self._note("%s.acquire(%s): failure", self, blocking) return rc | 90cece7f8930cbfe5b87a61a1a67cfd670639c63 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/90cece7f8930cbfe5b87a61a1a67cfd670639c63/threading.py |
return strftime(self.format, (item,)*9).capitalize() | return strftime(self.format, (item,)*8+(0,)).capitalize() | def __getitem__(self, item): if isinstance(item, int): if item < 0: item += self.len if not 0 <= item < self.len: raise IndexError, "out of range" return strftime(self.format, (item,)*9).capitalize() elif isinstance(item, type(slice(0))): return [self[e] for e in range(self.len)].__getslice__(item.start, item.stop) | e8c6a3eef66950a1dea7bf0c17961e170aab94f9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e8c6a3eef66950a1dea7bf0c17961e170aab94f9/calendar.py |
pat = re.compile(r'^\s*def\s') | pat = re.compile(r'^(\s*def\s)|(.*\slambda(:|\s))') | def findsource(object): """Return the entire source file and starting line number for an object. The argument may be a module, class, method, function, traceback, frame, or code object. The source code is returned as a list of all the lines in the file and the line number indexes a line in that list. An IOError is raised if the source code cannot be retrieved.""" file = getsourcefile(object) or getfile(object) lines = linecache.getlines(file) if not lines: raise IOError, 'could not get source code' if ismodule(object): return lines, 0 if isclass(object): name = object.__name__ pat = re.compile(r'^\s*class\s*' + name + r'\b') for i in range(len(lines)): if pat.match(lines[i]): return lines, i else: raise IOError, 'could not find class definition' if ismethod(object): object = object.im_func if isfunction(object): object = object.func_code if istraceback(object): object = object.tb_frame if isframe(object): object = object.f_code if iscode(object): if not hasattr(object, 'co_firstlineno'): raise IOError, 'could not find function definition' lnum = object.co_firstlineno - 1 pat = re.compile(r'^\s*def\s') while lnum > 0: if pat.match(lines[lnum]): break lnum = lnum - 1 return lines, lnum raise IOError, 'could not find code object' | 2d375f78a570dc627daf61df9d12473633055cdf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2d375f78a570dc627daf61df9d12473633055cdf/inspect.py |
if not installDir: installDir = DEFAULT_INSTALLDIR | def __init__(self, flavorOrder=None, downloadDir=None, buildDir=None, installDir=None, pimpDatabase=None): if not flavorOrder: flavorOrder = DEFAULT_FLAVORORDER if not downloadDir: downloadDir = DEFAULT_DOWNLOADDIR if not buildDir: buildDir = DEFAULT_BUILDDIR if not installDir: installDir = DEFAULT_INSTALLDIR if not pimpDatabase: pimpDatabase = DEFAULT_PIMPDATABASE self.flavorOrder = flavorOrder self.downloadDir = downloadDir self.buildDir = buildDir self.installDir = installDir self.pimpDatabase = pimpDatabase | 6fde1cef4aa2498f965f95c2d467f4b57face862 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6fde1cef4aa2498f965f95c2d467f4b57face862/pimp.py |
|
return rv | return rv | def check(self): """Check that the preferences make sense: directories exist and are writable, the install directory is on sys.path, etc.""" rv = "" RWX_OK = os.R_OK|os.W_OK|os.X_OK if not os.path.exists(self.downloadDir): rv += "Warning: Download directory \"%s\" does not exist\n" % self.downloadDir elif not os.access(self.downloadDir, RWX_OK): rv += "Warning: Download directory \"%s\" is not writable or not readable\n" % self.downloadDir if not os.path.exists(self.buildDir): rv += "Warning: Build directory \"%s\" does not exist\n" % self.buildDir elif not os.access(self.buildDir, RWX_OK): rv += "Warning: Build directory \"%s\" is not writable or not readable\n" % self.buildDir if not os.path.exists(self.installDir): rv += "Warning: Install directory \"%s\" does not exist\n" % self.installDir elif not os.access(self.installDir, RWX_OK): rv += "Warning: Install directory \"%s\" is not writable or not readable\n" % self.installDir else: installDir = os.path.realpath(self.installDir) for p in sys.path: try: realpath = os.path.realpath(p) except: pass if installDir == realpath: break else: rv += "Warning: Install directory \"%s\" is not on sys.path\n" % self.installDir return rv | 6fde1cef4aa2498f965f95c2d467f4b57face862 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6fde1cef4aa2498f965f95c2d467f4b57face862/pimp.py |
def _cmd(self, output, dir, *cmditems): """Internal routine to run a shell command in a given directory.""" cmd = ("cd \"%s\"; " % dir) + " ".join(cmditems) if output: output.write("+ %s\n" % cmd) if NO_EXECUTE: return 0 child = popen2.Popen4(cmd) child.tochild.close() while 1: line = child.fromchild.readline() if not line: break if output: output.write(line) return child.wait() | def _cmd(self, output, dir, *cmditems): """Internal routine to run a shell command in a given directory.""" cmd = ("cd \"%s\"; " % dir) + " ".join(cmditems) if output: output.write("+ %s\n" % cmd) if NO_EXECUTE: return 0 child = popen2.Popen4(cmd) child.tochild.close() while 1: line = child.fromchild.readline() if not line: break if output: output.write(line) return child.wait() | 6fde1cef4aa2498f965f95c2d467f4b57face862 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6fde1cef4aa2498f965f95c2d467f4b57face862/pimp.py |
|
if self._cmd(output, self._db.preferences.downloadDir, | if _cmd(output, self._db.preferences.downloadDir, | def downloadPackageOnly(self, output=None): """Download a single package, if needed. An MD5 signature is used to determine whether download is needed, and to test that we actually downloaded what we expected. If output is given it is a file-like object that will receive a log of what happens. If anything unforeseen happened the method returns an error message string. """ scheme, loc, path, query, frag = urlparse.urlsplit(self._dict['Download-URL']) path = urllib.url2pathname(path) filename = os.path.split(path)[1] self.archiveFilename = os.path.join(self._db.preferences.downloadDir, filename) if not self._archiveOK(): if scheme == 'manual': return "Please download package manually and save as %s" % self.archiveFilename if self._cmd(output, self._db.preferences.downloadDir, "curl", "--output", self.archiveFilename, self._dict['Download-URL']): return "download command failed" if not os.path.exists(self.archiveFilename) and not NO_EXECUTE: return "archive not found after download" if not self._archiveOK(): return "archive does not have correct MD5 checksum" | 6fde1cef4aa2498f965f95c2d467f4b57face862 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6fde1cef4aa2498f965f95c2d467f4b57face862/pimp.py |
for ext, cmd in ARCHIVE_FORMATS: | for ext, unpackerClass, arg in ARCHIVE_FORMATS: | def unpackPackageOnly(self, output=None): """Unpack a downloaded package archive.""" filename = os.path.split(self.archiveFilename)[1] for ext, cmd in ARCHIVE_FORMATS: if filename[-len(ext):] == ext: break else: return "unknown extension for archive file: %s" % filename self.basename = filename[:-len(ext)] cmd = cmd % self.archiveFilename if self._cmd(output, self._db.preferences.buildDir, cmd): return "unpack command failed" | 6fde1cef4aa2498f965f95c2d467f4b57face862 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6fde1cef4aa2498f965f95c2d467f4b57face862/pimp.py |
cmd = cmd % self.archiveFilename if self._cmd(output, self._db.preferences.buildDir, cmd): return "unpack command failed" | unpacker = unpackerClass(arg, dir=self._db.preferences.buildDir) rv = unpacker.unpack(self.archiveFilename, output=output) if rv: return rv | def unpackPackageOnly(self, output=None): """Unpack a downloaded package archive.""" filename = os.path.split(self.archiveFilename)[1] for ext, cmd in ARCHIVE_FORMATS: if filename[-len(ext):] == ext: break else: return "unknown extension for archive file: %s" % filename self.basename = filename[:-len(ext)] cmd = cmd % self.archiveFilename if self._cmd(output, self._db.preferences.buildDir, cmd): return "unpack command failed" | 6fde1cef4aa2498f965f95c2d467f4b57face862 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6fde1cef4aa2498f965f95c2d467f4b57face862/pimp.py |
print 'PimpPackage_binary installPackageOnly' | def installPackageOnly(self, output=None): """Install a single source package. If output is given it should be a file-like object and it will receive a log of what happened.""" print 'PimpPackage_binary installPackageOnly' msgs = [] if self._dict.has_key('Pre-install-command'): msg.append("%s: Pre-install-command ignored" % self.fullname()) if self._dict.has_key('Install-command'): msgs.append("%s: Install-command ignored" % self.fullname()) if self._dict.has_key('Post-install-command'): msgs.append("%s: Post-install-command ignored" % self.fullname()) self.beforeInstall() | 6fde1cef4aa2498f965f95c2d467f4b57face862 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6fde1cef4aa2498f965f95c2d467f4b57face862/pimp.py |
|
msgs = [] | if self._dict.has_key('Install-command'): return "%s: Binary package cannot have Install-command" % self.fullname() | def installPackageOnly(self, output=None): """Install a single source package. If output is given it should be a file-like object and it will receive a log of what happened.""" print 'PimpPackage_binary installPackageOnly' msgs = [] if self._dict.has_key('Pre-install-command'): msg.append("%s: Pre-install-command ignored" % self.fullname()) if self._dict.has_key('Install-command'): msgs.append("%s: Install-command ignored" % self.fullname()) if self._dict.has_key('Post-install-command'): msgs.append("%s: Post-install-command ignored" % self.fullname()) self.beforeInstall() | 6fde1cef4aa2498f965f95c2d467f4b57face862 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6fde1cef4aa2498f965f95c2d467f4b57face862/pimp.py |
msg.append("%s: Pre-install-command ignored" % self.fullname()) if self._dict.has_key('Install-command'): msgs.append("%s: Install-command ignored" % self.fullname()) if self._dict.has_key('Post-install-command'): msgs.append("%s: Post-install-command ignored" % self.fullname()) | if _cmd(output, self._buildDirname, self._dict['Pre-install-command']): return "pre-install %s: running \"%s\" failed" % \ (self.fullname(), self._dict['Pre-install-command']) | def installPackageOnly(self, output=None): """Install a single source package. If output is given it should be a file-like object and it will receive a log of what happened.""" print 'PimpPackage_binary installPackageOnly' msgs = [] if self._dict.has_key('Pre-install-command'): msg.append("%s: Pre-install-command ignored" % self.fullname()) if self._dict.has_key('Install-command'): msgs.append("%s: Install-command ignored" % self.fullname()) if self._dict.has_key('Post-install-command'): msgs.append("%s: Post-install-command ignored" % self.fullname()) self.beforeInstall() | 6fde1cef4aa2498f965f95c2d467f4b57face862 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6fde1cef4aa2498f965f95c2d467f4b57face862/pimp.py |
for ext, cmd in ARCHIVE_FORMATS: | for ext, unpackerClass, arg in ARCHIVE_FORMATS: | def installPackageOnly(self, output=None): """Install a single source package. If output is given it should be a file-like object and it will receive a log of what happened.""" print 'PimpPackage_binary installPackageOnly' msgs = [] if self._dict.has_key('Pre-install-command'): msg.append("%s: Pre-install-command ignored" % self.fullname()) if self._dict.has_key('Install-command'): msgs.append("%s: Install-command ignored" % self.fullname()) if self._dict.has_key('Post-install-command'): msgs.append("%s: Post-install-command ignored" % self.fullname()) self.beforeInstall() | 6fde1cef4aa2498f965f95c2d467f4b57face862 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6fde1cef4aa2498f965f95c2d467f4b57face862/pimp.py |
return "unknown extension for archive file: %s" % filename cmd = cmd % self.archiveFilename if self._cmd(output, "/", cmd): return "unpack command failed" | return "%s: unknown extension for archive file: %s" % (self.fullname(), filename) self.basename = filename[:-len(ext)] install_renames = [] for k, newloc in self._db.preferences.installLocations: if not newloc: continue if k == "--install-lib": oldloc = DEFAULT_INSTALLDIR else: return "%s: Don't know installLocation %s" % (self.fullname(), k) install_renames.append((oldloc, newloc)) unpacker = unpackerClass(arg, dir="/", renames=install_renames) rv = unpacker.unpack(self.archiveFilename, output=output) if rv: return rv | def installPackageOnly(self, output=None): """Install a single source package. If output is given it should be a file-like object and it will receive a log of what happened.""" print 'PimpPackage_binary installPackageOnly' msgs = [] if self._dict.has_key('Pre-install-command'): msg.append("%s: Pre-install-command ignored" % self.fullname()) if self._dict.has_key('Install-command'): msgs.append("%s: Install-command ignored" % self.fullname()) if self._dict.has_key('Post-install-command'): msgs.append("%s: Post-install-command ignored" % self.fullname()) self.beforeInstall() | 6fde1cef4aa2498f965f95c2d467f4b57face862 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6fde1cef4aa2498f965f95c2d467f4b57face862/pimp.py |
if self._cmd(output, self._buildDirname, self._dict['Post-install-command']): return "post-install %s: running \"%s\" failed" % \ | if _cmd(output, self._buildDirname, self._dict['Post-install-command']): return "%s: post-install: running \"%s\" failed" % \ | def installPackageOnly(self, output=None): """Install a single source package. If output is given it should be a file-like object and it will receive a log of what happened.""" print 'PimpPackage_binary installPackageOnly' msgs = [] if self._dict.has_key('Pre-install-command'): msg.append("%s: Pre-install-command ignored" % self.fullname()) if self._dict.has_key('Install-command'): msgs.append("%s: Install-command ignored" % self.fullname()) if self._dict.has_key('Post-install-command'): msgs.append("%s: Post-install-command ignored" % self.fullname()) self.beforeInstall() | 6fde1cef4aa2498f965f95c2d467f4b57face862 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6fde1cef4aa2498f965f95c2d467f4b57face862/pimp.py |
if self._cmd(output, self._buildDirname, self._dict['Pre-install-command']): | if _cmd(output, self._buildDirname, self._dict['Pre-install-command']): | def installPackageOnly(self, output=None): """Install a single source package. If output is given it should be a file-like object and it will receive a log of what happened.""" if self._dict.has_key('Pre-install-command'): if self._cmd(output, self._buildDirname, self._dict['Pre-install-command']): return "pre-install %s: running \"%s\" failed" % \ (self.fullname(), self._dict['Pre-install-command']) self.beforeInstall() installcmd = self._dict.get('Install-command') if not installcmd: installcmd = '"%s" setup.py install' % sys.executable if self._cmd(output, self._buildDirname, installcmd): return "install %s: running \"%s\" failed" % \ (self.fullname(), installcmd) self.afterInstall() if self._dict.has_key('Post-install-command'): if self._cmd(output, self._buildDirname, self._dict['Post-install-command']): return "post-install %s: running \"%s\" failed" % \ (self.fullname(), self._dict['Post-install-command']) return None | 6fde1cef4aa2498f965f95c2d467f4b57face862 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6fde1cef4aa2498f965f95c2d467f4b57face862/pimp.py |
installcmd = '"%s" setup.py install' % sys.executable if self._cmd(output, self._buildDirname, installcmd): | extra_args = "" for k, v in self._db.preferences.installLocations: if not v: if not unwanted_install_dir: unwanted_install_dir = tempfile.mkdtemp() v = unwanted_install_dir extra_args = extra_args + " %s \"%s\"" % (k, v) installcmd = '"%s" setup.py install %s' % (sys.executable, extra_args) if _cmd(output, self._buildDirname, installcmd): | def installPackageOnly(self, output=None): """Install a single source package. If output is given it should be a file-like object and it will receive a log of what happened.""" if self._dict.has_key('Pre-install-command'): if self._cmd(output, self._buildDirname, self._dict['Pre-install-command']): return "pre-install %s: running \"%s\" failed" % \ (self.fullname(), self._dict['Pre-install-command']) self.beforeInstall() installcmd = self._dict.get('Install-command') if not installcmd: installcmd = '"%s" setup.py install' % sys.executable if self._cmd(output, self._buildDirname, installcmd): return "install %s: running \"%s\" failed" % \ (self.fullname(), installcmd) self.afterInstall() if self._dict.has_key('Post-install-command'): if self._cmd(output, self._buildDirname, self._dict['Post-install-command']): return "post-install %s: running \"%s\" failed" % \ (self.fullname(), self._dict['Post-install-command']) return None | 6fde1cef4aa2498f965f95c2d467f4b57face862 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6fde1cef4aa2498f965f95c2d467f4b57face862/pimp.py |
if self._cmd(output, self._buildDirname, self._dict['Post-install-command']): | if _cmd(output, self._buildDirname, self._dict['Post-install-command']): | def installPackageOnly(self, output=None): """Install a single source package. If output is given it should be a file-like object and it will receive a log of what happened.""" if self._dict.has_key('Pre-install-command'): if self._cmd(output, self._buildDirname, self._dict['Pre-install-command']): return "pre-install %s: running \"%s\" failed" % \ (self.fullname(), self._dict['Pre-install-command']) self.beforeInstall() installcmd = self._dict.get('Install-command') if not installcmd: installcmd = '"%s" setup.py install' % sys.executable if self._cmd(output, self._buildDirname, installcmd): return "install %s: running \"%s\" failed" % \ (self.fullname(), installcmd) self.afterInstall() if self._dict.has_key('Post-install-command'): if self._cmd(output, self._buildDirname, self._dict['Post-install-command']): return "post-install %s: running \"%s\" failed" % \ (self.fullname(), self._dict['Post-install-command']) return None | 6fde1cef4aa2498f965f95c2d467f4b57face862 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6fde1cef4aa2498f965f95c2d467f4b57face862/pimp.py |
def _run(mode, verbose, force, args): | def _run(mode, verbose, force, args, prefargs): | def _run(mode, verbose, force, args): """Engine for the main program""" prefs = PimpPreferences() prefs.check() db = PimpDatabase(prefs) db.appendURL(prefs.pimpDatabase) if mode == 'dump': db.dump(sys.stdout) elif mode =='list': if not args: args = db.listnames() print "%-20.20s\t%s" % ("Package", "Description") print for pkgname in args: pkg = db.find(pkgname) if pkg: description = pkg.description() pkgname = pkg.fullname() else: description = 'Error: no such package' print "%-20.20s\t%s" % (pkgname, description) if verbose: print "\tHome page:\t", pkg.homepage() print "\tDownload URL:\t", pkg.downloadURL() elif mode =='status': if not args: args = db.listnames() print "%-20.20s\t%s\t%s" % ("Package", "Installed", "Message") print for pkgname in args: pkg = db.find(pkgname) if pkg: status, msg = pkg.installed() pkgname = pkg.fullname() else: status = 'error' msg = 'No such package' print "%-20.20s\t%-9.9s\t%s" % (pkgname, status, msg) if verbose and status == "no": prereq = pkg.prerequisites() for pkg, msg in prereq: if not pkg: pkg = '' else: pkg = pkg.fullname() print "%-20.20s\tRequirement: %s %s" % ("", pkg, msg) elif mode == 'install': if not args: print 'Please specify packages to install' sys.exit(1) inst = PimpInstaller(db) for pkgname in args: pkg = db.find(pkgname) if not pkg: print '%s: No such package' % pkgname continue list, messages = inst.prepareInstall(pkg, force) if messages and not force: print "%s: Not installed:" % pkgname for m in messages: print "\t", m else: if verbose: output = sys.stdout else: output = None messages = inst.install(list, output) if messages: print "%s: Not installed:" % pkgname for m in messages: print "\t", m | 6fde1cef4aa2498f965f95c2d467f4b57face862 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6fde1cef4aa2498f965f95c2d467f4b57face862/pimp.py |
prefs = PimpPreferences() prefs.check() | prefs = PimpPreferences(**prefargs) rv = prefs.check() if rv: sys.stdout.write(rv) | def _run(mode, verbose, force, args): """Engine for the main program""" prefs = PimpPreferences() prefs.check() db = PimpDatabase(prefs) db.appendURL(prefs.pimpDatabase) if mode == 'dump': db.dump(sys.stdout) elif mode =='list': if not args: args = db.listnames() print "%-20.20s\t%s" % ("Package", "Description") print for pkgname in args: pkg = db.find(pkgname) if pkg: description = pkg.description() pkgname = pkg.fullname() else: description = 'Error: no such package' print "%-20.20s\t%s" % (pkgname, description) if verbose: print "\tHome page:\t", pkg.homepage() print "\tDownload URL:\t", pkg.downloadURL() elif mode =='status': if not args: args = db.listnames() print "%-20.20s\t%s\t%s" % ("Package", "Installed", "Message") print for pkgname in args: pkg = db.find(pkgname) if pkg: status, msg = pkg.installed() pkgname = pkg.fullname() else: status = 'error' msg = 'No such package' print "%-20.20s\t%-9.9s\t%s" % (pkgname, status, msg) if verbose and status == "no": prereq = pkg.prerequisites() for pkg, msg in prereq: if not pkg: pkg = '' else: pkg = pkg.fullname() print "%-20.20s\tRequirement: %s %s" % ("", pkg, msg) elif mode == 'install': if not args: print 'Please specify packages to install' sys.exit(1) inst = PimpInstaller(db) for pkgname in args: pkg = db.find(pkgname) if not pkg: print '%s: No such package' % pkgname continue list, messages = inst.prepareInstall(pkg, force) if messages and not force: print "%s: Not installed:" % pkgname for m in messages: print "\t", m else: if verbose: output = sys.stdout else: output = None messages = inst.install(list, output) if messages: print "%s: Not installed:" % pkgname for m in messages: print "\t", m | 6fde1cef4aa2498f965f95c2d467f4b57face862 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6fde1cef4aa2498f965f95c2d467f4b57face862/pimp.py |
print "\tDownload URL:\t", pkg.downloadURL() | try: print "\tDownload URL:\t", pkg.downloadURL() except KeyError: pass | def _run(mode, verbose, force, args): """Engine for the main program""" prefs = PimpPreferences() prefs.check() db = PimpDatabase(prefs) db.appendURL(prefs.pimpDatabase) if mode == 'dump': db.dump(sys.stdout) elif mode =='list': if not args: args = db.listnames() print "%-20.20s\t%s" % ("Package", "Description") print for pkgname in args: pkg = db.find(pkgname) if pkg: description = pkg.description() pkgname = pkg.fullname() else: description = 'Error: no such package' print "%-20.20s\t%s" % (pkgname, description) if verbose: print "\tHome page:\t", pkg.homepage() print "\tDownload URL:\t", pkg.downloadURL() elif mode =='status': if not args: args = db.listnames() print "%-20.20s\t%s\t%s" % ("Package", "Installed", "Message") print for pkgname in args: pkg = db.find(pkgname) if pkg: status, msg = pkg.installed() pkgname = pkg.fullname() else: status = 'error' msg = 'No such package' print "%-20.20s\t%-9.9s\t%s" % (pkgname, status, msg) if verbose and status == "no": prereq = pkg.prerequisites() for pkg, msg in prereq: if not pkg: pkg = '' else: pkg = pkg.fullname() print "%-20.20s\tRequirement: %s %s" % ("", pkg, msg) elif mode == 'install': if not args: print 'Please specify packages to install' sys.exit(1) inst = PimpInstaller(db) for pkgname in args: pkg = db.find(pkgname) if not pkg: print '%s: No such package' % pkgname continue list, messages = inst.prepareInstall(pkg, force) if messages and not force: print "%s: Not installed:" % pkgname for m in messages: print "\t", m else: if verbose: output = sys.stdout else: output = None messages = inst.install(list, output) if messages: print "%s: Not installed:" % pkgname for m in messages: print "\t", m | 6fde1cef4aa2498f965f95c2d467f4b57face862 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6fde1cef4aa2498f965f95c2d467f4b57face862/pimp.py |
print "Usage: pimp [-v] -s [package ...] List installed status" print " pimp [-v] -l [package ...] Show package information" print " pimp [-vf] -i package ... Install packages" print " pimp -d Dump database to stdout" | print "Usage: pimp [options] -s [package ...] List installed status" print " pimp [options] -l [package ...] Show package information" print " pimp [options] -i package ... Install packages" print " pimp -d Dump database to stdout" | def _help(): print "Usage: pimp [-v] -s [package ...] List installed status" print " pimp [-v] -l [package ...] Show package information" print " pimp [-vf] -i package ... Install packages" print " pimp -d Dump database to stdout" print "Options:" print " -v Verbose" print " -f Force installation" sys.exit(1) | 6fde1cef4aa2498f965f95c2d467f4b57face862 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6fde1cef4aa2498f965f95c2d467f4b57face862/pimp.py |
print " -v Verbose" print " -f Force installation" | print " -v Verbose" print " -f Force installation" print " -D dir Set destination directory (default: site-packages)" | def _help(): print "Usage: pimp [-v] -s [package ...] List installed status" print " pimp [-v] -l [package ...] Show package information" print " pimp [-vf] -i package ... Install packages" print " pimp -d Dump database to stdout" print "Options:" print " -v Verbose" print " -f Force installation" sys.exit(1) | 6fde1cef4aa2498f965f95c2d467f4b57face862 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6fde1cef4aa2498f965f95c2d467f4b57face862/pimp.py |
opts, args = getopt.getopt(sys.argv[1:], "slifvd") | opts, args = getopt.getopt(sys.argv[1:], "slifvdD:") | def _help(): print "Usage: pimp [-v] -s [package ...] List installed status" print " pimp [-v] -l [package ...] Show package information" print " pimp [-vf] -i package ... Install packages" print " pimp -d Dump database to stdout" print "Options:" print " -v Verbose" print " -f Force installation" sys.exit(1) | 6fde1cef4aa2498f965f95c2d467f4b57face862 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6fde1cef4aa2498f965f95c2d467f4b57face862/pimp.py |
_run(mode, verbose, force, args) | _run(mode, verbose, force, args, prefargs) | def _help(): print "Usage: pimp [-v] -s [package ...] List installed status" print " pimp [-v] -l [package ...] Show package information" print " pimp [-vf] -i package ... Install packages" print " pimp -d Dump database to stdout" print "Options:" print " -v Verbose" print " -f Force installation" sys.exit(1) | 6fde1cef4aa2498f965f95c2d467f4b57face862 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6fde1cef4aa2498f965f95c2d467f4b57face862/pimp.py |
args = args + to | if to[0] == '-to': to = to[1:] args = args + ('-to',) + tuple(to) | def put(self, data, to=None): args = (self.name, 'put', data) if to: args = args + to apply(self.tk.call, args) | b5323999d261d3f864c9c7da78e3c88640ee411a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b5323999d261d3f864c9c7da78e3c88640ee411a/Tkinter.py |
def compare_generic_iter(make_it,match): | def compare_generic_iter(test, make_it, match): | def compare_generic_iter(make_it,match): """Utility to compare a generic 2.1/2.2+ iterator with an iterable If running under Python 2.2+, this tests the iterator using iter()/next(), as well as __getitem__. 'make_it' must be a function returning a fresh iterator to be tested (since this may test the iterator twice).""" it = make_it() n = 0 for item in match: assert it[n]==item n+=1 try: it[n] except IndexError: pass else: raise AssertionError("Too many items from __getitem__",it) try: iter, StopIteration except NameError: pass else: # Only test iter mode under 2.2+ it = make_it() assert iter(it) is it for item in match: assert it.next()==item try: it.next() except StopIteration: pass else: raise AssertionError("Too many items from .next()",it) | 06524b61d05c604543e6d3603dee11425ccff637 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/06524b61d05c604543e6d3603dee11425ccff637/test_wsgiref.py |
assert it[n]==item | test.assertEqual(it[n], item) | def compare_generic_iter(make_it,match): """Utility to compare a generic 2.1/2.2+ iterator with an iterable If running under Python 2.2+, this tests the iterator using iter()/next(), as well as __getitem__. 'make_it' must be a function returning a fresh iterator to be tested (since this may test the iterator twice).""" it = make_it() n = 0 for item in match: assert it[n]==item n+=1 try: it[n] except IndexError: pass else: raise AssertionError("Too many items from __getitem__",it) try: iter, StopIteration except NameError: pass else: # Only test iter mode under 2.2+ it = make_it() assert iter(it) is it for item in match: assert it.next()==item try: it.next() except StopIteration: pass else: raise AssertionError("Too many items from .next()",it) | 06524b61d05c604543e6d3603dee11425ccff637 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/06524b61d05c604543e6d3603dee11425ccff637/test_wsgiref.py |
assert iter(it) is it | test.assert_(iter(it) is it) | def compare_generic_iter(make_it,match): """Utility to compare a generic 2.1/2.2+ iterator with an iterable If running under Python 2.2+, this tests the iterator using iter()/next(), as well as __getitem__. 'make_it' must be a function returning a fresh iterator to be tested (since this may test the iterator twice).""" it = make_it() n = 0 for item in match: assert it[n]==item n+=1 try: it[n] except IndexError: pass else: raise AssertionError("Too many items from __getitem__",it) try: iter, StopIteration except NameError: pass else: # Only test iter mode under 2.2+ it = make_it() assert iter(it) is it for item in match: assert it.next()==item try: it.next() except StopIteration: pass else: raise AssertionError("Too many items from .next()",it) | 06524b61d05c604543e6d3603dee11425ccff637 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/06524b61d05c604543e6d3603dee11425ccff637/test_wsgiref.py |
assert it.next()==item try: it.next() except StopIteration: pass else: raise AssertionError("Too many items from .next()",it) | test.assertEqual(it.next(), item) test.assertRaises(StopIteration, it.next) | def compare_generic_iter(make_it,match): """Utility to compare a generic 2.1/2.2+ iterator with an iterable If running under Python 2.2+, this tests the iterator using iter()/next(), as well as __getitem__. 'make_it' must be a function returning a fresh iterator to be tested (since this may test the iterator twice).""" it = make_it() n = 0 for item in match: assert it[n]==item n+=1 try: it[n] except IndexError: pass else: raise AssertionError("Too many items from __getitem__",it) try: iter, StopIteration except NameError: pass else: # Only test iter mode under 2.2+ it = make_it() assert iter(it) is it for item in match: assert it.next()==item try: it.next() except StopIteration: pass else: raise AssertionError("Too many items from .next()",it) | 06524b61d05c604543e6d3603dee11425ccff637 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/06524b61d05c604543e6d3603dee11425ccff637/test_wsgiref.py |
compare_generic_iter(make_it,match) | compare_generic_iter(self, make_it, match) | def make_it(text=text,size=size): return util.FileWrapper(StringIO(text),size) | 06524b61d05c604543e6d3603dee11425ccff637 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/06524b61d05c604543e6d3603dee11425ccff637/test_wsgiref.py |
assert h.environ.has_key(key) | self.assert_(h.environ.has_key(key)) | def testCGIEnviron(self): h = BaseCGIHandler(None,None,None,{}) h.setup_environ() for key in 'wsgi.url_scheme', 'wsgi.input', 'wsgi.errors': assert h.environ.has_key(key) | 06524b61d05c604543e6d3603dee11425ccff637 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/06524b61d05c604543e6d3603dee11425ccff637/test_wsgiref.py |
test('isupper', u'\u1FFc', 0) | if sys.platform[:4] != 'java': test('isupper', u'\u1FFc', 0) | def test_fixup(s): s2 = u'\ud800\udc01' test_lecmp(s, s2) s2 = u'\ud900\udc01' test_lecmp(s, s2) s2 = u'\uda00\udc01' test_lecmp(s, s2) s2 = u'\udb00\udc01' test_lecmp(s, s2) s2 = u'\ud800\udd01' test_lecmp(s, s2) s2 = u'\ud900\udd01' test_lecmp(s, s2) s2 = u'\uda00\udd01' test_lecmp(s, s2) s2 = u'\udb00\udd01' test_lecmp(s, s2) s2 = u'\ud800\ude01' test_lecmp(s, s2) s2 = u'\ud900\ude01' test_lecmp(s, s2) s2 = u'\uda00\ude01' test_lecmp(s, s2) s2 = u'\udb00\ude01' test_lecmp(s, s2) s2 = u'\ud800\udfff' test_lecmp(s, s2) s2 = u'\ud900\udfff' test_lecmp(s, s2) s2 = u'\uda00\udfff' test_lecmp(s, s2) s2 = u'\udb00\udfff' test_lecmp(s, s2) | ef0a032883cadeb0dba7a6ff84025f7133b75b31 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ef0a032883cadeb0dba7a6ff84025f7133b75b31/test_unicode.py |
value = u"%r, %r" % (u"abc", "abc") if value != u"u'abc', 'abc'": print '*** formatting failed for "%s"' % 'u"%r, %r" % (u"abc", "abc")' | if sys.platform[:4] != 'java': value = u"%r, %r" % (u"abc", "abc") if value != u"u'abc', 'abc'": print '*** formatting failed for "%s"' % 'u"%r, %r" % (u"abc", "abc")' | def test_fixup(s): s2 = u'\ud800\udc01' test_lecmp(s, s2) s2 = u'\ud900\udc01' test_lecmp(s, s2) s2 = u'\uda00\udc01' test_lecmp(s, s2) s2 = u'\udb00\udc01' test_lecmp(s, s2) s2 = u'\ud800\udd01' test_lecmp(s, s2) s2 = u'\ud900\udd01' test_lecmp(s, s2) s2 = u'\uda00\udd01' test_lecmp(s, s2) s2 = u'\udb00\udd01' test_lecmp(s, s2) s2 = u'\ud800\ude01' test_lecmp(s, s2) s2 = u'\ud900\ude01' test_lecmp(s, s2) s2 = u'\uda00\ude01' test_lecmp(s, s2) s2 = u'\udb00\ude01' test_lecmp(s, s2) s2 = u'\ud800\udfff' test_lecmp(s, s2) s2 = u'\ud900\udfff' test_lecmp(s, s2) s2 = u'\uda00\udfff' test_lecmp(s, s2) s2 = u'\udb00\udfff' test_lecmp(s, s2) | ef0a032883cadeb0dba7a6ff84025f7133b75b31 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ef0a032883cadeb0dba7a6ff84025f7133b75b31/test_unicode.py |
value = u"%(x)s, %()s" % {'x':u"abc", u''.encode('utf-8'):"def"} | if sys.platform[:4] != 'java': value = u"%(x)s, %()s" % {'x':u"abc", u''.encode('utf-8'):"def"} else: value = u"%(x)s, %()s" % {'x':u"abc", u'':"def"} | def test_fixup(s): s2 = u'\ud800\udc01' test_lecmp(s, s2) s2 = u'\ud900\udc01' test_lecmp(s, s2) s2 = u'\uda00\udc01' test_lecmp(s, s2) s2 = u'\udb00\udc01' test_lecmp(s, s2) s2 = u'\ud800\udd01' test_lecmp(s, s2) s2 = u'\ud900\udd01' test_lecmp(s, s2) s2 = u'\uda00\udd01' test_lecmp(s, s2) s2 = u'\udb00\udd01' test_lecmp(s, s2) s2 = u'\ud800\ude01' test_lecmp(s, s2) s2 = u'\ud900\ude01' test_lecmp(s, s2) s2 = u'\uda00\ude01' test_lecmp(s, s2) s2 = u'\udb00\ude01' test_lecmp(s, s2) s2 = u'\ud800\udfff' test_lecmp(s, s2) s2 = u'\ud900\udfff' test_lecmp(s, s2) s2 = u'\uda00\udfff' test_lecmp(s, s2) s2 = u'\udb00\udfff' test_lecmp(s, s2) | ef0a032883cadeb0dba7a6ff84025f7133b75b31 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ef0a032883cadeb0dba7a6ff84025f7133b75b31/test_unicode.py |
capability_name = _capability_names[ch] | capability_name = _capability_names.get(ch) if capability_name is None: return 0 | def has_key(ch): if type(ch) == type( '' ): ch = ord(ch) # Figure out the correct capability name for the keycode. capability_name = _capability_names[ch] #Check the current terminal description for that capability; #if present, return true, else return false. if _curses.tigetstr( capability_name ): return 1 else: return 0 | 0ec5288d09e2ac3652c8a88f644417629ed1e759 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0ec5288d09e2ac3652c8a88f644417629ed1e759/has_key.py |
(objects, output_dir) = self._fix_link_args (objects, output_dir, takes_libs=0) | (objects, output_dir) = self._fix_object_args (objects, output_dir) | def create_static_lib (self, objects, output_libname, output_dir=None, debug=0): | e21dabe2e0f93aef55bf6a5352527f4874a31489 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e21dabe2e0f93aef55bf6a5352527f4874a31489/unixccompiler.py |
(objects, output_dir, libraries, library_dirs) = \ self._fix_link_args (objects, output_dir, takes_libs=1, libraries=libraries, library_dirs=library_dirs) | (objects, output_dir) = self._fix_object_args (objects, output_dir) (libraries, library_dirs, runtime_library_dirs) = \ self._fix_lib_args (libraries, library_dirs, runtime_library_dirs) | def link_shared_object (self, objects, output_filename, output_dir=None, libraries=None, library_dirs=None, debug=0, extra_preargs=None, extra_postargs=None): | e21dabe2e0f93aef55bf6a5352527f4874a31489 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e21dabe2e0f93aef55bf6a5352527f4874a31489/unixccompiler.py |
library_dirs, self.runtime_library_dirs, | library_dirs, runtime_library_dirs, | def link_shared_object (self, objects, output_filename, output_dir=None, libraries=None, library_dirs=None, debug=0, extra_preargs=None, extra_postargs=None): | e21dabe2e0f93aef55bf6a5352527f4874a31489 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e21dabe2e0f93aef55bf6a5352527f4874a31489/unixccompiler.py |
(objects, output_dir, libraries, library_dirs) = \ self._fix_link_args (objects, output_dir, takes_libs=1, libraries=libraries, library_dirs=library_dirs) | (objects, output_dir) = self._fix_object_args (objects, output_dir) (libraries, library_dirs, runtime_library_dirs) = \ self._fix_lib_args (libraries, library_dirs, runtime_library_dirs) | def link_executable (self, objects, output_progname, output_dir=None, libraries=None, library_dirs=None, debug=0, extra_preargs=None, extra_postargs=None): (objects, output_dir, libraries, library_dirs) = \ self._fix_link_args (objects, output_dir, takes_libs=1, libraries=libraries, library_dirs=library_dirs) | e21dabe2e0f93aef55bf6a5352527f4874a31489 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e21dabe2e0f93aef55bf6a5352527f4874a31489/unixccompiler.py |
library_dirs, self.runtime_library_dirs, | library_dirs, runtime_library_dirs, | def link_executable (self, objects, output_progname, output_dir=None, libraries=None, library_dirs=None, debug=0, extra_preargs=None, extra_postargs=None): (objects, output_dir, libraries, library_dirs) = \ self._fix_link_args (objects, output_dir, takes_libs=1, libraries=libraries, library_dirs=library_dirs) | e21dabe2e0f93aef55bf6a5352527f4874a31489 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e21dabe2e0f93aef55bf6a5352527f4874a31489/unixccompiler.py |
assert len(a) == 1 | vereq(len(a), 1) | def __init__(self, *a, **kw): if a: assert len(a) == 1 self.state = a[0] if kw: for k, v in kw.items(): self[v] = k | 90c45142d7c8b018d099a832af8c856ef4d9f8c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/90c45142d7c8b018d099a832af8c856ef4d9f8c9/test_descr.py |
assert isinstance(key, type(0)) | verify(isinstance(key, type(0))) | def __setitem__(self, key, value): assert isinstance(key, type(0)) dict.__setitem__(self, key, value) | 90c45142d7c8b018d099a832af8c856ef4d9f8c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/90c45142d7c8b018d099a832af8c856ef4d9f8c9/test_descr.py |
assert x.__class__ == a.__class__ assert sorteditems(x.__dict__) == sorteditems(a.__dict__) assert y.__class__ == b.__class__ assert sorteditems(y.__dict__) == sorteditems(b.__dict__) assert `x` == `a` assert `y` == `b` | vereq(x.__class__, a.__class__) vereq(sorteditems(x.__dict__), sorteditems(a.__dict__)) vereq(y.__class__, b.__class__) vereq(sorteditems(y.__dict__), sorteditems(b.__dict__)) vereq(`x`, `a`) vereq(`y`, `b`) | def __repr__(self): return "C2(%r, %r)<%r>" % (self.a, self.b, int(self)) | 90c45142d7c8b018d099a832af8c856ef4d9f8c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/90c45142d7c8b018d099a832af8c856ef4d9f8c9/test_descr.py |
assert x.__class__ == a.__class__ assert sorteditems(x.__dict__) == sorteditems(a.__dict__) assert y.__class__ == b.__class__ assert sorteditems(y.__dict__) == sorteditems(b.__dict__) assert `x` == `a` assert `y` == `b` | vereq(x.__class__, a.__class__) vereq(sorteditems(x.__dict__), sorteditems(a.__dict__)) vereq(y.__class__, b.__class__) vereq(sorteditems(y.__dict__), sorteditems(b.__dict__)) vereq(`x`, `a`) vereq(`y`, `b`) | def __repr__(self): return "C2(%r, %r)<%r>" % (self.a, self.b, int(self)) | 90c45142d7c8b018d099a832af8c856ef4d9f8c9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/90c45142d7c8b018d099a832af8c856ef4d9f8c9/test_descr.py |
t = _translations.setdefault(key, class_(open(mofile, 'rb'))) | t = _translations.get(key) if t is None: t = _translations.setdefault(key, class_(open(mofile, 'rb'))) | def translation(domain, localedir=None, languages=None, class_=None): if class_ is None: class_ = GNUTranslations mofile = find(domain, localedir, languages) if mofile is None: raise IOError(ENOENT, 'No translation file found for domain', domain) key = os.path.abspath(mofile) # TBD: do we need to worry about the file pointer getting collected? t = _translations.setdefault(key, class_(open(mofile, 'rb'))) return t | 293b03f73f5ad48719a0f07fb45857182dfb1d51 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/293b03f73f5ad48719a0f07fb45857182dfb1d51/gettext.py |
"""Lock file f using lockf, flock, and dot locking.""" | """Lock file f using lockf and dot locking.""" | def _lock_file(f, dotlock=True): """Lock file f using lockf, flock, and dot locking.""" dotlock_done = False try: if fcntl: try: fcntl.lockf(f, fcntl.LOCK_EX | fcntl.LOCK_NB) except IOError, e: if e.errno == errno.EAGAIN: raise ExternalClashError('lockf: lock unavailable: %s' % f.name) else: raise try: fcntl.flock(f, fcntl.LOCK_EX | fcntl.LOCK_NB) except IOError, e: if e.errno == errno.EWOULDBLOCK: raise ExternalClashError('flock: lock unavailable: %s' % f.name) else: raise if dotlock: try: pre_lock = _create_temporary(f.name + '.lock') pre_lock.close() except IOError, e: if e.errno == errno.EACCES: return # Without write access, just skip dotlocking. else: raise try: if hasattr(os, 'link'): os.link(pre_lock.name, f.name + '.lock') dotlock_done = True os.unlink(pre_lock.name) else: os.rename(pre_lock.name, f.name + '.lock') dotlock_done = True except OSError, e: if e.errno == errno.EEXIST: os.remove(pre_lock.name) raise ExternalClashError('dot lock unavailable: %s' % f.name) else: raise except: if fcntl: fcntl.lockf(f, fcntl.LOCK_UN) fcntl.flock(f, fcntl.LOCK_UN) if dotlock_done: os.remove(f.name + '.lock') raise | 557325930ce81804a1dd9c6f0e3babb8673afdd5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/557325930ce81804a1dd9c6f0e3babb8673afdd5/mailbox.py |
f.name) else: raise try: fcntl.flock(f, fcntl.LOCK_EX | fcntl.LOCK_NB) except IOError, e: if e.errno == errno.EWOULDBLOCK: raise ExternalClashError('flock: lock unavailable: %s' % | def _lock_file(f, dotlock=True): """Lock file f using lockf, flock, and dot locking.""" dotlock_done = False try: if fcntl: try: fcntl.lockf(f, fcntl.LOCK_EX | fcntl.LOCK_NB) except IOError, e: if e.errno == errno.EAGAIN: raise ExternalClashError('lockf: lock unavailable: %s' % f.name) else: raise try: fcntl.flock(f, fcntl.LOCK_EX | fcntl.LOCK_NB) except IOError, e: if e.errno == errno.EWOULDBLOCK: raise ExternalClashError('flock: lock unavailable: %s' % f.name) else: raise if dotlock: try: pre_lock = _create_temporary(f.name + '.lock') pre_lock.close() except IOError, e: if e.errno == errno.EACCES: return # Without write access, just skip dotlocking. else: raise try: if hasattr(os, 'link'): os.link(pre_lock.name, f.name + '.lock') dotlock_done = True os.unlink(pre_lock.name) else: os.rename(pre_lock.name, f.name + '.lock') dotlock_done = True except OSError, e: if e.errno == errno.EEXIST: os.remove(pre_lock.name) raise ExternalClashError('dot lock unavailable: %s' % f.name) else: raise except: if fcntl: fcntl.lockf(f, fcntl.LOCK_UN) fcntl.flock(f, fcntl.LOCK_UN) if dotlock_done: os.remove(f.name + '.lock') raise | 557325930ce81804a1dd9c6f0e3babb8673afdd5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/557325930ce81804a1dd9c6f0e3babb8673afdd5/mailbox.py |
|
fcntl.flock(f, fcntl.LOCK_UN) | def _lock_file(f, dotlock=True): """Lock file f using lockf, flock, and dot locking.""" dotlock_done = False try: if fcntl: try: fcntl.lockf(f, fcntl.LOCK_EX | fcntl.LOCK_NB) except IOError, e: if e.errno == errno.EAGAIN: raise ExternalClashError('lockf: lock unavailable: %s' % f.name) else: raise try: fcntl.flock(f, fcntl.LOCK_EX | fcntl.LOCK_NB) except IOError, e: if e.errno == errno.EWOULDBLOCK: raise ExternalClashError('flock: lock unavailable: %s' % f.name) else: raise if dotlock: try: pre_lock = _create_temporary(f.name + '.lock') pre_lock.close() except IOError, e: if e.errno == errno.EACCES: return # Without write access, just skip dotlocking. else: raise try: if hasattr(os, 'link'): os.link(pre_lock.name, f.name + '.lock') dotlock_done = True os.unlink(pre_lock.name) else: os.rename(pre_lock.name, f.name + '.lock') dotlock_done = True except OSError, e: if e.errno == errno.EEXIST: os.remove(pre_lock.name) raise ExternalClashError('dot lock unavailable: %s' % f.name) else: raise except: if fcntl: fcntl.lockf(f, fcntl.LOCK_UN) fcntl.flock(f, fcntl.LOCK_UN) if dotlock_done: os.remove(f.name + '.lock') raise | 557325930ce81804a1dd9c6f0e3babb8673afdd5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/557325930ce81804a1dd9c6f0e3babb8673afdd5/mailbox.py |
|
"""Unlock file f using lockf, flock, and dot locking.""" | """Unlock file f using lockf and dot locking.""" | def _unlock_file(f): """Unlock file f using lockf, flock, and dot locking.""" if fcntl: fcntl.lockf(f, fcntl.LOCK_UN) fcntl.flock(f, fcntl.LOCK_UN) if os.path.exists(f.name + '.lock'): os.remove(f.name + '.lock') | 557325930ce81804a1dd9c6f0e3babb8673afdd5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/557325930ce81804a1dd9c6f0e3babb8673afdd5/mailbox.py |
fcntl.flock(f, fcntl.LOCK_UN) | def _unlock_file(f): """Unlock file f using lockf, flock, and dot locking.""" if fcntl: fcntl.lockf(f, fcntl.LOCK_UN) fcntl.flock(f, fcntl.LOCK_UN) if os.path.exists(f.name + '.lock'): os.remove(f.name + '.lock') | 557325930ce81804a1dd9c6f0e3babb8673afdd5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/557325930ce81804a1dd9c6f0e3babb8673afdd5/mailbox.py |
|
self._name = 'PY_VAR' + `_varnum` | self._name = 'PY_VAR' + repr(_varnum) | def __init__(self, master=None, value=None, name=None): """Construct a variable | 426f4a1c65e59a9b06b42cd37fbe310f46afcee0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/426f4a1c65e59a9b06b42cd37fbe310f46afcee0/Tkinter.py |
eq(folders, map(normF, ['deep', 'deep/f1', 'deep/f2', 'deep/f2/f3', 'inbox', 'wide'])) | tfolders = map(normF, ['deep', 'deep/f1', 'deep/f2', 'deep/f2/f3', 'inbox', 'wide']) tfolders.sort() eq(folders, tfolders) | def test_listfolders(self): mh = getMH() eq = self.assertEquals | dbc363ce353ebd59f04778b045b89442bd59912a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dbc363ce353ebd59f04778b045b89442bd59912a/test_mhlib.py |
self.todo[url].append(origin) | if origin not in self.todo[url]: self.todo[url].append(origin) | def newtodolink(self, url, origin): if self.todo.has_key(url): self.todo[url].append(origin) self.note(3, " Seen todo link %s", url) else: self.todo[url] = [origin] self.note(3, " New todo link %s", url) | dbd5c3e63b639484709f02be311512048f7946e6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dbd5c3e63b639484709f02be311512048f7946e6/webchecker.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.