-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
mesondata: fix mypy warnings #15349
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
base: master
Are you sure you want to change the base?
mesondata: fix mypy warnings #15349
Conversation
This does apparently work without the conversion to a string, but the fix isn't hard
| def write_to_private(self, env: 'Environment') -> Path: | ||
| try: | ||
| resource = importlib.resources.files('mesonbuild') / self.path | ||
| resource = importlib.resources.files('mesonbuild') / self.path.as_posix() |
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 is a silly fix IMO because it makes the following code unreachable. What's the specific reason mypy doesn't like this?
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.
You can't / a Traversable and a PurePath, it wants either a string or a concrete Path
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'm actually super confused on this now.
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.
Here's the (3.13) definition of Traversable.__truediv__:
StrPath: TypeAlias = str | os.PathLike[str]
def __truediv__(self, child: StrPath) -> "Traversable": ...PurePath is an instance of os.PathLike[str].
So I'm super confused on why this is showing up as an issue.
|
I think this is a typeshed issue |
This does apparently work without the conversion to a string, but the fix isn't hard