diff --git a/dev-requirements.txt b/dev-requirements.txt index c42f8689e..419748e1c 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,3 +1,3 @@ mock nose -pylint==1.6.5 +pylint==1.7.1 diff --git a/instruments/abstract_instruments/comm/file_communicator.py b/instruments/abstract_instruments/comm/file_communicator.py index b6022e7ce..46245660e 100644 --- a/instruments/abstract_instruments/comm/file_communicator.py +++ b/instruments/abstract_instruments/comm/file_communicator.py @@ -60,8 +60,8 @@ def address(self): """ if hasattr(self._filelike, 'name'): return self._filelike.name - else: - return None + + return None @address.setter def address(self, newval): diff --git a/instruments/abstract_instruments/comm/gi_gpib_communicator.py b/instruments/abstract_instruments/comm/gi_gpib_communicator.py index ab686bb15..3123059d7 100644 --- a/instruments/abstract_instruments/comm/gi_gpib_communicator.py +++ b/instruments/abstract_instruments/comm/gi_gpib_communicator.py @@ -48,7 +48,7 @@ def __init__(self, filelike, gpib_address): if self._version <= 4: self._eos = 10 else: - self._eos = "\n" # pylint: disable=redefined-variable-type + self._eos = "\n" # PROPERTIES # @@ -117,8 +117,8 @@ def terminator(self): """ if not self._eoi: return self._terminator - else: - return 'eoi' + + return 'eoi' @terminator.setter def terminator(self, newval): @@ -203,7 +203,6 @@ def eos(self): @eos.setter def eos(self, newval): - # pylint: disable=redefined-variable-type if self._version <= 4: if isinstance(newval, (str, bytes)): newval = ord(newval) diff --git a/instruments/abstract_instruments/comm/usbtmc_communicator.py b/instruments/abstract_instruments/comm/usbtmc_communicator.py index 2f96194f6..f465abba7 100644 --- a/instruments/abstract_instruments/comm/usbtmc_communicator.py +++ b/instruments/abstract_instruments/comm/usbtmc_communicator.py @@ -43,8 +43,8 @@ def __init__(self, *args, **kwargs): def address(self): if hasattr(self._filelike, "name"): return id(self._filelike) # TODO: replace with something more useful. - else: - return None + + return None @property def terminator(self): diff --git a/instruments/abstract_instruments/function_generator.py b/instruments/abstract_instruments/function_generator.py index ffe73f3aa..e9baa64be 100644 --- a/instruments/abstract_instruments/function_generator.py +++ b/instruments/abstract_instruments/function_generator.py @@ -153,8 +153,8 @@ def amplitude(self): if units == self.VoltageMode.dBm: return pq.Quantity(mag, u.dBm) - else: - return pq.Quantity(mag, pq.V), units + + return pq.Quantity(mag, pq.V), units @amplitude.setter def amplitude(self, newval): @@ -168,7 +168,6 @@ def amplitude(self, newval): # OK, we have volts. Now, do we have a tuple? If not, assume Vpp. if not isinstance(newval, tuple): mag = newval - # pylint: disable=redefined-variable-type units = self.VoltageMode.peak_to_peak else: mag, units = newval diff --git a/instruments/abstract_instruments/oscilloscope.py b/instruments/abstract_instruments/oscilloscope.py index 960f28b28..16fa662ee 100644 --- a/instruments/abstract_instruments/oscilloscope.py +++ b/instruments/abstract_instruments/oscilloscope.py @@ -49,8 +49,10 @@ def __exit__(self, type, value, traceback): def __eq__(self, other): if not isinstance(other, type(self)): return NotImplemented - else: - return other.name == self.name + + return other.name == self.name + + __hash__ = None # PROPERTIES # diff --git a/instruments/agilent/agilent33220a.py b/instruments/agilent/agilent33220a.py index 7a2c56b7c..5a24ea9ad 100644 --- a/instruments/agilent/agilent33220a.py +++ b/instruments/agilent/agilent33220a.py @@ -43,9 +43,6 @@ class Agilent33220a(SCPIFunctionGenerator): """ - def __init__(self, filelike): - super(Agilent33220a, self).__init__(filelike) - # ENUMS # class Function(Enum): diff --git a/instruments/agilent/agilent34410a.py b/instruments/agilent/agilent34410a.py index 329ad8abf..8c444f552 100644 --- a/instruments/agilent/agilent34410a.py +++ b/instruments/agilent/agilent34410a.py @@ -35,9 +35,6 @@ class Agilent34410a(SCPIMultimeter): # pylint: disable=abstract-method .. _Keysight website: http://www.keysight.com/ """ - def __init__(self, filelike): - super(Agilent34410a, self).__init__(filelike) - # PROPERTIES # @property diff --git a/instruments/config.py b/instruments/config.py index 107daa157..2e6d7b6eb 100644 --- a/instruments/config.py +++ b/instruments/config.py @@ -56,9 +56,9 @@ def walk_dict(d, path): if not path[0]: # If the first part of the path is empty, do nothing. return walk_dict(d, path[1:]) - else: - # Otherwise, resolve that segment and recurse. - return walk_dict(d[path[0]], path[1:]) + + # Otherwise, resolve that segment and recurse. + return walk_dict(d[path[0]], path[1:]) def quantity_constructor(loader, node): """ diff --git a/instruments/generic_scpi/scpi_function_generator.py b/instruments/generic_scpi/scpi_function_generator.py index fcad54c04..66630006a 100644 --- a/instruments/generic_scpi/scpi_function_generator.py +++ b/instruments/generic_scpi/scpi_function_generator.py @@ -32,9 +32,6 @@ class SCPIFunctionGenerator(FunctionGenerator, SCPIInstrument): >>> inst.frequency = 1 * pq.kHz """ - def __init__(self, filelike): - super(SCPIFunctionGenerator, self).__init__(filelike) - # CONSTANTS # _UNIT_MNEMONICS = { diff --git a/instruments/generic_scpi/scpi_instrument.py b/instruments/generic_scpi/scpi_instrument.py index 30d16f670..5f4f0d93b 100644 --- a/instruments/generic_scpi/scpi_instrument.py +++ b/instruments/generic_scpi/scpi_instrument.py @@ -37,9 +37,6 @@ class SCPIInstrument(Instrument): >>> print(inst.name) """ - def __init__(self, filelike): - super(SCPIInstrument, self).__init__(filelike) - # PROPERTIES # @property diff --git a/instruments/generic_scpi/scpi_multimeter.py b/instruments/generic_scpi/scpi_multimeter.py index 213d9b3d7..b6cc062fd 100644 --- a/instruments/generic_scpi/scpi_multimeter.py +++ b/instruments/generic_scpi/scpi_multimeter.py @@ -45,9 +45,6 @@ class SCPIMultimeter(SCPIInstrument, Multimeter): >>> print(inst.measure(inst.Mode.resistance)) """ - def __init__(self, filelike): - super(SCPIMultimeter, self).__init__(filelike) - # ENUMS ## class Mode(Enum): @@ -142,7 +139,7 @@ class SampleSource(Enum): # PROPERTIES ## - # pylint: disable=unnecessary-lambda + # pylint: disable=unnecessary-lambda,undefined-variable mode = enum_property( name="CONF", enum=Mode, diff --git a/instruments/hp/hp6632b.py b/instruments/hp/hp6632b.py index 635ca53cd..b07407293 100644 --- a/instruments/hp/hp6632b.py +++ b/instruments/hp/hp6632b.py @@ -77,9 +77,6 @@ class HP6632b(SCPIInstrument, HP6652a): array(10.0) * V """ - def __init__(self, filelike): - super(HP6632b, self).__init__(filelike) - # ENUMS ## class ALCBandwidth(IntEnum): diff --git a/instruments/hp/hp6652a.py b/instruments/hp/hp6652a.py index 38e6bac40..f5d88ce03 100644 --- a/instruments/hp/hp6652a.py +++ b/instruments/hp/hp6652a.py @@ -55,9 +55,6 @@ class HP6652a(PowerSupply, PowerSupplyChannel): >>> psu.display_textmode=False """ - def __init__(self, filelike): - super(HP6652a, self).__init__(filelike) - # ENUMS ## # I don't know of any possible enumerations supported diff --git a/instruments/keithley/keithley195.py b/instruments/keithley/keithley195.py index 5bf00b06f..620be342b 100644 --- a/instruments/keithley/keithley195.py +++ b/instruments/keithley/keithley195.py @@ -195,11 +195,11 @@ def input_range(self): index = self.parse_status_word(self.get_status_word())['range'] if index == 0: return 'auto' - else: - mode = self.mode - value = Keithley195.ValidRange[mode.name].value[index - 1] - units = UNITS2[mode] - return value * units + + mode = self.mode + value = Keithley195.ValidRange[mode.name].value[index - 1] + units = UNITS2[mode] + return value * units @input_range.setter def input_range(self, newval): diff --git a/instruments/keithley/keithley2182.py b/instruments/keithley/keithley2182.py index 6a4873b06..8e3e245b1 100644 --- a/instruments/keithley/keithley2182.py +++ b/instruments/keithley/keithley2182.py @@ -35,9 +35,6 @@ class Keithley2182(SCPIMultimeter): """ - def __init__(self, filelike): - super(Keithley2182, self).__init__(filelike) - # INNER CLASSES # class Channel(Multimeter): diff --git a/instruments/keithley/keithley580.py b/instruments/keithley/keithley580.py index d8336ebbd..5ed6bbd26 100644 --- a/instruments/keithley/keithley580.py +++ b/instruments/keithley/keithley580.py @@ -463,8 +463,8 @@ def parse_measurement(measurement): # COMMUNICATOR METHODS # - def sendcmd(self, msg): - super(Keithley580, self).sendcmd(msg + ':') + def sendcmd(self, cmd): + super(Keithley580, self).sendcmd(cmd + ':') - def query(self, msg, size=-1): - return super(Keithley580, self).query(msg + ':', size)[:-1] + def query(self, cmd, size=-1): + return super(Keithley580, self).query(cmd + ':', size)[:-1] diff --git a/instruments/ondax/lm.py b/instruments/ondax/lm.py index 11070253a..0f4dfbfa3 100644 --- a/instruments/ondax/lm.py +++ b/instruments/ondax/lm.py @@ -411,8 +411,8 @@ def enabled(self, newval): def _ack_expected(self, msg=""): if msg.find("?") > 0: return None - else: - return "OK" + + return "OK" @property def firmware(self): diff --git a/instruments/qubitekk/cc1.py b/instruments/qubitekk/cc1.py index b6074755a..e2c785b31 100644 --- a/instruments/qubitekk/cc1.py +++ b/instruments/qubitekk/cc1.py @@ -275,8 +275,8 @@ def dwell_time(self): dwell_time = pq.Quantity(*split_unit_str(self.query("DWEL?"), "s")) if self.firmware[0] <= 2 and self.firmware[1] <= 1: return dwell_time/1000.0 - else: - return dwell_time + + return dwell_time @dwell_time.setter def dwell_time(self, new_val): diff --git a/instruments/rigol/rigolds1000.py b/instruments/rigol/rigolds1000.py index 4f23ae5e5..91acc4777 100644 --- a/instruments/rigol/rigolds1000.py +++ b/instruments/rigol/rigolds1000.py @@ -60,9 +60,6 @@ class DataSource(OscilloscopeDataSource): is designed to be initialized by the `RigolDS1000Series` class. """ - def __init__(self, parent, name): - super(RigolDS1000Series.DataSource, self).__init__(parent, name) - @property def name(self): return self._name diff --git a/instruments/srs/srs830.py b/instruments/srs/srs830.py index f533d0b9e..93f195c43 100644 --- a/instruments/srs/srs830.py +++ b/instruments/srs/srs830.py @@ -61,9 +61,9 @@ def __init__(self, filelike, outx_mode=None): # pragma: no cover will be sent depending on what type of communicator self._file is. """ super(SRS830, self).__init__(filelike) - if outx_mode is 1: + if outx_mode == 1: self.sendcmd("OUTX 1") - elif outx_mode is 2: + elif outx_mode == 2: self.sendcmd("OUTX 2") else: if isinstance(self._file, GPIBCommunicator): diff --git a/instruments/srs/srsctc100.py b/instruments/srs/srsctc100.py index 827b3ee90..3042ebc5b 100644 --- a/instruments/srs/srsctc100.py +++ b/instruments/srs/srsctc100.py @@ -168,7 +168,7 @@ def stats_enabled(self): :type: `bool` """ - return True if self._get('stats') is 'On' else False + return True if self._get('stats') == 'On' else False @stats_enabled.setter def stats_enabled(self, newval): diff --git a/instruments/tektronix/tekdpo4104.py b/instruments/tektronix/tekdpo4104.py index e770e70b6..0baea2240 100644 --- a/instruments/tektronix/tekdpo4104.py +++ b/instruments/tektronix/tekdpo4104.py @@ -83,8 +83,10 @@ def __exit__(self, type, value, traceback): def __eq__(self, other): if not isinstance(other, type(self)): return NotImplemented - else: - return other.name == self.name + + return other.name == self.name + + __hash__ = None def read_waveform(self, bin_format=True): """ @@ -259,8 +261,8 @@ def data_source(self): name = self.query("DAT:SOU?") if name.startswith("CH"): return _TekDPO4104Channel(self, int(name[2:]) - 1) - else: - return _TekDPO4104DataSource(self, name) + + return _TekDPO4104DataSource(self, name) @data_source.setter def data_source(self, newval): diff --git a/instruments/tektronix/tekdpo70000.py b/instruments/tektronix/tekdpo70000.py index 3c4c7664a..a70767b7c 100644 --- a/instruments/tektronix/tekdpo70000.py +++ b/instruments/tektronix/tekdpo70000.py @@ -172,9 +172,6 @@ class DataSource(OscilloscopeDataSource): is designed to be initialized by the `TekDPO70000` class. """ - def __init__(self, parent, name): - super(TekDPO70000.DataSource, self).__init__(parent, name) - @property def name(self): return self._name diff --git a/instruments/tektronix/tektds224.py b/instruments/tektronix/tektds224.py index ba7238d50..e5574da80 100644 --- a/instruments/tektronix/tektds224.py +++ b/instruments/tektronix/tektds224.py @@ -227,8 +227,8 @@ def data_source(self): name = self.query("DAT:SOU?") if name.startswith("CH"): return _TekTDS224Channel(self, int(name[2:]) - 1) - else: - return _TekTDS224DataSource(self, name) + + return _TekTDS224DataSource(self, name) @data_source.setter def data_source(self, newval): diff --git a/instruments/tektronix/tektds5xx.py b/instruments/tektronix/tektds5xx.py index d41c930c3..91bf28cfa 100644 --- a/instruments/tektronix/tektds5xx.py +++ b/instruments/tektronix/tektds5xx.py @@ -83,8 +83,8 @@ def read(self): resp = self._tek.query('MEASU:MEAS{}:VAL?'.format(self._id)) self._data['value'] = float(resp) return self._data - else: - return self._data + + return self._data class _TekTDS5xxDataSource(OscilloscopeDataSource): @@ -97,9 +97,6 @@ class _TekTDS5xxDataSource(OscilloscopeDataSource): designed to be initialized by the `TekTDS5xx` class. """ - def __init__(self, parent, name): - super(_TekTDS5xxDataSource, self).__init__(parent, name) - @property def name(self): """ @@ -434,8 +431,8 @@ def data_source(self): name = self.query("DAT:SOU?") if name.startswith("CH"): return _TekTDS5xxChannel(self, int(name[2:]) - 1) - else: - return _TekTDS5xxDataSource(self, name) + + return _TekTDS5xxDataSource(self, name) @data_source.setter def data_source(self, newval): diff --git a/instruments/tests/test_comm/test_file.py b/instruments/tests/test_comm/test_file.py index fcd242077..fde974caf 100644 --- a/instruments/tests/test_comm/test_file.py +++ b/instruments/tests/test_comm/test_file.py @@ -60,7 +60,7 @@ def test_filecomm_terminator(): comm.terminator = "*" eq_(comm._terminator, "*") - comm.terminator = b"*" # pylint: disable=redefined-variable-type + comm.terminator = b"*" eq_(comm._terminator, "*") diff --git a/instruments/tests/test_comm/test_gi_gpibusb.py b/instruments/tests/test_comm/test_gi_gpibusb.py index bee107953..263844e3e 100644 --- a/instruments/tests/test_comm/test_gi_gpibusb.py +++ b/instruments/tests/test_comm/test_gi_gpibusb.py @@ -66,7 +66,7 @@ def test_gpibusbcomm_address(): eq_(comm._gpib_address, 5) # Able to set address with a list - comm.address = [6, "/dev/foobar"] # pylint: disable=redefined-variable-type + comm.address = [6, "/dev/foobar"] eq_(comm._gpib_address, 6) port_name.assert_called_with("/dev/foobar") diff --git a/instruments/tests/test_comm/test_loopback.py b/instruments/tests/test_comm/test_loopback.py index 66e5aae5d..eaa9e796c 100644 --- a/instruments/tests/test_comm/test_loopback.py +++ b/instruments/tests/test_comm/test_loopback.py @@ -48,7 +48,7 @@ def test_loopbackcomm_terminator(): eq_(comm.terminator, "*") eq_(comm._terminator, "*") - comm.terminator = u"\r" # pylint: disable=redefined-variable-type + comm.terminator = u"\r" eq_(comm.terminator, u"\r") eq_(comm._terminator, u"\r") diff --git a/instruments/tests/test_comm/test_socket.py b/instruments/tests/test_comm/test_socket.py index a08c39660..05307f946 100644 --- a/instruments/tests/test_comm/test_socket.py +++ b/instruments/tests/test_comm/test_socket.py @@ -59,7 +59,7 @@ def test_socketcomm_terminator(): eq_(comm.terminator, "*") eq_(comm._terminator, "*") - comm.terminator = u"\r" # pylint: disable=redefined-variable-type + comm.terminator = u"\r" eq_(comm.terminator, u"\r") eq_(comm._terminator, u"\r") diff --git a/instruments/tests/test_comm/test_usbtmc.py b/instruments/tests/test_comm/test_usbtmc.py index 826ccecec..18e2ebcf7 100644 --- a/instruments/tests/test_comm/test_usbtmc.py +++ b/instruments/tests/test_comm/test_usbtmc.py @@ -58,7 +58,7 @@ def test_usbtmccomm_terminator_setter(mock_usbtmc): eq_(comm._terminator, "*") term_char.assert_called_with(42) - comm.terminator = b"*" # pylint: disable=redefined-variable-type + comm.terminator = b"*" eq_(comm._terminator, "*") term_char.assert_called_with(42) diff --git a/instruments/tests/test_qubitekk/test_qubitekk_cc1.py b/instruments/tests/test_qubitekk/test_qubitekk_cc1.py index e5d366fbc..cdbe9b499 100644 --- a/instruments/tests/test_qubitekk/test_qubitekk_cc1.py +++ b/instruments/tests/test_qubitekk/test_qubitekk_cc1.py @@ -364,7 +364,7 @@ def test_cc1_subtract_error(): cc.subtract = "blo" -def test_cc1_trigger_mode(): # pylint: disable=redefined-variable-type +def test_cc1_trigger_mode(): with expected_protocol( ik.qubitekk.CC1, [ @@ -386,7 +386,7 @@ def test_cc1_trigger_mode(): # pylint: disable=redefined-variable-type cc.trigger_mode = cc.TriggerMode.start_stop -def test_cc1_trigger_mode_old_firmware(): # pylint: disable=redefined-variable-type +def test_cc1_trigger_mode_old_firmware(): with expected_protocol( ik.qubitekk.CC1, [ diff --git a/instruments/tests/test_srs/test_srs830.py b/instruments/tests/test_srs/test_srs830.py index d94128726..57a612c08 100644 --- a/instruments/tests/test_srs/test_srs830.py +++ b/instruments/tests/test_srs/test_srs830.py @@ -125,7 +125,7 @@ def test_sample_rate(): # sends index of VALID_SAMPLE_RATES assert inst.sample_rate == 16 * pq.Hz assert inst.sample_rate == "trigger" inst.sample_rate = 2 - inst.sample_rate = "trigger" # pylint: disable=redefined-variable-type + inst.sample_rate = "trigger" @raises(ValueError) diff --git a/instruments/thorlabs/_packets.py b/instruments/thorlabs/_packets.py index 83c6decb9..7a9ef8ded 100644 --- a/instruments/thorlabs/_packets.py +++ b/instruments/thorlabs/_packets.py @@ -138,11 +138,11 @@ def pack(self): self._message_id, len( self._data), 0x80 | self._dest, self._source ) + self._data - else: - return message_header_nopacket.pack( - self._message_id, self._param1, self._param2, self._dest, - self._source - ) + + return message_header_nopacket.pack( + self._message_id, self._param1, self._param2, self._dest, + self._source + ) @classmethod def unpack(cls, bytes): diff --git a/instruments/thorlabs/tc200.py b/instruments/thorlabs/tc200.py index 0589de9ee..4478c80d8 100644 --- a/instruments/thorlabs/tc200.py +++ b/instruments/thorlabs/tc200.py @@ -292,8 +292,8 @@ def degrees(self): return pq.degC elif (response >> 5) % 2: return pq.degK - else: - return pq.degF + + return pq.degF @degrees.setter def degrees(self, newval): diff --git a/instruments/thorlabs/thorlabs_utils.py b/instruments/thorlabs/thorlabs_utils.py index d5514d0a6..5969afa1d 100644 --- a/instruments/thorlabs/thorlabs_utils.py +++ b/instruments/thorlabs/thorlabs_utils.py @@ -1,26 +1,5 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -# -# thorlabs_utils.py: Utility functions for Thorlabs-brand instruments. -# -# © 2016 Steven Casagrande (scasagrande@galvant.ca). -# -# This file is a part of the InstrumentKit project. -# Licensed under the AGPL version 3. -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# """ Contains common utility functions for Thorlabs-brand instruments """ @@ -35,7 +14,8 @@ def check_cmd(response): :return: 1 if not found, 0 otherwise :rtype: int """ - if response != "CMD_NOT_DEFINED" and response != "CMD_ARG_INVALID": - return 1 - else: - return 0 + return ( + 1 + if response != "CMD_NOT_DEFINED" and response != "CMD_ARG_INVALID" + else 0 + ) diff --git a/instruments/toptica/topmode.py b/instruments/toptica/topmode.py index e50607b84..b12978a40 100644 --- a/instruments/toptica/topmode.py +++ b/instruments/toptica/topmode.py @@ -48,8 +48,8 @@ def _ack_expected(self, msg=""): return [msg, "reboot process started."] elif "start-correction" in msg: return [msg, "()"] - else: - return msg + + return msg # ENUMS # @@ -326,7 +326,7 @@ def set(self, param, value): if isinstance(value, str): self.query("(param-set! '{} \"{}\")".format(param, value)) - elif isinstance(value, tuple) or isinstance(value, list): + elif isinstance(value, (tuple, list)): self.query("(param-set! '{} '({}))".format(param, " ".join(value))) elif isinstance(value, bool): value = "t" if value else "f" diff --git a/instruments/toptica/toptica_utils.py b/instruments/toptica/toptica_utils.py index ead664049..0ffb424e5 100644 --- a/instruments/toptica/toptica_utils.py +++ b/instruments/toptica/toptica_utils.py @@ -37,5 +37,5 @@ def convert_toptica_datetime(response): """ if response.find('""') >= 0: return None - else: - return datetime.strptime(response, "%Y-%m-%d %H:%M:%S") + + return datetime.strptime(response, "%Y-%m-%d %H:%M:%S") diff --git a/instruments/util_fns.py b/instruments/util_fns.py index 977bfdcf3..fad59455e 100644 --- a/instruments/util_fns.py +++ b/instruments/util_fns.py @@ -151,8 +151,9 @@ def split_unit_str(s, default_units=pq.dimensionless, lookup=None): if units is None: return float(val), default_units - else: - return float(val), lookup(units) + + return float(val), lookup(units) + else: try: return float(s), default_units @@ -179,8 +180,8 @@ def rproperty(fget=None, fset=None, doc=None, readonly=False, writeonly=False): return property(fget=fget, fset=None, doc=doc) elif writeonly: return property(fget=None, fset=fset, doc=doc) - else: - return property(fget=fget, fset=fset, doc=doc) + + return property(fget=fget, fset=fset, doc=doc) def bool_property(name, inst_true, inst_false, doc=None, readonly=False, @@ -480,14 +481,14 @@ def bounded_unitful_property(name, units, min_fmt_str="{}:MIN?", def _min_getter(self): if valid_range[0] == "query": return pq.Quantity(*split_unit_str(self.query(min_fmt_str.format(name)), units)) - else: - return assume_units(valid_range[0], units).rescale(units) + + return assume_units(valid_range[0], units).rescale(units) def _max_getter(self): if valid_range[1] == "query": return pq.Quantity(*split_unit_str(self.query(max_fmt_str.format(name)), units)) - else: - return assume_units(valid_range[1], units).rescale(units) + + return assume_units(valid_range[1], units).rescale(units) new_range = ( None if valid_range[0] is None else _min_getter, diff --git a/instruments/yokogawa/yokogawa7651.py b/instruments/yokogawa/yokogawa7651.py index c5779ab06..3d7d03e08 100644 --- a/instruments/yokogawa/yokogawa7651.py +++ b/instruments/yokogawa/yokogawa7651.py @@ -36,9 +36,6 @@ class Yokogawa7651(PowerSupply, Instrument): >>> inst.voltage = 10 * pq.V """ - def __init__(self, filelike): - super(Yokogawa7651, self).__init__(filelike) - # INNER CLASSES # class Channel(PowerSupplyChannel):