From 72f24fcbabb18fc66c0122d5f5238d887de67114 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 23 May 2025 03:58:31 +0000 Subject: [PATCH] Cleanup: resolve pylint warnings --- .../build_environment/utils/strip_libraries.py | 1 - doc/python_api/examples/gpu.1.py | 11 +++++++---- scripts/modules/rna_info.py | 7 +++++-- scripts/startup/bl_ui/space_image.py | 9 ++++++--- scripts/startup/bl_ui/space_spreadsheet.py | 1 + scripts/startup/bl_ui/space_toolsystem_common.py | 1 + tools/triage/weekly_report.py | 8 ++++++-- 7 files changed, 26 insertions(+), 12 deletions(-) diff --git a/build_files/build_environment/utils/strip_libraries.py b/build_files/build_environment/utils/strip_libraries.py index b10e1403552..9851ecf5a30 100755 --- a/build_files/build_environment/utils/strip_libraries.py +++ b/build_files/build_environment/utils/strip_libraries.py @@ -62,7 +62,6 @@ def main() -> None: if sys.platform == "linux": strip_libs(args.directory) - return if __name__ == "__main__": diff --git a/doc/python_api/examples/gpu.1.py b/doc/python_api/examples/gpu.1.py index 6c121267d03..7dad7c8c50e 100644 --- a/doc/python_api/examples/gpu.1.py +++ b/doc/python_api/examples/gpu.1.py @@ -86,19 +86,22 @@ They can be set using the ``shader.uniform_*`` functions after the shader has be .. note:: - It is important to note that GLSL sources are reinterpreted to MSL (Metal Shading Language) on Apple operating systems. + It is important to note that GLSL sources are reinterpreted to MSL (Metal Shading Language) + on Apple operating systems. This uses a small compatibility layer that does not cover the whole GLSL language specification. Here is a list of differences to keep in mind when targeting compatibility with Apple platforms: - * The only matrix constructors available are: + - The only matrix constructors available are: - diagonal scalar (example: ``mat2(1)``) - all scalars (example: ``mat2(1, 0, 0, 1)``) - column vector (example: ``mat2(vec2(1,0), vec2(0,1))``) - reshape constructors work only for square matrices (example: ``mat3(mat4(1))``) - * ``vertex``, ``fragment`` and ``kernel`` are reserved keywords. - * all types and keywords defined by the `MSL specification `__ are reserved keywords and should not be used. + - ``vertex``, ``fragment`` and ``kernel`` are reserved keywords. + - all types and keywords defined by the + `MSL specification `__ + are reserved keywords and should not be used. Batch Creation diff --git a/scripts/modules/rna_info.py b/scripts/modules/rna_info.py index 7f7f6584b17..0e47a2b5ccc 100644 --- a/scripts/modules/rna_info.py +++ b/scripts/modules/rna_info.py @@ -487,8 +487,11 @@ class InfoPropertyRNA: if self.is_path_supports_templates: type_info.append( - "Supports `template expressions `_".format( - *bpy.app.version[:2])) + "Supports `template expressions " + "`_".format( + *bpy.app.version[:2], + ), + ) if type_info: type_str += ", ({:s})".format(", ".join(type_info)) diff --git a/scripts/startup/bl_ui/space_image.py b/scripts/startup/bl_ui/space_image.py index d8d0634dde4..2152ae6e8f0 100644 --- a/scripts/startup/bl_ui/space_image.py +++ b/scripts/startup/bl_ui/space_image.py @@ -1744,9 +1744,12 @@ class IMAGE_PT_overlay_render_guides(Panel): @classmethod def poll(cls, context): sima = context.space_data - return ((sima.mode == 'MASK' or sima.mode == 'VIEW') and - (sima.image and sima.image.source == 'VIEWER' and - sima.image.type == 'COMPOSITING')) + return ( + (sima.mode in {'MASK', 'VIEW'}) and + (image := sima.image) is not None and + (image.source == 'VIEWER') and + (image.type == 'COMPOSITING') + ) def draw(self, context): layout = self.layout diff --git a/scripts/startup/bl_ui/space_spreadsheet.py b/scripts/startup/bl_ui/space_spreadsheet.py index 11e503b5acb..02fddc3e9ad 100644 --- a/scripts/startup/bl_ui/space_spreadsheet.py +++ b/scripts/startup/bl_ui/space_spreadsheet.py @@ -45,6 +45,7 @@ class SPREADSHEET_MT_editor_menus(bpy.types.Menu): bl_label = "" def draw(self, context): + del context layout = self.layout layout.menu("SPREADSHEET_MT_view") diff --git a/scripts/startup/bl_ui/space_toolsystem_common.py b/scripts/startup/bl_ui/space_toolsystem_common.py index c77e8e40f60..7f0c77181a6 100644 --- a/scripts/startup/bl_ui/space_toolsystem_common.py +++ b/scripts/startup/bl_ui/space_toolsystem_common.py @@ -1245,6 +1245,7 @@ class PlayheadSnappingPanel: @classmethod def poll(cls, context): + del context return True def draw(self, context): diff --git a/tools/triage/weekly_report.py b/tools/triage/weekly_report.py index e3c981d4b1d..172de1d3964 100755 --- a/tools/triage/weekly_report.py +++ b/tools/triage/weekly_report.py @@ -27,6 +27,8 @@ import re import shutil import sys +from dataclasses import dataclass, field + from gitea_utils import ( gitea_json_activities_get, gitea_json_pull_request_by_base_and_head_get, @@ -41,7 +43,6 @@ from typing import ( from collections.abc import ( Iterable, ) -from dataclasses import dataclass, field # Support piping the output to a file or process. IS_ATTY = sys.stdout.isatty() @@ -243,7 +244,10 @@ def report_personal_weekly_get( # against the default branch of the target repository. if not is_release_branch and target_repo_json: pr = gitea_json_pull_request_by_base_and_head_get( - target_repo_fullname, target_repo_json["default_branch"], f"{repo_fullname}:{branch_name}") + target_repo_fullname, + target_repo_json["default_branch"], + f"{repo_fullname}:{branch_name}", + ) branch = target_repo.branches[branch_name] if pr: