Skip to content

outPath in ONC class constructor should accept both str and Path #12

Closed
@kan-fu

Description

@kan-fu

The idea occurred to me when I want to use a tmp_file fixture from pytest for outPath, but it only accepts str because it calls len to sanitize outPath. I have to convert it to str.

As illustrated in PEP519, the type of outPath should be typing.Union[str, bytes, os.PathLike]. For our use case, I think str | os.PathLike should be fine (with from __future__ import annotations of course).

Converting str to Path will eliminate the need for sanitizing. Both onc.py and _util.py need to be changed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions