Skip to content

Commit 84c094b

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
1 parent 9b81e79 commit 84c094b

File tree

140 files changed

+301
-348
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+301
-348
lines changed

lib/ts_utils/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def colored(text: str, color: str | None = None, **kwargs: Any) -> str: # type:
5050

5151

5252
def strip_comments(text: str) -> str:
53-
return text.split("#")[0].strip()
53+
return text.split("#", maxsplit=1)[0].strip()
5454

5555

5656
def jsonc_to_json(text: str) -> str:

scripts/create_baseline_stubs.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,10 @@ def add_pyright_exclusion(stub_dir: Path) -> None:
188188

189189

190190
def main() -> None:
191-
parser = argparse.ArgumentParser(
192-
description="""Generate baseline stubs automatically for an installed pip package
191+
parser = argparse.ArgumentParser(description="""Generate baseline stubs automatically for an installed pip package
193192
using stubgen. Also run Black and Ruff. If the name of
194193
the project is different from the runtime Python package name, you may
195-
need to use --package (example: --package yaml PyYAML)."""
196-
)
194+
need to use --package (example: --package yaml PyYAML).""")
197195
parser.add_argument("project", help="name of PyPI project for which to generate stubs under stubs/")
198196
parser.add_argument("--package", help="generate stubs for this Python package (default is autodetected)")
199197
args = parser.parse_args()

scripts/stubsabot.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -844,24 +844,20 @@ def get_update_pr_body(update: Update, metadata: Mapping[str, Any]) -> str:
844844
stubtest_settings: dict[str, Any] = metadata.get("tool", {}).get("stubtest", {})
845845
stubtest_will_run = not stubtest_settings.get("skip", False)
846846
if stubtest_will_run:
847-
body += textwrap.dedent(
848-
"""
847+
body += textwrap.dedent("""
849848
850849
If stubtest fails for this PR:
851850
- Leave this PR open (as a reminder, and to prevent stubsabot from opening another PR)
852851
- Fix stubtest failures in another PR, then close this PR
853852
854853
Note that you will need to close and re-open the PR in order to trigger CI
855-
"""
856-
)
854+
""")
857855
else:
858-
body += textwrap.dedent(
859-
f"""
856+
body += textwrap.dedent(f"""
860857
861858
:warning: Review this PR manually, as stubtest is skipped in CI for {update.distribution}!
862859
Also check whether stubtest can be reenabled. :warning:
863-
"""
864-
)
860+
""")
865861
return body
866862

867863

stdlib/@tests/test_cases/typing/check_all.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"""
33
This tests that star imports work when using "all += " syntax.
44
"""
5+
56
from __future__ import annotations
67

78
from typing import *

stdlib/_socket.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ class socket:
741741
def proto(self) -> int: ...
742742
# F811: "Redefinition of unused `timeout`"
743743
@property
744-
def timeout(self) -> float | None: ... # noqa: F811
744+
def timeout(self) -> float | None: ...
745745
if sys.platform == "win32":
746746
def __init__(
747747
self, family: int = ..., type: int = ..., proto: int = ..., fileno: SupportsIndex | bytes | None = None
@@ -838,7 +838,7 @@ def inet_ntop(address_family: int, packed_ip: ReadableBuffer, /) -> str: ...
838838
def getdefaulttimeout() -> float | None: ...
839839

840840
# F811: "Redefinition of unused `timeout`"
841-
def setdefaulttimeout(timeout: float | None, /) -> None: ... # noqa: F811
841+
def setdefaulttimeout(timeout: float | None, /) -> None: ...
842842

843843
if sys.platform != "win32":
844844
def sethostname(name: str, /) -> None: ...

stdlib/argparse.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ class HelpFormatter:
344344
def _metavar_formatter(self, action: Action, default_metavar: str) -> Callable[[int], tuple[str, ...]]: ...
345345
def _format_args(self, action: Action, default_metavar: str) -> str: ...
346346
def _expand_help(self, action: Action) -> str: ...
347-
def _iter_indented_subactions(self, action: Action) -> Generator[Action, None, None]: ...
347+
def _iter_indented_subactions(self, action: Action) -> Generator[Action]: ...
348348
def _split_lines(self, text: str, width: int) -> list[str]: ...
349349
def _fill_text(self, text: str, width: int, indent: str) -> str: ...
350350
def _get_help_string(self, action: Action) -> str | None: ...

stdlib/codecs.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,8 @@ def open(
196196
filename: str, mode: str = "r", encoding: str | None = None, errors: str = "strict", buffering: int = -1
197197
) -> StreamReaderWriter: ...
198198
def EncodedFile(file: _Stream, data_encoding: str, file_encoding: str | None = None, errors: str = "strict") -> StreamRecoder: ...
199-
def iterencode(iterator: Iterable[str], encoding: str, errors: str = "strict") -> Generator[bytes, None, None]: ...
200-
def iterdecode(iterator: Iterable[bytes], encoding: str, errors: str = "strict") -> Generator[str, None, None]: ...
199+
def iterencode(iterator: Iterable[str], encoding: str, errors: str = "strict") -> Generator[bytes]: ...
200+
def iterdecode(iterator: Iterable[bytes], encoding: str, errors: str = "strict") -> Generator[str]: ...
201201

202202
BOM: Final[Literal[b"\xff\xfe", b"\xfe\xff"]] # depends on `sys.byteorder`
203203
BOM_BE: Final = b"\xfe\xff"

stdlib/concurrent/futures/process.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class _SafeQueue(Queue[Future[Any]]):
9797

9898
def _on_queue_feeder_error(self, e: Exception, obj: _CallItem) -> None: ...
9999

100-
def _get_chunks(*iterables: Any, chunksize: int) -> Generator[tuple[Any, ...], None, None]: ...
100+
def _get_chunks(*iterables: Any, chunksize: int) -> Generator[tuple[Any, ...]]: ...
101101
def _process_chunk(fn: Callable[..., _T], chunk: Iterable[tuple[Any, ...]]) -> list[_T]: ...
102102

103103
if sys.version_info >= (3, 11):

stdlib/email/message.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ class Message(Generic[_HeaderT_co, _HeaderParamT_contra]):
130130
def get_charsets(self, failobj: None = None) -> list[str | None]: ...
131131
@overload
132132
def get_charsets(self, failobj: _T) -> list[str | _T]: ...
133-
def walk(self) -> Generator[Self, None, None]: ...
133+
def walk(self) -> Generator[Self]: ...
134134
def get_content_disposition(self) -> str | None: ...
135135
def as_string(self, unixfrom: bool = False, maxheaderlen: int = 0, policy: Policy[Any] | None = None) -> str: ...
136136
def as_bytes(self, unixfrom: bool = False, policy: Policy[Any] | None = None) -> bytes: ...

stdlib/lib2to3/fixes/fix_except.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ from ..pytree import Base
66

77
_N = TypeVar("_N", bound=Base)
88

9-
def find_excepts(nodes: Iterable[_N]) -> Generator[tuple[_N, _N], None, None]: ...
9+
def find_excepts(nodes: Iterable[_N]) -> Generator[tuple[_N, _N]]: ...
1010

1111
class FixExcept(fixer_base.BaseFix):
1212
BM_compatible: ClassVar[Literal[True]]

0 commit comments

Comments
 (0)