Skip to content

Commit 0bd3283

Browse files
amyreesefacebook-github-bot
authored andcommitted
apply black 20.8b1 formatting update
Summary: allow-large-files black_any_style Reviewed By: zertosh Differential Revision: D24325133 fbshipit-source-id: b4afe80d1e8b2bc993f4b8e3822c02964df47462
1 parent 644155c commit 0bd3283

File tree

12 files changed

+84
-84
lines changed

12 files changed

+84
-84
lines changed

build/fbcode_builder/getdeps.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@ def setup_project_cmd_parser(self, parser):
207207

208208

209209
class CachedProject(object):
210-
""" A helper that allows calling the cache logic for a project
211-
from both the build and the fetch code """
210+
"""A helper that allows calling the cache logic for a project
211+
from both the build and the fetch code"""
212212

213213
def __init__(self, cache, loader, m):
214214
self.m = m

build/fbcode_builder/getdeps/builder.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,17 @@ def build(self, install_dirs, reconfigure):
103103
def run_tests(
104104
self, install_dirs, schedule_type, owner, test_filter, retry, no_testpilot
105105
):
106-
""" Execute any tests that we know how to run. If they fail,
107-
raise an exception. """
106+
"""Execute any tests that we know how to run. If they fail,
107+
raise an exception."""
108108
pass
109109

110110
def _build(self, install_dirs, reconfigure):
111-
""" Perform the build.
111+
"""Perform the build.
112112
install_dirs contains the list of installation directories for
113113
the dependencies of this project.
114114
reconfigure will be set to true if the fetcher determined
115115
that the sources have changed in such a way that the build
116-
system needs to regenerate its rules. """
116+
system needs to regenerate its rules."""
117117
pass
118118

