Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
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
6 changes: 3 additions & 3 deletions generated/nidaqmx/_library_interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -5843,7 +5843,7 @@ def unregister_done_event(self, task):
ctypes.POINTER(ctypes.c_void_p)]

options = 0
callback_method_ptr = DAQmxDoneEventCallbackPtr() # type: ignore # typeshed is missing no-argument constructor overload
callback_method_ptr = DAQmxDoneEventCallbackPtr()
callback_data = None

error_code = cfunc(
Expand All @@ -5867,7 +5867,7 @@ def unregister_every_n_samples_event(

n_samples = 0
options = 0
callback_method_ptr = DAQmxEveryNSamplesEventCallbackPtr() # type: ignore # typeshed is missing no-argument constructor overload
callback_method_ptr = DAQmxEveryNSamplesEventCallbackPtr()
callback_data = None

error_code = cfunc(
Expand All @@ -5890,7 +5890,7 @@ def unregister_signal_event(self, task, signal_id):
ctypes.POINTER(ctypes.c_void_p)]

options = 0
callback_method_ptr = DAQmxSignalEventCallbackPtr() # type: ignore # typeshed is missing no-argument constructor overload
callback_method_ptr = DAQmxSignalEventCallbackPtr()
callback_data = None

error_code = cfunc(
Expand Down
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ plugins = "numpy.typing.mypy_plugin"
warn_redundant_casts = true
warn_unreachable = true
warn_unused_configs = true
warn_unused_ignores = true

[[tool.mypy.overrides]]
module = [
Expand All @@ -157,6 +158,11 @@ module = [
]
ignore_missing_imports = true

[[tool.mypy.overrides]]
# mypy-protobuf codegen has some unused ignores.
module = ["nidaqmx._stubs.*"]
warn_unused_ignores = false

[tool.bandit]
skips = [
"B101", # assert_used
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
n_samples = 0
%endif
options = 0
callback_method_ptr = ${callback_func_param.type}() # type: ignore # typeshed is missing no-argument constructor overload
callback_method_ptr = ${callback_func_param.type}()
callback_data = None
%endif

Expand Down
5 changes: 2 additions & 3 deletions tests/acceptance/test_internationalization.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
from typing import Any

import pytest

from nidaqmx._lib import lib_importer, get_encoding_from_locale
from nidaqmx._lib import get_encoding_from_locale, lib_importer
from nidaqmx.error_codes import DAQmxErrors
from nidaqmx.errors import DaqError
from nidaqmx.system import Device
Expand Down Expand Up @@ -63,7 +62,7 @@ def test___supported_encoding___logging_file_path___returns_assigned_value(
):
if _get_encoding(ai_task) not in supported_encodings:
pytest.skip("requires compatible encoding")
ai_task.in_stream.logging_file_path = file_path # type: ignore[assignment] # https://github.com/ni/nidaqmx-python/issues/613
ai_task.in_stream.logging_file_path = file_path

assert ai_task.in_stream.logging_file_path == pathlib.Path(file_path)

Expand Down
5 changes: 2 additions & 3 deletions tests/component/task/test_in_stream_read_properties.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import pathlib

import pytest

from nidaqmx.constants import OverwriteMode, ReadRelativeTo
from nidaqmx.task import Task

Expand Down Expand Up @@ -127,7 +126,7 @@ def test___ai_task___get_string_property___returns_default_value(ai_task: Task):


def test___ai_task___set_string_property___returns_assigned_value(ai_task: Task):
ai_task.in_stream.logging_file_path = "TestData.tdms" # type: ignore[assignment] # https://github.com/ni/nidaqmx-python/issues/613
ai_task.in_stream.logging_file_path = "TestData.tdms"

assert ai_task.in_stream.logging_file_path == pathlib.Path("TestData.tdms")

Expand All @@ -139,7 +138,7 @@ def test___ai_task___set_string_property_none___returns_default_value(ai_task: T


def test___ai_task___reset_string_property___returns_default_value(ai_task: Task):
ai_task.in_stream.logging_file_path = "TestData.tdms" # type: ignore[assignment] # https://github.com/ni/nidaqmx-python/issues/613
ai_task.in_stream.logging_file_path = "TestData.tdms"

del ai_task.in_stream.logging_file_path

Expand Down
15 changes: 10 additions & 5 deletions tests/component/test_watchdog.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
from typing import Callable

import pytest

from nidaqmx.constants import WatchdogAOExpirState, WatchdogCOExpirState
from nidaqmx.system import Device
from nidaqmx.system.watchdog import AOExpirationState, COExpirationState, WatchdogTask
from nidaqmx.system.watchdog import (
AOExpirationState,
COExpirationState,
ExpirationState,
WatchdogTask,
)


def test___watchdog_task___cfg_watchdog_ao_expir_states___no_error(
Expand Down Expand Up @@ -129,8 +133,9 @@ def test___watchdog_expiration_states___set_nonexistent_property___raises_except
)
]
watchdog_task.cfg_watchdog_ao_expir_states(expir_states)
expir_state: ExpirationState = watchdog_task.expiration_states[
sim_9263_device.ao_physical_chans[0].name
]

with pytest.raises(AttributeError):
watchdog_task.expiration_states[
sim_9263_device.ao_physical_chans[0].name
].nonexistent_property = "foo" # type: ignore[attr-defined]
expir_state.nonexistent_property = "foo" # type: ignore[attr-defined]
2 changes: 1 addition & 1 deletion tests/unit/test_grpc_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def test___grpc_response_before_1970___convert_to_timestamp___succeeds(response_
)
def test___utc_datetime___convert_to_timestamp_with_dst___is_reversible(date):
# we use a location that has daylight savings date change on the dates above
target_timezone: ZoneInfo = ZoneInfo("America/Los_Angeles") # type: ignore # ZoneInfo is a concrete class that takes in abstract tzinfo
target_timezone = ZoneInfo("America/Los_Angeles")
astimezone_date = date.astimezone(target_timezone)

to_ts = grpc_time.convert_time_to_timestamp(date)
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_lib_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

import pytest
from hightime import datetime as ht_datetime

from nidaqmx._lib_time import AbsoluteTime as LibTimestamp

from tests.unit._time_utils import (
JAN_01_1850_DATETIME,
JAN_01_1850_HIGHTIME,
Expand Down Expand Up @@ -97,7 +97,7 @@ def test___utc_datetime_before_1904___convert_to_timestamp___is_reversible(from_
)
def test___utc_datetime___convert_to_timestamp_with_dst___is_reversible(date):
# we use a location that has daylight savings date change on the dates above
target_timezone: ZoneInfo = ZoneInfo("America/Los_Angeles") # type: ignore # ZoneInfo is a concrete class that takes in abstract tzinfo
target_timezone = ZoneInfo("America/Los_Angeles")
astimezone_date = date.astimezone(target_timezone)

to_ts = LibTimestamp.from_datetime(date)
Expand Down
Loading