Skip to content

Commit 52ea198

Browse files
committed
[qa] Fixed formatting
1 parent 590bd43 commit 52ea198

File tree

7 files changed

+89
-84
lines changed

7 files changed

+89
-84
lines changed

Diff for: CHANGES.rst

+23-13
Original file line numberDiff line numberDiff line change
@@ -20,47 +20,57 @@ Version 0.4.1 [2018-02-19]
2020
Version 0.4.0 [2017-05-24]
2121
--------------------------
2222

23-
- `8078e07 <https://github.com/openwisp/django-owm-legacy/commit/8078e07>`_:
23+
- `8078e07
24+
<https://github.com/openwisp/django-owm-legacy/commit/8078e07>`_:
2425
Upgraded to **django-netjsonconfig 0.6.0**
2526

2627
Version 0.3.1 [2017-03-08]
2728
--------------------------
2829

29-
- `fb595bd <https://github.com/openwisp/django-owm-legacy/commit/fb595bd>`_:
30+
- `fb595bd
31+
<https://github.com/openwisp/django-owm-legacy/commit/fb595bd>`_:
3032
[views] Added support for openwisp-controller
3133

3234
Version 0.3.0 [2017-01-18]
3335
--------------------------
3436

35-
- `2db46c8 <https://github.com/openwisp/django-owm-legacy/commit/2db46c8>`_:
37+
- `2db46c8
38+
<https://github.com/openwisp/django-owm-legacy/commit/2db46c8>`_:
3639
[requirements] set minimum `django-netjsonconfig
3740
<https://github.com/openwisp/django-netjsonconfig>`_ version to 0.5.0
38-
- `f388d9c <https://github.com/openwisp/django-owm-legacy/commit/f388d9c>`_:
41+
- `f388d9c
42+
<https://github.com/openwisp/django-owm-legacy/commit/f388d9c>`_:
3943
[views] use ``mac_address`` field instead of ``key``
40-
- `5a8b793 <https://github.com/openwisp/django-owm-legacy/commit/5a8b793>`_:
44+
- `5a8b793
45+
<https://github.com/openwisp/django-owm-legacy/commit/5a8b793>`_:
4146
[views] added compatibility with ``openwisp2.config``
4247

4348
Version 0.2.3 [2016-02-29]
4449
--------------------------
4550

46-
- `b162867 <https://github.com/openwisp/django-owm-legacy/commit/b162867>`_:
47-
log denied requests with warning level
51+
- `b162867
52+
<https://github.com/openwisp/django-owm-legacy/commit/b162867>`_: log
53+
denied requests with warning level
4854

4955
Version 0.2.2 [2016-02-12]
5056
--------------------------
5157

52-
- `f66bec1 <https://github.com/openwisp/django-owm-legacy/commit/f66bec1>`_:
53-
update ``last_ip`` on checksum if necessary
54-
- `4ae482e <https://github.com/openwisp/django-owm-legacy/commit/4ae482e>`_:
58+
- `f66bec1
59+
<https://github.com/openwisp/django-owm-legacy/commit/f66bec1>`_: update
60+
``last_ip`` on checksum if necessary
61+
- `4ae482e
62+
<https://github.com/openwisp/django-owm-legacy/commit/4ae482e>`_:
5563
updated minimum ``django-netjsonconfig`` version to 0.2.3
5664

5765
Version 0.2.1 [2016-01-28]
5866
--------------------------
5967

60-
- `ebf950a <https://github.com/openwisp/django-owm-legacy/commit/ebf950a>`_:
68+
- `ebf950a
69+
<https://github.com/openwisp/django-owm-legacy/commit/ebf950a>`_:
6170
updated requirements.txt
62-
- `61e6ddd <https://github.com/openwisp/django-owm-legacy/commit/61e6ddd>`_:
63-
fill last_ip and status fields when config is downloaded
71+
- `61e6ddd
72+
<https://github.com/openwisp/django-owm-legacy/commit/61e6ddd>`_: fill
73+
last_ip and status fields when config is downloaded
6474

6575
Version 0.2 [2016-01-14]
6676
------------------------

Diff for: CONTRIBUTING.rst

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
Contributing
22
============
33

4-
Thanks for your interest! We love contributions, so please feel free to fix bugs, improve things, provide documentation.
5-
Just `follow the guidelines <https://github.com/openwisp/django-owm-legacy#contributing>`_ and submit a PR.
4+
Thanks for your interest! We love contributions, so please feel free to
5+
fix bugs, improve things, provide documentation. Just `follow the
6+
guidelines <https://github.com/openwisp/django-owm-legacy#contributing>`_
7+
and submit a PR.

Diff for: README.rst

+53-50
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,33 @@ django-owm-legacy
22
=================
33

