From 4be55acbe4e45408e09bb71edb66bba6724e8ed3 Mon Sep 17 00:00:00 2001 From: kijai <40791699+kijai@users.noreply.github.com> Date: Tue, 26 May 2026 02:56:59 +0300 Subject: [PATCH] Fix linting --- comfy/ldm/sam3/detector.py | 3 +-- comfy_extras/sam3d_body/export/glb_openpose.py | 18 ++++++++++++------ comfy_extras/sam3d_body/export/openpose_2d.py | 3 ++- comfy_extras/sam3d_body/utils.py | 1 - 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/comfy/ldm/sam3/detector.py b/comfy/ldm/sam3/detector.py index 23a972ac7..dd5eb473d 100644 --- a/comfy/ldm/sam3/detector.py +++ b/comfy/ldm/sam3/detector.py @@ -9,8 +9,7 @@ from torchvision.ops import roi_align from comfy.ldm.modules.attention import optimized_attention from comfy.ldm.sam3.tracker import SAM3Tracker, SAM31Tracker -from comfy.ldm.sam3.sam import SAM3VisionBackbone # noqa: used in __init__ -from comfy.ldm.sam3.sam import MLP, PositionEmbeddingSine +from comfy.ldm.sam3.sam import SAM3VisionBackbone, MLP, PositionEmbeddingSine TRACKER_CLASSES = {"SAM3": SAM3Tracker, "SAM31": SAM31Tracker} from comfy.ops import cast_to_input diff --git a/comfy_extras/sam3d_body/export/glb_openpose.py b/comfy_extras/sam3d_body/export/glb_openpose.py index 602edde09..2b1617eb6 100644 --- a/comfy_extras/sam3d_body/export/glb_openpose.py +++ b/comfy_extras/sam3d_body/export/glb_openpose.py @@ -443,17 +443,23 @@ def _capsule_mesh_local( # omit them entirely. cap_r = 0.0 body_r = W - if n_cap_lat is None: n_cap_lat = 0 - if n_body is None: n_body = 0 - if n_lon is None: n_lon = 16 + if n_cap_lat is None: + n_cap_lat = 0 + if n_body is None: + n_body = 0 + if n_lon is None: + n_lon = 16 elif str(shape) == "ellipsoid": end_frac = float(min(0.95, max(0.05, end_width_frac))) cap_r = max(1e-7, W * end_frac) body_r = W # Ellipsoid defaults: more body rings to sample the sin(π·u) curve. - if n_cap_lat is None: n_cap_lat = 3 - if n_body is None: n_body = 7 - if n_lon is None: n_lon = 12 + if n_cap_lat is None: + n_cap_lat = 3 + if n_body is None: + n_body = 7 + if n_lon is None: + n_lon = 12 else: raise ValueError( f"_capsule_mesh_local: unknown shape={shape!r} " diff --git a/comfy_extras/sam3d_body/export/openpose_2d.py b/comfy_extras/sam3d_body/export/openpose_2d.py index 084ffa8f3..d602acc6e 100644 --- a/comfy_extras/sam3d_body/export/openpose_2d.py +++ b/comfy_extras/sam3d_body/export/openpose_2d.py @@ -9,6 +9,7 @@ the DWPose face slot). Output: (H, W, 3) fp32 torch.Tensor in [0, 1]. """ +import logging from typing import Any, Dict, Optional, Tuple import numpy as np @@ -178,7 +179,7 @@ def render_pose_data_openpose( if use_rig_only: face_vert_ids = face_vert_ids[_EYES_MOUTH_IDX] except Exception as e: - print(f"[SAM3DBody] face landmarks disabled - {e}") + logging.warning(f"[SAM3DBody] face landmarks disabled - {e}") face_vert_ids = None hand_dot_color = ( diff --git a/comfy_extras/sam3d_body/utils.py b/comfy_extras/sam3d_body/utils.py index 09e5f300f..2b5345481 100644 --- a/comfy_extras/sam3d_body/utils.py +++ b/comfy_extras/sam3d_body/utils.py @@ -10,7 +10,6 @@ from comfy.ldm.sam3d_body.model.model import SAM3DBody import comfy.model_management -from comfy_api.latest import io import comfy.utils from tqdm import tqdm