Formatting: Format all python code with black.
This CL is probably not what you're looking for, it's only
automated formatting. Ignore it with
`git blame --ignore-rev <revision>` for this commit.
BUG=b:233893248
TEST=CQ
Change-Id: I66591d7a738d241aed3290138c0f68065ab10a6d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/3879174
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Alex Klein <saklein@chromium.org>
diff --git a/scripts/fetch_cipd.py b/scripts/fetch_cipd.py
index c3b8b5c..484ab59 100644
--- a/scripts/fetch_cipd.py
+++ b/scripts/fetch_cipd.py
@@ -22,37 +22,48 @@
def GetParser():
- """Creates the argparse parser."""
- parser = commandline.ArgumentParser(description=__doc__)
- parser.add_argument('uri', type='cipd',
- help='CIPD URI of a file to download.')
- parser.add_argument('output', type='path',
- help='Location to store the file.')
- return parser
+ """Creates the argparse parser."""
+ parser = commandline.ArgumentParser(description=__doc__)
+ parser.add_argument(
+ "uri", type="cipd", help="CIPD URI of a file to download."
+ )
+ parser.add_argument(
+ "output", type="path", help="Location to store the file."
+ )
+ return parser
def ParseCipdUri(uri):
- o = urllib.parse.urlparse(uri)
- if o.scheme != 'cipd':
- raise ValueError('wrong scheme: ', o.scheme)
- if ':' not in o.path:
- raise ValueError('version not specified')
- pkgpath, version = o.path.rsplit(':', 1)
- return (o.netloc + pkgpath, version)
+ o = urllib.parse.urlparse(uri)
+ if o.scheme != "cipd":
+ raise ValueError("wrong scheme: ", o.scheme)
+ if ":" not in o.path:
+ raise ValueError("version not specified")
+ pkgpath, version = o.path.rsplit(":", 1)
+ return (o.netloc + pkgpath, version)
def main(argv):
- parser = GetParser()
- options = parser.parse_args(argv)
- options.Freeze()
+ parser = GetParser()
+ options = parser.parse_args(argv)
+ options.Freeze()
- (pkgpath, version) = ParseCipdUri(options.uri)
- try:
- cros_build_lib.run(
- [os.path.join(constants.DEPOT_TOOLS_DIR, 'cipd'), 'pkg-fetch',
- '-out', options.output, '-version', version, '-verbose', pkgpath],
- check=True)
+ (pkgpath, version) = ParseCipdUri(options.uri)
+ try:
+ cros_build_lib.run(
+ [
+ os.path.join(constants.DEPOT_TOOLS_DIR, "cipd"),
+ "pkg-fetch",
+ "-out",
+ options.output,
+ "-version",
+ version,
+ "-verbose",
+ pkgpath,
+ ],
+ check=True,
+ )
- except cros_build_lib.RunCommandError as ex:
- # Hide the stack trace using Die.
- cros_build_lib.Die('%s', ex)
+ except cros_build_lib.RunCommandError as ex:
+ # Hide the stack trace using Die.
+ cros_build_lib.Die("%s", ex)