From 7db98362f368ac569edf66228d52cbc64a6d69aa Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sat, 1 May 2021 14:15:50 -0400 Subject: refactor: remove yet more unneeded backward.py shims Gone are: - PYC_MAGIC_NUMBER - code_object - SimpleNamespace --- coverage/backward.py | 29 ----------------------------- 1 file changed, 29 deletions(-) (limited to 'coverage/backward.py') diff --git a/coverage/backward.py b/coverage/backward.py index 26d8d0e5..1169ff46 100644 --- a/coverage/backward.py +++ b/coverage/backward.py @@ -20,35 +20,6 @@ except Exception: import imp importlib_util_find_spec = None -# What is the .pyc magic number for this version of Python? -try: - PYC_MAGIC_NUMBER = importlib.util.MAGIC_NUMBER -except AttributeError: - PYC_MAGIC_NUMBER = imp.get_magic() - - -def code_object(fn): - """Get the code object from a function.""" - try: - return fn.func_code - except AttributeError: - return fn.__code__ - - -try: - from types import SimpleNamespace -except ImportError: - # The code from https://docs.python.org/3/library/types.html#types.SimpleNamespace - class SimpleNamespace: - """Python implementation of SimpleNamespace, for Python 2.""" - def __init__(self, **kwargs): - self.__dict__.update(kwargs) - - def __repr__(self): - keys = sorted(self.__dict__) - items = ("{}={!r}".format(k, self.__dict__[k]) for k in keys) - return "{}({})".format(type(self).__name__, ", ".join(items)) - def format_local_datetime(dt): """Return a string with local timezone representing the date. -- cgit v1.2.1