Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove python<3.8 support #261

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 0 additions & 39 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,11 @@ jobs:
os:
- ubuntu-20.04
python-version:
# - 2.7
# - 3.5
- 3.6
- 3.7
- 3.8
- 3.9
- "3.10"
- 3.11
- 3.12
# - pypy-2.7
- pypy-3.8
- pypy-3.9
- pypy-3.10
Expand Down Expand Up @@ -55,7 +50,6 @@ jobs:
# strategy:
# matrix:
# python:
# #- {os: ubuntu-20.04, python-version: 3.7, pyver: py37}
# #- {os: ubuntu-20.04, python-version: 3.8, pyver: py38}
# #- {os: ubuntu-20.04, python-version: 3.9, pyver: py39}
# - {os: ubuntu-20.04, python-version: "3.10", pyver: py310}
Expand Down Expand Up @@ -91,16 +85,11 @@ jobs:
os:
- macos-latest
python-version:
# - 2.7
# - 3.5
- 3.6
- 3.7
- 3.8
- 3.9
- "3.10"
- 3.11
- 3.12
# - pypy-2.7
- pypy-3.8
- pypy-3.9
- pypy-3.10
Expand All @@ -123,29 +112,6 @@ jobs:
name: coverage
path: .coverage.*

# test_windows_py27:
# name: Test (${{ matrix.os }}, ${{ matrix.python-version }})
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
# os:
# - windows-latest
# python-version:
# - 2.7
# steps:
# - name: Checkout code
# uses: actions/checkout@v3
# - name: Setup Python ${{ matrix.python-version }}
# uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python-version }}
# - name: Update pip
# run: python -m pip install -U pip wheel setuptools
# - name: Install tox
# run: python -m pip install "tox<4.0.0" "tox-gh-actions<3.0.0"
# - name: Test with tox
# run: python -m tox -e py27,py27-without-extensions

test_windows:
name: Test (${{ matrix.os }}, ${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
Expand All @@ -154,15 +120,11 @@ jobs:
os:
- windows-latest
python-version:
# - 3.5
- 3.6
- 3.7
- 3.8
- 3.9
- "3.10"
- 3.11
- 3.12
# - pypy-2.7
- pypy-3.8
- pypy-3.9
- pypy-3.10
Expand Down Expand Up @@ -278,7 +240,6 @@ jobs:
needs:
- test_linux
- test_macos
# - test_windows_py27
- test_windows
runs-on: ubuntu-20.04
steps:
Expand Down
2 changes: 1 addition & 1 deletion docs/benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def wrapper4(wrapped, *args, **kwargs):
def function4():
pass

class Class(object):
class Class:

def function1(self):
pass
Expand Down
17 changes: 8 additions & 9 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
#
# wrapt documentation build configuration file, created by
# sphinx-quickstart on Tue Aug 13 20:38:04 2013.
Expand Down Expand Up @@ -40,8 +39,8 @@
master_doc = 'index'

# General information about the project.
project = u'wrapt'
copyright = u'2013-2023, Graham Dumpleton'
project = 'wrapt'
copyright = '2013-2023, Graham Dumpleton'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
Expand Down Expand Up @@ -189,8 +188,8 @@
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, documentclass [howto/manual]).
latex_documents = [
('index', 'wrapt.tex', u'wrapt Documentation',
u'Graham Dumpleton', 'manual'),
('index', 'wrapt.tex', 'wrapt Documentation',
'Graham Dumpleton', 'manual'),
]

# The name of an image file (relative to this directory) to place at the top of
Expand Down Expand Up @@ -219,8 +218,8 @@
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
('index', 'wrapt', u'wrapt Documentation',
[u'Graham Dumpleton'], 1)
('index', 'wrapt', 'wrapt Documentation',
['Graham Dumpleton'], 1)
]

# If true, show URL addresses after external links.
Expand All @@ -233,8 +232,8 @@
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
('index', 'wrapt', u'wrapt Documentation',
u'Graham Dumpleton', 'wrapt', 'One line description of project.',
('index', 'wrapt', 'wrapt Documentation',
'Graham Dumpleton', 'wrapt', 'One line description of project.',
'Miscellaneous'),
]

