Cleanup repo

* Remove unused files babel.cfg and openstack-common.conf.
* Remove obsolete entries from setup.cfg.
* Remove six as requirement
* Switch to newer hacking version and fix all problems.
* Remove Babel requirement, update requirements for python3

Change-Id: I1fc46288e54a5b787afbd9ee31b32a0e7d28c6de
This commit is contained in:
Andreas Jaeger 2020-06-09 10:45:08 +02:00
parent 4be7831173
commit 7be58d6af8
12 changed files with 27 additions and 50 deletions

View File

@ -1 +0,0 @@
[python: **.py]

View File

@ -1,7 +0,0 @@
[DEFAULT]
# The list of modules to copy from oslo-incubator.git
module=install_venv_common
# The base module to hold the copy of openstack.common
base=reviewstats

View File

@ -1,8 +1,6 @@
paramiko
pbr>=0.5.21,<1.0
pbr>=2.0,!=2.1.0
prettytable
Babel>=1.3
pytz>=2010h
requests>=2.2.0,!=2.4.0
six>=1.7.0
PyYAML>=3.1.0

View File

@ -139,8 +139,8 @@ class Listener(object):
closed in the period, and bug tags present on any critical bugs.
"""
for period in self.periods:
yield ([period[0].strftime('%Y-%m-%d')] +
period[1:-1] + [','.join(period[-1])])
yield ([period[0].strftime('%Y-%m-%d')]
+ period[1:-1] + [','.join(period[-1])])
def main():

View File

@ -21,8 +21,6 @@ import logging
import optparse
import sys
import six
from reviewstats import utils
@ -176,7 +174,7 @@ def print_stats_txt(stats, f=sys.stdout):
print_item_txt(item, level)
def print_item_txt(item, level):
if isinstance(item, six.text_type):
if isinstance(item, str):
f.write('%s\n' % item.encode('utf-8'))
elif isinstance(item, list):
print_list_txt(item, level + 1)
@ -205,7 +203,7 @@ def print_stats_html(stats, f=sys.stdout):
f.write('</%s>\n' % ('ul' if level == 1 else 'ol'))
def print_item_html(item, level):
if isinstance(item, six.text_type):
if isinstance(item, str):
f.write('%s' % item.encode('utf-8'))
elif isinstance(item, list):
print_list_html(item, level + 1)

View File

@ -80,8 +80,9 @@ def process_patchset(project, patchset, reviewers, ts, options):
reviewer = review['by'].get('username', 'unknown')
set_defaults(reviewer, reviewers)
if (review['type'] == 'Approved' or
(review['type'] == 'Workflow' and int(review['value']) > 0)):
if (review['type'] == 'Approved'
or (review['type'] == 'Workflow'
and int(review['value']) > 0)):
cur = reviewers[reviewer]['votes']['A']
reviewers[reviewer]['votes']['A'] = cur + 1
elif review['type'] != 'Workflow':
@ -210,8 +211,8 @@ def write_pretty(reviewer_data, file_obj, options, reviewers, projects,
'(%.1f/day)\n')
% (options.days, change_stats['wip'],
float(change_stats['wip']) / options.days))
queue_growth = (change_stats['created'] - change_stats['merged'] -
change_stats['abandoned'] - change_stats['wip'])
queue_growth = (change_stats['created'] - change_stats['merged']
- change_stats['abandoned'] - change_stats['wip'])
file_obj.write(
(' Queue growth in the last %d days: %d '
'(%.1f/day)\n')

View File

@ -58,7 +58,7 @@ def main():
milestones = {}
changes = utils.get_changes(projects, args.user, args.key, only_open=True)
bug_regex = re.compile('bug/(\d+)')
bug_regex = re.compile(r'bug/(\d+)')
for change in changes:
if 'topic' not in change:
continue

View File

@ -18,18 +18,18 @@
import glob
import gzip
import io
import json
import logging
import os
import pickle
import time
import urllib
import yaml
import paramiko
import requests
import requests.auth
from six.moves import cPickle as pickle
from six.moves import cStringIO
from six.moves import urllib
LOG = logging.getLogger(__name__)
@ -59,7 +59,7 @@ def get_remote_data(address, datatype='json'):
data += chunk
if remote_data.info().get('Content-Encoding') == 'gzip':
buf = cStringIO.StringIO(data)
buf = io.StringIO(data)
f = gzip.GzipFile(fileobj=buf)
data = f.read()
@ -143,9 +143,9 @@ def projects_q(project):
.. _Searching Changes:
https://review.openstack.org/Documentation/user-search.html
"""
return ('(' +
' OR '.join(['project:' + p for p in project['subprojects']]) +
')')
return ('('
+ ' OR '.join(['project:' + p for p in project['subprojects']])
+ ')')
def get_changes(projects, ssh_user, ssh_key, only_open=False, stable='',
@ -321,8 +321,9 @@ def patch_set_approved(patch_set):
"""
approvals = patch_set.get('approvals', [])
for review in approvals:
if (review['type'] == 'Approved' or
(review['type'] == 'Workflow' and int(review['value']) > 0)):
if (review['type'] == 'Approved'
or (review['type'] == 'Workflow'
and int(review['value']) > 0)):
return True
return False

View File

@ -20,20 +20,6 @@ classifier =
packages =
reviewstats
[compile_catalog]
directory = reviewstats/locale
domain = reviewstats
[update_catalog]
domain = reviewstats
output_dir = reviewstats/locale
input_file = reviewstats/locale/reviewstats.pot
[extract_messages]
keywords = _ gettext ngettext l_ lazy_gettext
mapping_file = babel.cfg
output_file = reviewstats/locale/reviewstats.pot
[entry_points]
console_scripts =
bugstats = reviewstats.cmd.bugstats:main

View File

@ -1,4 +1,4 @@
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
hacking>=3.1.0,<=3.2.0 # Apache-2.0
coverage>=3.6
fixtures>=0.3.14

View File

@ -12,10 +12,9 @@
# License for the specific language governing permissions and limitations
# under the License.
import io
import unittest
import six
import reviewstats.cmd.reviewers
@ -27,7 +26,7 @@ class ReviewersCSVTestCase(unittest.TestCase):
options = Options()
options.csv_rows = 10
reviewer_data = [('', '', '', '')] * 100
sio = six.StringIO()
sio = io.StringIO()
reviewstats.cmd.reviewers.write_csv(reviewer_data, sio, options, {},
{}, {}, {})

View File

@ -40,6 +40,8 @@ commands =
show-source = True
# E126: from PEP8 upstream, 'most folk agree that its bad'.
# E128: like E126.
ignore = E123,E125,E126,E128,H803
# E741 ambiguous variable name 'l'
# W503 line break before binary operator
ignore = E123,E125,E126,E128,E741,W503,H803
builtins = _
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build