Projet

Général

Profil

0030-misc-fix-no-else-raise-pylint-error-56982.patch

Valentin Deniaud, 21 septembre 2021 17:09

Télécharger (4,42 ko)

Voir les différences:

Subject: [PATCH 30/59] misc: fix no-else-raise pylint error (#56982)

 src/authentic2/attributes_ng/engine.py | 23 +++++++++++------------
 src/authentic2/forms/authentication.py |  3 +--
 src/authentic2/hashers.py              | 17 +++++++++--------
 src/authentic2_auth_saml/adapters.py   |  3 +--
 4 files changed, 22 insertions(+), 24 deletions(-)
src/authentic2/attributes_ng/engine.py
63 63
        elif count_sorted == len(sorted_list):  # no progress !
64 64
            if raise_on_unsortable:
65 65
                raise UnsortableError(sorted_list, unsorted)
66
            else:
67
                logger = logging.getLogger(__name__)
68
                for source, instance in unsorted:
69
                    dependencies = set(source.get_dependencies(instance, ctx))
70
                    sorted_list.append((source, instance))
71
                    logger.debug(
72
                        'missing dependencies for instance %r of %r: %s',
73
                        instance,
74
                        source,
75
                        list(dependencies - variables),
76
                    )
77
                break
66
            logger = logging.getLogger(__name__)
67
            for source, instance in unsorted:
68
                dependencies = set(source.get_dependencies(instance, ctx))
69
                sorted_list.append((source, instance))
70
                logger.debug(
71
                    'missing dependencies for instance %r of %r: %s',
72
                    instance,
73
                    source,
74
                    list(dependencies - variables),
75
                )
76
            break
78 77
    return sorted_list
79 78

  
80 79

  
src/authentic2/forms/authentication.py
127 127
                    code='invalid_login',
128 128
                    params={'username': self.username_field.verbose_name},
129 129
                )
130
            else:
131
                self.confirm_login_allowed(self.user_cache)
130
            self.confirm_login_allowed(self.user_cache)
132 131

  
133 132
        return self.cleaned_data
134 133

  
src/authentic2/hashers.py
238 238
    def from_joomla(cls, encoded):
239 239
        if encoded.startswith('$P$'):
240 240
            raise NotImplementedError
241
        elif encoded.startswith('$'):
241
        if encoded.startswith('$'):
242 242
            raise NotImplementedError
243
        elif encoded.startswith('{SHA256}'):
243
        if encoded.startswith('{SHA256}'):
244 244
            raise NotImplementedError
245

  
246
        if ':' in encoded:
247
            h, salt = encoded.split(':', 1)
245 248
        else:
246
            if ':' in encoded:
247
                h, salt = encoded.split(':', 1)
248
            else:
249
                h, salt = encoded, ''
250
            salt = force_text(hexlify(force_bytes(salt)), encoding='ascii')
251
            return '%s$md5$%s$%s' % (cls.algorithm, salt, h)
249
            h, salt = encoded, ''
250
        salt = force_text(hexlify(force_bytes(salt)), encoding='ascii')
251

  
252
        return '%s$md5$%s$%s' % (cls.algorithm, salt, h)
252 253

  
253 254
    @classmethod
254 255
    def to_joomla(cls, encoded):
src/authentic2_auth_saml/adapters.py
141 141
                if mandatory:
142 142
                    # it's mandatory, provisionning should fail completely
143 143
                    raise e
144
                else:
145
                    logger.warning('auth_saml: mapping action failed: %s', e)
144
                logger.warning('auth_saml: mapping action failed: %s', e)
146 145
        return user_modified
147 146

  
148 147
    def action_rename(self, user, idp, saml_attributes, mapping):
149
-