Skip to content

Commit 3b56b58

Browse files
committed
Implement B009
1 parent 93ce880 commit 3b56b58

5 files changed

Lines changed: 8 additions & 8 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ extend-select = [
262262
# it may be worth fixing some or these in the future
263263
# PYI036 disable until https://github.com/astral-sh/ruff/issues/9794 is fixed
264264
ignore = ["E501", "G004", "PLR2004", "PLR0913", "PLR0911", "PLR0912", "PLR0915", "PLW0602", "PLW0603", "PLW2901", "PYI036",
265-
"B018", "B017", "B009","SIM118", "PT014", "LOG015", "PT031",
265+
"B018", "B017","SIM118", "PT014", "LOG015", "PT031",
266266
"DTZ007", "DTZ005", "BLE001", "S110",
267267
"PIE790", "N999", "PIE804",
268268
"DTZ006",

src/qcodes/instrument_drivers/stanford_research/SR86x.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1292,7 +1292,7 @@ def get_data_channels_parameters(
12921292
method_name = "get_latest"
12931293

12941294
return tuple(
1295-
getattr(getattr(self.data_channels[i], "assigned_parameter"), method_name)()
1295+
getattr(self.data_channels[i].assigned_parameter, method_name)()
12961296
for i in range(self._N_DATA_CHANNELS)
12971297
)
12981298

src/qcodes/utils/json_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def default(self, o: Any) -> Any:
6161
}
6262
elif hasattr(o, "_JSONEncoder"):
6363
# Use object's custom JSON encoder
64-
jsosencode = getattr(o, "_JSONEncoder")
64+
jsosencode = o._JSONEncoder
6565
return jsosencode()
6666
else:
6767
try:
@@ -82,7 +82,7 @@ def default(self, o: Any) -> Any:
8282
):
8383
return {
8484
"__class__": type(o).__name__,
85-
"__args__": getattr(o, "__getnewargs__")(),
85+
"__args__": o.__getnewargs__(),
8686
}
8787
else:
8888
# we cannot convert the object to JSON, just take a string

tests/drivers/test_lakeshore_372.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ def __init__(self, *args, **kwargs) -> None:
6262
f = getattr(self, func_name)
6363
# only add for methods that have such an attribute
6464
with suppress(AttributeError):
65-
self.queries[getattr(f, "query_name")] = f
65+
self.queries[f.query_name] = f
6666
with suppress(AttributeError):
67-
self.cmds[getattr(f, "command_name")] = f
67+
self.cmds[f.command_name] = f
6868

6969
def write_raw(self, cmd) -> None:
7070
cmd_parts = cmd.split(" ")

tests/test_station.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ def test_setup_alias_parameters() -> None:
619619
"""
620620
)
621621
mock = st.load_instrument("mock")
622-
p = getattr(mock, "gate_a")
622+
p = mock.gate_a
623623
assert isinstance(p, Parameter)
624624
assert p.unit == "mV"
625625
assert p.label == "main gate"
@@ -665,7 +665,7 @@ def test_setup_delegate_parameters() -> None:
665665
"""
666666
)
667667
mock = st.load_instrument("mock")
668-
p = getattr(mock, "gate_a")
668+
p = mock.gate_a
669669
assert isinstance(p, DelegateParameter)
670670
assert p.unit == "mV"
671671
assert p.label == "main gate"

0 commit comments

Comments
 (0)