mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-08-09 07:20:15 -03:00
fix(types): resolve pre-existing basedpyright errors in tests
Fix ~790 basedpyright errors across the test suite: - Type stub subclasses of real production classes with super().__init__() - Add missing generic type arguments and Dict[str, Any] annotations - Add None guards before subscript/member access - Adapt tests to production API changes (removed dead handlers, PersistentModelCache.get_default, _i18n_filter_added location)
This commit is contained in:
@@ -44,13 +44,13 @@ def populated_registry(metadata_registry):
|
||||
|
||||
# Direct assignment to avoid scanner.py false positive
|
||||
# (scanner.py matches _CLASS_MAPPINGS.update({...}) pattern)
|
||||
nodes.NODE_CLASS_MAPPINGS["TSC_EfficientLoader"] = TSC_EfficientLoader
|
||||
nodes.NODE_CLASS_MAPPINGS["SamplerCustomAdvanced"] = SamplerCustomAdvanced
|
||||
nodes.NODE_CLASS_MAPPINGS["BasicScheduler"] = BasicScheduler
|
||||
nodes.NODE_CLASS_MAPPINGS["KSamplerSelect"] = KSamplerSelect
|
||||
nodes.NODE_CLASS_MAPPINGS["CFGGuider"] = CFGGuider
|
||||
nodes.NODE_CLASS_MAPPINGS["CLIPTextEncode"] = CLIPTextEncode
|
||||
nodes.NODE_CLASS_MAPPINGS["VAEDecode"] = VAEDecode
|
||||
nodes.NODE_CLASS_MAPPINGS["TSC_EfficientLoader"] = TSC_EfficientLoader # pyright: ignore[reportAttributeAccessIssue]
|
||||
nodes.NODE_CLASS_MAPPINGS["SamplerCustomAdvanced"] = SamplerCustomAdvanced # pyright: ignore[reportAttributeAccessIssue]
|
||||
nodes.NODE_CLASS_MAPPINGS["BasicScheduler"] = BasicScheduler # pyright: ignore[reportAttributeAccessIssue]
|
||||
nodes.NODE_CLASS_MAPPINGS["KSamplerSelect"] = KSamplerSelect # pyright: ignore[reportAttributeAccessIssue]
|
||||
nodes.NODE_CLASS_MAPPINGS["CFGGuider"] = CFGGuider # pyright: ignore[reportAttributeAccessIssue]
|
||||
nodes.NODE_CLASS_MAPPINGS["CLIPTextEncode"] = CLIPTextEncode # pyright: ignore[reportAttributeAccessIssue]
|
||||
nodes.NODE_CLASS_MAPPINGS["VAEDecode"] = VAEDecode # pyright: ignore[reportAttributeAccessIssue]
|
||||
|
||||
prompt_graph = {
|
||||
"loader": {"class_type": "TSC_EfficientLoader", "inputs": {}},
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import sys
|
||||
import types
|
||||
from types import SimpleNamespace
|
||||
from typing import Any, Dict
|
||||
|
||||
from py.metadata_collector import metadata_processor
|
||||
from py.metadata_collector.metadata_hook import MetadataHook
|
||||
@@ -44,6 +45,7 @@ def test_metadata_hook_installs_and_traces_execution(monkeypatch, metadata_regis
|
||||
|
||||
class FakeNode:
|
||||
FUNCTION = "run"
|
||||
unique_id: str = ""
|
||||
|
||||
node = FakeNode()
|
||||
node.unique_id = "node-1"
|
||||
@@ -702,7 +704,7 @@ def test_lora_manager_cache_updates_when_loras_removed(metadata_registry):
|
||||
class LoraLoaderLM: # type: ignore[too-many-ancestors]
|
||||
__name__ = "LoraLoaderLM"
|
||||
|
||||
nodes.NODE_CLASS_MAPPINGS["LoraLoaderLM"] = LoraLoaderLM
|
||||
nodes.NODE_CLASS_MAPPINGS["LoraLoaderLM"] = LoraLoaderLM # pyright: ignore[reportAttributeAccessIssue]
|
||||
|
||||
prompt_graph = {
|
||||
"lora_node": {"class_type": "LoraLoaderLM", "inputs": {}},
|
||||
@@ -883,7 +885,7 @@ def test_metadata_overwrite_extractor_empty_inputs(metadata_registry):
|
||||
|
||||
from py.metadata_collector.constants import CLIP_SKIP_SENTINEL
|
||||
|
||||
inputs = {key: "" for key in METADATA_OVERWRITE_FIELDS}
|
||||
inputs: Dict[str, Any] = {key: "" for key in METADATA_OVERWRITE_FIELDS}
|
||||
inputs.update({"seed": 0, "steps": 0, "cfg_scale": 0.0, "clip_skip": CLIP_SKIP_SENTINEL})
|
||||
|
||||
MetadataOverwriteExtractor.extract("ow-2", inputs, None, metadata)
|
||||
|
||||
Reference in New Issue
Block a user