nidaqmx-python icon indicating copy to clipboard operation
nidaqmx-python copied to clipboard

InStream.logging_file_path setter type hint is not effective

Open bkeryan opened this issue 7 months ago • 0 comments

logging_file_path currently has the following type hints, because we wanted to allow setting it using either a pathlib.Path or a str:

    @property
    def logging_file_path(self) -> Optional[pathlib.Path]: ...

    @logging_file_path.setter
    def logging_file_path(self, val: Optional[Union[str, pathlib.PurePath]]): ...

    @logging_file_path.deleter
    def logging_file_path(self): ...

However, we were previously running mypy separately for the nidaqmx package and its tests. Combining these runs revealed that mypy doesn't honor the setter's type hint:

tests\component\task\test_in_stream_read_properties.py:139: error: Incompatible types in assignment (expression has type "str", variable has type "Optional[Path]")  [assignment]
tests\component\task\test_in_stream_read_properties.py:159: error: Incompatible types in assignment (expression has type "str", variable has type "Optional[Path]")  [assignment]

bkeryan avatar Jul 10 '24 16:07 bkeryan