Skip to content

Commit

Permalink
Use better return type for inspect.waktree and `inspect.getclasstre…
Browse files Browse the repository at this point in the history
…e` (#13129)
  • Loading branch information
kbaikov authored Dec 16, 2024
1 parent 7cae61f commit 54e1c6a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions stdlib/inspect.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -421,11 +421,10 @@ class BoundArguments:
# Classes and functions
#

# TODO: The actual return type should be list[_ClassTreeItem] but mypy doesn't
# seem to be supporting this at the moment:
# _ClassTreeItem = list[_ClassTreeItem] | Tuple[type, Tuple[type, ...]]
def getclasstree(classes: list[type], unique: bool = False) -> list[Any]: ...
def walktree(classes: list[type], children: Mapping[type[Any], list[type]], parent: type[Any] | None) -> list[Any]: ...
_ClassTreeItem: TypeAlias = list[tuple[type, ...]] | list[_ClassTreeItem]

def getclasstree(classes: list[type], unique: bool = False) -> _ClassTreeItem: ...
def walktree(classes: list[type], children: Mapping[type[Any], list[type]], parent: type[Any] | None) -> _ClassTreeItem: ...

class Arguments(NamedTuple):
args: list[str]
Expand Down

0 comments on commit 54e1c6a

Please sign in to comment.