Skip to content

Commit

Permalink
Fix mypy violations (#1916)
Browse files Browse the repository at this point in the history
  • Loading branch information
bartfeenstra authored Aug 31, 2024
1 parent dae345c commit 0a77e78
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions betty/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ def _prepare_listener(
) -> ReferenceType[_ConfigurationListener]:
if isinstance(listener, Configuration):
listener = listener._dispatch_change
if inspect.ismethod(listener): # type: ignore[redundant-expr]
return weakref.WeakMethod(listener) # type: ignore[unreachable]
if inspect.ismethod(listener):
return weakref.WeakMethod(listener)
return weakref.ref(listener)

def on_change(self, listener: ConfigurationListener) -> None:
Expand Down
4 changes: 1 addition & 3 deletions betty/functools.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,7 @@ async def until(
if isawaitable(condition_result_or_coroutine):
condition_result = await condition_result_or_coroutine
else:
condition_result = cast(
None | bool, condition_result_or_coroutine
)
condition_result = condition_result_or_coroutine
if condition_result is False:
raise RuntimeError(
f"Condition {condition} was not met for {do_result}."
Expand Down
4 changes: 2 additions & 2 deletions betty/serde/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,8 +456,8 @@ def _assert_mapping(value: Any) -> MutableMapping[str, _AssertionReturnT]:
with SerdeErrorCollection().assert_valid() as errors:
for value_item_key, value_item_value in dict_value.items():
with errors.catch(Str.plain(value_item_key)):
mapping[value_item_key] = self.assert_assertions(
item_assertion
mapping[value_item_key] = self.assert_assertions( # type: ignore[assignment]
item_assertion # type: ignore[arg-type]
)(value_item_value)
return mapping

Expand Down

0 comments on commit 0a77e78

Please sign in to comment.