Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
457c7e6
Implement B009
jenshnielsen Jul 24, 2026
eb6dcde
Enable SIM117
jenshnielsen Jul 24, 2026
b86755e
Enable SIM905
jenshnielsen Jul 24, 2026
c284be8
This rule is now stable
jenshnielsen Jul 24, 2026
2ecca12
Enable SIM102
jenshnielsen Jul 24, 2026
fcc38c2
Enable B018
jenshnielsen Jul 24, 2026
f3a7b9c
Enable PT031
jenshnielsen Jul 24, 2026
35f2560
Enable PT014
jenshnielsen Jul 24, 2026
68912a1
Implement C405 and C414
jenshnielsen Jul 24, 2026
570297f
Implement C419
jenshnielsen Jul 24, 2026
8e22ca4
Implement SIM201
jenshnielsen Jul 24, 2026
01e2e44
Add PIE790
jenshnielsen Jul 24, 2026
3a0d72f
Enable FLY002
jenshnielsen Jul 24, 2026
2b7004f
Enable C408
jenshnielsen Jul 24, 2026
616eda3
Enable C400
jenshnielsen Jul 24, 2026
d01a8c0
Disable a few more rules for now
jenshnielsen Jul 24, 2026
a51e5d3
Switch to extend-select and ignore remaining errors
jenshnielsen Jul 24, 2026
f126afc
Fix FURB105
jenshnielsen Jul 24, 2026
ce61161
Implement B016
jenshnielsen Jul 24, 2026
3a26074
Implement SIM210
jenshnielsen Jul 24, 2026
f4ff43e
Implement SIM113
jenshnielsen Jul 24, 2026
5bd93ac
Implement FURB166
jenshnielsen Jul 24, 2026
24320c3
Implement B033
jenshnielsen Jul 24, 2026
fe3fb5e
Implement PIE804
jenshnielsen Jul 24, 2026
bb1bc9e
Implement LOG009
jenshnielsen Jul 24, 2026
13a3fce
Implement SIM103
jenshnielsen Jul 24, 2026
696e9eb
Implement C409
jenshnielsen Jul 24, 2026
94de519
Implement B010
jenshnielsen Jul 24, 2026
db3b561
Implement PERF102
jenshnielsen Jul 24, 2026
e18b761
Implement SIM114
jenshnielsen Jul 24, 2026
49dc025
Implement B023
jenshnielsen Jul 24, 2026
041cba1
Add PIE808
jenshnielsen Jul 24, 2026
99c9eff
Add LOG015
jenshnielsen Jul 24, 2026
460f3fb
Implement B008
jenshnielsen Jul 25, 2026
4a88cdb
implement PERF402
jenshnielsen Jul 25, 2026
ee35e20
Implement TRY201
jenshnielsen Jul 25, 2026
c397e42
Implement B017
jenshnielsen Jul 25, 2026
d59f0b6
Ignore new type checking errors
jenshnielsen Jul 27, 2026
8b15979
Remove shebang
jenshnielsen Jul 27, 2026
94961a4
remove not matching regex
jenshnielsen Jul 27, 2026
304a629
Remove another shebang
jenshnielsen Jul 27, 2026
dca87ba
Feedback from review
jenshnielsen Jul 30, 2026
6bc281c
Lint new code
jenshnielsen Jul 30, 2026
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
8 changes: 4 additions & 4 deletions benchmarking/benchmarks/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ class Adding5Params:
timer = time.perf_counter

def __init__(self):
self.parameters = list()
self.values = list()
self.parameters = []
self.values = []
self.experiment = None
self.runner = None
self.datasaver = None
Expand Down Expand Up @@ -116,8 +116,8 @@ def teardown(self, bench_param):
shutil.rmtree(self.tmpdir)
self.tmpdir = None

self.parameters = list()
self.values = list()
self.parameters = []
self.values = []

