diff --git a/src/cpl_core/pipes/__init__.py b/src/cpl_core/pipes/__init__.py index 5a25afb1..cc4799a0 100644 --- a/src/cpl_core/pipes/__init__.py +++ b/src/cpl_core/pipes/__init__.py @@ -19,15 +19,10 @@ __version__ = "2023.4.0" from collections import namedtuple - # imports: from .bool_pipe import BoolPipe -from .first_char_to_lower_pipe import FirstCharToLowerPipe -from .first_to_upper_pipe import FirstToUpperPipe from .ip_address_pipe import IPAddressPipe from .pipe_abc import PipeABC -from .to_camel_case_pipe import ToCamelCasePipe -from .to_snake_case_pipe import ToSnakeCasePipe VersionInfo = namedtuple("VersionInfo", "major minor micro") version_info = VersionInfo(major="2023", minor="4", micro="0") diff --git a/src/cpl_core/pipes/first_char_to_lower_pipe.py b/src/cpl_core/pipes/first_char_to_lower_pipe.py deleted file mode 100644 index b9e7630e..00000000 --- a/src/cpl_core/pipes/first_char_to_lower_pipe.py +++ /dev/null @@ -1,18 +0,0 @@ -from cpl_core.pipes.pipe_abc import PipeABC - - -class FirstCharToLowerPipe(PipeABC): - def __init__(self): - pass - - def transform(self, value: any, *args): - r"""Converts first char to lower - - Parameter: - value: :class:`str` - String to convert - - Returns: - String with first char as lower - """ - return f"{value[0].lower()}{value[1:]}" diff --git a/src/cpl_core/pipes/first_to_upper_pipe.py b/src/cpl_core/pipes/first_to_upper_pipe.py deleted file mode 100644 index fbc7cb29..00000000 --- a/src/cpl_core/pipes/first_to_upper_pipe.py +++ /dev/null @@ -1,18 +0,0 @@ -from cpl_core.pipes.pipe_abc import PipeABC - - -class FirstToUpperPipe(PipeABC): - def __init__(self): - pass - - def transform(self, value: str, *args): - r"""Converts first char to upper - - Parameter: - chars: :class:`str` - String to convert - - Returns: - String with first char as upper - """ - return f"{value[0].upper()}{value[1:]}" diff --git a/src/cpl_core/pipes/to_camel_case_pipe.py b/src/cpl_core/pipes/to_camel_case_pipe.py deleted file mode 100644 index 6418b97b..00000000 --- a/src/cpl_core/pipes/to_camel_case_pipe.py +++ /dev/null @@ -1,26 +0,0 @@ -import string - -from cpl_core.pipes import PipeABC - - -class ToCamelCasePipe(PipeABC): - def __init__(self): - pass - - def transform(self, value: str, *args) -> str: - r"""Converts string to camel case - - Parameter: - chars: :class:`str` - String to convert - - Returns: - String converted to CamelCase - """ - converted_name = value - char_set = string.punctuation + " " - for char in char_set: - if char in converted_name: - converted_name = "".join(word.title() for word in converted_name.split(char)) - - return converted_name diff --git a/src/cpl_core/pipes/to_snake_case_pipe.py b/src/cpl_core/pipes/to_snake_case_pipe.py deleted file mode 100644 index e4528ab0..00000000 --- a/src/cpl_core/pipes/to_snake_case_pipe.py +++ /dev/null @@ -1,27 +0,0 @@ -import re - -from cpl_core.pipes import PipeABC - - -class ToSnakeCasePipe(PipeABC): - def __init__(self): - pass - - def transform(self, value: str, *args) -> str: - r"""Converts string to snake case - - Parameter: - chars: :class:`str` - String to convert - - Returns: - String converted to snake_case - """ - # convert to train-case to CamelCase - if "-" in value: - value = "".join(word.title() for word in value.split("-")) - - pattern1 = re.compile(r"(.)([A-Z][a-z]+)") - pattern2 = re.compile(r"([a-z0-9])([A-Z])") - file_name = re.sub(pattern1, r"\1_\2", value) - return re.sub(pattern2, r"\1_\2", file_name).lower()