Skip to content

Commit

Permalink
chore: Drop Python 2 support
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Drop support for legacy (2.x) Python versions.
  • Loading branch information
honzajavorek committed Mar 18, 2018
1 parent 20c3f73 commit 19acf0c
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 51 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
language: "python"
cache: "pip"
python:
- "2.7"
- "3.5"
- "3.6"
- "3.7"
env:
global: # 'travis encrypt PYPI_PASSWORD=... GH_TOKEN=...'
- PYPI_USERNAME=honzajavorek
Expand Down
13 changes: 13 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,19 @@ Conflict Error
30s. Otherwise a HTTP 409 Conflict will be returned and
``fiobank.ThrottlingError`` will be raised.

Contributing
------------

.. code:: shell
$ pip install -e .[tests]
$ pytest
Changelog
---------

See `GitHub Releases <https://github.com/honzajavorek/fiobank/releases>`_.

License: ISC
------------

Expand Down
11 changes: 1 addition & 10 deletions fiobank.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
# -*- coding: utf-8 -*-


from __future__ import unicode_literals

import re
from datetime import datetime, date

import six
import requests


__all__ = ('FioBank', 'ThrottlingError')


str = six.text_type


def coerce_date(value):
if isinstance(value, datetime):
return value.date()
Expand All @@ -26,7 +17,7 @@ def coerce_date(value):


def sanitize_value(value, convert=None):
if isinstance(value, six.string_types):
if isinstance(value, str):
value = value.strip() or None
if convert and value is not None:
return convert(value)
Expand Down
6 changes: 3 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[wheel]
universal = 1

[flake8]
exclude = env
[pylama]
skip = env/*,venv/*

[pytest]
[tool:pytest]
testpaths = tests
norecursedirs = env venv .git
addopts = --cov=fiobank
Expand Down
9 changes: 1 addition & 8 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# -*- coding: utf-8 -*-


from __future__ import print_function

import sys
from setuptools import setup

Expand All @@ -19,7 +14,6 @@

install_requires = [
'requests',
'six',
]
tests_require = [
'pytest-runner',
Expand Down Expand Up @@ -56,8 +50,7 @@
'Intended Audience :: Developers',
'License :: OSI Approved :: ISC License (ISCL)',
'Programming Language :: Python',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Internet',
),
Expand Down
5 changes: 0 additions & 5 deletions tests/test_coerce_date.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# -*- coding: utf-8 -*-


from __future__ import unicode_literals

from datetime import date, datetime

import pytest
Expand Down
14 changes: 1 addition & 13 deletions tests/test_fiobank.py
Original file line number Diff line number Diff line change
@@ -1,29 +1,17 @@
# -*- coding: utf-8 -*-


from __future__ import unicode_literals

try:
from unittest import mock # PY>=3.3
except ImportError:
import mock
from unittest import mock

import re
import os
import uuid
import json
from datetime import date

import six
import pytest
import requests
import responses
from fiobank import FioBank


str = six.text_type


@pytest.fixture(scope='function')
def token():
return uuid.uuid4()
Expand Down
16 changes: 5 additions & 11 deletions tests/test_sanitize_value.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
# -*- coding: utf-8 -*-


from __future__ import unicode_literals

import six
import pytest
from fiobank import sanitize_value

Expand All @@ -30,12 +24,12 @@ def test_sanitize_value_strip(test_input, expected):


@pytest.mark.parametrize('test_input,convert,expected', [
('abc', six.text_type, 'abc'),
('žluťoučký kůň', six.text_type, 'žluťoučký kůň'),
(None, six.text_type, None),
('abc', str, 'abc'),
('žluťoučký kůň', str, 'žluťoučký kůň'),
(None, str, None),
(None, bool, None),
(123, six.text_type, '123'),
(30.8, six.text_type, '30.8'),
(123, str, '123'),
(30.8, str, '30.8'),
(0, int, 0),
(30.8, int, 30),
(False, bool, False),
Expand Down

0 comments on commit 19acf0c

Please sign in to comment.