-
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.
Initiate type hinting for improved code clarity and consistency
- Loading branch information
1 parent
11afdba
commit ba9207c
Showing
11 changed files
with
84 additions
and
44 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
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,12 +1,14 @@ | ||
from typing import Literal | ||
|
||
import inflect | ||
|
||
|
||
def singularize(word): | ||
def singularize(word: str) -> str | Literal[False]: | ||
p = inflect.engine() | ||
return p.singular_noun(word) or word | ||
|
||
|
||
def pluralize_word(word): | ||
def pluralize_word(word: str) -> str: | ||
p = inflect.engine() | ||
|
||
return p.plural(word) or word |
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,5 +1,5 @@ | ||
import secrets | ||
|
||
|
||
def get_random_secret_key(length=50): | ||
def get_random_secret_key(length: int = 50) -> str: | ||
return secrets.token_urlsafe(length)[:length] |
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,11 +1,14 @@ | ||
from typing import Dict, Any | ||
|
||
|
||
class WebSocketControllerRegistry: | ||
_controllers = {} | ||
|
||
@classmethod | ||
def register_controller(cls, path, controller_cls): | ||
def register_controller(cls, path: str, controller_cls: Dict[str, Any]): | ||
cls._controllers[path] = controller_cls | ||
return controller_cls | ||
|
||
@classmethod | ||
def get_controller(cls, path): | ||
def get_controller(cls, path: str): | ||
return cls._controllers.get(path) |