Version 0.4.6 - fix pop random to make them always recalculate

This commit is contained in:
StableLlama
2025-07-16 20:03:15 +02:00
parent 753163cfb1
commit bdae6308b1
5 changed files with 17 additions and 1 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "basic_data_handling"
version = "0.4.5"
version = "0.4.6"
description = """Basic Python functions for manipulating data that every programmer is used to, lightweight with no additional dependencies.
Supported data types:
@@ -747,6 +747,10 @@ class DataListPopRandom(ComfyNodeABC):
INPUT_IS_LIST = True
OUTPUT_IS_LIST = (True, False)
@classmethod
def IS_CHANGED(cls, **kwargs):
return float("NaN") # Not equal to anything -> trigger recalculation
def pop_random_element(self, **kwargs: list[Any]) -> tuple[list[Any], Any]:
from random import randrange
input_list = kwargs.get('list', []).copy()
+4
View File
@@ -736,6 +736,10 @@ class DictPopRandom(ComfyNodeABC):
DESCRIPTION = cleandoc(__doc__ or "")
FUNCTION = "pop_random"
@classmethod
def IS_CHANGED(cls, **kwargs):
return float("NaN") # Not equal to anything -> trigger recalculation
def pop_random(self, input_dict: dict) -> tuple[dict, str, Any, bool]:
import random
result = input_dict.copy()
+4
View File
@@ -610,6 +610,10 @@ class ListPopRandom(ComfyNodeABC):
DESCRIPTION = cleandoc(__doc__ or "")
FUNCTION = "pop_random_element"
@classmethod
def IS_CHANGED(cls, **kwargs):
return float("NaN") # Not equal to anything -> trigger recalculation
def pop_random_element(self, list: list[Any]) -> tuple[list[Any], Any]:
import random
result = list.copy()
+4
View File
@@ -520,6 +520,10 @@ class SetPopRandom(ComfyNodeABC):
DESCRIPTION = cleandoc(__doc__ or "")
FUNCTION = "pop_random_element"
@classmethod
def IS_CHANGED(cls, **kwargs):
return float("NaN") # Not equal to anything -> trigger recalculation
def pop_random_element(self, set: set[Any]) -> tuple[set[Any], Any]:
import random
result = set.copy()