0001-misc-remove-all-uses-of-map-44878.patch
src/authentic2/attributes_ng/sources/function.py | ||
---|---|---|
51 | 51 |
config_error(MISSING_KEYS_ERROR, missing) |
52 | 52 |
dependencies = d['dependencies'] |
53 | 53 |
if not isinstance(dependencies, (list, tuple)) or \ |
54 |
not all(map(lambda x: isinstance(x, str), dependencies)):
|
|
54 |
not all(isinstance(dep, str) for dep in dependencies):
|
|
55 | 55 |
config_error(DEPENDENCY_TYPE_ERROR) |
56 | 56 | |
57 | 57 |
if not callable(d['function']): |
src/authentic2/backends/ldap_backend.py | ||
---|---|---|
24 | 24 |
from ldap.dn import escape_dn_chars |
25 | 25 |
from ldap.ldapobject import ReconnectLDAPObject as NativeLDAPObject |
26 | 26 |
from ldap.controls import SimplePagedResultsControl |
27 |
PYTHON_LDAP3 = list(map(int, ldap.__version__.split('.'))) >= [3]
|
|
27 |
PYTHON_LDAP3 = [int(x) for x in ldap.__version__.split('.')] >= [3]
|
|
28 | 28 |
LDAPObject = NativeLDAPObject |
29 | 29 |
except ImportError: |
30 | 30 |
ldap = None |
... | ... | |
121 | 121 |
if mod_vals is None: |
122 | 122 |
pass |
123 | 123 |
elif isinstance(mod_vals, list): |
124 |
mod_vals = list(map(convert, mod_vals))
|
|
124 |
mod_vals = [convert(mod_val) for mod_val in mod_vals]
|
|
125 | 125 |
else: |
126 | 126 |
mod_vals = convert(mod_vals) |
127 | 127 |
new_modlist.append((mod_op, mod_typ, mod_vals)) |
... | ... | |
173 | 173 |
base = force_bytes(base) |
174 | 174 |
filterstr = force_bytes(filterstr) |
175 | 175 |
if attrlist: |
176 |
attrlist = map(force_bytes, attrlist)
|
|
176 |
attrlist = [force_bytes(attr) for attr in attrlist]
|
|
177 | 177 |
return NativeLDAPObject.search_ext(self, base, scope, |
178 | 178 |
filterstr=filterstr, |
179 | 179 |
attrlist=attrlist, |
... | ... | |
197 | 197 |
if mod_vals is None: |
198 | 198 |
pass |
199 | 199 |
elif isinstance(mod_vals, list): |
200 |
mod_vals = list(map(convert, mod_vals))
|
|
200 |
mod_vals = [convert(mod_val) for mod_val in mod_vals]
|
|
201 | 201 |
else: |
202 | 202 |
mod_vals = convert(mod_vals) |
203 | 203 |
new_modlist.append((mod_op, mod_typ, mod_vals)) |
... | ... | |
1214 | 1214 |
new_attributes = {} |
1215 | 1215 |
for key in attributes: |
1216 | 1216 |
try: |
1217 |
new_attributes[key.lower()] = list(map(lambda x: force_text(x, encoding), attributes[key]))
|
|
1217 |
new_attributes[key.lower()] = [force_text(value, encoding) for value in attributes[key]]
|
|
1218 | 1218 |
except UnicodeDecodeError: |
1219 | 1219 |
log.debug('unable to decode attribute %r as UTF-8, converting to base64', key) |
1220 |
new_attributes[key.lower()] = list(map(base64.b64encode, attributes[key]))
|
|
1220 |
new_attributes[key.lower()] = [base64.b64encode(value).decode('ascii') for value in attributes[key]]
|
|
1221 | 1221 |
return new_attributes |
1222 | 1222 | |
1223 | 1223 |
@classmethod |
src/authentic2/custom_user/models.py | ||
---|---|---|
102 | 102 |
return atv.to_python() |
103 | 103 |
else: |
104 | 104 |
# multiple |
105 |
return list(map(lambda x: x.to_python(), atv))
|
|
105 |
return [x.to_python() for x in atv]
|
|
106 | 106 |
return None |
107 | 107 | |
108 | 108 |
src/authentic2/exponential_retry_timeout.py | ||
---|---|---|
43 | 43 |
self.key_prefix = key_prefix |
44 | 44 | |
45 | 45 |
def key(self, keys): |
46 |
key = u'-'.join(map(six.text_type, keys))
|
|
46 |
key = u'-'.join(six.text_type(key) for key in keys)
|
|
47 | 47 |
key = key.encode('utf-8') |
48 | 48 |
return '%s%s' % (self.key_prefix or self.KEY_PREFIX, hashlib.md5(key).hexdigest()) |
49 | 49 |
src/authentic2/idp/saml/saml2_endpoints.py | ||
---|---|---|
1466 | 1466 |
logout.request.sessionIndexes = [] |
1467 | 1467 |
else: |
1468 | 1468 |
session_indexes = lib_sessions.values_list('session_index', flat=True) |
1469 |
logout.request.sessionIndexes = tuple(map(force_str, session_indexes))
|
|
1469 |
logout.request.sessionIndexes = tuple(force_str(session_index) for session_index in session_indexes)
|
|
1470 | 1470 |
logout.msgRelayState = logout.request.id |
1471 | 1471 |
try: |
1472 | 1472 |
logout.buildRequestMsg() |
src/authentic2/manager/resources.py | ||
---|---|---|
31 | 31 |
raise NotImplementedError |
32 | 32 | |
33 | 33 |
def render(self, value, object): |
34 |
return u', '.join(map(six.text_type, value.all()))
|
|
34 |
return u', '.join(six.text_type(v) for v in value.all())
|
|
35 | 35 | |
36 | 36 | |
37 | 37 |
class UserResource(ModelResource): |
... | ... | |
43 | 43 |
result.add(role) |
44 | 44 |
for pr in role.parent_relation.all(): |
45 | 45 |
result.add(pr.parent) |
46 |
return ', '.join(map(six.text_type, result))
|
|
46 |
return ', '.join(six.text_type(x) for x in result)
|
|
47 | 47 | |
48 | 48 |
class Meta: |
49 | 49 |
model = User |
src/authentic2/manager/user_views.py | ||
---|---|---|
449 | 449 |
for attr in attributes: |
450 | 450 |
record.append(attr_d.get(attr)) |
451 | 451 | |
452 |
return list(map(iso, record))
|
|
452 |
return [iso(x) for x in record]
|
|
453 | 453 | |
454 | 454 |
self._dataset = tablib.Dataset(headers=headers) |
455 | 455 |
for user in self.get_data(): |
... | ... | |
560 | 560 |
'members', queryset=User.objects.filter(pk=self.object.pk), |
561 | 561 |
to_attr='member')) |
562 | 562 |
qs2 = self.request.user.filter_by_perm('a2_rbac.manage_members_role', qs) |
563 |
managable_ids = map(str, qs2.values_list('pk', flat=True))
|
|
563 |
managable_ids = [str(pk) for pk in qs2.values_list('pk', flat=True)]
|
|
564 | 564 |
qs = qs.extra(select={'has_perm': 'a2_rbac_role.id in (%s)' % ', '.join(managable_ids)}) |
565 | 565 |
qs = qs.exclude(slug__startswith='_a2-managers-of-role') |
566 | 566 |
return qs |
src/authentic2/utils/__init__.py | ||
---|---|---|
1181 | 1181 |
def prepend_remember_cookie(request, response, name, value, count=5): |
1182 | 1182 |
values = get_remember_cookie(request, name, count=count) |
1183 | 1183 |
values = [value] + values[:count - 1] |
1184 |
response.set_cookie(name, ' '.join(map(str, values)),
|
|
1184 |
response.set_cookie(name, ' '.join(str(value) for value in values),
|
|
1185 | 1185 |
max_age=86400 * 365, # keep preferences for 1 year |
1186 | 1186 |
path=request.path, |
1187 | 1187 |
httponly=True) |
src/authentic2/views.py | ||
---|---|---|
470 | 470 |
if not isinstance(value, (list, tuple)): |
471 | 471 |
value = (value,) |
472 | 472 |
raw_value = value |
473 |
value = map(six.text_type, value)
|
|
473 |
value = [six.text_type(v) for v in value]
|
|
474 | 474 |
if value or app_settings.A2_PROFILE_DISPLAY_EMPTY_FIELDS: |
475 | 475 |
profile.append((title, value)) |
476 | 476 |
attributes.append({'attribute': attribute, 'values': raw_value}) |
src/authentic2_auth_oidc/management/commands/oidc-register-issuer.py | ||
---|---|---|
113 | 113 |
raise CommandError('invalid claim mapping %r. it must contain at least a claim and ' |
114 | 114 |
'an attribute name') |
115 | 115 |
claim, attribute = tup[:2] |
116 |
claim_options = map(str.strip, tup[2:])
|
|
116 |
claim_options = [x.strip() for x in tup[2:]]
|
|
117 | 117 |
extra = { |
118 | 118 |
'required': 'required' in claim_options, |
119 | 119 |
'idtoken_claim': 'idtoken' in claim_options, |
src/authentic2_idp_oidc/utils.py | ||
---|---|---|
103 | 103 | |
104 | 104 |
def clean_words(data): |
105 | 105 |
'''Clean and order a list of words''' |
106 |
return u' '.join(sorted(map(six.text_type.strip, data.split())))
|
|
106 |
return u' '.join(sorted(x.strip() for x in data.split()))
|
|
107 | 107 | |
108 | 108 | |
109 | 109 |
def url_domain(url): |
tests/test_hashers.py | ||
---|---|---|
28 | 28 | |
29 | 29 | |
30 | 30 |
def test_openldap_hashers(): |
31 |
VECTORS = map(str.split, '''\
|
|
31 |
VECTORS = [x.split() for x in '''\
|
|
32 | 32 |
coin {SHA}NHj+acfc68FPYrMipEBZ3t8ABGY= |
33 | 33 |
250523 {SHA}4zuJhPW1w0upqG7beAlxDcvtBj0= |
34 | 34 |
coin {SSHA}zLPxfZ3RSNkIwVdHWEyB4Tpr6fT9LiVX |
35 | 35 |
coin {SMD5}+x9QkU2T/wlPp6NK3bfYYxPYwaE= |
36 |
coin {MD5}lqlRm4/d0X6MxLugQI///Q=='''.splitlines())
|
|
36 |
coin {MD5}lqlRm4/d0X6MxLugQI///Q=='''.splitlines()]
|
|
37 | 37 |
for password, oldap_hash in VECTORS: |
38 | 38 |
dj_hash = hashers.olap_password_to_dj(oldap_hash) |
39 | 39 |
assert check_password(password, dj_hash) |
40 |
- |