bugged
stringlengths 4
228k
| fixed
stringlengths 0
96.3M
| __index_level_0__
int64 0
481k
|
|---|---|---|
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..."))
|
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..."))
| 6,300
|
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
|
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: if line[m.start()] == '(': stack.append(m.group("file")) else: del stack[-1] line = line[m.end():] m = re_file.search(line) return
| 6,301
|
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
|
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(os.path.join(pname, name)); except ImportError: return 0 module = imp.load_module(name, file, path, descr) file.close() self.modules[name] = module return 1
| 6,302
|
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, "")
|
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, "")
| 6,303
|
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)
|
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 = {} for key in cp.options(name): rule[key] = cp.get(name, key) rule["cost"] = cost = cp.getint(name, "cost") expr = re.compile(rule["target"] + "$") self.rules[name] = (expr, cost, rule)
| 6,304
|
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..."))
|
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..."))
| 6,305
|
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()
|
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, _("reinitializing...")) self.modules.clear() self.initialize()
| 6,306
|
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]
|
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]
| 6,307
|
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)
|
def clean (self): """ Remove all generated files related to the index. """ for file in self.source, self.target, self.pbase + ".ilg": if exists(file): self.env.msg(1, _("removing %s") % file) os.unlink(file)
| 6,308
|
def __init__ (self, env, dict): self.env = env env.add_hook("verbatimtabinput", self.input) env.add_hook("listinginput", self.input)
|
def __init__ (self, env, dict): self.env = env env.add_hook("verbatimtabinput", self.input) env.add_hook("listinginput", self.input)
| 6,309
|
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
|
def errors (self): """ Returns true if there was an error during the compilation. """ for line in self.lines: if line[0] == "!": return string.find(line, "warning:") != -1 return 0
| 6,310
|
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)
|
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 == "clean": self.removed_files.append(arg) elif cmd == "depend": file = self.conf.find_input(arg) if file: self.depends[file] = DependLeaf([file]) else: self.msg(1, _("dependency '%s' not found") % arg)
| 6,311
|
def h_tableofcontents (self, dict): self.watch_file(self.base + ".toc")
|
def h_tableofcontents (self, dict): self.watch_file(self.base + ".toc")
| 6,312
|
def h_listoffigures (self, dict): self.watch_file(self.base + ".lof")
|
def h_listoffigures (self, dict): self.watch_file(self.base + ".lof")
| 6,313
|
def h_listoftables (self, dict): self.watch_file(self.base + ".lot")
|
def h_listoftables (self, dict): self.watch_file(self.base + ".lot")
| 6,314
|
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
|
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
| 6,315
|
def __init__ (self, env, dict):
|
def __init__ (self, env, dict):
| 6,316
|
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
|
def run (self): 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
| 6,317
|
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
|
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
| 6,318
|
def expand_path (self, path): # self.out_stream.write("%%--- beginning of file %s\n" % path) file = open(path)
|
def expand_path (self, path): # self.out_stream.write("%%--- beginning of file %s\n" % path) file = open(path)
| 6,319
|
def x_usepackage (self, dict): if not dict["arg"]: return remaining = []
|
def x_usepackage (self, dict): if not dict["arg"]: return remaining = []
| 6,320
|
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
|
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
| 6,321
|
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()
|
def compile_needed (self): """ Returns true if a first compilation is needed. This method supposes that no compilation 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()
| 6,322
|
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...
|
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...
| 6,323
|
# default suffixes for each device driver (taken from the .def files)
|
# default suffixes for each device driver (taken from the .def files)
| 6,324
|
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()
|
def compile_needed (self): """ Returns true if a first compilation is needed. This method supposes that no compilation 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()
| 6,325
|
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...
|
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...
| 6,326
|
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)
|
def push_vars (self, **dict): """ For each named argument "key=val", save the value of variable "key" and assign it the value "val". """ saved = self.vars.copy() for (key, val) in dict.items(): saved[key] = self.vars[key] self.vars[key] = val self.vars_stack.append(saved)
| 6,327
|
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)
|
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(): self.vars[key] = val self.vars_stack.append(saved)
| 6,328
|
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]
|
def pop_vars (self): """ Restore the last set of variables saved using "push_vars". """ self.vars = self.vars_stack[-1] del self.vars_stack[-1]
| 6,329
|
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("\
|
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("\
| 6,330
|
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)
|
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)
| 6,331
|
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)
|
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)
| 6,332
|
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
|
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: aux = dict["arg"] + ".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
| 6,333
|
def canonicalize(args): """ BootAuth canonicalization method. Parameter values are collected, sorted, converted to strings, then hashed with the node key. """
|
def canonicalize(args): """ BootAuth canonicalization method. Parameter values are collected, sorted, converted to strings, then hashed with the node key. """
| 6,334
|
def canonicalize(args): """ BootAuth canonicalization method. Parameter values are collected, sorted, converted to strings, then hashed with the node key. """
|
def canonicalize(args): """ BootAuth canonicalization method. Parameter values are collected, sorted, converted to strings, then hashed with the node key. """
| 6,335
|
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
|
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: self[name] = rec elif 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
| 6,336
|
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
|
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
| 6,337
|
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)
|
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)
| 6,338
|
def processInputs(self): 'See IPublisherRequest'
|
def processInputs(self): 'See IPublisherRequest'
| 6,339
|
def processInputs(self): 'See IPublisherRequest'
|
def processInputs(self): 'See IPublisherRequest'
| 6,340
|
def setBody(self, body): """Sets the body of the response
|
def setBody(self, body): """Sets the body of the response
| 6,341
|
def handleException(self, exc_info): """Handle Errors during publsihing and wrap it in XML-RPC XML""" t, value = exc_info[:2]
|
def handleException(self, exc_info): """Handle Errors during publsihing and wrap it in XML-RPC XML""" t, value = exc_info[:2]
| 6,342
|
def _encode(self, text): if self._charset is not None and isinstance(text, unicode): return text.encode(self._charset) return text
|
def _encode(self, text): if isinstance(text, unicode): return text.encode(self._charset or 'UTF-8') return text
| 6,343
|
def processInputs(self): 'See IPublisherRequest'
|
defprocessInputs(self):'SeeIPublisherRequest'
| 6,344
|
def processInputs(self): 'See IPublisherRequest'
|
def processInputs(self): 'See IPublisherRequest'
| 6,345
|
def __str__(self): return 'Location: %s' % self.location
|
def __str__(self): return 'Location: %s' % self.location
| 6,346
|
def retry(): """Return a retry request
|
def retry(): """Return a retry request
| 6,347
|
def processInputs(): """Do any input processing that needs to bve done before traversing
|
def processInputs(): """Do any input processing that needs to bve done before traversing
| 6,348
|
def __getitem__(key): """Return request data
|
def __getitem__(key): """Return request data
| 6,349
|
def readline(self, size=None): data = self.stream.readline(size) self.cacheStream.write(data) return data
|
def readline(self, size=None): data = self.stream.readline() self.cacheStream.write(data) return data
| 6,350
|
def testHaveCustomTestsForIApplicationRequest(self): # Make sure that tests are defined for things we can't test here self.test_IApplicationRequest_bodyStream
|
def testHaveCustomTestsForIApplicationRequest(self): # Make sure that tests are defined for things we can't test here self.test_IApplicationRequest_bodyStream
| 6,351
|
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
|
def _authUserPW(self): 'See IHTTPCredentials' global base64 if self._auth: if self._auth.lower().startswith('basic '): if base64 is None: import base64 name, password = base64.decodestring( auth.split()[-1]).split(':') return name, password
| 6,352
|
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
|
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( self._auth.split()[-1]).split(':') return name, password
| 6,353
|
def _createResponse(self): """Create a specific XML-RPC response object.""" return FTPResponse()
|
def _createResponse(self): """Create a specific FTP response object.""" return FTPResponse()
| 6,354
|
def _updateContentLength(self): blen = str(len(self._body)) if blen.endswith('L'): blen = blen[:-1] self.setHeader('content-length', blen)
|
def _updateContentLength(self, data=None): if data is None: blen = str(len(self._body)) else: blen = str(len(data)) if blen.endswith('L'): blen = blen[:-1] self.setHeader('content-length', blen)
| 6,355
|
def write(self, string): """See IApplicationResponse
|
def write(self, string): """See IApplicationResponse
| 6,356
|
def output(self, data): """Output the data to the world. There are a couple of steps we have to do:
|
def if self.getHeader('content-type', '').startswith('text'): data = self._encode(data) self._updateContentLength(data) output(self, if self.getHeader('content-type', '').startswith('text'): data = self._encode(data) self._updateContentLength(data) data): if self.getHeader('content-type', '').startswith('text'): data = self._encode(data) self._updateContentLength(data) """Output if self.getHeader('content-type', '').startswith('text'): data = self._encode(data) self._updateContentLength(data) the if self.getHeader('content-type', '').startswith('text'): data = self._encode(data) self._updateContentLength(data) data if self.getHeader('content-type', '').startswith('text'): data = self._encode(data) self._updateContentLength(data) to if self.getHeader('content-type', '').startswith('text'): data = self._encode(data) self._updateContentLength(data) the if self.getHeader('content-type', '').startswith('text'): data = self._encode(data) self._updateContentLength(data) world. if self.getHeader('content-type', '').startswith('text'): data = self._encode(data) self._updateContentLength(data) There if self.getHeader('content-type', '').startswith('text'): data = self._encode(data) self._updateContentLength(data) are if self.getHeader('content-type', '').startswith('text'): data = self._encode(data) self._updateContentLength(data) a if self.getHeader('content-type', '').startswith('text'): data = self._encode(data) self._updateContentLength(data) couple if self.getHeader('content-type', '').startswith('text'): data = self._encode(data) self._updateContentLength(data) of if self.getHeader('content-type', '').startswith('text'): data = self._encode(data) self._updateContentLength(data) steps if self.getHeader('content-type', '').startswith('text'): data = self._encode(data) self._updateContentLength(data) we if self.getHeader('content-type', '').startswith('text'): data = self._encode(data) self._updateContentLength(data) have if self.getHeader('content-type', '').startswith('text'): data = self._encode(data) self._updateContentLength(data) to if self.getHeader('content-type', '').startswith('text'): data = self._encode(data) self._updateContentLength(data) do:
| 6,357
|
def output(self, data): """Output the data to the world. There are a couple of steps we have to do:
|
def output(self, data): """Output the data to the world. There are a couple of steps we have to do:
| 6,358
|
def setUp(self): self.pres = Presentation()
|
def setUp(self): self.pres = Presentation()
| 6,359
|
def __init__(self, aFieldStorage):
|
def __init__(self, aFieldStorage):
| 6,360
|
def getDefaultTraversal(request, ob): """Get the default published object for the request
|
def getDefaultTraversal(request, ob): """Get the default published object for the request
| 6,361
|
def processInputs(self): 'See IPublisherRequest'
|
def processInputs(self): 'See IPublisherRequest'
| 6,362
|
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)
|
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.id.language, lang) eq(locale.id.country, country) eq(locale.id.variant, 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)
| 6,363
|
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)
|
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.id.language, None) eq(locale.id.country, None) eq(locale.id.variant, None)
| 6,364
|
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")
|
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 self._setupPath_helper("PATH_INFO")
| 6,365
|
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)
|
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)
| 6,366
|
def IPublisher(Interface): def publish(request): """Publish a request The request must be an IPublisherRequest. """
|
class IPublisher(Interface): def publish(request): """Publish a request The request must be an IPublisherRequest. """
| 6,367
|
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())
|
def _getResultFromResponse(self, body, charset=None, headers=None): response, stream = self._createResponse() if charset is not None: response.setCharset(charset) 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())
| 6,368
|
def processInputs(): """Do any input processing that needs to bve done before traversing
|
def processInputs(): """Do any input processing that needs to bve done before traversing
| 6,369
|
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
|
def traverseName(self, request, ob, name, check_auth=1): if name.startswith('_'): raise Unauthorized, 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
| 6,370
|
def getOriginalException(): 'Returns the original exception object.'
|
def getOriginalException(): 'Returns the original exception object.'
| 6,371
|
def __str__(self): return repr(self.orig_exc)
|
def __str__(self): return repr(self.orig_exc)
| 6,372
|
def __call__(obj, request, exc_info): '''Effect persistent side-effects.
|
def __call__(obj, request, exc_info): '''Effect persistent side-effects.
| 6,373
|
def __call__(obj, request, exc_info): '''Effect persistent side-effects.
|
def __call__(obj, request, exc_info): '''Effect persistent side-effects.
| 6,374
|
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
|
def getobsc(snum,stime,observables,zerotime=0.0): fullinittime = time() inittime = int(fullinittime) 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
| 6,375
|
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
|
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 = time() - fullinittime 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
| 6,376
|
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
|
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 = snum/currenttime print "\r...completed in %d s [%d (multi)samples/s]. " % (int(currenttime),int(vel)) else: print "\r...completed. " return array
| 6,377
|
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
|
def dotime(i,snum,inittime,lasttime): currenttime = int(time()) - inittime if currenttime - lasttime > 2 and i > 0: 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
| 6,378
|
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
|
def spect(series,sampling,patches=1,detrend=0,overlap=1): 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
| 6,379
|
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
|
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: if overlap==0: period = nopwpdg(series,patches,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
| 6,380
|
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
|
def wpdg(series,detrend=0): samples = shape(series)[0] pdlen = (samples-1)/2.0 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
| 6,381
|
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
|
def 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 opwpdg(series,patches,detrend=0): 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 samples 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 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 shape(series)[0] 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 serlen 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 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 samples 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 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 (samples 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 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 (4*patches)) 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 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 patlen 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 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 serlen/patches 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 pdlen 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 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 patlen/2 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 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 opwpdgram 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 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 zeros(pdlen+1,typecode='d') 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 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 for 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 cnt 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 in 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 range(0,2*patches-1): 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 opwpdgram[:] 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 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 wpdg(series[cnt*pdlen:(cnt+2)*pdlen],detrend) 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 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 opwpdgram[:] 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 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 (2.0*patches 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 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 1.0) 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 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 return 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 opwpdgram 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
| 6,382
|
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
|
def getobs(snum,stime,observables,zerotime=0.0): 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
| 6,383
|
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
|
def getobs(snum,stime,observables): if len(shape(observables)) == 0: array = zeros(snum,typecode='d') for i in arange(0,snum): array[i] = observables(zerotime+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
| 6,384
|
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
|
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](zerotime+i*stime) return array
| 6,385
|
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
|
def getobsc(snum,stime,observables,zerotime=0.0): 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
| 6,386
|
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
|
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(zerotime+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
| 6,387
|
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
|
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](zerotime+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
| 6,388
|
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
|
def getobs(snum,stime,observables,zerotime=0.0): 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) 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
| 6,389
|
def stdLISApositions(): """Returns four Numeric arrays corresponding to times [in seconds] along
|
def stdLISApositions(): """Returns four Numeric arrays corresponding to times [in seconds] along
| 6,390
|
def stdSampledLISA(interp=1):
|
def stdSampledLISA(interp=1):
| 6,391
|
def stdSampledLISA(interp=1):
|
def stdSampledLISA(interp=1):
| 6,392
|
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]
|
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]
| 6,393
|
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]
|
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]
| 6,394
|
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]
|
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]
| 6,395
|
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]
|
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]
| 6,396
|
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]
|
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]
| 6,397
|
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]
|
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]
| 6,398
|
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]
|
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]
| 6,399
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.