|
OpenQuizz
Une application de gestion des contenus pédagogiques
|
Functions | |
| def | merge (first, second) |
| def | camel_to_dash (value) |
| def | default_id (resource, method) |
| def | not_none (data) |
| def | not_none_sorted (data) |
| def | unpack (response, default_code=HTTPStatus.OK) |
Variables | |
| FIRST_CAP_RE = re.compile("(.)([A-Z][a-z]+)") | |
| ALL_CAP_RE = re.compile("([a-z0-9])([A-Z])") | |
| def flask_restx.utils.camel_to_dash | ( | value | ) |
Transform a CamelCase string into a low_dashed one :param str value: a CamelCase string to transform :return: the low_dashed string :rtype: str
| def flask_restx.utils.default_id | ( | resource, | |
| method | |||
| ) |
Default operation ID generator
| def flask_restx.utils.merge | ( | first, | |
| second | |||
| ) |
Recursively merges two dictionaries. Second dictionary values will take precedence over those from the first one. Nested dictionaries are merged too. :param dict first: The first dictionary :param dict second: The second dictionary :return: the resulting merged dictionary :rtype: dict
| def flask_restx.utils.not_none | ( | data | ) |
Remove all keys where value is None :param dict data: A dictionary with potentially some values set to None :return: The same dictionary without the keys with values to ``None`` :rtype: dict
| def flask_restx.utils.not_none_sorted | ( | data | ) |
Remove all keys where value is None :param OrderedDict data: A dictionary with potentially some values set to None :return: The same dictionary without the keys with values to ``None`` :rtype: OrderedDict
| def flask_restx.utils.unpack | ( | response, | |
default_code = HTTPStatus.OK |
|||
| ) |
Unpack a Flask standard response.
Flask response can be:
- a single value
- a 2-tuple ``(value, code)``
- a 3-tuple ``(value, code, headers)``
.. warning::
When using this function, you must ensure that the tuple is not the response data.
To do so, prefer returning list instead of tuple for listings.
:param response: A Flask style response
:param int default_code: The HTTP code to use as default if none is provided
:return: a 3-tuple ``(data, code, headers)``
:rtype: tuple
:raise ValueError: if the response does not have one of the expected format
| ALL_CAP_RE = re.compile("([a-z0-9])([A-Z])") |
| FIRST_CAP_RE = re.compile("(.)([A-Z][a-z]+)") |