rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
self.assertEqual(p.stderr.read(), "strawberry")
self.assertEqual(remove_stderr_debug_decorations(p.stderr.read()), "strawberry")
def test_stderr_pipe(self): # stderr redirection p = subprocess.Popen([sys.executable, "-c", 'import sys; sys.stderr.write("strawberry")'], stderr=subprocess.PIPE) self.assertEqual(p.stderr.read(), "strawberry")
05a5f9b6bd5da2d785236574266f2d3a4e794e5d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/05a5f9b6bd5da2d785236574266f2d3a4e794e5d/test_subprocess.py
self.assertEqual(os.read(d, 1024), "strawberry")
self.assertEqual(remove_stderr_debug_decorations(os.read(d, 1024)), "strawberry")
def test_stderr_filedes(self): # stderr is set to open file descriptor tf = tempfile.TemporaryFile() d = tf.fileno() p = subprocess.Popen([sys.executable, "-c", 'import sys; sys.stderr.write("strawberry")'], stderr=d) p.wait() os.lseek(d, 0, 0) self.assertEqual(os.read(d, 1024), "strawberry")
05a5f9b6bd5da2d785236574266f2d3a4e794e5d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/05a5f9b6bd5da2d785236574266f2d3a4e794e5d/test_subprocess.py
self.assertEqual(tf.read(), "strawberry")
self.assertEqual(remove_stderr_debug_decorations(tf.read()), "strawberry")
def test_stderr_fileobj(self): # stderr is set to open file object tf = tempfile.TemporaryFile() p = subprocess.Popen([sys.executable, "-c", 'import sys; sys.stderr.write("strawberry")'], stderr=tf) p.wait() tf.seek(0) self.assertEqual(tf.read(), "strawberry")
05a5f9b6bd5da2d785236574266f2d3a4e794e5d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/05a5f9b6bd5da2d785236574266f2d3a4e794e5d/test_subprocess.py
self.assertEqual(p.stdout.read(), "appleorange")
output = p.stdout.read() stripped = remove_stderr_debug_decorations(output) self.assertEqual(stripped, "appleorange")
def test_stdout_stderr_pipe(self): # capture stdout and stderr to the same pipe p = subprocess.Popen([sys.executable, "-c", 'import sys;' \ 'sys.stdout.write("apple");' \ 'sys.stdout.flush();' \ 'sys.stderr.write("orange")'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) self.assertEqual(p.stdout.read(), "appleorange")
05a5f9b6bd5da2d785236574266f2d3a4e794e5d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/05a5f9b6bd5da2d785236574266f2d3a4e794e5d/test_subprocess.py
self.assertEqual(tf.read(), "appleorange")
output = tf.read() stripped = remove_stderr_debug_decorations(output) self.assertEqual(stripped, "appleorange")
def test_stdout_stderr_file(self): # capture stdout and stderr to the same open file tf = tempfile.TemporaryFile() p = subprocess.Popen([sys.executable, "-c", 'import sys;' \ 'sys.stdout.write("apple");' \ 'sys.stdout.flush();' \ 'sys.stderr.write("orange")'], stdout=tf, stderr=tf) p.wait() tf.seek(0) self.assertEqual(tf.read(), "appleorange")
05a5f9b6bd5da2d785236574266f2d3a4e794e5d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/05a5f9b6bd5da2d785236574266f2d3a4e794e5d/test_subprocess.py
self.assertEqual(stderr, "pineapple")
self.assertEqual(remove_stderr_debug_decorations(stderr), "pineapple")
def test_communicate(self): p = subprocess.Popen([sys.executable, "-c", 'import sys,os;' \ 'sys.stderr.write("pineapple");' \ 'sys.stdout.write(sys.stdin.read())'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) (stdout, stderr) = p.communicate("banana") self.assertEqual(stdout, "banana") self.assertEqual(stderr, "pineapple")
05a5f9b6bd5da2d785236574266f2d3a4e794e5d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/05a5f9b6bd5da2d785236574266f2d3a4e794e5d/test_subprocess.py
self.assertEqual(stderr, "")
self.assertEqual(remove_stderr_debug_decorations(stderr), "")
def test_writes_before_communicate(self): # stdin.write before communicate() p = subprocess.Popen([sys.executable, "-c", 'import sys,os;' \ 'sys.stdout.write(sys.stdin.read())'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) p.stdin.write("banana") (stdout, stderr) = p.communicate("split") self.assertEqual(stdout, "bananasplit") self.assertEqual(stderr, "")
05a5f9b6bd5da2d785236574266f2d3a4e794e5d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/05a5f9b6bd5da2d785236574266f2d3a4e794e5d/test_subprocess.py
UserDict.UserDict.__init__(self, *args, **kw)
def __init__(self, *args, **kw): UserDict.UserDict.__init__(self, *args, **kw) def remove(wr, selfref=ref(self)): self = selfref() if self is not None: del self.data[wr.key] self._remove = remove
d29ba07a5d4470043b148a64d05a5f127d1bd30f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d29ba07a5d4470043b148a64d05a5f127d1bd30f/weakref.py
self.min_readsize = 64
def __init__(self, filename=None, mode=None, compresslevel=9, fileobj=None): """Constructor for the GzipFile class.
94857c88febb30ed9845f0b48036d4df50580a91 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/94857c88febb30ed9845f0b48036d4df50580a91/gzip.py
if size < 0: size = sys.maxint readsize = self.min_readsize else: readsize = size bufs = ""
if size < 0: size = sys.maxint bufs = [] readsize = min(100, size)
def readline(self, size=-1): if size < 0: size = sys.maxint # Line can be as long as maxint readsize = self.min_readsize # Read from file in small chunks else: readsize = size # Only read in as much as specified
94857c88febb30ed9845f0b48036d4df50580a91 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/94857c88febb30ed9845f0b48036d4df50580a91/gzip.py
if size == 0: return bufs
if size == 0: return "".join(bufs)
def readline(self, size=-1): if size < 0: size = sys.maxint # Line can be as long as maxint readsize = self.min_readsize # Read from file in small chunks else: readsize = size # Only read in as much as specified
94857c88febb30ed9845f0b48036d4df50580a91 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/94857c88febb30ed9845f0b48036d4df50580a91/gzip.py
if size is not None: if i==-1 and len(c) > size: i=size-1 elif size <= i: i = size -1
def readline(self, size=-1): if size < 0: size = sys.maxint # Line can be as long as maxint readsize = self.min_readsize # Read from file in small chunks else: readsize = size # Only read in as much as specified
94857c88febb30ed9845f0b48036d4df50580a91 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/94857c88febb30ed9845f0b48036d4df50580a91/gzip.py
if size <= i: i = size - 1 self._unread(c[i+1:]) return bufs + c[:i+1] else: if len(c) > size: i = size - 1 bufs = bufs + c size = size - len(c) readsize = min(size, int(readsize * 1.1)) if readsize > self.min_readsize: self.min_readsize = readsize
bufs.append(c[:i+1]) self._unread(c[i+1:]) return ''.join(bufs) bufs.append(c) size = size - len(c) readsize = min(size, readsize * 2)
def readline(self, size=-1): if size < 0: size = sys.maxint # Line can be as long as maxint readsize = self.min_readsize # Read from file in small chunks else: readsize = size # Only read in as much as specified
94857c88febb30ed9845f0b48036d4df50580a91 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/94857c88febb30ed9845f0b48036d4df50580a91/gzip.py
libraries, extradirs, extraexportsymbols)
libraries, extradirs, extraexportsymbols, outputdir)
def genpluginproject(architecture, module, project=None, projectdir=None, sources=[], sourcedirs=[], libraries=[], extradirs=[], extraexportsymbols=[], outputdir=":::Lib:lib-dynload"): if architecture == "all": # For the time being we generate two project files. Not as nice as # a single multitarget project, but easier to implement for now. genpluginproject("ppc", module, project, projectdir, sources, sourcedirs, libraries, extradirs, extraexportsymbols) genpluginproject("carbon", module, project, projectdir, sources, sourcedirs, libraries, extradirs, extraexportsymbols) return templatename = "template-%s" % architecture targetname = "%s.%s" % (module, architecture) dllname = "%s.%s.slb" % (module, architecture) if not project: if architecture != "ppc": project = "%s.%s.mcp"%(module, architecture) else: project = "%s.mcp"%module if not projectdir: projectdir = PROJECTDIR if not sources: sources = [module + 'module.c'] if not sourcedirs: for moduledir in MODULEDIRS: if '%' in moduledir: moduledir = moduledir % module fn = os.path.join(projectdir, os.path.join(moduledir, sources[0])) if os.path.exists(fn): moduledir, sourcefile = os.path.split(fn) sourcedirs = [relpath(projectdir, moduledir)] sources[0] = sourcefile break else: print "Warning: %s: sourcefile not found: %s"%(module, sources[0]) sourcedirs = [] if architecture == "carbon": prefixname = "mwerks_carbonplugin_config.h" else: prefixname = "mwerks_plugin_config.h" dict = { "sysprefix" : relpath(projectdir, sys.prefix), "sources" : sources, "extrasearchdirs" : sourcedirs + extradirs, "libraries": libraries, "mac_outputdir" : outputdir, "extraexportsymbols" : extraexportsymbols, "mac_targetname" : targetname, "mac_dllname" : dllname, "prefixname" : prefixname, } mkcwproject.mkproject(os.path.join(projectdir, project), module, dict, force=FORCEREBUILD, templatename=templatename)
579f673323af12f7aa8ee186776b73f9976097f9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/579f673323af12f7aa8ee186776b73f9976097f9/genpluginprojects.py
libraries, extradirs, extraexportsymbols)
libraries, extradirs, extraexportsymbols, outputdir)
def genpluginproject(architecture, module, project=None, projectdir=None, sources=[], sourcedirs=[], libraries=[], extradirs=[], extraexportsymbols=[], outputdir=":::Lib:lib-dynload"): if architecture == "all": # For the time being we generate two project files. Not as nice as # a single multitarget project, but easier to implement for now. genpluginproject("ppc", module, project, projectdir, sources, sourcedirs, libraries, extradirs, extraexportsymbols) genpluginproject("carbon", module, project, projectdir, sources, sourcedirs, libraries, extradirs, extraexportsymbols) return templatename = "template-%s" % architecture targetname = "%s.%s" % (module, architecture) dllname = "%s.%s.slb" % (module, architecture) if not project: if architecture != "ppc": project = "%s.%s.mcp"%(module, architecture) else: project = "%s.mcp"%module if not projectdir: projectdir = PROJECTDIR if not sources: sources = [module + 'module.c'] if not sourcedirs: for moduledir in MODULEDIRS: if '%' in moduledir: moduledir = moduledir % module fn = os.path.join(projectdir, os.path.join(moduledir, sources[0])) if os.path.exists(fn): moduledir, sourcefile = os.path.split(fn) sourcedirs = [relpath(projectdir, moduledir)] sources[0] = sourcefile break else: print "Warning: %s: sourcefile not found: %s"%(module, sources[0]) sourcedirs = [] if architecture == "carbon": prefixname = "mwerks_carbonplugin_config.h" else: prefixname = "mwerks_plugin_config.h" dict = { "sysprefix" : relpath(projectdir, sys.prefix), "sources" : sources, "extrasearchdirs" : sourcedirs + extradirs, "libraries": libraries, "mac_outputdir" : outputdir, "extraexportsymbols" : extraexportsymbols, "mac_targetname" : targetname, "mac_dllname" : dllname, "prefixname" : prefixname, } mkcwproject.mkproject(os.path.join(projectdir, project), module, dict, force=FORCEREBUILD, templatename=templatename)
579f673323af12f7aa8ee186776b73f9976097f9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/579f673323af12f7aa8ee186776b73f9976097f9/genpluginprojects.py
genpluginproject("ppc", "Icn", libraries=["IconServicesLib"])
genpluginproject("ppc", "Icn", libraries=["IconServicesLib"], outputdir="::Lib:Carbon")
def genpluginproject(architecture, module, project=None, projectdir=None, sources=[], sourcedirs=[], libraries=[], extradirs=[], extraexportsymbols=[], outputdir=":::Lib:lib-dynload"): if architecture == "all": # For the time being we generate two project files. Not as nice as # a single multitarget project, but easier to implement for now. genpluginproject("ppc", module, project, projectdir, sources, sourcedirs, libraries, extradirs, extraexportsymbols) genpluginproject("carbon", module, project, projectdir, sources, sourcedirs, libraries, extradirs, extraexportsymbols) return templatename = "template-%s" % architecture targetname = "%s.%s" % (module, architecture) dllname = "%s.%s.slb" % (module, architecture) if not project: if architecture != "ppc": project = "%s.%s.mcp"%(module, architecture) else: project = "%s.mcp"%module if not projectdir: projectdir = PROJECTDIR if not sources: sources = [module + 'module.c'] if not sourcedirs: for moduledir in MODULEDIRS: if '%' in moduledir: moduledir = moduledir % module fn = os.path.join(projectdir, os.path.join(moduledir, sources[0])) if os.path.exists(fn): moduledir, sourcefile = os.path.split(fn) sourcedirs = [relpath(projectdir, moduledir)] sources[0] = sourcefile break else: print "Warning: %s: sourcefile not found: %s"%(module, sources[0]) sourcedirs = [] if architecture == "carbon": prefixname = "mwerks_carbonplugin_config.h" else: prefixname = "mwerks_plugin_config.h" dict = { "sysprefix" : relpath(projectdir, sys.prefix), "sources" : sources, "extrasearchdirs" : sourcedirs + extradirs, "libraries": libraries, "mac_outputdir" : outputdir, "extraexportsymbols" : extraexportsymbols, "mac_targetname" : targetname, "mac_dllname" : dllname, "prefixname" : prefixname, } mkcwproject.mkproject(os.path.join(projectdir, project), module, dict, force=FORCEREBUILD, templatename=templatename)
579f673323af12f7aa8ee186776b73f9976097f9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/579f673323af12f7aa8ee186776b73f9976097f9/genpluginprojects.py
print x return x
def __del__(self): x = self.ref() print x return x
5382205e1df06237bd89657d5d238a7c7348d929 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5382205e1df06237bd89657d5d238a7c7348d929/test_descr.py
if (not check_intermediate) or len(plist) < 2:
if not check_intermediate:
def __init__(self, master, name, destroy_physically=1, check_intermediate=1): if check_intermediate: path = master._subwidget_name(name) try: path = path[len(master._w)+1:] plist = path.split('.') except: plist = []
c5c78594932f31d6eaadbf386cb39048eae8f945 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/c5c78594932f31d6eaadbf386cb39048eae8f945/Tix.py
waste = self.rfile.read(1)
if not self.rfile.read(1): break
def run_cgi(self): """Execute a CGI script.""" dir, rest = self.cgi_info i = rest.rfind('?') if i >= 0: rest, query = rest[:i], rest[i+1:] else: query = '' i = rest.find('/') if i >= 0: script, rest = rest[:i], rest[i:] else: script, rest = rest, '' scriptname = dir + '/' + script scriptfile = self.translate_path(scriptname) if not os.path.exists(scriptfile): self.send_error(404, "No such CGI script (%s)" % `scriptname`) return if not os.path.isfile(scriptfile): self.send_error(403, "CGI script is not a plain file (%s)" % `scriptname`) return ispy = self.is_python(scriptname) if not ispy: if not (self.have_fork or self.have_popen2 or self.have_popen3): self.send_error(403, "CGI script is not a Python script (%s)" % `scriptname`) return if not self.is_executable(scriptfile): self.send_error(403, "CGI script is not executable (%s)" % `scriptname`) return
7a40b14b65083150d38e48641c61432e7d35308f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7a40b14b65083150d38e48641c61432e7d35308f/CGIHTTPServer.py
waste = self.rfile._sock.recv(1)
if not self.rfile._sock.recv(1): break
def run_cgi(self): """Execute a CGI script.""" dir, rest = self.cgi_info i = rest.rfind('?') if i >= 0: rest, query = rest[:i], rest[i+1:] else: query = '' i = rest.find('/') if i >= 0: script, rest = rest[:i], rest[i:] else: script, rest = rest, '' scriptname = dir + '/' + script scriptfile = self.translate_path(scriptname) if not os.path.exists(scriptfile): self.send_error(404, "No such CGI script (%s)" % `scriptname`) return if not os.path.isfile(scriptfile): self.send_error(403, "CGI script is not a plain file (%s)" % `scriptname`) return ispy = self.is_python(scriptname) if not ispy: if not (self.have_fork or self.have_popen2 or self.have_popen3): self.send_error(403, "CGI script is not a Python script (%s)" % `scriptname`) return if not self.is_executable(scriptfile): self.send_error(403, "CGI script is not executable (%s)" % `scriptname`) return
7a40b14b65083150d38e48641c61432e7d35308f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7a40b14b65083150d38e48641c61432e7d35308f/CGIHTTPServer.py
if userhome.endswith('/'): i += 1
userhome = userhome.rstrip('/')
def expanduser(path): """Expand ~ and ~user constructions. If user or $HOME is unknown, do nothing.""" if not path.startswith('~'): return path i = path.find('/', 1) if i < 0: i = len(path) if i == 1: if 'HOME' not in os.environ: import pwd userhome = pwd.getpwuid(os.getuid()).pw_dir else: userhome = os.environ['HOME'] else: import pwd try: pwent = pwd.getpwnam(path[1:i]) except KeyError: return path userhome = pwent.pw_dir if userhome.endswith('/'): i += 1 return userhome + path[i:]
e9741338182beae2cc4669963c8ac2a866500c28 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/e9741338182beae2cc4669963c8ac2a866500c28/posixpath.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
d30a0d8c957bf3aa04e2e3f3d6f94ed594592fc4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d30a0d8c957bf3aa04e2e3f3d6f94ed594592fc4/test_mhlib.py
with private names and those defined in other modules. + C.__doc__ for all classes C in M.__dict__.values(), except those with private names and those defined in other modules.
defined in other modules. + C.__doc__ for all classes C in M.__dict__.values(), except those defined in other modules.
def _test(): import doctest, M # replace M with your module's name return doctest.testmod(M) # ditto
69ea6631db2503d0aa159a5cd267f7e1a492a14a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/69ea6631db2503d0aa159a5cd267f7e1a492a14a/doctest.py
their contained methods and nested classes. Private names reached from M's globals are skipped, but all names reached from M.__test__ are searched. By default, a name is considered to be private if it begins with an underscore (like "_my_func") but doesn't both begin and end with (at least) two underscores (like "__init__"). You can change the default by passing your own "isprivate" function to testmod.
their contained methods and nested classes. All names reached from M.__test__ are searched. Optionally, functions with private names can be skipped (unless listed in M.__test__) by supplying a function to the "isprivate" argument that will identify private functions. For convenience, one such function is supplied. docttest.is_private considers a name to be private if it begins with an underscore (like "_my_func") but doesn't both begin and end with (at least) two underscores (like "__init__"). By supplying this function or your own "isprivate" function to testmod, the behavior can be customized.
def _test(): import doctest, M # replace M with your module's name return doctest.testmod(M) # ditto
69ea6631db2503d0aa159a5cd267f7e1a492a14a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/69ea6631db2503d0aa159a5cd267f7e1a492a14a/doctest.py
whether a name is private. The default function is doctest.is_private; see its docs for details.
whether a name is private. The default function is to assume that no functions are private. The "isprivate" arg may be set to doctest.is_private in order to skip over functions marked as private using an underscore naming convention; see its docs for details.
def __init__(self, mod=None, globs=None, verbose=None, isprivate=None, optionflags=0): """mod=None, globs=None, verbose=None, isprivate=None,
69ea6631db2503d0aa159a5cd267f7e1a492a14a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/69ea6631db2503d0aa159a5cd267f7e1a492a14a/doctest.py
isprivate = is_private
isprivate = lambda prefix, base: 0
def __init__(self, mod=None, globs=None, verbose=None, isprivate=None, optionflags=0): """mod=None, globs=None, verbose=None, isprivate=None,
69ea6631db2503d0aa159a5cd267f7e1a492a14a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/69ea6631db2503d0aa159a5cd267f7e1a492a14a/doctest.py
>>> t = Tester(globs={}, verbose=0)
>>> t = Tester(globs={}, verbose=0, isprivate=is_private)
... def bar(self):
69ea6631db2503d0aa159a5cd267f7e1a492a14a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/69ea6631db2503d0aa159a5cd267f7e1a492a14a/doctest.py
Again, but with a custom isprivate function allowing _f: >>> t = Tester(globs={}, verbose=0, isprivate=lambda x,y: 0)
Again, but with the default isprivate function allowing _f: >>> t = Tester(globs={}, verbose=0)
... def bar(self):
69ea6631db2503d0aa159a5cd267f7e1a492a14a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/69ea6631db2503d0aa159a5cd267f7e1a492a14a/doctest.py
>>> t = Tester(globs={}, verbose=0, isprivate=lambda x,y: 0)
>>> t = Tester(globs={}, verbose=0)
... def bar(self):
69ea6631db2503d0aa159a5cd267f7e1a492a14a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/69ea6631db2503d0aa159a5cd267f7e1a492a14a/doctest.py
>>> testmod(m1)
>>> testmod(m1, isprivate=is_private)
... def bar(self):
69ea6631db2503d0aa159a5cd267f7e1a492a14a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/69ea6631db2503d0aa159a5cd267f7e1a492a14a/doctest.py
with m.__doc__. Private names are skipped.
with m.__doc__. Unless isprivate is specified, private names are not skipped.
def testmod(m=None, name=None, globs=None, verbose=None, isprivate=None, report=True, optionflags=0): """m=None, name=None, globs=None, verbose=None, isprivate=None, report=True, optionflags=0 Test examples in docstrings in functions and classes reachable from module m (or the current module if m is not supplied), starting with m.__doc__. Private names are skipped. Also test examples reachable from dict m.__test__ if it exists and is not None. m.__dict__ maps names to functions, classes and strings; function and class docstrings are tested even if the name is private; strings are tested directly, as if they were docstrings. Return (#failures, #tests). See doctest.__doc__ for an overview. Optional keyword arg "name" gives the name of the module; by default use m.__name__. Optional keyword arg "globs" gives a dict to be used as the globals when executing examples; by default, use m.__dict__. A copy of this dict is actually used for each docstring, so that each docstring's examples start with a clean slate. Optional keyword arg "verbose" prints lots of stuff if true, prints only failures if false; by default, it's true iff "-v" is in sys.argv. Optional keyword arg "isprivate" specifies a function used to determine whether a name is private. The default function is doctest.is_private; see its docs for details. Optional keyword arg "report" prints a summary at the end when true, else prints nothing at the end. In verbose mode, the summary is detailed, else very brief (in fact, empty if all tests passed). Optional keyword arg "optionflags" or's together module constants, and defaults to 0. This is new in 2.3. Possible values: DONT_ACCEPT_TRUE_FOR_1 By default, if an expected output block contains just "1", an actual output block containing just "True" is considered to be a match, and similarly for "0" versus "False". When DONT_ACCEPT_TRUE_FOR_1 is specified, neither substitution is allowed. Advanced tomfoolery: testmod runs methods of a local instance of class doctest.Tester, then merges the results into (or creates) global Tester instance doctest.master. Methods of doctest.master can be called directly too, if you want to do something unusual. Passing report=0 to testmod is especially useful then, to delay displaying a summary. Invoke doctest.master.summarize(verbose) when you're done fiddling. """ global master if m is None: import sys # DWA - m will still be None if this wasn't invoked from the command # line, in which case the following TypeError is about as good an error # as we should expect m = sys.modules.get('__main__') if not _ismodule(m): raise TypeError("testmod: module required; " + `m`) if name is None: name = m.__name__ tester = Tester(m, globs=globs, verbose=verbose, isprivate=isprivate, optionflags=optionflags) failures, tries = tester.rundoc(m, name) f, t = tester.rundict(m.__dict__, name, m) failures += f tries += t if hasattr(m, "__test__"): testdict = m.__test__ if testdict: if not hasattr(testdict, "items"): raise TypeError("testmod: module.__test__ must support " ".items(); " + `testdict`) f, t = tester.run__test__(testdict, name + ".__test__") failures += f tries += t if report: tester.summarize() if master is None: master = tester else: master.merge(tester) return failures, tries
69ea6631db2503d0aa159a5cd267f7e1a492a14a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/69ea6631db2503d0aa159a5cd267f7e1a492a14a/doctest.py
doctest.is_private; see its docs for details.
treat all functions as public. Optionally, "isprivate" can be set to doctest.is_private to skip over functions marked as private using the underscore naming convention; see its docs for details.
def testmod(m=None, name=None, globs=None, verbose=None, isprivate=None, report=True, optionflags=0): """m=None, name=None, globs=None, verbose=None, isprivate=None, report=True, optionflags=0 Test examples in docstrings in functions and classes reachable from module m (or the current module if m is not supplied), starting with m.__doc__. Private names are skipped. Also test examples reachable from dict m.__test__ if it exists and is not None. m.__dict__ maps names to functions, classes and strings; function and class docstrings are tested even if the name is private; strings are tested directly, as if they were docstrings. Return (#failures, #tests). See doctest.__doc__ for an overview. Optional keyword arg "name" gives the name of the module; by default use m.__name__. Optional keyword arg "globs" gives a dict to be used as the globals when executing examples; by default, use m.__dict__. A copy of this dict is actually used for each docstring, so that each docstring's examples start with a clean slate. Optional keyword arg "verbose" prints lots of stuff if true, prints only failures if false; by default, it's true iff "-v" is in sys.argv. Optional keyword arg "isprivate" specifies a function used to determine whether a name is private. The default function is doctest.is_private; see its docs for details. Optional keyword arg "report" prints a summary at the end when true, else prints nothing at the end. In verbose mode, the summary is detailed, else very brief (in fact, empty if all tests passed). Optional keyword arg "optionflags" or's together module constants, and defaults to 0. This is new in 2.3. Possible values: DONT_ACCEPT_TRUE_FOR_1 By default, if an expected output block contains just "1", an actual output block containing just "True" is considered to be a match, and similarly for "0" versus "False". When DONT_ACCEPT_TRUE_FOR_1 is specified, neither substitution is allowed. Advanced tomfoolery: testmod runs methods of a local instance of class doctest.Tester, then merges the results into (or creates) global Tester instance doctest.master. Methods of doctest.master can be called directly too, if you want to do something unusual. Passing report=0 to testmod is especially useful then, to delay displaying a summary. Invoke doctest.master.summarize(verbose) when you're done fiddling. """ global master if m is None: import sys # DWA - m will still be None if this wasn't invoked from the command # line, in which case the following TypeError is about as good an error # as we should expect m = sys.modules.get('__main__') if not _ismodule(m): raise TypeError("testmod: module required; " + `m`) if name is None: name = m.__name__ tester = Tester(m, globs=globs, verbose=verbose, isprivate=isprivate, optionflags=optionflags) failures, tries = tester.rundoc(m, name) f, t = tester.rundict(m.__dict__, name, m) failures += f tries += t if hasattr(m, "__test__"): testdict = m.__test__ if testdict: if not hasattr(testdict, "items"): raise TypeError("testmod: module.__test__ must support " ".items(); " + `testdict`) f, t = tester.run__test__(testdict, name + ".__test__") failures += f tries += t if report: tester.summarize() if master is None: master = tester else: master.merge(tester) return failures, tries
69ea6631db2503d0aa159a5cd267f7e1a492a14a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/69ea6631db2503d0aa159a5cd267f7e1a492a14a/doctest.py
c, noise = noise[0], noise[1:] res = res + c return res + noise + line res = "" for line in map(addnoise, lines): b = binascii.a2b_base64(line) res = res + b verify(res == testdata)
self.fail("binascii.a2b_qp(**{1:1}) didn't raise TypeError") self.assertEqual(binascii.a2b_qp("= "), "") self.assertEqual(binascii.a2b_qp("=="), "=") self.assertEqual(binascii.a2b_qp("=AX"), "=AX") self.assertRaises(TypeError, binascii.b2a_qp, foo="bar") self.assertEqual(binascii.a2b_qp("=00\r\n=00"), "\x00\r\n\x00") self.assertEqual( binascii.b2a_qp("\xff\r\n\xff\n\xff"), "=FF\r\n=FF\r\n=FF" ) self.assertEqual( binascii.b2a_qp("0"*75+"\xff\r\n\xff\r\n\xff"), "0"*75+"=\r\n=FF\r\n=FF\r\n=FF" )
def addnoise(line): noise = fillers ratio = len(line) // len(noise) res = "" while line and noise: if len(line) // len(noise) > ratio: c, line = line[0], line[1:] else: c, noise = noise[0], noise[1:] res = res + c return res + noise + line
46cb568c7f48672eda08b3d15f7013b06a02b01f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/46cb568c7f48672eda08b3d15f7013b06a02b01f/test_binascii.py
verify(binascii.a2b_base64(fillers) == '')
def test_main(): test_support.run_unittest(BinASCIITest)
def addnoise(line): noise = fillers ratio = len(line) // len(noise) res = "" while line and noise: if len(line) // len(noise) > ratio: c, line = line[0], line[1:] else: c, noise = noise[0], noise[1:] res = res + c return res + noise + line
46cb568c7f48672eda08b3d15f7013b06a02b01f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/46cb568c7f48672eda08b3d15f7013b06a02b01f/test_binascii.py
print "uu test" MAX_UU = 45 lines = [] for i in range(0, len(testdata), MAX_UU): b = testdata[i:i+MAX_UU] a = binascii.b2a_uu(b) lines.append(a) print a, res = "" for line in lines: b = binascii.a2b_uu(line) res = res + b verify(res == testdata) crc = binascii.crc32("Test the CRC-32 of") crc = binascii.crc32(" this string.", crc) if crc != 1571220330: print "binascii.crc32() failed." s = '{s\005\000\000\000worldi\002\000\000\000s\005\000\000\000helloi\001\000\000\0000' t = binascii.b2a_hex(s) u = binascii.a2b_hex(t) if s != u: print 'binascii hexlification failed' try: binascii.a2b_hex(t[:-1]) except TypeError: pass else: print 'expected TypeError not raised' try: binascii.a2b_hex(t[:-1] + 'q') except TypeError: pass else: print 'expected TypeError not raised' if have_unicode: verify(binascii.hexlify(unicode('a', 'ascii')) == '61', "hexlify failed for Unicode") try: binascii.a2b_qp("", **{1:1}) except TypeError: pass else: raise TestFailed, "binascii..a2b_qp(**{1:1}) didn't raise TypeError"
if __name__ == "__main__": test_main()
def addnoise(line): noise = fillers ratio = len(line) // len(noise) res = "" while line and noise: if len(line) // len(noise) > ratio: c, line = line[0], line[1:] else: c, noise = noise[0], noise[1:] res = res + c return res + noise + line
46cb568c7f48672eda08b3d15f7013b06a02b01f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/46cb568c7f48672eda08b3d15f7013b06a02b01f/test_binascii.py
def small(text): return '<small>' + text + '</small>' def strong(text): return '<strong>' + text + '</strong>' def grey(text): return '<font color="
def small(text): if text: return '<small>' + text + '</small>' else: return '' def strong(text): if text: return '<strong>' + text + '</strong>' else: return '' def grey(text): if text: return '<font color=" else: return ''
def small(text): return '<small>' + text + '</small>'
d73dbf6662d0071e92013361f41cd3db0b0ca4b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d73dbf6662d0071e92013361f41cd3db0b0ca4b2/cgitb.py
'<big><big><strong>%s</strong></big></big>' % str(etype),
'<big><big>%s</big></big>' % strong(pydoc.html.escape(str(etype))),
def html((etype, evalue, etb), context=5): """Return a nice HTML document describing a given traceback.""" import os, types, time, traceback, linecache, inspect, pydoc if type(etype) is types.ClassType: etype = etype.__name__ pyver = 'Python ' + sys.version.split()[0] + ': ' + sys.executable date = time.ctime(time.time()) head = '<body bgcolor="#f0f0f8">' + pydoc.html.heading( '<big><big><strong>%s</strong></big></big>' % str(etype), '#ffffff', '#6622aa', pyver + '<br>' + date) + '''
d73dbf6662d0071e92013361f41cd3db0b0ca4b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d73dbf6662d0071e92013361f41cd3db0b0ca4b2/cgitb.py
function calls leading up to the error, in the order they occurred.'''
function calls leading up to the error, in the order they occurred.</p>'''
def html((etype, evalue, etb), context=5): """Return a nice HTML document describing a given traceback.""" import os, types, time, traceback, linecache, inspect, pydoc if type(etype) is types.ClassType: etype = etype.__name__ pyver = 'Python ' + sys.version.split()[0] + ': ' + sys.executable date = time.ctime(time.time()) head = '<body bgcolor="#f0f0f8">' + pydoc.html.heading( '<big><big><strong>%s</strong></big></big>' % str(etype), '#ffffff', '#6622aa', pyver + '<br>' + date) + '''
d73dbf6662d0071e92013361f41cd3db0b0ca4b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d73dbf6662d0071e92013361f41cd3db0b0ca4b2/cgitb.py
frames.append('''<p>
frames.append('''
def reader(lnum=[lnum]): highlight[lnum[0]] = 1 try: return linecache.getline(file, lnum[0]) finally: lnum[0] += 1
d73dbf6662d0071e92013361f41cd3db0b0ca4b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d73dbf6662d0071e92013361f41cd3db0b0ca4b2/cgitb.py
suffix_map = db.encodings_map
suffix_map = db.suffix_map
def init(files=None): global guess_extension, guess_type global suffix_map, types_map, encodings_map global inited inited = 1 db = MimeTypes() if files is None: files = knownfiles for file in files: if os.path.isfile(file): db.readfp(open(file)) encodings_map = db.encodings_map suffix_map = db.encodings_map types_map = db.types_map guess_extension = db.guess_extension guess_type = db.guess_type
807d40861edf883a7f5bdd83bb6dc3b92e639f62 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/807d40861edf883a7f5bdd83bb6dc3b92e639f62/mimetypes.py
def main(): input = "MacTextEditor.h" output = SHORT + "gen.py" defsoutput = TOOLBOXDIR + LONG + ".py" scanner = MyScanner(input, output, defsoutput) scanner.scan() scanner.gentypetest(SHORT+"typetest.py") scanner.close() print "=== Done scanning and generating, now importing the generated code... ===" exec "import " + SHORT + "support" print "=== Done. It's up to you to compile it now! ==="
MODNAME = 'Mlte'
def main(): input = "MacTextEditor.h" output = SHORT + "gen.py" defsoutput = TOOLBOXDIR + LONG + ".py" scanner = MyScanner(input, output, defsoutput) scanner.scan() scanner.gentypetest(SHORT+"typetest.py") scanner.close() print "=== Done scanning and generating, now importing the generated code... ===" exec "import " + SHORT + "support" print "=== Done. It's up to you to compile it now! ==="
7cb7b5d4ad4ecc45411476c23090ffddbfcfa35e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7cb7b5d4ad4ecc45411476c23090ffddbfcfa35e/mltesupport.py
class MyScanner(Scanner_OSX):
MODPREFIX = MODNAME INPUTFILE = string.lower(MODPREFIX) + 'gen.py' OUTPUTFILE = MODNAME + "module.c"
def main(): input = "MacTextEditor.h" output = SHORT + "gen.py" defsoutput = TOOLBOXDIR + LONG + ".py" scanner = MyScanner(input, output, defsoutput) scanner.scan() scanner.gentypetest(SHORT+"typetest.py") scanner.close() print "=== Done scanning and generating, now importing the generated code... ===" exec "import " + SHORT + "support" print "=== Done. It's up to you to compile it now! ==="
7cb7b5d4ad4ecc45411476c23090ffddbfcfa35e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7cb7b5d4ad4ecc45411476c23090ffddbfcfa35e/mltesupport.py
def destination(self, type, name, arglist): classname = "Function" listname = "functions" if arglist: t, n, m = arglist[0] if t in OBJECTS and m == "InMode": classname = "Method" listname = t + "_methods" return classname, listname
from macsupport import *
def destination(self, type, name, arglist): classname = "Function" listname = "functions" if arglist: t, n, m = arglist[0] if t in OBJECTS and m == "InMode": classname = "Method" listname = t + "_methods" return classname, listname
7cb7b5d4ad4ecc45411476c23090ffddbfcfa35e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7cb7b5d4ad4ecc45411476c23090ffddbfcfa35e/mltesupport.py
def writeinitialdefs(self): self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
def writeinitialdefs(self): self.defsfile.write("def FOUR_CHAR_CODE(x): return x\n")
7cb7b5d4ad4ecc45411476c23090ffddbfcfa35e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7cb7b5d4ad4ecc45411476c23090ffddbfcfa35e/mltesupport.py
def makeblacklistnames(self): return [ ]
includestuff = includestuff + """
def makeblacklistnames(self): return [ ]
7cb7b5d4ad4ecc45411476c23090ffddbfcfa35e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7cb7b5d4ad4ecc45411476c23090ffddbfcfa35e/mltesupport.py
def makegreylist(self): return []
/* For now we declare them forward here. They'll go to mactoolbox later */ staticforward PyObject *TXNObj_New(TXNObject); staticforward int TXNObj_Convert(PyObject *, TXNObject *); staticforward PyObject *TXNFontMenuObj_New(TXNFontMenuObject); staticforward int TXNFontMenuObj_Convert(PyObject *, TXNFontMenuObject *);
def makegreylist(self): return []
7cb7b5d4ad4ecc45411476c23090ffddbfcfa35e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7cb7b5d4ad4ecc45411476c23090ffddbfcfa35e/mltesupport.py
def makeblacklisttypes(self): return [ "TXNTab", "TXNMargins", "TXNControlData", "TXNATSUIFeatures", "TXNATSUIVariations", "TXNAttributeData", "TXNTypeAttributes", "TXNMatchTextRecord", "TXNBackground", "UniChar", "TXNFindUPP", ]
// ADD declarations //extern PyObject *_CFTypeRefObj_New(CFTypeRef); //extern int _CFTypeRefObj_Convert(PyObject *, CFTypeRef *);
def makeblacklisttypes(self): return [ "TXNTab", # TBD "TXNMargins", # TBD "TXNControlData", #TBD "TXNATSUIFeatures", #TBD "TXNATSUIVariations", #TBD "TXNAttributeData", #TBD "TXNTypeAttributes", #TBD "TXNMatchTextRecord", #TBD "TXNBackground", #TBD "UniChar", #TBD "TXNFindUPP", ]
7cb7b5d4ad4ecc45411476c23090ffddbfcfa35e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7cb7b5d4ad4ecc45411476c23090ffddbfcfa35e/mltesupport.py
def makerepairinstructions(self): return [ ([("void", "*", "OutMode"), ("ByteCount", "*", "InMode")], [("MlteInBuffer", "*", "InMode")]), ] if __name__ == "__main__": main()
// // /* ** Parse/generate ADD records */ """ initstuff = initstuff + """ // PyMac_INIT_TOOLBOX_OBJECT_NEW(xxxx); """ TXNObject = OpaqueByValueType("TXNObject", "TXNObj") TXNFontMenuObject = OpaqueByValueType("TXNFontMenuObject", "TXNFontMenuObj") TXNFrameID = Type("TXNFrameID", "l") TXNVersionValue = Type("TXNVersionValue", "l") TXNFeatureBits = Type("TXNFeatureBits", "l") TXNInitOptions = Type("TXNInitOptions", "l") TXNFrameOptions = Type("TXNFrameOptions", "l") TXNContinuousFlags = Type("TXNContinuousFlags", "l") TXNMatchOptions = Type("TXNMatchOptions", "l") TXNFileType = OSTypeType("TXNFileType") TXNFrameType = Type("TXNFrameType", "l") TXNDataType = OSTypeType("TXNDataType") TXNControlTag = OSTypeType("TXNControlTag") TXNActionKey = Type("TXNActionKey", "l") TXNTabType = Type("TXNTabType", "b") TXNScrollBarState = Type("TXNScrollBarState", "l") TXNOffset = Type("TXNOffset", "l") TXNObjectRefcon = FakeType("(TXNObjectRefcon)0") TXNErrors = OSErrType("TXNErrors", "l") TXNTypeRunAttributes = OSTypeType("TXNTypeRunAttributes") TXNTypeRunAttributeSizes = Type("TXNTypeRunAttributeSizes", "l") TXNPermanentTextEncodingType = Type("TXNPermanentTextEncodingType", "l") TXTNTag = OSTypeType("TXTNTag") TXNBackgroundType = Type("TXNBackgroundType", "l") DragReference = OpaqueByValueType("DragReference", "DragObj") DragTrackingMessage = Type("DragTrackingMessage", "h") RgnHandle = OpaqueByValueType("RgnHandle", "ResObj") GWorldPtr = OpaqueByValueType("GWorldPtr", "GWorldObj") MlteInBuffer = VarInputBufferType('void *', 'ByteCount', 'l') execfile("mltetypetest.py") class TXNObjDefinition(GlobalObjectDefinition): def outputCheckNewArg(self): Output("if (itself == NULL) return PyMac_Error(resNotFound);") class TXNFontMenuObjDefinition(GlobalObjectDefinition): def outputCheckNewArg(self): Output("if (itself == NULL) return PyMac_Error(resNotFound);") module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff) TXNObject_object = TXNObjDefinition("TXNObject", "TXNObj", "TXNObject") TXNFontMenuObject_object = TXNFontMenuObjDefinition("TXNFontMenuObject", "TXNFontMenuObj", "TXNFontMenuObject") module.addobject(TXNObject_object) module.addobject(TXNFontMenuObject_object) Function = OSErrWeakLinkFunctionGenerator Method = OSErrWeakLinkMethodGenerator functions = [] TXNObject_methods = [] TXNFontMenuObject_methods = [] execfile(INPUTFILE) for f in functions: module.add(f) for f in TXNObject_methods: TXNObject_object.add(f) for f in TXNFontMenuObject_methods: TXNFontMenuObject_object.add(f) SetOutputFileName(OUTPUTFILE) module.generate()
def makerepairinstructions(self): return [ ([("void", "*", "OutMode"), ("ByteCount", "*", "InMode")], [("MlteInBuffer", "*", "InMode")]), ]
7cb7b5d4ad4ecc45411476c23090ffddbfcfa35e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/7cb7b5d4ad4ecc45411476c23090ffddbfcfa35e/mltesupport.py
cmdclass = {'build_ext':PyBuildExt},
cmdclass = {'build_ext':PyBuildExt, 'install':PyBuildInstall},
def main(): setup(name = 'Python standard library', version = '%d.%d' % sys.version_info[:2], cmdclass = {'build_ext':PyBuildExt}, # The struct module is defined here, because build_ext won't be # called unless there's at least one extension module defined. ext_modules=[Extension('struct', ['structmodule.c'])], # Scripts to install scripts = ['Tools/scripts/pydoc'] )
11ebaff9a39bcd9ea5f9e5ba6024eb948ceecb48 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/11ebaff9a39bcd9ea5f9e5ba6024eb948ceecb48/setup.py
'__module__', '__name__']: return 0
'__module__', '__name__', '__slots__']: return 0
def visiblename(name, all=None): """Decide whether to show documentation on a variable.""" # Certain special names are redundant. if name in ['__builtins__', '__doc__', '__file__', '__path__', '__module__', '__name__']: return 0 # Private names are hidden, but special names are displayed. if name.startswith('__') and name.endswith('__'): return 1 if all is not None: # only document that which the programmer exported in __all__ return name in all else: return not name.startswith('_')
d11e9bddf58ab4c0de85be5a7c233b9b332feaad /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d11e9bddf58ab4c0de85be5a7c233b9b332feaad/pydoc.py
def spillproperties(msg, attrs, predicate):
def spilldescriptors(msg, attrs, predicate):
def spillproperties(msg, attrs, predicate): ok, attrs = _split_list(attrs, predicate) if ok: hr.maybe() push(msg) for name, kind, homecls, value in ok: push(self._docproperty(name, value, mod)) return attrs
d11e9bddf58ab4c0de85be5a7c233b9b332feaad /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d11e9bddf58ab4c0de85be5a7c233b9b332feaad/pydoc.py
push(self._docproperty(name, value, mod))
push(self._docdescriptor(name, value, mod))
def spillproperties(msg, attrs, predicate): ok, attrs = _split_list(attrs, predicate) if ok: hr.maybe() push(msg) for name, kind, homecls, value in ok: push(self._docproperty(name, value, mod)) return attrs
d11e9bddf58ab4c0de85be5a7c233b9b332feaad /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d11e9bddf58ab4c0de85be5a7c233b9b332feaad/pydoc.py
inspect.classify_class_attrs(object))
classify_class_attrs(object))
def spilldata(msg, attrs, predicate): ok, attrs = _split_list(attrs, predicate) if ok: hr.maybe() push(msg) for name, kind, homecls, value in ok: base = self.docother(getattr(object, name), name, mod) if callable(value) or inspect.isdatadescriptor(value): doc = getattr(value, "__doc__", None) else: doc = None if doc is None: push('<dl><dt>%s</dl>\n' % base) else: doc = self.markup(getdoc(value), self.preformat, funcs, classes, mdict) doc = '<dd><tt>%s</tt>' % doc push('<dl><dt>%s%s</dl>\n' % (base, doc)) push('\n') return attrs
d11e9bddf58ab4c0de85be5a7c233b9b332feaad /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d11e9bddf58ab4c0de85be5a7c233b9b332feaad/pydoc.py
attrs = spillproperties('Properties %s' % tag, attrs, lambda t: t[1] == 'property')
attrs = spilldescriptors('Data descriptors %s' % tag, attrs, lambda t: t[1] == 'data descriptor')
def spilldata(msg, attrs, predicate): ok, attrs = _split_list(attrs, predicate) if ok: hr.maybe() push(msg) for name, kind, homecls, value in ok: base = self.docother(getattr(object, name), name, mod) if callable(value) or inspect.isdatadescriptor(value): doc = getattr(value, "__doc__", None) else: doc = None if doc is None: push('<dl><dt>%s</dl>\n' % base) else: doc = self.markup(getdoc(value), self.preformat, funcs, classes, mdict) doc = '<dd><tt>%s</tt>' % doc push('<dl><dt>%s%s</dl>\n' % (base, doc)) push('\n') return attrs
d11e9bddf58ab4c0de85be5a7c233b9b332feaad /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d11e9bddf58ab4c0de85be5a7c233b9b332feaad/pydoc.py
def _docproperty(self, name, value, mod):
def _docdescriptor(self, name, value, mod):
def _docproperty(self, name, value, mod): results = [] push = results.append
d11e9bddf58ab4c0de85be5a7c233b9b332feaad /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d11e9bddf58ab4c0de85be5a7c233b9b332feaad/pydoc.py
for attr, tag in [('fget', '<em>get</em>'), ('fset', '<em>set</em>'), ('fdel', '<em>delete</em>')]: func = getattr(value, attr) if func is not None: base = self.document(func, tag, mod) push('<dd>%s</dd>\n' % base)
def _docproperty(self, name, value, mod): results = [] push = results.append
d11e9bddf58ab4c0de85be5a7c233b9b332feaad /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d11e9bddf58ab4c0de85be5a7c233b9b332feaad/pydoc.py
return self._docproperty(name, object, mod)
return self._docdescriptor(name, object, mod)
def docproperty(self, object, name=None, mod=None, cl=None): """Produce html documentation for a property.""" return self._docproperty(name, object, mod)
d11e9bddf58ab4c0de85be5a7c233b9b332feaad /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d11e9bddf58ab4c0de85be5a7c233b9b332feaad/pydoc.py
def spillproperties(msg, attrs, predicate):
def spilldescriptors(msg, attrs, predicate):
def spillproperties(msg, attrs, predicate): ok, attrs = _split_list(attrs, predicate) if ok: hr.maybe() push(msg) for name, kind, homecls, value in ok: push(self._docproperty(name, value, mod)) return attrs
d11e9bddf58ab4c0de85be5a7c233b9b332feaad /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d11e9bddf58ab4c0de85be5a7c233b9b332feaad/pydoc.py
push(self._docproperty(name, value, mod))
push(self._docdescriptor(name, value, mod))
def spillproperties(msg, attrs, predicate): ok, attrs = _split_list(attrs, predicate) if ok: hr.maybe() push(msg) for name, kind, homecls, value in ok: push(self._docproperty(name, value, mod)) return attrs
d11e9bddf58ab4c0de85be5a7c233b9b332feaad /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d11e9bddf58ab4c0de85be5a7c233b9b332feaad/pydoc.py
inspect.classify_class_attrs(object))
classify_class_attrs(object))
def spilldata(msg, attrs, predicate): ok, attrs = _split_list(attrs, predicate) if ok: hr.maybe() push(msg) for name, kind, homecls, value in ok: if callable(value) or inspect.isdatadescriptor(value): doc = getattr(value, "__doc__", None) else: doc = None push(self.docother(getattr(object, name), name, mod, 70, doc) + '\n') return attrs
d11e9bddf58ab4c0de85be5a7c233b9b332feaad /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d11e9bddf58ab4c0de85be5a7c233b9b332feaad/pydoc.py
attrs = spillproperties("Properties %s:\n" % tag, attrs, lambda t: t[1] == 'property')
attrs = spilldescriptors("Data descriptors %s:\n" % tag, attrs, lambda t: t[1] == 'data descriptor')
def spilldata(msg, attrs, predicate): ok, attrs = _split_list(attrs, predicate) if ok: hr.maybe() push(msg) for name, kind, homecls, value in ok: if callable(value) or inspect.isdatadescriptor(value): doc = getattr(value, "__doc__", None) else: doc = None push(self.docother(getattr(object, name), name, mod, 70, doc) + '\n') return attrs
d11e9bddf58ab4c0de85be5a7c233b9b332feaad /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d11e9bddf58ab4c0de85be5a7c233b9b332feaad/pydoc.py
def _docproperty(self, name, value, mod):
def _docdescriptor(self, name, value, mod):
def _docproperty(self, name, value, mod): results = [] push = results.append
d11e9bddf58ab4c0de85be5a7c233b9b332feaad /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d11e9bddf58ab4c0de85be5a7c233b9b332feaad/pydoc.py
push(name) need_blank_after_doc = 0
push(self.bold(name)) push('\n')
def _docproperty(self, name, value, mod): results = [] push = results.append
d11e9bddf58ab4c0de85be5a7c233b9b332feaad /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d11e9bddf58ab4c0de85be5a7c233b9b332feaad/pydoc.py
need_blank_after_doc = 1 for attr, tag in [('fget', '<get>'), ('fset', '<set>'), ('fdel', '<delete>')]: func = getattr(value, attr) if func is not None: if need_blank_after_doc: push('') need_blank_after_doc = 0 base = self.document(func, tag, mod) push(self.indent(base)) return '\n'.join(results)
push('\n') return ''.join(results)
def _docproperty(self, name, value, mod): results = [] push = results.append
d11e9bddf58ab4c0de85be5a7c233b9b332feaad /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d11e9bddf58ab4c0de85be5a7c233b9b332feaad/pydoc.py
return self._docproperty(name, object, mod)
return self._docdescriptor(name, object, mod)
def docproperty(self, object, name=None, mod=None, cl=None): """Produce text documentation for a property.""" return self._docproperty(name, object, mod)
d11e9bddf58ab4c0de85be5a7c233b9b332feaad /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/d11e9bddf58ab4c0de85be5a7c233b9b332feaad/pydoc.py
while not is_all_white(line):
while lineno > 0 and not is_all_white(line):
def find_paragraph(text, mark): lineno, col = map(int, string.split(mark, ".")) line = text.get("%d.0" % lineno, "%d.0 lineend" % lineno) while is_all_white(line): lineno = lineno + 1 line = text.get("%d.0" % lineno, "%d.0 lineend" % lineno) first_lineno = lineno while not is_all_white(line): lineno = lineno + 1 line = text.get("%d.0" % lineno, "%d.0 lineend" % lineno) last = "%d.0" % lineno # Search back to beginning of paragraph lineno = first_lineno - 1 line = text.get("%d.0" % lineno, "%d.0 lineend" % lineno) while not is_all_white(line): lineno = lineno - 1 line = text.get("%d.0" % lineno, "%d.0 lineend" % lineno) first = "%d.0" % (lineno+1) return first, last, text.get(first, last)
5c7ab29b14b7b83a8627295c506af51f5726c692 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5c7ab29b14b7b83a8627295c506af51f5726c692/FormatParagraph.py
if userhome.endswith('/'): i += 1
userhome = userhome.rstrip('/')
def expanduser(path): """Expand ~ and ~user constructions. If user or $HOME is unknown, do nothing.""" if not path.startswith('~'): return path i = path.find('/', 1) if i < 0: i = len(path) if i == 1: if 'HOME' not in os.environ: import pwd userhome = pwd.getpwuid(os.getuid()).pw_dir else: userhome = os.environ['HOME'] else: import pwd try: pwent = pwd.getpwnam(path[1:i]) except KeyError: return path userhome = pwent.pw_dir if userhome.endswith('/'): i += 1 return userhome + path[i:]
4d0f558111d60d80e10612b0f0ff19d95122fbab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/4d0f558111d60d80e10612b0f0ff19d95122fbab/posixpath.py
zip file will be named 'base_dir' + ".zip". Uses either the InfoZIP "zip" utility (if installed and found on the default search path) or the "zipfile" Python module (if available). If neither tool is available, raises DistutilsExecError. Returns the name of the output zip file.
zip file will be named 'base_dir' + ".zip". Uses either the "zipfile" Python module (if available) or the InfoZIP "zip" utility (if installed and found on the default search path). If neither tool is available, raises DistutilsExecError. Returns the name of the output zip file.
def make_zipfile (base_name, base_dir, verbose=0, dry_run=0): """Create a zip file from all the files under 'base_dir'. The output zip file will be named 'base_dir' + ".zip". Uses either the InfoZIP "zip" utility (if installed and found on the default search path) or the "zipfile" Python module (if available). If neither tool is available, raises DistutilsExecError. Returns the name of the output zip file. """ # This initially assumed the Unix 'zip' utility -- but # apparently InfoZIP's zip.exe works the same under Windows, so # no changes needed! zip_filename = base_name + ".zip" mkpath(os.path.dirname(zip_filename), dry_run=dry_run) try: spawn(["zip", "-rq", zip_filename, base_dir], dry_run=dry_run) except DistutilsExecError: # XXX really should distinguish between "couldn't find # external 'zip' command" and "zip failed" -- shouldn't try # again in the latter case. (I think fixing this will # require some cooperation from the spawn module -- perhaps # a utility function to search the path, so we can fallback # on zipfile.py without the failed spawn.) try: import zipfile except ImportError: raise DistutilsExecError, \ ("unable to create zip file '%s': " + "could neither find a standalone zip utility nor " + "import the 'zipfile' module") % zip_filename log.info("creating '%s' and adding '%s' to it", zip_filename, base_dir) def visit (z, dirname, names): for name in names: path = os.path.normpath(os.path.join(dirname, name)) if os.path.isfile(path): z.write(path, path) if not dry_run: z = zipfile.ZipFile(zip_filename, "w", compression=zipfile.ZIP_DEFLATED) os.path.walk(base_dir, visit, z) z.close() return zip_filename
a274097dcd7a450c7e3ee66369100b9f1367e1ea /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a274097dcd7a450c7e3ee66369100b9f1367e1ea/archive_util.py
try: import zipfile except ImportError: zipfile = None
def make_zipfile (base_name, base_dir, verbose=0, dry_run=0): """Create a zip file from all the files under 'base_dir'. The output zip file will be named 'base_dir' + ".zip". Uses either the InfoZIP "zip" utility (if installed and found on the default search path) or the "zipfile" Python module (if available). If neither tool is available, raises DistutilsExecError. Returns the name of the output zip file. """ # This initially assumed the Unix 'zip' utility -- but # apparently InfoZIP's zip.exe works the same under Windows, so # no changes needed! zip_filename = base_name + ".zip" mkpath(os.path.dirname(zip_filename), dry_run=dry_run) try: spawn(["zip", "-rq", zip_filename, base_dir], dry_run=dry_run) except DistutilsExecError: # XXX really should distinguish between "couldn't find # external 'zip' command" and "zip failed" -- shouldn't try # again in the latter case. (I think fixing this will # require some cooperation from the spawn module -- perhaps # a utility function to search the path, so we can fallback # on zipfile.py without the failed spawn.) try: import zipfile except ImportError: raise DistutilsExecError, \ ("unable to create zip file '%s': " + "could neither find a standalone zip utility nor " + "import the 'zipfile' module") % zip_filename log.info("creating '%s' and adding '%s' to it", zip_filename, base_dir) def visit (z, dirname, names): for name in names: path = os.path.normpath(os.path.join(dirname, name)) if os.path.isfile(path): z.write(path, path) if not dry_run: z = zipfile.ZipFile(zip_filename, "w", compression=zipfile.ZIP_DEFLATED) os.path.walk(base_dir, visit, z) z.close() return zip_filename
a274097dcd7a450c7e3ee66369100b9f1367e1ea /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a274097dcd7a450c7e3ee66369100b9f1367e1ea/archive_util.py
try: spawn(["zip", "-rq", zip_filename, base_dir], dry_run=dry_run) except DistutilsExecError:
def make_zipfile (base_name, base_dir, verbose=0, dry_run=0): """Create a zip file from all the files under 'base_dir'. The output zip file will be named 'base_dir' + ".zip". Uses either the InfoZIP "zip" utility (if installed and found on the default search path) or the "zipfile" Python module (if available). If neither tool is available, raises DistutilsExecError. Returns the name of the output zip file. """ # This initially assumed the Unix 'zip' utility -- but # apparently InfoZIP's zip.exe works the same under Windows, so # no changes needed! zip_filename = base_name + ".zip" mkpath(os.path.dirname(zip_filename), dry_run=dry_run) try: spawn(["zip", "-rq", zip_filename, base_dir], dry_run=dry_run) except DistutilsExecError: # XXX really should distinguish between "couldn't find # external 'zip' command" and "zip failed" -- shouldn't try # again in the latter case. (I think fixing this will # require some cooperation from the spawn module -- perhaps # a utility function to search the path, so we can fallback # on zipfile.py without the failed spawn.) try: import zipfile except ImportError: raise DistutilsExecError, \ ("unable to create zip file '%s': " + "could neither find a standalone zip utility nor " + "import the 'zipfile' module") % zip_filename log.info("creating '%s' and adding '%s' to it", zip_filename, base_dir) def visit (z, dirname, names): for name in names: path = os.path.normpath(os.path.join(dirname, name)) if os.path.isfile(path): z.write(path, path) if not dry_run: z = zipfile.ZipFile(zip_filename, "w", compression=zipfile.ZIP_DEFLATED) os.path.walk(base_dir, visit, z) z.close() return zip_filename
a274097dcd7a450c7e3ee66369100b9f1367e1ea /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a274097dcd7a450c7e3ee66369100b9f1367e1ea/archive_util.py
if zipfile is None: if verbose: zipoptions = "-r" else: zipoptions = "-rq"
def make_zipfile (base_name, base_dir, verbose=0, dry_run=0): """Create a zip file from all the files under 'base_dir'. The output zip file will be named 'base_dir' + ".zip". Uses either the InfoZIP "zip" utility (if installed and found on the default search path) or the "zipfile" Python module (if available). If neither tool is available, raises DistutilsExecError. Returns the name of the output zip file. """ # This initially assumed the Unix 'zip' utility -- but # apparently InfoZIP's zip.exe works the same under Windows, so # no changes needed! zip_filename = base_name + ".zip" mkpath(os.path.dirname(zip_filename), dry_run=dry_run) try: spawn(["zip", "-rq", zip_filename, base_dir], dry_run=dry_run) except DistutilsExecError: # XXX really should distinguish between "couldn't find # external 'zip' command" and "zip failed" -- shouldn't try # again in the latter case. (I think fixing this will # require some cooperation from the spawn module -- perhaps # a utility function to search the path, so we can fallback # on zipfile.py without the failed spawn.) try: import zipfile except ImportError: raise DistutilsExecError, \ ("unable to create zip file '%s': " + "could neither find a standalone zip utility nor " + "import the 'zipfile' module") % zip_filename log.info("creating '%s' and adding '%s' to it", zip_filename, base_dir) def visit (z, dirname, names): for name in names: path = os.path.normpath(os.path.join(dirname, name)) if os.path.isfile(path): z.write(path, path) if not dry_run: z = zipfile.ZipFile(zip_filename, "w", compression=zipfile.ZIP_DEFLATED) os.path.walk(base_dir, visit, z) z.close() return zip_filename
a274097dcd7a450c7e3ee66369100b9f1367e1ea /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a274097dcd7a450c7e3ee66369100b9f1367e1ea/archive_util.py
import zipfile except ImportError:
spawn(["zip", zipoptions, zip_filename, base_dir], dry_run=dry_run) except DistutilsExecError:
def make_zipfile (base_name, base_dir, verbose=0, dry_run=0): """Create a zip file from all the files under 'base_dir'. The output zip file will be named 'base_dir' + ".zip". Uses either the InfoZIP "zip" utility (if installed and found on the default search path) or the "zipfile" Python module (if available). If neither tool is available, raises DistutilsExecError. Returns the name of the output zip file. """ # This initially assumed the Unix 'zip' utility -- but # apparently InfoZIP's zip.exe works the same under Windows, so # no changes needed! zip_filename = base_name + ".zip" mkpath(os.path.dirname(zip_filename), dry_run=dry_run) try: spawn(["zip", "-rq", zip_filename, base_dir], dry_run=dry_run) except DistutilsExecError: # XXX really should distinguish between "couldn't find # external 'zip' command" and "zip failed" -- shouldn't try # again in the latter case. (I think fixing this will # require some cooperation from the spawn module -- perhaps # a utility function to search the path, so we can fallback # on zipfile.py without the failed spawn.) try: import zipfile except ImportError: raise DistutilsExecError, \ ("unable to create zip file '%s': " + "could neither find a standalone zip utility nor " + "import the 'zipfile' module") % zip_filename log.info("creating '%s' and adding '%s' to it", zip_filename, base_dir) def visit (z, dirname, names): for name in names: path = os.path.normpath(os.path.join(dirname, name)) if os.path.isfile(path): z.write(path, path) if not dry_run: z = zipfile.ZipFile(zip_filename, "w", compression=zipfile.ZIP_DEFLATED) os.path.walk(base_dir, visit, z) z.close() return zip_filename
a274097dcd7a450c7e3ee66369100b9f1367e1ea /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a274097dcd7a450c7e3ee66369100b9f1367e1ea/archive_util.py
("unable to create zip file '%s': " + "could neither find a standalone zip utility nor " + "import the 'zipfile' module") % zip_filename
("unable to create zip file '%s': " "could neither import the 'zipfile' module nor " "find a standalone zip utility") % zip_filename
def make_zipfile (base_name, base_dir, verbose=0, dry_run=0): """Create a zip file from all the files under 'base_dir'. The output zip file will be named 'base_dir' + ".zip". Uses either the InfoZIP "zip" utility (if installed and found on the default search path) or the "zipfile" Python module (if available). If neither tool is available, raises DistutilsExecError. Returns the name of the output zip file. """ # This initially assumed the Unix 'zip' utility -- but # apparently InfoZIP's zip.exe works the same under Windows, so # no changes needed! zip_filename = base_name + ".zip" mkpath(os.path.dirname(zip_filename), dry_run=dry_run) try: spawn(["zip", "-rq", zip_filename, base_dir], dry_run=dry_run) except DistutilsExecError: # XXX really should distinguish between "couldn't find # external 'zip' command" and "zip failed" -- shouldn't try # again in the latter case. (I think fixing this will # require some cooperation from the spawn module -- perhaps # a utility function to search the path, so we can fallback # on zipfile.py without the failed spawn.) try: import zipfile except ImportError: raise DistutilsExecError, \ ("unable to create zip file '%s': " + "could neither find a standalone zip utility nor " + "import the 'zipfile' module") % zip_filename log.info("creating '%s' and adding '%s' to it", zip_filename, base_dir) def visit (z, dirname, names): for name in names: path = os.path.normpath(os.path.join(dirname, name)) if os.path.isfile(path): z.write(path, path) if not dry_run: z = zipfile.ZipFile(zip_filename, "w", compression=zipfile.ZIP_DEFLATED) os.path.walk(base_dir, visit, z) z.close() return zip_filename
a274097dcd7a450c7e3ee66369100b9f1367e1ea /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a274097dcd7a450c7e3ee66369100b9f1367e1ea/archive_util.py
log.info("creating '%s' and adding '%s' to it",
else: log.info("creating '%s' and adding '%s' to it",
def make_zipfile (base_name, base_dir, verbose=0, dry_run=0): """Create a zip file from all the files under 'base_dir'. The output zip file will be named 'base_dir' + ".zip". Uses either the InfoZIP "zip" utility (if installed and found on the default search path) or the "zipfile" Python module (if available). If neither tool is available, raises DistutilsExecError. Returns the name of the output zip file. """ # This initially assumed the Unix 'zip' utility -- but # apparently InfoZIP's zip.exe works the same under Windows, so # no changes needed! zip_filename = base_name + ".zip" mkpath(os.path.dirname(zip_filename), dry_run=dry_run) try: spawn(["zip", "-rq", zip_filename, base_dir], dry_run=dry_run) except DistutilsExecError: # XXX really should distinguish between "couldn't find # external 'zip' command" and "zip failed" -- shouldn't try # again in the latter case. (I think fixing this will # require some cooperation from the spawn module -- perhaps # a utility function to search the path, so we can fallback # on zipfile.py without the failed spawn.) try: import zipfile except ImportError: raise DistutilsExecError, \ ("unable to create zip file '%s': " + "could neither find a standalone zip utility nor " + "import the 'zipfile' module") % zip_filename log.info("creating '%s' and adding '%s' to it", zip_filename, base_dir) def visit (z, dirname, names): for name in names: path = os.path.normpath(os.path.join(dirname, name)) if os.path.isfile(path): z.write(path, path) if not dry_run: z = zipfile.ZipFile(zip_filename, "w", compression=zipfile.ZIP_DEFLATED) os.path.walk(base_dir, visit, z) z.close() return zip_filename
a274097dcd7a450c7e3ee66369100b9f1367e1ea /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a274097dcd7a450c7e3ee66369100b9f1367e1ea/archive_util.py
def make_zipfile (base_name, base_dir, verbose=0, dry_run=0): """Create a zip file from all the files under 'base_dir'. The output zip file will be named 'base_dir' + ".zip". Uses either the InfoZIP "zip" utility (if installed and found on the default search path) or the "zipfile" Python module (if available). If neither tool is available, raises DistutilsExecError. Returns the name of the output zip file. """ # This initially assumed the Unix 'zip' utility -- but # apparently InfoZIP's zip.exe works the same under Windows, so # no changes needed! zip_filename = base_name + ".zip" mkpath(os.path.dirname(zip_filename), dry_run=dry_run) try: spawn(["zip", "-rq", zip_filename, base_dir], dry_run=dry_run) except DistutilsExecError: # XXX really should distinguish between "couldn't find # external 'zip' command" and "zip failed" -- shouldn't try # again in the latter case. (I think fixing this will # require some cooperation from the spawn module -- perhaps # a utility function to search the path, so we can fallback # on zipfile.py without the failed spawn.) try: import zipfile except ImportError: raise DistutilsExecError, \ ("unable to create zip file '%s': " + "could neither find a standalone zip utility nor " + "import the 'zipfile' module") % zip_filename log.info("creating '%s' and adding '%s' to it", zip_filename, base_dir) def visit (z, dirname, names): for name in names: path = os.path.normpath(os.path.join(dirname, name)) if os.path.isfile(path): z.write(path, path) if not dry_run: z = zipfile.ZipFile(zip_filename, "w", compression=zipfile.ZIP_DEFLATED) os.path.walk(base_dir, visit, z) z.close() return zip_filename
a274097dcd7a450c7e3ee66369100b9f1367e1ea /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/a274097dcd7a450c7e3ee66369100b9f1367e1ea/archive_util.py
exts.append( Extension('_md5', ['md5module.c', 'md5c.c']) )
exts.append( Extension('_md5', ['md5module.c', 'md5.c']) )
def detect_modules(self): # Ensure that /usr/local is always used add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
5ba393550bf3bd06da3b71af6ccbab8f44c5b32c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/5ba393550bf3bd06da3b71af6ccbab8f44c5b32c/setup.py
def poll (timeout=0.0, map=None):
def poll(timeout=0.0, map=None):
def poll (timeout=0.0, map=None): if map is None: map = socket_map if map: r = []; w = []; e = [] for fd, obj in map.iteritems(): if obj.readable(): r.append(fd) if obj.writable(): w.append(fd) try: r, w, e = select.select(r, w, e, timeout) except select.error, err: if err[0] != EINTR: raise for fd in r: obj = map.get(fd) if obj is None: continue read(obj) for fd in w: obj = map.get(fd) if obj is None: continue write(obj)
f7eb0d3f501f2e379b8719bda476d318d1e79160 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f7eb0d3f501f2e379b8719bda476d318d1e79160/asyncore.py
for fd, obj in map.iteritems():
for fd, obj in map.items():
def poll (timeout=0.0, map=None): if map is None: map = socket_map if map: r = []; w = []; e = [] for fd, obj in map.iteritems(): if obj.readable(): r.append(fd) if obj.writable(): w.append(fd) try: r, w, e = select.select(r, w, e, timeout) except select.error, err: if err[0] != EINTR: raise for fd in r: obj = map.get(fd) if obj is None: continue read(obj) for fd in w: obj = map.get(fd) if obj is None: continue write(obj)
f7eb0d3f501f2e379b8719bda476d318d1e79160 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f7eb0d3f501f2e379b8719bda476d318d1e79160/asyncore.py
def poll2 (timeout=0.0, map=None):
def poll2(timeout=0.0, map=None):
def poll2 (timeout=0.0, map=None): import poll if map is None: map=socket_map if timeout is not None: # timeout is in milliseconds timeout = int(timeout*1000) if map: l = [] for fd, obj in map.iteritems(): flags = 0 if obj.readable(): flags = poll.POLLIN if obj.writable(): flags = flags | poll.POLLOUT if flags: l.append ((fd, flags)) r = poll.poll (l, timeout) for fd, flags in r: obj = map.get(fd) if obj is None: continue readwrite(obj, flags)
f7eb0d3f501f2e379b8719bda476d318d1e79160 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f7eb0d3f501f2e379b8719bda476d318d1e79160/asyncore.py
map=socket_map
map = socket_map
def poll2 (timeout=0.0, map=None): import poll if map is None: map=socket_map if timeout is not None: # timeout is in milliseconds timeout = int(timeout*1000) if map: l = [] for fd, obj in map.iteritems(): flags = 0 if obj.readable(): flags = poll.POLLIN if obj.writable(): flags = flags | poll.POLLOUT if flags: l.append ((fd, flags)) r = poll.poll (l, timeout) for fd, flags in r: obj = map.get(fd) if obj is None: continue readwrite(obj, flags)
f7eb0d3f501f2e379b8719bda476d318d1e79160 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f7eb0d3f501f2e379b8719bda476d318d1e79160/asyncore.py
for fd, obj in map.iteritems():
for fd, obj in map.items():
def poll2 (timeout=0.0, map=None): import poll if map is None: map=socket_map if timeout is not None: # timeout is in milliseconds timeout = int(timeout*1000) if map: l = [] for fd, obj in map.iteritems(): flags = 0 if obj.readable(): flags = poll.POLLIN if obj.writable(): flags = flags | poll.POLLOUT if flags: l.append ((fd, flags)) r = poll.poll (l, timeout) for fd, flags in r: obj = map.get(fd) if obj is None: continue readwrite(obj, flags)
f7eb0d3f501f2e379b8719bda476d318d1e79160 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f7eb0d3f501f2e379b8719bda476d318d1e79160/asyncore.py
l.append ((fd, flags)) r = poll.poll (l, timeout)
l.append((fd, flags)) r = poll.poll(l, timeout)
def poll2 (timeout=0.0, map=None): import poll if map is None: map=socket_map if timeout is not None: # timeout is in milliseconds timeout = int(timeout*1000) if map: l = [] for fd, obj in map.iteritems(): flags = 0 if obj.readable(): flags = poll.POLLIN if obj.writable(): flags = flags | poll.POLLOUT if flags: l.append ((fd, flags)) r = poll.poll (l, timeout) for fd, flags in r: obj = map.get(fd) if obj is None: continue readwrite(obj, flags)
f7eb0d3f501f2e379b8719bda476d318d1e79160 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f7eb0d3f501f2e379b8719bda476d318d1e79160/asyncore.py
def poll3 (timeout=0.0, map=None):
def poll3(timeout=0.0, map=None):
def poll3 (timeout=0.0, map=None): # Use the poll() support added to the select module in Python 2.0 if map is None: map=socket_map if timeout is not None: # timeout is in milliseconds timeout = int(timeout*1000) pollster = select.poll() if map: for fd, obj in map.iteritems(): flags = 0 if obj.readable(): flags = select.POLLIN if obj.writable(): flags = flags | select.POLLOUT if flags: pollster.register(fd, flags) try: r = pollster.poll (timeout) except select.error, err: if err[0] != EINTR: raise r = [] for fd, flags in r: obj = map.get(fd) if obj is None: continue readwrite(obj, flags)
f7eb0d3f501f2e379b8719bda476d318d1e79160 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f7eb0d3f501f2e379b8719bda476d318d1e79160/asyncore.py
map=socket_map
map = socket_map
def poll3 (timeout=0.0, map=None): # Use the poll() support added to the select module in Python 2.0 if map is None: map=socket_map if timeout is not None: # timeout is in milliseconds timeout = int(timeout*1000) pollster = select.poll() if map: for fd, obj in map.iteritems(): flags = 0 if obj.readable(): flags = select.POLLIN if obj.writable(): flags = flags | select.POLLOUT if flags: pollster.register(fd, flags) try: r = pollster.poll (timeout) except select.error, err: if err[0] != EINTR: raise r = [] for fd, flags in r: obj = map.get(fd) if obj is None: continue readwrite(obj, flags)
f7eb0d3f501f2e379b8719bda476d318d1e79160 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f7eb0d3f501f2e379b8719bda476d318d1e79160/asyncore.py
for fd, obj in map.iteritems():
for fd, obj in map.items():
def poll3 (timeout=0.0, map=None): # Use the poll() support added to the select module in Python 2.0 if map is None: map=socket_map if timeout is not None: # timeout is in milliseconds timeout = int(timeout*1000) pollster = select.poll() if map: for fd, obj in map.iteritems(): flags = 0 if obj.readable(): flags = select.POLLIN if obj.writable(): flags = flags | select.POLLOUT if flags: pollster.register(fd, flags) try: r = pollster.poll (timeout) except select.error, err: if err[0] != EINTR: raise r = [] for fd, flags in r: obj = map.get(fd) if obj is None: continue readwrite(obj, flags)
f7eb0d3f501f2e379b8719bda476d318d1e79160 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f7eb0d3f501f2e379b8719bda476d318d1e79160/asyncore.py
r = pollster.poll (timeout)
r = pollster.poll(timeout)
def poll3 (timeout=0.0, map=None): # Use the poll() support added to the select module in Python 2.0 if map is None: map=socket_map if timeout is not None: # timeout is in milliseconds timeout = int(timeout*1000) pollster = select.poll() if map: for fd, obj in map.iteritems(): flags = 0 if obj.readable(): flags = select.POLLIN if obj.writable(): flags = flags | select.POLLOUT if flags: pollster.register(fd, flags) try: r = pollster.poll (timeout) except select.error, err: if err[0] != EINTR: raise r = [] for fd, flags in r: obj = map.get(fd) if obj is None: continue readwrite(obj, flags)
f7eb0d3f501f2e379b8719bda476d318d1e79160 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f7eb0d3f501f2e379b8719bda476d318d1e79160/asyncore.py
def loop (timeout=30.0, use_poll=0, map=None):
def loop(timeout=30.0, use_poll=0, map=None):
def loop (timeout=30.0, use_poll=0, map=None): if map is None: map = socket_map if use_poll: if hasattr (select, 'poll'): poll_fun = poll3 else: poll_fun = poll2 else: poll_fun = poll while map: poll_fun (timeout, map)
f7eb0d3f501f2e379b8719bda476d318d1e79160 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f7eb0d3f501f2e379b8719bda476d318d1e79160/asyncore.py
if hasattr (select, 'poll'):
if hasattr(select, 'poll'):
def loop (timeout=30.0, use_poll=0, map=None): if map is None: map = socket_map if use_poll: if hasattr (select, 'poll'): poll_fun = poll3 else: poll_fun = poll2 else: poll_fun = poll while map: poll_fun (timeout, map)
f7eb0d3f501f2e379b8719bda476d318d1e79160 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f7eb0d3f501f2e379b8719bda476d318d1e79160/asyncore.py
poll_fun (timeout, map)
poll_fun(timeout, map)
def loop (timeout=30.0, use_poll=0, map=None): if map is None: map = socket_map if use_poll: if hasattr (select, 'poll'): poll_fun = poll3 else: poll_fun = poll2 else: poll_fun = poll while map: poll_fun (timeout, map)
f7eb0d3f501f2e379b8719bda476d318d1e79160 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f7eb0d3f501f2e379b8719bda476d318d1e79160/asyncore.py
def __init__ (self, sock=None, map=None):
def __init__(self, sock=None, map=None):
def __init__ (self, sock=None, map=None): if sock: self.set_socket (sock, map) # I think it should inherit this anyway self.socket.setblocking (0) self.connected = 1 # XXX Does the constructor require that the socket passed # be connected? try: self.addr = sock.getpeername() except socket.error: # The addr isn't crucial pass else: self.socket = None
f7eb0d3f501f2e379b8719bda476d318d1e79160 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f7eb0d3f501f2e379b8719bda476d318d1e79160/asyncore.py
self.set_socket (sock, map)
self.set_socket(sock, map)
def __init__ (self, sock=None, map=None): if sock: self.set_socket (sock, map) # I think it should inherit this anyway self.socket.setblocking (0) self.connected = 1 # XXX Does the constructor require that the socket passed # be connected? try: self.addr = sock.getpeername() except socket.error: # The addr isn't crucial pass else: self.socket = None
f7eb0d3f501f2e379b8719bda476d318d1e79160 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f7eb0d3f501f2e379b8719bda476d318d1e79160/asyncore.py
self.socket.setblocking (0)
self.socket.setblocking(0)
def __init__ (self, sock=None, map=None): if sock: self.set_socket (sock, map) # I think it should inherit this anyway self.socket.setblocking (0) self.connected = 1 # XXX Does the constructor require that the socket passed # be connected? try: self.addr = sock.getpeername() except socket.error: # The addr isn't crucial pass else: self.socket = None
f7eb0d3f501f2e379b8719bda476d318d1e79160 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f7eb0d3f501f2e379b8719bda476d318d1e79160/asyncore.py
def __repr__ (self):
def __repr__(self):
def __repr__ (self): status = [self.__class__.__module__+"."+self.__class__.__name__] if self.accepting and self.addr: status.append ('listening') elif self.connected: status.append ('connected') if self.addr is not None: try: status.append ('%s:%d' % self.addr) except TypeError: status.append (repr(self.addr)) return '<%s at %#x>' % (' '.join (status), id (self))
f7eb0d3f501f2e379b8719bda476d318d1e79160 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f7eb0d3f501f2e379b8719bda476d318d1e79160/asyncore.py
status.append ('listening')
status.append('listening')
def __repr__ (self): status = [self.__class__.__module__+"."+self.__class__.__name__] if self.accepting and self.addr: status.append ('listening') elif self.connected: status.append ('connected') if self.addr is not None: try: status.append ('%s:%d' % self.addr) except TypeError: status.append (repr(self.addr)) return '<%s at %#x>' % (' '.join (status), id (self))
f7eb0d3f501f2e379b8719bda476d318d1e79160 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f7eb0d3f501f2e379b8719bda476d318d1e79160/asyncore.py
status.append ('connected')
status.append('connected')
def __repr__ (self): status = [self.__class__.__module__+"."+self.__class__.__name__] if self.accepting and self.addr: status.append ('listening') elif self.connected: status.append ('connected') if self.addr is not None: try: status.append ('%s:%d' % self.addr) except TypeError: status.append (repr(self.addr)) return '<%s at %#x>' % (' '.join (status), id (self))
f7eb0d3f501f2e379b8719bda476d318d1e79160 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f7eb0d3f501f2e379b8719bda476d318d1e79160/asyncore.py
status.append ('%s:%d' % self.addr)
status.append('%s:%d' % self.addr)
def __repr__ (self): status = [self.__class__.__module__+"."+self.__class__.__name__] if self.accepting and self.addr: status.append ('listening') elif self.connected: status.append ('connected') if self.addr is not None: try: status.append ('%s:%d' % self.addr) except TypeError: status.append (repr(self.addr)) return '<%s at %#x>' % (' '.join (status), id (self))
f7eb0d3f501f2e379b8719bda476d318d1e79160 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f7eb0d3f501f2e379b8719bda476d318d1e79160/asyncore.py
status.append (repr(self.addr)) return '<%s at % def add_channel (self, map=None):
status.append(repr(self.addr)) return '<%s at % def add_channel(self, map=None):
def __repr__ (self): status = [self.__class__.__module__+"."+self.__class__.__name__] if self.accepting and self.addr: status.append ('listening') elif self.connected: status.append ('connected') if self.addr is not None: try: status.append ('%s:%d' % self.addr) except TypeError: status.append (repr(self.addr)) return '<%s at %#x>' % (' '.join (status), id (self))
f7eb0d3f501f2e379b8719bda476d318d1e79160 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f7eb0d3f501f2e379b8719bda476d318d1e79160/asyncore.py
map=socket_map
map = socket_map
def add_channel (self, map=None): #self.log_info ('adding channel %s' % self) if map is None: map=socket_map map [self._fileno] = self
f7eb0d3f501f2e379b8719bda476d318d1e79160 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f7eb0d3f501f2e379b8719bda476d318d1e79160/asyncore.py
def del_channel (self, map=None):
def del_channel(self, map=None):
def del_channel (self, map=None): fd = self._fileno if map is None: map=socket_map if map.has_key (fd): #self.log_info ('closing channel %d:%s' % (fd, self)) del map [fd]
f7eb0d3f501f2e379b8719bda476d318d1e79160 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f7eb0d3f501f2e379b8719bda476d318d1e79160/asyncore.py
map=socket_map if map.has_key (fd):
map = socket_map if map.has_key(fd):
def del_channel (self, map=None): fd = self._fileno if map is None: map=socket_map if map.has_key (fd): #self.log_info ('closing channel %d:%s' % (fd, self)) del map [fd]
f7eb0d3f501f2e379b8719bda476d318d1e79160 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/12029/f7eb0d3f501f2e379b8719bda476d318d1e79160/asyncore.py