rem
stringlengths
1
322k
add
stringlengths
0
2.05M
context
stringlengths
4
228k
meta
stringlengths
156
215
self.msg(2, _("the undefined citations are the same")) return 0 self.undef_cites = self.list_undefs()
else: self.msg(2, _("the undefined citations are the same")) else: self.undef_cites = self.list_undefs()
def bibtex_needed (self): """ Return true if BibTeX must be run. """ if self.run_needed: return 1 self.msg(2, _("checking if BibTeX must be run..."))
ca49fe2e7c8984795e9311971ade3b20aac20344 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/ca49fe2e7c8984795e9311971ade3b20aac20344/bibtex.py
file = m.group("file") if file: stack.append(file)
if line[m.start()] == '(': stack.append(m.group("file"))
def update_file (self, line, stack): """ Parse the given line of log file for file openings and closings and update the list `stack'. Newly opened files are at the end, therefore stack[0] is the main source while stack[-1] is the current one. """ m = re_file.search(line) if not m: return while m: file = m.group("file") if file: stack.append(file) else: del stack[-1] line = line[m.end():] m = re_file.search(line) return
8b74b61af24e6642cb8ad48fe232cbacb0f78388 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/8b74b61af24e6642cb8ad48fe232cbacb0f78388/__init__.py
file, path, descr = imp.find_module(join(pname, name));
file, path, descr = imp.find_module(os.path.join(pname, name));
def load_module (self, name, package=None): """ Attempt to register a module with the specified name. If an appropriate module is found, load it and store it in the object's dictionary. Return 0 if no module was found, 1 if a module was found and loaded, and 2 if the module was found but already loaded. """ if self.modules.has_key(name): return 2 try: file, path, descr = imp.find_module(name, [""]) except ImportError: if not package: return 0 try: pname = "" for p in package.split("."): pname = os.path.join(pname, p) file, path, descr = imp.find_module(join(pname, name)); except ImportError: return 0 module = imp.load_module(name, file, path, descr) file.close() self.modules[name] = module return 1
470bcf338a09bbb475561f4e7f61e17f444aa4fb /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/470bcf338a09bbb475561f4e7f61e17f444aa4fb/util.py
self.cwd = join(curdir, "")
self.cwd = "./"
def __init__ (self, level=1, write=None): """ Initialize the object with the specified verbosity level and an optional writing function. If no such function is specified, no message will be output until the 'write' field is changed. """ self.level = level self.write = write self.short = 0 self.path = "" self.cwd = join(curdir, "")
7d7356346aacb262a555c7c9fae658cfd6d010b8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/7d7356346aacb262a555c7c9fae658cfd6d010b8/__init__.py
rule = dict(cp.items(name))
rule = {} for key in cp.options(name): rule[key] = cp.get(name, key)
def read_ini (self, filename): """ Read a set of rules from a file. See the texinfo documentation for the expected format of this file. """ from ConfigParser import ConfigParser cp = ConfigParser() cp.read(filename) for name in cp.sections(): rule = dict(cp.items(name)) rule["cost"] = cost = cp.getint(name, "cost") expr = re.compile(rule["target"] + "$") self.rules[name] = (expr, cost, rule)
7d7356346aacb262a555c7c9fae658cfd6d010b8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/7d7356346aacb262a555c7c9fae658cfd6d010b8/__init__.py
self.conf = Config()
def __init__ (self, message): """ Initialize the environment. This prepares the processing steps for the given file (all steps are initialized empty) and sets the regular expressions and the hook dictionary. """ self.msg = message self.msg(2, _("initializing Rubber..."))
6189ee537f404c8d8cf54554dbc066eecf34882e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/6189ee537f404c8d8cf54554dbc066eecf34882e/__init__.py
self.msg(1, _("initializing..."))
self.msg(1, _("reinitializing..."))
def restart (self): """ Reinitialize the environment, in order to process a new document. This resets the process and the hook dictionary and unloads modules. """ self.msg(1, _("initializing...")) self.modules.clear() self.initialize()
6189ee537f404c8d8cf54554dbc066eecf34882e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/6189ee537f404c8d8cf54554dbc066eecf34882e/__init__.py
old_bst = self.style + ".bst" if exists(old_bst) and self.env.depends.has_key(old_bst): del self.env.depends[old_bst]
if self.style: old_bst = self.style + ".bst" if exists(old_bst) and self.env.depends.has_key(old_bst): del self.env.depends[old_bst]
def set_style (self, style): """ Define the bibliography style used. This method is called when \\bibliographystyle is found. If the style file is found in the current directory, it is considered a dependency. """ old_bst = self.style + ".bst" if exists(old_bst) and self.env.depends.has_key(old_bst): del self.env.depends[old_bst]
08b6d06a2add145b8bf9dfdb59ed38d3e8def9b4 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/08b6d06a2add145b8bf9dfdb59ed38d3e8def9b4/bibtex.py
for file in self.source, self.target:
for file in self.source, self.target, self.pbase + ".ilg":
def clean (self): """ Remove all generated files related to the index. """ for file in self.source, self.target: if exists(file): self.env.msg(1, _("removing %s") % file) os.unlink(file)
b7e85572d9c54390bd3e418c487a599e232a099c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/b7e85572d9c54390bd3e418c487a599e232a099c/index.py
env.add_hook("listinginput", self.input)
env.add_hook("listinginput", self.listinginput)
def __init__ (self, env, dict): self.env = env env.add_hook("verbatimtabinput", self.input) env.add_hook("listinginput", self.input)
13513149653250cfa9e813b7b6dc60709c0cdc24 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/13513149653250cfa9e813b7b6dc60709c0cdc24/moreverb.py
return 1
return string.find(line, "warning:") != -1
def errors (self): """ Returns true if there was an error during the compilation. """ for line in self.lines: if line[0] == "!": return 1 return 0
2e6edd41b641e8206b52357c231c9abd18bf1d85 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/2e6edd41b641e8206b52357c231c9abd18bf1d85/__init__.py
if cmd == "depend":
if cmd == "clean": self.removed_files.append(arg) elif cmd == "depend":
def command (self, cmd, arg): """ Execute the rubber command 'cmd' with argument 'arg'. This is called when a command is found in the source file or in a configuration file. A command name of the form 'foo.bar' is considered to be a command 'bar' for module 'foo'. """ if cmd == "depend": file = self.conf.find_input(arg) if file: self.depends[file] = DependLeaf([file]) else: self.msg(1, _("dependency '%s' not found") % arg)
2e6edd41b641e8206b52357c231c9abd18bf1d85 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/2e6edd41b641e8206b52357c231c9abd18bf1d85/__init__.py
self.watch_file(self.base + ".toc")
self.watch_file(self.src_base + ".toc")
def h_tableofcontents (self, dict): self.watch_file(self.base + ".toc")
2e6edd41b641e8206b52357c231c9abd18bf1d85 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/2e6edd41b641e8206b52357c231c9abd18bf1d85/__init__.py
self.watch_file(self.base + ".lof")
self.watch_file(self.src_base + ".lof")
def h_listoffigures (self, dict): self.watch_file(self.base + ".lof")
2e6edd41b641e8206b52357c231c9abd18bf1d85 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/2e6edd41b641e8206b52357c231c9abd18bf1d85/__init__.py
self.watch_file(self.base + ".lot")
self.watch_file(self.src_base + ".lot")
def h_listoftables (self, dict): self.watch_file(self.base + ".lot")
2e6edd41b641e8206b52357c231c9abd18bf1d85 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/2e6edd41b641e8206b52357c231c9abd18bf1d85/__init__.py
if errors: d = { "kind": "error", "text": error,
pdfTeX = string.find(line, "pdfTeX warning") == -1 if (pdfTeX and warnings) or (errors and not pdfTeX): if pdfTeX: d = { "kind": "warning", "pkg": "pdfTeX", "text": error[error.find(":")+2:] } else: d = { "kind": "error", "text": error
def parse (self, errors=0, boxes=0, refs=0, warnings=0): """ Parse the log file for relevant information. The named arguments are booleans that indicate which information should be extracted: - errors: all errors - boxes: bad boxes - refs: warnings about references - warnings: all other warnings The function returns a generator. Each generated item is a dictionary that contains (some of) the following entries: - kind: the kind of information ("error", "box", "ref", "warning") - text: the text of the error or warning - code: the piece of code that caused an error - file, line, last, pkg: as used by Message.format_pos. """ if not self.lines: return last_file = None pos = [last_file] page = 1 parsing = 0 # 1 if we are parsing an error's text skipping = 0 # 1 if we are skipping text until an empty line something = 0 # 1 if some error was found prefix = None # the prefix for warning messages from packages accu = "" # accumulated text from the previous line for line in self.lines: line = line[:-1] # remove the line feed
9b5572b61c29883d5398dc799bdb2d49ed984b39 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/9b5572b61c29883d5398dc799bdb2d49ed984b39/__init__.py
def __init__ (self, env, dict):
8cbbdf956547e764087cac613d36efede65ec59b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/8cbbdf956547e764087cac613d36efede65ec59b/expand.py
if not self.expand_needed(): return 0
def run (self): if not self.expand_needed(): return 0 self.msg(0, _("writing %s...") % (self.out)) self.out_stream = open(self.out, "w") try: self.expand_path(self.env.source()) except rubber.EndDocument: self.out_stream.write("\\end{document}\n") self.out_stream.close() self.env.something_done = 1
8cbbdf956547e764087cac613d36efede65ec59b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/8cbbdf956547e764087cac613d36efede65ec59b/expand.py
try: self.expand_path(self.env.source()) except rubber.EndDocument: self.out_stream.write("\\end{document}\n") self.out_stream.close() self.env.something_done = 1 def expand_needed (self): """ Check if running epxanding the source is needed. """ final = self.env.src_base + "-final.tex" if not exists(final): self.msg(3, _("the expanded file doesn't exist")) return 1 if getmtime(final) < getmtime(self.env.src_base + ".dvi"): self.msg(3, _("the expanded file is older than the DVI")) return 1 self.msg(3, _("expansion is not needed")) return 0 def expand_path (self, path): file = open(path)
def run (self): if not self.expand_needed(): return 0 self.msg(0, _("writing %s...") % (self.out)) self.out_stream = open(self.out, "w") try: self.expand_path(self.env.source()) except rubber.EndDocument: self.out_stream.write("\\end{document}\n") self.out_stream.close() self.env.something_done = 1
8cbbdf956547e764087cac613d36efede65ec59b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/8cbbdf956547e764087cac613d36efede65ec59b/expand.py
self.env.do_process(file, path, dump=self.out_stream)
try: self.expand_path(self.env.source()) except rubber.EndDocument: self.out_stream.write("\\end{document}\n")
def expand_path (self, path): # self.out_stream.write("%%--- beginning of file %s\n" % path) file = open(path)
8cbbdf956547e764087cac613d36efede65ec59b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/8cbbdf956547e764087cac613d36efede65ec59b/expand.py
for key in self.pkg_hooks.keys(): del self.env.hooks[key] self.env.update_seq()
for key in self.pkg_hooks.keys(): del self.env.hooks[key] self.env.update_seq()
def x_usepackage (self, dict): if not dict["arg"]: return remaining = []
8cbbdf956547e764087cac613d36efede65ec59b /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/8cbbdf956547e764087cac613d36efede65ec59b/expand.py
return 0
continue
def main (self, cmdline): """ Run Rubber for the specified command line. This processes each specified source in order (for making or cleaning). If an error happens while making one of the documents, the whole process stops. The method returns the program's exit code. """ self.prologue = [] self.epilogue = [] self.clean = 0 self.force = 0
e25f0163625d4e8f90519a10342c7e12e238706c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/e25f0163625d4e8f90519a10342c7e12e238706c/cmdline.py
that no compilatin was done (by the script) yet.
that no compilation was done (by the script) yet.
def compile_needed (self): """ Returns true if a first compilation is needed. This method supposes that no compilatin was done (by the script) yet. """ if self.must_compile: return 1 self.msg(3, _("checking if compiling is necessary...")) if not exists(self.src_base + self.out_ext): self.msg(3, _("the output file doesn't exist")) return 1 if not exists(self.src_base + ".log"): self.msg(3, _("the log file does not exist")) return 1 if getmtime(self.src_base + ".log") < getmtime(self.source()): self.msg(3, _("the source is younger than the log file")) return 1 if self.log.read(self.src_base + ".log"): self.msg(3, _("the log file is not produced by %s") % self.conf.tex) return 1 return self.recompile_needed()
d84841c62293ae7ecdbb22ccea845dfa5faaa5e8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/d84841c62293ae7ecdbb22ccea845dfa5faaa5e8/__init__.py
return string.find(line, "warning:") != -1
if string.find(line, "warning:") == -1: return 1
def errors (self): """ Returns true if there was an error during the compilation. """ for line in self.lines: if line[0] == "!": # We check for the substring "warning:" because pdfTeX # sometimes issues warnings (like undefined references) in the # form of errors...
c0dec665d79c4ed6a8789e46a6aae25e06b58fdf /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/c0dec665d79c4ed6a8789e46a6aae25e06b58fdf/__init__.py
"tcidvi" : [""], "textures" : ["", ".ps", ".eps", ".pict"],
"tcidvi" : [], "textures" : [".ps", ".eps", ".pict"],
# default suffixes for each device driver (taken from the .def files)
54d7233db590e1bdc00b147ac889a0949af5e0de /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/54d7233db590e1bdc00b147ac889a0949af5e0de/graphics.py
that no compilatin was done (by the script) yet.
that no compilation was done (by the script) yet.
def compile_needed (self): """ Returns true if a first compilation is needed. This method supposes that no compilatin was done (by the script) yet. """ if self.must_compile: return 1 self.msg(3, _("checking if compiling is necessary...")) if not exists(self.src_base + self.out_ext): self.msg(3, _("the output file doesn't exist")) return 1 if not exists(self.src_base + ".log"): self.msg(3, _("the log file does not exist")) return 1 if getmtime(self.src_base + ".log") < getmtime(self.source()): self.msg(3, _("the source is younger than the log file")) return 1 if self.log.read(self.src_base + ".log"): self.msg(3, _("the log file is not produced by %s") % self.conf.tex) return 1 return self.recompile_needed()
87098d71fbe0fc6ce8db89efda84b3cd844ae20a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/87098d71fbe0fc6ce8db89efda84b3cd844ae20a/__init__.py
return string.find(line, "warning:") != -1
if string.find(line, "warning:") == -1: return 1
def errors (self): """ Returns true if there was an error during the compilation. """ for line in self.lines: if line[0] == "!": # We check for the substring "warning:" because pdfTeX # sometimes issues warnings (like undefined references) in the # form of errors...
a3c30583c0c116039bc79999d23e5e95b3de0e37 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/a3c30583c0c116039bc79999d23e5e95b3de0e37/__init__.py
saved = {}
saved = self.vars.copy()
def push_vars (self, **dict): """ For each named argument "key=val", save the value of variable "key" and assign it the value "val". """ saved = {} for (key, val) in dict.items(): saved[key] = self.vars[key] self.vars[key] = val self.vars_stack.append(saved)
d346c8300956aa84c886ffb2a17544acd2b5db9f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/d346c8300956aa84c886ffb2a17544acd2b5db9f/__init__.py
saved[key] = self.vars[key]
def push_vars (self, **dict): """ For each named argument "key=val", save the value of variable "key" and assign it the value "val". """ saved = {} for (key, val) in dict.items(): saved[key] = self.vars[key] self.vars[key] = val self.vars_stack.append(saved)
d346c8300956aa84c886ffb2a17544acd2b5db9f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/d346c8300956aa84c886ffb2a17544acd2b5db9f/__init__.py
self.vars.update(self.vars_stack[-1])
self.vars = self.vars_stack[-1]
def pop_vars (self): """ Restore the last set of variables saved using "push_vars". """ self.vars.update(self.vars_stack[-1]) del self.vars_stack[-1]
d346c8300956aa84c886ffb2a17544acd2b5db9f /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/d346c8300956aa84c886ffb2a17544acd2b5db9f/__init__.py
({(?P<arg>[^\\\\{}]*)}|[^A-Za-z{])?"
({(?P<arg>[^\\\\{}]*)}|(?=[^A-Za-z]))"
def update_seq (self): """ Update the regular expression used to match macro calls using the keys in the `hook' dictionary. We don't match all control sequences for obvious efficiency reasons. """ self.seq = re.compile("\
8b37ef090907546ad41b0670f69825c5ee4442db /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/8b37ef090907546ad41b0670f69825c5ee4442db/__init__.py
def execute (self, prog, env={}, pwd=None, out=None): """ Silently execute an external program. The `prog' argument is the list of arguments for the program, `prog[0]' is the program name. The `env' argument is a dictionary with definitions that should be added to the environment when running the program. The standard output is passed line by line to the `out' function (or discarded by default). The error output is parsed and messages from Kpathsea are processed (to indicate e.g. font compilation). """ self.msg(1, _("executing: %s") % string.join(prog)) if pwd: self.msg(2, _(" in directory %s") % pwd) if env != {}: self.msg(2, _(" with environment: %r") % env)
8b37ef090907546ad41b0670f69825c5ee4442db /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/8b37ef090907546ad41b0670f69825c5ee4442db/__init__.py
def execute (self, prog, env={}, pwd=None, out=None): """ Silently execute an external program. The `prog' argument is the list of arguments for the program, `prog[0]' is the program name. The `env' argument is a dictionary with definitions that should be added to the environment when running the program. The standard output is passed line by line to the `out' function (or discarded by default). The error output is parsed and messages from Kpathsea are processed (to indicate e.g. font compilation). """ self.msg(1, _("executing: %s") % string.join(prog)) if pwd: self.msg(2, _(" in directory %s") % pwd) if env != {}: self.msg(2, _(" with environment: %r") % env)
8b37ef090907546ad41b0670f69825c5ee4442db /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/8b37ef090907546ad41b0670f69825c5ee4442db/__init__.py
if file[-4:] == ".tex": file = file[:-4] aux = basename(file) + ".aux"
aux = dict["arg"] + ".aux"
def h_include (self, dict): """ Called when an \\include macro is found. This includes files into the source in a way very similar to \\input, except that LaTeX also creates .aux files for them, so we have to notice this. """ if not dict["arg"]: return if self.include_only and not self.include_only.has_key(dict["arg"]): return file, _ = self.input_file(dict["arg"], dict) if file: if file[-4:] == ".tex": file = file[:-4] aux = basename(file) + ".aux" self.removed_files.append(aux) self.aux_old[aux] = None if exists(aux): self.aux_md5[aux] = md5_file(aux) else: self.aux_md5[aux] = None
47294b562ac3accd59a26d657dabee178f612641 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/10102/47294b562ac3accd59a26d657dabee178f612641/__init__.py
values += self.canonicalize(arg)
values += canonicalize(arg)
def canonicalize(args): """ BootAuth canonicalization method. Parameter values are collected, sorted, converted to strings, then hashed with the node key. """
2bdabc3d01aac59e8000093482f369f81990a924 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6995/2bdabc3d01aac59e8000093482f369f81990a924/plcapi.py
values += self.canonicalize(arg.values())
values += canonicalize(arg.values())
def canonicalize(args): """ BootAuth canonicalization method. Parameter values are collected, sorted, converted to strings, then hashed with the node key. """
2bdabc3d01aac59e8000093482f369f81990a924 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6995/2bdabc3d01aac59e8000093482f369f81990a924/plcapi.py
if old_rec != None and rec['timestamp'] > old_rec['timestamp']:
if old_rec == None: self[name] = rec elif rec['timestamp'] > old_rec['timestamp']:
def deliver_record(self, rec): """A record is simply a dictionary with 'name' and 'timestamp' keys. We keep some persistent private data in the records under keys that start with '_'; thus record updates should not displace such keys.""" name = rec['name'] old_rec = self.get(name) if old_rec != None and rec['timestamp'] > old_rec['timestamp']: for key in old_rec.keys(): if not key.startswith('_'): del old_rec[key] old_rec.update(rec) elif rec['timestamp'] >= self._min_timestamp: self[name] = rec
de9814822774070f439479ad36397f3d36f6eb52 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6995/de9814822774070f439479ad36397f3d36f6eb52/database.py
elif rec['timestamp'] >= self._min_timestamp: self[name] = rec
def deliver_record(self, rec): """A record is simply a dictionary with 'name' and 'timestamp' keys. We keep some persistent private data in the records under keys that start with '_'; thus record updates should not displace such keys.""" name = rec['name'] old_rec = self.get(name) if old_rec != None and rec['timestamp'] > old_rec['timestamp']: for key in old_rec.keys(): if not key.startswith('_'): del old_rec[key] old_rec.update(rec) elif rec['timestamp'] >= self._min_timestamp: self[name] = rec
de9814822774070f439479ad36397f3d36f6eb52 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6995/de9814822774070f439479ad36397f3d36f6eb52/database.py
if self.system(cf_rec['postinstall_cmd']): system(err_cmd)
if self.system(cf_rec['postinstall_cmd']): self.system(err_cmd)
def update_conf_file(self, cf_rec): if not cf_rec['enabled']: return dest = cf_rec['dest'] logger.log('conf_files: considering file %s' % dest) err_cmd = cf_rec['error_cmd'] mode = string.atoi(cf_rec['file_permissions'], base=8) uid = pwd.getpwnam(cf_rec['file_owner'])[2] gid = grp.getgrnam(cf_rec['file_group'])[2] url = 'https://%s/%s' % (self.config.PLC_BOOT_HOST, cf_rec['source']) contents = curlwrapper.retrieve(url) logger.log('conf_files: retrieving url %s' % url) if not cf_rec['always_update'] and sha.new(contents).digest() == self.checksum(dest): logger.log('conf_files: skipping file %s, always_update is false and checksums are identical' % dest) return if self.system(cf_rec['preinstall_cmd']): self.system(err_cmd) if not cf_rec['ignore_cmd_errors']: return logger.log('conf_files: installing file %s' % dest) tools.write_file(dest, lambda f: f.write(contents), mode=mode, uidgid=(uid,gid)) if self.system(cf_rec['postinstall_cmd']): system(err_cmd)
eeb809dcffe45268a9c2271a031a9def9fe2427c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/6995/eeb809dcffe45268a9c2271a031a9def9fe2427c/conf_files.py
function = function.replace('.', '/')
function = function.split('.')
def processInputs(self): 'See IPublisherRequest'
f89e0934c04a029908b292162ac24f086ddb5582 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9825/f89e0934c04a029908b292162ac24f086ddb5582/xmlrpc.py
self.setPathSuffix((function,))
self.setPathSuffix(function)
def processInputs(self): 'See IPublisherRequest'
f89e0934c04a029908b292162ac24f086ddb5582 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9825/f89e0934c04a029908b292162ac24f086ddb5582/xmlrpc.py
except Exception, e: self.handleException(e)
except: self.handleException(sys.exc_info())
def setBody(self, body): """Sets the body of the response
f89e0934c04a029908b292162ac24f086ddb5582 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9825/f89e0934c04a029908b292162ac24f086ddb5582/xmlrpc.py
import traceback traceback.print_tb(exc_info[2]) print t print value
def handleException(self, exc_info): """Handle Errors during publsihing and wrap it in XML-RPC XML""" t, value = exc_info[:2]
f89e0934c04a029908b292162ac24f086ddb5582 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9825/f89e0934c04a029908b292162ac24f086ddb5582/xmlrpc.py
if self._charset is not None and isinstance(text, unicode): return text.encode(self._charset)
if isinstance(text, unicode): return text.encode(self._charset or 'UTF-8')
def _encode(self, text): if self._charset is not None and isinstance(text, unicode): return text.encode(self._charset) return text
5984febbf643a873cf682d78a128f0d497b32527 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9825/5984febbf643a873cf682d78a128f0d497b32527/http.py
def processInputs(self): 'See IPublisherRequest'
7e68d3c9e309bb86c4a5632b3f0519c7d59945a8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9825/7e68d3c9e309bb86c4a5632b3f0519c7d59945a8/xmlrpc.py
self._args, function = xmlrpclib.loads(self._body_instream.read())
lines = ''.join(self._body_instream.readlines()) self._args, function = xmlrpclib.loads(lines)
def processInputs(self): 'See IPublisherRequest'
7e68d3c9e309bb86c4a5632b3f0519c7d59945a8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9825/7e68d3c9e309bb86c4a5632b3f0519c7d59945a8/xmlrpc.py
class Retry (PublishingException):
class Retry(PublishingException):
def __str__(self): return 'Location: %s' % self.location
7893590cebabb8468069414f2adbc2caecaee2ec /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9825/7893590cebabb8468069414f2adbc2caecaee2ec/__init__.py
publication = Attribute("""the request's publication object
publication = Attribute("""The request's publication object
def retry(): """Return a retry request
7893590cebabb8468069414f2adbc2caecaee2ec /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9825/7893590cebabb8468069414f2adbc2caecaee2ec/__init__.py
body = Attribute("""the body of the request as a string""") bodyFile = Attribute("""the body of the request as a file""")
body = Attribute("""The body of the request as a string""") bodyFile = Attribute("""The body of the request as a file""")
def processInputs(): """Do any input processing that needs to bve done before traversing
7893590cebabb8468069414f2adbc2caecaee2ec /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9825/7893590cebabb8468069414f2adbc2caecaee2ec/__init__.py
The only request data are envirnment variables.
The only request data are environment variables.
def __getitem__(key): """Return request data
7893590cebabb8468069414f2adbc2caecaee2ec /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9825/7893590cebabb8468069414f2adbc2caecaee2ec/__init__.py
data = self.stream.readline(size)
data = self.stream.readline()
def readline(self, size=None): data = self.stream.readline(size) self.cacheStream.write(data) return data
67be4a6a106553edb3dc4629c9e3a341002cfb05 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9825/67be4a6a106553edb3dc4629c9e3a341002cfb05/http.py
self.test_IApplicationRequest_bodyStream
self.test_IApplicationRequest_body
def testHaveCustomTestsForIApplicationRequest(self): # Make sure that tests are defined for things we can't test here self.test_IApplicationRequest_bodyStream
7ad7b30c526619cb987d33cb088496ef14b2c81c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9825/7ad7b30c526619cb987d33cb088496ef14b2c81c/basetestiapplicationrequest.py
auth=self._auth if auth: if auth.lower().startswith('basic '): if base64 is None: import base64
if self._auth: if self._auth.lower().startswith('basic '): if base64 is None: import base64
def _authUserPW(self): 'See IHTTPCredentials' global base64 auth=self._auth if auth: if auth.lower().startswith('basic '): if base64 is None: import base64 name, password = base64.decodestring( auth.split()[-1]).split(':') return name, password
5575570fab3a532f4f05e4bc709a6612f7d54009 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9825/5575570fab3a532f4f05e4bc709a6612f7d54009/http.py
auth.split()[-1]).split(':')
self._auth.split()[-1]).split(':')
def _authUserPW(self): 'See IHTTPCredentials' global base64 auth=self._auth if auth: if auth.lower().startswith('basic '): if base64 is None: import base64 name, password = base64.decodestring( auth.split()[-1]).split(':') return name, password
5575570fab3a532f4f05e4bc709a6612f7d54009 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9825/5575570fab3a532f4f05e4bc709a6612f7d54009/http.py
"""Create a specific XML-RPC response object."""
"""Create a specific FTP response object."""
def _createResponse(self): """Create a specific XML-RPC response object.""" return FTPResponse()
75a93e70ef9fbcc331604627f6a348ae7858b0f6 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9825/75a93e70ef9fbcc331604627f6a348ae7858b0f6/ftp.py
def _updateContentLength(self): blen = str(len(self._body))
def _updateContentLength(self, data=None): if data is None: blen = str(len(self._body)) else: blen = str(len(data))
def _updateContentLength(self): blen = str(len(self._body)) if blen.endswith('L'): blen = blen[:-1] self.setHeader('content-length', blen)
1fd03e9dc1037d1095c4db7ef85e3459aae64424 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9825/1fd03e9dc1037d1095c4db7ef85e3459aae64424/http.py
cookies on the response object.
cookies on the response object and encode the string into appropriate encoding.
def write(self, string): """See IApplicationResponse
1fd03e9dc1037d1095c4db7ef85e3459aae64424 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9825/1fd03e9dc1037d1095c4db7ef85e3459aae64424/http.py
if self.getHeader('content-type', '').startswith('text'): data = self._encode(data) self._updateContentLength(data)
def output(self, data): """Output the data to the world. There are a couple of steps we have to do:
1fd03e9dc1037d1095c4db7ef85e3459aae64424 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9825/1fd03e9dc1037d1095c4db7ef85e3459aae64424/http.py
if self.getHeader('content-type', '').startswith('text'): data = self._encode(data)
def output(self, data): """Output the data to the world. There are a couple of steps we have to do:
1fd03e9dc1037d1095c4db7ef85e3459aae64424 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9825/1fd03e9dc1037d1095c4db7ef85e3459aae64424/http.py
self.pres = Presentation()
self.pres = Presentation(ContentStub(), TestRequest())
def setUp(self): self.pres = Presentation()
8d0542b2242e354b5c556b9ebbec7a9493ab031a /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9825/8d0542b2242e354b5c556b9ebbec7a9493ab031a/test_xmlrpcmethodpublisher.py
self.filename = aFieldStorage.filename
self.filename = unicode(aFieldStorage.filename, 'UTF-8')
def __init__(self, aFieldStorage):
af919a97465be0a9276d2fc268b770e09dd56772 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9825/af919a97465be0a9276d2fc268b770e09dd56772/browser.py
"XMLRPC View"
"""XMLRPC View"""
def getDefaultTraversal(request, ob): """Get the default published object for the request
3deb045796a6bc016b92290d7325bce9a161038c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9825/3deb045796a6bc016b92290d7325bce9a161038c/xmlrpc.py
(item.filename is not None
(item.filename is not None and item.filename != ''
def processInputs(self): 'See IPublisherRequest'
37e60eace075fc2146aa213668d39ea83cae41f9 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9825/37e60eace075fc2146aa213668d39ea83cae41f9/browser.py
eq(locale.getLocaleLanguageId(), lang) eq(locale.getLocaleCountryId(), country) eq(locale.getLocaleVariantId(), variant)
eq(locale.id.language, lang) eq(locale.id.country, country) eq(locale.id.variant, variant)
def testRequestLocale(self): eq = self.assertEqual unless = self.failUnless for httplang in ('it', 'it-ch', 'it-CH', 'IT', 'IT-CH', 'IT-ch'): req = self._createRequest({'HTTP_ACCEPT_LANGUAGE': httplang}) locale = req.getLocale() unless(ILocale.isImplementedBy(locale)) parts = httplang.split('-') lang = parts.pop(0).lower() country = variant = None if parts: country = parts.pop(0).upper() if parts: variant = parts.pop(0).upper() eq(locale.getLocaleLanguageId(), lang) eq(locale.getLocaleCountryId(), country) eq(locale.getLocaleVariantId(), variant) # Now test for non-existant locale fallback req = self._createRequest({'HTTP_ACCEPT_LANGUAGE': 'xx'}) locale = req.getLocale() unless(ILocale.isImplementedBy(locale)) eq(locale.getLocaleLanguageId(), None) eq(locale.getLocaleCountryId(), None) eq(locale.getLocaleVariantId(), None)
a724aec889c0cb764d866a3cc18b925591a870c3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9825/a724aec889c0cb764d866a3cc18b925591a870c3/test_http.py
eq(locale.getLocaleLanguageId(), None) eq(locale.getLocaleCountryId(), None) eq(locale.getLocaleVariantId(), None)
eq(locale.id.language, None) eq(locale.id.country, None) eq(locale.id.variant, None)
def testRequestLocale(self): eq = self.assertEqual unless = self.failUnless for httplang in ('it', 'it-ch', 'it-CH', 'IT', 'IT-CH', 'IT-ch'): req = self._createRequest({'HTTP_ACCEPT_LANGUAGE': httplang}) locale = req.getLocale() unless(ILocale.isImplementedBy(locale)) parts = httplang.split('-') lang = parts.pop(0).lower() country = variant = None if parts: country = parts.pop(0).upper() if parts: variant = parts.pop(0).upper() eq(locale.getLocaleLanguageId(), lang) eq(locale.getLocaleCountryId(), country) eq(locale.getLocaleVariantId(), variant) # Now test for non-existant locale fallback req = self._createRequest({'HTTP_ACCEPT_LANGUAGE': 'xx'}) locale = req.getLocale() unless(ILocale.isImplementedBy(locale)) eq(locale.getLocaleLanguageId(), None) eq(locale.getLocaleCountryId(), None) eq(locale.getLocaleVariantId(), None)
a724aec889c0cb764d866a3cc18b925591a870c3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9825/a724aec889c0cb764d866a3cc18b925591a870c3/test_http.py
path = self.get("PATH_INFO", "/") path = unquote(path) path = path.decode('UTF-8') self._environ["PATH_INFO"] = path
def __setupPath(self): # The recommendation states that: # # Unless there is some compelling reason for a # particular scheme to do otherwise, translating character sequences # into UTF-8 (RFC 2279) [3] and then subsequently using the %HH # encoding for unsafe octets is recommended. # # See: http://www.ietf.org/rfc/rfc2718.txt, Section 2.2.5 path = self.get("PATH_INFO", "/") path = unquote(path) path = path.decode('UTF-8') self._environ["PATH_INFO"] = path self._setupPath_helper("PATH_INFO")
0b69c6b22625da97b31cb95f6ab5326c954369c8 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9825/0b69c6b22625da97b31cb95f6ab5326c954369c8/http.py
def mapply(object, positional=(), request={}): __traceback_info__ = object # we need deep access for intrspection. Waaa. unwrapped = removeAllProxies(object) unwrapped, wrapperCount = unwrapMethod(unwrapped) code = unwrapped.func_code defaults = unwrapped.func_defaults names = code.co_varnames[wrapperCount:code.co_argcount] nargs = len(names) if positional: args = list(positional) if len(args) > nargs: given = len(args) if wrapperCount: given = given + wrapperCount raise TypeError, ( '%s() takes at most %d argument%s(%d given)' % ( getattr(unwrapped, '__name__', repr(object)), code.co_argcount, (code.co_argcount > 1 and 's ' or ' '), given)) else: args = [] get = request.get if defaults: nrequired = len(names) - (len(defaults)) else: nrequired = len(names) for index in range(len(args), nargs): name = names[index] v = get(name, _marker) if v is _marker: if name == 'REQUEST': v = request elif index < nrequired: raise TypeError, 'Missing argument to %s(): %s' % ( getattr(unwrapped, '__name__', repr(object)), name) else: v = defaults[index-nrequired] args.append(v) args = tuple(args) if __debug__: return debug_call(object, args) return object(*args)
5734eae15f356ce05cacf333f1df8b1cead01329 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9825/5734eae15f356ce05cacf333f1df8b1cead01329/publish.py
def IPublisher(Interface):
class IPublisher(Interface):
def IPublisher(Interface): def publish(request): """Publish a request The request must be an IPublisherRequest. """
dd0057708ff34f1dbbffb3122772526e275e73b2 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9825/dd0057708ff34f1dbbffb3122772526e275e73b2/__init__.py
response.setCharset()
response.setCharset(charset)
def _getResultFromResponse(self, body, charset=None, headers=None): response, stream = self._createResponse() if charset is not None: response.setCharset() if headers is not None: for hdr, val in headers.iteritems(): response.setHeader(hdr, val) response.setBody(body) response.outputBody() return self._parseResult(stream.getvalue())
8979b58f8d21d66b086fecea5ade77d377a08e55 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9825/8979b58f8d21d66b086fecea5ade77d377a08e55/test_http.py
"""Do any input processing that needs to bve done before traversing
"""Do any input processing that needs to be done before traversing
def processInputs(): """Do any input processing that needs to bve done before traversing
ac1e28175e96108ec6ffd3c42c09a40931353d01 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9825/ac1e28175e96108ec6ffd3c42c09a40931353d01/__init__.py
raise Unauthorized("Name %s begins with an underscore" % `name`)
raise Unauthorized, name
def traverseName(self, request, ob, name, check_auth=1): if name.startswith('_'): raise Unauthorized("Name %s begins with an underscore" % `name`) if hasattr(ob, name): subob = getattr(ob, name) else: try: subob = ob[name] except (KeyError, IndexError, TypeError, AttributeError): raise NotFound(ob, name, request) if self.require_docstrings and not getattr(subob, '__doc__', None): raise DebugError(subob, 'Missing or empty doc string') return subob
ac0a0ddc8413791ff71684446a431b7bb31b73a0 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9825/ac0a0ddc8413791ff71684446a431b7bb31b73a0/base.py
"""Raise this to retry a request. """
"""Raise this to retry a request."""
def getOriginalException(): 'Returns the original exception object.'
1efc979e1e3a1ded9db92b29d7fe03b1f6a70c2e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9825/1efc979e1e3a1ded9db92b29d7fe03b1f6a70c2e/__init__.py
'''An exception caught by the publisher is adapted to this so that it can have persistent side-effects.'''
"""An exception caught by the publisher is adapted to this so that it can have persistent side-effects."""
def __str__(self): return repr(self.orig_exc)
1efc979e1e3a1ded9db92b29d7fe03b1f6a70c2e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9825/1efc979e1e3a1ded9db92b29d7fe03b1f6a70c2e/__init__.py
'''Effect persistent side-effects.
"""Effect persistent side-effects.
def __call__(obj, request, exc_info): '''Effect persistent side-effects.
1efc979e1e3a1ded9db92b29d7fe03b1f6a70c2e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9825/1efc979e1e3a1ded9db92b29d7fe03b1f6a70c2e/__init__.py
'''
"""
def __call__(obj, request, exc_info): '''Effect persistent side-effects.
1efc979e1e3a1ded9db92b29d7fe03b1f6a70c2e /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/9825/1efc979e1e3a1ded9db92b29d7fe03b1f6a70c2e/__init__.py
inittime = int(time())
fullinittime = time() inittime = int(fullinittime)
def getobsc(snum,stime,observables,zerotime=0.0): inittime = int(time()) lasttime = 0 print "Processing...", sys.stdout.flush() try: if len(Numeric.shape(observables)) == 0: array = Numeric.zeros(snum,typecode='d') for i in Numeric.arange(0,snum): array[i] = observables(zerotime+i*stime) if i % 1024 == 0: lasttime = dotime(i,snum,inittime,lasttime) else: obslen = Numeric.shape(observables)[0] array = Numeric.zeros((snum,obslen),typecode='d') for i in Numeric.arange(0,snum): for j in range(0,obslen): array[i,j] = observables[j](zerotime+i*stime) if i % 1024 == 0: lasttime = dotime(i,snum,inittime,lasttime) except IndexError: print "lisautils::getobsc: I have trouble accessing time ", zerotime+i*stime, print "; you may try to reset your objects and repeat..." raise # there was good stuff here, but it's better to let the user deal with this # in particular, if observables is a noise-like variable, then it should # have the 'reset' method ['reset' in dir(observables)]; if observables is # a method of a TDI class, which should have the 'reset' method, the test # is ['reset' in dir(observables.im_self)], where "im_self" returns the # class instance for a given instance method currenttime = int(time()) - inittime if currenttime > 0: vel = ((1.0*snum)/currenttime) print "\r...completed in %d s [%d (multi)samples/s]. " % (currenttime,vel) else: print "\r...completed. " return array
af4a70d237e31b270a07043590794603135da9d7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11274/af4a70d237e31b270a07043590794603135da9d7/lisautils.py
currenttime = int(time()) - inittime
currenttime = time() - fullinittime
def getobsc(snum,stime,observables,zerotime=0.0): inittime = int(time()) lasttime = 0 print "Processing...", sys.stdout.flush() try: if len(Numeric.shape(observables)) == 0: array = Numeric.zeros(snum,typecode='d') for i in Numeric.arange(0,snum): array[i] = observables(zerotime+i*stime) if i % 1024 == 0: lasttime = dotime(i,snum,inittime,lasttime) else: obslen = Numeric.shape(observables)[0] array = Numeric.zeros((snum,obslen),typecode='d') for i in Numeric.arange(0,snum): for j in range(0,obslen): array[i,j] = observables[j](zerotime+i*stime) if i % 1024 == 0: lasttime = dotime(i,snum,inittime,lasttime) except IndexError: print "lisautils::getobsc: I have trouble accessing time ", zerotime+i*stime, print "; you may try to reset your objects and repeat..." raise # there was good stuff here, but it's better to let the user deal with this # in particular, if observables is a noise-like variable, then it should # have the 'reset' method ['reset' in dir(observables)]; if observables is # a method of a TDI class, which should have the 'reset' method, the test # is ['reset' in dir(observables.im_self)], where "im_self" returns the # class instance for a given instance method currenttime = int(time()) - inittime if currenttime > 0: vel = ((1.0*snum)/currenttime) print "\r...completed in %d s [%d (multi)samples/s]. " % (currenttime,vel) else: print "\r...completed. " return array
af4a70d237e31b270a07043590794603135da9d7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11274/af4a70d237e31b270a07043590794603135da9d7/lisautils.py
vel = ((1.0*snum)/currenttime) print "\r...completed in %d s [%d (multi)samples/s]. " % (currenttime,vel)
vel = snum/currenttime print "\r...completed in %d s [%d (multi)samples/s]. " % (int(currenttime),int(vel))
def getobsc(snum,stime,observables,zerotime=0.0): inittime = int(time()) lasttime = 0 print "Processing...", sys.stdout.flush() try: if len(Numeric.shape(observables)) == 0: array = Numeric.zeros(snum,typecode='d') for i in Numeric.arange(0,snum): array[i] = observables(zerotime+i*stime) if i % 1024 == 0: lasttime = dotime(i,snum,inittime,lasttime) else: obslen = Numeric.shape(observables)[0] array = Numeric.zeros((snum,obslen),typecode='d') for i in Numeric.arange(0,snum): for j in range(0,obslen): array[i,j] = observables[j](zerotime+i*stime) if i % 1024 == 0: lasttime = dotime(i,snum,inittime,lasttime) except IndexError: print "lisautils::getobsc: I have trouble accessing time ", zerotime+i*stime, print "; you may try to reset your objects and repeat..." raise # there was good stuff here, but it's better to let the user deal with this # in particular, if observables is a noise-like variable, then it should # have the 'reset' method ['reset' in dir(observables)]; if observables is # a method of a TDI class, which should have the 'reset' method, the test # is ['reset' in dir(observables.im_self)], where "im_self" returns the # class instance for a given instance method currenttime = int(time()) - inittime if currenttime > 0: vel = ((1.0*snum)/currenttime) print "\r...completed in %d s [%d (multi)samples/s]. " % (currenttime,vel) else: print "\r...completed. " return array
af4a70d237e31b270a07043590794603135da9d7 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11274/af4a70d237e31b270a07043590794603135da9d7/lisautils.py
if currenttime - lasttime > 2:
if currenttime - lasttime > 2 and i > 0:
def dotime(i,snum,inittime,lasttime): currenttime = int(time()) - inittime if currenttime - lasttime > 2: percdone = int((100.0*i)/snum) timeleft = int(((1.0 * currenttime) / i) * (snum-i)) vel = ((1.0*i)/currenttime) minleft = timeleft / 60 secleft = timeleft - minleft*60 print "\r...%d/%d (%d%%) done [%d (multi)samples/s], est. %dm%ds left..." % (i,snum,percdone,vel,minleft,secleft), sys.stdout.flush() return currenttime return lasttime
08d91cb3b99132ae30fbe7b31149c88b578e4a4c /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11274/08d91cb3b99132ae30fbe7b31149c88b578e4a4c/lisautils.py
def spect(series,sampling,patches=1,detrend=0):
def spect(series,sampling,patches=1,detrend=0,overlap=1):
def spect(series,sampling,patches=1,detrend=0): nyquistf = 0.5 / sampling if patches==0: period = pdg(series) elif patches==1: period = wpdg(series,detrend) else: period = opwpdg(series,patches,detrend) pdlen = shape(period)[0]-1 freqs = arange(0,pdlen+1,typecode='d') * (nyquistf / pdlen) deltaf = nyquistf / pdlen period[0] = 2 * period[0] / deltaf period[1:pdlen] = period[1:pdlen] / deltaf period[pdlen] = 2 * period[pdlen] / deltaf spectrum = zeros((pdlen+1,2),typecode='d') spectrum[:,0] = freqs[:] spectrum[:,1] = period[:] return spectrum
0c175a445243a1b3324796b1f3acc50610adb7e3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11274/0c175a445243a1b3324796b1f3acc50610adb7e3/lisautils.py
period = opwpdg(series,patches,detrend)
if overlap==0: period = nopwpdg(series,patches,detrend) else: period = opwpdg(series,patches,detrend)
def spect(series,sampling,patches=1,detrend=0): nyquistf = 0.5 / sampling if patches==0: period = pdg(series) elif patches==1: period = wpdg(series,detrend) else: period = opwpdg(series,patches,detrend) pdlen = shape(period)[0]-1 freqs = arange(0,pdlen+1,typecode='d') * (nyquistf / pdlen) deltaf = nyquistf / pdlen period[0] = 2 * period[0] / deltaf period[1:pdlen] = period[1:pdlen] / deltaf period[pdlen] = 2 * period[pdlen] / deltaf spectrum = zeros((pdlen+1,2),typecode='d') spectrum[:,0] = freqs[:] spectrum[:,1] = period[:] return spectrum
0c175a445243a1b3324796b1f3acc50610adb7e3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11274/0c175a445243a1b3324796b1f3acc50610adb7e3/lisautils.py
pdlen = samples/2
pdlen = (samples-1)/2.0
def wpdg(series,detrend=0): samples = shape(series)[0] pdlen = samples/2 window = 1.0 - abs(arange(0,samples,typecode='d') - pdlen) / (pdlen) weight = samples * sum(window ** 2) # detrending if detrend==0: mean = 0.0 else: mean = sum(series) / (1.0*samples) wseries = window * (series - mean) wpdgram = pdg(wseries) * (1.0 * samples**2 / weight) return wpdgram
0c175a445243a1b3324796b1f3acc50610adb7e3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11274/0c175a445243a1b3324796b1f3acc50610adb7e3/lisautils.py
def nopwpdg(series,patches,detrend=0): samples = shape(series)[0] serlen = samples - (samples % (4*patches)) patlen = serlen/patches pdlen = patlen/2 opwpdgram = zeros(pdlen+1,typecode='d') for cnt in range(0,patches): opwpdgram[:] += wpdg(series[cnt*patlen:(cnt+1)*patlen],detrend) opwpdgram[:] /= 1.0*patches return opwpdgram
def opwpdg(series,patches,detrend=0): samples = shape(series)[0] serlen = samples - (samples % (4*patches)) patlen = serlen/patches pdlen = patlen/2 opwpdgram = zeros(pdlen+1,typecode='d') for cnt in range(0,2*patches-1): opwpdgram[:] += wpdg(series[cnt*pdlen:(cnt+2)*pdlen],detrend) opwpdgram[:] /= (2.0*patches - 1.0) return opwpdgram
0c175a445243a1b3324796b1f3acc50610adb7e3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11274/0c175a445243a1b3324796b1f3acc50610adb7e3/lisautils.py
def getobs(snum,stime,observables):
def getobs(snum,stime,observables,zerotime=0.0):
def getobs(snum,stime,observables): if len(shape(observables)) == 0: array = zeros(snum,typecode='d') for i in arange(0,snum): array[i] = observables(i*stime) else: obslen = shape(observables)[0] array = zeros((snum,obslen),typecode='d') for i in arange(0,snum): for j in range(0,obslen): array[i,j] = observables[j](i*stime) return array
0c175a445243a1b3324796b1f3acc50610adb7e3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11274/0c175a445243a1b3324796b1f3acc50610adb7e3/lisautils.py
array[i] = observables(i*stime)
array[i] = observables(zerotime+i*stime)
def getobs(snum,stime,observables): if len(shape(observables)) == 0: array = zeros(snum,typecode='d') for i in arange(0,snum): array[i] = observables(i*stime) else: obslen = shape(observables)[0] array = zeros((snum,obslen),typecode='d') for i in arange(0,snum): for j in range(0,obslen): array[i,j] = observables[j](i*stime) return array
0c175a445243a1b3324796b1f3acc50610adb7e3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11274/0c175a445243a1b3324796b1f3acc50610adb7e3/lisautils.py
array[i,j] = observables[j](i*stime)
array[i,j] = observables[j](zerotime+i*stime)
def getobs(snum,stime,observables): if len(shape(observables)) == 0: array = zeros(snum,typecode='d') for i in arange(0,snum): array[i] = observables(i*stime) else: obslen = shape(observables)[0] array = zeros((snum,obslen),typecode='d') for i in arange(0,snum): for j in range(0,obslen): array[i,j] = observables[j](i*stime) return array
0c175a445243a1b3324796b1f3acc50610adb7e3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11274/0c175a445243a1b3324796b1f3acc50610adb7e3/lisautils.py
def getobsc(snum,stime,observables):
def getobsc(snum,stime,observables,zerotime=0.0):
def getobsc(snum,stime,observables): inittime = int(time()) lasttime = 0 print "Processing...", sys.stdout.flush() if len(shape(observables)) == 0: array = zeros(snum,typecode='d') for i in arange(0,snum): array[i] = observables(i*stime) if i % 1024 == 0: lasttime = dotime(i,snum,inittime,lasttime) else: obslen = shape(observables)[0] array = zeros((snum,obslen),typecode='d') for i in arange(0,snum): for j in range(0,obslen): array[i,j] = observables[j](i*stime) if i % 1024 == 0: lasttime = dotime(i,snum,inittime,lasttime) currenttime = int(time()) - inittime print "\r...completed in %d s. " % currenttime return array
0c175a445243a1b3324796b1f3acc50610adb7e3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11274/0c175a445243a1b3324796b1f3acc50610adb7e3/lisautils.py
array[i] = observables(i*stime)
array[i] = observables(zerotime+i*stime)
def getobsc(snum,stime,observables): inittime = int(time()) lasttime = 0 print "Processing...", sys.stdout.flush() if len(shape(observables)) == 0: array = zeros(snum,typecode='d') for i in arange(0,snum): array[i] = observables(i*stime) if i % 1024 == 0: lasttime = dotime(i,snum,inittime,lasttime) else: obslen = shape(observables)[0] array = zeros((snum,obslen),typecode='d') for i in arange(0,snum): for j in range(0,obslen): array[i,j] = observables[j](i*stime) if i % 1024 == 0: lasttime = dotime(i,snum,inittime,lasttime) currenttime = int(time()) - inittime print "\r...completed in %d s. " % currenttime return array
0c175a445243a1b3324796b1f3acc50610adb7e3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11274/0c175a445243a1b3324796b1f3acc50610adb7e3/lisautils.py
array[i,j] = observables[j](i*stime)
array[i,j] = observables[j](zerotime+i*stime)
def getobsc(snum,stime,observables): inittime = int(time()) lasttime = 0 print "Processing...", sys.stdout.flush() if len(shape(observables)) == 0: array = zeros(snum,typecode='d') for i in arange(0,snum): array[i] = observables(i*stime) if i % 1024 == 0: lasttime = dotime(i,snum,inittime,lasttime) else: obslen = shape(observables)[0] array = zeros((snum,obslen),typecode='d') for i in arange(0,snum): for j in range(0,obslen): array[i,j] = observables[j](i*stime) if i % 1024 == 0: lasttime = dotime(i,snum,inittime,lasttime) currenttime = int(time()) - inittime print "\r...completed in %d s. " % currenttime return array
0c175a445243a1b3324796b1f3acc50610adb7e3 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11274/0c175a445243a1b3324796b1f3acc50610adb7e3/lisautils.py
for i in arange(0,snum):
for i in Numeric.arange(0,snum):
def getobs(snum,stime,observables,zerotime=0.0): if len(Numeric.shape(observables)) == 0: array = Numeric.zeros(snum,typecode='d') for i in arange(0,snum): array[i] = observables(zerotime+i*stime) else: obslen = Numeric.shape(observables)[0] array = Numeric.zeros((snum,obslen),typecode='d') for i in Numeric.arange(0,snum): for j in range(0,obslen): array[i,j] = observables[j](zerotime+i*stime) return array
73843dccfd4b0caf1704e5983fdbb56e9b47112d /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11274/73843dccfd4b0caf1704e5983fdbb56e9b47112d/lisautils.py
Ted's Julian date 2457023.5"""
Ted's Julian date 2457023.5."""
def stdLISApositions(): """Returns four Numeric arrays corresponding to times [in seconds] along
2848eadedf1e8a14c8ed36a9a6fe90d642d7e992 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11274/2848eadedf1e8a14c8ed36a9a6fe90d642d7e992/lisautils.py
"""Returns an interpolated SampledLISA object based on the position arrays
"""Returns an interpolated SampledLISA object based on the position arrays
def stdSampledLISA(interp=1):
2848eadedf1e8a14c8ed36a9a6fe90d642d7e992 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11274/2848eadedf1e8a14c8ed36a9a6fe90d642d7e992/lisautils.py
[t,p1,p2,p3] = stdlisapositions()
[t,p1,p2,p3] = stdLISApositions()
def stdSampledLISA(interp=1):
2848eadedf1e8a14c8ed36a9a6fe90d642d7e992 /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11274/2848eadedf1e8a14c8ed36a9a6fe90d642d7e992/lisautils.py
assert os.system('python setup.py install --prefix=' + escapespace(thisdir)) == 0
assert os.system('python setup.py install --prefix=' + escapespace(installdir)) == 0
def findpackage(packagename,dirname): packagetargz = glob.glob(packagename + '-*.tar.gz') packagetgz = glob.glob(packagename + '-*.tgz') packagetar = glob.glob(packagename + '-*.tar') packagezip = glob.glob(packagename + '-*.zip') if packagetargz: print "Unpacking " + packagetargz[-1] os.system('tar zxvf ' + packagetargz[-1] + ' > /dev/null') elif packagetgz: print "Unpacking " + packagetgz[-1] os.system('tar zxvf ' + packagetgz[-1] + ' > /dev/null') elif packagetar: print "Unpacking " + packagetar[-1] os.system('tar xvf ' + packagetar[-1] + ' > /dev/null') elif packagezip: print "Unpacking " + packagezip[-1] os.system('unzip ' + packagezip[-1] + ' > /dev/null') dir = filter(os.path.isdir,glob.glob(dirname + '-*') + glob.glob(packagename + '-*')) print "Using unpacking dir " + dir[-1] return dir[-1]
af2dc03441af0fd6fc0cf23df14bcba46f4840fe /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11274/af2dc03441af0fd6fc0cf23df14bcba46f4840fe/default-install.py
assert os.system('python setup.py install --prefix=' + escapespace(thisdir)) == 0
assert os.system('python setup.py install --prefix=' + escapespace(installdir)) == 0
def findpackage(packagename,dirname): packagetargz = glob.glob(packagename + '-*.tar.gz') packagetgz = glob.glob(packagename + '-*.tgz') packagetar = glob.glob(packagename + '-*.tar') packagezip = glob.glob(packagename + '-*.zip') if packagetargz: print "Unpacking " + packagetargz[-1] os.system('tar zxvf ' + packagetargz[-1] + ' > /dev/null') elif packagetgz: print "Unpacking " + packagetgz[-1] os.system('tar zxvf ' + packagetgz[-1] + ' > /dev/null') elif packagetar: print "Unpacking " + packagetar[-1] os.system('tar xvf ' + packagetar[-1] + ' > /dev/null') elif packagezip: print "Unpacking " + packagezip[-1] os.system('unzip ' + packagezip[-1] + ' > /dev/null') dir = filter(os.path.isdir,glob.glob(dirname + '-*') + glob.glob(packagename + '-*')) print "Using unpacking dir " + dir[-1] return dir[-1]
af2dc03441af0fd6fc0cf23df14bcba46f4840fe /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11274/af2dc03441af0fd6fc0cf23df14bcba46f4840fe/default-install.py
assert os.system('./configure --prefix=' + escapespace(thisdir)) == 0
assert os.system('./configure --prefix=' + escapespace(installdir)) == 0
def findpackage(packagename,dirname): packagetargz = glob.glob(packagename + '-*.tar.gz') packagetgz = glob.glob(packagename + '-*.tgz') packagetar = glob.glob(packagename + '-*.tar') packagezip = glob.glob(packagename + '-*.zip') if packagetargz: print "Unpacking " + packagetargz[-1] os.system('tar zxvf ' + packagetargz[-1] + ' > /dev/null') elif packagetgz: print "Unpacking " + packagetgz[-1] os.system('tar zxvf ' + packagetgz[-1] + ' > /dev/null') elif packagetar: print "Unpacking " + packagetar[-1] os.system('tar xvf ' + packagetar[-1] + ' > /dev/null') elif packagezip: print "Unpacking " + packagezip[-1] os.system('unzip ' + packagezip[-1] + ' > /dev/null') dir = filter(os.path.isdir,glob.glob(dirname + '-*') + glob.glob(packagename + '-*')) print "Using unpacking dir " + dir[-1] return dir[-1]
af2dc03441af0fd6fc0cf23df14bcba46f4840fe /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11274/af2dc03441af0fd6fc0cf23df14bcba46f4840fe/default-install.py
assert os.system('python setup.py install --prefix=. --root=' + escapespace(thisdir)) == 0
assert os.system('python setup.py install --prefix=. --root=' + escapespace(installdir)) == 0
def findpackage(packagename,dirname): packagetargz = glob.glob(packagename + '-*.tar.gz') packagetgz = glob.glob(packagename + '-*.tgz') packagetar = glob.glob(packagename + '-*.tar') packagezip = glob.glob(packagename + '-*.zip') if packagetargz: print "Unpacking " + packagetargz[-1] os.system('tar zxvf ' + packagetargz[-1] + ' > /dev/null') elif packagetgz: print "Unpacking " + packagetgz[-1] os.system('tar zxvf ' + packagetgz[-1] + ' > /dev/null') elif packagetar: print "Unpacking " + packagetar[-1] os.system('tar xvf ' + packagetar[-1] + ' > /dev/null') elif packagezip: print "Unpacking " + packagezip[-1] os.system('unzip ' + packagezip[-1] + ' > /dev/null') dir = filter(os.path.isdir,glob.glob(dirname + '-*') + glob.glob(packagename + '-*')) print "Using unpacking dir " + dir[-1] return dir[-1]
af2dc03441af0fd6fc0cf23df14bcba46f4840fe /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11274/af2dc03441af0fd6fc0cf23df14bcba46f4840fe/default-install.py
assert os.system('python setup.py install --prefix=' + escapespace(thisdir)) == 0
assert os.system('python setup.py install --prefix=' + escapespace(installdir)) == 0
def findpackage(packagename,dirname): packagetargz = glob.glob(packagename + '-*.tar.gz') packagetgz = glob.glob(packagename + '-*.tgz') packagetar = glob.glob(packagename + '-*.tar') packagezip = glob.glob(packagename + '-*.zip') if packagetargz: print "Unpacking " + packagetargz[-1] os.system('tar zxvf ' + packagetargz[-1] + ' > /dev/null') elif packagetgz: print "Unpacking " + packagetgz[-1] os.system('tar zxvf ' + packagetgz[-1] + ' > /dev/null') elif packagetar: print "Unpacking " + packagetar[-1] os.system('tar xvf ' + packagetar[-1] + ' > /dev/null') elif packagezip: print "Unpacking " + packagezip[-1] os.system('unzip ' + packagezip[-1] + ' > /dev/null') dir = filter(os.path.isdir,glob.glob(dirname + '-*') + glob.glob(packagename + '-*')) print "Using unpacking dir " + dir[-1] return dir[-1]
af2dc03441af0fd6fc0cf23df14bcba46f4840fe /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11274/af2dc03441af0fd6fc0cf23df14bcba46f4840fe/default-install.py
assert os.system('python setup.py install --prefix=' + escapespace(thisdir) + ' --with-numeric=' + escapespace(thisdir)) == 0
assert os.system('python setup.py install --prefix=' + escapespace(installdir) + ' --with-numeric=' + escapespace(installdir)) == 0
def findpackage(packagename,dirname): packagetargz = glob.glob(packagename + '-*.tar.gz') packagetgz = glob.glob(packagename + '-*.tgz') packagetar = glob.glob(packagename + '-*.tar') packagezip = glob.glob(packagename + '-*.zip') if packagetargz: print "Unpacking " + packagetargz[-1] os.system('tar zxvf ' + packagetargz[-1] + ' > /dev/null') elif packagetgz: print "Unpacking " + packagetgz[-1] os.system('tar zxvf ' + packagetgz[-1] + ' > /dev/null') elif packagetar: print "Unpacking " + packagetar[-1] os.system('tar xvf ' + packagetar[-1] + ' > /dev/null') elif packagezip: print "Unpacking " + packagezip[-1] os.system('unzip ' + packagezip[-1] + ' > /dev/null') dir = filter(os.path.isdir,glob.glob(dirname + '-*') + glob.glob(packagename + '-*')) print "Using unpacking dir " + dir[-1] return dir[-1]
af2dc03441af0fd6fc0cf23df14bcba46f4840fe /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11274/af2dc03441af0fd6fc0cf23df14bcba46f4840fe/default-install.py
' --with-numpy=' + escapespace(thisdir) + ' --with-swig=' + escapespace(thisdir) + '/bin/swig --prefix=' + escapespace(thisdir))) == 0
' --with-numpy=' + escapespace(installdir) + ' --with-swig=' + escapespace(installdir) + '/bin/swig --prefix=' + escapespace(installdir))) == 0
def findpackage(packagename,dirname): packagetargz = glob.glob(packagename + '-*.tar.gz') packagetgz = glob.glob(packagename + '-*.tgz') packagetar = glob.glob(packagename + '-*.tar') packagezip = glob.glob(packagename + '-*.zip') if packagetargz: print "Unpacking " + packagetargz[-1] os.system('tar zxvf ' + packagetargz[-1] + ' > /dev/null') elif packagetgz: print "Unpacking " + packagetgz[-1] os.system('tar zxvf ' + packagetgz[-1] + ' > /dev/null') elif packagetar: print "Unpacking " + packagetar[-1] os.system('tar xvf ' + packagetar[-1] + ' > /dev/null') elif packagezip: print "Unpacking " + packagezip[-1] os.system('unzip ' + packagezip[-1] + ' > /dev/null') dir = filter(os.path.isdir,glob.glob(dirname + '-*') + glob.glob(packagename + '-*')) print "Using unpacking dir " + dir[-1] return dir[-1]
af2dc03441af0fd6fc0cf23df14bcba46f4840fe /local1/tlutelli/issta_data/temp/all_python//python/2006_temp/2006/11274/af2dc03441af0fd6fc0cf23df14bcba46f4840fe/default-install.py