Pylint: fixed 'keyword-arg-before-vararg' and module order issues

This commit is contained in:
Michael Bideau 2019-10-29 18:26:56 +01:00
parent 498a36bba3
commit 05a81aa993
1 changed files with 16 additions and 68 deletions

View File

@ -26,10 +26,10 @@ import json
import os import os
import urlparse import urlparse
import magic
from urllib import quote from urllib import quote
import magic
from django.db import models from django.db import models
from django.http import Http404 from django.http import Http404
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
@ -506,15 +506,7 @@ class AtrealOpenads(BaseResource, HTTPResource, BaseModel):
@endpoint( @endpoint(
description=_("Test an openADS 'connexion'") description=_("Test an openADS 'connexion'")
# get={ ) # pylint: disable=keyword-arg-before-vararg
# 'description': _("Test an openADS 'connexion'"),
# 'response_body': {
# 'schema': {
# 'application/json': JSON_SCHEMA_CHECK_STATUS_OUT
# }
# }
# }
)
# pylint: disable=unused-argument,arguments-differ # pylint: disable=unused-argument,arguments-differ
def check_status(self, request=None, *args, **kwargs): def check_status(self, request=None, *args, **kwargs):
"""Check avaibility of the openADS.API service.""" """Check avaibility of the openADS.API service."""
@ -546,13 +538,8 @@ class AtrealOpenads(BaseResource, HTTPResource, BaseModel):
'application/json': JSON_SCHEMA_CREATE_DOSSIER_IN 'application/json': JSON_SCHEMA_CREATE_DOSSIER_IN
} # pylint: disable=too-many-statements,too-many-branches,too-many-locals,too-many-arguments } # 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 # pylint: disable=unused-argument
def create_dossier(self, request, type_dossier, type_dossier_detaille=None, collectivite=None, def create_dossier(self, request, type_dossier, type_dossier_detaille=None, collectivite=None,
now=None, *args, **kwargs): now=None, *args, **kwargs):
@ -879,16 +866,8 @@ class AtrealOpenads(BaseResource, HTTPResource, BaseModel):
'type_dossier': {'description': _("Type of 'dossier'"), 'example_value': 'DIA'}, 'type_dossier': {'description': _("Type of 'dossier'"), 'example_value': 'DIA'},
'numero_dossier': {'description': _("Identifier for 'dossier'"), 'numero_dossier': {'description': _("Identifier for 'dossier'"),
'example_value': 'DIA0130551900001'} 'example_value': 'DIA0130551900001'}
}, }
# get={ ) # pylint: disable=keyword-arg-before-vararg
# 'description': _("Get informations about an openADS 'dossier'"),
# 'response_body': {
# 'schema': {
# 'application/json': JSON_SCHEMA_GET_DOSSIER_OUT
# }
# }
# }
)
# pylint: disable=unused-argument # pylint: disable=unused-argument
def get_dossier(self, request, type_dossier, numero_dossier, *args, **kwargs): def get_dossier(self, request, type_dossier, numero_dossier, *args, **kwargs):
"""Get informations about an openADS 'dossier'.""" """Get informations about an openADS 'dossier'."""
@ -926,16 +905,8 @@ class AtrealOpenads(BaseResource, HTTPResource, BaseModel):
'example_value': 'DIA0130551900001'}, 'example_value': 'DIA0130551900001'},
'fichier_id': {'description': _("File identifier"), 'fichier_id': {'description': _("File identifier"),
'example_value': '78'} 'example_value': '78'}
}, }
# get={ ) # pylint: disable=keyword-arg-before-vararg
# 'description': _("Get informations about the forwarding of user files to openADS"),
# 'response_body': {
# 'schema': {
# 'application/json': JSON_SCHEMA_GET_FWD_FILES_OUT
# }
# }
# }
)
# pylint: disable=unused-argument,no-self-use # pylint: disable=unused-argument,no-self-use
def get_fwd_files(self, request, numero_dossier, fichier_id=None, *args, **kwargs): def get_fwd_files(self, request, numero_dossier, fichier_id=None, *args, **kwargs):
"""Get informations about the forwarding of user files to openADS.""" """Get informations about the forwarding of user files to openADS."""
@ -989,16 +960,8 @@ class AtrealOpenads(BaseResource, HTTPResource, BaseModel):
'example_value': 'DIA0130551900001'}, 'example_value': 'DIA0130551900001'},
'fichier_id': {'description': _("File identifier"), 'fichier_id': {'description': _("File identifier"),
'example_value': '78'} 'example_value': '78'}
}, }
# get={ ) # pylint: disable=keyword-arg-before-vararg
# '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=unused-argument # pylint: disable=unused-argument
def get_fwd_files_status(self, request, numero_dossier, fichier_id=None, *args, **kwargs): 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.""" """Get informations about the forwarding of a user file to openADS."""
@ -1040,16 +1003,8 @@ class AtrealOpenads(BaseResource, HTTPResource, BaseModel):
'example_value': 'DIA0130551900001'}, 'example_value': 'DIA0130551900001'},
'lettre_type': {'description': _("Courrier ID to get"), 'lettre_type': {'description': _("Courrier ID to get"),
'example_value': 'dia_renonciation_preempter'} 'example_value': 'dia_renonciation_preempter'}
}, }
# get={ ) # pylint: disable=keyword-arg-before-vararg
# 'description': _("Get a 'courrier' from an openADS 'dossier'"),
# 'response_body': {
# 'schema': {
# 'application/json': JSON_SCHEMA_GET_COURRIER_OUT
# }
# }
# }
)
# pylint: disable=unused-argument # pylint: disable=unused-argument
def get_courrier(self, request, type_dossier, numero_dossier, lettre_type, *args, **kwargs): def get_courrier(self, request, type_dossier, numero_dossier, lettre_type, *args, **kwargs):
"""Get a 'courrier' from an openADS 'dossier'.""" """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 " 'file_ids': {'description': _(("List of ForwardFile IDs to upload "
"(coma separated)")), "(coma separated)")),
'example_value': '12,18'} 'example_value': '12,18'}
}, # pylint: disable=too-many-statements,too-many-branches,too-many-locals } # pylint: disable=too-many-statements,too-many-branches,too-many-locals
# get={ ) # pylint: disable=keyword-arg-before-vararg
# 'description': _("Trigger the uploading of user's files to openADS"),
# 'response_body': {
# 'schema': {
# 'application/json': JSON_SCHEMA_UPLOAD_USER_FILES
# }
# }
# }
)
# @raise ForwareFile.DoesNotExist if not found # @raise ForwareFile.DoesNotExist if not found
# pylint: disable=unused-argument # pylint: disable=unused-argument
def upload_user_files(self, request, type_dossier, numero_dossier, file_ids=None, 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) # make the request to openADS.API (with a specific timeout)
url = urlparse.urljoin(self.openADS_API_url, '/dossier/%s/%s/files' % ( 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( response = self.requests.post(
url, url,
json=payload, json=payload,
@ -1320,6 +1267,7 @@ class AtrealOpenads(BaseResource, HTTPResource, BaseModel):
# return something to please pylint # return something to please pylint
return True return True
# pylint: disable=keyword-arg-before-vararg
@endpoint( @endpoint(
perm='can_access', perm='can_access',
description=_("Get the type of 'courrier' of an openADS 'dossier'"), description=_("Get the type of 'courrier' of an openADS 'dossier'"),