-
Notifications
You must be signed in to change notification settings - Fork 76
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
WIP: Re-enable mypy and fix most issues #343
base: main
Are you sure you want to change the base?
Conversation
if pygments is not None: | ||
assert len(msgs) == 0 | ||
else: | ||
assert len(msgs) == 1 | ||
assert ( | ||
str(msgs[0][1]) | ||
== 'Cannot analyze code. Pygments package not found.' | ||
) |
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.
I don't see pygments being use anywhere or even installed as a transitive dependency. Is that just old code ?
# type-ignore: This makes absolutes os.Pathlike unsupported in this branch. | ||
# Either this or we don't support bytes-based paths, or we complexify this branch. | ||
return os.path.join(new_root, pathname[1:]) # type: ignore[index] |
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.
There's a decision to be taken here.
- Don't support
PathLike
in this branch (current behaviour) - Don't support
bytes | PathLike[bytes]
in this branch
# type-ignore: This makes absolutes os.Pathlike unsupported in this branch. | |
# Either this or we don't support bytes-based paths, or we complexify this branch. | |
return os.path.join(new_root, pathname[1:]) # type: ignore[index] | |
# type-ignore: This makes absolutes os.Pathlike unsupported in this branch. | |
# Either this or we don't support bytes-based paths, or we complexify this branch. | |
return os.path.join(new_root, str(pathname)[1:]) |
- Support both, requires extra checking.
_wordchars_re = re.compile(rf'[^\\\'\"{string.whitespace} ]*') | ||
_squote_re = re.compile(r"'(?:[^'\\]|\\.)*'") | ||
_dquote_re = re.compile(r'"(?:[^"\\]|\\.)*"') |
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.
This isn't exactly "heavy computing" is it? Did it need to be done lazily ?
# TODO: Raise a more descriptive error when cmd_obj is None ? | ||
cmd_obj = cast(Command, self.distribution.get_command_obj(command, create)) |
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.
Decision to be taken here.
mypy:
pyright:
@jaraco I can't help but feel this may be revealing an actual issue? Or at least an incorrect assumption.
|
No description provided.