Skip to content

Incorrect type annotation set[dict] in catalog.add_book.load_book.find_author #12738

@jonathandung

Description

@jonathandung

In the following function defined within the above:

    def get_redirected_authors(authors: list["Author"]):
        keys = [a.type.key for a in authors]
        if any(k != "/type/author" for k in keys):
            seen: set[dict] = set()
            all_authors = [walk_redirects(a, seen) for a in authors if a["key"] not in seen]
            return all_authors
        return authors

set[dict] is wrong, because dictionaries are not hashable and cannot be used as set members. I read into the source code, and as far as I can deduce, it should be a set of strings instead. I'm not familiar with the infrastructure of this project, however, so this may be incorrect.

Parent: python/typeshed#15754

Metadata

Metadata

Assignees

No one assigned

    Labels

    Lead: @mekarpelesIssues overseen by Mek (Staff: Program Lead) [managed]Priority: 4An issue, but should be worked on when no other pressing work can be done. [managed]

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions