From e9e3d592b561108ae30e5eb98b550ac8e591e75c Mon Sep 17 00:00:00 2001 From: Michael Jones Date: Sun, 30 Jan 2022 18:51:30 +0000 Subject: [PATCH 1/3] Pin the version of black We want to check the formatting but we don't want it to randomly fail CI if black has released a new version that makes different choices. Though it has recently be declared stable so I think there is less of a chance of that. --- requirements/development.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/development.txt b/requirements/development.txt index 69363b23..c1b74992 100644 --- a/requirements/development.txt +++ b/requirements/development.txt @@ -7,4 +7,4 @@ pytest mypy>=0.900 types-docutils>=0.17.0 -black +black==22.1.0 From 59a2efb74aebbbea3766e325198a8bab7a128296 Mon Sep 17 00:00:00 2001 From: Michael Jones Date: Sun, 30 Jan 2022 18:52:30 +0000 Subject: [PATCH 2/3] Format all files with pinned black version It seems to be mostly removing u's from string. Possibly due to Python 2.7 being long dead and it doing nothing much in Python 3 (as far as I understand.) --- breathe/directives/function.py | 4 ++-- breathe/renderer/sphinxrenderer.py | 2 +- documentation/source/conf.py | 4 ++-- tests/test_renderer.py | 8 ++++---- tests/warnings/source/conf.py | 14 +++++++------- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/breathe/directives/function.py b/breathe/directives/function.py index e35d21cf..b47b531a 100644 --- a/breathe/directives/function.py +++ b/breathe/directives/function.py @@ -253,11 +253,11 @@ def _resolve_function(self, matches, args: Optional[cpp.ASTParametersQualifiers] res = [] candSignatures = [] for entry in matches: - text_options = {"no-link": u"", "outline": u""} + text_options = {"no-link": "", "outline": ""} # Render the matches to docutils nodes target_handler = create_target_handler( - {"no-link": u""}, project_info, self.state.document + {"no-link": ""}, project_info, self.state.document ) filter_ = self.filter_factory.create_outline_filter(text_options) mask_factory = MaskFactory({"param": NoParameterNamesMask}) diff --git a/breathe/renderer/sphinxrenderer.py b/breathe/renderer/sphinxrenderer.py index 978299fb..cae3a57b 100644 --- a/breathe/renderer/sphinxrenderer.py +++ b/breathe/renderer/sphinxrenderer.py @@ -1681,7 +1681,7 @@ def visit_verbatim(self, node) -> List[Node]: text = node.text.replace("embed:rst:inline", "", 1) else: # Remove the first line which is "embed:rst[:leading-asterisk]" - text = "\n".join(node.text.split(u"\n")[1:]) + text = "\n".join(node.text.split("\n")[1:]) # Remove starting whitespace text = textwrap.dedent(text) diff --git a/documentation/source/conf.py b/documentation/source/conf.py index 29834090..9f81ce65 100644 --- a/documentation/source/conf.py +++ b/documentation/source/conf.py @@ -143,8 +143,8 @@ master_doc = "index" # General information about the project. -project = u"Breathe" -copyright = u"2009-2014, Michael Jones" +project = "Breathe" +copyright = "2009-2014, Michael Jones" # The language for content autogenerated by Sphinx. Refer to documentation diff --git a/tests/test_renderer.py b/tests/test_renderer.py index 2b9a5860..16889818 100644 --- a/tests/test_renderer.py +++ b/tests/test_renderer.py @@ -315,7 +315,7 @@ def test_render_func(app): argsstring="(int)", virt="non-virtual", param=[ - WrappedParam(type_=WrappedLinkedText(content_=[WrappedMixedContainer(value=u"int")])) + WrappedParam(type_=WrappedLinkedText(content_=[WrappedMixedContainer(value="int")])) ], ) signature = find_node(render(app, member_def), "desc_signature") @@ -460,7 +460,7 @@ def test_render_variable_initializer(app): definition="const int EOF", type_="const int", name="EOF", - initializer=WrappedMixedContainer(value=u"= -1"), + initializer=WrappedMixedContainer(value="= -1"), ) signature = find_node(render(app, member_def), "desc_signature") assert signature.astext() == "const int EOF = -1" @@ -470,7 +470,7 @@ def test_render_define_initializer(app): member_def = WrappedMemberDef( kind="define", name="MAX_LENGTH", - initializer=WrappedLinkedText(content_=[WrappedMixedContainer(value=u"100")]), + initializer=WrappedLinkedText(content_=[WrappedMixedContainer(value="100")]), ) signature_w_initializer = find_node( render(app, member_def, show_define_initializer=True), "desc_signature" @@ -480,7 +480,7 @@ def test_render_define_initializer(app): member_def_no_show = WrappedMemberDef( kind="define", name="MAX_LENGTH_NO_INITIALIZER", - initializer=WrappedLinkedText(content_=[WrappedMixedContainer(value=u"100")]), + initializer=WrappedLinkedText(content_=[WrappedMixedContainer(value="100")]), ) signature_wo_initializer = find_node( diff --git a/tests/warnings/source/conf.py b/tests/warnings/source/conf.py index 8c356c37..3dfc126d 100644 --- a/tests/warnings/source/conf.py +++ b/tests/warnings/source/conf.py @@ -55,8 +55,8 @@ master_doc = "index" # General information about the project. -project = u"Test Breathe Warnings" -copyright = u"2014, Michael Jones" +project = "Test Breathe Warnings" +copyright = "2014, Michael Jones" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -209,8 +209,8 @@ ( "index", "TestBreatheWarnings.tex", - u"Test Breathe Warnings Documentation", - u"Michael Jones", + "Test Breathe Warnings Documentation", + "Michael Jones", "manual", ), ] @@ -241,7 +241,7 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - ("index", "testbreathewarnings", u"Test Breathe Warnings Documentation", [u"Michael Jones"], 1) + ("index", "testbreathewarnings", "Test Breathe Warnings Documentation", ["Michael Jones"], 1) ] # If true, show URL addresses after external links. @@ -257,8 +257,8 @@ ( "index", "TestBreatheWarnings", - u"Test Breathe Warnings Documentation", - u"Michael Jones", + "Test Breathe Warnings Documentation", + "Michael Jones", "TestBreatheWarnings", "One line description of project.", "Miscellaneous", From 95223df58f6e31becb53afa8cb2cfca497e388d3 Mon Sep 17 00:00:00 2001 From: Michael Jones Date: Sun, 30 Jan 2022 18:53:44 +0000 Subject: [PATCH 3/3] Remove 'continue on error' for black Hopefully we shouldn't have that issue again. If we do it will represent a meaningful failure. I'm happy to roll this back if we're concerned it'll get in the way. --- .github/workflows/lint.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 3013edc0..33bca366 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -24,7 +24,6 @@ jobs: run: make flake8 - name: check source code formatting - continue-on-error: true run: make black - name: type check the source code