Bumping black to 22.3.0

Setting desired version of black to 22.3.0 prevents issues with
the click dependency described in the #1966879.

Introduction of black 22.3.0 forced style changes in following files:
- doc/source/conf.py
- jenkins_jobs/local_yaml.py
- tests/base.py

These changes do not modify behavior of the programs concerned.

Signed-off-by: Jiri Podivin <jpodivin@redhat.com>
Change-Id: I42a46f9ed31ea0f404d698eec73d30975e2e6f4c
This commit is contained in:
Jiri Podivin 2022-03-31 09:27:41 +02:00
parent efb479f0cc
commit 352b93d586
4 changed files with 25 additions and 25 deletions

View File

@ -2,7 +2,7 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/python/black.git
rev: 19.3b0
rev: 22.3.0
hooks:
- id: black
language_version: python3

View File

@ -50,8 +50,8 @@ source_suffix = ".rst"
master_doc = "index"
# General information about the project.
project = u"Jenkins Job Builder"
copyright = u"2012, Jenkins Job Builder Maintainers"
project = "Jenkins Job Builder"
copyright = "2012, Jenkins Job Builder Maintainers"
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
@ -195,8 +195,8 @@ latex_documents = [
(
"index",
"JenkinsJobBuilder.tex",
u"Jenkins Job Builder Documentation",
u"Jenkins Job Builder Maintainers",
"Jenkins Job Builder Documentation",
"Jenkins Job Builder Maintainers",
"manual",
)
]
@ -236,8 +236,8 @@ man_pages = [
(
"index",
"jenkins-jobs",
u"Jenkins Job Builder Documentation",
[u"Jenkins Job Builder Maintainers"],
"Jenkins Job Builder Documentation",
["Jenkins Job Builder Maintainers"],
1,
)
]
@ -255,8 +255,8 @@ texinfo_documents = [
(
"index",
"JenkinsJobBuilder",
u"Jenkins Job Builder Documentation",
u"Jenkins Job Builder Maintainers",
"Jenkins Job Builder Documentation",
"Jenkins Job Builder Maintainers",
"JenkinsJobBuilder",
"One line description of project.",
"Miscellaneous",

View File

@ -279,7 +279,7 @@ class OrderedConstructor(BaseConstructor):
class OrderedRepresenter(BaseRepresenter):
def represent_yaml_mapping(self, mapping, flow_style=None):
tag = u"tag:yaml.org,2002:map"
tag = "tag:yaml.org,2002:map"
node = self.represent_mapping(tag, mapping, flow_style=flow_style)
return node
@ -388,7 +388,7 @@ class BaseYAMLObject(YAMLObject):
class J2Yaml(BaseYAMLObject):
yaml_tag = u"!j2-yaml:"
yaml_tag = "!j2-yaml:"
@classmethod
def from_yaml(cls, loader, node):
@ -396,7 +396,7 @@ class J2Yaml(BaseYAMLObject):
class J2String(BaseYAMLObject):
yaml_tag = u"!j2:"
yaml_tag = "!j2:"
@classmethod
def from_yaml(cls, loader, node):
@ -404,7 +404,7 @@ class J2String(BaseYAMLObject):
class YamlListJoin(BaseYAMLObject):
yaml_tag = u"!join:"
yaml_tag = "!join:"
@classmethod
def from_yaml(cls, loader, node):
@ -430,7 +430,7 @@ class YamlListJoin(BaseYAMLObject):
class YamlInclude(BaseYAMLObject):
yaml_tag = u"!include:"
yaml_tag = "!include:"
@classmethod
def _find_file(cls, filename, search_path):
@ -490,7 +490,7 @@ class YamlInclude(BaseYAMLObject):
if any(isinstance(s, CustomLoader) for s in contents):
return CustomLoaderCollection(contents)
return u"\n".join(contents)
return "\n".join(contents)
else:
raise yaml.constructor.ConstructorError(
None,
@ -501,7 +501,7 @@ class YamlInclude(BaseYAMLObject):
class YamlIncludeRaw(YamlInclude):
yaml_tag = u"!include-raw:"
yaml_tag = "!include-raw:"
@classmethod
def _from_file(cls, loader, node):
@ -509,7 +509,7 @@ class YamlIncludeRaw(YamlInclude):
class YamlIncludeRawEscape(YamlIncludeRaw):
yaml_tag = u"!include-raw-escape:"
yaml_tag = "!include-raw-escape:"
@classmethod
def from_yaml(cls, loader, node):
@ -528,7 +528,7 @@ class YamlIncludeRawEscape(YamlIncludeRaw):
class YamlIncludeJinja2(YamlIncludeRaw):
yaml_tag = u"!include-jinja2:"
yaml_tag = "!include-jinja2:"
@classmethod
def _from_file(cls, loader, node):
@ -550,17 +550,17 @@ class DeprecatedTag(BaseYAMLObject):
class YamlIncludeDeprecated(DeprecatedTag):
yaml_tag = u"!include"
yaml_tag = "!include"
_new = YamlInclude
class YamlIncludeRawDeprecated(DeprecatedTag):
yaml_tag = u"!include-raw"
yaml_tag = "!include-raw"
_new = YamlIncludeRaw
class YamlIncludeRawEscapeDeprecated(DeprecatedTag):
yaml_tag = u"!include-raw-escape"
yaml_tag = "!include-raw-escape"
_new = YamlIncludeRawEscape
@ -635,7 +635,7 @@ class CustomLoaderCollection(object):
self._data = sequence
def format(self, *args, **kwargs):
return u"\n".join(item.format(*args, **kwargs) for item in self._data)
return "\n".join(item.format(*args, **kwargs) for item in self._data)
class LazyLoader(CustomLoader):

View File

@ -149,13 +149,13 @@ class BaseTestCase(testtools.TestCase):
def _read_utf8_content(self):
# if None assume empty file
if not self.out_filenames:
return u""
return ""
# Read XML content, assuming it is unicode encoded
xml_content = ""
for f in sorted(self.out_filenames):
with io.open(f, "r", encoding="utf-8") as xml_file:
xml_content += u"%s" % xml_file.read()
xml_content += "%s" % xml_file.read()
return xml_content
def _read_yaml_content(self, filename):
@ -361,7 +361,7 @@ class SingleJobTestCase(BaseScenariosTestCase):
# Prettify generated XML
pretty_xml = (
u"\n".join(job.output().decode("utf-8") for job in xml_jobs)
"\n".join(job.output().decode("utf-8") for job in xml_jobs)
.strip()
.replace("\n\n", "\n")
)