rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
def __create_single_partition(self, loop_path): | def _create_single_partition(self, loop_path): | def __create_single_partition(self, loop_path): """ Creates a single partition encompassing the whole 'disk' using cfdisk. |
def __create_entries_partition(self, loop_path): | def _create_entries_partition(self, loop_path): | def __create_entries_partition(self, loop_path): """ Takes the newly created partition table on the loopback device and makes all its devices available under /dev/mapper. As we previously have partitioned it using a single partition, only one partition will be returned. |
def __remove_entries_partition(self): | def _remove_entries_partition(self): | def __remove_entries_partition(self): """ Removes the entries under /dev/mapper for the partition associated to the loopback device. """ logging.debug('Removing the entry on /dev/mapper for %s loop dev', self.loop) try: cmd = 'kpartx -d %s' % self.loop utils.system(cmd) except error.CmdError, e: e_msg = 'Error removing... |
def __detach_img_loop(self): | def _detach_img_loop(self): | def __detach_img_loop(self): """ Detaches the image file from the loopback device. """ logging.debug('Detaching image %s from loop device %s', self.img, self.loop) try: cmd = 'losetup -d %s' % self.loop utils.system(cmd) except error.CmdError, e: e_msg = ('Error detaching image %s from loop device %s: %s' % (self.loop,... |
unknown_files.append(line[1:].strip()) | for extension in self.ignored_extension_list: if not line.endswith(extension): unknown_files.append(line[1:].strip()) | def get_unknown_files(self): status = utils.system_output("svn status --ignore-externals") unknown_files = [] for line in status.split("\n"): status_flag = line[0] if line and status_flag == "?": unknown_files.append(line[1:].strip()) return unknown_files |
def __init__(self, path): | def __init__(self, path, confirm=False): | def __init__(self, path): """ Class constructor, sets the path attribute. |
self.indentation_exceptions = ['cli/job_unittest.py'] | self.indentation_exceptions = ['job_unittest.py'] | def __init__(self, path): """ Class constructor, sets the path attribute. |
logging.error("Possible indentation and spacing issues on " "file %s" % self.path) | def _check_indent(self): """ Verifies the file with reindent.py. This tool performs the following checks on python files: | |
logging.error("Possible syntax problems on file %s", self.path) logging.error("You might want to rerun '%s'", c_cmd) | logging.error("Syntax issues found during '%s'", c_cmd) | def _check_code(self): """ Verifies the file with run_pylint.py. This tool will call the static code checker pylint using the special autotest conventions and warn only on problems. If problems are found, a report will be generated. Some of the problems reported might be bogus, but it's allways good to look at them. ""... |
logging.error("Problems during unit test execution " "for file %s", self.path) logging.error("You might want to rerun '%s'", unittest_cmd) | logging.error("Unittest issues found during '%s'", unittest_cmd) | def _check_unittest(self): """ Verifies if the file in question has a unittest suite, if so, run the unittest and report on any failures. This is important to keep our unit tests up to date. """ if "unittest" not in self.basename: stripped_name = self.basename.strip(".py") unittest_name = stripped_name + "_unittest.py"... |
logging.info("File %s seems to require execution " "permissions. ", self.path) self.corrective_actions.append("chmod +x %s" % self.path) | self.corrective_actions.append("svn propset svn:executable ON %s" % self.path) | def _check_permissions(self): """ Verifies the execution permissions, specifically: * Files with no shebang and execution permissions are reported. * Files with shebang and no execution permissions are reported. """ if self.first_line.startswith("#!"): if not self.is_executable: logging.info("File %s seems to require e... |
logging.info("File %s does not seem to require execution " "permissions. ", self.path) self.corrective_actions.append("chmod -x %s" % self.path) | self.corrective_actions.append("svn propdel svn:executable %s" % self.path) | def _check_permissions(self): """ Verifies the execution permissions, specifically: * Files with no shebang and execution permissions are reported. * Files with shebang and no execution permissions are reported. """ if self.first_line.startswith("#!"): if not self.is_executable: logging.info("File %s seems to require e... |
logging.info("The following corrective actions are suggested:") | def report(self): """ Executes all required checks, if problems are found, the possible corrective actions are listed. """ self._check_permissions() if self.is_python: self._check_indent() self._check_code() self._check_unittest() if self.corrective_actions: logging.info("The following corrective actions are suggested:... | |
logging.info(action) answer = raw_input("Would you like to apply it? (y/n) ") | answer = ask("Would you like to execute %s?" % action, auto=self.confirm) | def report(self): """ Executes all required checks, if problems are found, the possible corrective actions are listed. """ self._check_permissions() if self.is_python: self._check_indent() self._check_code() self._check_unittest() if self.corrective_actions: logging.info("The following corrective actions are suggested:... |
def __init__(self, patch=None, patchwork_id=None): | def __init__(self, patch=None, patchwork_id=None, confirm=False): self.confirm = confirm | def __init__(self, patch=None, patchwork_id=None): self.base_dir = os.getcwd() if patch: self.patch = os.path.abspath(patch) if patchwork_id: self.patch = self._fetch_from_patchwork(patchwork_id) |
answer = raw_input("Would you like to revert them? (y/n) ") | answer = ask("Would you like to revert them?", auto=self.confirm) | def __init__(self, patch=None, patchwork_id=None): self.base_dir = os.getcwd() if patch: self.patch = os.path.abspath(patch) if patchwork_id: self.patch = self._fetch_from_patchwork(patchwork_id) |
logging.info("Would you like to add them to VCS ? (y/n/abort) ") answer = raw_input() | answer = ask("Would you like to add them to VCS ?") | def _check_files_modified_patch(self): untracked_files_after = self.vcs.get_unknown_files() modified_files_after = self.vcs.get_modified_files() add_to_vcs = [] for untracked_file in untracked_files_after: if untracked_file not in self.untracked_files_before: add_to_vcs.append(untracked_file) |
elif answer == "abort": sys.exit(1) | def _check_files_modified_patch(self): untracked_files_after = self.vcs.get_unknown_files() modified_files_after = self.vcs.get_modified_files() add_to_vcs = [] for untracked_file in untracked_files_after: if untracked_file not in self.untracked_files_before: add_to_vcs.append(untracked_file) | |
if local_patch: patch_checker = PatchChecker(patch=local_patch) elif id: patch_checker = PatchChecker(patchwork_id=id) | ignore_file_list = ['common.py'] if full_check: for root, dirs, files in os.walk('.'): if not '.svn' in root: for file in files: if file not in ignore_file_list: path = os.path.join(root, file) file_checker = FileChecker(path, confirm=confirm) file_checker.report() | def check(self): self.vcs.apply_patch(self.patch) self._check_files_modified_patch() |
logging.error('No patch or patchwork id specified. Aborting.') sys.exit(1) patch_checker.check() | if local_patch: patch_checker = PatchChecker(patch=local_patch, confirm=confirm) elif id: patch_checker = PatchChecker(patchwork_id=id, confirm=confirm) else: logging.error('No patch or patchwork id specified. Aborting.') sys.exit(1) patch_checker.check() | def check(self): self.vcs.apply_patch(self.patch) self._check_files_modified_patch() |
class FileFieldMonitor(): | class FileFieldMonitor: | def write_keyval(path, dictionary, type_tag=None): """ Write a key-value pair format file out to a file. This uses append mode to open the file, so existing text will not be overwritten or reparsed. If type_tag is None, then the key must be composed of alphanumeric characters (or dashes+underscores). However, if type-... |
class SystemLoad(): | class SystemLoad: | def get_cpu_percentage(function, *args, **dargs): """Returns a tuple containing the CPU% and return value from function call. This function calculates the usage time by taking the difference of the user and system times both before and after the function call. """ child_pre = resource.getrusage(resource.RUSAGE_CHILDRE... |
if site_overrides_path: | if os.path.exists(site_overrides_path): | def build_alert_hooks_from_path(patterns_path, warnfile): """ Same as build_alert_hooks, but accepts a path to a patterns file and automatically finds the corresponding site overrides file if one exists. """ dirname, basename = os.path.split(patterns_path) site_overrides_basename = 'site_' + basename + '_overrides' sit... |
global_control_vars = {'job': self} | global_control_vars = {'job': self, 'args': self.args} | def step_engine(self): """The multi-run engine used when the control file defines step_init. |
attributes): | attributes, labels): | def __init__(self, subdir, testname, status, reason, test_kernel, machine, started_time, finished_time, iterations, attributes): # for backwards compatibility with the original parser # implementation, if there is no test version we need a NULL # value to be used; also, if there is a version it should # be terminated b... |
attributes) | attributes, labels) | def __init__(self, subdir, testname, status, reason, test_kernel, machine, started_time, finished_time, iterations, attributes): # for backwards compatibility with the original parser # implementation, if there is no test version we need a NULL # value to be used; also, if there is a version it should # be terminated b... |
if parts[0] == self.device: | if parts[0] == self.device or parts[1] == self.mountpoint: | def get_mountpoint(self, open_func=open, filename=None): """ Find the mount point of this partition object. |
TLPFigure(self.figure, tlp_curve_data, title, leakage_evol) | self.fig = TLPFigure(self.figure, tlp_curve_data, title, leakage_evol) | def __init__(self, tlp_curve_data, title, leakage_evol=None, parent=None): MatplotlibFig.__init__(self, parent) self.figure.canvas.setFocusPolicy( QtCore.Qt.ClickFocus ) self.figure.canvas.setFocus() TLPFigure(self.figure, tlp_curve_data, title, leakage_evol) |
TLPPulsePickFigure(self.figure, raw_data) | self.fig = TLPPulsePickFigure(self.figure, raw_data) | def __init__(self, raw_data, title, parent=None): MatplotlibFig.__init__(self, parent) TLPPulsePickFigure(self.figure, raw_data) |
None, "Open %s data file"%self.importer_name, filter='%s (%s)'%(self.importer_name, self.file_ext)) | None, "Open %s data file"%self.importer_name, '', '%s (%s)'%(self.importer_name, self.file_ext)) | def __call__(self, file_name): self.file_name = QtGui.QFileDialog.getOpenFileName( None, "Open %s data file"%self.importer_name, filter='%s (%s)'%(self.importer_name, self.file_ext)) if self.file_name != "": self.start() |
experiment = self.importer.load(str(self.file_name)) | experiment = self.importer.load(unicode(self.file_name)) | def run(self): experiment = self.importer.load(str(self.file_name)) self.new_data_ready.emit(experiment, self.file_name) |
data_name = os.path.splitext(os.path.basename(str(file_name)))[0] | data_name = os.path.splitext(os.path.basename(unicode(file_name)))[0] | def add_new_experiment(self, experiment, file_name): data_name = os.path.splitext(os.path.basename(str(file_name)))[0] device_data_tab = DeviceDataTab() device_data_tab.addTab(TlpFigCanvas(experiment.raw_data.tlp_curve, experiment.exp_name), "TLP curve") device_data_tab.addTab(PulsesFigCanvas(experiment.raw_data.pulses... |
f = b['builder'].split('-', 3) goos = f[0] goarch = f[1] note = "" if len(f) > 2: note = f[2] builders[b['builder']] = {'goos': goos, 'goarch': goarch, 'note': note} | builders[b['builder']] = builderInfo(b['builder']) | def get(self): self.response.headers['Content-Type'] = 'text/html; charset=utf-8' |
r['shortdesc'] = r['desc'].split('\n', 2)[0] | def get(self): self.response.headers['Content-Type'] = 'text/html; charset=utf-8' | |
self.response.set_status(200) self.response.headers['Content-Type'] = 'application/json; charset=utf-8' self.response.out.write('{"benchmarks": [\n') first = True | builders = {} data = {} | def get(self): q = Benchmark.all() bs = q.fetch(10000) |
if not first: self.response.out.write(',"' + b.name + '"\n') else: self.response.out.write('"' + b.name + '"\n') first = False self.response.out.write(']}\n') | q = BenchmarkResult.all() q.ancestor(b) q.order('-__key__') results = q.fetch(10000) m = {} revs = {} for r in results: if r.builder not in m: m[r.builder] = {} m[r.builder][r.num] = r.nsperop revs[r.num] = 0 builders[r.builder] = 0 data[b.name] = m builders = list(builders.keys()) builders.sort() revs = list(revs.ke... | def get(self): q = Benchmark.all() bs = q.fetch(10000) |
b = Benchmark.get_or_insert(benchmark.encode('base64'), name = benchmark) r = BenchmarkResult(key_name = '%08x/builder' % n.num, parent = b, num = n.num, iterations = iterations, nsperop = time, builder = builder) | b = Benchmark.get_or_insert('v002.' + benchmark.encode('base64'), name = benchmark, version = 2) r = BenchmarkResult(key_name = '%08x/%s' % (n.num, builder), parent = b, num = n.num, iterations = iterations, nsperop = time, builder = builder) | def get_string(i): l, = struct.unpack('>H', i[:2]) s = i[2:2+l] if len(s) != l: return None, None return s, i[2+l:] |
key = "bench(%d)" % n.num memcache.delete(key) | def get_string(i): l, = struct.unpack('>H', i[:2]) s = i[2:2+l] if len(s) != l: return None, None return s, i[2+l:] | |
self.response.headers['Content-Type'] = 'application/json; charset=utf-8' benchmark = self.request.path[12:].decode('hex').encode('base64') b = Benchmark.get_by_key_name(benchmark) if b is None: | benchmark = self.request.path[12:] bm = Benchmark.get_by_key_name('v002.' + benchmark.encode('base64')) if bm is None: | def get(self): self.response.headers['Content-Type'] = 'application/json; charset=utf-8' benchmark = self.request.path[12:].decode('hex').encode('base64') |
q.ancestor(b) | q.ancestor(bm) | def get(self): self.response.headers['Content-Type'] = 'application/json; charset=utf-8' benchmark = self.request.path[12:].decode('hex').encode('base64') |
max = -1 min = 2000000000 | maxv = -1 minv = 2000000000 | def get(self): self.response.headers['Content-Type'] = 'application/json; charset=utf-8' benchmark = self.request.path[12:].decode('hex').encode('base64') |
if max < r.num: max = r.num if min > r.num: min = r.num | if maxv < r.num: maxv = r.num if minv > r.num: minv = r.num | def get(self): self.response.headers['Content-Type'] = 'application/json; charset=utf-8' benchmark = self.request.path[12:].decode('hex').encode('base64') |
res[b] = [[-1] * ((max - min) + 1), [-1] * ((max - min) + 1)] | res[b] = [[-1] * ((maxv - minv) + 1), [-1] * ((maxv - minv) + 1)] | def get(self): self.response.headers['Content-Type'] = 'application/json; charset=utf-8' benchmark = self.request.path[12:].decode('hex').encode('base64') |
res[r.builder][0][r.num - min] = r.iterations res[r.builder][1][r.num - min] = r.nsperop self.response.out.write(str(res)) | res[r.builder][0][r.num - minv] = r.iterations res[r.builder][1][r.num - minv] = r.nsperop minhash = node(minv).node maxhash = node(maxv).node if self.request.get('fmt') == 'json': self.response.headers['Content-Type'] = 'text/plain; charset=utf-8' self.response.out.write('{"min": "%s", "max": "%s", "data": {' % (minh... | def get(self): self.response.headers['Content-Type'] = 'application/json; charset=utf-8' benchmark = self.request.path[12:].decode('hex').encode('base64') |
b = { "node": c.node, "user": toUsername(c.user), "date": dateToShortStr(c.date), "desc": c.desc} b['builds'] = [parseBuild(build) for build in c.builds] return b | b = nodeInfo(c) b['builds'] = [parseBuild(build) for build in c.builds] return b | def toRev(c): b = { "node": c.node, "user": toUsername(c.user), "date": dateToShortStr(c.date), "desc": c.desc} b['builds'] = [parseBuild(build) for build in c.builds] return b |
other = hg.repository(cmdutil.remoteui(repo, opts), source) | try: remoteui = hg.remoteui except: remoteui = cmdutil.remoteui other = hg.repository(remoteui(repo, opts), source) | def getremote(ui, repo, opts): # save $http_proxy; creating the HTTP repo object will # delete it in an attempt to "help" proxy = os.environ.get('http_proxy') source = hg.parseurl(ui.expandpath("default"), None)[0] other = hg.repository(cmdutil.remoteui(repo, opts), source) if proxy is not None: os.environ['http_proxy'... |
self.base_rev = RunShell(["hg", "parent", "-q"]).split(':')[1].strip() | self.base_rev = RunShell(["hg", "parents", "-q"]).split(':')[1].strip() | def __init__(self, options, repo_dir): super(MercurialVCS, self).__init__(options) # Absolute path to repository (we can be in a subdir) self.repo_dir = os.path.normpath(repo_dir) # Compute the subdir cwd = os.path.normpath(os.getcwd()) assert cwd.startswith(self.repo_dir) self.subdir = cwd[len(self.repo_dir):].lstrip(... |
StatusThread().start() | t = StatusThread() t.setDaemon(True) t.start() | def start_status_thread(): StatusThread().start() |
pass | return | def RietveldSetup(ui, repo): global defaultcc, upload_options, rpc, server, server_url_base, force_google_account, verbosity, contributors # Read repository-specific options from lib/codereview/codereview.cfg try: f = open(repo.root + '/lib/codereview/codereview.cfg') for line in f: if line.startswith('defaultcc: '): ... |
text = sum.findtext("", None).strip() | text = sum.text.strip() | def IsRietveldSubmitted(ui, clname, hex): feed = XMLGet(ui, "/rss/issue/" + clname) if feed is None: return False for sum in feed.findall("{http://www.w3.org/2005/Atom}entry/{http://www.w3.org/2005/Atom}summary"): text = sum.findtext("", None).strip() m = re.match('\*\*\* Submitted as [^*]*?([0-9a-f]+) \*\*\*', text) i... |
nick = author.findtext("", None).strip() | nick = author.text.strip() | def DownloadCL(ui, repo, clname): set_status("downloading CL " + clname) cl, err = LoadCL(ui, repo, clname) if err != "": return None, None, "error loading CL %s: %s" % (clname, ExceptionDetail()) # Grab RSS feed to learn about CL feed = XMLGet(ui, "/rss/issue/" + clname) if feed is None: return None, None, "cannot do... |
if ui.prompt("error parsing change list: line %d: %s\nre-edit (y/n)?" % (line, err), ["&yes", "&no"], "y") == "n": | if not promptyesno(ui, "error parsing change list: line %d: %s\nre-edit (y/n)?" % (line, err)): | def EditCL(ui, repo, cl): s = cl.EditorText() while True: s = ui.edit(s, ui.username()) clx, line, err = ParseCL(s, cl.name) if err != '': if ui.prompt("error parsing change list: line %d: %s\nre-edit (y/n)?" % (line, err), ["&yes", "&no"], "y") == "n": return "change list not modified" continue cl.desc = clx.desc; cl.... |
if ui.prompt("change list should have description\nre-edit (y/n)?", ["&yes", "&no"], "y") != "n": | if promptyesno(ui, "change list should have description\nre-edit (y/n)?"): | def EditCL(ui, repo, cl): s = cl.EditorText() while True: s = ui.edit(s, ui.username()) clx, line, err = ParseCL(s, cl.name) if err != '': if ui.prompt("error parsing change list: line %d: %s\nre-edit (y/n)?" % (line, err), ["&yes", "&no"], "y") == "n": return "change list not modified" continue cl.desc = clx.desc; cl.... |
(sep, builder, str(iter).replace("L", ""), str(nsperop).replace("L", ""))) | (sep, builder, str(iter).replace("L", ""), str(ns).replace("L", ""))) | def get(self): benchmark = self.request.path[12:] minr, maxr, bybuilder = benchmark_data(benchmark) minhash = node(minr).node maxhash = node(maxr).node |
data = memcache.get('view-project-data') | cache_key = 'view-project-data' tag = self.request.get('tag', None) if tag: cache_key += '-'+tag data = memcache.get(cache_key) | def list(self, additional_data={}): data = memcache.get('view-project-data') admin = users.is_current_user_admin() if admin or not data: projects = Project.all().order('category').order('name') if not admin: projects = projects.filter('approved =', True) projects = list(projects) |
tag = self.request.get('tag', None) | def list(self, additional_data={}): data = memcache.get('view-project-data') admin = users.is_current_user_admin() if admin or not data: projects = Project.all().order('category').order('name') if not admin: projects = projects.filter('approved =', True) projects = list(projects) | |
memcache.set('view-project-data', data, time=CacheTimeout) | memcache.set(cache_key, data, time=CacheTimeout) | def list(self, additional_data={}): data = memcache.get('view-project-data') admin = users.is_current_user_admin() if admin or not data: projects = Project.all().order('category').order('name') if not admin: projects = projects.filter('approved =', True) projects = list(projects) |
fixedtotal = structsize(self.fields) if fixedtotal <= 32: go(' b := c.scratch[0:%d]', fixedtotal) else: go(' b := make([]byte, %d)', fixedtotal) | fixedlength = math.ceil(float(structsize(self.fields)) / float(4)) fixedsize = fixedlength * 4 if fixedsize <= 32: go(' b := c.scratch[0:%d]', fixedsize) else: go(' b := make([]byte, %d)', fixedsize) | def go_complex_writer(self, name, void): func_name = self.c_request_name param_fields = [] wire_fields = [] for field in self.fields: if field.visible: # _len is taken from the list directly if not field.field_name.endswith("_len"): # The field should appear as a call parameter param_fields.append(field) if field.wire... |
go(' n := %d', fixedtotal) | go(' n := %d', fixedsize) | def go_complex_writer(self, name, void): func_name = self.c_request_name param_fields = [] wire_fields = [] for field in self.fields: if field.visible: # _len is taken from the list directly if not field.field_name.endswith("_len"): # The field should appear as a call parameter param_fields.append(field) if field.wire... |
go(' put16(b[2:], %d)', fixedtotal / 4) | go(' put16(b[2:], %d)', fixedlength) | def go_complex_writer(self, name, void): func_name = self.c_request_name param_fields = [] wire_fields = [] for field in self.fields: if field.visible: # _len is taken from the list directly if not field.field_name.endswith("_len"): # The field should appear as a call parameter param_fields.append(field) if field.wire... |
base_content = str(self.repo[base_rev][filename].data()) | base_content = str(self.repo[base_rev][oldrelpath].data()) | def GetBaseFile(self, filename): set_status("inspecting " + filename) # "hg status" and "hg cat" both take a path relative to the current subdir # rather than to the repo root, but "hg diff" has given us the full path # to the repo root. base_content = "" new_content = None is_binary = False oldrelpath = relpath = self... |
rows = [{"name": bm, "builds": [{"url": ""} for b in builders]} for bm in benchmarks] for i in range(len(rows)): benchmark = benchmarks[i] builds = rows[i]["builds"] minr, maxr, bybuilder = benchmark_data(benchmark) for j in range(len(builders)): builder = builders[j] cell = builds[j] if len(bybuilder) > 0 and builder... | rows = [] for bm in benchmarks: row = {'name':bm, 'builders': []} for bl in builders: key = "single-%s-%s" % (bm, bl) url = memcache.get(key) row['builders'].append({'name': bl, 'url': url}) rows.append(row) | def compute(self, num): benchmarks, builders = benchmark_list() # Build empty grid, to be filled in. rows = [{"name": bm, "builds": [{"url": ""} for b in builders]} for bm in benchmarks] |
"benchmarks": rows, "builders": [builderInfo(b) for b in builders] | "builders": [builderInfo(b) for b in builders], "rows": rows, | def compute(self, num): benchmarks, builders = benchmark_list() # Build empty grid, to be filled in. rows = [{"name": bm, "builds": [{"url": ""} for b in builders]} for bm in benchmarks] |
url = "http://chart.apis.google.com/chart?cht=ls&chd=s:"+s | url = "http://chart.apis.google.com/chart?cht=ls&chd=s:"+s+"&chs=80x20&chf=bg,s,00000000&chco=000000ff&chls=1,1,0" | def benchmark_sparkline(ns): valid = [x for x in ns if x >= 0] if not valid: return "" m = max(max(valid), 2*sum(valid)/len(valid)) # Encoding is 0-61, which is fine enough granularity for our tiny graphs. _ means missing. encoding = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" s = ''.join([x < 0 a... |
benchmarks = [r.benchmark for r in q.fetch(1000)] | benchmarks = [r.benchmark for r in q] | def benchmark_list(): q = BenchmarkResults.all() q.order('__key__') q.filter('builder = ', u'darwin-amd64') benchmarks = [r.benchmark for r in q.fetch(1000)] q = BenchmarkResults.all() q.order('__key__') q.filter('benchmark =', u'math_test.BenchmarkSqrt') builders = [r.builder for r in q.fetch(100)] return benchmarks... |
builders = [r.builder for r in q.fetch(100)] | builders = [r.builder for r in q.fetch(20)] | def benchmark_list(): q = BenchmarkResults.all() q.order('__key__') q.filter('builder = ', u'darwin-amd64') benchmarks = [r.benchmark for r in q.fetch(1000)] q = BenchmarkResults.all() q.order('__key__') q.filter('benchmark =', u'math_test.BenchmarkSqrt') builders = [r.builder for r in q.fetch(100)] return benchmarks... |
def write(self, s): self.output += s | def write(self, *args, **opts): self.output += ' '.join(args) | def write(self, s): self.output += s |
self.__key_trans = key_trans if key_trans != None else lambda k: k | self.__key_trans = key_trans if key_trans is not None else lambda k: k | def __init__(self, pmap, g, key_type, key_trans=None): self.__map = pmap self.__g = weakref.ref(g) self.__key_type = key_type self.__key_trans = key_trans if key_trans != None else lambda k: k self.__register_map() |
self.__map[self.__key_trans(k)] = v | try: self.__map[self.__key_trans(k)] = v except TypeError: valtype = self.python_value_type() if isistance(valtype, tuple): val = [valtype[1](x) for x in v] else: val = valtype(v) self.__map[self.__key_trans(k)] = val | def __setitem__(self, k, v): self.__map[self.__key_trans(k)] = v |
if self.get_array() != None: | if self.get_array() is not None: | def __get_array(self): if self.get_array() != None: return self.get_array()[:] else: return None |
The algorithm used is described in [ullman-algorithm-1976]. It has worse-case complexity of :math:`O(N_{\text{g}}^{N_\text{sub}})`, but for random graphs it typically has a complexity of :math:`O(N_{\text{g}}^\gamma)` with :math:`\gamma` depending sub-linearly on the size of `sub`. | The algorithm used is described in [ullmann-algorithm-1976]. It has worse-case complexity of :math:`O(N_g^{N_{sub}})`, but for random graphs it typically has a complexity of :math:`O(N_g^\gamma)` with :math:`\gamma` depending sub-linearly on the size of `sub`. | def subgraph_isomorphism(sub, g): r""" Obtain all subgraph isomorphisms of `sub` in `g`. It returns two lists, containing the vertex and edge property maps for `sub` with the isomorphism mappings. The value of the properties are the vertex/edge index of the corresponding vertex/edge in `g`. Examples -------- >>> from... |
.. [ullman-algorithm-1976] Ullmann, J. R., "An algorithm for subgraph | .. [ullmann-algorithm-1976] Ullmann, J. R., "An algorithm for subgraph | def subgraph_isomorphism(sub, g): r""" Obtain all subgraph isomorphisms of `sub` in `g`. It returns two lists, containing the vertex and edge property maps for `sub` with the isomorphism mappings. The value of the properties are the vertex/edge index of the corresponding vertex/edge in `g`. Examples -------- >>> from... |
... [subgraph-isormophism-wikipedia] http://en.wikipedia.org/wiki/Subgraph_isomorphism_problem | .. [subgraph-isormophism-wikipedia] http://en.wikipedia.org/wiki/Subgraph_isomorphism_problem | def subgraph_isomorphism(sub, g): r""" Obtain all subgraph isomorphisms of `sub` in `g`. It returns two lists, containing the vertex and edge property maps for `sub` with the isomorphism mappings. The value of the properties are the vertex/edge index of the corresponding vertex/edge in `g`. Examples -------- >>> from... |
self.__graph.SetVertexFilterProperty(None) | self.set_vertex_filter(None) | def purge_vertices(self): """Remove all vertices of the graph which are currently being filtered out, and return it to the unfiltered state.""" self.__graph.PurgeVertices() self.__graph.SetVertexFilterProperty(None) |
self.__graph.SetEdgeFilterProperty(None) | self.set_edge_filter(None) | def purge_edges(self): """Remove all edges of the graph which are currently being filtered out, and return it to the unfiltered state.""" self.__graph.PurgeEdges() self.__graph.SetEdgeFilterProperty(None) |
g.set_vertex_filter(e_filter) | g.set_vertex_filter(v_filter) | def _edge_repr(self): if not self.is_valid(): return "<invalid Edge object at 0x%x>" % (id(self)) return ("<Edge object with source '%d' and target '%d'"+ " at 0x%x>") % (int(self.source()), int(self.target()), id(self)) |
n = self.__g().num_edges() | n = self.__g()._Graph__graph.GetMaxEdgeIndex() + 1 | def get_array(self): """Get an array with property values. |
props = self.__graph.ReadFromFile("", file_name, format) | props = self.__graph.ReadFromFile("", file_name, file_format) | def load(self, file_name, file_format="auto"): """Load graph from ``file_name`` (which can be either a string or a file-like object). The format is guessed from ``file_name``, or can be specified by ``file_format``, which can be either "xml" or "dot". """ |
args_call = inspect.formatargspec(argspec[0]) argspec = inspect.formatargspec(argspec[0], defaults=argspec[3]) | ___wrap_defaults = defaults = argspec[-1] if defaults is not None: def_string = ["___wrap_defaults[%d]" % d for d in xrange(len(defaults))] def_names = argspec[0][-len(defaults):] else: def_string = None def_names = None args_call = inspect.formatargspec(argspec[0], defaults=def_names) argspec = inspect.formatargspec(a... | def decorate(f): argspec = inspect.getargspec(func) args_call = inspect.formatargspec(argspec[0]) argspec = inspect.formatargspec(argspec[0], defaults=argspec[3]) argspec = argspec.lstrip("(").rstrip(")") wrap = eval("lambda %s: f%s" % (argspec, args_call), locals()) return functools.wraps(func)(wrap) |
wrap = eval("lambda %s: f%s" % (argspec, args_call), locals()) return functools.wraps(func)(wrap) | wf = "def %s(%s):\n return f%s\n" % \ (func.__name__, argspec, args_call) if def_string is not None: for d in def_string: wf = wf.replace("'%s'" % d, "%s" % d) for d in def_names: wf = wf.replace("'%s'" % d, "%s" % d) exec wf in locals() return functools.wraps(func)(locals()[func.__name__]) | def decorate(f): argspec = inspect.getargspec(func) args_call = inspect.formatargspec(argspec[0]) argspec = inspect.formatargspec(argspec[0], defaults=argspec[3]) argspec = argspec.lstrip("(").rstrip(")") wrap = eval("lambda %s: f%s" % (argspec, args_call), locals()) return functools.wraps(func)(wrap) |
zip_cmd = "7za a \"%s\" nonlocalized" % self.build | zip_cmd = "%s a \"%s\" nonlocalized" % (SEVENZIP_BIN, self.build) | def repackBuild(self): zip_cmd = "7za a \"%s\" nonlocalized" % self.build shellCommand(zip_cmd) |
if "win32" in options.platforms and not which("7za"): print "Error: couldn't find the 7za executable in PATH." | if "win32" in options.platforms and not which(SEVENZIP_BIN): print "Error: couldn't find the %s executable in PATH." % SEVENZIP_BIN error = True if "win32" in options.platforms and \ options.use_signed and \ not which(UPX_BIN): print "Error: couldn't find the %s executable in PATH." % UPX_BIN | def doRepack(self): self.announceStart() os.chdir(self.working_dir) self.unpackBuild() self.copyFiles() self.mungeControl() self.repackBuild() self.cleanup() os.chdir(self.base_dir) |
win32_candidates_web_dir = candidates_web_dir + '/unsigned' | if options.use_signed: win32_candidates_web_dir = candidates_web_dir else: win32_candidates_web_dir = candidates_web_dir + '/unsigned' | def doRepack(self): self.announceStart() os.chdir(self.working_dir) self.unpackBuild() self.copyFiles() self.mungeControl() self.repackBuild() self.cleanup() os.chdir(self.base_dir) |
wget_cmd = "wget -q \"%s\"" % original_build_url shellCommand(wget_cmd) | retrieveFile(original_build_url, filename) | def doRepack(self): self.announceStart() os.chdir(self.working_dir) self.unpackBuild() self.copyFiles() self.mungeControl() self.repackBuild() self.cleanup() os.chdir(self.base_dir) |
return "maemo" | return platform | def getFormattedPlatform(platform): '''Returns the platform in the format used in building package names. ''' if isLinux(platform): return "linux-i686" if isMac(platform): return "mac" if isWin(platform): return "win32" if isMaemo(platform): return "maemo" return None |
self.platform = "maemo" | def __init__(self, build, partner_dir, build_dir, working_dir, final_dir, repack_info, sbox_path=SBOX_PATH, sbox_home=SBOX_HOME): super(RepackMaemo, self).__init__(build, partner_dir, build_dir, working_dir, final_dir, repack_info) self.platform = "maemo" self.sbox_path = sbox_path self.sbox_home = sbox_home self.tmpdi... | |
cp_cmd = "cp %s/* %s/opt/mozilla/[a-z\-\.0-9]*/defaults/preferences/" % \ | cp_cmd = "cp %s/* %s/opt/mozilla/[a-z\-\.0-9]*/defaults/pref/" % \ | def copyFiles(self): full_path = "%s/preferences" % self.full_partner_path if os.path.exists(full_path): cp_cmd = "cp %s/* %s/opt/mozilla/[a-z\-\.0-9]*/defaults/preferences/" % \ (full_path, self.tmpdir) shellCommand(cp_cmd) |
'maemo': RepackMaemo | 'maemo4': RepackMaemo, 'maemo5-gtk': RepackMaemo | def doRepack(self): self.announceStart() os.chdir(self.working_dir) self.unpackBuild() self.copyFiles() self.mungeControl() self.repackBuild() self.cleanup() os.chdir(self.base_dir) |
pkg_cmd = "pkg-dmg --source stage/ --target \"%s\" --volname 'Firefox' --icon stage/.VolumeIcon.icns --symlink '/Applications':' '" % self.build | pkg_cmd = "%s --source stage/ --target \"%s\" --volname 'Firefox' --icon stage/.VolumeIcon.icns --symlink '/Applications':' '" % (options.pkg_dmg, self.build) | def repackBuild(self): pkg_cmd = "pkg-dmg --source stage/ --target \"%s\" --volname 'Firefox' --icon stage/.VolumeIcon.icns --symlink '/Applications':' '" % self.build shellCommand(pkg_cmd) |
if not which("pkg-dmg"): | if not which(options.pkg_dmg): | def repackBuild(self): zip_cmd = "7za a \"%s\" nonlocalized" % self.build shellCommand(zip_cmd) |
(STAGING_SERVER, | (options.staging_server, | def repackBuild(self): zip_cmd = "7za a \"%s\" nonlocalized" % self.build shellCommand(zip_cmd) |
if isLinux(key) or isMac(key) or isWin(key) or isMaemo(key): if key in platforms and value == 'true': config['platforms'].append(key) continue | def parseRepackConfig(file, platforms): config = {} config['platforms'] = [] f= open(file, 'r') for line in f: line = line.rstrip("\n") [key, value] = line.split('=',2) value = value.strip('"') if key == 'dist_id': config['dist_id'] = value continue if key == 'locales': config['locales'] = value.split(' ') continue if... | |
repack_info): | platform_formatted, repack_info): | def __init__(self, build, partner_dir, build_dir, working_dir, final_dir, repack_info): self.base_dir = os.getcwd() self.build = build self.full_build_path = "%s/%s/%s" % (self.base_dir, build_dir, build) self.full_partner_path = "%s/%s" % (self.base_dir, partner_dir) self.working_dir = working_dir self.final_dir = fin... |
self.platform = None | def __init__(self, build, partner_dir, build_dir, working_dir, final_dir, repack_info): self.base_dir = os.getcwd() self.build = build self.full_build_path = "%s/%s/%s" % (self.base_dir, build_dir, build) self.full_partner_path = "%s/%s" % (self.base_dir, partner_dir) self.working_dir = working_dir self.final_dir = fin... | |
print " | print " self.build) def announceSuccess(self): print " self.build) print | def announceStart(self): print "### Repacking %s build %s" % (self.platform, self.build) |
repack_info): super(RepackLinux, self).__init__(build, partner_dir, build_dir, working_dir, final_dir, repack_info) self.platform = "linux" | platform_formatted, repack_info): super(RepackLinux, self).__init__(build, partner_dir, build_dir, working_dir, final_dir, platform_formatted, repack_info) | def __init__(self, build, partner_dir, build_dir, working_dir, final_dir, repack_info): super(RepackLinux, self).__init__(build, partner_dir, build_dir, working_dir, final_dir, repack_info) self.platform = "linux" self.uncompressed_build = build.replace('.bz2','') |
tar_cmd = "tar rvf %s firefox" % self.uncompressed_build | if options.quiet: tar_flags = "rf" else: tar_flags = "rvf" tar_cmd = "tar %s %s firefox" % (tar_flags, self.uncompressed_build) | def repackBuild(self): tar_cmd = "tar rvf %s firefox" % self.uncompressed_build shellCommand(tar_cmd) bzip2_command = "bzip2 %s" % self.uncompressed_build shellCommand(bzip2_command) |
repack_info): super(RepackMac, self).__init__(build, partner_dir, build_dir, working_dir, final_dir, repack_info) self.platform = "mac" | platform_formatted, repack_info): super(RepackMac, self).__init__(build, partner_dir, build_dir, working_dir, final_dir, platform_formatted, repack_info) | def __init__(self, build, partner_dir, build_dir, working_dir, final_dir, repack_info): super(RepackMac, self).__init__(build, partner_dir, build_dir, working_dir, final_dir, repack_info) self.platform = "mac" self.mountpoint = "/tmp/FirefoxInstaller" |
attach_cmd = "hdiutil attach -mountpoint %s -readonly -private -noautoopen \"%s\"" % (self.mountpoint, self.full_build_path) | if options.quiet: quiet_flag = "-quiet" else: quiet_flag = "" attach_cmd = "hdiutil attach -mountpoint %s -readonly -private %s -noautoopen \"%s\"" % (self.mountpoint, quiet_flag, self.full_build_path) | def unpackBuild(self): mkdir(self.mountpoint) |
eject_cmd = "hdiutil eject %s" % self.mountpoint | eject_cmd = "hdiutil eject %s %s" % (quiet_flag, self.mountpoint) | def unpackBuild(self): mkdir(self.mountpoint) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.