Skip to content

Commit 5e0d881

Browse files
committed
remove all occurences of six
1 parent a3953bc commit 5e0d881

File tree

5 files changed

+8
-18
lines changed

5 files changed

+8
-18
lines changed

djng/core/urlresolvers.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from inspect import isclass
22

3-
import six
43
from django.urls import (get_resolver, get_urlconf, resolve, reverse, NoReverseMatch)
54
from django.core.exceptions import ImproperlyConfigured
65

@@ -36,7 +35,7 @@ def get_all_remote_methods(resolver=None, ns_prefix=''):
3635
resolver = get_resolver(get_urlconf())
3736
result = {}
3837
for name in resolver.reverse_dict.keys():
39-
if not isinstance(name, six.string_types):
38+
if not isinstance(name, str):
4039
continue
4140
try:
4241
url = reverse(ns_prefix + name)

djng/forms/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# -*- coding: utf-8 -*-
22
from django.forms.forms import DeclarativeFieldsMetaclass, BaseForm
33
from django.forms.models import BaseModelForm, ModelFormMetaclass
4-
import six
54
from .angular_base import BaseFieldsModifierMetaclass, NgFormBaseMixin
65
from .angular_model import NgModelFormMixin
76
from .angular_validation import NgFormValidationMixin
@@ -11,7 +10,7 @@ class NgDeclarativeFieldsMetaclass(BaseFieldsModifierMetaclass, DeclarativeField
1110
pass
1211

1312

14-
class NgForm(six.with_metaclass(NgDeclarativeFieldsMetaclass, NgFormBaseMixin, BaseForm)):
13+
class NgForm(NgFormBaseMixin, BaseForm, metaclass=NgDeclarativeFieldsMetaclass):
1514
"""
1615
Convenience class to be used instead of Django's internal ``forms.Form`` when declaring
1716
a form to be used with AngularJS.
@@ -22,7 +21,7 @@ class NgModelFormMetaclass(BaseFieldsModifierMetaclass, ModelFormMetaclass):
2221
pass
2322

2423

25-
class NgModelForm(six.with_metaclass(NgModelFormMetaclass, NgFormBaseMixin, BaseModelForm)):
24+
class NgModelForm(NgFormBaseMixin, BaseModelForm, metaclass=NgModelFormMetaclass):
2625
"""
2726
Convenience class to be used instead of Django's internal ``forms.ModelForm`` when declaring
2827
a model form to be used with AngularJS.

djng/forms/angular_base.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from django import VERSION as DJANGO_VERSION
1212
from django.forms import forms
1313
from django.http import QueryDict
14-
import six
1514
try:
1615
from importlib import import_module
1716
except ImportError:
@@ -294,10 +293,8 @@ def __init__(self, *args, **kwargs):
294293
try:
295294
form_name = self.form_name
296295
except AttributeError:
297-
# if form_name is unset, then generate a pseudo unique name, based upon the class name
298-
form_name = b64encode(six.b(self.__class__.__name__)).rstrip(six.b('='))
299-
if six.PY3:
300-
form_name = form_name.decode('utf-8')
296+
# if form_name is unset, generate a pseudo unique name, based upon the class name
297+
form_name = b64encode(self.__class__.__name__.encode()).rstrip(b'=').decode('utf-8')
301298
self.form_name = kwargs.pop('form_name', form_name)
302299
error_class = kwargs.pop('error_class', TupleErrorList)
303300
kwargs.setdefault('error_class', error_class)

djng/middleware.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import six
21
from django import http
32
from django.urls import reverse
43
from django.utils.http import unquote
@@ -62,10 +61,7 @@ def process_request(self, request):
6261
for key in request.GET:
6362
if key.startswith('djng_url'):
6463
query.pop(key, None)
65-
if six.PY3:
66-
request.environ['QUERY_STRING'] = query.urlencode()
67-
else:
68-
request.environ['QUERY_STRING'] = query.urlencode().encode('utf-8')
64+
request.environ['QUERY_STRING'] = query.urlencode()
6965

7066
# Reconstruct GET QueryList in the same way WSGIRequest.GET function works
7167
request.GET = http.QueryDict(request.environ['QUERY_STRING'])

djng/styling/bootstrap3/forms.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from six import with_metaclass
21
import warnings
32

43
from django import VERSION as DJANGO_VERSION
@@ -34,14 +33,14 @@ def as_div(self):
3433
return div_element
3534

3635

37-
class Bootstrap3Form(with_metaclass(NgDeclarativeFieldsMetaclass, Bootstrap3FormMixin, NgFormBaseMixin, BaseForm)):
36+
class Bootstrap3Form(Bootstrap3FormMixin, NgFormBaseMixin, BaseForm, metaclass=NgDeclarativeFieldsMetaclass):
3837
"""
3938
Convenience class to be used instead of Django's internal ``forms.Form`` when declaring
4039
a form to be used with AngularJS and Bootstrap3 styling.
4140
"""
4241

4342

44-
class Bootstrap3ModelForm(with_metaclass(NgModelFormMetaclass, Bootstrap3FormMixin, NgFormBaseMixin, BaseModelForm)):
43+
class Bootstrap3ModelForm(Bootstrap3FormMixin, NgFormBaseMixin, BaseModelForm, metaclass=NgModelFormMetaclass):
4544
"""
4645
Convenience class to be used instead of Django's internal ``forms.ModelForm`` when declaring
4746
a model form to be used with AngularJS and Bootstrap3 styling.

0 commit comments

Comments
 (0)