-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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 (#1335)
* Add type annotations for files in /utils * Remove py35 and add py39 to appveyor config Python 3.5 was deprecated in #1332. * Add base image VS 2019 to appveyor to support Python 3.9
- Loading branch information
Showing
7 changed files
with
54 additions
and
37 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
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