util: add types module defining PathLike type

Add a simple new module meant to define types that are commonly
used throughout the code-base. For starters, define `PathLike`
meant to represent file system paths, i.e. strings, bytes, or
anything that provides the `os.PathLike` protocol, i.e. that
can be used with `os.fspath`.
This commit is contained in:
Christian Kellner 2020-07-24 19:15:58 +02:00 committed by Tom Gundersen
parent 21a60324bc
commit 2fd83ac90d

11
osbuild/util/types.py Normal file
View file

@ -0,0 +1,11 @@
#
# Define some useful typing abbreviations
#
import os
from typing import Union
#: Represents a file system path. See also `os.fspath`.
PathLike = Union[str, bytes, os.PathLike]