diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 74955b8..4ab905d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,14 +1,14 @@ repos: - repo: https://github.com/ambv/black - rev: 18.6b4 + rev: 21.12b0 hooks: - id: black - python-version: python3.6 + python-version: python3.8 files: ^((uplink|examples|tests)\/.+|setup|docs\/conf)\.py$ -- repo: https://github.com/pre-commit/pre-commit-hooks - rev: v1.3.0 +- repo: https://github.com/pycqa/flake8 + rev: '4.0.1' hooks: - id: flake8 name: flake8 - python-version: python3.6 + python-version: python3.8 files: ^((uplink|examples|tests)\/.+|setup|docs\/conf)\.py$ diff --git a/.travis.yml b/.travis.yml index b01be3c..1a6d1f6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ language: python dist: bionic # Ubuntu 18.04 python: + - '2.7' - '3.5' - '3.6' - '3.7' diff --git a/AUTHORS.rst b/AUTHORS.rst index de74a9f..2a403eb 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -16,3 +16,4 @@ Contributors - Sakorn Waungwiwatsin (`@SakornW `_) - Jacob Floyd (`@cognifloyd `_) - Guilherme Crocetti (`@gmcrocetti `_) +- Alexander Shadchin (`@shadchin `_) diff --git a/tests/integration/test_form_url_encoded.py b/tests/integration/test_form_url_encoded.py index ad70bef..073ef41 100644 --- a/tests/integration/test_form_url_encoded.py +++ b/tests/integration/test_form_url_encoded.py @@ -8,8 +8,8 @@ def test_without_converter(mock_response, mock_client): class Calendar(Consumer): @form_url_encoded - @put("/user/repos") - def add_event(self, **event_data: FieldMap): + @put("/user/repos", args={"event_data": FieldMap}) + def add_event(self, **event_data): pass mock_client.with_response(mock_response) diff --git a/tests/integration/test_multipart.py b/tests/integration/test_multipart.py index 7ab7e1f..3c208c7 100644 --- a/tests/integration/test_multipart.py +++ b/tests/integration/test_multipart.py @@ -8,8 +8,8 @@ def test_without_converter(mock_response, mock_client): class Calendar(Consumer): @multipart - @post("/attachments") - def upload_attachments(self, **files: PartMap): + @post("/attachments", args={"files": PartMap}) + def upload_attachments(self, **files): pass mock_client.with_response(mock_response) diff --git a/tox.ini b/tox.ini index 19b1c35..d19f6cb 100644 --- a/tox.ini +++ b/tox.ini @@ -2,7 +2,9 @@ # Website (June 2016): http://tox.readthedocs.io/en/latest/ [testenv] -deps = pipenv +deps = + pipenv == 2018.11.26 ; python_version == '2.7' + pipenv ; python_version > '2.7' commands = pipenv install --skip-lock pipenv run py.test tests \ --cov-config .coveragerc \ diff --git a/uplink/arguments.py b/uplink/arguments.py index 9503c1c..8237565 100644 --- a/uplink/arguments.py +++ b/uplink/arguments.py @@ -4,12 +4,12 @@ """ # Standard library imports import collections -from collections import abc import functools import inspect # Local imports from uplink import exceptions, hooks, interfaces, utils +from uplink.compat import abc from uplink.converters import keys __all__ = [ diff --git a/uplink/auth.py b/uplink/auth.py index 3334b72..9ba53f2 100644 --- a/uplink/auth.py +++ b/uplink/auth.py @@ -1,13 +1,11 @@ """This module implements the auth layer.""" -# Standard library imports -from collections import abc - # Third-party imports from requests import auth # Local imports from uplink import utils +from uplink.compat import abc __all__ = [ "ApiTokenParam", diff --git a/uplink/clients/io/interfaces.py b/uplink/clients/io/interfaces.py index ff81082..d0e4d31 100644 --- a/uplink/clients/io/interfaces.py +++ b/uplink/clients/io/interfaces.py @@ -1,6 +1,3 @@ -# Standard library imports -from collections import abc - # Local imports from uplink import compat @@ -69,7 +66,7 @@ def on_failure(self, exc_type, exc_val, exc_tb): raise NotImplementedError -class Executable(abc.Iterator): +class Executable(compat.abc.Iterator): """An abstraction for iterating over the execution of a request.""" def __next__(self): diff --git a/uplink/commands.py b/uplink/commands.py index 6805412..4020039 100644 --- a/uplink/commands.py +++ b/uplink/commands.py @@ -1,5 +1,4 @@ # Standard library imports -from collections import abc import functools # Local imports @@ -12,6 +11,7 @@ returns, utils, ) +from uplink.compat import abc __all__ = ["get", "head", "put", "post", "patch", "delete"] diff --git a/uplink/compat.py b/uplink/compat.py index d0ac368..6b6ac98 100644 --- a/uplink/compat.py +++ b/uplink/compat.py @@ -1,6 +1,7 @@ # Third-party imports import six -__all__ = ["reraise"] +__all__ = ["abc", "reraise"] +abc = six.moves.collections_abc reraise = six.reraise diff --git a/uplink/converters/__init__.py b/uplink/converters/__init__.py index fdc2fcf..ebc73b1 100644 --- a/uplink/converters/__init__.py +++ b/uplink/converters/__init__.py @@ -1,8 +1,6 @@ -# Standard library imports -from collections import abc - # Local imports from uplink._extras import installer, plugin +from uplink.compat import abc from uplink.converters import keys from uplink.converters.interfaces import Factory, ConverterFactory, Converter from uplink.converters.register import ( diff --git a/uplink/converters/typing_.py b/uplink/converters/typing_.py index 1c42ffd..9f5f8f9 100644 --- a/uplink/converters/typing_.py +++ b/uplink/converters/typing_.py @@ -1,9 +1,9 @@ # Standard library imports import collections -from collections import abc import functools # Local imports +from uplink.compat import abc from uplink.converters import interfaces, register_default_converter_factory __all__ = ["TypingConverter", "ListConverter", "DictConverter"] diff --git a/uplink/decorators.py b/uplink/decorators.py index d0bfe6c..bd32cf0 100644 --- a/uplink/decorators.py +++ b/uplink/decorators.py @@ -3,12 +3,12 @@ handling classes. """ # Standard library imports -from collections import abc import functools import inspect # Local imports from uplink import arguments, helpers, hooks, interfaces, utils +from uplink.compat import abc __all__ = [ "headers",