Skip to content

Commit ca44e4c

Browse files
Add __slots__ to third-party packages using stubdefaulter (python#14619)
1 parent 573b57d commit ca44e4c

File tree

135 files changed

+675
-25
lines changed

Some content is hidden

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

135 files changed

+675
-25
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ ignore = [
177177
"TRY003", # Avoid specifying long messages outside the exception class
178178
# Slower and more verbose https://github.com/astral-sh/ruff/issues/7871
179179
"UP038", # Use `X | Y` in `isinstance` call instead of `(X, Y)`
180+
"PLC0205", # Sometimes __slots__ really is a string at runtime
180181
###
181182
# False-positives, but already checked by type-checkers
182183
###

stubs/PyMySQL/pymysql/protocol.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ UNSIGNED_INT64_COLUMN: Final[int]
1111
def dump_packet(data) -> None: ...
1212

1313
class MysqlPacket:
14+
__slots__ = ("_position", "_data")
1415
def __init__(self, data, encoding) -> None: ...
1516
def get_all_data(self): ...
1617
def read(self, size): ...

stubs/PyYAML/yaml/__init__.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,7 @@ class YAMLObjectMetaclass(type):
428428
def __init__(cls, name, bases, kwds) -> None: ...
429429

430430
class YAMLObject(metaclass=YAMLObjectMetaclass):
431+
__slots__ = ()
431432
yaml_loader: Any
432433
yaml_dumper: Any
433434
yaml_tag: Any

stubs/WebOb/webob/cookies.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ class Cookie(dict[bytes, Morsel]):
6060
def __str__(self, full: bool = True) -> str: ...
6161

6262
class Morsel(dict[bytes, bytes | bool | None]):
63+
__slots__ = ("name", "value")
6364
name: bytes
6465
value: bytes
6566
def __init__(self, name: str | bytes, value: str | bytes) -> None: ...

stubs/aiofiles/aiofiles/base.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class AsyncIndirectBase(AsyncBase[_T]):
2020
) -> None: ...
2121

2222
class AiofilesContextManager(Awaitable[_V_co], AbstractAsyncContextManager[_V_co]):
23+
__slots__ = ("_coro", "_obj")
2324
def __init__(self, coro: Awaitable[_V_co]) -> None: ...
2425
def __await__(self) -> Generator[Any, Any, _V_co]: ...
2526
async def __aenter__(self) -> _V_co: ...

stubs/antlr4-python3-runtime/antlr4/BufferedTokenStream.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Lexer: Incomplete
88
class TokenStream: ...
99

1010
class BufferedTokenStream(TokenStream):
11+
__slots__ = ("tokenSource", "tokens", "index", "fetchedEOF")
1112
tokenSource: Incomplete
1213
tokens: Incomplete
1314
index: int

stubs/antlr4-python3-runtime/antlr4/CommonTokenFactory.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ from antlr4.Token import CommonToken as CommonToken
55
class TokenFactory: ...
66

77
class CommonTokenFactory(TokenFactory):
8+
__slots__ = "copyText"
89
DEFAULT: Incomplete
910
copyText: Incomplete
1011
def __init__(self, copyText: bool = False) -> None: ...

stubs/antlr4-python3-runtime/antlr4/CommonTokenStream.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ from antlr4.Lexer import Lexer as Lexer
55
from antlr4.Token import Token as Token
66

77
class CommonTokenStream(BufferedTokenStream):
8+
__slots__ = "channel"
89
channel: Incomplete
910
def __init__(self, lexer: Lexer, channel: int = 0) -> None: ...
1011
def adjustSeekIndex(self, i: int) -> int: ...

stubs/antlr4-python3-runtime/antlr4/FileStream.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ from _typeshed import Incomplete
33
from antlr4.InputStream import InputStream as InputStream
44

55
class FileStream(InputStream):
6+
__slots__ = "fileName"
67
fileName: Incomplete
78
def __init__(self, fileName: str, encoding: str = "ascii", errors: str = "strict") -> None: ...
89
def readDataFrom(self, fileName: str, encoding: str, errors: str = "strict"): ...

stubs/antlr4-python3-runtime/antlr4/InputStream.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ from _typeshed import Incomplete
33
from antlr4.Token import Token as Token
44

55
class InputStream:
6+
__slots__ = ("name", "strdata", "_index", "data", "_size")
67
name: str
78
strdata: Incomplete
89
data: Incomplete

0 commit comments

Comments
 (0)