Skip to content
This repository was archived by the owner on Jun 27, 2020. It is now read-only.

Commit b006137

Browse files
committed
[requirements] Dropped python 2 support
Upgraded necessary dependencies, deleted compatibility code, removed python 2 from travis config and documentation.
1 parent e1a4acd commit b006137

18 files changed

Lines changed: 26 additions & 59 deletions

.travis.yml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,15 @@ language: python
33
cache: pip
44

55
python:
6-
- "3.5"
7-
- "2.7"
6+
- "3.6"
7+
- "3.7"
88

99
branches:
1010
only:
1111
- master
1212

1313
env:
14-
- DJANGO="django>=2.1,<2.3"
15-
- DJANGO="django>=1.11,<1.12"
16-
17-
matrix:
18-
exclude:
19-
- python: "2.7"
20-
env: DJANGO="django>=2.1,<2.3"
21-
14+
- DJANGO="django>=2.2,<3.3"
2215
before_install:
2316
- pip install -U pip wheel setuptools
2417
- pip install --no-cache-dir -U -r requirements-test.txt
@@ -27,12 +20,11 @@ before_install:
2720

2821
install:
2922
- pip install $DJANGO
30-
- if [[ $TRAVIS_PYTHON_VERSION == 2.7 ]]; then pip install -U "djangorestframework<3.10"; fi
3123
- python setup.py -q develop
3224

3325
script:
3426
- coverage run --source=django_netjsongraph runtests.py
35-
- if [[ $TRAVIS_PYTHON_VERSION == 3.5 ]]; then ./tests/manage.py makemigrations django_netjsongraph --dry-run | grep "No changes detected"; fi
27+
- ./tests/manage.py makemigrations django_netjsongraph --dry-run | grep "No changes detected";
3628
- openwisp-utils-qa-checks --migration-path "./django_netjsongraph/migrations"
3729

3830
after_success:

django_netjsongraph/api/serializers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def data(self):
1414
def to_representation(self, data):
1515
return OrderedDict((
1616
('type', 'NetworkCollection'),
17-
('collection', super(NetworkCollectionSerializer, self).to_representation(data))
17+
('collection', super().to_representation(data))
1818
))
1919

2020

django_netjsongraph/base/admin.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from django.conf.urls import url
22
from django.contrib import messages
33
from django.contrib.admin import ModelAdmin
4-
from django.contrib.admin.templatetags.admin_static import static
4+
from django.templatetags.static import static
55
from django.db.models import Q
66
from django.template.response import TemplateResponse
77
from django.urls import reverse
@@ -16,7 +16,7 @@ class TimeStampedEditableAdmin(ModelAdmin):
1616
"""
1717
def __init__(self, *args, **kwargs):
1818
self.readonly_fields += ('created', 'modified',)
19-
super(TimeStampedEditableAdmin, self).__init__(*args, **kwargs)
19+
super().__init__(*args, **kwargs)
2020

2121

2222
class BaseAdmin(TimeStampedEditableAdmin):
@@ -56,7 +56,7 @@ def get_actions(self, request):
5656
"""
5757
move delete action to last position
5858
"""
59-
actions = super(AbstractTopologyAdmin, self).get_actions(request)
59+
actions = super().get_actions(request)
6060
delete = actions['delete_selected']
6161
del actions['delete_selected']
6262
actions['delete_selected'] = delete
@@ -77,7 +77,7 @@ def change_view(self, request, object_id, form_url='', extra_context=None):
7777
}
7878
]
7979
})
80-
return super(AbstractTopologyAdmin, self).change_view(request, object_id, form_url, extra_context)
80+
return super().change_view(request, object_id, form_url, extra_context)
8181

8282
def get_urls(self):
8383
options = getattr(self.model, '_meta')
@@ -86,7 +86,7 @@ def get_urls(self):
8686
url(r'^visualize/(?P<pk>[^/]+)/$',
8787
self.admin_site.admin_view(self.visualize_view),
8888
name='{0}_visualize'.format(url_prefix)),
89-
] + super(AbstractTopologyAdmin, self).get_urls()
89+
] + super().get_urls()
9090

9191
def _message(self, request, rows, suffix, level=messages.SUCCESS):
9292
if rows == 1:
@@ -171,7 +171,7 @@ def change_view(self, request, object_id, form_url='', extra_context=None):
171171
Q(target_id=object_id)),
172172
'admin_url': admin_url
173173
})
174-
return super(AbstractNodeAdmin, self).change_view(request, object_id, form_url, extra_context)
174+
return super().change_view(request, object_id, form_url, extra_context)
175175

176176

177177
class AbstractLinkAdmin(BaseAdmin):

django_netjsongraph/base/link.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from django.core.exceptions import ValidationError
66
from django.db import models
77
from django.db.models import Q
8-
from django.utils.encoding import python_2_unicode_compatible
98
from django.utils.timezone import now
109
from django.utils.translation import ugettext_lazy as _
1110
from jsonfield import JSONField
@@ -18,7 +17,6 @@
1817
from .base import TimeStampedEditableModel
1918

2019

21-
@python_2_unicode_compatible
2220
class AbstractLink(TimeStampedEditableModel):
2321
"""
2422
NetJSON NetworkGraph Link Object implementation
@@ -45,11 +43,11 @@ class Meta:
4543
abstract = True
4644

4745
def __init__(self, *args, **kwargs):
48-
super(AbstractLink, self).__init__(*args, **kwargs)
46+
super().__init__(*args, **kwargs)
4947
self._initial_status = self.status
5048

5149
def save(self, *args, **kwargs):
52-
super(AbstractLink, self).save(*args, **kwargs)
50+
super().save(*args, **kwargs)
5351
if self.status != self._initial_status:
5452
self.send_status_changed_signal()
5553
self.status_changed = now()

django_netjsongraph/base/node.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from datetime import timedelta
44

55
from django.db import models
6-
from django.utils.encoding import python_2_unicode_compatible
76
from django.utils.functional import cached_property
87
from django.utils.timezone import now
98
from jsonfield import JSONField
@@ -14,7 +13,6 @@
1413
from .base import TimeStampedEditableModel
1514

1615

17-
@python_2_unicode_compatible
1816
class AbstractNode(TimeStampedEditableModel):
1917
"""
2018
NetJSON NetworkGraph Node Object implementation
@@ -40,7 +38,7 @@ def clean(self):
4038
self.properties = {}
4139

4240
def save(self, *args, **kwargs):
43-
super(AbstractNode, self).save(*args, **kwargs)
41+
super().save(*args, **kwargs)
4442

4543
@property
4644
def netjson_id(self):

django_netjsongraph/base/topology.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from django.core.exceptions import ValidationError
66
from django.db import models
77
from django.urls import reverse
8-
from django.utils.encoding import python_2_unicode_compatible
98
from django.utils.functional import cached_property
109
from django.utils.module_loading import import_string
1110
from django.utils.timezone import now
@@ -24,7 +23,6 @@
2423
)
2524

2625

27-
@python_2_unicode_compatible
2826
class AbstractTopology(TimeStampedEditableModel):
2927
label = models.CharField(_('label'), max_length=64)
3028
parser = models.CharField(_('format'),

django_netjsongraph/migrations/0001_initial.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# -*- coding: utf-8 -*-
22
# Generated by Django 1.9 on 2015-12-23 09:04
3-
from __future__ import unicode_literals
4-
53
import uuid
64

75
import django.db.models.deletion

django_netjsongraph/migrations/0002_topology_published.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# -*- coding: utf-8 -*-
22
# Generated by Django 1.9 on 2015-12-26 17:05
3-
from __future__ import unicode_literals
4-
53
from django.db import migrations, models
64

75

django_netjsongraph/migrations/0003_topology_receive_strategy.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# -*- coding: utf-8 -*-
22
# Generated by Django 1.9 on 2016-01-24 14:35
3-
from __future__ import unicode_literals
4-
53
import django_netjsongraph.models
64
from django.db import migrations, models
75

django_netjsongraph/migrations/0004_increased_addresses_maxlength.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# -*- coding: utf-8 -*-
22
# Generated by Django 1.9.1 on 2016-01-24 17:08
3-
from __future__ import unicode_literals
4-
53
from django.db import migrations, models
64

75

0 commit comments

Comments
 (0)