Skip to content

Commit c0097b9

Browse files
authored
Merge pull request #23 from StableLlama/fix_random
Version 0.4.6 - fix pop random to make them always recalculate
2 parents 753163c + bdae630 commit c0097b9

File tree

5 files changed

+17
-1
lines changed

5 files changed

+17
-1
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "basic_data_handling"
7-
version = "0.4.5"
7+
version = "0.4.6"
88
description = """Basic Python functions for manipulating data that every programmer is used to, lightweight with no additional dependencies.
99
1010
Supported data types:

src/basic_data_handling/data_list_nodes.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,10 @@ def INPUT_TYPES(cls):
747747
INPUT_IS_LIST = True
748748
OUTPUT_IS_LIST = (True, False)
749749

750+
@classmethod
751+
def IS_CHANGED(cls, **kwargs):
752+
return float("NaN") # Not equal to anything -> trigger recalculation
753+
750754
def pop_random_element(self, **kwargs: list[Any]) -> tuple[list[Any], Any]:
751755
from random import randrange
752756
input_list = kwargs.get('list', []).copy()

src/basic_data_handling/dict_nodes.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,10 @@ def INPUT_TYPES(cls):
736736
DESCRIPTION = cleandoc(__doc__ or "")
737737
FUNCTION = "pop_random"
738738

739+
@classmethod
740+
def IS_CHANGED(cls, **kwargs):
741+
return float("NaN") # Not equal to anything -> trigger recalculation
742+
739743
def pop_random(self, input_dict: dict) -> tuple[dict, str, Any, bool]:
740744
import random
741745
result = input_dict.copy()

src/basic_data_handling/list_nodes.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,10 @@ def INPUT_TYPES(cls):
610610
DESCRIPTION = cleandoc(__doc__ or "")
611611
FUNCTION = "pop_random_element"
612612

613+
@classmethod
614+
def IS_CHANGED(cls, **kwargs):
615+
return float("NaN") # Not equal to anything -> trigger recalculation
616+
613617
def pop_random_element(self, list: list[Any]) -> tuple[list[Any], Any]:
614618
import random
615619
result = list.copy()

src/basic_data_handling/set_nodes.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,10 @@ def INPUT_TYPES(cls):
520520
DESCRIPTION = cleandoc(__doc__ or "")
521521
FUNCTION = "pop_random_element"
522522

523+
@classmethod
524+
def IS_CHANGED(cls, **kwargs):
525+
return float("NaN") # Not equal to anything -> trigger recalculation
526+
523527
def pop_random_element(self, set: set[Any]) -> tuple[set[Any], Any]:
524528
import random
525529
result = set.copy()

0 commit comments

Comments
 (0)