misc: fix new pylint 2.16 warnings (#74060)
gitea-wip/passerelle/pipeline/pr-main This commit looks good Details
gitea/passerelle/pipeline/head Something is wrong with the build of this commit Details

This commit is contained in:
Thomas NOËL 2023-02-01 13:55:49 +01:00
parent c4a71ede04
commit 791eedd3f5
4 changed files with 13 additions and 12 deletions

View File

@ -148,12 +148,12 @@ class SOAPConnector(BaseResource, HTTPResource):
return endpoints return endpoints
for name, input_schema, output_schema in operations_and_schemas: for name, input_schema, output_schema in operations_and_schemas:
kwargs = dict( kwargs = {
name='method', 'name': 'method',
pattern=f'{name}/', 'pattern': f'{name}/',
example_pattern=f'{name}/', 'example_pattern': f'{name}/',
description=f'Method {name}', 'description': f'Method {name}',
json_schema_response={ 'json_schema_response': {
'type': 'object', 'type': 'object',
'properties': collections.OrderedDict( 'properties': collections.OrderedDict(
[ [
@ -162,7 +162,7 @@ class SOAPConnector(BaseResource, HTTPResource):
] ]
), ),
}, },
) }
if input_schema: if input_schema:
kwargs['post_json_schema'] = input_schema kwargs['post_json_schema'] = input_schema
endpoints.append(endpoint(**kwargs)) endpoints.append(endpoint(**kwargs))

View File

@ -205,8 +205,8 @@ class BaseResource(models.Model):
return self._requests return self._requests
def make_requests(self, **kwargs): def make_requests(self, **kwargs):
init_kwargs = dict(resource=self, logger=self.logger) init_kwargs = {'resource': self, 'logger': self.logger}
init_kwargs = dict(init_kwargs, **kwargs) init_kwargs.update(kwargs)
return passerelle.utils.Request(**init_kwargs) return passerelle.utils.Request(**init_kwargs)
@property @property

View File

@ -10,6 +10,7 @@ disable=
attribute-defined-outside-init, attribute-defined-outside-init,
bad-super-call, bad-super-call,
broad-except, broad-except,
broad-exception-raised,
consider-using-f-string, consider-using-f-string,
consider-using-set-comprehension, consider-using-set-comprehension,
consider-using-ternary, consider-using-ternary,

View File

@ -72,7 +72,7 @@ def test_demand_creation(app, payload, actesweb):
demfile = get_demand_filepath(actesweb, demand_id) demfile = get_demand_filepath(actesweb, demand_id)
assert_file_content_values( assert_file_content_values(
demfile, demfile,
dict( dict( # noqa pylint: disable=use-dict-literal
DEMANDEUR_CIVILITE="Madame", DEMANDEUR_CIVILITE="Madame",
DEMANDEUR_NOM_USAGE="W'hatever?", DEMANDEUR_NOM_USAGE="W'hatever?",
DEMANDEUR_PRENOMS="Kim Chelsea", DEMANDEUR_PRENOMS="Kim Chelsea",
@ -102,7 +102,7 @@ def test_demand_creation(app, payload, actesweb):
demfile = get_demand_filepath(actesweb, demand_id) demfile = get_demand_filepath(actesweb, demand_id)
assert_file_content_values( assert_file_content_values(
demfile, demfile,
dict( dict( # noqa pylint: disable=use-dict-literal
DEMANDEUR_CIVILITE="Madame", DEMANDEUR_CIVILITE="Madame",
DEMANDEUR_NOM_USAGE="Whatever", DEMANDEUR_NOM_USAGE="Whatever",
DEMANDEUR_NOM="Bar", DEMANDEUR_NOM="Bar",
@ -146,7 +146,7 @@ def test_demand_creation(app, payload, actesweb):
assert not bool(os.stat(demfile).st_mode & stat.S_IRWXO) assert not bool(os.stat(demfile).st_mode & stat.S_IRWXO)
assert_file_content_values( assert_file_content_values(
demfile, demfile,
dict( dict( # noqa pylint: disable=use-dict-literal
DEMANDEUR_CIVILITE="Madame", DEMANDEUR_CIVILITE="Madame",
DEMANDEUR_NOM_USAGE="Whatever", DEMANDEUR_NOM_USAGE="Whatever",
DEMANDEUR_PRENOMS="Kim Chelsea", DEMANDEUR_PRENOMS="Kim Chelsea",