diff --git a/bd_api/apps/api/v1/models.py b/bd_api/apps/api/v1/models.py index 4f867b9d..733e04e4 100644 --- a/bd_api/apps/api/v1/models.py +++ b/bd_api/apps/api/v1/models.py @@ -11,9 +11,9 @@ from ordered_model.models import OrderedModel from bd_api.apps.account.models import Account -from bd_api.apps.api.v1.utils import check_kebab_case, check_snake_case from bd_api.custom.model import BaseModel from bd_api.custom.storage import OverwriteStorage, upload_to, validate_image +from bd_api.custom.utils import check_kebab_case, check_snake_case def to_str(value: str | None, zfill: int = 0): diff --git a/bd_api/apps/api/v1/utils.py b/bd_api/custom/utils.py similarity index 71% rename from bd_api/apps/api/v1/utils.py rename to bd_api/custom/utils.py index 5b1d5c2f..7e9e6096 100644 --- a/bd_api/apps/api/v1/utils.py +++ b/bd_api/custom/utils.py @@ -1,22 +1,12 @@ # -*- coding: utf-8 -*- -""" -General-purpose functions for the API. -""" - import string def check_snake_case(name: str) -> bool: - """ - Check if a string is in snake_case. - """ allowed_chars = set(string.ascii_lowercase + string.digits + "_") return set(name).issubset(allowed_chars) and name[0] != "_" def check_kebab_case(name: str) -> bool: - """ - Check if a string is in kebab-case. - """ allowed_chars = set(string.ascii_lowercase + string.digits + "-") return set(name).issubset(allowed_chars) and name[0] != "-"