repo stringlengths 7 54 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 20 28.4k | docstring stringlengths 1 46.3k | docstring_tokens listlengths 1 1.66k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value | summary stringlengths 4 350 | obf_code stringlengths 7.85k 764k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
pallets/werkzeug | src/werkzeug/wsgi.py | get_query_string | def get_query_string(environ):
"""Returns the `QUERY_STRING` from the WSGI environment. This also takes
care about the WSGI decoding dance on Python 3 environments as a
native string. The string returned will be restricted to ASCII
characters.
.. versionadded:: 0.9
:param environ: the WSGI e... | python | def get_query_string(environ):
"""Returns the `QUERY_STRING` from the WSGI environment. This also takes
care about the WSGI decoding dance on Python 3 environments as a
native string. The string returned will be restricted to ASCII
characters.
.. versionadded:: 0.9
:param environ: the WSGI e... | [
"def",
"get_query_string",
"(",
"environ",
")",
":",
"qs",
"=",
"wsgi_get_bytes",
"(",
"environ",
".",
"get",
"(",
"\"QUERY_STRING\"",
",",
"\"\"",
")",
")",
"# QUERY_STRING really should be ascii safe but some browsers",
"# will send us some unicode stuff (I am looking at yo... | Returns the `QUERY_STRING` from the WSGI environment. This also takes
care about the WSGI decoding dance on Python 3 environments as a
native string. The string returned will be restricted to ASCII
characters.
.. versionadded:: 0.9
:param environ: the WSGI environment object to get the query str... | [
"Returns",
"the",
"QUERY_STRING",
"from",
"the",
"WSGI",
"environment",
".",
"This",
"also",
"takes",
"care",
"about",
"the",
"WSGI",
"decoding",
"dance",
"on",
"Python",
"3",
"environments",
"as",
"a",
"native",
"string",
".",
"The",
"string",
"returned",
"... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/wsgi.py#L238-L252 | train | Returns the QUERY_STRING from the WSGI environment object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/wsgi.py | extract_path_info | def extract_path_info(
environ_or_baseurl,
path_or_url,
charset="utf-8",
errors="werkzeug.url_quote",
collapse_http_schemes=True,
):
"""Extracts the path info from the given URL (or WSGI environment) and
path. The path info returned is a unicode string, not a bytestring
suitable for a W... | python | def extract_path_info(
environ_or_baseurl,
path_or_url,
charset="utf-8",
errors="werkzeug.url_quote",
collapse_http_schemes=True,
):
"""Extracts the path info from the given URL (or WSGI environment) and
path. The path info returned is a unicode string, not a bytestring
suitable for a W... | [
"def",
"extract_path_info",
"(",
"environ_or_baseurl",
",",
"path_or_url",
",",
"charset",
"=",
"\"utf-8\"",
",",
"errors",
"=",
"\"werkzeug.url_quote\"",
",",
"collapse_http_schemes",
"=",
"True",
",",
")",
":",
"def",
"_normalize_netloc",
"(",
"scheme",
",",
"ne... | Extracts the path info from the given URL (or WSGI environment) and
path. The path info returned is a unicode string, not a bytestring
suitable for a WSGI environment. The URLs might also be IRIs.
If the path info could not be determined, `None` is returned.
Some examples:
>>> extract_path_info... | [
"Extracts",
"the",
"path",
"info",
"from",
"the",
"given",
"URL",
"(",
"or",
"WSGI",
"environment",
")",
"and",
"path",
".",
"The",
"path",
"info",
"returned",
"is",
"a",
"unicode",
"string",
"not",
"a",
"bytestring",
"suitable",
"for",
"a",
"WSGI",
"env... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/wsgi.py#L369-L462 | train | Extracts the path info from the given URL or WSGI environment dict and the given path. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/wsgi.py | make_line_iter | def make_line_iter(stream, limit=None, buffer_size=10 * 1024, cap_at_buffer=False):
"""Safely iterates line-based over an input stream. If the input stream
is not a :class:`LimitedStream` the `limit` parameter is mandatory.
This uses the stream's :meth:`~file.read` method internally as opposite
to the... | python | def make_line_iter(stream, limit=None, buffer_size=10 * 1024, cap_at_buffer=False):
"""Safely iterates line-based over an input stream. If the input stream
is not a :class:`LimitedStream` the `limit` parameter is mandatory.
This uses the stream's :meth:`~file.read` method internally as opposite
to the... | [
"def",
"make_line_iter",
"(",
"stream",
",",
"limit",
"=",
"None",
",",
"buffer_size",
"=",
"10",
"*",
"1024",
",",
"cap_at_buffer",
"=",
"False",
")",
":",
"_iter",
"=",
"_make_chunk_iter",
"(",
"stream",
",",
"limit",
",",
"buffer_size",
")",
"first_item... | Safely iterates line-based over an input stream. If the input stream
is not a :class:`LimitedStream` the `limit` parameter is mandatory.
This uses the stream's :meth:`~file.read` method internally as opposite
to the :meth:`~file.readline` method that is unsafe and can only be used
in violation of the ... | [
"Safely",
"iterates",
"line",
"-",
"based",
"over",
"an",
"input",
"stream",
".",
"If",
"the",
"input",
"stream",
"is",
"not",
"a",
":",
"class",
":",
"LimitedStream",
"the",
"limit",
"parameter",
"is",
"mandatory",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/wsgi.py#L687-L769 | train | Safely iterates over a file - like object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/wsgi.py | make_chunk_iter | def make_chunk_iter(
stream, separator, limit=None, buffer_size=10 * 1024, cap_at_buffer=False
):
"""Works like :func:`make_line_iter` but accepts a separator
which divides chunks. If you want newline based processing
you should use :func:`make_line_iter` instead as it
supports arbitrary newline ma... | python | def make_chunk_iter(
stream, separator, limit=None, buffer_size=10 * 1024, cap_at_buffer=False
):
"""Works like :func:`make_line_iter` but accepts a separator
which divides chunks. If you want newline based processing
you should use :func:`make_line_iter` instead as it
supports arbitrary newline ma... | [
"def",
"make_chunk_iter",
"(",
"stream",
",",
"separator",
",",
"limit",
"=",
"None",
",",
"buffer_size",
"=",
"10",
"*",
"1024",
",",
"cap_at_buffer",
"=",
"False",
")",
":",
"_iter",
"=",
"_make_chunk_iter",
"(",
"stream",
",",
"limit",
",",
"buffer_size... | Works like :func:`make_line_iter` but accepts a separator
which divides chunks. If you want newline based processing
you should use :func:`make_line_iter` instead as it
supports arbitrary newline markers.
.. versionadded:: 0.8
.. versionadded:: 0.9
added support for iterators as input stre... | [
"Works",
"like",
":",
"func",
":",
"make_line_iter",
"but",
"accepts",
"a",
"separator",
"which",
"divides",
"chunks",
".",
"If",
"you",
"want",
"newline",
"based",
"processing",
"you",
"should",
"use",
":",
"func",
":",
"make_line_iter",
"instead",
"as",
"i... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/wsgi.py#L772-L842 | train | Takes a stream and returns an iterator over the items in the alphabetical order. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/filesystem.py | _is_ascii_encoding | def _is_ascii_encoding(encoding):
"""Given an encoding this figures out if the encoding is actually ASCII (which
is something we don't actually want in most cases). This is necessary
because ASCII comes under many names such as ANSI_X3.4-1968.
"""
if encoding is None:
return False
try:
... | python | def _is_ascii_encoding(encoding):
"""Given an encoding this figures out if the encoding is actually ASCII (which
is something we don't actually want in most cases). This is necessary
because ASCII comes under many names such as ANSI_X3.4-1968.
"""
if encoding is None:
return False
try:
... | [
"def",
"_is_ascii_encoding",
"(",
"encoding",
")",
":",
"if",
"encoding",
"is",
"None",
":",
"return",
"False",
"try",
":",
"return",
"codecs",
".",
"lookup",
"(",
"encoding",
")",
".",
"name",
"==",
"\"ascii\"",
"except",
"LookupError",
":",
"return",
"Fa... | Given an encoding this figures out if the encoding is actually ASCII (which
is something we don't actually want in most cases). This is necessary
because ASCII comes under many names such as ANSI_X3.4-1968. | [
"Given",
"an",
"encoding",
"this",
"figures",
"out",
"if",
"the",
"encoding",
"is",
"actually",
"ASCII",
"(",
"which",
"is",
"something",
"we",
"don",
"t",
"actually",
"want",
"in",
"most",
"cases",
")",
".",
"This",
"is",
"necessary",
"because",
"ASCII",
... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/filesystem.py#L21-L31 | train | Determines if an encoding is ASCII. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/filesystem.py | get_filesystem_encoding | def get_filesystem_encoding():
"""Returns the filesystem encoding that should be used. Note that this is
different from the Python understanding of the filesystem encoding which
might be deeply flawed. Do not use this value against Python's unicode APIs
because it might be different. See :ref:`filesyste... | python | def get_filesystem_encoding():
"""Returns the filesystem encoding that should be used. Note that this is
different from the Python understanding of the filesystem encoding which
might be deeply flawed. Do not use this value against Python's unicode APIs
because it might be different. See :ref:`filesyste... | [
"def",
"get_filesystem_encoding",
"(",
")",
":",
"global",
"_warned_about_filesystem_encoding",
"rv",
"=",
"sys",
".",
"getfilesystemencoding",
"(",
")",
"if",
"has_likely_buggy_unicode_filesystem",
"and",
"not",
"rv",
"or",
"_is_ascii_encoding",
"(",
"rv",
")",
":",
... | Returns the filesystem encoding that should be used. Note that this is
different from the Python understanding of the filesystem encoding which
might be deeply flawed. Do not use this value against Python's unicode APIs
because it might be different. See :ref:`filesystem-encoding` for the exact
behavior... | [
"Returns",
"the",
"filesystem",
"encoding",
"that",
"should",
"be",
"used",
".",
"Note",
"that",
"this",
"is",
"different",
"from",
"the",
"Python",
"understanding",
"of",
"the",
"filesystem",
"encoding",
"which",
"might",
"be",
"deeply",
"flawed",
".",
"Do",
... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/filesystem.py#L42-L64 | train | Returns the filesystem encoding that should be used for the current system. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/_reloader.py | _iter_module_files | def _iter_module_files():
"""This iterates over all relevant Python files. It goes through all
loaded files from modules, all files in folders of already loaded modules
as well as all files reachable through a package.
"""
# The list call is necessary on Python 3 in case the module
# dictionary... | python | def _iter_module_files():
"""This iterates over all relevant Python files. It goes through all
loaded files from modules, all files in folders of already loaded modules
as well as all files reachable through a package.
"""
# The list call is necessary on Python 3 in case the module
# dictionary... | [
"def",
"_iter_module_files",
"(",
")",
":",
"# The list call is necessary on Python 3 in case the module",
"# dictionary modifies during iteration.",
"for",
"module",
"in",
"list",
"(",
"sys",
".",
"modules",
".",
"values",
"(",
")",
")",
":",
"if",
"module",
"is",
"N... | This iterates over all relevant Python files. It goes through all
loaded files from modules, all files in folders of already loaded modules
as well as all files reachable through a package. | [
"This",
"iterates",
"over",
"all",
"relevant",
"Python",
"files",
".",
"It",
"goes",
"through",
"all",
"loaded",
"files",
"from",
"modules",
"all",
"files",
"in",
"folders",
"of",
"already",
"loaded",
"modules",
"as",
"well",
"as",
"all",
"files",
"reachable... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/_reloader.py#L14-L40 | train | This function iterates over all relevant Python files in the modules and returns a generator of all relevant files. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/_reloader.py | _find_observable_paths | def _find_observable_paths(extra_files=None):
"""Finds all paths that should be observed."""
rv = set(
os.path.dirname(os.path.abspath(x)) if os.path.isfile(x) else os.path.abspath(x)
for x in sys.path
)
for filename in extra_files or ():
rv.add(os.path.dirname(os.path.abspath(f... | python | def _find_observable_paths(extra_files=None):
"""Finds all paths that should be observed."""
rv = set(
os.path.dirname(os.path.abspath(x)) if os.path.isfile(x) else os.path.abspath(x)
for x in sys.path
)
for filename in extra_files or ():
rv.add(os.path.dirname(os.path.abspath(f... | [
"def",
"_find_observable_paths",
"(",
"extra_files",
"=",
"None",
")",
":",
"rv",
"=",
"set",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"x",
")",
")",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"x",
")... | Finds all paths that should be observed. | [
"Finds",
"all",
"paths",
"that",
"should",
"be",
"observed",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/_reloader.py#L43-L60 | train | Finds all paths that should be observed. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/_reloader.py | _get_args_for_reloading | def _get_args_for_reloading():
"""Returns the executable. This contains a workaround for windows
if the executable is incorrectly reported to not have the .exe
extension which can cause bugs on reloading. This also contains
a workaround for linux where the file is executable (possibly with
a progra... | python | def _get_args_for_reloading():
"""Returns the executable. This contains a workaround for windows
if the executable is incorrectly reported to not have the .exe
extension which can cause bugs on reloading. This also contains
a workaround for linux where the file is executable (possibly with
a progra... | [
"def",
"_get_args_for_reloading",
"(",
")",
":",
"rv",
"=",
"[",
"sys",
".",
"executable",
"]",
"py_script",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"sys",
".",
"argv",
"[",
"0",
"]",
")",
"args",
"=",
"sys",
".",
"argv",
"[",
"1",
":",
"]",... | Returns the executable. This contains a workaround for windows
if the executable is incorrectly reported to not have the .exe
extension which can cause bugs on reloading. This also contains
a workaround for linux where the file is executable (possibly with
a program other than python) | [
"Returns",
"the",
"executable",
".",
"This",
"contains",
"a",
"workaround",
"for",
"windows",
"if",
"the",
"executable",
"is",
"incorrectly",
"reported",
"to",
"not",
"have",
"the",
".",
"exe",
"extension",
"which",
"can",
"cause",
"bugs",
"on",
"reloading",
... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/_reloader.py#L63-L113 | train | Returns the executable that should be used for reloading the application. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/_reloader.py | _find_common_roots | def _find_common_roots(paths):
"""Out of some paths it finds the common roots that need monitoring."""
paths = [x.split(os.path.sep) for x in paths]
root = {}
for chunks in sorted(paths, key=len, reverse=True):
node = root
for chunk in chunks:
node = node.setdefault(chunk, {}... | python | def _find_common_roots(paths):
"""Out of some paths it finds the common roots that need monitoring."""
paths = [x.split(os.path.sep) for x in paths]
root = {}
for chunks in sorted(paths, key=len, reverse=True):
node = root
for chunk in chunks:
node = node.setdefault(chunk, {}... | [
"def",
"_find_common_roots",
"(",
"paths",
")",
":",
"paths",
"=",
"[",
"x",
".",
"split",
"(",
"os",
".",
"path",
".",
"sep",
")",
"for",
"x",
"in",
"paths",
"]",
"root",
"=",
"{",
"}",
"for",
"chunks",
"in",
"sorted",
"(",
"paths",
",",
"key",
... | Out of some paths it finds the common roots that need monitoring. | [
"Out",
"of",
"some",
"paths",
"it",
"finds",
"the",
"common",
"roots",
"that",
"need",
"monitoring",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/_reloader.py#L116-L135 | train | Out of some paths it finds the common roots that need monitoring. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/_reloader.py | ensure_echo_on | def ensure_echo_on():
"""Ensure that echo mode is enabled. Some tools such as PDB disable
it which causes usability issues after reload."""
# tcgetattr will fail if stdin isn't a tty
if not sys.stdin.isatty():
return
try:
import termios
except ImportError:
return
attr... | python | def ensure_echo_on():
"""Ensure that echo mode is enabled. Some tools such as PDB disable
it which causes usability issues after reload."""
# tcgetattr will fail if stdin isn't a tty
if not sys.stdin.isatty():
return
try:
import termios
except ImportError:
return
attr... | [
"def",
"ensure_echo_on",
"(",
")",
":",
"# tcgetattr will fail if stdin isn't a tty",
"if",
"not",
"sys",
".",
"stdin",
".",
"isatty",
"(",
")",
":",
"return",
"try",
":",
"import",
"termios",
"except",
"ImportError",
":",
"return",
"attributes",
"=",
"termios",... | Ensure that echo mode is enabled. Some tools such as PDB disable
it which causes usability issues after reload. | [
"Ensure",
"that",
"echo",
"mode",
"is",
"enabled",
".",
"Some",
"tools",
"such",
"as",
"PDB",
"disable",
"it",
"which",
"causes",
"usability",
"issues",
"after",
"reload",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/_reloader.py#L302-L315 | train | Ensure that echo mode is enabled. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/_reloader.py | run_with_reloader | def run_with_reloader(main_func, extra_files=None, interval=1, reloader_type="auto"):
"""Run the given function in an independent python interpreter."""
import signal
reloader = reloader_loops[reloader_type](extra_files, interval)
signal.signal(signal.SIGTERM, lambda *args: sys.exit(0))
try:
... | python | def run_with_reloader(main_func, extra_files=None, interval=1, reloader_type="auto"):
"""Run the given function in an independent python interpreter."""
import signal
reloader = reloader_loops[reloader_type](extra_files, interval)
signal.signal(signal.SIGTERM, lambda *args: sys.exit(0))
try:
... | [
"def",
"run_with_reloader",
"(",
"main_func",
",",
"extra_files",
"=",
"None",
",",
"interval",
"=",
"1",
",",
"reloader_type",
"=",
"\"auto\"",
")",
":",
"import",
"signal",
"reloader",
"=",
"reloader_loops",
"[",
"reloader_type",
"]",
"(",
"extra_files",
","... | Run the given function in an independent python interpreter. | [
"Run",
"the",
"given",
"function",
"in",
"an",
"independent",
"python",
"interpreter",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/_reloader.py#L318-L334 | train | Run the given function in an independent python interpreter. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/_reloader.py | ReloaderLoop.restart_with_reloader | def restart_with_reloader(self):
"""Spawn a new Python interpreter with the same arguments as this one,
but running the reloader thread.
"""
while 1:
_log("info", " * Restarting with %s" % self.name)
args = _get_args_for_reloading()
# a weird bug on w... | python | def restart_with_reloader(self):
"""Spawn a new Python interpreter with the same arguments as this one,
but running the reloader thread.
"""
while 1:
_log("info", " * Restarting with %s" % self.name)
args = _get_args_for_reloading()
# a weird bug on w... | [
"def",
"restart_with_reloader",
"(",
"self",
")",
":",
"while",
"1",
":",
"_log",
"(",
"\"info\"",
",",
"\" * Restarting with %s\"",
"%",
"self",
".",
"name",
")",
"args",
"=",
"_get_args_for_reloading",
"(",
")",
"# a weird bug on windows. sometimes unicode strings e... | Spawn a new Python interpreter with the same arguments as this one,
but running the reloader thread. | [
"Spawn",
"a",
"new",
"Python",
"interpreter",
"with",
"the",
"same",
"arguments",
"as",
"this",
"one",
"but",
"running",
"the",
"reloader",
"thread",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/_reloader.py#L153-L178 | train | Spawn a new Python interpreter with the same arguments as this one and running the reloader thread. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | examples/simplewiki/application.py | SimpleWiki.dispatch_request | def dispatch_request(self, environ, start_response):
"""Dispatch an incoming request."""
# set up all the stuff we want to have for this request. That is
# creating a request object, propagating the application to the
# current context and instanciating the database session.
sel... | python | def dispatch_request(self, environ, start_response):
"""Dispatch an incoming request."""
# set up all the stuff we want to have for this request. That is
# creating a request object, propagating the application to the
# current context and instanciating the database session.
sel... | [
"def",
"dispatch_request",
"(",
"self",
",",
"environ",
",",
"start_response",
")",
":",
"# set up all the stuff we want to have for this request. That is",
"# creating a request object, propagating the application to the",
"# current context and instanciating the database session.",
"sel... | Dispatch an incoming request. | [
"Dispatch",
"an",
"incoming",
"request",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/examples/simplewiki/application.py#L64-L100 | train | Dispatch an incoming request. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/utils.py | get_content_type | def get_content_type(mimetype, charset):
"""Returns the full content type string with charset for a mimetype.
If the mimetype represents text, the charset parameter will be
appended, otherwise the mimetype is returned unchanged.
:param mimetype: The mimetype to be used as content type.
:param char... | python | def get_content_type(mimetype, charset):
"""Returns the full content type string with charset for a mimetype.
If the mimetype represents text, the charset parameter will be
appended, otherwise the mimetype is returned unchanged.
:param mimetype: The mimetype to be used as content type.
:param char... | [
"def",
"get_content_type",
"(",
"mimetype",
",",
"charset",
")",
":",
"if",
"(",
"mimetype",
".",
"startswith",
"(",
"\"text/\"",
")",
"or",
"mimetype",
"in",
"_charset_mimetypes",
"or",
"mimetype",
".",
"endswith",
"(",
"\"+xml\"",
")",
")",
":",
"mimetype"... | Returns the full content type string with charset for a mimetype.
If the mimetype represents text, the charset parameter will be
appended, otherwise the mimetype is returned unchanged.
:param mimetype: The mimetype to be used as content type.
:param charset: The charset to be appended for text mimetyp... | [
"Returns",
"the",
"full",
"content",
"type",
"string",
"with",
"charset",
"for",
"a",
"mimetype",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/utils.py#L291-L313 | train | Returns the full content type string with charset for a mimetype. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/utils.py | detect_utf_encoding | def detect_utf_encoding(data):
"""Detect which UTF encoding was used to encode the given bytes.
The latest JSON standard (:rfc:`8259`) suggests that only UTF-8 is
accepted. Older documents allowed 8, 16, or 32. 16 and 32 can be big
or little endian. Some editors or libraries may prepend a BOM.
:in... | python | def detect_utf_encoding(data):
"""Detect which UTF encoding was used to encode the given bytes.
The latest JSON standard (:rfc:`8259`) suggests that only UTF-8 is
accepted. Older documents allowed 8, 16, or 32. 16 and 32 can be big
or little endian. Some editors or libraries may prepend a BOM.
:in... | [
"def",
"detect_utf_encoding",
"(",
"data",
")",
":",
"head",
"=",
"data",
"[",
":",
"4",
"]",
"if",
"head",
"[",
":",
"3",
"]",
"==",
"codecs",
".",
"BOM_UTF8",
":",
"return",
"\"utf-8-sig\"",
"if",
"b\"\\x00\"",
"not",
"in",
"head",
":",
"return",
"... | Detect which UTF encoding was used to encode the given bytes.
The latest JSON standard (:rfc:`8259`) suggests that only UTF-8 is
accepted. Older documents allowed 8, 16, or 32. 16 and 32 can be big
or little endian. Some editors or libraries may prepend a BOM.
:internal:
:param data: Bytes in unk... | [
"Detect",
"which",
"UTF",
"encoding",
"was",
"used",
"to",
"encode",
"the",
"given",
"bytes",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/utils.py#L316-L360 | train | Detects which UTF encoding was used to encode the given bytes. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/utils.py | format_string | def format_string(string, context):
"""String-template format a string:
>>> format_string('$foo and ${foo}s', dict(foo=42))
'42 and 42s'
This does not do any attribute lookup etc. For more advanced string
formattings have a look at the `werkzeug.template` module.
:param string: the format st... | python | def format_string(string, context):
"""String-template format a string:
>>> format_string('$foo and ${foo}s', dict(foo=42))
'42 and 42s'
This does not do any attribute lookup etc. For more advanced string
formattings have a look at the `werkzeug.template` module.
:param string: the format st... | [
"def",
"format_string",
"(",
"string",
",",
"context",
")",
":",
"def",
"lookup_arg",
"(",
"match",
")",
":",
"x",
"=",
"context",
"[",
"match",
".",
"group",
"(",
"1",
")",
"or",
"match",
".",
"group",
"(",
"2",
")",
"]",
"if",
"not",
"isinstance"... | String-template format a string:
>>> format_string('$foo and ${foo}s', dict(foo=42))
'42 and 42s'
This does not do any attribute lookup etc. For more advanced string
formattings have a look at the `werkzeug.template` module.
:param string: the format string.
:param context: a dict with the v... | [
"String",
"-",
"template",
"format",
"a",
"string",
":"
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/utils.py#L363-L382 | train | String - template format a string | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/utils.py | secure_filename | def secure_filename(filename):
r"""Pass it a filename and it will return a secure version of it. This
filename can then safely be stored on a regular file system and passed
to :func:`os.path.join`. The filename returned is an ASCII only string
for maximum portability.
On windows systems the funct... | python | def secure_filename(filename):
r"""Pass it a filename and it will return a secure version of it. This
filename can then safely be stored on a regular file system and passed
to :func:`os.path.join`. The filename returned is an ASCII only string
for maximum portability.
On windows systems the funct... | [
"def",
"secure_filename",
"(",
"filename",
")",
":",
"if",
"isinstance",
"(",
"filename",
",",
"text_type",
")",
":",
"from",
"unicodedata",
"import",
"normalize",
"filename",
"=",
"normalize",
"(",
"\"NFKD\"",
",",
"filename",
")",
".",
"encode",
"(",
"\"as... | r"""Pass it a filename and it will return a secure version of it. This
filename can then safely be stored on a regular file system and passed
to :func:`os.path.join`. The filename returned is an ASCII only string
for maximum portability.
On windows systems the function also makes sure that the file i... | [
"r",
"Pass",
"it",
"a",
"filename",
"and",
"it",
"will",
"return",
"a",
"secure",
"version",
"of",
"it",
".",
"This",
"filename",
"can",
"then",
"safely",
"be",
"stored",
"on",
"a",
"regular",
"file",
"system",
"and",
"passed",
"to",
":",
"func",
":",
... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/utils.py#L385-L432 | train | r Returns a secure version of a file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/utils.py | escape | def escape(s):
"""Replace special characters "&", "<", ">" and (") to HTML-safe sequences.
There is a special handling for `None` which escapes to an empty string.
.. versionchanged:: 0.9
`quote` is now implicitly on.
:param s: the string to escape.
:param quote: ignored.
"""
if s ... | python | def escape(s):
"""Replace special characters "&", "<", ">" and (") to HTML-safe sequences.
There is a special handling for `None` which escapes to an empty string.
.. versionchanged:: 0.9
`quote` is now implicitly on.
:param s: the string to escape.
:param quote: ignored.
"""
if s ... | [
"def",
"escape",
"(",
"s",
")",
":",
"if",
"s",
"is",
"None",
":",
"return",
"\"\"",
"elif",
"hasattr",
"(",
"s",
",",
"\"__html__\"",
")",
":",
"return",
"text_type",
"(",
"s",
".",
"__html__",
"(",
")",
")",
"if",
"not",
"isinstance",
"(",
"s",
... | Replace special characters "&", "<", ">" and (") to HTML-safe sequences.
There is a special handling for `None` which escapes to an empty string.
.. versionchanged:: 0.9
`quote` is now implicitly on.
:param s: the string to escape.
:param quote: ignored. | [
"Replace",
"special",
"characters",
"&",
"<",
">",
"and",
"(",
")",
"to",
"HTML",
"-",
"safe",
"sequences",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/utils.py#L435-L459 | train | Escape special characters in a string. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/utils.py | find_modules | def find_modules(import_path, include_packages=False, recursive=False):
"""Finds all the modules below a package. This can be useful to
automatically import all views / controllers so that their metaclasses /
function decorators have a chance to register themselves on the
application.
Packages are... | python | def find_modules(import_path, include_packages=False, recursive=False):
"""Finds all the modules below a package. This can be useful to
automatically import all views / controllers so that their metaclasses /
function decorators have a chance to register themselves on the
application.
Packages are... | [
"def",
"find_modules",
"(",
"import_path",
",",
"include_packages",
"=",
"False",
",",
"recursive",
"=",
"False",
")",
":",
"module",
"=",
"import_string",
"(",
"import_path",
")",
"path",
"=",
"getattr",
"(",
"module",
",",
"\"__path__\"",
",",
"None",
")",... | Finds all the modules below a package. This can be useful to
automatically import all views / controllers so that their metaclasses /
function decorators have a chance to register themselves on the
application.
Packages are not returned unless `include_packages` is `True`. This can
also recursive... | [
"Finds",
"all",
"the",
"modules",
"below",
"a",
"package",
".",
"This",
"can",
"be",
"useful",
"to",
"automatically",
"import",
"all",
"views",
"/",
"controllers",
"so",
"that",
"their",
"metaclasses",
"/",
"function",
"decorators",
"have",
"a",
"chance",
"t... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/utils.py#L584-L613 | train | Find all the modules below a given package. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/utils.py | validate_arguments | def validate_arguments(func, args, kwargs, drop_extra=True):
"""Checks if the function accepts the arguments and keyword arguments.
Returns a new ``(args, kwargs)`` tuple that can safely be passed to
the function without causing a `TypeError` because the function signature
is incompatible. If `drop_ext... | python | def validate_arguments(func, args, kwargs, drop_extra=True):
"""Checks if the function accepts the arguments and keyword arguments.
Returns a new ``(args, kwargs)`` tuple that can safely be passed to
the function without causing a `TypeError` because the function signature
is incompatible. If `drop_ext... | [
"def",
"validate_arguments",
"(",
"func",
",",
"args",
",",
"kwargs",
",",
"drop_extra",
"=",
"True",
")",
":",
"parser",
"=",
"_parse_signature",
"(",
"func",
")",
"args",
",",
"kwargs",
",",
"missing",
",",
"extra",
",",
"extra_positional",
"=",
"parser"... | Checks if the function accepts the arguments and keyword arguments.
Returns a new ``(args, kwargs)`` tuple that can safely be passed to
the function without causing a `TypeError` because the function signature
is incompatible. If `drop_extra` is set to `True` (which is the default)
any extra positional... | [
"Checks",
"if",
"the",
"function",
"accepts",
"the",
"arguments",
"and",
"keyword",
"arguments",
".",
"Returns",
"a",
"new",
"(",
"args",
"kwargs",
")",
"tuple",
"that",
"can",
"safely",
"be",
"passed",
"to",
"the",
"function",
"without",
"causing",
"a",
"... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/utils.py#L616-L666 | train | Checks if the function accepts the arguments and keyword arguments. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/utils.py | bind_arguments | def bind_arguments(func, args, kwargs):
"""Bind the arguments provided into a dict. When passed a function,
a tuple of arguments and a dict of keyword arguments `bind_arguments`
returns a dict of names as the function would see it. This can be useful
to implement a cache decorator that uses the functi... | python | def bind_arguments(func, args, kwargs):
"""Bind the arguments provided into a dict. When passed a function,
a tuple of arguments and a dict of keyword arguments `bind_arguments`
returns a dict of names as the function would see it. This can be useful
to implement a cache decorator that uses the functi... | [
"def",
"bind_arguments",
"(",
"func",
",",
"args",
",",
"kwargs",
")",
":",
"(",
"args",
",",
"kwargs",
",",
"missing",
",",
"extra",
",",
"extra_positional",
",",
"arg_spec",
",",
"vararg_var",
",",
"kwarg_var",
",",
")",
"=",
"_parse_signature",
"(",
"... | Bind the arguments provided into a dict. When passed a function,
a tuple of arguments and a dict of keyword arguments `bind_arguments`
returns a dict of names as the function would see it. This can be useful
to implement a cache decorator that uses the function arguments to build
the cache key based o... | [
"Bind",
"the",
"arguments",
"provided",
"into",
"a",
"dict",
".",
"When",
"passed",
"a",
"function",
"a",
"tuple",
"of",
"arguments",
"and",
"a",
"dict",
"of",
"keyword",
"arguments",
"bind_arguments",
"returns",
"a",
"dict",
"of",
"names",
"as",
"the",
"f... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/utils.py#L669-L707 | train | Bind the arguments provided into a dictionary. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | examples/plnt/views.py | index | def index(request, page):
"""Show the index page or any an offset of it."""
days = []
days_found = set()
query = Entry.query.order_by(Entry.pub_date.desc())
pagination = Pagination(query, PER_PAGE, page, "index")
for entry in pagination.entries:
day = date(*entry.pub_date.timetuple()[:3]... | python | def index(request, page):
"""Show the index page or any an offset of it."""
days = []
days_found = set()
query = Entry.query.order_by(Entry.pub_date.desc())
pagination = Pagination(query, PER_PAGE, page, "index")
for entry in pagination.entries:
day = date(*entry.pub_date.timetuple()[:3]... | [
"def",
"index",
"(",
"request",
",",
"page",
")",
":",
"days",
"=",
"[",
"]",
"days_found",
"=",
"set",
"(",
")",
"query",
"=",
"Entry",
".",
"query",
".",
"order_by",
"(",
"Entry",
".",
"pub_date",
".",
"desc",
"(",
")",
")",
"pagination",
"=",
... | Show the index page or any an offset of it. | [
"Show",
"the",
"index",
"page",
"or",
"any",
"an",
"offset",
"of",
"it",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/examples/plnt/views.py#L25-L37 | train | Show the index page or any an offset of it. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/debug/repr.py | dump | def dump(obj=missing):
"""Print the object details to stdout._write (for the interactive
console of the web debugger.
"""
gen = DebugReprGenerator()
if obj is missing:
rv = gen.dump_locals(sys._getframe(1).f_locals)
else:
rv = gen.dump_object(obj)
sys.stdout._write(rv) | python | def dump(obj=missing):
"""Print the object details to stdout._write (for the interactive
console of the web debugger.
"""
gen = DebugReprGenerator()
if obj is missing:
rv = gen.dump_locals(sys._getframe(1).f_locals)
else:
rv = gen.dump_object(obj)
sys.stdout._write(rv) | [
"def",
"dump",
"(",
"obj",
"=",
"missing",
")",
":",
"gen",
"=",
"DebugReprGenerator",
"(",
")",
"if",
"obj",
"is",
"missing",
":",
"rv",
"=",
"gen",
".",
"dump_locals",
"(",
"sys",
".",
"_getframe",
"(",
"1",
")",
".",
"f_locals",
")",
"else",
":"... | Print the object details to stdout._write (for the interactive
console of the web debugger. | [
"Print",
"the",
"object",
"details",
"to",
"stdout",
".",
"_write",
"(",
"for",
"the",
"interactive",
"console",
"of",
"the",
"web",
"debugger",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/debug/repr.py#L55-L64 | train | Print the object details to stdout. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/formparser.py | default_stream_factory | def default_stream_factory(
total_content_length, filename, content_type, content_length=None
):
"""The stream factory that is used per default."""
max_size = 1024 * 500
if SpooledTemporaryFile is not None:
return SpooledTemporaryFile(max_size=max_size, mode="wb+")
if total_content_length is... | python | def default_stream_factory(
total_content_length, filename, content_type, content_length=None
):
"""The stream factory that is used per default."""
max_size = 1024 * 500
if SpooledTemporaryFile is not None:
return SpooledTemporaryFile(max_size=max_size, mode="wb+")
if total_content_length is... | [
"def",
"default_stream_factory",
"(",
"total_content_length",
",",
"filename",
",",
"content_type",
",",
"content_length",
"=",
"None",
")",
":",
"max_size",
"=",
"1024",
"*",
"500",
"if",
"SpooledTemporaryFile",
"is",
"not",
"None",
":",
"return",
"SpooledTempora... | The stream factory that is used per default. | [
"The",
"stream",
"factory",
"that",
"is",
"used",
"per",
"default",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/formparser.py#L52-L61 | train | The stream factory that is used per default. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/formparser.py | exhaust_stream | def exhaust_stream(f):
"""Helper decorator for methods that exhausts the stream on return."""
def wrapper(self, stream, *args, **kwargs):
try:
return f(self, stream, *args, **kwargs)
finally:
exhaust = getattr(stream, "exhaust", None)
if exhaust is not None:
... | python | def exhaust_stream(f):
"""Helper decorator for methods that exhausts the stream on return."""
def wrapper(self, stream, *args, **kwargs):
try:
return f(self, stream, *args, **kwargs)
finally:
exhaust = getattr(stream, "exhaust", None)
if exhaust is not None:
... | [
"def",
"exhaust_stream",
"(",
"f",
")",
":",
"def",
"wrapper",
"(",
"self",
",",
"stream",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"return",
"f",
"(",
"self",
",",
"stream",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")... | Helper decorator for methods that exhausts the stream on return. | [
"Helper",
"decorator",
"for",
"methods",
"that",
"exhausts",
"the",
"stream",
"on",
"return",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/formparser.py#L125-L141 | train | Decorator for methods that exhausts the stream on return. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/formparser.py | _line_parse | def _line_parse(line):
"""Removes line ending characters and returns a tuple (`stripped_line`,
`is_terminated`).
"""
if line[-2:] in ["\r\n", b"\r\n"]:
return line[:-2], True
elif line[-1:] in ["\r", "\n", b"\r", b"\n"]:
return line[:-1], True
return line, False | python | def _line_parse(line):
"""Removes line ending characters and returns a tuple (`stripped_line`,
`is_terminated`).
"""
if line[-2:] in ["\r\n", b"\r\n"]:
return line[:-2], True
elif line[-1:] in ["\r", "\n", b"\r", b"\n"]:
return line[:-1], True
return line, False | [
"def",
"_line_parse",
"(",
"line",
")",
":",
"if",
"line",
"[",
"-",
"2",
":",
"]",
"in",
"[",
"\"\\r\\n\"",
",",
"b\"\\r\\n\"",
"]",
":",
"return",
"line",
"[",
":",
"-",
"2",
"]",
",",
"True",
"elif",
"line",
"[",
"-",
"1",
":",
"]",
"in",
... | Removes line ending characters and returns a tuple (`stripped_line`,
`is_terminated`). | [
"Removes",
"line",
"ending",
"characters",
"and",
"returns",
"a",
"tuple",
"(",
"stripped_line",
"is_terminated",
")",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/formparser.py#L279-L287 | train | Removes line ending characters and returns a tuple of the stripped line and is_terminated. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/formparser.py | FormDataParser.parse_from_environ | def parse_from_environ(self, environ):
"""Parses the information from the environment as form data.
:param environ: the WSGI environment to be used for parsing.
:return: A tuple in the form ``(stream, form, files)``.
"""
content_type = environ.get("CONTENT_TYPE", "")
con... | python | def parse_from_environ(self, environ):
"""Parses the information from the environment as form data.
:param environ: the WSGI environment to be used for parsing.
:return: A tuple in the form ``(stream, form, files)``.
"""
content_type = environ.get("CONTENT_TYPE", "")
con... | [
"def",
"parse_from_environ",
"(",
"self",
",",
"environ",
")",
":",
"content_type",
"=",
"environ",
".",
"get",
"(",
"\"CONTENT_TYPE\"",
",",
"\"\"",
")",
"content_length",
"=",
"get_content_length",
"(",
"environ",
")",
"mimetype",
",",
"options",
"=",
"parse... | Parses the information from the environment as form data.
:param environ: the WSGI environment to be used for parsing.
:return: A tuple in the form ``(stream, form, files)``. | [
"Parses",
"the",
"information",
"from",
"the",
"environment",
"as",
"form",
"data",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/formparser.py#L197-L206 | train | Parses the information from the WSGI environment as form data. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/formparser.py | FormDataParser.parse | def parse(self, stream, mimetype, content_length, options=None):
"""Parses the information from the given stream, mimetype,
content length and mimetype parameters.
:param stream: an input stream
:param mimetype: the mimetype of the data
:param content_length: the content length ... | python | def parse(self, stream, mimetype, content_length, options=None):
"""Parses the information from the given stream, mimetype,
content length and mimetype parameters.
:param stream: an input stream
:param mimetype: the mimetype of the data
:param content_length: the content length ... | [
"def",
"parse",
"(",
"self",
",",
"stream",
",",
"mimetype",
",",
"content_length",
",",
"options",
"=",
"None",
")",
":",
"if",
"(",
"self",
".",
"max_content_length",
"is",
"not",
"None",
"and",
"content_length",
"is",
"not",
"None",
"and",
"content_leng... | Parses the information from the given stream, mimetype,
content length and mimetype parameters.
:param stream: an input stream
:param mimetype: the mimetype of the data
:param content_length: the content length of the incoming data
:param options: optional mimetype parameters (u... | [
"Parses",
"the",
"information",
"from",
"the",
"given",
"stream",
"mimetype",
"content",
"length",
"and",
"mimetype",
"parameters",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/formparser.py#L208-L236 | train | Parses the information from the given stream mimetype content_length and mimetype parameters. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/formparser.py | MultiPartParser._find_terminator | def _find_terminator(self, iterator):
"""The terminator might have some additional newlines before it.
There is at least one application that sends additional newlines
before headers (the python setuptools package).
"""
for line in iterator:
if not line:
... | python | def _find_terminator(self, iterator):
"""The terminator might have some additional newlines before it.
There is at least one application that sends additional newlines
before headers (the python setuptools package).
"""
for line in iterator:
if not line:
... | [
"def",
"_find_terminator",
"(",
"self",
",",
"iterator",
")",
":",
"for",
"line",
"in",
"iterator",
":",
"if",
"not",
"line",
":",
"break",
"line",
"=",
"line",
".",
"strip",
"(",
")",
"if",
"line",
":",
"return",
"line",
"return",
"b\"\""
] | The terminator might have some additional newlines before it.
There is at least one application that sends additional newlines
before headers (the python setuptools package). | [
"The",
"terminator",
"might",
"have",
"some",
"additional",
"newlines",
"before",
"it",
".",
"There",
"is",
"at",
"least",
"one",
"application",
"that",
"sends",
"additional",
"newlines",
"before",
"headers",
"(",
"the",
"python",
"setuptools",
"package",
")",
... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/formparser.py#L362-L373 | train | Find the next line of the terminator. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/formparser.py | MultiPartParser.parse_lines | def parse_lines(self, file, boundary, content_length, cap_at_buffer=True):
"""Generate parts of
``('begin_form', (headers, name))``
``('begin_file', (headers, name, filename))``
``('cont', bytestring)``
``('end', None)``
Always obeys the grammar
parts = ( begin_f... | python | def parse_lines(self, file, boundary, content_length, cap_at_buffer=True):
"""Generate parts of
``('begin_form', (headers, name))``
``('begin_file', (headers, name, filename))``
``('cont', bytestring)``
``('end', None)``
Always obeys the grammar
parts = ( begin_f... | [
"def",
"parse_lines",
"(",
"self",
",",
"file",
",",
"boundary",
",",
"content_length",
",",
"cap_at_buffer",
"=",
"True",
")",
":",
"next_part",
"=",
"b\"--\"",
"+",
"boundary",
"last_part",
"=",
"next_part",
"+",
"b\"--\"",
"iterator",
"=",
"chain",
"(",
... | Generate parts of
``('begin_form', (headers, name))``
``('begin_file', (headers, name, filename))``
``('cont', bytestring)``
``('end', None)``
Always obeys the grammar
parts = ( begin_form cont* end |
begin_file cont* end )* | [
"Generate",
"parts",
"of",
"(",
"begin_form",
"(",
"headers",
"name",
"))",
"(",
"begin_file",
"(",
"headers",
"name",
"filename",
"))",
"(",
"cont",
"bytestring",
")",
"(",
"end",
"None",
")"
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/formparser.py#L426-L528 | train | Yields a generator of lines from a multipart file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | examples/coolmagic/application.py | make_app | def make_app(config=None):
"""
Factory function that creates a new `CoolmagicApplication`
object. Optional WSGI middlewares should be applied here.
"""
config = config or {}
app = CoolMagicApplication(config)
# static stuff
app = SharedDataMiddleware(
app, {"/public": path.join(... | python | def make_app(config=None):
"""
Factory function that creates a new `CoolmagicApplication`
object. Optional WSGI middlewares should be applied here.
"""
config = config or {}
app = CoolMagicApplication(config)
# static stuff
app = SharedDataMiddleware(
app, {"/public": path.join(... | [
"def",
"make_app",
"(",
"config",
"=",
"None",
")",
":",
"config",
"=",
"config",
"or",
"{",
"}",
"app",
"=",
"CoolMagicApplication",
"(",
"config",
")",
"# static stuff",
"app",
"=",
"SharedDataMiddleware",
"(",
"app",
",",
"{",
"\"/public\"",
":",
"path"... | Factory function that creates a new `CoolmagicApplication`
object. Optional WSGI middlewares should be applied here. | [
"Factory",
"function",
"that",
"creates",
"a",
"new",
"CoolmagicApplication",
"object",
".",
"Optional",
"WSGI",
"middlewares",
"should",
"be",
"applied",
"here",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/examples/coolmagic/application.py#L69-L85 | train | Factory function that creates a new CoolmagicApplication object. Optional WSGI middlewares should be applied here. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | bench/wzbench.py | find_hg_tag | def find_hg_tag(path):
"""Returns the current node or tag for the given path."""
tags = {}
try:
client = subprocess.Popen(
["hg", "cat", "-r", "tip", ".hgtags"], stdout=subprocess.PIPE, cwd=path
)
for line in client.communicate()[0].splitlines():
line = line.s... | python | def find_hg_tag(path):
"""Returns the current node or tag for the given path."""
tags = {}
try:
client = subprocess.Popen(
["hg", "cat", "-r", "tip", ".hgtags"], stdout=subprocess.PIPE, cwd=path
)
for line in client.communicate()[0].splitlines():
line = line.s... | [
"def",
"find_hg_tag",
"(",
"path",
")",
":",
"tags",
"=",
"{",
"}",
"try",
":",
"client",
"=",
"subprocess",
".",
"Popen",
"(",
"[",
"\"hg\"",
",",
"\"cat\"",
",",
"\"-r\"",
",",
"\"tip\"",
",",
"\".hgtags\"",
"]",
",",
"stdout",
"=",
"subprocess",
"... | Returns the current node or tag for the given path. | [
"Returns",
"the",
"current",
"node",
"or",
"tag",
"for",
"the",
"given",
"path",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/bench/wzbench.py#L48-L72 | train | Returns the current node or tag for the given path. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | bench/wzbench.py | load_werkzeug | def load_werkzeug(path):
"""Load werkzeug."""
sys.path[0] = path
# get rid of already imported stuff
wz.__dict__.clear()
for key in sys.modules.keys():
if key.startswith("werkzeug.") or key == "werkzeug":
sys.modules.pop(key, None)
# import werkzeug again.
import werkze... | python | def load_werkzeug(path):
"""Load werkzeug."""
sys.path[0] = path
# get rid of already imported stuff
wz.__dict__.clear()
for key in sys.modules.keys():
if key.startswith("werkzeug.") or key == "werkzeug":
sys.modules.pop(key, None)
# import werkzeug again.
import werkze... | [
"def",
"load_werkzeug",
"(",
"path",
")",
":",
"sys",
".",
"path",
"[",
"0",
"]",
"=",
"path",
"# get rid of already imported stuff",
"wz",
".",
"__dict__",
".",
"clear",
"(",
")",
"for",
"key",
"in",
"sys",
".",
"modules",
".",
"keys",
"(",
")",
":",
... | Load werkzeug. | [
"Load",
"werkzeug",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/bench/wzbench.py#L75-L108 | train | Load werkzeug. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | bench/wzbench.py | bench | def bench(func):
"""Times a single function."""
sys.stdout.write("%44s " % format_func(func))
sys.stdout.flush()
# figure out how many times we have to run the function to
# get reliable timings.
for i in xrange(3, 10):
rounds = 1 << i
t = timer()
for _ in xrange(round... | python | def bench(func):
"""Times a single function."""
sys.stdout.write("%44s " % format_func(func))
sys.stdout.flush()
# figure out how many times we have to run the function to
# get reliable timings.
for i in xrange(3, 10):
rounds = 1 << i
t = timer()
for _ in xrange(round... | [
"def",
"bench",
"(",
"func",
")",
":",
"sys",
".",
"stdout",
".",
"write",
"(",
"\"%44s \"",
"%",
"format_func",
"(",
"func",
")",
")",
"sys",
".",
"stdout",
".",
"flush",
"(",
")",
"# figure out how many times we have to run the function to",
"# get reliable ... | Times a single function. | [
"Times",
"a",
"single",
"function",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/bench/wzbench.py#L128-L160 | train | Times a single function. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | bench/wzbench.py | main | def main():
"""The main entrypoint."""
from optparse import OptionParser
parser = OptionParser(usage="%prog [options]")
parser.add_option(
"--werkzeug-path",
"-p",
dest="path",
default="..",
help="the path to the werkzeug package. defaults to cwd",
)
pars... | python | def main():
"""The main entrypoint."""
from optparse import OptionParser
parser = OptionParser(usage="%prog [options]")
parser.add_option(
"--werkzeug-path",
"-p",
dest="path",
default="..",
help="the path to the werkzeug package. defaults to cwd",
)
pars... | [
"def",
"main",
"(",
")",
":",
"from",
"optparse",
"import",
"OptionParser",
"parser",
"=",
"OptionParser",
"(",
"usage",
"=",
"\"%prog [options]\"",
")",
"parser",
".",
"add_option",
"(",
"\"--werkzeug-path\"",
",",
"\"-p\"",
",",
"dest",
"=",
"\"path\"",
",",... | The main entrypoint. | [
"The",
"main",
"entrypoint",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/bench/wzbench.py#L163-L198 | train | The main entrypoint. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | bench/wzbench.py | compare | def compare(node1, node2):
"""Compares two Werkzeug hg versions."""
if not os.path.isdir("a"):
print("error: comparison feature not initialized", file=sys.stderr)
sys.exit(4)
print("=" * 80)
print("WERKZEUG INTERNAL BENCHMARK -- COMPARE MODE".center(80))
print("-" * 80)
def _hg... | python | def compare(node1, node2):
"""Compares two Werkzeug hg versions."""
if not os.path.isdir("a"):
print("error: comparison feature not initialized", file=sys.stderr)
sys.exit(4)
print("=" * 80)
print("WERKZEUG INTERNAL BENCHMARK -- COMPARE MODE".center(80))
print("-" * 80)
def _hg... | [
"def",
"compare",
"(",
"node1",
",",
"node2",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"\"a\"",
")",
":",
"print",
"(",
"\"error: comparison feature not initialized\"",
",",
"file",
"=",
"sys",
".",
"stderr",
")",
"sys",
".",
"exit",
... | Compares two Werkzeug hg versions. | [
"Compares",
"two",
"Werkzeug",
"hg",
"versions",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/bench/wzbench.py#L208-L266 | train | Compares two Werkzeug hg versions. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/debug/tbtools.py | Traceback.filter_hidden_frames | def filter_hidden_frames(self):
"""Remove the frames according to the paste spec."""
for group in self.groups:
group.filter_hidden_frames()
self.frames[:] = [frame for group in self.groups for frame in group.frames] | python | def filter_hidden_frames(self):
"""Remove the frames according to the paste spec."""
for group in self.groups:
group.filter_hidden_frames()
self.frames[:] = [frame for group in self.groups for frame in group.frames] | [
"def",
"filter_hidden_frames",
"(",
"self",
")",
":",
"for",
"group",
"in",
"self",
".",
"groups",
":",
"group",
".",
"filter_hidden_frames",
"(",
")",
"self",
".",
"frames",
"[",
":",
"]",
"=",
"[",
"frame",
"for",
"group",
"in",
"self",
".",
"groups"... | Remove the frames according to the paste spec. | [
"Remove",
"the",
"frames",
"according",
"to",
"the",
"paste",
"spec",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/debug/tbtools.py#L260-L265 | train | Remove the frames according to the paste spec. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/debug/tbtools.py | Traceback.log | def log(self, logfile=None):
"""Log the ASCII traceback into a file object."""
if logfile is None:
logfile = sys.stderr
tb = self.plaintext.rstrip() + u"\n"
logfile.write(to_native(tb, "utf-8", "replace")) | python | def log(self, logfile=None):
"""Log the ASCII traceback into a file object."""
if logfile is None:
logfile = sys.stderr
tb = self.plaintext.rstrip() + u"\n"
logfile.write(to_native(tb, "utf-8", "replace")) | [
"def",
"log",
"(",
"self",
",",
"logfile",
"=",
"None",
")",
":",
"if",
"logfile",
"is",
"None",
":",
"logfile",
"=",
"sys",
".",
"stderr",
"tb",
"=",
"self",
".",
"plaintext",
".",
"rstrip",
"(",
")",
"+",
"u\"\\n\"",
"logfile",
".",
"write",
"(",... | Log the ASCII traceback into a file object. | [
"Log",
"the",
"ASCII",
"traceback",
"into",
"a",
"file",
"object",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/debug/tbtools.py#L277-L282 | train | Log the ASCII traceback into a file object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/debug/tbtools.py | Traceback.paste | def paste(self):
"""Create a paste and return the paste id."""
data = json.dumps(
{
"description": "Werkzeug Internal Server Error",
"public": False,
"files": {"traceback.txt": {"content": self.plaintext}},
}
).encode("utf-8... | python | def paste(self):
"""Create a paste and return the paste id."""
data = json.dumps(
{
"description": "Werkzeug Internal Server Error",
"public": False,
"files": {"traceback.txt": {"content": self.plaintext}},
}
).encode("utf-8... | [
"def",
"paste",
"(",
"self",
")",
":",
"data",
"=",
"json",
".",
"dumps",
"(",
"{",
"\"description\"",
":",
"\"Werkzeug Internal Server Error\"",
",",
"\"public\"",
":",
"False",
",",
"\"files\"",
":",
"{",
"\"traceback.txt\"",
":",
"{",
"\"content\"",
":",
... | Create a paste and return the paste id. | [
"Create",
"a",
"paste",
"and",
"return",
"the",
"paste",
"id",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/debug/tbtools.py#L284-L300 | train | Create a paste and return the paste id. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/debug/tbtools.py | Traceback.render_summary | def render_summary(self, include_title=True):
"""Render the traceback for the interactive console."""
title = ""
classes = ["traceback"]
if not self.frames:
classes.append("noframe-traceback")
frames = []
else:
library_frames = sum(frame.is_lib... | python | def render_summary(self, include_title=True):
"""Render the traceback for the interactive console."""
title = ""
classes = ["traceback"]
if not self.frames:
classes.append("noframe-traceback")
frames = []
else:
library_frames = sum(frame.is_lib... | [
"def",
"render_summary",
"(",
"self",
",",
"include_title",
"=",
"True",
")",
":",
"title",
"=",
"\"\"",
"classes",
"=",
"[",
"\"traceback\"",
"]",
"if",
"not",
"self",
".",
"frames",
":",
"classes",
".",
"append",
"(",
"\"noframe-traceback\"",
")",
"frame... | Render the traceback for the interactive console. | [
"Render",
"the",
"traceback",
"for",
"the",
"interactive",
"console",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/debug/tbtools.py#L302-L330 | train | Render the traceback for the interactive console. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/debug/tbtools.py | Traceback.render_full | def render_full(self, evalex=False, secret=None, evalex_trusted=True):
"""Render the Full HTML page with the traceback info."""
exc = escape(self.exception)
return PAGE_HTML % {
"evalex": "true" if evalex else "false",
"evalex_trusted": "true" if evalex_trusted else "fals... | python | def render_full(self, evalex=False, secret=None, evalex_trusted=True):
"""Render the Full HTML page with the traceback info."""
exc = escape(self.exception)
return PAGE_HTML % {
"evalex": "true" if evalex else "false",
"evalex_trusted": "true" if evalex_trusted else "fals... | [
"def",
"render_full",
"(",
"self",
",",
"evalex",
"=",
"False",
",",
"secret",
"=",
"None",
",",
"evalex_trusted",
"=",
"True",
")",
":",
"exc",
"=",
"escape",
"(",
"self",
".",
"exception",
")",
"return",
"PAGE_HTML",
"%",
"{",
"\"evalex\"",
":",
"\"t... | Render the Full HTML page with the traceback info. | [
"Render",
"the",
"Full",
"HTML",
"page",
"with",
"the",
"traceback",
"info",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/debug/tbtools.py#L332-L347 | train | Render the Full HTML page with the traceback info. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/debug/tbtools.py | Group.exception | def exception(self):
"""String representation of the exception."""
buf = traceback.format_exception_only(self.exc_type, self.exc_value)
rv = "".join(buf).strip()
return to_unicode(rv, "utf-8", "replace") | python | def exception(self):
"""String representation of the exception."""
buf = traceback.format_exception_only(self.exc_type, self.exc_value)
rv = "".join(buf).strip()
return to_unicode(rv, "utf-8", "replace") | [
"def",
"exception",
"(",
"self",
")",
":",
"buf",
"=",
"traceback",
".",
"format_exception_only",
"(",
"self",
".",
"exc_type",
",",
"self",
".",
"exc_value",
")",
"rv",
"=",
"\"\"",
".",
"join",
"(",
"buf",
")",
".",
"strip",
"(",
")",
"return",
"to... | String representation of the exception. | [
"String",
"representation",
"of",
"the",
"exception",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/debug/tbtools.py#L418-L422 | train | String representation of the exception. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/debug/tbtools.py | Frame.render | def render(self, mark_lib=True):
"""Render a single frame in a traceback."""
return FRAME_HTML % {
"id": self.id,
"filename": escape(self.filename),
"lineno": self.lineno,
"function_name": escape(self.function_name),
"lines": self.render_line_c... | python | def render(self, mark_lib=True):
"""Render a single frame in a traceback."""
return FRAME_HTML % {
"id": self.id,
"filename": escape(self.filename),
"lineno": self.lineno,
"function_name": escape(self.function_name),
"lines": self.render_line_c... | [
"def",
"render",
"(",
"self",
",",
"mark_lib",
"=",
"True",
")",
":",
"return",
"FRAME_HTML",
"%",
"{",
"\"id\"",
":",
"self",
".",
"id",
",",
"\"filename\"",
":",
"escape",
"(",
"self",
".",
"filename",
")",
",",
"\"lineno\"",
":",
"self",
".",
"lin... | Render a single frame in a traceback. | [
"Render",
"a",
"single",
"frame",
"in",
"a",
"traceback",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/debug/tbtools.py#L476-L485 | train | Render a single frame in a traceback. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/debug/tbtools.py | Frame.eval | def eval(self, code, mode="single"):
"""Evaluate code in the context of the frame."""
if isinstance(code, string_types):
if PY2 and isinstance(code, text_type): # noqa
code = UTF8_COOKIE + code.encode("utf-8")
code = compile(code, "<interactive>", mode)
r... | python | def eval(self, code, mode="single"):
"""Evaluate code in the context of the frame."""
if isinstance(code, string_types):
if PY2 and isinstance(code, text_type): # noqa
code = UTF8_COOKIE + code.encode("utf-8")
code = compile(code, "<interactive>", mode)
r... | [
"def",
"eval",
"(",
"self",
",",
"code",
",",
"mode",
"=",
"\"single\"",
")",
":",
"if",
"isinstance",
"(",
"code",
",",
"string_types",
")",
":",
"if",
"PY2",
"and",
"isinstance",
"(",
"code",
",",
"text_type",
")",
":",
"# noqa",
"code",
"=",
"UTF8... | Evaluate code in the context of the frame. | [
"Evaluate",
"code",
"in",
"the",
"context",
"of",
"the",
"frame",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/debug/tbtools.py#L548-L554 | train | Evaluate code in the context of the frame. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/wrappers/base_request.py | BaseRequest.application | def application(cls, f):
"""Decorate a function as responder that accepts the request as first
argument. This works like the :func:`responder` decorator but the
function is passed the request object as first argument and the
request object will be closed automatically::
@Re... | python | def application(cls, f):
"""Decorate a function as responder that accepts the request as first
argument. This works like the :func:`responder` decorator but the
function is passed the request object as first argument and the
request object will be closed automatically::
@Re... | [
"def",
"application",
"(",
"cls",
",",
"f",
")",
":",
"#: return a callable that wraps the -2nd argument with the request",
"#: and calls the function with all the arguments up to that one and",
"#: the request. The return value is then called with the latest",
"#: two arguments. This makes ... | Decorate a function as responder that accepts the request as first
argument. This works like the :func:`responder` decorator but the
function is passed the request object as first argument and the
request object will be closed automatically::
@Request.application
def my... | [
"Decorate",
"a",
"function",
"as",
"responder",
"that",
"accepts",
"the",
"request",
"as",
"first",
"argument",
".",
"This",
"works",
"like",
"the",
":",
"func",
":",
"responder",
"decorator",
"but",
"the",
"function",
"is",
"passed",
"the",
"request",
"obje... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/wrappers/base_request.py#L207-L239 | train | Decorate a function as responder that accepts the request as first
argument and returns a WSGI response. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/wrappers/base_request.py | BaseRequest._load_form_data | def _load_form_data(self):
"""Method used internally to retrieve submitted data. After calling
this sets `form` and `files` on the request object to multi dicts
filled with the incoming form data. As a matter of fact the input
stream will be empty afterwards. You can also call this me... | python | def _load_form_data(self):
"""Method used internally to retrieve submitted data. After calling
this sets `form` and `files` on the request object to multi dicts
filled with the incoming form data. As a matter of fact the input
stream will be empty afterwards. You can also call this me... | [
"def",
"_load_form_data",
"(",
"self",
")",
":",
"# abort early if we have already consumed the stream",
"if",
"\"form\"",
"in",
"self",
".",
"__dict__",
":",
"return",
"_assert_not_shallow",
"(",
"self",
")",
"if",
"self",
".",
"want_form_data_parsed",
":",
"content_... | Method used internally to retrieve submitted data. After calling
this sets `form` and `files` on the request object to multi dicts
filled with the incoming form data. As a matter of fact the input
stream will be empty afterwards. You can also call this method to
force the parsing of t... | [
"Method",
"used",
"internally",
"to",
"retrieve",
"submitted",
"data",
".",
"After",
"calling",
"this",
"sets",
"form",
"and",
"files",
"on",
"the",
"request",
"object",
"to",
"multi",
"dicts",
"filled",
"with",
"the",
"incoming",
"form",
"data",
".",
"As",
... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/wrappers/base_request.py#L294-L327 | train | Method used internally to retrieve submitted data. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/wrappers/base_request.py | BaseRequest.close | def close(self):
"""Closes associated resources of this request object. This
closes all file handles explicitly. You can also use the request
object in a with statement which will automatically close it.
.. versionadded:: 0.9
"""
files = self.__dict__.get("files")
... | python | def close(self):
"""Closes associated resources of this request object. This
closes all file handles explicitly. You can also use the request
object in a with statement which will automatically close it.
.. versionadded:: 0.9
"""
files = self.__dict__.get("files")
... | [
"def",
"close",
"(",
"self",
")",
":",
"files",
"=",
"self",
".",
"__dict__",
".",
"get",
"(",
"\"files\"",
")",
"for",
"_key",
",",
"value",
"in",
"iter_multi_items",
"(",
"files",
"or",
"(",
")",
")",
":",
"value",
".",
"close",
"(",
")"
] | Closes associated resources of this request object. This
closes all file handles explicitly. You can also use the request
object in a with statement which will automatically close it.
.. versionadded:: 0.9 | [
"Closes",
"associated",
"resources",
"of",
"this",
"request",
"object",
".",
"This",
"closes",
"all",
"file",
"handles",
"explicitly",
".",
"You",
"can",
"also",
"use",
"the",
"request",
"object",
"in",
"a",
"with",
"statement",
"which",
"will",
"automatically... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/wrappers/base_request.py#L341-L350 | train | Closes all associated resources of this request object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/wrappers/base_request.py | BaseRequest.values | def values(self):
"""A :class:`werkzeug.datastructures.CombinedMultiDict` that combines
:attr:`args` and :attr:`form`."""
args = []
for d in self.args, self.form:
if not isinstance(d, MultiDict):
d = MultiDict(d)
args.append(d)
return Combi... | python | def values(self):
"""A :class:`werkzeug.datastructures.CombinedMultiDict` that combines
:attr:`args` and :attr:`form`."""
args = []
for d in self.args, self.form:
if not isinstance(d, MultiDict):
d = MultiDict(d)
args.append(d)
return Combi... | [
"def",
"values",
"(",
"self",
")",
":",
"args",
"=",
"[",
"]",
"for",
"d",
"in",
"self",
".",
"args",
",",
"self",
".",
"form",
":",
"if",
"not",
"isinstance",
"(",
"d",
",",
"MultiDict",
")",
":",
"d",
"=",
"MultiDict",
"(",
"d",
")",
"args",
... | A :class:`werkzeug.datastructures.CombinedMultiDict` that combines
:attr:`args` and :attr:`form`. | [
"A",
":",
"class",
":",
"werkzeug",
".",
"datastructures",
".",
"CombinedMultiDict",
"that",
"combines",
":",
"attr",
":",
"args",
"and",
":",
"attr",
":",
"form",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/wrappers/base_request.py#L480-L488 | train | A : class : werkzeug. datastructures. CombinedMultiDict that combines the args and form. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/wrappers/base_request.py | BaseRequest.cookies | def cookies(self):
"""A :class:`dict` with the contents of all cookies transmitted with
the request."""
return parse_cookie(
self.environ,
self.charset,
self.encoding_errors,
cls=self.dict_storage_class,
) | python | def cookies(self):
"""A :class:`dict` with the contents of all cookies transmitted with
the request."""
return parse_cookie(
self.environ,
self.charset,
self.encoding_errors,
cls=self.dict_storage_class,
) | [
"def",
"cookies",
"(",
"self",
")",
":",
"return",
"parse_cookie",
"(",
"self",
".",
"environ",
",",
"self",
".",
"charset",
",",
"self",
".",
"encoding_errors",
",",
"cls",
"=",
"self",
".",
"dict_storage_class",
",",
")"
] | A :class:`dict` with the contents of all cookies transmitted with
the request. | [
"A",
":",
"class",
":",
"dict",
"with",
"the",
"contents",
"of",
"all",
"cookies",
"transmitted",
"with",
"the",
"request",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/wrappers/base_request.py#L514-L522 | train | A dict with the contents of all cookies transmitted with
the request. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/wrappers/base_request.py | BaseRequest.path | def path(self):
"""Requested path as unicode. This works a bit like the regular path
info in the WSGI environment but will always include a leading slash,
even if the URL root is accessed.
"""
raw_path = wsgi_decoding_dance(
self.environ.get("PATH_INFO") or "", self.... | python | def path(self):
"""Requested path as unicode. This works a bit like the regular path
info in the WSGI environment but will always include a leading slash,
even if the URL root is accessed.
"""
raw_path = wsgi_decoding_dance(
self.environ.get("PATH_INFO") or "", self.... | [
"def",
"path",
"(",
"self",
")",
":",
"raw_path",
"=",
"wsgi_decoding_dance",
"(",
"self",
".",
"environ",
".",
"get",
"(",
"\"PATH_INFO\"",
")",
"or",
"\"\"",
",",
"self",
".",
"charset",
",",
"self",
".",
"encoding_errors",
")",
"return",
"\"/\"",
"+",... | Requested path as unicode. This works a bit like the regular path
info in the WSGI environment but will always include a leading slash,
even if the URL root is accessed. | [
"Requested",
"path",
"as",
"unicode",
".",
"This",
"works",
"a",
"bit",
"like",
"the",
"regular",
"path",
"info",
"in",
"the",
"WSGI",
"environment",
"but",
"will",
"always",
"include",
"a",
"leading",
"slash",
"even",
"if",
"the",
"URL",
"root",
"is",
"... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/wrappers/base_request.py#L532-L540 | train | The path of the current URL. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/wrappers/base_request.py | BaseRequest.full_path | def full_path(self):
"""Requested path as unicode, including the query string."""
return self.path + u"?" + to_unicode(self.query_string, self.url_charset) | python | def full_path(self):
"""Requested path as unicode, including the query string."""
return self.path + u"?" + to_unicode(self.query_string, self.url_charset) | [
"def",
"full_path",
"(",
"self",
")",
":",
"return",
"self",
".",
"path",
"+",
"u\"?\"",
"+",
"to_unicode",
"(",
"self",
".",
"query_string",
",",
"self",
".",
"url_charset",
")"
] | Requested path as unicode, including the query string. | [
"Requested",
"path",
"as",
"unicode",
"including",
"the",
"query",
"string",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/wrappers/base_request.py#L543-L545 | train | Returns the full path to the resource. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/wrappers/base_request.py | BaseRequest.script_root | def script_root(self):
"""The root path of the script without the trailing slash."""
raw_path = wsgi_decoding_dance(
self.environ.get("SCRIPT_NAME") or "", self.charset, self.encoding_errors
)
return raw_path.rstrip("/") | python | def script_root(self):
"""The root path of the script without the trailing slash."""
raw_path = wsgi_decoding_dance(
self.environ.get("SCRIPT_NAME") or "", self.charset, self.encoding_errors
)
return raw_path.rstrip("/") | [
"def",
"script_root",
"(",
"self",
")",
":",
"raw_path",
"=",
"wsgi_decoding_dance",
"(",
"self",
".",
"environ",
".",
"get",
"(",
"\"SCRIPT_NAME\"",
")",
"or",
"\"\"",
",",
"self",
".",
"charset",
",",
"self",
".",
"encoding_errors",
")",
"return",
"raw_p... | The root path of the script without the trailing slash. | [
"The",
"root",
"path",
"of",
"the",
"script",
"without",
"the",
"trailing",
"slash",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/wrappers/base_request.py#L548-L553 | train | The root path of the script without the trailing slash. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/wrappers/base_request.py | BaseRequest.base_url | def base_url(self):
"""Like :attr:`url` but without the querystring
See also: :attr:`trusted_hosts`.
"""
return get_current_url(
self.environ, strip_querystring=True, trusted_hosts=self.trusted_hosts
) | python | def base_url(self):
"""Like :attr:`url` but without the querystring
See also: :attr:`trusted_hosts`.
"""
return get_current_url(
self.environ, strip_querystring=True, trusted_hosts=self.trusted_hosts
) | [
"def",
"base_url",
"(",
"self",
")",
":",
"return",
"get_current_url",
"(",
"self",
".",
"environ",
",",
"strip_querystring",
"=",
"True",
",",
"trusted_hosts",
"=",
"self",
".",
"trusted_hosts",
")"
] | Like :attr:`url` but without the querystring
See also: :attr:`trusted_hosts`. | [
"Like",
":",
"attr",
":",
"url",
"but",
"without",
"the",
"querystring",
"See",
"also",
":",
":",
"attr",
":",
"trusted_hosts",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/wrappers/base_request.py#L563-L569 | train | Like url but without the querystring
| Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/wrappers/base_request.py | BaseRequest.host_url | def host_url(self):
"""Just the host with scheme as IRI.
See also: :attr:`trusted_hosts`.
"""
return get_current_url(
self.environ, host_only=True, trusted_hosts=self.trusted_hosts
) | python | def host_url(self):
"""Just the host with scheme as IRI.
See also: :attr:`trusted_hosts`.
"""
return get_current_url(
self.environ, host_only=True, trusted_hosts=self.trusted_hosts
) | [
"def",
"host_url",
"(",
"self",
")",
":",
"return",
"get_current_url",
"(",
"self",
".",
"environ",
",",
"host_only",
"=",
"True",
",",
"trusted_hosts",
"=",
"self",
".",
"trusted_hosts",
")"
] | Just the host with scheme as IRI.
See also: :attr:`trusted_hosts`. | [
"Just",
"the",
"host",
"with",
"scheme",
"as",
"IRI",
".",
"See",
"also",
":",
":",
"attr",
":",
"trusted_hosts",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/wrappers/base_request.py#L580-L586 | train | Just the host with scheme as IRI. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | src/werkzeug/wrappers/base_request.py | BaseRequest.access_route | def access_route(self):
"""If a forwarded header exists this is a list of all ip addresses
from the client ip to the last proxy server.
"""
if "HTTP_X_FORWARDED_FOR" in self.environ:
addr = self.environ["HTTP_X_FORWARDED_FOR"].split(",")
return self.list_storage_c... | python | def access_route(self):
"""If a forwarded header exists this is a list of all ip addresses
from the client ip to the last proxy server.
"""
if "HTTP_X_FORWARDED_FOR" in self.environ:
addr = self.environ["HTTP_X_FORWARDED_FOR"].split(",")
return self.list_storage_c... | [
"def",
"access_route",
"(",
"self",
")",
":",
"if",
"\"HTTP_X_FORWARDED_FOR\"",
"in",
"self",
".",
"environ",
":",
"addr",
"=",
"self",
".",
"environ",
"[",
"\"HTTP_X_FORWARDED_FOR\"",
"]",
".",
"split",
"(",
"\",\"",
")",
"return",
"self",
".",
"list_storag... | If a forwarded header exists this is a list of all ip addresses
from the client ip to the last proxy server. | [
"If",
"a",
"forwarded",
"header",
"exists",
"this",
"is",
"a",
"list",
"of",
"all",
"ip",
"addresses",
"from",
"the",
"client",
"ip",
"to",
"the",
"last",
"proxy",
"server",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/wrappers/base_request.py#L611-L620 | train | Returns a list of all ip addresses that are forwarded to the client ip. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | examples/simplewiki/actions.py | on_show | def on_show(request, page_name):
"""Displays the page the user requests."""
revision_id = request.args.get("rev", type=int)
query = RevisionedPage.query.filter_by(name=page_name)
if revision_id:
query = query.filter_by(revision_id=revision_id)
revision_requested = True
else:
... | python | def on_show(request, page_name):
"""Displays the page the user requests."""
revision_id = request.args.get("rev", type=int)
query = RevisionedPage.query.filter_by(name=page_name)
if revision_id:
query = query.filter_by(revision_id=revision_id)
revision_requested = True
else:
... | [
"def",
"on_show",
"(",
"request",
",",
"page_name",
")",
":",
"revision_id",
"=",
"request",
".",
"args",
".",
"get",
"(",
"\"rev\"",
",",
"type",
"=",
"int",
")",
"query",
"=",
"RevisionedPage",
".",
"query",
".",
"filter_by",
"(",
"name",
"=",
"page_... | Displays the page the user requests. | [
"Displays",
"the",
"page",
"the",
"user",
"requests",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/examples/simplewiki/actions.py#L29-L42 | train | Displays the page the user requests. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | examples/simplewiki/actions.py | on_edit | def on_edit(request, page_name):
"""Edit the current revision of a page."""
change_note = error = ""
revision = (
Revision.query.filter(
(Page.name == page_name) & (Page.page_id == Revision.page_id)
)
.order_by(Revision.revision_id.desc())
.first()
)
if re... | python | def on_edit(request, page_name):
"""Edit the current revision of a page."""
change_note = error = ""
revision = (
Revision.query.filter(
(Page.name == page_name) & (Page.page_id == Revision.page_id)
)
.order_by(Revision.revision_id.desc())
.first()
)
if re... | [
"def",
"on_edit",
"(",
"request",
",",
"page_name",
")",
":",
"change_note",
"=",
"error",
"=",
"\"\"",
"revision",
"=",
"(",
"Revision",
".",
"query",
".",
"filter",
"(",
"(",
"Page",
".",
"name",
"==",
"page_name",
")",
"&",
"(",
"Page",
".",
"page... | Edit the current revision of a page. | [
"Edit",
"the",
"current",
"revision",
"of",
"a",
"page",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/examples/simplewiki/actions.py#L45-L85 | train | Edit the current revision of a page. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | examples/simplewiki/actions.py | on_log | def on_log(request, page_name):
"""Show the list of recent changes."""
page = Page.query.filter_by(name=page_name).first()
if page is None:
return page_missing(request, page_name, False)
return Response(generate_template("action_log.html", page=page)) | python | def on_log(request, page_name):
"""Show the list of recent changes."""
page = Page.query.filter_by(name=page_name).first()
if page is None:
return page_missing(request, page_name, False)
return Response(generate_template("action_log.html", page=page)) | [
"def",
"on_log",
"(",
"request",
",",
"page_name",
")",
":",
"page",
"=",
"Page",
".",
"query",
".",
"filter_by",
"(",
"name",
"=",
"page_name",
")",
".",
"first",
"(",
")",
"if",
"page",
"is",
"None",
":",
"return",
"page_missing",
"(",
"request",
"... | Show the list of recent changes. | [
"Show",
"the",
"list",
"of",
"recent",
"changes",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/examples/simplewiki/actions.py#L88-L93 | train | Show the list of recent changes. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | examples/simplewiki/actions.py | on_diff | def on_diff(request, page_name):
"""Show the diff between two revisions."""
old = request.args.get("old", type=int)
new = request.args.get("new", type=int)
error = ""
diff = page = old_rev = new_rev = None
if not (old and new):
error = "No revisions specified."
else:
revisio... | python | def on_diff(request, page_name):
"""Show the diff between two revisions."""
old = request.args.get("old", type=int)
new = request.args.get("new", type=int)
error = ""
diff = page = old_rev = new_rev = None
if not (old and new):
error = "No revisions specified."
else:
revisio... | [
"def",
"on_diff",
"(",
"request",
",",
"page_name",
")",
":",
"old",
"=",
"request",
".",
"args",
".",
"get",
"(",
"\"old\"",
",",
"type",
"=",
"int",
")",
"new",
"=",
"request",
".",
"args",
".",
"get",
"(",
"\"new\"",
",",
"type",
"=",
"int",
"... | Show the diff between two revisions. | [
"Show",
"the",
"diff",
"between",
"two",
"revisions",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/examples/simplewiki/actions.py#L96-L139 | train | Show the diff between two revisions. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | examples/simplewiki/actions.py | on_revert | def on_revert(request, page_name):
"""Revert an old revision."""
rev_id = request.args.get("rev", type=int)
old_revision = page = None
error = "No such revision"
if request.method == "POST" and request.form.get("cancel"):
return redirect(href(page_name))
if rev_id:
old_revisio... | python | def on_revert(request, page_name):
"""Revert an old revision."""
rev_id = request.args.get("rev", type=int)
old_revision = page = None
error = "No such revision"
if request.method == "POST" and request.form.get("cancel"):
return redirect(href(page_name))
if rev_id:
old_revisio... | [
"def",
"on_revert",
"(",
"request",
",",
"page_name",
")",
":",
"rev_id",
"=",
"request",
".",
"args",
".",
"get",
"(",
"\"rev\"",
",",
"type",
"=",
"int",
")",
"old_revision",
"=",
"page",
"=",
"None",
"error",
"=",
"\"No such revision\"",
"if",
"reques... | Revert an old revision. | [
"Revert",
"an",
"old",
"revision",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/examples/simplewiki/actions.py#L142-L188 | train | Revert an old revision. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | examples/simplewiki/actions.py | page_missing | def page_missing(request, page_name, revision_requested, protected=False):
"""Displayed if page or revision does not exist."""
return Response(
generate_template(
"page_missing.html",
page_name=page_name,
revision_requested=revision_requested,
protected=pr... | python | def page_missing(request, page_name, revision_requested, protected=False):
"""Displayed if page or revision does not exist."""
return Response(
generate_template(
"page_missing.html",
page_name=page_name,
revision_requested=revision_requested,
protected=pr... | [
"def",
"page_missing",
"(",
"request",
",",
"page_name",
",",
"revision_requested",
",",
"protected",
"=",
"False",
")",
":",
"return",
"Response",
"(",
"generate_template",
"(",
"\"page_missing.html\"",
",",
"page_name",
"=",
"page_name",
",",
"revision_requested",... | Displayed if page or revision does not exist. | [
"Displayed",
"if",
"page",
"or",
"revision",
"does",
"not",
"exist",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/examples/simplewiki/actions.py#L191-L201 | train | Displayed if page or revision does not exist. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
pallets/werkzeug | examples/manage-shorty.py | shell | def shell(no_ipython):
"""Start a new interactive python session."""
banner = "Interactive Werkzeug Shell"
namespace = make_shell()
if not no_ipython:
try:
try:
from IPython.frontend.terminal.embed import InteractiveShellEmbed
sh = InteractiveShellEmb... | python | def shell(no_ipython):
"""Start a new interactive python session."""
banner = "Interactive Werkzeug Shell"
namespace = make_shell()
if not no_ipython:
try:
try:
from IPython.frontend.terminal.embed import InteractiveShellEmbed
sh = InteractiveShellEmb... | [
"def",
"shell",
"(",
"no_ipython",
")",
":",
"banner",
"=",
"\"Interactive Werkzeug Shell\"",
"namespace",
"=",
"make_shell",
"(",
")",
"if",
"not",
"no_ipython",
":",
"try",
":",
"try",
":",
"from",
"IPython",
".",
"frontend",
".",
"terminal",
".",
"embed",... | Start a new interactive python session. | [
"Start",
"a",
"new",
"interactive",
"python",
"session",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/examples/manage-shorty.py#L60-L81 | train | Start a new interactive python session. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/schema.py | _get_fields | def _get_fields(attrs, field_class, pop=False, ordered=False):
"""Get fields from a class. If ordered=True, fields will sorted by creation index.
:param attrs: Mapping of class attributes
:param type field_class: Base field class
:param bool pop: Remove matching fields
"""
fields = [
(f... | python | def _get_fields(attrs, field_class, pop=False, ordered=False):
"""Get fields from a class. If ordered=True, fields will sorted by creation index.
:param attrs: Mapping of class attributes
:param type field_class: Base field class
:param bool pop: Remove matching fields
"""
fields = [
(f... | [
"def",
"_get_fields",
"(",
"attrs",
",",
"field_class",
",",
"pop",
"=",
"False",
",",
"ordered",
"=",
"False",
")",
":",
"fields",
"=",
"[",
"(",
"field_name",
",",
"field_value",
")",
"for",
"field_name",
",",
"field_value",
"in",
"iteritems",
"(",
"at... | Get fields from a class. If ordered=True, fields will sorted by creation index.
:param attrs: Mapping of class attributes
:param type field_class: Base field class
:param bool pop: Remove matching fields | [
"Get",
"fields",
"from",
"a",
"class",
".",
"If",
"ordered",
"=",
"True",
"fields",
"will",
"sorted",
"by",
"creation",
"index",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/schema.py#L35-L52 | train | Get all the fields from a class. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/schema.py | _get_fields_by_mro | def _get_fields_by_mro(klass, field_class, ordered=False):
"""Collect fields from a class, following its method resolution order. The
class itself is excluded from the search; only its parents are checked. Get
fields from ``_declared_fields`` if available, else use ``__dict__``.
:param type klass: Clas... | python | def _get_fields_by_mro(klass, field_class, ordered=False):
"""Collect fields from a class, following its method resolution order. The
class itself is excluded from the search; only its parents are checked. Get
fields from ``_declared_fields`` if available, else use ``__dict__``.
:param type klass: Clas... | [
"def",
"_get_fields_by_mro",
"(",
"klass",
",",
"field_class",
",",
"ordered",
"=",
"False",
")",
":",
"mro",
"=",
"inspect",
".",
"getmro",
"(",
"klass",
")",
"# Loop over mro in reverse to maintain correct order of fields",
"return",
"sum",
"(",
"(",
"_get_fields"... | Collect fields from a class, following its method resolution order. The
class itself is excluded from the search; only its parents are checked. Get
fields from ``_declared_fields`` if available, else use ``__dict__``.
:param type klass: Class whose fields to retrieve
:param type field_class: Base field... | [
"Collect",
"fields",
"from",
"a",
"class",
"following",
"its",
"method",
"resolution",
"order",
".",
"The",
"class",
"itself",
"is",
"excluded",
"from",
"the",
"search",
";",
"only",
"its",
"parents",
"are",
"checked",
".",
"Get",
"fields",
"from",
"_declare... | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/schema.py#L56-L76 | train | Collect fields from a class following its method resolution order. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/schema.py | SchemaMeta.resolve_hooks | def resolve_hooks(self):
"""Add in the decorated processors
By doing this after constructing the class, we let standard inheritance
do all the hard work.
"""
mro = inspect.getmro(self)
hooks = defaultdict(list)
for attr_name in dir(self):
# Need to ... | python | def resolve_hooks(self):
"""Add in the decorated processors
By doing this after constructing the class, we let standard inheritance
do all the hard work.
"""
mro = inspect.getmro(self)
hooks = defaultdict(list)
for attr_name in dir(self):
# Need to ... | [
"def",
"resolve_hooks",
"(",
"self",
")",
":",
"mro",
"=",
"inspect",
".",
"getmro",
"(",
"self",
")",
"hooks",
"=",
"defaultdict",
"(",
"list",
")",
"for",
"attr_name",
"in",
"dir",
"(",
"self",
")",
":",
"# Need to look up the actual descriptor, not whatever... | Add in the decorated processors
By doing this after constructing the class, we let standard inheritance
do all the hard work. | [
"Add",
"in",
"the",
"decorated",
"processors"
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/schema.py#L144-L181 | train | Add in the decorated processors
By doing this by adding in the decorated processors
| Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/schema.py | BaseSchema._call_and_store | def _call_and_store(getter_func, data, field_name, error_store, index=None):
"""Call ``getter_func`` with ``data`` as its argument, and store any `ValidationErrors`.
:param callable getter_func: Function for getting the serialized/deserialized
value from ``data``.
:param data: The d... | python | def _call_and_store(getter_func, data, field_name, error_store, index=None):
"""Call ``getter_func`` with ``data`` as its argument, and store any `ValidationErrors`.
:param callable getter_func: Function for getting the serialized/deserialized
value from ``data``.
:param data: The d... | [
"def",
"_call_and_store",
"(",
"getter_func",
",",
"data",
",",
"field_name",
",",
"error_store",
",",
"index",
"=",
"None",
")",
":",
"try",
":",
"value",
"=",
"getter_func",
"(",
"data",
")",
"except",
"ValidationError",
"as",
"err",
":",
"error_store",
... | Call ``getter_func`` with ``data`` as its argument, and store any `ValidationErrors`.
:param callable getter_func: Function for getting the serialized/deserialized
value from ``data``.
:param data: The data passed to ``getter_func``.
:param str field_name: Field name.
:param... | [
"Call",
"getter_func",
"with",
"data",
"as",
"its",
"argument",
"and",
"store",
"any",
"ValidationErrors",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/schema.py#L416-L433 | train | Calls the getter_func with data as its argument and stores any ValidationErrors. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/schema.py | BaseSchema._serialize | def _serialize(
self, obj, fields_dict, error_store, many=False,
accessor=None, dict_class=dict, index_errors=True,
index=None,
):
"""Takes raw data (a dict, list, or other object) and a dict of
fields to output and serializes the data based on those fields.
:param o... | python | def _serialize(
self, obj, fields_dict, error_store, many=False,
accessor=None, dict_class=dict, index_errors=True,
index=None,
):
"""Takes raw data (a dict, list, or other object) and a dict of
fields to output and serializes the data based on those fields.
:param o... | [
"def",
"_serialize",
"(",
"self",
",",
"obj",
",",
"fields_dict",
",",
"error_store",
",",
"many",
"=",
"False",
",",
"accessor",
"=",
"None",
",",
"dict_class",
"=",
"dict",
",",
"index_errors",
"=",
"True",
",",
"index",
"=",
"None",
",",
")",
":",
... | Takes raw data (a dict, list, or other object) and a dict of
fields to output and serializes the data based on those fields.
:param obj: The actual object(s) from which the fields are taken from
:param dict fields_dict: Mapping of field names to :class:`Field` objects.
:param ErrorStore... | [
"Takes",
"raw",
"data",
"(",
"a",
"dict",
"list",
"or",
"other",
"object",
")",
"and",
"a",
"dict",
"of",
"fields",
"to",
"output",
"and",
"serializes",
"the",
"data",
"based",
"on",
"those",
"fields",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/schema.py#L435-L489 | train | Serializes the raw data of the current object into a list of the items that are stored in the internal state. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/schema.py | BaseSchema.dump | def dump(self, obj, many=None):
"""Serialize an object to native Python data types according to this
Schema's fields.
:param obj: The object to serialize.
:param bool many: Whether to serialize `obj` as a collection. If `None`, the value
for `self.many` is used.
:ret... | python | def dump(self, obj, many=None):
"""Serialize an object to native Python data types according to this
Schema's fields.
:param obj: The object to serialize.
:param bool many: Whether to serialize `obj` as a collection. If `None`, the value
for `self.many` is used.
:ret... | [
"def",
"dump",
"(",
"self",
",",
"obj",
",",
"many",
"=",
"None",
")",
":",
"error_store",
"=",
"ErrorStore",
"(",
")",
"errors",
"=",
"{",
"}",
"many",
"=",
"self",
".",
"many",
"if",
"many",
"is",
"None",
"else",
"bool",
"(",
"many",
")",
"if",... | Serialize an object to native Python data types according to this
Schema's fields.
:param obj: The object to serialize.
:param bool many: Whether to serialize `obj` as a collection. If `None`, the value
for `self.many` is used.
:return: A dict of serialized data
:rty... | [
"Serialize",
"an",
"object",
"to",
"native",
"Python",
"data",
"types",
"according",
"to",
"this",
"Schema",
"s",
"fields",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/schema.py#L491-L559 | train | Serialize an object to native Python data types according to this schema s fields. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/schema.py | BaseSchema.dumps | def dumps(self, obj, many=None, *args, **kwargs):
"""Same as :meth:`dump`, except return a JSON-encoded string.
:param obj: The object to serialize.
:param bool many: Whether to serialize `obj` as a collection. If `None`, the value
for `self.many` is used.
:return: A ``json`... | python | def dumps(self, obj, many=None, *args, **kwargs):
"""Same as :meth:`dump`, except return a JSON-encoded string.
:param obj: The object to serialize.
:param bool many: Whether to serialize `obj` as a collection. If `None`, the value
for `self.many` is used.
:return: A ``json`... | [
"def",
"dumps",
"(",
"self",
",",
"obj",
",",
"many",
"=",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"serialized",
"=",
"self",
".",
"dump",
"(",
"obj",
",",
"many",
"=",
"many",
")",
"return",
"self",
".",
"opts",
".",
"rend... | Same as :meth:`dump`, except return a JSON-encoded string.
:param obj: The object to serialize.
:param bool many: Whether to serialize `obj` as a collection. If `None`, the value
for `self.many` is used.
:return: A ``json`` string
:rtype: str
.. versionadded:: 1.0.0... | [
"Same",
"as",
":",
"meth",
":",
"dump",
"except",
"return",
"a",
"JSON",
"-",
"encoded",
"string",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/schema.py#L561-L577 | train | Same as dump except return a JSON - encoded string. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/schema.py | BaseSchema._deserialize | def _deserialize(
self, data, fields_dict, error_store, many=False, partial=False,
unknown=RAISE, dict_class=dict, index_errors=True, index=None,
):
"""Deserialize ``data`` based on the schema defined by ``fields_dict``.
:param dict data: The data to deserialize.
:param dict... | python | def _deserialize(
self, data, fields_dict, error_store, many=False, partial=False,
unknown=RAISE, dict_class=dict, index_errors=True, index=None,
):
"""Deserialize ``data`` based on the schema defined by ``fields_dict``.
:param dict data: The data to deserialize.
:param dict... | [
"def",
"_deserialize",
"(",
"self",
",",
"data",
",",
"fields_dict",
",",
"error_store",
",",
"many",
"=",
"False",
",",
"partial",
"=",
"False",
",",
"unknown",
"=",
"RAISE",
",",
"dict_class",
"=",
"dict",
",",
"index_errors",
"=",
"True",
",",
"index"... | Deserialize ``data`` based on the schema defined by ``fields_dict``.
:param dict data: The data to deserialize.
:param dict fields_dict: Mapping of field names to :class:`Field` objects.
:param ErrorStore error_store: Structure to store errors.
:param bool many: Set to `True` if ``data`... | [
"Deserialize",
"data",
"based",
"on",
"the",
"schema",
"defined",
"by",
"fields_dict",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/schema.py#L579-L682 | train | Deserializes the data according to the schema defined by fields_dict. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/schema.py | BaseSchema.load | def load(self, data, many=None, partial=None, unknown=None):
"""Deserialize a data structure to an object defined by this Schema's fields.
:param dict data: The data to deserialize.
:param bool many: Whether to deserialize `data` as a collection. If `None`, the
value for `self.many`... | python | def load(self, data, many=None, partial=None, unknown=None):
"""Deserialize a data structure to an object defined by this Schema's fields.
:param dict data: The data to deserialize.
:param bool many: Whether to deserialize `data` as a collection. If `None`, the
value for `self.many`... | [
"def",
"load",
"(",
"self",
",",
"data",
",",
"many",
"=",
"None",
",",
"partial",
"=",
"None",
",",
"unknown",
"=",
"None",
")",
":",
"return",
"self",
".",
"_do_load",
"(",
"data",
",",
"many",
",",
"partial",
"=",
"partial",
",",
"unknown",
"=",... | Deserialize a data structure to an object defined by this Schema's fields.
:param dict data: The data to deserialize.
:param bool many: Whether to deserialize `data` as a collection. If `None`, the
value for `self.many` is used.
:param bool|tuple partial: Whether to ignore missing f... | [
"Deserialize",
"a",
"data",
"structure",
"to",
"an",
"object",
"defined",
"by",
"this",
"Schema",
"s",
"fields",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/schema.py#L684-L709 | train | Deserialize a data structure to an object defined by this Schema s fields. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/schema.py | BaseSchema.loads | def loads(
self, json_data, many=None, partial=None, unknown=None,
**kwargs
):
"""Same as :meth:`load`, except it takes a JSON string as input.
:param str json_data: A JSON string of the data to deserialize.
:param bool many: Whether to deserialize `obj` as a collection. If ... | python | def loads(
self, json_data, many=None, partial=None, unknown=None,
**kwargs
):
"""Same as :meth:`load`, except it takes a JSON string as input.
:param str json_data: A JSON string of the data to deserialize.
:param bool many: Whether to deserialize `obj` as a collection. If ... | [
"def",
"loads",
"(",
"self",
",",
"json_data",
",",
"many",
"=",
"None",
",",
"partial",
"=",
"None",
",",
"unknown",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"data",
"=",
"self",
".",
"opts",
".",
"render_module",
".",
"loads",
"(",
"json_d... | Same as :meth:`load`, except it takes a JSON string as input.
:param str json_data: A JSON string of the data to deserialize.
:param bool many: Whether to deserialize `obj` as a collection. If `None`, the
value for `self.many` is used.
:param bool|tuple partial: Whether to ignore mi... | [
"Same",
"as",
":",
"meth",
":",
"load",
"except",
"it",
"takes",
"a",
"JSON",
"string",
"as",
"input",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/schema.py#L711-L737 | train | This method loads the data from a JSON string into a dict. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/schema.py | BaseSchema.validate | def validate(self, data, many=None, partial=None):
"""Validate `data` against the schema, returning a dictionary of
validation errors.
:param dict data: The data to validate.
:param bool many: Whether to validate `data` as a collection. If `None`, the
value for `self.many` i... | python | def validate(self, data, many=None, partial=None):
"""Validate `data` against the schema, returning a dictionary of
validation errors.
:param dict data: The data to validate.
:param bool many: Whether to validate `data` as a collection. If `None`, the
value for `self.many` i... | [
"def",
"validate",
"(",
"self",
",",
"data",
",",
"many",
"=",
"None",
",",
"partial",
"=",
"None",
")",
":",
"try",
":",
"self",
".",
"_do_load",
"(",
"data",
",",
"many",
",",
"partial",
"=",
"partial",
",",
"postprocess",
"=",
"False",
")",
"exc... | Validate `data` against the schema, returning a dictionary of
validation errors.
:param dict data: The data to validate.
:param bool many: Whether to validate `data` as a collection. If `None`, the
value for `self.many` is used.
:param bool|tuple partial: Whether to ignore m... | [
"Validate",
"data",
"against",
"the",
"schema",
"returning",
"a",
"dictionary",
"of",
"validation",
"errors",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/schema.py#L752-L772 | train | Validate the data against the schema of the object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/schema.py | BaseSchema._do_load | def _do_load(
self, data, many=None, partial=None, unknown=None,
postprocess=True,
):
"""Deserialize `data`, returning the deserialized result.
:param data: The data to deserialize.
:param bool many: Whether to deserialize `data` as a collection. If `None`, the
v... | python | def _do_load(
self, data, many=None, partial=None, unknown=None,
postprocess=True,
):
"""Deserialize `data`, returning the deserialized result.
:param data: The data to deserialize.
:param bool many: Whether to deserialize `data` as a collection. If `None`, the
v... | [
"def",
"_do_load",
"(",
"self",
",",
"data",
",",
"many",
"=",
"None",
",",
"partial",
"=",
"None",
",",
"unknown",
"=",
"None",
",",
"postprocess",
"=",
"True",
",",
")",
":",
"error_store",
"=",
"ErrorStore",
"(",
")",
"errors",
"=",
"{",
"}",
"m... | Deserialize `data`, returning the deserialized result.
:param data: The data to deserialize.
:param bool many: Whether to deserialize `data` as a collection. If `None`, the
value for `self.many` is used.
:param bool|tuple partial: Whether to validate required fields. If its value is... | [
"Deserialize",
"data",
"returning",
"the",
"deserialized",
"result",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/schema.py#L776-L870 | train | Deserialize data returning the deserialized result. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/schema.py | BaseSchema._normalize_nested_options | def _normalize_nested_options(self):
"""Apply then flatten nested schema options"""
if self.only is not None:
# Apply the only option to nested fields.
self.__apply_nested_option('only', self.only, 'intersection')
# Remove the child field names from the only option.
... | python | def _normalize_nested_options(self):
"""Apply then flatten nested schema options"""
if self.only is not None:
# Apply the only option to nested fields.
self.__apply_nested_option('only', self.only, 'intersection')
# Remove the child field names from the only option.
... | [
"def",
"_normalize_nested_options",
"(",
"self",
")",
":",
"if",
"self",
".",
"only",
"is",
"not",
"None",
":",
"# Apply the only option to nested fields.",
"self",
".",
"__apply_nested_option",
"(",
"'only'",
",",
"self",
".",
"only",
",",
"'intersection'",
")",
... | Apply then flatten nested schema options | [
"Apply",
"then",
"flatten",
"nested",
"schema",
"options"
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/schema.py#L872-L894 | train | Apply then flatten nested schema options | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/schema.py | BaseSchema.__apply_nested_option | def __apply_nested_option(self, option_name, field_names, set_operation):
"""Apply nested options to nested fields"""
# Split nested field names on the first dot.
nested_fields = [name.split('.', 1) for name in field_names if '.' in name]
# Partition the nested field names by parent fiel... | python | def __apply_nested_option(self, option_name, field_names, set_operation):
"""Apply nested options to nested fields"""
# Split nested field names on the first dot.
nested_fields = [name.split('.', 1) for name in field_names if '.' in name]
# Partition the nested field names by parent fiel... | [
"def",
"__apply_nested_option",
"(",
"self",
",",
"option_name",
",",
"field_names",
",",
"set_operation",
")",
":",
"# Split nested field names on the first dot.",
"nested_fields",
"=",
"[",
"name",
".",
"split",
"(",
"'.'",
",",
"1",
")",
"for",
"name",
"in",
... | Apply nested options to nested fields | [
"Apply",
"nested",
"options",
"to",
"nested",
"fields"
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/schema.py#L896-L913 | train | Applies nested options to nested fields. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/schema.py | BaseSchema._init_fields | def _init_fields(self):
"""Update fields based on schema options."""
if self.opts.fields:
available_field_names = self.set_class(self.opts.fields)
else:
available_field_names = self.set_class(self.declared_fields.keys())
if self.opts.additional:
... | python | def _init_fields(self):
"""Update fields based on schema options."""
if self.opts.fields:
available_field_names = self.set_class(self.opts.fields)
else:
available_field_names = self.set_class(self.declared_fields.keys())
if self.opts.additional:
... | [
"def",
"_init_fields",
"(",
"self",
")",
":",
"if",
"self",
".",
"opts",
".",
"fields",
":",
"available_field_names",
"=",
"self",
".",
"set_class",
"(",
"self",
".",
"opts",
".",
"fields",
")",
"else",
":",
"available_field_names",
"=",
"self",
".",
"se... | Update fields based on schema options. | [
"Update",
"fields",
"based",
"on",
"schema",
"options",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/schema.py#L915-L977 | train | Initialize the fields based on the schema options. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/schema.py | BaseSchema._bind_field | def _bind_field(self, field_name, field_obj):
"""Bind field to the schema, setting any necessary attributes on the
field (e.g. parent and name).
Also set field load_only and dump_only values if field_name was
specified in ``class Meta``.
"""
try:
if field_nam... | python | def _bind_field(self, field_name, field_obj):
"""Bind field to the schema, setting any necessary attributes on the
field (e.g. parent and name).
Also set field load_only and dump_only values if field_name was
specified in ``class Meta``.
"""
try:
if field_nam... | [
"def",
"_bind_field",
"(",
"self",
",",
"field_name",
",",
"field_obj",
")",
":",
"try",
":",
"if",
"field_name",
"in",
"self",
".",
"load_only",
":",
"field_obj",
".",
"load_only",
"=",
"True",
"if",
"field_name",
"in",
"self",
".",
"dump_only",
":",
"f... | Bind field to the schema, setting any necessary attributes on the
field (e.g. parent and name).
Also set field load_only and dump_only values if field_name was
specified in ``class Meta``. | [
"Bind",
"field",
"to",
"the",
"schema",
"setting",
"any",
"necessary",
"attributes",
"on",
"the",
"field",
"(",
"e",
".",
"g",
".",
"parent",
"and",
"name",
")",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/schema.py#L986-L1008 | train | Bind a field to the schema. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/decorators.py | validates_schema | def validates_schema(
fn=None,
pass_many=False,
pass_original=False,
skip_on_field_errors=True,
):
"""Register a schema-level validator.
By default, receives a single object at a time, regardless of whether ``many=True``
is passed to the `Schema`. If ``pass_many=True``, the raw data (which ... | python | def validates_schema(
fn=None,
pass_many=False,
pass_original=False,
skip_on_field_errors=True,
):
"""Register a schema-level validator.
By default, receives a single object at a time, regardless of whether ``many=True``
is passed to the `Schema`. If ``pass_many=True``, the raw data (which ... | [
"def",
"validates_schema",
"(",
"fn",
"=",
"None",
",",
"pass_many",
"=",
"False",
",",
"pass_original",
"=",
"False",
",",
"skip_on_field_errors",
"=",
"True",
",",
")",
":",
"return",
"set_hook",
"(",
"fn",
",",
"(",
"VALIDATES_SCHEMA",
",",
"pass_many",
... | Register a schema-level validator.
By default, receives a single object at a time, regardless of whether ``many=True``
is passed to the `Schema`. If ``pass_many=True``, the raw data (which may be a collection)
and the value for ``many`` is passed.
If ``pass_original=True``, the original data (before u... | [
"Register",
"a",
"schema",
"-",
"level",
"validator",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/decorators.py#L72-L98 | train | Register a schema - level validator. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/decorators.py | post_dump | def post_dump(fn=None, pass_many=False, pass_original=False):
"""Register a method to invoke after serializing an object. The method
receives the serialized object and returns the processed object.
By default, receives a single object at a time, transparently handling the ``many``
argument passed to th... | python | def post_dump(fn=None, pass_many=False, pass_original=False):
"""Register a method to invoke after serializing an object. The method
receives the serialized object and returns the processed object.
By default, receives a single object at a time, transparently handling the ``many``
argument passed to th... | [
"def",
"post_dump",
"(",
"fn",
"=",
"None",
",",
"pass_many",
"=",
"False",
",",
"pass_original",
"=",
"False",
")",
":",
"return",
"set_hook",
"(",
"fn",
",",
"(",
"POST_DUMP",
",",
"pass_many",
")",
",",
"pass_original",
"=",
"pass_original",
")"
] | Register a method to invoke after serializing an object. The method
receives the serialized object and returns the processed object.
By default, receives a single object at a time, transparently handling the ``many``
argument passed to the Schema. If ``pass_many=True``, the raw data
(which may be a col... | [
"Register",
"a",
"method",
"to",
"invoke",
"after",
"serializing",
"an",
"object",
".",
"The",
"method",
"receives",
"the",
"serialized",
"object",
"and",
"returns",
"the",
"processed",
"object",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/decorators.py#L112-L123 | train | Register a method to invoke after serializing an object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/decorators.py | post_load | def post_load(fn=None, pass_many=False, pass_original=False):
"""Register a method to invoke after deserializing an object. The method
receives the deserialized data and returns the processed data.
By default, receives a single datum at a time, transparently handling the ``many``
argument passed to the... | python | def post_load(fn=None, pass_many=False, pass_original=False):
"""Register a method to invoke after deserializing an object. The method
receives the deserialized data and returns the processed data.
By default, receives a single datum at a time, transparently handling the ``many``
argument passed to the... | [
"def",
"post_load",
"(",
"fn",
"=",
"None",
",",
"pass_many",
"=",
"False",
",",
"pass_original",
"=",
"False",
")",
":",
"return",
"set_hook",
"(",
"fn",
",",
"(",
"POST_LOAD",
",",
"pass_many",
")",
",",
"pass_original",
"=",
"pass_original",
")"
] | Register a method to invoke after deserializing an object. The method
receives the deserialized data and returns the processed data.
By default, receives a single datum at a time, transparently handling the ``many``
argument passed to the Schema. If ``pass_many=True``, the raw data
(which may be a coll... | [
"Register",
"a",
"method",
"to",
"invoke",
"after",
"deserializing",
"an",
"object",
".",
"The",
"method",
"receives",
"the",
"deserialized",
"data",
"and",
"returns",
"the",
"processed",
"data",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/decorators.py#L137-L148 | train | Register a method to invoke after deserializing an object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/decorators.py | set_hook | def set_hook(fn, key, **kwargs):
"""Mark decorated function as a hook to be picked up later.
.. note::
Currently only works with functions and instance methods. Class and
static methods are not supported.
:return: Decorated function if supplied, else this decorator with its args
bo... | python | def set_hook(fn, key, **kwargs):
"""Mark decorated function as a hook to be picked up later.
.. note::
Currently only works with functions and instance methods. Class and
static methods are not supported.
:return: Decorated function if supplied, else this decorator with its args
bo... | [
"def",
"set_hook",
"(",
"fn",
",",
"key",
",",
"*",
"*",
"kwargs",
")",
":",
"# Allow using this as either a decorator or a decorator factory.",
"if",
"fn",
"is",
"None",
":",
"return",
"functools",
".",
"partial",
"(",
"set_hook",
",",
"key",
"=",
"key",
",",... | Mark decorated function as a hook to be picked up later.
.. note::
Currently only works with functions and instance methods. Class and
static methods are not supported.
:return: Decorated function if supplied, else this decorator with its args
bound. | [
"Mark",
"decorated",
"function",
"as",
"a",
"hook",
"to",
"be",
"picked",
"up",
"later",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/decorators.py#L151-L175 | train | Mark the decorated function as a hook to be picked up later. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/validate.py | OneOf.options | def options(self, valuegetter=text_type):
"""Return a generator over the (value, label) pairs, where value
is a string associated with each choice. This convenience method
is useful to populate, for instance, a form select field.
:param valuegetter: Can be a callable or a string. In the... | python | def options(self, valuegetter=text_type):
"""Return a generator over the (value, label) pairs, where value
is a string associated with each choice. This convenience method
is useful to populate, for instance, a form select field.
:param valuegetter: Can be a callable or a string. In the... | [
"def",
"options",
"(",
"self",
",",
"valuegetter",
"=",
"text_type",
")",
":",
"valuegetter",
"=",
"valuegetter",
"if",
"callable",
"(",
"valuegetter",
")",
"else",
"attrgetter",
"(",
"valuegetter",
")",
"pairs",
"=",
"zip_longest",
"(",
"self",
".",
"choice... | Return a generator over the (value, label) pairs, where value
is a string associated with each choice. This convenience method
is useful to populate, for instance, a form select field.
:param valuegetter: Can be a callable or a string. In the former case, it must
be a one-argument c... | [
"Return",
"a",
"generator",
"over",
"the",
"(",
"value",
"label",
")",
"pairs",
"where",
"value",
"is",
"a",
"string",
"associated",
"with",
"each",
"choice",
".",
"This",
"convenience",
"method",
"is",
"useful",
"to",
"populate",
"for",
"instance",
"a",
"... | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/validate.py#L441-L455 | train | Return a generator over the value and label pairs associated with each choice. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/error_store.py | merge_errors | def merge_errors(errors1, errors2):
"""Deeply merge two error messages.
The format of ``errors1`` and ``errors2`` matches the ``message``
parameter of :exc:`marshmallow.exceptions.ValidationError`.
"""
if not errors1:
return errors2
if not errors2:
return errors1
if isinstan... | python | def merge_errors(errors1, errors2):
"""Deeply merge two error messages.
The format of ``errors1`` and ``errors2`` matches the ``message``
parameter of :exc:`marshmallow.exceptions.ValidationError`.
"""
if not errors1:
return errors2
if not errors2:
return errors1
if isinstan... | [
"def",
"merge_errors",
"(",
"errors1",
",",
"errors2",
")",
":",
"if",
"not",
"errors1",
":",
"return",
"errors2",
"if",
"not",
"errors2",
":",
"return",
"errors1",
"if",
"isinstance",
"(",
"errors1",
",",
"list",
")",
":",
"if",
"isinstance",
"(",
"erro... | Deeply merge two error messages.
The format of ``errors1`` and ``errors2`` matches the ``message``
parameter of :exc:`marshmallow.exceptions.ValidationError`. | [
"Deeply",
"merge",
"two",
"error",
"messages",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/error_store.py#L35-L79 | train | Deeply merge two error messages. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/class_registry.py | register | def register(classname, cls):
"""Add a class to the registry of serializer classes. When a class is
registered, an entry for both its classname and its full, module-qualified
path are added to the registry.
Example: ::
class MyClass:
pass
register('MyClass', MyClass)
... | python | def register(classname, cls):
"""Add a class to the registry of serializer classes. When a class is
registered, an entry for both its classname and its full, module-qualified
path are added to the registry.
Example: ::
class MyClass:
pass
register('MyClass', MyClass)
... | [
"def",
"register",
"(",
"classname",
",",
"cls",
")",
":",
"# Module where the class is located",
"module",
"=",
"cls",
".",
"__module__",
"# Full module path to the class",
"# e.g. user.schemas.UserSchema",
"fullpath",
"=",
"'.'",
".",
"join",
"(",
"[",
"module",
","... | Add a class to the registry of serializer classes. When a class is
registered, an entry for both its classname and its full, module-qualified
path are added to the registry.
Example: ::
class MyClass:
pass
register('MyClass', MyClass)
# Registry:
# {
# ... | [
"Add",
"a",
"class",
"to",
"the",
"registry",
"of",
"serializer",
"classes",
".",
"When",
"a",
"class",
"is",
"registered",
"an",
"entry",
"for",
"both",
"its",
"classname",
"and",
"its",
"full",
"module",
"-",
"qualified",
"path",
"are",
"added",
"to",
... | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/class_registry.py#L22-L60 | train | Register a class to the registry of serializer classes. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/class_registry.py | get_class | def get_class(classname, all=False):
"""Retrieve a class from the registry.
:raises: marshmallow.exceptions.RegistryError if the class cannot be found
or if there are multiple entries for the given class name.
"""
try:
classes = _registry[classname]
except KeyError:
raise Re... | python | def get_class(classname, all=False):
"""Retrieve a class from the registry.
:raises: marshmallow.exceptions.RegistryError if the class cannot be found
or if there are multiple entries for the given class name.
"""
try:
classes = _registry[classname]
except KeyError:
raise Re... | [
"def",
"get_class",
"(",
"classname",
",",
"all",
"=",
"False",
")",
":",
"try",
":",
"classes",
"=",
"_registry",
"[",
"classname",
"]",
"except",
"KeyError",
":",
"raise",
"RegistryError",
"(",
"'Class with name {!r} was not found. You may need '",
"'to import the... | Retrieve a class from the registry.
:raises: marshmallow.exceptions.RegistryError if the class cannot be found
or if there are multiple entries for the given class name. | [
"Retrieve",
"a",
"class",
"from",
"the",
"registry",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/class_registry.py#L62-L80 | train | Retrieve a class from the registry. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/fields.py | Field.get_value | def get_value(self, obj, attr, accessor=None, default=missing_):
"""Return the value for a given key from an object.
:param object obj: The object to get the value from
:param str attr: The attribute/key in `obj` to get the value from.
:param callable accessor: A callable used to retrie... | python | def get_value(self, obj, attr, accessor=None, default=missing_):
"""Return the value for a given key from an object.
:param object obj: The object to get the value from
:param str attr: The attribute/key in `obj` to get the value from.
:param callable accessor: A callable used to retrie... | [
"def",
"get_value",
"(",
"self",
",",
"obj",
",",
"attr",
",",
"accessor",
"=",
"None",
",",
"default",
"=",
"missing_",
")",
":",
"# NOTE: Use getattr instead of direct attribute access here so that",
"# subclasses aren't required to define `attribute` member",
"attribute",
... | Return the value for a given key from an object.
:param object obj: The object to get the value from
:param str attr: The attribute/key in `obj` to get the value from.
:param callable accessor: A callable used to retrieve the value of `attr` from
the object `obj`. Defaults to `marsh... | [
"Return",
"the",
"value",
"for",
"a",
"given",
"key",
"from",
"an",
"object",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/fields.py#L204-L217 | train | Get the value for a given key from an object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/fields.py | Field._validate | def _validate(self, value):
"""Perform validation on ``value``. Raise a :exc:`ValidationError` if validation
does not succeed.
"""
errors = []
kwargs = {}
for validator in self.validators:
try:
r = validator(value)
if not isinst... | python | def _validate(self, value):
"""Perform validation on ``value``. Raise a :exc:`ValidationError` if validation
does not succeed.
"""
errors = []
kwargs = {}
for validator in self.validators:
try:
r = validator(value)
if not isinst... | [
"def",
"_validate",
"(",
"self",
",",
"value",
")",
":",
"errors",
"=",
"[",
"]",
"kwargs",
"=",
"{",
"}",
"for",
"validator",
"in",
"self",
".",
"validators",
":",
"try",
":",
"r",
"=",
"validator",
"(",
"value",
")",
"if",
"not",
"isinstance",
"(... | Perform validation on ``value``. Raise a :exc:`ValidationError` if validation
does not succeed. | [
"Perform",
"validation",
"on",
"value",
".",
"Raise",
"a",
":",
"exc",
":",
"ValidationError",
"if",
"validation",
"does",
"not",
"succeed",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/fields.py#L219-L237 | train | Perform validation on value. Raise a ValidationError if validation
does not succeed. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/fields.py | Field._validate_missing | def _validate_missing(self, value):
"""Validate missing values. Raise a :exc:`ValidationError` if
`value` should be considered missing.
"""
if value is missing_:
if hasattr(self, 'required') and self.required:
self.fail('required')
if value is None:
... | python | def _validate_missing(self, value):
"""Validate missing values. Raise a :exc:`ValidationError` if
`value` should be considered missing.
"""
if value is missing_:
if hasattr(self, 'required') and self.required:
self.fail('required')
if value is None:
... | [
"def",
"_validate_missing",
"(",
"self",
",",
"value",
")",
":",
"if",
"value",
"is",
"missing_",
":",
"if",
"hasattr",
"(",
"self",
",",
"'required'",
")",
"and",
"self",
".",
"required",
":",
"self",
".",
"fail",
"(",
"'required'",
")",
"if",
"value"... | Validate missing values. Raise a :exc:`ValidationError` if
`value` should be considered missing. | [
"Validate",
"missing",
"values",
".",
"Raise",
"a",
":",
"exc",
":",
"ValidationError",
"if",
"value",
"should",
"be",
"considered",
"missing",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/fields.py#L253-L262 | train | Validate missing values. Raise a : exc : ValidationException if value is not a valid value. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/fields.py | Field.serialize | def serialize(self, attr, obj, accessor=None, **kwargs):
"""Pulls the value for the given key from the object, applies the
field's formatting and returns the result.
:param str attr: The attribute or key to get from the object.
:param str obj: The object to pull the key from.
:p... | python | def serialize(self, attr, obj, accessor=None, **kwargs):
"""Pulls the value for the given key from the object, applies the
field's formatting and returns the result.
:param str attr: The attribute or key to get from the object.
:param str obj: The object to pull the key from.
:p... | [
"def",
"serialize",
"(",
"self",
",",
"attr",
",",
"obj",
",",
"accessor",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"_CHECK_ATTRIBUTE",
":",
"value",
"=",
"self",
".",
"get_value",
"(",
"obj",
",",
"attr",
",",
"accessor",
... | Pulls the value for the given key from the object, applies the
field's formatting and returns the result.
:param str attr: The attribute or key to get from the object.
:param str obj: The object to pull the key from.
:param callable accessor: Function used to pull values from ``obj``.
... | [
"Pulls",
"the",
"value",
"for",
"the",
"given",
"key",
"from",
"the",
"object",
"applies",
"the",
"field",
"s",
"formatting",
"and",
"returns",
"the",
"result",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/fields.py#L264-L283 | train | Returns the value for the given attribute or key from the object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/fields.py | Field.deserialize | def deserialize(self, value, attr=None, data=None, **kwargs):
"""Deserialize ``value``.
:param value: The value to be deserialized.
:param str attr: The attribute/key in `data` to be deserialized.
:param dict data: The raw input data passed to the `Schema.load`.
:param dict kwar... | python | def deserialize(self, value, attr=None, data=None, **kwargs):
"""Deserialize ``value``.
:param value: The value to be deserialized.
:param str attr: The attribute/key in `data` to be deserialized.
:param dict data: The raw input data passed to the `Schema.load`.
:param dict kwar... | [
"def",
"deserialize",
"(",
"self",
",",
"value",
",",
"attr",
"=",
"None",
",",
"data",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# Validate required fields, deserialize, then validate",
"# deserialized value",
"self",
".",
"_validate_missing",
"(",
"value"... | Deserialize ``value``.
:param value: The value to be deserialized.
:param str attr: The attribute/key in `data` to be deserialized.
:param dict data: The raw input data passed to the `Schema.load`.
:param dict kwargs': Field-specific keyword arguments.
:raise ValidationError: If... | [
"Deserialize",
"value",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/fields.py#L285-L305 | train | Deserialize the value into a dictionary. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/fields.py | Field._bind_to_schema | def _bind_to_schema(self, field_name, schema):
"""Update field with values from its parent schema. Called by
:meth:`_bind_field<marshmallow.Schema._bind_field>`.
:param str field_name: Field name set in schema.
:param Schema schema: Parent schema.
"""
self.parent = s... | python | def _bind_to_schema(self, field_name, schema):
"""Update field with values from its parent schema. Called by
:meth:`_bind_field<marshmallow.Schema._bind_field>`.
:param str field_name: Field name set in schema.
:param Schema schema: Parent schema.
"""
self.parent = s... | [
"def",
"_bind_to_schema",
"(",
"self",
",",
"field_name",
",",
"schema",
")",
":",
"self",
".",
"parent",
"=",
"self",
".",
"parent",
"or",
"schema",
"self",
".",
"name",
"=",
"self",
".",
"name",
"or",
"field_name"
] | Update field with values from its parent schema. Called by
:meth:`_bind_field<marshmallow.Schema._bind_field>`.
:param str field_name: Field name set in schema.
:param Schema schema: Parent schema. | [
"Update",
"field",
"with",
"values",
"from",
"its",
"parent",
"schema",
".",
"Called",
"by",
":",
"meth",
":",
"_bind_field<marshmallow",
".",
"Schema",
".",
"_bind_field",
">",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/fields.py#L309-L317 | train | Bind values from its parent schema to the given field. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/fields.py | Field.root | def root(self):
"""Reference to the `Schema` that this field belongs to even if it is buried in a `List`.
Return `None` for unbound fields.
"""
ret = self
while hasattr(ret, 'parent') and ret.parent:
ret = ret.parent
return ret if isinstance(ret, SchemaABC) el... | python | def root(self):
"""Reference to the `Schema` that this field belongs to even if it is buried in a `List`.
Return `None` for unbound fields.
"""
ret = self
while hasattr(ret, 'parent') and ret.parent:
ret = ret.parent
return ret if isinstance(ret, SchemaABC) el... | [
"def",
"root",
"(",
"self",
")",
":",
"ret",
"=",
"self",
"while",
"hasattr",
"(",
"ret",
",",
"'parent'",
")",
"and",
"ret",
".",
"parent",
":",
"ret",
"=",
"ret",
".",
"parent",
"return",
"ret",
"if",
"isinstance",
"(",
"ret",
",",
"SchemaABC",
"... | Reference to the `Schema` that this field belongs to even if it is buried in a `List`.
Return `None` for unbound fields. | [
"Reference",
"to",
"the",
"Schema",
"that",
"this",
"field",
"belongs",
"to",
"even",
"if",
"it",
"is",
"buried",
"in",
"a",
"List",
".",
"Return",
"None",
"for",
"unbound",
"fields",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/fields.py#L366-L373 | train | Reference to the root schema that this field belongs to even if it is buried in a List. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/fields.py | Nested.schema | def schema(self):
"""The nested Schema object.
.. versionchanged:: 1.0.0
Renamed from `serializer` to `schema`
"""
if not self.__schema:
# Inherit context from parent.
context = getattr(self.parent, 'context', {})
if isinstance(self.nested... | python | def schema(self):
"""The nested Schema object.
.. versionchanged:: 1.0.0
Renamed from `serializer` to `schema`
"""
if not self.__schema:
# Inherit context from parent.
context = getattr(self.parent, 'context', {})
if isinstance(self.nested... | [
"def",
"schema",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"__schema",
":",
"# Inherit context from parent.",
"context",
"=",
"getattr",
"(",
"self",
".",
"parent",
",",
"'context'",
",",
"{",
"}",
")",
"if",
"isinstance",
"(",
"self",
".",
"neste... | The nested Schema object.
.. versionchanged:: 1.0.0
Renamed from `serializer` to `schema` | [
"The",
"nested",
"Schema",
"object",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/fields.py#L435-L467 | train | The nested Schema object. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/fields.py | Nested._deserialize | def _deserialize(self, value, attr, data, partial=None, **kwargs):
"""Same as :meth:`Field._deserialize` with additional ``partial`` argument.
:param bool|tuple partial: For nested schemas, the ``partial``
parameter passed to `Schema.load`.
.. versionchanged:: 3.0.0
Add... | python | def _deserialize(self, value, attr, data, partial=None, **kwargs):
"""Same as :meth:`Field._deserialize` with additional ``partial`` argument.
:param bool|tuple partial: For nested schemas, the ``partial``
parameter passed to `Schema.load`.
.. versionchanged:: 3.0.0
Add... | [
"def",
"_deserialize",
"(",
"self",
",",
"value",
",",
"attr",
",",
"data",
",",
"partial",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_test_collection",
"(",
"value",
")",
"return",
"self",
".",
"_load",
"(",
"value",
",",
"data",... | Same as :meth:`Field._deserialize` with additional ``partial`` argument.
:param bool|tuple partial: For nested schemas, the ``partial``
parameter passed to `Schema.load`.
.. versionchanged:: 3.0.0
Add ``partial`` parameter | [
"Same",
"as",
":",
"meth",
":",
"Field",
".",
"_deserialize",
"with",
"additional",
"partial",
"argument",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/fields.py#L499-L509 | train | Same as field. _deserialize but checks that the value is a valid record. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/fields.py | UUID._validated | def _validated(self, value):
"""Format the value or raise a :exc:`ValidationError` if an error occurs."""
if value is None:
return None
if isinstance(value, uuid.UUID):
return value
try:
if isinstance(value, bytes) and len(value) == 16:
... | python | def _validated(self, value):
"""Format the value or raise a :exc:`ValidationError` if an error occurs."""
if value is None:
return None
if isinstance(value, uuid.UUID):
return value
try:
if isinstance(value, bytes) and len(value) == 16:
... | [
"def",
"_validated",
"(",
"self",
",",
"value",
")",
":",
"if",
"value",
"is",
"None",
":",
"return",
"None",
"if",
"isinstance",
"(",
"value",
",",
"uuid",
".",
"UUID",
")",
":",
"return",
"value",
"try",
":",
"if",
"isinstance",
"(",
"value",
",",
... | Format the value or raise a :exc:`ValidationError` if an error occurs. | [
"Format",
"the",
"value",
"or",
"raise",
"a",
":",
"exc",
":",
"ValidationError",
"if",
"an",
"error",
"occurs",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/fields.py#L728-L740 | train | Format the value or raise a : exc : ValidationException. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/fields.py | Number._format_num | def _format_num(self, value):
"""Return the number value for value, given this field's `num_type`."""
# (value is True or value is False) is ~5x faster than isinstance(value, bool)
if value is True or value is False:
raise TypeError('value must be a Number, not a boolean.')
r... | python | def _format_num(self, value):
"""Return the number value for value, given this field's `num_type`."""
# (value is True or value is False) is ~5x faster than isinstance(value, bool)
if value is True or value is False:
raise TypeError('value must be a Number, not a boolean.')
r... | [
"def",
"_format_num",
"(",
"self",
",",
"value",
")",
":",
"# (value is True or value is False) is ~5x faster than isinstance(value, bool)",
"if",
"value",
"is",
"True",
"or",
"value",
"is",
"False",
":",
"raise",
"TypeError",
"(",
"'value must be a Number, not a boolean.'"... | Return the number value for value, given this field's `num_type`. | [
"Return",
"the",
"number",
"value",
"for",
"value",
"given",
"this",
"field",
"s",
"num_type",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/fields.py#L767-L772 | train | Return the number value for value given this field s num_type. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/fields.py | Number._validated | def _validated(self, value):
"""Format the value or raise a :exc:`ValidationError` if an error occurs."""
if value is None:
return None
try:
return self._format_num(value)
except (TypeError, ValueError):
self.fail('invalid', input=value)
except... | python | def _validated(self, value):
"""Format the value or raise a :exc:`ValidationError` if an error occurs."""
if value is None:
return None
try:
return self._format_num(value)
except (TypeError, ValueError):
self.fail('invalid', input=value)
except... | [
"def",
"_validated",
"(",
"self",
",",
"value",
")",
":",
"if",
"value",
"is",
"None",
":",
"return",
"None",
"try",
":",
"return",
"self",
".",
"_format_num",
"(",
"value",
")",
"except",
"(",
"TypeError",
",",
"ValueError",
")",
":",
"self",
".",
"... | Format the value or raise a :exc:`ValidationError` if an error occurs. | [
"Format",
"the",
"value",
"or",
"raise",
"a",
":",
"exc",
":",
"ValidationError",
"if",
"an",
"error",
"occurs",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/fields.py#L774-L783 | train | Format the value or raise a : exc : ValidationException. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
marshmallow-code/marshmallow | src/marshmallow/fields.py | Number._serialize | def _serialize(self, value, attr, obj, **kwargs):
"""Return a string if `self.as_string=True`, otherwise return this field's `num_type`."""
ret = self._validated(value)
return (
self._to_string(ret)
if (self.as_string and ret not in (None, missing_))
else ret
... | python | def _serialize(self, value, attr, obj, **kwargs):
"""Return a string if `self.as_string=True`, otherwise return this field's `num_type`."""
ret = self._validated(value)
return (
self._to_string(ret)
if (self.as_string and ret not in (None, missing_))
else ret
... | [
"def",
"_serialize",
"(",
"self",
",",
"value",
",",
"attr",
",",
"obj",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"self",
".",
"_validated",
"(",
"value",
")",
"return",
"(",
"self",
".",
"_to_string",
"(",
"ret",
")",
"if",
"(",
"self",
".... | Return a string if `self.as_string=True`, otherwise return this field's `num_type`. | [
"Return",
"a",
"string",
"if",
"self",
".",
"as_string",
"=",
"True",
"otherwise",
"return",
"this",
"field",
"s",
"num_type",
"."
] | a6b6c4151f1fbf16f3774d4052ca2bddf6903750 | https://github.com/marshmallow-code/marshmallow/blob/a6b6c4151f1fbf16f3774d4052ca2bddf6903750/src/marshmallow/fields.py#L788-L795 | train | Serialize the value into a string if self. as_string = True otherwise return this field s num_type. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.