Skip to content
This repository was archived by the owner on Nov 19, 2024. It is now read-only.

Commit b7604d4

Browse files
committed
doc: Added missing type info in docstrings
1 parent bfd2b56 commit b7604d4

13 files changed

+38
-1
lines changed

flask_utils/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Increment versions here according to SemVer
2-
__version__ = "0.7.0"
2+
__version__ = "0.7.1"
33

44
from flask_utils.utils import is_it_true
55
from flask_utils.errors import GoneError

flask_utils/decorators.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ def _is_optional(type_hint: Type) -> bool: # type: ignore
4141
"""Check if the type hint is :data:`~typing.Optional`.
4242
4343
:param type_hint: Type hint to check.
44+
:type type_hint: Type
45+
4446
:return: True if the type hint is :data:`~typing.Optional`, False otherwise.
47+
:rtype: bool
4548
4649
:Example:
4750
@@ -62,7 +65,10 @@ def _make_optional(type_hint: Type) -> Type: # type: ignore
6265
"""Wrap type hint with :data:`~typing.Optional` if it's not already.
6366
6467
:param type_hint: Type hint to wrap.
68+
:type type_hint: Type
69+
6570
:return: Type hint wrapped with :data:`~typing.Optional`.
71+
:rtype: Type
6672
6773
:Example:
6874
@@ -85,10 +91,14 @@ def _is_allow_empty(value: Any, type_hint: Type, allow_empty: bool) -> bool: #
8591
"""Determine if the value is considered empty and whether it's allowed.
8692
8793
:param value: Value to check.
94+
:type value: Any
8895
:param type_hint: Type hint to check against.
96+
:type type_hint: Type
8997
:param allow_empty: Whether to allow empty values.
98+
:type allow_empty: bool
9099
91100
:return: True if the value is empty and allowed, False otherwise.
101+
:rtype: bool
92102
93103
:Example:
94104
@@ -118,11 +128,16 @@ def _check_type(value: Any, expected_type: Type, allow_empty: bool = False, curr
118128
"""Check if the value matches the expected type, recursively if necessary.
119129
120130
:param value: Value to check.
131+
:type value: Any
121132
:param expected_type: Expected type.
133+
:type expected_type: Type
122134
:param allow_empty: Whether to allow empty values.
135+
:type allow_empty: bool
123136
:param curr_depth: Current depth of the recursive check.
137+
:type curr_depth: int
124138
125139
:return: True if the value matches the expected type, False otherwise.
140+
:rtype: bool
126141
127142
:Example:
128143

flask_utils/errors/badrequest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ class BadRequestError(_BaseFlaskException):
99
When raised, it will return a 400 status code with the message and solution provided.
1010
1111
:param msg: The message to be displayed in the error.
12+
:type msg: str
1213
:param solution: The solution to the error.
14+
:type solution: str
1315
1416
:Example:
1517

flask_utils/errors/conflict.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ class ConflictError(_BaseFlaskException):
99
When raised, it will return a 409 status code with the message and solution provided.
1010
1111
:param msg: The message to be displayed in the error.
12+
:type msg: str
1213
:param solution: The solution to the error.
14+
:type solution: str
1315
1416
:Example:
1517

flask_utils/errors/failed_dependency.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ class FailedDependencyError(_BaseFlaskException):
99
When raised, it will return a 424 status code with the message and solution provided.
1010
1111
:param msg: The message to be displayed in the error.
12+
:type msg: str
1213
:param solution: The solution to the error.
14+
:type solution: str
1315
1416
:Example:
1517

flask_utils/errors/forbidden.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ class ForbiddenError(_BaseFlaskException):
99
When raised, it will return a 403 status code with the message and solution provided.
1010
1111
:param msg: The message to be displayed in the error.
12+
:type msg: str
1213
:param solution: The solution to the error.
14+
:type solution: str
1315
1416
:Example:
1517

flask_utils/errors/gone.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ class GoneError(_BaseFlaskException):
99
When raised, it will return a 410 status code with the message and solution provided.
1010
1111
:param msg: The message to be displayed in the error.
12+
:type msg: str
1213
:param solution: The solution to the error.
14+
:type solution: str
1315
1416
:Example:
1517

flask_utils/errors/notfound.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ class NotFoundError(_BaseFlaskException):
99
When raised, it will return 404 status code with the message and solution provided.
1010
1111
:param msg: The message to be displayed in the error.
12+
:type msg: str
1213
:param solution: The solution to the error.
14+
:type solution: str
1315
1416
:Example:
1517

flask_utils/errors/origin_is_unreachable.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ class OriginIsUnreachableError(_BaseFlaskException):
99
When raised, it will return a 523 status code with the message and solution provided.
1010
1111
:param msg: The message to be displayed in the error.
12+
:type msg: str
1213
:param solution: The solution to the error.
14+
:type solution: str
1315
1416
:Example:
1517

flask_utils/errors/service_unavailable.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ class ServiceUnavailableError(_BaseFlaskException):
99
When raised, it will return a 503 status code with the message and solution provided.
1010
1111
:param msg: The message to be displayed in the error.
12+
:type msg: str
1213
:param solution: The solution to the error.
14+
:type solution: str
1315
1416
:Example:
1517

0 commit comments

Comments
 (0)