Skip to content

Commit

Permalink
Updated to pass latests linters (#3)
Browse files Browse the repository at this point in the history
* Updated examples to appease pylint
  • Loading branch information
PatrickBaus authored Jun 22, 2024
1 parent e31e3a0 commit 80b41b0
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 8 deletions.
5 changes: 3 additions & 2 deletions examples/read_calram.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,12 @@
IP_ADDRESS = "127.0.0.1"
# pylint: disable=used-before-assignment # false positive
gpib_device = AsyncPrologixGpibEthernetController(IP_ADDRESS, pad=27, timeout=1, eos_mode=EosMode.APPEND_NONE)

if "async_gpib" in sys.modules:
elif "async_gpib" in sys.modules:
# Set the timeout to 1 second (T1s=11)
# NI GPIB adapter
gpib_device = AsyncGpib(name=0, pad=27, timeout=11) # pylint: disable=used-before-assignment # false positive
else:
raise ImportWarning("No GPIB module loaded. Please check your imports")


# This example will read the calibration memory and write it to a file named 'calram.bin'
Expand Down
5 changes: 3 additions & 2 deletions examples/resistance.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@
IP_ADDRESS = "127.0.0.1"
# pylint: disable=used-before-assignment # false positive
gpib_device = AsyncPrologixGpibEthernetController(IP_ADDRESS, pad=27, timeout=1, eos_mode=EosMode.APPEND_NONE)

if "async_gpib" in sys.modules:
elif "async_gpib" in sys.modules:
# Create the gpib device. We need a timeout of > 10 PLC (20 ms), because the DMM might reply to a conversion request
# and unable to reply to a status request during conversion (maximum time 10 PLC)
# Set the timeout to 1 second (T1s=11)
Expand All @@ -60,6 +59,8 @@
gpib_board = Gpib(name=0)
gpib_board.config(0x7, True) # enable wait for SRQs to speed up waiting for state changes
gpib_board.close()
else:
raise ImportWarning("No GPIB module loaded. Please check your imports")


async def main():
Expand Down
5 changes: 3 additions & 2 deletions examples/thermistor.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@
IP_ADDRESS = "127.0.0.1"
# pylint: disable=used-before-assignment # false positive
gpib_device = AsyncPrologixGpibEthernetController(IP_ADDRESS, pad=27, timeout=1, eos_mode=EosMode.APPEND_NONE)

if "async_gpib" in sys.modules:
elif "async_gpib" in sys.modules:
# Create the gpib device. We need a timeout of > 10 PLC (20 ms), because the DMM might reply to a conversion request
# and unable to reply to a status request during conversion (maximum time 10 PLC)
# Set the timeout to 1 second (T1s=11)
Expand All @@ -58,6 +57,8 @@
gpib_board = Gpib(name=0)
gpib_board.config(0x7, True) # enable wait for SRQs to speed up waiting for state changes
gpib_board.close()
else:
raise ImportWarning("No GPIB module loaded. Please check your imports")


# This example will log resistance data to the console
Expand Down
5 changes: 3 additions & 2 deletions examples/write_calram.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,12 @@
IP_ADDRESS = "127.0.0.1"
# pylint: disable=used-before-assignment # false positive
gpib_device = AsyncPrologixGpibEthernetController(IP_ADDRESS, pad=27, timeout=1, eos_mode=EosMode.APPEND_NONE)

if "async_gpib" in sys.modules:
elif "async_gpib" in sys.modules:
# Set the timeout to 1 second (T1s=11)
# NI GPIB adapter
gpib_device = AsyncGpib(name=0, pad=27, timeout=11) # pylint: disable=used-before-assignment # false positive
else:
raise ImportWarning("No GPIB module loaded. Please check your imports")


async def main():
Expand Down
1 change: 1 addition & 0 deletions hp3478a_async/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
This is an asyncIO library for the Hewlett Packard 3478A DMM. It includes all functions of DMM including some hidden
function to read the non-volatile RAM and calibration constants of the device.
"""

from ._version import __version__
from .enums import FrontRearSwitchPosition, FunctionType, Range, TriggerType
from .hp_3478a import HP_3478A, DmmStatus, NtcParameters
Expand Down
1 change: 1 addition & 0 deletions hp3478a_async/enums.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Enums are used to represent the device functions and settings."""

from __future__ import annotations

from enum import Enum
Expand Down
1 change: 1 addition & 0 deletions hp3478a_async/flags.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Flags are used for the status registers returned by the device."""

from __future__ import annotations

from enum import Flag
Expand Down
1 change: 1 addition & 0 deletions test_encoder_decoder.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit test for the binary-coded decimal encoder/decoder used to encode/decode the calibration memory dumps."""

# ##### BEGIN GPL LICENSE BLOCK #####
#
# Copyright (C) 2020 Patrick Baus
Expand Down

0 comments on commit 80b41b0

Please sign in to comment.