Skip to content

Commit

Permalink
Merge pull request dj-stripe#555 from cloudsmith-io/feature-future-im…
Browse files Browse the repository at this point in the history
…ports

Add consistent future import statements
  • Loading branch information
kavdev authored Aug 6, 2017
2 parents 3ee32f0 + 6118fbe commit cf33137
Show file tree
Hide file tree
Showing 107 changed files with 148 additions and 75 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@ addons:
env:
- TOXENV=py27-django110
- TOXENV=py27-django111
- TOXENV=py27-checkmigrations
- TOXENV=py34-django110
- TOXENV=py34-django111
- TOXENV=py35-django110
- TOXENV=py35-django111
- TOXENV=py35-djangomaster
- TOXENV=py36-django111
- TOXENV=py36-djangomaster
- TOXENV=checkmigrations
- TOXENV=py36-checkmigrations
- TOXENV=flake8

matrix:
Expand Down
10 changes: 10 additions & 0 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ If you are proposing a feature:
* Keep the scope as narrow as possible, to make it easier to implement.
* Remember that this is a volunteer-driven project, and that contributions are welcome :)

New Modules
-----------

As with Django we're aiming for future compatibility with Python 3.x. Please ensure that any
new modules use the following future import statement:

```
from __future__ import absolute_import, division, print_function, unicode_literals
```

Get Started!
------------

Expand Down
1 change: 1 addition & 0 deletions djstripe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
:synopsis: dj-stripe - Django + Stripe Made Easy
"""
from __future__ import absolute_import, division, print_function, unicode_literals
import pkg_resources
from . import checks # noqa: Register the checks

Expand Down
1 change: 1 addition & 0 deletions djstripe/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
.. moduleauthor:: Lee Skillen (@lskillen)
"""
from __future__ import absolute_import, division, print_function, unicode_literals

from django.contrib import admin

Expand Down
2 changes: 1 addition & 1 deletion djstripe/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
.. moduleauthor:: Lee Skillen (@lskillen)
"""
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function, unicode_literals

from django.conf import settings
from django.core import checks
Expand Down
1 change: 1 addition & 0 deletions djstripe/context_managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
.. moduleauthor:: Lee Skillen (@lskillen)
"""
from __future__ import absolute_import, division, print_function, unicode_literals

from contextlib import contextmanager

Expand Down
1 change: 1 addition & 0 deletions djstripe/contrib/rest_framework/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
.. moduleauthor:: @kavdev, @pydanny
"""
from __future__ import absolute_import, division, print_function, unicode_literals
from rest_framework.permissions import BasePermission

from ...utils import subscriber_has_active_subscription
Expand Down
2 changes: 1 addition & 1 deletion djstripe/contrib/rest_framework/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"""

from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function, unicode_literals

from rest_framework import serializers
from rest_framework.serializers import ModelSerializer
Expand Down
2 changes: 1 addition & 1 deletion djstripe/contrib/rest_framework/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"""

from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function, unicode_literals
from django.conf.urls import url

from . import views
Expand Down
2 changes: 1 addition & 1 deletion djstripe/contrib/rest_framework/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"""

from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function, unicode_literals

from rest_framework import status
from rest_framework.permissions import IsAuthenticated
Expand Down
2 changes: 1 addition & 1 deletion djstripe/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
.. moduleauthor:: @pydanny, and @audreyr
"""
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function, unicode_literals

from functools import wraps

Expand Down
16 changes: 14 additions & 2 deletions djstripe/enums.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from __future__ import absolute_import, division, print_function, unicode_literals
from collections import OrderedDict
import operator

from django.utils.translation import ugettext as _
from django.utils.six import add_metaclass
from django.utils.six import add_metaclass, text_type


class EnumMetaClass(type):
Expand All @@ -27,9 +29,19 @@ def __new__(self, name, bases, classdict):

for k, v in keys.items():
classdict[v] = k

classdict["__choices__"] = choices
classdict["__members__"] = members
classdict["choices"] = tuple(choices.items())

# Note: Differences between Python 2.x and Python 3.x force us to
# explicitly use unicode here, and to explicitly sort the list. In
# Python 2.x, class members are unordered and so the ordering will
# vary on different systems based on internal hashing. Without this
# Django will continually require new no-op migrations.
classdict["choices"] = tuple(
(text_type(k), text_type(v))
for k, v in sorted(choices.items(), key=operator.itemgetter(0))
)

return type.__new__(self, name, bases, classdict)

Expand Down
1 change: 1 addition & 0 deletions djstripe/event_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
process.
"""
from __future__ import absolute_import, division, print_function, unicode_literals

