Skip to content

Static tools doesn't see class members (at least for trio.Path) #2630

@jakkdl

Description

@jakkdl

Jedi:

> import jedi
> script = jedi.Script("import trio; trio.Path.")
> comp = script.complete()
> [cc.name for cc in comp if not cc.name.startswith('_')]
Out: ['mro', 'open']

mypy also doesn't see them, which is probably the bigger problem

$ mypy trio/tests/test_path.py
...
trio/tests/test_path.py:189: error: "Type[Path]" has no attribute "joinpath"  [attr-defined]

which means downstream users will get typing errors if they use trio.Path in their code.

I haven't figured out how to check pylint, but otherwise it should be doable to modify test_static_tool_sees_all_symbols to also check class members.

For trio.Path, there's presumably some reason it's doing lots of magic instead of inheriting from Path - so if that's not on the table one would either have to define all the methods, or if that's what _forward_magic is for it's maybe possible to list them there, or some other constant.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions