Skip to content

Commit

Permalink
Updates to support isort 5.0 (#152)
Browse files Browse the repository at this point in the history
* Removed `not_skip` and `recursive` from `tox.ini` to fix
TypeError: __init__() got an unexpected keyword argument 'not_skip'

* recursive
Prior to version 5.0.0, isort wouldn't automatically traverse directories. The --recursive option was necessary to tell it to do so. In 5.0.0 directories are automatically traversed for all Python files, and as such this option is no longer necessary and should simply be removed.

* not_skip
In an earlier version isort had a default skip of __init__.py. To get around that many projects wanted a way to not skip __init__.py or any other files that were automatically skipped in the future by isort. isort no longer has any default skips, so if the value here is __init__.py you can simply remove the setting.

https://timothycrosley.github.io/isort/docs/upgrade_guides/5.0.0/

* Add python_requires to setup.py
  • Loading branch information
cwdavies committed Jul 13, 2020
1 parent f504e37 commit bde3730
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion ratechecker/dataset.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import io
import xml.etree.cElementTree as ET
from collections import OrderedDict
from datetime import datetime, time
from xml.etree import cElementTree as ET
from zipfile import ZipFile

from django.utils import timezone
Expand Down
3 changes: 2 additions & 1 deletion ratechecker/ratechecker_parameters.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from decimal import Decimal

from localflavor.us.us_states import STATE_CHOICES
from ratechecker.models import Product
from rest_framework import serializers

from ratechecker.models import Product


def scrub_error(error):
for char in ["<", ">", r"%3C", r"%3E"]:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from django.test import TestCase

from mock import patch

from ratechecker.tests.helpers import write_sample_dataset


Expand Down
1 change: 1 addition & 0 deletions ratechecker/tests/test_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from django.utils import timezone

from mock import Mock

from ratechecker.dataset import CoverSheet
from ratechecker.tests.helpers import get_sample_dataset

Expand Down
1 change: 1 addition & 0 deletions ratechecker/tests/test_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from django.utils import timezone

from model_mommy import mommy

from ratechecker.loader import (
AdjustmentLoader,
Loader,
Expand Down
1 change: 1 addition & 0 deletions ratechecker/tests/test_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from django.core.files.base import ContentFile

from mock import patch

from ratechecker.tests.helpers import get_sample_dataset
from ratechecker.validation import (
ScenarioLoader,
Expand Down
5 changes: 3 additions & 2 deletions ratechecker/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
from django.utils import timezone

from model_mommy import mommy
from ratechecker.models import Adjustment, Product, Rate, Region
from ratechecker.views import set_lock_max_min
from rest_framework import status
from rest_framework.test import APITestCase

from ratechecker.models import Adjustment, Product, Rate, Region
from ratechecker.views import set_lock_max_min


try:
from django.urls import reverse
Expand Down
5 changes: 3 additions & 2 deletions ratechecker/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

from django.db.models import Q, Sum

from ratechecker.models import Adjustment, Rate, Region
from ratechecker.ratechecker_parameters import ParamsSerializer
from rest_framework import status
from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework.views import APIView

from ratechecker.models import Adjustment, Rate, Region
from ratechecker.ratechecker_parameters import ParamsSerializer


def get_rates(params_data, data_load_testing=False, return_fees=False):
""" params_data is a method parameter of type RateCheckerParameters."""
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def read_file(filename):
],
long_description=read_file("README.md"),
zip_safe=False,
python_requires=">=3.6",
install_requires=install_requires,
setup_requires=setup_requires,
extras_require={"docs": docs_extras, "testing": testing_extras},
Expand Down
3 changes: 1 addition & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ deps=
commands=
black --check countylimits oahapi ratechecker setup.py
flake8 .
isort --check-only --diff --recursive ratechecker
isort --check-only --diff ratechecker

[flake8]
ignore=E731,W503,W504,
Expand All @@ -43,7 +43,6 @@ lines_after_imports=2
include_trailing_comma=1
multi_line_output=3
skip=.tox,migrations
not_skip=__init__.py
use_parentheses=1
known_django=django
known_future_library=future
Expand Down

0 comments on commit bde3730

Please sign in to comment.