Release v3.1.0

This commit is contained in:
hyugogirubato
2023-06-04 15:57:30 +02:00
parent ffca3239cf
commit 1f1433a3c4
26 changed files with 533 additions and 586 deletions
+6 -9
View File
@@ -4,13 +4,10 @@ from typing import Union
import unicodedata
def get_key_value(_value) -> str:
if isinstance(_value, str):
if _value in ['YesAndRightToLeft', 'Yes', 'No']:
return _value
elif isinstance(_value, bool):
return 'Yes' if _value else 'No'
return _value
def get_key_value(value: Union[str, bool]) -> str:
if isinstance(value, bool):
return "Yes" if value else "No"
return value
def delete_none(_dict: dict) -> dict:
@@ -39,9 +36,9 @@ def slugify(value: Union[str, int], allow_unicode: bool = False) -> str:
"""
value = str(value)
if allow_unicode:
value = unicodedata.normalize('NFKC', value)
value = unicodedata.normalize("NFKC", value)
else:
value = unicodedata.normalize('NFKD', value).encode('ascii', 'ignore').decode('ascii')
value = unicodedata.normalize("NFKD", value).encode("ascii", "ignore").decode("ascii")
# value = re.sub(r'[^\w\s-]', '', value.lower())
# return re.sub(r'[-\s]+', '-', value).strip('-_')
return value