Skip to content

Commit 85aec03

Browse files
authored
Mark many attributes as read-only properties (#7591)
1 parent b8f2eb3 commit 85aec03

File tree

28 files changed

+189
-93
lines changed

28 files changed

+189
-93
lines changed

stubs/JACK-Client/jack/__init__.pyi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,10 @@ class Port:
161161
def unset_alias(self, alias: str) -> None: ...
162162
@property
163163
def uuid(self) -> str: ...
164-
is_audio: bool = ...
165-
is_midi: bool = ...
164+
@property
165+
def is_audio(self) -> bool: ...
166+
@property
167+
def is_midi(self) -> bool: ...
166168
@property
167169
def is_input(self) -> bool: ...
168170
@property

stubs/Pillow/PIL/TiffImagePlugin.pyi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,10 @@ class ImageFileDirectory_v2(MutableMapping[int, Any]):
122122

123123
class ImageFileDirectory_v1(ImageFileDirectory_v2):
124124
def __init__(self, *args, **kwargs) -> None: ...
125-
tags: Any
126-
tagdata: Any
125+
@property
126+
def tags(self): ...
127+
@property
128+
def tagdata(self): ...
127129
tagtype: dict[int, int]
128130
@classmethod
129131
def from_v2(cls, original): ...

stubs/SQLAlchemy/sqlalchemy/engine/row.pyi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ KEY_OBJECTS_BUT_WARN: int
1414
KEY_OBJECTS_NO_WARN: int
1515

1616
class Row(BaseRow, Sequence[Any], metaclass=abc.ABCMeta):
17-
count: Any
18-
index: Any
17+
@property
18+
def count(self): ...
19+
@property
20+
def index(self): ...
1921
def __contains__(self, key): ...
2022
__hash__: Any
2123
def __lt__(self, other): ...

stubs/SQLAlchemy/sqlalchemy/ext/associationproxy.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ class _AssociationCollection:
9393
setter: Any
9494
parent: Any
9595
def __init__(self, lazy_collection, creator, getter, setter, parent) -> None: ...
96-
col: Any
96+
@property
97+
def col(self): ...
9798
def __len__(self): ...
9899
def __bool__(self): ...
99100
__nonzero__: Any

stubs/SQLAlchemy/sqlalchemy/sql/schema.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ class ForeignKey(DialectKWArgs, SchemaItem):
9292
**dialect_kw,
9393
) -> None: ...
9494
def copy(self, schema: Any | None = ..., **kw): ...
95-
target_fullname: Any
95+
@property
96+
def target_fullname(self): ...
9697
def references(self, table): ...
9798
def get_referent(self, table): ...
9899
@memoized_property

stubs/SQLAlchemy/sqlalchemy/sql/selectable.pyi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ class FromClause(roles.AnonymizedFromClauseRole, Selectable):
7070
def primary_key(self): ...
7171
@memoized_property
7272
def foreign_keys(self): ...
73-
c: Any
73+
@property
74+
def c(self): ...
7475

7576
LABEL_STYLE_NONE: Any
7677
LABEL_STYLE_TABLENAME_PLUS_COL: Any
@@ -383,7 +384,8 @@ class ScalarSelect(roles.InElementRole, Generative, Grouping):
383384
def __init__(self, element) -> None: ...
384385
@property
385386
def columns(self) -> None: ...
386-
c: Any
387+
@property
388+
def c(self): ...
387389
def where(self, crit) -> None: ...
388390
def self_group(self, **kwargs): ...
389391
def correlate(self, *fromclauses) -> None: ...

stubs/babel/babel/core.pyi

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,17 @@ class Locale:
2121
def __ne__(self, other): ...
2222
def __hash__(self): ...
2323
def get_display_name(self, locale: Any | None = ...): ...
24-
display_name: Any
24+
@property
25+
def display_name(self): ...
2526
def get_language_name(self, locale: Any | None = ...): ...
26-
language_name: Any
27+
@property
28+
def language_name(self): ...
2729
def get_territory_name(self, locale: Any | None = ...): ...
28-
territory_name: Any
30+
@property
31+
def territory_name(self): ...
2932
def get_script_name(self, locale: Any | None = ...): ...
30-
script_name: Any
33+
@property
34+
def script_name(self): ...
3135
@property
3236
def english_name(self): ...
3337
@property

