Projet

Général

Profil

0019-misc-fix-no-else-raise-pylint-error-62099.patch

Lauréline Guérin, 22 mars 2022 10:30

Télécharger (3,77 ko)

Voir les différences:

Subject: [PATCH 19/65] misc: fix no-else-raise pylint error (#62099)

 passerelle/apps/sfr_dmc/models.py  | 5 ++---
 passerelle/contrib/greco/models.py | 2 +-
 passerelle/utils/json.py           | 2 +-
 tests/test_dpark.py                | 7 +++----
 tests/test_mdph13.py               | 2 +-
 5 files changed, 8 insertions(+), 10 deletions(-)
passerelle/apps/sfr_dmc/models.py
292 292

  
293 293
        if 'success' not in json_data:
294 294
            raise APIError('Bad JSON response')
295
        elif not json_data['success']:
295
        if not json_data['success']:
296 296
            if not 'errorDetail' in json_data:
297 297
                raise APIError('Bad JSON response')
298
            else:
299
                raise APIError(json_data['errorDetail'])
298
            raise APIError(json_data['errorDetail'])
passerelle/contrib/greco/models.py
209 209
                        'HTTP Transport Error %s' % resp.status_code,
210 210
                        err_code='transport-error-%s' % resp.status_code,
211 211
                    )
212
                elif resp.status_code == 500 and b'Fault' not in resp.content:
212
                if resp.status_code == 500 and b'Fault' not in resp.content:
213 213
                    raise APIError('Error 500, not a SOAP Fault', err_code='transport-error-500')
214 214
                return Reply(resp.status_code, resp.headers, resp.content)
215 215

  
passerelle/utils/json.py
82 82
                        'incomplete array before %s in %s'
83 83
                        % (separator.join(map(str, path[: i + 1])), orig_key)
84 84
                    )
85
                elif len(d) == key:
85
                if len(d) == key:
86 86
                    d.append(new)
87 87
                else:
88 88
                    new = d[key]
tests/test_dpark.py
92 92
    def raise_error(self):
93 93
        if self.error_class is WebFault:
94 94
            raise self.error_class(mock.Mock(faulstring='Error %s raised' % self.error_class.__name__), None)
95
        elif self.error_class is TransportError:
95
        if self.error_class is TransportError:
96 96
            raise self.error_class('connection error occured', None)
97
        elif self.error_class is WebFaultHavingLatin1:
97
        if self.error_class is WebFaultHavingLatin1:
98 98
            raise WebFault(message='éêè')
99
        else:
100
            raise Exception('random error')
99
        raise Exception('random error')
101 100

  
102 101
    def return_response(self, *args, **kwargs):
103 102
        return ReplyDataClass(**self.replydata)
tests/test_mdph13.py
226 226
            response = self.responses[idx]
227 227
            if isinstance(response, Exception):
228 228
                raise response
229
            elif hasattr(response, '__call__'):
229
            if hasattr(response, '__call__'):
230 230
                response = response(url, request)
231 231
            return response
232 232

  
233
-