Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
488 changes: 284 additions & 204 deletions poetry.lock

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ build-backend = "poetry.core.masonry.api"
files = "examples/,scripts/,src/,tests/"
namespace_packages = true
strict = true
# Work around https://github.com/ni/nitypes-python/issues/298
show_traceback = true
native_parser = false
Comment thread
bkeryan marked this conversation as resolved.
Resolved

[[tool.mypy.overrides]]
module = [
Expand Down
6 changes: 3 additions & 3 deletions src/nitypes/bintime/_datetime_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@

from collections.abc import Iterable, MutableSequence
from typing import (
TYPE_CHECKING,
Any,
final,
overload,
TYPE_CHECKING,
)

import numpy as np
import numpy.typing as npt

from nitypes._exceptions import invalid_arg_value, invalid_arg_type
from nitypes._exceptions import invalid_arg_type, invalid_arg_value

if TYPE_CHECKING:
# Import from the public package so the docs don't reference private submodules.
from nitypes.bintime import CVIAbsoluteTimeDType, DateTime, TimeValueTuple
else:
from nitypes.bintime._dtypes import CVIAbsoluteTimeDType
from nitypes.bintime._datetime import DateTime
from nitypes.bintime._dtypes import CVIAbsoluteTimeDType
from nitypes.bintime._time_value_tuple import TimeValueTuple


Expand Down
6 changes: 3 additions & 3 deletions src/nitypes/bintime/_timedelta_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@

from collections.abc import Iterable, MutableSequence
from typing import (
TYPE_CHECKING,
Any,
final,
overload,
TYPE_CHECKING,
)

import numpy as np
import numpy.typing as npt

from nitypes._exceptions import invalid_arg_value, invalid_arg_type
from nitypes._exceptions import invalid_arg_type, invalid_arg_value

if TYPE_CHECKING:
# Import from the public package so the docs don't reference private submodules.
from nitypes.bintime import CVITimeIntervalDType, TimeDelta, TimeValueTuple
else:
from nitypes.bintime._dtypes import CVITimeIntervalDType
from nitypes.bintime._timedelta import TimeDelta
from nitypes.bintime._time_value_tuple import TimeValueTuple
from nitypes.bintime._timedelta import TimeDelta


@final
Expand Down
5 changes: 2 additions & 3 deletions src/nitypes/waveform/_timing/_timing.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import datetime as dt
import operator
from collections.abc import Iterable, Sequence
from typing import TYPE_CHECKING, Any, ClassVar, Generic, SupportsIndex, cast, final
from typing import Any, cast, ClassVar, final, Generic, SupportsIndex, TYPE_CHECKING

import hightime as ht
from typing_extensions import Self
Expand All @@ -12,8 +12,8 @@
from nitypes._exceptions import add_note
from nitypes.time import convert_datetime, convert_timedelta
from nitypes.waveform._timing._sample_interval import (
SampleIntervalStrategy,
create_sample_interval_strategy,
SampleIntervalStrategy,
)
from nitypes.waveform.typing import (
TOtherSampleInterval,
Expand All @@ -30,7 +30,6 @@
if TYPE_CHECKING:
# Import from the public package so the docs don't reference private submodules.
from nitypes.waveform import SampleIntervalMode

else:
from nitypes.waveform._timing._sample_interval import SampleIntervalMode

Expand Down
8 changes: 6 additions & 2 deletions tests/unit/waveform/test_digital_waveform.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ def test___sample_count_signal_count_and_dtype___create___creates_waveform_with_
assert waveform.dtype == _np_bool
# https://github.com/microsoft/pyright/issues/10631 - Passing a generic type via a parameter of
# type type[T] can leak an unsolved type variable
assert_type(waveform, DigitalWaveform[_np_bool]) # pyright: ignore[reportAssertTypeFailure]
# https://github.com/ni/nitypes-python/issues/296 - Mypy 2.4 infers
# DigitalWaveform[np.bool[Any]] instead of DigitalWaveform[np.bool[builtins.bool]]
assert_type(waveform, DigitalWaveform[_np_bool]) # type: ignore


def test___sample_count_and_dtype_str___create___creates_waveform_with_sample_count_and_dtype() -> (
Expand Down Expand Up @@ -170,7 +172,9 @@ def test___bool_ndarray___from_lines___creates_waveform_with_bool_dtype() -> Non

waveform = DigitalWaveform.from_lines(array)

assert_type(waveform, DigitalWaveform[_np_bool])
# https://github.com/ni/nitypes-python/issues/296 - Mypy 2.4 infers
# DigitalWaveform[np.bool[Any]] instead of DigitalWaveform[np.bool[builtins.bool]]
assert_type(waveform, DigitalWaveform[_np_bool]) # type: ignore
assert isinstance(waveform, DigitalWaveform) and waveform.dtype == _np_bool
assert waveform.data.tolist() == [[False], [True], [False]]

Expand Down
Loading