rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
setattr(F,"valid min","%.2g" % (val-2*std)) | if numpy.allclose(std,0.): std=val*.005 setattr(F,"valid min","%.4g" % (val-2*std)) | def process_template(tmpl,cnames,cols,voids={},minmax={}): F = genutil.StringConstructor(tmpl) keys = F.keys() match = 0 for c in cnames: if c in keys: match+=1 indx = cnames.index(c) |
setattr(F,"valid max","%.2g" % (val+2*std)) | if numpy.allclose(std,0.): std=val*.005 setattr(F,"valid max","%.4g" % (val+2*std)) | def process_template(tmpl,cnames,cols,voids={},minmax={}): F = genutil.StringConstructor(tmpl) keys = F.keys() match = 0 for c in cnames: if c in keys: match+=1 indx = cnames.index(c) |
setattr(F,"mean absolute min","%.2g" % (val-2*std)) | if numpy.allclose(std,0.): std=val*.005 setattr(F,"mean absolute min","%.4g" % (val-2*std)) | def process_template(tmpl,cnames,cols,voids={},minmax={}): F = genutil.StringConstructor(tmpl) keys = F.keys() match = 0 for c in cnames: if c in keys: match+=1 indx = cnames.index(c) |
setattr(F,"mean absolute max","%.2g" % (val+2*std)) | if numpy.allclose(std,0.): std=val*.005 setattr(F,"mean absolute max","%.4g" % (val+2*std)) | def process_template(tmpl,cnames,cols,voids={},minmax={}): F = genutil.StringConstructor(tmpl) keys = F.keys() match = 0 for c in cnames: if c in keys: match+=1 indx = cnames.index(c) |
create_table(sys.argv[1],dims_table) | create_table(sys.argv[1],dims_table,minmax=minmax) | def create_table(table_file, dims_file,minmax={}): tables = {} foundnm= False D = open(table_file) dlines = D.readlines() ivar = -2 if len(dlines)==1: dlines = dlines[0].split('\r') #This bit insert a table dlines2=[] for i in range(len(dlines)): if dlines[i].find("include Amon 2D")>-1: f=open("Tables_csv/Amon_2D.csv")... |
import pickle f=open("Tables_csv/minmax.pickled") minmax = pickle.load(f) | def create_table(table_file, dims_file,minmax={}): tables = {} foundnm= False D = open(table_file) dlines = D.readlines() ivar = -2 if len(dlines)==1: dlines = dlines[0].split('\r') #This bit insert a table dlines2=[] for i in range(len(dlines)): if dlines[i].find("include Amon 2D")>-1: f=open("Tables_csv/Amon_2D.csv")... | |
netcdf_file_action = cmor.CMOR_REPLACE_3) cmor.dataset('pre-industrial control', 'ukmo', 'HadCM3', '360_day', | netcdf_file_action = cmor.CMOR_REPLACE) cmor.dataset('pre-industrial control', 'mohc', 'HadGEM2: source', '360_day', | def main(): cmor.setup(inpath='Tables', netcdf_file_action = cmor.CMOR_REPLACE_3) cmor.dataset('pre-industrial control', 'ukmo', 'HadCM3', '360_day', institute_id = 'ukmo', model_id = 'HadCM3', history = 'some global history', forcing = 'N/A', parent_experiment_id = 'N/A', branch_time = 0., contact = 'bob') table = '... |
model_id = 'HadCM3', | model_id = 'HadGEM2', | def main(): cmor.setup(inpath='Tables', netcdf_file_action = cmor.CMOR_REPLACE_3) cmor.dataset('pre-industrial control', 'ukmo', 'HadCM3', '360_day', institute_id = 'ukmo', model_id = 'HadCM3', history = 'some global history', forcing = 'N/A', parent_experiment_id = 'N/A', branch_time = 0., contact = 'bob') table = '... |
table = 'CMIP5_Amon' | table = 'CMIP5_6hrLev' | def main(): cmor.setup(inpath='Tables', netcdf_file_action = cmor.CMOR_REPLACE_3) cmor.dataset('pre-industrial control', 'ukmo', 'HadCM3', '360_day', institute_id = 'ukmo', model_id = 'HadCM3', history = 'some global history', forcing = 'N/A', parent_experiment_id = 'N/A', branch_time = 0., contact = 'bob') table = '... |
axes = [ {'table_entry': 'time', | axes = [ {'table_entry': 'time1', | def main(): cmor.setup(inpath='Tables', netcdf_file_action = cmor.CMOR_REPLACE_3) cmor.dataset('pre-industrial control', 'ukmo', 'HadCM3', '360_day', institute_id = 'ukmo', model_id = 'HadCM3', history = 'some global history', forcing = 'N/A', parent_experiment_id = 'N/A', branch_time = 0., contact = 'bob') table = '... |
values = numpy.array([1.], numpy.float32)+200 | values = numpy.array([0.,0.], numpy.float32) numpy.reshape(values, (2,1,1,1)) | def main(): cmor.setup(inpath='Tables', netcdf_file_action = cmor.CMOR_REPLACE_3) cmor.dataset('pre-industrial control', 'ukmo', 'HadCM3', '360_day', institute_id = 'ukmo', model_id = 'HadCM3', history = 'some global history', forcing = 'N/A', parent_experiment_id = 'N/A', branch_time = 0., contact = 'bob') table = '... |
for var, units, positive in (('ts', 'K', ''), ('rsut', 'W m-2', 'up'), ('rlut', 'W m-2', 'down'),): varid = cmor.variable(var, units, axis_ids, history = 'variable history', missing_value = -99, positive = positive ) cmor.write(varid, values, time_vals = [15], time_bnds = [ [0,30] ]) | print 'cmor.axis calls complete' cmor.zfactor(axis_ids[3], 'b', '', axis_ids[3:4], 'd', [0., 0.5], [[0., 0.25], [0.25, 1.]]) cmor.zfactor(axis_ids[3], 'orog', 'm', axis_ids[1:3], 'd', [[0.]]) print 'cmor.zfactor calls complete' varid = cmor.variable('ua', 'm s-1', axis_ids, missing_value = -99 ) print 'cmor.variable ... | def main(): cmor.setup(inpath='Tables', netcdf_file_action = cmor.CMOR_REPLACE_3) cmor.dataset('pre-industrial control', 'ukmo', 'HadCM3', '360_day', institute_id = 'ukmo', model_id = 'HadCM3', history = 'some global history', forcing = 'N/A', parent_experiment_id = 'N/A', branch_time = 0., contact = 'bob') table = '... |
e[entry_type][entry]=getattr(e[entry_type],entry,{}) | e[entry_type][entry]=e[entry_type].get(entry,{}) | def readTable(table): lists_kw=['requested','bounds_requested','z_factors','z_bounds_requested','dimensions','required','ignored','optional'] f=open(table,'r') import hashlib m5=hashlib.md5(f.read()) m5=m5.hexdigest() f.seek(0) ln=f.readlines() f.close() header=1 gen_attributes={'actual_md5':m5} while header: l = ln.po... |
tbl_id = getattr(file,'table_id').split()[1] tbl_date= getattr(file,'table_id').split('(')[1].split(')')[0].strip() ttbl_id = e['general'].get("table_id").split()[1] ttbl_date = e['general'].get("table_date").strip() if tbl_date!=ttbl_date: nwarn+=1 ncheck+=1 manageLog(fout,cmor.CMOR_WARNING,"File says table date was ... | try: tmp_tbl_nm = getattr(file,'table_id') tbl_id = tmp_tbl_nm.split()[1] tbl_date= tmp_tbl_nm.split('(')[1].split(')')[0].strip() ttbl_id = e['general'].get("table_id").split()[1] ttbl_date = e['general'].get("table_date").strip() if tbl_date!=ttbl_date: nwarn+=1 ncheck+=1 manageLog(fout,cmor.CMOR_WARNING,"File says t... | def checkCMOR(fout,file,table,noerror=cmor.CMOR_CRITICAL,variable=None,from_bounds=None,other_tables=None,dodrs=True): req_glbl_att = ['title','Conventions','source','experiment','source','institution','project_id','table_id','realization',] opt_glbl_att = ['cmor_version','history','references','comment','parent_exper... |
if len(dates[0])<10: nerr+=manageLog(fout, noerror, 'your file name indicates a start time with years, months and days only when the approximate interval says it should have hours') | if len(dates[0])<12: nerr+=manageLog(fout, noerror, 'your file name indicates a start time with years, months, days and hours only when the approximate interval says it should have minutes') | def checkCMOR(fout,file,table,noerror=cmor.CMOR_CRITICAL,variable=None,from_bounds=None,other_tables=None,dodrs=True): req_glbl_att = ['title','Conventions','source','experiment','source','institution','project_id','table_id','realization',] opt_glbl_att = ['cmor_version','history','references','comment','parent_exper... |
else: h0= ft0.hour if interval < 3000: if len(dates[0])<12: nerr+=manageLog(fout, noerror, 'your file name indicates a start time with years, months, days and hours only when the approximate interval says it should have minutes') | def checkCMOR(fout,file,table,noerror=cmor.CMOR_CRITICAL,variable=None,from_bounds=None,other_tables=None,dodrs=True): req_glbl_att = ['title','Conventions','source','experiment','source','institution','project_id','table_id','realization',] opt_glbl_att = ['cmor_version','history','references','comment','parent_exper... | |
else: | else: h0= ft0.hour | def checkCMOR(fout,file,table,noerror=cmor.CMOR_CRITICAL,variable=None,from_bounds=None,other_tables=None,dodrs=True): req_glbl_att = ['title','Conventions','source','experiment','source','institution','project_id','table_id','realization',] opt_glbl_att = ['cmor_version','history','references','comment','parent_exper... |
if interval < 50: | if interval < 3000: | def checkCMOR(fout,file,table,noerror=cmor.CMOR_CRITICAL,variable=None,from_bounds=None,other_tables=None,dodrs=True): req_glbl_att = ['title','Conventions','source','experiment','source','institution','project_id','table_id','realization',] opt_glbl_att = ['cmor_version','history','references','comment','parent_exper... |
if max-min<6.3: | if 0.<max-min<6.3: | def checkCMOR(fout,file,table,noerror=cmor.CMOR_CRITICAL,variable=None,from_bounds=None,other_tables=None,dodrs=True): req_glbl_att = ['title','Conventions','source','experiment','source','institution','project_id','table_id','realization',] opt_glbl_att = ['cmor_version','history','references','comment','parent_exper... |
if max-min<3.2: | if 0.<max-min<3.2: | def checkCMOR(fout,file,table,noerror=cmor.CMOR_CRITICAL,variable=None,from_bounds=None,other_tables=None,dodrs=True): req_glbl_att = ['title','Conventions','source','experiment','source','institution','project_id','table_id','realization',] opt_glbl_att = ['cmor_version','history','references','comment','parent_exper... |
noerror=True | noerror=cmor.CMOR_CRITICAL | def checkCMOR(fout,file,table,noerror=cmor.CMOR_CRITICAL,variable=None,from_bounds=None,other_tables=None,dodrs=True): req_glbl_att = ['title','Conventions','source','experiment','source','institution','project_id','table_id','realization',] opt_glbl_att = ['cmor_version','history','references','comment','parent_exper... |
noerror=False | noerror=cmor.VERBOSE | def checkCMOR(fout,file,table,noerror=cmor.CMOR_CRITICAL,variable=None,from_bounds=None,other_tables=None,dodrs=True): req_glbl_att = ['title','Conventions','source','experiment','source','institution','project_id','table_id','realization',] opt_glbl_att = ['cmor_version','history','references','comment','parent_exper... |
if noerror: | if noerror==VERBOSE: | def checkCMOR(fout,file,table,noerror=cmor.CMOR_CRITICAL,variable=None,from_bounds=None,other_tables=None,dodrs=True): req_glbl_att = ['title','Conventions','source','experiment','source','institution','project_id','table_id','realization',] opt_glbl_att = ['cmor_version','history','references','comment','parent_exper... |
if nm in [ 'alevel','olevel','zlevel']: | if nm in [ 'zlevel',]+e['general'].get('generic_levels','').split(): | def checkCMOR(fout,file,table,noerror=cmor.CMOR_CRITICAL,variable=None,from_bounds=None,other_tables=None,dodrs=True): req_glbl_att = ['title','Conventions','source','experiment','source','institution','project_id','table_id','realization',] opt_glbl_att = ['cmor_version','history','references','comment','parent_exper... |
std=val*.005 setattr(F,"valid min","%.4g" % (val-2*std)) | std=val*pmean setattr(F,"valid min","%.4g" % (val-nstd*std)) | def process_template(tmpl,cnames,cols,voids={},minmax={}): F = genutil.StringConstructor(tmpl) keys = F.keys() match = 0 for c in cnames: if c in keys: match+=1 indx = cnames.index(c) |
std=val*.005 setattr(F,"valid max","%.4g" % (val+2*std)) | std=val*pmean setattr(F,"valid max","%.4g" % (val+nstd*std)) | def process_template(tmpl,cnames,cols,voids={},minmax={}): F = genutil.StringConstructor(tmpl) keys = F.keys() match = 0 for c in cnames: if c in keys: match+=1 indx = cnames.index(c) |
std=val*.005 setattr(F,"mean absolute min","%.4g" % (val-2*std)) | std=val*pmean setattr(F,"mean absolute min","%.4g" % (val-nstd*std)) | def process_template(tmpl,cnames,cols,voids={},minmax={}): F = genutil.StringConstructor(tmpl) keys = F.keys() match = 0 for c in cnames: if c in keys: match+=1 indx = cnames.index(c) |
std=val*.005 setattr(F,"mean absolute max","%.4g" % (val+2*std)) | std=val*pmean setattr(F,"mean absolute max","%.4g" % (val+nstd*std)) | def process_template(tmpl,cnames,cols,voids={},minmax={}): F = genutil.StringConstructor(tmpl) keys = F.keys() match = 0 for c in cnames: if c in keys: match+=1 indx = cnames.index(c) |
if has_variable_attribute(name): | if has_variable_attribute(var_id,name): | def get_variable_attribute(var_id,name): """Gets an attribute from a cmor variable Usage: cmor.get_variable_attribute(name) Where: var_id: is cmor variable id name: is the name of the attribute Returns none if attribute is non-existant """ if has_variable_attribute(name): return _cmor.get_variable_attribute(var_id,name... |
('namespace-packages=', | ('namespace-packages=', None, | def finalize_options(self): distutils.command.build.build.finalize_options(self) if self.build_exe is None: dirName = "exe.%s-%s" % \ (distutils.util.get_platform(), sys.version[0:3]) self.build_exe = os.path.join(self.build_base, dirName) |
if not os.path.exists(loggingDir): | if not os.path.exists(importLibraryDir): | def find_cx_Logging(): currentDir = os.getcwd() dirName, baseName = os.path.split(currentDir) parts = [dirName, ".."] if baseName != "trunk": parts.append("..") parts.append("cx_Logging") if CX_LOGGING_TAG != "trunk": parts.append("tags") parts.append(CX_LOGGING_TAG) loggingDir = os.path.normpath(os.path.join(*parts)) ... |
self._regenerate() | self._regenerate(debug=False) | def get_output(self, variation): self._regenerate() yield self._compiled |
self._regenerate() | self._regenerate(debug=True) | def get_dev_output(self, name, variation): assert name == self.main_module self._regenerate() return self._compiled |
def _compile(self, input): cmd = Popen(['sass', '-C', '-t', 'expanded', '-E', 'utf-8'] + self.path_args, shell=True, universal_newlines=True, | def _compile(self, debug=False): run = ['sass', '-C', '-t', 'expanded', '-E', 'utf-8'] if debug: run.append('--line-numbers') if SASS_DEBUG_INFO: run.append('--debug-info') run.extend(self.path_args) cmd = Popen(run, shell=True, universal_newlines=True, | def _compile(self, input): cmd = Popen(['sass', '-C', '-t', 'expanded', '-E', 'utf-8'] + self.path_args, shell=True, universal_newlines=True, stdin=PIPE, stdout=PIPE, stderr=PIPE) output, error = cmd.communicate(input) assert cmd.wait() == 0, 'Command returned bad result:\n%s' % error return output |
output, error = cmd.communicate(input) | output, error = cmd.communicate('@import %s' % self.main_module) | def _compile(self, input): cmd = Popen(['sass', '-C', '-t', 'expanded', '-E', 'utf-8'] + self.path_args, shell=True, universal_newlines=True, stdin=PIPE, stdout=PIPE, stderr=PIPE) output, error = cmd.communicate(input) assert cmd.wait() == 0, 'Command returned bad result:\n%s' % error return output |
def _regenerate(self): | def _regenerate(self, debug=False): | def _regenerate(self): if self._dependencies: for name, mtime in self._dependencies.items(): path = self._find_file(name) if not path or os.path.getmtime(path) != mtime: # Just recompile everything self._dependencies = {} break else: # No changes return |
path = self._find_file(self.main_module) fp = open(path, 'r') source = fp.read() fp.close() | def _regenerate(self): if self._dependencies: for name, mtime in self._dependencies.items(): path = self._find_file(name) if not path or os.path.getmtime(path) != mtime: # Just recompile everything self._dependencies = {} break else: # No changes return | |
self._compiled = self._compile(source) | self._compiled = self._compile(debug=debug) | def _regenerate(self): if self._dependencies: for name, mtime in self._dependencies.items(): path = self._find_file(name) if not path or os.path.getmtime(path) != mtime: # Just recompile everything self._dependencies = {} break else: # No changes return |
for filters_spec in (ROOT_MEDIA_FILTERS, BASE_ROOT_MEDIA_FILTERS): | for filters_spec in (BASE_ROOT_MEDIA_FILTERS, ROOT_MEDIA_FILTERS): | def _get_root_filters_list(filetype): root_filters = () filetypes = (filetype, '*') for filters_spec in (ROOT_MEDIA_FILTERS, BASE_ROOT_MEDIA_FILTERS): for filetype in filetypes: filters = filters_spec.get(filetype, ()) if not isinstance(filters, (tuple, list)): filters = (filters, ) root_filters += tuple(filters) retur... |
return | else: return | def _regenerate(self, dev_mode=False): # This function is only called in only_dependencies mode if self._compiled: for module_name, (mtime, content) in self._compiled.items(): if module_name not in self._collected or \ os.path.getmtime(self._collected[module_name]) != mtime: # Just recompile everything # TODO: track de... |
assert language == name + '.js' | assert language == name | def get_dev_output(self, name, variation): language = variation['language'] assert language == name + '.js' return self._generate(language) |
yield content, hash | yield language, hash | def get_dev_output_names(self, variation): language = variation['language'] content = self._generate(language) hash = sha1(content).hexdigest() yield content, hash |
shell = platform.system() == 'Windows' | shell = sys.platform == 'win32' | def _compile(self, debug=False): run = ['sass', '-C', '-t', 'expanded'] if debug: run.append('--line-numbers') if SASS_DEBUG_INFO: run.append('--debug-info') run.extend(self.path_args) shell = platform.system() == 'Windows' cmd = Popen(run, shell=shell, universal_newlines=True, stdin=PIPE, stdout=PIPE, stderr=PIPE) out... |
if response.has_header('ETag'): del response['ETag'] | for header in ('ETag', 'Expires', 'Cache-Control', 'Vary'): if response.has_header(header): del response[header] | def process_response(self, request, response): if not request.path.startswith(settings.MEDIA_URL): return response |
name = name.split('/', 1)[-1] assert name == self.name, "File name doen't match the one in GENERATE_MEDIA" | assert name == self.name, ( '''File name "%s" doen't match the one in GENERATE_MEDIA ("%s")''' % (name, self.name)) | def get_dev_output(self, name, variation): name = name.split('/', 1)[-1] assert name == self.name, "File name doen't match the one in GENERATE_MEDIA" path = find_file(name) assert path, """File name "%s" doesn't exist.""" % name fp = open(path, 'r') output = fp.read() fp.close() return output |
$pyjs.in_try_except -= 1; sys.save_exception_stack(); var $pyjs_msg = ''; try { $pyjs_msg = "\\n" + sys.trackstackstr(); } catch (s) {}; pyjslib['debugReport'](err + '\\nTraceback:' + $pyjs_msg); | pyjslib['_handle_exception'](err); | def PYVA(content): return compile(dedent(content)) |
self.debug = False | def __init__(self, **kwargs): self.config(kwargs, exclude_main_libs=False, main_module=None, debug=None, path=(), only_dependencies=None) if isinstance(self.path, basestring): self.path = (self.path,) self.path += tuple(get_media_dirs()) if self.only_dependencies is None: self.only_dependencies = bool(self.main_module)... | |
content += '$pyjs.in_try_except += 1;\n' | def _compile_main(self, dev_mode=False): if self.debug is None: debug = dev_mode else: debug = self.debug content = '' if not self.exclude_main_libs: content += '\n\n$pyjs.loaded_modules["pyjslib"]("pyjslib");' content += '\n$pyjs.__modules__.pyjslib = $pyjs.loaded_modules["pyjslib"];' if self.main_module is not None: ... | |
subvariations = filter.get_variations() | subvariations = filter._get_variations_with_input() | def _get_variations_with_input(self): """Utility function to get variations including input variations""" variations = self.get_variations() if not self.takes_input: return variations |
run = ['sass', '-C', '-t', 'expanded', '-E', 'utf-8'] | run = ['sass', '-C', '-t', 'expanded'] | def _compile(self, debug=False): run = ['sass', '-C', '-t', 'expanded', '-E', 'utf-8'] if debug: run.append('--line-numbers') if SASS_DEBUG_INFO: run.append('--debug-info') run.extend(self.path_args) cmd = Popen(run, shell=True, universal_newlines=True, stdin=PIPE, stdout=PIPE, stderr=PIPE) output, error = cmd.communic... |
cmd = Popen(run, shell=True, universal_newlines=True, | shell = platform.system() == 'Windows' cmd = Popen(run, shell=shell, universal_newlines=True, | def _compile(self, debug=False): run = ['sass', '-C', '-t', 'expanded', '-E', 'utf-8'] if debug: run.append('--line-numbers') if SASS_DEBUG_INFO: run.append('--debug-info') run.extend(self.path_args) cmd = Popen(run, shell=True, universal_newlines=True, stdin=PIPE, stdout=PIPE, stderr=PIPE) output, error = cmd.communic... |
if host == "localhost" or host.startswith("localhost:"): | if re.match(r'(http://)?localhost([:/]|$)', host): | def GetRpcServer(server, email=None, host_override=None, save_cookies=True, account_type=AUTH_ACCOUNT_TYPE): """Returns an instance of an AbstractRpcServer. Args: server: String containing the review server URL. email: String containing user's email address. host_override: If not None, string containing an alternate h... |
save_cookies=False): | save_cookies=False, account_type=AUTH_ACCOUNT_TYPE): | def __init__(self, host, auth_function, host_override=None, extra_headers={}, save_cookies=False): """Creates a new HttpRpcServer. |
account_type = "GOOGLE" | account_type = self.account_type | def _GetAuthToken(self, email, password): """Uses ClientLogin to authenticate the user, returning an auth token. |
def GetRpcServer(server, email=None, host_override=None, save_cookies=True): | def GetRpcServer(server, email=None, host_override=None, save_cookies=True, account_type=AUTH_ACCOUNT_TYPE): | def GetRpcServer(server, email=None, host_override=None, save_cookies=True): """Returns an instance of an AbstractRpcServer. Args: server: String containing the review server URL. email: String containing user's email address. host_override: If not None, string containing an alternate hostname to use in the host heade... |
save_cookies=save_cookies) | save_cookies=save_cookies, account_type=account_type) | def GetRpcServer(server, email=None, host_override=None, save_cookies=True): """Returns an instance of an AbstractRpcServer. Args: server: String containing the review server URL. email: String containing user's email address. host_override: If not None, string containing an alternate hostname to use in the host heade... |
options.save_cookies) | options.save_cookies, options.account_type) | def RealMain(argv, data=None): """The real main function. Args: argv: Command line arguments. data: Diff contents. If None (default) the diff is generated by the VersionControlSystem implementation returned by GuessVCS(). Returns: A 2-tuple (issue id, patchset id). The patchset id is None if the base files are not up... |
return ", ".join("<a href='http://code.google.com/p/chromium/issues/detail?id=%s'>%s</a>" % (i, i) for i in bugs if i != "") + "\n" | base_tracker_url = 'http://code.google.com/p/%s/issues/detail?id=%s' valid_trackers = ('chromium', 'chromium-os', 'chrome-os-partner', 'gyp', 'v8') urls = [] for bug in bugs: if not bug: continue tracker = 'chromium' if ':' in bug: tracker, bug_id = bug.split(':', 1) if tracker not in valid_trackers: urls.append(bug) c... | def replace_bug(m): bugs = re.split(r"[\s,]+", m.group(1)) return ", ".join("<a href='http://code.google.com/p/chromium/issues/detail?id=%s'>%s</a>" % (i, i) for i in bugs if i != "") + "\n" |
expression = re.compile(r"(?<=BUG=)(\s*\d+\s*(?:,\s*\d+\s*)*)", re.IGNORECASE) | re_string = r"(?<=BUG=)" re_string += "(\s*(?:[a-z0-9-]+:)?\d+\s*(?:,\s*(?:[a-z0-9-]+:)?\d+\s*)*)" expression = re.compile(re_string, re.IGNORECASE) | def show(request, form=None): """/<issue> - Show an issue.""" issue, patchsets, response = _get_patchset_info(request, None) if response: return response if not form: form = AddForm(initial={'reviewers': ', '.join(issue.reviewers)}) last_patchset = first_patch = None if patchsets: last_patchset = patchsets[-1] if last_... |
and curr_id > id_after_start and curr_id <= id_after_end+1): | and curr_id > id_after_start and curr_id <= id_after_end): | def _get_skipped_lines_response(rows, id_before, id_after, where, context): """Helper function that creates a Response object for skipped lines""" response_rows = [] id_before_start = int(id_before) id_after_end = int(id_after) if context is not None: id_before_end = id_before_start+context id_after_start = id_after_en... |
template_values['status'] = query | template_values['status'] = (StatusToDict(s, json=False) for s in query) | def get(self): query = db.Query(Status).order('-date') start_date = self.request.get('startTime') if start_date != "": query.filter('date <', datetime.datetime.utcfromtimestamp(int(start_date))) |
self.response.out.write(json.dumps(status.AsDict())) | self.response.out.write(json.dumps(StatusToDict(status, json=True))) | def get(self): """Displays the current message and nothing else.""" format = self.request.get('format', 'html') status = memcache.get('last_status') if status is None: status = Status.gql('ORDER BY date DESC').get() # Cache 2 seconds. memcache.add('last_status', status, 2) if not status: self.error(501) elif format == ... |
message_value = '1' for rx in (re.compile('closed', re.IGNORECASE), re.compile('is close', re.IGNORECASE), re.compile('throt', re.IGNORECASE)): if rx.search(status.message): message_value = '0' | if CanCommitFreely(status.message): message_value = '1' else: message_value = '0' | def get(self): """Displays 1 if the tree is open, and 0 if the tree is closed.""" status = Status.gql('ORDER BY date DESC').get() if status: # Throttled counts as closed for the purpose of /status. # throt* counts as throttled message_value = '1' for rx in (re.compile('closed', re.IGNORECASE), re.compile('is close', re... |
template_values['status'] = status | template_values['status'] = (StatusToDict(s, json=False) for s in status) | def get(self): """Sets the information to be displayed on the main page.""" (validated, is_admin) = self.ValidateUser() if not validated: return |
_add_next_prev(data["ps_right"], data["patch_right"]) | _add_next_prev2(data["ps_left"], data["ps_right"], data["patch_right"]) | def diff2(request, ps_left_id, ps_right_id, patch_filename): """/<issue>/diff2/... - View the delta between two different patch sets.""" context = _get_context_for_user(request) column_width = _get_column_width_for_user(request) ps_right = models.PatchSet.get_by_id(int(ps_right_id), parent=request.issue) patch_right =... |
if not patchset_id: | if not patchset_id and patchsets: | def _get_patchset_info(request, patchset_id): """ Returns a list of patchsets for the issue. Args: request: Django Request object. patchset_id: The id of the patchset that the caller is interested in. This is the one that we generate delta links to if they're not available. We can't generate for all patchsets becaus... |
def GetUserCredentials(): """Prompts the user for a username and password.""" if email is None: email = GetEmail("Email (login for uploading to %s)" % server) password = getpass.getpass("Password for %s: " % email) return (email, password) | def GetUserCredentials(): """Prompts the user for a username and password.""" if email is None: email = GetEmail("Email (login for uploading to %s)" % server) password = getpass.getpass("Password for %s: " % email) return (email, password) | |
def GenerateDiff(self, extra_args): | def PostProcessDiff(self, gitdiff): """Converts the diff output to include an svn-style "Index:" line as well as record the hashes of the files, so we can upload them along with our diff.""" | def GenerateDiff(self, extra_args): # This is more complicated than svn's GenerateDiff because we must convert # the diff output to include an svn-style "Index:" line as well as record # the hashes of the files, so we can upload them along with our diff. |
extra_args = extra_args[:] if self.options.revision: extra_args = [self.options.revision] + extra_args env = os.environ.copy() if 'GIT_EXTERNAL_DIFF' in env: del env['GIT_EXTERNAL_DIFF'] gitdiff = RunShell(["git", "diff", "--no-ext-diff", "--full-index", "-M"] + extra_args, env=env) | def GenerateDiff(self, extra_args): # This is more complicated than svn's GenerateDiff because we must convert # the diff output to include an svn-style "Index:" line as well as record # the hashes of the files, so we can upload them along with our diff. | |
@xsrf_required | def _patchset_delete(ps_delete, patches): """Transactional helper for delete_patchset. Args: ps_delete: The patchset to be deleted. patches: Patches that have delta against patches of ps_delete. """ patchset_id = ps_delete.key().id() tbp = [] for patch in patches: patch.delta.remove(patchset_id) tbp.append(patch) if ... | |
if build_result.split(UploadBuildResult.SEPARATOR)[0] == platform_id: | if build_result.split(UploadBuildResult.SEPARATOR, 2)[0] == platform_id: | def upload_build_result(request): """/<issue>/upload_build_result/<patchset> - Set build result for a patchset. Used to upload results from a build made with the patchset on a given platform. """ form = UploadBuildResult(request.POST, request.FILES) if not form.is_valid(): return HttpResponse('ERROR: Upload build resu... |
UploadBuildResult.SEPARATOR) | UploadBuildResult.SEPARATOR, 2) | def _get_patchset_info(request, patchset_id): """ Returns a list of patchsets for the issue. Args: request: Django Request object. patchset_id: The id of the patchset that the caller is interested in. This is the one that we generate delta links to if they're not available. We can't generate for all patchsets becaus... |
parser = optparse.OptionParser(usage="%prog [options] [-- diff_options]") | parser = optparse.OptionParser( usage="%prog [options] [-- diff_options] [path...]") | def _GetOpener(self): """Returns an OpenerDirector that supports cookies and ignores redirects. |
extra_args = extra_args or ["."] | def GenerateDiff(self, extra_args): # If no file specified, restrict to the current subdir extra_args = extra_args or ["."] cmd = ["hg", "diff", "--git", "-r", self.base_rev] + extra_args data = RunShell(cmd, silent_ok=True) svndiff = [] filecount = 0 for line in data.splitlines(): m = re.match("diff --git a/(\S+) b/(\... | |
password = keyring.get_password(options.server, email) | password = keyring.get_password(host, local_email) | def GetUserCredentials(): """Prompts the user for a username and password.""" # Create a local alias to the email variable to avoid Python's crazy # scoping rules. local_email = email if local_email is None: local_email = GetEmail("Email (login for uploading to %s)" % server) password = None if keyring: password = keyr... |
password = getpass.getpass("Password for %s: " % email) | password = getpass.getpass("Password for %s: " % local_email) | def GetUserCredentials(): """Prompts the user for a username and password.""" # Create a local alias to the email variable to avoid Python's crazy # scoping rules. local_email = email if local_email is None: local_email = GetEmail("Email (login for uploading to %s)" % server) password = None if keyring: password = keyr... |
keyring.set_password(options.server, email, password) | keyring.set_password(host, local_email, password) | def GetUserCredentials(): """Prompts the user for a username and password.""" # Create a local alias to the email variable to avoid Python's crazy # scoping rules. local_email = email if local_email is None: local_email = GetEmail("Email (login for uploading to %s)" % server) password = None if keyring: password = keyr... |
extra_args = [self.options.revision] + extra_args | if ":" in self.options.revision: extra_args = self.options.revision.split(":", 1) + extra_args else: extra_args = [self.options.revision] + extra_args | def GenerateDiff(self, extra_args): extra_args = extra_args[:] if self.options.revision: extra_args = [self.options.revision] + extra_args |
base_content = RunShell(["svn", "cat", filename], universal_newlines=universal_newlines, silent_ok=True) | base_content, ret_code = RunShellWithReturnCode( ["svn", "cat", filename], universal_newlines=universal_newlines) if ret_code and status[0] == "R": url = "%s/%s" % (self.svn_base, filename) base_content = RunShell(["svn", "cat", url], universal_newlines=universal_newlines, silent_ok=True) elif ret_code: ErrorExit("Go... | def GetBaseFile(self, filename): status = self.GetStatus(filename) base_content = None new_content = None |
def get(self): | def get(self, error_message='', last_message=''): | def get(self): """Sets the information to be displayed on the main page.""" (validated, is_admin) = self.ValidateUser() if not validated: return |
last_status = status.get() last_message = '' if last_status: last_message = last_status.message | current_status = status.get() if not last_message and current_status: last_message = current_status.message | def get(self): """Sets the information to be displayed on the main page.""" (validated, is_admin) = self.ValidateUser() if not validated: return |
template_values['last_message'] = last_message | template_values['message'] = last_message if current_status: template_values['last_status_key'] = current_status.key() template_values['error_message'] = error_message | def get(self): """Sets the information to be displayed on the main page.""" (validated, is_admin) = self.ValidateUser() if not validated: return |
message = self.request.get('message') if message: user = self.GetCurrentUser() if not user or not user.email(): self.response.out.write( '<html><body>Failed to retrieve your email address to update ' 'the tree status. Please try signing in first</body></html>') self.error(403) return status = Status(message=message, us... | new_message = self.request.get('message') last_status_key = self.request.get('last_status_key') if new_message: current_status = Status.gql('ORDER BY date DESC').get() if current_status and (last_status_key != str(current_status.key())): error_message = ('Message not saved, mid-air collision detected, ' 'please resolve... | def post(self): """Adds a new message.""" (validated, is_admin) = self.ValidateUser() if not validated or not is_admin: return |
content = "\n".join([ElementTree.tostring(x) for x in node.getchildren()]) | content = [[x.items(), x.text] for x in node.getchildren()] | def _get_skipped_lines_response(rows, id_before, id_after, where, context): """Helper function that creates a Response object for skipped lines""" response_rows = [] id_before_start = int(id_before) id_after_end = int(id_after) if context is not None: id_before_end = id_before_start+context id_after_start = id_after_en... |
base_page.bootstrap() utils.bootstrap() | def main(): """Manages and displays chromium tree and revisions status.""" base_page.bootstrap() utils.bootstrap() util.run_wsgi_app(APPLICATION) | |
ErrorExit("Got error status from 'svn cat %s'", filename) | ErrorExit("Got error status from 'svn cat %s'" % filename) | def GetBaseFile(self, filename): status = self.GetStatus(filename) base_content = None new_content = None |
cwd=cwd).put() | cwd=cwd, version=version).put() | def post(self): """Adds a new breakpad report.""" user = self.request.get('user') stack = self.request.get('stack') args = self.request.get('args') exception = self.request.get('exception') host = self.request.get('host') cwd = self.request.get('cwd') if user and stack and args: Report(user=user, stack=stack, args=args... |
"""Returns the SVN base URL. | """Returns base URL for current diff. | def _GuessBase(self, required): """Returns the SVN base URL. |
words = line.split() if len(words) == 2 and words[0] == "URL:": url = words[1] | if line.startswith("URL: "): url = line.split()[1] | def _GuessBase(self, required): """Returns the SVN base URL. |
if netloc.endswith("svn.python.org"): if netloc == "svn.python.org": if path.startswith("/projects/"): path = path[9:] elif netloc != "pythondev@svn.python.org": ErrorExit("Unrecognized Python URL: %s" % url) base = "http://svn.python.org/view/*checkout*%s/" % path logging.info("Guessed Python base = %s", base) elif ne... | guess = "" if netloc == "svn.python.org" and scheme == "svn+ssh": path = "projects" + path scheme = "http" guess = "Python " | def _GuessBase(self, required): """Returns the SVN base URL. |
path = path + "/" base = urlparse.urlunparse(("http", netloc, path, params, query, fragment)) logging.info("Guessed Google Code base = %s", base) else: path = path + "/" base = urlparse.urlunparse((scheme, netloc, path, params, query, fragment)) logging.info("Guessed base = %s", base) | scheme = "http" guess = "Google Code " path = path + "/" base = urlparse.urlunparse((scheme, netloc, path, params, query, fragment)) logging.info("Guessed %sbase = %s", guess, base) | def _GuessBase(self, required): """Returns the SVN base URL. |
for opatch in other.patch_set: if patch.filename == opatch.filename: if not patch.no_base_file and patch.text != opatch.text: delta.append(other.key().id()) opatch.text = None | query = models.Patch.all() query.filter("filename =", patch.filename) query.filter("patchset =", other.key()) other_patches = query.fetch(100) if other_patches and len(other_patches) > 1: logging.info("Got %s patches with the same filename for a patchset", len(other_patches)) for op in other_patches: if op.text != patc... | def _calculate_delta(patch, patchset_id, patchsets): """Calculates which files in earlier patchsets this file differs from. Args: patch: The file to compare. patchset_id: The file's patchset's key id. patchsets: A list of existing patchsets. Returns: A list of patchset ids. """ delta = [] if patch.no_base_file: retur... |
Report(user=user, stack=stack, args=args, exception=exception, host=host ).put() | Report(user=user, stack=stack, args=args, exception=exception, host=host, cwd=cwd).put() | def post(self): """Adds a new breakpad report.""" user = self.request.get('user') stack = self.request.get('stack') args = self.request.get('args') exception = self.request.get('exception') host = self.request.get('host') if user and stack and args: Report(user=user, stack=stack, args=args, exception=exception, host=ho... |
is_closed = re.compile("closed", re.IGNORECASE) if is_closed.search(status.message): message_value = '0' else: message_value = '1' | message_value = '1' for rx in (re.compile('closed', re.IGNORECASE), re.compile('is close', re.IGNORECASE), re.compile('throt', re.IGNORECASE)): if rx.search(status.message): message_value = '0' | def get(self): """Displays 1 if the tree is open, and 0 if the tree is closed.""" status = Status.gql('ORDER BY date DESC').get() if status: is_closed = re.compile("closed", re.IGNORECASE) if is_closed.search(status.message): message_value = '0' else: message_value = '1' |
if patch_left is None: return HttpResponseNotFound( "Patch set %s doesn't have a patch with filename %s" % (ps_left_id, patch_right.filename)) try: new_content_left = patch_left.get_patched_content() new_content_right = patch_right.get_patched_content() except engine.FetchError, err: return HttpResponseNotFound(str(err... | if patch_left: try: new_content_left = patch_left.get_patched_content() new_content_right = patch_right.get_patched_content() except engine.FetchError, err: return HttpResponseNotFound(str(err)) rows = engine.RenderDiff2TableRows(request, new_content_left.lines, patch_left, new_content_right.lines, patch_right, context... | def _get_diff2_data(request, ps_left_id, ps_right_id, patch_id, context, column_width): """Helper function that returns objects for diff2 views""" ps_left = models.PatchSet.get_by_id(int(ps_left_id), parent=request.issue) if ps_left is None: return HttpResponseNotFound('No patch set exists with that id (%s)' % ps_left_... |
def GetRpcServer(options): | def GetRpcServer(server, email=None, host_override=None, save_cookies=True): | def GetRpcServer(options): """Returns an instance of an AbstractRpcServer. Returns: A new AbstractRpcServer, on which RPC calls can be made. """ rpc_server_class = HttpRpcServer def GetUserCredentials(): """Prompts the user for a username and password.""" email = options.email if email is None: email = GetEmail("Ema... |
email = options.email | def GetUserCredentials(): """Prompts the user for a username and password.""" email = options.email if email is None: email = GetEmail("Email (login for uploading to %s)" % options.server) password = getpass.getpass("Password for %s: " % email) return (email, password) | |
email = GetEmail("Email (login for uploading to %s)" % options.server) | email = GetEmail("Email (login for uploading to %s)" % server) | def GetUserCredentials(): """Prompts the user for a username and password.""" email = options.email if email is None: email = GetEmail("Email (login for uploading to %s)" % options.server) password = getpass.getpass("Password for %s: " % email) return (email, password) |
host = (options.host or options.server).lower() | host = (host_override or server).lower() | def GetUserCredentials(): """Prompts the user for a username and password.""" email = options.email if email is None: email = GetEmail("Email (login for uploading to %s)" % options.server) password = getpass.getpass("Password for %s: " % email) return (email, password) |
options.server, | server, | def GetUserCredentials(): """Prompts the user for a username and password.""" email = options.email if email is None: email = GetEmail("Email (login for uploading to %s)" % options.server) password = getpass.getpass("Password for %s: " % email) return (email, password) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.