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
|
"""Build candidates list
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import jinja2
|
||||||
|
import jinja2.environment
|
||||||
import os
|
import os
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from jinja2 import FileSystemLoader
|
|
||||||
from jinja2.environment import Environment
|
|
||||||
|
|
||||||
from openstack_election import utils
|
from openstack_election import utils
|
||||||
|
|
||||||
|
|
||||||
def render_template(template, data, **kwargs):
|
def render_template(template, data, **kwargs):
|
||||||
template_dir = kwargs.get('template_dir', os.getcwd())
|
template_dir = kwargs.get('template_dir', os.getcwd())
|
||||||
loader = FileSystemLoader(template_dir)
|
loader = jinja2.FileSystemLoader(template_dir)
|
||||||
env = Environment(trim_blocks=True, loader=loader)
|
env = jinja2.environment.Environment(trim_blocks=True, loader=loader)
|
||||||
template = env.get_template(template)
|
template = env.get_template(template)
|
||||||
return template.render(data)
|
return template.render(data)
|
||||||
|
|
||||||
|
@ -13,13 +13,12 @@
|
|||||||
"""Add election timer data
|
"""Add election timer data
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
|
||||||
import calendar
|
import calendar
|
||||||
|
import jinja2
|
||||||
|
import jinja2.environment
|
||||||
|
import os
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from jinja2 import FileSystemLoader
|
|
||||||
from jinja2.environment import Environment
|
|
||||||
|
|
||||||
from openstack_election import utils
|
from openstack_election import utils
|
||||||
|
|
||||||
|
|
||||||
@ -46,8 +45,8 @@ def build_timer(app):
|
|||||||
output_file = os.path.join(utils.CANDIDATE_PATH, "events.rst")
|
output_file = os.path.join(utils.CANDIDATE_PATH, "events.rst")
|
||||||
with open(output_file, "w") as out:
|
with open(output_file, "w") as out:
|
||||||
template_dir = os.path.join(".", "doc", "source", "_exts")
|
template_dir = os.path.join(".", "doc", "source", "_exts")
|
||||||
loader = FileSystemLoader(template_dir)
|
loader = jinja2.FileSystemLoader(template_dir)
|
||||||
env = Environment(trim_blocks=True, loader=loader)
|
env = jinja2.environment.Environment(trim_blocks=True, loader=loader)
|
||||||
template = env.get_template("events.jinja")
|
template = env.get_template("events.jinja")
|
||||||
out.write(template.render({'events': utils.conf['timelines']}))
|
out.write(template.render({'events': utils.conf['timelines']}))
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ def main():
|
|||||||
args.outputdir = os.path.expanduser(args.outputdir)
|
args.outputdir = os.path.expanduser(args.outputdir)
|
||||||
|
|
||||||
if not os.path.isdir(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)
|
db_file = os.path.join(args.outputdir, "%s.yaml" % args.round)
|
||||||
|
|
||||||
|
@ -27,8 +27,7 @@ class TestGerritUtils(testtools.TestCase):
|
|||||||
'some/file': {},
|
'some/file': {},
|
||||||
'candidates/some/file': {}}
|
'candidates/some/file': {}}
|
||||||
}
|
}
|
||||||
}
|
}}
|
||||||
}
|
|
||||||
|
|
||||||
self.assertEqual(openstack_election.utils.candidate_files(review),
|
self.assertEqual(openstack_election.utils.candidate_files(review),
|
||||||
['candidates/some/file'])
|
['candidates/some/file'])
|
||||||
|
@ -19,12 +19,12 @@ import json
|
|||||||
import os
|
import os
|
||||||
import pickle
|
import pickle
|
||||||
import pytz
|
import pytz
|
||||||
|
import re
|
||||||
import requests
|
import requests
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
import urllib
|
import urllib
|
||||||
import yaml
|
import yaml
|
||||||
import re
|
|
||||||
|
|
||||||
# Per election constants
|
# Per election constants
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
# needed for doc build
|
# needed for doc build
|
||||||
sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2 # BSD
|
sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2 # BSD
|
||||||
oslosphinx!=3.4.0,>=2.5.0 # Apache-2.0
|
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
|
yamllint
|
||||||
mock>=2.0 # BSD
|
mock>=2.0 # BSD
|
||||||
oslotest>=1.10.0 # Apache-2.0
|
oslotest>=1.10.0 # Apache-2.0
|
||||||
|
@ -12,10 +12,14 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
from __future__ import absolute_import
|
||||||
|
from __future__ import print_function
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from utils import get_projects, name2dir
|
from openstack_election import utils
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('name', help='The release cycle name')
|
parser.add_argument('name', help='The release cycle name')
|
||||||
@ -24,21 +28,21 @@ options = parser.parse_args()
|
|||||||
|
|
||||||
os.chdir(options.root)
|
os.chdir(options.root)
|
||||||
if not os.path.isdir("candidates"):
|
if not os.path.isdir("candidates"):
|
||||||
print "candidates directory not found"
|
print("candidates directory not found")
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
if os.path.exists("candidates/%s" % options.name):
|
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)
|
exit(1)
|
||||||
|
|
||||||
projects = get_projects()
|
projects = utils.get_projects()
|
||||||
project_list = projects.keys()
|
project_list = projects.keys()
|
||||||
project_list.sort()
|
project_list.sort()
|
||||||
for project in project_list + ["TC"]:
|
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)
|
os.makedirs(dpath)
|
||||||
open("%s/.placeholder" % dpath, "w").close()
|
open("%s/.placeholder" % dpath, "w").close()
|
||||||
print "[+] Created %s" % dpath
|
print("[+] Created %s" % (dpath))
|
||||||
|
|
||||||
print("Done. Now please manually update events.yaml and "
|
print("Done. Now please manually update events.yaml and "
|
||||||
"doc/source/index.rst substitutions")
|
"doc/source/index.rst substitutions")
|
||||||
|
Loading…
Reference in New Issue
Block a user