From 2fd83ac90d90a097c89b83fd6589fad2d5aa4ee4 Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Fri, 24 Jul 2020 19:15:58 +0200 Subject: [PATCH] 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`. --- osbuild/util/types.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 osbuild/util/types.py diff --git a/osbuild/util/types.py b/osbuild/util/types.py new file mode 100644 index 00000000..74629012 --- /dev/null +++ b/osbuild/util/types.py @@ -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]