diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2023-02-12 09:27:25 -0500 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2023-02-12 11:52:05 -0500 |
commit | f77be1770a9d93ed69d6b5a26dcbe5dbfe14e380 (patch) | |
tree | 57ee04342aef1966e9a73563306f5dceb415b6a5 /coverage/types.py | |
parent | 6bc043981f6548852844ea6b16d5ef7d37c0417d (diff) | |
download | python-coveragepy-git-f77be1770a9d93ed69d6b5a26dcbe5dbfe14e380.tar.gz |
fix: Path objects are ok for data_file and config_file. #1552
Diffstat (limited to 'coverage/types.py')
-rw-r--r-- | coverage/types.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/coverage/types.py b/coverage/types.py index b8135d05..e01f451e 100644 --- a/coverage/types.py +++ b/coverage/types.py @@ -7,9 +7,12 @@ Types for use throughout coverage.py. from __future__ import annotations +import os +import pathlib + from types import FrameType, ModuleType from typing import ( - Any, Callable, Dict, Iterable, List, Mapping, Optional, Set, Tuple, Union, + Any, Callable, Dict, Iterable, List, Mapping, Optional, Set, Tuple, Type, Union, TYPE_CHECKING, ) @@ -23,6 +26,14 @@ else: class Protocol: # pylint: disable=missing-class-docstring pass +## File paths + +# For arguments that are file paths: +FilePath = Union[str, os.PathLike] +# For testing FilePath arguments +FilePathClasses = [str, pathlib.Path] +FilePathType = Union[Type[str], Type[pathlib.Path]] + ## Python tracing class TTraceFn(Protocol): |