From 95917d6fea6fcb38593528c1691684409ae9bdd9 Mon Sep 17 00:00:00 2001 From: Dan Yeaw Date: Sat, 28 Dec 2019 17:35:15 -0500 Subject: [PATCH] Remove Python version workarounds --- gaphas/aspect.py | 6 +----- gaphas/state.py | 19 ++----------------- 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/gaphas/aspect.py b/gaphas/aspect.py index 5a3ec56..d876e65 100644 --- a/gaphas/aspect.py +++ b/gaphas/aspect.py @@ -2,14 +2,10 @@ Aspects form intermediate items between tools and items. """ -import sys import warnings from builtins import object -if sys.version_info.major >= 3: # Modern Python - from functools import singledispatch as real_singledispatch -else: - from singledispatch import singledispatch as real_singledispatch +from functools import singledispatch as real_singledispatch from gi.repository import Gdk diff --git a/gaphas/state.py b/gaphas/state.py index 59be217..3ce3469 100644 --- a/gaphas/state.py +++ b/gaphas/state.py @@ -17,23 +17,13 @@ set:: gaphas.state.observers.add(gaphas.state.revert_handler) """ - import sys from builtins import zip from threading import Lock from types import MethodType -if sys.version_info.major >= 3: # Modern Python - from functools import update_wrapper - from inspect import getfullargspec as _getargspec -else: # Legacy Python - from inspect import getargspec as _getargspec - import functools - - def update_wrapper(wrapper, wrapped): - w = functools.update_wrapper(wrapper, wrapped) - w.__wrapped__ = wrapped - return w +from functools import update_wrapper +from inspect import getfullargspec as _getargspec # This string is added to each docstring in order to denote is's observed @@ -289,9 +279,4 @@ def getfunction(func): """ Return the function associated with a class method. """ - if isinstance(func, MethodType): - if sys.version_info.major >= 3: # Modern Python - return func - else: # Legacy Python - return func.__func__ return func