bugged
stringlengths
4
228k
fixed
stringlengths
0
96.3M
__index_level_0__
int64
0
481k
def MakeTestSuite(): # This is apparently needed on some systems to make sure that the tests # work even if a previous version is already installed. if 'google' in sys.modules: del sys.modules['google'] generate_proto("../src/google/protobuf/unittest.proto") generate_proto("../src/google/protobuf/unittest_custom_optio...
def MakeTestSuite(): # This is apparently needed on some systems to make sure that the tests # work even if a previous version is already installed. if 'google' in sys.modules: del sys.modules['google'] generate_proto("../src/google/protobuf/unittest.proto") generate_proto("../src/google/protobuf/unittest_custom_optio...
477,600
def _MergeField(tokenizer, message): """Merges a single protocol message field into a message. Args: tokenizer: A tokenizer to parse the field name and values. message: A protocol message to record the data. Raises: ParseError: In case of ASCII parsing problems. """ message_descriptor = message.DESCRIPTOR if tokenize...
def _MergeField(tokenizer, message): """Merges a single protocol message field into a message. Args: tokenizer: A tokenizer to parse the field name and values. message: A protocol message to record the data. Raises: ParseError: In case of ASCII parsing problems. """ message_descriptor = message.DESCRIPTOR if tokenize...
477,601
def __init__(self, path): self.paths = self.Paths(path) self.name = basename(path) self.link = os.readlink(self.paths.link) if not isdir(self.link): raise Error("stock link to non-directory `%s'" % stock.link)
def __init__(self, path): self.paths = self.Paths(path) self.name = basename(path) self.link = os.readlink(self.paths.link) if not isdir(self.link): raise Error("stock link to non-directory `%s'" % stock.link)
477,602
def _read_versions(self): source_versions = {} for dpath, dnames, fnames in os.walk(self.paths.source_versions): relative_path = make_relative(self.paths.source_versions, dpath) for fname in fnames: fpath = join(dpath, fname) versions = [ line.strip() for line in file(fpath).readlines() if line.strip() ] source_version...
def _init_read_versions(self): source_versions = {} for dpath, dnames, fnames in os.walk(self.paths.source_versions): relative_path = make_relative(self.paths.source_versions, dpath) for fname in fnames: fpath = join(dpath, fname) versions = [ line.strip() for line in file(fpath).readlines() if line.strip() ] source_ve...
477,603
def _get_workdir(self): """Return an initialized workdir path.
def _init_get_workdir(self): """Return an initialized workdir path.
477,604
def __init__(self, path, pkgcache): self.paths = StockPaths(path) self.name = basename(path) self.branch = None if "#" in self.name: self.branch = self.name.split("#")[1]
def __init__(self, path, pkgcache): self.paths = StockPaths(path) self.name = basename(path) self.branch = None if "#" in self.name: self.branch = self.name.split("#")[1]
477,605
def _sync(self): """synchronise pool with registered stocks""" for binary in self.stocks.get_binaries(): if self.pkgcache.exists(basename(binary)): continue
def _sync(self): """synchronise pool with registered stocks""" for binary in self.stocks.get_binaries(): if self.pkgcache.exists(basename(binary)): continue
477,606
def exists(self, package): """Check if package exists in pool -> Returns bool""" if self.pkgcache.exists(package): return True
def exists(self, package): """Check if package exists in pool -> Returns bool""" if self.pkgcache.exists(package): return True
477,607
def _register(self, filename): name, version = self._parse_filename(filename) self.filenames[(name, version)] = filename self.packagelist.add(name)
def _register(self, filename): name, version = self._parse_filename(filename) self.filenames[(name, version)] = filename self.packagelist.add(name)
477,608
def _unregister(self, name, version): del self.filenames[(name, version)] self.packagelist.remove(name)
def _unregister(self, name, version): del self.filenames[(name, version)] self.namerefs[name] -= 1 if not self.namerefs[name]: del self.namerefs[name]
477,609
def __init__(self, path): self.path = path
def __init__(self, path): self.path = path
477,610
def exists(self, name, version=None): """Returns True if package exists in cache.
def exists(self, name, version=None): """Returns True if package exists in cache.
477,611
def list(self, all_versions=False): """List packages in pool -> list of (name, version) tuples.
def list(self, all_versions=False): """List packages in pool -> list of (name, version) tuples.
477,612
def get_binaries(self): """Recursively scan stocks for binaries -> list of filename"""
def get_binaries(self): """Recursively scan stocks for binaries -> list of filename"""
477,613
def getnum(self): str = self.str i = 0 for c in str: if c not in '0123456789': break i += 1
def def _lexcmp(a, b): i = 0 while True: if len(a) == len(b): if i == len(a): return 0 else: if i == len(a): return -1 if i == len(b): return 1 if a[i].isalpha(): if not b[i].isalpha(): return -1 if b[i].isalpha(): if not a[i].isalpha(): return 1 val = cmp(a[i], b[i]) if val != 0: return val i += 1 getnum(self): ...
477,614
def _compare(s1, s2): if s1 == s2: return 0 p1 = VersionParser(s1) p2 = VersionParser(s2) while True: l1 = p1.getlex() l2 = p2.getlex() val = cmp(l1, l2) if val != 0: return val n1 = p1.getnum() n2 = p2.getnum() val = cmp(n1, n2) if val != 0: return val if p1.str == p2.str: return 0
def _compare(s1, s2): if s1 == s2: return 0 p1 = VersionParser(s1) p2 = VersionParser(s2) while True: l1 = p1.getlex() l2 = p2.getlex() val = _lexcmp(l1, l2) if val != 0: return val n1 = p1.getnum() n2 = p2.getnum() val = cmp(n1, n2) if val != 0: return val if p1.str == p2.str: return 0
477,615
def _compare_flat(s1, s2): if s1 == s2: return 0 while True: # parse lexical components i = 0 for c in s1: if c in '0123456789': break i += 1 if i: l1 = s1[:i] s1 = s1[i:] else: l1 = '' i = 0 for c in s2: if c in '0123456789': break i += 1 if i: l2 = s2[:i] s2 = s2[i:] else: l2 = '' val = cmp(l1, l2) if val != 0: ...
def _compare_flat(s1, s2): if s1 == s2: return 0 while True: # parse lexical components i = 0 for c in s1: if c in '0123456789': break i += 1 if i: l1 = s1[:i] s1 = s1[i:] else: l1 = '' i = 0 for c in s2: if c in '0123456789': break i += 1 if i: l2 = s2[:i] s2 = s2[i:] else: l2 = '' val = _lexcmp(l1, l2) if val !=...
477,616
def __init__(self, path, recursed_paths=[]): StockBase.__init__(self, path) if self.link in recursed_paths: raise CircularDependency("circular dependency detected `%s' is in recursed paths %s" % (self.link, recursed_paths))
def __init__(self, path, recursed_paths=[]): StockBase.__init__(self, path) if self.link in recursed_paths: raise CircularDependency("circular dependency detected `%s' is in recursed paths %s" % (self.link, recursed_paths))
477,617
def init_create(cls, path, bare=False, verbose=False): if not lexists(path): os.mkdir(path)
def init_create(cls, path, bare=False, verbose=False): if not lexists(path): os.mkdir(path)
477,618
def _parse_stock(stock): try: dir, branch = stock.split("#", 1) except ValueError: dir = stock branch = None
def _parse_stock(stock): try: dir, branch = stock.split("#", 1) except ValueError: dir = stock branch = None
477,619
def unregister(self, stock): dir, branch = self._parse_stock(stock) stock_name = basename(dir) if branch: stock_name += "#" + branch if not self.stocks.has_key(stock_name) or \ self.stocks[stock_name].link != realpath(dir): raise Error("no matches for unregister")
def unregister(self, stock): dir, branch = self._parse_stock(stock) stock_name = basename(dir) if branch: stock_name += "#" + branch matches = [ stock for stock in self.stocks.values() if stock.link == dir and (not branch or stock.branch == branch) ] if not matches: raise Error("no matches for unregister")
477,620
def unregister(self, stock): dir, branch = self._parse_stock(stock) stock_name = basename(dir) if branch: stock_name += "#" + branch if not self.stocks.has_key(stock_name) or \ self.stocks[stock_name].link != realpath(dir): raise Error("no matches for unregister")
def unregister(self, stock): dir, branch = self._parse_stock(stock) stock_name = basename(dir) if branch: stock_name += "#" + branch if not self.stocks.has_key(stock_name) or \ self.stocks[stock_name].link != realpath(dir): raise Error("no matches for unregister")
477,621
def getpath_cached(p, package): """get path of cached package, whether in the pool or in a subpool""" path = p.pkgcache.getpath(package) if path: return path for subpool in p.subpools: path = getpath_cached(subpool, package) if path: return path return None
def pkgcache_list_versions(pool, name): versions = [ pkgcache_version for pkgcache_name, pkgcache_version in pool.pkgcache.list() if pkgcache_name == name ] for subpool in pool.subpools: versions += pkgcache_list_versions(subpool, name) return versions def pkgcache_getpath_newest(pool, name): versions = pkgcache_lis...
477,622
def getpath_cached(p, package): """get path of cached package, whether in the pool or in a subpool""" path = p.pkgcache.getpath(package) if path: return path for subpool in p.subpools: path = getpath_cached(subpool, package) if path: return path return None
def getpath_cached(p, package): """get path of cached package, whether in the pool or in a subpool""" path = p.pkgcache.getpath(package) if path: return path source_package = binary2source(pool, package) if source_package: path = pool.getpath_build_log(source_package) return None
477,623
def getpath_cached(p, package): """get path of cached package, whether in the pool or in a subpool""" path = p.pkgcache.getpath(package) if path: return path for subpool in p.subpools: path = getpath_cached(subpool, package) if path: return path return None
def getpath_cached(p, package): """get path of cached package, whether in the pool or in a subpool""" path = p.pkgcache.getpath(package) if path: return path for subpool in p.subpools: path = getpath_cached(subpool, package) if path: return path return None
477,624
def main(): args = sys.argv[1:] if not args: usage() package = args[0] try: p = pool.Pool() except pool.Error, e: fatal(e) source_package = package deb = getpath_cached(p, package) if deb: source_name = extract_source_name(deb) if source_name: source_package = source_name if '=' in package: source_package += "=" + p...
def main(): args = sys.argv[1:] if not args: usage() package = args[0] path = getpath_build_log(package) source_package = package deb = getpath_cached(p, package) if deb: source_name = extract_source_name(deb) if source_name: source_package = source_name if '=' in package: source_package += "=" + package.split("=", 1...
477,625
def main(): args = sys.argv[1:] if not args: usage() package = args[0] try: p = pool.Pool() except pool.Error, e: fatal(e) source_package = package deb = getpath_cached(p, package) if deb: source_name = extract_source_name(deb) if source_name: source_package = source_name if '=' in package: source_package += "=" + p...
def main(): args = sys.argv[1:] if not args: usage() package = args[0] try: p = pool.Pool() except pool.Error, e: fatal(e) for line in file(path).readlines(): print line,
477,626
def _compare(s1, s2): if s1 == s2: return 0 p1 = VersionParser(s1) p2 = VersionParser(s2) while True: l1 = p1.getlex() l2 = p2.getlex() val = cmp(l1, l2) if val != 0: return val n1 = p1.getnum() n2 = p2.getnum() val = cmp(n1, n2) if val != 0: return val
def _compare(s1, s2): if s1 == s2: return 0 p1 = VersionParser(s1) p2 = VersionParser(s2) while True: l1 = p1.getlex() l2 = p2.getlex() val = cmp(l1, l2) if val != 0: return val
477,627
def parse(v): if ':' in v: epoch, v = v.split(':', 1) else: epoch = 0 if '-' in v: upstream_version, debian_revision = v.rsplit('-', 1) else: upstream_version = v debian_revision = '' return epoch, upstream_version, debian_revision
def parse(v): if ':' in v: epoch, v = v.split(':', 1) else: epoch = '' if '-' in v: upstream_version, debian_revision = v.rsplit('-', 1) else: upstream_version = v debian_revision = '' return epoch, upstream_version, debian_revision
477,628
def parse(v): if ':' in v: epoch, v = v.split(':', 1) else: epoch = 0 if '-' in v: upstream_version, debian_revision = v.rsplit('-', 1) else: upstream_version = v debian_revision = '' return epoch, upstream_version, debian_revision
def class VersionParser: def __init__(self, str): self.str = str def getlex(self): lex = re.match(r'(\D*)', self.str).group(1) self.str = self.str[len(lex):] return lex def getnum(self): num = re.match(r'(\d*)', self.str).group(1) self.str = self.str[len(num):] if num: return int(num) return 0 def _compare(s1, s2...
477,629
def parse(v): if ':' in v: epoch, v = v.split(':', 1) else: epoch = '' if '-' in v: upstream_version, debian_revision = v.rsplit('-', 1) else: upstream_version = v debian_revision = '' return epoch, upstream_version, debian_revision
def parse(v): if ':' in v: epoch, v = v.split(':', 1) else: epoch = '0' if '-' in v: upstream_version, debian_revision = v.rsplit('-', 1) else: upstream_version = v debian_revision = '' return epoch, upstream_version, debian_revision
477,630
def parse(v): if ':' in v: epoch, v = v.split(':', 1) else: epoch = '' if '-' in v: upstream_version, debian_revision = v.rsplit('-', 1) else: upstream_version = v debian_revision = '' return epoch, upstream_version, debian_revision
def parse(v): if ':' in v: epoch, v = v.split(':', 1) else: epoch = '' if '-' in v: upstream_version, debian_revision = v.rsplit('-', 1) else: upstream_version = v debian_revision = '0' return epoch, upstream_version, debian_revision
477,631
def compare(a, b): """Compare a with b according to Debian versioning criteria""" a = parse(normalize(a)) b = parse(normalize(b)) for i in (0, 1, 2): val = _compare(a[i], b[i]) if val != 0: return val return 0
def compare(a, b): """Compare a with b according to Debian versioning criteria""" a = parse(a) b = parse(b) for i in (0, 1, 2): val = _compare(a[i], b[i]) if val != 0: return val return 0
477,632
def compare(a, b): """Compare a with b according to Debian versioning criteria""" a = parse(normalize(a)) b = parse(normalize(b)) for i in (0, 1, 2): val = _compare(a[i], b[i]) if val != 0: return val return 0
def compare(a, b): """Compare a with b according to Debian versioning criteria""" a = parse(normalize(a)) b = parse(normalize(b)) for i in (0, 1, 2): val = _compare_flat(a[i], b[i]) if val != 0: return val return 0
477,633
def test(): import time howmany = 1000 start = time.time() for i in xrange(howmany): compare("0-2010.10.1-d6cbb928", "0-2010.10.10-a9ee521c") end = time.time() elapsed = end - start print "%d runs in %.4f seconds (%.2f per/sec)" % (howmany, elapsed, howmany / elapsed)
def test(): import time howmany = 10000 start = time.time() for i in xrange(howmany): compare("0-2010.10.1-d6cbb928", "0-2010.10.10-a9ee521c") end = time.time() elapsed = end - start print "%d runs in %.4f seconds (%.2f per/sec)" % (howmany, elapsed, howmany / elapsed)
477,634
def resolve(self, unresolved): """Resolve a list of unresolved packages. If unresolved is a single unresolved package, return a single resolved package. If unresolved is a tuple or list of unresolved packages, return a list of resolved packages"""
def resolve(self, unresolved): """Resolve a list of unresolved packages. If unresolved is a single unresolved package, return a single resolved package. If unresolved is a tuple or list of unresolved packages, return a list of resolved packages"""
477,635
def _compare(s1, s2): if s1 == s2: return 0 p1 = VersionParser(s1) p2 = VersionParser(s2) while True: n1 = p1.getnum() n2 = p2.getnum() val = cmp(n1, n2) if val != 0: return val l1 = p1.getlex() l2 = p2.getlex() val = cmp(l1, l2) if val != 0: return val if p1.str == p2.str: return 0
def _compare(s1, s2): if s1 == s2: return 0 p1 = VersionParser(s1) p2 = VersionParser(s2) while True: n1 = p1.getnum() n2 = p2.getnum() val = cmp(n1, n2) if val != 0: return val if p1.str == p2.str: return 0
477,636
def _compare_flat(s1, s2): if s1 == s2: return 0 while True: # parse numeric component for comparison i = 0 for c in s1: if c not in '0123456789': break i += 1 if i: n1 = int(s1[:i]) s1 = s1[i:] else: n1 = 0 i = 0 for c in s2: if c not in '0123456789': break i += 1 if i: n2 = int(s2[:i]) s2 = s2[i:] else: n2 = 0 ...
def i = 0 for c in s1: if c in '0123456789': break i += 1 if i: l1 = s1[:i] s1 = s1[i:] else: l1 = '' i = 0 for c in s2: if c in '0123456789': break i += 1 if i: l2 = s2[:i] s2 = s2[i:] else: l2 = '' val = cmp(l1, l2) if val != 0: return val _compare_flat(s1, i = 0 for c in s1: if c in '0123456789': break i += 1 ...
477,637
def _compare_flat(s1, s2): if s1 == s2: return 0 while True: # parse numeric component for comparison i = 0 for c in s1: if c not in '0123456789': break i += 1 if i: n1 = int(s1[:i]) s1 = s1[i:] else: n1 = 0 i = 0 for c in s2: if c not in '0123456789': break i += 1 if i: n2 = int(s2[:i]) s2 = s2[i:] else: n2 = 0 ...
def _compare_flat(s1, s2): if s1 == s2: return 0 while True: # parse numeric component for comparison i = 0 for c in s1: if c not in '0123456789': break i += 1 if i: n1 = int(s1[:i]) s1 = s1[i:] else: n1 = 0 i = 0 for c in s2: if c not in '0123456789': break i += 1 if i: n2 = int(s2[:i]) s2 = s2[i:] else: n2 = 0 ...
477,638
def main(): try: opts, args = getopt.getopt(sys.argv[1:], 'i:sqt', ['input=', 'strict', 'quiet', 'tree']) except getopt.GetoptError, e: usage(e) if not args: usage() outputdir = args[0] packages = args[1:] input = None opt_strict = False opt_quiet = False opt_tree = False for opt, val in opts: if opt in ('-i', '--i...
def main(): try: opts, args = getopt.getopt(sys.argv[1:], 'i:sqt', ['input=', 'strict', 'quiet', 'tree']) except getopt.GetoptError, e: usage(e) if not args: usage() outputdir = args[0] packages = args[1:] input = None opt_strict = False opt_quiet = False opt_tree = False for opt, val in opts: if opt in ('-i', '--i...
477,639
def main(): try: opts, args = getopt.getopt(sys.argv[1:], 'an', ['all-versions', 'name-only']) except getopt.GetoptError, e: usage(e) opt_all_versions = False opt_name_only = False for opt, val in opts: if opt in ('-a', '--all-versions'): opt_all_versions = True elif opt in ('-n', '--name-only'): opt_name_only = True...
def main(): try: opts, args = getopt.getopt(sys.argv[1:], 'an', ['all-versions', 'name-only']) except getopt.GetoptError, e: usage(e) opt_all_versions = False opt_name_only = False for opt, val in opts: if opt in ('-a', '--all-versions'): opt_all_versions = True elif opt in ('-n', '--name-only'): opt_name_only = True...
477,640
def create(cls, path, link): mkdir(path) paths = self.Paths(path) os.symlink(realpath(link), paths.link)
def create(cls, path, link): mkdir(path) paths = cls.Paths(path) os.symlink(realpath(link), paths.link)
477,641
def _sync_update_source_versions(self, dir): """update versions for a particular source package at <dir>""" packages = deb_get_packages(dir) versions = verseek.list(dir)
def _sync_update_source_versions(self, dir): """update versions for a particular source package at <dir>""" packages = deb_get_packages(dir) versions = verseek.list(dir)
477,642
def sync(self): """sync stock by updating source versions and importing binaries into the cache"""
def sync(self): """sync stock by updating source versions and importing binaries into the cache"""
477,643
def print_info(self): if len(self.stocks): print "# stocks" for stock in self.stocks: addr = stock.link if stock.branch: addr += "#" + stock.branch print addr
def print_info(self): if len(self.stocks): print "# stocks" for stock in self.stocks: addr = stock.link if stock.branch: addr += "#" + stock.branch print addr
477,644
def unregister(self, stock): dir, branch = self._parse_stock(stock) stock_name = basename(dir) if branch: stock_name += "#" + branch matches = [ stock for stock in self.stocks.values() if stock.link == dir and (not branch or stock.branch == branch) ] if not matches: raise Error("no matches for unregister")
def unregister(self, stock): dir, branch = self._parse_stock(stock) stock_name = basename(dir) if branch: stock_name += "#" + branch matches = [ stock for stock in self.stocks.values() if stock.link == dir and (not branch or stock.branch == branch) ] if not matches: raise Error("no matches for unregister")
477,645
def unregister(self, stock): dir, branch = self._parse_stock(stock) stock_name = basename(dir) if branch: stock_name += "#" + branch matches = [ stock for stock in self.stocks.values() if stock.link == dir and (not branch or stock.branch == branch) ] if not matches: raise Error("no matches for unregister")
def unregister(self, stock): dir, branch = self._parse_stock(stock) stock_name = basename(dir) if branch: stock_name += "#" + branch matches = [ stock for stock in self.stocks.values() if stock.link == dir and (not branch or stock.branch == branch) ] if not matches: raise Error("no matches for unregister")
477,646
def list(self, all_versions=False): """List packages in pool -> list of (name, version) tuples.
def list(self, all_versions=False): """List packages in pool -> list of (name, version) tuples.
477,647
def _get_workdir(self): """Return an initialized workdir path.
def _get_workdir(self): """Return an initialized workdir path.
477,648
def rev_parse(self, rev): """git-rev-parse <rev>. Returns object-id of parsed rev. Returns None on failure. """ try: return self._getoutput("git-rev-parse", rev + "^0") except self.Error: return None
def rev_parse(self, rev): """git-rev-parse <rev>. Returns object-id of parsed rev. Returns None on failure. """ try: return self._getoutput("git-rev-parse", rev) except self.Error: return None
477,649
def allow_args_openconn(desthost, destport, localip=None, localport=0, timeout=5): # TODO: the wiki:RepyLibrary gives localport=0 as the default for this function, # slightly different than the localport=None it gives for sendmess(). This # should either be verified as intentional or made the same. _require_string(des...
def allow_args_openconn(desthost, destport, localip=None, localport=0, timeout=5): # TODO: the wiki:RepyLibrary gives localport=0 as the default for this function, # slightly different than the localport=None it gives for sendmess(). This # should either be verified as intentional or made the same. _require_string(des...
477,650
def foo(): exitall()
def foo(): if mycontext['winner'] == None: mycontext['winner'] = 'timer'
477,651
def foo(): exitall()
def foo(): exitall()
477,652
def foo(): exitall()
def foo(): exitall()
477,653
def main(): """ <Purpose> Executes the main program that is the unit testing framework. Tests different modules, files, capabilities, dependent on command line arguments. <Arguments> None <Exceptions> None. <Side Effects> None <Returns> None """ ### ### Define allowed arguments. ### parser = optparse.OptionParser()...
def main(): """ <Purpose> Executes the main program that is the unit testing framework. Tests different modules, files, capabilities, dependent on command line arguments. <Arguments> None <Exceptions> None. <Side Effects> None <Returns> None """ ### ### Define allowed arguments. ### parser = optparse.OptionParser()...
477,654
def test_single(file_path): """ <Purpose> Given the test file path, this function will execute the test using the test framework. <Arguments> Test file path. <Exceptions> None. <Side Effects> None <Returns> None """ file_path = os.path.normpath(file_path) testing_monitor(file_path)
def execute_and_check_program(file_path): """ <Purpose> Given the test file path, this function will execute the program and monitor its behavior <Arguments> Test file path. <Exceptions> None. <Side Effects> None <Returns> None """ file_path = os.path.normpath(file_path) testing_monitor(file_path)
477,655
def test_module(module_name, module_file_list): """ <Purpose> Execute all test files contained within module_file_list matching the module_name in the form of each test file name 'ut_<module_name>_<descriptor>.py' <Arguments> module_name: module name to be tested module_file_list: a list of files to be filtered by mod...
def test_module(module_name, module_file_list): """ <Purpose> Execute all test files contained within module_file_list matching the module_name in the form of each test file name 'ut_<module_name>_<descriptor>.py' <Arguments> module_name: module name to be tested module_file_list: a list of files to be filtered by mod...
477,656
def test_module(module_name, module_file_list): """ <Purpose> Execute all test files contained within module_file_list matching the module_name in the form of each test file name 'ut_<module_name>_<descriptor>.py' <Arguments> module_name: module name to be tested module_file_list: a list of files to be filtered by mod...
def test_module(module_name, module_file_list): """ <Purpose> Execute all test files contained within module_file_list matching the module_name in the form of each test file name 'ut_<module_name>_<descriptor>.py' <Arguments> module_name: module name to be tested module_file_list: a list of files to be filtered by mod...
477,657
def test_module(module_name, module_file_list): """ <Purpose> Execute all test files contained within module_file_list matching the module_name in the form of each test file name 'ut_<module_name>_<descriptor>.py' <Arguments> module_name: module name to be tested module_file_list: a list of files to be filtered by mod...
def test_module(module_name, module_file_list): """ <Purpose> Execute all test files contained within module_file_list matching the module_name in the form of each test file name 'ut_<module_name>_<descriptor>.py' <Arguments> module_name: module name to be tested module_file_list: a list of files to be filtered by mod...
477,658
def _create_rss_file(resultslist): failureitems = [] for (runnumber, revision, resulttext) in resultslist: if resulttext[0].strip() != "SUCCESS": datestr = resulttext[1].strip() dateobj = datetime.datetime.strptime(datestr, "%Y-%m-%d %H:%M:%S") # The PyRSS2Gen module expects this to be in GMT, and python is a pain # f...
def _create_rss_file(resultslist): failureitems = [] for (runnumber, revision, resulttext) in resultslist: if resulttext[0].strip() != "SUCCESS": datestr = resulttext[1].strip() dateobj = datetime.datetime.strptime(datestr, "%Y-%m-%d %H:%M:%S") # The PyRSS2Gen module expects this to be in GMT, and python is a pain # f...
477,659
def main(): # initialize the gmail module success,explanation_str = send_gmail.init_gmail() if not success: integrationtestlib.log(explanation_str) sys.exit(0) notify_str = '' #add Eric Kimbrel to the email notify list integrationtestlib.notify_list.append("lekimbrel@gmail.com") integrationtestlib.log("Starting tes...
def main(): # initialize the gmail module success,explanation_str = send_gmail.init_gmail() if not success: integrationtestlib.log(explanation_str) sys.exit(0) notify_str = '' #add Eric Kimbrel to the email notify list integrationtestlib.notify_list.append("lekimbrel@gmail.com") integrationtestlib.log("Starting tes...
477,660
def main(): # initialize the gmail module success,explanation_str = send_gmail.init_gmail() if not success: integrationtestlib.log(explanation_str) sys.exit(0) notify_str = '' #add Eric Kimbrel to the email notify list integrationtestlib.notify_list.append("lekimbrel@gmail.com") integrationtestlib.log("Starting tes...
def main(): # initialize the gmail module success,explanation_str = send_gmail.init_gmail() if not success: integrationtestlib.log(explanation_str) sys.exit(0) notify_str = '' #add Eric Kimbrel to the email notify list integrationtestlib.notify_list.append("lekimbrel@gmail.com") integ...
477,661
def main(): # initialize the gmail module success,explanation_str = send_gmail.init_gmail() if not success: integrationtestlib.log(explanation_str) sys.exit(0) notify_str = '' #add Eric Kimbrel to the email notify list integrationtestlib.notify_list.append("lekimbrel@gmail.com") integrationtestlib.log("Starting tes...
def main(): # initialize the gmail module success,explanation_str = send_gmail.init_gmail() if not success: integrationtestlib.log(explanation_str) sys.exit(0) notify_str = '' #add Eric Kimbrel to the email notify list integrationtestlib.notify_list.append("lekimbrel@gmail.com") integrationtestlib.log("Starting tes...
477,662
def main(): # initialize the gmail module success,explanation_str = send_gmail.init_gmail() if not success: integrationtestlib.log(explanation_str) sys.exit(0) notify_str = '' #add Eric Kimbrel to the email notify list integrationtestlib.notify_list.append("lekimbrel@gmail.com") integrationtestlib.log("Starting tes...
def main(): # initialize the gmail module success,explanation_str = send_gmail.init_gmail() if not success: integrationtestlib.log(explanation_str) sys.exit(0) notify_str = '' #add Eric Kimbrel to the email notify list integrationtestlib.notify_list.append("lekimbrel@gmail.com") integrationtestlib.log("Starting tes...
477,663
def main(): # initialize the gmail module success,explanation_str = send_gmail.init_gmail() if not success: integrationtestlib.log(explanation_str) sys.exit(0) notify_str = '' #add Eric Kimbrel to the email notify list integrationtestlib.notify_list.append("lekimbrel@gmail.com") integrationtestlib.log("Starting tes...
def main(): # initialize the gmail module success,explanation_str = send_gmail.init_gmail() if not success: integrationtestlib.log(explanation_str) sys.exit(0) notify_str = '' #add Eric Kimbrel to the email notify list integrationtestlib.notify_list.append("lekimbrel@gmail.com") integrationtestlib.log("Starting tes...
477,664
def _generate_python_file_from_repy(repyfilename, generatedfilename, shared_mycontext, callfunc, callargs): """ Generate a python module from a repy file so it can be imported The first line is TRANSLATION_TAGLINE, so it's easy to detect that the file was automatically generated """ #Start the generation! Print out t...
def _generate_python_file_from_repy(repyfilename, generatedfilename, shared_mycontext, callfunc, callargs): """ Generate a python module from a repy file so it can be imported The first line is TRANSLATION_TAGLINE, so it's easy to detect that the file was automatically generated """ #Start the generation! Print out t...
477,665
def is_accepter_started(): acceptor_state['lock'].acquire() result = acceptor_state['started'] acceptor_state['lock'].release() return result
def is_accepter_started(): accepter_state['lock'].acquire() result = accepter_state['started'] accepter_state['lock'].release() return result
477,666
def start_accepter(): shimstack = ShimStackInterface('(NatDeciderShim)') unique_id = rsa_publickey_to_string(configuration['publickey']) unique_id = sha_hexhash(unique_id) + str(configuration['service_vessel']) # do this until we get the accepter started... while True: if is_accepter_started(): # we're done, return...
def start_accepter(): shimstack = ShimStackInterface('(NatDeciderShim)') unique_id = rsa_publickey_to_string(configuration['publickey']) unique_id = sha_hexhash(unique_id) + str(configuration['service_vessel']) # do this until we get the accepter started... while True: if not node_reset_config['reset_accepter'] and...
477,667
def start_accepter(): shimstack = ShimStackInterface('(NatDeciderShim)') unique_id = rsa_publickey_to_string(configuration['publickey']) unique_id = sha_hexhash(unique_id) + str(configuration['service_vessel']) # do this until we get the accepter started... while True: if is_accepter_started(): # we're done, return...
def start_accepter(): shimstack = ShimStackInterface('(NatDeciderShim)') unique_id = rsa_publickey_to_string(configuration['publickey']) unique_id = sha_hexhash(unique_id) + str(configuration['service_vessel']) # do this until we get the accepter started... while True: if is_accepter_started(): # we're done, return...
477,668
def start_accepter(): shimstack = ShimStackInterface('(NatDeciderShim)') unique_id = rsa_publickey_to_string(configuration['publickey']) unique_id = sha_hexhash(unique_id) + str(configuration['service_vessel']) # do this until we get the accepter started... while True: if is_accepter_started(): # we're done, return...
def start_accepter(): shimstack = ShimStackInterface('(NatDeciderShim)') unique_id = rsa_publickey_to_string(configuration['publickey']) unique_id = sha_hexhash(unique_id) + str(configuration['service_vessel']) # do this until we get the accepter started... while True: if is_accepter_started(): # we're done, return...
477,669
def main(): global configuration if not FOREGROUND: # Background ourselves. daemon.daemonize() # ensure that only one instance is running at a time... gotlock = runonce.getprocesslock("seattlenodemanager") if gotlock == True: # I got the lock. All is well... pass else: if gotlock: servicelogger.log("[ERROR]:Anothe...
defmain():globalconfigurationifnotFOREGROUND:#Backgroundourselves.daemon.daemonize()#ensurethatonlyoneinstanceisrunningatatime...gotlock=runonce.getprocesslock("seattlenodemanager")ifgotlock==True:#Igotthelock.Alliswell...passelse:ifgotlock:servicelogger.log("[ERROR]:Anothernodemanagerprocess(pid:"+str(gotlock)+")isrun...
477,670
def main(): global configuration if not FOREGROUND: # Background ourselves. daemon.daemonize() # ensure that only one instance is running at a time... gotlock = runonce.getprocesslock("seattlenodemanager") if gotlock == True: # I got the lock. All is well... pass else: if gotlock: servicelogger.log("[ERROR]:Anothe...
def main(): global configuration if not FOREGROUND: # Background ourselves. daemon.daemonize() # ensure that only one instance is running at a time... gotlock = runonce.getprocesslock("seattlenodemanager") if gotlock == True: # I got the lock. All is well... pass else: if gotlock: servicelogger.log("[ERROR]:Anothe...
477,671
def check_and_exit(): if mycontext['maxlag'] > 4: print "UDP packets lag too long in the buffer: ", mycontext['maxlag'] if mycontext['maxlag'] == 0: print "UDP packets were not received or had 0 lag" exitall()
def check_and_exit(): if mycontext['maxlag'] > 2: print "UDP packets lag too long in the buffer: ", mycontext['maxlag'] if mycontext['maxlag'] == 0: print "UDP packets were not received or had 0 lag" exitall()
477,672
def sendforever(sockobj): while True: # send a message that is around 100 bytes sockobj.send("%9f "%getruntime())
def sendforever(sockobj): while True: # send a message that is around 100 bytes sockobj.send("%9f "%getruntime() + " "*90)
477,673
def handleconnection(ip, port, connobj, ch, mainch): while True: sendtime = float(connobj.recv(10).split()[0]) lag = getruntime() - sendtime if mycontext['maxlag'] < lag: mycontext['maxlag'] = lag
def handleconnection(ip, port, connobj, ch, mainch): while True: sendtime = float(connobj.recv(100).strip().split()[0]) lag = getruntime() - sendtime if mycontext['maxlag'] < lag: mycontext['maxlag'] = lag
477,674
def check_and_exit(): if mycontext['maxlag'] > 4: print "TCP packets lag too long in the buffer: ", mycontext['maxlag'] if mycontext['maxlag'] == 0: print "TCP packets were not received or had 0 lag" exitall()
def check_and_exit(): if mycontext['maxlag'] > 2: print "TCP packets lag too long in the buffer: ", mycontext['maxlag'] if mycontext['maxlag'] == 0: print "TCP packets were not received or had 0 lag" exitall()
477,675
def main(): repytest = False RANDOMPORTS = False target_dir = None for arg in sys.argv[1:]: # -t means we will copy repy tests if arg == '-t': repytest = True # The user wants us to fill in the port numbers randomly. elif arg == '-randomports': RANDOMPORTS = True # Not a flag? Assume it's the target directory else: ...
def main(): repytest = False RANDOMPORTS = False target_dir = None for arg in sys.argv[1:]: # -t means we will copy repy tests if arg == '-t': repytest = True # The user wants us to fill in the port numbers randomly. elif arg == '-randomports': RANDOMPORTS = True # Not a flag? Assume it's the target directory else: ...
477,676
def start_vessel(vesselhandle, identity, program_file, arg_list=[]): """ <Purpose> Start a program running on a vessel. <Arguments> vesselhandle The vesselhandle of the vessel that is to be started. identity The identity of either the owner or a user of the vessel. program_file The name of the file that already exists ...
def start_vessel(vesselhandle, identity, program_file, arg_list=None): """ <Purpose> Start a program running on a vessel. <Arguments> vesselhandle The vesselhandle of the vessel that is to be started. identity The identity of either the owner or a user of the vessel. program_file The name of the file that already exist...
477,677
def start_vessel(vesselhandle, identity, program_file, arg_list=[]): """ <Purpose> Start a program running on a vessel. <Arguments> vesselhandle The vesselhandle of the vessel that is to be started. identity The identity of either the owner or a user of the vessel. program_file The name of the file that already exists ...
def start_vessel(vesselhandle, identity, program_file, arg_list=[]): """ <Purpose> Start a program running on a vessel. <Arguments> vesselhandle The vesselhandle of the vessel that is to be started. identity The identity of either the owner or a user of the vessel. program_file The name of the file that already exists ...
477,678
def command_loop(): # Things that may be set herein and used in later commands. # Contains the local variables of the original command loop. # Keeps track of the user's state in seash. Referenced # during command executions by the command_parser. environment_dict = { 'host': None, 'port': None, 'expnum': None, 'filena...
def command_loop(): # Things that may be set herein and used in later commands. # Contains the local variables of the original command loop. # Keeps track of the user's state in seash. Referenced # during command executions by the command_parser. environment_dict = { 'host': None, 'port': None, 'expnum': None, 'filena...
477,679
def test_module(module_name, module_file_list): """ <Purpose> Execute all test files contained within module_file_list matching the module_name in the form of each test file name 'ut_<module_name>_<descriptor>.py' <Arguments> module_name: module name to be tested module_file_list: a list of files to be filtered by mod...
def test_module(module_name, module_file_list): """ <Purpose> Execute all test files contained within module_file_list matching the module_name in the form of each test file name 'ut_<module_name>_<descriptor>.py' <Arguments> module_name: module name to be tested module_file_list: a list of files to be filtered by mod...
477,680
def test_module(module_name, module_file_list): """ <Purpose> Execute all test files contained within module_file_list matching the module_name in the form of each test file name 'ut_<module_name>_<descriptor>.py' <Arguments> module_name: module name to be tested module_file_list: a list of files to be filtered by mod...
def test_module(module_name, module_file_list): """ <Purpose> Execute all test files contained within module_file_list matching the module_name in the form of each test file name 'ut_<module_name>_<descriptor>.py' <Arguments> module_name: module name to be tested module_file_list: a list of files to be filtered by mod...
477,681
def set_keys(vessel, identity): """ The first argument will be a vesseldict rather than a vesselhandle because we passed the result of get_vessels_on_nodes to run_parallelized. """ if vessel['vesselname'] != VESSELNAME_TO_SET_USER_KEYS_ON: msg = "[" + vessel['location'] + "] Skipping: vesselname is not: " + VESSELNAME...
def set_keys(vessel, identity): """ The first argument will be a vesseldict rather than a vesselhandle because we passed the result of get_vessels_on_nodes to run_parallelized. """ if vessel['vesselname'] != VESSELNAME_TO_SET_USER_KEYS_ON: msg = "[" + vessel['nodelocation'] + "] Skipping: vesselname is not: " + VESSEL...
477,682
def set_keys(vessel, identity): """ The first argument will be a vesseldict rather than a vesselhandle because we passed the result of get_vessels_on_nodes to run_parallelized. """ if vessel['vesselname'] != VESSELNAME_TO_SET_USER_KEYS_ON: msg = "[" + vessel['location'] + "] Skipping: vesselname is not: " + VESSELNAME...
def set_keys(vessel, identity): """ The first argument will be a vesseldict rather than a vesselhandle because we passed the result of get_vessels_on_nodes to run_parallelized. """ if vessel['vesselname'] != VESSELNAME_TO_SET_USER_KEYS_ON: msg = "[" + vessel['location'] + "] Skipping: vesselname is not: " + VESSELNAME...
477,683
def set_keys(vessel, identity): """ The first argument will be a vesseldict rather than a vesselhandle because we passed the result of get_vessels_on_nodes to run_parallelized. """ if vessel['vesselname'] != VESSELNAME_TO_SET_USER_KEYS_ON: msg = "[" + vessel['location'] + "] Skipping: vesselname is not: " + VESSELNAME...
def set_keys(vessel, identity): """ The first argument will be a vesseldict rather than a vesselhandle because we passed the result of get_vessels_on_nodes to run_parallelized. """ if vessel['vesselname'] != VESSELNAME_TO_SET_USER_KEYS_ON: msg = "[" + vessel['location'] + "] Skipping: vesselname is not: " + VESSELNAME...
477,684
def set_keys(vessel, identity): """ The first argument will be a vesseldict rather than a vesselhandle because we passed the result of get_vessels_on_nodes to run_parallelized. """ if vessel['vesselname'] != VESSELNAME_TO_SET_USER_KEYS_ON: msg = "[" + vessel['location'] + "] Skipping: vesselname is not: " + VESSELNAME...
def set_keys(vessel, identity): """ The first argument will be a vesseldict rather than a vesselhandle because we passed the result of get_vessels_on_nodes to run_parallelized. """ if vessel['vesselname'] != VESSELNAME_TO_SET_USER_KEYS_ON: msg = "[" + vessel['location'] + "] Skipping: vesselname is not: " + VESSELNAME...
477,685
def set_keys(vessel, identity): """ The first argument will be a vesseldict rather than a vesselhandle because we passed the result of get_vessels_on_nodes to run_parallelized. """ if vessel['vesselname'] != VESSELNAME_TO_SET_USER_KEYS_ON: msg = "[" + vessel['location'] + "] Skipping: vesselname is not: " + VESSELNAME...
def set_keys(vessel, identity): """ The first argument will be a vesseldict rather than a vesselhandle because we passed the result of get_vessels_on_nodes to run_parallelized. """ if vessel['vesselname'] != VESSELNAME_TO_SET_USER_KEYS_ON: msg = "[" + vessel['location'] + "] Skipping: vesselname is not: " + VESSELNAME...
477,686
def set_keys(vessel, identity): """ The first argument will be a vesseldict rather than a vesselhandle because we passed the result of get_vessels_on_nodes to run_parallelized. """ if vessel['vesselname'] != VESSELNAME_TO_SET_USER_KEYS_ON: msg = "[" + vessel['location'] + "] Skipping: vesselname is not: " + VESSELNAME...
def set_keys(vessel, identity): """ The first argument will be a vesseldict rather than a vesselhandle because we passed the result of get_vessels_on_nodes to run_parallelized. """ if vessel['vesselname'] != VESSELNAME_TO_SET_USER_KEYS_ON: msg = "[" + vessel['location'] + "] Skipping: vesselname is not: " + VESSELNAME...
477,687
def _translation_is_needed(repyfilename, generatedfile): """ Checks if generatedfile needs to be regenerated. Does several checks to decide if generating generatedfilename based on repyfilename is a good idea. --does file already exist? --was it automatically generated? --was it generated from the same source file? --w...
def _translation_is_needed(repyfilename, generatedfile): """ Checks if generatedfile needs to be regenerated. Does several checks to decide if generating generatedfilename based on repyfilename is a good idea. --does file already exist? --was it automatically generated? --was it generated from the same source file? --w...
477,688
def start_event(entry, handle,eventhandle): if entry['type'] == 'UDP': # some sort of socket error, I'll assume they closed the socket or it's # not important try: # NOTE: is 4096 a reasonable maximum datagram size? data, addr = entry['socket'].recvfrom(4096) except socket.error: # they closed in the meantime? nanny.ta...
def start_event(entry, handle,eventhandle): if entry['type'] == 'UDP': # some sort of socket error, I'll assume they closed the socket or it's # not important try: # NOTE: is 4096 a reasonable maximum datagram size? data, addr = entry['socket'].recvfrom(65535) except socket.error: # they closed in the meantime? nanny.t...
477,689
def _translation_is_needed(repyfilename, generatedfile): """ Checks if generatedfile needs to be regenerated. Does several checks to decide if generating generatedfilename based on repyfilename is a good idea. --does file already exist? --was it automatically generated? --was it generated from the same source file? --w...
def _translation_is_needed(repyfilename, generatedfile): """ Checks if generatedfile needs to be regenerated. Does several checks to decide if generating generatedfilename based on repyfilename is a good idea. --does file already exist? --was it automatically generated? --was it generated from the same source file? --w...
477,690
def commit_time(thread_dict, TOC): resource = thread_dict["resource"] thread_dict[resource] += TOC - thread_dict["begin"] thread_dict["begin"] = TOC
def commit_time(thread_dict, TOC): resource = thread_dict["resource"] thread_dict[resource] += TOC - thread_dict["begin"] thread_dict["begin"] = TOC
477,691
def commit_time(thread_dict, TOC): resource = thread_dict["resource"] thread_dict[resource] += TOC - thread_dict["begin"] thread_dict["begin"] = TOC
def commit_time(thread_dict, TOC): resource = thread_dict["resource"] thread_dict[resource] += TOC - thread_dict["begin"] thread_dict["begin"] = TOC
477,692
def commit_time(thread_dict, TOC): resource = thread_dict["resource"] thread_dict[resource] += TOC - thread_dict["begin"] thread_dict["begin"] = TOC
def commit_time(thread_dict, TOC): resource = thread_dict["resource"] thread_dict[resource] += TOC - thread_dict["begin"] thread_dict["begin"] = TOC
477,693
def exec_repy_script(filename, restrictionsfile, arguments={}, script_args=''): global mobileNoSubprocess if script_args != '': script_args = ' ' + script_args if not mobileNoSubprocess: # Convert arguments arg_string = arguments_to_string(arguments) return exec_command('python repy.py ' + arg_string + restrictionsf...
def exec_repy_script(filename, restrictionsfile, arguments=None, script_args=''): global mobileNoSubprocess if script_args != '': script_args = ' ' + script_args if not mobileNoSubprocess: # Convert arguments arg_string = arguments_to_string(arguments) return exec_command('python repy.py ' + arg_string + restriction...
477,694
def main(): if OS not in SUPPORTED_OSES: raise UnsupportedOSError("This operating system is not supported.") # Begin pre-installation process. # Pre-install: parse the passed-in arguments. try: # Armon: Changed getopt to accept parameters for Repy and NM IP/Iface # restrictions, also a special disable flag opts, arg...
def main(): if OS not in SUPPORTED_OSES: raise UnsupportedOSError("This operating system is not supported.") # Begin pre-installation process. # Pre-install: parse the passed-in arguments. try: # Armon: Changed getopt to accept parameters for Repy and NM IP/Iface # restrictions, also a special disable flag opts, arg...
477,695
def init(geni_username, vesselcount, vesseltype, program_filename, *args): """ <Purpose> Initializes the deployment of an arbitrary service. Populates a global configuration dictionary and returns a dict of data that could be required by the run() function. init() must be called before the run() function. Note on the ...
def init(geni_username, vesselcount, vesseltype, program_filename): """ <Purpose> Initializes the deployment of an arbitrary service. Populates a global configuration dictionary and returns a dict of data that could be required by the run() function. init() must be called before the run() function. Note on the return ...
477,696
def init(geni_username, vesselcount, vesseltype, program_filename, *args): """ <Purpose> Initializes the deployment of an arbitrary service. Populates a global configuration dictionary and returns a dict of data that could be required by the run() function. init() must be called before the run() function. Note on the ...
def init(geni_username, vesselcount, vesseltype, program_filename, *args): """ <Purpose> Initializes the deployment of an arbitrary service. Populates a global configuration dictionary and returns a dict of data that could be required by the run() function. init() must be called before the run() function. Note on the ...
477,697
def assertisallowed(call,*args): # let's pre-reject certain open / file calls #print call_rule_table[call] matches = find_action(call_rule_table[call], args) action, matched_rule, reasoning = matches[0] if action == 'allow': return True elif action == 'deny': matches.reverse() estr = "Call '"+str(call)+"' with args "+...
def assertisallowed(call,*args): # let's pre-reject certain open / file calls #print call_rule_table[call] matches = find_action(call_rule_table[call], args) action, matched_rule, reasoning = matches[0] if action == 'allow': return True elif action == 'deny': matches.reverse() estr = "Call '"+str(call)+"' with args "+...
477,698
def seattlegeni_renew_vessels(identity, vesselhandle_list): """ <Purpose> Renew vessels previously acquired from SeattleGENI. <Arguments> identity The identity to use for communicating with SeattleGENI. vesselhandle_list The vessels to be renewed. <Exceptions> The common SeattleGENI exceptions described in the module c...
def seattlegeni_renew_vessels(identity, vesselhandle_list): """ <Purpose> Renew vessels previously acquired from SeattleGENI. <Arguments> identity The identity to use for communicating with SeattleGENI. vesselhandle_list The vessels to be renewed. <Exceptions> The common SeattleGENI exceptions described in the module c...
477,699