From 05a81aa99332d043dde39ea189874d233060041a Mon Sep 17 00:00:00 2001 From: Michael Bideau Date: Tue, 29 Oct 2019 18:26:56 +0100 Subject: [PATCH] Pylint: fixed 'keyword-arg-before-vararg' and module order issues --- atreal_openads/models.py | 84 ++++++++-------------------------------- 1 file changed, 16 insertions(+), 68 deletions(-) diff --git a/atreal_openads/models.py b/atreal_openads/models.py index 36c2946..d602531 100644 --- a/atreal_openads/models.py +++ b/atreal_openads/models.py @@ -26,10 +26,10 @@ import json import os import urlparse -import magic - from urllib import quote +import magic + from django.db import models from django.http import Http404 from django.utils.translation import ugettext_lazy as _ @@ -506,15 +506,7 @@ class AtrealOpenads(BaseResource, HTTPResource, BaseModel): @endpoint( description=_("Test an openADS 'connexion'") - # get={ - # 'description': _("Test an openADS 'connexion'"), - # 'response_body': { - # 'schema': { - # 'application/json': JSON_SCHEMA_CHECK_STATUS_OUT - # } - # } - # } - ) + ) # pylint: disable=keyword-arg-before-vararg # pylint: disable=unused-argument,arguments-differ def check_status(self, request=None, *args, **kwargs): """Check avaibility of the openADS.API service.""" @@ -546,13 +538,8 @@ class AtrealOpenads(BaseResource, HTTPResource, BaseModel): 'application/json': JSON_SCHEMA_CREATE_DOSSIER_IN } # pylint: disable=too-many-statements,too-many-branches,too-many-locals,too-many-arguments } - # 'response_body': { - # 'schema': { - # 'application/json': JSON_SCHEMA_CREATE_DOSSIER_OUT - # } - # } } - ) + ) # pylint: disable=keyword-arg-before-vararg # pylint: disable=unused-argument def create_dossier(self, request, type_dossier, type_dossier_detaille=None, collectivite=None, now=None, *args, **kwargs): @@ -879,16 +866,8 @@ class AtrealOpenads(BaseResource, HTTPResource, BaseModel): 'type_dossier': {'description': _("Type of 'dossier'"), 'example_value': 'DIA'}, 'numero_dossier': {'description': _("Identifier for 'dossier'"), 'example_value': 'DIA0130551900001'} - }, - # get={ - # 'description': _("Get informations about an openADS 'dossier'"), - # 'response_body': { - # 'schema': { - # 'application/json': JSON_SCHEMA_GET_DOSSIER_OUT - # } - # } - # } - ) + } + ) # pylint: disable=keyword-arg-before-vararg # pylint: disable=unused-argument def get_dossier(self, request, type_dossier, numero_dossier, *args, **kwargs): """Get informations about an openADS 'dossier'.""" @@ -926,16 +905,8 @@ class AtrealOpenads(BaseResource, HTTPResource, BaseModel): 'example_value': 'DIA0130551900001'}, 'fichier_id': {'description': _("File identifier"), 'example_value': '78'} - }, - # get={ - # 'description': _("Get informations about the forwarding of user files to openADS"), - # 'response_body': { - # 'schema': { - # 'application/json': JSON_SCHEMA_GET_FWD_FILES_OUT - # } - # } - # } - ) + } + ) # pylint: disable=keyword-arg-before-vararg # pylint: disable=unused-argument,no-self-use def get_fwd_files(self, request, numero_dossier, fichier_id=None, *args, **kwargs): """Get informations about the forwarding of user files to openADS.""" @@ -989,16 +960,8 @@ class AtrealOpenads(BaseResource, HTTPResource, BaseModel): 'example_value': 'DIA0130551900001'}, 'fichier_id': {'description': _("File identifier"), 'example_value': '78'} - }, - # get={ - # 'description': _("Get informations about the forwarding of a user file to openADS"), - # 'response_body': { - # 'schema': { - # 'application/json': JSON_SCHEMA_GET_FWD_FILES_STATUS_OUT - # } - # } - # } - ) + } + ) # pylint: disable=keyword-arg-before-vararg # pylint: disable=unused-argument def get_fwd_files_status(self, request, numero_dossier, fichier_id=None, *args, **kwargs): """Get informations about the forwarding of a user file to openADS.""" @@ -1040,16 +1003,8 @@ class AtrealOpenads(BaseResource, HTTPResource, BaseModel): 'example_value': 'DIA0130551900001'}, 'lettre_type': {'description': _("Courrier ID to get"), 'example_value': 'dia_renonciation_preempter'} - }, - # get={ - # 'description': _("Get a 'courrier' from an openADS 'dossier'"), - # 'response_body': { - # 'schema': { - # 'application/json': JSON_SCHEMA_GET_COURRIER_OUT - # } - # } - # } - ) + } + ) # pylint: disable=keyword-arg-before-vararg # pylint: disable=unused-argument def get_courrier(self, request, type_dossier, numero_dossier, lettre_type, *args, **kwargs): """Get a 'courrier' from an openADS 'dossier'.""" @@ -1129,16 +1084,8 @@ class AtrealOpenads(BaseResource, HTTPResource, BaseModel): 'file_ids': {'description': _(("List of ForwardFile IDs to upload " "(coma separated)")), 'example_value': '12,18'} - }, # pylint: disable=too-many-statements,too-many-branches,too-many-locals - # get={ - # 'description': _("Trigger the uploading of user's files to openADS"), - # 'response_body': { - # 'schema': { - # 'application/json': JSON_SCHEMA_UPLOAD_USER_FILES - # } - # } - # } - ) + } # pylint: disable=too-many-statements,too-many-branches,too-many-locals + ) # pylint: disable=keyword-arg-before-vararg # @raise ForwareFile.DoesNotExist if not found # pylint: disable=unused-argument def upload_user_files(self, request, type_dossier, numero_dossier, file_ids=None, @@ -1224,7 +1171,7 @@ class AtrealOpenads(BaseResource, HTTPResource, BaseModel): # make the request to openADS.API (with a specific timeout) url = urlparse.urljoin(self.openADS_API_url, '/dossier/%s/%s/files' % ( - quote(type_dossier), quote(numero_dossier))) + quote(type_dossier), quote(numero_dossier))) response = self.requests.post( url, json=payload, @@ -1320,6 +1267,7 @@ class AtrealOpenads(BaseResource, HTTPResource, BaseModel): # return something to please pylint return True + # pylint: disable=keyword-arg-before-vararg @endpoint( perm='can_access', description=_("Get the type of 'courrier' of an openADS 'dossier'"),