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 paramiko
pbr>=0.5.21,<1.0 pbr>=2.0,!=2.1.0
prettytable prettytable
Babel>=1.3
pytz>=2010h pytz>=2010h
requests>=2.2.0,!=2.4.0 requests>=2.2.0,!=2.4.0
six>=1.7.0
PyYAML>=3.1.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. closed in the period, and bug tags present on any critical bugs.
""" """
for period in self.periods: for period in self.periods:
yield ([period[0].strftime('%Y-%m-%d')] + yield ([period[0].strftime('%Y-%m-%d')]
period[1:-1] + [','.join(period[-1])]) + period[1:-1] + [','.join(period[-1])])
def main(): def main():

View File

@ -21,8 +21,6 @@ import logging
import optparse import optparse
import sys import sys
import six
from reviewstats import utils from reviewstats import utils
@ -176,7 +174,7 @@ def print_stats_txt(stats, f=sys.stdout):
print_item_txt(item, level) print_item_txt(item, level)
def 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')) f.write('%s\n' % item.encode('utf-8'))
elif isinstance(item, list): elif isinstance(item, list):
print_list_txt(item, level + 1) 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')) f.write('</%s>\n' % ('ul' if level == 1 else 'ol'))
def print_item_html(item, level): def print_item_html(item, level):
if isinstance(item, six.text_type): if isinstance(item, str):
f.write('%s' % item.encode('utf-8')) f.write('%s' % item.encode('utf-8'))
elif isinstance(item, list): elif isinstance(item, list):
print_list_html(item, level + 1) 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') reviewer = review['by'].get('username', 'unknown')
set_defaults(reviewer, reviewers) set_defaults(reviewer, reviewers)
if (review['type'] == 'Approved' or if (review['type'] == 'Approved'
(review['type'] == 'Workflow' and int(review['value']) > 0)): or (review['type'] == 'Workflow'
and int(review['value']) > 0)):
cur = reviewers[reviewer]['votes']['A'] cur = reviewers[reviewer]['votes']['A']
reviewers[reviewer]['votes']['A'] = cur + 1 reviewers[reviewer]['votes']['A'] = cur + 1
elif review['type'] != 'Workflow': elif review['type'] != 'Workflow':
@ -210,8 +211,8 @@ def write_pretty(reviewer_data, file_obj, options, reviewers, projects,
'(%.1f/day)\n') '(%.1f/day)\n')
% (options.days, change_stats['wip'], % (options.days, change_stats['wip'],
float(change_stats['wip']) / options.days)) float(change_stats['wip']) / options.days))
queue_growth = (change_stats['created'] - change_stats['merged'] - queue_growth = (change_stats['created'] - change_stats['merged']
change_stats['abandoned'] - change_stats['wip']) - change_stats['abandoned'] - change_stats['wip'])
file_obj.write( file_obj.write(
(' Queue growth in the last %d days: %d ' (' Queue growth in the last %d days: %d '
'(%.1f/day)\n') '(%.1f/day)\n')

View File

@ -58,7 +58,7 @@ def main():
milestones = {} milestones = {}
changes = utils.get_changes(projects, args.user, args.key, only_open=True) 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: for change in changes:
if 'topic' not in change: if 'topic' not in change:
continue continue

View File

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

View File

@ -20,20 +20,6 @@ classifier =
packages = packages =
reviewstats 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] [entry_points]
console_scripts = console_scripts =
bugstats = reviewstats.cmd.bugstats:main 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 coverage>=3.6
fixtures>=0.3.14 fixtures>=0.3.14

View File

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

View File

@ -40,6 +40,8 @@ commands =
show-source = True show-source = True
# E126: from PEP8 upstream, 'most folk agree that its bad'. # E126: from PEP8 upstream, 'most folk agree that its bad'.
# E128: like E126. # 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 = _ builtins = _
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build