Expand Down
12 changes: 6 additions & 6 deletions src/wrapt/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def exec_(_code_, _globs_=None, _locs_=None):
class _AdapterFunctionCode(CallableObjectProxy):

def __init__(self, wrapped_code, adapter_code):
super(_AdapterFunctionCode, self).__init__(wrapped_code)
super().__init__(wrapped_code)
self._self_adapter_code = adapter_code

@property
Expand All @@ -79,7 +79,7 @@ def co_varnames(self):
class _AdapterFunctionSurrogate(CallableObjectProxy):

def __init__(self, wrapped, adapter):
super(_AdapterFunctionSurrogate, self).__init__(wrapped)
super().__init__(wrapped)
self._self_adapter = adapter

@property
Expand Down Expand Up @@ -129,7 +129,7 @@ class AdapterWrapper(FunctionWrapper):

def __init__(self, *args, **kwargs):
adapter = kwargs.pop('adapter')
super(AdapterWrapper, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
self._self_surrogate = _AdapterFunctionSurrogate(
self.__wrapped__, adapter)
self._self_adapter = adapter
Expand All @@ -154,13 +154,13 @@ def __kwdefaults__(self):
def __signature__(self):
return self._self_surrogate.__signature__

class AdapterFactory(object):
class AdapterFactory:
def __call__(self, wrapped):
raise NotImplementedError()

class DelegatedAdapterFactory(AdapterFactory):
def __init__(self, factory):
super(DelegatedAdapterFactory, self).__init__()
super().__init__()
self.factory = factory
def __call__(self, wrapped):
return self.factory(wrapped)
Expand Down Expand Up @@ -226,7 +226,7 @@ def _build(wrapped, wrapper, enabled=None, adapter=None):
adapter = adapter[:-1]
adapter = formatargspec(*adapter)

exec_('def adapter{}: pass'.format(adapter), ns, ns)
exec_(f'def adapter{adapter}: pass', ns, ns)
adapter = ns['adapter']

# Override the annotations for the manufactured
Expand Down
2 changes: 1 addition & 1 deletion src/wrapt/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def load_module(self, fullname):
class _ImportHookChainedLoader(ObjectProxy):

def __init__(self, loader):
super(_ImportHookChainedLoader, self).__init__(loader)
super().__init__(loader)

if hasattr(loader, "load_module"):
self.__self_setattr__('load_module', self._self_load_module)
Expand Down
2 changes: 1 addition & 1 deletion src/wrapt/patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def wrap_object(module, name, factory, args=(), kwargs={}):
# instance attribute. Note that this cannot be used on attributes which
# are themselves defined by a property object.

class AttributeWrapper(object):
class AttributeWrapper:

def __init__(self, attribute, factory, args, kwargs):
self.attribute = attribute
Expand Down
8 changes: 4 additions & 4 deletions src/wrapt/weakrefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,25 +53,25 @@ def __init__(self, wrapped, callback=None):
_callback)

