tweak docstrings
This fixes section names:
Arguments -> Args
Return -> Returns
It also fixes the last line of the docstring so it isn't cuddled.
And we fix a few docstrings that should be one line but aren't.
BUG=None
TEST=`./buildbot/run_tests` passes
Change-Id: Iaafb7d346a3aee97a40dab340463894c02533091
Reviewed-on: https://chromium-review.googlesource.com/176279
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
diff --git a/scripts/autotest_quickmerge.py b/scripts/autotest_quickmerge.py
index b6c5548..33b3d4d 100644
--- a/scripts/autotest_quickmerge.py
+++ b/scripts/autotest_quickmerge.py
@@ -66,7 +66,7 @@
#pylint: disable-msg=W0102
"""Recursively determine the newest file modification time.
- Arguments:
+ Args:
path: The absolute path of the directory to recursively search.
ignore_subdirs: list of names of subdirectores of given path, to be
ignored by recursive search. Useful as a speed
@@ -99,7 +99,7 @@
within the client/site_tests directory tree, that had any files added or
modified and for whom any existing bzipped test packages may now be stale.
- Arguments:
+ Args:
change_list: A list of ItemizedChange objects corresponding to changed
or modified files.
autotest_sysroot: Absolute path of autotest in the sysroot,
@@ -118,7 +118,7 @@
def ItemizeChangesFromRsyncOutput(rsync_output, destination_path):
"""Convert the output of an rsync with `-i` to a ItemizedChangeReport object.
- Arguments:
+ Args:
rsync_output: String stdout of rsync command that was run with `-i` option.
destination_path: String absolute path of the destination directory for the
rsync operations. This argument is necessary because
@@ -152,7 +152,7 @@
def GetPackageAPI(portage_root, package_cp):
"""Gets portage API handles for the given package.
- Arguments:
+ Args:
portage_root: Root directory of portage tree. Eg '/' or '/build/lumpy'
package_cp: A string similar to 'chromeos-base/autotest-tests'.
@@ -198,7 +198,7 @@
downgrade_to_version='0'):
"""Downgrade the specified portage package version.
- Arguments:
+ Args:
portage_root: Root directory of portage tree. Eg '/' or '/build/lumpy'
package_cp: A string similar to 'chromeos-base/autotest-tests'.
downgrade_to_version: String version to downgrade to. Default: '0'
@@ -231,7 +231,7 @@
to the CONTENTS of an installed portage package, such that these files are
considered owned by that package.
- Arguments:
+ Args:
changereport: ItemizedChangeReport object for the changes to be
made to the package.
package_cp: A string similar to 'chromeos-base/autotest-tests' giving
@@ -256,7 +256,7 @@
def RemoveBzipPackages(autotest_sysroot):
"""Remove all bzipped test/dep/profiler packages from sysroot autotest.
- Arguments:
+ Args:
autotest_sysroot: Absolute path of autotest in the sysroot,
e.g. '/build/lumpy/usr/local/build/autotest'
"""
@@ -275,7 +275,7 @@
[optional --include-from argument]
--exclude=* [source_path] [sysroot_autotest_path]`
- Arguments:
+ Args:
pretend: True to use the '-n' option to rsync, to perform dry run.
overwrite: True to omit '-u' option, overwrite all files in sysroot,
not just older files.
@@ -313,7 +313,8 @@
def ParseArguments(argv):
"""Parse command line arguments
- Returns: parsed arguments.
+ Returns:
+ parsed arguments.
"""
parser = argparse.ArgumentParser(description='Perform a fast approximation '
'to emerge-$board autotest-all, by '
diff --git a/scripts/cbuildbot.py b/scripts/cbuildbot.py
index 92ec3c2..a51ea6f 100644
--- a/scripts/cbuildbot.py
+++ b/scripts/cbuildbot.py
@@ -58,7 +58,7 @@
def _PrintValidConfigs(display_all=False):
"""Print a list of valid buildbot configs.
- Arguments:
+ Args:
display_all: Print all configs. Otherwise, prints only configs with
trybot_list=True.
"""
@@ -190,7 +190,6 @@
args: args to pass to stage constructor.
kwargs: kwargs to pass to stage constructor.
Returns:
-
Whatever the stage's Run method returns.
"""
stage_instance = self._GetStageInstance(stage, *args, **kwargs)
@@ -208,7 +207,8 @@
Subclasses may override this method.
- Returns: None
+ Returns:
+ None
"""
return None
@@ -374,7 +374,8 @@
def GetSyncInstance(self):
"""Sync to lkgm or TOT as necessary.
- Returns: the instance of the sync stage to run.
+ Returns:
+ The instance of the sync stage to run.
"""
if self.options.force_version:
sync_stage = self._GetStageInstance(stages.ManifestVersionedSyncStage)
@@ -564,7 +565,8 @@
def GetSyncInstance(self):
"""Syncs the tree using one of the distributed sync logic paths.
- Returns: the instance of the sync stage to run.
+ Returns:
+ The instance of the sync stage to run.
"""
# Determine sync class to use. CQ overrides PFQ bits so should check it
# first.
@@ -652,7 +654,7 @@
def _DetermineDefaultBuildRoot(sourceroot, internal_build):
"""Default buildroot to be under the directory that contains current checkout.
- Arguments:
+ Args:
internal_build: Whether the build is an internal build
sourceroot: Use specified sourceroot.
"""
diff --git a/scripts/cros_deps_diff.py b/scripts/cros_deps_diff.py
index b0aee96..8633f94 100644
--- a/scripts/cros_deps_diff.py
+++ b/scripts/cros_deps_diff.py
@@ -42,7 +42,8 @@
"""Gets the closure of the reverse dependencies of a node.
Walks the tree along all the reverse dependency paths to find all the nodes
- of the divergent set that transitively depend on the input node."""
+ of the divergent set that transitively depend on the input node.
+ """
s = set()
def GetClosure(name):
node = deps_map[name]
@@ -83,7 +84,8 @@
"""Gets the set of divergent packages.
Divergent packages are those that have a different version among the input
- dependency graphs (or missing version altogether)."""
+ dependency graphs (or missing version altogether).
+ """
divergent_set = set()
for pkg, value in version_map.iteritems():
if len(value.keys()) != count or len(set(value.values())) > 1:
diff --git a/scripts/cros_extract_deps.py b/scripts/cros_extract_deps.py
index 9071a57..05cf206 100644
--- a/scripts/cros_extract_deps.py
+++ b/scripts/cros_extract_deps.py
@@ -79,8 +79,9 @@
package: The Portage package's name, e.g. "curl"
version: The Portage version, e.g. "7.30.0"
- Returns: A list of CPE Name strings, e.g.
- ["cpe:/a:curl:curl:7.30.0", "cpe:/a:curl:libcurl:7.30.0"]
+ Returns:
+ A list of CPE Name strings, e.g.
+ ["cpe:/a:curl:curl:7.30.0", "cpe:/a:curl:libcurl:7.30.0"]
"""
equery_cmd = ["equery", "m", "-U", "%s/%s" % (category, package)]
lines = cros_build_lib.RunCommand(equery_cmd, error_code_ok=True,
diff --git a/scripts/cros_generate_breakpad_symbols.py b/scripts/cros_generate_breakpad_symbols.py
index b8dc8f7..4c443e5 100644
--- a/scripts/cros_generate_breakpad_symbols.py
+++ b/scripts/cros_generate_breakpad_symbols.py
@@ -13,7 +13,8 @@
and converts them over using the `dump_syms` programs. Those plain text .sym
files are then stored in /build/$BOARD/usr/lib/debug/breakpad/.
-If you want to actually upload things, see upload_symbols.py."""
+If you want to actually upload things, see upload_symbols.py.
+"""
import collections
import ctypes
diff --git a/scripts/cros_generate_deps_graphs.py b/scripts/cros_generate_deps_graphs.py
index b7dffb2..4ff80ce 100644
--- a/scripts/cros_generate_deps_graphs.py
+++ b/scripts/cros_generate_deps_graphs.py
@@ -22,7 +22,8 @@
"""Gets the closure of the reverse dependencies of a node.
Walks the tree along all the reverse dependency paths to find all the nodes
- that transitively depend on the input node."""
+ that transitively depend on the input node.
+ """
s = set()
def GetClosure(name):
s.add(name)
@@ -56,7 +57,8 @@
def GenerateDotGraph(package, deps_map, options):
"""Generates the dot source for the dependency graph leading to a node.
- The output is a list of lines."""
+ The output is a list of lines.
+ """
deps = GetReverseDependencyClosure(package, deps_map)
node = deps_map[package]
diff --git a/scripts/cros_generate_sysroot.py b/scripts/cros_generate_sysroot.py
index 556de9d..a6233ae 100644
--- a/scripts/cros_generate_sysroot.py
+++ b/scripts/cros_generate_sysroot.py
@@ -51,7 +51,7 @@
def __init__(self, sysroot, options):
"""Initialize
- Arguments:
+ Args:
sysroot: Path to sysroot.
options: Parsed options.
"""
diff --git a/scripts/cros_merge_to_branch.py b/scripts/cros_merge_to_branch.py
index e9ff69e..20e17cb 100644
--- a/scripts/cros_merge_to_branch.py
+++ b/scripts/cros_merge_to_branch.py
@@ -31,7 +31,8 @@
For more information on how to do this yourself you can go here:
http://dev.chromium.org/chromium-os/how-tos-and-troubleshooting/working-on-a-br\
-anch"""
+anch
+"""
import errno
import logging
diff --git a/scripts/cros_portage_upgrade.py b/scripts/cros_portage_upgrade.py
index 46c6b3f..277c858 100644
--- a/scripts/cros_portage_upgrade.py
+++ b/scripts/cros_portage_upgrade.py
@@ -43,7 +43,8 @@
class PInfo(object):
"""Class to accumulate package info during upgrade process.
- This class is basically a formalized dictionary."""
+ This class is basically a formalized dictionary.
+ """
__slots__ = (
'category', # Package category only
@@ -845,7 +846,9 @@
Does not do the copy if the eclass already exists locally and
is identical to the upstream version.
- Returns True if the copy was done."""
+ Returns:
+ True if the copy was done.
+ """
eclass_subpath = os.path.join('eclass', eclass)
upstream_path = os.path.join(self._upstream_repo, eclass_subpath)
local_path = os.path.join(self._stable_repo, eclass_subpath)
@@ -1330,7 +1333,8 @@
pinfo of |target_pinfolist| to (parallel_)emerge.
The returned list is ordered such that the dependencies of any mentioned
- package occur earlier in the list."""
+ package occur earlier in the list.
+ """
emerge_args = []
for pinfo in target_pinfolist:
local_cpv = pinfo.cpv
@@ -1709,7 +1713,8 @@
"""Runs the upgrader based on the supplied options and arguments.
Currently just lists all package dependencies in pre-order along with
- potential upgrades."""
+ potential upgrades.
+ """
# Preserve status report for entire stable repo (output of 'git status -s').
self._SaveStatusOnStableRepo()
# Read contents of profiles/categories for later checks
diff --git a/scripts/cros_portage_upgrade_unittest.py b/scripts/cros_portage_upgrade_unittest.py
index df19862..1934a71 100755
--- a/scripts/cros_portage_upgrade_unittest.py
+++ b/scripts/cros_portage_upgrade_unittest.py
@@ -1579,7 +1579,8 @@
class UtilityTest(CpuTestBase):
"""Test several Upgrader methods.
- Test these Upgrader methods: _SplitEBuildPath, _GenPortageEnvvars"""
+ Test these Upgrader methods: _SplitEBuildPath, _GenPortageEnvvars
+ """
#
# _IsInUpgradeMode
diff --git a/scripts/deploy_chrome.py b/scripts/deploy_chrome.py
index d24600d..ff54db0 100644
--- a/scripts/deploy_chrome.py
+++ b/scripts/deploy_chrome.py
@@ -78,7 +78,7 @@
def __init__(self, options, tempdir, staging_dir):
"""Initialize the class.
- Arguments:
+ Args:
options: Optparse result structure.
tempdir: Scratch space for the class. Caller has responsibility to clean
it up.
@@ -185,7 +185,7 @@
If the command fails, and error_code_ok is True, then this function sets
self._rootfs_is_still_readonly.
- Arguments:
+ Args:
error_code_ok: See remote.RemoteAccess.RemoteSh for details.
"""
result = self.host.RemoteSh(MOUNT_RW_COMMAND, error_code_ok=error_code_ok)
@@ -203,7 +203,7 @@
def _CheckDeviceFreeSpace(self, device_info):
"""See if target device has enough space for Chrome.
- Arguments:
+ Args:
device_info: A DeviceInfo named tuple.
"""
effective_free = device_info.target_dir_size + device_info.target_fs_free
@@ -443,7 +443,8 @@
def _FetchChromePackage(cache_dir, tempdir, gs_path):
"""Get the chrome prebuilt tarball from GS.
- Returns: Path to the fetched chrome tarball.
+ Returns:
+ Path to the fetched chrome tarball.
"""
gs_ctx = gs.GSContext(cache_dir=cache_dir, init_boto=True)
files = gs_ctx.LS(gs_path).output.splitlines()
diff --git a/scripts/generate_delta_sysroot.py b/scripts/generate_delta_sysroot.py
index cf91f05..685aa79 100755
--- a/scripts/generate_delta_sysroot.py
+++ b/scripts/generate_delta_sysroot.py
@@ -41,7 +41,7 @@
This batch file can be applied to any directory identical to out_dir, to make
it identical to build_dir.
- Arguments:
+ Args:
build_dir: Directory to rsync from.
out_dir: Directory to rsync to.
batch_file: Batch file to be created.
@@ -88,7 +88,7 @@
def GenerateSysroot(sysroot, board, build_tests, unpack_only=False):
"""Create a sysroot using only binary packages from local binhost.
- Arguments:
+ Args:
sysroot: Where we want to place the sysroot.
board: Board we want to build for.
build_tests: If we should include autotest packages.
diff --git a/scripts/merge_package_status.py b/scripts/merge_package_status.py
index 695ff81..ccfdb32 100644
--- a/scripts/merge_package_status.py
+++ b/scripts/merge_package_status.py
@@ -34,7 +34,8 @@
All valid rankings are greater than zero.
- Return valid ranking for target or a false value if target is unrecognized."""
+ Returns valid ranking for target or a false value if target is unrecognized.
+ """
for ix, targ in enumerate(CHROMEOS_TARGET_ORDER):
if target == targ:
return ix + 1 # Avoid a 0 (non-true) result
diff --git a/scripts/parallel_emerge.py b/scripts/parallel_emerge.py
index 56bc1f9..fc77974 100644
--- a/scripts/parallel_emerge.py
+++ b/scripts/parallel_emerge.py
@@ -671,8 +671,9 @@
def PrintCycleBreak(basedep, dep, mycycle):
"""Print details about a cycle that we are planning on breaking.
- We are breaking a cycle where dep needs basedep. mycycle is an
- example cycle which contains dep -> basedep."""
+ We are breaking a cycle where dep needs basedep. mycycle is an
+ example cycle which contains dep -> basedep.
+ """
needs = deps_map[dep]["needs"]
depinfo = needs.get(basedep, "deleted")
@@ -1078,7 +1079,8 @@
def __init__(self, job, unlink=False):
"""Print output of job.
- If unlink is True, unlink the job output file when done."""
+ If unlink is True, unlink the job output file when done.
+ """
self.current_time = time.time()
self.job = job
self.unlink = unlink
diff --git a/scripts/upload_symbols.py b/scripts/upload_symbols.py
index d6ace19..5365b11 100644
--- a/scripts/upload_symbols.py
+++ b/scripts/upload_symbols.py
@@ -6,7 +6,8 @@
This script need only be used to upload release builds symbols or to debug
crashes on non-release builds (in which case try to only upload the symbols
-for those executables involved)."""
+for those executables involved).
+"""
import ctypes
import multiprocessing