Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove six dependency, as python2 is no longer supported #98

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 11 additions & 27 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ steps:
depends_on:
- clone

- name: coverage
image: plugins/codecov
settings:
token:
from_secret: codecov_token
files:
- '*.xml'
required: true
depends_on:
- python3.8

- name: python3.7
image: python:3.7
commands:
Expand All @@ -33,22 +44,6 @@ steps:
depends_on:
- clone

- name: python2.7
image: python:2.7
commands:
- pip install tox
- tox -e $(tox -l | grep py27 | paste -sd ",")
depends_on:
- clone

- name: pypy
image: pypy:2.7
commands:
- pip install tox
- tox -e $(tox -l | grep pypy- | paste -sd ",")
depends_on:
- clone

- name: pypy3
image: pypy:3.6
commands:
Expand All @@ -61,17 +56,6 @@ steps:
depends_on:
- clone

- name: coverage
image: plugins/codecov
settings:
token:
from_secret: codecov_token
files:
- '*.xml'
required: true
depends_on:
- python3.8

trigger:
trigger:
ref:
Expand Down
11 changes: 7 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,25 @@ repos:
args: [--allow-multiple-documents]
- id: debug-statements
- id: end-of-file-fixer
- id: fix-encoding-pragma
- id: flake8
- id: mixed-line-ending
- id: trailing-whitespace

- repo: https://gitlab.com/pycqa/flake8
rev: 'master'
hooks:
- id: flake8

- repo: https://github.com/miki725/importanize
rev: 'master'
hooks:
- id: importanize
language_version: python3

- repo: https://github.com/python/black
rev: 'master'
rev: 'stable'
hooks:
- id: black
args: [--line-length=88, --safe]
args: [--line-length=88, --safe, --check, --diff]
language_version: python3
exclude: test_data/.*$

Expand Down
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ addons:

language: python
python:
- "3.6-dev"
- "3.7-dev"
- "2.7"
- "3.6"
- "3.7"
- "pypy"
- "pypy3.5-7.0"

Expand Down
1 change: 0 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# This file is execfile()d with the current directory set to its
# containing dir.
Expand Down
1 change: 0 additions & 1 deletion manage.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys

Expand Down
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
cached-property
Django>=1.8
Django>=2.2
enum-compat
six
8 changes: 3 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import os

from setuptools import find_packages, setup
Expand Down Expand Up @@ -41,10 +39,10 @@ def read(fname):
"Intended Audience :: Developers",
"Natural Language :: English",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Development Status :: 2 - Pre-Alpha",
],
)
2 changes: 0 additions & 2 deletions test_project/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
3 changes: 0 additions & 3 deletions test_project/alchemy.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals

from sqlalchemy.ext.declarative import declarative_base


Expand Down
2 changes: 0 additions & 2 deletions test_project/generic/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
3 changes: 0 additions & 3 deletions test_project/generic/api.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals

from rest_framework import serializers
from rest_framework.viewsets import ModelViewSet

Expand Down
6 changes: 0 additions & 6 deletions test_project/generic/models.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals

import six
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models


@six.python_2_unicode_compatible
class ModelA(models.Model):
name = models.CharField(max_length=64)

def __str__(self):
return self.name


