-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: turn api v1 utils into custom utils
- Loading branch information
Showing
2 changed files
with
1 addition
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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] != "-" |