diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-06-16 11:28:39 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-06-16 21:12:12 +0000 |
commit | 59e80c67f8275db91f172c2ee2e46d3158437af0 (patch) | |
tree | 48cd2edffafea8c77137789253545fde1fbdc377 | |
parent | 69870e0c61f5ba3ba3e3d286f0eb4dbf9dec0a6d (diff) |
Fix some flake8 warnings in the documentation scripts
Change-Id: Ifbf248d0cc0aae511b3f96cc03baf80f582f5d4a
Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
(cherry picked from commit 05fdbd6ff3901587eb0c6b192e6666225f49695c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | sources/pyside6/doc/pysideinclude.py | 8 | ||||
-rw-r--r-- | sources/pyside6/doc/qtattributionsscannertorst.py | 8 |
2 files changed, 12 insertions, 4 deletions
diff --git a/sources/pyside6/doc/pysideinclude.py b/sources/pyside6/doc/pysideinclude.py index 91fffe115..66f8e31e7 100644 --- a/sources/pyside6/doc/pysideinclude.py +++ b/sources/pyside6/doc/pysideinclude.py @@ -14,6 +14,7 @@ from docutils.parsers.rst import Directive, directives from sphinx import addnodes from sphinx.util import parselinenos + class PySideInclude(Directive): """ Like ``.. include:: :literal:``, but only warns if the include file is @@ -91,7 +92,7 @@ class PySideInclude(Directive): 'Object named %r not found in include file %r' % (objectname, filename), line=self.lineno)] else: - lines = lines[tags[objectname][1]-1 : tags[objectname][2]-1] + lines = lines[tags[objectname][1] - 1: tags[objectname][2] - 1] linespec = self.options.get('lines') if linespec is not None: @@ -126,9 +127,9 @@ class PySideInclude(Directive): lines = res if prepend: - lines.insert(0, prepend + '\n') + lines.insert(0, prepend + '\n') if append: - lines.append(append + '\n') + lines.append(append + '\n') text = ''.join(lines) if self.options.get('tab-width'): @@ -143,5 +144,6 @@ class PySideInclude(Directive): document.settings.env.note_dependency(rel_fn) return [retnode] + def setup(app): app.add_directive('pysideinclude', PySideInclude) diff --git a/sources/pyside6/doc/qtattributionsscannertorst.py b/sources/pyside6/doc/qtattributionsscannertorst.py index 216c1439b..aae4bccf8 100644 --- a/sources/pyside6/doc/qtattributionsscannertorst.py +++ b/sources/pyside6/doc/qtattributionsscannertorst.py @@ -26,7 +26,8 @@ def indent(lines, indent): result = f"{result}{indent}{l}\n" return result -rstHeader="""Licenses Used in Qt for Python + +rstHeader = """Licenses Used in Qt for Python ****************************** Qt for Python contains some code that is not provided under the @@ -52,18 +53,23 @@ code licensed under third-party opensource licenses: """ + def rstHeadline(title): return f"{title}\n{'-' * len(title)}\n" + def rstUrl(title, url): return f"`{title} <{url}>`_" + def rstLiteralBlock(lines): return f"::\n\n{indent(lines, ' ')}\n\n" + def rstLiteralBlockFromText(text): return rstLiteralBlock(text.strip().split('\n')) + def readFile(fileName): with open(fileName, 'r') as file: return file.readlines() |