@six.python_2_unicode_compatible
class ModelB(models.Model):
name = models.CharField(max_length=64)
a = models.ForeignKey(
Expand Down
3 changes: 0 additions & 3 deletions test_project/many_to_many/alchemy.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals

from sqlalchemy import Column, Integer, String
from sqlalchemy.orm import backref, relationship
from sqlalchemy.schema import ForeignKey, Table
Expand Down
3 changes: 0 additions & 3 deletions test_project/many_to_many/api.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals

from rest_framework.serializers import ModelSerializer
from rest_framework.viewsets import ReadOnlyModelViewSet

Expand Down
6 changes: 0 additions & 6 deletions test_project/many_to_many/models.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals

import six
from django.db import models


@six.python_2_unicode_compatible
class Publication(models.Model):
title = models.CharField(max_length=30)

Expand All @@ -16,7 +11,6 @@ class Meta:
ordering = ("title",)


@six.python_2_unicode_compatible
class Article(models.Model):
headline = models.CharField(max_length=100)
publications = models.ManyToManyField(Publication, related_name="articles")
Expand Down
3 changes: 0 additions & 3 deletions test_project/many_to_one/alchemy.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals

from sqlalchemy import Column, Date, Integer, String
from sqlalchemy.orm import backref, relationship

Expand Down
3 changes: 0 additions & 3 deletions test_project/many_to_one/api.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals

from rest_framework.serializers import ModelSerializer
from rest_framework.viewsets import ReadOnlyModelViewSet

Expand Down
6 changes: 0 additions & 6 deletions test_project/many_to_one/models.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals

import six
from django.db import models


@six.python_2_unicode_compatible
class Reporter(models.Model):
first_name = models.CharField(max_length=30)
last_name = models.CharField(max_length=30)
Expand All @@ -15,7 +10,6 @@ def __str__(self):
return "%s %s" % (self.first_name, self.last_name)


@six.python_2_unicode_compatible
class Article(models.Model):
headline = models.CharField(max_length=100)
pub_date = models.DateField()
Expand Down
3 changes: 0 additions & 3 deletions test_project/middleware.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals

from django.conf import settings
from sqlalchemy.orm import sessionmaker

Expand Down
3 changes: 0 additions & 3 deletions test_project/one_to_one/alchemy.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals

from sqlalchemy import Boolean, Column, Integer, String
from sqlalchemy.orm import backref, relationship

Expand Down
2 changes: 0 additions & 2 deletions test_project/one_to_one/api.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
import operator

from django import forms
Expand Down
7 changes: 0 additions & 7 deletions test_project/one_to_one/models.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals

import six
from django.db import models


@six.python_2_unicode_compatible
class Place(models.Model):
name = models.CharField(max_length=50)
address = models.CharField(max_length=80)
Expand All @@ -14,7 +9,6 @@ def __str__(self):
return "%s the place" % self.name


@six.python_2_unicode_compatible
class Restaurant(models.Model):
place = models.OneToOneField(Place, primary_key=True, on_delete=models.CASCADE)
serves_hot_dogs = models.BooleanField(default=False)
Expand All @@ -24,7 +18,6 @@ def __str__(self):
return "%s the restaurant" % self.place.name


@six.python_2_unicode_compatible
class Waiter(models.Model):
restaurant = models.ForeignKey(Restaurant, on_delete=models.CASCADE)
name = models.CharField(max_length=50)
Expand Down
1 change: 0 additions & 1 deletion test_project/settings.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
# Bare ``settings.py`` for running tests for url_filter
import os

Expand Down
3 changes: 0 additions & 3 deletions test_project/urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals

import debug_toolbar
from django.conf import settings
from django.conf.urls import url
Expand Down
2 changes: 0 additions & 2 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
2 changes: 0 additions & 2 deletions tests/backends/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
3 changes: 0 additions & 3 deletions tests/backends/test_django.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals

import mock

from test_project.one_to_one.models import Place
Expand Down
2 changes: 0 additions & 2 deletions tests/backends/test_plain.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
from datetime import datetime

from url_filter.backends.plain import PlainFilterBackend
Expand Down
12 changes: 4 additions & 8 deletions tests/backends/test_sqlalchemy.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals

import pytest
import six
from alchemy_mock.comparison import ExpressionMatcher
from sqlalchemy import func
from sqlalchemy.orm import joinedload
Expand Down Expand Up @@ -34,7 +30,7 @@ def test_empty(self, alchemy_db):
alchemy_db.query(Place), context={"context": "here"}
)

assert "WHERE 0 = 1" in six.text_type(backend.empty())
assert "WHERE 0 = 1" in str(backend.empty())

def test_get_model(self, alchemy_db):
backend = SQLAlchemyFilterBackend(alchemy_db.query(Place))
Expand All @@ -57,7 +53,7 @@ def test_filter(self, alchemy_db):

filtered = backend.filter()

sql = six.text_type(filtered)
sql = str(filtered)
# eagerloads via outerjoin
assert "LEFT OUTER JOIN one_to_one_restaurant" not in sql
assert "LEFT OUTER JOIN one_to_one_waiter" not in sql
Expand All @@ -77,7 +73,7 @@ def test_filter_already_selectinload(self, alchemy_db):

filtered = backend.filter()

sql = six.text_type(filtered)
sql = str(filtered)
# eagerloads via outerjoin
assert "LEFT OUTER JOIN one_to_one_restaurant" in sql
assert "LEFT OUTER JOIN one_to_one_waiter" not in sql
Expand All @@ -97,7 +93,7 @@ def test_filter_already_eagerloaded(self, alchemy_db):

filtered = backend.filter()

sql = six.text_type(filtered)
sql = str(filtered)
# eagerloads via outerjoin
assert "LEFT OUTER JOIN one_to_one_restaurant" in sql
assert "LEFT OUTER JOIN one_to_one_waiter" in sql
Expand Down
3 changes: 0 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals

import pytest
from django.conf import settings
from django.core.management import call_command
Expand Down
2 changes: 0 additions & 2 deletions tests/filtersets/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
3 changes: 0 additions & 3 deletions tests/filtersets/test_base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals

import pytest
from django import forms
from django.http import QueryDict
Expand Down
3 changes: 0 additions & 3 deletions tests/filtersets/test_django.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals

import pytest
from django import forms
from django.db import models
Expand Down
Loading