diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ea49edb45..f4b0ec220 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 diff --git a/doc/source/conf.py b/doc/source/conf.py index 61023225c..9a37c66d6 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -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", diff --git a/jenkins_jobs/local_yaml.py b/jenkins_jobs/local_yaml.py index 896cc24a9..5ac2af325 100644 --- a/jenkins_jobs/local_yaml.py +++ b/jenkins_jobs/local_yaml.py @@ -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): diff --git a/tests/base.py b/tests/base.py index c12f90c3c..7e2f64d0d 100644 --- a/tests/base.py +++ b/tests/base.py @@ -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") )