Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

git.types.PathLike is partially unknown for Pylance/mypy #1473

Closed
@madebylydia

Description

@madebylydia

Hello everyone,

I am using GitPython in my project and I use Pylance/mypy with the strict type checking settings. This setting is pretty important for my project's sanity.

As I've been using methods from GitPython that make uses of paths, I've been getting the following errors:
mypy raising an error for git.types.PathLike
As you can notice, what raises this error isPathLike[Unknown], defined ingit.types.PathLike. (Source file & lines)

After further investigation, I've found out that this is becauseos.PathLike is considered as a generic class (Liketyping.List,typing.Dict and so on)
Image showing PathLike being a generic class

The fix is fairly simple, as it is to simply allowstr forPathLike, which gives this result:os.PathLike[str]

PathLike with the implemented fix
Actual code without any errors
(awesome! This issue's no longer a thing with this fix!)

There has some discussion about the same situation on this StackOverflow page:https://stackoverflow.com/a/69680089/13720113

I can make a PR for fixing this (Of course, with some testing, since there is Python version checks), as long as this issue is approved.

Thank you, hoping this issue get sorted soon!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp