| 1 |
From 3ef27ef7ba7026d7634e08603967a2dd2ab29a41 Mon Sep 17 00:00:00 2001 |
| 2 |
From: Alexandre Detiste <[email protected]> |
| 3 |
Date: Sat, 20 Jan 2024 11:59:54 +0100 |
| 4 |
Subject: [PATCH] remove leftover Python2 compatibility hybridation |
| 5 |
|
| 6 |
--- a/bitfield/admin.py |
| 7 |
+++ b/bitfield/admin.py |
| 8 |
@@ -1,5 +1,4 @@ |
| 9 |
import django |
| 10 |
-import six |
| 11 |
|
| 12 |
from django.core.exceptions import ValidationError |
| 13 |
if django.VERSION < (2, 0): |
| 14 |
@@ -29,7 +28,7 @@ def __init__(self, field, request, params, model, model_admin, field_path): |
| 15 |
def queryset(self, request, queryset): |
| 16 |
filter_kwargs = dict( |
| 17 |
(p, BitHandler(v, ())) |
| 18 |
- for p, v in six.iteritems(self.used_parameters) |
| 19 |
+ for p, v in self.used_parameters.items() |
| 20 |
) |
| 21 |
if not filter_kwargs: |
| 22 |
return queryset |
| 23 |
--- a/bitfield/models.py |
| 24 |
+++ b/bitfield/models.py |
| 25 |
@@ -1,7 +1,3 @@ |
| 26 |
-from __future__ import absolute_import |
| 27 |
- |
| 28 |
-import six |
| 29 |
- |
| 30 |
from django.db.models import signals |
| 31 |
from django.db.models.fields import Field, BigIntegerField |
| 32 |
|
| 33 |
@@ -154,7 +150,7 @@ def to_python(self, value): |
| 34 |
# Regression for #1425: fix bad data that was created resulting |
| 35 |
# in negative values for flags. Compute the value that would |
| 36 |
# have been visible ot the application to preserve compatibility. |
| 37 |
- if isinstance(value, six.integer_types) and value < 0: |
| 38 |
+ if isinstance(value, int) and value < 0: |
| 39 |
new_value = 0 |
| 40 |
for bit_number, _ in enumerate(self.flags): |
| 41 |
new_value |= (value & (2 ** bit_number)) |
| 42 |
--- a/bitfield/types.py |
| 43 |
+++ b/bitfield/types.py |
| 44 |
@@ -1,8 +1,3 @@ |
| 45 |
-from __future__ import absolute_import |
| 46 |
- |
| 47 |
-from six import string_types |
| 48 |
- |
| 49 |
- |
| 50 |
def cmp(a, b): |
| 51 |
return (a > b) - (a < b) |
| 52 |
|
| 53 |
@@ -238,7 +233,7 @@ def iteritems(self): |
| 54 |
yield (k, getattr(self, k).is_set) |
| 55 |
|
| 56 |
def get_label(self, flag): |
| 57 |
- if isinstance(flag, string_types): |
| 58 |
+ if isinstance(flag, str): |
| 59 |
flag = self._keys.index(flag) |
| 60 |
if isinstance(flag, Bit): |
| 61 |
flag = flag.number |
| 62 |
--- a/setup.py |
| 63 |
+++ b/setup.py |
| 64 |
@@ -31,7 +31,6 @@ def visit_Assign(self, node): |
| 65 |
zip_safe=False, |
| 66 |
install_requires=[ |
| 67 |
'Django>=1.11.29', |
| 68 |
- 'six', |
| 69 |
], |
| 70 |
extras_require={ |
| 71 |
'tests': [ |