44
.. image:: https://github.com/openwisp/django-owm-legacy/workflows/Django%20OWM%20Legacy%20CI%20Build/badge.svg?branch=master
5-
:target: https://github.com/openwisp/django-owm-legacy/actions?query=workflow%3A"Django%20OWM%20Legacy%20CI%20Build"
6-
:alt: CI build status
5+
:target: https://github.com/openwisp/django-owm-legacy/actions?query=workflow%3A"Django%20OWM%20Legacy%20CI%20Build"
6+
:alt: CI build status
77

88
.. image:: https://coveralls.io/repos/openwisp/django-owm-legacy/badge.svg
9-
:target: https://coveralls.io/r/openwisp/django-owm-legacy
10-
:alt: Test Coverage
9+
:target: https://coveralls.io/r/openwisp/django-owm-legacy
10+
:alt: Test Coverage
1111

1212
.. image:: https://img.shields.io/librariesio/release/github/openwisp/django-owm-legacy
13-
:target: https://libraries.io/github/openwisp/django-owm-legacy#repository_dependencies
14-
:alt: Dependency monitoring
13+
:target: https://libraries.io/github/openwisp/django-owm-legacy#repository_dependencies
14+
:alt: Dependency monitoring
1515

1616
.. image:: https://img.shields.io/gitter/room/nwjs/nw.js.svg
17-
:target: https://gitter.im/openwisp/general
18-
:alt: Chat
17+
:target: https://gitter.im/openwisp/general
18+
:alt: Chat
1919

2020
.. image:: https://badge.fury.io/py/django-owm-legacy.svg
21-
:target: http://badge.fury.io/py/django-owm-legacy
21+
:target: http://badge.fury.io/py/django-owm-legacy
2222

2323
.. image:: https://pepy.tech/badge/django-owm-legacy
24-
:target: https://pepy.tech/project/django-owm-legacy
25-
:alt: Downloads
24+
:target: https://pepy.tech/project/django-owm-legacy
25+
:alt: Downloads
2626

2727
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
28-
:target: https://pypi.org/project/black/
29-
:alt: code style: black
28+
:target: https://pypi.org/project/black/
29+
:alt: code style: black
3030

31-
------------
31+
----
3232

3333
Legacy features of OpenWISP Manager reimplemented in django for `OpenWISP2
3434
<https://github.com/openwisp/ansible-openwisp2>`_.
@@ -68,46 +68,47 @@ If you want to contribute, install your cloned fork:
6868
Setup (integrate in an existing django project)
6969
-----------------------------------------------
7070

71-
Add ``openwisp_controller`` and ``owm_legacy`` to ``INSTALLED_APPS`` as follow:
71+
Add ``openwisp_controller`` and ``owm_legacy`` to ``INSTALLED_APPS`` as
72+
follow:
7273

7374
.. code-block:: python
7475
7576
INSTALLED_APPS = [
7677
# ...
77-
'django.contrib.sites',
78+
"django.contrib.sites",
7879
# allauth
79-
'allauth',
80-
'allauth.account',
81-
'django_extensions',
80+
"allauth",
81+
"allauth.account",
82+
"django_extensions",
8283
# openwisp2 modules
83-
'openwisp_controller.config',
84-
'openwisp_controller.pki',
85-
'openwisp_controller.geo',
86-
'openwisp_controller.connection',
87-
'openwisp_users',
88-
'openwisp_notifications',
89-
'openwisp_ipam',
84+
"openwisp_controller.config",
85+
"openwisp_controller.pki",
86+
"openwisp_controller.geo",
87+
"openwisp_controller.connection",
88+
"openwisp_users",
89+
"openwisp_notifications",
90+
"openwisp_ipam",
9091
# openwisp2 admin theme
9192
# (must be loaded here)
92-
'openwisp_utils.admin_theme',
93-
'django.contrib.admin',
94-
'django.forms',
93+
"openwisp_utils.admin_theme",
94+
"django.contrib.admin",
95+
"django.forms",
9596
# other dependencies
96-
'sortedm2m',
97-
'reversion',
98-
'leaflet',
99-
'flat_json_widget',
100-
'owm_legacy',
97+
"sortedm2m",
98+
"reversion",
99+
"leaflet",
100+
"flat_json_widget",
101+
"owm_legacy",
101102
# ...
102103
]
103104
104105
Other settings needed in ``settings.py``:
105106

106107
.. code-block:: python
107108
108-
EXTENDED_APPS = ('django_x509', 'django_loci')
109+
EXTENDED_APPS = ("django_x509", "django_loci")
109110
110-
AUTH_USER_MODEL = 'openwisp_users.User'
111+
AUTH_USER_MODEL = "openwisp_users.User"
111112
SITE_ID = 1
112113
113114
Your ``urls.py`` should look like the following:
@@ -122,9 +123,9 @@ Your ``urls.py`` should look like the following:
122123
123124
124125
urlpatterns = [
125-
path('admin/', include(admin.site.urls)),
126-
path('', include('openwisp_controller.urls', namespace='controller')),
127-
path('', include('owm_legacy.urls', namespace='owm_legacy')),
126+
path("admin/", include(admin.site.urls)),
127+
path("", include("openwisp_controller.urls", namespace="controller")),
128+
path("", include("owm_legacy.urls", namespace="owm_legacy")),
128129
]
129130
130131
urlpatterns += staticfiles_urlpatterns()
@@ -193,31 +194,33 @@ Settings
193194
``OWM_LEGACY_ALLOWED_SUBNETS``
194195
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
195196

