rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
url = string.strip(url[1:-1]) if url[:4] == 'URL:': url = string.strip(url[4:])
url = url[1:-1].strip() if url[:4] == 'URL:': url = url[4:].strip()
def unwrap(url): """unwrap('<URL:type://host/path>') --> 'type://host/path'.""" url = string.strip(url) if url[:1] == '<' and url[-1:] == '>': url = string.strip(url[1:-1]) if url[:4] == 'URL:': url = string.strip(url[4:]) return url
b2493f855a7319ce0748bfb965253cad9c9f5a2c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b2493f855a7319ce0748bfb965253cad9c9f5a2c/urllib.py
if not port: raise string.atoi_error, "no digits" nport = string.atoi(port) except string.atoi_error:
if not port: raise ValueError, "no digits" nport = int(port) except ValueError:
def splitnport(host, defport=-1): """Split host and port, returning numeric port. Return given default port if no ':' found; defaults to -1. Return numerical port if a valid number are found after ':'. Return None if ':' but not a valid number.""" global _nportprog if _nportprog is None: import re _nportprog = re.compile('^(.*):(.*)$') match = _nportprog.match(host) if match: host, port = match.group(1, 2) try: if not port: raise string.atoi_error, "no digits" nport = string.atoi(port) except string.atoi_error: nport = None return host, nport return host, defport
b2493f855a7319ce0748bfb965253cad9c9f5a2c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b2493f855a7319ce0748bfb965253cad9c9f5a2c/urllib.py
words = string.splitfields(url, ';')
words = url.split(';')
def splitattr(url): """splitattr('/path;attr1=value1;attr2=value2;...') -> '/path', ['attr1=value1', 'attr2=value2', ...].""" words = string.splitfields(url, ';') return words[0], words[1:]
b2493f855a7319ce0748bfb965253cad9c9f5a2c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b2493f855a7319ce0748bfb965253cad9c9f5a2c/urllib.py
myatoi = string.atoi list = string.split(s, '%')
myatoi = int list = s.split('%')
def unquote(s): """unquote('abc%20def') -> 'abc def'.""" mychr = chr myatoi = string.atoi list = string.split(s, '%') res = [list[0]] myappend = res.append del list[0] for item in list: if item[1:2]: try: myappend(mychr(myatoi(item[:2], 16)) + item[2:]) except: myappend('%' + item) else: myappend('%' + item) return string.join(res, "")
b2493f855a7319ce0748bfb965253cad9c9f5a2c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b2493f855a7319ce0748bfb965253cad9c9f5a2c/urllib.py
return string.join(res, "")
return "".join(res)
def unquote(s): """unquote('abc%20def') -> 'abc def'.""" mychr = chr myatoi = string.atoi list = string.split(s, '%') res = [list[0]] myappend = res.append del list[0] for item in list: if item[1:2]: try: myappend(mychr(myatoi(item[:2], 16)) + item[2:]) except: myappend('%' + item) else: myappend('%' + item) return string.join(res, "")
b2493f855a7319ce0748bfb965253cad9c9f5a2c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b2493f855a7319ce0748bfb965253cad9c9f5a2c/urllib.py
s = string.join(string.split(s, '+'), ' ')
s = ' '.join(s.split('+'))
def unquote_plus(s): """unquote('%7e/abc+def') -> '~/abc def'""" if '+' in s: # replace '+' with ' ' s = string.join(string.split(s, '+'), ' ') return unquote(s)
b2493f855a7319ce0748bfb965253cad9c9f5a2c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b2493f855a7319ce0748bfb965253cad9c9f5a2c/urllib.py
return string.join(res, '')
return ''.join(res)
def _fast_quote(s): global _fast_safe if _fast_safe is None: _fast_safe = {} for c in _fast_safe_test: _fast_safe[c] = c res = list(s) for i in range(len(res)): c = res[i] if not _fast_safe.has_key(c): res[i] = '%%%02x' % ord(c) return string.join(res, '')
b2493f855a7319ce0748bfb965253cad9c9f5a2c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b2493f855a7319ce0748bfb965253cad9c9f5a2c/urllib.py
return string.join(res, '')
return ''.join(res)
def quote(s, safe = '/'): """quote('abc def') -> 'abc%20def' Each part of a URL, e.g. the path info, the query, etc., has a different set of reserved characters that must be quoted. RFC 2396 Uniform Resource Identifiers (URI): Generic Syntax lists the following reserved characters. reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | "$" | "," Each of these characters is reserved in some component of a URL, but not necessarily in all of them. By default, the quote function is intended for quoting the path section of a URL. Thus, it will not encode '/'. This character is reserved, but in typical usage the quote function is being called on a path where the existing slash characters are used as reserved characters. """ safe = always_safe + safe if _fast_safe_test == safe: return _fast_quote(s) res = list(s) for i in range(len(res)): c = res[i] if c not in safe: res[i] = '%%%02x' % ord(c) return string.join(res, '')
b2493f855a7319ce0748bfb965253cad9c9f5a2c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b2493f855a7319ce0748bfb965253cad9c9f5a2c/urllib.py
l = string.split(s, ' ')
l = s.split(' ')
def quote_plus(s, safe = ''): """Quote the query fragment of a URL; replacing ' ' with '+'""" if ' ' in s: l = string.split(s, ' ') for i in range(len(l)): l[i] = quote(l[i], safe) return string.join(l, '+') else: return quote(s, safe)
b2493f855a7319ce0748bfb965253cad9c9f5a2c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b2493f855a7319ce0748bfb965253cad9c9f5a2c/urllib.py
return string.join(l, '+')
return '+'.join(l)
def quote_plus(s, safe = ''): """Quote the query fragment of a URL; replacing ' ' with '+'""" if ' ' in s: l = string.split(s, ' ') for i in range(len(l)): l[i] = quote(l[i], safe) return string.join(l, '+') else: return quote(s, safe)
b2493f855a7319ce0748bfb965253cad9c9f5a2c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b2493f855a7319ce0748bfb965253cad9c9f5a2c/urllib.py
return string.join(l, '&')
return '&'.join(l)
def urlencode(dict): """Encode a dictionary of form entries into a URL query string.""" l = [] for k, v in dict.items(): k = quote_plus(str(k)) v = quote_plus(str(v)) l.append(k + '=' + v) return string.join(l, '&')
b2493f855a7319ce0748bfb965253cad9c9f5a2c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b2493f855a7319ce0748bfb965253cad9c9f5a2c/urllib.py
name = string.lower(name)
name = name.lower()
def getproxies_environment(): """Return a dictionary of scheme -> proxy server URL mappings. Scan the environment for variables named <scheme>_proxy; this seems to be the standard convention. If you need a different way, you can pass a proxies dictionary to the [Fancy]URLopener constructor. """ proxies = {} for name, value in os.environ.items(): name = string.lower(name) if value and name[-6:] == '_proxy': proxies[name[:-6]] = value return proxies
b2493f855a7319ce0748bfb965253cad9c9f5a2c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b2493f855a7319ce0748bfb965253cad9c9f5a2c/urllib.py
print "Block number: %d, Block size: %d, Total size: %d" % (blocknum, blocksize, totalsize)
print "Block number: %d, Block size: %d, Total size: %d" % ( blocknum, blocksize, totalsize)
def reporthook(blocknum, blocksize, totalsize): # Report during remote transfers print "Block number: %d, Block size: %d, Total size: %d" % (blocknum, blocksize, totalsize)
b2493f855a7319ce0748bfb965253cad9c9f5a2c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b2493f855a7319ce0748bfb965253cad9c9f5a2c/urllib.py
print fn, h
print fn
def test(args=[]): if not args: args = [ '/etc/passwd', 'file:/etc/passwd', 'file://localhost/etc/passwd', 'ftp://ftp.python.org/etc/passwd',
b2493f855a7319ce0748bfb965253cad9c9f5a2c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b2493f855a7319ce0748bfb965253cad9c9f5a2c/urllib.py
data = string.translate(data, table, "\r")
data = data.translate(table, "\r")
def test(args=[]): if not args: args = [ '/etc/passwd', 'file:/etc/passwd', 'file://localhost/etc/passwd', 'ftp://ftp.python.org/etc/passwd',
b2493f855a7319ce0748bfb965253cad9c9f5a2c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b2493f855a7319ce0748bfb965253cad9c9f5a2c/urllib.py
def build_extensions (self, extensions):
2f1b5bb905c2a8a1462833635e6d912a36eae1a9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2f1b5bb905c2a8a1462833635e6d912a36eae1a9/build_ext.py
libraries, library_dirs)
libraries, library_dirs, build_info)
def build_extensions (self, extensions):
2f1b5bb905c2a8a1462833635e6d912a36eae1a9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2f1b5bb905c2a8a1462833635e6d912a36eae1a9/build_ext.py
The walk is performed in breadth-first order. This method is a
The walk is performed in depth-first order. This method is a
def walk(self): """Walk over the message tree, yielding each subpart.
2a9e3852eeaa3a4d039e2dcedded011dddb612c0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2a9e3852eeaa3a4d039e2dcedded011dddb612c0/Message.py
from Carbon import Qd
def close(self): if self.editgroup.editor.changed: import EasyDialogs from Carbon import Qd Qd.InitCursor() save = EasyDialogs.AskYesNoCancel('Save window "%s" before closing?' % self.title, default=1, no="Don\xd5t save") if save > 0: if self.domenu_save(): return 1 elif save < 0: return 1 self.globals = None W.Window.close(self)
2ad9419c8f14652170858cfd42b1638af116ba5e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2ad9419c8f14652170858cfd42b1638af116ba5e/PyEdit.py
import Qd; Qd.InitCursor()
Qd.InitCursor()
def _run(self): if self.run_with_interpreter: if self.editgroup.editor.changed: import EasyDialogs import Qd; Qd.InitCursor() save = EasyDialogs.AskYesNoCancel('Save "%s" before running?' % self.title, 1) if save > 0: if self.domenu_save(): return elif save < 0: return if not self.path: raise W.AlertError, "Can't run unsaved file" self._run_with_interpreter() elif self.run_with_cl_interpreter: # Until universal newline support if self._eoln != '\n': import EasyDialogs ok = EasyDialogs.AskYesNoCancel('Warning: "%s" does not have Unix line-endings' % self.title, 1, yes='OK', no='') if not ok: return if self.editgroup.editor.changed: import EasyDialogs import Qd; Qd.InitCursor() save = EasyDialogs.AskYesNoCancel('Save "%s" before running?' % self.title, 1) if save > 0: if self.domenu_save(): return elif save < 0: return if not self.path: raise W.AlertError, "Can't run unsaved file" self._run_with_cl_interpreter() else: pytext = self.editgroup.editor.get() globals, file, modname = self.getenvironment() self.execstring(pytext, globals, globals, file, modname)
2ad9419c8f14652170858cfd42b1638af116ba5e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2ad9419c8f14652170858cfd42b1638af116ba5e/PyEdit.py
if self._eoln != '\n': import EasyDialogs ok = EasyDialogs.AskYesNoCancel('Warning: "%s" does not have Unix line-endings' % self.title, 1, yes='OK', no='') if not ok: return
def _run(self): if self.run_with_interpreter: if self.editgroup.editor.changed: import EasyDialogs import Qd; Qd.InitCursor() save = EasyDialogs.AskYesNoCancel('Save "%s" before running?' % self.title, 1) if save > 0: if self.domenu_save(): return elif save < 0: return if not self.path: raise W.AlertError, "Can't run unsaved file" self._run_with_interpreter() elif self.run_with_cl_interpreter: # Until universal newline support if self._eoln != '\n': import EasyDialogs ok = EasyDialogs.AskYesNoCancel('Warning: "%s" does not have Unix line-endings' % self.title, 1, yes='OK', no='') if not ok: return if self.editgroup.editor.changed: import EasyDialogs import Qd; Qd.InitCursor() save = EasyDialogs.AskYesNoCancel('Save "%s" before running?' % self.title, 1) if save > 0: if self.domenu_save(): return elif save < 0: return if not self.path: raise W.AlertError, "Can't run unsaved file" self._run_with_cl_interpreter() else: pytext = self.editgroup.editor.get() globals, file, modname = self.getenvironment() self.execstring(pytext, globals, globals, file, modname)
2ad9419c8f14652170858cfd42b1638af116ba5e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2ad9419c8f14652170858cfd42b1638af116ba5e/PyEdit.py
import Qd; Qd.InitCursor()
Qd.InitCursor()
def _run(self): if self.run_with_interpreter: if self.editgroup.editor.changed: import EasyDialogs import Qd; Qd.InitCursor() save = EasyDialogs.AskYesNoCancel('Save "%s" before running?' % self.title, 1) if save > 0: if self.domenu_save(): return elif save < 0: return if not self.path: raise W.AlertError, "Can't run unsaved file" self._run_with_interpreter() elif self.run_with_cl_interpreter: # Until universal newline support if self._eoln != '\n': import EasyDialogs ok = EasyDialogs.AskYesNoCancel('Warning: "%s" does not have Unix line-endings' % self.title, 1, yes='OK', no='') if not ok: return if self.editgroup.editor.changed: import EasyDialogs import Qd; Qd.InitCursor() save = EasyDialogs.AskYesNoCancel('Save "%s" before running?' % self.title, 1) if save > 0: if self.domenu_save(): return elif save < 0: return if not self.path: raise W.AlertError, "Can't run unsaved file" self._run_with_cl_interpreter() else: pytext = self.editgroup.editor.get() globals, file, modname = self.getenvironment() self.execstring(pytext, globals, globals, file, modname)
2ad9419c8f14652170858cfd42b1638af116ba5e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/2ad9419c8f14652170858cfd42b1638af116ba5e/PyEdit.py
f.fileno = None
def open_data(self, url, data=None): """Use "data" URL.""" # ignore POSTed data # # syntax of data URLs: # dataurl := "data:" [ mediatype ] [ ";base64" ] "," data # mediatype := [ type "/" subtype ] *( ";" parameter ) # data := *urlchar # parameter := attribute "=" value import mimetools try: from cStringIO import StringIO except ImportError: from StringIO import StringIO try: [type, data] = url.split(',', 1) except ValueError: raise IOError, ('data error', 'bad data URL') if not type: type = 'text/plain;charset=US-ASCII' semi = type.rfind(';') if semi >= 0 and '=' not in type[semi:]: encoding = type[semi+1:] type = type[:semi] else: encoding = '' msg = [] msg.append('Date: %s'%time.strftime('%a, %d %b %Y %T GMT', time.gmtime(time.time()))) msg.append('Content-type: %s' % type) if encoding == 'base64': import base64 data = base64.decodestring(data) else: data = unquote(data) msg.append('Content-length: %d' % len(data)) msg.append('') msg.append(data) msg = '\n'.join(msg) f = StringIO(msg) headers = mimetools.Message(f, 0) f.fileno = None # needed for addinfourl return addinfourl(f, headers, url)
1f663574ee154dfc95b883747137040f51ea7ef6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1f663574ee154dfc95b883747137040f51ea7ef6/urllib.py
if hasattr(self.fp, "fileno"): self.fileno = self.fp.fileno
if hasattr(self.fp, "fileno"): self.fileno = self.fp.fileno else: self.fileno = lambda: None
def __init__(self, fp): self.fp = fp self.read = self.fp.read self.readline = self.fp.readline if hasattr(self.fp, "readlines"): self.readlines = self.fp.readlines if hasattr(self.fp, "fileno"): self.fileno = self.fp.fileno if hasattr(self.fp, "__iter__"): self.__iter__ = self.fp.__iter__ if hasattr(self.fp, "next"): self.next = self.fp.next
1f663574ee154dfc95b883747137040f51ea7ef6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1f663574ee154dfc95b883747137040f51ea7ef6/urllib.py
if (isinstance (filename, str)): new_base = base.decode(TESTFN_ENCODING) file_list = [f.decode(TESTFN_ENCODING) for f in os.listdir(path)] else: new_base = base file_list = os.listdir(path)
if isinstance(base, str): base = base.decode(TESTFN_ENCODING) file_list = os.listdir(path) if file_list and isinstance(file_list[0], str): file_list = [f.decode(TESTFN_ENCODING) for f in file_list]
def _do_single(self, filename): self.failUnless(os.path.exists(filename)) self.failUnless(os.path.isfile(filename)) self.failUnless(os.path.exists(os.path.abspath(filename))) self.failUnless(os.path.isfile(os.path.abspath(filename))) os.chmod(filename, 0777) os.utime(filename, None) os.utime(filename, (time.time(), time.time())) # Copy/rename etc tests using the same filename self._do_copyish(filename, filename) # Filename should appear in glob output self.failUnless( os.path.abspath(filename)==os.path.abspath(glob.glob(filename)[0])) # basename should appear in listdir. path, base = os.path.split(os.path.abspath(filename)) if (isinstance (filename, str)): new_base = base.decode(TESTFN_ENCODING) file_list = [f.decode(TESTFN_ENCODING) for f in os.listdir(path)] else: new_base = base file_list = os.listdir(path)
3b04ce824dfba83c5b736138b91aea07d0d2d5da /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3b04ce824dfba83c5b736138b91aea07d0d2d5da/test_unicode_file.py
new_base = unicodedata.normalize("NFD", new_base)
base = unicodedata.normalize("NFD", base)
def _do_single(self, filename): self.failUnless(os.path.exists(filename)) self.failUnless(os.path.isfile(filename)) self.failUnless(os.path.exists(os.path.abspath(filename))) self.failUnless(os.path.isfile(os.path.abspath(filename))) os.chmod(filename, 0777) os.utime(filename, None) os.utime(filename, (time.time(), time.time())) # Copy/rename etc tests using the same filename self._do_copyish(filename, filename) # Filename should appear in glob output self.failUnless( os.path.abspath(filename)==os.path.abspath(glob.glob(filename)[0])) # basename should appear in listdir. path, base = os.path.split(os.path.abspath(filename)) if (isinstance (filename, str)): new_base = base.decode(TESTFN_ENCODING) file_list = [f.decode(TESTFN_ENCODING) for f in os.listdir(path)] else: new_base = base file_list = os.listdir(path)
3b04ce824dfba83c5b736138b91aea07d0d2d5da /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3b04ce824dfba83c5b736138b91aea07d0d2d5da/test_unicode_file.py
self.failUnless(new_base in file_list)
self.failUnless(base in file_list)
def _do_single(self, filename): self.failUnless(os.path.exists(filename)) self.failUnless(os.path.isfile(filename)) self.failUnless(os.path.exists(os.path.abspath(filename))) self.failUnless(os.path.isfile(os.path.abspath(filename))) os.chmod(filename, 0777) os.utime(filename, None) os.utime(filename, (time.time(), time.time())) # Copy/rename etc tests using the same filename self._do_copyish(filename, filename) # Filename should appear in glob output self.failUnless( os.path.abspath(filename)==os.path.abspath(glob.glob(filename)[0])) # basename should appear in listdir. path, base = os.path.split(os.path.abspath(filename)) if (isinstance (filename, str)): new_base = base.decode(TESTFN_ENCODING) file_list = [f.decode(TESTFN_ENCODING) for f in os.listdir(path)] else: new_base = base file_list = os.listdir(path)
3b04ce824dfba83c5b736138b91aea07d0d2d5da /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3b04ce824dfba83c5b736138b91aea07d0d2d5da/test_unicode_file.py
filename="<testcase>", mode="exec"):
filename="<testcase>", mode="exec", subclass=None):
def _check_error(self, code, errtext, filename="<testcase>", mode="exec"): """Check that compiling code raises SyntaxError with errtext.
777367103c9ab487fb74ce3f3ac8ea2701de328e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/777367103c9ab487fb74ce3f3ac8ea2701de328e/test_syntax.py
test of the exception raised.
test of the exception raised. If subclass is specified it is the expected subclass of SyntaxError (e.g. IndentationError).
def _check_error(self, code, errtext, filename="<testcase>", mode="exec"): """Check that compiling code raises SyntaxError with errtext.
777367103c9ab487fb74ce3f3ac8ea2701de328e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/777367103c9ab487fb74ce3f3ac8ea2701de328e/test_syntax.py
pdir = self.package_dir.get('') if pdir is not None: tail.insert(0, pdir)
def get_package_dir (self, package): """Return the directory, relative to the top of the source distribution, where package 'package' should be found (at least according to the 'package_dir' option, if any)."""
8bbba17d3815a44eefbd0cf33db937a56fe50db5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8bbba17d3815a44eefbd0cf33db937a56fe50db5/build_py.py
if not os.path.isfile (init_py):
if os.path.isfile (init_py): return init_py else:
def check_package (self, package, package_dir):
8bbba17d3815a44eefbd0cf33db937a56fe50db5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8bbba17d3815a44eefbd0cf33db937a56fe50db5/build_py.py
def find_modules (self): # Map package names to tuples of useful info about the package: # (package_dir, checked) # package_dir - the directory where we'll find source files for # this package # checked - true if we have checked that the package directory # is valid (exists, contains __init__.py, ... ?) packages = {}
8bbba17d3815a44eefbd0cf33db937a56fe50db5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8bbba17d3815a44eefbd0cf33db937a56fe50db5/build_py.py
self.check_package (package, package_dir)
init_py = self.check_package (package, package_dir)
def find_modules (self): # Map package names to tuples of useful info about the package: # (package_dir, checked) # package_dir - the directory where we'll find source files for # this package # checked - true if we have checked that the package directory # is valid (exists, contains __init__.py, ... ?) packages = {}
8bbba17d3815a44eefbd0cf33db937a56fe50db5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8bbba17d3815a44eefbd0cf33db937a56fe50db5/build_py.py
modules.append ((package, module, module_file))
modules.append ((package, module_base, module_file))
def find_modules (self): # Map package names to tuples of useful info about the package: # (package_dir, checked) # package_dir - the directory where we'll find source files for # this package # checked - true if we have checked that the package directory # is valid (exists, contains __init__.py, ... ?) packages = {}
8bbba17d3815a44eefbd0cf33db937a56fe50db5 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8bbba17d3815a44eefbd0cf33db937a56fe50db5/build_py.py
if len (words) != 2:
if len (words) < 2:
def read_template (self): """Read and parse the manifest template file named by 'self.template' (usually "MANIFEST.in"). Process all file specifications (include and exclude) in the manifest template and add the resulting filenames to 'self.files'."""
9d5afa9894c2dd18acaf81f6ff52a3591772f40d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9d5afa9894c2dd18acaf81f6ff52a3591772f40d/sdist.py
"'%s' expects a single <pattern>" %
"'%s' expects <pattern1> <pattern2> ..." %
def read_template (self): """Read and parse the manifest template file named by 'self.template' (usually "MANIFEST.in"). Process all file specifications (include and exclude) in the manifest template and add the resulting filenames to 'self.files'."""
9d5afa9894c2dd18acaf81f6ff52a3591772f40d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9d5afa9894c2dd18acaf81f6ff52a3591772f40d/sdist.py
pattern = native_path (words[1])
pattern_list = map(native_path, words[1:])
def read_template (self): """Read and parse the manifest template file named by 'self.template' (usually "MANIFEST.in"). Process all file specifications (include and exclude) in the manifest template and add the resulting filenames to 'self.files'."""
9d5afa9894c2dd18acaf81f6ff52a3591772f40d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9d5afa9894c2dd18acaf81f6ff52a3591772f40d/sdist.py
if len (words) != 3:
if len (words) < 3:
def read_template (self): """Read and parse the manifest template file named by 'self.template' (usually "MANIFEST.in"). Process all file specifications (include and exclude) in the manifest template and add the resulting filenames to 'self.files'."""
9d5afa9894c2dd18acaf81f6ff52a3591772f40d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9d5afa9894c2dd18acaf81f6ff52a3591772f40d/sdist.py
"'%s' expects <dir> <pattern>" %
"'%s' expects <dir> <pattern1> <pattern2> ..." %
def read_template (self): """Read and parse the manifest template file named by 'self.template' (usually "MANIFEST.in"). Process all file specifications (include and exclude) in the manifest template and add the resulting filenames to 'self.files'."""
9d5afa9894c2dd18acaf81f6ff52a3591772f40d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9d5afa9894c2dd18acaf81f6ff52a3591772f40d/sdist.py
(dir, pattern) = map (native_path, words[1:3])
dir = native_path(words[1]) pattern_list = map (native_path, words[2:])
def read_template (self): """Read and parse the manifest template file named by 'self.template' (usually "MANIFEST.in"). Process all file specifications (include and exclude) in the manifest template and add the resulting filenames to 'self.files'."""
9d5afa9894c2dd18acaf81f6ff52a3591772f40d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9d5afa9894c2dd18acaf81f6ff52a3591772f40d/sdist.py
print "include", pattern files = select_pattern (all_files, pattern, anchor=1) if not files: template.warn ("no files found matching '%s'" % pattern) else: self.files.extend (files)
print "include", string.join(pattern_list) for pattern in pattern_list: files = select_pattern (all_files, pattern, anchor=1) if not files: template.warn ("no files found matching '%s'" % pattern) else: self.files.extend (files)
def read_template (self): """Read and parse the manifest template file named by 'self.template' (usually "MANIFEST.in"). Process all file specifications (include and exclude) in the manifest template and add the resulting filenames to 'self.files'."""
9d5afa9894c2dd18acaf81f6ff52a3591772f40d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9d5afa9894c2dd18acaf81f6ff52a3591772f40d/sdist.py
print "exclude", pattern num = exclude_pattern (self.files, pattern, anchor=1) if num == 0: template.warn \ ("no previously-included files found matching '%s'" % pattern)
print "exclude", string.join(pattern_list) for pattern in pattern_list: num = exclude_pattern (self.files, pattern, anchor=1) if num == 0: template.warn ( "no previously-included files found matching '%s'"% pattern)
def read_template (self): """Read and parse the manifest template file named by 'self.template' (usually "MANIFEST.in"). Process all file specifications (include and exclude) in the manifest template and add the resulting filenames to 'self.files'."""
9d5afa9894c2dd18acaf81f6ff52a3591772f40d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9d5afa9894c2dd18acaf81f6ff52a3591772f40d/sdist.py
print "global-include", pattern files = select_pattern (all_files, pattern, anchor=0) if not files: template.warn (("no files found matching '%s' " + "anywhere in distribution") % pattern) else: self.files.extend (files)
print "global-include", string.join(pattern_list) for pattern in pattern_list: files = select_pattern (all_files, pattern, anchor=0) if not files: template.warn (("no files found matching '%s' " + "anywhere in distribution") % pattern) else: self.files.extend (files)
def read_template (self): """Read and parse the manifest template file named by 'self.template' (usually "MANIFEST.in"). Process all file specifications (include and exclude) in the manifest template and add the resulting filenames to 'self.files'."""
9d5afa9894c2dd18acaf81f6ff52a3591772f40d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9d5afa9894c2dd18acaf81f6ff52a3591772f40d/sdist.py
print "global-exclude", pattern num = exclude_pattern (self.files, pattern, anchor=0) if num == 0: template.warn \ (("no previously-included files matching '%s' " + "found anywhere in distribution") % pattern)
print "global-exclude", string.join(pattern_list) for pattern in pattern_list: num = exclude_pattern (self.files, pattern, anchor=0) if num == 0: template.warn \ (("no previously-included files matching '%s' " + "found anywhere in distribution") % pattern)
def read_template (self): """Read and parse the manifest template file named by 'self.template' (usually "MANIFEST.in"). Process all file specifications (include and exclude) in the manifest template and add the resulting filenames to 'self.files'."""
9d5afa9894c2dd18acaf81f6ff52a3591772f40d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9d5afa9894c2dd18acaf81f6ff52a3591772f40d/sdist.py
print "recursive-include", dir, pattern files = select_pattern (all_files, pattern, prefix=dir) if not files: template.warn (("no files found matching '%s' " + "under directory '%s'") % (pattern, dir)) else: self.files.extend (files)
print "recursive-include", dir, string.join(pattern_list) for pattern in pattern_list: files = select_pattern (all_files, pattern, prefix=dir) if not files: template.warn (("no files found matching '%s' " + "under directory '%s'") % (pattern, dir)) else: self.files.extend (files)
def read_template (self): """Read and parse the manifest template file named by 'self.template' (usually "MANIFEST.in"). Process all file specifications (include and exclude) in the manifest template and add the resulting filenames to 'self.files'."""
9d5afa9894c2dd18acaf81f6ff52a3591772f40d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9d5afa9894c2dd18acaf81f6ff52a3591772f40d/sdist.py
print "recursive-exclude", dir, pattern num = exclude_pattern (self.files, pattern, prefix=dir) if num == 0: template.warn \ (("no previously-included files matching '%s' " + "found under directory '%s'") % (pattern, dir))
print "recursive-exclude", dir, string.join(pattern_list) for pattern in pattern_list: num = exclude_pattern (self.files, pattern, prefix=dir) if num == 0: template.warn \ (("no previously-included files matching '%s' " + "found under directory '%s'") % (pattern, dir))
def read_template (self): """Read and parse the manifest template file named by 'self.template' (usually "MANIFEST.in"). Process all file specifications (include and exclude) in the manifest template and add the resulting filenames to 'self.files'."""
9d5afa9894c2dd18acaf81f6ff52a3591772f40d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9d5afa9894c2dd18acaf81f6ff52a3591772f40d/sdist.py
_tryorder = os.environ["BROWSER"].split(":")
_tryorder = os.environ["BROWSER"].split(os.pathsep)
def open_new(self, url): self.open(url)
4b402f207416a448197fc5696ae3a1e4e3fbcac1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/4b402f207416a448197fc5696ae3a1e4e3fbcac1/webbrowser.py
state = ' '
self.state = ' '
def get_token(self): "Get a token from the input stream (or from stack if it's monempty)" if self.pushback: tok = self.pushback[0] self.pushback = self.pushback[1:] if (self.debug >= 1): print "Popping " + tok return tok tok = '' while 1: nextchar = self.instream.read(1); if nextchar == '\n': self.lineno = self.lineno + 1 if self.debug >= 3: print "In state " + repr(self.state) + " I see character: " + repr(nextchar) if self.state == None: return '' elif self.state == ' ': if not nextchar: self.state = None; # end of file break elif nextchar in self.whitespace: if self.debug >= 2: print "I see whitespace in whitespace state" if self.token: break # emit current token else: continue elif nextchar in self.commenters: self.instream.readline() self.lineno = self.lineno + 1 elif nextchar in self.wordchars: self.token = nextchar self.state = 'a' elif nextchar in self.quotes: self.token = nextchar self.state = nextchar else: self.token = nextchar if self.token: break # emit current token else: continue elif self.state in self.quotes: self.token = self.token + nextchar if nextchar == self.state: self.state = ' ' break elif self.state == 'a': if not nextchar: self.state = None; # end of file break elif nextchar in self.whitespace: if self.debug >= 2: print "I see whitespace in word state" self.state = ' ' if self.token: break # emit current token else: continue elif nextchar in self.commenters: self.instream.readline() self.lineno = self.lineno + 1 elif nextchar in self.wordchars or nextchar in self.quotes: self.token = self.token + nextchar else: self.pushback = [nextchar] + self.pushback if self.debug >= 2: print "I see punctuation in word state" state = ' ' if self.token: break # emit current token else: continue result = self.token self.token = '' if self.debug >= 1: print "Token: " + result return result
f247d75507ec767df5ed38e9a2264acb123fe493 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f247d75507ec767df5ed38e9a2264acb123fe493/shlex.py
if (self.compiler.find_library_file(lib_dirs, 'z')): exts.append( Extension('zlib', ['zlibmodule.c'], libraries = ['z']) )
zlib_inc = find_file('zlib.h', [], inc_dirs) if zlib_inc is not None: zlib_h = zlib_inc[0] + '/zlib.h' version = '"0.0.0"' version_req = '"1.1.3"' fp = open(zlib_h) while 1: line = fp.readline() if not line: break if line.find(' version = line.split()[2] break if version >= version_req: if (self.compiler.find_library_file(lib_dirs, 'z')): exts.append( Extension('zlib', ['zlibmodule.c'], libraries = ['z']) )
def detect_modules(self): # Ensure that /usr/local is always used if '/usr/local/lib' not in self.compiler.library_dirs: self.compiler.library_dirs.insert(0, '/usr/local/lib') if '/usr/local/include' not in self.compiler.include_dirs: self.compiler.include_dirs.insert(0, '/usr/local/include' )
e697091c45001a1674434a553d67e15f2c6b13b8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e697091c45001a1674434a553d67e15f2c6b13b8/setup.py
res = platform.libc_ver()
from sys import executable import os if os.path.isdir(executable) and os.path.exists(executable+'.exe'): executable = executable + '.exe' res = platform.libc_ver(executable)
def test_libc_ver(self): res = platform.libc_ver()
06853fc15055686ec02fd2671fd37cda0f69209b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/06853fc15055686ec02fd2671fd37cda0f69209b/test_platform.py
data = self.rfile.read(int(self.headers["content-length"]))
max_chunk_size = 10*1024*1024 size_remaining = int(self.headers["content-length"]) L = [] while size_remaining: chunk_size = min(size_remaining, max_chunk_size) L.append(self.rfile.read(chunk_size)) size_remaining -= len(L[-1]) data = ''.join(L)
def do_POST(self): """Handles the HTTP POST request.
e63fde72f397385e09000e243e16eda7e01e3242 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e63fde72f397385e09000e243e16eda7e01e3242/SimpleXMLRPCServer.py
self.assertEqual(sys.stdout.getvalue().splitlines(), ['0', '0.5', '0'])
if 1/2 == 0: expected = ['0', '0.5', '0'] else: expected = ['0.5', '0.5', '0.5'] self.assertEqual(sys.stdout.getvalue().splitlines(), expected)
def test_input_and_raw_input(self): self.write_testfile() fp = open(TESTFN, 'r') savestdin = sys.stdin savestdout = sys.stdout # Eats the echo try: sys.stdin = fp sys.stdout = BitBucket() self.assertEqual(input(), 2) self.assertEqual(input('testing\n'), 2) self.assertEqual(raw_input(), 'The quick brown fox jumps over the lazy dog.') self.assertEqual(raw_input('testing\n'), 'Dear John') sys.stdin = cStringIO.StringIO("NULL\0") self.assertRaises(TypeError, input, 42, 42) sys.stdin = cStringIO.StringIO(" 'whitespace'") self.assertEqual(input(), 'whitespace') sys.stdin = cStringIO.StringIO() self.assertRaises(EOFError, input)
b82cb8dcd513d49dc674f6973c984628c14cf045 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b82cb8dcd513d49dc674f6973c984628c14cf045/test_builtin.py
def run_suite(suite):
def run_suite(suite, testclass=None):
def run_suite(suite): """Run tests from a unittest.TestSuite-derived class.""" if verbose: runner = unittest.TextTestRunner(sys.stdout, verbosity=2) else: runner = BasicTestRunner() result = runner.run(suite) if not result.wasSuccessful(): if len(result.errors) == 1 and not result.failures: err = result.errors[0][1] elif len(result.failures) == 1 and not result.errors: err = result.failures[0][1] else: raise TestFailed("errors occurred in %s.%s" % (testclass.__module__, testclass.__name__)) raise TestFailed(err)
266410355f7faa7c98b29a16b9f50c56a9224f4b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/266410355f7faa7c98b29a16b9f50c56a9224f4b/test_support.py
raise TestFailed("errors occurred in %s.%s" % (testclass.__module__, testclass.__name__))
if testclass is None: msg = "errors occurred; run in verbose mode for details" else: msg = "errors occurred in %s.%s" \ % (testclass.__module__, testclass.__name__) raise TestFailed(msg)
def run_suite(suite): """Run tests from a unittest.TestSuite-derived class.""" if verbose: runner = unittest.TextTestRunner(sys.stdout, verbosity=2) else: runner = BasicTestRunner() result = runner.run(suite) if not result.wasSuccessful(): if len(result.errors) == 1 and not result.failures: err = result.errors[0][1] elif len(result.failures) == 1 and not result.errors: err = result.failures[0][1] else: raise TestFailed("errors occurred in %s.%s" % (testclass.__module__, testclass.__name__)) raise TestFailed(err)
266410355f7faa7c98b29a16b9f50c56a9224f4b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/266410355f7faa7c98b29a16b9f50c56a9224f4b/test_support.py
run_suite(unittest.makeSuite(testclass))
run_suite(unittest.makeSuite(testclass), testclass)
def run_unittest(testclass): """Run tests from a unittest.TestCase-derived class.""" run_suite(unittest.makeSuite(testclass))
266410355f7faa7c98b29a16b9f50c56a9224f4b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/266410355f7faa7c98b29a16b9f50c56a9224f4b/test_support.py
while 1:
while formlength > 0:
def initfp(self, file): self._file = file self._version = 0 self._decomp = None self._markers = [] self._soundpos = 0 form = self._file.read(4) if form != 'FORM': raise Error, 'file does not start with FORM id' formlength = _read_long(self._file) if formlength <= 0: raise Error, 'invalid FORM chunk data size' formdata = self._file.read(4) formlength = formlength - 4 if formdata == 'AIFF': self._aifc = 0 elif formdata == 'AIFC': self._aifc = 1 else: raise Error, 'not an AIFF or AIFF-C file' self._comm_chunk_read = 0 while 1: self._ssnd_seek_needed = 1 try: chunk = Chunk().init(self._file) except EOFError: raise Error, 'COMM chunk and/or SSND chunk missing' formlength = formlength - 8 - chunk.chunksize if chunk.chunksize & 1: formlength = formlength - 1 if chunk.chunkname == 'COMM': self._read_comm_chunk(chunk) self._comm_chunk_read = 1 elif chunk.chunkname == 'SSND': self._ssnd_chunk = chunk dummy = chunk.read(8) self._ssnd_seek_needed = 0 if formlength <= 0: if not self._comm_chunk_read: raise Error, 'COMM chunk missing' break elif chunk.chunkname == 'FVER': self._version = _read_long(chunk) elif chunk.chunkname == 'MARK': self._readmark(chunk) elif chunk.chunkname in _skiplist: pass else: raise Error, 'unrecognized chunk type '+chunk.chunkname chunk.skip() if self._aifc and self._decomp: params = [CL.ORIGINAL_FORMAT, 0, \ CL.BITS_PER_COMPONENT, 0, \ CL.FRAME_RATE, self._framerate] if self._nchannels == AL.MONO: params[1] = CL.MONO else: params[1] = CL.STEREO_INTERLEAVED if self._sampwidth == AL.SAMPLE_8: params[3] = 8 elif self._sampwidth == AL.SAMPLE_16: params[3] = 16 else: params[3] = 24 self._decomp.SetParams(params) return self
7564a641e50de5f4aa569e1413269d71701dee5b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7564a641e50de5f4aa569e1413269d71701dee5b/aifc.py
try: chunk = Chunk().init(self._file) except EOFError: raise Error, 'COMM chunk and/or SSND chunk missing'
chunk = Chunk().init(self._file)
def initfp(self, file): self._file = file self._version = 0 self._decomp = None self._markers = [] self._soundpos = 0 form = self._file.read(4) if form != 'FORM': raise Error, 'file does not start with FORM id' formlength = _read_long(self._file) if formlength <= 0: raise Error, 'invalid FORM chunk data size' formdata = self._file.read(4) formlength = formlength - 4 if formdata == 'AIFF': self._aifc = 0 elif formdata == 'AIFC': self._aifc = 1 else: raise Error, 'not an AIFF or AIFF-C file' self._comm_chunk_read = 0 while 1: self._ssnd_seek_needed = 1 try: chunk = Chunk().init(self._file) except EOFError: raise Error, 'COMM chunk and/or SSND chunk missing' formlength = formlength - 8 - chunk.chunksize if chunk.chunksize & 1: formlength = formlength - 1 if chunk.chunkname == 'COMM': self._read_comm_chunk(chunk) self._comm_chunk_read = 1 elif chunk.chunkname == 'SSND': self._ssnd_chunk = chunk dummy = chunk.read(8) self._ssnd_seek_needed = 0 if formlength <= 0: if not self._comm_chunk_read: raise Error, 'COMM chunk missing' break elif chunk.chunkname == 'FVER': self._version = _read_long(chunk) elif chunk.chunkname == 'MARK': self._readmark(chunk) elif chunk.chunkname in _skiplist: pass else: raise Error, 'unrecognized chunk type '+chunk.chunkname chunk.skip() if self._aifc and self._decomp: params = [CL.ORIGINAL_FORMAT, 0, \ CL.BITS_PER_COMPONENT, 0, \ CL.FRAME_RATE, self._framerate] if self._nchannels == AL.MONO: params[1] = CL.MONO else: params[1] = CL.STEREO_INTERLEAVED if self._sampwidth == AL.SAMPLE_8: params[3] = 8 elif self._sampwidth == AL.SAMPLE_16: params[3] = 16 else: params[3] = 24 self._decomp.SetParams(params) return self
7564a641e50de5f4aa569e1413269d71701dee5b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7564a641e50de5f4aa569e1413269d71701dee5b/aifc.py
if formlength <= 0: if not self._comm_chunk_read: raise Error, 'COMM chunk missing' break
def initfp(self, file): self._file = file self._version = 0 self._decomp = None self._markers = [] self._soundpos = 0 form = self._file.read(4) if form != 'FORM': raise Error, 'file does not start with FORM id' formlength = _read_long(self._file) if formlength <= 0: raise Error, 'invalid FORM chunk data size' formdata = self._file.read(4) formlength = formlength - 4 if formdata == 'AIFF': self._aifc = 0 elif formdata == 'AIFC': self._aifc = 1 else: raise Error, 'not an AIFF or AIFF-C file' self._comm_chunk_read = 0 while 1: self._ssnd_seek_needed = 1 try: chunk = Chunk().init(self._file) except EOFError: raise Error, 'COMM chunk and/or SSND chunk missing' formlength = formlength - 8 - chunk.chunksize if chunk.chunksize & 1: formlength = formlength - 1 if chunk.chunkname == 'COMM': self._read_comm_chunk(chunk) self._comm_chunk_read = 1 elif chunk.chunkname == 'SSND': self._ssnd_chunk = chunk dummy = chunk.read(8) self._ssnd_seek_needed = 0 if formlength <= 0: if not self._comm_chunk_read: raise Error, 'COMM chunk missing' break elif chunk.chunkname == 'FVER': self._version = _read_long(chunk) elif chunk.chunkname == 'MARK': self._readmark(chunk) elif chunk.chunkname in _skiplist: pass else: raise Error, 'unrecognized chunk type '+chunk.chunkname chunk.skip() if self._aifc and self._decomp: params = [CL.ORIGINAL_FORMAT, 0, \ CL.BITS_PER_COMPONENT, 0, \ CL.FRAME_RATE, self._framerate] if self._nchannels == AL.MONO: params[1] = CL.MONO else: params[1] = CL.STEREO_INTERLEAVED if self._sampwidth == AL.SAMPLE_8: params[3] = 8 elif self._sampwidth == AL.SAMPLE_16: params[3] = 16 else: params[3] = 24 self._decomp.SetParams(params) return self
7564a641e50de5f4aa569e1413269d71701dee5b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7564a641e50de5f4aa569e1413269d71701dee5b/aifc.py
def setmark(self, (id, pos, name)):
def setmark(self, id, pos, name):
def setmark(self, (id, pos, name)): if id <= 0: raise Error, 'marker ID must be > 0' if pos < 0: raise Error, 'marker position must be >= 0' if type(name) != type(''): raise Error, 'marker name must be a string' for i in range(len(self._markers)): if id == self._markers[i][0]: self._markers[i] = id, pos, name return self._markers.append((id, pos, name))
7564a641e50de5f4aa569e1413269d71701dee5b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7564a641e50de5f4aa569e1413269d71701dee5b/aifc.py
self._nframes == self._nframeswritten:
self._nframes == self._nframeswritten and \ self._marklength == 0:
def _patchheader(self): curpos = self._file.tell() if self._datawritten & 1: datalength = self._datawritten + 1 self._file.write(chr(0)) else: datalength = self._datawritten if datalength == self._datalength and \ self._nframes == self._nframeswritten: self._file.seek(curpos, 0) return self._file.seek(self._form_length_pos, 0) dummy = self._write_form_length(datalength) self._file.seek(self._nframes_pos, 0) _write_long(self._file, self._nframeswritten) self._file.seek(self._ssnd_length_pos, 0) _write_long(self._file, datalength + 8) self._file.seek(curpos, 0) self._nframes = self._nframeswritten self._datalength = datalength
7564a641e50de5f4aa569e1413269d71701dee5b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7564a641e50de5f4aa569e1413269d71701dee5b/aifc.py
_write_short(len(self._file, markers))
_write_short(self._file, len(self._markers))
def _writemarkers(self): if len(self._markers) == 0: return self._file.write('MARK') length = 2 for marker in self._markers: id, pos, name = marker length = length + len(name) + 1 + 6 if len(name) & 1 == 0: length = length + 1 _write_long(self._file, length) self._marklength = length + 8 _write_short(len(self._file, markers)) for marker in self._markers: id, pos, name = marker _write_short(self._file, id) _write_long(self._file, pos) _write_string(self._file, name)
7564a641e50de5f4aa569e1413269d71701dee5b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7564a641e50de5f4aa569e1413269d71701dee5b/aifc.py
self.compiler.find_library_file(lib_dirs, 'panel')):
self.compiler.find_library_file(lib_dirs, panel_library)):
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')
86070428898b811339b0e4454e10ebf6f6ad4641 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/86070428898b811339b0e4454e10ebf6f6ad4641/setup.py
libraries = ['panel'] + curses_libs) )
libraries = [panel_library] + curses_libs) )
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')
86070428898b811339b0e4454e10ebf6f6ad4641 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/86070428898b811339b0e4454e10ebf6f6ad4641/setup.py
path = unquote(path)
def ftp_open(self, req): host = req.get_host() if not host: raise IOError, ('ftp error', 'no host given') # XXX handle custom username & password try: host = socket.gethostbyname(host) except socket.error, msg: raise URLError(msg) host, port = splitport(host) if port is None: port = ftplib.FTP_PORT path, attrs = splitattr(req.get_selector()) path = unquote(path) dirs = path.split('/') dirs, file = dirs[:-1], dirs[-1] if dirs and not dirs[0]: dirs = dirs[1:] user = passwd = '' # XXX try: fw = self.connect_ftp(user, passwd, host, port, dirs) type = file and 'I' or 'D' for attr in attrs: attr, value = splitattr(attr) if attr.lower() == 'type' and \ value in ('a', 'A', 'i', 'I', 'd', 'D'): type = value.upper() fp, retrlen = fw.retrfile(file, type) headers = "" mtype = mimetypes.guess_type(req.get_full_url())[0] if mtype: headers += "Content-type: %s\n" % mtype if retrlen is not None and retrlen >= 0: headers += "Content-length: %d\n" % retrlen sf = StringIO(headers) headers = mimetools.Message(sf) return addinfourl(fp, headers, req.get_full_url()) except ftplib.all_errors, msg: raise IOError, ('ftp error', msg), sys.exc_info()[2]
7db04e7c4802022cfb3a1daacab333cd9efd5a78 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7db04e7c4802022cfb3a1daacab333cd9efd5a78/urllib2.py
print self.skip, self.stack,
print '!'*self.debugging, 'process:', self.skip, self.stack,
def process(self, accu): if self.debugging > 1: print self.skip, self.stack, if accu: print accu[0][:30], if accu[0][30:] or accu[1:]: print '...', print if self.stack and self.stack[-1] == 'menu': # XXX should be done differently for line in accu: mo = miprog.match(line) if not mo: line = string.strip(line) + '\n' self.expand(line) continue bgn, end = mo.span(0) a, b = mo.span(1) c, d = mo.span(2) e, f = mo.span(3) g, h = mo.span(4) label = line[a:b] nodename = line[c:d] if nodename[0] == ':': nodename = label else: nodename = line[e:f] punct = line[g:h] self.write(' <LI><A HREF="', makefile(nodename), '">', nodename, '</A>', punct, '\n') self.expand(line[end:]) else: text = string.joinfields(accu, '') self.expand(text)
ef5864ed718f5261a00bf695aae3b38b624408c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ef5864ed718f5261a00bf695aae3b38b624408c2/texi2html.py
if self.stack and self.stack[-1] == 'menu':
if self.inmenu():
def process(self, accu): if self.debugging > 1: print self.skip, self.stack, if accu: print accu[0][:30], if accu[0][30:] or accu[1:]: print '...', print if self.stack and self.stack[-1] == 'menu': # XXX should be done differently for line in accu: mo = miprog.match(line) if not mo: line = string.strip(line) + '\n' self.expand(line) continue bgn, end = mo.span(0) a, b = mo.span(1) c, d = mo.span(2) e, f = mo.span(3) g, h = mo.span(4) label = line[a:b] nodename = line[c:d] if nodename[0] == ':': nodename = label else: nodename = line[e:f] punct = line[g:h] self.write(' <LI><A HREF="', makefile(nodename), '">', nodename, '</A>', punct, '\n') self.expand(line[end:]) else: text = string.joinfields(accu, '') self.expand(text)
ef5864ed718f5261a00bf695aae3b38b624408c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ef5864ed718f5261a00bf695aae3b38b624408c2/texi2html.py
if self.debugging: print '--> file', `file`
print '!'*self.debugging, '--> file', `file`
def do_include(self, args): file = args file = os.path.join(self.includedir, file) try: fp = open(file, 'r') except IOError, msg: print '*** Can\'t open include file', `file` return if self.debugging: print '--> file', `file` save_done = self.done save_skip = self.skip save_stack = self.stack self.includedepth = self.includedepth + 1 self.parserest(fp, 0) self.includedepth = self.includedepth - 1 fp.close() self.done = save_done self.skip = save_skip self.stack = save_stack if self.debugging: print '<-- file', `file`
ef5864ed718f5261a00bf695aae3b38b624408c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ef5864ed718f5261a00bf695aae3b38b624408c2/texi2html.py
if self.debugging: print '<-- file', `file`
print '!'*self.debugging, '<-- file', `file`
def do_include(self, args): file = args file = os.path.join(self.includedir, file) try: fp = open(file, 'r') except IOError, msg: print '*** Can\'t open include file', `file` return if self.debugging: print '--> file', `file` save_done = self.done save_skip = self.skip save_stack = self.stack self.includedepth = self.includedepth + 1 self.parserest(fp, 0) self.includedepth = self.includedepth - 1 fp.close() self.done = save_done self.skip = save_skip self.stack = save_stack if self.debugging: print '<-- file', `file`
ef5864ed718f5261a00bf695aae3b38b624408c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ef5864ed718f5261a00bf695aae3b38b624408c2/texi2html.py
print self.skip, self.stack, '@' + cmd, args
print '!'*self.debugging, 'command:', self.skip, self.stack, \ '@' + cmd, args
def command(self, line, mo): a, b = mo.span(1) cmd = line[a:b] args = string.strip(line[b:]) if self.debugging > 1: print self.skip, self.stack, '@' + cmd, args try: func = getattr(self, 'do_' + cmd) except AttributeError: try: func = getattr(self, 'bgn_' + cmd) except AttributeError: # don't complain if we are skipping anyway if not self.skip: self.unknown_cmd(cmd, args) return self.stack.append(cmd) func(args) return if not self.skip or cmd == 'end': func(args)
ef5864ed718f5261a00bf695aae3b38b624408c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ef5864ed718f5261a00bf695aae3b38b624408c2/texi2html.py
print self.values
def do_set(self, args): fields = string.splitfields(args, ' ') key = fields[0] if len(fields) == 1: value = 1 else: value = string.joinfields(fields[1:], ' ') self.values[key] = value print self.values
ef5864ed718f5261a00bf695aae3b38b624408c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ef5864ed718f5261a00bf695aae3b38b624408c2/texi2html.py
print self.stack print self.stackinfo if self.stackinfo[len(self.stack) + 1]: self.skip = self.skip - 1 del self.stackinfo[len(self.stack) + 1]
try: if self.stackinfo[len(self.stack) + 1]: self.skip = self.skip - 1 del self.stackinfo[len(self.stack) + 1] except KeyError: print '*** end_ifset: KeyError :', len(self.stack) + 1
def end_ifset(self): print self.stack print self.stackinfo if self.stackinfo[len(self.stack) + 1]: self.skip = self.skip - 1 del self.stackinfo[len(self.stack) + 1]
ef5864ed718f5261a00bf695aae3b38b624408c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ef5864ed718f5261a00bf695aae3b38b624408c2/texi2html.py
end_ifclear = end_ifset
def end_ifclear(self): try: if self.stackinfo[len(self.stack) + 1]: self.skip = self.skip - 1 del self.stackinfo[len(self.stack) + 1] except KeyError: print '*** end_ifclear: KeyError :', len(self.stack) + 1
def bgn_ifclear(self, args): if args in self.values.keys() \ and self.values[args] is not None: self.skip = self.skip + 1 self.stackinfo[len(self.stack)] = 1 else: self.stackinfo[len(self.stack)] = 0
ef5864ed718f5261a00bf695aae3b38b624408c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ef5864ed718f5261a00bf695aae3b38b624408c2/texi2html.py
print args
def do_settitle(self, args): print args self.startsaving() self.expand(args) self.title = self.collectsavings() print self.title
ef5864ed718f5261a00bf695aae3b38b624408c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ef5864ed718f5261a00bf695aae3b38b624408c2/texi2html.py
print self.title
def do_settitle(self, args): print args self.startsaving() self.expand(args) self.title = self.collectsavings() print self.title
ef5864ed718f5261a00bf695aae3b38b624408c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ef5864ed718f5261a00bf695aae3b38b624408c2/texi2html.py
if self.debugging: print '--- writing', file
if self.debugging: print '!'*self.debugging, '--- writing', file
def do_node(self, args): self.endnode() self.nodelineno = 0 parts = string.splitfields(args, ',') while len(parts) < 4: parts.append('') for i in range(4): parts[i] = string.strip(parts[i]) self.nodelinks = parts [name, next, prev, up] = parts[:4] file = self.dirname + '/' + makefile(name) if self.filenames.has_key(file): print '*** Filename already in use: ', file else: if self.debugging: print '--- writing', file self.filenames[file] = 1 # self.nodefp = open(file, 'w') self.nodename = name if self.cont and self.nodestack: self.nodestack[-1].cont = self.nodename if not self.topname: self.topname = name title = name if self.title: title = title + ' -- ' + self.title self.node = self.Node(self.dirname, self.nodename, self.topname, title, next, prev, up)
ef5864ed718f5261a00bf695aae3b38b624408c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ef5864ed718f5261a00bf695aae3b38b624408c2/texi2html.py
if self.itemarg[0] == '@' and self.itemarg[1:2] and \
if self.itemarg[0] == '@' and self.itemarg[1] and \
def do_item(self, args): if self.itemindex: self.index(self.itemindex, args) if self.itemarg: if self.itemarg[0] == '@' and self.itemarg[1:2] and \ self.itemarg[1] in string.ascii_letters: args = self.itemarg + '{' + args + '}' else: # some other character, e.g. '-' args = self.itemarg + ' ' + args if self.itemnumber <> None: args = self.itemnumber + '. ' + args self.itemnumber = increment(self.itemnumber) if self.stack and self.stack[-1] == 'table': self.write('<DT>') self.expand(args) self.write('\n<DD>') else: self.write('<LI>') self.expand(args) self.write(' ')
ef5864ed718f5261a00bf695aae3b38b624408c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ef5864ed718f5261a00bf695aae3b38b624408c2/texi2html.py
print '--- Generating', self.indextitle[name], 'index'
print '!'*self.debugging, '--- Generating', \ self.indextitle[name], 'index'
def prindex(self, name): iscodeindex = (name not in self.noncodeindices) index = self.whichindex[name] if not index: return if self.debugging: print '--- Generating', self.indextitle[name], 'index' # The node already provides a title index1 = [] junkprog = re.compile('^(@[a-z]+)?{') for key, node in index: sortkey = string.lower(key) # Remove leading `@cmd{' from sort key # -- don't bother about the matching `}' oldsortkey = sortkey while 1: mo = junkprog.match(sortkey) if not mo: break i = mo.end() sortkey = sortkey[i:] index1.append((sortkey, key, node)) del index[:] index1.sort() self.write('<DL COMPACT>\n') prevkey = prevnode = None for sortkey, key, node in index1: if (key, node) == (prevkey, prevnode): continue if self.debugging > 1: print key, ':', node self.write('<DT>') if iscodeindex: key = '@code{' + key + '}' if key != prevkey: self.expand(key) self.write('\n<DD><A HREF="%s">%s</A>\n' % (makefile(node), node)) prevkey, prevnode = key, node self.write('</DL>\n')
ef5864ed718f5261a00bf695aae3b38b624408c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ef5864ed718f5261a00bf695aae3b38b624408c2/texi2html.py
if self.debugging > 1: print key, ':', node
if self.debugging > 1: print '!'*self.debugging, key, ':', node
def prindex(self, name): iscodeindex = (name not in self.noncodeindices) index = self.whichindex[name] if not index: return if self.debugging: print '--- Generating', self.indextitle[name], 'index' # The node already provides a title index1 = [] junkprog = re.compile('^(@[a-z]+)?{') for key, node in index: sortkey = string.lower(key) # Remove leading `@cmd{' from sort key # -- don't bother about the matching `}' oldsortkey = sortkey while 1: mo = junkprog.match(sortkey) if not mo: break i = mo.end() sortkey = sortkey[i:] index1.append((sortkey, key, node)) del index[:] index1.sort() self.write('<DL COMPACT>\n') prevkey = prevnode = None for sortkey, key, node in index1: if (key, node) == (prevkey, prevnode): continue if self.debugging > 1: print key, ':', node self.write('<DT>') if iscodeindex: key = '@code{' + key + '}' if key != prevkey: self.expand(key) self.write('\n<DD><A HREF="%s">%s</A>\n' % (makefile(node), node)) prevkey, prevnode = key, node self.write('</DL>\n')
ef5864ed718f5261a00bf695aae3b38b624408c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ef5864ed718f5261a00bf695aae3b38b624408c2/texi2html.py
while sys.argv[1:2] == ['-d']:
htmlhelp = '' while sys.argv[1] == ['-d']:
def test(): import sys debugging = 0 print_headers = 0 cont = 0 html3 = 0 while sys.argv[1:2] == ['-d']: debugging = debugging + 1 del sys.argv[1:2] if sys.argv[1] == '-p': print_headers = 1 del sys.argv[1] if sys.argv[1] == '-c': cont = 1 del sys.argv[1] if sys.argv[1] == '-3': html3 = 1 del sys.argv[1] if len(sys.argv) <> 3: print 'usage: texi2html [-d [-d]] [-p] [-c] inputfile outputdirectory' sys.exit(2) if html3: parser = TexinfoParserHTML3() else: parser = TexinfoParser() parser.cont = cont parser.debugging = debugging parser.print_headers = print_headers file = sys.argv[1] parser.setdirname(sys.argv[2]) if file == '-': fp = sys.stdin else: parser.setincludedir(os.path.dirname(file)) try: fp = open(file, 'r') except IOError, msg: print file, ':', msg sys.exit(1) parser.parse(fp) fp.close() parser.report()
ef5864ed718f5261a00bf695aae3b38b624408c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ef5864ed718f5261a00bf695aae3b38b624408c2/texi2html.py
del sys.argv[1:2]
del sys.argv[1]
def test(): import sys debugging = 0 print_headers = 0 cont = 0 html3 = 0 while sys.argv[1:2] == ['-d']: debugging = debugging + 1 del sys.argv[1:2] if sys.argv[1] == '-p': print_headers = 1 del sys.argv[1] if sys.argv[1] == '-c': cont = 1 del sys.argv[1] if sys.argv[1] == '-3': html3 = 1 del sys.argv[1] if len(sys.argv) <> 3: print 'usage: texi2html [-d [-d]] [-p] [-c] inputfile outputdirectory' sys.exit(2) if html3: parser = TexinfoParserHTML3() else: parser = TexinfoParser() parser.cont = cont parser.debugging = debugging parser.print_headers = print_headers file = sys.argv[1] parser.setdirname(sys.argv[2]) if file == '-': fp = sys.stdin else: parser.setincludedir(os.path.dirname(file)) try: fp = open(file, 'r') except IOError, msg: print file, ':', msg sys.exit(1) parser.parse(fp) fp.close() parser.report()
ef5864ed718f5261a00bf695aae3b38b624408c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ef5864ed718f5261a00bf695aae3b38b624408c2/texi2html.py
print 'usage: texi2html [-d [-d]] [-p] [-c] inputfile outputdirectory'
print 'usage: texi2hh [-d [-d]] [-p] [-c] [-3] [-H htmlhelp]', \ 'inputfile outputdirectory'
def test(): import sys debugging = 0 print_headers = 0 cont = 0 html3 = 0 while sys.argv[1:2] == ['-d']: debugging = debugging + 1 del sys.argv[1:2] if sys.argv[1] == '-p': print_headers = 1 del sys.argv[1] if sys.argv[1] == '-c': cont = 1 del sys.argv[1] if sys.argv[1] == '-3': html3 = 1 del sys.argv[1] if len(sys.argv) <> 3: print 'usage: texi2html [-d [-d]] [-p] [-c] inputfile outputdirectory' sys.exit(2) if html3: parser = TexinfoParserHTML3() else: parser = TexinfoParser() parser.cont = cont parser.debugging = debugging parser.print_headers = print_headers file = sys.argv[1] parser.setdirname(sys.argv[2]) if file == '-': fp = sys.stdin else: parser.setincludedir(os.path.dirname(file)) try: fp = open(file, 'r') except IOError, msg: print file, ':', msg sys.exit(1) parser.parse(fp) fp.close() parser.report()
ef5864ed718f5261a00bf695aae3b38b624408c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ef5864ed718f5261a00bf695aae3b38b624408c2/texi2html.py
parser.setdirname(sys.argv[2]) if file == '-': fp = sys.stdin else:
dirname = sys.argv[2] parser.setdirname(dirname)
def test(): import sys debugging = 0 print_headers = 0 cont = 0 html3 = 0 while sys.argv[1:2] == ['-d']: debugging = debugging + 1 del sys.argv[1:2] if sys.argv[1] == '-p': print_headers = 1 del sys.argv[1] if sys.argv[1] == '-c': cont = 1 del sys.argv[1] if sys.argv[1] == '-3': html3 = 1 del sys.argv[1] if len(sys.argv) <> 3: print 'usage: texi2html [-d [-d]] [-p] [-c] inputfile outputdirectory' sys.exit(2) if html3: parser = TexinfoParserHTML3() else: parser = TexinfoParser() parser.cont = cont parser.debugging = debugging parser.print_headers = print_headers file = sys.argv[1] parser.setdirname(sys.argv[2]) if file == '-': fp = sys.stdin else: parser.setincludedir(os.path.dirname(file)) try: fp = open(file, 'r') except IOError, msg: print file, ':', msg sys.exit(1) parser.parse(fp) fp.close() parser.report()
ef5864ed718f5261a00bf695aae3b38b624408c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ef5864ed718f5261a00bf695aae3b38b624408c2/texi2html.py
except (ImportError, AttributeError): def _set_cloexec(fd): pass
def _set_cloexec(fd): flags = _fcntl.fcntl(fd, _fcntl.F_GETFD, 0) if flags >= 0: # flags read successfully, modify flags |= _fcntl.FD_CLOEXEC _fcntl.fcntl(fd, _fcntl.F_SETFD, flags)
291f14e3d386714ea937489e1863bed7f818a970 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/291f14e3d386714ea937489e1863bed7f818a970/tempfile.py
def __init__(self): self.data = {} def __repr__(self): return repr(self.data) def __cmp__(self, dict): if type(dict) == type(self.data): return cmp(self.data, dict) else: return cmp(self.data, dict.data) def __len__(self): return len(self.data) def __getitem__(self, key): return self.data[key] def __setitem__(self, key, item): self.data[key] = item def __delitem__(self, key): del self.data[key] def clear(self): return self.data.clear() def copy(self): if self.__class__ is UserDict: new = UserDict() new.dict = self.data.copy() else: new = self.__class__() for k, v in self.items(): new[k] = v return new def keys(self): return self.data.keys() def items(self): return self.data.items() def values(self): return self.data.values() def has_key(self, key): return self.data.has_key(key) def update(self, other): if type(other) is type(self.data): self.data.update(other) else: for k, v in other.items(): self.data[k] = v
def __init__(self): self.data = {} def __repr__(self): return repr(self.data) def __cmp__(self, dict): if type(dict) == type(self.data): return cmp(self.data, dict) else: return cmp(self.data, dict.data) def __len__(self): return len(self.data) def __getitem__(self, key): return self.data[key] def __setitem__(self, key, item): self.data[key] = item def __delitem__(self, key): del self.data[key] def clear(self): return self.data.clear() def copy(self): import copy return copy.copy(self) def keys(self): return self.data.keys() def items(self): return self.data.items() def values(self): return self.data.values() def has_key(self, key): return self.data.has_key(key) def update(self, other): if type(other) is type(self.data): self.data.update(other) else: for k, v in other.items(): self.data[k] = v
def __init__(self): self.data = {}
b94cd96977ac4d3c2c335ff7d72033d818d59d84 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b94cd96977ac4d3c2c335ff7d72033d818d59d84/UserDict.py
s.bind('', self.port)
s.bind(('', self.port))
def __init__(self, port=None, connection_hook=None): self.connections = [] self.port = port or self.default_port self.connection_hook = connection_hook
9a580c440c4f064a92bbc537ac3a2df1c0998afc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9a580c440c4f064a92bbc537ac3a2df1c0998afc/protocol.py
@bigmemtest(minsize=_2G, memuse=8)
@bigmemtest(minsize=_2G, memuse=9)
def test_repr_large(self, size): return self.basic_test_repr(size)
b5ccd1416e19773f541256480a014a847bfc53f9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b5ccd1416e19773f541256480a014a847bfc53f9/test_bigmem.py
@bigmemtest(minsize=_2G + 10, memuse=8)
@bigmemtest(minsize=_2G + 10, memuse=9)
def test_index(self, size): l = [1L, 2L, 3L, 4L, 5L] * (size // 5) self.assertEquals(l.index(1), 0) self.assertEquals(l.index(5, size - 5), size - 1) self.assertEquals(l.index(5, size - 5, size), size - 1) self.assertRaises(ValueError, l.index, 1, size - 4, size) self.assertRaises(ValueError, l.index, 6L)
b5ccd1416e19773f541256480a014a847bfc53f9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b5ccd1416e19773f541256480a014a847bfc53f9/test_bigmem.py
MIN_SQLITE_VERSION = 3002002
MIN_SQLITE_VERSION_NUMBER = 3000008 MIN_SQLITE_VERSION = "3.0.8"
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')
07f5b35e190ab9be85143c6e8e1217d96bbf75ca /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/07f5b35e190ab9be85143c6e8e1217d96bbf75ca/setup.py
if db_setup_debug: print "found %s"%f
if sqlite_setup_debug: print "sqlite: found %s"%f
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')
07f5b35e190ab9be85143c6e8e1217d96bbf75ca /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/07f5b35e190ab9be85143c6e8e1217d96bbf75ca/setup.py
if sqlite_version >= MIN_SQLITE_VERSION:
if sqlite_version >= MIN_SQLITE_VERSION_NUMBER:
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')
07f5b35e190ab9be85143c6e8e1217d96bbf75ca /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/07f5b35e190ab9be85143c6e8e1217d96bbf75ca/setup.py
if db_setup_debug:
if sqlite_setup_debug:
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')
07f5b35e190ab9be85143c6e8e1217d96bbf75ca /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/07f5b35e190ab9be85143c6e8e1217d96bbf75ca/setup.py
self.relative = 0
def initialize_options (self): self.bdist_dir = None self.plat_name = None self.format = None self.keep_temp = 0 self.dist_dir = None self.skip_build = 0
acd5cb2ff075e9ef3d0952806dbe1ef9a2f00882 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/acd5cb2ff075e9ef3d0952806dbe1ef9a2f00882/bdist_dumb.py
self.make_archive(os.path.join(self.dist_dir, archive_basename), self.format, root_dir=self.bdist_dir)
pseudoinstall_root = os.path.join(self.dist_dir, archive_basename) if not self.relative: archive_root = self.bdist_dir else: if (self.distribution.has_ext_modules() and (install.install_base != install.install_platbase)): raise DistutilsPlatformError, \ ("can't make a dumb built distribution where " "base and platbase are different (%s, %s)" % (repr(install.install_base), repr(install.install_platbase))) else: archive_root = os.path.join(self.bdist_dir, ensure_relative(install.install_base)) self.make_archive(pseudoinstall_root, self.format, root_dir=archive_root)
def run (self):
acd5cb2ff075e9ef3d0952806dbe1ef9a2f00882 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/acd5cb2ff075e9ef3d0952806dbe1ef9a2f00882/bdist_dumb.py
print 'cwd', os.getcwd() print 'fsspec', macfs.FSSpec(fullname) raise
print '*** Copy failed mysteriously, try again' print '*** cwd', os.getcwd() print '*** fsspec', macfs.FSSpec(fullname) try: i = 1 / 0 except: pass macostools.copy(fullname, os.path.join(destprefix, dest), 1)
def rundir(self, path, destprefix, doit): files = os.listdir(path) todo = [] rv = 1 for f in files: if self.exc.match(f): continue fullname = os.path.join(path, f) if os.path.isdir(fullname): todo.append(fullname) else: dest = self.inc.match(fullname) if dest == None: print 'Not yet resolved:', fullname rv = 0 if dest: if doit: print 'COPY ', fullname print ' -> ', os.path.join(destprefix, dest) try: macostools.copy(fullname, os.path.join(destprefix, dest), 1) except: #DBG print 'cwd', os.getcwd() #DBG print 'fsspec', macfs.FSSpec(fullname) #DBG raise for d in todo: if not self.rundir(d, destprefix, doit): rv = 0 return rv
36bcf9b94f8cbec99881f07225f4c682a7fecbe2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/36bcf9b94f8cbec99881f07225f4c682a7fecbe2/MkDistr.py
if args and (len(args) == 1) and args[0]:
if args and (len(args) == 1) and args[0] and (type(args[0]) == types.DictType):
def __init__(self, name, level, pathname, lineno, msg, args, exc_info): """ Initialize a logging record with interesting information. """ ct = time.time() self.name = name self.msg = msg # # The following statement allows passing of a dictionary as a sole # argument, so that you can do something like # logging.debug("a %(a)d b %(b)s", {'a':1, 'b':2}) # Suggested by Stefan Behnel. # Note that without the test for args[0], we get a problem because # during formatting, we test to see if the arg is present using # 'if self.args:'. If the event being logged is e.g. 'Value is %d' # and if the passed arg fails 'if self.args:' then no formatting # is done. For example, logger.warn('Value is %d', 0) would log # 'Value is %d' instead of 'Value is 0'. # For the use case of passing a dictionary, this should not be a # problem. if args and (len(args) == 1) and args[0]: args = args[0] self.args = args self.levelname = getLevelName(level) self.levelno = level self.pathname = pathname try: self.filename = os.path.basename(pathname) self.module = os.path.splitext(self.filename)[0] except: self.filename = pathname self.module = "Unknown module" self.exc_info = exc_info self.exc_text = None # used to cache the traceback text self.lineno = lineno self.created = ct self.msecs = (ct - long(ct)) * 1000 self.relativeCreated = (self.created - _startTime) * 1000 if thread: self.thread = thread.get_ident() else: self.thread = None if hasattr(os, 'getpid'): self.process = os.getpid() else: self.process = None
dccd4321a70c05b94b2efff28b416df440262cb8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dccd4321a70c05b94b2efff28b416df440262cb8/__init__.py
def translation(domain, localedir=None, languages=None, class_=None):
def translation(domain, localedir=None, languages=None, class_=None, fallback=0):
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? # Avoid opening, reading, and parsing the .mo file after it's been done # once. t = _translations.get(key) if t is None: t = _translations.setdefault(key, class_(open(mofile, 'rb'))) return t
1be641987145f88d61e52d5b4714a8cc6c7e6da8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1be641987145f88d61e52d5b4714a8cc6c7e6da8/gettext.py
translation(domain, localedir).install(unicode)
translation(domain, localedir, fallback=1).install(unicode)
def install(domain, localedir=None, unicode=0): translation(domain, localedir).install(unicode)
1be641987145f88d61e52d5b4714a8cc6c7e6da8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1be641987145f88d61e52d5b4714a8cc6c7e6da8/gettext.py
supported_dists=('SuSE','debian','redhat','mandrake')):
supported_dists=('SuSE', 'debian', 'fedora', 'redhat', 'mandrake')):
def dist(distname='',version='',id='', supported_dists=('SuSE','debian','redhat','mandrake')): """ Tries to determine the name of the Linux OS distribution name. The function first looks for a distribution release file in /etc and then reverts to _dist_try_harder() in case no suitable files are found. Returns a tuple (distname,version,id) which default to the args given as parameters. """ try: etc = os.listdir('/etc') except os.error: # Probably not a Unix system return distname,version,id for file in etc: m = _release_filename.match(file) if m: _distname,dummy = m.groups() if _distname in supported_dists: distname = _distname break else: return _dist_try_harder(distname,version,id) f = open('/etc/'+file,'r') firstline = f.readline() f.close() m = _release_version.search(firstline) if m: _version,_id = m.groups() if _version: version = _version if _id: id = _id else: # Unkown format... take the first two words l = string.split(string.strip(firstline)) if l: version = l[0] if len(l) > 1: id = l[1] return distname,version,id
380f417e15dd36e6656a4f65e9c5ccd75134b8c1 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/380f417e15dd36e6656a4f65e9c5ccd75134b8c1/platform.py
def __init__(self, host, port = NNTP_PORT):
def __init__(self, host, port = NNTP_PORT, user=None, password=None):
def __init__(self, host, port = NNTP_PORT): self.host = host self.port = port self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.sock.connect(self.host, self.port) self.file = self.sock.makefile('rb') self.debugging = 0 self.welcome = self.getresp()
dd65975ac716a9a3beaa80189ab72ce0f88779e4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/dd65975ac716a9a3beaa80189ab72ce0f88779e4/nntplib.py
__call__ = run
def __call__(self, *args, **kwds): return self.run(*args, **kwds)
def run(self, result=None): if result is None: result = self.defaultTestResult() result.startTest(self) testMethod = getattr(self, self.__testMethodName) try: try: self.setUp() except KeyboardInterrupt: raise except: result.addError(self, self.__exc_info()) return
664347be946f0a217f91259f93962727ba84c287 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/664347be946f0a217f91259f93962727ba84c287/unittest.py