Switch to hacking and fix errors
./doc/source/_exts/candidates.py:20:1: H306 imports not in alphabetical order (jinja2.filesystemloader, jinja2.environment.environment) ./doc/source/_exts/events.py:17:1: H306 imports not in alphabetical order (os, calendar) ./doc/source/_exts/events.py:21:1: H306 imports not in alphabetical order (jinja2.filesystemloader, jinja2.environment.environment) ./openstack_election/check_candidacy.py:62:29: E126 continuation line over-indented for hanging indent ./openstack_election/utils.py:27:1: H306 imports not in alphabetical order (yaml, re) ./openstack_election/cmds/close_election.py:90:9: H232 Python 3.x incompatible octal 755 should be written as 0o755 ./openstack_election/tests/test_utils.py:25:21: E126 continuation line over-indented for hanging indent ./tools/new-election.py:18:31: H301 one import per line ./tools/new-election.py:27:5: H233 Python 3.x incompatible use of print operator ./tools/new-election.py:31:5: H233 Python 3.x incompatible use of print operator ./tools/new-election.py:41:5: H233 Python 3.x incompatible use of print operator Co-Authored-By: Nguyen Hung Phuong <phuongnh@vn.fujitsu.com> Change-Id: Idd9bc1f1f92da1658e6da2af588c575ee0ba2cb0
This commit is contained in:
parent
8f8df0c950
commit
7da752110a
@ -13,19 +13,18 @@
|
||||
"""Build candidates list
|
||||
"""
|
||||
|
||||
import jinja2
|
||||
import jinja2.environment
|
||||
import os
|
||||
import yaml
|
||||
|
||||
from jinja2 import FileSystemLoader
|
||||
from jinja2.environment import Environment
|
||||
|
||||
from openstack_election import utils
|
||||
|
||||
|
||||
def render_template(template, data, **kwargs):
|
||||
template_dir = kwargs.get('template_dir', os.getcwd())
|
||||
loader = FileSystemLoader(template_dir)
|
||||
env = Environment(trim_blocks=True, loader=loader)
|
||||
loader = jinja2.FileSystemLoader(template_dir)
|
||||
env = jinja2.environment.Environment(trim_blocks=True, loader=loader)
|
||||
template = env.get_template(template)
|
||||
return template.render(data)
|
||||
|
||||
|
@ -13,13 +13,12 @@
|
||||
"""Add election timer data
|
||||
"""
|
||||
|
||||
import os
|
||||
import calendar
|
||||
import jinja2
|
||||
import jinja2.environment
|
||||
import os
|
||||
import time
|
||||
|
||||
from jinja2 import FileSystemLoader
|
||||
from jinja2.environment import Environment
|
||||
|
||||
from openstack_election import utils
|
||||
|
||||
|
||||
@ -46,8 +45,8 @@ def build_timer(app):
|
||||
output_file = os.path.join(utils.CANDIDATE_PATH, "events.rst")
|
||||
with open(output_file, "w") as out:
|
||||
template_dir = os.path.join(".", "doc", "source", "_exts")
|
||||
loader = FileSystemLoader(template_dir)
|
||||
env = Environment(trim_blocks=True, loader=loader)
|
||||
loader = jinja2.FileSystemLoader(template_dir)
|
||||
env = jinja2.environment.Environment(trim_blocks=True, loader=loader)
|
||||
template = env.get_template("events.jinja")
|
||||
out.write(template.render({'events': utils.conf['timelines']}))
|
||||
|
||||
|
@ -59,8 +59,8 @@ def check_candidate(project_name, email, projects, limit=1):
|
||||
(repo_name, email))
|
||||
for review in utils.get_reviews(query):
|
||||
url = ('%s/%s/commit/?id=%s' % (
|
||||
utils.CGIT_URL, review['project'],
|
||||
review['current_revision']))
|
||||
utils.CGIT_URL, review['project'],
|
||||
review['current_revision']))
|
||||
print('%2d: %s %s' %
|
||||
(found, pretty_datetime(review['submitted']),
|
||||
url))
|
||||
|
@ -87,7 +87,7 @@ def main():
|
||||
args.outputdir = os.path.expanduser(args.outputdir)
|
||||
|
||||
if not os.path.isdir(args.outputdir):
|
||||
os.mkdir(args.outputdir, 0755)
|
||||
os.mkdir(args.outputdir, 0o755)
|
||||
|
||||
db_file = os.path.join(args.outputdir, "%s.yaml" % args.round)
|
||||
|
||||
|
@ -22,13 +22,12 @@ import openstack_election.utils
|
||||
class TestGerritUtils(testtools.TestCase):
|
||||
def test_candidate_files(self):
|
||||
review = {'revisions': {
|
||||
'Ifake': {
|
||||
'files': {
|
||||
'some/file': {},
|
||||
'candidates/some/file': {}}
|
||||
}
|
||||
}
|
||||
}
|
||||
'Ifake': {
|
||||
'files': {
|
||||
'some/file': {},
|
||||
'candidates/some/file': {}}
|
||||
}
|
||||
}}
|
||||
|
||||
self.assertEqual(openstack_election.utils.candidate_files(review),
|
||||
['candidates/some/file'])
|
||||
|
@ -19,12 +19,12 @@ import json
|
||||
import os
|
||||
import pickle
|
||||
import pytz
|
||||
import re
|
||||
import requests
|
||||
import subprocess
|
||||
import time
|
||||
import urllib
|
||||
import yaml
|
||||
import re
|
||||
|
||||
# Per election constants
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
# needed for doc build
|
||||
sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2 # BSD
|
||||
oslosphinx!=3.4.0,>=2.5.0 # Apache-2.0
|
||||
flake8>=2.5.4,<2.6.0 # MIT
|
||||
hacking>=0.11.0,<0.12 # Apache-2.0
|
||||
yamllint
|
||||
mock>=2.0 # BSD
|
||||
oslotest>=1.10.0 # Apache-2.0
|
||||
|
@ -12,10 +12,14 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import argparse
|
||||
import os
|
||||
|
||||
from utils import get_projects, name2dir
|
||||
from openstack_election import utils
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('name', help='The release cycle name')
|
||||
@ -24,21 +28,21 @@ options = parser.parse_args()
|
||||
|
||||
os.chdir(options.root)
|
||||
if not os.path.isdir("candidates"):
|
||||
print "candidates directory not found"
|
||||
print("candidates directory not found")
|
||||
exit(1)
|
||||
|
||||
if os.path.exists("candidates/%s" % options.name):
|
||||
print "candidates/%s: directory already exists" % options.name
|
||||
print("candidates/%s: directory already exists" % (options.name))
|
||||
exit(1)
|
||||
|
||||
projects = get_projects()
|
||||
projects = utils.get_projects()
|
||||
project_list = projects.keys()
|
||||
project_list.sort()
|
||||
for project in project_list + ["TC"]:
|
||||
dpath = "candidates/%s/%s" % (options.name, name2dir(project))
|
||||
dpath = "candidates/%s/%s" % (options.name, utils.name2dir(project))
|
||||
os.makedirs(dpath)
|
||||
open("%s/.placeholder" % dpath, "w").close()
|
||||
print "[+] Created %s" % dpath
|
||||
print("[+] Created %s" % (dpath))
|
||||
|
||||
print("Done. Now please manually update events.yaml and "
|
||||
"doc/source/index.rst substitutions")
|
||||
|
Loading…
Reference in New Issue
Block a user