From 18a3994ec34f8daaa4a80f58236465f849f9316e Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Fri, 12 Aug 2022 12:02:52 -0500 Subject: [PATCH 1/3] refactor: Use string form of type checking * Use the string form of type checking until Python 3.7 is dropped to avoid having to check for `if typing.TYPE_CHECKING`. --- src/pyhf/typing.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/pyhf/typing.py b/src/pyhf/typing.py index bdfa44f85c..10c9dd8562 100644 --- a/src/pyhf/typing.py +++ b/src/pyhf/typing.py @@ -1,6 +1,6 @@ import os import sys -from typing import TYPE_CHECKING, MutableSequence, Sequence, Union +from typing import MutableSequence, Sequence, Union if sys.version_info >= (3, 8): from typing import Literal, TypedDict @@ -27,10 +27,8 @@ "Workspace", ) -if TYPE_CHECKING: - PathOrStr = Union[str, os.PathLike[str]] -else: - PathOrStr = Union[str, "os.PathLike[str]"] +# TODO: Switch to os.PathLike[str] once Python 3.7 dropped +PathOrStr = Union[str, "os.PathLike[str]"] class ParameterBase(TypedDict, total=False): From e24cadd25f084dd0e633e843328052488fd8bc2d Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Fri, 12 Aug 2022 12:04:10 -0500 Subject: [PATCH 2/3] remove .coveragerc * Revert PR 1937 --- .coveragerc | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 .coveragerc diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index 0856c037f2..0000000000 --- a/.coveragerc +++ /dev/null @@ -1,3 +0,0 @@ -[report] -exclude_lines = - if TYPE_CHECKING: From 9b52d3da5dc340c650b283caf2e263560446d83b Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Fri, 12 Aug 2022 16:26:23 -0500 Subject: [PATCH 3/3] Correct comment to reflect Python 3.9+ --- src/pyhf/typing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pyhf/typing.py b/src/pyhf/typing.py index 10c9dd8562..50a6237199 100644 --- a/src/pyhf/typing.py +++ b/src/pyhf/typing.py @@ -27,7 +27,7 @@ "Workspace", ) -# TODO: Switch to os.PathLike[str] once Python 3.7 dropped +# TODO: Switch to os.PathLike[str] once Python 3.8 support dropped PathOrStr = Union[str, "os.PathLike[str]"]