Skip to content

Commit

Permalink
Spotted pyright fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
A5rocks committed Nov 24, 2023
1 parent 873ac42 commit 4ed1cfa
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/trio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@

# Not imported by default, but mentioned here so static analysis tools like
# pylint will know that it exists.
if False:
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from . import testing

from . import _deprecate as _deprecate
Expand Down Expand Up @@ -154,3 +155,4 @@
fixup_module_metadata(from_thread.__name__, from_thread.__dict__)
fixup_module_metadata(to_thread.__name__, to_thread.__dict__)
del fixup_module_metadata
del TYPE_CHECKING
7 changes: 2 additions & 5 deletions src/trio/_tests/test_exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ def no_underscores(symbols: Iterable[str]) -> set[str]:
)
elif tool == "pyright_verifytypes":
if not RUN_SLOW: # pragma: no cover
pytest.skip("use --run-slow to check against mypy")
pytest.skip("use --run-slow to check against pyright")

try:
import pyright # noqa: F401
except ImportError as error:
Expand All @@ -217,10 +218,6 @@ def no_underscores(symbols: Iterable[str]) -> set[str]:
if x["name"].startswith(modname)
}

# pyright ignores the symbol defined behind `if False`
if modname == "trio":
static_names.add("testing")

# these are hidden behind `if sys.platform != "win32" or not TYPE_CHECKING`
# so presumably pyright is parsing that if statement, in which case we don't
# care about them being missing.
Expand Down

0 comments on commit 4ed1cfa

Please sign in to comment.