diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2021-05-01 14:15:50 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2021-05-01 16:24:37 -0400 |
commit | 7db98362f368ac569edf66228d52cbc64a6d69aa (patch) | |
tree | 491c7c3736ca60ceeda3d29e3f4186954e3e572a /coverage/backward.py | |
parent | 775c14a764ff3fd32bcd25d91f4c0f635722ed50 (diff) | |
download | python-coveragepy-git-7db98362f368ac569edf66228d52cbc64a6d69aa.tar.gz |
refactor: remove yet more unneeded backward.py shims
Gone are:
- PYC_MAGIC_NUMBER
- code_object
- SimpleNamespace
Diffstat (limited to 'coverage/backward.py')
-rw-r--r-- | coverage/backward.py | 29 |
1 files changed, 0 insertions, 29 deletions
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. |