diff options
author | Campbell Barton <campbell@blender.org> | 2022-09-14 09:18:59 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-09-14 09:18:59 +0300 |
commit | 39c341bf4ab9582edc26227447634cae2004baa6 (patch) | |
tree | dce6d8f00adbca2b3b6c7be99119507023beab92 /doc | |
parent | 260b75a952f40961d3e06c9a7f48ec9b696bf169 (diff) |
Cleanup: remove redundant braces from assert & raise
autopep8 v1.7 added a space after assert & raise,
remove the braces as they aren't needed.
Diffstat (limited to 'doc')
-rwxr-xr-x | doc/manpage/blender.1.py | 2 | ||||
-rw-r--r-- | doc/python_api/rst_from_bmesh_opdefines.py | 22 | ||||
-rw-r--r-- | doc/python_api/sphinx_changelog_gen.py | 16 | ||||
-rw-r--r-- | doc/python_api/sphinx_doc_gen.py | 2 |
4 files changed, 23 insertions, 19 deletions
diff --git a/doc/manpage/blender.1.py b/doc/manpage/blender.1.py index 7d35dc0abb1..49dae35e0c5 100755 --- a/doc/manpage/blender.1.py +++ b/doc/manpage/blender.1.py @@ -139,7 +139,7 @@ https://www.blender.org''') l = lines.pop(0) if l: - assert(l.startswith('\t')) + assert l.startswith('\t') l = l[1:] # Remove first white-space (tab). fh.write('%s\n' % man_format(l)) diff --git a/doc/python_api/rst_from_bmesh_opdefines.py b/doc/python_api/rst_from_bmesh_opdefines.py index 3d8ff1e6248..0614538964d 100644 --- a/doc/python_api/rst_from_bmesh_opdefines.py +++ b/doc/python_api/rst_from_bmesh_opdefines.py @@ -241,9 +241,9 @@ def main(): comment_washed = [] comment = [] if comment is None else comment for i, l in enumerate(comment): - assert((l.strip() == "") or - (l in {"/*", " *"}) or - (l.startswith(("/* ", " * ")))) + assert ((l.strip() == "") or + (l in {"/*", " *"}) or + (l.startswith(("/* ", " * ")))) l = l[3:] if i == 0 and not l.strip(): @@ -270,7 +270,7 @@ def main(): tp_sub = None else: print(arg) - assert(0) + assert 0 tp_str = "" @@ -315,7 +315,7 @@ def main(): tp_str += " or any sequence of 3 floats" elif tp == BMO_OP_SLOT_PTR: tp_str = "dict" - assert(tp_sub is not None) + assert tp_sub is not None if tp_sub == BMO_OP_SLOT_SUBTYPE_PTR_BMESH: tp_str = ":class:`bmesh.types.BMesh`" elif tp_sub == BMO_OP_SLOT_SUBTYPE_PTR_SCENE: @@ -330,10 +330,10 @@ def main(): tp_str = ":class:`bpy.types.bpy_struct`" else: print("Can't find", vars_dict_reverse[tp_sub]) - assert(0) + assert 0 elif tp == BMO_OP_SLOT_ELEMENT_BUF: - assert(tp_sub is not None) + assert tp_sub is not None ls = [] if tp_sub & BM_VERT: @@ -342,7 +342,7 @@ def main(): ls.append(":class:`bmesh.types.BMEdge`") if tp_sub & BM_FACE: ls.append(":class:`bmesh.types.BMFace`") - assert(ls) # must be at least one + assert ls # Must be at least one. if tp_sub & BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE: tp_str = "/".join(ls) @@ -367,10 +367,10 @@ def main(): tp_str += "unknown internal data, not compatible with python" else: print("Can't find", vars_dict_reverse[tp_sub]) - assert(0) + assert 0 else: print("Can't find", vars_dict_reverse[tp]) - assert(0) + assert 0 args_wash.append((name, tp_str, comment)) return args_wash @@ -394,7 +394,7 @@ def main(): fw(" :return:\n\n") for (name, tp, comment) in args_out_wash: - assert(name.endswith(".out")) + assert name.endswith(".out") name = name[:-4] fw(" - ``%s``: %s\n\n" % (name, comment)) fw(" **type** %s\n" % tp) diff --git a/doc/python_api/sphinx_changelog_gen.py b/doc/python_api/sphinx_changelog_gen.py index 4c9f7232a74..e2bbf7c3acd 100644 --- a/doc/python_api/sphinx_changelog_gen.py +++ b/doc/python_api/sphinx_changelog_gen.py @@ -101,7 +101,7 @@ def api_dump(args): version, version_key = api_version() if version is None: - raise(ValueError("API dumps can only be generated from within Blender.")) + raise ValueError("API dumps can only be generated from within Blender.") dump = {} dump_module = dump["bpy.types"] = {} @@ -250,7 +250,7 @@ def api_changelog(args): version, version_key = api_version() if version is None and (filepath_in_from is None or filepath_in_to is None): - raise(ValueError("API dumps files must be given when ran outside of Blender.")) + raise ValueError("API dumps files must be given when ran outside of Blender.") with open(indexpath, 'r', encoding='utf-8') as file_handle: index = json.load(file_handle) @@ -258,17 +258,21 @@ def api_changelog(args): if filepath_in_to is None: filepath_in_to = index.get(version_key, None) if filepath_in_to is None: - raise(ValueError("Cannot find API dump file for Blender version " + str(version) + " in index file.")) + 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 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.")) + raise ValueError("No previous version of Blender could be found in the index.") filepath_in_from = index.get(version_from_key, None) if filepath_in_from is None: - raise(ValueError("Cannot find API dump file for previous Blender version " + str(version_from) + " in index file.")) + raise ValueError( + "Cannot find API dump file for previous Blender version " + + str(version_from) + + " in index file." + ) print("Found from file: %r" % filepath_in_from) @@ -277,7 +281,7 @@ def api_changelog(args): with open(os.path.join(rootpath, filepath_in_to), 'r', encoding='utf-8') as file_handle: dump_version, dict_to = json.load(file_handle) - assert(tuple(dump_version) == version) + assert tuple(dump_version) == version api_changes = [] diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py index e07afe44545..0887e9e74d8 100644 --- a/doc/python_api/sphinx_doc_gen.py +++ b/doc/python_api/sphinx_doc_gen.py @@ -1477,7 +1477,7 @@ def pyrna2sphinx(basepath): struct_module_name = struct.module_name if USE_ONLY_BUILTIN_RNA_TYPES: - assert (struct_module_name == "bpy.types") + assert struct_module_name == "bpy.types" filepath = os.path.join(basepath, "%s.%s.rst" % (struct_module_name, struct.identifier)) file = open(filepath, "w", encoding="utf-8") fw = file.write |