From 68d037190f1864292c6117b7d16b4a6c77a67fff Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 29 Jun 2022 10:18:24 +1000 Subject: Cleanup: format --- doc/python_api/sphinx_changelog_gen.py | 11 +++++++---- doc/python_api/sphinx_doc_gen.py | 26 +++++++++++++++++++++----- 2 files changed, 28 insertions(+), 9 deletions(-) (limited to 'doc/python_api') diff --git a/doc/python_api/sphinx_changelog_gen.py b/doc/python_api/sphinx_changelog_gen.py index 4f7f4d8270a..4c9f7232a74 100644 --- a/doc/python_api/sphinx_changelog_gen.py +++ b/doc/python_api/sphinx_changelog_gen.py @@ -255,14 +255,14 @@ def api_changelog(args): with open(indexpath, 'r', encoding='utf-8') as file_handle: index = json.load(file_handle) - if filepath_in_to == None: + if filepath_in_to is None: filepath_in_to = index.get(version_key, None) - if filepath_in_to == None: + if filepath_in_to is None: raise(ValueError("Cannot find API dump file for Blender version " + str(version) + " in index file.")) print("Found to file: %r" % filepath_in_to) - if filepath_in_from == None: + if filepath_in_from is None: version_from, version_from_key = api_version_previous_in_index(index, version) if version_from is None: raise(ValueError("No previous version of Blender could be found in the index.")) @@ -423,7 +423,10 @@ def main(argv=None): help="Path of the JSON file containing the dump of the API.") parser_dump.set_defaults(func=api_dump) - parser_changelog = parser_commands.add_parser('changelog', help="Generate the RST changelog page based on two Blender Python API JSON dumps.") + parser_changelog = parser_commands.add_parser( + 'changelog', + help="Generate the RST changelog page based on two Blender Python API JSON dumps.", + ) parser_changelog.add_argument( "--filepath-in-from", dest="filepath_in_from", metavar='FILE', default=None, diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py index 4f27b662c60..17ffdb8e244 100644 --- a/doc/python_api/sphinx_doc_gen.py +++ b/doc/python_api/sphinx_doc_gen.py @@ -539,8 +539,10 @@ if ARGS.sphinx_build_pdf: def generate_changelog(): import importlib.util - spec = importlib.util.spec_from_file_location("sphinx_changelog_gen", - os.path.abspath(os.path.join(SCRIPT_DIR, "sphinx_changelog_gen.py"))) + spec = importlib.util.spec_from_file_location( + "sphinx_changelog_gen", + os.path.abspath(os.path.join(SCRIPT_DIR, "sphinx_changelog_gen.py")), + ) sphinx_changelog_gen = importlib.util.module_from_spec(spec) spec.loader.exec_module(sphinx_changelog_gen) @@ -549,9 +551,23 @@ def generate_changelog(): API_DUMP_FILEPATH = os.path.abspath(os.path.join(API_DUMP_ROOT, BLENDER_VERSION_DOTS, "api_dump.json")) API_CHANGELOG_FILEPATH = os.path.abspath(os.path.join(SPHINX_IN_TMP, "change_log.rst")) - sphinx_changelog_gen.main(("--", "--indexpath", API_DUMP_INDEX_FILEPATH, "dump", "--filepath-out", API_DUMP_FILEPATH)) - - sphinx_changelog_gen.main(("--", "--indexpath", API_DUMP_INDEX_FILEPATH, "changelog", "--filepath-out", API_CHANGELOG_FILEPATH)) + sphinx_changelog_gen.main(( + "--", + "--indexpath", + API_DUMP_INDEX_FILEPATH, + "dump", + "--filepath-out", + API_DUMP_FILEPATH, + )) + + sphinx_changelog_gen.main(( + "--", + "--indexpath", + API_DUMP_INDEX_FILEPATH, + "changelog", + "--filepath-out", + API_CHANGELOG_FILEPATH, + )) # --------------------------------API DUMP-------------------------------------- -- cgit v1.2.3