diff --git a/.flake8 b/.flake8 index 177fdbe..ae33f46 100644 --- a/.flake8 +++ b/.flake8 @@ -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 diff --git a/engagement/stats.py b/engagement/stats.py index 1188556..1bd01d2 100755 --- a/engagement/stats.py +++ b/engagement/stats.py @@ -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 diff --git a/engagement/who-approves.py b/engagement/who-approves.py index 55b240e..8f1b0c1 100755 --- a/engagement/who-approves.py +++ b/engagement/who-approves.py @@ -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)