Commit 6f4f39a
Annotate g_pathmgr global type and fix surfaced caller
Summary:
Splits the one behavior-visible piece out of the `file_io.py` type-annotation reland (D110187182) into its own base diff.
Annotates the module-level `g_pathmgr` global with its concrete type:
g_pathmgr: PathManager = PathManagerFactory.get(defaults_setup=True)
replacing the `# pyre-fixme[5]: Global expression must be annotated.` suppression. This is the only change in the reland with a downstream blast radius: an un-annotated global that trips `[5]` is exported to *other* modules as `Any`, which silences all attribute/argument checks on `g_pathmgr` at every call site. Giving it a real type binds `g_pathmgr.open(...)` to the actual `PathManager.open(path: str, ...)` signature, so pyre now type-checks its arguments in downstream projects.
That surfaces one pre-existing latent error in `oculus/face`:
benchmark_visualize.py:229 Incompatible parameter type [6]: for 1st positional argument, expected `str` but got `Optional[str]`.
`meta.uri` is `Optional[str]` and was being passed straight into `open`, previously masked because `g_pathmgr` was `Any`. Narrowed with an `assert meta.uri is not None` immediately before the call. It sits inside the existing surrounding `try`/`except`, so a `None` uri raises `AssertionError` and is swallowed exactly as `open(None)` would have been — no runtime behavior change, and no new import.
Keeping this at the base of the stack makes every commit independently type-clean (important for bisect); the mechanical, blast-radius-free annotation modernization stays isolated in D110187182 on top.
___
Differential Revision: D110314532
fbshipit-source-id: cbbb4bb69e975f7c2b441c377ce4b4c0577ccae61 parent a20cd1b commit 6f4f39a
1 file changed
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1761 | 1761 | | |
1762 | 1762 | | |
1763 | 1763 | | |
1764 | | - | |
1765 | | - | |
| 1764 | + | |
0 commit comments