diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4f5a1024..f5ebed04 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,4 +1,5 @@
stages:
+- pre-commit
- gitlab
- test
- deploy
@@ -13,6 +14,18 @@ before_script:
- python -V
- pip install wheel tox
+pre-commit-check:
+ stage: pre-commit
+ image: python:3.6-buster
+ variables:
+ PRE_COMMIT_HOME: ${CI_PROJECT_DIR}/.cache/pre-commit
+ cache:
+ paths:
+ - ${PRE_COMMIT_HOME}
+ script:
+ - pip install pre-commit
+ - pre-commit run --all-files
+
sast:
stage: gitlab
before_script: []
@@ -27,7 +40,7 @@ dependency_scanning:
test-3.7-core:
image: python:3.7-buster
- script:
+ script:
- tox -e py37-core
artifacts:
when: always
@@ -36,7 +49,7 @@ test-3.7-core:
test-3.8-core:
image: python:3.8-buster
- script:
+ script:
- tox -e py38-core
artifacts:
when: always
@@ -45,7 +58,7 @@ test-3.8-core:
test-3.9-core:
image: python:3.9-buster
- script:
+ script:
- tox -e py39-core
artifacts:
when: always
@@ -54,7 +67,7 @@ test-3.9-core:
test-3.7-all:
image: python:3.7-buster
- script:
+ script:
- tox -e py37-all
artifacts:
when: always
@@ -63,7 +76,7 @@ test-3.7-all:
test-3.8-all:
image: python:3.8-buster
- script:
+ script:
- tox -e py38-all
artifacts:
when: always
@@ -72,7 +85,7 @@ test-3.8-all:
test-3.9-all:
image: python:3.9-buster
- script:
+ script:
- tox -e py39-all
artifacts:
when: always
@@ -91,4 +104,4 @@ deploy_production:
- twine upload dist/*
rules:
- - if: $CI_COMMIT_TAG
\ No newline at end of file
+ - if: $CI_COMMIT_TAG
diff --git a/.gitlab/issue_templates/Bug.md b/.gitlab/issue_templates/Bug.md
index e7d9ffff..d1284314 100644
--- a/.gitlab/issue_templates/Bug.md
+++ b/.gitlab/issue_templates/Bug.md
@@ -1,8 +1,8 @@
# Bug
- I have searched [issues](https://gitlab.com/allianceauth/allianceauth/issues?scope=all&utf8=%E2%9C%93&state=all) (Y/N):
-- What Version of Alliance Auth:
-- What Operating System:
+- What Version of Alliance Auth:
+- What Operating System:
- Version of other components relevant to issue eg. Service, Database:
Please include a brief description of your issue here.
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 00000000..0a3a9478
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,16 @@
+# Apply to all files without committing:
+# pre-commit run --all-files
+# Update this file:
+# pre-commit autoupdate
+
+repos:
+ - repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v3.4.0
+ hooks:
+ - id: check-case-conflict
+ - id: check-json
+ - id: check-xml
+ - id: check-yaml
+ - id: fix-byte-order-marker
+ - id: trailing-whitespace
+ exclude: \.(min\.css|min\.js|po|mo)$
diff --git a/allianceauth/authentication/admin.py b/allianceauth/authentication/admin.py
index 5191981c..248a0c3c 100644
--- a/allianceauth/authentication/admin.py
+++ b/allianceauth/authentication/admin.py
@@ -84,7 +84,7 @@ class UserProfileInline(admin.StackedInline):
if request.user.is_superuser:
query |= Q(userprofile__isnull=True)
else:
- query |= Q(character_ownership__user=obj)
+ query |= Q(character_ownership__user=obj)
formset = super().get_formset(request, obj=obj, **kwargs)
def get_kwargs(self, index):
@@ -123,26 +123,26 @@ def user_username(obj):
works for both User objects and objects with `user` as FK to User
To be used for all user based admin lists
- """
+ """
link = reverse(
'admin:{}_{}_change'.format(
obj._meta.app_label,
type(obj).__name__.lower()
- ),
+ ),
args=(obj.pk,)
)
user_obj = obj.user if hasattr(obj, 'user') else obj
if user_obj.profile.main_character:
return format_html(
'{}
{}',
- link,
+ link,
user_obj.username,
user_obj.profile.main_character.character_name
)
else:
return format_html(
'{}',
- link,
+ link,
user_obj.username,
)
@@ -160,16 +160,16 @@ def user_main_organization(obj):
user_obj = obj.user if hasattr(obj, 'user') else obj
if not user_obj.profile.main_character:
result = None
- else:
+ else:
corporation = user_obj.profile.main_character.corporation_name
- if user_obj.profile.main_character.alliance_id:
+ if user_obj.profile.main_character.alliance_id:
result = format_html(
'{}
{}',
- corporation,
+ corporation,
user_obj.profile.main_character.alliance_name
)
else:
- result = corporation
+ result = corporation
return result
@@ -200,7 +200,7 @@ class MainCorporationsFilter(admin.SimpleListFilter):
def queryset(self, request, qs):
if self.value() is None:
return qs.all()
- else:
+ else:
if qs.model == User:
return qs.filter(
profile__main_character__corporation_id=self.value()
@@ -209,7 +209,7 @@ class MainCorporationsFilter(admin.SimpleListFilter):
return qs.filter(
user__profile__main_character__corporation_id=self.value()
)
-
+
class MainAllianceFilter(admin.SimpleListFilter):
"""Custom filter to filter on alliances from mains only
@@ -234,16 +234,16 @@ class MainAllianceFilter(admin.SimpleListFilter):
def queryset(self, request, qs):
if self.value() is None:
return qs.all()
- else:
+ else:
if qs.model == User:
- return qs.filter(profile__main_character__alliance_id=self.value())
+ return qs.filter(profile__main_character__alliance_id=self.value())
else:
return qs.filter(
user__profile__main_character__alliance_id=self.value()
)
-
-def update_main_character_model(modeladmin, request, queryset):
+
+def update_main_character_model(modeladmin, request, queryset):
tasks_count = 0
for obj in queryset:
if obj.profile.main_character:
@@ -251,7 +251,7 @@ def update_main_character_model(modeladmin, request, queryset):
tasks_count += 1
modeladmin.message_user(
- request,
+ request,
'Update from ESI started for {} characters'.format(tasks_count)
)
@@ -262,7 +262,7 @@ update_main_character_model.short_description = \
class UserAdmin(BaseUserAdmin):
"""Extending Django's UserAdmin model
-
+
Behavior of groups and characters columns can be configured via settings
"""
@@ -270,7 +270,7 @@ class UserAdmin(BaseUserAdmin):
css = {
"all": ("authentication/css/admin.css",)
}
-
+
def get_queryset(self, request):
qs = super().get_queryset(request)
return qs.prefetch_related("character_ownerships__character", "groups")
@@ -279,8 +279,8 @@ class UserAdmin(BaseUserAdmin):
actions = super(BaseUserAdmin, self).get_actions(request)
actions[update_main_character_model.__name__] = (
- update_main_character_model,
- update_main_character_model.__name__,
+ update_main_character_model,
+ update_main_character_model.__name__,
update_main_character_model.short_description
)
@@ -290,21 +290,21 @@ class UserAdmin(BaseUserAdmin):
if svc.update_groups.__module__ != ServicesHook.update_groups.__module__:
action = make_service_hooks_update_groups_action(svc)
actions[action.__name__] = (
- action,
+ action,
action.__name__,
action.short_description
)
-
+
# Create sync nickname action if service implements it
if svc.sync_nickname.__module__ != ServicesHook.sync_nickname.__module__:
action = make_service_hooks_sync_nickname_action(svc)
actions[action.__name__] = (
- action, action.__name__,
+ action, action.__name__,
action.short_description
)
return actions
- def _list_2_html_w_tooltips(self, my_items: list, max_items: int) -> str:
+ def _list_2_html_w_tooltips(self, my_items: list, max_items: int) -> str:
"""converts list of strings into HTML with cutoff and tooltip"""
items_truncated_str = ', '.join(my_items[:max_items])
if not my_items:
@@ -320,27 +320,27 @@ class UserAdmin(BaseUserAdmin):
items_truncated_str
)
return result
-
+
inlines = BaseUserAdmin.inlines + [UserProfileInline]
- ordering = ('username', )
+ ordering = ('username', )
list_select_related = ('profile__state', 'profile__main_character')
- show_full_result_count = True
+ show_full_result_count = True
list_display = (
user_profile_pic,
- user_username,
- '_state',
+ user_username,
+ '_state',
'_groups',
user_main_organization,
'_characters',
'is_active',
'date_joined',
'_role'
- )
+ )
list_display_links = None
- list_filter = (
+ list_filter = (
'profile__state',
- 'groups',
- MainCorporationsFilter,
+ 'groups',
+ MainCorporationsFilter,
MainAllianceFilter,
'is_active',
'date_joined',
@@ -348,32 +348,32 @@ class UserAdmin(BaseUserAdmin):
'is_superuser'
)
search_fields = (
- 'username',
+ 'username',
'character_ownerships__character__character_name'
)
-
+
def _characters(self, obj):
character_ownerships = list(obj.character_ownerships.all())
characters = [obj.character.character_name for obj in character_ownerships]
return self._list_2_html_w_tooltips(
- sorted(characters),
+ sorted(characters),
AUTHENTICATION_ADMIN_USERS_MAX_CHARS
)
-
+
_characters.short_description = 'characters'
-
+
def _state(self, obj):
return obj.profile.state.name
-
+
_state.short_description = 'state'
_state.admin_order_field = 'profile__state'
- def _groups(self, obj):
+ def _groups(self, obj):
my_groups = sorted([group.name for group in list(obj.groups.all())])
return self._list_2_html_w_tooltips(
my_groups, AUTHENTICATION_ADMIN_USERS_MAX_GROUPS
)
-
+
_groups.short_description = 'groups'
def _role(self, obj):
@@ -382,11 +382,11 @@ class UserAdmin(BaseUserAdmin):
elif obj.is_staff:
role = 'Staff'
else:
- role = 'User'
+ role = 'User'
return role
-
+
_role.short_description = 'role'
-
+
def has_change_permission(self, request, obj=None):
return request.user.has_perm('auth.change_user')
@@ -404,10 +404,10 @@ class UserAdmin(BaseUserAdmin):
@admin.register(State)
-class StateAdmin(admin.ModelAdmin):
+class StateAdmin(admin.ModelAdmin):
list_select_related = True
list_display = ('name', 'priority', '_user_count')
-
+
def get_queryset(self, request):
qs = super().get_queryset(request)
return qs.annotate(user_count=Count("userprofile__id"))
@@ -423,17 +423,17 @@ class StateAdmin(admin.ModelAdmin):
}),
('Membership', {
'fields': (
- 'public',
- 'member_characters',
- 'member_corporations',
+ 'public',
+ 'member_characters',
+ 'member_corporations',
'member_alliances'
),
})
)
filter_horizontal = [
- 'member_characters',
- 'member_corporations',
- 'member_alliances',
+ 'member_characters',
+ 'member_corporations',
+ 'member_alliances',
'permissions'
]
@@ -463,16 +463,16 @@ class StateAdmin(admin.ModelAdmin):
}),
)
return super(StateAdmin, self).get_fieldsets(request, obj=obj)
-
+
class BaseOwnershipAdmin(admin.ModelAdmin):
class Media:
css = {
"all": ("authentication/css/admin.css",)
}
-
+
list_select_related = (
- 'user__profile__state', 'user__profile__main_character', 'character')
+ 'user__profile__state', 'user__profile__main_character', 'character')
list_display = (
user_profile_pic,
user_username,
@@ -480,13 +480,13 @@ class BaseOwnershipAdmin(admin.ModelAdmin):
'character',
)
search_fields = (
- 'user__username',
- 'character__character_name',
- 'character__corporation_name',
+ 'user__username',
+ 'character__character_name',
+ 'character__corporation_name',
'character__alliance_name'
)
- list_filter = (
- MainCorporationsFilter,
+ list_filter = (
+ MainCorporationsFilter,
MainAllianceFilter,
)
diff --git a/allianceauth/authentication/app_settings.py b/allianceauth/authentication/app_settings.py
index 9494953f..29afd26e 100644
--- a/allianceauth/authentication/app_settings.py
+++ b/allianceauth/authentication/app_settings.py
@@ -2,14 +2,14 @@ from django.conf import settings
def _clean_setting(
- name: str,
- default_value: object,
+ name: str,
+ default_value: object,
min_value: int = None,
max_value: int = None,
required_type: type = None
):
"""cleans the input for a custom setting
-
+
Will use `default_value` if settings does not exit or has the wrong type
or is outside define boundaries (for int only)
@@ -18,22 +18,22 @@ def _clean_setting(
Will assume `min_value` of 0 for int (can be overriden)
Returns cleaned value for setting
- """
+ """
if default_value is None and not required_type:
raise ValueError('You must specify a required_type for None defaults')
-
+
if not required_type:
required_type = type(default_value)
if min_value is None and required_type == int:
- min_value = 0
-
+ min_value = 0
+
if (hasattr(settings, name)
and isinstance(getattr(settings, name), required_type)
and (min_value is None or getattr(settings, name) >= min_value)
and (max_value is None or getattr(settings, name) <= max_value)
- ):
- return getattr(settings, name)
+ ):
+ return getattr(settings, name)
else:
return default_value
diff --git a/allianceauth/authentication/backends.py b/allianceauth/authentication/backends.py
index f6fb2e0d..d0cecf4a 100644
--- a/allianceauth/authentication/backends.py
+++ b/allianceauth/authentication/backends.py
@@ -12,9 +12,9 @@ logger = logging.getLogger(__name__)
class StateBackend(ModelBackend):
@staticmethod
def _get_state_permissions(user_obj):
- """returns permissions for state of given user object"""
+ """returns permissions for state of given user object"""
if hasattr(user_obj, "profile") and user_obj.profile:
- return Permission.objects.filter(state=user_obj.profile.state)
+ return Permission.objects.filter(state=user_obj.profile.state)
else:
return Permission.objects.none()
diff --git a/allianceauth/authentication/migrations/0005_delete_perms.py b/allianceauth/authentication/migrations/0005_delete_perms.py
index e10f4253..5323b187 100644
--- a/allianceauth/authentication/migrations/0005_delete_perms.py
+++ b/allianceauth/authentication/migrations/0005_delete_perms.py
@@ -17,7 +17,7 @@ def create_permissions(apps, schema_editor):
Permission = apps.get_model('auth', 'Permission')
ct = ContentType.objects.get_for_model(User)
Permission.objects.get_or_create(codename="member", content_type=ct, name="member")
- Permission.objects.get_or_create(codename="blue_member", content_type=ct, name="blue_member")
+ Permission.objects.get_or_create(codename="blue_member", content_type=ct, name="blue_member")
class Migration(migrations.Migration):
diff --git a/allianceauth/authentication/models.py b/allianceauth/authentication/models.py
index c71721ef..df63e166 100755
--- a/allianceauth/authentication/models.py
+++ b/allianceauth/authentication/models.py
@@ -74,7 +74,7 @@ class UserProfile(models.Model):
logger.info('Updating {} state to {}'.format(self.user, self.state))
self.save(update_fields=['state'])
notify(
- self.user,
+ self.user,
_('State changed to: %s' % state),
_('Your user\'s state is now: %(state)s')
% ({'state': state}),
diff --git a/allianceauth/authentication/static/authentication/css/admin.css b/allianceauth/authentication/static/authentication/css/admin.css
index 489edd2e..ac0706e8 100644
--- a/allianceauth/authentication/static/authentication/css/admin.css
+++ b/allianceauth/authentication/static/authentication/css/admin.css
@@ -1,12 +1,12 @@
-/*
-CSS for allianceauth admin site
+/*
+CSS for allianceauth admin site
*/
/* styling for profile pic */
-.img-circle {
- border-radius: 50%;
+.img-circle {
+ border-radius: 50%;
}
-.column-user_profile_pic {
+.column-user_profile_pic {
width: 1px;
white-space: nowrap;
}
@@ -26,4 +26,4 @@ CSS for allianceauth admin site
color: black ;
background-color: rgb(255, 255, 204) ;
z-index: 1 ;
-}
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/allianceauth/authentication/templates/authentication/dashboard.html b/allianceauth/authentication/templates/authentication/dashboard.html
index d4401aa1..49dfa762 100644
--- a/allianceauth/authentication/templates/authentication/dashboard.html
+++ b/allianceauth/authentication/templates/authentication/dashboard.html
@@ -63,7 +63,7 @@
{% endif %}
-
+
@@ -74,7 +74,7 @@
{{ main.corporation_name }}
{{ main.alliance_name }}
-
+
{% endwith %}
{% else %}
@@ -121,7 +121,7 @@
{% trans 'Characters' %}
-
+
@@ -132,20 +132,20 @@
- {% for char in characters %}
+ {% for char in characters %}
|
{{ char.character_name }} |
{{ char.corporation_name }} |
{{ char.alliance_name }} |
-
+
{% endfor %}
- {% for char in characters %}
+ {% for char in characters %}
@@ -154,7 +154,7 @@
{{ char.character_name }}
{{ char.corporation_name }}
{{ char.alliance_name|default:"" }}
- |
+
{% endfor %}
diff --git a/allianceauth/authentication/templates/public/login.html b/allianceauth/authentication/templates/public/login.html
index 80d31979..af07857b 100644
--- a/allianceauth/authentication/templates/public/login.html
+++ b/allianceauth/authentication/templates/public/login.html
@@ -1,7 +1,7 @@
{% extends 'public/middle_box.html' %}
{% load static %}
{% block page_title %}Login{% endblock %}
-{% block middle_box_content %}
+{% block middle_box_content %}
diff --git a/allianceauth/authentication/tests/test_admin.py b/allianceauth/authentication/tests/test_admin.py
index b43da12b..41d5a88b 100644
--- a/allianceauth/authentication/tests/test_admin.py
+++ b/allianceauth/authentication/tests/test_admin.py
@@ -16,15 +16,15 @@ from allianceauth.tests.auth_utils import AuthUtils
from ..admin import (
BaseUserAdmin,
- CharacterOwnershipAdmin,
+ CharacterOwnershipAdmin,
StateAdmin,
MainCorporationsFilter,
MainAllianceFilter,
OwnershipRecordAdmin,
User,
- UserAdmin,
+ UserAdmin,
user_main_organization,
- user_profile_pic,
+ user_profile_pic,
user_username,
update_main_character_model,
make_service_hooks_update_groups_action,
@@ -36,7 +36,7 @@ from . import get_admin_change_view_url, get_admin_search_url
MODULE_PATH = 'allianceauth.authentication.admin'
-class MockRequest(object):
+class MockRequest(object):
def __init__(self, user=None):
self.user = user
@@ -51,7 +51,7 @@ class TestCaseWithTestData(TestCase):
EveAllianceInfo, EveCorporationInfo, EveCharacter, Group, User
]:
MyModel.objects.all().delete()
-
+
# groups
cls.group_1 = Group.objects.create(
name='Group 1'
@@ -84,16 +84,16 @@ class TestCaseWithTestData(TestCase):
alliance = EveAllianceInfo.objects.create(
alliance_id=3001,
alliance_name='Wayne Enterprises',
- alliance_ticker='WE',
+ alliance_ticker='WE',
executor_corp_id=2001
)
EveCorporationInfo.objects.create(
corporation_id=2001,
corporation_name='Wayne Technologies',
- corporation_ticker='WT',
+ corporation_ticker='WT',
member_count=42,
alliance=alliance
- )
+ )
cls.user_1 = User.objects.create_user(
character_1.character_name.replace(' ', '_'),
'abc@example.com',
@@ -111,7 +111,7 @@ class TestCaseWithTestData(TestCase):
)
cls.user_1.profile.main_character = character_1
cls.user_1.profile.save()
- cls.user_1.groups.add(cls.group_1)
+ cls.user_1.groups.add(cls.group_1)
# user 2 - corp only, staff
character_2 = EveCharacter.objects.create(
@@ -125,7 +125,7 @@ class TestCaseWithTestData(TestCase):
EveCorporationInfo.objects.create(
corporation_id=2002,
corporation_name='Daily Plane',
- corporation_ticker='DP',
+ corporation_ticker='DP',
member_count=99,
alliance=None
)
@@ -144,7 +144,7 @@ class TestCaseWithTestData(TestCase):
cls.user_2.groups.add(cls.group_2)
cls.user_2.is_staff = True
cls.user_2.save()
-
+
# user 3 - no main, no group, superuser
character_3 = EveCharacter.objects.create(
character_id=1101,
@@ -157,7 +157,7 @@ class TestCaseWithTestData(TestCase):
EveCorporationInfo.objects.create(
corporation_id=2101,
corporation_name='Lex Corp',
- corporation_ticker='LC',
+ corporation_ticker='LC',
member_count=666,
alliance=None
)
@@ -186,25 +186,25 @@ def make_generic_search_request(ModelClass: type, search_term: str):
username='superuser', password='secret', email='admin@example.com'
)
c = Client()
- c.login(username='superuser', password='secret')
+ c.login(username='superuser', password='secret')
return c.get(
'%s?q=%s' % (get_admin_search_url(ModelClass), quote(search_term))
- )
+ )
class TestCharacterOwnershipAdmin(TestCaseWithTestData):
-
+
def setUp(self):
self.modeladmin = CharacterOwnershipAdmin(
model=User, admin_site=AdminSite()
)
- def test_change_view_loads_normally(self):
+ def test_change_view_loads_normally(self):
User.objects.create_superuser(
username='superuser', password='secret', email='admin@example.com'
)
c = Client()
- c.login(username='superuser', password='secret')
+ c.login(username='superuser', password='secret')
ownership = self.user_1.character_ownerships.first()
response = c.get(get_admin_change_view_url(ownership))
self.assertEqual(response.status_code, 200)
@@ -219,18 +219,18 @@ class TestCharacterOwnershipAdmin(TestCaseWithTestData):
class TestOwnershipRecordAdmin(TestCaseWithTestData):
-
+
def setUp(self):
self.modeladmin = OwnershipRecordAdmin(
model=User, admin_site=AdminSite()
)
- def test_change_view_loads_normally(self):
+ def test_change_view_loads_normally(self):
User.objects.create_superuser(
username='superuser', password='secret', email='admin@example.com'
)
c = Client()
- c.login(username='superuser', password='secret')
+ c.login(username='superuser', password='secret')
ownership_record = OwnershipRecord.objects\
.filter(user=self.user_1)\
.first()
@@ -245,23 +245,23 @@ class TestOwnershipRecordAdmin(TestCaseWithTestData):
class TestStateAdmin(TestCaseWithTestData):
-
+
def setUp(self):
self.modeladmin = StateAdmin(
model=User, admin_site=AdminSite()
)
- def test_change_view_loads_normally(self):
+ def test_change_view_loads_normally(self):
User.objects.create_superuser(
username='superuser', password='secret', email='admin@example.com'
)
c = Client()
- c.login(username='superuser', password='secret')
-
+ c.login(username='superuser', password='secret')
+
guest_state = AuthUtils.get_guest_state()
response = c.get(get_admin_change_view_url(guest_state))
self.assertEqual(response.status_code, 200)
-
+
member_state = AuthUtils.get_member_state()
response = c.get(get_admin_change_view_url(member_state))
self.assertEqual(response.status_code, 200)
@@ -281,12 +281,12 @@ class TestUserAdmin(TestCaseWithTestData):
model=User, admin_site=AdminSite()
)
self.character_1 = self.user_1.character_ownerships.first().character
-
+
def test_user_profile_pic_u1(self):
expected = (
'
'
- )
+ )
self.assertEqual(user_profile_pic(self.user_1), expected)
def test_user_profile_pic_u3(self):
@@ -332,18 +332,18 @@ class TestUserAdmin(TestCaseWithTestData):
expected = 'Lex Luthor'
result = self.modeladmin._characters(self.user_3)
self.assertEqual(result, expected)
-
- def test_groups_u1(self):
+
+ def test_groups_u1(self):
expected = 'Group 1'
result = self.modeladmin._groups(self.user_1)
self.assertEqual(result, expected)
- def test_groups_u2(self):
+ def test_groups_u2(self):
expected = 'Group 2'
result = self.modeladmin._groups(self.user_2)
self.assertEqual(result, expected)
-
- def test_groups_u3(self):
+
+ def test_groups_u3(self):
result = self.modeladmin._groups(self.user_3)
self.assertIsNone(result)
@@ -387,7 +387,7 @@ class TestUserAdmin(TestCaseWithTestData):
expected = None
result = self.modeladmin._list_2_html_w_tooltips(items, 5)
self.assertEqual(expected, result)
-
+
# actions
@patch(MODULE_PATH + '.UserAdmin.message_user', auto_spec=True)
@@ -401,14 +401,14 @@ class TestUserAdmin(TestCaseWithTestData):
)
self.assertEqual(mock_task.delay.call_count, 2)
self.assertTrue(mock_message_user.called)
-
+
# filters
-
+
def test_filter_main_corporations(self):
-
- class UserAdminTest(BaseUserAdmin):
+
+ class UserAdminTest(BaseUserAdmin):
list_filter = (MainCorporationsFilter,)
-
+
my_modeladmin = UserAdminTest(User, AdminSite())
# Make sure the lookups are correct
@@ -417,7 +417,7 @@ class TestUserAdmin(TestCaseWithTestData):
changelist = my_modeladmin.get_changelist_instance(request)
filters = changelist.get_filters(request)
filterspec = filters[0][0]
- expected = [
+ expected = [
(2002, 'Daily Planet'),
(2001, 'Wayne Technologies'),
]
@@ -425,20 +425,20 @@ class TestUserAdmin(TestCaseWithTestData):
# Make sure the correct queryset is returned
request = self.factory.get(
- '/',
+ '/',
{'main_corporation_id__exact': self.character_1.corporation_id}
)
- request.user = self.user_1
+ request.user = self.user_1
changelist = my_modeladmin.get_changelist_instance(request)
queryset = changelist.get_queryset(request)
expected = [self.user_1]
self.assertSetEqual(set(queryset), set(expected))
def test_filter_main_alliances(self):
-
- class UserAdminTest(BaseUserAdmin):
+
+ class UserAdminTest(BaseUserAdmin):
list_filter = (MainAllianceFilter,)
-
+
my_modeladmin = UserAdminTest(User, AdminSite())
# Make sure the lookups are correct
@@ -447,17 +447,17 @@ class TestUserAdmin(TestCaseWithTestData):
changelist = my_modeladmin.get_changelist_instance(request)
filters = changelist.get_filters(request)
filterspec = filters[0][0]
- expected = [
- (3001, 'Wayne Enterprises'),
+ expected = [
+ (3001, 'Wayne Enterprises'),
]
self.assertEqual(filterspec.lookup_choices, expected)
# Make sure the correct queryset is returned
request = self.factory.get(
- '/',
+ '/',
{'main_alliance_id__exact': self.character_1.alliance_id}
)
- request.user = self.user_1
+ request.user = self.user_1
changelist = my_modeladmin.get_changelist_instance(request)
queryset = changelist.get_queryset(request)
expected = [self.user_1]
@@ -468,7 +468,7 @@ class TestUserAdmin(TestCaseWithTestData):
username='superuser', password='secret', email='admin@example.com'
)
c = Client()
- c.login(username='superuser', password='secret')
+ c.login(username='superuser', password='secret')
response = c.get(get_admin_change_view_url(self.user_1))
self.assertEqual(response.status_code, 200)
@@ -485,8 +485,8 @@ class TestMakeServicesHooksActions(TestCaseWithTestData):
def __init__(self):
super().__init__()
- self.name = 'My Service A'
-
+ self.name = 'My Service A'
+
def update_groups(self, user):
pass
@@ -498,7 +498,7 @@ class TestMakeServicesHooksActions(TestCaseWithTestData):
def __init__(self):
super().__init__()
self.name = 'My Service B'
-
+
def update_groups(self, user):
pass
@@ -510,32 +510,32 @@ class TestMakeServicesHooksActions(TestCaseWithTestData):
def sync_nicknames_bulk(self, user):
pass
-
- def test_service_has_update_groups_only(self):
+
+ def test_service_has_update_groups_only(self):
service = self.MyServicesHookTypeA()
- mock_service = MagicMock(spec=service)
+ mock_service = MagicMock(spec=service)
action = make_service_hooks_update_groups_action(mock_service)
action(MagicMock(), MagicMock(), [self.user_1])
self.assertTrue(mock_service.update_groups.called)
- def test_service_has_update_groups_bulk(self):
+ def test_service_has_update_groups_bulk(self):
service = self.MyServicesHookTypeB()
- mock_service = MagicMock(spec=service)
+ mock_service = MagicMock(spec=service)
action = make_service_hooks_update_groups_action(mock_service)
action(MagicMock(), MagicMock(), [self.user_1])
self.assertFalse(mock_service.update_groups.called)
self.assertTrue(mock_service.update_groups_bulk.called)
- def test_service_has_sync_nickname_only(self):
+ def test_service_has_sync_nickname_only(self):
service = self.MyServicesHookTypeA()
- mock_service = MagicMock(spec=service)
+ mock_service = MagicMock(spec=service)
action = make_service_hooks_sync_nickname_action(mock_service)
action(MagicMock(), MagicMock(), [self.user_1])
self.assertTrue(mock_service.sync_nickname.called)
- def test_service_has_sync_nicknames_bulk(self):
+ def test_service_has_sync_nicknames_bulk(self):
service = self.MyServicesHookTypeB()
- mock_service = MagicMock(spec=service)
+ mock_service = MagicMock(spec=service)
action = make_service_hooks_sync_nickname_action(mock_service)
action(MagicMock(), MagicMock(), [self.user_1])
self.assertFalse(mock_service.sync_nickname.called)
diff --git a/allianceauth/authentication/tests/test_app_settings.py b/allianceauth/authentication/tests/test_app_settings.py
index f941e411..8fa9d368 100644
--- a/allianceauth/authentication/tests/test_app_settings.py
+++ b/allianceauth/authentication/tests/test_app_settings.py
@@ -9,19 +9,19 @@ MODULE_PATH = 'allianceauth.authentication'
class TestSetAppSetting(TestCase):
@patch(MODULE_PATH + '.app_settings.settings')
- def test_default_if_not_set(self, mock_settings):
+ def test_default_if_not_set(self, mock_settings):
mock_settings.TEST_SETTING_DUMMY = Mock(spec=None)
result = app_settings._clean_setting(
- 'TEST_SETTING_DUMMY',
- False,
+ 'TEST_SETTING_DUMMY',
+ False,
)
self.assertEqual(result, False)
@patch(MODULE_PATH + '.app_settings.settings')
- def test_default_if_not_set_for_none(self, mock_settings):
+ def test_default_if_not_set_for_none(self, mock_settings):
mock_settings.TEST_SETTING_DUMMY = Mock(spec=None)
result = app_settings._clean_setting(
- 'TEST_SETTING_DUMMY',
+ 'TEST_SETTING_DUMMY',
None,
required_type=int
)
@@ -31,8 +31,8 @@ class TestSetAppSetting(TestCase):
def test_true_stays_true(self, mock_settings):
mock_settings.TEST_SETTING_DUMMY = True
result = app_settings._clean_setting(
- 'TEST_SETTING_DUMMY',
- False,
+ 'TEST_SETTING_DUMMY',
+ False,
)
self.assertEqual(result, True)
@@ -40,7 +40,7 @@ class TestSetAppSetting(TestCase):
def test_false_stays_false(self, mock_settings):
mock_settings.TEST_SETTING_DUMMY = False
result = app_settings._clean_setting(
- 'TEST_SETTING_DUMMY',
+ 'TEST_SETTING_DUMMY',
False
)
self.assertEqual(result, False)
@@ -49,7 +49,7 @@ class TestSetAppSetting(TestCase):
def test_default_for_invalid_type_bool(self, mock_settings):
mock_settings.TEST_SETTING_DUMMY = 'invalid type'
result = app_settings._clean_setting(
- 'TEST_SETTING_DUMMY',
+ 'TEST_SETTING_DUMMY',
False
)
self.assertEqual(result, False)
@@ -58,7 +58,7 @@ class TestSetAppSetting(TestCase):
def test_default_for_invalid_type_int(self, mock_settings):
mock_settings.TEST_SETTING_DUMMY = 'invalid type'
result = app_settings._clean_setting(
- 'TEST_SETTING_DUMMY',
+ 'TEST_SETTING_DUMMY',
50
)
self.assertEqual(result, 50)
@@ -67,7 +67,7 @@ class TestSetAppSetting(TestCase):
def test_default_if_below_minimum_1(self, mock_settings):
mock_settings.TEST_SETTING_DUMMY = -5
result = app_settings._clean_setting(
- 'TEST_SETTING_DUMMY',
+ 'TEST_SETTING_DUMMY',
default_value=50
)
self.assertEqual(result, 50)
@@ -76,7 +76,7 @@ class TestSetAppSetting(TestCase):
def test_default_if_below_minimum_2(self, mock_settings):
mock_settings.TEST_SETTING_DUMMY = -50
result = app_settings._clean_setting(
- 'TEST_SETTING_DUMMY',
+ 'TEST_SETTING_DUMMY',
default_value=50,
min_value=-10
)
@@ -86,7 +86,7 @@ class TestSetAppSetting(TestCase):
def test_default_for_invalid_type_int(self, mock_settings):
mock_settings.TEST_SETTING_DUMMY = 1000
result = app_settings._clean_setting(
- 'TEST_SETTING_DUMMY',
+ 'TEST_SETTING_DUMMY',
default_value=50,
max_value=100
)
@@ -97,6 +97,6 @@ class TestSetAppSetting(TestCase):
mock_settings.TEST_SETTING_DUMMY = 'invalid type'
with self.assertRaises(ValueError):
result = app_settings._clean_setting(
- 'TEST_SETTING_DUMMY',
+ 'TEST_SETTING_DUMMY',
default_value=None
)
diff --git a/allianceauth/authentication/tests/test_backend.py b/allianceauth/authentication/tests/test_backend.py
index 2a846c7c..701dfaa6 100644
--- a/allianceauth/authentication/tests/test_backend.py
+++ b/allianceauth/authentication/tests/test_backend.py
@@ -23,27 +23,27 @@ class TestStatePermissions(TestCase):
self.permission_2 = AuthUtils.get_permission_by_name(PERMISSION_2)
# group
- self.group_1 = Group.objects.create(name="Group 1")
+ self.group_1 = Group.objects.create(name="Group 1")
self.group_2 = Group.objects.create(name="Group 2")
# state
- self.state_1 = AuthUtils.get_member_state()
+ self.state_1 = AuthUtils.get_member_state()
self.state_2 = AuthUtils.create_state("Other State", 75)
-
+
# user
self.user = AuthUtils.create_user("Bruce Wayne")
self.main = AuthUtils.add_main_character_2(self.user, self.user.username, 123)
def test_user_has_user_permissions(self):
self.user.user_permissions.add(self.permission_1)
-
+
user = User.objects.get(pk=self.user.pk)
self.assertTrue(user.has_perm(PERMISSION_1))
- def test_user_has_group_permissions(self):
+ def test_user_has_group_permissions(self):
self.group_1.permissions.add(self.permission_1)
self.user.groups.add(self.group_1)
-
+
user = User.objects.get(pk=self.user.pk)
self.assertTrue(user.has_perm(PERMISSION_1))
@@ -55,7 +55,7 @@ class TestStatePermissions(TestCase):
self.assertTrue(user.has_perm(PERMISSION_1))
def test_when_user_changes_state_perms_change_accordingly(self):
- self.state_1.permissions.add(self.permission_1)
+ self.state_1.permissions.add(self.permission_1)
self.state_1.member_characters.add(self.main)
user = User.objects.get(pk=self.user.pk)
self.assertTrue(user.has_perm(PERMISSION_1))
@@ -68,16 +68,16 @@ class TestStatePermissions(TestCase):
self.assertTrue(user.has_perm(PERMISSION_2))
def test_state_permissions_are_returned_for_current_user_object(self):
- # verify state permissions are returns for the current user object
- # and not for it's instance in the database, which might be outdated
+ # verify state permissions are returns for the current user object
+ # and not for it's instance in the database, which might be outdated
self.state_1.permissions.add(self.permission_1)
- self.state_2.permissions.add(self.permission_2)
+ self.state_2.permissions.add(self.permission_2)
self.state_1.member_characters.add(self.main)
user = User.objects.get(pk=self.user.pk)
user.profile.state = self.state_2
self.assertFalse(user.has_perm(PERMISSION_1))
self.assertTrue(user.has_perm(PERMISSION_2))
-
+
class TestAuthenticate(TestCase):
@classmethod
diff --git a/allianceauth/authentication/tests/test_templatetags.py b/allianceauth/authentication/tests/test_templatetags.py
index 57b315b6..5409f840 100644
--- a/allianceauth/authentication/tests/test_templatetags.py
+++ b/allianceauth/authentication/tests/test_templatetags.py
@@ -10,9 +10,9 @@ from django.test import TestCase
from allianceauth.templatetags.admin_status import (
status_overview,
_fetch_list_from_gitlab,
- _current_notifications,
- _current_version_summary,
- _fetch_notification_issues_from_gitlab,
+ _current_notifications,
+ _current_version_summary,
+ _fetch_notification_issues_from_gitlab,
_latests_versions
)
@@ -58,10 +58,10 @@ class TestStatusOverviewTag(TestCase):
@patch(MODULE_PATH + '.admin_status.__version__', TEST_VERSION)
@patch(MODULE_PATH + '.admin_status._fetch_celery_queue_length')
@patch(MODULE_PATH + '.admin_status._current_version_summary')
- @patch(MODULE_PATH + '.admin_status._current_notifications')
+ @patch(MODULE_PATH + '.admin_status._current_notifications')
def test_status_overview(
- self,
- mock_current_notifications,
+ self,
+ mock_current_notifications,
mock_current_version_info,
mock_fetch_celery_queue_length
):
@@ -82,7 +82,7 @@ class TestStatusOverviewTag(TestCase):
}
mock_current_version_info.return_value = version_info
mock_fetch_celery_queue_length.return_value = 3
-
+
result = status_overview()
expected = {
'notifications': GITHUB_NOTIFICATION_ISSUES[:5],
@@ -111,7 +111,7 @@ class TestNotifications(TestCase):
url = (
'https://gitlab.com/api/v4/projects/allianceauth%2Fallianceauth/issues'
'?labels=announcement'
- )
+ )
requests_mocker.get(url, json=GITHUB_NOTIFICATION_ISSUES)
# when
result = _fetch_notification_issues_from_gitlab()
@@ -127,13 +127,13 @@ class TestNotifications(TestCase):
# then
self.assertEqual(result['notifications'], GITHUB_NOTIFICATION_ISSUES[:5])
- @requests_mock.mock()
+ @requests_mock.mock()
def test_current_notifications_failed(self, requests_mocker):
# given
url = (
'https://gitlab.com/api/v4/projects/allianceauth%2Fallianceauth/issues'
'?labels=announcement'
- )
+ )
requests_mocker.get(url, status_code=404)
# when
result = _current_notifications()
@@ -163,7 +163,7 @@ class TestVersionTags(TestCase):
@patch(MODULE_PATH + '.admin_status.__version__', TEST_VERSION)
@patch(MODULE_PATH + '.admin_status.cache')
- def test_current_version_info_normal(self, mock_cache):
+ def test_current_version_info_normal(self, mock_cache):
# given
mock_cache.get_or_set.return_value = GITHUB_TAGS
# when
@@ -184,7 +184,7 @@ class TestVersionTags(TestCase):
url = (
'https://gitlab.com/api/v4/projects/allianceauth%2Fallianceauth'
'/repository/tags'
- )
+ )
requests_mocker.get(url, status_code=500)
# when
result = _current_version_summary()
@@ -197,7 +197,7 @@ class TestVersionTags(TestCase):
url = (
'https://gitlab.com/api/v4/projects/allianceauth%2Fallianceauth'
'/repository/tags'
- )
+ )
requests_mocker.get(url, json=GITHUB_TAGS)
# when
result = _current_version_summary()
@@ -208,7 +208,7 @@ class TestVersionTags(TestCase):
@patch(MODULE_PATH + '.admin_status.cache')
def test_current_version_info_return_no_data(self, mock_cache):
# given
- mock_cache.get_or_set.return_value = None
+ mock_cache.get_or_set.return_value = None
# when
result = _current_version_summary()
# then
@@ -218,7 +218,7 @@ class TestVersionTags(TestCase):
class TestLatestsVersion(TestCase):
def test_all_version_types_defined(self):
-
+
tags = create_tags_list(
['2.1.1', '2.1.0', '2.0.0', '2.1.1a1', '1.1.1', '1.1.0', '1.0.0']
)
@@ -229,7 +229,7 @@ class TestLatestsVersion(TestCase):
self.assertEqual(beta, Pep440Version('2.1.1a1'))
def test_major_and_minor_not_defined_with_zero(self):
-
+
tags = create_tags_list(
['2.1.2', '2.1.1', '2.0.1', '2.1.1a1', '1.1.1', '1.1.0', '1.0.0']
)
@@ -238,9 +238,9 @@ class TestLatestsVersion(TestCase):
self.assertEqual(minor, Pep440Version('2.1.1'))
self.assertEqual(patch, Pep440Version('2.1.2'))
self.assertEqual(beta, Pep440Version('2.1.1a1'))
-
+
def test_can_ignore_invalid_versions(self):
-
+
tags = create_tags_list(
['2.1.1', '2.1.0', '2.0.0', '2.1.1a1', 'invalid']
)
@@ -252,9 +252,9 @@ class TestLatestsVersion(TestCase):
class TestFetchListFromGitlab(TestCase):
-
+
page_size = 2
-
+
def setUp(self):
self.url = (
'https://gitlab.com/api/v4/projects/allianceauth%2Fallianceauth'
@@ -266,8 +266,8 @@ class TestFetchListFromGitlab(TestCase):
page = int(request.qs['page'][0])
start = (page - 1) * cls.page_size
end = start + cls.page_size
- return GITHUB_TAGS[start:end]
-
+ return GITHUB_TAGS[start:end]
+
@requests_mock.mock()
def test_can_fetch_one_page_with_header(self, requests_mocker):
headers = {
@@ -279,7 +279,7 @@ class TestFetchListFromGitlab(TestCase):
self.assertEqual(requests_mocker.call_count, 1)
@requests_mock.mock()
- def test_can_fetch_one_page_wo_header(self, requests_mocker):
+ def test_can_fetch_one_page_wo_header(self, requests_mocker):
requests_mocker.get(self.url, json=GITHUB_TAGS)
result = _fetch_list_from_gitlab(self.url)
self.assertEqual(result, GITHUB_TAGS)
@@ -296,7 +296,7 @@ class TestFetchListFromGitlab(TestCase):
self.assertEqual(requests_mocker.call_count, 1)
@requests_mock.mock()
- def test_can_fetch_multiple_pages(self, requests_mocker):
+ def test_can_fetch_multiple_pages(self, requests_mocker):
total_pages = ceil(len(GITHUB_TAGS) / self.page_size)
headers = {
'x-total-pages': str(total_pages)
@@ -307,7 +307,7 @@ class TestFetchListFromGitlab(TestCase):
self.assertEqual(requests_mocker.call_count, total_pages)
@requests_mock.mock()
- def test_can_fetch_given_number_of_pages_only(self, requests_mocker):
+ def test_can_fetch_given_number_of_pages_only(self, requests_mocker):
total_pages = ceil(len(GITHUB_TAGS) / self.page_size)
headers = {
'x-total-pages': str(total_pages)
diff --git a/allianceauth/authentication/urls.py b/allianceauth/authentication/urls.py
index 11fee0b9..3f917f45 100644
--- a/allianceauth/authentication/urls.py
+++ b/allianceauth/authentication/urls.py
@@ -9,8 +9,8 @@ app_name = 'authentication'
urlpatterns = [
url(r'^$', views.index, name='index'),
url(
- r'^account/login/$',
- TemplateView.as_view(template_name='public/login.html'),
+ r'^account/login/$',
+ TemplateView.as_view(template_name='public/login.html'),
name='login'
),
url(
@@ -19,9 +19,9 @@ urlpatterns = [
name='change_main_character'
),
url(
- r'^account/characters/add/$',
- views.add_character,
+ r'^account/characters/add/$',
+ views.add_character,
name='add_character'
- ),
+ ),
url(r'^dashboard/$', views.dashboard, name='dashboard'),
]
diff --git a/allianceauth/authentication/views.py b/allianceauth/authentication/views.py
index 7645193b..f2cce9a4 100644
--- a/allianceauth/authentication/views.py
+++ b/allianceauth/authentication/views.py
@@ -16,8 +16,8 @@ from esi.decorators import token_required
from esi.models import Token
from django_registration.backends.activation.views import (
- RegistrationView as BaseRegistrationView,
- ActivationView as BaseActivationView,
+ RegistrationView as BaseRegistrationView,
+ ActivationView as BaseActivationView,
REGISTRATION_SALT
)
from django_registration.signals import user_registered
@@ -52,7 +52,7 @@ def dashboard(request):
.filter(character_ownership__user=request.user)\
.select_related()\
.order_by('character_name')
-
+
context = {
'groups': groups,
'characters': characters
@@ -71,7 +71,7 @@ def main_character_change(request, token):
co = CharacterOwnership.objects.create_by_token(token)
else:
messages.error(
- request,
+ request,
_('Cannot change main character to %(char)s: character owned by a different account.') % ({'char': token.character_name})
)
co = None
@@ -138,7 +138,7 @@ class RegistrationView(BaseRegistrationView):
template_name = "public/register.html"
email_body_template = "registration/activation_email.txt"
email_subject_template = "registration/activation_email_subject.txt"
- success_url = reverse_lazy('registration_complete')
+ success_url = reverse_lazy('registration_complete')
def get_success_url(self, user):
if not getattr(settings, 'REGISTRATION_VERIFY_EMAIL', True):
@@ -181,8 +181,8 @@ class RegistrationView(BaseRegistrationView):
# Step 3
class ActivationView(BaseActivationView):
template_name = "registration/activate.html"
- success_url = reverse_lazy('registration_activation_complete')
-
+ success_url = reverse_lazy('registration_activation_complete')
+
def validate_key(self, activation_key):
try:
dump = signing.loads(activation_key, salt=REGISTRATION_SALT,
diff --git a/allianceauth/corputils/managers.py b/allianceauth/corputils/managers.py
index 640cf170..8607b613 100644
--- a/allianceauth/corputils/managers.py
+++ b/allianceauth/corputils/managers.py
@@ -37,7 +37,7 @@ class CorpStatsQuerySet(models.QuerySet):
return self.filter(query)
except AssertionError:
logger.debug('User %s has no main character. No corpstats visible.' % user)
- return self.none()
+ return self.none()
class CorpStatsManager(models.Manager):
diff --git a/allianceauth/eveonline/admin.py b/allianceauth/eveonline/admin.py
index 9c0447a1..1333fa9d 100644
--- a/allianceauth/eveonline/admin.py
+++ b/allianceauth/eveonline/admin.py
@@ -97,7 +97,7 @@ class EveAllianceForm(EveEntityForm):
@admin.register(EveCorporationInfo)
class EveCorporationInfoAdmin(admin.ModelAdmin):
search_fields = ['corporation_name']
- list_display = ('corporation_name', 'alliance')
+ list_display = ('corporation_name', 'alliance')
list_select_related = ('alliance',)
list_filter = (('alliance', admin.RelatedOnlyFieldListFilter),)
ordering = ('corporation_name',)
@@ -114,9 +114,9 @@ class EveCorporationInfoAdmin(admin.ModelAdmin):
@admin.register(EveAllianceInfo)
class EveAllianceInfoAdmin(admin.ModelAdmin):
search_fields = ['alliance_name']
- list_display = ('alliance_name',)
+ list_display = ('alliance_name',)
ordering = ('alliance_name',)
-
+
def has_change_permission(self, request, obj=None):
return False
@@ -129,9 +129,9 @@ class EveAllianceInfoAdmin(admin.ModelAdmin):
@admin.register(EveCharacter)
class EveCharacterAdmin(admin.ModelAdmin):
search_fields = [
- 'character_name',
- 'corporation_name',
- 'alliance_name',
+ 'character_name',
+ 'corporation_name',
+ 'alliance_name',
'character_ownership__user__username'
]
list_display = (
@@ -141,10 +141,10 @@ class EveCharacterAdmin(admin.ModelAdmin):
'character_ownership', 'character_ownership__user__profile__main_character'
)
list_filter = (
- 'corporation_name',
- 'alliance_name',
+ 'corporation_name',
+ 'alliance_name',
(
- 'character_ownership__user__profile__main_character',
+ 'character_ownership__user__profile__main_character',
admin.RelatedOnlyFieldListFilter
),
)
diff --git a/allianceauth/eveonline/autogroups/tests/test_managers.py b/allianceauth/eveonline/autogroups/tests/test_managers.py
index ebf5eb02..e4e42ef0 100644
--- a/allianceauth/eveonline/autogroups/tests/test_managers.py
+++ b/allianceauth/eveonline/autogroups/tests/test_managers.py
@@ -44,7 +44,7 @@ class AutogroupsConfigManagerTestCase(TestCase):
with patch('.models.AutogroupsConfig.update_group_membership_for_user') \
as update_group_membership_for_user:
AutogroupsConfig.objects.update_groups_for_user(
- user=member,
+ user=member,
state=member.profile.state
)
diff --git a/allianceauth/eveonline/autogroups/tests/test_models.py b/allianceauth/eveonline/autogroups/tests/test_models.py
index 44917d3c..45044608 100644
--- a/allianceauth/eveonline/autogroups/tests/test_models.py
+++ b/allianceauth/eveonline/autogroups/tests/test_models.py
@@ -52,8 +52,8 @@ class AutogroupsConfigTestCase(TestCase):
@patch('.models.AutogroupsConfig.update_alliance_group_membership')
@patch('.models.AutogroupsConfig.update_corp_group_membership')
def test_update_group_membership_for_user(
- self,
- update_corp,
+ self,
+ update_corp,
update_alliance
):
agc = AutogroupsConfig.objects.create()
@@ -123,9 +123,9 @@ class AutogroupsConfigTestCase(TestCase):
alliance_ticker='alliance_ticker',
executor_corp_id='2345'
)
-
+
mock_create_alliance.side_effect = mock_create_alliance_side_effect
-
+
obj = AutogroupsConfig.objects.create(alliance_groups=True)
obj.states.add(AuthUtils.get_member_state())
char = EveCharacter.objects.create(
@@ -140,7 +140,7 @@ class AutogroupsConfigTestCase(TestCase):
self.member.profile.main_character = char
self.member.profile.save()
- # Act
+ # Act
obj.update_alliance_group_membership(self.member)
group = obj.get_alliance_group(self.alliance)
diff --git a/allianceauth/eveonline/evelinks/__init__.py b/allianceauth/eveonline/evelinks/__init__.py
index 2fb4f6b8..6f725dfd 100644
--- a/allianceauth/eveonline/evelinks/__init__.py
+++ b/allianceauth/eveonline/evelinks/__init__.py
@@ -1,4 +1,4 @@
-# this package generates profile URL for eve entities
+# this package generates profile URL for eve entities
# on 3rd party websites like evewho and zKillboard
#
# It contains of modules for views and templatetags for templates
diff --git a/allianceauth/eveonline/evelinks/dotlan.py b/allianceauth/eveonline/evelinks/dotlan.py
index ebd0e7bd..b782eabd 100644
--- a/allianceauth/eveonline/evelinks/dotlan.py
+++ b/allianceauth/eveonline/evelinks/dotlan.py
@@ -3,9 +3,9 @@
from urllib.parse import urljoin, quote
from . import (
- _ESI_CATEGORY_ALLIANCE,
- _ESI_CATEGORY_CORPORATION,
- _ESI_CATEGORY_REGION,
+ _ESI_CATEGORY_ALLIANCE,
+ _ESI_CATEGORY_CORPORATION,
+ _ESI_CATEGORY_REGION,
_ESI_CATEGORY_SOLARSYSTEM
)
@@ -15,28 +15,28 @@ _BASE_URL = 'http://evemaps.dotlan.net'
def _build_url(category: str, name: str) -> str:
"""return url to profile page for an eve entity"""
-
- if category == _ESI_CATEGORY_ALLIANCE:
+
+ if category == _ESI_CATEGORY_ALLIANCE:
partial = 'alliance'
- elif category == _ESI_CATEGORY_CORPORATION:
+ elif category == _ESI_CATEGORY_CORPORATION:
partial = 'corp'
elif category == _ESI_CATEGORY_REGION:
partial = 'map'
-
+
elif category == _ESI_CATEGORY_SOLARSYSTEM:
partial = 'system'
-
+
else:
raise NotImplementedError(
"Not implemented yet for category:" + category
)
-
+
url = urljoin(
_BASE_URL,
'{}/{}'.format(partial, quote(str(name).replace(" ", "_")))
-
+
)
return url
diff --git a/allianceauth/eveonline/evelinks/eveimageserver.py b/allianceauth/eveonline/evelinks/eveimageserver.py
index d3323446..d2f51c27 100644
--- a/allianceauth/eveonline/evelinks/eveimageserver.py
+++ b/allianceauth/eveonline/evelinks/eveimageserver.py
@@ -1,7 +1,7 @@
from . import (
- _ESI_CATEGORY_ALLIANCE,
- _ESI_CATEGORY_CHARACTER,
- _ESI_CATEGORY_CORPORATION,
+ _ESI_CATEGORY_ALLIANCE,
+ _ESI_CATEGORY_CHARACTER,
+ _ESI_CATEGORY_CORPORATION,
_ESI_CATEGORY_INVENTORYTYPE
)
@@ -10,7 +10,7 @@ _EVE_IMAGE_SERVER_URL = 'https://images.evetech.net'
_DEFAULT_IMAGE_SIZE = 32
-def _eve_entity_image_url(
+def _eve_entity_image_url(
category: str,
entity_id: int,
size: int = 32,
@@ -19,7 +19,7 @@ def _eve_entity_image_url(
) -> str:
"""returns image URL for an Eve Online ID.
Supported categories: alliance, corporation, character, inventory_type
-
+
Arguments:
- category: category of the ID, see ESI category constants
- entity_id: Eve ID of the entity
@@ -33,7 +33,7 @@ def _eve_entity_image_url(
Exceptions:
- Throws ValueError on invalid input
"""
-
+
# input validations
categories = {
_ESI_CATEGORY_ALLIANCE: {
@@ -54,15 +54,15 @@ def _eve_entity_image_url(
}
}
tenants = ['tranquility', 'singularity']
-
+
if not entity_id:
raise ValueError('Invalid entity_id: {}'.format(entity_id))
else:
entity_id = int(entity_id)
-
+
if not size or size < 32 or size > 1024 or (size & (size - 1) != 0):
raise ValueError('Invalid size: {}'.format(size))
-
+
if category not in categories:
raise ValueError('Invalid category {}'.format(category))
else:
@@ -79,7 +79,7 @@ def _eve_entity_image_url(
if tenant and tenant not in tenants:
raise ValueError('Invalid tenant {}'.format(tenant))
-
+
# compose result URL
result = '{}/{}/{}/{}?size={}'.format(
_EVE_IMAGE_SERVER_URL,
@@ -90,7 +90,7 @@ def _eve_entity_image_url(
)
if tenant:
result += '&tenant={}'.format(tenant)
-
+
return result
diff --git a/allianceauth/eveonline/evelinks/evewho.py b/allianceauth/eveonline/evelinks/evewho.py
index 57d748ac..3062ba45 100644
--- a/allianceauth/eveonline/evelinks/evewho.py
+++ b/allianceauth/eveonline/evelinks/evewho.py
@@ -3,9 +3,9 @@
from urllib.parse import urljoin
from . import (
- _ESI_CATEGORY_ALLIANCE,
- _ESI_CATEGORY_CORPORATION,
- _ESI_CATEGORY_CHARACTER,
+ _ESI_CATEGORY_ALLIANCE,
+ _ESI_CATEGORY_CORPORATION,
+ _ESI_CATEGORY_CHARACTER,
)
@@ -14,21 +14,21 @@ _BASE_URL = 'https://evewho.com'
def _build_url(category: str, eve_id: int) -> str:
"""return url to profile page for an eve entity"""
-
- if category == _ESI_CATEGORY_ALLIANCE:
+
+ if category == _ESI_CATEGORY_ALLIANCE:
partial = 'alliance'
- elif category == _ESI_CATEGORY_CORPORATION:
+ elif category == _ESI_CATEGORY_CORPORATION:
partial = 'corporation'
elif category == _ESI_CATEGORY_CHARACTER:
partial = 'character'
-
+
else:
raise NotImplementedError(
"Not implemented yet for category:" + category
)
-
+
url = urljoin(
_BASE_URL,
'{}/{}'.format(partial, int(eve_id))
diff --git a/allianceauth/eveonline/evelinks/tests/test_evelinks.py b/allianceauth/eveonline/evelinks/tests/test_evelinks.py
index a9baeb93..7897bb6a 100644
--- a/allianceauth/eveonline/evelinks/tests/test_evelinks.py
+++ b/allianceauth/eveonline/evelinks/tests/test_evelinks.py
@@ -12,12 +12,12 @@ class TestEveWho(TestCase):
evewho.alliance_url(12345678),
'https://evewho.com/alliance/12345678'
)
-
+
def test_corporation_url(self):
self.assertEqual(
evewho.corporation_url(12345678),
'https://evewho.com/corporation/12345678'
- )
+ )
def test_character_url(self):
self.assertEqual(
@@ -49,7 +49,7 @@ class TestDotlan(TestCase):
dotlan.region_url('Black Rise'),
'http://evemaps.dotlan.net/map/Black_Rise'
)
-
+
def test_solar_system_url(self):
self.assertEqual(
dotlan.solar_system_url('Jita'),
@@ -69,14 +69,14 @@ class TestZkillboard(TestCase):
self.assertEqual(
zkillboard.corporation_url(12345678),
'https://zkillboard.com/corporation/12345678/'
- )
+ )
def test_character_url(self):
self.assertEqual(
zkillboard.character_url(12345678),
'https://zkillboard.com/character/12345678/'
)
-
+
def test_region_url(self):
self.assertEqual(
@@ -93,34 +93,34 @@ class TestZkillboard(TestCase):
class TestEveImageServer(TestCase):
"""unit test for eveimageserver"""
-
- def test_sizes(self):
+
+ def test_sizes(self):
self.assertEqual(
- eveimageserver._eve_entity_image_url('character', 42),
+ eveimageserver._eve_entity_image_url('character', 42),
'https://images.evetech.net/characters/42/portrait?size=32'
)
self.assertEqual(
- eveimageserver._eve_entity_image_url('character', 42, size=32),
+ eveimageserver._eve_entity_image_url('character', 42, size=32),
'https://images.evetech.net/characters/42/portrait?size=32'
)
self.assertEqual(
- eveimageserver._eve_entity_image_url('character', 42, size=64),
+ eveimageserver._eve_entity_image_url('character', 42, size=64),
'https://images.evetech.net/characters/42/portrait?size=64'
)
self.assertEqual(
- eveimageserver._eve_entity_image_url('character', 42, size=128),
+ eveimageserver._eve_entity_image_url('character', 42, size=128),
'https://images.evetech.net/characters/42/portrait?size=128'
)
self.assertEqual(
- eveimageserver._eve_entity_image_url('character', 42, size=256),
+ eveimageserver._eve_entity_image_url('character', 42, size=256),
'https://images.evetech.net/characters/42/portrait?size=256'
)
self.assertEqual(
- eveimageserver._eve_entity_image_url('character', 42, size=512),
+ eveimageserver._eve_entity_image_url('character', 42, size=512),
'https://images.evetech.net/characters/42/portrait?size=512'
)
self.assertEqual(
- eveimageserver._eve_entity_image_url('character', 42, size=1024),
+ eveimageserver._eve_entity_image_url('character', 42, size=1024),
'https://images.evetech.net/characters/42/portrait?size=1024'
)
with self.assertRaises(ValueError):
@@ -128,10 +128,10 @@ class TestEveImageServer(TestCase):
with self.assertRaises(ValueError):
eveimageserver._eve_entity_image_url('corporation', 42, size=0)
-
+
with self.assertRaises(ValueError):
eveimageserver._eve_entity_image_url('corporation', 42, size=31)
-
+
with self.assertRaises(ValueError):
eveimageserver._eve_entity_image_url('corporation', 42, size=1025)
@@ -141,28 +141,28 @@ class TestEveImageServer(TestCase):
def test_variant(self):
self.assertEqual(
- eveimageserver._eve_entity_image_url('character', 42, variant='portrait'),
+ eveimageserver._eve_entity_image_url('character', 42, variant='portrait'),
'https://images.evetech.net/characters/42/portrait?size=32'
)
self.assertEqual(
- eveimageserver._eve_entity_image_url('alliance', 42, variant='logo'),
+ eveimageserver._eve_entity_image_url('alliance', 42, variant='logo'),
'https://images.evetech.net/alliances/42/logo?size=32'
)
with self.assertRaises(ValueError):
eveimageserver._eve_entity_image_url('character', 42, variant='logo')
-
+
def test_alliance(self):
self.assertEqual(
- eveimageserver._eve_entity_image_url('alliance', 42),
+ eveimageserver._eve_entity_image_url('alliance', 42),
'https://images.evetech.net/alliances/42/logo?size=32'
)
self.assertEqual(
- eveimageserver._eve_entity_image_url('corporation', 42),
+ eveimageserver._eve_entity_image_url('corporation', 42),
'https://images.evetech.net/corporations/42/logo?size=32'
)
self.assertEqual(
- eveimageserver._eve_entity_image_url('character', 42),
+ eveimageserver._eve_entity_image_url('character', 42),
'https://images.evetech.net/characters/42/portrait?size=32'
)
with self.assertRaises(ValueError):
@@ -171,16 +171,16 @@ class TestEveImageServer(TestCase):
def test_tenants(self):
self.assertEqual(
- eveimageserver._eve_entity_image_url('character', 42, tenant='tranquility'),
+ eveimageserver._eve_entity_image_url('character', 42, tenant='tranquility'),
'https://images.evetech.net/characters/42/portrait?size=32&tenant=tranquility'
)
self.assertEqual(
- eveimageserver._eve_entity_image_url('character', 42, tenant='singularity'),
+ eveimageserver._eve_entity_image_url('character', 42, tenant='singularity'),
'https://images.evetech.net/characters/42/portrait?size=32&tenant=singularity'
)
with self.assertRaises(ValueError):
eveimageserver._eve_entity_image_url('character', 42, tenant='xxx')
-
+
def test_alliance_logo_url(self):
expected = 'https://images.evetech.net/alliances/42/logo?size=128'
self.assertEqual(eveimageserver.alliance_logo_url(42, 128), expected)
diff --git a/allianceauth/eveonline/evelinks/tests/test_templatetags.py b/allianceauth/eveonline/evelinks/tests/test_templatetags.py
index 4fb8327a..fae25747 100644
--- a/allianceauth/eveonline/evelinks/tests/test_templatetags.py
+++ b/allianceauth/eveonline/evelinks/tests/test_templatetags.py
@@ -38,15 +38,15 @@ class TestTemplateTags(TestCase):
member_count=42,
alliance=self.my_alliance
)
-
+
self.my_region_id = 8001
self.my_region_name = 'Southpark'
-
+
self.my_solar_system_id = 9001
self.my_solar_system_name = 'Gotham'
-
- def test_evewho_character_url(self):
+
+ def test_evewho_character_url(self):
self.assertEqual(
evelinks.evewho_character_url(self.my_character),
evewho.character_url(self.my_character.character_id),
@@ -59,9 +59,9 @@ class TestTemplateTags(TestCase):
evelinks.evewho_character_url(self.my_character.character_id),
evewho.character_url(self.my_character.character_id),
)
-
-
- def test_evewho_corporation_url(self):
+
+
+ def test_evewho_corporation_url(self):
self.assertEqual(
evelinks.evewho_corporation_url(self.my_character),
evewho.corporation_url(self.my_character.corporation_id),
@@ -80,7 +80,7 @@ class TestTemplateTags(TestCase):
)
- def test_evewho_alliance_url(self):
+ def test_evewho_alliance_url(self):
self.assertEqual(
evelinks.evewho_alliance_url(self.my_character),
evewho.alliance_url(self.my_character.alliance_id),
@@ -100,12 +100,12 @@ class TestTemplateTags(TestCase):
self.assertEqual(
evelinks.evewho_alliance_url(self.my_character.alliance_id),
evewho.alliance_url(self.my_character.alliance_id),
- )
+ )
+
-
# dotlan
-
- def test_dotlan_corporation_url(self):
+
+ def test_dotlan_corporation_url(self):
self.assertEqual(
evelinks.dotlan_corporation_url(self.my_character),
dotlan.corporation_url(self.my_character.corporation_name),
@@ -121,10 +121,10 @@ class TestTemplateTags(TestCase):
self.assertEqual(
evelinks.dotlan_corporation_url(self.my_character.corporation_name),
dotlan.corporation_url(self.my_character.corporation_name),
- )
+ )
- def test_dotlan_alliance_url(self):
+ def test_dotlan_alliance_url(self):
self.assertEqual(
evelinks.dotlan_alliance_url(self.my_character),
dotlan.alliance_url(self.my_character.alliance_name),
@@ -144,32 +144,32 @@ class TestTemplateTags(TestCase):
self.assertEqual(
evelinks.dotlan_alliance_url(self.my_character.alliance_name),
dotlan.alliance_url(self.my_character.alliance_name),
- )
+ )
- def test_dotlan_region_url(self):
+ def test_dotlan_region_url(self):
self.assertEqual(
evelinks.dotlan_region_url(self.my_region_name),
dotlan.region_url(self.my_region_name),
- )
+ )
self.assertEqual(
evelinks.dotlan_region_url(None),
''
- )
+ )
- def test_dotlan_solar_system_url(self):
+ def test_dotlan_solar_system_url(self):
self.assertEqual(
evelinks.dotlan_solar_system_url(self.my_solar_system_name),
dotlan.solar_system_url(self.my_solar_system_name),
- )
+ )
self.assertEqual(
evelinks.dotlan_solar_system_url(None),
''
- )
+ )
+
-
# zkillboard
- def test_zkillboard_character_url(self):
+ def test_zkillboard_character_url(self):
self.assertEqual(
evelinks.zkillboard_character_url(self.my_character),
zkillboard.character_url(self.my_character.character_id),
@@ -182,9 +182,9 @@ class TestTemplateTags(TestCase):
evelinks.zkillboard_character_url(self.my_character.character_id),
zkillboard.character_url(self.my_character.character_id),
)
-
-
- def test_zkillboard_corporation_url(self):
+
+
+ def test_zkillboard_corporation_url(self):
self.assertEqual(
evelinks.zkillboard_corporation_url(self.my_character),
zkillboard.corporation_url(self.my_character.corporation_id),
@@ -200,10 +200,10 @@ class TestTemplateTags(TestCase):
self.assertEqual(
evelinks.zkillboard_corporation_url(self.my_character.corporation_id),
zkillboard.corporation_url(self.my_character.corporation_id),
- )
+ )
- def test_zkillboard_alliance_url(self):
+ def test_zkillboard_alliance_url(self):
self.assertEqual(
evelinks.zkillboard_alliance_url(self.my_character),
zkillboard.alliance_url(self.my_character.alliance_id),
@@ -223,29 +223,29 @@ class TestTemplateTags(TestCase):
self.assertEqual(
evelinks.zkillboard_alliance_url(self.my_character.alliance_id),
zkillboard.alliance_url(self.my_character.alliance_id),
- )
+ )
- def test_zkillboard_region_url(self):
+ def test_zkillboard_region_url(self):
self.assertEqual(
evelinks.zkillboard_region_url(self.my_region_id),
zkillboard.region_url(self.my_region_id),
- )
+ )
self.assertEqual(
evelinks.zkillboard_region_url(None),
''
- )
+ )
- def test_zkillboard_solar_system_url(self):
+ def test_zkillboard_solar_system_url(self):
self.assertEqual(
evelinks.zkillboard_solar_system_url(self.my_solar_system_id),
zkillboard.solar_system_url(self.my_solar_system_id),
- )
+ )
self.assertEqual(
evelinks.zkillboard_solar_system_url(None),
''
- )
+ )
# image URLs
@@ -254,12 +254,12 @@ class TestTemplateTags(TestCase):
self.assertEqual(
evelinks.character_portrait_url(123),
EveCharacter.generic_portrait_url(123)
-
+
),
self.assertEqual(
evelinks.character_portrait_url(123, 128),
EveCharacter.generic_portrait_url(123, 128)
-
+
)
self.assertEqual(
evelinks.character_portrait_url(123, 99),
@@ -267,7 +267,7 @@ class TestTemplateTags(TestCase):
)
self.assertEqual(
evelinks.character_portrait_url(self.my_character),
- self.my_character.portrait_url()
+ self.my_character.portrait_url()
)
self.assertEqual(
evelinks.character_portrait_url(None),
@@ -286,7 +286,7 @@ class TestTemplateTags(TestCase):
)
self.assertEqual(
evelinks.corporation_logo_url(123, 99),
- ''
+ ''
)
self.assertEqual(
evelinks.corporation_logo_url(self.my_corporation),
@@ -303,7 +303,7 @@ class TestTemplateTags(TestCase):
def test_alliance_logo_url(self):
- self.assertEqual(
+ self.assertEqual(
evelinks.alliance_logo_url(123),
EveAllianceInfo.generic_logo_url(123)
),
@@ -314,7 +314,7 @@ class TestTemplateTags(TestCase):
self.assertEqual(
evelinks.alliance_logo_url(123, 99),
''
- )
+ )
self.assertEqual(
evelinks.alliance_logo_url(self.my_alliance),
self.my_alliance.logo_url()
@@ -338,10 +338,10 @@ class TestTemplateTags(TestCase):
expected = eveimageserver.type_icon_url(123, 128)
self.assertEqual(evelinks.type_icon_url(123, 128), expected)
-
+
expected = ''
self.assertEqual(evelinks.type_icon_url(123, 99), expected)
-
+
expected = ''
self.assertEqual(evelinks.type_icon_url(None), expected)
@@ -351,9 +351,9 @@ class TestTemplateTags(TestCase):
expected = eveimageserver.type_render_url(123, 128)
self.assertEqual(evelinks.type_render_url(123, 128), expected)
-
+
expected = ''
self.assertEqual(evelinks.type_render_url(123, 99), expected)
-
+
expected = ''
self.assertEqual(evelinks.type_render_url(None), expected)
\ No newline at end of file
diff --git a/allianceauth/eveonline/evelinks/zkillboard.py b/allianceauth/eveonline/evelinks/zkillboard.py
index 255964b0..0023d071 100644
--- a/allianceauth/eveonline/evelinks/zkillboard.py
+++ b/allianceauth/eveonline/evelinks/zkillboard.py
@@ -3,10 +3,10 @@
from urllib.parse import urljoin
from . import (
- _ESI_CATEGORY_ALLIANCE,
- _ESI_CATEGORY_CORPORATION,
+ _ESI_CATEGORY_ALLIANCE,
+ _ESI_CATEGORY_CORPORATION,
_ESI_CATEGORY_CHARACTER,
- _ESI_CATEGORY_REGION,
+ _ESI_CATEGORY_REGION,
_ESI_CATEGORY_SOLARSYSTEM
)
@@ -16,11 +16,11 @@ _BASE_URL = 'https://zkillboard.com'
def _build_url(category: str, eve_id: int) -> str:
"""return url to profile page for an eve entity"""
-
- if category == _ESI_CATEGORY_ALLIANCE:
+
+ if category == _ESI_CATEGORY_ALLIANCE:
partial = 'alliance'
- elif category == _ESI_CATEGORY_CORPORATION:
+ elif category == _ESI_CATEGORY_CORPORATION:
partial = 'corporation'
elif category == _ESI_CATEGORY_CHARACTER:
@@ -31,12 +31,12 @@ def _build_url(category: str, eve_id: int) -> str:
elif category == _ESI_CATEGORY_SOLARSYSTEM:
partial = 'system'
-
+
else:
raise NotImplementedError(
"Not implemented yet for category:" + category
)
-
+
url = urljoin(
_BASE_URL,
'{}/{}/'.format(partial, int(eve_id))
diff --git a/allianceauth/eveonline/models.py b/allianceauth/eveonline/models.py
index 9a55e4fa..0bb494f5 100644
--- a/allianceauth/eveonline/models.py
+++ b/allianceauth/eveonline/models.py
@@ -51,7 +51,7 @@ class EveAllianceInfo(models.Model):
) -> str:
"""image URL for the given alliance ID"""
return eveimageserver.alliance_logo_url(alliance_id, size)
-
+
def logo_url(self, size: int = _DEFAULT_IMAGE_SIZE) -> str:
"""image URL of this alliance"""
return self.generic_logo_url(self.alliance_id, size)
@@ -224,7 +224,7 @@ class EveCharacter(models.Model):
def portrait_url_128(self) -> str:
"""image URL for this character"""
return self.portrait_url(128)
-
+
@property
def portrait_url_256(self) -> str:
"""image URL for this character"""
@@ -275,7 +275,7 @@ class EveCharacter(models.Model):
def alliance_logo_url_128(self) -> str:
"""image URL for alliance of this character or empty string"""
return self.alliance_logo_url(128)
-
+
@property
def alliance_logo_url_256(self) -> str:
"""image URL for alliance of this character or empty string"""
diff --git a/allianceauth/eveonline/providers.py b/allianceauth/eveonline/providers.py
index dc25ba35..1373c49d 100644
--- a/allianceauth/eveonline/providers.py
+++ b/allianceauth/eveonline/providers.py
@@ -159,7 +159,7 @@ class EveProvider(object):
class EveSwaggerProvider(EveProvider):
- def __init__(self, token=None, adapter=None):
+ def __init__(self, token=None, adapter=None):
if settings.DEBUG:
self._client = None
logger.info(
diff --git a/allianceauth/eveonline/tasks.py b/allianceauth/eveonline/tasks.py
index 5f3f4d42..9562d520 100644
--- a/allianceauth/eveonline/tasks.py
+++ b/allianceauth/eveonline/tasks.py
@@ -40,7 +40,7 @@ def update_character(character_id):
@shared_task
def run_model_update():
"""Update all alliances, corporations and characters from ESI"""
-
+
# update existing corp models
for corp in EveCorporationInfo.objects.all().values('corporation_id'):
update_corp.apply_async(
@@ -54,7 +54,7 @@ def run_model_update():
)
# update existing character models
- character_ids = EveCharacter.objects.all().values_list('character_id', flat=True)
+ character_ids = EveCharacter.objects.all().values_list('character_id', flat=True)
for character_ids_chunk in chunks(character_ids, CHUNK_SIZE):
affiliations_raw = providers.provider.client.Character\
.post_characters_affiliation(characters=character_ids_chunk).result()
@@ -62,39 +62,39 @@ def run_model_update():
.post_universe_names(ids=character_ids_chunk).result()
affiliations = {
- affiliation.get('character_id'): affiliation
+ affiliation.get('character_id'): affiliation
for affiliation in affiliations_raw
}
# add character names to affiliations
- for character in character_names:
+ for character in character_names:
character_id = character.get('id')
if character_id in affiliations:
affiliations[character_id]['name'] = character.get('name')
# fetch current characters
characters = EveCharacter.objects.filter(character_id__in=character_ids_chunk)\
- .values('character_id', 'corporation_id', 'alliance_id', 'character_name')
-
+ .values('character_id', 'corporation_id', 'alliance_id', 'character_name')
+
for character in characters:
character_id = character.get('character_id')
if character_id in affiliations:
affiliation = affiliations[character_id]
-
+
corp_changed = (
character.get('corporation_id') != affiliation.get('corporation_id')
)
-
+
alliance_id = character.get('alliance_id')
if not alliance_id:
alliance_id = None
alliance_changed = alliance_id != affiliation.get('alliance_id')
-
+
name_changed = False
fetched_name = affiliation.get('name', False)
if fetched_name:
name_changed = character.get('character_name') != fetched_name
-
- if corp_changed or alliance_changed or name_changed:
+
+ if corp_changed or alliance_changed or name_changed:
update_character.apply_async(
args=[character.get('character_id')], priority=TASK_PRIORITY
)
diff --git a/allianceauth/eveonline/templatetags/evelinks.py b/allianceauth/eveonline/templatetags/evelinks.py
index bf507965..e5f44440 100644
--- a/allianceauth/eveonline/templatetags/evelinks.py
+++ b/allianceauth/eveonline/templatetags/evelinks.py
@@ -1,14 +1,14 @@
# This module defines template tags for evelinks URLs and eve image URLs
-#
+#
# Many tags will work both with their respective eveonline object
# and their respective eve entity ID
-#
+#
# Example:
# character URL on evewho: {{ my_character|evewho_character_url}}
# character URL on evewho: {{ 1456384556|evewho_character_url}}
-#
+#
# For more examples see examples.html
-#
+#
# To add templatetags for additional providers just add the respective
# template functions and let them call the generic functions
@@ -25,59 +25,59 @@ _DEFAULT_IMAGE_SIZE = 32
# generic functions
def _generic_character_url(
- provider: object,
- obj_prop: str,
+ provider: object,
+ obj_prop: str,
eve_obj: EveCharacter
) -> str:
"""returns character URL for given provider and object"""
my_func = getattr(provider, 'character_url')
- if isinstance(eve_obj, EveCharacter):
+ if isinstance(eve_obj, EveCharacter):
return my_func(getattr(eve_obj, obj_prop))
-
+
elif eve_obj is None:
return ''
else:
return my_func(eve_obj)
-
+
def _generic_corporation_url(
- provider: object,
- obj_prop: str,
+ provider: object,
+ obj_prop: str,
eve_obj: object
) -> str:
"""returns corporation URL for given provider and object"""
my_func = getattr(provider, 'corporation_url')
- if isinstance(eve_obj, (EveCharacter, EveCorporationInfo)):
+ if isinstance(eve_obj, (EveCharacter, EveCorporationInfo)):
return my_func(getattr(eve_obj, obj_prop))
elif eve_obj is None:
return ''
-
+
else:
return my_func(eve_obj)
-
+
def _generic_alliance_url(
- provider: object,
+ provider: object,
obj_prop: str,
eve_obj: object
) -> str:
"""returns alliance URL for given provider and object"""
my_func = getattr(provider, 'alliance_url')
-
+
if isinstance(eve_obj, EveCharacter):
- if eve_obj.alliance_id:
+ if eve_obj.alliance_id:
return my_func(getattr(eve_obj, obj_prop))
else:
return ''
-
- elif isinstance(eve_obj, EveAllianceInfo):
+
+ elif isinstance(eve_obj, EveAllianceInfo):
return my_func(getattr(eve_obj, obj_prop))
elif eve_obj is None:
return ''
-
+
else:
return my_func(eve_obj)
@@ -91,7 +91,7 @@ def _generic_evelinks_url(
my_func = getattr(provider, provider_func)
if eve_obj is None:
return ''
-
+
else:
return my_func(eve_obj)
@@ -99,29 +99,29 @@ def _generic_evelinks_url(
# evewho
@register.filter
-def evewho_character_url(eve_obj: EveCharacter) -> str:
+def evewho_character_url(eve_obj: EveCharacter) -> str:
"""generates an evewho URL for the given object
Works with allianceauth.eveonline objects and eve entity IDs
- Returns URL or empty string
- """
+ Returns URL or empty string
+ """
return _generic_character_url(evewho, 'character_id', eve_obj)
-
+
@register.filter
def evewho_corporation_url(eve_obj: object) -> str:
"""generates an evewho URL for the given object
Works with allianceauth.eveonline objects and eve entity IDs
- Returns URL or empty string
- """
+ Returns URL or empty string
+ """
return _generic_corporation_url(evewho, 'corporation_id', eve_obj)
-
+
@register.filter
-def evewho_alliance_url(eve_obj: object) -> str:
+def evewho_alliance_url(eve_obj: object) -> str:
"""generates an evewho URL for the given object
Works with allianceauth.eveonline objects and eve entity IDs
- Returns URL or empty string
- """
+ Returns URL or empty string
+ """
return _generic_alliance_url(evewho, 'alliance_id', eve_obj)
@@ -131,69 +131,69 @@ def evewho_alliance_url(eve_obj: object) -> str:
def dotlan_corporation_url(eve_obj: object) -> str:
"""generates a dotlan URL for the given object
Works with allianceauth.eveonline objects and eve entity names
- Returns URL or empty string
- """
+ Returns URL or empty string
+ """
return _generic_corporation_url(dotlan, 'corporation_name', eve_obj)
-
+
@register.filter
-def dotlan_alliance_url(eve_obj: object) -> str:
+def dotlan_alliance_url(eve_obj: object) -> str:
"""generates a dotlan URL for the given object
Works with allianceauth.eveonline objects and eve entity names
- Returns URL or empty string
- """
+ Returns URL or empty string
+ """
return _generic_alliance_url(dotlan, 'alliance_name', eve_obj)
@register.filter
-def dotlan_region_url(eve_obj: object) -> str:
+def dotlan_region_url(eve_obj: object) -> str:
"""generates a dotlan URL for the given object
Works with eve entity names
- Returns URL or empty string
- """
+ Returns URL or empty string
+ """
return _generic_evelinks_url(dotlan, 'region_url', eve_obj)
@register.filter
-def dotlan_solar_system_url(eve_obj: object) -> str:
+def dotlan_solar_system_url(eve_obj: object) -> str:
"""generates a dotlan URL for the given object
Works with eve entity names
- Returns URL or empty string
- """
+ Returns URL or empty string
+ """
return _generic_evelinks_url(dotlan, 'solar_system_url', eve_obj)
# zkillboard
@register.filter
-def zkillboard_character_url(eve_obj: EveCharacter) -> str:
+def zkillboard_character_url(eve_obj: EveCharacter) -> str:
"""generates a zkillboard URL for the given object
Works with allianceauth.eveonline objects and eve entity IDs
- Returns URL or empty string
- """
+ Returns URL or empty string
+ """
return _generic_character_url(zkillboard, 'character_id', eve_obj)
-
+
@register.filter
def zkillboard_corporation_url(eve_obj: object) -> str:
"""generates a zkillboard URL for the given object
Works with allianceauth.eveonline objects and eve entity IDs
- Returns URL or empty string
+ Returns URL or empty string
"""
return _generic_corporation_url(zkillboard, 'corporation_id', eve_obj)
-
+
@register.filter
-def zkillboard_alliance_url(eve_obj: object) -> str:
+def zkillboard_alliance_url(eve_obj: object) -> str:
"""generates a zkillboard URL for the given object
Works with allianceauth.eveonline objects and eve entity IDs
- Returns URL or empty string
+ Returns URL or empty string
"""
return _generic_alliance_url(zkillboard, 'alliance_id', eve_obj)
@register.filter
-def zkillboard_region_url(eve_obj: object) -> str:
+def zkillboard_region_url(eve_obj: object) -> str:
"""generates a zkillboard URL for the given object
Works with eve entity IDs
Returns URL or empty string
@@ -202,7 +202,7 @@ def zkillboard_region_url(eve_obj: object) -> str:
@register.filter
-def zkillboard_solar_system_url(eve_obj: object) -> str:
+def zkillboard_solar_system_url(eve_obj: object) -> str:
"""generates zkillboard URL for the given object
Works with eve entity IDs
Returns URL or empty string
@@ -214,20 +214,20 @@ def zkillboard_solar_system_url(eve_obj: object) -> str:
@register.filter
def character_portrait_url(
- eve_obj: object,
+ eve_obj: object,
size: int = _DEFAULT_IMAGE_SIZE
) -> str:
"""generates an image URL for the given object
Works with EveCharacter objects or character IDs
Returns URL or empty string
"""
- if isinstance(eve_obj, EveCharacter):
+ if isinstance(eve_obj, EveCharacter):
return eve_obj.portrait_url(size)
elif eve_obj is None:
return ''
-
- else:
+
+ else:
try:
return EveCharacter.generic_portrait_url(eve_obj, size)
except ValueError:
@@ -236,23 +236,23 @@ def character_portrait_url(
@register.filter
def corporation_logo_url(
- eve_obj: object,
+ eve_obj: object,
size: int = _DEFAULT_IMAGE_SIZE
) -> str:
"""generates image URL for the given object
Works with EveCharacter, EveCorporationInfo objects or corporation IDs
Returns URL or empty string
"""
- if isinstance(eve_obj, EveCorporationInfo):
+ if isinstance(eve_obj, EveCorporationInfo):
return eve_obj.logo_url(size)
- elif isinstance(eve_obj, EveCharacter):
+ elif isinstance(eve_obj, EveCharacter):
return eve_obj.corporation_logo_url(size)
elif eve_obj is None:
return ''
-
- else:
+
+ else:
try:
return EveCorporationInfo.generic_logo_url(eve_obj, size)
except ValueError:
@@ -261,23 +261,23 @@ def corporation_logo_url(
@register.filter
def alliance_logo_url(
- eve_obj: object,
+ eve_obj: object,
size: int = _DEFAULT_IMAGE_SIZE
) -> str:
"""generates image URL for the given object
Works with EveCharacter, EveAllianceInfo objects or alliance IDs
Returns URL or empty string
"""
- if isinstance(eve_obj, EveAllianceInfo):
+ if isinstance(eve_obj, EveAllianceInfo):
return eve_obj.logo_url(size)
- elif isinstance(eve_obj, EveCharacter):
+ elif isinstance(eve_obj, EveCharacter):
return eve_obj.alliance_logo_url(size)
elif eve_obj is None:
return ''
-
- else:
+
+ else:
try:
return EveAllianceInfo.generic_logo_url(eve_obj, size)
except ValueError:
@@ -286,10 +286,10 @@ def alliance_logo_url(
@register.filter
def type_icon_url(
- type_id: int,
+ type_id: int,
size: int = _DEFAULT_IMAGE_SIZE
) -> str:
- """generates a icon image URL for the given type ID
+ """generates a icon image URL for the given type ID
Returns URL or empty string
"""
try:
@@ -300,10 +300,10 @@ def type_icon_url(
@register.filter
def type_render_url(
- type_id: int,
+ type_id: int,
size: int = _DEFAULT_IMAGE_SIZE
) -> str:
- """generates a render image URL for the given type ID
+ """generates a render image URL for the given type ID
Returns URL or empty string
"""
try:
diff --git a/allianceauth/eveonline/templatetags/examples.html b/allianceauth/eveonline/templatetags/examples.html
index 61e5d096..180aa3f8 100644
--- a/allianceauth/eveonline/templatetags/examples.html
+++ b/allianceauth/eveonline/templatetags/examples.html
@@ -1,4 +1,4 @@
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/allianceauth/templates/bundles/clipboard-js.html b/allianceauth/templates/bundles/clipboard-js.html
index c31378a8..e08de315 100644
--- a/allianceauth/templates/bundles/clipboard-js.html
+++ b/allianceauth/templates/bundles/clipboard-js.html
@@ -1,3 +1,3 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/allianceauth/templates/bundles/datatables-css.html b/allianceauth/templates/bundles/datatables-css.html
index d4081eec..623ad9df 100644
--- a/allianceauth/templates/bundles/datatables-css.html
+++ b/allianceauth/templates/bundles/datatables-css.html
@@ -1,3 +1,3 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/allianceauth/templates/bundles/datatables-js.html b/allianceauth/templates/bundles/datatables-js.html
index 475238e6..80726ee2 100644
--- a/allianceauth/templates/bundles/datatables-js.html
+++ b/allianceauth/templates/bundles/datatables-js.html
@@ -1,4 +1,4 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/allianceauth/templates/bundles/fontawesome.html b/allianceauth/templates/bundles/fontawesome.html
index 88370c4e..a96afd9c 100644
--- a/allianceauth/templates/bundles/fontawesome.html
+++ b/allianceauth/templates/bundles/fontawesome.html
@@ -1,3 +1,3 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/allianceauth/templates/bundles/jquery-datetimepicker-css.html b/allianceauth/templates/bundles/jquery-datetimepicker-css.html
index 274b402c..a437f981 100644
--- a/allianceauth/templates/bundles/jquery-datetimepicker-css.html
+++ b/allianceauth/templates/bundles/jquery-datetimepicker-css.html
@@ -1,3 +1,3 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/allianceauth/templates/bundles/jquery-datetimepicker-js.html b/allianceauth/templates/bundles/jquery-datetimepicker-js.html
index 650320ef..25fd9ff9 100644
--- a/allianceauth/templates/bundles/jquery-datetimepicker-js.html
+++ b/allianceauth/templates/bundles/jquery-datetimepicker-js.html
@@ -1,3 +1,3 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/allianceauth/templates/bundles/x-editable-js.html b/allianceauth/templates/bundles/x-editable-js.html
index 2200db70..6d9ebf8a 100644
--- a/allianceauth/templates/bundles/x-editable-js.html
+++ b/allianceauth/templates/bundles/x-editable-js.html
@@ -1,3 +1,3 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/allianceauth/templates/bundles/x-editable.css.html b/allianceauth/templates/bundles/x-editable.css.html
index de878759..545718b0 100644
--- a/allianceauth/templates/bundles/x-editable.css.html
+++ b/allianceauth/templates/bundles/x-editable.css.html
@@ -1,3 +1,3 @@
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/allianceauth/tests/auth_utils.py b/allianceauth/tests/auth_utils.py
index d5642d08..92d70d4d 100644
--- a/allianceauth/tests/auth_utils.py
+++ b/allianceauth/tests/auth_utils.py
@@ -9,17 +9,17 @@ from allianceauth.authentication.models import (
)
from allianceauth.eveonline.models import EveCharacter
from allianceauth.authentication.signals import (
- state_member_alliances_changed,
- state_member_characters_changed,
- state_member_corporations_changed,
+ state_member_alliances_changed,
+ state_member_characters_changed,
+ state_member_corporations_changed,
state_saved,
reassess_on_profile_save,
assign_state_on_active_change,
check_state_on_character_update
)
from allianceauth.services.signals import (
- m2m_changed_group_permissions,
- m2m_changed_user_permissions,
+ m2m_changed_group_permissions,
+ m2m_changed_user_permissions,
m2m_changed_state_permissions,
m2m_changed_user_groups, disable_services_on_inactive,
process_main_character_change,
@@ -31,13 +31,13 @@ class AuthUtils:
"""Utilities for making it easier to create tests for Alliance Auth"""
@staticmethod
- def _create_user(username):
+ def _create_user(username):
return User.objects.create(username=username)
@classmethod
def create_user(cls, username, disconnect_signals=False):
"""create a new user
-
+
username: Name of the user
disconnect_signals: whether to run process without signals
@@ -135,7 +135,7 @@ class AuthUtils:
m2m_changed.connect(state_member_alliances_changed, sender=State.member_alliances.through)
post_save.connect(state_saved, sender=State)
post_save.connect(reassess_on_profile_save, sender=UserProfile)
- pre_save.connect(assign_state_on_active_change, sender=User)
+ pre_save.connect(assign_state_on_active_change, sender=User)
pre_save.connect(process_main_character_change, sender=UserProfile)
pre_save.connect(process_main_character_update, sender=EveCharacter)
post_save.connect(check_state_on_character_update, sender=EveCharacter)
@@ -161,15 +161,15 @@ class AuthUtils:
UserProfile.objects.update_or_create(user=user, defaults={'main_character': char})
@classmethod
- def add_main_character_2(
+ def add_main_character_2(
cls,
- user,
- name,
- character_id,
- corp_id=2345,
- corp_name='',
- corp_ticker='',
- alliance_id=None,
+ user,
+ name,
+ character_id,
+ corp_id=2345,
+ corp_name='',
+ corp_ticker='',
+ alliance_id=None,
alliance_name='',
disconnect_signals=False
):
@@ -194,10 +194,10 @@ class AuthUtils:
)
user.profile.main_character = char
user.profile.save()
-
+
if disconnect_signals:
cls.connect_signals()
-
+
return char
@classmethod
@@ -222,16 +222,16 @@ class AuthUtils:
@classmethod
def add_permissions_to_user(cls, perms, user, disconnect_signals=True) -> User:
"""add list of permissions to user
-
+
perms: list of Permission objects
-
+
user: user object
-
+
disconnect_signals: whether to run process without signals
"""
if disconnect_signals:
cls.disconnect_signals()
-
+
for perm in perms:
user.user_permissions.add(perm)
@@ -244,7 +244,7 @@ class AuthUtils:
@classmethod
def add_permission_to_user_by_name(
cls, perm, user, disconnect_signals=True
- ) -> User:
+ ) -> User:
"""returns permission specified by qualified name
perm: Permission name as 'app_label.codename'
diff --git a/allianceauth/tests/test_auth_utils.py b/allianceauth/tests/test_auth_utils.py
index 1eb5d4a5..5e031507 100644
--- a/allianceauth/tests/test_auth_utils.py
+++ b/allianceauth/tests/test_auth_utils.py
@@ -12,10 +12,10 @@ from .auth_utils import AuthUtils
class TestAuthUtils(TestCase):
- def test_can_create_user(self):
+ def test_can_create_user(self):
user = AuthUtils.create_user('Bruce Wayne')
self.assertTrue(User.objects.filter(username='Bruce Wayne').exists())
-
+
def test_can_add_main_character_2(self):
user = AuthUtils.create_user('Bruce Wayne')
character = AuthUtils.add_main_character_2(
@@ -30,11 +30,11 @@ class TestAuthUtils(TestCase):
)
expected = character
self.assertEqual(user.profile.main_character, expected)
-
+
def test_can_add_permission_to_group(self):
group = Group.objects.create(name='Dummy Group')
p = AuthUtils.get_permission_by_name('auth.group_management')
- AuthUtils.add_permissions_to_groups([p], [group])
+ AuthUtils.add_permissions_to_groups([p], [group])
self.assertTrue(group.permissions.filter(pk=p.pk).exists())
def test_can_add_permission_to_user_by_name(self):
@@ -50,7 +50,7 @@ class TestGetPermissionByName(TestCase):
def test_can_get_permission_by_name(self):
expected = Permission.objects.get(
content_type__app_label='auth', codename='timer_management'
- )
+ )
self.assertEqual(
AuthUtils.get_permission_by_name('auth.timer_management'), expected
)
diff --git a/docs/conf.py b/docs/conf.py
index f6e38734..05ba8687 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -42,7 +42,7 @@ from recommonmark.transform import AutoStructify
extensions = [
'sphinx_rtd_theme',
- 'sphinx.ext.autodoc',
+ 'sphinx.ext.autodoc',
'recommonmark',
]
diff --git a/docs/development/custom/logging.md b/docs/development/custom/logging.md
index 02c253eb..bd6d8a81 100644
--- a/docs/development/custom/logging.md
+++ b/docs/development/custom/logging.md
@@ -15,7 +15,7 @@ This works by creating a child logger of the extension logger which propagates a
to the parent (extensions) logger.
## Changing the Logging Level
-By default, the extension logger's level is set to `DEBUG`.
+By default, the extension logger's level is set to `DEBUG`.
To change this, uncomment (or add) the following line in `local.py`.
```python
diff --git a/docs/development/custom/url-hooks.md b/docs/development/custom/url-hooks.md
index 2ea5e372..43c8bb43 100644
--- a/docs/development/custom/url-hooks.md
+++ b/docs/development/custom/url-hooks.md
@@ -12,8 +12,8 @@ To register a UrlHook class you would do the following:
@hooks.register('url_hook')
def register_urls():
return UrlHook(app_name.urls, 'app_name', r^'app_name/')
-
-
+
+
The `UrlHook` class specifies some parameters/instance variables required for URL pattern inclusion.
`UrlHook(urls, app_name, base_url)`
@@ -36,7 +36,7 @@ The app's `urls.py` would look like so:
from django.conf.urls import url
import plugin.views
-
+
urlpatterns = [
url(r^'index$', plugins.views.index, name='index'),
]
diff --git a/docs/development/dev_setup/aa-dev-setup-wsl-vsc-v2.md b/docs/development/dev_setup/aa-dev-setup-wsl-vsc-v2.md
index 806d40f4..8518476e 100644
--- a/docs/development/dev_setup/aa-dev-setup-wsl-vsc-v2.md
+++ b/docs/development/dev_setup/aa-dev-setup-wsl-vsc-v2.md
@@ -366,7 +366,7 @@ Here is an example debug config for Celery:
"module": "celery",
"cwd": "${workspaceFolder}/myauth",
"console": "integratedTerminal",
- "args": [
+ "args": [
"-A",
"myauth",
"worker",
@@ -391,7 +391,7 @@ Finally it makes sense to have a dedicated debug config for running unit tests.
"request": "launch",
"program": "${workspaceFolder}/myauth/manage.py",
"args": [
- "test",
+ "test",
"--keepdb",
"--debug-mode",
"--failfast",
diff --git a/docs/development/tech_docu/api/esi.rst b/docs/development/tech_docu/api/esi.rst
index a5b854ec..a6942e69 100644
--- a/docs/development/tech_docu/api/esi.rst
+++ b/docs/development/tech_docu/api/esi.rst
@@ -12,13 +12,13 @@ clients
===========
.. automodule:: esi.clients
- :members: esi_client_factory
+ :members: esi_client_factory
:undoc-members:
decorators
===========
-.. automodule:: esi.decorators
+.. automodule:: esi.decorators
:members:
:undoc-members:
diff --git a/docs/development/tech_docu/api/testutils.rst b/docs/development/tech_docu/api/testutils.rst
index 3ccea51f..9d0f93ee 100644
--- a/docs/development/tech_docu/api/testutils.rst
+++ b/docs/development/tech_docu/api/testutils.rst
@@ -10,5 +10,5 @@ auth_utils
===========
.. automodule:: allianceauth.tests.auth_utils
- :members:
+ :members:
:undoc-members:
diff --git a/docs/features/services/phpbb3.md b/docs/features/services/phpbb3.md
index 8800aab6..459a6d2d 100644
--- a/docs/features/services/phpbb3.md
+++ b/docs/features/services/phpbb3.md
@@ -69,7 +69,7 @@ mv phpBB3 /var/www/forums
The web server needs read/write permission to this folder
-Apache: `chown -R www-data:www-data /var/www/forums`
+Apache: `chown -R www-data:www-data /var/www/forums`
Nginx: `chown -R nginx:nginx /var/www/forums`
```eval_rst
diff --git a/docs/features/services/smf.md b/docs/features/services/smf.md
index f48e9ca6..8b606e0b 100644
--- a/docs/features/services/smf.md
+++ b/docs/features/services/smf.md
@@ -48,7 +48,7 @@ Now we need to move this to our web directory. Usually `/var/www/forums`.
The web server needs read/write permission to this folder
-Apache: `chown -R www-data:www-data /var/www/forums`
+Apache: `chown -R www-data:www-data /var/www/forums`
Nginx: `chown -R nginx:nginx /var/www/forums`
```eval_rst
diff --git a/docs/installation/apache.md b/docs/installation/apache.md
index 5ffd1f13..1b423587 100644
--- a/docs/installation/apache.md
+++ b/docs/installation/apache.md
@@ -45,7 +45,7 @@ Place your virtual host configuration in the appropriate section within `/etc/ht
```
ServerName auth.example.com
-
+
ProxyPassMatch ^/static !
ProxyPassMatch ^/robots.txt !
diff --git a/docs/installation/nginx.md b/docs/installation/nginx.md
index 37cf91bf..2ebd43a1 100644
--- a/docs/installation/nginx.md
+++ b/docs/installation/nginx.md
@@ -16,9 +16,9 @@ Nginx is lightweight for a reason. It doesn't try to do everything internally an
```eval_rst
+-----------+----------------------------------------+
-| Apache | Nginx Replacement |
+| Apache | Nginx Replacement |
+===========+========================================+
-| mod_php | php5-fpm or php7-fpm (PHP FastCGI) |
+| mod_php | php5-fpm or php7-fpm (PHP FastCGI) |
+-----------+----------------------------------------+
| mod_wsgi | Gunicorn or other external WSGI server |
+-----------+----------------------------------------+
diff --git a/docs/installation/upgrade_python.md b/docs/installation/upgrade_python.md
index a4acfd6e..65d18c9b 100644
--- a/docs/installation/upgrade_python.md
+++ b/docs/installation/upgrade_python.md
@@ -143,7 +143,7 @@ System check identified no issues (0 silenced).
Make sure you are in your venv!
-First we create a list of all installed packages in your venv. You can use this list later as reference to see what packages should be installed.
+First we create a list of all installed packages in your venv. You can use this list later as reference to see what packages should be installed.
```bash
pip freeze > requirements.txt
@@ -262,7 +262,7 @@ ls /home/allianceserver/venv/auth /home/allianceserver/venv
If the output shows these two folders you should be safe to proceed:
-- `auth`
+- `auth`
- `auth_old`
Run these commands to remove your current venv and switch back to the old venv for auth:
diff --git a/runtests.py b/runtests.py
index 983a8e7d..35d797b7 100644
--- a/runtests.py
+++ b/runtests.py
@@ -2,7 +2,7 @@
import os
import sys
-if __name__ == "__main__":
+if __name__ == "__main__":
try:
from django.core.management import execute_from_command_line
except ImportError:
diff --git a/tests/settings_core.py b/tests/settings_core.py
index 554b53a8..effc39da 100644
--- a/tests/settings_core.py
+++ b/tests/settings_core.py
@@ -18,7 +18,7 @@ NOSE_ARGS = [
# Celery configuration
CELERY_ALWAYS_EAGER = True # Forces celery to run locally for testing
-INSTALLED_APPS += [
+INSTALLED_APPS += [
'django_nose',
]
diff --git a/thirdparty/Supervisor/auth.conf b/thirdparty/Supervisor/auth.conf
index 381bec6f..8124d559 100644
--- a/thirdparty/Supervisor/auth.conf
+++ b/thirdparty/Supervisor/auth.conf
@@ -23,6 +23,6 @@ stopwaitsecs = 600
killasgroup=true
priority=998
-[group:auth]
-programs=celerybeat,celeryd
+[group:auth]
+programs=celerybeat,celeryd
priority=999
diff --git a/tox.ini b/tox.ini
index ccce0edb..3d3766a2 100644
--- a/tox.ini
+++ b/tox.ini
@@ -7,14 +7,14 @@ envlist = py{37,38,39}-{all}
setenv =
all: DJANGO_SETTINGS_MODULE = tests.settings_all
core: DJANGO_SETTINGS_MODULE = tests.settings_core
-basepython =
+basepython =
py37: python3.7
py38: python3.8
py39: python3.9
-deps=
+deps=
coverage
install_command = pip install -e ".[testing]" -U {opts} {packages}
-commands =
+commands =
all: coverage run runtests.py -v 2
all: coverage report -m
all: coverage xml