Skip to content

Commit

Permalink
__builtins__ => builtins
Browse files Browse the repository at this point in the history
  • Loading branch information
brentyi committed Aug 29, 2024
1 parent 1e68768 commit 6ab907f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/tyro/_docstrings.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Helpers for parsing docstrings. Used for helptext generation."""

import builtins
import collections.abc
import dataclasses
import functools
Expand Down Expand Up @@ -284,7 +285,10 @@ def get_field_docstring(cls: Type, field_name: str) -> Optional[str]:
_callable_description_blocklist: Set[Hashable] = set(
filter(
lambda x: isinstance(x, Hashable), # type: ignore
itertools.chain(__builtins__.values(), vars(collections.abc).values()), # type: ignore
itertools.chain(
vars(builtins).values(),
vars(collections.abc).values(),
),
)
)

Expand Down
3 changes: 2 additions & 1 deletion src/tyro/_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from __future__ import annotations

import builtins
import collections
import collections.abc
import dataclasses
Expand Down Expand Up @@ -353,7 +354,7 @@ def resolve(field: FieldDefinition) -> FieldDefinition:
filter(
lambda x: isinstance(x, Hashable), # type: ignore
itertools.chain(
__builtins__.values(), # type: ignore
vars(builtins).values(), # type: ignore
vars(typing).values(),
vars(typing_extensions).values(),
vars(collections.abc).values(),
Expand Down
3 changes: 2 additions & 1 deletion src/tyro/_instantiators.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
```
"""

import builtins
import collections.abc
import dataclasses
import datetime
Expand Down Expand Up @@ -106,7 +107,7 @@ class UnsupportedTypeAnnotationError(Exception):
_builtin_set: Set[Hashable] = set(
filter(
lambda x: isinstance(x, Hashable), # type: ignore
__builtins__.values(), # type: ignore
vars(builtins).values(), # type: ignore
)
)

Expand Down

0 comments on commit 6ab907f

Please sign in to comment.