rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
while 1: new_basename = os.path.splitext(basename)[0] if basename == new_basename: break else: basename = new_basename return basename | return os.path.splitext(basename)[0] | def ExtractModuleName(infile_path): """Infers the module name from the input file path. The input filename is supposed to be in the form "ModuleName.sigs". This function splits the filename from the extention on that basename of the path and returns that as the module name. Args: infile_path: String holding the path ... |
config.irc.server, config.irc.port, | config_irc.server, config_irc.port, | def __init__(self, message_queue, delegate): self._message_queue = message_queue self._delegate = delegate ircbot.SingleServerIRCBot.__init__( self, [( config.irc.server, config.irc.port, self._delegate.irc_password() )], self._delegate.irc_nickname, self._delegate.irc_nickname) self._channel = config.irc.channel |
self._delegate.irc_nickname, self._delegate.irc_nickname) self._channel = config.irc.channel | self._delegate.irc_nickname(), self._delegate.irc_nickname()) self._channel = config_irc.channel | def __init__(self, message_queue, delegate): self._message_queue = message_queue self._delegate = delegate ircbot.SingleServerIRCBot.__init__( self, [( config.irc.server, config.irc.port, self._delegate.irc_password() )], self._delegate.irc_nickname, self._delegate.irc_nickname) self._channel = config.irc.channel |
pyauto_utils.RemovePath(os.path.join(download_dir, name)) | self.files_to_remove.append(os.path.join(download_dir, name)) | def tearDown(self): # Cleanup all files we created in the download dir download_dir = self.GetDownloadDirectory().value() if os.path.isdir(download_dir): for name in os.listdir(download_dir): if name not in self._existing_downloads: pyauto_utils.RemovePath(os.path.join(download_dir, name)) pyauto.PyUITest.tearDown(self... |
os.path.exists(file_path) and os.remove(file_path) | self.files_to_remove.append(file_path) | def testCancelDownload(self): """Verify that we can cancel a download.""" # Create a big file (250 MB) on the fly, so that the download won't finish # before being cancelled. file_path = self._MakeFile(2**28) file_url = self.GetFileURLForPath(file_path) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(),... |
self._update_status("Unabled to successfully build and test", None) | self._update_status("Unable to successfully build and test", None) | def _can_build_and_test(self): try: self.run_webkit_patch(["build-and-test", "--force-clean", "--non-interactive", "--build-style=both", "--quiet"]) except ScriptError, e: self._update_status("Unabled to successfully build and test", None) return False return True |
output_file.write(" '%s',\n" % output_tgz) | output_file.write(" '../samples/%s',\n" % output_tgz) | def write_action(asset, webgl_mode): filename = posixpath.splitext(posixpath.basename(asset['path']))[0] filename = filename.replace('.','_') filename = filename.replace('-','_') filename = filename.lower() name = "convert_" + filename if webgl_mode: name = name + "_webgl" output = asset['path'].replace('convert_', '')... |
setup_mount = port.path_from_chromium_base('third_party', | setup_mount = self._port_obj.path_from_chromium_base('third_party', | def start(self): if self.is_running(): raise 'Lighttpd already running' |
self.files_to_remove = [] | self._files_to_remove = [] | def setUp(self): pyauto.PyUITest.setUp(self) # Record all entries in the download dir download_dir = self.GetDownloadDirectory().value() self._existing_downloads = [] if os.path.isdir(download_dir): self._existing_downloads += os.listdir(download_dir) self.files_to_remove = [] # Files to remove after browser shutdown |
self.files_to_remove.append(os.path.join(download_dir, name)) | self._files_to_remove.append(os.path.join(download_dir, name)) | def tearDown(self): # Cleanup all files we created in the download dir download_dir = self.GetDownloadDirectory().value() if os.path.isdir(download_dir): for name in os.listdir(download_dir): if name not in self._existing_downloads: self.files_to_remove.append(os.path.join(download_dir, name)) pyauto.PyUITest.tearDown(... |
for item in self.files_to_remove: | for item in self._files_to_remove: | def tearDown(self): # Cleanup all files we created in the download dir download_dir = self.GetDownloadDirectory().value() if os.path.isdir(download_dir): for name in os.listdir(download_dir): if name not in self._existing_downloads: self.files_to_remove.append(os.path.join(download_dir, name)) pyauto.PyUITest.tearDown(... |
os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg) | self._DeleteAfterShutdown(downloaded_pkg) | def testSaveDangerousFile(self): """Verify that we can download and save a dangerous file.""" file_path = self._GetDangerousDownload() file_url = self.GetFileURLForPath(file_path) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), os.path.basename(file_path)) os.path.exists(downloaded_pkg) and os.remove... |
os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg) | self._DeleteAfterShutdown(downloaded_pkg) | def testRemoveDownload(self): """Verify that we can remove a download.""" test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads') file_path = os.path.join(test_dir, 'a_zip_file.zip') file_url = self.GetFileURLForPath(file_path) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), 'a_zip_file... |
try: file_url = self.GetFileURLForPath(file_path) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), os.path.basename(file_path)) os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg) self.DownloadAndWaitForStart(file_url) self._CallFunctionWithNewTimeout(4 * 60 * 1000, self.WaitForAllDownloads... | self._DeleteAfterShutdown(file_path) file_url = self.GetFileURLForPath(file_path) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), os.path.basename(file_path)) os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg) self.DownloadAndWaitForStart(file_url) self._DeleteAfterShutdown(downloaded_pkg) ... | def testBigZip(self): """Verify that we can download a 1GB file. |
os.path.exists(filename) and os.remove(filename) | self._DeleteAfterShutdown(filename) | def testFileRenaming(self): """Test file renaming when downloading a already-existing filename.""" test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads') file_url = 'file://%s' % os.path.join(test_dir, 'a_zip_file.zip') download_dir = self.GetDownloadDirectory().value() |
try: for filename in crazy_filenames: utf8_filename = filename.encode('utf-8') file_path = os.path.join(temp_dir, utf8_filename) _CreateFile(os.path.join(temp_dir, filename)) file_url = self.GetFileURLForPath(file_path) downloaded_file = os.path.join(download_dir, filename) os.path.exists(downloaded_file) and os.remove... | for filename in crazy_filenames: utf8_filename = filename.encode('utf-8') file_path = os.path.join(temp_dir, utf8_filename) _CreateFile(os.path.join(temp_dir, filename)) file_url = self.GetFileURLForPath(file_path) downloaded_file = os.path.join(download_dir, filename) os.path.exists(downloaded_file) and os.remove(down... | def _CreateFile(name): """Create and fill the given file with some junk.""" fp = open(name, 'w') # name could be unicode print >>fp, 'This is a junk file named %s. ' % repr(name) * 100 fp.close() |
try: file_url = self.GetFileURLForPath(file_path) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), os.path.basename(file_path)) os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg) self.DownloadAndWaitForStart(file_url) pause_dict = self.PerformActionOnDownload(self._GetDownloadId(), 'toggle... | file_url = self.GetFileURLForPath(file_path) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), os.path.basename(file_path)) os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg) self.DownloadAndWaitForStart(file_url) self._DeleteAfterShutdown(downloaded_pkg) self._DeleteAfterShutdown(file_path)... | def testPauseAndResume(self): """Verify that pause and resume work while downloading a file. |
self.files_to_remove.append(file_path) | self._DeleteAfterShutdown(file_path) | def testCancelDownload(self): """Verify that we can cancel a download.""" # Create a big file (250 MB) on the fly, so that the download won't finish # before being cancelled. file_path = self._MakeFile(2**28) file_url = self.GetFileURLForPath(file_path) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(),... |
os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg) | self._DeleteAfterShutdown(downloaded_pkg) | def testDownloadsPersistence(self): """Verify that download history persists on session restart.""" test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads') file_url = self.GetFileURLForPath(os.path.join(test_dir, 'a_zip_file.zip')) downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), 'a_zip_... |
class Rollout(AbstractDeclarativeCommmand): | class Rollout(AbstractSequencedCommmand): | def _fetch_list_of_patches_to_process(self, options, args, tool): all_patches = [] for bug_id in args: patches = tool.bugs.fetch_reviewed_patches_from_bug(bug_id) log("%s found on bug %s." % (pluralize("reviewed patch", len(patches)), bug_id)) all_patches += patches return all_patches |
def __init__(self): self._sequence = StepSequence([ CleanWorkingDirectoryStep, UpdateStep, RevertRevisionStep, PrepareChangeLogForRevertStep, CompleteRollout, ]) AbstractDeclarativeCommmand.__init__(self, self._sequence.options()) | steps = [ CleanWorkingDirectoryStep, UpdateStep, RevertRevisionStep, PrepareChangeLogForRevertStep, CompleteRollout, ] | def __init__(self): self._sequence = StepSequence([ CleanWorkingDirectoryStep, UpdateStep, RevertRevisionStep, PrepareChangeLogForRevertStep, CompleteRollout, ]) AbstractDeclarativeCommmand.__init__(self, self._sequence.options()) |
self._tempfile = tempfile.TemporaryFile() | def __init__(self, args, executable, num_shards, shard): self._args = args self._executable = executable self._num_shards = num_shards self._shard = shard self._test = None self._tempfile = tempfile.TemporaryFile() | |
stdout=self._tempfile, | stdout=subprocess.PIPE, | def launch(self): env = os.environ.copy() env['GTEST_TOTAL_SHARDS'] = str(self._num_shards) env['GTEST_SHARD_INDEX'] = str(self._shard) self._test = subprocess.Popen(args=self._args, executable=self._executable, stdout=self._tempfile, stderr=subprocess.STDOUT, env=env) |
code = self._test.wait() self._tempfile.seek(0) print self._tempfile.read() self._tempfile.close() return code | if subprocess.mswindows: stdout_thread = threading.Thread( target=StreamCopyWindows, args=[self._test.stdout, sys.stdout]) stdout_thread.start() code = self._test.wait() stdout_thread.join() return code else: child_exited = threading.Event() stdout_thread = threading.Thread( target=StreamCopyPosix, args=[self._test.std... | def wait(self): code = self._test.wait() self._tempfile.seek(0) print self._tempfile.read() self._tempfile.close() return code |
if file_name.endswith(".html")) | if file_name.endswith(".html") and not file_name.startswith(".")) | def GetStaticFileNames(): static_files = os.listdir(_static_dir) return set(os.path.splitext(file_name)[0] for file_name in static_files if file_name.endswith(".html")) |
], debug=True) | ], debug=False) | def check(self, path, expectedUrl, expectedChannel): actual = self.getSrcUrl(path) if (actual[0] != expectedUrl): self.response.out.write('<span style="color:#f00;">Failure:</span> path ' + path + " gave url " + actual[0] + "<br/>") elif (actual[1] != expectedChannel): self.response.out.write('<span style="color:#f00;"... |
test_dir = os.path.join(os.path.abspath(self.DataDir()), 'history') | test_dir = os.path.join(os.path.abspath(self.DataDir()), 'History') | def testRedirectHistory(self): """HTTP meta-refresh redirects should have separate history entries.""" assert not self.GetHistoryInfo().History(), 'Expecting clean history.' test_dir = os.path.join(os.path.abspath(self.DataDir()), 'history') file_url = self.GetFileURLForPath(os.path.join(test_dir, 'redirector.html')) l... |
if PyUITest.IsPosix(): chrome_flags += ' --enable-crash-reporter' | os.putenv('CHROME_HEADLESS', '1') | def _Run(self): """Run the tests.""" if self._options.wait_for_debugger: raw_input('Attach debugger to process %s and hit <enter> ' % os.getpid()) |
old_level_name = logging.getLogger().getEffectiveLevel() logging.getLogger().setLevel(logging.ERROR) | def post(self, diff, message=None, codereview_issue=None, cc=None): if not message: raise ScriptError("Rietveld requires a message.") | |
logging.getLogger().setLevel(old_level_name) | def post(self, diff, message=None, codereview_issue=None, cc=None): if not message: raise ScriptError("Rietveld requires a message.") | |
print action | if hash_output: hash = hashlib.md5() hash.update(action) print >>f, '0x%s\t%s' % (hash.hexdigest()[:16], action) else: print action if hash_output: print "Done. Do not forget to add chromeactions.txt to your changelist" | def main(argv): actions = set() AddComputedActions(actions) # TODO(fmantek): bring back webkit editor actions. # AddWebKitEditorActions(actions) # Walk the source tree to process all .cc files. chrome_root = os.path.join(path_utils.ScriptDir(), '..') WalkDirectory(chrome_root, actions) webkit_root = os.path.join(path_... |
stack_line = re.compile('\s*@\s*(?:0x)?[0-9a-fA-F]*\s*([^\n]*)') | stack_line = re.compile('\s*@\s*(?:0x)?[0-9a-fA-F]+\s*([^\n]*)') | def Analyze(self, log_lines, check_sanity=False): """Analyzes the app's output and applies suppressions to the reports. |
proc = subprocess.Popen(['git'] + command, shell=shell, stdout=subprocess.PIPE) return proc.communicate()[0].strip() | proc = subprocess.Popen(command, shell=shell, stdout=subprocess.PIPE) out = proc.communicate()[0].strip() logging.info('Returned "%s"' % out) return out | def RunGit(command): """Run a git subcommand, returning its output.""" # On Windows, use shell=True to get PATH interpretation. shell = (os.name == 'nt') proc = subprocess.Popen(['git'] + command, shell=shell, stdout=subprocess.PIPE) return proc.communicate()[0].strip() |
log = subprocess.Popen(['git', 'log', '--no-color', '--first-parent', '--pretty=medium', 'origin'], shell=(os.name == 'nt'), stdout=subprocess.PIPE) | cmd = ['git', 'log', '--no-color', '--first-parent', '--pretty=medium', 'origin/master'] logging.info(' '.join(cmd)) log = subprocess.Popen(cmd, shell=(os.name == 'nt'), stdout=subprocess.PIPE) | def FindSVNRev(target_rev): """Map an SVN revision to a git hash. Like 'git svn find-rev' but without the git-svn bits.""" # We iterate through the commit log looking for "git-svn-id" lines, # which contain the SVN revision of that commit. We can stop once # we've found our target (or hit a revision number lower than... |
default=True, help="(DEPRECATED)"), | default=None, help="Use DumpRenderTree instead of test_shell"), | def parse_args(args=None): """Provides a default set of command line args. Returns a tuple of options, args from optparse""" # FIXME: All of these options should be stored closer to the code which # FIXME: actually uses them. configuration_options should move # FIXME: to WebKitPort and be shared across all scripts. c... |
self.browser["blocked"] = blocked | self.browser["blocked"] = str(blocked) | def create_bug(self, bug_title, bug_description, component=None, patch_file_object=None, patch_description=None, cc=None, blocked=None, mark_for_review=False, mark_for_commit_queue=False): self.authenticate() |
if options.builder_name is not None: options.builder_name = options.builder_name + ' - GPU' | def _set_gpu_options(options): if options: if options.accelerated_compositing is None: options.accelerated_compositing = True if options.accelerated_2d_canvas is None: options.accelerated_2d_canvas = True if options.builder_name is not None: options.builder_name = options.builder_name + ' - GPU' if options.use_drt is N... | |
output = posixpath.splitext(output)[0] + ".o3dtgz" | output_base = posixpath.splitext(output)[0] output_tgz = output_base + ".o3dtgz" output_json = output_base + "/scene.json" output = output_tgz if webgl_mode: output = output_json | def write_action(asset, webgl_mode): filename = posixpath.splitext(posixpath.basename(asset['path']))[0] filename = filename.replace('.','_') filename = filename.replace('-','_') filename = filename.lower() name = "convert_" + filename if webgl_mode: name = name + "_webgl" output = asset['path'].replace('convert_', '')... |
output_file.write(" '<(_outputs)',\n") | if webgl_mode: output_file.write(" '%s',\n" % output_tgz) else: output_file.write(" '<(_outputs)',\n") | def write_action(asset, webgl_mode): filename = posixpath.splitext(posixpath.basename(asset['path']))[0] filename = filename.replace('.','_') filename = filename.replace('-','_') filename = filename.lower() name = "convert_" + filename if webgl_mode: name = name + "_webgl" output = asset['path'].replace('convert_', '')... |
retries_left = 3 if sys.platform == "cygwin" else 1 | retries_left = 10 if sys.platform == "cygwin" else 1 | def kill_process(self, pid): """Attempts to kill the given pid. Will fail silently if pid does not exist or insufficient permisssions.""" if sys.platform == "win32": # We only use taskkill.exe on windows (not cygwin) because subprocess.pid # is a CYGWIN pid and taskkill.exe expects a windows pid. # Thankfully os.kill o... |
reviewed_patches = self.tool.bugs.fetch_bug(bug_id).reviewed_patches() | reviewed_patches = bug.reviewed_patches() | def _assign_bug_to_last_patch_attacher(self, bug_id): committers = CommitterList() bug = self.tool.bugs.fetch_bug(bug_id) assigned_to_email = bug.assigned_to_email() if assigned_to_email != self.tool.bugs.unassigned_email: log("Bug %s is already assigned to %s (%s)." % (bug_id, assigned_to_email, committers.committer_b... |
if path.startswith('ie\\') or path.startswith('common\\'): | if (ie_paths_re.match(path)): | def CheckUnittestsRan(input_api, output_api, committing): '''Checks that the unittests success file is newer than any modified file''' # But only if there were IE files modified, since we only have unit tests # for CEEE IE. files = [] for f in input_api.AffectedFiles(include_deletes = False): path = f.LocalPath() if pa... |
def __init__(self, methodName='runTest'): pyautolib.PyUITestSuite.__init__(self, sys.argv) | def __init__(self, methodName='runTest', extra_chrome_flags=None): """Initialize PyUITest. When redefining __init__ in a derived class, make sure that: o you make a call this __init__ o __init__ takes methodName as a arg. this is mandated by unittest module Args: methodName: the default method name. Internal use by u... | def __init__(self, methodName='runTest'): pyautolib.PyUITestSuite.__init__(self, sys.argv) # Figure out path to chromium binaries browser_dir = os.path.normpath(os.path.dirname(pyautolib.__file__)) os.environ['PATH'] = browser_dir + os.pathsep + os.environ['PATH'] self.Initialize(pyautolib.FilePath(browser_dir)) unitte... |
if 'regress' in perf_data[key]: if 'improve' not in perf_data[key]: bad_keys.append(key) if (not isinstance(perf_data[key]['regress'], int) and not isinstance(perf_data[key]['regress'], float)): bad_keys.append(key) if (not isinstance(perf_data[key]['improve'], int) and not isinstance(perf_data[key]['improve'], float))... | if 'delta' not in perf_data[key] or 'var' not in perf_data[key]: bad_keys.append(key) if (not isinstance(perf_data[key]['delta'], int) and not isinstance(perf_data[key]['delta'], float)): bad_keys.append(key) if (not isinstance(perf_data[key]['var'], int) and not isinstance(perf_data[key]['var'], float)): bad_keys.appe... | def testPerfExpectations(self): perf_data = LoadData() |
args.extend(["--ignore-tests", "compositing"]) | tests_to_ignore = [] tests_to_ignore.append("compositing") tests_to_ignore.append("media") args.extend(["--ignore-tests", ",".join(tests_to_ignore)]) | def run(self, state): if not self._options.test: return |
tests_are_present=True, overrides=overrides_str) | tests_are_present=False, overrides=overrides_str) | def skipped_layout_tests(self, extra_test_files=None): expectations_str = self.test_expectations() overrides_str = self.test_expectations_overrides() test_platform_name = self.test_platform_name() is_debug_mode = False |
os.mkdir(self._options.results_directory) | path_utils.maybe_make_directory(self._options.results_directory) | def __init__(self, options): self._options = options |
_log.info('File not a recognized type to check. Skipping: "%s"' % file_path) | _log.debug('File not a recognized type to check. Skipping: "%s"' % file_path) | def check_file(self, file_path, handle_style_error=None, process_file=None): """Check style in the given file. |
BASE_DIRECTORY = BASE_DIRECTORY.lower() | def main(argv): usage = """Usage: python %prog [--root <root>] [tocheck] tocheck Specifies the directory, relative to root, to check. This defaults to "." so it checks everything. | |
error_eof = error_lines.pop() assert(error_eof == " | if error_lines: error_eof = error_lines.pop() assert(error_eof == " | def run_test(self, uri, timeoutms, image_hash): if uri.startswith("file:///"): command = uri[7:] else: command = uri |
environment['DUMPRENDERTREE_TEMP'] = tempfile.mkdtemp(prefix='DumpRenderTree-') | def start(self): command = [] # FIXME: We should not be grabbing at self._port._options.wrapper directly. command += self._command_wrapper(self._port._options.wrapper) command += [self._port._path_to_driver(), '-'] if self._image_path: command.append('--pixel-tests') environment = self._port.setup_environ_for_server() ... | |
self._source_dir = layout_package.path_utils.get_absolute_path( self._source_dir) | self._source_dir = os.path.abspath(self._source_dir).replace('\\', '/') | def __init__(self, options, args, test): # The known list of tests. # Recognise the original abbreviations as well as full executable names. self._test_list = { "base": self.TestBase, "base_unittests": self.TestBase, "browser": self.TestBrowser, "browser_tests": self.TestBrowser, "googleurl": self.TestG... |
script = os.path.join(self._source_dir, "webkit", "tools", "layout_tests", "run_webkit_tests.py") | script = os.path.join(self._source_dir, "third_party", "WebKit", "WebKitTools", "Scripts", "run-chromium-webkit-tests") | def TestLayoutChunk(self, chunk_num, chunk_size): # Run tests [chunk_num*chunk_size .. (chunk_num+1)*chunk_size) from the # list of tests. Wrap around to beginning of list at end. # If chunk_size is zero, run all tests in the list once. # If a text file is given as argument, it is used as the list of tests. # # Build ... |
env['CYGWIN_PATH'] = path_utils.path_from_base('third_party', 'cygwin', 'bin') | env['CYGWIN_PATH'] = self._port_obj.path_from_base('third_party', 'cygwin', 'bin') | def start(self): if not self._web_socket_tests: _log.info('No need to start %s server.' % self._server_name) return if self.is_running(): raise PyWebSocketNotStarted('%s is already running.' % self._server_name) |
raise Exception("Building docs not supported for cygwin python.\n" "Please run the build.bat script.") | sys.exit("Building docs not supported for cygwin python. Please run the " "build.sh script instead, which uses depot_tools python.") | def main(): # Prevent windows from using cygwin python. if (sys.platform == "cygwin"): raise Exception("Building docs not supported for cygwin python.\n" "Please run the build.bat script.") parser = OptionParser() parser.add_option("--test-shell-path", dest="test_shell_path") parser.add_option("--page-name", dest="pag... |
return os.EX_OK | if 'EX_OK' in dir(os): return os.EX_OK else: return 0 | def main(): # Prevent windows from using cygwin python. if (sys.platform == "cygwin"): raise Exception("Building docs not supported for cygwin python.\n" "Please run the build.bat script.") parser = OptionParser() parser.add_option("--test-shell-path", dest="test_shell_path") parser.add_option("--page-name", dest="pag... |
If the 'replace_orig' and 'replace_new' URL query parameters are present, a new string is returned with all occasions of the 'replace_orig' value replaced by the 'replace_new' value. | If the 'replace_text' URL query parameter is present, it is expected to be of the form old_text:new_text, which indicates that any old_text strings in the file are replaced with new_text. Multiple 'replace_text' parameters may be specified. | def _ReplaceFileData(self, data, query_parameters): """Replaces matching substrings in a file. |
orig_values = query_dict.get('replace_orig', []) new_values = query_dict.get('replace_new', []) if not orig_values or not new_values: return data orig_value = orig_values[0] new_value = new_values[0] return data.replace(orig_value, new_value) | replace_text_values = query_dict.get('replace_text', []) for replace_text_value in replace_text_values: replace_text_args = replace_text_value.split(':') if len(replace_text_args) != 2: raise ValueError( 'replace_text must be of form old_text:new_text. Actual value: %s' % replace_text_value) old_text_b64, new_text_b64 ... | def _ReplaceFileData(self, data, query_parameters): """Replaces matching substrings in a file. |
with codecs.open(file_path, "w", encoding=encoding) as file: | open_mode = 'w' if encoding is None: open_mode = 'w+b' with codecs.open(file_path, open_mode, encoding=encoding) as file: | def _write_into_file_at_path(self, file_path, contents, encoding): """This method assumes that byte_array is already encoded into the right format.""" with codecs.open(file_path, "w", encoding=encoding) as file: file.write(contents) |
feature_defines = ['ENABLE_DATABASE', 'ENABLE_XSLT', 'ENABLE_JAVASCRIPT_DEBUGGER'] | feature_defines = ['ENABLE_DATABASE', 'ENABLE_XSLT', 'ENABLE_JAVASCRIPT_DEBUGGER', 'ENABLE_SVG', 'ENABLE_SVG_USE', 'ENABLE_FILTERS', 'ENABLE_SVG_FONTS', 'ENABLE_SVG_ANIMATION', 'ENABLE_SVG_AS_IMAGE'] | def get_config(): waf_configname = config.upper().strip() if building_on_win32: isReleaseCRT = (config == 'Release') if build_port == 'wx': if Options.options.wxpython: isReleaseCRT = True if isReleaseCRT: waf_configname = waf_configname + ' CRT_MULTITHREADED_DLL' else: waf_configname = waf_configname + ' CRT_MULTITHR... |
elif options.path: output.write(path, os.path.join(options.path, os.path.basename(path))) | def Main(): """Zip input arguments to Zip output archive.""" (options, args) = ParseCommandLine() # Test that all the input files exist before we blow the output archive away # only to fail part way. for path in args: if path == _DEBUG_ONLY_FILE_SEPARATOR: continue if not os.path.exists(path): raise Exception('Input f... | |
output.write(path) | dest_path = path if options.path: dest_path = os.path.join(options.path, os.path.basename(path)) extension = os.path.splitext(path)[1] if extension: extension = extension[1:] if extension in ignore_extensions: output.write(path, dest_path) else: contents = version.subst_file(path, subst_values) output.writestr(dest_p... | def Main(): """Zip input arguments to Zip output archive.""" (options, args) = ParseCommandLine() # Test that all the input files exist before we blow the output archive away # only to fail part way. for path in args: if path == _DEBUG_ONLY_FILE_SEPARATOR: continue if not os.path.exists(path): raise Exception('Input f... |
file_url = self.GetFileURLForDataPath(os.path.join( | file_url = self.GetFileURLForPath(os.path.join( | def _TriggerUnsafeDownload(self, filename, tab_index=0, windex=0): """Trigger download of an unsafe/dangerous filetype. |
subprocess.Popen([self._path_to_driver(), self.filename_to_uri(results_filename)]) | uri = self.filename_to_uri(results_filename) if self._options.use_drt: webbrowser.open(uri, new=1) else: subprocess.Popen([self._path_to_driver(), uri]) | def show_results_html_file(self, results_filename): subprocess.Popen([self._path_to_driver(), self.filename_to_uri(results_filename)]) |
python_interp, pywebsocket_script, | python_interp, '-u', pywebsocket_script, | def start(self): if not self._web_socket_tests: _log.info('No need to start %s server.' % self._server_name) return if self.is_running(): raise PyWebSocketNotStarted('%s is already running.' % self._server_name) |
def RunDispatcherHandler(dispatcher, handler): """Handles a single event for an asyncore.dispatcher. | def HandleXmppSocket(fd, socket_map, handler): """Runs the handler for the xmpp connection for fd. | def RunDispatcherHandler(dispatcher, handler): """Handles a single event for an asyncore.dispatcher. |
handler(dispatcher) | handler(xmpp_connection) | def RunDispatcherHandler(dispatcher, handler): """Handles a single event for an asyncore.dispatcher. |
dispatcher.handle_error() | xmpp_connection.handle_error() | def RunDispatcherHandler(dispatcher, handler): """Handles a single event for an asyncore.dispatcher. |
xmpp_connection = self._xmpp_socket_map.get(fd) RunDispatcherHandler(xmpp_connection, asyncore.dispatcher.handle_read_event) | HandleXmppSocket(fd, self._xmpp_socket_map, asyncore.dispatcher.handle_read_event) | def RunDispatcherHandler(dispatcher, handler): """Handles a single event for an asyncore.dispatcher. |
xmpp_connection = self._xmpp_socket_map.get(fd) RunDispatcherHandler(xmpp_connection, asyncore.dispatcher.handle_write_event) | HandleXmppSocket(fd, self._xmpp_socket_map, asyncore.dispatcher.handle_write_event) | def RunDispatcherHandler(dispatcher, handler): """Handles a single event for an asyncore.dispatcher. |
xmpp_connection = self._xmpp_socket_map.get(fd) RunDispatcherHandler(xmpp_connection, asyncore.dispatcher.handle_expt_event) | HandleXmppSocket(fd, self._xmpp_socket_map, asyncore.dispatcher.handle_expt_event) | def RunDispatcherHandler(dispatcher, handler): """Handles a single event for an asyncore.dispatcher. |
code_file = open(path) | code_file = open(path, "r") | def _parse_api_calls(self, api_methods): """ Returns a list of Chrome extension API calls the sample makes. |
code_contents = code_file.read() | code_contents = unicode(code_file.read(), errors="replace") | def _parse_api_calls(self, api_methods): """ Returns a list of Chrome extension API calls the sample makes. |
code = """ %(type)s %(name)s = c.%(name)s; """ file.Write(code % {'type': self.type, 'name': self.name}) | file.Write(" %s %s = c.%s;\n" % (self.type, self.name, self.name)) file.Write(" if (%s != 0 && !id_manager()->GetServiceId(%s, &%s)) {\n" % (self.name, self.name, self.name)) file.Write(" SetGLError(GL_INVALID_VALUE);\n") file.Write(" return error::kNoError;\n") file.Write(" }\n") | def WriteGetCode(self, file): """Overridden from Argument.""" code = """ %(type)s %(name)s = c.%(name)s; |
'--cgi-paths', '/websocket/tests/cookies', | '--cgi-paths', '/websocket/tests', | def start(self): if not self._web_socket_tests: _log.info('No need to start %s server.' % self._server_name) return if self.is_running(): raise PyWebSocketNotStarted('%s is already running.' % self._server_name) |
import os import unittest import pyauto_functional import pyauto class FindMatchTests(pyauto.PyUITest): def testCanFindMatchCount(self): """Verify Find match count for valid search""" url = self.GetFileURLForPath(os.path.join(self.DataDir(), 'title1.html')) self.NavigateToURL(url) self.assertEqual(1, self.FindInPag... | def testCanFindMatchCountFail(self): """Verify Find match count for invalid search""" url = self.GetFileURLForPath(os.path.join(self.DataDir(), 'title1.html')) self.NavigateToURL(url) self.assertEqual(0, self.FindInPage('blah')['match_count']) | |
self.file.write(line1 + '\n') | nolint = '' if len(line1) > 80: nolint = ' // NOLINT' self.file.write(line1 + nolint + '\n') | def __WriteLine(self, line, ends_with_eol): """Given a signle line, writes it to a file, splitting if it's > 80 chars""" if len(line) >= 80: i = self.__FindSplit(line) if i > 0: line1 = line[0:i + 1] self.file.write(line1 + '\n') match = re.match("( +)", line1) indent = "" if match: indent = match.group(1) splitter = l... |
self.file.write(line) | nolint = '' if len(line) > 80: nolint = ' // NOLINT' self.file.write(line + nolint) | def __WriteLine(self, line, ends_with_eol): """Given a signle line, writes it to a file, splitting if it's > 80 chars""" if len(line) >= 80: i = self.__FindSplit(line) if i > 0: line1 = line[0:i + 1] self.file.write(line1 + '\n') match = re.match("( +)", line1) indent = "" if match: indent = match.group(1) splitter = l... |
return "Failed to run PrettyPatch" | return self._pretty_patch_error_html | def pretty_patch_text(self, diff_path): global _pretty_patch_available if not _pretty_patch_available: return "Failed to run PrettyPatch" pretty_patch_path = self.path_from_webkit_base("BugsSite", "PrettyPatch") prettify_path = os.path.join(pretty_patch_path, "prettify.rb") command = ["ruby", "-I", pretty_patch_path, p... |
return "Failed to run PrettyPatch: %s" % e except Executive.ScriptError, e: | _log.error("Failed to run PrettyPatch (%s): %s" % (command, e)) return self._pretty_patch_error_html except ScriptError, e: | def pretty_patch_text(self, diff_path): global _pretty_patch_available if not _pretty_patch_available: return "Failed to run PrettyPatch" pretty_patch_path = self.path_from_webkit_base("BugsSite", "PrettyPatch") prettify_path = os.path.join(pretty_patch_path, "prettify.rb") command = ["ruby", "-I", pretty_patch_path, p... |
return "Failed to run PrettyPatch: %s" % e | _log.error("Failed to run PrettyPatch (%s):\n%s" % (command, e.message_with_output())) return self._pretty_patch_error_html | def pretty_patch_text(self, diff_path): global _pretty_patch_available if not _pretty_patch_available: return "Failed to run PrettyPatch" pretty_patch_path = self.path_from_webkit_base("BugsSite", "PrettyPatch") prettify_path = os.path.join(pretty_patch_path, "prettify.rb") command = ["ruby", "-I", pretty_patch_path, p... |
attrs = [("builder", self._options.builder_name)] | attrs = [("builder", self._options.builder_name), ("testtype", "layout-tests")] if self._options.master_name: attrs.append(("master", self._options.master_name)) | def _upload_json_files(self): if not self._options.test_results_server: return |
retries = 0 | def run(self, result_summary, print_results): """Run all our tests on all our test files. | |
while (retries < self.NUM_RETRY_ON_UNEXPECTED_FAILURE and | while (self._retries < self.NUM_RETRY_ON_UNEXPECTED_FAILURE and | def run(self, result_summary, print_results): """Run all our tests on all our test files. |
_log.debug("Retrying %d unexpected failure(s)" % len(failures)) retries += 1 | _log.info('') _log.info("Retrying %d unexpected failure(s)" % len(failures)) _log.info('') self._retries += 1 | def run(self, result_summary, print_results): """Run all our tests on all our test files. |
self._meter.progress("Testing (%d%%): %d ran as expected, %d didn't," " %d left" % (percent_complete, result_summary.expected, | action = "Testing" if self._retries > 0: action = "Retrying" self._meter.progress("%s (%d%%): %d ran as expected, %d didn't," " %d left" % (action, percent_complete, result_summary.expected, | def _display_one_line_progress(self, result_summary): """Displays the progress through the test run.""" percent_complete = 100 * (result_summary.expected + result_summary.unexpected) / result_summary.total self._meter.progress("Testing (%d%%): %d ran as expected, %d didn't," " %d left" % (percent_complete, result_summa... |
fd, file_path = tempfile.mkstemp(suffix='.zip', prefix='file-') | fd, file_path = tempfile.mkstemp(suffix='.zip', prefix='file-downloads-') | def _MakeFile(self, size): """Make a file on-the-fly with the given size. Returns the path to the file. """ fd, file_path = tempfile.mkstemp(suffix='.zip', prefix='file-') os.lseek(fd, size, 0) os.write(fd, 'a') os.close(fd) return file_path |
return '' return self._build_path(self._options.configuration, 'image_diff') | binary_name = 'ImageDiff' return self._build_path(self._options.configuration, binary_name) | def _path_to_image_diff(self): if self._options.use_drt: # FIXME(tony): This should use ImageDiff. return '' return self._build_path(self._options.configuration, 'image_diff') |
if not self._options.noshow_results and wrote_results: | if self._options.show_results and wrote_results: | def run(self, result_summary, print_results): """Run all our tests on all our test files. |
old_run_webkit_tests_compat = [ _compat_shim_option("--no-new-test-results"), _compat_shim_option("--no-sample-on-timeout"), _compat_shim_option("--use-remote-links-to-tests"), _compat_shim_option("--exit-after-n-failures", nargs=1), ] | def parse_args(args=None): """Provides a default set of command line args. Returns a tuple of options, args from optparse""" # FIXME: All of these options should be stored closer to the code which # FIXME: actually uses them. configuration_options should move # FIXME: to WebKitPort and be shared across all scripts. c... | |
optparse.make_option("-p", "--pixel-tests'", action="store_true", | optparse.make_option("-p", "--pixel-tests", action="store_true", | def parse_args(args=None): """Provides a default set of command line args. Returns a tuple of options, args from optparse""" # FIXME: All of these options should be stored closer to the code which # FIXME: actually uses them. configuration_options should move # FIXME: to WebKitPort and be shared across all scripts. c... |
optparse.make_option("--noshow-results", action="store_true", default=False, | optparse.make_option("--no-show-results", action="store_false", default=True, dest="show_results", | def parse_args(args=None): """Provides a default set of command line args. Returns a tuple of options, args from optparse""" # FIXME: All of these options should be stored closer to the code which # FIXME: actually uses them. configuration_options should move # FIXME: to WebKitPort and be shared across all scripts. c... |
misc_options + results_json_options) | misc_options + results_json_options + old_run_webkit_tests_compat) | def parse_args(args=None): """Provides a default set of command line args. Returns a tuple of options, args from optparse""" # FIXME: All of these options should be stored closer to the code which # FIXME: actually uses them. configuration_options should move # FIXME: to WebKitPort and be shared across all scripts. c... |
return 'out' | return '../out' | def PlatformBuildPrefix(self): """Return a platform specific build directory prefix. |
if sys.platform != 'win32': | if sys.platform != 'win32' and sys.platform != 'cygwin': | def Main(): '''Main function for this script''' parser = GetOptionParser() (opt, args) = parser.parse_args() output = opt.output remove = opt.remove if not output: parser.error('You must specify an output file') if not args: parser.error('You must specify at least one object or library') output = output.strip() remov... |
Committer("Yury Semikhatsky", "yurys@chromium.org"), | def __init__(self, name, email_or_emails, irc_nickname=None): Committer.__init__(self, name, email_or_emails, irc_nickname) self.can_review = True | |
ret += ["--show-possible=no"] | ret += ["--show-possibly-lost=no"] | def ToolSpecificFlags(self): ret = ["--leak-check=full", "--gen-suppressions=all", "--demangle=no"] |
self._browser["attachment_id"] = patch.id() | self._browser["attachment_id"] = unicode(patch.id()) | def _post_release_work_item(self, queue_name, patch): release_patch_url = "%s/release-patch/%s" % (self.url, queue_name) self._browser.open(release_patch_url) self._browser.select_form(name="release_patch") self._browser["queue_name"] = queue_name self._browser["attachment_id"] = patch.id() self._browser.submit() |
executable = self._path_to_wdiff() cmd = [executable, '--start-delete= '--end-delete= '--start-insert= '--end-insert= actual_filename, expected_filename] | def wdiff_text(self, actual_filename, expected_filename): """Returns a string of HTML indicating the word-level diff of the contents of the two filenames. Returns an empty string if word-level diffing isn't available.""" executable = self._path_to_wdiff() cmd = [executable, '--start-delete=##WDIFF_DEL##', '--end-delete... | |
result = '' | if not _wdiff_available: return "" | def wdiff_text(self, actual_filename, expected_filename): """Returns a string of HTML indicating the word-level diff of the contents of the two filenames. Returns an empty string if word-level diffing isn't available.""" executable = self._path_to_wdiff() cmd = [executable, '--start-delete=##WDIFF_DEL##', '--end-delete... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.