From 0d9f72e52f2ece3b0c8d9325e09234e8792fb0a5 Mon Sep 17 00:00:00 2001 From: Ilya Shakhat Date: Mon, 22 Dec 2014 18:49:58 +0300 Subject: [PATCH] Update from global requirements Fix lots of pep8 issues caused by new version of hacking. Change-Id: I70c1bef9e826a7c74ef87c052fc248e858ea0c73 --- requirements-py3.txt | 4 +- requirements.txt | 2 +- stackalytics/dashboard/helpers.py | 6 +- stackalytics/dashboard/web.py | 2 +- .../processor/default_data_processor.py | 2 +- stackalytics/processor/dump.py | 2 +- stackalytics/processor/mps.py | 8 +- test-requirements.txt | 4 +- tests/api/test_companies.py | 61 ++++--- tests/api/test_modules.py | 89 ++++----- tests/api/test_stats.py | 169 +++++++++--------- tests/unit/test_web_utils.py | 7 +- tox.ini | 4 +- 13 files changed, 188 insertions(+), 172 deletions(-) diff --git a/requirements-py3.txt b/requirements-py3.txt index 9e33665f9..8af39ed49 100644 --- a/requirements-py3.txt +++ b/requirements-py3.txt @@ -2,14 +2,14 @@ # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. -pbr>=0.6,!=0.7,<0.10.3 +pbr>=0.6,!=0.7,<1.0 Babel>=1.3 Flask>=0.10,<1.0 iso8601>=0.1.9 oslo.config>=1.4.0 # Apache-2.0 oslo.i18n>=1.0.0 # Apache-2.0 oslo.serialization>=1.0.0 # Apache-2.0 -oslo.utils>=1.0.0 # Apache-2.0 +oslo.utils>=1.1.0 # Apache-2.0 paramiko>=1.13.0 psutil>=1.1.1,<2.0.0 PyGithub diff --git a/requirements.txt b/requirements.txt index f8788bb0c..dea9e07c0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,7 +9,7 @@ iso8601>=0.1.9 oslo.config>=1.4.0 # Apache-2.0 oslo.i18n>=1.0.0 # Apache-2.0 oslo.serialization>=1.0.0 # Apache-2.0 -oslo.utils>=1.0.0 # Apache-2.0 +oslo.utils>=1.1.0 # Apache-2.0 paramiko>=1.13.0 psutil>=1.1.1,<2.0.0 PyGithub diff --git a/stackalytics/dashboard/helpers.py b/stackalytics/dashboard/helpers.py index 828acf5c2..912f3f219 100644 --- a/stackalytics/dashboard/helpers.py +++ b/stackalytics/dashboard/helpers.py @@ -237,9 +237,9 @@ def make_link(title, uri=None, options=None): 'metric') param_values = {} for param_name in param_names: - v = parameters.get_parameter({}, param_name) - if v: - param_values[param_name] = ','.join(v) + value = parameters.get_parameter({}, param_name) + if value: + param_values[param_name] = ','.join(value) if options: param_values.update(options) if param_values: diff --git a/stackalytics/dashboard/web.py b/stackalytics/dashboard/web.py index 66fde1110..3464731d3 100644 --- a/stackalytics/dashboard/web.py +++ b/stackalytics/dashboard/web.py @@ -274,7 +274,7 @@ def get_companies_json(record_ids, **kwargs): memory_storage = vault.get_memory_storage() companies = set(company for company in memory_storage.get_index_keys_by_record_ids( - 'company_name', record_ids)) + 'company_name', record_ids)) if kwargs['_params']['company']: companies.add(memory_storage.get_original_company_name( diff --git a/stackalytics/processor/default_data_processor.py b/stackalytics/processor/default_data_processor.py index 64dc1b5f0..320ff3596 100644 --- a/stackalytics/processor/default_data_processor.py +++ b/stackalytics/processor/default_data_processor.py @@ -16,10 +16,10 @@ import collections import hashlib import json +import re from github import MainClass from oslo.config import cfg -import re import six from stackalytics.openstack.common import log as logging diff --git a/stackalytics/processor/dump.py b/stackalytics/processor/dump.py index b338a94e7..248fc2ac7 100644 --- a/stackalytics/processor/dump.py +++ b/stackalytics/processor/dump.py @@ -14,11 +14,11 @@ # limitations under the License. import pickle +import re import sys import memcache from oslo.config import cfg -import re import six from six.moves.urllib import parse diff --git a/stackalytics/processor/mps.py b/stackalytics/processor/mps.py index 515c89eb5..933fc6be4 100644 --- a/stackalytics/processor/mps.py +++ b/stackalytics/processor/mps.py @@ -25,10 +25,10 @@ from stackalytics.processor import utils LOG = logging.getLogger(__name__) -NAME_AND_DATE_PATTERN = r'

