Skip to content

Commit

Permalink
Linting other code
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelldls committed Jan 22, 2025
1 parent e04e67f commit 0b10f50
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
7 changes: 4 additions & 3 deletions src/fastcs/attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,10 @@ def __init__(
allowed_values: list[T] | None = None,
description: str | None = None,
) -> None:
assert (
datatype.dtype in ATTRIBUTE_TYPES
), f"Attr type must be one of {ATTRIBUTE_TYPES}, received type {datatype.dtype}"
assert datatype.dtype in ATTRIBUTE_TYPES, (
f"Attr type must be one of {ATTRIBUTE_TYPES}"
", received type {datatype.dtype}"
)
self._datatype: DataType[T] = datatype
self._access_mode: AttrMode = access_mode
self._group = group
Expand Down
6 changes: 3 additions & 3 deletions src/fastcs/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ def _link_attribute_sender_class(single_mapping: SingleMapping) -> None:
for attr_name, attribute in single_mapping.attributes.items():
match attribute:
case AttrW(sender=Sender()):
assert (
not attribute.has_process_callback()
), f"Cannot assign both put method and Sender object to {attr_name}"
assert not attribute.has_process_callback(), (
f"Cannot assign both put method and Sender object to {attr_name}"
)

callback = _create_sender_callback(attribute, single_mapping.controller)
attribute.set_process_callback(callback)
Expand Down
6 changes: 3 additions & 3 deletions src/fastcs/transport/epics/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ def attr_is_enum(attribute: Attribute) -> bool:
"""
match attribute:
case Attribute(
datatype=String(), allowed_values=allowed_values
) if allowed_values is not None and len(allowed_values) <= MBB_MAX_CHOICES:
case Attribute(datatype=String(), allowed_values=allowed_values) if (
allowed_values is not None and len(allowed_values) <= MBB_MAX_CHOICES
):
return True
case _:
return False
Expand Down
2 changes: 1 addition & 1 deletion tests/test_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def test_over_defined_schema():

def test_version():
impl_version = "0.0.1"
expected = f"SingleArg: {impl_version}\n" f"FastCS: {__version__}\n"
expected = f"SingleArg: {impl_version}\nFastCS: {__version__}\n"
app = _launch(SingleArg, version=impl_version)
result = runner.invoke(app, ["version"])
assert result.exit_code == 0
Expand Down
2 changes: 1 addition & 1 deletion tests/transport/epics/test_ioc.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ def test_long_pv_names_discarded(mocker: MockerFixture):

assert long_name_controller.command_short_name.fastcs_method.enabled
long_command_name = (
"command_with_" "reallyreallyreallyreallyreallyreallyreally_long_name"
"command_with_reallyreallyreallyreallyreallyreallyreally_long_name"
)
assert not getattr(long_name_controller, long_command_name).fastcs_method.enabled

Expand Down

0 comments on commit 0b10f50

Please sign in to comment.