vulyk package¶
Subpackages¶
Submodules¶
vulyk.app module¶
Die Hauptstadt of our little project. Just a usual Flask application.
vulyk.settings module¶
vulyk.signals module¶
vulyk.utils module¶
Every project must have a package called utils.
-
vulyk.utils.
chunked
(iterable: Iterator, n: int) → Generator[Tuple, None, None][source]¶ Returns chunks of n length of iterable
If len(iterable) % n != 0, then the last chunk will have length less than n.
Example:
>>> chunked([1, 2, 3, 4, 5], 2) [(1, 2), (3, 4), (5,)]
- Parameters
iterable (Iterator) – Source we need to chop up.
n (int) – Slice length
- Returns
Sequence of tuples of given size.
- Return type
Generator[Tuple, None, None]
-
vulyk.utils.
get_tb
() → Dict[source]¶ Returns traceback of the latest exception caught in ‘except’ block
- Returns
traceback of the most recent exception
-
vulyk.utils.
get_template_path
(app: flask.app.Flask, name: str) → str[source]¶ Finds the path to the template.
- Parameters
app (flask.Flask) – Flask application instance.
name (str) – Name of the template.
- Returns
Full path to the template.
- Return type
str
-
vulyk.utils.
json_response
(result: Dict, errors: Optional[Iterator] = None, status: int = <HTTPStatus.OK: 200>) → flask.wrappers.Response[source]¶ Handy helper to prepare unified responses.
- Parameters
result (Dict) – Data to be sent
errors (Optional[Iterator]) – List (set, tuple, dict) of errors
status (int) – Response http-status
- Returns
Jsonified response
- Return type
flask.Response
-
vulyk.utils.
resolve_task_type
(type_id: str, tasks: Dict, user: vulyk.models.user.User)[source]¶ Looks for type_id in TASK_TYPES map.
- Parameters
type_id (str) – ID of the TaskType in the map.
tasks (Dict[str, vulyk.models.task_types.AbstractTaskType]) – map of task type id -> task type instance
user (User) – Current user.
- Returns
Correct TaskType instance or throws an exception.
- Return type