Use backticks not vertical bars to denote variables in comments for /tools_webrtc
Bug: webrtc:12338
Change-Id: If278f212b940d453bb50774f911e7b02f418f84e
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/227028
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Artem Titov <titovartem@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34557}
diff --git a/tools_webrtc/autoroller/roll_deps.py b/tools_webrtc/autoroller/roll_deps.py
index 286c3c4..8a61b1f 100755
--- a/tools_webrtc/autoroller/roll_deps.py
+++ b/tools_webrtc/autoroller/roll_deps.py
@@ -198,7 +198,14 @@
def ReadRemoteCrFile(path_below_src, revision):
- """Reads a remote Chromium file of a specific revision. Returns a string."""
+ """Reads a remote Chromium file of a specific revision.
+
+ Args:
+ path_below_src: A path to the target file relative to src dir.
+ revision: Revision to read.
+ Returns:
+ A string with file content.
+ """
return _ReadGitilesContent(CHROMIUM_FILE_TEMPLATE %
(revision, path_below_src))
@@ -209,7 +216,13 @@
def ReadUrlContent(url):
- """Connect to a remote host and read the contents. Returns a list of lines."""
+ """Connect to a remote host and read the contents.
+
+ Args:
+ url: URL to connect to.
+ Returns:
+ A list of lines.
+ """
conn = urllib2.urlopen(url)
try:
return conn.readlines()
@@ -245,7 +258,7 @@
def BuildDepsentryDict(deps_dict):
- """Builds a dict of paths to DepsEntry objects from a raw parsed deps dict."""
+ """Builds a dict of paths to DepsEntry objects from a raw deps dict."""
result = {}
def AddDepsEntries(deps_subdict):
@@ -287,7 +300,7 @@
def _FindNewDeps(old, new):
- """ Gather dependencies only in |new| and return corresponding paths. """
+ """ Gather dependencies only in `new` and return corresponding paths. """
old_entries = set(BuildDepsentryDict(old))
new_entries = set(BuildDepsentryDict(new))
return [
@@ -304,7 +317,7 @@
but transitively used in WebRTC.
Since it's hard to compute, we restrict ourselves to a well defined subset:
- deps sitting in |ANDROID_DEPS_PATH|.
+ deps sitting in `ANDROID_DEPS_PATH`.
Otherwise, assumes that's a Chromium-only dependency.
Args:
@@ -315,7 +328,7 @@
Returns:
A tuple consisting of:
- A list of paths added dependencies sitting in |ANDROID_DEPS_PATH|.
+ A list of paths added dependencies sitting in `ANDROID_DEPS_PATH`.
A list of paths for other added dependencies.
"""
all_added_deps = _FindNewDeps(webrtc_deps, new_cr_deps)
@@ -337,7 +350,7 @@
Since it's hard to compute:
1/ We restrict ourselves to a well defined subset:
- deps sitting in |ANDROID_DEPS_PATH|.
+ deps sitting in `ANDROID_DEPS_PATH`.
2/ We rely on existing behavior of CalculateChangeDeps.
I.e. Assumes non-CIPD dependencies are WebRTC-only, don't remove them.
@@ -349,7 +362,7 @@
Returns:
A tuple consisting of:
- A list of paths of dependencies removed from |ANDROID_DEPS_PATH|.
+ A list of paths of dependencies removed from `ANDROID_DEPS_PATH`.
A list of paths of unexpected disappearing dependencies.
"""
all_removed_deps = _FindNewDeps(new_cr_deps, webrtc_deps)
@@ -398,7 +411,7 @@
# Use the revision from Chromium's DEPS file.
new_rev = cr_deps_entry.revision
assert webrtc_deps_entry.url == cr_deps_entry.url, (
- 'WebRTC DEPS entry %s has a different URL (%s) than Chromium (%s).'
+ 'WebRTC DEPS entry %s has a different URL %s than Chromium %s.'
% (path, webrtc_deps_entry.url, cr_deps_entry.url))
else:
if isinstance(webrtc_deps_entry, DepsEntry):
diff --git a/tools_webrtc/vim/webrtc.ycm_extra_conf.py b/tools_webrtc/vim/webrtc.ycm_extra_conf.py
index b8727d9..12a09ed 100644
--- a/tools_webrtc/vim/webrtc.ycm_extra_conf.py
+++ b/tools_webrtc/vim/webrtc.ycm_extra_conf.py
@@ -103,10 +103,10 @@
def GetDefaultSourceFile(webrtc_root, filename):
- """Returns the default source file to use as an alternative to |filename|.
+ """Returns the default source file to use as an alternative to `filename`.
Compile flags used to build the default source file is assumed to be a
- close-enough approximation for building |filename|.
+ close-enough approximation for building `filename`.
Args:
webrtc_root: (String) Absolute path to the root of WebRTC checkout.
@@ -124,7 +124,7 @@
"""Returns a list of build outputs for filename.
The list is generated by invoking 'ninja -t query' tool to retrieve a list of
- inputs and outputs of |filename|. This list is then filtered to only include
+ inputs and outputs of `filename`. This list is then filtered to only include
.o and .obj outputs.
Args:
@@ -132,7 +132,7 @@
filename: (String) Absolute path to source file.
Returns:
- (List of Strings) List of target names. Will return [] if |filename| doesn't
+ (List of Strings) List of target names. Will return [] if `filename` doesn't
yield any .o or .obj outputs.
"""
# Ninja needs the path to the source file relative to the output build
@@ -163,9 +163,9 @@
def GetClangCommandLineForNinjaOutput(out_dir, build_target):
- """Returns the Clang command line for building |build_target|
+ """Returns the Clang command line for building `build_target`
- Asks ninja for the list of commands used to build |filename| and returns the
+ Asks ninja for the list of commands used to build `filename` and returns the
final Clang invocation.
Args:
@@ -185,8 +185,8 @@
return None
# Ninja will return multiple build steps for all dependencies up to
- # |build_target|. The build step we want is the last Clang invocation, which
- # is expected to be the one that outputs |build_target|.
+ # `build_target`. The build step we want is the last Clang invocation, which
+ # is expected to be the one that outputs `build_target`.
for line in reversed(stdout.split('\n')):
if 'clang' in line:
return line
@@ -194,7 +194,7 @@
def GetClangCommandLineFromNinjaForSource(out_dir, filename):
- """Returns a Clang command line used to build |filename|.
+ """Returns a Clang command line used to build `filename`.
The same source file could be built multiple times using different tool
chains. In such cases, this command returns the first Clang invocation. We
@@ -207,7 +207,7 @@
filename: (String) Absolute path to source file.
Returns:
- (String or None): Command line for Clang invocation using |filename| as a
+ (String or None): Command line for Clang invocation using `filename` as a
source. Returns None if no such command line could be found.
"""
build_targets = GetNinjaBuildOutputsForSourceFile(out_dir, filename)
@@ -220,12 +220,12 @@
def GetClangOptionsFromCommandLine(clang_commandline, out_dir,
additional_flags):
- """Extracts relevant command line options from |clang_commandline|
+ """Extracts relevant command line options from `clang_commandline`
Args:
clang_commandline: (String) Full Clang invocation.
out_dir: (String) Absolute path to ninja build directory. Relative paths in
- the command line are relative to |out_dir|.
+ the command line are relative to `out_dir`.
additional_flags: (List of String) Additional flags to return.
Returns:
@@ -238,8 +238,8 @@
clang_tokens = shlex.split(clang_commandline)
for flag_index, flag in enumerate(clang_tokens):
if flag.startswith('-I'):
- # Relative paths need to be resolved, because they're relative to the
- # output dir, not the source.
+ # Relative paths need to be resolved, because they're relative to
+ # the output dir, not the source.
if flag[2] == '/':
clang_flags.append(flag)
else:
@@ -248,9 +248,10 @@
elif flag.startswith('-std'):
clang_flags.append(flag)
elif flag.startswith('-') and flag[1] in 'DWFfmO':
- if flag == '-Wno-deprecated-register' or flag == '-Wno-header-guard':
- # These flags causes libclang (3.3) to crash. Remove it until things
- # are fixed.
+ if (flag == '-Wno-deprecated-register' or
+ flag == '-Wno-header-guard'):
+ # These flags causes libclang (3.3) to crash. Remove it until
+ # things are fixed.
continue
clang_flags.append(flag)
elif flag == '-isysroot':
@@ -272,12 +273,12 @@
def GetClangOptionsFromNinjaForFilename(webrtc_root, filename):
- """Returns the Clang command line options needed for building |filename|.
+ """Returns the Clang command line options needed for building `filename`.
Command line options are based on the command used by ninja for building
- |filename|. If |filename| is a .h file, uses its companion .cc or .cpp file.
+ `filename`. If `filename` is a .h file, uses its companion .cc or .cpp file.
If a suitable companion file can't be located or if ninja doesn't know about
- |filename|, then uses default source files in WebRTC for determining the
+ `filename`, then uses default source files in WebRTC for determining the
commandline.
Args:
@@ -296,9 +297,9 @@
additional_flags = ['-I' + os.path.join(webrtc_root)]
# Version of Clang used to compile WebRTC can be newer then version of
- # libclang that YCM uses for completion. So it's possible that YCM's libclang
- # doesn't know about some used warning options, which causes compilation
- # warnings (and errors, because of '-Werror');
+ # libclang that YCM uses for completion. So it's possible that YCM's
+ # libclang doesn't know about some used warning options, which causes
+ # compilation warnings (and errors, because of '-Werror');
additional_flags.append('-Wno-unknown-warning-option')
sys.path.append(os.path.join(webrtc_root, 'tools', 'vim'))
@@ -322,9 +323,9 @@
additional_flags += _EXTENSION_FLAGS.get(buildable_extension, [])
if not clang_line:
- # If ninja didn't know about filename or it's companion files, then try a
- # default build target. It is possible that the file is new, or build.ninja
- # is stale.
+ # If ninja didn't know about filename or it's companion files, then try
+ # a default build target. It is possible that the file is new, or
+ # build.ninja is stale.
clang_line = GetClangCommandLineFromNinjaForSource(
out_dir, GetDefaultSourceFile(webrtc_root, filename))
@@ -352,8 +353,8 @@
abs_filename)
# If clang_flags could not be determined, then assume that was due to a
- # transient failure. Preventing YCM from caching the flags allows us to try to
- # determine the flags again.
+ # transient failure. Preventing YCM from caching the flags allows us to
+ # try to determine the flags again.
should_cache_flags_for_file = bool(clang_flags)
final_flags = _DEFAULT_FLAGS + clang_flags