standalone_helpers

Module containing helpers for the tm_devices package that only use standard library imports.

PACKAGE_NAME module-attribute

PACKAGE_NAME: Final[str] = 'tm_devices'

Constant string with the name of this package.

PYVISA_PY_BACKEND module-attribute

PYVISA_PY_BACKEND: Final[str] = '@py'

Constant string which indicates to use the pure Python PyVISA-py backend when creating VISA connections.

SYSTEM_DEFAULT_VISA_BACKEND module-attribute

SYSTEM_DEFAULT_VISA_BACKEND: Final[str] = ''

Constant string which indicates to use the current system’s default VISA backend when creating VISA connections.

VISA_RESOURCE_EXPRESSION_REGEX module-attribute

VISA_RESOURCE_EXPRESSION_REGEX: Final[Pattern[str]] = compile(
    "^(\\w+)(?:::0X\\w+)?::([-.\\w]+)(?:::(\\w+))?(?:::)?(.*)?::(INSTR?|SOCKET)$", IGNORECASE
)

A regex pattern used to capture pieces of VISA resource expressions.

validate_address

validate_address(address: str) -> bool

Validate an IP address or hostname.

Parameters:
  • address (str) –

    The address to validate.

Returns:
  • bool

    A boolean, if False, the address was an IP address. If True, the address was a hostname.

Raises:
  • ValueError

    Indicating the address was not a valid IP address or hostname.