from . import webhooks
from .enums import SourceType
Expand Down
2 changes: 1 addition & 1 deletion djstripe/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
.. moduleauthor:: @kavdev
"""
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function, unicode_literals


class MultipleSubscriptionException(Exception):
Expand Down
1 change: 1 addition & 0 deletions djstripe/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
.. moduleauthor:: Bill Huneke (@wahuneke)
"""
from __future__ import absolute_import, division, print_function, unicode_literals

import decimal

Expand Down
1 change: 1 addition & 0 deletions djstripe/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
.. moduleauthor:: Daniel Greenfeld (@pydanny)
"""
from __future__ import absolute_import, division, print_function, unicode_literals

from django import forms

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from __future__ import absolute_import, division, print_function, unicode_literals
from django.core.management.base import BaseCommand

from ...utils import clear_expired_idempotency_keys
Expand Down
2 changes: 1 addition & 1 deletion djstripe/management/commands/djstripe_init_customers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
.. moduleauthor:: @kavdev, @pydanny
"""
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function, unicode_literals

from django.core.management.base import BaseCommand

Expand Down
2 changes: 1 addition & 1 deletion djstripe/management/commands/djstripe_sync_customers.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
.. moduleauthor:: @kavdev, @pydanny, @shvechikov
"""
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function, unicode_literals

from django.core.management.base import BaseCommand

Expand Down
2 changes: 1 addition & 1 deletion djstripe/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
.. moduleauthor:: @kavdev, @pydanny, @wahuneke
"""
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function, unicode_literals

import decimal

Expand Down
2 changes: 2 additions & 0 deletions djstripe/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
.. moduleauthor:: @kavdev, @pydanny, @wahuneke
"""
from __future__ import absolute_import, division, print_function, unicode_literals

from django.conf import settings
from django.shortcuts import redirect
from django.urls import resolve
Expand Down
2 changes: 1 addition & 1 deletion djstripe/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function, unicode_literals

from django.conf import settings
from django.db import models, migrations
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function, unicode_literals

from django.conf import settings
from django.db import models, migrations
Expand Down
2 changes: 1 addition & 1 deletion djstripe/migrations/0002_auto_20150122_2000.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function, unicode_literals

from django.db import migrations

Expand Down
2 changes: 1 addition & 1 deletion djstripe/migrations/0003_auto_20150128_0800.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function, unicode_literals

from django.conf import settings
from django.db import models, migrations
Expand Down
2 changes: 1 addition & 1 deletion djstripe/migrations/0004_auto_20150427_1609.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function, unicode_literals

from django.db import models, migrations
import jsonfield.fields
Expand Down
2 changes: 1 addition & 1 deletion djstripe/migrations/0005_charge_captured.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function, unicode_literals

from django.db import models, migrations

Expand Down
2 changes: 1 addition & 1 deletion djstripe/migrations/0006_auto_20150602_1934.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function, unicode_literals

from django.db import models, migrations

Expand Down
2 changes: 1 addition & 1 deletion djstripe/migrations/0007_auto_20150625_1243.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function, unicode_literals

from django.db import models, migrations

Expand Down
2 changes: 1 addition & 1 deletion djstripe/migrations/0008_auto_20150806_1641.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function, unicode_literals

from django.db import migrations

Expand Down
Loading

0 comments on commit cf33137

Please sign in to comment.