Projet

Général

Profil

0012-trivial-fix-unnecessary-lambda-pylint-warning-52732.patch

Frédéric Péters, 04 avril 2021 17:20

Télécharger (3,45 ko)

Voir les différences:

Subject: [PATCH 12/15] trivial: fix unnecessary-lambda pylint warning (#52732)

 pylint.rc                          | 1 -
 tests/backoffice_pages/test_all.py | 4 ++--
 tests/form_pages/test_block.py     | 2 +-
 wcs/forms/backoffice.py            | 2 +-
 wcs/qommon/form.py                 | 2 +-
 5 files changed, 5 insertions(+), 6 deletions(-)
pylint.rc
55 55
    too-many-statements,
56 56
    undefined-loop-variable,
57 57
    unnecessary-comprehension,
58
    unnecessary-lambda,
59 58
    unsubscriptable-object,
60 59
    unsupported-membership-test,
61 60
    unused-argument
tests/backoffice_pages/test_all.py
1699 1699
    assert 'Executing task "Mark as duplicates" on forms' in resp.text
1700 1700
    assert '>completed<' in resp.text
1701 1701
    oldest_formdata = None
1702
    for i, id in enumerate(sorted(ids, key=lambda x: int(x))):
1702
    for i, id in enumerate(sorted(ids, key=int)):
1703 1703
        if i == 0:
1704 1704
            oldest_formdata = formdef.data_class().get(id)
1705 1705
            assert formdef.data_class().get(id).status == 'wf-accepted'
......
1743 1743
    resp = resp.follow()
1744 1744
    assert 'Executing task &quot;Show user&quot; on forms' in resp.text
1745 1745
    assert '>completed<' in resp.text
1746
    for id in sorted(ids, key=lambda x: int(x)):
1746
    for id in sorted(ids, key=int):
1747 1747
        content = formdef.data_class().get(id).evolution[-1].parts[0].content
1748 1748
        assert 'session_user=admin' in content
1749 1749

  
tests/form_pages/test_block.py
1265 1265
            payload = [{'id': '2', 'text': 'bar'}]
1266 1266
        return io.StringIO(json.dumps({'data': payload}))
1267 1267

  
1268
    mock_urlopen.side_effect = lambda url: data_source(url)
1268
    mock_urlopen.side_effect = data_source
1269 1269

  
1270 1270
    FormDef.wipe()
1271 1271
    BlockDef.wipe()
wcs/forms/backoffice.py
216 216
            item_ids_dict = {x: True for x in item_ids}
217 217
            item_ids = [x for x in ordered_ids if x in item_ids_dict]
218 218
        else:
219
            item_ids.sort(key=lambda x: int(x))
219
            item_ids.sort(key=int)
220 220
            item_ids.reverse()
221 221

  
222 222
        total_count = len(item_ids)
wcs/qommon/form.py
2642 2642
            pwd1 = None
2643 2643

  
2644 2644
        PASSWORD_FORMATS = {
2645
            'cleartext': lambda x: force_str(x),
2645
            'cleartext': force_str,
2646 2646
            'md5': lambda x: force_str(hashlib.md5(force_bytes(x)).hexdigest()),
2647 2647
            'sha1': lambda x: force_str(hashlib.sha1(force_bytes(x)).hexdigest()),
2648 2648
        }
2649
-