rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
def _get_by_checksum(self, build): result = self.store.find(StormBuild, Cast(StormBuild.checksum, "TEXT") == build.log_checksum()) return result.one() | def _get_by_checksum(self, build): result = self.store.find(StormBuild, Cast(StormBuild.checksum, "TEXT") == build.log_checksum()) return result.one() | |
existing_build = self._get_by_checksum(build) | existing_build = self.store.find(StormBuild, Cast(StormBuild.checksum, "TEXT") == build.log_checksum()).order_by(StormBuild.upload_time).first() | def upload_build(self, build): existing_build = self._get_by_checksum(build) if existing_build is not None: # Already present assert build.tree == existing_build.tree assert build.host == existing_build.host assert build.compiler == existing_build.compiler return existing_build rev = build.revision_details() super(Stor... |
return make_collapsible_html('action', actionName, output, self.indice, status) | return "".join(make_collapsible_html('action', actionName, output, self.indice, status)) | def _pretty_print(self, m): output = m.group(1) actionName = m.group(2) status = m.group(3) # handle pretty-printing of static-analysis tools if actionName == 'cc_checker': output = print_log_cc_checker(output) |
return make_collapsible_html('test', m.group(1), m.group(2), self.indice, m.group(3)) | return "".join(make_collapsible_html('test', m.group(1), m.group(2), self.indice, m.group(3))) | def _format_stage(self, m): self.indice += 1 return make_collapsible_html('test', m.group(1), m.group(2), self.indice, m.group(3)) |
return make_collapsible_html('test', m.group(1), '', self.indice, 'skipped') | return "".join(make_collapsible_html('test', m.group(1), '', self.indice, 'skipped')) | def _format_skip_testsuite(self, m): self.indice += 1 return make_collapsible_html('test', m.group(1), '', self.indice, 'skipped') |
return make_collapsible_html('test', testName, content+errorReason, self.indice, status) | return "".join(make_collapsible_html('test', testName, content+errorReason, self.indice, status)) | def _format_testsuite(self, m): testName = m.group(1) content = m.group(2) status = subunit_to_buildfarm_result(m.group(3)) if m.group(4): errorReason = format_subunit_reason(m.group(4)) else: errorReason = "" self.indice += 1 return make_collapsible_html('test', testName, content+errorReason, self.indice, status) |
return make_collapsible_html('test', m.group(1), m.group(2)+format_subunit_reason(m.group(4)), self.indice, subunit_to_buildfarm_result(m.group(3))) | return "".join(make_collapsible_html('test', m.group(1), m.group(2)+format_subunit_reason(m.group(4)), self.indice, subunit_to_buildfarm_result(m.group(3)))) | def _format_test(self, m): self.indice += 1 return make_collapsible_html('test', m.group(1), m.group(2)+format_subunit_reason(m.group(4)), self.indice, subunit_to_buildfarm_result(m.group(3))) |
output += make_collapsible_html('cc_checker', title, content, id, status) | output += "".join(make_collapsible_html('cc_checker', title, content, id, status)) | def print_log_cc_checker(input): # generate pretty-printed html for static analysis tools output = "" # for now, we only handle the IBM Checker's output style if not re.search("^BEAM_VERSION", input): return "here" return input content = "" inEntry = False title = None status = None for line in input.splitlines(): #... |
if ((status == "" or "failed" == status.lower())): | if status.lower() in ("", "failed"): | def make_collapsible_html(type, title, output, id, status=""): """generate html for a collapsible section :param type: the logical type of it. e.g. "test" or "action" :param title: the title to be displayed """ if ((status == "" or "failed" == status.lower())): icon = 'icon_hide_16.png' else: icon = 'icon_unhide_16.pn... |
ret = "<div class='%s unit %s' id='%s-%s'>" % (type, status, type, id) ret += "<a href=\"javascript:handle('%s');\">" % id ret += "<img id='img-%s' name='img-%s' alt='%s' src='%s' />" %(id, id, status, icon) ret += "<div class='%s title'>%s</div></a>" % (type, title) ret += "<div class='%s status %s'>%s</div>" % (type... | yield "<div class='%s unit %s' id='%s-%s'>" % (type, status, type, id) yield "<a href=\"javascript:handle('%s');\">" % id yield "<img id='img-%s' name='img-%s' alt='%s' src='%s' />" % (id, id, status, icon) yield "<div class='%s title'>%s</div></a>" % (type, title) yield "<div class='%s status %s'>%s</div>" % (type, st... | def make_collapsible_html(type, title, output, id, status=""): """generate html for a collapsible section :param type: the logical type of it. e.g. "test" or "action" :param title: the title to be displayed """ if ((status == "" or "failed" == status.lower())): icon = 'icon_hide_16.png' else: icon = 'icon_unhide_16.pn... |
if err: err = cgi.escape(err) | err = cgi.escape(err) | def render(self, myself, tree, host, compiler, rev, checksum=None, plain_logs=False): """view one build in detail""" |
yield make_collapsible_html('action', "Error Output", "\n%s" % err, "stderr-0", "errorlog") | yield "".join(make_collapsible_html('action', "Error Output", "\n%s" % err, "stderr-0", "errorlog")) | def render(self, myself, tree, host, compiler, rev, checksum=None, plain_logs=False): """view one build in detail""" |
yield select(name="author", values=authors, default=author) | yield "".join(select(name="author", values=authors, default=author)) | def render(self, myself, tree, author=None): t = self.buildfarm.trees[tree] interesting = list() authors = {"ALL": "ALL"} branch = t.get_branch() re_author = re.compile("^(.*) <(.*)>$") for entry in branch.log(limit=HISTORY_HORIZON): m = re_author.match(entry.author) authors[m.group(2)] = m.group(1) if author in ("ALL"... |
parser.add_option("--cachedirname", help="Cache directory name", type=str) | def __call__(self, environ, start_response): form = cgi.FieldStorage(fp=environ['wsgi.input'], environ=environ) fn_name = get_param(form, 'function') or '' myself = wsgiref.util.application_uri(environ) | |
buildfarm = CachingBuildFarm(cachedirname=opts.cachedirname) | from buildfarm.sqldb import StormCachingBuildFarm buildfarm = StormCachingBuildFarm() | def __call__(self, environ, start_response): form = cgi.FieldStorage(fp=environ['wsgi.input'], environ=environ) fn_name = get_param(form, 'function') or '' myself = wsgiref.util.application_uri(environ) |
yield "<table class='real'>" | yield "<table class='real'>\n" | def view_build(myself, tree, host, compiler, rev, plain_logs=False): """view one build in detail""" # ensure the params are valid before using them assert host in hosts, "unknown host %s" % host assert compiler in compilers, "unknown compiler %s" % compiler assert tree in trees, "not a build tree %s" % tree uname = ""... |
"compiler=%s yield "<tr><td>Uname:</td><td>%s</td></tr>" % uname yield "<tr><td>Tree:</td><td>%s</td></tr>" % tree_link(myself, tree) yield "<tr><td>Build Revision:</td><td>%s</td></tr>" % revision_link(myself, revision, tree) yield "<tr><td>Build age:</td><td><div class='age'>%s</div></td></tr>" % red_age(age_mtime) y... | "compiler=%s yield "<tr><td>Uname:</td><td>%s</td></tr>\n" % uname yield "<tr><td>Tree:</td><td>%s</td></tr>\n" % tree_link(myself, tree) yield "<tr><td>Build Revision:</td><td>%s</td></tr>\n" % revision_link(myself, revision, tree) yield "<tr><td>Build age:</td><td><div class='age'>%s</div></td></tr>\n" % red_age(age_... | def view_build(myself, tree, host, compiler, rev, plain_logs=False): """view one build in detail""" # ensure the params are valid before using them assert host in hosts, "unknown host %s" % host assert compiler in compilers, "unknown compiler %s" % compiler assert tree in trees, "not a build tree %s" % tree uname = ""... |
yield "<h2>No error log available</h2>" | yield "<h2>No error log available</h2>\n" | def view_build(myself, tree, host, compiler, rev, plain_logs=False): """view one build in detail""" # ensure the params are valid before using them assert host in hosts, "unknown host %s" % host assert compiler in compilers, "unknown compiler %s" % compiler assert tree in trees, "not a build tree %s" % tree uname = ""... |
yield make_collapsible_html('action', "Error Output", "\n%s" % err, "stderr-0") | yield make_collapsible_html('action', "Error Output", "\n%s" % err, "stderr-0", "errorlog") | def view_build(myself, tree, host, compiler, rev, plain_logs=False): """view one build in detail""" # ensure the params are valid before using them assert host in hosts, "unknown host %s" % host assert compiler in compilers, "unknown compiler %s" % compiler assert tree in trees, "not a build tree %s" % tree uname = ""... |
yield "<h2>Build log:</h2>" | yield "<h2>Build log:</h2>\n" | def view_build(myself, tree, host, compiler, rev, plain_logs=False): """view one build in detail""" # ensure the params are valid before using them assert host in hosts, "unknown host %s" % host assert compiler in compilers, "unknown compiler %s" % compiler assert tree in trees, "not a build tree %s" % tree uname = ""... |
yield '<h2>Error log:</h2>' | yield '<h2>Error log:</h2>\n' | def view_build(myself, tree, host, compiler, rev, plain_logs=False): """view one build in detail""" # ensure the params are valid before using them assert host in hosts, "unknown host %s" % host assert compiler in compilers, "unknown compiler %s" % compiler assert tree in trees, "not a build tree %s" % tree uname = ""... |
yield '<h2>Build log:</h2>' | yield '<h2>Build log:</h2>\n' | def view_build(myself, tree, host, compiler, rev, plain_logs=False): """view one build in detail""" # ensure the params are valid before using them assert host in hosts, "unknown host %s" % host assert compiler in compilers, "unknown compiler %s" % compiler assert tree in trees, "not a build tree %s" % tree uname = ""... |
indice +=1 make_collapsible_html('action', actionName, output, indice, status) return output log = re.sub("(Running\ action\s+([\w\-]+) .*? ACTION\ (PASSED|FAILED):\ ([\w\-]+))", pretty_print, log) | indice += 1 return make_collapsible_html('action', actionName, output, indice, status) pattern = re.compile("(Running action\s+([\w\-]+)$(?:\s^.*$)*?\sACTION\ (PASSED|FAILED):\ ([\w\-]+)$)", re.M) log = pattern.sub(pretty_print, log) | def pretty_print(m): output = m.group(1) actionName = m.group(2) status = m.group(3) # handle pretty-printing of static-analysis tools if actionName == 'cc_checker': output = print_log_cc_checker(output) |
id += 1 return make_collapsible_html('test', m.group(1), m.group(2)+format_subunit_reason(m.group(4)), id, subunit_to_buildfarm_result(m.group(3))) log = re.sub("""testsuite: ([\w\-=,_:\ /.&; \(\)\$]+).*? (.*?) testsuite-(.*?): [\w\-=,_:\ /.&; \(\)]+( \[.*?\])?.*?""", format_testsuite, log) | global indice testName = m.group(1) content = m.group(2) status = subunit_to_buildfarm_result(m.group(3)) if m.group(4): errorReason = format_subunit_reason(m.group(4)) else: errorReason = "" indice += 1 return make_collapsible_html('test', testName, content+errorReason, indice, status) pattern = re.compile("^testsuit... | def format_testsuite(m): id += 1 return make_collapsible_html('test', m.group(1), m.group(2)+format_subunit_reason(m.group(4)), id, subunit_to_buildfarm_result(m.group(3))) |
if ((status == "" or "failed" in status.lower())): | if ((status == "" or "failed" == status.lower())): | def make_collapsible_html(type, title, output, id, status=""): """generate html for a collapsible section :param type: the logical type of it. e.g. "test" or "action" :param title: the title to be displayed """ if ((status == "" or "failed" in status.lower())): icon = 'icon_hide_16.png' else: icon = 'icon_unhide_16.p... |
ret += "<img id='img-%s' name='img-%s' alt='%s' src='%s'>" %(id, id, status, icon) ret += "<div class='%s title'>%s</div>" % (type, title) ret += " " | ret += "<img id='img-%s' name='img-%s' alt='%s' src='%s' />" %(id, id, status, icon) ret += "<div class='%s title'>%s</div></a>" % (type, title) | def make_collapsible_html(type, title, output, id, status=""): """generate html for a collapsible section :param type: the logical type of it. e.g. "test" or "action" :param title: the title to be displayed """ if ((status == "" or "failed" in status.lower())): icon = 'icon_hide_16.png' else: icon = 'icon_unhide_16.p... |
ret += "<div class='%s output' id='output-%s'><pre>%s</pre></div>" % (type, id, output) | ret += "<div class='%s output' id='output-%s'>" % (type, id) if output and len(output): ret += "<pre>%s</pre>>" % (output) ret += "</div></div>" | def make_collapsible_html(type, title, output, id, status=""): """generate html for a collapsible section :param type: the logical type of it. e.g. "test" or "action" :param title: the title to be displayed """ if ((status == "" or "failed" in status.lower())): icon = 'icon_hide_16.png' else: icon = 'icon_unhide_16.p... |
yield " <link rel='stylesheet' href='http://master.samba.org/samba/style/common.css' type='text/css' media='all'/>" | yield " <link rel='stylesheet' href='common.css' type='text/css' media='all'/>" | def buildApp(environ, start_response): form = cgi.FieldStorage(fp=environ['wsgi.input'], environ=environ) fn_name = get_param(form, 'function') or '' myself = wsgiref.util.application_uri(environ) if standalone and environ['PATH_INFO']: dir = os.path.join(os.path.dirname(__file__)) static_file = "%s/%s" % (dir, enviro... |
def get_last_builds(self, tree): extra_expr = [StormBuild.tree == tree] | def get_last_builds(self, tree=None): extra_expr = [] if tree is not None: extra_expr.append(StormBuild.tree == tree) | def get_last_builds(self, tree): extra_expr = [StormBuild.tree == tree] return self._get_store().find(StormBuild, *extra_expr) |
status = status.replace("?", "0") | status = status.replace("-", "0") status = status.replace("?", "0.1") | def build_status_vals(status): """translate a status into a set of int representing status""" status = util.strip_html(status) status = status.replace("ok", "0") status = status.replace("?", "0") status = status.replace("PANIC", "1") return status.split("/") |
if len(bstat) > 4 and bstat[4]: | if len(bstat) > 5 and bstat[5]: | def status_cmp(a, b): bstat = build_status_vals(b) astat = build_status_vals(a) |
elif len(astat) > 4 and astat[4]: | elif len(astat) > 5 and astat[5]: | def status_cmp(a, b): bstat = build_status_vals(b) astat = build_status_vals(a) |
return (cmp(astat[0], bstat[0]) or cmp(astat[1], bstat[1]) or cmp(astat[2], bstat[2]) or cmp(astat[3], bstat[3])) | if len(bstat) == 5: if bstat[0] == bstat[1] == bstat[2] == bstat[3] == "0": return -1 if len(astat) == 5: if astat[0] == astat[1] == astat[2] == astat[3] == "0": return 1 return (cmp((10000 * astat[3] + 1000*astat[2] + 100 * astat[1] + astat[0]), (10000 * bstat[3] + 1000*bstat[2] + 100 * bstat[1] + bstat[0]))) | def status_cmp(a, b): bstat = build_status_vals(b) astat = build_status_vals(a) |
judgingObject = SimpleJudgingObject(tagLst, nodeType, nodeId, ignoreList); | judgingObject = SimpleJudgingObject(tagLst, attrName, attrVal, dataToCheck); | def JudgeExemplary(self, context): |
elif (len(imageFilenames) == 1): self.__compareRendersResults = False msg = "FAILED: Unable to retrieve both image locations." | def CompareRenderedImages(self, context): self.__compareRendersResults = True msg = "PASSED: Output images match input images." # Retrieve the image files for this test case. imageFilenames = context.GetStepImageFilenames() if (len(imageFilenames) == 0): self.__compareRendersResults = False msg = "FAILED: Unable to re... | |
def ElementDataPreservedIn(self, context, tagListArray, dataType="float"): | def ElementDataPreservedIn(self, context, tagListArray, dataType="float", defaultLogText = True): | def ElementDataPreservedIn(self, context, tagListArray, dataType="float"): if ( len(self.__inputFileName) == 0 or len(self.__outputFileNameList) == 0 ): if (self.SetInputOutputFiles(context) == False): self.__preservationResults = False self.__result = False return self.__preservationResults testIO = DOMParserIO( self... |
context.Log("PASSED: <"+ inputTagList[len(inputTagList)-1] +"> data is preserved.") | logMsg = "PASSED: <"+ inputTagList[len(inputTagList)-1] +"> data is preserved." | def ElementDataPreservedIn(self, context, tagListArray, dataType="float"): if ( len(self.__inputFileName) == 0 or len(self.__outputFileNameList) == 0 ): if (self.SetInputOutputFiles(context) == False): self.__preservationResults = False self.__result = False return self.__preservationResults testIO = DOMParserIO( self... |
context.Log("FAILED: <"+ inputTagList[len(inputTagList)-1] +"> data is not preserved.") self.__preservationResults = False self.__result = False | logMsg = "FAILED: <"+ inputTagList[len(inputTagList)-1] +"> data is not preserved." self.__preservationResults = False self.__result = False if (defaultLogText): context.Log(logMsg) | def ElementDataPreservedIn(self, context, tagListArray, dataType="float"): if ( len(self.__inputFileName) == 0 or len(self.__outputFileNameList) == 0 ): if (self.SetInputOutputFiles(context) == False): self.__preservationResults = False self.__result = False return self.__preservationResults testIO = DOMParserIO( self... |
def NewparamCheck(self, context, originalLocation, bakedLocation, newparamLocations): | def NewparamCheck(self, context, originalLocation, bakedLocation, newparamLocations, defaultLogText = True): | def NewparamCheck(self, context, originalLocation, bakedLocation, newparamLocations): if ( len(self.__inputFileName) == 0 or len(self.__outputFileNameList) == 0 ): if (self.SetInputOutputFiles(context) == False): self.__preservationResults = False self.__result = False return self.__preservationResults testIO = DOMPar... |
context.Log("PASSED: "+ originalLocation[len(originalLocation)-1] +" data is baked into the referencing element.") | logMsg = "PASSED: "+ originalLocation[len(originalLocation)-1] +" data is baked into the referencing element." | def NewparamCheck(self, context, originalLocation, bakedLocation, newparamLocations): if ( len(self.__inputFileName) == 0 or len(self.__outputFileNameList) == 0 ): if (self.SetInputOutputFiles(context) == False): self.__preservationResults = False self.__result = False return self.__preservationResults testIO = DOMPar... |
context.Log("PASSED: "+ originalLocation[len(originalLocation)-1] +" data is found in newparam/param.") | logMsg = "PASSED: "+ originalLocation[len(originalLocation)-1] +" data is found in newparam/param." | def NewparamCheck(self, context, originalLocation, bakedLocation, newparamLocations): if ( len(self.__inputFileName) == 0 or len(self.__outputFileNameList) == 0 ): if (self.SetInputOutputFiles(context) == False): self.__preservationResults = False self.__result = False return self.__preservationResults testIO = DOMPar... |
context.Log("FAILED: "+ originalLocation[len(originalLocation)-1] +" data is not baked or found in newparam/param.") self.__preservationResults = False self.__result = False | logMsg = "FAILED: "+ originalLocation[len(originalLocation)-1] +" data is not baked or found in newparam/param." self.__preservationResults = False self.__result = False if (defaultLogText): context.Log(logMsg) | def NewparamCheck(self, context, originalLocation, bakedLocation, newparamLocations): if ( len(self.__inputFileName) == 0 or len(self.__outputFileNameList) == 0 ): if (self.SetInputOutputFiles(context) == False): self.__preservationResults = False self.__result = False return self.__preservationResults testIO = DOMPar... |
self.__assistant.CompareImagesAgainst(context, "_reference_node_translate_xyz_cube", None, None, 5, True, False) | self.__assistant.CompareImagesAgainst(context, "_reference_node_translate_xyz_cube", None, None, 5, True, True) | def JudgeBaseline(self, context): # No step should not crash self.__assistant.CheckCrashes(context) # Import/export/validate must exist and pass, while Render must only exist. self.__assistant.CheckSteps(context, ["Import", "Export", "Validate"], ["Render"]) if (self.__assistant.GetResults() == False): self.status_ba... |
self.__assistant.CheckSteps(context, ["Import", "Export", "Validate"], ["Render"]) | self.__assistant.CheckSteps(context, ["Import", "Export", "Validate"], []) | def JudgeBaseline(self, context): # No step should not crash self.__assistant.CheckCrashes(context) # Import/export/validate must exist and pass, while Render must only exist. self.__assistant.CheckSteps(context, ["Import", "Export", "Validate"], ["Render"]) |
print link(s1, s2) | if (s1 != s2): print link(s1, s2) | def link(s1,s2): return '(SimilarityLink (stv 1.0 0.999) '+str(s1)+' '+str(s2)+')' |
print response | def testPostTVRobustness(self): """ Test that bad json TV syntax fails gracefully, i.e. doesn't kill the server! """ data = """{ "type":"ConceptNode", "name":"SimpleTVMutations", "truthvalue": {"simple": {"str":0.5, "count":10}} }""" import random r = random.Random() for i in range(0,40): data_copy = list(data) data_co... | |
'../../../lib/opencog.conf'], stdout=sys.stdout) | opencog_conf], stdout=sys.stdout) | def spawn_server(): global server_process print "Spawning server" server_process = subprocess.Popen([server_exe, '-c', '../../../lib/opencog.conf'], stdout=sys.stdout) |
time.sleep(1) | time.sleep(10) | def spawn_server(): global server_process print "Spawning server" server_process = subprocess.Popen([server_exe, '-c', opencog_conf], stdout=sys.stdout) time.sleep(1) # Allow modules time to load print "Server spawned with pid %d" % (server_process.pid,) |
for i in xrange(0, num_links_per_node*10): | for i in xrange(0, num_nodes*num_links_per_node): | def link(s1,s2): return '(SimilarityLink (stv 1.0 0.999) '+str(s1)+' '+str(s2)+')' |
and not req.args.get('annotate'): | and not req.args.get('annotate', '') == 'coverage': | def post_process_request(self, req, template, data, content_type): """ Adds a 'Coverage' context navigation menu item. """ resource = data and data.get('context') \ and data.get('context').resource or None if resource and isinstance(resource, Resource) \ and resource.realm=='source' and data.get('file') \ and not req.a... |
username=None, password=None): | username=None, password=None, no_auth_cache='false'): | def checkout(ctxt, url, path=None, revision=None, dir_='.', verbose='false', shared_path=None, username=None, password=None): """Perform a checkout from a Subversion repository. :param ctxt: the build context :type ctxt: `Context` :param url: the URL of the repository :param path: the path inside the repository :param... |
def export(ctxt, url, path=None, revision=None, dir_='.', username=None, password=None): | def export(ctxt, url, path=None, revision=None, dir_='.', username=None, password=None, no_auth_cache='false'): | def export(ctxt, url, path=None, revision=None, dir_='.', username=None, password=None): """Perform an export from a Subversion repository. :param ctxt: the build context :type ctxt: `Context` :param url: the URL of the repository :param path: the path inside the repository :param revision: the revision to check out :... |
def checkout(ctxt, url, path=None, revision=None, dir_='.', verbose=False, shared_path=None, | def checkout(ctxt, url, path=None, revision=None, dir_='.', verbose='false', shared_path=None, | def checkout(ctxt, url, path=None, revision=None, dir_='.', verbose=False, shared_path=None, username=None, password=None): """Perform a checkout from a Subversion repository. :param ctxt: the build context :type ctxt: `Context` :param url: the URL of the repository :param path: the path inside the repository :param r... |
if not verbose: | if verbose.lower() == 'false': | def checkout(ctxt, url, path=None, revision=None, dir_='.', verbose=False, shared_path=None, username=None, password=None): """Perform a checkout from a Subversion repository. :param ctxt: the build context :type ctxt: `Context` :param url: the URL of the repository :param path: the path inside the repository :param r... |
WHERE report_category='lint' AND build=%s AND step=%s | WHERE report.category='lint' AND build=%s AND step=%s | def render_summary(self, req, config, build, step, category): assert category == 'lint' |
For example: | For example:: | def encode_multipart_formdata(fields): """ Given a dictionary field parameters, returns the HTTP request body and the content_type (which includes the boundary string), to be used with an httplib-like call. Normal key/value items are treated as regular parameters, but key/tuple items are treated as files, where a valu... |
:param keep_alive_interval: the time in seconds to wait between sending | :param keepalive_interval: the time in seconds to wait between sending | def __init__(self, urls, name=None, config=None, dry_run=False, work_dir=None, build_dir="build_${build}", keep_files=False, single_build=False, poll_interval=300, keepalive_interval = 60, username=None, password=None, dump_reports=False, no_loop=False, form_auth=False): """Create the build slave instance. :param urls... |
warns = [rec for rec in logwatch.records if rec.levelname == 'WARNING'] self.assertEqual(len(warns), 1) for warn in warns: self.assertTrue(warn.getMessage().startswith("Error renaming")) infos = [rec for rec in logwatch.records if rec.levelname == 'INFO'] self.assertEqual(len(infos), 4) for info in infos[:1]: self.ass... | logs = sorted(logwatch.records, key=lambda rec: rec.getMessage()) self.assertEqual(len(logs), 5) self.assertTrue(logs[0].getMessage().startswith( "Deleted 1 stray log level (0 errors)")) self.assertTrue(logs[1].getMessage().startswith( | def test_fix_log_levels_misnaming(self): |
self.assertTrue(infos[2].getMessage().startswith( | self.assertTrue(logs[2].getMessage().startswith( "Error renaming")) self.assertTrue(logs[3].getMessage().startswith( | def test_fix_log_levels_misnaming(self): |
self.assertTrue(infos[3].getMessage().startswith( "Deleted 1 stray log level (0 errors)")) | self.assertTrue(logs[4].getMessage().startswith( "Renamed incorrectly named log level file")) def test_remove_stray_log_levels_files(self): logfiles = { "1.log": "", "1.log.levels": "info\n", "2.log.levels": "info\ninfo\n", } expected_deletions = [ "2.log.levels", ] for filename, data in logfiles.items(): path = os.p... | def test_fix_log_levels_misnaming(self): |
sync=lambda: None, normalize_path=lambda path: path) | sync=lambda: None, normalize_path=lambda path: path, normalize_rev=lambda rev: rev) | def test_view_config(self): config = BuildConfig(self.env, name='test', path='trunk') config.insert() platform = TargetPlatform(self.env, config='test', name='any') platform.insert() |
sync=lambda: None, normalize_path=lambda path: path) | sync=lambda: None, normalize_path=lambda path: path, normalize_rev=lambda rev: rev) | def test_bitten_keeps_order_of_revisions_from_versioncontrol(self): # Trac's API specifies that they are sorted chronological (backwards) # We must not assume that these revision numbers can be sorted later on, # for example the mercurial plugin will return the revisions as strings # (e.g. '880:4c19fa95fb9e') config = ... |
sync=lambda: None, normalize_path=lambda path: path) | sync=lambda: None, normalize_path=lambda path: path, normalize_rev=lambda rev: rev) | def test_view_config_paging(self): config = BuildConfig(self.env, name='test', path='trunk') config.insert() platform = TargetPlatform(self.env, config='test', name='any') platform.insert() |
print "\n %s/%s" % (config, build) | print " %s/%s" % (config, build) | def discover(self, build): """Print a summary of what is linked to the build.""" print "Items to delete for build %r" % (build,) |
print "\n ".join(self._log_files(cursor, build)) | print " ", "\n ".join(self._log_files(cursor, build)) | def discover(self, build): """Print a summary of what is linked to the build.""" print "Items to delete for build %r" % (build,) |
print "\n ".join(row[0] for row in cursor.fetchall()) | print " ", "\n ".join(str(row[0]) for row in cursor.fetchall()) | def discover(self, build): """Print a summary of what is linked to the build.""" print "Items to delete for build %r" % (build,) |
cursor.execute("SELECT name FROM bitten_step WHERE build=%s", (build,)) print "\n ".join(row[0] for row in cursor.fetchall()) | cursor.execute("SELECT id FROM bitten_build WHERE id=%s", (build,)) print " ", "\n ".join(str(row[0]) for row in cursor.fetchall()) | def discover(self, build): """Print a summary of what is linked to the build.""" print "Items to delete for build %r" % (build,) |
>>> req = Mock(href=Href('/'), perm=MockPerm(), chrome={}, args={}) | >>> req = Mock(href=Href('/'), perm=MockPerm(), ... chrome={'warnings': []}, args={}) | def render_summary(self, req, config, build, step, category): assert category == 'coverage' |
add_ctxtnav(req, 'Coverage', | add_ctxtnav(req, tag.a('Coverage', | def post_process_request(self, req, template, data, content_type): """ Adds a 'Coverage' context navigation menu item. """ resource = data and data.get('context') \ and data.get('context').resource or None if resource and isinstance(resource, Resource) \ and resource.realm=='source' and data.get('file') \ and not req.a... |
annotate='coverage', rev=resource.version)) | annotate='coverage', rev=req.args.get('rev'), created=data.get('rev')), rel='nofollow')) | def post_process_request(self, req, template, data, content_type): """ Adds a 'Coverage' context navigation menu item. """ resource = data and data.get('context') \ and data.get('context').resource or None if resource and isinstance(resource, Resource) \ and resource.realm=='source' and data.get('file') \ and not req.a... |
try: version = context.req.args['rev'] except KeyError: version = resource.version builds = Build.select(self.env, rev=version) self.log.debug("Looking for coverage report for %s@%s [%s]..." % ( resource.id, str(resource.version), version)) reports = [] for build in builds: config = BuildConfig.fetch(self.env, build... | version = context.req.args.get('rev', resource.version) created = context.req.args.get('created', resource.version) repos = self.env.get_repository() version_time = to_timestamp(repos.get_changeset(version).date) if version != created: created_time = to_timestamp(repos.get_changeset(created).date) else: created_time... | def get_annotation_data(self, context): add_stylesheet(context.req, 'bitten/bitten_coverage.css') |
cmp=lambda x, y: int(y.rev) - int(x.rev)): | cmp=lambda x, y: int(y.rev_time) - int(x.rev_time)): | def _render_inprogress(self, req): data = {'title': 'In Progress Builds', 'page_mode': 'view-inprogress'} |
if DEBUG: print >>sys.stderr, "GlobalSeedingManager: UnlimitedSeeding" | if DEBUG: print >>sys.stderr, "GlobalSeedingManager: UnlimitedSeeding (for t4t)" | def apply_seeding_policy(self, dslist): # Remove stoped seeds for infohash, seeding_manager in self.seeding_managers.items(): if not seeding_manager.download_state.get_status() == DLSTATUS_SEEDING: self.write_storage(infohash, seeding_manager.get_updated_storage()) del self.seeding_managers[infohash] |
if DEBUG: print >>sys.stderr, "GlobalSeedingManager: NoSeeding" | if DEBUG: print >>sys.stderr, "GlobalSeedingManager: NoSeeding (for t4t)" | def apply_seeding_policy(self, dslist): # Remove stoped seeds for infohash, seeding_manager in self.seeding_managers.items(): if not seeding_manager.download_state.get_status() == DLSTATUS_SEEDING: self.write_storage(infohash, seeding_manager.get_updated_storage()) del self.seeding_managers[infohash] |
if DEBUG: print >>sys.stderr, "GlobalSeedingManager: UnlimitedSeeding" | if DEBUG: print >>sys.stderr, "GlobalSeedingManager: UnlimitedSeeding (for g2g)" | def apply_seeding_policy(self, dslist): # Remove stoped seeds for infohash, seeding_manager in self.seeding_managers.items(): if not seeding_manager.download_state.get_status() == DLSTATUS_SEEDING: self.write_storage(infohash, seeding_manager.get_updated_storage()) del self.seeding_managers[infohash] |
if DEBUG: print >>sys.stderr, "GlobalSeedingManager: NoSeeding" | if DEBUG: print >>sys.stderr, "GlobalSeedingManager: NoSeeding (for g2g)" | def apply_seeding_policy(self, dslist): # Remove stoped seeds for infohash, seeding_manager in self.seeding_managers.items(): if not seeding_manager.download_state.get_status() == DLSTATUS_SEEDING: self.write_storage(infohash, seeding_manager.get_updated_storage()) del self.seeding_managers[infohash] |
self.t4t_stop = False self.g2g_stop = False | self.t4t_eligible = True self.g2g_eligible = True | def __init__(self, download_state, storage): self.storage = storage self.download_state = download_state self.t4t_policy = None self.g2g_policy = None self.t4t_stop = False self.g2g_stop = False |
g2g_r = self.g2g_policy.apply(conn, self.download_state, self.storage) self.g2g_stop = g2g_r if self.t4t_stop and self.g2g_stop: | self.g2g_eligible = self.g2g_policy.apply(conn, self.download_state, self.storage) if DEBUG: print >>sys.stderr,"DenySeeding to g2g peer: ",self.download_state.get_download().get_dest_files() if not (self.t4t_eligible or self.g2g_eligible): if DEBUG: print >>sys.stderr,"Stop seedings: ",self.download_state.get_downlo... | def is_conn_eligible(self, conn): if conn.use_g2g: g2g_r = self.g2g_policy.apply(conn, self.download_state, self.storage) self.g2g_stop = g2g_r # If seeding stop both to g2g and t4t # then stop seeding if self.t4t_stop and self.g2g_stop: self.download_state.get_download().stop() if DEBUG: print >>sys.stderr,"Stop see... |
if DEBUG: print >>sys.stderr,"Stop seedings: ",self.download_state.get_download().get_dest_files() return g2g_r | return self.g2g_eligible | def is_conn_eligible(self, conn): if conn.use_g2g: g2g_r = self.g2g_policy.apply(conn, self.download_state, self.storage) self.g2g_stop = g2g_r # If seeding stop both to g2g and t4t # then stop seeding if self.t4t_stop and self.g2g_stop: self.download_state.get_download().stop() if DEBUG: print >>sys.stderr,"Stop see... |
t4t_r = self.t4t_policy.apply(conn, self.download_state, self.storage) self.t4t_stop = t4t_r if self.t4t_stop and self.g2g_stop: | self.t4t_eligible = self.t4t_policy.apply(conn, self.download_state, self.storage) if DEBUG: print >>sys.stderr,"DenySeeding to t4t peer: ",self.download_state.get_download().get_dest_files() if not (self.t4t_eligible or self.g2g_eligible): if DEBUG: print >>sys.stderr,"Stop seedings: ",self.download_state.get_downlo... | def is_conn_eligible(self, conn): if conn.use_g2g: g2g_r = self.g2g_policy.apply(conn, self.download_state, self.storage) self.g2g_stop = g2g_r # If seeding stop both to g2g and t4t # then stop seeding if self.t4t_stop and self.g2g_stop: self.download_state.get_download().stop() if DEBUG: print >>sys.stderr,"Stop see... |
if DEBUG: print >>sys.stderr,"Stop seedings: ",self.download_state.get_download().get_dest_files() return t4t_r | return self.t4t_eligible | def is_conn_eligible(self, conn): if conn.use_g2g: g2g_r = self.g2g_policy.apply(conn, self.download_state, self.storage) self.g2g_stop = g2g_r # If seeding stop both to g2g and t4t # then stop seeding if self.t4t_stop and self.g2g_stop: self.download_state.get_download().stop() if DEBUG: print >>sys.stderr,"Stop see... |
if current <= limit: return True else: return False | return current <= limit | def apply(self, _, __, storage): current = storage["time_seeding"] + time.time() - self.begin limit = long(self.Read('t4t_hours', "int"))*3600 + long(self.Read('t4t_mins', "int"))*60 if DEBUG: print >>sys.stderr, "TitForTatTimeBasedSeeding: apply:", current, "/", limit |
if current <= limit: return True else: return False | return current <= limit | def apply(self, _, __, storage): current = storage["time_seeding"] + time.time() - self.begin limit = long(self.Read('g2g_hours', "int"))*3600 + long(self.Read('g2g_mins', "int"))*60 |
ratio = ul/dl | ratio = 1.0*ul/dl | def apply(self, _, download_state, storage): # No Bittorrent leeching (minimal ratio of 1.0) ul = storage["total_up"] + download_state.get_total_transferred(UPLOAD) dl = storage["total_down"] + download_state.get_total_transferred(DOWNLOAD) |
if ratio <= 1.0: return True else: return False | return ratio <= 1.0 | def apply(self, _, download_state, storage): # No Bittorrent leeching (minimal ratio of 1.0) ul = storage["total_up"] + download_state.get_total_transferred(UPLOAD) dl = storage["total_down"] + download_state.get_total_transferred(DOWNLOAD) |
ratio = ul/dl if DEBUG: print >>sys.stderr, "GiveToGetRatioBasedSeedingapply:", dl, ul, ratio if ratio <= Read('g2g_ratio', "int")/100.0: return False else: return True | ratio = 1.0*ul/dl if DEBUG: print >>sys.stderr, "GiveToGetRatioBasedSeedingapply:", dl, ul, ratio, self.Read('g2g_ratio', "int")/100.0 return ratio <= self.Read('g2g_ratio', "int")/100.0 | def apply(self, conn, _, __): # Seeding to peers with large sharing ratio dl = conn.download.measure.get_total() ul = conn.upload.measure.get_total() |
relativeName = os.path.relpath(path, self.subs_dir) fileName = os.path.join(self.subs_dir, relativeName) print >> sys.stderr, "SUBTITLES PATH:", path print >> sys.stderr, "SUBTITLES SUBS_DIR:", self.subs_dir print >> sys.stderr, "SUBTITLES RELNAME:", relativeName print >> sys.stderr, "SUBTITLES FILENAME:", fileName pr... | fileName = path | def _readSubContent(self,path): try: # fileName = os.path.normpath(os.path.join(self.subs_dir, path)) relativeName = os.path.relpath(path, self.subs_dir) fileName = os.path.join(self.subs_dir, relativeName) |
f = open(tmpfilename, "r") f.close() if DEBUG: print >> sys.stderr, "DB Upgradation: file successfully created!!" | open(tmpfilename, "w") if DEBUG: print >> sys.stderr, "DB Upgradation: temp-file successfully created" | def updateDB(self, fromver, tover): |
if DEBUG: print >> sys.stderr, "DB Upgradation: file already present perhaps!!" | if DEBUG: print >> sys.stderr, "DB Upgradation: failed to create temp-file" | def updateDB(self, fromver, tover): |
from Tribler.Core.BitTornado.bencode import bencode, bdecode | def updateDB(self, fromver, tover): | |
def get_unicode_name(info): """ Get the name of the .torrent as a unicode string INFO must be the bdecoded .torrent file. INFO must be a dictionary containing a 'name' field and, optionally, a 'name-utf-8' field. """ if "name.utf-8" in info: try: return unicode(info["name.utf-8"], "UTF-8") except: pass if "name" i... | def updateDB(self, fromver, tover): | |
self.vSizer.Add(wx.StaticText(self, -1, '...collecting buzz information...')) | self.vSizer.Add(wx.StaticText(self, -1, '...collecting buzz information...'), 0, wx.ALIGN_CENTER) | def DisplayTerms(self, rows): self.Freeze() self.vSizer.ShowItems(False) self.vSizer.Clear() if rows is None or rows == []: self.vSizer.Add(wx.StaticText(self, -1, '...collecting buzz information...')) else: for i in range(len(rows)): row = rows[i] hSizer = wx.BoxSizer(wx.HORIZONTAL) hSizer.AddStretchSpacer(2) for t... |
if DEBUG: print >>sys.stderr,"GlobalSeedingManager: current seedings: ", len(self.seeding_managers), "out of", len(dslist), "downloads" | def apply_seeding_policy(self, dslist): # Remove stoped seeds for infohash, seeding_manager in self.seeding_managers.items(): if not seeding_manager.download_state.get_status() == DLSTATUS_SEEDING: self.write_storage(infohash, seeding_manager.get_updated_storage()) del self.seeding_managers[infohash] | |
if (nr_items is 0) or (nmyprefs is 0): | if (nr_items == 0) or (nmyprefs == 0): | def P2PSim_Single(db_row, nmyprefs): sim = 0 if db_row: peer_id, nr_items, overlap = db_row # Arno, 2010-01-14: Safety catch for weird by reported by Johan if (nr_items is None) or (nmyprefs is None): return sim if (nr_items is 0) or (nmyprefs is 0): return sim #Cosine Similarity With Emphasis on users with profilele... |
if DEBUG: print >>sys.stderr, "SeedingManager: created storage_dir", storage_dir | if DEBUG: print >>sys.stderr, "SeedingManager: created storage_dir", self.storage_dir | def prepare_storage(self): if not os.path.exists(self.storage_dir): if DEBUG: print >>sys.stderr, "SeedingManager: created storage_dir", storage_dir os.mkdir(self.storage_dir) |
policy_stop = othertorrentspolicy == OTHERTORRENTS_STOP or othertorrentspolicy == OTHERTORRENTS_STOP_RESTART if not policy_stop and not targetd is None: targetd.stop() | policy_stop = othertorrentspolicy == OTHERTORRENTS_STOP or \ othertorrentspolicy == OTHERTORRENTS_STOP_RESTART | def manage_other_downloads(self,othertorrentspolicy, targetd = None): self.resume_by_system = 1 if DEBUG: print >> sys.stderr, "VideoPlayer: manage_other_downloads" |
self.requestingThreads[prio] = TorrentRequester(self.metadatahandler, self.overlay_bridge, self.session, prio) | self.requestingThreads[prio] = TorrentRequester(self, self.metadatahandler, self.overlay_bridge, self.session, prio) | def download_torrent(self,permid,infohash,usercallback, prio = 1): """ The user has selected a torrent referred to by a peer in a query reply. Try to obtain the actual .torrent file from the peer and then start the actual download. """ assert isinstance(infohash, str), "INFOHASH has invalid type: %s" % type(infohash) a... |
def __init__(self, metadatahandler, overlay_bridge, session, prio): | def __init__(self, remoteTorrentHandler, metadatahandler, overlay_bridge, session, prio): self.remoteTorrentHandler = remoteTorrentHandler | def __init__(self, metadatahandler, overlay_bridge, session, prio): self.metadatahandler = metadatahandler self.overlay_bridge = overlay_bridge self.session = session self.prio = prio self.queue = Queue.Queue() self.sources = {} self.doRequest() |
kws = kwstr.split() | kws = split_into_keywords(kwstr) | def sesscb_got_remote_hits(self,permid,query,hits): # Called by SessionCallback thread |
kws = kwstr.split() | kws = split_into_keywords(kwstr) | def sesscb_got_channel_hits(self,permid,query,hits): # Called by SessionCallback thread if DEBUG: print >>sys.stderr,"GUIUtil: sesscb_got_channel_hits",len(hits) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.