-
-
Notifications
You must be signed in to change notification settings - Fork 182
typing fixes #334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
typing fixes #334
Changes from all commits
acc065a
a973f52
1166266
1ee9b66
7a3a2b5
55e089b
e429338
1437215
c7f546d
4a2bece
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| """Version, used in module and setup.py. | ||
| """ | ||
| __version__ = "2.4.10" | ||
| __version__ = "2.4.11a0" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -342,7 +342,8 @@ def _get_dir_entry(self, dir_path): | |
|
|
||
| def close(self): | ||
| # type: () -> None | ||
| self.root = None | ||
| if not self._closed: | ||
| del self.root | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mypy complains when assigning None, rather than modify the type of |
||
| return super(MemoryFS, self).close() | ||
|
|
||
| def getinfo(self, path, namespaces=None): | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,15 +28,15 @@ | |
| try: | ||
| from scandir import scandir # type: ignore | ||
| except ImportError: # pragma: no cover | ||
| scandir = None # pragma: no cover | ||
| scandir = None # type: ignore # pragma: no cover | ||
|
|
||
| try: | ||
| from os import sendfile | ||
| except ImportError: | ||
| try: | ||
| from sendfile import sendfile # type: ignore | ||
| except ImportError: | ||
| sendfile = None # pragma: no cover | ||
| sendfile = None # type: ignore # pragma: no cover | ||
|
|
||
| from . import errors | ||
| from .errors import FileExists | ||
|
|
@@ -186,7 +186,7 @@ def __str__(self): | |
| return fmt.format(_class_name.lower(), self.root_path) | ||
|
|
||
| def _to_sys_path(self, path): | ||
| # type: (Text) -> Text | ||
| # type: (Text) -> bytes | ||
| """Convert a FS path to a path on the OS. | ||
| """ | ||
| sys_path = fsencode( | ||
|
|
@@ -266,13 +266,11 @@ def _gettarget(self, sys_path): | |
| if hasattr(os, "readlink"): | ||
| try: | ||
| if _WINDOWS_PLATFORM: # pragma: no cover | ||
| target = os.readlink(sys_path) | ||
| return os.readlink(sys_path) | ||
| else: | ||
| target = os.readlink(fsencode(sys_path)) | ||
| return fsdecode(os.readlink(fsencode(sys_path))) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The link target was returned as |
||
| except OSError: | ||
| pass | ||
| else: | ||
| return target | ||
| return None | ||
|
|
||
| def _make_link_info(self, sys_path): | ||
|
|
@@ -484,7 +482,7 @@ def _scandir(self, path, namespaces=None): | |
| self._root_path, path.lstrip("/").replace("/", os.sep) | ||
| ) | ||
| else: | ||
| sys_path = self._to_sys_path(_path) | ||
| sys_path = self._to_sys_path(_path) # type: ignore | ||
| with convert_os_errors("scandir", path, directory=True): | ||
| for dir_entry in scandir(sys_path): | ||
| info = { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mypy complains about redefinition