Add ruff checking for unnecessary comprehensions
This commit is contained in:
parent
2050c2dc7c
commit
1c54d25212
4 changed files with 4 additions and 4 deletions
|
|
@ -102,7 +102,7 @@ select = [
|
||||||
# "PL", # Pylint (a subset of, catches far less than pylint does)
|
# "PL", # Pylint (a subset of, catches far less than pylint does)
|
||||||
# "B", # Flake8 bugbear
|
# "B", # Flake8 bugbear
|
||||||
"A", # Flake8 builtins checker
|
"A", # Flake8 builtins checker
|
||||||
# "C", # Flake8 comprehensions
|
"C", # Flake8 comprehensions
|
||||||
# "FIX", #TODO/FIXME's in code. These should be added during develoment for ongoing tasks.
|
# "FIX", #TODO/FIXME's in code. These should be added during develoment for ongoing tasks.
|
||||||
# If they are not fixed before merge they should be converted to GitLab issues
|
# If they are not fixed before merge they should be converted to GitLab issues
|
||||||
# "LOG", # Flake8 logging issues (pedantic logger formatting issues can be added with "G")
|
# "LOG", # Flake8 logging issues (pedantic logger formatting issues can be added with "G")
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ def make_hardware_interface(
|
||||||
axes = stage.axis_names
|
axes = stage.axis_names
|
||||||
|
|
||||||
def pos2dict(pos: Sequence[float]) -> Mapping[str, float]:
|
def pos2dict(pos: Sequence[float]) -> Mapping[str, float]:
|
||||||
return {k: p for k, p in zip(axes, pos)}
|
return dict(zip(axes, pos))
|
||||||
|
|
||||||
def dict2pos(posd: Mapping[str, float]) -> Sequence[float]:
|
def dict2pos(posd: Mapping[str, float]) -> Sequence[float]:
|
||||||
return tuple(posd[k] for k in axes if k in posd)
|
return tuple(posd[k] for k in axes if k in posd)
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ class BaseStage(Thing):
|
||||||
|
|
||||||
position = PropertyDescriptor(
|
position = PropertyDescriptor(
|
||||||
Mapping[str, int],
|
Mapping[str, int],
|
||||||
{k: 0 for k in _axis_names},
|
dict.fromkeys(_axis_names, 0),
|
||||||
description="Current position of the stage",
|
description="Current position of the stage",
|
||||||
readonly=True,
|
readonly=True,
|
||||||
observable=True,
|
observable=True,
|
||||||
|
|
|
||||||
|
|
@ -91,5 +91,5 @@ class DummyStage(BaseStage):
|
||||||
It is intended for use after manually or automatically recentring the
|
It is intended for use after manually or automatically recentring the
|
||||||
stage.
|
stage.
|
||||||
"""
|
"""
|
||||||
self.position = {k: 0 for k in self.axis_names}
|
self.position = dict.fromkeys(self.axis_names, 0)
|
||||||
self.instantaneous_position = self.position
|
self.instantaneous_position = self.position
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue