_quoting.py 519 B

123456789101112131415161718
  1. import os
  2. import sys
  3. __all__ = ("_Quoter", "_Unquoter")
  4. NO_EXTENSIONS = bool(os.environ.get("YARL_NO_EXTENSIONS")) # type: bool
  5. if sys.implementation.name != "cpython":
  6. NO_EXTENSIONS = True
  7. if not NO_EXTENSIONS: # pragma: no branch
  8. try:
  9. from ._quoting_c import _Quoter, _Unquoter # type: ignore[misc]
  10. except ImportError: # pragma: no cover
  11. from ._quoting_py import _Quoter, _Unquoter # type: ignore[misc]
  12. else:
  13. from ._quoting_py import _Quoter, _Unquoter # type: ignore[misc]