if wrapped._self_parent is not None:
super(WeakFunctionProxy, self).__init__(
super().__init__(
weakref.proxy(wrapped._self_parent, _callback))

else:
super(WeakFunctionProxy, self).__init__(
super().__init__(
weakref.proxy(wrapped, _callback))

return

try:
self._self_instance = weakref.ref(wrapped.__self__, _callback)

super(WeakFunctionProxy, self).__init__(
super().__init__(
weakref.proxy(wrapped.__func__, _callback))

except AttributeError:
self._self_instance = None

super(WeakFunctionProxy, self).__init__(
super().__init__(
weakref.proxy(wrapped, _callback))

def __call__(*args, **kwargs):
Expand Down
6 changes: 3 additions & 3 deletions src/wrapt/wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def with_metaclass(meta, *bases):
"""Create a base class with a metaclass."""
return meta("NewBase", bases, {})

class _ObjectProxyMethods(object):
class _ObjectProxyMethods:

# We use properties to override the values of __module__ and
# __doc__. If we add these in ObjectProxy, the derived class
Expand Down Expand Up @@ -495,7 +495,7 @@ class _FunctionWrapperBase(ObjectProxy):
def __init__(self, wrapped, instance, wrapper, enabled=None,
binding='function', parent=None):

super(_FunctionWrapperBase, self).__init__(wrapped)
super().__init__(wrapped)

object.__setattr__(self, '_self_instance', instance)
object.__setattr__(self, '_self_wrapper', wrapper)
Expand Down Expand Up @@ -780,5 +780,5 @@ def __init__(self, wrapped, wrapper, enabled=None):
else:
binding = 'function'

super(FunctionWrapper, self).__init__(wrapped, None, wrapper,
super().__init__(wrapped, None, wrapper,
enabled, binding)
10 changes: 4 additions & 6 deletions tests/test_adapter.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import print_function

import unittest
import inspect
import types
Expand Down Expand Up @@ -140,7 +138,7 @@ def _adapter(self, arg1, arg2, arg3=None, *args, **kwargs): pass
def _wrapper_1(wrapped, instance, args, kwargs):
return wrapped(*args, **kwargs)

class Class1(object):
class Class1:
@_wrapper_1
def function(self):
pass
Expand All @@ -156,7 +154,7 @@ def function(self):
def _wrapper_2(wrapped, instance, args, kwargs):
return wrapped(*args, **kwargs)

class Class2(object):
class Class2:
@_wrapper_2
def function(self):
pass
Expand All @@ -175,7 +173,7 @@ def _adapter(cls, arg1, arg2, arg3=None, *args, **kwargs): pass
def _wrapper_1(wrapped, instance, args, kwargs):
return wrapped(*args, **kwargs)

class Class1(object):
class Class1:
@_wrapper_1
@classmethod
def function(cls):
Expand All @@ -192,7 +190,7 @@ def function(cls):
def _wrapper_2(wrapped, instance, args, kwargs):
return wrapped(*args, **kwargs)

class Class2(object):
class Class2:
@_wrapper_2
@classmethod
def function(self):
Expand Down
10 changes: 4 additions & 6 deletions tests/test_adapter_py3.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import print_function

import inspect
import unittest
import types
Expand Down Expand Up @@ -148,7 +146,7 @@ def _adapter1(self, arg1, arg2, arg3=None, *args, **kwargs) -> Iterable: pass
def _wrapper_1(wrapped, instance, args, kwargs):
return wrapped(*args, **kwargs)

class Class1(object):
class Class1:
@_wrapper_1
def function(self):
pass
Expand All @@ -171,7 +169,7 @@ def _adapter2(self, arg1, arg2, arg3=None, *args, **kwargs) -> int: pass
def _wrapper_2(wrapped, instance, args, kwargs):
return wrapped(*args, **kwargs)

class Class2(object):
class Class2:
@_wrapper_2
def function(self):
pass
Expand All @@ -190,7 +188,7 @@ def _adapter1(cls, arg1, arg2, arg3=None, *args, **kwargs) -> Iterable: pass
def _wrapper_1(wrapped, instance, args, kwargs):
return wrapped(*args, **kwargs)

class Class1(object):
class Class1:
@_wrapper_1
@classmethod
def function(cls):
Expand All @@ -214,7 +212,7 @@ def _adapter2(cls, arg1, arg2, arg3=None, *args, **kwargs) -> int: pass
def _wrapper_2(wrapped, instance, args, kwargs):
return wrapped(*args, **kwargs)

class Class2(object):
class Class2:
@_wrapper_2
@classmethod
def function(self):
Expand Down
2 changes: 0 additions & 2 deletions tests/test_adapter_py33.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import print_function

import unittest
import inspect
import types
Expand Down
4 changes: 1 addition & 3 deletions tests/test_arguments.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import print_function

import unittest

import wrapt
Expand All @@ -26,5 +24,5 @@ def test_unexpected_unicode_keyword(self):
def function(a=2):
pass

kwargs = { u'b': 40 }
kwargs = { 'b': 40 }
self.assertRaises(TypeError, wrapt.getcallargs, function, **kwargs)
4 changes: 1 addition & 3 deletions tests/test_attribute_wrapper.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
from __future__ import print_function

import unittest

import wrapt

class Class(object):
class Class:
def __init__(self, value):
self.value = value

Expand Down
2 changes: 0 additions & 2 deletions tests/test_callable_object_proxy.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import print_function

import unittest

import wrapt
Expand Down
Loading