Skip to content

Commit b2e9f6f

Browse files
committed
Move PYPY into compat.
1 parent b718517 commit b2e9f6f

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

domdf_python_tools/compat.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,14 @@
4040
#
4141

4242
# stdlib
43+
import platform
4344
import sys
4445
from typing import TYPE_CHECKING, ContextManager, Optional, TypeVar
4546

4647
# this package
4748
import domdf_python_tools
4849

49-
__all__ = ["importlib_resources", "importlib_metadata", "nullcontext"]
50+
__all__ = ["importlib_resources", "importlib_metadata", "nullcontext", "PYPY"]
5051

5152
if sys.version_info < (3, 7): # pragma: no cover (>=py37)
5253
# 3rd party
@@ -103,3 +104,10 @@ def __exit__(self, *excinfo):
103104
else: # pragma: no cover (<py37)
104105
# stdlib
105106
from contextlib import nullcontext
107+
108+
PYPY = platform.python_implementation() == "PyPy"
109+
"""
110+
:py:obj:`True` if running on PyPy rather than CPython.
111+
112+
.. versionadded:: 2.3.0
113+
"""

domdf_python_tools/doctools.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@
2828

2929
# stdlib
3030
import builtins
31-
import platform
3231
from inspect import cleandoc
3332
from types import MethodType
3433
from typing import Any, Callable, Dict, Optional, Sequence, Type, TypeVar, Union
3534

3635
# this package
36+
from domdf_python_tools.compat import PYPY
3737
from domdf_python_tools.typing import MethodDescriptorType, MethodWrapperType, WrapperDescriptorType
3838

3939
__all__ = [
@@ -49,7 +49,6 @@
4949
]
5050

5151
F = TypeVar('F', bound=Callable[..., Any])
52-
PYPY = platform.python_implementation() == "PyPy"
5352

5453

5554
def deindent_string(string: Optional[str]) -> str:

domdf_python_tools/testing/selectors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
from _pytest.mark import MarkDecorator # nodep
3939

4040
# this package
41-
from domdf_python_tools.doctools import PYPY
41+
from domdf_python_tools.compat import PYPY
4242
from domdf_python_tools.testing.utils import is_docker
4343
from domdf_python_tools.versions import Version
4444

0 commit comments

Comments
 (0)