rem
stringlengths 1
322k
| add
stringlengths 0
2.05M
| context
stringlengths 4
228k
| meta
stringlengths 156
215
|
---|---|---|---|
'libdirs': ('/usr/lib', '/sw/lib', '/lib'), 'incdirs': ('/usr/include/db2', '/usr/local/include/db2', '/sw/include/db2'), | 'libdirs': ('/usr/local/lib', '/sw/lib', '/usr/lib', '/lib'), 'incdirs': ('/usr/local/include/db2', '/sw/include/db2', '/usr/include/db2'), | 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') | ccfdde86eb56b5e24d44e18aa1c276be475aeee2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ccfdde86eb56b5e24d44e18aa1c276be475aeee2/setup.py |
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') | ccfdde86eb56b5e24d44e18aa1c276be475aeee2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ccfdde86eb56b5e24d44e18aa1c276be475aeee2/setup.py |
||
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') | ccfdde86eb56b5e24d44e18aa1c276be475aeee2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/ccfdde86eb56b5e24d44e18aa1c276be475aeee2/setup.py |
||
filename = tempfilename = tempfile.mktemp() if not self.writefile(filename): | (tfd, tempfilename) = tempfile.mkstemp(prefix='IDLE_tmp_') filename = tempfilename os.close(tfd) if not self.writefile(tempfilename): | def print_window(self, event): tempfilename = None saved = self.get_saved() if saved: filename = self.filename # shell undo is reset after every prompt, looks saved, probably isn't if not saved or filename is None: # XXX KBK 08Jun03 Wouldn't it be better to ask the user to save? filename = tempfilename = tempfile.mktemp() if not self.writefile(filename): os.unlink(tempfilename) return "break" platform=os.name printPlatform=1 if platform == 'posix': #posix platform command = idleConf.GetOption('main','General', 'print-command-posix') command = command + " 2>&1" elif platform == 'nt': #win32 platform command = idleConf.GetOption('main','General','print-command-win') else: #no printing for this platform printPlatform=0 if printPlatform: #we can try to print for this platform command = command % filename pipe = os.popen(command, "r") # things can get ugly on NT if there is no printer available. output = pipe.read().strip() status = pipe.close() if status: output = "Printing failed (exit status 0x%x)\n" % \ status + output if output: output = "Printing command: %s\n" % repr(command) + output tkMessageBox.showerror("Print status", output, master=self.text) else: #no printing for this platform message="Printing is not enabled for this platform: %s" % platform tkMessageBox.showinfo("Print status", message, master=self.text) return "break" | 61e2c9a402106664142fa1e26ac5d938b2f95d1b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/61e2c9a402106664142fa1e26ac5d938b2f95d1b/IOBinding.py |
_LegalCharsPatt = r"[\w\d! | _LegalCharsPatt = r"[\w\d! | def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append | c05abb3bdaa87b6e5ea2d6db1e5d6145ae2b0440 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c05abb3bdaa87b6e5ea2d6db1e5d6145ae2b0440/Cookie.py |
""+ _LegalCharsPatt +"+" | ""+ _LegalCharsPatt +"+?" | def OutputString(self, attrs=None): # Build up our result # result = [] RA = result.append | c05abb3bdaa87b6e5ea2d6db1e5d6145ae2b0440 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/c05abb3bdaa87b6e5ea2d6db1e5d6145ae2b0440/Cookie.py |
self.announce(e.msg, log.ERROR) | self.announce(str(e), log.ERROR) | def upload_file(self, command, pyversion, filename): # Sign if requested if self.sign: gpg_args = ["gpg", "--detach-sign", "-a", filename] if self.identity: gpg_args[2:2] = ["--local-user", self.identity] spawn(gpg_args, dry_run=self.dry_run) | 137ff79329ceefa9f7318c3bb97277627866c2ac /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/137ff79329ceefa9f7318c3bb97277627866c2ac/upload.py |
pos = f.tell() | pos = int(f.tell()) | def _addval(self, val): f = _open(self._datfile, 'rb+') f.seek(0, 2) pos = f.tell() | 3f36a085feeba6217f791d683021816fa513c01f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3f36a085feeba6217f791d683021816fa513c01f/dumbdbm.py |
expand_tabs if true (default), tabs in input text will be expanded to spaces before further processing. Each tab will become 1 .. 8 spaces, depending on its position in its line. If false, each tab is treated as a single character. replace_whitespace if true (default), all whitespace characters in the input text are replaced by spaces after tab expansion. Note that expand_tabs is false and replace_whitespace is true, every tab will be converted to a single space! break_long_words if true (default), words longer than the line width constraint will be broken. If false, those words will not be broken, and some lines might be longer than the width constraint. | expand_tabs (default: true) Expand tabs in input text to spaces before further processing. Each tab will become 1 .. 8 spaces, depending on its position in its line. If false, each tab is treated as a single character. replace_whitespace (default: true) Replace all whitespace characters in the input text by spaces after tab expansion. Note that if expand_tabs is false and replace_whitespace is true, every tab will be converted to a single space! fix_sentence_endings (default: false) Ensure that sentence-ending punctuation is always followed by two spaces. Off by default becaus the algorithm is (unavoidably) imperfect. break_long_words (default: true) Break words longer than the line width constraint. If false, those words will not be broken, and some lines might be longer than the width constraint. | def islower (c): return c in string.lowercase | 62e4f3bf224d6a3a17c04524a674caaa14270753 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/62e4f3bf224d6a3a17c04524a674caaa14270753/textwrap.py |
if (chunks[i][-1] == "." and | if (chunks[i][-1] in punct and | def _fix_sentence_endings (self, chunks): """_fix_sentence_endings(chunks : [string]) | 62e4f3bf224d6a3a17c04524a674caaa14270753 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/62e4f3bf224d6a3a17c04524a674caaa14270753/textwrap.py |
self._fix_sentence_endings(chunks) | if self.fix_sentence_endings: self._fix_sentence_endings(chunks) | def wrap (self, text, width): """wrap(text : string, width : int) -> [string] | 62e4f3bf224d6a3a17c04524a674caaa14270753 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/62e4f3bf224d6a3a17c04524a674caaa14270753/textwrap.py |
return filename | components = string.split(filename, ':') for i in range(1, len(components)): if components[i] == '..': components[i] = '' return string.join(components, ':') | def _filename_to_abs(self, filename): # Some filenames seem to be unix-like. Convert to Mac names. | 9020bcebc875463f1acec1b14949db35e1e68ad6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9020bcebc875463f1acec1b14949db35e1e68ad6/mwerkscompiler.py |
if line[:2] == '|-': break | def emparse_cts(fp): while 1: line = fp.readline() if not line: raise Unparseable line = line[:-1] # Check that we're not in the returned message yet if string.lower(line)[:5] == 'from:': raise Unparseable line = string.split(line) if len(line) > 3 and line[0][:2] == '|-' and line[1] == 'Failed' \ and line[2] == 'addresses': # Yes, found it! break errors = [] while 1: line = fp.readline() if not line: break line = line[:-1] if not line: continue errors.append(line) if line[:2] == '|-': break return errors | e48aa966c1f11ee6d66fc96a92dc4972d52353b8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/e48aa966c1f11ee6d66fc96a92dc4972d52353b8/mailerdaemon.py |
|
def __init__(self, environ=os.environ): self.dict = self.data = parse(environ=environ) | def __init__(self, environ=os.environ, keep_blank_values=0, strict_parsing=0): self.dict = self.data = parse(environ=environ, keep_blank_values=keep_blank_values, strict_parsing=strict_parsing) | def __init__(self, environ=os.environ): self.dict = self.data = parse(environ=environ) self.query_string = environ['QUERY_STRING'] | 05b3c450a811b93bd915ea0931b04e2679557390 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/05b3c450a811b93bd915ea0931b04e2679557390/cgi.py |
except: | except (ValueError, OverflowError): | def mimify(infile, outfile): """Convert 8bit parts of a MIME mail message to quoted-printable.""" if type(infile) == type(''): ifile = open(infile) if type(outfile) == type('') and infile == outfile: import os d, f = os.path.split(infile) os.rename(infile, os.path.join(d, ',' + f)) else: ifile = infile if type(outfile) == type(''): ofile = open(outfile, 'w') else: ofile = outfile nifile = File(ifile, None) mimify_part(nifile, ofile, 0) ofile.flush() | 6274fff287bb084f9511dd4c65c3898427f7c96d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/6274fff287bb084f9511dd4c65c3898427f7c96d/mimify.py |
return t + data[9] - time.timezone | return t - data[9] - time.timezone | def mktime_tz(data): """Turn a 10-tuple as returned by parsedate_tz() into a UTC timestamp. Minor glitch: this first interprets the first 8 elements as a local time and then compensates for the timezone difference; this may yield a slight error around daylight savings time switch dates. Not enough to worry about for common use. """ t = time.mktime(data[:8] + (0,)) return t + data[9] - time.timezone | 00455b77a66f78679f41e2b33955a439cb66316b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/00455b77a66f78679f41e2b33955a439cb66316b/rfc822.py |
attrs['script_name'] = sys.argv[0] | attrs['script_name'] = os.path.basename(sys.argv[0]) | def setup (**attrs): """The gateway to the Distutils: do everything your setup script needs to do, in a highly flexible and user-driven way. Briefly: create a Distribution instance; find and parse config files; parse the command line; run each Distutils command found there, customized by the options supplied to 'setup()' (as keyword arguments), in config files, and on the command line. The Distribution instance might be an instance of a class supplied via the 'distclass' keyword argument to 'setup'; if no such class is supplied, then the Distribution class (in dist.py) is instantiated. All other arguments to 'setup' (except for 'cmdclass') are used to set attributes of the Distribution instance. The 'cmdclass' argument, if supplied, is a dictionary mapping command names to command classes. Each command encountered on the command line will be turned into a command class, which is in turn instantiated; any class found in 'cmdclass' is used in place of the default, which is (for command 'foo_bar') class 'foo_bar' in module 'distutils.command.foo_bar'. The command class must provide a 'user_options' attribute which is a list of option specifiers for 'distutils.fancy_getopt'. Any command-line options between the current and the next command are used to set attributes of the current command object. When the entire command-line has been successfully parsed, calls the 'run()' method on each command object in turn. This method will be driven entirely by the Distribution object (which each command object has a reference to, thanks to its constructor), and the command-specific options that became attributes of each command object. """ global _setup_stop_after, _setup_distribution # Determine the distribution class -- either caller-supplied or # our Distribution (see below). klass = attrs.get('distclass') if klass: del attrs['distclass'] else: klass = Distribution if not attrs.has_key('script_name'): attrs['script_name'] = sys.argv[0] if not attrs.has_key('script_args'): attrs['script_args'] = sys.argv[1:] # Create the Distribution instance, using the remaining arguments # (ie. everything except distclass) to initialize it try: _setup_distribution = dist = klass(attrs) except DistutilsSetupError, msg: if attrs.has_key('name'): raise SystemExit, "error in %s setup command: %s" % \ (attrs['name'], msg) else: raise SystemExit, "error in setup command: %s" % msg if _setup_stop_after == "init": return dist # Find and parse the config file(s): they will override options from # the setup script, but be overridden by the command line. dist.parse_config_files() if DEBUG: print "options (after parsing config files):" dist.dump_option_dicts() if _setup_stop_after == "config": return dist # Parse the command line; any command-line errors are the end user's # fault, so turn them into SystemExit to suppress tracebacks. try: ok = dist.parse_command_line() except DistutilsArgError, msg: raise SystemExit, gen_usage(dist.script_name) + "\nerror: %s" % msg if DEBUG: print "options (after parsing command line):" dist.dump_option_dicts() if _setup_stop_after == "commandline": return dist # And finally, run all the commands found on the command line. if ok: try: dist.run_commands() except KeyboardInterrupt: raise SystemExit, "interrupted" except (IOError, os.error), exc: error = grok_environment_error(exc) if DEBUG: sys.stderr.write(error + "\n") raise else: raise SystemExit, error except (DistutilsExecError, DistutilsFileError, DistutilsOptionError, CCompilerError), msg: if DEBUG: raise else: raise SystemExit, "error: " + str(msg) return dist | 8560bb816720a6b8069f9850d5203ed2425e9cbc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/8560bb816720a6b8069f9850d5203ed2425e9cbc/core.py |
self.text.insert(mark, str(s), tags) | self.text.insert(mark, s, tags) | def write(self, s, tags=(), mark="insert"): self.text.insert(mark, str(s), tags) self.text.see(mark) self.text.update() | d01163615ac4656c14c1c83b74526c8e85d094c2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d01163615ac4656c14c1c83b74526c8e85d094c2/OutputWindow.py |
host = urlparse.urlparse(req.get_full_url())[1] | host = req.get_host() | def do_open(self, http_class, req): host = urlparse.urlparse(req.get_full_url())[1] if not host: raise URLError('no host given') | 7667680d703d32c796be342539b9265f9e280e98 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/7667680d703d32c796be342539b9265f9e280e98/urllib2.py |
post_interp = match.group(1) | post_interp = match.group(1) or '' | def copy_scripts (self): """Copy each script listed in 'self.scripts'; if it's marked as a Python script in the Unix way (first line matches 'first_line_re', ie. starts with "\#!" and contains "python"), then adjust the first line to refer to the current Python interpreter as we copy. """ self.mkpath(self.build_dir) for script in self.scripts: adjust = 0 script = convert_path(script) outfile = os.path.join(self.build_dir, os.path.basename(script)) | 90294d01be806a96f5196143e4d9ea10a6064965 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/90294d01be806a96f5196143e4d9ea10a6064965/build_scripts.py |
skip_msg = "byte-compilation of %s skipped" % f | skip_msg = "skipping byte-compilation of %s" % f | def run (self): | 90c74cc4da5b1aa58a37799df16541870ddc4ff7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/90c74cc4da5b1aa58a37799df16541870ddc4ff7/install_lib.py |
self.putsequences() | self.putsequences(sequences) | def removefromallsequences(self, list): if hasattr(self, 'last') and self.last in list: del self.last sequences = self.getsequences() changed = 0 for name, seq in sequences.items(): for n in list: if n in seq: seq.remove(n) changed = 1 if not seq: del sequences[name] if changed: self.putsequences() | 5f47e5752a31dda81e20a21ed9dc33d0fa9b0db7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/5f47e5752a31dda81e20a21ed9dc33d0fa9b0db7/mhlib.py |
if inspect.ismodule(object): return self.docmodule(*args) if inspect.isclass(object): return self.docclass(*args) if inspect.isroutine(object): return self.docroutine(*args) | try: if inspect.ismodule(object): return self.docmodule(*args) if inspect.isclass(object): return self.docclass(*args) if inspect.isroutine(object): return self.docroutine(*args) except AttributeError: pass | def document(self, object, name=None, *args): """Generate documentation for an object.""" args = (object, name) + args if inspect.ismodule(object): return self.docmodule(*args) if inspect.isclass(object): return self.docclass(*args) if inspect.isroutine(object): return self.docroutine(*args) return self.docother(*args) | 28a4f0f9659e6f64eee8905b21953e7ba6ff68fa /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/28a4f0f9659e6f64eee8905b21953e7ba6ff68fa/pydoc.py |
debug("nonnumeric port: '%s'", port) | _debug("nonnumeric port: '%s'", port) | def request_port(request): host = request.get_host() i = host.find(':') if i >= 0: port = host[i+1:] try: int(port) except ValueError: debug("nonnumeric port: '%s'", port) return None else: port = DEFAULT_HTTP_PORT return port | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug(" - checking cookie %s=%s", cookie.name, cookie.value) | _debug(" - checking cookie %s=%s", cookie.name, cookie.value) | def set_ok(self, cookie, request): """ If you override .set_ok(), be sure to call this method. If it returns false, so should your subclass (assuming your subclass wants to be more strict about which cookies to accept). | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug(" Set-Cookie2 without version attribute (%s=%s)", cookie.name, cookie.value) | _debug(" Set-Cookie2 without version attribute (%s=%s)", cookie.name, cookie.value) | def set_ok_version(self, cookie, request): if cookie.version is None: # Version is always set to 0 by parse_ns_headers if it's a Netscape # cookie, so this must be an invalid RFC 2965 cookie. debug(" Set-Cookie2 without version attribute (%s=%s)", cookie.name, cookie.value) return False if cookie.version > 0 and not self.rfc2965: debug(" RFC 2965 cookies are switched off") return False elif cookie.version == 0 and not self.netscape: debug(" Netscape cookies are switched off") return False return True | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug(" RFC 2965 cookies are switched off") | _debug(" RFC 2965 cookies are switched off") | def set_ok_version(self, cookie, request): if cookie.version is None: # Version is always set to 0 by parse_ns_headers if it's a Netscape # cookie, so this must be an invalid RFC 2965 cookie. debug(" Set-Cookie2 without version attribute (%s=%s)", cookie.name, cookie.value) return False if cookie.version > 0 and not self.rfc2965: debug(" RFC 2965 cookies are switched off") return False elif cookie.version == 0 and not self.netscape: debug(" Netscape cookies are switched off") return False return True | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug(" Netscape cookies are switched off") | _debug(" Netscape cookies are switched off") | def set_ok_version(self, cookie, request): if cookie.version is None: # Version is always set to 0 by parse_ns_headers if it's a Netscape # cookie, so this must be an invalid RFC 2965 cookie. debug(" Set-Cookie2 without version attribute (%s=%s)", cookie.name, cookie.value) return False if cookie.version > 0 and not self.rfc2965: debug(" RFC 2965 cookies are switched off") return False elif cookie.version == 0 and not self.netscape: debug(" Netscape cookies are switched off") return False return True | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug(" third-party RFC 2965 cookie during " | _debug(" third-party RFC 2965 cookie during " | def set_ok_verifiability(self, cookie, request): if request.is_unverifiable() and is_third_party(request): if cookie.version > 0 and self.strict_rfc2965_unverifiable: debug(" third-party RFC 2965 cookie during " "unverifiable transaction") return False elif cookie.version == 0 and self.strict_ns_unverifiable: debug(" third-party Netscape cookie during " "unverifiable transaction") return False return True | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug(" third-party Netscape cookie during " | _debug(" third-party Netscape cookie during " | def set_ok_verifiability(self, cookie, request): if request.is_unverifiable() and is_third_party(request): if cookie.version > 0 and self.strict_rfc2965_unverifiable: debug(" third-party RFC 2965 cookie during " "unverifiable transaction") return False elif cookie.version == 0 and self.strict_ns_unverifiable: debug(" third-party Netscape cookie during " "unverifiable transaction") return False return True | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug(" illegal name (starts with '$'): '%s'", cookie.name) | _debug(" illegal name (starts with '$'): '%s'", cookie.name) | def set_ok_name(self, cookie, request): # Try and stop servers setting V0 cookies designed to hack other # servers that know both V0 and V1 protocols. if (cookie.version == 0 and self.strict_ns_set_initial_dollar and cookie.name.startswith("$")): debug(" illegal name (starts with '$'): '%s'", cookie.name) return False return True | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug(" path attribute %s is not a prefix of request " "path %s", cookie.path, req_path) | _debug(" path attribute %s is not a prefix of request " "path %s", cookie.path, req_path) | def set_ok_path(self, cookie, request): if cookie.path_specified: req_path = request_path(request) if ((cookie.version > 0 or (cookie.version == 0 and self.strict_ns_set_path)) and not req_path.startswith(cookie.path)): debug(" path attribute %s is not a prefix of request " "path %s", cookie.path, req_path) return False return True | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug(" domain %s is in user block-list", cookie.domain) | _debug(" domain %s is in user block-list", cookie.domain) | 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): # XXX This should probably be compared with the Konqueror # (kcookiejar.cpp) and Mozilla implementations, but it's a # losing battle. 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", "aero", "biz", "cat", "coop", "info", "jobs", "mobi", "museum", "name", "pro", "travel", "eu") 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 | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug(" domain %s is not in user allow-list", cookie.domain) | _debug(" domain %s is not in user allow-list", cookie.domain) | 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): # XXX This should probably be compared with the Konqueror # (kcookiejar.cpp) and Mozilla implementations, but it's a # losing battle. 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", "aero", "biz", "cat", "coop", "info", "jobs", "mobi", "museum", "name", "pro", "travel", "eu") 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 | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug(" country-code second level domain %s", domain) | _debug(" country-code second level domain %s", domain) | 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): # XXX This should probably be compared with the Konqueror # (kcookiejar.cpp) and Mozilla implementations, but it's a # losing battle. 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", "aero", "biz", "cat", "coop", "info", "jobs", "mobi", "museum", "name", "pro", "travel", "eu") 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 | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug(" non-local domain %s contains no embedded dot", domain) | _debug(" non-local domain %s contains no embedded dot", domain) | 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): # XXX This should probably be compared with the Konqueror # (kcookiejar.cpp) and Mozilla implementations, but it's a # losing battle. 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", "aero", "biz", "cat", "coop", "info", "jobs", "mobi", "museum", "name", "pro", "travel", "eu") 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 | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug(" effective request-host %s (even with added " "initial dot) does not end end with %s", erhn, domain) | _debug(" effective request-host %s (even with added " "initial dot) does not end end with %s", erhn, domain) | 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): # XXX This should probably be compared with the Konqueror # (kcookiejar.cpp) and Mozilla implementations, but it's a # losing battle. 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", "aero", "biz", "cat", "coop", "info", "jobs", "mobi", "museum", "name", "pro", "travel", "eu") 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 | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug(" effective request-host %s does not domain-match " "%s", erhn, domain) | _debug(" effective request-host %s does not domain-match " "%s", erhn, domain) | 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): # XXX This should probably be compared with the Konqueror # (kcookiejar.cpp) and Mozilla implementations, but it's a # losing battle. 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", "aero", "biz", "cat", "coop", "info", "jobs", "mobi", "museum", "name", "pro", "travel", "eu") 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 | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug(" host prefix %s for domain %s contains a dot", host_prefix, domain) | _debug(" host prefix %s for domain %s contains a dot", host_prefix, domain) | 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): # XXX This should probably be compared with the Konqueror # (kcookiejar.cpp) and Mozilla implementations, but it's a # losing battle. 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", "aero", "biz", "cat", "coop", "info", "jobs", "mobi", "museum", "name", "pro", "travel", "eu") 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 | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug(" bad port %s (not numeric)", p) | _debug(" bad port %s (not numeric)", p) | def set_ok_port(self, cookie, request): if cookie.port_specified: req_port = request_port(request) if req_port is None: req_port = "80" else: req_port = str(req_port) for p in cookie.port.split(","): try: int(p) except ValueError: debug(" bad port %s (not numeric)", p) return False if p == req_port: break else: debug(" request port (%s) not found in %s", req_port, cookie.port) return False return True | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug(" request port (%s) not found in %s", req_port, cookie.port) | _debug(" request port (%s) not found in %s", req_port, cookie.port) | def set_ok_port(self, cookie, request): if cookie.port_specified: req_port = request_port(request) if req_port is None: req_port = "80" else: req_port = str(req_port) for p in cookie.port.split(","): try: int(p) except ValueError: debug(" bad port %s (not numeric)", p) return False if p == req_port: break else: debug(" request port (%s) not found in %s", req_port, cookie.port) return False return True | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug(" - checking cookie %s=%s", cookie.name, cookie.value) | _debug(" - checking cookie %s=%s", cookie.name, cookie.value) | def return_ok(self, cookie, request): """ If you override .return_ok(), be sure to call this method. If it returns false, so should your subclass (assuming your subclass wants to be more strict about which cookies to return). | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug(" RFC 2965 cookies are switched off") | _debug(" RFC 2965 cookies are switched off") | def return_ok_version(self, cookie, request): if cookie.version > 0 and not self.rfc2965: debug(" RFC 2965 cookies are switched off") return False elif cookie.version == 0 and not self.netscape: debug(" Netscape cookies are switched off") return False return True | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug(" Netscape cookies are switched off") | _debug(" Netscape cookies are switched off") | def return_ok_version(self, cookie, request): if cookie.version > 0 and not self.rfc2965: debug(" RFC 2965 cookies are switched off") return False elif cookie.version == 0 and not self.netscape: debug(" Netscape cookies are switched off") return False return True | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug(" third-party RFC 2965 cookie during unverifiable " "transaction") | _debug(" third-party RFC 2965 cookie during unverifiable " "transaction") | def return_ok_verifiability(self, cookie, request): if request.is_unverifiable() and is_third_party(request): if cookie.version > 0 and self.strict_rfc2965_unverifiable: debug(" third-party RFC 2965 cookie during unverifiable " "transaction") return False elif cookie.version == 0 and self.strict_ns_unverifiable: debug(" third-party Netscape cookie during unverifiable " "transaction") return False return True | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug(" third-party Netscape cookie during unverifiable " "transaction") | _debug(" third-party Netscape cookie during unverifiable " "transaction") | def return_ok_verifiability(self, cookie, request): if request.is_unverifiable() and is_third_party(request): if cookie.version > 0 and self.strict_rfc2965_unverifiable: debug(" third-party RFC 2965 cookie during unverifiable " "transaction") return False elif cookie.version == 0 and self.strict_ns_unverifiable: debug(" third-party Netscape cookie during unverifiable " "transaction") return False return True | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug(" secure cookie with non-secure request") | _debug(" secure cookie with non-secure request") | def return_ok_secure(self, cookie, request): if cookie.secure and request.get_type() != "https": debug(" secure cookie with non-secure request") return False return True | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug(" cookie expired") | _debug(" cookie expired") | def return_ok_expires(self, cookie, request): if cookie.is_expired(self._now): debug(" cookie expired") return False return True | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug(" request port %s does not match cookie port %s", req_port, cookie.port) | _debug(" request port %s does not match cookie port %s", req_port, cookie.port) | def return_ok_port(self, cookie, request): if cookie.port: req_port = request_port(request) if req_port is None: req_port = "80" for p in cookie.port.split(","): if p == req_port: break else: debug(" request port %s does not match cookie port %s", req_port, cookie.port) return False return True | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug(" cookie with unspecified domain does not string-compare " "equal to request domain") | _debug(" cookie with unspecified domain does not string-compare " "equal to request domain") | def return_ok_domain(self, cookie, request): req_host, erhn = eff_request_host(request) domain = cookie.domain | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug(" effective request-host name %s does not domain-match " "RFC 2965 cookie domain %s", erhn, domain) | _debug(" effective request-host name %s does not domain-match " "RFC 2965 cookie domain %s", erhn, domain) | def return_ok_domain(self, cookie, request): req_host, erhn = eff_request_host(request) domain = cookie.domain | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug(" request-host %s does not match Netscape cookie domain " "%s", req_host, domain) | _debug(" request-host %s does not match Netscape cookie domain " "%s", req_host, domain) | def return_ok_domain(self, cookie, request): req_host, erhn = eff_request_host(request) domain = cookie.domain | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
def domain_return_ok(self, domain, request): # Liberal check of. This is here as an optimization to avoid # having to load lots of MSIE cookie files unless necessary. req_host, erhn = eff_request_host(request) if not req_host.startswith("."): req_host = "."+req_host if not erhn.startswith("."): erhn = "."+erhn if not (req_host.endswith(domain) or erhn.endswith(domain)): #debug(" request domain %s does not match cookie domain %s", # req_host, domain) return False | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
||
debug(" domain %s is in user block-list", domain) | _debug(" domain %s is in user block-list", domain) | def domain_return_ok(self, domain, request): # Liberal check of. This is here as an optimization to avoid # having to load lots of MSIE cookie files unless necessary. req_host, erhn = eff_request_host(request) if not req_host.startswith("."): req_host = "."+req_host if not erhn.startswith("."): erhn = "."+erhn if not (req_host.endswith(domain) or erhn.endswith(domain)): #debug(" request domain %s does not match cookie domain %s", # req_host, domain) return False | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug(" domain %s is not in user allow-list", domain) | _debug(" domain %s is not in user allow-list", domain) | def domain_return_ok(self, domain, request): # Liberal check of. This is here as an optimization to avoid # having to load lots of MSIE cookie files unless necessary. req_host, erhn = eff_request_host(request) if not req_host.startswith("."): req_host = "."+req_host if not erhn.startswith("."): erhn = "."+erhn if not (req_host.endswith(domain) or erhn.endswith(domain)): #debug(" request domain %s does not match cookie domain %s", # req_host, domain) return False | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug("- checking cookie path=%s", path) | _debug("- checking cookie path=%s", path) | def path_return_ok(self, path, request): debug("- checking cookie path=%s", path) req_path = request_path(request) if not req_path.startswith(path): debug(" %s does not path-match %s", req_path, path) return False return True | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug(" %s does not path-match %s", req_path, path) | _debug(" %s does not path-match %s", req_path, path) | def path_return_ok(self, path, request): debug("- checking cookie path=%s", path) req_path = request_path(request) if not req_path.startswith(path): debug(" %s does not path-match %s", req_path, path) return False return True | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug("Checking %s for cookies to return", domain) | _debug("Checking %s for cookies to return", domain) | def _cookies_for_domain(self, domain, request): cookies = [] if not self._policy.domain_return_ok(domain, request): return [] debug("Checking %s for cookies to return", domain) cookies_by_path = self._cookies[domain] for path in cookies_by_path.keys(): if not self._policy.path_return_ok(path, request): continue cookies_by_name = cookies_by_path[path] for cookie in cookies_by_name.values(): if not self._policy.return_ok(cookie, request): debug(" not returning cookie") continue debug(" it's a match") cookies.append(cookie) return cookies | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug(" not returning cookie") | _debug(" not returning cookie") | def _cookies_for_domain(self, domain, request): cookies = [] if not self._policy.domain_return_ok(domain, request): return [] debug("Checking %s for cookies to return", domain) cookies_by_path = self._cookies[domain] for path in cookies_by_path.keys(): if not self._policy.path_return_ok(path, request): continue cookies_by_name = cookies_by_path[path] for cookie in cookies_by_name.values(): if not self._policy.return_ok(cookie, request): debug(" not returning cookie") continue debug(" it's a match") cookies.append(cookie) return cookies | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug(" it's a match") | _debug(" it's a match") | def _cookies_for_domain(self, domain, request): cookies = [] if not self._policy.domain_return_ok(domain, request): return [] debug("Checking %s for cookies to return", domain) cookies_by_path = self._cookies[domain] for path in cookies_by_path.keys(): if not self._policy.path_return_ok(path, request): continue cookies_by_name = cookies_by_path[path] for cookie in cookies_by_name.values(): if not self._policy.return_ok(cookie, request): debug(" not returning cookie") continue debug(" it's a match") cookies.append(cookie) return cookies | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug("add_cookie_header") | _debug("add_cookie_header") | def add_cookie_header(self, request): """Add correct Cookie: header to request (urllib2.Request object). | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug(" missing value for domain attribute") | _debug(" missing value for domain attribute") | def _normalized_cookie_tuples(self, attrs_set): """Return list of tuples containing normalised cookie information. | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug(" missing or invalid value for expires " | _debug(" missing or invalid value for expires " | def _normalized_cookie_tuples(self, attrs_set): """Return list of tuples containing normalised cookie information. | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug(" missing or invalid (non-numeric) value for " | _debug(" missing or invalid (non-numeric) value for " | def _normalized_cookie_tuples(self, attrs_set): """Return list of tuples containing normalised cookie information. | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug(" missing value for %s attribute" % k) | _debug(" missing value for %s attribute" % k) | def _normalized_cookie_tuples(self, attrs_set): """Return list of tuples containing normalised cookie information. | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug("Expiring cookie, domain='%s', path='%s', name='%s'", domain, path, name) | _debug("Expiring cookie, domain='%s', path='%s', name='%s'", domain, path, name) | def _cookie_from_cookie_tuple(self, tup, request): # standard is dict of standard cookie-attributes, rest is dict of the # rest of them name, value, standard, rest = tup | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug("extract_cookies: %s", response.info()) | _debug("extract_cookies: %s", response.info()) | def extract_cookies(self, response, request): """Extract cookies from response, where allowable given the request.""" debug("extract_cookies: %s", response.info()) self._cookies_lock.acquire() self._policy._now = self._now = int(time.time()) | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
debug(" setting cookie: %s", cookie) | _debug(" setting cookie: %s", cookie) | def extract_cookies(self, response, request): """Extract cookies from response, where allowable given the request.""" debug("extract_cookies: %s", response.info()) self._cookies_lock.acquire() self._policy._now = self._now = int(time.time()) | feb0a3bdbccc7b45bc8b960aa4c3434838b52d05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/feb0a3bdbccc7b45bc8b960aa4c3434838b52d05/cookielib.py |
self.disallow_all = 0 self.allow_all = 0 | self.disallow_all = False self.allow_all = False | def __init__(self, url=''): self.entries = [] self.default_entry = None self.disallow_all = 0 self.allow_all = 0 self.set_url(url) self.last_checked = 0 | 31bd529f5307f65702dbe2a0accbb5532b188a5c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/31bd529f5307f65702dbe2a0accbb5532b188a5c/robotparser.py |
self.disallow_all = 1 | self.disallow_all = True | def read(self): """Reads the robots.txt URL and feeds it to the parser.""" opener = URLopener() f = opener.open(self.url) lines = [] line = f.readline() while line: lines.append(line.strip()) line = f.readline() self.errcode = opener.errcode if self.errcode == 401 or self.errcode == 403: self.disallow_all = 1 _debug("disallow all") elif self.errcode >= 400: self.allow_all = 1 _debug("allow all") elif self.errcode == 200 and lines: _debug("parse lines") self.parse(lines) | 31bd529f5307f65702dbe2a0accbb5532b188a5c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/31bd529f5307f65702dbe2a0accbb5532b188a5c/robotparser.py |
self.allow_all = 1 | self.allow_all = True | def read(self): """Reads the robots.txt URL and feeds it to the parser.""" opener = URLopener() f = opener.open(self.url) lines = [] line = f.readline() while line: lines.append(line.strip()) line = f.readline() self.errcode = opener.errcode if self.errcode == 401 or self.errcode == 403: self.disallow_all = 1 _debug("disallow all") elif self.errcode >= 400: self.allow_all = 1 _debug("allow all") elif self.errcode == 200 and lines: _debug("parse lines") self.parse(lines) | 31bd529f5307f65702dbe2a0accbb5532b188a5c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/31bd529f5307f65702dbe2a0accbb5532b188a5c/robotparser.py |
entry.rulelines.append(RuleLine(line[1], 0)) | entry.rulelines.append(RuleLine(line[1], False)) | def parse(self, lines): """parse the input lines from a robots.txt file. We allow that a user-agent: line is not preceded by one or more blank lines.""" state = 0 linenumber = 0 entry = Entry() | 31bd529f5307f65702dbe2a0accbb5532b188a5c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/31bd529f5307f65702dbe2a0accbb5532b188a5c/robotparser.py |
entry.rulelines.append(RuleLine(line[1], 1)) | entry.rulelines.append(RuleLine(line[1], True)) | def parse(self, lines): """parse the input lines from a robots.txt file. We allow that a user-agent: line is not preceded by one or more blank lines.""" state = 0 linenumber = 0 entry = Entry() | 31bd529f5307f65702dbe2a0accbb5532b188a5c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/31bd529f5307f65702dbe2a0accbb5532b188a5c/robotparser.py |
"""A rule line is a single "Allow:" (allowance==1) or "Disallow:" (allowance==0) followed by a path.""" | """A rule line is a single "Allow:" (allowance==True) or "Disallow:" (allowance==False) followed by a path.""" | def __str__(self): ret = "" for entry in self.entries: ret = ret + str(entry) + "\n" return ret | 31bd529f5307f65702dbe2a0accbb5532b188a5c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/31bd529f5307f65702dbe2a0accbb5532b188a5c/robotparser.py |
allowance = 1 | allowance = True | def __init__(self, path, allowance): if path == '' and not allowance: # an empty value means allow all allowance = 1 self.path = urllib.quote(path) self.allowance = allowance | 31bd529f5307f65702dbe2a0accbb5532b188a5c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/31bd529f5307f65702dbe2a0accbb5532b188a5c/robotparser.py |
return 1 | return True | def allowance(self, filename): """Preconditions: - our agent applies to this entry - filename is URL decoded""" for line in self.rulelines: _debug((filename, str(line), line.allowance)) if line.applies_to(filename): return line.allowance return 1 | 31bd529f5307f65702dbe2a0accbb5532b188a5c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/31bd529f5307f65702dbe2a0accbb5532b188a5c/robotparser.py |
limit = sqrt(n+1) | limit = sqrt(float(n+1)) | def fact(n): if n < 1: raise error # fact() argument should be >= 1 if n == 1: return [] # special case res = [] # Treat even factors special, so we can use i = i+2 later while n%2 == 0: res.append(2) n = n/2 # Try odd numbers up to sqrt(n) limit = sqrt(n+1) i = 3 while i <= limit: if n%i == 0: res.append(i) n = n/i limit = sqrt(n+1) else: i = i+2 res.append(n) return res | 3a585bb964483f2892f5a7bfc8e899806a1dc247 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3a585bb964483f2892f5a7bfc8e899806a1dc247/fact.py |
res.append(n) | if n != 1: res.append(n) | def fact(n): if n < 1: raise error # fact() argument should be >= 1 if n == 1: return [] # special case res = [] # Treat even factors special, so we can use i = i+2 later while n%2 == 0: res.append(2) n = n/2 # Try odd numbers up to sqrt(n) limit = sqrt(n+1) i = 3 while i <= limit: if n%i == 0: res.append(i) n = n/i limit = sqrt(n+1) else: i = i+2 res.append(n) return res | 3a585bb964483f2892f5a7bfc8e899806a1dc247 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/3a585bb964483f2892f5a7bfc8e899806a1dc247/fact.py |
if pathname and pathname[0] == '/': | if not pathname: return pathname if pathname[0] == '/': | def convert_path (pathname): """Return 'pathname' as a name that will work on the native filesystem, i.e. split it on '/' and put it back together again using the current directory separator. Needed because filenames in the setup script are always supplied in Unix style, and have to be converted to the local convention before we can actually use them in the filesystem. Raises ValueError on non-Unix-ish systems if 'pathname' either starts or ends with a slash. """ if os.sep == '/': return pathname if pathname and pathname[0] == '/': raise ValueError, "path '%s' cannot be absolute" % pathname if pathname and pathname[-1] == '/': raise ValueError, "path '%s' cannot end with '/'" % pathname paths = string.split(pathname, '/') while '.' in paths: paths.remove('.') if not paths: return os.curdir return apply(os.path.join, paths) | b0df6a1afa585c5f4d097aeb68e41996a9fff9d7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b0df6a1afa585c5f4d097aeb68e41996a9fff9d7/util.py |
if pathname and pathname[-1] == '/': | if pathname[-1] == '/': | def convert_path (pathname): """Return 'pathname' as a name that will work on the native filesystem, i.e. split it on '/' and put it back together again using the current directory separator. Needed because filenames in the setup script are always supplied in Unix style, and have to be converted to the local convention before we can actually use them in the filesystem. Raises ValueError on non-Unix-ish systems if 'pathname' either starts or ends with a slash. """ if os.sep == '/': return pathname if pathname and pathname[0] == '/': raise ValueError, "path '%s' cannot be absolute" % pathname if pathname and pathname[-1] == '/': raise ValueError, "path '%s' cannot end with '/'" % pathname paths = string.split(pathname, '/') while '.' in paths: paths.remove('.') if not paths: return os.curdir return apply(os.path.join, paths) | b0df6a1afa585c5f4d097aeb68e41996a9fff9d7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/b0df6a1afa585c5f4d097aeb68e41996a9fff9d7/util.py |
osname = string.lower(osname) | osname = string.lower(osname) osname = string.replace(osname, '/', '') | def get_platform (): """Return a string that identifies the current platform. This is used mainly to distinguish platform-specific build directories and platform-specific built distributions. Typically includes the OS name and version and the architecture (as supplied by 'os.uname()'), although the exact information included depends on the OS; eg. for IRIX the architecture isn't particularly important (IRIX only runs on SGI hardware), but for Linux the kernel version isn't particularly important. Examples of returned values: linux-i586 linux-alpha (?) solaris-2.6-sun4u irix-5.3 irix64-6.2 For non-POSIX platforms, currently just returns 'sys.platform'. """ if os.name != "posix" or not hasattr(os, 'uname'): # XXX what about the architecture? NT is Intel or Alpha, # Mac OS is M68k or PPC, etc. return sys.platform # Try to distinguish various flavours of Unix (osname, host, release, version, machine) = os.uname() osname = string.lower(osname) if osname[:5] == "linux": # At least on Linux/Intel, 'machine' is the processor -- # i386, etc. # XXX what about Alpha, SPARC, etc? return "%s-%s" % (osname, machine) elif osname[:5] == "sunos": if release[0] >= "5": # SunOS 5 == Solaris 2 osname = "solaris" release = "%d.%s" % (int(release[0]) - 3, release[2:]) # fall through to standard osname-release-machine representation elif osname[:4] == "irix": # could be "irix64"! return "%s-%s" % (osname, release) elif osname[:3] == "aix": return "%s-%s.%s" % (osname, version, release) elif osname[:6] == "cygwin": rel_re = re.compile (r'[\d.]+') m = rel_re.match(release) if m: release = m.group() return "%s-%s-%s" % (osname, release, machine) | 83c158fdc9d9acb737172a1a365014514afd4fc9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/83c158fdc9d9acb737172a1a365014514afd4fc9/util.py |
_nmtoken_rx = re.compile("[a-z][-._a-z0-9]*", re.IGNORECASE) | _nmtoken_rx = re.compile("[a-z][-._a-z0-9]*$", re.IGNORECASE) | def format_attrs(attrs, xml=0): attrs = attrs.items() attrs.sort() s = '' for name, value in attrs: if xml: s = '%s %s="%s"' % (s, name, escape(value)) else: # this is a little bogus, but should do for now if name == value and isnmtoken(value): s = "%s %s" % (s, value) elif istoken(value): s = "%s %s=%s" % (s, name, value) else: s = '%s %s="%s"' % (s, name, escape(value)) return s | 36dfe58694afff02120f89e5a086593716baf1d7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/36dfe58694afff02120f89e5a086593716baf1d7/esis2sgml.py |
_token_rx = re.compile("[a-z0-9][-._a-z0-9]*", re.IGNORECASE) | _token_rx = re.compile("[a-z0-9][-._a-z0-9]*$", re.IGNORECASE) | def isnmtoken(s): return _nmtoken_rx.match(s) is not None | 36dfe58694afff02120f89e5a086593716baf1d7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/36dfe58694afff02120f89e5a086593716baf1d7/esis2sgml.py |
__version__ = '1.3' | __version__ = '1.4' | def _(s): return s | 63ce5af49660181d129aabb9c096cab07807b54b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/63ce5af49660181d129aabb9c096cab07807b54b/pygettext.py |
def _(s): return s | 63ce5af49660181d129aabb9c096cab07807b54b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/63ce5af49660181d129aabb9c096cab07807b54b/pygettext.py |
||
if self.__options.docstrings: | if opts.docstrings and not opts.nodocstrings.get(self.__curfile): | def __waiting(self, ttype, tstring, lineno): # Do docstring extractions, if enabled if self.__options.docstrings: # module docstring? if self.__freshmodule: if ttype == tokenize.STRING: self.__addentry(safe_eval(tstring), lineno, isdocstring=1) self.__freshmodule = 0 elif ttype not in (tokenize.COMMENT, tokenize.NL): self.__freshmodule = 0 return # class docstring? if ttype == tokenize.NAME and tstring in ('class', 'def'): self.__state = self.__suiteseen return if ttype == tokenize.NAME and tstring in self.__options.keywords: self.__state = self.__keywordseen | 63ce5af49660181d129aabb9c096cab07807b54b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/63ce5af49660181d129aabb9c096cab07807b54b/pygettext.py |
if ttype == tokenize.NAME and tstring in self.__options.keywords: | if ttype == tokenize.NAME and tstring in opts.keywords: | def __waiting(self, ttype, tstring, lineno): # Do docstring extractions, if enabled if self.__options.docstrings: # module docstring? if self.__freshmodule: if ttype == tokenize.STRING: self.__addentry(safe_eval(tstring), lineno, isdocstring=1) self.__freshmodule = 0 elif ttype not in (tokenize.COMMENT, tokenize.NL): self.__freshmodule = 0 return # class docstring? if ttype == tokenize.NAME and tstring in ('class', 'def'): self.__state = self.__suiteseen return if ttype == tokenize.NAME and tstring in self.__options.keywords: self.__state = self.__keywordseen | 63ce5af49660181d129aabb9c096cab07807b54b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/63ce5af49660181d129aabb9c096cab07807b54b/pygettext.py |
'ad:DEhk:Kno:p:S:Vvw:x:', | 'ad:DEhk:Kno:p:S:Vvw:x:X:', | def main(): global default_keywords try: opts, args = getopt.getopt( sys.argv[1:], 'ad:DEhk:Kno:p:S:Vvw:x:', ['extract-all', 'default-domain=', 'escape', 'help', 'keyword=', 'no-default-keywords', 'add-location', 'no-location', 'output=', 'output-dir=', 'style=', 'verbose', 'version', 'width=', 'exclude-file=', 'docstrings', ]) except getopt.error, msg: usage(1, msg) # for holding option values class Options: # constants GNU = 1 SOLARIS = 2 # defaults extractall = 0 # FIXME: currently this option has no effect at all. escape = 0 keywords = [] outpath = '' outfile = 'messages.pot' writelocations = 1 locationstyle = GNU verbose = 0 width = 78 excludefilename = '' docstrings = 0 options = Options() locations = {'gnu' : options.GNU, 'solaris' : options.SOLARIS, } # parse options for opt, arg in opts: if opt in ('-h', '--help'): usage(0) elif opt in ('-a', '--extract-all'): options.extractall = 1 elif opt in ('-d', '--default-domain'): options.outfile = arg + '.pot' elif opt in ('-E', '--escape'): options.escape = 1 elif opt in ('-D', '--docstrings'): options.docstrings = 1 elif opt in ('-k', '--keyword'): options.keywords.append(arg) elif opt in ('-K', '--no-default-keywords'): default_keywords = [] elif opt in ('-n', '--add-location'): options.writelocations = 1 elif opt in ('--no-location',): options.writelocations = 0 elif opt in ('-S', '--style'): options.locationstyle = locations.get(arg.lower()) if options.locationstyle is None: usage(1, _('Invalid value for --style: %s') % arg) elif opt in ('-o', '--output'): options.outfile = arg elif opt in ('-p', '--output-dir'): options.outpath = arg elif opt in ('-v', '--verbose'): options.verbose = 1 elif opt in ('-V', '--version'): print _('pygettext.py (xgettext for Python) %s') % __version__ sys.exit(0) elif opt in ('-w', '--width'): try: options.width = int(arg) except ValueError: usage(1, _('--width argument must be an integer: %s') % arg) elif opt in ('-x', '--exclude-file'): options.excludefilename = arg # calculate escapes make_escapes(options.escape) # calculate all keywords options.keywords.extend(default_keywords) # initialize list of strings to exclude if options.excludefilename: try: fp = open(options.excludefilename) options.toexclude = fp.readlines() fp.close() except IOError: print >> sys.stderr, _( "Can't read --exclude-file: %s") % options.excludefilename sys.exit(1) else: options.toexclude = [] # slurp through all the files eater = TokenEater(options) for filename in args: if filename == '-': if options.verbose: print _('Reading standard input') fp = sys.stdin closep = 0 else: if options.verbose: print _('Working on %s') % filename fp = open(filename) closep = 1 try: eater.set_filename(filename) try: tokenize.tokenize(fp.readline, eater) except tokenize.TokenError, e: print >> sys.stderr, '%s: %s, line %d, column %d' % ( e[0], filename, e[1][0], e[1][1]) finally: if closep: fp.close() # write the output if options.outfile == '-': fp = sys.stdout closep = 0 else: if options.outpath: options.outfile = os.path.join(options.outpath, options.outfile) fp = open(options.outfile, 'w') closep = 1 try: eater.write(fp) finally: if closep: fp.close() | 63ce5af49660181d129aabb9c096cab07807b54b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/63ce5af49660181d129aabb9c096cab07807b54b/pygettext.py |
'docstrings', | 'docstrings', 'no-docstrings', | def main(): global default_keywords try: opts, args = getopt.getopt( sys.argv[1:], 'ad:DEhk:Kno:p:S:Vvw:x:', ['extract-all', 'default-domain=', 'escape', 'help', 'keyword=', 'no-default-keywords', 'add-location', 'no-location', 'output=', 'output-dir=', 'style=', 'verbose', 'version', 'width=', 'exclude-file=', 'docstrings', ]) except getopt.error, msg: usage(1, msg) # for holding option values class Options: # constants GNU = 1 SOLARIS = 2 # defaults extractall = 0 # FIXME: currently this option has no effect at all. escape = 0 keywords = [] outpath = '' outfile = 'messages.pot' writelocations = 1 locationstyle = GNU verbose = 0 width = 78 excludefilename = '' docstrings = 0 options = Options() locations = {'gnu' : options.GNU, 'solaris' : options.SOLARIS, } # parse options for opt, arg in opts: if opt in ('-h', '--help'): usage(0) elif opt in ('-a', '--extract-all'): options.extractall = 1 elif opt in ('-d', '--default-domain'): options.outfile = arg + '.pot' elif opt in ('-E', '--escape'): options.escape = 1 elif opt in ('-D', '--docstrings'): options.docstrings = 1 elif opt in ('-k', '--keyword'): options.keywords.append(arg) elif opt in ('-K', '--no-default-keywords'): default_keywords = [] elif opt in ('-n', '--add-location'): options.writelocations = 1 elif opt in ('--no-location',): options.writelocations = 0 elif opt in ('-S', '--style'): options.locationstyle = locations.get(arg.lower()) if options.locationstyle is None: usage(1, _('Invalid value for --style: %s') % arg) elif opt in ('-o', '--output'): options.outfile = arg elif opt in ('-p', '--output-dir'): options.outpath = arg elif opt in ('-v', '--verbose'): options.verbose = 1 elif opt in ('-V', '--version'): print _('pygettext.py (xgettext for Python) %s') % __version__ sys.exit(0) elif opt in ('-w', '--width'): try: options.width = int(arg) except ValueError: usage(1, _('--width argument must be an integer: %s') % arg) elif opt in ('-x', '--exclude-file'): options.excludefilename = arg # calculate escapes make_escapes(options.escape) # calculate all keywords options.keywords.extend(default_keywords) # initialize list of strings to exclude if options.excludefilename: try: fp = open(options.excludefilename) options.toexclude = fp.readlines() fp.close() except IOError: print >> sys.stderr, _( "Can't read --exclude-file: %s") % options.excludefilename sys.exit(1) else: options.toexclude = [] # slurp through all the files eater = TokenEater(options) for filename in args: if filename == '-': if options.verbose: print _('Reading standard input') fp = sys.stdin closep = 0 else: if options.verbose: print _('Working on %s') % filename fp = open(filename) closep = 1 try: eater.set_filename(filename) try: tokenize.tokenize(fp.readline, eater) except tokenize.TokenError, e: print >> sys.stderr, '%s: %s, line %d, column %d' % ( e[0], filename, e[1][0], e[1][1]) finally: if closep: fp.close() # write the output if options.outfile == '-': fp = sys.stdout closep = 0 else: if options.outpath: options.outfile = os.path.join(options.outpath, options.outfile) fp = open(options.outfile, 'w') closep = 1 try: eater.write(fp) finally: if closep: fp.close() | 63ce5af49660181d129aabb9c096cab07807b54b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/63ce5af49660181d129aabb9c096cab07807b54b/pygettext.py |
except ImportError: | termios.tcgetattr, termios.tcsetattr except (ImportError, AttributeError): | def getuser(): """Get the username from the environment or password database. First try various environment variables, then the password database. This works on Windows as long as USERNAME is set. """ import os for name in ('LOGNAME', 'USER', 'LNAME', 'USERNAME'): user = os.environ.get(name) if user: return user # If this fails, the exception will "explain" why import pwd return pwd.getpwuid(os.getuid())[0] | 201626e00f87a514b4891a65f3014bcb49c5dc88 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/201626e00f87a514b4891a65f3014bcb49c5dc88/getpass.py |
self.assertEqual( posixpath.expanduser("~") + "/", posixpath.expanduser("~/") ) | if posixpath.expanduser("~") != '/': self.assertEqual( posixpath.expanduser("~") + "/", posixpath.expanduser("~/") ) | def test_expanduser(self): self.assertEqual(posixpath.expanduser("foo"), "foo") try: import pwd except ImportError: pass else: self.assert_(isinstance(posixpath.expanduser("~/"), basestring)) self.assertEqual( posixpath.expanduser("~") + "/", posixpath.expanduser("~/") ) self.assert_(isinstance(posixpath.expanduser("~root/"), basestring)) self.assert_(isinstance(posixpath.expanduser("~foo/"), basestring)) | 168e73d25e965888aa307fd74de597a35b660e1b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/168e73d25e965888aa307fd74de597a35b660e1b/test_posixpath.py |
return st[stat.ST_MTIME] | return st[stat.ST_ATIME] | def getatime(filename): """Return the last access time of a file, reported by os.stat().""" st = os.stat(filename) return st[stat.ST_MTIME] | 9811861e3c31f2cb9d04853460408c4fea3d6f1b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/9811861e3c31f2cb9d04853460408c4fea3d6f1b/posixpath.py |
dict['prefixname'] = 'mwerks_plugin_config.h' | if hasattr(MacOS, 'runtimemodel') and MacOS.runtimemodel == "carbon": dict['prefixname'] = 'mwerks_carbonplugin_config.h' else: dict['prefixname'] = 'mwerks_plugin_config.h' | def __init__(self, dict, templatelist=TEMPLATELIST, templatename=None): if templatename == None: if hasattr(MacOS, 'runtimemodel'): templatename = 'template-%s'%MacOS.runtimemodel else: templatename = 'template' if os.sep in templatename: templatedir = templatename else: try: packagedir = os.path.split(__file__)[0] except NameError: packagedir = os.curdir templatedir = os.path.join(packagedir, templatename) if not os.path.exists(templatedir): raise Error, "Cannot find templatedir %s"%templatedir self.dict = dict if not dict.has_key('prefixname'): dict['prefixname'] = 'mwerks_plugin_config.h' self.templatelist = templatelist self.templatedir = templatedir | f3456912e46ba74233e219a94f48e29c85280abc /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/f3456912e46ba74233e219a94f48e29c85280abc/cwxmlgen.py |
stat_function = (os.stat, statcache.stat)[use_statcache] s1, s2 = _sig(stat_function(f1)), _sig(stat_function(f2)) if s1[0]!=stat.S_IFREG or s2[0]!=stat.S_IFREG: return 0 if shallow and s1 == s2: return 1 if s1[1]!=s2[1]: return 0 | if use_statcache: stat_function = statcache.stat else: stat_function = os.stat s1 = _sig(stat_function(f1)) s2 = _sig(stat_function(f2)) if s1[0] != stat.S_IFREG or s2[0] != stat.S_IFREG: return 0 if shallow and s1 == s2: return 1 if s1[1] != s2[1]: return 0 | def cmp(f1, f2, shallow=1,use_statcache=0): """Compare two files. Arguments: f1 -- First file name f2 -- Second file name shallow -- Just check stat signature (do not read the files). defaults to 1. use_statcache -- Do not stat() each file directly: go through the statcache module for more efficiency. Return value: integer -- 1 if the files are the same, 0 otherwise. This function uses a cache for past comparisons and the results, with a cache invalidation mechanism relying on stale signatures. Of course, if 'use_statcache' is true, this mechanism is defeated, and the cache will never grow stale. """ stat_function = (os.stat, statcache.stat)[use_statcache] s1, s2 = _sig(stat_function(f1)), _sig(stat_function(f2)) if s1[0]!=stat.S_IFREG or s2[0]!=stat.S_IFREG: return 0 if shallow and s1 == s2: return 1 if s1[1]!=s2[1]: return 0 result = _cache.get((f1, f2)) if result and (s1, s2)==result[:2]: return result[2] outcome = _do_cmp(f1, f2) _cache[f1, f2] = s1, s2, outcome return outcome | 1916b35f5864b2bfe5e2687b7db4fc0c329c9402 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1916b35f5864b2bfe5e2687b7db4fc0c329c9402/filecmp.py |
if result and (s1, s2)==result[:2]: | if result and (s1, s2) == result[:2]: | def cmp(f1, f2, shallow=1,use_statcache=0): """Compare two files. Arguments: f1 -- First file name f2 -- Second file name shallow -- Just check stat signature (do not read the files). defaults to 1. use_statcache -- Do not stat() each file directly: go through the statcache module for more efficiency. Return value: integer -- 1 if the files are the same, 0 otherwise. This function uses a cache for past comparisons and the results, with a cache invalidation mechanism relying on stale signatures. Of course, if 'use_statcache' is true, this mechanism is defeated, and the cache will never grow stale. """ stat_function = (os.stat, statcache.stat)[use_statcache] s1, s2 = _sig(stat_function(f1)), _sig(stat_function(f2)) if s1[0]!=stat.S_IFREG or s2[0]!=stat.S_IFREG: return 0 if shallow and s1 == s2: return 1 if s1[1]!=s2[1]: return 0 result = _cache.get((f1, f2)) if result and (s1, s2)==result[:2]: return result[2] outcome = _do_cmp(f1, f2) _cache[f1, f2] = s1, s2, outcome return outcome | 1916b35f5864b2bfe5e2687b7db4fc0c329c9402 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/1916b35f5864b2bfe5e2687b7db4fc0c329c9402/filecmp.py |
def loop(timeout=30.0, use_poll=False, map=None): | def loop(timeout=30.0, use_poll=False, map=None, count=None): | def loop(timeout=30.0, use_poll=False, map=None): if map is None: map = socket_map if use_poll and hasattr(select, 'poll'): poll_fun = poll2 else: poll_fun = poll while map: poll_fun(timeout, map) | d5cf14348269f1faf06322a8c159cc50e98e736b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d5cf14348269f1faf06322a8c159cc50e98e736b/asyncore.py |
while map: poll_fun(timeout, map) | if count is None: while map: poll_fun(timeout, map) else: while map and count > 0: poll_fun(timeout, map) count = count - 1 | def loop(timeout=30.0, use_poll=False, map=None): if map is None: map = socket_map if use_poll and hasattr(select, 'poll'): poll_fun = poll2 else: poll_fun = poll while map: poll_fun(timeout, map) | d5cf14348269f1faf06322a8c159cc50e98e736b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/d5cf14348269f1faf06322a8c159cc50e98e736b/asyncore.py |
def install_opener(opener): global _opener _opener = opener | 0a4a50dd85fb1f9f30ec6e6ff62c71124c52ade6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/0a4a50dd85fb1f9f30ec6e6ff62c71124c52ade6/urllib2.py |
||
if not self.stack and not space.match(data): | if not self.stack and space.match(data) is None: | def goahead(self, end): rawdata = self.rawdata i = 0 n = len(rawdata) while i < n: if i > 0: self.__at_start = 0 if self.nomoretags: data = rawdata[i:n] self.handle_data(data) self.lineno = self.lineno + string.count(data, '\n') i = n break res = interesting.search(rawdata, i) if res: j = res.start(0) else: j = n if i < j: if self.__at_start: self.syntax_error('illegal data at start of file') self.__at_start = 0 data = rawdata[i:j] if not self.stack and not space.match(data): self.syntax_error('data not in content') if illegal.search(data): self.syntax_error('illegal character in content') self.handle_data(data) self.lineno = self.lineno + string.count(data, '\n') i = j if i == n: break if rawdata[i] == '<': if starttagopen.match(rawdata, i): if self.literal: data = rawdata[i] self.handle_data(data) self.lineno = self.lineno + string.count(data, '\n') i = i+1 continue k = self.parse_starttag(i) if k < 0: break self.__seen_starttag = 1 self.lineno = self.lineno + string.count(rawdata[i:k], '\n') i = k continue if endtagopen.match(rawdata, i): k = self.parse_endtag(i) if k < 0: break self.lineno = self.lineno + string.count(rawdata[i:k], '\n') i = k self.literal = 0 continue if commentopen.match(rawdata, i): if self.literal: data = rawdata[i] self.handle_data(data) self.lineno = self.lineno + string.count(data, '\n') i = i+1 continue k = self.parse_comment(i) if k < 0: break self.lineno = self.lineno + string.count(rawdata[i:k], '\n') i = k continue if cdataopen.match(rawdata, i): k = self.parse_cdata(i) if k < 0: break self.lineno = self.lineno + string.count(rawdata[i:i], '\n') i = k continue res = xmldecl.match(rawdata, i) if res: if not self.__at_start: self.syntax_error("<?xml?> declaration not at start of document") version, encoding, standalone = res.group('version', 'encoding', 'standalone') if version[1:-1] != '1.0': raise RuntimeError, 'only XML version 1.0 supported' if encoding: encoding = encoding[1:-1] if standalone: standalone = standalone[1:-1] self.handle_xml(encoding, standalone) i = res.end(0) continue res = procopen.match(rawdata, i) if res: k = self.parse_proc(i) if k < 0: break self.lineno = self.lineno + string.count(rawdata[i:k], '\n') i = k continue res = doctype.match(rawdata, i) if res: if self.literal: data = rawdata[i] self.handle_data(data) self.lineno = self.lineno + string.count(data, '\n') i = i+1 continue if self.__seen_doctype: self.syntax_error('multiple DOCTYPE elements') if self.__seen_starttag: self.syntax_error('DOCTYPE not at beginning of document') k = self.parse_doctype(res) if k < 0: break self.__seen_doctype = res.group('name') self.lineno = self.lineno + string.count(rawdata[i:k], '\n') i = k continue elif rawdata[i] == '&': res = charref.match(rawdata, i) if res is not None: i = res.end(0) if rawdata[i-1] != ';': self.syntax_error("`;' missing in charref") i = i-1 if not self.stack: self.syntax_error('data not in content') self.handle_charref(res.group('char')[:-1]) self.lineno = self.lineno + string.count(res.group(0), '\n') continue res = entityref.match(rawdata, i) if res is not None: i = res.end(0) if rawdata[i-1] != ';': self.syntax_error("`;' missing in entityref") i = i-1 name = res.group('name') if self.entitydefs.has_key(name): self.rawdata = rawdata = rawdata[:res.start(0)] + self.entitydefs[name] + rawdata[i:] n = len(rawdata) i = res.start(0) else: self.syntax_error('reference to unknown entity') self.unknown_entityref(name) self.lineno = self.lineno + string.count(res.group(0), '\n') continue elif rawdata[i] == ']': if n-i < 3: break if cdataclose.match(rawdata, i): self.syntax_error("bogus `]]>'") self.handle_data(rawdata[i]) i = i+1 continue else: raise RuntimeError, 'neither < nor & ??' # We get here only if incomplete matches but # nothing else break # end while if i > 0: self.__at_start = 0 if end and i < n: data = rawdata[i] self.syntax_error("bogus `%s'" % data) if illegal.search(data): self.syntax_error('illegal character in content') self.handle_data(data) self.lineno = self.lineno + string.count(data, '\n') self.rawdata = rawdata[i+1:] return self.goahead(end) self.rawdata = rawdata[i:] if end: if not self.__seen_starttag: self.syntax_error('no elements in file') if self.stack: self.syntax_error('missing end tags') while self.stack: self.finish_endtag(self.stack[-1]) | eeb2f32aad5c080dbc80705d5b3fc807c0c31037 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/eeb2f32aad5c080dbc80705d5b3fc807c0c31037/xmllib.py |
if not res: | if res is None: | def parse_comment(self, i): rawdata = self.rawdata if rawdata[i:i+4] <> '<!--': raise RuntimeError, 'unexpected call to handle_comment' res = commentclose.search(rawdata, i+4) if not res: return -1 if doubledash.search(rawdata, i+4, res.start(0)): self.syntax_error("`--' inside comment") if rawdata[res.start(0)-1] == '-': self.syntax_error('comment cannot end in three dashes') if illegal.search(rawdata, i+4, res.start(0)): self.syntax_error('illegal character in comment') self.handle_comment(rawdata[i+4: res.start(0)]) return res.end(0) | eeb2f32aad5c080dbc80705d5b3fc807c0c31037 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/8546/eeb2f32aad5c080dbc80705d5b3fc807c0c31037/xmllib.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.