119119
def _compute_env(self, install_dirs):
@@ -575,7 +575,7 @@ def run_tests(
575575
use_cmd_prefix = False
576576

577577
def get_property(test, propname, defval=None):
578-
""" extracts a named property from a cmake test info json blob.
578+
"""extracts a named property from a cmake test info json blob.
579579
The properties look like:
580580
[{"name": "WORKING_DIRECTORY"},
581581
{"value": "something"}]

build/fbcode_builder/getdeps/buildopts.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,18 @@ def __init__(
5656
vcvars_path=None,
5757
allow_system_packages=False,
5858
):
59-
""" fbcode_builder_dir - the path to either the in-fbsource fbcode_builder dir,
60-
or for shipit-transformed repos, the build dir that
61-
has been mapped into that dir.
62-
scratch_dir - a place where we can store repos and build bits.
63-
This path should be stable across runs and ideally
64-
should not be in the repo of the project being built,
65-
but that is ultimately where we generally fall back
66-
for builds outside of FB
67-
install_dir - where the project will ultimately be installed
68-
num_jobs - the level of concurrency to use while building
69-
use_shipit - use real shipit instead of the simple shipit transformer
70-
vcvars_path - Path to external VS toolchain's vsvarsall.bat
59+
"""fbcode_builder_dir - the path to either the in-fbsource fbcode_builder dir,
60+
or for shipit-transformed repos, the build dir that
61+
has been mapped into that dir.
62+
scratch_dir - a place where we can store repos and build bits.
63+
This path should be stable across runs and ideally
64+
should not be in the repo of the project being built,
65+
but that is ultimately where we generally fall back
66+
for builds outside of FB
67+
install_dir - where the project will ultimately be installed
68+
num_jobs - the level of concurrency to use while building
69+
use_shipit - use real shipit instead of the simple shipit transformer
70+
vcvars_path - Path to external VS toolchain's vsvarsall.bat
7171
"""
7272
if not num_jobs:
7373
import multiprocessing

build/fbcode_builder/getdeps/cache.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,33 @@
77

88

99
class ArtifactCache(object):
10-
""" The ArtifactCache is a small abstraction that allows caching
10+
"""The ArtifactCache is a small abstraction that allows caching
1111
named things in some external storage mechanism.
1212
The primary use case is for storing the build products on CI
13-
systems to accelerate the build """
13+
systems to accelerate the build"""
1414

1515
def download_to_file(self, name, dest_file_name):
16-
""" If `name` exists in the cache, download it and place it
16+
"""If `name` exists in the cache, download it and place it
1717
in the specified `dest_file_name` location on the filesystem.
1818
If a transient issue was encountered a TransientFailure shall
1919
be raised.
2020
If `name` doesn't exist in the cache `False` shall be returned.
2121
If `dest_file_name` was successfully updated `True` shall be
2222
returned.
23-
All other conditions shall raise an appropriate exception. """
23+
All other conditions shall raise an appropriate exception."""
2424
return False
2525

2626
def upload_from_file(self, name, source_file_name):
27-
""" Causes `name` to be populated in the cache by uploading
27+
"""Causes `name` to be populated in the cache by uploading
2828
the contents of `source_file_name` to the storage system.
2929
If a transient issue was encountered a TransientFailure shall
3030
be raised.
3131
If the upload failed for some other reason, an appropriate
32-
exception shall be raised. """
32+
exception shall be raised."""
3333
pass
3434

3535

3636
def create_cache():
37-
""" This function is monkey patchable to provide an actual
38-
implementation """
37+
"""This function is monkey patchable to provide an actual
38+
implementation"""
3939
return None

build/fbcode_builder/getdeps/copytree.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ def find_eden_root(dirpath):
4848

4949

5050
def prefetch_dir_if_eden(dirpath):
51-
""" After an amend/rebase, Eden may need to fetch a large number
51+
"""After an amend/rebase, Eden may need to fetch a large number
5252
of trees from the servers. The simplistic single threaded walk
5353
performed by copytree makes this more expensive than is desirable
5454
so we help accelerate things by performing a prefetch on the
55-
source directory """
55+
source directory"""
5656
global PREFETCHED_DIRS
5757
if dirpath in PREFETCHED_DIRS:
5858
return
@@ -68,7 +68,7 @@ def prefetch_dir_if_eden(dirpath):
6868

6969

7070
def copytree(src_dir, dest_dir, ignore=None):
71-
""" Recursively copy the src_dir to the dest_dir, filtering
71+
"""Recursively copy the src_dir to the dest_dir, filtering
7272
out entries using the ignore lambda. The behavior of the
7373
ignore lambda must match that described by `shutil.copytree`.
7474
This `copytree` function knows how to prefetch data when

build/fbcode_builder/getdeps/envfuncs.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@ def items(self):
121121

122122

123123
def add_path_entry(env, name, item, append=True, separator=os.pathsep):
124-
""" Cause `item` to be added to the path style env var named
124+
"""Cause `item` to be added to the path style env var named
125125
`name` held in the `env` dict. `append` specifies whether
126126
the item is added to the end (the default) or should be
127-
prepended if `name` already exists. """
127+
prepended if `name` already exists."""
128128
val = env.get(name, "")
129129
if len(val) > 0:
130130
val = val.split(separator)
@@ -138,10 +138,10 @@ def add_path_entry(env, name, item, append=True, separator=os.pathsep):
138138

139139

140140
def add_flag(env, name, flag, append=True):
141-
""" Cause `flag` to be added to the CXXFLAGS-style env var named
141+
"""Cause `flag` to be added to the CXXFLAGS-style env var named
142142
`name` held in the `env` dict. `append` specifies whether the
143143
flag is added to the end (the default) or should be prepended if
144-
`name` already exists. """
144+
`name` already exists."""
145145
val = shlex.split(env.get(name, ""))
146146
if append:
147147
val.append(flag)
@@ -155,11 +155,11 @@ def add_flag(env, name, flag, append=True):
155155

156156

157157
def path_search(env, exename, defval=None):
158-
""" Search for exename in the PATH specified in env.
158+
"""Search for exename in the PATH specified in env.
159159
exename is eg: `ninja` and this function knows to append a .exe
160160
to the end on windows.
161161
Returns the path to the exe if found, or None if either no
162-
PATH is set in env or no executable is found. """
162+
PATH is set in env or no executable is found."""
163163

164164
path = env.get("PATH", None)
165165
if path is None:

build/fbcode_builder/getdeps/errors.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88

99
class TransientFailure(Exception):
10-
""" Raising this error causes getdeps to return with an error code
10+
"""Raising this error causes getdeps to return with an error code
1111
that Sandcastle will consider to be a retryable transient
12-
infrastructure error """
12+
infrastructure error"""
1313

1414
pass
1515

build/fbcode_builder/getdeps/expr.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
def parse_expr(expr_text, valid_variables):
13-
""" parses the simple criteria expression syntax used in
13+
"""parses the simple criteria expression syntax used in
1414
dependency specifications.
1515
Returns an ExprNode instance that can be evaluated like this:
1616

build/fbcode_builder/getdeps/fetcher.py

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def file_name_is_cmake_file(file_name):
4646

4747

4848
class ChangeStatus(object):
49-
""" Indicates the nature of changes that happened while updating
49+
"""Indicates the nature of changes that happened while updating
5050
the source directory. There are two broad uses:
5151
* When extracting archives for third party software we want to
5252
know that we did something (eg: we either extracted code or
@@ -59,9 +59,9 @@ class ChangeStatus(object):
5959
"""
6060

6161
def __init__(self, all_changed=False):
62-
""" Construct a ChangeStatus object. The default is to create
62+
"""Construct a ChangeStatus object. The default is to create
6363
a status that indicates no changes, but passing all_changed=True
64-
will create one that indicates that everything changed """
64+
will create one that indicates that everything changed"""
6565
if all_changed:
6666
self.source_files = 1
6767
self.make_files = 1
@@ -70,7 +70,7 @@ def __init__(self, all_changed=False):
7070
self.make_files = 0
7171

7272
def record_change(self, file_name):
73-
""" Used by the shipit fetcher to record changes as it updates
73+
"""Used by the shipit fetcher to record changes as it updates
7474
files in the destination. If the file name might be one used
7575
in the cmake build system that we use for 1st party code, then
7676
record that as a "make file" change. We could broaden this
@@ -79,7 +79,7 @@ def record_change(self, file_name):
7979
If the file isn't a build file and is under the `fbcode_builder`
8080
dir then we don't class that as an interesting change that we
8181
might need to rebuild, so we ignore it.
82-
Otherwise we record the file as a source file change. """
82+
Otherwise we record the file as a source file change."""
8383

8484
file_name = file_name.lower()
8585
if file_name_is_cmake_file(file_name):
@@ -90,41 +90,41 @@ def record_change(self, file_name):
9090
self.source_files += 1
9191

9292
def sources_changed(self):
93-
""" Returns true if any source files were changed during
93+
"""Returns true if any source files were changed during
9494
an update operation. This will typically be used to decide
9595
that the build system to be run on the source dir in an
96-
incremental mode """
96+
incremental mode"""
9797
return self.source_files > 0
9898

9999
def build_changed(self):
100-
""" Returns true if any build files were changed during
100+
"""Returns true if any build files were changed during
101101
an update operation. This will typically be used to decidfe
102102
that the build system should be reconfigured and re-run
103-
as a full build """
103+
as a full build"""
104104
return self.make_files > 0
105105

106106

107107
class Fetcher(object):
108-
""" The Fetcher is responsible for fetching and extracting the
108+
"""The Fetcher is responsible for fetching and extracting the
109109
sources for project. The Fetcher instance defines where the
110110
extracted data resides and reports this to the consumer via
111-
its `get_src_dir` method. """
111+
its `get_src_dir` method."""
112112

113113
def update(self):
114-
""" Brings the src dir up to date, ideally minimizing
114+
"""Brings the src dir up to date, ideally minimizing
115115
changes so that a subsequent build doesn't over-build.
116116
Returns a ChangeStatus object that helps the caller to
117117
understand the nature of the changes required during
118-
the update. """
118+
the update."""
119119
return ChangeStatus()
120120

121121
def clean(self):
122-
""" Reverts any changes that might have been made to
123-
the src dir """
122+
"""Reverts any changes that might have been made to
123+
the src dir"""
124124
pass
125125

126126
def hash(self):
127-
""" Returns a hash that identifies the version of the code in the
127+
"""Returns a hash that identifies the version of the code in the
128128
working copy. For a git repo this is commit hash for the working
129129
copy. For other Fetchers this should relate to the version of
130130
the code in the src dir. The intent is that if a manifest
@@ -137,17 +137,17 @@ def hash(self):
137137
pass
138138

139139
def get_src_dir(self):
140-
""" Returns the source directory that the project was
141-
extracted into """
140+
"""Returns the source directory that the project was
141+
extracted into"""
142142
pass
143143

144144

145145
class LocalDirFetcher(object):
146-
""" This class exists to override the normal fetching behavior, and
146+
"""This class exists to override the normal fetching behavior, and
147147
use an explicit user-specified directory for the project sources.
148148
149149
This fetcher cannot update or track changes. It always reports that the
150-
project has changed, forcing it to always be built. """
150+
project has changed, forcing it to always be built."""
151151

152152
def __init__(self, path):
153153
self.path = os.path.realpath(path)
@@ -337,9 +337,9 @@ def does_file_need_update(src_name, src_st, dest_name):
337337

338338

339339
def copy_if_different(src_name, dest_name):
340-
""" Copy src_name -> dest_name, but only touch dest_name
340+
"""Copy src_name -> dest_name, but only touch dest_name
341341
if src_name is different from dest_name, making this a
342-
more build system friendly way to copy. """
342+
more build system friendly way to copy."""
343343
src_st = os.lstat(src_name)
344344
if not does_file_need_update(src_name, src_st, dest_name):
345345
return False
@@ -379,19 +379,19 @@ def __init__(self):
379379
self.exclusion = []
380380

381381
def add_mapping(self, fbsource_dir, target_dir):
382-
""" Add a posix path or pattern. We cannot normpath the input
382+
"""Add a posix path or pattern. We cannot normpath the input
383383
here because that would change the paths from posix to windows
384-
form and break the logic throughout this class. """
384+
form and break the logic throughout this class."""
385385
self.roots.append(fbsource_dir)
386386
self.mapping.append((fbsource_dir, target_dir))
387387

388388
def add_exclusion(self, pattern):
389389
self.exclusion.append(re.compile(pattern))
390390

391391
def _minimize_roots(self):
392-
""" compute the de-duplicated set of roots within fbsource.
392+
"""compute the de-duplicated set of roots within fbsource.
393393
We take the shortest common directory prefix to make this
394-
determination """
394+
determination"""
395395
self.roots.sort(key=len)
396396
minimized = []
397397

@@ -496,10 +496,10 @@ class FbsourceRepoData(NamedTuple):
496496

497497

498498
def get_fbsource_repo_data(build_options):
499-
""" Returns the commit metadata for the fbsource repo.
499+
"""Returns the commit metadata for the fbsource repo.
500500
Since we may have multiple first party projects to
501501
hash, and because we don't mutate the repo, we cache
502-
this hash in a global. """
502+
this hash in a global."""
503503
cached_data = FBSOURCE_REPO_DATA.get(build_options.fbsource_dir)
504504
if cached_data:
505505
return cached_data

0 commit comments

Comments
 (0)