Cleanup: quiet python linter warnings

This commit is contained in:
Campbell Barton
2025-04-16 11:08:40 +10:00
parent f445df26f7
commit 9567ac1272
14 changed files with 14 additions and 16 deletions

View File

@@ -112,7 +112,7 @@ def api_dump(args):
dump_module = dump["bpy.types"] = {}
struct = rna_info.BuildRNAInfo()[0]
for struct_id, struct_info in sorted(struct.items()):
for _struct_id, struct_info in sorted(struct.items()):
struct_id_str = struct_info.identifier

View File

@@ -33,7 +33,7 @@ def keyconfig_update(keyconfig_data, keyconfig_version):
nonlocal has_copy
changed_items = []
for km_index, (km_name, _km_parms, km_items_data) in enumerate(keyconfig_data):
for km_index, (_km_name, _km_parms, km_items_data) in enumerate(keyconfig_data):
for kmi_item_index, (item_op, item_event, item_prop) in enumerate(km_items_data["items"]):
if item_prop and item_op in op_prop_map:
properties = item_prop.get("properties", [])

View File

@@ -543,7 +543,6 @@ class PREFERENCES_OT_addon_disable(Operator):
_wm_wait_cursor(True)
module_name = self.module
is_extension = addon_utils.check_extension(module_name)
addon_utils.disable(module_name, default_set=True, handle_error=err_cb)
if err_str:

View File

@@ -320,11 +320,11 @@ def lightmap_uvpack(
if added_ids[i]:
continue
tri1 = tri_lengths[i]
f1, lens1, lo1 = tri1
_f1, lens1, lo1 = tri1
sorted_l = (lens1[lo1[0]], lens1[lo1[1]], lens1[lo1[2]])
added_ids[i] = True
vec, nearest, dist = kd.find(sorted_l, filter=lambda idx: not added_ids[idx])
_vec, nearest, dist = kd.find(sorted_l, filter=lambda idx: not added_ids[idx])
if not nearest or nearest < 0:
pretty_faces.append(prettyface((tri1, None)))
break

View File

@@ -176,8 +176,6 @@ class OUTLINER_MT_id_data(Menu):
def draw(self, context):
layout = self.layout
space = context.space_data
layout.operator_enum("outliner.id_operation", "type")
id_linked = getattr(context, "id", None)

View File

@@ -1721,7 +1721,7 @@ class USERPREF_PT_file_paths_asset_libraries(FilePathsPanel, Panel):
class USERPREF_UL_asset_libraries(UIList):
def draw_item(self, _context, layout, _data, item, icon, _active_data, _active_propname, _index):
def draw_item(self, _context, layout, _data, item, _icon, _active_data, _active_propname, _index):
asset_library = item
if self.layout_type in {'DEFAULT', 'COMPACT'}:

View File

@@ -5,8 +5,6 @@
import bpy
from nodeitems_utils import (
NodeCategory,
NodeItem,
NodeItemCustom,
)

View File

@@ -258,6 +258,7 @@ def cppcheck(cppcheck_dir: str, temp_dir: str, log_fh: IO[bytes]) -> None:
process_functions = []
def my_process(i: int, c: str, cmd: list[str]) -> subprocess.Popen[Any]:
del c
proc = subprocess.Popen(
cmd,
stderr=subprocess.PIPE,

View File

@@ -55,7 +55,7 @@ if IS_ATTY:
print(text, end="\r", flush=True)
else:
def print_progress(text: str) -> None:
pass
del text
def argparse_create() -> argparse.ArgumentParser:

View File

@@ -200,7 +200,7 @@ class Credits:
chunk_size = 256
chunk_list = []
chunk = []
for i, c in enumerate(commit_iter):
for c in commit_iter:
chunk.append(c)
if len(chunk) >= chunk_size:
chunk_list.append(chunk)

View File

@@ -258,7 +258,7 @@ def bblocks_to_json(args, fw, blend, address_map, indent, indent_step):
indent = indent + indent_step
is_first = True
for i, block in enumerate(blend.blocks):
for block in blend.blocks:
if block.user_data is None or block.user_data > 0:
meta_keyval = gen_meta_keyval(blend, block)
if full_data:
@@ -280,7 +280,7 @@ def bdna_to_json(args, fw, blend, indent, indent_step):
def bdna_fields_to_json(blend, dna, indent, indent_step):
lst = []
for i, field in enumerate(dna.fields):
for field in dna.fields:
keyval = (
("dna_name", json_dumps(field.dna_name.name_only)),
("dna_type_id", json_dumps(field.dna_type.dna_type_id)),

View File

@@ -266,6 +266,7 @@ def file_remove_empty_braces(source_dst):
import re
def key_replace(match):
del match
return ""
data_prev = None
# Braces may become empty by removing nested

View File

@@ -37,6 +37,7 @@ class _GetchUnix:
def __init__(self):
import tty
del tty
def __call__(self):
import tty

View File

@@ -10,14 +10,14 @@ __all__ = (
import os
from os.path import join
from trailing_space_clean_config import PATHS
from collections.abc import (
Callable,
Iterator,
Sequence,
)
from trailing_space_clean_config import PATHS
SOURCE_EXT = (
# C/C++
".c", ".h", ".cpp", ".hpp", ".cc", ".hh", ".cxx", ".hxx", ".inl",