Ratchet down and simplify linting rules

Some cleanup of the flake8 config while fixing minor linting
violations previously ignored.

Change-Id: Ie56205248a8f296c06fb19c24080e4ac52f76228
This commit is contained in:
Jeremy Stanley 2025-03-21 13:31:23 +00:00
parent 6d595cef17
commit e4ebee51b8
3 changed files with 12 additions and 13 deletions

View File

@ -1,6 +1,5 @@
[flake8]
# E123, E125 skipped as they are invalid PEP-8.
show-source = True
ignore = E123,E125,E126,E129,E226,H,W503,W504,W605
builtins = _
exclude=.venv,.git,.nox,.tox,dist,doc,*lib/python*,*egg,build
# E123, E125 and W503 are invalid per PEP-8; OpenStack's H rules don't apply
ignore = E123,E125,H,W503
show-source = True

View File

@ -221,11 +221,11 @@ def add_ml_activity(ml_activity, site, archive):
# handle both MM2 and MM3 format inboxes whose FROM lines
# differ slightly
fromline = re.match(
r'From ([^ ]+)(@| at )([0-9A-Za-z\.-]+\.[0-9A-Za-z\.-]+) +'
r'(Sun|Mon|Tue|Wed|Thu|Fri|Sat) '
r'(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) '
r'[ 123][0-9] [012][0-9]:[0-9]{2}:[0-9]{2} [0-9]{4}$',
line)
r'From ([^ ]+)(@| at )([0-9A-Za-z\.-]+\.[0-9A-Za-z\.-]+) +'
r'(Sun|Mon|Tue|Wed|Thu|Fri|Sat) '
r'(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) '
r'[ 123][0-9] [012][0-9]:[0-9]{2}:[0-9]{2} [0-9]{4}$',
line)
if fromline:
localpart, _, domainpart = fromline.groups()[:3]
domainpart = domainpart.lower()
@ -368,10 +368,10 @@ def main(verbose=0):
argument = parse_command_line()
if argument.startswith('record-'):
mode = 'record'
argument = argument[len(mode)+1:]
argument = argument[len(mode) + 1:]
elif argument.startswith('replay-'):
mode = 'replay'
argument = argument[len(mode)+1:]
argument = argument[len(mode) + 1:]
else:
mode = 'live'
@ -412,7 +412,7 @@ def main(verbose=0):
# Offset additional pages by half the returned entry count to help
# avoid missing changes due to pagination instability
if new_changes and new_changes[-1].get('_more_changes', False):
offset += int(len(new_changes)/2)
offset += int(len(new_changes) / 2)
else:
offset = -1

View File

@ -95,7 +95,7 @@ group_path = 'a/groups/%s/members/?recursive&pp=0'
projects_file = ('gitweb?p=openstack/governance.git;a=blob_plain;'
'f=reference/projects.yaml;hb=%s')
ref_name = 'refs/heads/master'
aprv_pattern = 'label-Workflow = .*\.\.\+1 group (.*)'
aprv_pattern = r'label-Workflow = .*\.\.\+1 group (.*)'
projects = requests.get(gerrit_url + projects_file % ref_name)
projects.encoding = 'utf-8' # Workaround for Gitweb encoding
projects = yaml.safe_load(projects.text)