rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
raise self.error(dat)
raise self.error(dat[-1])
def login(self, user, password): """Identify client using plaintext password.
26367a001ddaca576aba1a3f31a7c035c53199e8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/26367a001ddaca576aba1a3f31a7c035c53199e8/imaplib.py
except EOFError: typ, dat = None, [None]
except: typ, dat = 'NO', ['%s: %s' % sys.exc_info()[:2]]
def logout(self): """Shutdown connection to server.
26367a001ddaca576aba1a3f31a7c035c53199e8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/26367a001ddaca576aba1a3f31a7c035c53199e8/imaplib.py
return self._untagged_response(typ, name)
return self._untagged_response(typ, dat, name)
def lsub(self, directory='""', pattern='*'): """List 'subscribed' mailbox names in directory matching pattern.
26367a001ddaca576aba1a3f31a7c035c53199e8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/26367a001ddaca576aba1a3f31a7c035c53199e8/imaplib.py
print '\tuntagged responses: %s' % `self.untagged_responses`
_dump_ur(self.untagged_responses)
def noop(self): """Send NOOP command.
26367a001ddaca576aba1a3f31a7c035c53199e8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/26367a001ddaca576aba1a3f31a7c035c53199e8/imaplib.py
return self._untagged_response(typ, 'FETCH') def recent(self): """Return most recent 'RECENT' responses if any exist, else prompt server for an update using the 'NOOP' command, and flush all untagged responses. (typ, [data]) = <instance>.recent() 'data' is None if no new messages, else list of RECENT responses, most recent last. """ name = 'RECENT' typ, dat = self._untagged_response('OK', name) if dat[-1]: return typ, dat self.untagged_responses = {} typ, dat = self._simple_command('NOOP') return self._untagged_response(typ, name)
return self._untagged_response(typ, dat, 'FETCH')
def partial(self, message_num, message_part, start, length): """Fetch truncated part of a message.
26367a001ddaca576aba1a3f31a7c035c53199e8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/26367a001ddaca576aba1a3f31a7c035c53199e8/imaplib.py
def response(self, code): """Return data for response 'code' if received, or None. Old value for response 'code' is cleared. (code, [data]) = <instance>.response(code) """ return self._untagged_response(code, string.upper(code))
def rename(self, oldmailbox, newmailbox): """Rename old mailbox name to new.
26367a001ddaca576aba1a3f31a7c035c53199e8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/26367a001ddaca576aba1a3f31a7c035c53199e8/imaplib.py
return self._untagged_response(typ, name)
return self._untagged_response(typ, dat, name)
def search(self, charset, criteria): """Search mailbox for matching messages.
26367a001ddaca576aba1a3f31a7c035c53199e8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/26367a001ddaca576aba1a3f31a7c035c53199e8/imaplib.py
if typ == 'OK': self.state = 'SELECTED' elif typ == 'NO': self.state = 'AUTH' if not readonly and not self.untagged_responses.has_key('READ-WRITE'): raise self.error('%s is not writable' % mailbox)
if typ != 'OK': self.state = 'AUTH' return typ, dat self.state = 'SELECTED' if not self.untagged_responses.has_key('READ-WRITE') \ and not readonly: if __debug__ and self.debug >= 1: _dump_ur(self.untagged_responses) raise self.readonly('%s is not writable' % mailbox)
def select(self, mailbox='INBOX', readonly=None): """Select a mailbox.
26367a001ddaca576aba1a3f31a7c035c53199e8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/26367a001ddaca576aba1a3f31a7c035c53199e8/imaplib.py
def socket(self): """Return socket instance used to connect to IMAP4 server. socket = <instance>.socket() """ return self.sock
def select(self, mailbox='INBOX', readonly=None): """Select a mailbox.
26367a001ddaca576aba1a3f31a7c035c53199e8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/26367a001ddaca576aba1a3f31a7c035c53199e8/imaplib.py
return self._untagged_response(typ, name)
return self._untagged_response(typ, dat, name)
def status(self, mailbox, names): """Request named status conditions for mailbox.
26367a001ddaca576aba1a3f31a7c035c53199e8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/26367a001ddaca576aba1a3f31a7c035c53199e8/imaplib.py
return self._untagged_response(typ, 'FETCH')
return self._untagged_response(typ, dat, 'FETCH')
def store(self, message_set, command, flag_list): """Alters flag dispositions for messages in mailbox.
26367a001ddaca576aba1a3f31a7c035c53199e8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/26367a001ddaca576aba1a3f31a7c035c53199e8/imaplib.py
typ, dat2 = self._untagged_response(typ, name) if dat2[-1]: dat = dat2 return typ, dat
return self._untagged_response(typ, dat, name)
def uid(self, command, *args): """Execute "command arg ..." with messages identified by UID, rather than message number.
26367a001ddaca576aba1a3f31a7c035c53199e8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/26367a001ddaca576aba1a3f31a7c035c53199e8/imaplib.py
if __debug__ and self.debug >= 5: print '\tuntagged_responses[%s] %s += %s' % (typ, len(`ur[typ]`), _trunc(20, `dat`))
def _append_untagged(self, typ, dat):
26367a001ddaca576aba1a3f31a7c035c53199e8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/26367a001ddaca576aba1a3f31a7c035c53199e8/imaplib.py
if self.untagged_responses.has_key('OK'): del self.untagged_responses['OK']
for typ in ('OK', 'NO', 'BAD'): if self.untagged_responses.has_key(typ): del self.untagged_responses[typ] if self.untagged_responses.has_key('READ-WRITE') \ and self.untagged_responses.has_key('READ-ONLY'): del self.untagged_responses['READ-WRITE'] raise self.readonly('mailbox status changed to READ-ONLY')
def _command(self, name, *args):
26367a001ddaca576aba1a3f31a7c035c53199e8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/26367a001ddaca576aba1a3f31a7c035c53199e8/imaplib.py
print '\t> %s' % data
_mesg('> %s' % data)
def _command(self, name, *args):
26367a001ddaca576aba1a3f31a7c035c53199e8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/26367a001ddaca576aba1a3f31a7c035c53199e8/imaplib.py
print '\twrite literal size %s' % len(literal)
_mesg('write literal size %s' % len(literal))
def _command(self, name, *args):
26367a001ddaca576aba1a3f31a7c035c53199e8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/26367a001ddaca576aba1a3f31a7c035c53199e8/imaplib.py
print '\tread literal size %s' % size
_mesg('read literal size %s' % size)
def _get_response(self):
26367a001ddaca576aba1a3f31a7c035c53199e8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/26367a001ddaca576aba1a3f31a7c035c53199e8/imaplib.py
raise EOFError
raise self.abort('socket error: EOF')
def _get_line(self):
26367a001ddaca576aba1a3f31a7c035c53199e8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/26367a001ddaca576aba1a3f31a7c035c53199e8/imaplib.py
print '\t< %s' % line
_mesg('< %s' % line)
def _get_line(self):
26367a001ddaca576aba1a3f31a7c035c53199e8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/26367a001ddaca576aba1a3f31a7c035c53199e8/imaplib.py
print "\tmatched r'%s' => %s" % (cre.pattern, `self.mo.groups()`)
_mesg("\tmatched r'%s' => %s" % (cre.pattern, `self.mo.groups()`))
def _match(self, cre, s):
26367a001ddaca576aba1a3f31a7c035c53199e8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/26367a001ddaca576aba1a3f31a7c035c53199e8/imaplib.py
def _untagged_response(self, typ, name):
def _untagged_response(self, typ, dat, name): if typ == 'NO': return typ, dat
def _untagged_response(self, typ, name):
26367a001ddaca576aba1a3f31a7c035c53199e8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/26367a001ddaca576aba1a3f31a7c035c53199e8/imaplib.py
print '\tuntagged_responses[%s] => %s' % (name, _trunc(20, `data`))
_mesg('untagged_responses[%s] => %s' % (name, data))
def _untagged_response(self, typ, name):
26367a001ddaca576aba1a3f31a7c035c53199e8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/26367a001ddaca576aba1a3f31a7c035c53199e8/imaplib.py
def _trunc(m, s): if len(s) <= m: return s return '%.*s..' % (m, s)
def _mesg(s): sys.stderr.write('\t'+s+'\n') sys.stderr.flush() def _dump_ur(dict): l = dict.items() if not l: return t = '\n\t\t' j = string.join l = map(lambda x,j=j:'%s: "%s"' % (x[0], x[1][0] and j(x[1], '" "') or ''), l) _mesg('untagged responses dump:%s%s' % (t, j(l, t)))
def _trunc(m, s): if len(s) <= m: return s return '%.*s..' % (m, s)
26367a001ddaca576aba1a3f31a7c035c53199e8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/26367a001ddaca576aba1a3f31a7c035c53199e8/imaplib.py
print ' %s %s\n => %s %s' % (cmd, args, typ, dat)
_mesg(' %s %s\n => %s %s' % (cmd, args, typ, dat))
def run(cmd, args): typ, dat = apply(eval('M.%s' % cmd), args) print ' %s %s\n => %s %s' % (cmd, args, typ, dat) return dat
26367a001ddaca576aba1a3f31a7c035c53199e8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/26367a001ddaca576aba1a3f31a7c035c53199e8/imaplib.py
print 'PROTOCOL_VERSION = %s' % M.PROTOCOL_VERSION
_mesg('PROTOCOL_VERSION = %s' % M.PROTOCOL_VERSION)
def run(cmd, args): typ, dat = apply(eval('M.%s' % cmd), args) print ' %s %s\n => %s %s' % (cmd, args, typ, dat) return dat
26367a001ddaca576aba1a3f31a7c035c53199e8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/26367a001ddaca576aba1a3f31a7c035c53199e8/imaplib.py
if (sld.lower() in ( "co", "ac", "com", "edu", "org", "net", "gov", "mil", "int") and len(tld) == 2):
if sld.lower() in ("co", "ac", "com", "edu", "org", "net", "gov", "mil", "int", "aero", "biz", "cat", "coop", "info", "jobs", "mobi", "museum", "name", "pro", "travel", "eu") and len(tld) == 2:
def set_ok_domain(self, cookie, request): if self.is_blocked(cookie.domain): debug(" domain %s is in user block-list", cookie.domain) return False if self.is_not_allowed(cookie.domain): debug(" domain %s is not in user allow-list", cookie.domain) return False if cookie.domain_specified: req_host, erhn = eff_request_host(request) domain = cookie.domain if self.strict_domain and (domain.count(".") >= 2): i = domain.rfind(".") j = domain.rfind(".", 0, i) if j == 0: # domain like .foo.bar tld = domain[i+1:] sld = domain[j+1:i] if (sld.lower() in ( "co", "ac", "com", "edu", "org", "net", "gov", "mil", "int") and len(tld) == 2): # domain like .co.uk debug(" country-code second level domain %s", domain) return False if domain.startswith("."): undotted_domain = domain[1:] else: undotted_domain = domain embedded_dots = (undotted_domain.find(".") >= 0) if not embedded_dots and domain != ".local": debug(" non-local domain %s contains no embedded dot", domain) return False if cookie.version == 0: if (not erhn.endswith(domain) and (not erhn.startswith(".") and not ("."+erhn).endswith(domain))): debug(" effective request-host %s (even with added " "initial dot) does not end end with %s", erhn, domain) return False if (cookie.version > 0 or (self.strict_ns_domain & self.DomainRFC2965Match)): if not domain_match(erhn, domain): debug(" effective request-host %s does not domain-match " "%s", erhn, domain) return False if (cookie.version > 0 or (self.strict_ns_domain & self.DomainStrictNoDots)): host_prefix = req_host[:-len(domain)] if (host_prefix.find(".") >= 0 and not IPV4_RE.search(req_host)): debug(" host prefix %s for domain %s contains a dot", host_prefix, domain) return False return True
e58334ae9e4a635794ff0605f125eec459b9b98f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e58334ae9e4a635794ff0605f125eec459b9b98f/cookielib.py
genpluginproject("ppc", "_AE", libraries=["ObjectSupportLib"], outputdir="::Lib:Carbon")
genpluginproject("ppc", "_AE", libraries=["ObjectSupportLib"], stdlibraryflags="Debug, WeakImport", outputdir="::Lib:Carbon")
def genpluginproject(architecture, module, project=None, projectdir=None, sources=[], sourcedirs=[], libraries=[], extradirs=[], extraexportsymbols=[], outputdir=":::Lib:lib-dynload", libraryflags=None, stdlibraryflags=None, prefixname=None): 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, outputdir, libraryflags, stdlibraryflags, prefixname) genpluginproject("carbon", module, project, projectdir, sources, sourcedirs, libraries, extradirs, extraexportsymbols, outputdir, libraryflags, stdlibraryflags, prefixname) 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: # For historical reasons an initial _ in the modulename # is not reflected in the folder name if module[0] == '_': modulewithout_ = module[1:] else: modulewithout_ = module moduledir = moduledir % modulewithout_ 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 prefixname: pass elif 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, } if libraryflags: dict['libraryflags'] = libraryflags if stdlibraryflags: dict['stdlibraryflags'] = stdlibraryflags mkcwproject.mkproject(os.path.join(projectdir, project), module, dict, force=FORCEREBUILD, templatename=templatename)
5ee24ae98d191d5a645c2cf67487285de2f2651b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5ee24ae98d191d5a645c2cf67487285de2f2651b/genpluginprojects.py
genpluginproject("ppc", "_Cm", libraries=["QuickTimeLib"], outputdir="::Lib:Carbon")
genpluginproject("ppc", "_Cm", libraries=["QuickTimeLib"], stdlibraryflags="Debug, WeakImport", outputdir="::Lib:Carbon")
def genpluginproject(architecture, module, project=None, projectdir=None, sources=[], sourcedirs=[], libraries=[], extradirs=[], extraexportsymbols=[], outputdir=":::Lib:lib-dynload", libraryflags=None, stdlibraryflags=None, prefixname=None): 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, outputdir, libraryflags, stdlibraryflags, prefixname) genpluginproject("carbon", module, project, projectdir, sources, sourcedirs, libraries, extradirs, extraexportsymbols, outputdir, libraryflags, stdlibraryflags, prefixname) 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: # For historical reasons an initial _ in the modulename # is not reflected in the folder name if module[0] == '_': modulewithout_ = module[1:] else: modulewithout_ = module moduledir = moduledir % modulewithout_ 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 prefixname: pass elif 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, } if libraryflags: dict['libraryflags'] = libraryflags if stdlibraryflags: dict['stdlibraryflags'] = stdlibraryflags mkcwproject.mkproject(os.path.join(projectdir, project), module, dict, force=FORCEREBUILD, templatename=templatename)
5ee24ae98d191d5a645c2cf67487285de2f2651b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5ee24ae98d191d5a645c2cf67487285de2f2651b/genpluginprojects.py
genpluginproject("ppc", "_Drag", libraries=["DragLib"], outputdir="::Lib:Carbon") genpluginproject("all", "_Evt", outputdir="::Lib:Carbon") genpluginproject("all", "_Fm", outputdir="::Lib:Carbon")
genpluginproject("ppc", "_Drag", libraries=["DragLib"], libraryflags="Debug, WeakImport", outputdir="::Lib:Carbon") genpluginproject("all", "_Evt", stdlibraryflags="Debug, WeakImport", outputdir="::Lib:Carbon") genpluginproject("all", "_Fm", stdlibraryflags="Debug, WeakImport", outputdir="::Lib:Carbon")
def genpluginproject(architecture, module, project=None, projectdir=None, sources=[], sourcedirs=[], libraries=[], extradirs=[], extraexportsymbols=[], outputdir=":::Lib:lib-dynload", libraryflags=None, stdlibraryflags=None, prefixname=None): 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, outputdir, libraryflags, stdlibraryflags, prefixname) genpluginproject("carbon", module, project, projectdir, sources, sourcedirs, libraries, extradirs, extraexportsymbols, outputdir, libraryflags, stdlibraryflags, prefixname) 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: # For historical reasons an initial _ in the modulename # is not reflected in the folder name if module[0] == '_': modulewithout_ = module[1:] else: modulewithout_ = module moduledir = moduledir % modulewithout_ 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 prefixname: pass elif 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, } if libraryflags: dict['libraryflags'] = libraryflags if stdlibraryflags: dict['stdlibraryflags'] = stdlibraryflags mkcwproject.mkproject(os.path.join(projectdir, project), module, dict, force=FORCEREBUILD, templatename=templatename)
5ee24ae98d191d5a645c2cf67487285de2f2651b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5ee24ae98d191d5a645c2cf67487285de2f2651b/genpluginprojects.py
genpluginproject("ppc", "_Icn", libraries=["IconServicesLib"], outputdir="::Lib:Carbon")
genpluginproject("ppc", "_Icn", libraries=["IconServicesLib"], libraryflags="Debug, WeakImport", outputdir="::Lib:Carbon")
def genpluginproject(architecture, module, project=None, projectdir=None, sources=[], sourcedirs=[], libraries=[], extradirs=[], extraexportsymbols=[], outputdir=":::Lib:lib-dynload", libraryflags=None, stdlibraryflags=None, prefixname=None): 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, outputdir, libraryflags, stdlibraryflags, prefixname) genpluginproject("carbon", module, project, projectdir, sources, sourcedirs, libraries, extradirs, extraexportsymbols, outputdir, libraryflags, stdlibraryflags, prefixname) 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: # For historical reasons an initial _ in the modulename # is not reflected in the folder name if module[0] == '_': modulewithout_ = module[1:] else: modulewithout_ = module moduledir = moduledir % modulewithout_ 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 prefixname: pass elif 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, } if libraryflags: dict['libraryflags'] = libraryflags if stdlibraryflags: dict['stdlibraryflags'] = stdlibraryflags mkcwproject.mkproject(os.path.join(projectdir, project), module, dict, force=FORCEREBUILD, templatename=templatename)
5ee24ae98d191d5a645c2cf67487285de2f2651b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5ee24ae98d191d5a645c2cf67487285de2f2651b/genpluginprojects.py
genpluginproject("all", "_Qd", outputdir="::Lib:Carbon") genpluginproject("ppc", "_Qt", libraries=["QuickTimeLib"], outputdir="::Lib:Carbon") genpluginproject("carbon", "_Qt", outputdir="::Lib:Carbon") genpluginproject("all", "_Qdoffs", outputdir="::Lib:Carbon")
genpluginproject("all", "_Qd", stdlibraryflags="Debug, WeakImport", outputdir="::Lib:Carbon") genpluginproject("ppc", "_Qt", libraries=["QuickTimeLib"], libraryflags="Debug, WeakImport", outputdir="::Lib:Carbon") genpluginproject("carbon", "_Qt", libraryflags="Debug, WeakImport", outputdir="::Lib:Carbon") genpluginproject("all", "_Qdoffs", stdlibraryflags="Debug, WeakImport", outputdir="::Lib:Carbon")
def genpluginproject(architecture, module, project=None, projectdir=None, sources=[], sourcedirs=[], libraries=[], extradirs=[], extraexportsymbols=[], outputdir=":::Lib:lib-dynload", libraryflags=None, stdlibraryflags=None, prefixname=None): 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, outputdir, libraryflags, stdlibraryflags, prefixname) genpluginproject("carbon", module, project, projectdir, sources, sourcedirs, libraries, extradirs, extraexportsymbols, outputdir, libraryflags, stdlibraryflags, prefixname) 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: # For historical reasons an initial _ in the modulename # is not reflected in the folder name if module[0] == '_': modulewithout_ = module[1:] else: modulewithout_ = module moduledir = moduledir % modulewithout_ 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 prefixname: pass elif 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, } if libraryflags: dict['libraryflags'] = libraryflags if stdlibraryflags: dict['stdlibraryflags'] = stdlibraryflags mkcwproject.mkproject(os.path.join(projectdir, project), module, dict, force=FORCEREBUILD, templatename=templatename)
5ee24ae98d191d5a645c2cf67487285de2f2651b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5ee24ae98d191d5a645c2cf67487285de2f2651b/genpluginprojects.py
genpluginproject("ppc", "_TE", libraries=["CarbonAccessors.o", "DragLib"], outputdir="::Lib:Carbon")
genpluginproject("ppc", "_TE", libraries=["CarbonAccessors.o", "DragLib"], stdlibraryflags="Debug, WeakImport", libraryflags="Debug, WeakImport", outputdir="::Lib:Carbon")
def genpluginproject(architecture, module, project=None, projectdir=None, sources=[], sourcedirs=[], libraries=[], extradirs=[], extraexportsymbols=[], outputdir=":::Lib:lib-dynload", libraryflags=None, stdlibraryflags=None, prefixname=None): 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, outputdir, libraryflags, stdlibraryflags, prefixname) genpluginproject("carbon", module, project, projectdir, sources, sourcedirs, libraries, extradirs, extraexportsymbols, outputdir, libraryflags, stdlibraryflags, prefixname) 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: # For historical reasons an initial _ in the modulename # is not reflected in the folder name if module[0] == '_': modulewithout_ = module[1:] else: modulewithout_ = module moduledir = moduledir % modulewithout_ 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 prefixname: pass elif 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, } if libraryflags: dict['libraryflags'] = libraryflags if stdlibraryflags: dict['stdlibraryflags'] = stdlibraryflags mkcwproject.mkproject(os.path.join(projectdir, project), module, dict, force=FORCEREBUILD, templatename=templatename)
5ee24ae98d191d5a645c2cf67487285de2f2651b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5ee24ae98d191d5a645c2cf67487285de2f2651b/genpluginprojects.py
genpluginproject("ppc", "_Mlte", libraries=["Textension"], outputdir="::Lib:Carbon")
genpluginproject("ppc", "_Mlte", libraries=["Textension"], libraryflags="Debug, WeakImport", outputdir="::Lib:Carbon")
def genpluginproject(architecture, module, project=None, projectdir=None, sources=[], sourcedirs=[], libraries=[], extradirs=[], extraexportsymbols=[], outputdir=":::Lib:lib-dynload", libraryflags=None, stdlibraryflags=None, prefixname=None): 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, outputdir, libraryflags, stdlibraryflags, prefixname) genpluginproject("carbon", module, project, projectdir, sources, sourcedirs, libraries, extradirs, extraexportsymbols, outputdir, libraryflags, stdlibraryflags, prefixname) 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: # For historical reasons an initial _ in the modulename # is not reflected in the folder name if module[0] == '_': modulewithout_ = module[1:] else: modulewithout_ = module moduledir = moduledir % modulewithout_ 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 prefixname: pass elif 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, } if libraryflags: dict['libraryflags'] = libraryflags if stdlibraryflags: dict['stdlibraryflags'] = stdlibraryflags mkcwproject.mkproject(os.path.join(projectdir, project), module, dict, force=FORCEREBUILD, templatename=templatename)
5ee24ae98d191d5a645c2cf67487285de2f2651b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5ee24ae98d191d5a645c2cf67487285de2f2651b/genpluginprojects.py
]
]
def show_compilers (): from distutils.ccompiler import show_compilers show_compilers()
0419a4ffbabce545d9c8ab19d16a087a1c8dd985 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0419a4ffbabce545d9c8ab19d16a087a1c8dd985/build_ext.py
ext.export_symbol_file = build_info.get('def_file')
if build_info.has_key('def_file'): self.warn("'def_file' element of build info dict " "no longer supported")
def check_extensions_list (self, extensions): """Ensure that the list of extensions (presumably provided as a command option 'extensions') is valid, i.e. it is a list of Extension objects. We also support the old-style list of 2-tuples, where the tuples are (ext_name, build_info), which are converted to Extension instances here.
0419a4ffbabce545d9c8ab19d16a087a1c8dd985 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0419a4ffbabce545d9c8ab19d16a087a1c8dd985/build_ext.py
if self.compiler.compiler_type == 'msvc': self.msvc_prelink_hack(sources, ext, extra_args)
def build_extensions (self):
0419a4ffbabce545d9c8ab19d16a087a1c8dd985 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0419a4ffbabce545d9c8ab19d16a087a1c8dd985/build_ext.py
libraries=ext.libraries,
libraries=self.get_libraries(ext),
def build_extensions (self):
0419a4ffbabce545d9c8ab19d16a087a1c8dd985 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0419a4ffbabce545d9c8ab19d16a087a1c8dd985/build_ext.py
def msvc_prelink_hack (self, sources, ext, extra_args): def_file = ext.export_symbol_file if def_file is not None: extra_args.append ('/DEF:' + def_file) else: modname = string.split (ext.name, '.')[-1] extra_args.append('/export:init%s' % modname) implib_file = os.path.join ( self.implib_dir, self.get_ext_libname (ext.name)) extra_args.append ('/IMPLIB:' + implib_file) self.mkpath (os.path.dirname (implib_file))
def find_swig (self): """Return the name of the SWIG executable. On Unix, this is just "swig" -- it should be in the PATH. Tries a bit harder on Windows. """
0419a4ffbabce545d9c8ab19d16a087a1c8dd985 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0419a4ffbabce545d9c8ab19d16a087a1c8dd985/build_ext.py
if forceload and path in sys.modules: if path not in sys.builtin_module_names: info = inspect.getmoduleinfo(sys.modules[path].__file__) if info[3] != imp.C_EXTENSION: cache[path] = sys.modules[path] del sys.modules[path]
def safeimport(path, forceload=0, cache={}): """Import a module; handle errors; return None if the module isn't found. If the module *is* found but an exception occurs, it's wrapped in an ErrorDuringImport exception and reraised. Unlike __import__, if a package path is specified, the module at the end of the path is returned, not the package at the beginning. If the optional 'forceload' argument is 1, we reload the module from disk (unless it's a dynamic extension).""" if forceload and path in sys.modules: # This is the only way to be sure. Checking the mtime of the file # isn't good enough (e.g. what if the module contains a class that # inherits from another module that has changed?). if path not in sys.builtin_module_names: # Python never loads a dynamic extension a second time from the # same path, even if the file is changed or missing. Deleting # the entry in sys.modules doesn't help for dynamic extensions, # so we're not even going to try to keep them up to date. info = inspect.getmoduleinfo(sys.modules[path].__file__) if info[3] != imp.C_EXTENSION: cache[path] = sys.modules[path] # prevent module from clearing del sys.modules[path] try: module = __import__(path) except: # Did the error occur before or after the module was found? (exc, value, tb) = info = sys.exc_info() if path in sys.modules: # An error occurred while executing the imported module. raise ErrorDuringImport(sys.modules[path].__file__, info) elif exc is SyntaxError: # A SyntaxError occurred before we could execute the module. raise ErrorDuringImport(value.filename, info) elif exc is ImportError and \ split(lower(str(value)))[:2] == ['no', 'module']: # The module was not found. return None else: # Some other error occurred during the importing process. raise ErrorDuringImport(path, sys.exc_info()) for part in split(path, '.')[1:]: try: module = getattr(module, part) except AttributeError: return None return module
9a2dcf8ac1ef89d03c2978e7b1ef4b36cc2fa9f8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9a2dcf8ac1ef89d03c2978e7b1ef4b36cc2fa9f8/pydoc.py
SyntaxError: assignment to None (<doctest test.test_syntax[13]>, line 1)
SyntaxError: assignment to None (<doctest test.test_syntax[14]>, line 1)
>>> def f(None=1):
373f0a718c359bc9e554ec323a9d71844ee76dfc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/373f0a718c359bc9e554ec323a9d71844ee76dfc/test_syntax.py
SyntaxError: non-default argument follows default argument (<doctest test.test_syntax[14]>, line 1)
SyntaxError: non-default argument follows default argument (<doctest test.test_syntax[15]>, line 1)
>>> def f(x, y=1, z):
373f0a718c359bc9e554ec323a9d71844ee76dfc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/373f0a718c359bc9e554ec323a9d71844ee76dfc/test_syntax.py
SyntaxError: assignment to None (<doctest test.test_syntax[15]>, line 1)
SyntaxError: assignment to None (<doctest test.test_syntax[16]>, line 1)
>>> def f(x, None):
373f0a718c359bc9e554ec323a9d71844ee76dfc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/373f0a718c359bc9e554ec323a9d71844ee76dfc/test_syntax.py
SyntaxError: assignment to None (<doctest test.test_syntax[16]>, line 1)
SyntaxError: assignment to None (<doctest test.test_syntax[17]>, line 1)
>>> def f(*None):
373f0a718c359bc9e554ec323a9d71844ee76dfc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/373f0a718c359bc9e554ec323a9d71844ee76dfc/test_syntax.py
SyntaxError: assignment to None (<doctest test.test_syntax[17]>, line 1)
SyntaxError: assignment to None (<doctest test.test_syntax[18]>, line 1)
>>> def f(**None):
373f0a718c359bc9e554ec323a9d71844ee76dfc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/373f0a718c359bc9e554ec323a9d71844ee76dfc/test_syntax.py
SyntaxError: assignment to None (<doctest test.test_syntax[18]>, line 1)
SyntaxError: assignment to None (<doctest test.test_syntax[19]>, line 1)
>>> def None(x):
373f0a718c359bc9e554ec323a9d71844ee76dfc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/373f0a718c359bc9e554ec323a9d71844ee76dfc/test_syntax.py
SyntaxError: Generator expression must be parenthesized if not sole argument (<doctest test.test_syntax[22]>, line 1)
SyntaxError: Generator expression must be parenthesized if not sole argument (<doctest test.test_syntax[23]>, line 1)
>>> def f(it, *varargs):
373f0a718c359bc9e554ec323a9d71844ee76dfc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/373f0a718c359bc9e554ec323a9d71844ee76dfc/test_syntax.py
SyntaxError: more than 255 arguments (<doctest test.test_syntax[24]>, line 1)
SyntaxError: more than 255 arguments (<doctest test.test_syntax[25]>, line 1)
>>> def f(it, *varargs):
373f0a718c359bc9e554ec323a9d71844ee76dfc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/373f0a718c359bc9e554ec323a9d71844ee76dfc/test_syntax.py
SyntaxError: more than 255 arguments (<doctest test.test_syntax[25]>, line 1)
SyntaxError: more than 255 arguments (<doctest test.test_syntax[26]>, line 1)
>>> def f(it, *varargs):
373f0a718c359bc9e554ec323a9d71844ee76dfc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/373f0a718c359bc9e554ec323a9d71844ee76dfc/test_syntax.py
SyntaxError: lambda cannot contain assignment (<doctest test.test_syntax[26]>, line 1)
SyntaxError: lambda cannot contain assignment (<doctest test.test_syntax[27]>, line 1)
>>> def f(it, *varargs):
373f0a718c359bc9e554ec323a9d71844ee76dfc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/373f0a718c359bc9e554ec323a9d71844ee76dfc/test_syntax.py
SyntaxError: keyword can't be an expression (<doctest test.test_syntax[27]>, line 1)
SyntaxError: keyword can't be an expression (<doctest test.test_syntax[28]>, line 1)
>>> def f(it, *varargs):
373f0a718c359bc9e554ec323a9d71844ee76dfc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/373f0a718c359bc9e554ec323a9d71844ee76dfc/test_syntax.py
SyntaxError: keyword can't be an expression (<doctest test.test_syntax[28]>, line 1)
SyntaxError: keyword can't be an expression (<doctest test.test_syntax[29]>, line 1)
>>> def f(it, *varargs):
373f0a718c359bc9e554ec323a9d71844ee76dfc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/373f0a718c359bc9e554ec323a9d71844ee76dfc/test_syntax.py
SyntaxError: keyword can't be an expression (<doctest test.test_syntax[29]>, line 1)
SyntaxError: keyword can't be an expression (<doctest test.test_syntax[30]>, line 1)
>>> def f(it, *varargs):
373f0a718c359bc9e554ec323a9d71844ee76dfc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/373f0a718c359bc9e554ec323a9d71844ee76dfc/test_syntax.py
SyntaxError: augmented assignment to generator expression not possible (<doctest test.test_syntax[30]>, line 1)
SyntaxError: augmented assignment to generator expression not possible (<doctest test.test_syntax[31]>, line 1)
>>> def f(it, *varargs):
373f0a718c359bc9e554ec323a9d71844ee76dfc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/373f0a718c359bc9e554ec323a9d71844ee76dfc/test_syntax.py
SyntaxError: assignment to None (<doctest test.test_syntax[31]>, line 1)
SyntaxError: assignment to None (<doctest test.test_syntax[32]>, line 1)
>>> def f(it, *varargs):
373f0a718c359bc9e554ec323a9d71844ee76dfc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/373f0a718c359bc9e554ec323a9d71844ee76dfc/test_syntax.py
SyntaxError: illegal expression for augmented assignment (<doctest test.test_syntax[32]>, line 1)
SyntaxError: illegal expression for augmented assignment (<doctest test.test_syntax[33]>, line 1)
>>> def f(it, *varargs):
373f0a718c359bc9e554ec323a9d71844ee76dfc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/373f0a718c359bc9e554ec323a9d71844ee76dfc/test_syntax.py
context = context.copy()
context = copy.deepcopy(context) context.clear_flags()
def setcontext(context): """Set this thread's context to context.""" if context in (DefaultContext, BasicContext, ExtendedContext): context = context.copy() threading.currentThread().__decimal_context__ = context
61992efc4bb413ae7a19752215eca5af09be6b6d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/61992efc4bb413ae7a19752215eca5af09be6b6d/decimal.py
context = context.copy()
context = copy.deepcopy(context) context.clear_flags()
def setcontext(context, _local=local): """Set this thread's context to context.""" if context in (DefaultContext, BasicContext, ExtendedContext): context = context.copy() _local.__decimal_context__ = context
61992efc4bb413ae7a19752215eca5af09be6b6d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/61992efc4bb413ae7a19752215eca5af09be6b6d/decimal.py
if self._int[prec-1] %2 == 0:
if self._int[prec-1] & 1 == 0:
def _round_half_even(self, prec, expdiff, context): """Round 5 to even, rest to nearest."""
61992efc4bb413ae7a19752215eca5af09be6b6d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/61992efc4bb413ae7a19752215eca5af09be6b6d/decimal.py
if tmp._exp % 2 == 1:
if tmp._exp & 1:
def sqrt(self, context=None): """Return the square root of self.
61992efc4bb413ae7a19752215eca5af09be6b6d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/61992efc4bb413ae7a19752215eca5af09be6b6d/decimal.py
if tmp.adjusted() % 2 == 0:
if tmp.adjusted() & 1 == 0:
def sqrt(self, context=None): """Return the square root of self.
61992efc4bb413ae7a19752215eca5af09be6b6d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/61992efc4bb413ae7a19752215eca5af09be6b6d/decimal.py
return self._int[-1+self._exp] % 2 == 0
return self._int[-1+self._exp] & 1 == 0
def _iseven(self): """Returns 1 if self is even. Assumes self is an integer.""" if self._exp > 0: return 1 return self._int[-1+self._exp] % 2 == 0
61992efc4bb413ae7a19752215eca5af09be6b6d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/61992efc4bb413ae7a19752215eca5af09be6b6d/decimal.py
except IOError:
except IOError, reason:
def main(self):
8a230b50a160ba8ade992ffd8c35deeab8fbdd38 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8a230b50a160ba8ade992ffd8c35deeab8fbdd38/pybench.py
except IOError:
except IOError, reason:
def main(self):
8a230b50a160ba8ade992ffd8c35deeab8fbdd38 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8a230b50a160ba8ade992ffd8c35deeab8fbdd38/pybench.py
out.write("
out.write("
typedef struct
90321ec314d468f9cf02fac398a8ceac92f60e1a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/90321ec314d468f9cf02fac398a8ceac92f60e1a/GenUCNHash.py
self.capabilities = tuple(string.split(self.untagged_responses[cap][-1]))
self.capabilities = tuple(string.split(string.upper(self.untagged_responses[cap][-1])))
def __init__(self, host = '', port = IMAP4_PORT): self.host = host self.port = port self.debug = Debug self.state = 'LOGOUT' self.literal = None # A literal argument to a command self.tagged_commands = {} # Tagged commands awaiting response self.untagged_responses = {} # {typ: [data, ...], ...} self.continuation_response = '' # Last continuation response self.tagnum = 0
04da10c7a2fa0bd060e8052a9fe3d47623324b94 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/04da10c7a2fa0bd060e8052a9fe3d47623324b94/imaplib.py
filename = os.path.join(dir, testfile) fp = open(filename, 'w') fp.write('blat') fp.close() os.unlink(filename) tempdir = dir break
filename = os.path.join(dir, testfile) if os.name == 'posix': try: fd = os.open(filename, os.O_RDWR|os.O_CREAT|os.O_EXCL, 0700) except OSError: pass else: fp = os.fdopen(fd, 'w') fp.write('blat') fp.close() os.unlink(filename) del fp, fd tempdir = dir break else: fp = open(filename, 'w') fp.write('blat') fp.close() os.unlink(filename) tempdir = dir break
def gettempdir(): """Function to calculate the directory to use.""" global tempdir if tempdir is not None: return tempdir try: pwd = os.getcwd() except (AttributeError, os.error): pwd = os.curdir attempdirs = ['/usr/tmp', '/tmp', pwd] if os.name == 'nt': attempdirs.insert(0, 'C:\\TEMP') attempdirs.insert(0, '\\TEMP') elif os.name == 'mac': import macfs, MACFS try: refnum, dirid = macfs.FindFolder(MACFS.kOnSystemDisk, MACFS.kTemporaryFolderType, 1) dirname = macfs.FSSpec((refnum, dirid, '')).as_pathname() attempdirs.insert(0, dirname) except macfs.error: pass for envname in 'TMPDIR', 'TEMP', 'TMP': if os.environ.has_key(envname): attempdirs.insert(0, os.environ[envname]) testfile = gettempprefix() + 'test' for dir in attempdirs: try: filename = os.path.join(dir, testfile) fp = open(filename, 'w') fp.write('blat') fp.close() os.unlink(filename) tempdir = dir break except IOError: pass if tempdir is None: msg = "Can't find a usable temporary directory amongst " + `attempdirs` raise IOError, msg return tempdir
00f09b38219778b4911f9a3772f06e13153a02c8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/00f09b38219778b4911f9a3772f06e13153a02c8/tempfile.py
_hostprog = re.compile('^//([^/]*)(.*)$')
_hostprog = re.compile('^//([^/?]*)(.*)$')
def splithost(url): """splithost('//host[:port]/path') --> 'host[:port]', '/path'.""" global _hostprog if _hostprog is None: import re _hostprog = re.compile('^//([^/]*)(.*)$') match = _hostprog.match(url) if match: return match.group(1, 2) return None, url
1c168d8eebd927d95f069848568262ebc0b90cd6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1c168d8eebd927d95f069848568262ebc0b90cd6/urllib.py
<style>TT { font-family: lucida console, lucida typewriter, courier }</style> </head><body bgcolor="
<style type="text/css"><!-- TT { font-family: lucida console, lucida typewriter, courier } --></style></head><body bgcolor="
def page(self, title, contents): """Format an HTML page.""" return '''
e280c06d5910eca5bcded37611033bb11bc17110 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e280c06d5910eca5bcded37611033bb11bc17110/pydoc.py
if 0 and hasattr(object, '__all__'):
if 0 and hasattr(object, '__all__'):
def docmodule(self, object, name=None): """Produce HTML documentation for a module object.""" name = object.__name__ # ignore the passed-in name parts = split(name, '.') links = [] for i in range(len(parts)-1): links.append( '<a href="%s.html"><font color="#ffffff">%s</font></a>' % (join(parts[:i+1], '.'), parts[i])) linkedname = join(links + parts[-1:], '.') head = '<big><big><strong>%s</strong></big></big>' % linkedname try: path = inspect.getabsfile(object) filelink = '<a href="file:%s">%s</a>' % (path, path) except TypeError: filelink = '(built-in)' info = [] if hasattr(object, '__version__'): version = str(object.__version__) if version[:11] == '$' + 'Revision: ' and version[-1:] == '$': version = strip(version[11:-1]) info.append('version %s' % self.escape(version)) if hasattr(object, '__date__'): info.append(self.escape(str(object.__date__))) if info: head = head + ' (%s)' % join(info, ', ') result = self.heading( head, '#ffffff', '#7799ee', '<a href=".">index</a><br>' + filelink)
e280c06d5910eca5bcded37611033bb11bc17110 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e280c06d5910eca5bcded37611033bb11bc17110/pydoc.py
result = result + '<p>%s\n' % self.small(doc)
result = result + '<p>%s</p>\n' % self.small(doc)
def docmodule(self, object, name=None): """Produce HTML documentation for a module object.""" name = object.__name__ # ignore the passed-in name parts = split(name, '.') links = [] for i in range(len(parts)-1): links.append( '<a href="%s.html"><font color="#ffffff">%s</font></a>' % (join(parts[:i+1], '.'), parts[i])) linkedname = join(links + parts[-1:], '.') head = '<big><big><strong>%s</strong></big></big>' % linkedname try: path = inspect.getabsfile(object) filelink = '<a href="file:%s">%s</a>' % (path, path) except TypeError: filelink = '(built-in)' info = [] if hasattr(object, '__version__'): version = str(object.__version__) if version[:11] == '$' + 'Revision: ' and version[-1:] == '$': version = strip(version[11:-1]) info.append('version %s' % self.escape(version)) if hasattr(object, '__date__'): info.append(self.escape(str(object.__date__))) if info: head = head + ' (%s)' % join(info, ', ') result = self.heading( head, '#ffffff', '#7799ee', '<a href=".">index</a><br>' + filelink)
e280c06d5910eca5bcded37611033bb11bc17110 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e280c06d5910eca5bcded37611033bb11bc17110/pydoc.py
if not cl.__dict__.has_key(name):
if object.im_class is not cl:
def docroutine(self, object, name=None, funcs={}, classes={}, methods={}, cl=None): """Produce HTML documentation for a function or method object.""" realname = object.__name__ name = name or realname anchor = (cl and cl.__name__ or '') + '-' + name note = '' skipdocs = 0 if inspect.ismethod(object): if cl: if not cl.__dict__.has_key(name): base = object.im_class url = '#%s-%s' % (base.__name__, name) basename = base.__name__ if base.__module__ != cl.__module__: url = base.__module__ + '.html' + url basename = base.__module__ + '.' + basename note = ' from <a href="%s">%s</a>' % (url, basename) skipdocs = 1 else: note = (object.im_self and ' method of ' + self.repr(object.im_self) or ' unbound %s method' % object.im_class.__name__) object = object.im_func
e280c06d5910eca5bcded37611033bb11bc17110 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e280c06d5910eca5bcded37611033bb11bc17110/pydoc.py
reallink = '<a href="%s">%s</a>' % (
reallink = '<a href="
def docroutine(self, object, name=None, funcs={}, classes={}, methods={}, cl=None): """Produce HTML documentation for a function or method object.""" realname = object.__name__ name = name or realname anchor = (cl and cl.__name__ or '') + '-' + name note = '' skipdocs = 0 if inspect.ismethod(object): if cl: if not cl.__dict__.has_key(name): base = object.im_class url = '#%s-%s' % (base.__name__, name) basename = base.__name__ if base.__module__ != cl.__module__: url = base.__module__ + '.html' + url basename = base.__module__ + '.' + basename note = ' from <a href="%s">%s</a>' % (url, basename) skipdocs = 1 else: note = (object.im_self and ' method of ' + self.repr(object.im_self) or ' unbound %s method' % object.im_class.__name__) object = object.im_func
e280c06d5910eca5bcded37611033bb11bc17110 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e280c06d5910eca5bcded37611033bb11bc17110/pydoc.py
if not cl.__dict__.has_key(name):
if object.im_class is not cl:
def docroutine(self, object, name=None, cl=None): """Produce text documentation for a function or method object.""" realname = object.__name__ name = name or realname note = '' skipdocs = 0 if inspect.ismethod(object): if cl: if not cl.__dict__.has_key(name): base = object.im_class basename = base.__name__ if base.__module__ != cl.__module__: basename = base.__module__ + '.' + basename note = ' from %s' % basename skipdocs = 1 else: if object.im_self: note = ' method of %s' % self.repr(object.im_self) else: note = ' unbound %s method' % object.im_class.__name__ object = object.im_func
e280c06d5910eca5bcded37611033bb11bc17110 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e280c06d5910eca5bcded37611033bb11bc17110/pydoc.py
raise xml.sax.SAXParseException(expat.ErrorString(error_code), None, self)
raise SAXParseException(expat.ErrorString(error_code), None, self)
def parse(self, stream_or_string): "Parse an XML document from a URL." if type(stream_or_string) is type(""): stream = open(stream_or_string) else: stream = stream_or_string
f43cf31f4a60091af8b2146f4589be53a6d76b8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f43cf31f4a60091af8b2146f4589be53a6d76b8c/expatreader.py
"Looks up and returns the state of a SAX2 feature."
if name == feature_namespaces: return self._namespaces
def getFeature(self, name): "Looks up and returns the state of a SAX2 feature." raise SAXNotRecognizedException("Feature '%s' not recognized" % name)
f43cf31f4a60091af8b2146f4589be53a6d76b8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f43cf31f4a60091af8b2146f4589be53a6d76b8c/expatreader.py
"Sets the state of a SAX2 feature." raise SAXNotRecognizedException("Feature '%s' not recognized" % name)
if self._parsing: raise SAXNotSupportedException("Cannot set features while parsing") if name == feature_namespaces: self._namespaces = state else: raise SAXNotRecognizedException("Feature '%s' not recognized" % name)
def setFeature(self, name, state): "Sets the state of a SAX2 feature." raise SAXNotRecognizedException("Feature '%s' not recognized" % name)
f43cf31f4a60091af8b2146f4589be53a6d76b8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f43cf31f4a60091af8b2146f4589be53a6d76b8c/expatreader.py
"Looks up and returns the value of a SAX2 property."
def getProperty(self, name): "Looks up and returns the value of a SAX2 property." raise SAXNotRecognizedException("Property '%s' not recognized" % name)
f43cf31f4a60091af8b2146f4589be53a6d76b8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f43cf31f4a60091af8b2146f4589be53a6d76b8c/expatreader.py
"Sets the value of a SAX2 property."
def setProperty(self, name, value): "Sets the value of a SAX2 property." raise SAXNotRecognizedException("Property '%s' not recognized" % name)
f43cf31f4a60091af8b2146f4589be53a6d76b8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f43cf31f4a60091af8b2146f4589be53a6d76b8c/expatreader.py
self._parser.Parse(data, 0)
if not self._parser.Parse(data, 0): msg = pyexpat.ErrorString(self._parser.ErrorCode) raise SAXParseException(msg, None, self)
def feed(self, data): if not self._parsing: self._parsing = 1 self.reset() self._cont_handler.startDocument() # FIXME: error checking and endDocument() self._parser.Parse(data, 0)
f43cf31f4a60091af8b2146f4589be53a6d76b8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f43cf31f4a60091af8b2146f4589be53a6d76b8c/expatreader.py
self._cont_handler.startElement(name, name, xmlreader.AttributesImpl(attrs, attrs))
self._cont_handler.startElement(name, self._attrs)
def start_element(self, name, attrs): self._cont_handler.startElement(name, name, xmlreader.AttributesImpl(attrs, attrs))
f43cf31f4a60091af8b2146f4589be53a6d76b8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f43cf31f4a60091af8b2146f4589be53a6d76b8c/expatreader.py
self._cont_handler.endElement(name, name)
self._cont_handler.endElement(name)
def end_element(self, name): self._cont_handler.endElement(name, name)
f43cf31f4a60091af8b2146f4589be53a6d76b8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f43cf31f4a60091af8b2146f4589be53a6d76b8c/expatreader.py
tup = (None, name) else: tup = pair
pair = (None, name)
def start_element_ns(self, name, attrs): pair = name.split() if len(pair) == 1: tup = (None, name) else: tup = pair
f43cf31f4a60091af8b2146f4589be53a6d76b8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f43cf31f4a60091af8b2146f4589be53a6d76b8c/expatreader.py
self._cont_handler.startElement(tup, None, xmlreader.AttributesImpl(attrs, None))
self._cont_handler.startElementNS(pair, None, self._attrs)
def start_element_ns(self, name, attrs): pair = name.split() if len(pair) == 1: tup = (None, name) else: tup = pair
f43cf31f4a60091af8b2146f4589be53a6d76b8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f43cf31f4a60091af8b2146f4589be53a6d76b8c/expatreader.py
name = (None, name, None) else: name = pair + [None]
name = (None, name)
def end_element_ns(self, name): pair = name.split() if len(pair) == 1: name = (None, name, None) else: name = pair + [None] # prefix is not implemented yet! self._cont_handler.endElement(name, None)
f43cf31f4a60091af8b2146f4589be53a6d76b8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f43cf31f4a60091af8b2146f4589be53a6d76b8c/expatreader.py
self._cont_handler.endElement(name, None)
self._cont_handler.endElementNS(pair, None)
def end_element_ns(self, name): pair = name.split() if len(pair) == 1: name = (None, name, None) else: name = pair + [None] # prefix is not implemented yet! self._cont_handler.endElement(name, None)
f43cf31f4a60091af8b2146f4589be53a6d76b8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f43cf31f4a60091af8b2146f4589be53a6d76b8c/expatreader.py
def end_element_ns(self, name): pair = name.split() if len(pair) == 1: name = (None, name, None) else: name = pair + [None] # prefix is not implemented yet! self._cont_handler.endElement(name, None)
f43cf31f4a60091af8b2146f4589be53a6d76b8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f43cf31f4a60091af8b2146f4589be53a6d76b8c/expatreader.py
def processing_instruction(self, target, data): self._cont_handler.processingInstruction(target, data)
f43cf31f4a60091af8b2146f4589be53a6d76b8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f43cf31f4a60091af8b2146f4589be53a6d76b8c/expatreader.py
assert 0
raise NotImplementedError()
def external_entity_ref(self, context, base, sysid, pubid): assert 0 # not implemented source = self._ent_handler.resolveEntity(pubid, sysid) source = saxutils.prepare_input_source(source) # FIXME: create new parser, stack self._source and self._parser # FIXME: reuse code from self.parse(...) return 1
f43cf31f4a60091af8b2146f4589be53a6d76b8c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f43cf31f4a60091af8b2146f4589be53a6d76b8c/expatreader.py
self.badmodules[fqname][parent.__name__] = None
if parent: self.badmodules[fqname][parent.__name__] = None
def import_module(self, partname, fqname, parent): self.msgin(3, "import_module", partname, fqname, parent) try: m = self.modules[fqname] except KeyError: pass else: self.msgout(3, "import_module ->", m) return m if self.badmodules.has_key(fqname): self.msgout(3, "import_module -> None") self.badmodules[fqname][parent.__name__] = None return None try: fp, pathname, stuff = self.find_module(partname, parent and parent.__path__) except ImportError: self.msgout(3, "import_module ->", None) return None try: m = self.load_module(fqname, fp, pathname, stuff) finally: if fp: fp.close() if parent: setattr(parent, partname, m) self.msgout(3, "import_module ->", m) return m
8b4b46e4f3d9d80bfc09961efaf5fc65807e34ab /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8b4b46e4f3d9d80bfc09961efaf5fc65807e34ab/modulefinder.py
parent = readmodule(package, path, inpackage) child = readmodule(submodule, parent['__path__'], 1)
parent = readmodule_ex(package, path, inpackage) child = readmodule_ex(submodule, parent['__path__'], 1)
def readmodule_ex(module, path=[], inpackage=0): '''Read a module file and return a dictionary of classes. Search for MODULE in PATH and sys.path, read and parse the module and return a dictionary with one entry for each class found in the module.''' dict = {} i = module.rfind('.') if i >= 0: # Dotted module name package = module[:i].strip() submodule = module[i+1:].strip() parent = readmodule(package, path, inpackage) child = readmodule(submodule, parent['__path__'], 1) return child if _modules.has_key(module): # we've seen this module before... return _modules[module] if module in sys.builtin_module_names: # this is a built-in module _modules[module] = dict return dict # search the path for the module f = None if inpackage: try: f, file, (suff, mode, type) = \ imp.find_module(module, path) except ImportError: f = None if f is None: fullpath = list(path) + sys.path f, file, (suff, mode, type) = imp.find_module(module, fullpath) if type == imp.PKG_DIRECTORY: dict['__path__'] = [file] _modules[module] = dict path = [file] + path f, file, (suff, mode, type) = \ imp.find_module('__init__', [file]) if type != imp.PY_SOURCE: # not Python source, can't do anything with this module f.close() _modules[module] = dict return dict _modules[module] = dict classstack = [] # stack of (class, indent) pairs src = f.read() f.close() # To avoid having to stop the regexp at each newline, instead # when we need a line number we simply string.count the number of # newlines in the string since the last time we did this; i.e., # lineno = lineno + \ # string.count(src, '\n', last_lineno_pos, here) # last_lineno_pos = here countnl = string.count lineno, last_lineno_pos = 1, 0 i = 0 while 1: m = _getnext(src, i) if not m: break start, i = m.span() if m.start("Method") >= 0: # found a method definition or function thisindent = _indent(m.group("MethodIndent")) meth_name = m.group("MethodName") lineno = lineno + \ countnl(src, '\n', last_lineno_pos, start) last_lineno_pos = start # close all classes indented at least as much while classstack and \ classstack[-1][1] >= thisindent: del classstack[-1] if classstack: # it's a class method cur_class = classstack[-1][0] cur_class._addmethod(meth_name, lineno) else: # it's a function f = Function(module, meth_name, file, lineno) dict[meth_name] = f elif m.start("String") >= 0: pass elif m.start("Class") >= 0: # we found a class definition thisindent = _indent(m.group("ClassIndent")) # close all classes indented at least as much while classstack and \ classstack[-1][1] >= thisindent: del classstack[-1] lineno = lineno + \ countnl(src, '\n', last_lineno_pos, start) last_lineno_pos = start class_name = m.group("ClassName") inherit = m.group("ClassSupers") if inherit: # the class inherits from other classes inherit = inherit[1:-1].strip() names = [] for n in inherit.split(','): n = n.strip() if dict.has_key(n): # we know this super class n = dict[n] else: c = n.split('.') if len(c) > 1: # super class # is of the # form module.class: # look in # module for class m = c[-2] c = c[-1] if _modules.has_key(m): d = _modules[m] if d.has_key(c): n = d[c] names.append(n) inherit = names # remember this class cur_class = Class(module, class_name, inherit, file, lineno) dict[class_name] = cur_class classstack.append((cur_class, thisindent)) elif m.start("Import") >= 0: # import module for n in m.group("ImportList").split(','): n = n.strip() try: # recursively read the imported module d = readmodule(n, path, inpackage) except: ##print 'module', n, 'not found' pass elif m.start("ImportFrom") >= 0: # from module import stuff mod = m.group("ImportFromPath") names = m.group("ImportFromList").split(',') try: # recursively read the imported module d = readmodule(mod, path, inpackage) except: ##print 'module', mod, 'not found' continue # add any classes that were defined in the # imported module to our name space if they # were mentioned in the list for n in names: n = n.strip() if d.has_key(n): dict[n] = d[n] elif n == '*': # only add a name if not # already there (to mimic what # Python does internally) # also don't add names that # start with _ for n in d.keys(): if n[0] != '_' and \ not dict.has_key(n): dict[n] = d[n] else: assert 0, "regexp _getnext found something unexpected" return dict
03f7a70345fe7bb59ee15f1f76ce9c9ca36e3d59 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/03f7a70345fe7bb59ee15f1f76ce9c9ca36e3d59/pyclbr.py
d = readmodule(n, path, inpackage)
d = readmodule_ex(n, path, inpackage)
def readmodule_ex(module, path=[], inpackage=0): '''Read a module file and return a dictionary of classes. Search for MODULE in PATH and sys.path, read and parse the module and return a dictionary with one entry for each class found in the module.''' dict = {} i = module.rfind('.') if i >= 0: # Dotted module name package = module[:i].strip() submodule = module[i+1:].strip() parent = readmodule(package, path, inpackage) child = readmodule(submodule, parent['__path__'], 1) return child if _modules.has_key(module): # we've seen this module before... return _modules[module] if module in sys.builtin_module_names: # this is a built-in module _modules[module] = dict return dict # search the path for the module f = None if inpackage: try: f, file, (suff, mode, type) = \ imp.find_module(module, path) except ImportError: f = None if f is None: fullpath = list(path) + sys.path f, file, (suff, mode, type) = imp.find_module(module, fullpath) if type == imp.PKG_DIRECTORY: dict['__path__'] = [file] _modules[module] = dict path = [file] + path f, file, (suff, mode, type) = \ imp.find_module('__init__', [file]) if type != imp.PY_SOURCE: # not Python source, can't do anything with this module f.close() _modules[module] = dict return dict _modules[module] = dict classstack = [] # stack of (class, indent) pairs src = f.read() f.close() # To avoid having to stop the regexp at each newline, instead # when we need a line number we simply string.count the number of # newlines in the string since the last time we did this; i.e., # lineno = lineno + \ # string.count(src, '\n', last_lineno_pos, here) # last_lineno_pos = here countnl = string.count lineno, last_lineno_pos = 1, 0 i = 0 while 1: m = _getnext(src, i) if not m: break start, i = m.span() if m.start("Method") >= 0: # found a method definition or function thisindent = _indent(m.group("MethodIndent")) meth_name = m.group("MethodName") lineno = lineno + \ countnl(src, '\n', last_lineno_pos, start) last_lineno_pos = start # close all classes indented at least as much while classstack and \ classstack[-1][1] >= thisindent: del classstack[-1] if classstack: # it's a class method cur_class = classstack[-1][0] cur_class._addmethod(meth_name, lineno) else: # it's a function f = Function(module, meth_name, file, lineno) dict[meth_name] = f elif m.start("String") >= 0: pass elif m.start("Class") >= 0: # we found a class definition thisindent = _indent(m.group("ClassIndent")) # close all classes indented at least as much while classstack and \ classstack[-1][1] >= thisindent: del classstack[-1] lineno = lineno + \ countnl(src, '\n', last_lineno_pos, start) last_lineno_pos = start class_name = m.group("ClassName") inherit = m.group("ClassSupers") if inherit: # the class inherits from other classes inherit = inherit[1:-1].strip() names = [] for n in inherit.split(','): n = n.strip() if dict.has_key(n): # we know this super class n = dict[n] else: c = n.split('.') if len(c) > 1: # super class # is of the # form module.class: # look in # module for class m = c[-2] c = c[-1] if _modules.has_key(m): d = _modules[m] if d.has_key(c): n = d[c] names.append(n) inherit = names # remember this class cur_class = Class(module, class_name, inherit, file, lineno) dict[class_name] = cur_class classstack.append((cur_class, thisindent)) elif m.start("Import") >= 0: # import module for n in m.group("ImportList").split(','): n = n.strip() try: # recursively read the imported module d = readmodule(n, path, inpackage) except: ##print 'module', n, 'not found' pass elif m.start("ImportFrom") >= 0: # from module import stuff mod = m.group("ImportFromPath") names = m.group("ImportFromList").split(',') try: # recursively read the imported module d = readmodule(mod, path, inpackage) except: ##print 'module', mod, 'not found' continue # add any classes that were defined in the # imported module to our name space if they # were mentioned in the list for n in names: n = n.strip() if d.has_key(n): dict[n] = d[n] elif n == '*': # only add a name if not # already there (to mimic what # Python does internally) # also don't add names that # start with _ for n in d.keys(): if n[0] != '_' and \ not dict.has_key(n): dict[n] = d[n] else: assert 0, "regexp _getnext found something unexpected" return dict
03f7a70345fe7bb59ee15f1f76ce9c9ca36e3d59 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/03f7a70345fe7bb59ee15f1f76ce9c9ca36e3d59/pyclbr.py
d = readmodule(mod, path, inpackage)
d = readmodule_ex(mod, path, inpackage)
def readmodule_ex(module, path=[], inpackage=0): '''Read a module file and return a dictionary of classes. Search for MODULE in PATH and sys.path, read and parse the module and return a dictionary with one entry for each class found in the module.''' dict = {} i = module.rfind('.') if i >= 0: # Dotted module name package = module[:i].strip() submodule = module[i+1:].strip() parent = readmodule(package, path, inpackage) child = readmodule(submodule, parent['__path__'], 1) return child if _modules.has_key(module): # we've seen this module before... return _modules[module] if module in sys.builtin_module_names: # this is a built-in module _modules[module] = dict return dict # search the path for the module f = None if inpackage: try: f, file, (suff, mode, type) = \ imp.find_module(module, path) except ImportError: f = None if f is None: fullpath = list(path) + sys.path f, file, (suff, mode, type) = imp.find_module(module, fullpath) if type == imp.PKG_DIRECTORY: dict['__path__'] = [file] _modules[module] = dict path = [file] + path f, file, (suff, mode, type) = \ imp.find_module('__init__', [file]) if type != imp.PY_SOURCE: # not Python source, can't do anything with this module f.close() _modules[module] = dict return dict _modules[module] = dict classstack = [] # stack of (class, indent) pairs src = f.read() f.close() # To avoid having to stop the regexp at each newline, instead # when we need a line number we simply string.count the number of # newlines in the string since the last time we did this; i.e., # lineno = lineno + \ # string.count(src, '\n', last_lineno_pos, here) # last_lineno_pos = here countnl = string.count lineno, last_lineno_pos = 1, 0 i = 0 while 1: m = _getnext(src, i) if not m: break start, i = m.span() if m.start("Method") >= 0: # found a method definition or function thisindent = _indent(m.group("MethodIndent")) meth_name = m.group("MethodName") lineno = lineno + \ countnl(src, '\n', last_lineno_pos, start) last_lineno_pos = start # close all classes indented at least as much while classstack and \ classstack[-1][1] >= thisindent: del classstack[-1] if classstack: # it's a class method cur_class = classstack[-1][0] cur_class._addmethod(meth_name, lineno) else: # it's a function f = Function(module, meth_name, file, lineno) dict[meth_name] = f elif m.start("String") >= 0: pass elif m.start("Class") >= 0: # we found a class definition thisindent = _indent(m.group("ClassIndent")) # close all classes indented at least as much while classstack and \ classstack[-1][1] >= thisindent: del classstack[-1] lineno = lineno + \ countnl(src, '\n', last_lineno_pos, start) last_lineno_pos = start class_name = m.group("ClassName") inherit = m.group("ClassSupers") if inherit: # the class inherits from other classes inherit = inherit[1:-1].strip() names = [] for n in inherit.split(','): n = n.strip() if dict.has_key(n): # we know this super class n = dict[n] else: c = n.split('.') if len(c) > 1: # super class # is of the # form module.class: # look in # module for class m = c[-2] c = c[-1] if _modules.has_key(m): d = _modules[m] if d.has_key(c): n = d[c] names.append(n) inherit = names # remember this class cur_class = Class(module, class_name, inherit, file, lineno) dict[class_name] = cur_class classstack.append((cur_class, thisindent)) elif m.start("Import") >= 0: # import module for n in m.group("ImportList").split(','): n = n.strip() try: # recursively read the imported module d = readmodule(n, path, inpackage) except: ##print 'module', n, 'not found' pass elif m.start("ImportFrom") >= 0: # from module import stuff mod = m.group("ImportFromPath") names = m.group("ImportFromList").split(',') try: # recursively read the imported module d = readmodule(mod, path, inpackage) except: ##print 'module', mod, 'not found' continue # add any classes that were defined in the # imported module to our name space if they # were mentioned in the list for n in names: n = n.strip() if d.has_key(n): dict[n] = d[n] elif n == '*': # only add a name if not # already there (to mimic what # Python does internally) # also don't add names that # start with _ for n in d.keys(): if n[0] != '_' and \ not dict.has_key(n): dict[n] = d[n] else: assert 0, "regexp _getnext found something unexpected" return dict
03f7a70345fe7bb59ee15f1f76ce9c9ca36e3d59 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/03f7a70345fe7bb59ee15f1f76ce9c9ca36e3d59/pyclbr.py
return "-R" + dir
compiler = os.path.basename(sysconfig.get_config_var("CC")) if compiler == "gcc" or compiler == "g++": return "-Wl,-R" + dir else: return "-R" + dir
def runtime_library_dir_option (self, dir): return "-R" + dir
d15db5c711f0b903762d0dfb0fbab95d869d56d8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d15db5c711f0b903762d0dfb0fbab95d869d56d8/unixccompiler.py
(ccshared,) = sysconfig.get_config_vars('CCSHARED') args['compiler_so'] = compiler + ' ' + ccshared
(ccshared,opt) = sysconfig.get_config_vars('CCSHARED','OPT') args['compiler_so'] = compiler + ' ' + opt + ' ' + ccshared
def build_extensions(self):
3e4b0e800b04380e669d4cff7f8c77bdc031b170 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3e4b0e800b04380e669d4cff7f8c77bdc031b170/setup.py
def wait(self, timeout=None): self.__cond.acquire() if not self.__flag: self.__cond.wait(timeout) self.__cond.release()
44f8696171f8d9e29c82e250ed90351dfb207da2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/44f8696171f8d9e29c82e250ed90351dfb207da2/threading.py
class AnotherDateTimeClass(object): def __cmp__(self, other): return 0 their = AnotherDateTimeClass()
class SomeClass: pass their = SomeClass() self.assertEqual(our == their, False) self.assertEqual(their == our, False) self.assertEqual(our != their, True) self.assertEqual(their != our, True) self.assertRaises(TypeError, lambda: our < their) self.assertRaises(TypeError, lambda: their < our)
def test_mixed_compare(self): our = self.theclass(2000, 4, 5) self.assertRaises(TypeError, cmp, our, 1) self.assertRaises(TypeError, cmp, 1, our)
19960597adb65c9ecd33e4c3d320390eecd38625 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/19960597adb65c9ecd33e4c3d320390eecd38625/test_datetime.py
class Comparable(AnotherDateTimeClass): def timetuple(self): return () their = Comparable() self.assertEqual(cmp(our, their), 0) self.assertEqual(cmp(their, our), 0) self.failUnless(our == their) self.failUnless(their == our)
self.assertRaises(TypeError, cmp, their, our) class LargerThanAnything: def __lt__(self, other): return False def __le__(self, other): return isinstance(other, LargerThanAnything) def __eq__(self, other): return isinstance(other, LargerThanAnything) def __ne__(self, other): return not isinstance(other, LargerThanAnything) def __gt__(self, other): return not isinstance(other, LargerThanAnything) def __ge__(self, other): return True their = LargerThanAnything() self.assertEqual(our == their, False) self.assertEqual(their == our, False) self.assertEqual(our != their, True) self.assertEqual(their != our, True) self.assertEqual(our < their, True) self.assertEqual(their < our, False) self.assertEqual(cmp(our, their), -1) self.assertEqual(cmp(their, our), 1)
def __cmp__(self, other): # Return "equal" so calling this can't be confused with # compare-by-address (which never says "equal" for distinct # objects). return 0
19960597adb65c9ecd33e4c3d320390eecd38625 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/19960597adb65c9ecd33e4c3d320390eecd38625/test_datetime.py
self.assert_(as_date.__eq__(as_datetime))
self.assertEqual(as_date.__eq__(as_datetime), True)
def test_bug_1028306(self): # Trying to compare a date to a datetime should act like a mixed- # type comparison, despite that datetime is a subclass of date. as_date = date.today() as_datetime = datetime.combine(as_date, time()) self.assert_(as_date != as_datetime) self.assert_(as_datetime != as_date) self.assert_(not as_date == as_datetime) self.assert_(not as_datetime == as_date) self.assertRaises(TypeError, lambda: as_date < as_datetime) self.assertRaises(TypeError, lambda: as_datetime < as_date) self.assertRaises(TypeError, lambda: as_date <= as_datetime) self.assertRaises(TypeError, lambda: as_datetime <= as_date) self.assertRaises(TypeError, lambda: as_date > as_datetime) self.assertRaises(TypeError, lambda: as_datetime > as_date) self.assertRaises(TypeError, lambda: as_date >= as_datetime) self.assertRaises(TypeError, lambda: as_datetime >= as_date)
19960597adb65c9ecd33e4c3d320390eecd38625 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/19960597adb65c9ecd33e4c3d320390eecd38625/test_datetime.py
self.assert_(not as_date.__eq__(as_datetime.replace(day= different_day)))
as_different = as_datetime.replace(day= different_day) self.assertEqual(as_date.__eq__(as_different), False)
def test_bug_1028306(self): # Trying to compare a date to a datetime should act like a mixed- # type comparison, despite that datetime is a subclass of date. as_date = date.today() as_datetime = datetime.combine(as_date, time()) self.assert_(as_date != as_datetime) self.assert_(as_datetime != as_date) self.assert_(not as_date == as_datetime) self.assert_(not as_datetime == as_date) self.assertRaises(TypeError, lambda: as_date < as_datetime) self.assertRaises(TypeError, lambda: as_datetime < as_date) self.assertRaises(TypeError, lambda: as_date <= as_datetime) self.assertRaises(TypeError, lambda: as_datetime <= as_date) self.assertRaises(TypeError, lambda: as_date > as_datetime) self.assertRaises(TypeError, lambda: as_datetime > as_date) self.assertRaises(TypeError, lambda: as_date >= as_datetime) self.assertRaises(TypeError, lambda: as_datetime >= as_date)
19960597adb65c9ecd33e4c3d320390eecd38625 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/19960597adb65c9ecd33e4c3d320390eecd38625/test_datetime.py
if self.debugging: print '*welcome*', `self.welcome`
if self.debugging: print '*welcome*', self.sanitize(self.welcome)
def getwelcome(self): if self.debugging: print '*welcome*', `self.welcome` return self.welcome
ebaf104665158f0dd215062b699e7f1a2b4580b7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ebaf104665158f0dd215062b699e7f1a2b4580b7/ftplib.py