Skip to content

Commit

Permalink
Run isort on all python files and add isort test.
Browse files Browse the repository at this point in the history
  • Loading branch information
benkonrath committed Apr 17, 2016
1 parent 8ba4501 commit 29160ca
Show file tree
Hide file tree
Showing 116 changed files with 182 additions and 245 deletions.
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ env:
- PIP_FIND_LINKS=file://$PIP_WHEEL_DIR
matrix:
include:
- env: TOXENV=docs
- env: TOXENV=prospector
- python: 2.7
env: TOXENV=docs
- python: 2.7
env: TOXENV=prospector
- python: 3.5
env: TOXENV=isort
- python: 2.7
env: TOXENV=py27-1.7
- python: 2.7
Expand Down
2 changes: 1 addition & 1 deletion localflavor/ar/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import RegexField, CharField, Select
from django.forms.fields import CharField, RegexField, Select
from django.utils.translation import ugettext_lazy as _

from .ar_provinces import PROVINCE_CHOICES
Expand Down
2 changes: 1 addition & 1 deletion localflavor/at/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
AT-specific Form helpers
"""
from __future__ import unicode_literals

import re

from django.core.validators import EMPTY_VALUES
Expand All @@ -11,7 +12,6 @@

from .at_states import STATE_CHOICES


re_ssn = re.compile(r'^\d{4} \d{6}')


Expand Down
2 changes: 1 addition & 1 deletion localflavor/br/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, CharField, Select
from django.forms.fields import CharField, Field, RegexField, Select
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _

Expand Down
2 changes: 1 addition & 1 deletion localflavor/br/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.utils.translation import ugettext_lazy as _
from django.db.models.fields import CharField
from django.utils.translation import ugettext_lazy as _

from .br_states import STATE_CHOICES

Expand Down
4 changes: 2 additions & 2 deletions localflavor/ca/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, CharField, Select
from django.forms.fields import CharField, Field, Select
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _
from localflavor.generic.checksums import luhn

from localflavor.generic.checksums import luhn

phone_digits_re = re.compile(r'^(?:1-?)?(\d{3})[-\.]?(\d{3})[-\.]?(\d{4})$')
sin_re = re.compile(r"^(\d{3})-(\d{3})-(\d{3})$")
Expand Down
2 changes: 1 addition & 1 deletion localflavor/ch/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _

from .ch_states import STATE_CHOICES
from ..generic import validators
from .ch_states import STATE_CHOICES

zip_re = re.compile(r'^[1-9]\d{3}$')
id_re = re.compile(
Expand Down
2 changes: 1 addition & 1 deletion localflavor/cl/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import RegexField, Select
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _

from .cl_regions import REGION_CHOICES

Expand Down
1 change: 0 additions & 1 deletion localflavor/cn/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

from .cn_provinces import CN_PROVINCE_CHOICES


__all__ = (
'CNProvinceSelect',
'CNPostCodeField',
Expand Down
2 changes: 1 addition & 1 deletion localflavor/cz/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Select, RegexField, Field
from django.forms.fields import Field, RegexField, Select
from django.utils.translation import ugettext_lazy as _

from .cz_regions import REGION_CHOICES
Expand Down
1 change: 0 additions & 1 deletion localflavor/de/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

from .de_states import STATE_CHOICES


ID_RE = re.compile(r"^(?P<residence>\d{10})(?P<origin>\w{1,3})"
r"[-\ ]?(?P<birthday>\d{7})[-\ ]?(?P<validity>\d{7})"
r"[-\ ]?(?P<checksum>\d{1})$")
Expand Down
1 change: 1 addition & 0 deletions localflavor/dk/dk_municipalities.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# coding: utf-8
from __future__ import unicode_literals

from django.utils.translation import ugettext_lazy as _

#: A list of municipalities in the Danish region Hovedstaden
Expand Down
2 changes: 1 addition & 1 deletion localflavor/dk/dk_postalcodes.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# coding: utf-8
from __future__ import unicode_literals
from django.utils.translation import ugettext_lazy as _

from django.utils.translation import ugettext_lazy as _

#: A list of Danish postal codes as `choices` in a formfield.
DK_POSTALCODES = (
Expand Down
4 changes: 2 additions & 2 deletions localflavor/dk/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
from __future__ import unicode_literals

from django.core.exceptions import ValidationError
from django.forms import fields, widgets
from django.utils.translation import ugettext_lazy as _
from django.forms import widgets, fields

from .dk_postalcodes import DK_POSTALCODES
from .dk_municipalities import DK_MUNICIPALITIES
from .dk_postalcodes import DK_POSTALCODES


def postal_code_validator(value):
Expand Down
2 changes: 1 addition & 1 deletion localflavor/ec/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.utils.translation import ugettext_lazy as _
from django.db.models import CharField
from django.utils.translation import ugettext_lazy as _

from .ec_provinces import PROVINCE_CHOICES

Expand Down
1 change: 0 additions & 1 deletion localflavor/ee/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

from .ee_counties import COUNTY_CHOICES


idcode = re.compile(r'^([1-6])(\d\d)(\d\d)(\d\d)(?:\d{3})(\d)$')
zipcode = re.compile(r'^[1-9]\d{4}$')
bregcode = re.compile(r'^[1-9]\d{7}$')
Expand Down
2 changes: 1 addition & 1 deletion localflavor/es/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
from __future__ import unicode_literals

import re
import six

from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import RegexField, Select
from django.utils import six
from django.utils.translation import ugettext_lazy as _

from .es_provinces import PROVINCE_CHOICES
Expand Down
2 changes: 1 addition & 1 deletion localflavor/fr/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
from django.forms.fields import CharField, RegexField, Select
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _

from localflavor.generic.checksums import luhn

from .fr_department import DEPARTMENT_CHOICES_PER_REGION
from .fr_region import REGION_CHOICES


nin_re = re.compile(r'^(?P<gender>[1278])(?P<year_of_birth>\d{2})(?P<month_of_birth>0[1-9]|1[0-2]|20)' +
'(?P<department_of_origin>\d{2}|2[AB])(?P<commune_of_origin>\d{3})(?P<person_unique_number>\d{3})' +
'(?P<control_key>\d{2})$')
Expand Down
2 changes: 1 addition & 1 deletion localflavor/fr/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.utils.translation import ugettext_lazy as _
from django.db.models import CharField
from django.utils.translation import ugettext_lazy as _


class FRSIRENField(CharField):
Expand Down
2 changes: 1 addition & 1 deletion localflavor/gb/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

import re

from django.forms.fields import CharField, Select
from django.forms import ValidationError
from django.forms.fields import CharField, Select
from django.utils.translation import ugettext_lazy as _

from .gb_regions import GB_NATIONS_CHOICES, GB_REGION_CHOICES
Expand Down
3 changes: 1 addition & 2 deletions localflavor/generic/forms.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from django import forms

from .validators import IBANValidator, BICValidator, IBAN_COUNTRY_CODE_LENGTH

from .validators import IBAN_COUNTRY_CODE_LENGTH, BICValidator, IBANValidator

DEFAULT_DATE_INPUT_FORMATS = (
'%Y-%m-%d', '%d/%m/%Y', '%d/%m/%y', # '2006-10-25', '25/10/2006', '25/10/06'
Expand Down
4 changes: 2 additions & 2 deletions localflavor/generic/models.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from django.db import models
from django.utils.translation import ugettext_lazy as _

from .forms import IBANFormField, BICFormField
from .validators import IBANValidator, BICValidator
from .forms import BICFormField, IBANFormField
from .validators import BICValidator, IBANValidator


class IBANField(models.CharField):
Expand Down
7 changes: 3 additions & 4 deletions localflavor/generic/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
from __future__ import unicode_literals

import re

import string

from django.core.exceptions import ValidationError, ImproperlyConfigured
from django.utils.translation import ugettext_lazy as _
from django.core.exceptions import ImproperlyConfigured, ValidationError
from django.utils.deconstruct import deconstructible
from django.utils.translation import ugettext_lazy as _

from .countries.iso_3166 import ISO_3166_1_ALPHA2_COUNTRY_CODES
from . import checksums
from .countries.iso_3166 import ISO_3166_1_ALPHA2_COUNTRY_CODES

# Dictionary of ISO country code to IBAN length.
#
Expand Down
3 changes: 1 addition & 2 deletions localflavor/gr/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
import re

from django.core.validators import EMPTY_VALUES
from django.forms import RegexField, Field, ValidationError
from django.forms import Field, RegexField, ValidationError
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _


NUMERIC_RE = re.compile('^\d+$')


Expand Down
4 changes: 1 addition & 3 deletions localflavor/hk/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@
import re

from django.core.validators import EMPTY_VALUES
from django.forms import CharField
from django.forms import ValidationError
from django.forms import CharField, ValidationError
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _


hk_phone_digits_re = re.compile(r'^(?:852-?)?(\d{4})[-\.]?(\d{4})$')
hk_special_numbers = ('999', '992', '112')
hk_phone_prefixes = ('2', '3', '5', '6', '8', '9')
Expand Down
5 changes: 2 additions & 3 deletions localflavor/hr/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@

from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, Select, RegexField
from django.forms.fields import Field, RegexField, Select
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _

from .hr_choices import (HR_LICENSE_PLATE_PREFIX_CHOICES, HR_COUNTY_CHOICES,
HR_PHONE_NUMBER_PREFIX_CHOICES)
from localflavor.generic.checksums import luhn

from .hr_choices import HR_COUNTY_CHOICES, HR_LICENSE_PLATE_PREFIX_CHOICES, HR_PHONE_NUMBER_PREFIX_CHOICES

jmbg_re = re.compile(r'^(?P<dd>\d{2})(?P<mm>\d{2})(?P<yyy>\d{3})' +
r'(?P<rr>\d{2})(?P<bbb>\d{3})(?P<k>\d{1})$')
Expand Down
3 changes: 1 addition & 2 deletions localflavor/id_/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, Select
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import force_text

from django.utils.translation import ugettext_lazy as _

postcode_re = re.compile(r'^[1-9]\d{4}$')
phone_re = re.compile(r'^(\+62|0)[2-9]\d{7,10}$')
Expand Down
4 changes: 3 additions & 1 deletion localflavor/il/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@
Israeli-specific form helpers
"""
from __future__ import unicode_literals

