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 /release | |
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 'release')
20 files changed, 37 insertions, 37 deletions
diff --git a/release/datafiles/blender_icons_geom.py b/release/datafiles/blender_icons_geom.py index b95baf3419e..878cc4b46f6 100644 --- a/release/datafiles/blender_icons_geom.py +++ b/release/datafiles/blender_icons_geom.py @@ -72,7 +72,7 @@ class TriMesh: @staticmethod def _tri_copy_from_object(ob): import bmesh - assert(ob.type in OBJECTS_TYPES_MESH_COMPATIBLE) + assert ob.type in OBJECTS_TYPES_MESH_COMPATIBLE bm = bmesh.new() bm.from_mesh(ob.to_mesh()) bmesh.ops.triangulate(bm, faces=bm.faces) @@ -143,7 +143,7 @@ def mesh_data_lists_from_mesh(me, material_colors): i1 = 1 # we only write tris now - assert(len(loops_poly) == 3) + assert len(loops_poly) == 3 for i2 in range(2, l_len): l0 = loops_poly[i0] @@ -217,7 +217,7 @@ def mesh_data_lists_from_objects(ob_parent, ob_children): def write_mesh_to_py(fh, ob, ob_children): def float_as_byte(f, axis_range): - assert(axis_range <= 255) + assert axis_range <= 255 # -1..1 -> 0..255 f = (f + 1.0) * 0.5 f = round(f * axis_range) @@ -238,7 +238,7 @@ def write_mesh_to_py(fh, ob, ob_children): if 0: # make as large as we can, keeping alignment def size_scale_up(size): - assert(size != 0) + assert size != 0 while size * 2 <= 255: size *= 2 return size diff --git a/release/datafiles/ctodata.py b/release/datafiles/ctodata.py index b6420d5c9a2..6c5afdb1b5b 100755 --- a/release/datafiles/ctodata.py +++ b/release/datafiles/ctodata.py @@ -31,7 +31,7 @@ data = [int(v) for v in data] if strip_byte: # String data gets trailing byte. last = data.pop() - assert(last == 0) + assert last == 0 data = bytes(data) diff --git a/release/scripts/freestyle/modules/freestyle/functions.py b/release/scripts/freestyle/modules/freestyle/functions.py index 4a4a2f036e1..326e072d34a 100644 --- a/release/scripts/freestyle/modules/freestyle/functions.py +++ b/release/scripts/freestyle/modules/freestyle/functions.py @@ -198,7 +198,7 @@ class pyInverseCurvature2DAngleF0D(UnaryFunction0DDouble): class pyCurvilinearLengthF0D(UnaryFunction0DDouble): def __call__(self, inter): cp = inter.object - assert(isinstance(cp, CurvePoint)) + assert isinstance(cp, CurvePoint) return cp.t2d diff --git a/release/scripts/modules/bl_app_override/__init__.py b/release/scripts/modules/bl_app_override/__init__.py index 4d6194e71cd..1408cf3594f 100644 --- a/release/scripts/modules/bl_app_override/__init__.py +++ b/release/scripts/modules/bl_app_override/__init__.py @@ -74,7 +74,7 @@ def ui_draw_filter_register( if ui_test is None: UILayout.__getattribute__(self, "label")(text="") else: - assert(ui_test is True) + assert ui_test is True # may need to be set ret = OperatorProperties_Fake() return ret @@ -95,7 +95,7 @@ def ui_draw_filter_register( if ui_test is None: UILayout.__getattribute__(self, "label")(text="") else: - assert(ui_test is True) + assert ui_test is True ret = None return ret return dummy_func @@ -115,7 +115,7 @@ def ui_draw_filter_register( if ui_test is None: UILayout.__getattribute__(self, "label")(text="") else: - assert(ui_test is True) + assert ui_test is True ret = None return ret return dummy_func @@ -135,7 +135,7 @@ def ui_draw_filter_register( if ui_test is None: real_func(text="") else: - assert(ui_test is True) + assert ui_test is True ret = None return ret return dummy_func diff --git a/release/scripts/modules/bl_app_override/helpers.py b/release/scripts/modules/bl_app_override/helpers.py index 4759e0ae8e5..0b785511886 100644 --- a/release/scripts/modules/bl_app_override/helpers.py +++ b/release/scripts/modules/bl_app_override/helpers.py @@ -44,14 +44,14 @@ class AppOverrideState: self._ui_ignore_store = None def _setup_classes(self): - assert(self._class_store is None) + assert self._class_store is None self._class_store = self.class_ignore() from bpy.utils import unregister_class for cls in self._class_store: unregister_class(cls) def _teardown_classes(self): - assert(self._class_store is not None) + assert self._class_store is not None from bpy.utils import register_class for cls in self._class_store: diff --git a/release/scripts/modules/bl_console_utils/autocomplete/complete_import.py b/release/scripts/modules/bl_console_utils/autocomplete/complete_import.py index 2f321fee0b2..1a97e408b70 100644 --- a/release/scripts/modules/bl_console_utils/autocomplete/complete_import.py +++ b/release/scripts/modules/bl_console_utils/autocomplete/complete_import.py @@ -42,7 +42,7 @@ def get_root_modules(): """ global ROOT_MODULES modules = [] - if not(ROOT_MODULES is None): + if not (ROOT_MODULES is None): return ROOT_MODULES from time import time t = time() @@ -131,7 +131,7 @@ def complete(line): if only_modules: return inspect.ismodule(getattr(module, attr)) else: - return not(attr[:2] == '__' and attr[-2:] == '__') + return not (attr[:2] == '__' and attr[-2:] == '__') try: m = __import__(mod) diff --git a/release/scripts/modules/bl_console_utils/autocomplete/complete_namespace.py b/release/scripts/modules/bl_console_utils/autocomplete/complete_namespace.py index 4ba446d6832..096e5596fc6 100644 --- a/release/scripts/modules/bl_console_utils/autocomplete/complete_namespace.py +++ b/release/scripts/modules/bl_console_utils/autocomplete/complete_namespace.py @@ -132,7 +132,7 @@ def complete(word, namespace, *, private=True): matches = complete_indices(word, namespace, base=re_incomplete_index.group(1)) - elif not('[' in word): + elif not ('[' in word): matches = complete_names(word, namespace) elif word[-1] == ']': @@ -182,7 +182,7 @@ def complete(word, namespace, *, private=True): matches = [word + '.'] # separate public from private - public_matches = [match for match in matches if not('._' in match)] + public_matches = [match for match in matches if not ('._' in match)] if private: private_matches = [match for match in matches if '._' in match] return public_matches + private_matches diff --git a/release/scripts/modules/bl_i18n_utils/settings.py b/release/scripts/modules/bl_i18n_utils/settings.py index 77ab70f8d91..374b90446f3 100644 --- a/release/scripts/modules/bl_i18n_utils/settings.py +++ b/release/scripts/modules/bl_i18n_utils/settings.py @@ -87,7 +87,7 @@ LANGUAGES = ( # Default context, in py (keep in sync with `BLT_translation.h`)! if bpy is not None: - assert(bpy.app.translations.contexts.default == "*") + assert bpy.app.translations.contexts.default == "*" DEFAULT_CONTEXT = "*" # Name of language file used by Blender to generate translations' menu. diff --git a/release/scripts/modules/bl_i18n_utils/utils.py b/release/scripts/modules/bl_i18n_utils/utils.py index 324c3ea261d..784b206fb84 100644 --- a/release/scripts/modules/bl_i18n_utils/utils.py +++ b/release/scripts/modules/bl_i18n_utils/utils.py @@ -68,7 +68,7 @@ def locale_explode(locale): try: import bpy.app.translations as bpy_translations - assert(ret == bpy_translations.locale_explode(locale)) + assert ret == bpy_translations.locale_explode(locale) except ModuleNotFoundError: pass diff --git a/release/scripts/modules/bl_keymap_utils/io.py b/release/scripts/modules/bl_keymap_utils/io.py index 5d74ffbcf56..8d849498bd7 100644 --- a/release/scripts/modules/bl_keymap_utils/io.py +++ b/release/scripts/modules/bl_keymap_utils/io.py @@ -229,7 +229,7 @@ def keyconfig_export_as_data(wm, kc, filepath, *, all_keymaps=False): # Take care making changes that could impact performance. def _init_properties_from_data(base_props, base_value): - assert(type(base_value) is list) + assert type(base_value) is list for attr, value in base_value: if type(value) is list: base_props.property_unset(attr) diff --git a/release/scripts/modules/bpy_extras/io_utils.py b/release/scripts/modules/bpy_extras/io_utils.py index 35b7d564a5e..b6da6c7768c 100644 --- a/release/scripts/modules/bpy_extras/io_utils.py +++ b/release/scripts/modules/bpy_extras/io_utils.py @@ -295,7 +295,7 @@ def axis_conversion(from_forward='Y', from_up='Z', to_forward='Y', to_up='Z'): for i, axis_lut in enumerate(_axis_convert_lut): if value in axis_lut: return Matrix(_axis_convert_matrix[i]) - assert(0) + assert 0 def axis_conversion_ensure(operator, forward_attr, up_attr): diff --git a/release/scripts/modules/bpy_extras/node_shader_utils.py b/release/scripts/modules/bpy_extras/node_shader_utils.py index cda291c6c90..0c349084220 100644 --- a/release/scripts/modules/bpy_extras/node_shader_utils.py +++ b/release/scripts/modules/bpy_extras/node_shader_utils.py @@ -13,7 +13,7 @@ def _set_check(func): @wraps(func) def wrapper(self, *args, **kwargs): if self.is_readonly: - assert(not "Trying to set value to read-only shader!") + assert not "Trying to set value to read-only shader!" return return func(self, *args, **kwargs) return wrapper diff --git a/release/scripts/modules/bpy_extras/wm_utils/progress_report.py b/release/scripts/modules/bpy_extras/wm_utils/progress_report.py index 637d60838db..371d598042c 100644 --- a/release/scripts/modules/bpy_extras/wm_utils/progress_report.py +++ b/release/scripts/modules/bpy_extras/wm_utils/progress_report.py @@ -93,7 +93,7 @@ class ProgressReport: def leave_substeps(self, msg=""): if (msg): self.update(msg) - assert(len(self.steps) > 1) + assert len(self.steps) > 1 del self.steps[-1] del self.curr_step[-1] del self.start_time[-1] @@ -134,7 +134,7 @@ class ProgressReportSubstep: return self def __exit__(self, exc_type, exc_value, traceback): - assert(len(self.progress.steps) > self.level) + assert len(self.progress.steps) > self.level while len(self.progress.steps) > self.level + 1: self.progress.leave_substeps() self.progress.leave_substeps(self.final_msg) diff --git a/release/scripts/modules/rna_prop_ui.py b/release/scripts/modules/rna_prop_ui.py index 8b8cfaaccc5..5f4a6b8cf38 100644 --- a/release/scripts/modules/rna_prop_ui.py +++ b/release/scripts/modules/rna_prop_ui.py @@ -127,7 +127,7 @@ def draw(layout, context, context_member, property_type, *, use_edit=True): use_edit = False is_lib_override = rna_item.id_data.override_library and rna_item.id_data.override_library.reference - assert(isinstance(rna_item, property_type)) + assert isinstance(rna_item, property_type) items = list(rna_item.items()) items.sort() @@ -183,7 +183,7 @@ def draw(layout, context, context_member, property_type, *, use_edit=True): # Do not allow editing of overridden properties (we cannot use a poll function # of the operators here since they's have no access to the specific property). - operator_row.enabled = not(is_lib_override and key in rna_item.id_data.override_library.reference) + operator_row.enabled = not (is_lib_override and key in rna_item.id_data.override_library.reference) if use_edit: if is_rna: diff --git a/release/scripts/presets/keyconfig/keymap_data/blender_default.py b/release/scripts/presets/keyconfig/keymap_data/blender_default.py index c8569990a3a..75d0717184e 100644 --- a/release/scripts/presets/keyconfig/keymap_data/blender_default.py +++ b/release/scripts/presets/keyconfig/keymap_data/blender_default.py @@ -128,7 +128,7 @@ class Params: self.legacy = legacy if use_mouse_emulate_3_button: - assert(use_alt_tool_or_cursor is False) + assert use_alt_tool_or_cursor is False if select_mouse == 'RIGHT': # Right mouse select. diff --git a/release/scripts/startup/bl_operators/uvcalc_follow_active.py b/release/scripts/startup/bl_operators/uvcalc_follow_active.py index a5c91f238d2..f9f8d7d1019 100644 --- a/release/scripts/startup/bl_operators/uvcalc_follow_active.py +++ b/release/scripts/startup/bl_operators/uvcalc_follow_active.py @@ -229,7 +229,7 @@ def main(context, operator): elif status & STATUS_ERR_NOT_SELECTED: operator.report({'ERROR'}, "Active face not selected") else: - assert((status & STATUS_ERR_ACTIVE_FACE) != 0) + assert status & STATUS_ERR_ACTIVE_FACE != 0 operator.report({'ERROR'}, "No active face") diff --git a/release/scripts/startup/bl_operators/uvcalc_lightmap.py b/release/scripts/startup/bl_operators/uvcalc_lightmap.py index 93c72c97129..995ec721046 100644 --- a/release/scripts/startup/bl_operators/uvcalc_lightmap.py +++ b/release/scripts/startup/bl_operators/uvcalc_lightmap.py @@ -452,7 +452,7 @@ def lightmap_uvpack( pretty_faces.append(pf_parent) w, h = pf_parent.width, pf_parent.height - assert(w <= h) + assert w <= h if w == h: even_dict.setdefault(w, []).append(pf_parent) diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index cbb5a63b754..f8cb57d638a 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -178,10 +178,10 @@ def context_path_decompose(data_path): prop_item = "".join(path_split[i + 1:]) if base_path: - assert(base_path.startswith(".")) + assert base_path.startswith(".") base_path = base_path[1:] if prop_attr: - assert(prop_attr.startswith(".")) + assert prop_attr.startswith(".") prop_attr = prop_attr[1:] else: # If there are no properties, everything is an item. @@ -2730,7 +2730,7 @@ class WM_OT_batch_rename(Operator): elif method == 'SUFFIX': name = name + text else: - assert(0) + assert 0 elif ty == 'STRIP': chars = action.strip_chars @@ -2775,9 +2775,9 @@ class WM_OT_batch_rename(Operator): elif method == 'TITLE': name = name.title() else: - assert(0) + assert 0 else: - assert(0) + assert 0 return name def _data_update(self, context): diff --git a/release/scripts/startup/bl_ui/space_toolsystem_common.py b/release/scripts/startup/bl_ui/space_toolsystem_common.py index 39dfdd0eecb..81acc0837aa 100644 --- a/release/scripts/startup/bl_ui/space_toolsystem_common.py +++ b/release/scripts/startup/bl_ui/space_toolsystem_common.py @@ -232,7 +232,7 @@ class ToolSelectPanelHelper: def _icon_value_from_icon_handle(icon_name): import os if icon_name is not None: - assert(type(icon_name) is str) + assert type(icon_name) is str icon_value = _icon_cache.get(icon_name) if icon_value is None: dirname = bpy.utils.system_resource('DATAFILES', path="icons") diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index d15be4a9d3f..78e7932433e 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -1917,7 +1917,7 @@ class VIEW3D_PT_tools_grease_pencil_sculpt_select(Panel, View3DPanel, GreasePenc if brush is not None: col.prop(brush, "use_custom_icon", toggle=True, icon='FILE_IMAGE', text="") - if(brush.use_custom_icon): + if (brush.use_custom_icon): layout.row().prop(brush, "icon_filepath", text="") @@ -2026,7 +2026,7 @@ class VIEW3D_PT_tools_grease_pencil_weight_paint_select(View3DPanel, Panel, Grea if brush is not None: col.prop(brush, "use_custom_icon", toggle=True, icon='FILE_IMAGE', text="") - if(brush.use_custom_icon): + if (brush.use_custom_icon): layout.row().prop(brush, "icon_filepath", text="") @@ -2101,7 +2101,7 @@ class VIEW3D_PT_tools_grease_pencil_vertex_paint_select(View3DPanel, Panel, Grea if brush is not None: col.prop(brush, "use_custom_icon", toggle=True, icon='FILE_IMAGE', text="") - if(brush.use_custom_icon): + if (brush.use_custom_icon): layout.row().prop(brush, "icon_filepath", text="") |