d3b384b pylint: Fix unnecessary-dict-index-lookup

2 files Authored by slev 2 years ago, Committed by rcritten 2 years ago,
    pylint: Fix unnecessary-dict-index-lookup
    
    Pylint 2.9 introduced new check:
    > Emitted when iterating over the dictionary items (key-item pairs) and
    accessing the value by index lookup. The value can be accessed directly
    instead.
    
    Note: in Python3 removing from dict during an iteration is not
    possible even. For example,
    ```
    cat a.py
    d = {"a": 1}
    
    for k, v in d.items():
        if v is not None:
            del d[k]
    
    python3 a.py
    Traceback (most recent call last):
      File "/usr/src/RPM/BUILD/freeipa/a.py", line 3, in <module>
        for k, v in d.items():
    RuntimeError: dictionary changed size during iteration
    ```
    
    Fixes: https://pagure.io/freeipa/issue/9117
    Signed-off-by: Stanislav Levin <slev@altlinux.org>
    Reviewed-By: Rob Crittenden <rcritten@redhat.com>