Skip to content

Commit

Permalink
chore: fix G003
Browse files Browse the repository at this point in the history
  • Loading branch information
saturday06 committed Jun 23, 2024
1 parent 23bfd41 commit 438322c
Show file tree
Hide file tree
Showing 16 changed files with 62 additions and 52 deletions.
4 changes: 2 additions & 2 deletions extension.patch
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ index 22658475..5f4289fb 100644
-
- logger.warning(
- "%s Extracting the partial add-on archive for "
- + "users who have acquired the add-on "
- + 'from "Code" -> "Download ZIP" on GitHub ...',
- "users who have acquired the add-on "
- 'from "Code" -> "Download ZIP" on GitHub ...',
- log_warning_prefix,
- )
-
Expand Down
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ ignore = [
"EXE002", # The file is executable but no shebang is present

"FBT003", # Boolean positional value in function call
"G003", # Logging statement uses `+`

# ----- ignored -----

Expand Down Expand Up @@ -143,7 +142,6 @@ typeCheckingMode = "strict"

reportMissingModuleSource = false
reportCallInDefaultInitializer = true
reportImplicitStringConcatenation = true
reportShadowedImports = true

[build-system]
Expand Down
4 changes: 2 additions & 2 deletions src/io_scene_vrm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ def extract_github_private_partial_code_archive_if_necessary() -> None:

logger.warning(
"%s Extracting the partial add-on archive for "
+ "users who have acquired the add-on "
+ 'from "Code" -> "Download ZIP" on GitHub ...',
"users who have acquired the add-on "
'from "Code" -> "Download ZIP" on GitHub ...',
log_warning_prefix,
)

Expand Down
14 changes: 10 additions & 4 deletions src/io_scene_vrm/common/native.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ def read_blend_method_from_memory_address(material: Material) -> Optional[str]:

if bpy.app.build_type != b"Release":
logger.warning(
f'The Blend Mode of "{material.name}" could not be read. '
+ f'"{bpy.app.build_type!r}" builds are not supported.'
'The Blend Mode of "%s" could not be read. "%s" builds are not supported.',
material.name,
bpy.app.build_type,
)
return None

Expand All @@ -46,8 +47,13 @@ def read_blend_method_from_memory_address(material: Material) -> Optional[str]:
)
if native_struct_offset is None:
logger.warning(
f'The Blend Mode of "{material.name}" could not be read. '
+ f"Blender {major}.{minor} ({platform=}, {ext_suffix=}) is not supported."
'The Blend Mode of "%s" could not be read.'
" Blender %s.%s (platform=%s, ext_suffix=%s) is not supported.",
material.name,
major,
minor,
platform,
ext_suffix,
)
return None

