From cafe2f1e1ffd953fe896924bca92c43a1833cf59 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Wed, 20 May 2020 13:59:56 +0200 Subject: [PATCH] admin: fix linting --- passbook/admin/views/policies.py | 4 +- passbook/admin/views/property_mapping.py | 4 +- passbook/admin/views/providers.py | 4 +- passbook/admin/views/sources.py | 4 +- passbook/admin/views/stages.py | 4 +- passbook/lib/templatetags/passbook_utils.py | 1 + .../migrations/0002_auto_20200520_1108.py | 43 +++++++++++++------ passbook/sources/oauth/models.py | 25 +++++++---- swagger.yaml | 5 +++ 9 files changed, 58 insertions(+), 36 deletions(-) diff --git a/passbook/admin/views/policies.py b/passbook/admin/views/policies.py index 9f4678561..e8a009bd2 100644 --- a/passbook/admin/views/policies.py +++ b/passbook/admin/views/policies.py @@ -29,9 +29,7 @@ class PolicyListView(LoginRequiredMixin, PermissionListMixin, ListView): template_name = "administration/policy/list.html" def get_context_data(self, **kwargs): - kwargs["types"] = { - x.__name__: x for x in all_subclasses(Policy) - } + kwargs["types"] = {x.__name__: x for x in all_subclasses(Policy)} return super().get_context_data(**kwargs) def get_queryset(self): diff --git a/passbook/admin/views/property_mapping.py b/passbook/admin/views/property_mapping.py index c1edb5815..0f3d9ffa9 100644 --- a/passbook/admin/views/property_mapping.py +++ b/passbook/admin/views/property_mapping.py @@ -26,9 +26,7 @@ class PropertyMappingListView(LoginRequiredMixin, PermissionListMixin, ListView) paginate_by = 40 def get_context_data(self, **kwargs): - kwargs["types"] = { - x.__name__: x for x in all_subclasses(PropertyMapping) - } + kwargs["types"] = {x.__name__: x for x in all_subclasses(PropertyMapping)} return super().get_context_data(**kwargs) def get_queryset(self): diff --git a/passbook/admin/views/providers.py b/passbook/admin/views/providers.py index 11a287a36..da9a1c761 100644 --- a/passbook/admin/views/providers.py +++ b/passbook/admin/views/providers.py @@ -26,9 +26,7 @@ class ProviderListView(LoginRequiredMixin, PermissionListMixin, ListView): ordering = "id" def get_context_data(self, **kwargs): - kwargs["types"] = { - x.__name__: x for x in all_subclasses(Provider) - } + kwargs["types"] = {x.__name__: x for x in all_subclasses(Provider)} return super().get_context_data(**kwargs) def get_queryset(self): diff --git a/passbook/admin/views/sources.py b/passbook/admin/views/sources.py index 68d908f3a..a8751be9f 100644 --- a/passbook/admin/views/sources.py +++ b/passbook/admin/views/sources.py @@ -26,9 +26,7 @@ class SourceListView(LoginRequiredMixin, PermissionListMixin, ListView): template_name = "administration/source/list.html" def get_context_data(self, **kwargs): - kwargs["types"] = { - x.__name__: x for x in all_subclasses(Source) - } + kwargs["types"] = {x.__name__: x for x in all_subclasses(Source)} return super().get_context_data(**kwargs) def get_queryset(self): diff --git a/passbook/admin/views/stages.py b/passbook/admin/views/stages.py index 103e34afc..03ee9f549 100644 --- a/passbook/admin/views/stages.py +++ b/passbook/admin/views/stages.py @@ -26,9 +26,7 @@ class StageListView(LoginRequiredMixin, PermissionListMixin, ListView): paginate_by = 40 def get_context_data(self, **kwargs): - kwargs["types"] = { - x.__name__: x for x in all_subclasses(Stage) - } + kwargs["types"] = {x.__name__: x for x in all_subclasses(Stage)} return super().get_context_data(**kwargs) def get_queryset(self): diff --git a/passbook/lib/templatetags/passbook_utils.py b/passbook/lib/templatetags/passbook_utils.py index e11ed6ae0..2d5af96cb 100644 --- a/passbook/lib/templatetags/passbook_utils.py +++ b/passbook/lib/templatetags/passbook_utils.py @@ -101,6 +101,7 @@ def debug(obj) -> str: LOGGER.debug(obj) return "" + @register.filter def doc(obj) -> str: """Return docstring of object""" diff --git a/passbook/sources/oauth/migrations/0002_auto_20200520_1108.py b/passbook/sources/oauth/migrations/0002_auto_20200520_1108.py index 9a5cce7d3..e1177614d 100644 --- a/passbook/sources/oauth/migrations/0002_auto_20200520_1108.py +++ b/passbook/sources/oauth/migrations/0002_auto_20200520_1108.py @@ -6,28 +6,45 @@ from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('passbook_sources_oauth', '0001_initial'), + ("passbook_sources_oauth", "0001_initial"), ] operations = [ migrations.AlterField( - model_name='oauthsource', - name='access_token_url', - field=models.CharField(help_text='URL used by passbook to retrive tokens.', max_length=255, verbose_name='Access Token URL'), + model_name="oauthsource", + name="access_token_url", + field=models.CharField( + help_text="URL used by passbook to retrive tokens.", + max_length=255, + verbose_name="Access Token URL", + ), ), migrations.AlterField( - model_name='oauthsource', - name='request_token_url', - field=models.CharField(blank=True, help_text='URL used to request the initial token. This URL is only required for OAuth 1.', max_length=255, verbose_name='Request Token URL'), + model_name="oauthsource", + name="request_token_url", + field=models.CharField( + blank=True, + help_text="URL used to request the initial token. This URL is only required for OAuth 1.", + max_length=255, + verbose_name="Request Token URL", + ), ), migrations.AlterField( - model_name='oauthsource', - name='authorization_url', - field=models.CharField(help_text='URL the user is redirect to to conest the flow.', max_length=255, verbose_name='Authorization URL'), + model_name="oauthsource", + name="authorization_url", + field=models.CharField( + help_text="URL the user is redirect to to conest the flow.", + max_length=255, + verbose_name="Authorization URL", + ), ), migrations.AlterField( - model_name='oauthsource', - name='profile_url', - field=models.CharField(help_text='URL used by passbook to get user information.', max_length=255, verbose_name='Profile URL'), + model_name="oauthsource", + name="profile_url", + field=models.CharField( + help_text="URL used by passbook to get user information.", + max_length=255, + verbose_name="Profile URL", + ), ), ] diff --git a/passbook/sources/oauth/models.py b/passbook/sources/oauth/models.py index 9097121ed..43f2a6280 100644 --- a/passbook/sources/oauth/models.py +++ b/passbook/sources/oauth/models.py @@ -14,20 +14,28 @@ class OAuthSource(Source): provider_type = models.CharField(max_length=255) request_token_url = models.CharField( - blank=True, max_length=255, verbose_name=_("Request Token URL"), - help_text=_("URL used to request the initial token. This URL is only required for OAuth 1.") + blank=True, + max_length=255, + verbose_name=_("Request Token URL"), + help_text=_( + "URL used to request the initial token. This URL is only required for OAuth 1." + ), ) authorization_url = models.CharField( - max_length=255, verbose_name=_("Authorization URL"), - help_text=_("URL the user is redirect to to conest the flow.") + max_length=255, + verbose_name=_("Authorization URL"), + help_text=_("URL the user is redirect to to conest the flow."), ) access_token_url = models.CharField( - max_length=255, verbose_name=_("Access Token URL"), - help_text=_("URL used by passbook to retrive tokens.") + max_length=255, + verbose_name=_("Access Token URL"), + help_text=_("URL used by passbook to retrive tokens."), ) profile_url = models.CharField( - max_length=255, verbose_name=_("Profile URL"), - help_text=_("URL used by passbook to get user information.")) + max_length=255, + verbose_name=_("Profile URL"), + help_text=_("URL used by passbook to get user information."), + ) consumer_key = models.TextField() consumer_secret = models.TextField() @@ -145,6 +153,7 @@ class AzureADOAuthSource(OAuthSource): verbose_name = _("Azure AD OAuth Source") verbose_name_plural = _("Azure AD OAuth Sources") + class OpenIDOAuthSource(OAuthSource): """Abstract subclass of OAuthSource to specify OpenID Form""" diff --git a/swagger.yaml b/swagger.yaml index ece4d2134..980ab4c24 100755 --- a/swagger.yaml +++ b/swagger.yaml @@ -5780,20 +5780,25 @@ definitions: minLength: 1 request_token_url: title: Request Token URL + description: URL used to request the initial token. This URL is only required + for OAuth 1. type: string maxLength: 255 authorization_url: title: Authorization URL + description: URL the user is redirect to to conest the flow. type: string maxLength: 255 minLength: 1 access_token_url: title: Access Token URL + description: URL used by passbook to retrive tokens. type: string maxLength: 255 minLength: 1 profile_url: title: Profile URL + description: URL used by passbook to get user information. type: string maxLength: 255 minLength: 1