Skip to content

Commit b0fca20

Browse files
committed
Update ruff to 0.12.0
1 parent 13398ee commit b0fca20

File tree

4 files changed

+40
-29
lines changed

4 files changed

+40
-29
lines changed

docs/conf.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@
1313
import sys
1414
from pathlib import Path
1515

16+
import m2r2
17+
import sphinxcontrib.towncrier.ext
18+
from docutils import statemachine
1619
from packaging.version import parse as parse_version
20+
from sphinx.ext import autodoc
21+
from sphinx.util.nodes import nodes
1722
from typing_extensions import override
1823

1924
if sys.version_info >= (3, 11):
@@ -170,7 +175,6 @@ def mock_autodoc() -> None:
170175
171176
See also https://stackoverflow.com/a/75041544/20952782.
172177
"""
173-
from sphinx.ext import autodoc
174178

175179
class MockedClassDocumenter(autodoc.ClassDocumenter):
176180
@override
@@ -193,11 +197,6 @@ def override_towncrier_draft_format() -> None:
193197
this doesn't look well with the version set to "Unreleased changes", so this function
194198
also removes this "Version " prefix.
195199
"""
196-
import m2r2
197-
import sphinxcontrib.towncrier.ext
198-
from docutils import statemachine
199-
from sphinx.util.nodes import nodes
200-
201200
orig_f = sphinxcontrib.towncrier.ext._nodes_from_document_markup_source # pyright: ignore[reportPrivateUsage]
202201

203202
def override_f(

mcproto/types/chat.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ def __eq__(self, other: object) -> bool:
6969

7070
return self.raw == other.raw
7171

72+
@override
73+
def __hash__(self) -> int:
74+
return hash(self.raw)
75+
7276
@override
7377
def serialize_to(self, buf: Buffer) -> None:
7478
txt = json.dumps(self.raw)

mcproto/types/nbt.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,10 @@ def __repr__(self) -> str:
447447
return f"{type(self).__name__}[{self.name!r}]({self.payload!r})"
448448
return f"{type(self).__name__}({self.payload!r})"
449449

450+
@override
451+
def __hash__(self) -> int:
452+
return hash((type(self), self.name, self.payload))
453+
450454
@override
451455
def to_nbt(self, name: str = "") -> NBTag:
452456
"""Convert the object to an NBT tag.
@@ -995,6 +999,10 @@ def __eq__(self, other: object) -> bool:
995999
return False
9961000
return all(tag in other.payload for tag in self.payload)
9971001

1002+
# Hash implementation is consistent with the parent class, even though
1003+
# we're overriding __eq__
1004+
__hash__ = NBTag.__hash__
1005+
9981006
@property
9991007
@override
10001008
def value(self) -> dict[str, PayloadType]:

poetry.lock

Lines changed: 23 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)