Skip to content

InStream.logging_file_path setter type hint is not effective #613

@bkeryan

Description

@bkeryan

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]

AB#3148009

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions