Skip to content

Commit

Permalink
chore: mypy mini cleanups
Browse files Browse the repository at this point in the history
Note regarding the `ignore`d super() call: mypy thinks that the
`super()` call in `ManabiS3Provider.__init__()` goes to the direct base
class `ManabiProvider` and is thus missing the required `root_folder`
parameter, but this ain't so: This calls `DAVProvider.__init__()` which
doesn't take that param.

Then we add a bit of typing sugar and make mypy shut up about missing
type information from 3rd party imports.

A few smaller issues that mypy finds in CI but not locally are addressed
as well.
  • Loading branch information
winged committed Nov 22, 2024
1 parent 9219a27 commit f3fdc86
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions manabi/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def get_content(self):
transport_params={"client": self.s3},
)

def begin_write(self, *, content_type):
def begin_write(self, *, content_type=None):
"""
Open content as a stream for writing.
Expand Down Expand Up @@ -257,7 +257,7 @@ def __init__(
shadow=None,
cb_hook_config: Optional[CallbackHookConfig] = None,
):
super(FilesystemProvider, self).__init__()
super(FilesystemProvider, self).__init__() # type: ignore

if not root_folder:
raise ValueError("Invalid root path: {dir}".format(dir=root_folder))
Expand All @@ -269,7 +269,7 @@ def __init__(
else:
self.shadow = {}

self.fs_opts = {}
self.fs_opts: Dict[str, Any] = {}
# Get shadow map and convert keys to lower case
self.shadow_map = self.fs_opts.get("shadow_map") or {}
if self.shadow_map:
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ commit_author = "github-actions <[email protected]>"
[tool.mypy]
check_untyped_defs = true

ignore_missing_imports = true

[tool.flake8]
ignore = """
E501,
Expand Down

0 comments on commit f3fdc86

Please sign in to comment.