Remove Python version workarounds

This commit is contained in:
Dan Yeaw 2019-12-28 17:35:15 -05:00
parent bc5e0c759a
commit 95917d6fea
No known key found for this signature in database
GPG Key ID: 77A923EF537B61A4
2 changed files with 3 additions and 22 deletions

View File

@ -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

View File

@ -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