Skip to content

Commit 6f5902b

Browse files
committed
fix python lint errors with new hatch version
1 parent 5e270c7 commit 6f5902b

File tree

4 files changed

+19
-18
lines changed

4 files changed

+19
-18
lines changed

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,8 @@ lint.ignore = [
305305
"PLR0912",
306306
"PLR0913",
307307
"PLR0915",
308+
# Allow imports anywhere
309+
"PLC0415",
308310
]
309311
lint.unfixable = [
310312
# Don't touch unused imports

src/reactpy/_console/rewrite_keys.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,7 @@ def log_could_not_rewrite(file: Path, tree: ast.AST) -> None:
100100
else:
101101
continue
102102

103-
if (
104-
name == "vdom"
105-
or (hasattr(html, name)
106-
and any(kw.arg == "key" for kw in node.keywords))
103+
if name == "vdom" or (
104+
hasattr(html, name) and any(kw.arg == "key" for kw in node.keywords)
107105
):
108106
click.echo(f"Unable to rewrite usage at {file}:{node.lineno}")

src/reactpy/core/events.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,7 @@ def setup(function: Callable[..., Any]) -> EventHandler:
6969
prevent_default,
7070
)
7171

72-
if function is not None:
73-
return setup(function)
74-
else:
75-
return setup
72+
return setup(function) if function is not None else setup
7673

7774

7875
class EventHandler:
@@ -109,18 +106,20 @@ def __init__(
109106
self.stop_propagation = stop_propagation
110107
self.target = target
111108

109+
__hash__ = None # type: ignore
110+
112111
def __eq__(self, other: object) -> bool:
113112
undefined = object()
114-
for attr in (
115-
"function",
116-
"prevent_default",
117-
"stop_propagation",
118-
"target",
119-
):
120-
if not attr.startswith("_"):
121-
if not getattr(other, attr, undefined) == getattr(self, attr):
122-
return False
123-
return True
113+
return not any(
114+
not attr.startswith("_")
115+
and not getattr(other, attr, undefined) == getattr(self, attr)
116+
for attr in (
117+
"function",
118+
"prevent_default",
119+
"stop_propagation",
120+
"target",
121+
)
122+
)
124123

125124
def __repr__(self) -> str:
126125
public_names = [name for name in self.__slots__ if not name.startswith("_")]

src/reactpy/utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ def set_current(self, new: _RefValue) -> _RefValue:
4545
self.current = new
4646
return old
4747

48+
__hash__ = None # type: ignore
49+
4850
def __eq__(self, other: object) -> bool:
4951
try:
5052
return isinstance(other, Ref) and (other.current == self.current)

0 commit comments

Comments
 (0)