stubs/babel/babel/messages/catalog.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ class Catalog:
7070
charset: Any | None = ...,
7171
fuzzy: bool = ...,
7272
) -> None: ...
73-
locale_identifier: Any
73+
@property
74+
def locale_identifier(self): ...
7475
header_comment: Any
7576
mime_headers: Any
7677
@property

stubs/babel/babel/messages/plurals.pyi

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ PLURALS: Any
55
DEFAULT_PLURAL: Any
66

77
class _PluralTuple(tuple[int, str]):
8-
num_plurals: Any
9-
plural_expr: Any
10-
plural_forms: Any
8+
@property
9+
def num_plurals(self) -> int: ...
10+
@property
11+
def plural_expr(self) -> str: ...
12+
@property
13+
def plural_forms(self) -> str: ...
1114

1215
def get_plural(locale=...): ...

stubs/babel/babel/plural.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ class PluralRule:
99
def parse(cls, rules): ...
1010
@property
1111
def rules(self): ...
12-
tags: Any
12+
@property
13+
def tags(self): ...
1314
def __call__(self, n): ...
1415

1516
def to_javascript(rule): ...

stubs/beautifulsoup4/bs4/builder/_html5lib.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ class Element(Any): # html5lib.treebuilders.base.Node
5858
def cloneNode(self): ...
5959
def hasContent(self): ...
6060
def getNameTuple(self): ...
61-
nameTuple: Any
61+
@property
62+
def nameTuple(self): ...
6263

6364
class TextNode(Element):
6465
element: Any

stubs/beautifulsoup4/bs4/element.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,8 @@ class Tag(PageElement):
262262
def __copy__(self: Self) -> Self: ...
263263
@property
264264
def is_empty_element(self) -> bool: ...
265-
isSelfClosing = is_empty_element
265+
@property
266+
def isSelfClosing(self) -> bool: ...
266267
@property
267268
def string(self) -> str | None: ...
268269
@string.setter

stubs/boto/boto/connection.pyi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,14 @@ class AWSAuthConnection:
9191
def aws_access_key_id(self): ...
9292
@property
9393
def gs_access_key_id(self) -> Any: ...
94-
access_key: Any
94+
@property
95+
def access_key(self): ...
9596
@property
9697
def aws_secret_access_key(self): ...
9798
@property
9899
def gs_secret_access_key(self): ...
99-
secret_key: Any
100+
@property
101+
def secret_key(self): ...
100102
@property
101103
def profile_name(self): ...
102104
def get_path(self, path: str = ...): ...

stubs/cryptography/cryptography/hazmat/primitives/asymmetric/dh.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ class DHParameterNumbers:
3030
def parameters(self, backend: DHBackend | None = ...) -> DHParameters: ...
3131

3232
class DHPrivateKey(metaclass=ABCMeta):
33-
key_size: int
33+
@property
34+
def key_size(self) -> int: ...
3435
@abstractmethod
3536
def exchange(self, peer_public_key: DHPublicKey) -> bytes: ...
3637
@abstractmethod

stubs/cryptography/cryptography/hazmat/primitives/asymmetric/utils.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ class Prehashed:
77
_algorithm: HashAlgorithm # undocumented
88
_digest_size: int # undocumented
99
def __init__(self, algorithm: HashAlgorithm) -> None: ...
10-
digest_size: int
10+
@property
11+
def digest_size(self) -> int: ...

stubs/cryptography/cryptography/hazmat/primitives/hashes.pyi

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,17 @@ from abc import ABCMeta, abstractmethod
22

33
from cryptography.hazmat.backends.interfaces import HashBackend
44

5+
# These are actually abstractproperties on HashAlgorithm,
6+
# but let's not worry too much about that.
57
class HashAlgorithm(metaclass=ABCMeta):
6-
digest_size: int
7-
name: str
8+
@property
9+
def digest_size(self) -> int: ...
10+
@property
11+
def name(self) -> str: ...
812

913
class HashContext(metaclass=ABCMeta):
10-
algorithm: HashAlgorithm
14+
@property
15+
def algorithm(self) -> HashAlgorithm: ...
1116
@abstractmethod
1217
def copy(self) -> HashContext: ...
1318
@abstractmethod

0 commit comments

Comments
 (0)