diff --git a/src/basic_data_handling/casting_nodes.py b/src/basic_data_handling/casting_nodes.py index ce6924b..01e3a31 100644 --- a/src/basic_data_handling/casting_nodes.py +++ b/src/basic_data_handling/casting_nodes.py @@ -161,7 +161,7 @@ class CastDataListToList: def VALIDATE_INPUTS(cls, input_types: dict[str, str]) -> bool: return True - def convert(self, **kwargs: dict[str, list]) -> tuple[list[Any]]: + def convert(self, **kwargs: list[Any]) -> tuple[list[Any]]: return (kwargs.get('list', []).copy(),) @@ -218,7 +218,7 @@ class CastDataListToSet: def VALIDATE_INPUTS(cls, input_types: dict[str, str]) -> bool: return True - def convert(self, **kwargs: dict[str, list]) -> tuple[list[Any]]: + def convert(self, **kwargs: list[Any]) -> tuple[set[Any]]: return (set(kwargs.get('list', [])),) diff --git a/src/basic_data_handling/control_flow_nodes.py b/src/basic_data_handling/control_flow_nodes.py index 419b283..11cb064 100644 --- a/src/basic_data_handling/control_flow_nodes.py +++ b/src/basic_data_handling/control_flow_nodes.py @@ -1,4 +1,4 @@ -from typing import Any, Dict, List, Union +from typing import Any from inspect import cleandoc class IfElse: diff --git a/src/basic_data_handling/int_nodes.py b/src/basic_data_handling/int_nodes.py index 38a02ab..dabf783 100644 --- a/src/basic_data_handling/int_nodes.py +++ b/src/basic_data_handling/int_nodes.py @@ -201,7 +201,7 @@ class IntToBytes: DESCRIPTION = cleandoc(__doc__ or "") FUNCTION = "to_bytes" - def to_bytes(self, int_value: int, length: int, byteorder: Literal["big", "little"], signed: Literal["True", "False"]) -> tuple[int]: + def to_bytes(self, int_value: int, length: int, byteorder: Literal["big", "little"], signed: Literal["True", "False"]) -> tuple[bytes]: signed_bool = (signed == "True") return (int_value.to_bytes(length, byteorder=byteorder, signed=signed_bool),) diff --git a/src/basic_data_handling/regex_nodes.py b/src/basic_data_handling/regex_nodes.py index e762e53..944e782 100644 --- a/src/basic_data_handling/regex_nodes.py +++ b/src/basic_data_handling/regex_nodes.py @@ -1,4 +1,3 @@ -from typing import Any from inspect import cleandoc import re diff --git a/src/basic_data_handling/string_nodes.py b/src/basic_data_handling/string_nodes.py index fe1e729..6f46780 100644 --- a/src/basic_data_handling/string_nodes.py +++ b/src/basic_data_handling/string_nodes.py @@ -696,29 +696,6 @@ class StringLjust: return (string.ljust(width, fillchar),) -class StringLower: - """ - Converts the string to lowercase. - - This node returns a copy of the string with all uppercase characters converted to lowercase. - """ - @classmethod - def INPUT_TYPES(cls): - return { - "required": { - "string": ("STRING", {"default": "", "defaultInput": True}), - } - } - - RETURN_TYPES = ("STRING",) - CATEGORY = "Basic/STRING" - DESCRIPTION = cleandoc(__doc__ or "") - FUNCTION = "lower" - - def lower(self, string): - return (string.lower(),) - - class StringLstrip: """ Removes leading characters from the string. @@ -749,36 +726,6 @@ class StringLstrip: return (string.lstrip(chars),) -class StringReplace: - """ - Replaces occurrences of a substring with another substring. - - This node returns a copy of the string with all occurrences of substring - old replaced by new. If the optional argument count is given, only the - first count occurrences are replaced. - """ - @classmethod - def INPUT_TYPES(cls): - return { - "required": { - "string": ("STRING", {"default": "", "defaultInput": True}), - "old": ("STRING", {"default": ""}), - "new": ("STRING", {"default": ""}), - }, - "optional": { - "count": ("INT", {"default": -1, "min": -1}), - } - } - - RETURN_TYPES = ("STRING",) - CATEGORY = "Basic/STRING" - DESCRIPTION = cleandoc(__doc__ or "") - FUNCTION = "replace" - - def replace(self, string, old, new, count=-1): - return (string.replace(old, new, count),) - - class StringRemoveprefix: """ Removes prefix from the string if present. @@ -829,40 +776,6 @@ class StringRemovesuffix: return (string.removesuffix(suffix),) -class StringRfind: - """ - Finds the highest index of the substring in the string. - - This node searches for the last occurrence of the specified substring within the input string. - Returns the highest index where the substring is found. If the substring is not found, it returns -1. - Optional start and end parameters allow you to limit the search to a specific portion of the string. - """ - @classmethod - def INPUT_TYPES(cls): - return { - "required": { - "string": ("STRING", {"default": "", "defaultInput": True}), - "substring": ("STRING", {"default": ""}), - }, - "optional": { - "start": ("INT", {"default": 0, "min": 0}), - "end": ("INT", {"default": 0, "min": 0}), - } - } - - RETURN_TYPES = ("INT",) - CATEGORY = "Basic/STRING" - DESCRIPTION = cleandoc(__doc__ or "") - FUNCTION = "rfind" - - def rfind(self, string, substring, start=0, end=0): - # If end is 0 or negative, search to the end of the string - if end <= 0: - end = len(string) - - return (string.rfind(substring, start, end),) - - class StringRjust: """ Right-aligns the string within a field of a given width. @@ -1011,36 +924,6 @@ class StringLower: return (string.lower(),) -class StringLstrip: - """ - Removes leading characters from the string. - - This node returns a copy of the string with leading characters removed. - If chars is provided, it specifies the set of characters to be removed. - If chars is not provided, whitespace characters are removed. - """ - @classmethod - def INPUT_TYPES(cls): - return { - "required": { - "string": ("STRING", {"default": "", "defaultInput": True}), - }, - "optional": { - "chars": ("STRING", {"default": ""}), - } - } - - RETURN_TYPES = ("STRING",) - CATEGORY = "Basic/STRING" - DESCRIPTION = cleandoc(__doc__ or "") - FUNCTION = "lstrip" - - def lstrip(self, string, chars=None): - if chars == "": - chars = None - return (string.lstrip(chars),) - - class StringReplace: """ Replaces occurrences of a substring with another substring. @@ -1071,31 +954,6 @@ class StringReplace: return (string.replace(old, new, count),) -class StringRemoveprefix: - """ - Removes prefix from the string if present. - - This node returns a copy of the string with the specified prefix removed - if the string starts with that prefix, otherwise returns the original string. - """ - @classmethod - def INPUT_TYPES(cls): - return { - "required": { - "string": ("STRING", {"default": "", "defaultInput": True}), - "prefix": ("STRING", {"default": ""}), - } - } - - RETURN_TYPES = ("STRING",) - CATEGORY = "Basic/STRING" - DESCRIPTION = cleandoc(__doc__ or "") - FUNCTION = "removeprefix" - - def removeprefix(self, string, prefix): - return (string.removeprefix(prefix),) - - class StringRemovesuffix: """ Removes suffix from the string if present. @@ -1277,37 +1135,6 @@ class StringJoin: return (separator.join(strings),) -class StringLjust: - """ - Left-aligns the string within a field of a given width. - - This node returns a string left-aligned in a field of the specified width. - If fillchar is provided, it is used as the padding character instead of a space. - """ - @classmethod - def INPUT_TYPES(cls): - return { - "required": { - "string": ("STRING", {"default": "", "defaultInput": True}), - "width": ("INT", {"default": 10, "min": 0}), - }, - "optional": { - "fillchar": ("STRING", {"default": " "}), - } - } - - RETURN_TYPES = ("STRING",) - CATEGORY = "Basic/STRING" - DESCRIPTION = cleandoc(__doc__ or "") - FUNCTION = "ljust" - - def ljust(self, string, width, fillchar=" "): - # Ensure fillchar is only one character - if len(fillchar) > 0: - fillchar = fillchar[0] - return (string.ljust(width, fillchar),) - - class StringLower: """ Converts the string to lowercase. @@ -1331,36 +1158,6 @@ class StringLower: return (string.lower(),) -class StringLstrip: - """ - Removes leading characters from the string. - - This node returns a copy of the string with leading characters removed. - If chars is provided, it specifies the set of characters to be removed. - If chars is not provided, whitespace characters are removed. - """ - @classmethod - def INPUT_TYPES(cls): - return { - "required": { - "string": ("STRING", {"default": "", "defaultInput": True}), - }, - "optional": { - "chars": ("STRING", {"default": ""}), - } - } - - RETURN_TYPES = ("STRING",) - CATEGORY = "Basic/STRING" - DESCRIPTION = cleandoc(__doc__ or "") - FUNCTION = "lstrip" - - def lstrip(self, string, chars=None): - if chars == "": - chars = None - return (string.lstrip(chars),) - - class StringRemoveprefix: """ Removes prefix from the string if present. @@ -1386,31 +1183,6 @@ class StringRemoveprefix: return (string.removeprefix(prefix),) -class StringRemovesuffix: - """ - Removes suffix from the string if present. - - This node returns a copy of the string with the specified suffix removed - if the string ends with that suffix, otherwise returns the original string. - """ - @classmethod - def INPUT_TYPES(cls): - return { - "required": { - "string": ("STRING", {"default": "", "defaultInput": True}), - "suffix": ("STRING", {"default": ""}), - } - } - - RETURN_TYPES = ("STRING",) - CATEGORY = "Basic/STRING" - DESCRIPTION = cleandoc(__doc__ or "") - FUNCTION = "removesuffix" - - def removesuffix(self, string, suffix): - return (string.removesuffix(suffix),) - - class StringRfind: """ Finds the highest index of the substring in the string. diff --git a/tests/test_boolean_nodes.py b/tests/test_boolean_nodes.py index 14ac869..a20f8ea 100644 --- a/tests/test_boolean_nodes.py +++ b/tests/test_boolean_nodes.py @@ -1,4 +1,4 @@ -import pytest +#import pytest from src.basic_data_handling.boolean_nodes import ( BooleanAnd, diff --git a/tests/test_comparison_nodes.py b/tests/test_comparison_nodes.py index 310cb3e..9d44431 100644 --- a/tests/test_comparison_nodes.py +++ b/tests/test_comparison_nodes.py @@ -1,4 +1,4 @@ -import pytest +#import pytest from src.basic_data_handling.comparison_nodes import ( Equal, NotEqual, diff --git a/tests/test_control_flow_nodes.py b/tests/test_control_flow_nodes.py index 612790c..f3de291 100644 --- a/tests/test_control_flow_nodes.py +++ b/tests/test_control_flow_nodes.py @@ -1,4 +1,4 @@ -import pytest +#import pytest from src.basic_data_handling.control_flow_nodes import IfElse, SwitchCase diff --git a/tests/test_string_nodes.py b/tests/test_string_nodes.py index 4a096d4..46ff19a 100644 --- a/tests/test_string_nodes.py +++ b/tests/test_string_nodes.py @@ -1,4 +1,4 @@ -import pytest +#import pytest from src.basic_data_handling.string_nodes import ( StringCapitalize,