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

Fix typing error #1359

Merged
merged 1 commit into from
Nov 16, 2023
Merged
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
2 changes: 1 addition & 1 deletion dandi/cli/cmd_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
@devel_debug_option()
@map_to_click_exceptions
def move(
paths: tuple[str],
paths: tuple[str, ...],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for my own sake, so the old one is a tuple of a single str and new one is tuple of strings or tuple with the first element a str?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tuple[str] is a tuple of length 1 containing a str. tuple[str, ...] is a tuple of any length where all elements are strs.

Mypy was complaining because we we doing this inside the function:

if len(paths) < 2:
raise ValueError("At least two paths are required")

and len() of a one-element tuple is always less than 2, making the line after the raise unreachable.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so it is the

dandi/cli/cmd_move.py:90: error: Statement is unreachable  [unreachable]
        move_mod.move(
        ^
Found 1 error in 1 file (checked 77 source files)

one. got it. thank you for the explanation

dandiset: str | None,
dry_run: bool,
existing: str,
Expand Down