196-
+--------------+------------------------------------------+
197-
| **type**: | ``list`` |
198-
+--------------+------------------------------------------+
199-
| **default**: | ``['10.8.0.0/16', '127.0.0.1/32']`` |
200-
+--------------+------------------------------------------+
197+
============ ===================================
198+
**type**: ``list``
199+
**default**: ``['10.8.0.0/16', '127.0.0.1/32']``
200+
============ ===================================
201201

202-
List of strings representing ip networks allowed to retrieve
203-
checksums and download configuration archives.
202+
List of strings representing ip networks allowed to retrieve checksums and
203+
download configuration archives.
204204

205205
Contributing
206206
------------
207207

208-
Please refer to the `OpenWISP contributing guidelines <http://openwisp.io/docs/developer/contributing.html>`_.
208+
Please refer to the `OpenWISP contributing guidelines
209+
<http://openwisp.io/docs/developer/contributing.html>`_.
209210

210-
.. _PEP8, Style Guide for Python Code: http://www.python.org/dev/peps/pep-0008/
211+
.. _pep8, style guide for python code: http://www.python.org/dev/peps/pep-0008/
211212

212213
Changelog
213214
---------
214215

215-
See `CHANGES <https://github.com/openwisp/django-owm-legacy/blob/master/CHANGES.rst>`_.
216+
See `CHANGES
217+
<https://github.com/openwisp/django-owm-legacy/blob/master/CHANGES.rst>`_.
216218

217219
License
218220
-------
219221

220-
See `LICENSE <https://github.com/openwisp/django-owm-legacy/blob/master/LICENSE>`_.
222+
See `LICENSE
223+
<https://github.com/openwisp/django-owm-legacy/blob/master/LICENSE>`_.
221224

222225
Support
223226
-------

Diff for: owm_legacy/tests.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515

1616

1717
class TestOwmLegacy(CreateConfigMixin, TestOrganizationMixin, TestCase):
18-
"""
19-
tests for owm_legacy
20-
"""
18+
"""tests for owm_legacy"""
2119

2220
config_model = Config
2321
device_model = Device

Diff for: owm_legacy/utils.py

+5-7
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99

1010

1111
def ip_allowed(address_string):
12-
"""
13-
returns ``True`` if specified ip address is allowed
14-
according to ``settings.OWM_LEGACY_ALLOWED_SUBNETS``
15-
otherwise returns ``False``
12+
"""returns ``True`` if specified ip address is allowed
13+
14+
according to ``settings.OWM_LEGACY_ALLOWED_SUBNETS`` otherwise returns
15+
``False``
1616
"""
1717
ip_address = ipaddress.ip_address(address_string.encode().decode())
1818
for subnet_string in ALLOWED_SUBNETS:
@@ -23,9 +23,7 @@ def ip_allowed(address_string):
2323

2424

2525
def forbid_unallowed(request):
26-
"""
27-
raises ``PermissionDenied`` if remote address is not allowed
28-
"""
26+
"""raises ``PermissionDenied`` if remote address is not allowed"""
2927
if not ip_allowed(request.META.get('REMOTE_ADDR')):
3028
logger.warning('PermissionDenied', extra={'request': request, 'stack': True})
3129
raise PermissionDenied

Diff for: owm_legacy/views.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414

1515

1616
def get_config_md5(request, mac_address):
17-
"""
18-
returns md5 of configuration
19-
"""
17+
"""returns md5 of configuration"""
2018
forbid_unallowed(request)
2119
config = get_object_or_404(Config, device__mac_address__iexact=mac_address)
2220
# in OpenWISP 1, the last_ip field and the management_ip are the same
@@ -31,9 +29,7 @@ def get_config_md5(request, mac_address):
3129

3230

3331
def get_config(request, mac_address):
34-
"""
35-
returns configuration tar.gz
36-
"""
32+
"""returns configuration tar.gz"""
3733
forbid_unallowed(request)
3834
config = get_object_or_404(Config, device__mac_address__iexact=mac_address)
3935
config.set_status_applied()

Diff for: setup.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88

99

1010
def get_install_requires():
11-
"""
12-
parse requirements.txt, ignore links, exclude comments
13-
"""
11+
"""parse requirements.txt, ignore links, exclude comments"""
1412
requirements = []
1513
for line in open('requirements.txt').readlines():
1614
# skip to next iteration if comment or empty line

0 commit comments

Comments
 (0)