Skip to content

Commit 71cc9cd

Browse files
Rename TypeVar T_2 to U
Source : Conventions Fix one minor `basedpyright` issue
1 parent 13cd00b commit 71cc9cd

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

mcproto/types/entity/metadata.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from mcproto.types.abc import MCType
1212

1313
T = TypeVar("T")
14-
T_2 = TypeVar("T_2")
14+
U = TypeVar("U")
1515

1616

1717
class EntityMetadataEntry(MCType, Generic[T]):
@@ -137,19 +137,19 @@ def deserialize(cls, buf: Buffer) -> EntityMetadataEntry[T]:
137137
return cls(index=index, value=value)
138138

139139

140-
class ProxyEntityMetadataEntry(MCType, Generic[T, T_2]):
140+
class ProxyEntityMetadataEntry(MCType, Generic[T, U]):
141141
"""A proxy entity metadata entry which is used to designate a part of a metadata entry in a human-readable format.
142142
143143
For example, this can be used to represent a certain mask for a ByteEME entry.
144144
"""
145145

146146
ENTRY_TYPE: ClassVar[int] = None # type: ignore
147147

148-
bound_entry: EntityMetadataEntry[T_2]
148+
bound_entry: EntityMetadataEntry[U]
149149

150150
__slots__ = ("bound_entry",)
151151

152-
def __init__(self, bound_entry: EntityMetadataEntry[T_2], *args: Any, **kwargs: Any):
152+
def __init__(self, bound_entry: EntityMetadataEntry[U], *args: Any, **kwargs: Any):
153153
self.bound_entry = bound_entry
154154
self.validate()
155155

@@ -159,7 +159,7 @@ def serialize_to(self, buf: Buffer) -> None:
159159

160160
@override
161161
@classmethod
162-
def deserialize(cls, buf: Buffer) -> ProxyEntityMetadataEntry[T, T_2]:
162+
def deserialize(cls, buf: Buffer) -> ProxyEntityMetadataEntry[T, U]:
163163
raise NotImplementedError("Proxy entity metadata entries cannot be deserialized.")
164164

165165
@abstractmethod
@@ -195,7 +195,7 @@ def entry(entry_type: type[EntityMetadataEntry[T]], value: T) -> T:
195195

196196

197197
@define
198-
class ProxyEntityMetadataEntryDeclaration(Generic[T, T_2]):
198+
class ProxyEntityMetadataEntryDeclaration(Generic[T, U]):
199199
"""Class used to pass the bound entry and additional arguments to the proxy entity metadata entry.
200200
201201
Explanation:
@@ -209,16 +209,16 @@ class ProxyEntityMetadataEntryDeclaration(Generic[T, T_2]):
209209
This is set by the EntityMetadataCreator.
210210
"""
211211

212-
m_bound_entry: EntityMetadataEntry[T_2]
212+
m_bound_entry: EntityMetadataEntry[U]
213213
m_args: tuple[Any]
214214
m_kwargs: dict[str, Any]
215-
m_type: type[ProxyEntityMetadataEntry[T, T_2]]
215+
m_type: type[ProxyEntityMetadataEntry[T, U]]
216216
m_bound_index: int
217217

218218

219219
def proxy(
220-
bound_entry: T_2, # This will in fact be an EntityMetadataEntry, but treated as a T_2 during type checking
221-
proxy: type[ProxyEntityMetadataEntry[T, T_2]],
220+
bound_entry: U, # This will in fact be an EntityMetadataEntry, but treated as a U during type checking
221+
proxy: type[ProxyEntityMetadataEntry[T, U]],
222222
*args: Any,
223223
**kwargs: Any,
224224
) -> T:

scripts/entity_generator_data.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2784,7 +2784,7 @@
27842784
{
27852785
"type": "OptBlockState",
27862786
"name": "carried_block",
2787-
"default": None,
2787+
"default": "None",
27882788
"input": "int | None",
27892789
"description": "The block the enderman is carrying.",
27902790
},

0 commit comments

Comments
 (0)