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

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

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

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

@ -149,13 +149,13 @@ class BaseTestCase(testtools.TestCase):
def _read_utf8_content(self): def _read_utf8_content(self):
# if None assume empty file # if None assume empty file
if not self.out_filenames: if not self.out_filenames:
return u"" return ""
# Read XML content, assuming it is unicode encoded # Read XML content, assuming it is unicode encoded
xml_content = "" xml_content = ""
for f in sorted(self.out_filenames): for f in sorted(self.out_filenames):
with io.open(f, "r", encoding="utf-8") as xml_file: 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 return xml_content
def _read_yaml_content(self, filename): def _read_yaml_content(self, filename):
@ -361,7 +361,7 @@ class SingleJobTestCase(BaseScenariosTestCase):
# Prettify generated XML # Prettify generated XML
pretty_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() .strip()
.replace("\n\n", "\n") .replace("\n\n", "\n")
) )