This code appears to be unused and in any case is unnecessary since
is_finalizing has been in the standard library since 3.5.
timedelta_to_seconds,
import_object,
re_unescape,
- is_finalizing,
)
import typing
re_unescape("\\b")
with self.assertRaises(ValueError):
re_unescape("\\Z")
-
-
-class IsFinalizingTest(unittest.TestCase):
- def test_basic(self):
- self.assertFalse(is_finalizing())
import array
import asyncio
-import atexit
from inspect import getfullargspec
import os
import re
unicode_type = str
basestring_type = str
-try:
- from sys import is_finalizing
-except ImportError:
- # Emulate it
- def _get_emulated_is_finalizing() -> Callable[[], bool]:
- L = [] # type: List[None]
- atexit.register(lambda: L.append(None))
-
- def is_finalizing() -> bool:
- # Not referencing any globals here
- return L != []
-
- return is_finalizing
-
- is_finalizing = _get_emulated_is_finalizing()
-
# versionchanged:: 6.2
# no longer our own TimeoutError, use standard asyncio class