Expand Down
15 changes: 8 additions & 7 deletions src/io_scene_vrm/common/shader.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,7 @@ def load_mtoon1_node_group(

end_time = time.perf_counter()
logger.debug(
f'Loaded NodeTree "{node_group_name}": '
+ f"{end_time - start_time:.9f} seconds"
'Loaded NodeTree "%s": %.9f seconds', node_group_name, end_time - start_time
)


Expand Down Expand Up @@ -446,7 +445,7 @@ def load_mtoon1_shader(

end_time = time.perf_counter()
logger.debug(
f'Loaded Material "{material.name}": ' + f"{end_time - start_time:.9f} seconds"
'Loaded Material "%s": %.9f seconds', material.name, end_time - start_time
)


Expand Down Expand Up @@ -1204,8 +1203,9 @@ def copy_node_tree_interface(from_node_tree: NodeTree, to_node_tree: NodeTree) -
from_socket_type = from_item.socket_type
if not from_socket_type:
logger.error(
f"{from_item.name} has empty socket_type."
+ f" type={type(from_item).__name__}"
"%s has empty socket_type. type=%s",
from_item.name,
type(from_item).__name__,
)
if isinstance(from_item, NodeTreeInterfaceSocketFloatFactor):
from_socket_type = "NodeSocketFloat"
Expand Down Expand Up @@ -1324,8 +1324,9 @@ def copy_node_tree(
continue
if not 0 <= output_socket_index < len(output_node.outputs):
logger.error(
"Output socket out of range: "
+ f"{output_socket_index} < {len(output_node.outputs)}"
"Output socket out of range: %d < %d",
output_socket_index,
len(output_node.outputs),
)
continue
output_socket = output_node.outputs[output_socket_index]
Expand Down
11 changes: 7 additions & 4 deletions src/io_scene_vrm/editor/migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,10 @@ def migrate(context: Optional[Context], armature_object_name: str) -> bool:

updated_addon_version = addon_version()
logger.info(
f"Upgrade armature {armature_object_name}"
+ f" {tuple(ext.addon_version)} to {updated_addon_version}"
"Upgrade armature %s %s to %s",
armature_object_name,
tuple(ext.addon_version),
updated_addon_version,
)
ext.addon_version = updated_addon_version

Expand Down Expand Up @@ -120,8 +122,9 @@ def migrate_all_objects(

updated_addon_version = addon_version()
logger.debug(
"Upgrade preferences"
+ f" {tuple(preferences.addon_version)} to {updated_addon_version}"
"Upgrade preferences %s to %s",
tuple(preferences.addon_version),
updated_addon_version,
)
preferences.addon_version = updated_addon_version

Expand Down
4 changes: 2 additions & 2 deletions src/io_scene_vrm/editor/mtoon1/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ def update_mtoon1_outline() -> Optional[float]:
compare_end_time = time.perf_counter()

logger.debug(
"The duration to determine material updates is "
+ f"{compare_end_time - compare_start_time:.9f} seconds"
"The duration to determine material updates is %.9f seconds",
compare_end_time - compare_start_time,
)

if not_changed:
Expand Down
8 changes: 4 additions & 4 deletions src/io_scene_vrm/editor/property_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@ def set_mesh_object_name(self, value: object) -> None:
def get_value(self) -> str:
logger.warning(
"MeshObjectPropertyGroup.value is deprecated."
+ " Use MeshObjectPropertyGroup.mesh_object_name instead."
" Use MeshObjectPropertyGroup.mesh_object_name instead."
)
return str(self.mesh_object_name)

def set_value(self, value: str) -> None:
logger.warning(
"MeshObjectPropertyGroup.value is deprecated."
+ " Use MeshObjectPropertyGroup.mesh_object_name instead."
" Use MeshObjectPropertyGroup.mesh_object_name instead."
)
self.mesh_object_name = value

Expand Down Expand Up @@ -355,14 +355,14 @@ def set_bone_name(
def get_value(self) -> str:
logger.warning(
"BonePropertyGroup.value is deprecated."
+ " Use BonePropertyGroup.bone_name instead."
" Use BonePropertyGroup.bone_name instead."
)
return str(self.bone_name)

def set_value(self, value: str) -> None:
logger.warning(
"BonePropertyGroup.value is deprecated."
+ " Use BonePropertyGroup.bone_name instead."
" Use BonePropertyGroup.bone_name instead."
)
self.bone_name = value

Expand Down
2 changes: 1 addition & 1 deletion src/io_scene_vrm/editor/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def execute(self, context: Context) -> set[str]:
logger.warning("Validation error: truncated ...")
break
if error.severity == 0:
logger.warning("Validation error: " + error.message)
logger.warning("Validation error: %s", error.message)
fatal_error_count += 1
if fatal_error_count > 0:
return {"CANCELLED"}
Expand Down
4 changes: 2 additions & 2 deletions src/io_scene_vrm/editor/vrm1/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ def update_look_at_preview() -> Optional[float]:
compare_end_time = time.perf_counter()

logger.debug(
"The duration to determine look at preview updates is "
+ f"{compare_end_time - compare_start_time:.9f} seconds"
"The duration to determine look at preview updates is %.9f seconds",
compare_end_time - compare_start_time,
)

if not changed:
Expand Down
10 changes: 6 additions & 4 deletions src/io_scene_vrm/exporter/vrm0_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -2450,8 +2450,9 @@ def mesh_to_bin_and_dict(self) -> None:

if len(weight_and_joint_list) > 4:
logger.warning(
"Joints on vertex "
+ f"id: {loop.vert.index} in: {mesh.name} are truncated"
"Joints on vertex index=%d mesh=%s are truncated",
loop.vert.index,
mesh.name,
)
weight_and_joint_list = weight_and_joint_list[:4]

Expand All @@ -2460,8 +2461,9 @@ def mesh_to_bin_and_dict(self) -> None:

if sum(weights) < float_info.epsilon:
logger.warning(
"No weight on vertex "
+ f"id:{loop.vert.index} in:{mesh.name}"
"No weight on vertex index=%d mesh=%s",
loop.vert.index,
mesh.name,
)

# Attach near bone
Expand Down
16 changes: 8 additions & 8 deletions src/io_scene_vrm/importer/abstract_base_vrm_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -890,9 +890,9 @@ def import_gltf2_with_indices(self) -> None:
full_vrm_import_success = True
except RuntimeError:
logger.exception(
f'Failed to import "{indexed_vrm_filepath}"'
+ f' generated from "{self.parse_result.filepath}"'
+ " using glTF 2.0 Add-on"
'Failed to import "%s" generated from "%s" using glTF 2.0 Add-on',
indexed_vrm_filepath,
self.parse_result.filepath,
)
self.cleanup_gltf2_with_indices()
if not full_vrm_import_success:
Expand All @@ -912,9 +912,10 @@ def import_gltf2_with_indices(self) -> None:
)
except RuntimeError:
logger.exception(
f'Failed to import "{indexed_vrm_filepath}"'
+ f' generated from "{self.parse_result.filepath}"'
+ " using glTF 2.0 Add-on without animations key"
'Failed to import "%s" generated from "%s"'
" using glTF 2.0 Add-on without animations key",
indexed_vrm_filepath,
self.parse_result.filepath,
)
self.cleanup_gltf2_with_indices()
raise
Expand Down Expand Up @@ -1194,8 +1195,7 @@ def viewport_setup(self) -> None:
view_settings.view_transform = "Standard"
except TypeError:
logger.exception(
"scene.view_settings.view_transform"
+ ' doesn\'t support "Standard".'
'scene.view_settings.view_transform doesn\'t support "Standard".'
)

if self.preferences.set_shading_type_to_material_on_import:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ def gather_import_image_after_hook(

if not isinstance(bpy_image, Image):
logger.warning(
"gather_import_image_after_hook: "
+ "bpy_image is not a Image but {type(bpy_image)}"
"gather_import_image_after_hook: bpy_image is not a Image but %s",
type(bpy_image),
)
return

Expand All @@ -44,8 +44,8 @@ def gather_import_image_after_hook(
)
if images is None:
logger.warning(
"gather_import_image_after_hook: "
+ "gltf_importer is unexpected structure: %s",
"gather_import_image_after_hook:"
" gltf_importer is unexpected structure: %s",
gltf_importer,
)
return
Expand Down
4 changes: 2 additions & 2 deletions src/io_scene_vrm/importer/vrm1_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ def assign_texture(
colorspace_settings.name = texture.colorspace
except TypeError:
logger.exception(
"image.colorspace_settings.name doesn't support"
+ f" {texture.colorspace}."
"image.colorspace_settings.name doesn't support %s",
texture.colorspace,
)
if texture.colorspace == "Non-Color":
with contextlib.suppress(TypeError):
Expand Down
4 changes: 2 additions & 2 deletions src/io_scene_vrm/importer/vrm_animation_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -928,8 +928,8 @@ def assign_humanoid_keyframe(
dump(rest_to_pose_world_rotation),
)
logger.debug(
"rest_to_pose_target_local_rotation = "
+ dump(rest_to_pose_target_local_rotation)
"rest_to_pose_target_local_rotation = %s",
dump(rest_to_pose_target_local_rotation),
)

# logger.debug("parent bone matrix = %s", dump(parent_matrix))
Expand Down
4 changes: 2 additions & 2 deletions src/io_scene_vrm/importer/vrm_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,8 @@ def decode_bin(
buffer_view_index = accessor_dict.get("bufferView")
if not isinstance(buffer_view_index, int):
logger.warning(
f"accessors[{accessor_index}] doesn't have bufferView "
+ "that is not implemented yet"
"accessors[%s] doesn't have bufferView that is not implemented yet",
accessor_index,
)
decoded_binary.append([])
continue
Expand Down

0 comments on commit 438322c

Please sign in to comment.