Skip to content
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

Enable mypy warn_unreachable globally; Describe the only exception #2948

Merged
merged 1 commit into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ no_implicit_optional = True

strict_equality = True
warn_unused_ignores = True
warn_unreachable = True

[mypy-non_existent.*]
ignore_missing_imports = True
Expand Down Expand Up @@ -57,14 +58,12 @@ disallow_any_decorated = True
disallow_untyped_decorators = True
check_untyped_defs = True
disallow_subclassing_any = True
warn_unreachable = True
disallow_untyped_defs = True

[mypy-parsl.serialize.*]
disallow_untyped_decorators = True
check_untyped_defs = True
disallow_subclassing_any = True
warn_unreachable = True
disallow_untyped_defs = True

[mypy-parsl.serialize.proxystore.*]
Expand All @@ -77,13 +76,11 @@ disallow_any_expr = True

[mypy-parsl.executors.high_throughput.interchange.*]
disallow_untyped_defs = True
warn_unreachable = True

[mypy-parsl.monitoring.*]
disallow_untyped_decorators = True
check_untyped_defs = True
disallow_subclassing_any = True
warn_unreachable = True
disallow_untyped_defs = True

# visualization typechecks much less well than the rest of monitoring,
Expand All @@ -95,7 +92,6 @@ ignore_errors = True
ignore_missing_imports = True

[mypy-parsl.utils]
warn_unreachable = True
disallow_untyped_defs = True

[mypy-flask_sqlalchemy.*]
Expand Down
9 changes: 8 additions & 1 deletion parsl/dataflow/dflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,14 @@ def _create_remote_dirs_over_channel(self, provider: ExecutionProvider, channel:
"""
run_dir = self.run_dir
if channel.script_dir is None:
channel.script_dir = os.path.join(run_dir, 'submit_scripts')

# This case will be detected as unreachable by mypy, because of
# the type of script_dir, which is str, not Optional[str].
# The type system doesn't represent the initialized/uninitialized
# state of a channel so cannot represent that a channel needs
# its script directory set or not.

channel.script_dir = os.path.join(run_dir, 'submit_scripts') # type: ignore[unreachable]

# Only create dirs if we aren't on a shared-fs
if not channel.isdir(run_dir):
Expand Down
Loading