def time_test(self, bench_param):
"""Adding data for 5 parameters"""
Expand Down
2 changes: 0 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env python3
#
# QCoDeS documentation build configuration file, created by
# sphinx-quickstart on Thu Jun 2 10:41:37 2016.
#
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/DataSet/Accessing-data-in-DataSet.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@
}
],
"source": [
"for d in interdeps.dependencies.keys():\n",
"for d in interdeps.dependencies:\n",
" print(f\"Parameter {d.name!r} ({d.label}, {d.unit}) depends on:\")\n",
" for i in interdeps.dependencies[d]:\n",
" print(f\"- {i.name!r} ({i.label}, {i.unit})\")"
Expand Down Expand Up @@ -972,7 +972,7 @@
" print(f\"DataFrame for parameter {parameter_name}\")\n",
" print(\"-----------------------------\")\n",
" print(f\"{df.head()!r}\")\n",
" print(\"\")"
" print()"
]
},
{
Expand Down
10 changes: 2 additions & 8 deletions docs/examples/DataSet/Offline Plotting Tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -669,17 +669,11 @@
"\n",
"\n",
"def no_x(xv):\n",
" if xv > 0 and xv < 3:\n",
" return True\n",
" else:\n",
" return False\n",
" return bool(xv > 0 and xv < 3)\n",
"\n",
"\n",
"def no_t(tv):\n",
" if tv > 0 and tv < 450:\n",
" return True\n",
" else:\n",
" return False\n",
" return bool(tv > 0 and tv < 450)\n",
"\n",
"\n",
"with meas.run() as datasaver:\n",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1736,9 +1736,8 @@
}
],
"source": [
"with qcodes.logger.console_level(\"DEBUG\"):\n",
" with qcodes.logger.filter_instrument(dac):\n",
" dond(set_only_sweep, dmm.v1, dmm.v2)"
"with qcodes.logger.console_level(\"DEBUG\"), qcodes.logger.filter_instrument(dac):\n",
" dond(set_only_sweep, dmm.v1, dmm.v2)"
]
},
{
Expand Down Expand Up @@ -1796,9 +1795,8 @@
}
],
"source": [
"with qcodes.logger.console_level(\"DEBUG\"):\n",
" with qcodes.logger.filter_instrument(dac):\n",
" dond(set_and_get_sweep, dmm.v1, dmm.v2)"
"with qcodes.logger.console_level(\"DEBUG\"), qcodes.logger.filter_instrument(dac):\n",
" dond(set_and_get_sweep, dmm.v1, dmm.v2)"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
" super().__init__(name=name, get_cmd=False)\n",
" # dict of Parameter to (slope, offset) of components\n",
" self._components_dict: dict[Parameter, tuple[float, float]] = components\n",
" for param in self._components_dict.keys():\n",
" for param in self._components_dict:\n",
" self._has_control_of.add(param)\n",
" param.is_controlled_by.add(self)\n",
"\n",
Expand Down
3 changes: 1 addition & 2 deletions docs/examples/Parameters/Parameters.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@
},
{
"cell_type": "code",
"execution_count": 36,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand All @@ -429,7 +429,6 @@
}
],
"source": [
"dac.ch1\n",
"print(f\"Default validators: {dac.ch1.validators}\")\n",
"\n",
"# if we try to set a value outside the range of the default validator we get an error.\n",
Expand Down
4 changes: 1 addition & 3 deletions docs/examples/basic_examples/Configuring_QCoDeS.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,7 @@
],
"source": [
"print(\n",
" \"\\n\".join(\n",
" [qc.config.home_file_name, qc.config.env_file_name, qc.config.cwd_file_name]\n",
" )\n",
" f\"{qc.config.home_file_name}\\n{qc.config.env_file_name}\\n{qc.config.cwd_file_name}\"\n",
")"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand All @@ -454,7 +454,7 @@
],
"source": [
"try:\n",
" measurement.capacitance\n",
" _ = measurement.capacitance\n",
"except AttributeError as err:\n",
" print(err)"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand All @@ -191,7 +191,7 @@
"source": [
"try:\n",
" s46.A2(\"close\")\n",
" raise (\"We should not be here\")\n",
" raise RuntimeError(\"We should not be here\")\n",
"except KeithleyS46LockAcquisitionError as e:\n",
" print(e)"
]
Expand All @@ -216,7 +216,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand All @@ -230,7 +230,7 @@
"source": [
"try:\n",
" s46.A1(\"close\")\n",
" raise (\"We should not be here\")\n",
" raise RuntimeError(\"We should not be here\")\n",
"except KeithleyS46LockAcquisitionError as e:\n",
" print(e)"
]
Expand All @@ -246,7 +246,7 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand All @@ -260,7 +260,7 @@
"source": [
"try:\n",
" s46.B2(\"close\")\n",
" raise (\"We should not be here\")\n",
" raise RuntimeError(\"We should not be here\")\n",
"except KeithleyS46LockAcquisitionError as e:\n",
" print(e)"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,32 +79,32 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from IPython.display import Markdown, display\n",
"from matplotlib import pyplot as plt\n",
"from pyvisa.errors import VisaIOError\n",
"\n",
"import qcodes as qc\n",
"from qcodes.dataset import (\n",
" Measurement,\n",
" initialise_database,\n",
" load_or_create_experiment,\n",
" plot_dataset,\n",
")\n",
"from qcodes.instrument_drivers.Keysight import KeysightB1500\n",
"from qcodes.instrument_drivers.Keysight.keysightb1500 import MessageBuilder, constants"
"from qcodes.instrument_drivers.Keysight.keysightb1500 import MessageBuilder, constants\n",
"from qcodes.station import Station"
]
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"station = qc.Station() # Create a station to hold all the instruments"
"station = Station() # Create a station to hold all the instruments"
]
},
{
Expand Down Expand Up @@ -215,9 +215,9 @@
"metadata": {},
"outputs": [],
"source": [
"b1500.smu1 # first SMU in the system\n",
"b1500.cmu1 # first CMU in the system\n",
"b1500.smu2 # second SMU in the system"
"_smu1 = b1500.smu1 # first SMU in the system\n",
"_cmu1 = b1500.cmu1 # first CMU in the system\n",
"_smu2 = b1500.smu2 # second SMU in the system"
]
},
{
Expand Down
5 changes: 2 additions & 3 deletions docs/examples/logging/logfile_parsing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,8 @@
"source": [
"# put the 30MB into a zip file\n",
"filepath = os.path.join(os.getcwd(), \"static\", \"pythonlog.zip\")\n",
"with ZipFile(filepath) as z:\n",
" with z.open(\"pythonlog.log\", \"r\") as f:\n",
" my_log = [line.decode() for line in f]"
"with ZipFile(filepath) as z, z.open(\"pythonlog.log\", \"r\") as f:\n",
" my_log = [line.decode() for line in f]"
]
},
{
Expand Down
26 changes: 13 additions & 13 deletions docs/examples/logging/logging_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,8 @@
],
"source": [
"driver.cartesian((0, 0, 0))\n",
"with logger.console_level(\"DEBUG\"):\n",
" with logger.filter_instrument(mag_x):\n",
" driver.cartesian((0, 0, 1))"
"with logger.console_level(\"DEBUG\"), logger.filter_instrument(mag_x):\n",
" driver.cartesian((0, 0, 1))"
]
},
{
Expand Down Expand Up @@ -330,9 +329,8 @@
],
"source": [
"driver.cartesian((0, 0, 0))\n",
"with logger.console_level(\"DEBUG\"):\n",
" with logger.filter_instrument((mag_x, mag_y)):\n",
" driver.cartesian((0, 0, 1))"
"with logger.console_level(\"DEBUG\"), logger.filter_instrument((mag_x, mag_y)):\n",
" driver.cartesian((0, 0, 1))"
]
},
{
Expand Down Expand Up @@ -360,7 +358,7 @@
"metadata": {},
"outputs": [],
"source": [
"with logger.console_level(logging.WARN):\n",
"with logger.console_level(logging.WARNING):\n",
" driver.cartesian((0, 0, 0))\n",
" with capture_dataframe(level=\"DEBUG\") as (handler, get_dataframe):\n",
" driver.cartesian((0, 0, 1))\n",
Expand Down Expand Up @@ -1197,7 +1195,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": null,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -1319,12 +1317,14 @@
}
],
"source": [
"with logger.console_level(logging.WARN):\n",
"with logger.console_level(logging.WARNING):\n",
" driver.cartesian((0, 0, 0))\n",
" with capture_dataframe(level=\"DEBUG\") as (handler, get_dataframe):\n",
" with logger.filter_instrument(mag_x, handler=handler):\n",
" driver.cartesian((0, 0, 1))\n",
" df = get_dataframe()\n",
" with (\n",
" capture_dataframe(level=\"DEBUG\") as (handler, get_dataframe),\n",
" logger.filter_instrument(mag_x, handler=handler),\n",
" ):\n",
" driver.cartesian((0, 0, 1))\n",
" df = get_dataframe()\n",
"df"
]
},
Expand Down
7 changes: 4 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -244,20 +244,21 @@ explicit-preview-rules = true
# TID253 banned-module-level-imports
# W pydocstyle
# PLx pylint
select = [
extend-select = [
"E", "F", "PT025", "UP", "RUF", "YTT", "INP",
"I", "G", "ISC", "TID253", "NPY", "PLE",
"PLR", "PLC", "PLW", "W",
"D214", "D300", "D402", "D403", "D405", "D410", "D411", "D412", "D413", "D414", "D416", "D417", "D418", "D419",
"TC", "PYI",
"RUF027", "PYI059", # these are preview rules that are not yet stable but explicitly enabled.
"RUF027", # these are preview rules that are not yet stable but explicitly enabled.
]
# G004 We have a lot of use of f strings in log messages
# so disable that lint for now
# PLxxxx are pylint lints that generate a fair amount of warnings
# it may be worth fixing some or these in the future
# PYI036 disable until https://github.com/astral-sh/ruff/issues/9794 is fixed
ignore = ["E501", "G004", "PLR2004", "PLR0913", "PLR0911", "PLR0912", "PLR0915", "PLW0602", "PLW0603", "PLW2901", "PYI036", "PLR0917"]
ignore = ["E501", "G004", "PLR2004", "PLR0913", "PLR0911", "PLR0912", "PLR0915", "PLW0602", "PLW0603", "PLW2901", "PYI036", "PLR0917",
"DTZ007", "DTZ005", "DTZ006", "N999", "BLE001", "TRY004", "TRY002", "S110"] # new defaults of of 0.16.0 that we don't want to enable yet

# we want to explicitly use the micro symbol
# not the greek letter
Expand Down
2 changes: 1 addition & 1 deletion src/qcodes/calibrations/keithley.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def calibrate_keithley_smu_v_single(
time_delay: float = 3.0,
) -> None:
assert channel in {smu_channel.channel for smu_channel in smu.channels}
assert v_range in src_FS_map.keys()
assert v_range in src_FS_map
src_FS = src_FS_map[v_range]

sense_modes = ["SENSE_LOCAL"]
Expand Down
13 changes: 6 additions & 7 deletions src/qcodes/dataset/data_set_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,10 +376,7 @@ def _merge_data_single_param(
)
elif new_values is not None or shape is not None:
(merged_data, new_write_status) = _create_new_data_dict(new_values, shape)
elif existing_values is not None:
merged_data = existing_values
new_write_status = single_tree_write_status
elif shape is None and new_values is None:
elif existing_values is not None or (shape is None and new_values is None):
merged_data = existing_values
new_write_status = single_tree_write_status
else:
Expand Down Expand Up @@ -442,11 +439,13 @@ def _insert_into_data_dict(
data[j] = np.atleast_1d(new_values[i])
return data, None
else:
if existing_values.dtype.kind in ("U", "S"):
if (
existing_values.dtype.kind in ("U", "S")
and new_values.dtype.itemsize > existing_values.dtype.itemsize
):
# string type arrays may be too small for the new data
# read so rescale if needed.
if new_values.dtype.itemsize > existing_values.dtype.itemsize:
existing_values = existing_values.astype(new_values.dtype)
existing_values = existing_values.astype(new_values.dtype)
n_values = new_values.size
new_write_status = write_status + n_values
if new_write_status > existing_values.size:
Expand Down
Loading
Loading