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

mypy is confused by property aliases #1934

Closed
@PatrickMassot

Description

@PatrickMassot

Thank you very much for this very useful python package. Unfortunately mypy is very confused by property aliases such as

@propertydefreferences(self)->"IterableList[Reference]":"""A list of :class:`~git.refs.reference.Reference` objects representing tags,        heads and remote references.        :return:            ``git.IterableList(Reference, ...)``        """returnReference.list_items(self)# Alias for references.refs=references

that can be found ingit/repo/base.py or the analogous aliasbranches forheads. Seepython/mypy#6700

You can reproduce the issue with the followingtest.py:

fromgit.repoimportReporepo=Repo()forbranchinrepo.branches:print(branch)

about whichmypy says:

test.py:4: error: "Callable[[], IterableList[Head]]" has no attribute "__iter__" (not iterable)  [attr-defined]Found 1 error in 1 file (checked 1 source file)

I am not aware of any fix that would not uglify the code here, and that mypy issue doesn’t seem likely to see improvement in the near future. This is sad, but doing all the work to add type annotations and still having users facing incomprehensible error messages in perfectly legitimate code is also sad.

Could you please tell me whether you would welcome a PR “fixing” this?

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