From 72214954830cdaa4523c10f432f6c13daea2ac5d Mon Sep 17 00:00:00 2001 From: John Reese Date: Tue, 4 May 2021 22:13:57 -0700 Subject: [PATCH] apply upgraded black 21.4b2 formatting to fbsource Summary: This applies the formatting changes from black v21.4b2 to all covered projects in fbsource. Most changes are to single line docstrings, as black will now remove leading and trailing whitespace to match PEP8. Any other formatting changes are likely due to files that landed without formatting, or files that previously triggered errors in black. Any changes to code should be AST identical. Any test failures are likely due to bad tests, or testing against the output of pyfmt. Reviewed By: thatch Differential Revision: D28204910 fbshipit-source-id: 804725bcd14f763e90c5ddff1d0418117c15809a --- build/fbcode_builder/getdeps.py | 2 +- build/fbcode_builder/getdeps/buildopts.py | 4 ++-- build/fbcode_builder/getdeps/fetcher.py | 2 +- build/fbcode_builder/getdeps/load.py | 4 ++-- build/fbcode_builder/getdeps/manifest.py | 4 ++-- build/fbcode_builder/getdeps/subcmd.py | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/build/fbcode_builder/getdeps.py b/build/fbcode_builder/getdeps.py index 5f661e614..b455d12c7 100755 --- a/build/fbcode_builder/getdeps.py +++ b/build/fbcode_builder/getdeps.py @@ -235,7 +235,7 @@ class CachedProject(object): ) def is_cacheable(self): - """ We only cache third party projects """ + """We only cache third party projects""" return self.cache and self.m.shipit_project is None def was_cached(self): diff --git a/build/fbcode_builder/getdeps/buildopts.py b/build/fbcode_builder/getdeps/buildopts.py index 993a3ba01..f1c9e1bc0 100644 --- a/build/fbcode_builder/getdeps/buildopts.py +++ b/build/fbcode_builder/getdeps/buildopts.py @@ -148,7 +148,7 @@ class BuildOptions(object): return self.host_type.is_linux() def get_context_generator(self, host_tuple=None, facebook_internal=None): - """ Create a manifest ContextGenerator for the specified target platform. """ + """Create a manifest ContextGenerator for the specified target platform.""" if host_tuple is None: host_type = self.host_type elif isinstance(host_tuple, HostType): @@ -364,7 +364,7 @@ def _check_host_type(args, host_type): def setup_build_options(args, host_type=None): - """ Create a BuildOptions object based on the arguments """ + """Create a BuildOptions object based on the arguments""" fbcode_builder_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) scratch_dir = args.scratch_path diff --git a/build/fbcode_builder/getdeps/fetcher.py b/build/fbcode_builder/getdeps/fetcher.py index 1bd0d78d8..041549ad7 100644 --- a/build/fbcode_builder/getdeps/fetcher.py +++ b/build/fbcode_builder/getdeps/fetcher.py @@ -690,7 +690,7 @@ class ArchiveFetcher(Fetcher): ) def _download_dir(self): - """ returns the download dir, creating it if it doesn't already exist """ + """returns the download dir, creating it if it doesn't already exist""" download_dir = os.path.dirname(self.file_name) if not os.path.exists(download_dir): os.makedirs(download_dir) diff --git a/build/fbcode_builder/getdeps/load.py b/build/fbcode_builder/getdeps/load.py index 22b653dea..c5f40d2fa 100644 --- a/build/fbcode_builder/getdeps/load.py +++ b/build/fbcode_builder/getdeps/load.py @@ -16,10 +16,10 @@ from .manifest import ManifestParser class Loader(object): - """ The loader allows our tests to patch the load operation """ + """The loader allows our tests to patch the load operation""" def _list_manifests(self, build_opts): - """ Returns a generator that iterates all the available manifests """ + """Returns a generator that iterates all the available manifests""" for (path, _, files) in os.walk(build_opts.manifests_dir): for name in files: # skip hidden files diff --git a/build/fbcode_builder/getdeps/manifest.py b/build/fbcode_builder/getdeps/manifest.py index eecdc7f85..0d03d383c 100644 --- a/build/fbcode_builder/getdeps/manifest.py +++ b/build/fbcode_builder/getdeps/manifest.py @@ -330,11 +330,11 @@ class ManifestParser(object): hasher.update(value.encode("utf-8")) def is_first_party_project(self): - """ returns true if this is an FB first-party project """ + """returns true if this is an FB first-party project""" return self.shipit_project is not None def get_required_system_packages(self, ctx): - """ Returns dictionary of packager system -> list of packages """ + """Returns dictionary of packager system -> list of packages""" return { "rpm": self.get_section_as_args("rpms", ctx), "deb": self.get_section_as_args("debs", ctx), diff --git a/build/fbcode_builder/getdeps/subcmd.py b/build/fbcode_builder/getdeps/subcmd.py index ff033e595..95f9a07ca 100644 --- a/build/fbcode_builder/getdeps/subcmd.py +++ b/build/fbcode_builder/getdeps/subcmd.py @@ -11,7 +11,7 @@ class SubCmd(object): HELP = None def run(self, args): - """ perform the command """ + """perform the command""" return 0 def setup_parser(self, parser): @@ -24,7 +24,7 @@ CmdTable = [] def add_subcommands(parser, common_args, cmd_table=CmdTable): - """ Register parsers for the defined commands with the provided parser """ + """Register parsers for the defined commands with the provided parser""" for cls in cmd_table: command = cls() command_parser = parser.add_parser(