Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toml #2133

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open

Toml #2133

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions pint/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,20 @@ class BehaviorChangeWarning(UserWarning):
except ImportError:
HAS_DASK = False

try:
import tomli_w # noqa: F401

HAS_TOMLI_W = True
except ImportError:
HAS_TOMLI_W = False

if sys.version_info >= (3, 11):
import tomllib # noqa

HAS_TOMLLIB = True
else:
HAS_TOMLLIB = False


##############################
# Imports are handled here
Expand All @@ -248,6 +262,17 @@ class BehaviorChangeWarning(UserWarning):
# in mypy configuration.
##############################

if HAS_TOMLLIB:
import tomllib # noqa: F401
else:
tomllib = None

if HAS_TOMLI_W:
import tomli_w # noqa: F401
else:
tomli_w = None


if HAS_BABEL:
from babel import Locale
from babel import units as babel_units
Expand Down
Loading
Loading