Skip to content

Commit 003c338

Browse files
Fabian Schenkmeta-codesync[bot]
authored andcommitted
Modernize type annotations in file_io.py
Summary: Mechanical typing modernization of `iopath/common/file_io.py`, with no behavior or signature-semantics change: `Optional[X]` -> `X | None`, `Union[A, B]` -> `A | B`, `Dict`/`List`/`Set`/`Type` -> the builtin generics, `Callable`/`Iterator`/`MutableMapping` moved to `collections.abc`, `Literal` moved from `typing_extensions` to `typing`, and the now-unused `typing` imports dropped. Docstrings are updated to match the new spellings. Also fills in annotations that were previously carrying a `# pyre-fixme[2]`/`[3]`/`[4]` suppression: `PathManager.set_logging`, `PathManagerFactory.get`/`remove`/`pm_list`, `PathHandler._non_blocking_io_manager`, `NativePathHandler._cwd`, `LazyPath.__getattr__`/`__getitem__`, `file_lock`, and the `Callable`/`os.PathLike` generic parameters. The behavioral parts of the modernization -- the `PathManager.open` overload set, the `EventLogger.add_keys` widening, and `copy_from_local` returning `False` instead of `None` -- are in the next diff of the stack, together with the caller suppressions they invalidate. Reviewed By: nponte Differential Revision: D116452125 fbshipit-source-id: af2f17a5c7082fd9523a817769c851f2a4177018
1 parent 016147e commit 003c338

1 file changed

Lines changed: 83 additions & 104 deletions

File tree

0 commit comments

Comments
 (0)