(?P[^<]*)[\s\S]*?' \ - r'
(?P[^<]*)' -COMPANY_PATTERN = r'Date\sJoined[\s\S]*?(?P[^<]*)' \ - r'[\s\S]*?From\s(?P[\s\S]*?)\(Current\)' +NAME_AND_DATE_PATTERN = (r'

(?P[^<]*)[\s\S]*?' + r'
(?P[^<]*)') +COMPANY_PATTERN = (r'Date\sJoined[\s\S]*?(?P[^<]*)' + r'[\s\S]*?From\s(?P[\s\S]*?)\(Current\)') GARBAGE_PATTERN = r'[/\\~%^\*_]+' diff --git a/test-requirements.txt b/test-requirements.txt index ef2a1316e..042635df7 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -3,7 +3,7 @@ # process, which may cause wedges in the gate later. # Hacking already pins down pep8, pyflakes and flake8 -hacking>=0.8.0,<0.9 +hacking>=0.9.4,<0.10 coverage>=3.6 discover fixtures>=0.3.14 @@ -13,4 +13,4 @@ python-subunit sphinx>=1.1.2,!=1.2.0,!=1.3b1,<1.3 sphinxcontrib-httpdomain testrepository>=0.0.17 -testtools>=0.9.32 +testtools>=0.9.32,<0.9.35 diff --git a/tests/api/test_companies.py b/tests/api/test_companies.py index 9d7896280..648de428c 100644 --- a/tests/api/test_companies.py +++ b/tests/api/test_companies.py @@ -20,17 +20,18 @@ class TestAPICompanies(test_api.TestAPI): def test_get_companies(self): with test_api.make_runtime_storage( - {'repos': [ - {'module': 'nova', 'project_type': 'openstack', - 'organization': 'openstack', - 'uri': 'git://git.openstack.org/openstack/nova.git'}, - {'module': 'glance', 'project_type': 'openstack', - 'organization': 'openstack', - 'uri': 'git://git.openstack.org/openstack/glance.git'}], + { + 'repos': [ + {'module': 'nova', 'project_type': 'openstack', + 'organization': 'openstack', + 'uri': 'git://git.openstack.org/openstack/nova.git'}, + {'module': 'glance', 'project_type': 'openstack', + 'organization': 'openstack', + 'uri': 'git://git.openstack.org/openstack/glance.git'} + ], 'project_types': [ {'id': 'openstack', 'title': 'OpenStack', - 'modules': ['nova', 'glance']} - ], + 'modules': ['nova', 'glance']}], 'releases': [{'release_name': 'prehistory', 'end_date': 1234567890}, {'release_name': 'icehouse', @@ -75,26 +76,28 @@ class TestAPICompanies(test_api.TestAPI): def test_get_company(self): with test_api.make_runtime_storage( - {'repos': [ - {'module': 'nova', 'project_type': 'openstack', - 'organization': 'openstack', - 'uri': 'git://git.openstack.org/openstack/nova.git'}, - {'module': 'glance', 'project_type': 'openstack', - 'organization': 'openstack', - 'uri': 'git://git.openstack.org/openstack/glance.git'}], - 'module_groups': { - 'nova': test_api.make_module('nova'), - 'glance': test_api.make_module('glance'), - }, - 'releases': [{'release_name': 'prehistory', - 'end_date': 1234567890}, - {'release_name': 'icehouse', - 'end_date': 1234567890}], - 'project_types': [ - {'id': 'all', 'title': 'All', - 'modules': ['nova', 'glance', 'nova-cli']}, - {'id': 'openstack', 'title': 'OpenStack', - 'modules': ['nova', 'glance']}]}, + { + 'repos': [ + {'module': 'nova', 'project_type': 'openstack', + 'organization': 'openstack', + 'uri': 'git://git.openstack.org/openstack/nova.git'}, + {'module': 'glance', 'project_type': 'openstack', + 'organization': 'openstack', + 'uri': 'git://git.openstack.org/openstack/glance.git'} + ], + 'module_groups': { + 'nova': test_api.make_module('nova'), + 'glance': test_api.make_module('glance'), + }, + 'releases': [{'release_name': 'prehistory', + 'end_date': 1234567890}, + {'release_name': 'icehouse', + 'end_date': 1234567890}], + 'project_types': [ + {'id': 'all', 'title': 'All', + 'modules': ['nova', 'glance', 'nova-cli']}, + {'id': 'openstack', 'title': 'OpenStack', + 'modules': ['nova', 'glance']}]}, test_api.make_records(record_type=['commit'], loc=[10, 20, 30], module=['glance'], diff --git a/tests/api/test_modules.py b/tests/api/test_modules.py index 3c6386bcd..1f1d7b8e8 100644 --- a/tests/api/test_modules.py +++ b/tests/api/test_modules.py @@ -20,29 +20,31 @@ class TestAPIModules(test_api.TestAPI): def test_get_modules(self): with test_api.make_runtime_storage( - {'repos': [ - {'module': 'nova', 'organization': 'openstack', - 'uri': 'git://git.openstack.org/openstack/nova.git'}, - {'module': 'glance', 'organization': 'openstack', - 'uri': 'git://git.openstack.org/openstack/glance.git'}], - 'module_groups': { - 'nova-group': {'id': 'nova-group', - 'module_group_name': 'nova-group', - 'modules': ['nova', 'nova-cli'], - 'tag': 'group'}, - 'nova': test_api.make_module('nova'), - 'nova-cli': test_api.make_module('nova-cli'), - 'glance': test_api.make_module('glance'), - }, - 'releases': [{'release_name': 'prehistory', - 'end_date': 1234567890}, - {'release_name': 'icehouse', - 'end_date': 1234567890}], - 'project_types': [ - {'id': 'all', 'title': 'All', - 'modules': ['nova', 'glance', 'nova-cli']}, - {'id': 'integrated', 'title': 'Integrated', - 'modules': ['nova', 'glance']}]}, + { + 'repos': [ + {'module': 'nova', 'organization': 'openstack', + 'uri': 'git://git.openstack.org/openstack/nova.git'}, + {'module': 'glance', 'organization': 'openstack', + 'uri': 'git://git.openstack.org/openstack/glance.git'} + ], + 'module_groups': { + 'nova-group': {'id': 'nova-group', + 'module_group_name': 'nova-group', + 'modules': ['nova', 'nova-cli'], + 'tag': 'group'}, + 'nova': test_api.make_module('nova'), + 'nova-cli': test_api.make_module('nova-cli'), + 'glance': test_api.make_module('glance'), + }, + 'releases': [ + {'release_name': 'prehistory', 'end_date': 1234567890}, + {'release_name': 'icehouse', 'end_date': 1234567890}], + 'project_types': [{'id': 'all', 'title': 'All', + 'modules': ['nova', 'glance', + 'nova-cli']}, + {'id': 'integrated', + 'title': 'Integrated', + 'modules': ['nova', 'glance']}]}, test_api.make_records(record_type=['commit'], module=['glance', 'nova', 'nova-cli'])): @@ -73,26 +75,27 @@ class TestAPIModules(test_api.TestAPI): def test_get_module(self): with test_api.make_runtime_storage( - {'repos': [ - {'module': 'nova', 'organization': 'openstack', - 'uri': 'git://git.openstack.org/openstack/nova.git'}], - 'module_groups': { - 'nova-group': {'id': 'nova-group', - 'module_group_name': 'nova-group', - 'modules': ['nova-cli', 'nova'], - 'tag': 'group'}, - 'nova': test_api.make_module('nova'), - 'nova-cli': test_api.make_module('nova-cli'), - }, - 'releases': [{'release_name': 'prehistory', - 'end_date': 1234567890}, - {'release_name': 'icehouse', - 'end_date': 1234567890}], - 'project_types': [ - {'id': 'all', 'title': 'All', - 'modules': ['nova', 'glance', 'nova-cli']}, - {'id': 'openstack', 'title': 'OpenStack', - 'modules': ['nova', 'glance']}]}, + { + 'repos': [ + {'module': 'nova', 'organization': 'openstack', + 'uri': 'git://git.openstack.org/openstack/nova.git'}], + 'module_groups': { + 'nova-group': {'id': 'nova-group', + 'module_group_name': 'nova-group', + 'modules': ['nova-cli', 'nova'], + 'tag': 'group'}, + 'nova': test_api.make_module('nova'), + 'nova-cli': test_api.make_module('nova-cli'), + }, + 'releases': [{'release_name': 'prehistory', + 'end_date': 1234567890}, + {'release_name': 'icehouse', + 'end_date': 1234567890}], + 'project_types': [ + {'id': 'all', 'title': 'All', + 'modules': ['nova', 'glance', 'nova-cli']}, + {'id': 'openstack', 'title': 'OpenStack', + 'modules': ['nova', 'glance']}]}, test_api.make_records(record_type=['commit'])): response = self.app.get('/api/1.0/modules/nova') diff --git a/tests/api/test_stats.py b/tests/api/test_stats.py index 45de63ccf..ff5efb7a6 100644 --- a/tests/api/test_stats.py +++ b/tests/api/test_stats.py @@ -20,26 +20,28 @@ class TestAPIStats(test_api.TestAPI): def test_get_modules(self): with test_api.make_runtime_storage( - {'repos': [ - {'module': 'nova', 'organization': 'openstack', - 'uri': 'git://git.openstack.org/openstack/nova.git'}, - {'module': 'glance', 'organization': 'openstack', - 'uri': 'git://git.openstack.org/openstack/glance.git'}], - 'releases': [{'release_name': 'prehistory', - 'end_date': 1234567890}, - {'release_name': 'icehouse', - 'end_date': 1234567890}], - 'module_groups': { - 'openstack': {'id': 'openstack', - 'module_group_name': 'openstack', - 'modules': ['nova', 'glance'], - 'tag': 'group'}, - 'nova': test_api.make_module('nova'), - 'glance': test_api.make_module('glance'), - }, - 'project_types': [ - {'id': 'all', 'title': 'All', - 'modules': ['nova', 'glance']}]}, + { + 'repos': [ + {'module': 'nova', 'organization': 'openstack', + 'uri': 'git://git.openstack.org/openstack/nova.git'}, + {'module': 'glance', 'organization': 'openstack', + 'uri': 'git://git.openstack.org/openstack/glance.git'} + ], + 'releases': [{'release_name': 'prehistory', + 'end_date': 1234567890}, + {'release_name': 'icehouse', + 'end_date': 1234567890}], + 'module_groups': { + 'openstack': {'id': 'openstack', + 'module_group_name': 'openstack', + 'modules': ['nova', 'glance'], + 'tag': 'group'}, + 'nova': test_api.make_module('nova'), + 'glance': test_api.make_module('glance'), + }, + 'project_types': [ + {'id': 'all', 'title': 'All', + 'modules': ['nova', 'glance']}]}, test_api.make_records(record_type=['commit'], loc=[10, 20, 30], module=['nova']), @@ -57,36 +59,39 @@ class TestAPIStats(test_api.TestAPI): def test_get_engineers(self): with test_api.make_runtime_storage( - {'repos': [ - {'module': 'nova', 'project_type': 'openstack', - 'organization': 'openstack', - 'uri': 'git://git.openstack.org/openstack/nova.git'}, - {'module': 'glance', 'project_type': 'openstack', - 'organization': 'openstack', - 'uri': 'git://git.openstack.org/openstack/glance.git'}], - 'releases': [{'release_name': 'prehistory', - 'end_date': 1234567890}, - {'release_name': 'icehouse', - 'end_date': 1234567890}], - 'module_groups': { - 'openstack': {'id': 'openstack', - 'module_group_name': 'openstack', - 'modules': ['nova', 'glance'], - 'tag': 'group'}, - 'nova': test_api.make_module('nova'), - 'glance': test_api.make_module('glance'), - }, - 'project_types': [ - {'id': 'all', 'title': 'All', - 'modules': ['nova', 'glance']}], - 'user:john_doe': { - 'seq': 1, 'user_id': 'john_doe', 'user_name': 'John Doe', - 'companies': [{'company_name': 'NEC', 'end_date': 0}], - 'emails': ['john_doe@gmail.com'], 'core': []}, - 'user:bill': { - 'seq': 1, 'user_id': 'bill', 'user_name': 'Bill Smith', - 'companies': [{'company_name': 'IBM', 'end_date': 0}], - 'emails': ['bill_smith@gmail.com'], 'core': []}}, + { + 'repos': [ + {'module': 'nova', 'project_type': 'openstack', + 'organization': 'openstack', + 'uri': 'git://git.openstack.org/openstack/nova.git'}, + {'module': 'glance', 'project_type': 'openstack', + 'organization': 'openstack', + 'uri': 'git://git.openstack.org/openstack/glance.git'} + ], + 'releases': [{'release_name': 'prehistory', + 'end_date': 1234567890}, + {'release_name': 'icehouse', + 'end_date': 1234567890}], + 'module_groups': { + 'openstack': {'id': 'openstack', + 'module_group_name': 'openstack', + 'modules': ['nova', 'glance'], + 'tag': 'group'}, + 'nova': test_api.make_module('nova'), + 'glance': test_api.make_module('glance'), + }, + 'project_types': [ + {'id': 'all', 'title': 'All', + 'modules': ['nova', 'glance']}], + 'user:john_doe': { + 'seq': 1, 'user_id': 'john_doe', + 'user_name': 'John Doe', + 'companies': [{'company_name': 'NEC', 'end_date': 0}], + 'emails': ['john_doe@gmail.com'], 'core': []}, + 'user:bill': { + 'seq': 1, 'user_id': 'bill', 'user_name': 'Bill Smith', + 'companies': [{'company_name': 'IBM', 'end_date': 0}], + 'emails': ['bill_smith@gmail.com'], 'core': []}}, test_api.make_records(record_type=['commit'], loc=[10, 20, 30], module=['nova'], @@ -110,36 +115,40 @@ class TestAPIStats(test_api.TestAPI): def test_get_engineers_extended(self): with test_api.make_runtime_storage( - {'repos': [ - {'module': 'nova', 'project_type': 'openstack', - 'organization': 'openstack', - 'uri': 'git://git.openstack.org/openstack/nova.git'}, - {'module': 'glance', 'project_type': 'openstack', - 'organization': 'openstack', - 'uri': 'git://git.openstack.org/openstack/glance.git'}], - 'releases': [{'release_name': 'prehistory', - 'end_date': 1234567890}, - {'release_name': 'icehouse', - 'end_date': 1234567890}], - 'module_groups': { - 'openstack': {'id': 'openstack', - 'module_group_name': 'openstack', - 'modules': ['nova', 'glance'], - 'tag': 'group'}, - 'nova': test_api.make_module('nova'), - 'glance': test_api.make_module('glance'), - }, - 'project_types': [ - {'id': 'all', 'title': 'All', - 'modules': ['nova', 'glance']}], - 'user:john_doe': { - 'seq': 1, 'user_id': 'john_doe', 'user_name': 'John Doe', - 'companies': [{'company_name': 'NEC', 'end_date': 0}], - 'emails': ['john_doe@gmail.com'], 'core': []}, - 'user:smith': { - 'seq': 1, 'user_id': 'smith', 'user_name': 'Bill Smith', - 'companies': [{'company_name': 'IBM', 'end_date': 0}], - 'emails': ['bill_smith@gmail.com'], 'core': []}}, + { + 'repos': [ + {'module': 'nova', 'project_type': 'openstack', + 'organization': 'openstack', + 'uri': 'git://git.openstack.org/openstack/nova.git'}, + {'module': 'glance', 'project_type': 'openstack', + 'organization': 'openstack', + 'uri': 'git://git.openstack.org/openstack/glance.git'} + ], + 'releases': [{'release_name': 'prehistory', + 'end_date': 1234567890}, + {'release_name': 'icehouse', + 'end_date': 1234567890}], + 'module_groups': { + 'openstack': {'id': 'openstack', + 'module_group_name': 'openstack', + 'modules': ['nova', 'glance'], + 'tag': 'group'}, + 'nova': test_api.make_module('nova'), + 'glance': test_api.make_module('glance'), + }, + 'project_types': [ + {'id': 'all', 'title': 'All', + 'modules': ['nova', 'glance']}], + 'user:john_doe': { + 'seq': 1, 'user_id': 'john_doe', + 'user_name': 'John Doe', + 'companies': [{'company_name': 'NEC', 'end_date': 0}], + 'emails': ['john_doe@gmail.com'], 'core': []}, + 'user:smith': { + 'seq': 1, 'user_id': 'smith', + 'user_name': 'Bill Smith', + 'companies': [{'company_name': 'IBM', 'end_date': 0}], + 'emails': ['bill_smith@gmail.com'], 'core': []}}, test_api.make_records(record_type=['commit'], loc=[10, 20, 30], module=['nova'], diff --git a/tests/unit/test_web_utils.py b/tests/unit/test_web_utils.py index d64a675b7..0eeadb4eb 100644 --- a/tests/unit/test_web_utils.py +++ b/tests/unit/test_web_utils.py @@ -47,9 +47,10 @@ update the block_device_mapping with the potentially new connection_info \ returned. Fixes bug \ 1076801 -''' + ('Change-Id: ' - 'Ie49ccd2138905e178843b375a9b16c3fe572d1db') +''' + ( + 'Change-Id: ' + 'Ie49ccd2138905e178843b375a9b16c3fe572d1db') observed = helpers.make_commit_message(record) diff --git a/tox.ini b/tox.ini index d801795ad..addea0c0c 100644 --- a/tox.ini +++ b/tox.ini @@ -40,8 +40,8 @@ downloadcache = ~/cache/pip commands = python setup.py build_sphinx [flake8] -# E125 continuation line does not distinguish itself from next logical line -ignore = E125 +# H904 Wrap long lines in parentheses instead of a backslash +ignore = H904 show-source = true builtins = _ exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,tools,build