import re

from django.core.exceptions import ValidationError
from django.core.validators import EMPTY_VALUES
from django.forms.fields import RegexField, Field
from django.forms.fields import Field, RegexField
from django.utils.translation import ugettext_lazy as _

from localflavor.generic.checksums import luhn

id_number_re = re.compile(r'^(?P<number>\d{1,8})-?(?P<check>\d)$')
Expand Down
5 changes: 2 additions & 3 deletions localflavor/in_/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@

from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, CharField, Select
from django.forms.fields import CharField, Field, RegexField, Select
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _

from .in_states import STATES_NORMALIZED, STATE_CHOICES

from .in_states import STATE_CHOICES, STATES_NORMALIZED

phone_digits_re = re.compile(r"""
(
Expand Down
2 changes: 1 addition & 1 deletion localflavor/in_/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.utils.translation import ugettext_lazy as _
from django.db.models import CharField
from django.utils.translation import ugettext_lazy as _

from .in_states import STATE_CHOICES

Expand Down
5 changes: 2 additions & 3 deletions localflavor/it/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,13 @@

from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select, CharField
from django.forms.fields import CharField, Field, RegexField, Select
from django.utils.encoding import force_text
from django.utils.translation import ugettext_lazy as _

from .it_province import PROVINCE_CHOICES
from .it_region import REGION_CHOICES, REGION_PROVINCE_CHOICES
from .util import vat_number_validation, ssn_validation

from .util import ssn_validation, vat_number_validation

phone_digits_re = re.compile(r'^(?:\+?39)?((0\d{1,3})(\d{4,8})|(3\d{2})(\d{6,8}))$')

Expand Down
2 changes: 1 addition & 1 deletion localflavor/jp/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from django.forms.fields import RegexField, Select
from django.utils.translation import ugettext_lazy as _

from .jp_prefectures import JP_PREFECTURES, JP_PREFECTURE_CODES
from .jp_prefectures import JP_PREFECTURE_CODES, JP_PREFECTURES


class JPPostalCodeField(RegexField):
Expand Down
8 changes: 4 additions & 4 deletions localflavor/lt/forms.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
from __future__ import unicode_literals
from datetime import date

import re
from datetime import date

from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Select, RegexField, Field
from django.utils.translation import ugettext_lazy as _
from django.forms.fields import Field, RegexField, Select
from django.utils.six import text_type
from django.utils.translation import ugettext_lazy as _

from .lt_choices import COUNTY_CHOICES, MUNICIPALITY_CHOICES


postalcode = re.compile(r'^(LT\s?-\s?)?(?P<code>\d{5})$', re.IGNORECASE)


Expand Down
1 change: 1 addition & 0 deletions localflavor/lt/lt_choices.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.utils.translation import ugettext_lazy as _

#: Alphabetically sorted list of Lithuanian counties.
Expand Down
1 change: 0 additions & 1 deletion localflavor/lv/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

from .lv_choices import MUNICIPALITY_CHOICES


zipcode = re.compile(r'^(LV\s?-\s?)?(?P<code>[1-5]\d{3})$', re.IGNORECASE)
idcode = re.compile(r'^(\d\d)(\d\d)(\d\d)-([0-2])(?:\d{3})(\d)$')

Expand Down
Loading

0 comments on commit 29160ca

Please sign in to comment.