Skip to content

Commit 12f739d

Browse files
generatedunixname89002005307016meta-codesync[bot]
authored andcommitted
Remove unused type error suppressions - opensource
Summary: This diff was automatically generated by the Pyre per-target upgrade tool. It removes `# pyre-fixme` or `pyrefly: ignore` comments that are no longer needed because the underlying type errors have been resolved. Note that it will also aim to ensure type checking runs cleanly, and will add suppressions to existing type errors. #pyreupgrade Differential Revision: D116543228 fbshipit-source-id: 32ca0b90ec80a8a018ad879bf298554063d3c8eb
1 parent 368ddb8 commit 12f739d

8 files changed

Lines changed: 0 additions & 39 deletions

File tree

build/fbcode_builder/getdeps/builder.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ def __init__(
5151
) -> None:
5252
self.env: Env = Env()
5353
if env:
54-
# pyre-fixme[6]: For 1st argument expected `Mapping[str, str]` but got
5554
# `Env`.
5655
self.env.update(env)
5756

@@ -118,7 +117,6 @@ def _run_cmd(
118117
) -> int:
119118
if env:
120119
e = self.env.copy()
121-
# pyre-fixme[6]: For 1st argument expected `Mapping[str, str]` but got
122120
# `Env`.
123121
e.update(env)
124122
env = e
@@ -168,7 +166,6 @@ def _apply_patchfile(self) -> None:
168166
patchfile = os.path.join(
169167
self.build_opts.fbcode_builder_dir,
170168
"patches",
171-
# pyre-fixme[6]: For 3rd argument expected `Union[PathLike[str], str]`
172169
# but got `Optional[str]`.
173170
self.patchfile,
174171
)
@@ -437,7 +434,6 @@ def run_tests(
437434

438435
cmd = (
439436
[self._make_binary, "-j%s" % self.num_jobs]
440-
# pyre-fixme[58]: `+` is not supported for operand types
441437
# `list[Optional[str]]` and `Optional[list[str]]`.
442438
+ self.test_args
443439
+ self._get_prefix()
@@ -608,7 +604,6 @@ def __init__(
608604

609605
def _build(self, reconfigure: bool) -> None:
610606
env = self._compute_env()
611-
# pyre-fixme[6]: For 1st argument expected `Mapping[str, str]` but got `Env`.
612607
meson: str | None = path_search(env, "meson")
613608
if meson is None:
614609
raise Exception("Failed to find Meson")
@@ -913,7 +908,6 @@ def _compute_cmake_define_args(self, env: Env) -> list[str]:
913908
# separator, so translate the runtime path to something
914909
# that cmake will parse
915910
defines["CMAKE_INSTALL_RPATH"] = ";".join(
916-
# pyre-fixme[16]: Optional type has no attribute `split`.
917911
env.get("DYLD_LIBRARY_PATH", "").split(":")
918912
)
919913
# Tell cmake that we want to set the rpath in the tree
@@ -986,7 +980,6 @@ def _build(self, reconfigure: bool) -> None:
986980
env["DESTDIR"] = self.inst_dir
987981

988982
# Resolve the cmake that we installed
989-
# pyre-fixme[6]: For 1st argument expected `Mapping[str, str]` but got `Env`.
990983
cmake = path_search(env, "cmake")
991984
if cmake is None:
992985
raise Exception("Failed to find CMake")
@@ -1004,7 +997,6 @@ def _build(self, reconfigure: bool) -> None:
1004997
self._write_build_script(
1005998
cmd_prefix=self._get_cmd_prefix(),
1006999
cmake=cmake,
1007-
# pyre-fixme[6]: For 1st argument expected `Mapping[str, str]` but
10081000
# got `Env`.
10091001
ctest=path_search(env, "ctest"),
10101002
env=env,
@@ -1050,7 +1042,6 @@ def _build_targets(self, targets: Sequence[str]) -> None:
10501042
return
10511043

10521044
env = self._compute_env()
1053-
# pyre-fixme[6]: For 1st argument expected `Mapping[str, str]` but got `Env`.
10541045
cmake = path_search(env, "cmake")
10551046
if cmake is None:
10561047
raise RuntimeError("unable to find cmake")
@@ -1134,9 +1125,7 @@ def run_tests(
11341125
timeout: int | None = None,
11351126
) -> None:
11361127
env = self._compute_env()
1137-
# pyre-fixme[6]: For 1st argument expected `Mapping[str, str]` but got `Env`.
11381128
ctest: str | None = path_search(env, "ctest")
1139-
# pyre-fixme[6]: For 1st argument expected `Mapping[str, str]` but got `Env`.
11401129
cmake = path_search(env, "cmake")
11411130

11421131
# Build only the missing test executables needed for the given filter.
@@ -1190,10 +1179,7 @@ def get_property(
11901179
return p.get("value", defval)
11911180
return defval
11921181

1193-
# pyre-fixme[53]: Captured variable `cmake` is not annotated.
1194-
# pyre-fixme[53]: Captured variable `env` is not annotated.
11951182
def list_tests() -> list[dict[str, object]]:
1196-
# pyrefly: ignore [no-matching-overload]
11971183
output = subprocess.check_output(
11981184
[require_command(ctest, "ctest"), "--show-only=json-v1"],
11991185
env=env,
@@ -1258,7 +1244,6 @@ def list_tests() -> list[dict[str, object]]:
12581244
try:
12591245
from .facebook.testinfra import start_run
12601246

1261-
# pyre-fixme[6]: For 1st argument expected `Mapping[str, str]` but got
12621247
# `Env`.
12631248
tpx = path_search(env, "tpx")
12641249
except ImportError:
@@ -1457,7 +1442,6 @@ def _build(self, reconfigure: bool) -> None:
14571442
bindir = os.path.join(self.loader.get_project_install_dir(m), "bin")
14581443
add_path_entry(env, "PATH", bindir, append=False)
14591444

1460-
# pyre-fixme[6]: For 1st argument expected `Mapping[str, str]` but got `Env`.
14611445
perl = typing.cast(str, path_search(env, "perl", "perl"))
14621446

14631447
make_j_args = []
@@ -1781,7 +1765,6 @@ def _build(self, reconfigure: bool) -> None:
17811765
env = self._compute_env()
17821766

17831767
# Resolve the cmake that we installed
1784-
# pyre-fixme[6]: For 1st argument expected `Mapping[str, str]` but got `Env`.
17851768
cmake = path_search(env, "cmake")
17861769

17871770
# pyre-fixme[6]: For 1st argument expected `List[str]` but got

build/fbcode_builder/getdeps/buildopts.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ def __init__(
103103
break
104104

105105
# Detect what repository and project we are being run from.
106-
# pyre-fixme[4]: Attribute must be annotated.
107106
self.repo_root, self.repo_project = detect_project(os.getcwd())
108107

109108
# If we are running from an fbsource repository, set self.fbsource_dir
@@ -329,14 +328,11 @@ def compute_env_for_install_dirs(
329328
# Try extra hard to find openssl, needed with homebrew on macOS
330329
if found and p.startswith("openssl"):
331330
candidate = homebrew_package_prefix("openssl@1.1")
332-
# pyre-fixme[6]: For 1st argument expected
333331
# `Union[PathLike[bytes], PathLike[str], bytes, int, str]` but got
334332
# `Optional[str]`.
335333
if candidate and os.path.exists(candidate):
336-
# pyre-fixme[6]: For 2nd argument expected `str` but got
337334
# `Optional[str]`.
338335
os.environ["OPENSSL_ROOT_DIR"] = candidate
339-
# pyrefly: ignore [unsupported-operation]
340336
env["OPENSSL_ROOT_DIR"] = os.environ["OPENSSL_ROOT_DIR"]
341337

342338
if self.fbsource_dir:
@@ -345,22 +341,19 @@ def compute_env_for_install_dirs(
345341
)
346342
yarn_exe = "yarn.bat" if self.is_windows() else "yarn"
347343
env["YARN_PATH"] = os.path.join(
348-
# pyre-fixme[6]: For 1st argument expected `LiteralString` but got
349344
# `Optional[str]`.
350345
self.fbsource_dir,
351346
"xplat/third-party/yarn/",
352347
yarn_exe,
353348
)
354349
node_exe = "node-win-x64.exe" if self.is_windows() else "node"
355350
env["NODE_BIN"] = os.path.join(
356-
# pyre-fixme[6]: For 1st argument expected `LiteralString` but got
357351
# `Optional[str]`.
358352
self.fbsource_dir,
359353
"xplat/third-party/node/bin/",
360354
node_exe,
361355
)
362356
env["RUST_VENDORED_CRATES_DIR"] = os.path.join(
363-
# pyre-fixme[6]: For 1st argument expected `LiteralString` but got
364357
# `Optional[str]`.
365358
self.fbsource_dir,
366359
"third-party/rust/vendor",
@@ -496,7 +489,6 @@ def add_prefix_to_env(
496489
libdir: str = os.path.join(d, lib)
497490
if os.path.exists(libdir):
498491
found = True
499-
# pyre-fixme[6]: For 2nd argument expected `str` but got
500492
# `Optional[str]`.
501493
add_path_entry(env, self.lib_path, libdir, append=append)
502494
# module detection for python is old fashioned and needs flags

build/fbcode_builder/getdeps/cargo.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ def __init__(
4949
)
5050
self.build_doc = build_doc
5151
self.ws_dir: str | None = workspace_dir
52-
# pyre-fixme[8]: Attribute has type `Optional[List[str]]`; used as
5352
# `Union[None, List[str], str]`.
5453
self.manifests_to_build: list[str] | None = (
5554
# pyrefly: ignore [bad-assignment]
@@ -205,7 +204,6 @@ def _build(self, reconfigure: bool) -> None:
205204
build_args,
206205
)
207206
else:
208-
# pyre-fixme[16]: Optional type has no attribute `__iter__`.
209207
for manifest in self.manifests_to_build:
210208
self.run_cargo(
211209
self.install_dirs,
@@ -245,7 +243,6 @@ def run_tests(
245243
if self.build_doc and not filter_args:
246244
self.run_cargo(self.install_dirs, "doc", ["--no-deps"])
247245
else:
248-
# pyre-fixme[16]: Optional type has no attribute `__iter__`.
249246
for manifest in self.manifests_to_build:
250247
margs = ["--manifest-path", self.manifest_dir(manifest)]
251248
self.run_cargo(
@@ -486,7 +483,6 @@ def _resolve_dep_to_crates(
486483
file=sys.stderr,
487484
)
488485
existing_crates.add(c)
489-
# pyre-fixme[61]: `name` is undefined, or not always defined.
490486
dep_to_crates.setdefault(name, set()).update(existing_crates)
491487
return dep_to_crates
492488

build/fbcode_builder/getdeps/copytree.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ def simple_copytree(src_dir: str, dest_dir: str, symlinks: bool = False) -> str:
105105
def _remove_readonly_and_try_again(
106106
func: Callable[..., object],
107107
path: str,
108-
# pyre-fixme[24]: Generic type `type` expects 1 type parameter, use
109108
# `typing.Type[<base type>]` to avoid runtime subscripting errors.
110109
exc_info: tuple[type, BaseException, object],
111110
) -> None:

build/fbcode_builder/getdeps/manifest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,6 @@ def create_cargo_builder(
950950
src_dir,
951951
build_dir,
952952
inst_dir,
953-
# pyre-fixme[6]: For 9th argument expected `bool` but got `Optional[str]`.
954953
build_doc,
955954
workspace_dir,
956955
manifests_to_build,

build/fbcode_builder/getdeps/py_wheel_builder.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,7 @@ class PythonWheelBuilder(BuilderBase):
100100
that can be used by add_fb_python_library()/add_fb_python_executable() CMake rules.
101101
"""
102102

103-
# pyre-fixme[13]: Attribute `dist_info_dir` is never initialized.
104103
dist_info_dir: str
105-
# pyre-fixme[13]: Attribute `template_format_dict` is never initialized.
106104
template_format_dict: dict[str, str]
107105

108106
def _build(self, reconfigure: bool) -> None:
@@ -276,7 +274,6 @@ def _parse_wheel_name(self) -> WheelNameInfo:
276274
platform=match.group("platform"),
277275
)
278276

279-
# pyre-fixme[24]: Generic type `email.message.Message` expects 2 type parameters.
280277
def _read_wheel_metadata(self, wheel_name: WheelNameInfo) -> email.message.Message:
281278
metadata_path = os.path.join(self.dist_info_dir, "WHEEL")
282279
with codecs.open(metadata_path, "r", encoding="utf-8") as f:

build/fbcode_builder/getdeps/runcmd.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ def log_to_stdout(msg: str) -> None:
117117
if log_file is not None:
118118
with open(log_file, "a", encoding="utf-8", errors="surrogateescape") as log:
119119

120-
# pyre-fixme[53]: Captured variable `log` is not annotated.
121120
def log_function(msg: str) -> None:
122121
log.write(msg)
123122
log_to_stdout(msg)
@@ -248,7 +247,6 @@ def _pipe_output(p: subprocess.Popen[bytes], log_fn: Callable[[str], None]) -> N
248247
assert p.stdout is not None
249248
buffer_size = 64
250249
while True:
251-
# pyre-fixme[16]: Optional type has no attribute `read`.
252250
data = p.stdout.read(buffer_size)
253251
if not data:
254252
break

build/fbcode_builder/getdeps/subcmd.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,8 @@ class SubclassedCmd(cls):
6767
NAME = name
6868
HELP = help
6969

70-
# pyre-fixme[6]: For 1st argument expected `Type[SubCmd]` but got
7170
# `Type[SubclassedCmd]`.
72-
# pyre-fixme[16]: Callable `cmd` has no attribute `wrapper`.
7371
cmd_table.append(SubclassedCmd)
74-
# pyre-fixme[7]: Expected `Type[SubCmd]` but got `Type[SubclassedCmd]`.
7572
return SubclassedCmd
7673

7774
return wrapper

0 commit comments

Comments
 (0)