Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mypy violations #1916

Merged
merged 1 commit into from
Aug 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading