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 leftover Python2 compatibility hybridation #134

Merged
merged 1 commit into from
Oct 23, 2024
Merged
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
3 changes: 1 addition & 2 deletions bitfield/admin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import django
import six

from django.core.exceptions import ValidationError
if django.VERSION < (2, 0):
Expand Down Expand Up @@ -29,7 +28,7 @@ def __init__(self, field, request, params, model, model_admin, field_path):
def queryset(self, request, queryset):
filter_kwargs = dict(
(p, BitHandler(v, ()))
for p, v in six.iteritems(self.used_parameters)
for p, v in self.used_parameters.items()
)
if not filter_kwargs:
return queryset
Expand Down
6 changes: 1 addition & 5 deletions bitfield/models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
from __future__ import absolute_import

import six

from django.db.models import signals
from django.db.models.fields import Field, BigIntegerField

Expand Down Expand Up @@ -154,7 +150,7 @@ def to_python(self, value):
# Regression for #1425: fix bad data that was created resulting
# in negative values for flags. Compute the value that would
# have been visible ot the application to preserve compatibility.
if isinstance(value, six.integer_types) and value < 0:
if isinstance(value, int) and value < 0:
new_value = 0
for bit_number, _ in enumerate(self.flags):
new_value |= (value & (2 ** bit_number))
Expand Down
7 changes: 1 addition & 6 deletions bitfield/types.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
from __future__ import absolute_import

from six import string_types


def cmp(a, b):
return (a > b) - (a < b)

Expand Down Expand Up @@ -238,7 +233,7 @@ def iteritems(self):
yield (k, getattr(self, k).is_set)

def get_label(self, flag):
if isinstance(flag, string_types):
if isinstance(flag, str):
flag = self._keys.index(flag)
if isinstance(flag, Bit):
flag = flag.number
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ def visit_Assign(self, node):
zip_safe=False,
install_requires=[
'Django>=1.11.29',
'six',
],
extras_require={
'tests': [
Expand Down