diff --git a/scripts/modules/_bpy_internal/system_info/text_generate_runtime.py b/scripts/modules/_bpy_internal/system_info/text_generate_runtime.py index 3f76a856598..eae5692508d 100644 --- a/scripts/modules/_bpy_internal/system_info/text_generate_runtime.py +++ b/scripts/modules/_bpy_internal/system_info/text_generate_runtime.py @@ -197,8 +197,8 @@ def write(output): glext = sorted(gpu.capabilities.extensions_get()) - for l in glext: - output.write("\t{:s}\n".format(l)) + for line in glext: + output.write("\t{:s}\n".format(line)) output.write(title("Implementation Dependent GPU Limits")) output.write("Maximum Batch Vertices:\t{:d}\n".format( diff --git a/scripts/modules/addon_utils.py b/scripts/modules/addon_utils.py index 27888333137..39f6f6b7386 100644 --- a/scripts/modules/addon_utils.py +++ b/scripts/modules/addon_utils.py @@ -114,22 +114,22 @@ def _fake_module(mod_name, mod_path, speedy=True): if speedy: lines = [] line_iter = iter(file_mod) - l = "" - while not l.startswith("bl_info"): + line = "" + while not line.startswith("bl_info"): try: - l = line_iter.readline() + line = line_iter.readline() except UnicodeDecodeError as ex: if not error_encoding: error_encoding = True print("Error reading file as UTF-8:", mod_path, ex) return None - if len(l) == 0: + if len(line) == 0: break - while l.rstrip(): - lines.append(l) + while line.rstrip(): + lines.append(line) try: - l = line_iter.readline() + line = line_iter.readline() except UnicodeDecodeError as ex: if not error_encoding: error_encoding = True diff --git a/scripts/modules/animsys_refactor.py b/scripts/modules/animsys_refactor.py index a0d0f287c03..37e4767da7a 100644 --- a/scripts/modules/animsys_refactor.py +++ b/scripts/modules/animsys_refactor.py @@ -102,11 +102,12 @@ class DataPathBuilder: def id_iter(): - type_iter = type(bpy.data.objects) + from bpy.types import bpy_prop_collection + assert isinstance(bpy.data.objects, bpy_prop_collection) for attr in dir(bpy.data): data_iter = getattr(bpy.data, attr, None) - if type(data_iter) == type_iter: + if isinstance(data_iter, bpy_prop_collection): for id_data in data_iter: if id_data.library is None: yield id_data diff --git a/scripts/modules/bl_i18n_utils/bl_extract_messages.py b/scripts/modules/bl_i18n_utils/bl_extract_messages.py index be151a27ed1..27884059178 100644 --- a/scripts/modules/bl_i18n_utils/bl_extract_messages.py +++ b/scripts/modules/bl_i18n_utils/bl_extract_messages.py @@ -867,11 +867,11 @@ def dump_src_messages(msgs, reports, settings): forced = set() if os.path.isfile(settings.SRC_POTFILES): with open(settings.SRC_POTFILES, encoding="utf8") as src: - for l in src: - if l[0] == '-': - forbidden.add(l[1:].rstrip('\n')) - elif l[0] != '#': - forced.add(l.rstrip('\n')) + for line in src: + if line[0] == '-': + forbidden.add(line[1:].rstrip('\n')) + elif line[0] != '#': + forced.add(line.rstrip('\n')) for root, dirs, files in os.walk(settings.POTFILES_SOURCE_DIR): if "/.git" in root: continue diff --git a/scripts/modules/bpy/path.py b/scripts/modules/bpy/path.py index 0722e59a313..44e0d528564 100644 --- a/scripts/modules/bpy/path.py +++ b/scripts/modules/bpy/path.py @@ -187,7 +187,7 @@ clean_name._trans_cache = {} def _clean_utf8(name): - if type(name) == bytes: + if type(name) is bytes: return name.decode("utf8", "replace") else: return name.encode("utf8", "replace").decode("utf8") diff --git a/scripts/modules/console_python.py b/scripts/modules/console_python.py index 9fd21984509..742e2e65929 100644 --- a/scripts/modules/console_python.py +++ b/scripts/modules/console_python.py @@ -33,8 +33,11 @@ class _TempModuleOverride: def add_scrollback(text, text_type): - for l in text.split("\n"): - bpy.ops.console.scrollback_append(text=l, type=text_type) + for line in text.split("\n"): + bpy.ops.console.scrollback_append( + text=line, + type=text_type, + ) def replace_help(namespace): diff --git a/scripts/modules/console_shell.py b/scripts/modules/console_shell.py index d30e457d54e..1f261435577 100644 --- a/scripts/modules/console_shell.py +++ b/scripts/modules/console_shell.py @@ -9,9 +9,11 @@ language_id = "shell" def add_scrollback(text, text_type): - for l in text.split("\n"): - bpy.ops.console.scrollback_append(text=l.replace("\t", " "), - type=text_type) + for line in text.split("\n"): + bpy.ops.console.scrollback_append( + text=line.replace("\t", " "), + type=text_type, + ) def shell_run(text): diff --git a/scripts/modules/graphviz_export.py b/scripts/modules/graphviz_export.py index 5ab7b685d36..808f9ef2de8 100644 --- a/scripts/modules/graphviz_export.py +++ b/scripts/modules/graphviz_export.py @@ -57,9 +57,10 @@ def graph_armature(obj, filepath, FAKE_PARENT=True, CONSTRAINTS=True, DRIVERS=Tr if key.startswith("_"): continue - if type(value) == float: + value_type = type(value) + if value_type is float: value = "{:.3f}".format(value) - elif type(value) == str: + elif value_type is str: value = compat_str(value) label.append("{:s} = {:s}".format(key, value)) diff --git a/scripts/startup/bl_ui/properties_data_curve.py b/scripts/startup/bl_ui/properties_data_curve.py index d653f853296..e244bfc09c6 100644 --- a/scripts/startup/bl_ui/properties_data_curve.py +++ b/scripts/startup/bl_ui/properties_data_curve.py @@ -229,7 +229,7 @@ class DATA_PT_geometry_curve_start_end(CurveButtonsPanelCurve, Panel): @classmethod def poll(cls, context): # Text objects don't support these properties - return (type(context.curve) == Curve) + return (type(context.curve) is Curve) def draw(self, context): layout = self.layout diff --git a/scripts/startup/bl_ui/space_toolsystem_common.py b/scripts/startup/bl_ui/space_toolsystem_common.py index d4f3dcf5c63..32c7f93d5c0 100644 --- a/scripts/startup/bl_ui/space_toolsystem_common.py +++ b/scripts/startup/bl_ui/space_toolsystem_common.py @@ -43,7 +43,7 @@ def _keymap_fn_from_seq(keymap_data): def _item_is_fn(item): - return (not (type(item) is ToolDef) and callable(item)) + return ((type(item) is not ToolDef) and callable(item)) from collections import namedtuple diff --git a/scripts/startup/bl_ui/space_userpref.py b/scripts/startup/bl_ui/space_userpref.py index cc3537603e6..f9adc96008e 100644 --- a/scripts/startup/bl_ui/space_userpref.py +++ b/scripts/startup/bl_ui/space_userpref.py @@ -2432,8 +2432,8 @@ class USERPREF_PT_addons(AddOnPanel, Panel): sub = box.row() sub.label(text=lines[0]) sub.label(icon='ERROR') - for l in lines[1:]: - box.label(text=l) + for line in lines[1:]: + box.label(text=line) @staticmethod def _draw_addon_header(layout, prefs, wm):