From f6a816bdc269f755b6d46210843eba998139d09b Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Tue, 24 Dec 2024 23:47:25 +0000 Subject: [PATCH] Revert "Remove unnecessary pyright supressions (#13287)" This reverts commit 445858c5656b070869a6e159b580258aa655357e. --- lib/ts_utils/metadata.py | 6 +++--- lib/ts_utils/utils.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ts_utils/metadata.py b/lib/ts_utils/metadata.py index 450a7602ec9c..2ae052d64799 100644 --- a/lib/ts_utils/metadata.py +++ b/lib/ts_utils/metadata.py @@ -280,7 +280,7 @@ def read_metadata(distribution: str) -> StubMetadata: assert isinstance(tools_settings, dict) assert tools_settings.keys() <= _KNOWN_METADATA_TOOL_FIELDS.keys(), f"Unrecognised tool for {distribution!r}" for tool, tk in _KNOWN_METADATA_TOOL_FIELDS.items(): - settings_for_tool: object = tools_settings.get(tool, {}) + settings_for_tool: object = tools_settings.get(tool, {}) # pyright: ignore[reportUnknownMemberType] assert isinstance(settings_for_tool, dict) for key in settings_for_tool: assert key in tk, f"Unrecognised {tool} key {key!r} for {distribution!r}" @@ -311,9 +311,9 @@ def update_metadata(distribution: str, **new_values: object) -> tomlkit.TOMLDocu data = tomlkit.load(file) except FileNotFoundError: raise NoSuchStubError(f"Typeshed has no stubs for {distribution!r}!") from None - data.update(new_values) + data.update(new_values) # pyright: ignore[reportUnknownMemberType] # tomlkit.TOMLDocument.update is partially typed with path.open("w", encoding="UTF-8") as file: - tomlkit.dump(data, file) + tomlkit.dump(data, file) # pyright: ignore[reportUnknownMemberType] # tomlkit.dump has partially unknown Mapping type return data diff --git a/lib/ts_utils/utils.py b/lib/ts_utils/utils.py index 2e2865a40556..4dfe05488275 100644 --- a/lib/ts_utils/utils.py +++ b/lib/ts_utils/utils.py @@ -14,7 +14,7 @@ from packaging.requirements import Requirement try: - from termcolor import colored as colored + from termcolor import colored as colored # pyright: ignore[reportAssignmentType] except ImportError: def colored(text: str, color: str | None = None, **kwargs: Any) -> str: # type: ignore[misc]