~ubuntu-core-dev/ubuntu/hirsute/apport/ubuntu

« back to all changes in this revision

Viewing changes to apport/hookutils.py

  • Committer: Brian Murray
  • Date: 2020-06-24 16:15:42 UTC
  • Revision ID: brian@canonical.com-20200624161542-fh9hv8j2v6grndqq
Fix pep8 errors regarding ambiguous variables.

Show diffs side-by-side

added added

removed removed

Lines of Context:
617
617
    env['XDG_CONFIG_HOME'] = '/nonexisting'
618
618
    gsettings = subprocess.Popen(['gsettings', 'list-recursively', schema],
619
619
                                 env=env, stdout=subprocess.PIPE)
620
 
    for l in gsettings.stdout:
 
620
    for line in gsettings.stdout:
621
621
        try:
622
 
            (schema_name, key, value) = l.split(None, 2)
 
622
            (schema_name, key, value) = line.split(None, 2)
623
623
            value = value.rstrip()
624
624
        except ValueError:
625
625
            continue  # invalid line
627
627
 
628
628
    gsettings = subprocess.Popen(['gsettings', 'list-recursively', schema],
629
629
                                 stdout=subprocess.PIPE)
630
 
    for l in gsettings.stdout:
 
630
    for line in gsettings.stdout:
631
631
        try:
632
 
            (schema_name, key, value) = l.split(None, 2)
 
632
            (schema_name, key, value) = line.split(None, 2)
633
633
            value = value.rstrip()
634
634
        except ValueError:
635
635
            continue  # invalid line
813
813
            return 'invalid'
814
814
    except OSError:
815
815
        return None
816
 
    for l in out.splitlines():
817
 
        fields = l.split(':', 1)
 
816
    for line in out.splitlines():
 
817
        fields = line.split(':', 1)
818
818
        if len(fields) < 2:
819
819
            continue
820
820
        if fields[0] == 'license':
828
828
 
829
829
    try:
830
830
        with open(module_list) as f:
831
 
            mods = [l.split()[0] for l in f]
 
831
            mods = [line.split()[0] for line in f]
832
832
    except IOError:
833
833
        return []
834
834
 
924
924
 
925
925
    if os.path.exists(path):
926
926
        with open(path, 'r') as f:
927
 
            filtered = [l if not l.startswith('password')
 
927
            filtered = [line if not line.startswith('password')
928
928
                        else '### PASSWORD LINE REMOVED ###'
929
 
                        for l in f.readlines()]
 
929
                        for line in f.readlines()]
930
930
            report[key] = ''.join(filtered)
931
931
 
932
932