KotlinIsland / KotlinIsland/basedmypy

Render `Any` subtypes

Open
#295 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
Python
Stars
202
Forks
6
PR merge metrics
No merged PRs in 30d

Description

class A(Any): ...
reveal_type(A()) # A

This could reveal something like A(Any) or Any(A) or Any[A]

class A:
  def __getattr__(...) -> Any: ...
a: A
reveal_type(a.foo) # Any

This could mention that the signature of foo is actually comming from an operator.

Original Content

import tempfile
from os import PathLike

with tempfile.NamedTemporaryFile() as file:
    reveal_type(file) # tempfile._TemporaryFileWrapper[builtins.bytes]
    foo: PathLike[str] = file # no error even though it's not a PathLike

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the issue's reveal_type examples and the original PathLike[str] assignment case. Trace how the checker represents Any in subtype declarations and __getattr__ results, then determine the intended output for each example. Done means the proposed representation and behavior are specified and covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.