-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add type annotations for files in /utils
- Loading branch information
Showing
6 changed files
with
46 additions
and
30 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
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,31 +1,32 @@ | ||
from functools import wraps | ||
from typing import Any, Callable, Dict, Tuple | ||
|
||
from faker.utils import text | ||
|
||
|
||
def slugify(fn): | ||
def slugify(fn: Callable) -> Callable: | ||
@wraps(fn) | ||
def wrapper(*args, **kwargs): | ||
def wrapper(*args: Tuple[Any, ...], **kwargs: Dict[str, Any]) -> str: | ||
return text.slugify(fn(*args, **kwargs)) | ||
return wrapper | ||
|
||
|
||
def slugify_domain(fn): | ||
def slugify_domain(fn: Callable) -> Callable: | ||
@wraps(fn) | ||
def wrapper(*args, **kwargs): | ||
def wrapper(*args: Tuple[Any, ...], **kwargs: Dict[str, Any]) -> str: | ||
return text.slugify(fn(*args, **kwargs), allow_dots=True) | ||
return wrapper | ||
|
||
|
||
def slugify_unicode(fn): | ||
def slugify_unicode(fn: Callable) -> Callable: | ||
@wraps(fn) | ||
def wrapper(*args, **kwargs): | ||
def wrapper(*args: Tuple[Any, ...], **kwargs: Dict[str, Any]) -> str: | ||
return text.slugify(fn(*args, **kwargs), allow_unicode=True) | ||
return wrapper | ||
|
||
|
||
def lowercase(fn): | ||
def lowercase(fn: Callable) -> Callable: | ||
@wraps(fn) | ||
def wrapper(*args, **kwargs): | ||
def wrapper(*args: Tuple[Any, ...], **kwargs: Dict[str, Any]) -> str: | ||
return fn(*args, **kwargs).lower() | ||
return wrapper |
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
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