Version 0.4.6 - fix pop random to make them always recalculate
This commit is contained in:
+1
-1
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user