2023.4 #168

Merged
edraft merged 56 commits from 2023.4 into master 2023-04-12 13:57:51 +02:00
5 changed files with 0 additions and 94 deletions
Showing only changes of commit 04f610c799 - Show all commits

View File

@ -19,15 +19,10 @@ __version__ = "2023.4.0"
from collections import namedtuple from collections import namedtuple
# imports: # imports:
from .bool_pipe import BoolPipe 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 .ip_address_pipe import IPAddressPipe
from .pipe_abc import PipeABC 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") VersionInfo = namedtuple("VersionInfo", "major minor micro")
version_info = VersionInfo(major="2023", minor="4", micro="0") version_info = VersionInfo(major="2023", minor="4", micro="0")

View File

@ -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:]}"

View File

@ -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:]}"

View File

@ -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

View File

@ -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()