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/wrappers/base_response.py | BaseResponse.from_app | def from_app(cls, app, environ, buffered=False):
"""Create a new response object from an application output. This
works best if you pass it an application that returns a generator all
the time. Sometimes applications may use the `write()` callable
returned by the `start_response` funct... | python | def from_app(cls, app, environ, buffered=False):
"""Create a new response object from an application output. This
works best if you pass it an application that returns a generator all
the time. Sometimes applications may use the `write()` callable
returned by the `start_response` funct... | [
"def",
"from_app",
"(",
"cls",
",",
"app",
",",
"environ",
",",
"buffered",
"=",
"False",
")",
":",
"return",
"cls",
"(",
"*",
"_run_wsgi_app",
"(",
"app",
",",
"environ",
",",
"buffered",
")",
")"
] | Create a new response object from an application output. This
works best if you pass it an application that returns a generator all
the time. Sometimes applications may use the `write()` callable
returned by the `start_response` function. This tries to resolve such
edge cases automati... | [
"Create",
"a",
"new",
"response",
"object",
"from",
"an",
"application",
"output",
".",
"This",
"works",
"best",
"if",
"you",
"pass",
"it",
"an",
"application",
"that",
"returns",
"a",
"generator",
"all",
"the",
"time",
".",
"Sometimes",
"applications",
"may... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/wrappers/base_response.py#L274-L287 | train | Create a new response object from an application output. | 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_response.py | BaseResponse.calculate_content_length | def calculate_content_length(self):
"""Returns the content length if available or `None` otherwise."""
try:
self._ensure_sequence()
except RuntimeError:
return None
return sum(len(x) for x in self.iter_encoded()) | python | def calculate_content_length(self):
"""Returns the content length if available or `None` otherwise."""
try:
self._ensure_sequence()
except RuntimeError:
return None
return sum(len(x) for x in self.iter_encoded()) | [
"def",
"calculate_content_length",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"_ensure_sequence",
"(",
")",
"except",
"RuntimeError",
":",
"return",
"None",
"return",
"sum",
"(",
"len",
"(",
"x",
")",
"for",
"x",
"in",
"self",
".",
"iter_encoded",
"... | Returns the content length if available or `None` otherwise. | [
"Returns",
"the",
"content",
"length",
"if",
"available",
"or",
"None",
"otherwise",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/wrappers/base_response.py#L366-L372 | train | Returns the content length if available or None otherwise. | 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_response.py | BaseResponse.make_sequence | def make_sequence(self):
"""Converts the response iterator in a list. By default this happens
automatically if required. If `implicit_sequence_conversion` is
disabled, this method is not automatically called and some properties
might raise exceptions. This also encodes all the items.
... | python | def make_sequence(self):
"""Converts the response iterator in a list. By default this happens
automatically if required. If `implicit_sequence_conversion` is
disabled, this method is not automatically called and some properties
might raise exceptions. This also encodes all the items.
... | [
"def",
"make_sequence",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_sequence",
":",
"# if we consume an iterable we have to ensure that the close",
"# method of the iterable is called if available when we tear",
"# down the response",
"close",
"=",
"getattr",
"(",
"sel... | Converts the response iterator in a list. By default this happens
automatically if required. If `implicit_sequence_conversion` is
disabled, this method is not automatically called and some properties
might raise exceptions. This also encodes all the items.
.. versionadded:: 0.6 | [
"Converts",
"the",
"response",
"iterator",
"in",
"a",
"list",
".",
"By",
"default",
"this",
"happens",
"automatically",
"if",
"required",
".",
"If",
"implicit_sequence_conversion",
"is",
"disabled",
"this",
"method",
"is",
"not",
"automatically",
"called",
"and",
... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/wrappers/base_response.py#L399-L414 | train | Converts the response iterator 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... |
pallets/werkzeug | src/werkzeug/wrappers/base_response.py | BaseResponse.set_cookie | def set_cookie(
self,
key,
value="",
max_age=None,
expires=None,
path="/",
domain=None,
secure=False,
httponly=False,
samesite=None,
):
"""Sets a cookie. The parameters are the same as in the cookie `Morsel`
object in th... | python | def set_cookie(
self,
key,
value="",
max_age=None,
expires=None,
path="/",
domain=None,
secure=False,
httponly=False,
samesite=None,
):
"""Sets a cookie. The parameters are the same as in the cookie `Morsel`
object in th... | [
"def",
"set_cookie",
"(",
"self",
",",
"key",
",",
"value",
"=",
"\"\"",
",",
"max_age",
"=",
"None",
",",
"expires",
"=",
"None",
",",
"path",
"=",
"\"/\"",
",",
"domain",
"=",
"None",
",",
"secure",
"=",
"False",
",",
"httponly",
"=",
"False",
",... | Sets a cookie. The parameters are the same as in the cookie `Morsel`
object in the Python standard library but it accepts unicode data, too.
A warning is raised if the size of the cookie header exceeds
:attr:`max_cookie_size`, but the header will still be set.
:param key: the key (name... | [
"Sets",
"a",
"cookie",
".",
"The",
"parameters",
"are",
"the",
"same",
"as",
"in",
"the",
"cookie",
"Morsel",
"object",
"in",
"the",
"Python",
"standard",
"library",
"but",
"it",
"accepts",
"unicode",
"data",
"too",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/wrappers/base_response.py#L429-L483 | train | Sets a cookie for the given key value pair. | 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_response.py | BaseResponse.close | def close(self):
"""Close the wrapped response if possible. You can also use the object
in a with statement which will automatically close it.
.. versionadded:: 0.9
Can now be used in a with statement.
"""
if hasattr(self.response, "close"):
self.response... | python | def close(self):
"""Close the wrapped response if possible. You can also use the object
in a with statement which will automatically close it.
.. versionadded:: 0.9
Can now be used in a with statement.
"""
if hasattr(self.response, "close"):
self.response... | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"hasattr",
"(",
"self",
".",
"response",
",",
"\"close\"",
")",
":",
"self",
".",
"response",
".",
"close",
"(",
")",
"for",
"func",
"in",
"self",
".",
"_on_close",
":",
"func",
"(",
")"
] | Close the wrapped response if possible. You can also use the object
in a with statement which will automatically close it.
.. versionadded:: 0.9
Can now be used in a with statement. | [
"Close",
"the",
"wrapped",
"response",
"if",
"possible",
".",
"You",
"can",
"also",
"use",
"the",
"object",
"in",
"a",
"with",
"statement",
"which",
"will",
"automatically",
"close",
"it",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/wrappers/base_response.py#L522-L532 | train | Close the wrapped response if possible. | 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_response.py | BaseResponse.get_wsgi_headers | def get_wsgi_headers(self, environ):
"""This is automatically called right before the response is started
and returns headers modified for the given environment. It returns a
copy of the headers from the response with some modifications applied
if necessary.
For example the loc... | python | def get_wsgi_headers(self, environ):
"""This is automatically called right before the response is started
and returns headers modified for the given environment. It returns a
copy of the headers from the response with some modifications applied
if necessary.
For example the loc... | [
"def",
"get_wsgi_headers",
"(",
"self",
",",
"environ",
")",
":",
"headers",
"=",
"Headers",
"(",
"self",
".",
"headers",
")",
"location",
"=",
"None",
"content_location",
"=",
"None",
"content_length",
"=",
"None",
"status",
"=",
"self",
".",
"status_code",... | This is automatically called right before the response is started
and returns headers modified for the given environment. It returns a
copy of the headers from the response with some modifications applied
if necessary.
For example the location header (if present) is joined with the roo... | [
"This",
"is",
"automatically",
"called",
"right",
"before",
"the",
"response",
"is",
"started",
"and",
"returns",
"headers",
"modified",
"for",
"the",
"given",
"environment",
".",
"It",
"returns",
"a",
"copy",
"of",
"the",
"headers",
"from",
"the",
"response",... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/wrappers/base_response.py#L553-L644 | train | This function returns the WSGI headers modified for the given environment. | 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_response.py | BaseResponse.get_wsgi_response | def get_wsgi_response(self, environ):
"""Returns the final WSGI response as tuple. The first item in
the tuple is the application iterator, the second the status and
the third the list of headers. The response returned is created
specially for the given environment. For example if the... | python | def get_wsgi_response(self, environ):
"""Returns the final WSGI response as tuple. The first item in
the tuple is the application iterator, the second the status and
the third the list of headers. The response returned is created
specially for the given environment. For example if the... | [
"def",
"get_wsgi_response",
"(",
"self",
",",
"environ",
")",
":",
"headers",
"=",
"self",
".",
"get_wsgi_headers",
"(",
"environ",
")",
"app_iter",
"=",
"self",
".",
"get_app_iter",
"(",
"environ",
")",
"return",
"app_iter",
",",
"self",
".",
"status",
",... | Returns the final WSGI response as tuple. The first item in
the tuple is the application iterator, the second the status and
the third the list of headers. The response returned is created
specially for the given environment. For example if the request
method in the WSGI environment i... | [
"Returns",
"the",
"final",
"WSGI",
"response",
"as",
"tuple",
".",
"The",
"first",
"item",
"in",
"the",
"tuple",
"is",
"the",
"application",
"iterator",
"the",
"second",
"the",
"status",
"and",
"the",
"third",
"the",
"list",
"of",
"headers",
".",
"The",
... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/wrappers/base_response.py#L675-L690 | train | Returns the WSGI response as tuple. | 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/security.py | pbkdf2_bin | def pbkdf2_bin(
data, salt, iterations=DEFAULT_PBKDF2_ITERATIONS, keylen=None, hashfunc=None
):
"""Returns a binary digest for the PBKDF2 hash algorithm of `data`
with the given `salt`. It iterates `iterations` times and produces a
key of `keylen` bytes. By default, SHA-256 is used as hash function;
... | python | def pbkdf2_bin(
data, salt, iterations=DEFAULT_PBKDF2_ITERATIONS, keylen=None, hashfunc=None
):
"""Returns a binary digest for the PBKDF2 hash algorithm of `data`
with the given `salt`. It iterates `iterations` times and produces a
key of `keylen` bytes. By default, SHA-256 is used as hash function;
... | [
"def",
"pbkdf2_bin",
"(",
"data",
",",
"salt",
",",
"iterations",
"=",
"DEFAULT_PBKDF2_ITERATIONS",
",",
"keylen",
"=",
"None",
",",
"hashfunc",
"=",
"None",
")",
":",
"if",
"not",
"hashfunc",
":",
"hashfunc",
"=",
"\"sha256\"",
"data",
"=",
"to_bytes",
"(... | Returns a binary digest for the PBKDF2 hash algorithm of `data`
with the given `salt`. It iterates `iterations` times and produces a
key of `keylen` bytes. By default, SHA-256 is used as hash function;
a different hashlib `hashfunc` can be provided.
.. versionadded:: 0.9
:param data: the data to d... | [
"Returns",
"a",
"binary",
"digest",
"for",
"the",
"PBKDF2",
"hash",
"algorithm",
"of",
"data",
"with",
"the",
"given",
"salt",
".",
"It",
"iterates",
"iterations",
"times",
"and",
"produces",
"a",
"key",
"of",
"keylen",
"bytes",
".",
"By",
"default",
"SHA"... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/security.py#L57-L87 | train | Returns a binary digest of the PBKDF2 hash algorithm of data with the given salt. | 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/security.py | _hash_internal | def _hash_internal(method, salt, password):
"""Internal password hash helper. Supports plaintext without salt,
unsalted and salted passwords. In case salted passwords are used
hmac is used.
"""
if method == "plain":
return password, method
if isinstance(password, text_type):
p... | python | def _hash_internal(method, salt, password):
"""Internal password hash helper. Supports plaintext without salt,
unsalted and salted passwords. In case salted passwords are used
hmac is used.
"""
if method == "plain":
return password, method
if isinstance(password, text_type):
p... | [
"def",
"_hash_internal",
"(",
"method",
",",
"salt",
",",
"password",
")",
":",
"if",
"method",
"==",
"\"plain\"",
":",
"return",
"password",
",",
"method",
"if",
"isinstance",
"(",
"password",
",",
"text_type",
")",
":",
"password",
"=",
"password",
".",
... | Internal password hash helper. Supports plaintext without salt,
unsalted and salted passwords. In case salted passwords are used
hmac is used. | [
"Internal",
"password",
"hash",
"helper",
".",
"Supports",
"plaintext",
"without",
"salt",
"unsalted",
"and",
"salted",
"passwords",
".",
"In",
"case",
"salted",
"passwords",
"are",
"used",
"hmac",
"is",
"used",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/security.py#L127-L161 | train | Internal password hash helper. | 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/security.py | safe_join | def safe_join(directory, *pathnames):
"""Safely join `directory` and one or more untrusted `pathnames`. If this
cannot be done, this function returns ``None``.
:param directory: the base directory.
:param pathnames: the untrusted pathnames relative to that directory.
"""
parts = [directory]
... | python | def safe_join(directory, *pathnames):
"""Safely join `directory` and one or more untrusted `pathnames`. If this
cannot be done, this function returns ``None``.
:param directory: the base directory.
:param pathnames: the untrusted pathnames relative to that directory.
"""
parts = [directory]
... | [
"def",
"safe_join",
"(",
"directory",
",",
"*",
"pathnames",
")",
":",
"parts",
"=",
"[",
"directory",
"]",
"for",
"filename",
"in",
"pathnames",
":",
"if",
"filename",
"!=",
"\"\"",
":",
"filename",
"=",
"posixpath",
".",
"normpath",
"(",
"filename",
")... | Safely join `directory` and one or more untrusted `pathnames`. If this
cannot be done, this function returns ``None``.
:param directory: the base directory.
:param pathnames: the untrusted pathnames relative to that directory. | [
"Safely",
"join",
"directory",
"and",
"one",
"or",
"more",
"untrusted",
"pathnames",
".",
"If",
"this",
"cannot",
"be",
"done",
"this",
"function",
"returns",
"None",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/security.py#L224-L241 | train | Safely joins a directory and one or more untrusted pathnames. | 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/serving.py | generate_adhoc_ssl_context | def generate_adhoc_ssl_context():
"""Generates an adhoc SSL context for the development server."""
crypto = _get_openssl_crypto_module()
import tempfile
import atexit
cert, pkey = generate_adhoc_ssl_pair()
cert_handle, cert_file = tempfile.mkstemp()
pkey_handle, pkey_file = tempfile.mkstemp... | python | def generate_adhoc_ssl_context():
"""Generates an adhoc SSL context for the development server."""
crypto = _get_openssl_crypto_module()
import tempfile
import atexit
cert, pkey = generate_adhoc_ssl_pair()
cert_handle, cert_file = tempfile.mkstemp()
pkey_handle, pkey_file = tempfile.mkstemp... | [
"def",
"generate_adhoc_ssl_context",
"(",
")",
":",
"crypto",
"=",
"_get_openssl_crypto_module",
"(",
")",
"import",
"tempfile",
"import",
"atexit",
"cert",
",",
"pkey",
"=",
"generate_adhoc_ssl_pair",
"(",
")",
"cert_handle",
",",
"cert_file",
"=",
"tempfile",
".... | Generates an adhoc SSL context for the development server. | [
"Generates",
"an",
"adhoc",
"SSL",
"context",
"for",
"the",
"development",
"server",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/serving.py#L532-L549 | train | Generates an adhoc SSL context for the development server. | 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/serving.py | load_ssl_context | def load_ssl_context(cert_file, pkey_file=None, protocol=None):
"""Loads SSL context from cert/private key files and optional protocol.
Many parameters are directly taken from the API of
:py:class:`ssl.SSLContext`.
:param cert_file: Path of the certificate to use.
:param pkey_file: Path of the priv... | python | def load_ssl_context(cert_file, pkey_file=None, protocol=None):
"""Loads SSL context from cert/private key files and optional protocol.
Many parameters are directly taken from the API of
:py:class:`ssl.SSLContext`.
:param cert_file: Path of the certificate to use.
:param pkey_file: Path of the priv... | [
"def",
"load_ssl_context",
"(",
"cert_file",
",",
"pkey_file",
"=",
"None",
",",
"protocol",
"=",
"None",
")",
":",
"if",
"protocol",
"is",
"None",
":",
"protocol",
"=",
"ssl",
".",
"PROTOCOL_SSLv23",
"ctx",
"=",
"_SSLContext",
"(",
"protocol",
")",
"ctx",... | Loads SSL context from cert/private key files and optional protocol.
Many parameters are directly taken from the API of
:py:class:`ssl.SSLContext`.
:param cert_file: Path of the certificate to use.
:param pkey_file: Path of the private key to use. If not given, the key
will be obt... | [
"Loads",
"SSL",
"context",
"from",
"cert",
"/",
"private",
"key",
"files",
"and",
"optional",
"protocol",
".",
"Many",
"parameters",
"are",
"directly",
"taken",
"from",
"the",
"API",
"of",
":",
"py",
":",
"class",
":",
"ssl",
".",
"SSLContext",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/serving.py#L552-L567 | train | Loads an SSL context from cert and private key files and optional protocol. | 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/serving.py | is_ssl_error | def is_ssl_error(error=None):
"""Checks if the given error (or the current one) is an SSL error."""
exc_types = (ssl.SSLError,)
try:
from OpenSSL.SSL import Error
exc_types += (Error,)
except ImportError:
pass
if error is None:
error = sys.exc_info()[1]
return i... | python | def is_ssl_error(error=None):
"""Checks if the given error (or the current one) is an SSL error."""
exc_types = (ssl.SSLError,)
try:
from OpenSSL.SSL import Error
exc_types += (Error,)
except ImportError:
pass
if error is None:
error = sys.exc_info()[1]
return i... | [
"def",
"is_ssl_error",
"(",
"error",
"=",
"None",
")",
":",
"exc_types",
"=",
"(",
"ssl",
".",
"SSLError",
",",
")",
"try",
":",
"from",
"OpenSSL",
".",
"SSL",
"import",
"Error",
"exc_types",
"+=",
"(",
"Error",
",",
")",
"except",
"ImportError",
":",
... | Checks if the given error (or the current one) is an SSL error. | [
"Checks",
"if",
"the",
"given",
"error",
"(",
"or",
"the",
"current",
"one",
")",
"is",
"an",
"SSL",
"error",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/serving.py#L596-L608 | train | Checks if the given error is an SSL error. | 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/serving.py | select_address_family | def select_address_family(host, port):
"""Return ``AF_INET4``, ``AF_INET6``, or ``AF_UNIX`` depending on
the host and port."""
# disabled due to problems with current ipv6 implementations
# and various operating systems. Probably this code also is
# not supposed to work, but I can't come up with an... | python | def select_address_family(host, port):
"""Return ``AF_INET4``, ``AF_INET6``, or ``AF_UNIX`` depending on
the host and port."""
# disabled due to problems with current ipv6 implementations
# and various operating systems. Probably this code also is
# not supposed to work, but I can't come up with an... | [
"def",
"select_address_family",
"(",
"host",
",",
"port",
")",
":",
"# disabled due to problems with current ipv6 implementations",
"# and various operating systems. Probably this code also is",
"# not supposed to work, but I can't come up with any other",
"# ways to implement this.",
"# tr... | Return ``AF_INET4``, ``AF_INET6``, or ``AF_UNIX`` depending on
the host and port. | [
"Return",
"AF_INET4",
"AF_INET6",
"or",
"AF_UNIX",
"depending",
"on",
"the",
"host",
"and",
"port",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/serving.py#L611-L630 | train | Select the address family based on the host and port. | 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/serving.py | get_sockaddr | def get_sockaddr(host, port, family):
"""Return a fully qualified socket address that can be passed to
:func:`socket.bind`."""
if family == af_unix:
return host.split("://", 1)[1]
try:
res = socket.getaddrinfo(
host, port, family, socket.SOCK_STREAM, socket.IPPROTO_TCP
... | python | def get_sockaddr(host, port, family):
"""Return a fully qualified socket address that can be passed to
:func:`socket.bind`."""
if family == af_unix:
return host.split("://", 1)[1]
try:
res = socket.getaddrinfo(
host, port, family, socket.SOCK_STREAM, socket.IPPROTO_TCP
... | [
"def",
"get_sockaddr",
"(",
"host",
",",
"port",
",",
"family",
")",
":",
"if",
"family",
"==",
"af_unix",
":",
"return",
"host",
".",
"split",
"(",
"\"://\"",
",",
"1",
")",
"[",
"1",
"]",
"try",
":",
"res",
"=",
"socket",
".",
"getaddrinfo",
"(",... | Return a fully qualified socket address that can be passed to
:func:`socket.bind`. | [
"Return",
"a",
"fully",
"qualified",
"socket",
"address",
"that",
"can",
"be",
"passed",
"to",
":",
"func",
":",
"socket",
".",
"bind",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/serving.py#L633-L644 | train | Return a fully qualified socket address that can be passed to
. | 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/serving.py | run_simple | def run_simple(
hostname,
port,
application,
use_reloader=False,
use_debugger=False,
use_evalex=True,
extra_files=None,
reloader_interval=1,
reloader_type="auto",
threaded=False,
processes=1,
request_handler=None,
static_files=None,
passthrough_errors=False,
s... | python | def run_simple(
hostname,
port,
application,
use_reloader=False,
use_debugger=False,
use_evalex=True,
extra_files=None,
reloader_interval=1,
reloader_type="auto",
threaded=False,
processes=1,
request_handler=None,
static_files=None,
passthrough_errors=False,
s... | [
"def",
"run_simple",
"(",
"hostname",
",",
"port",
",",
"application",
",",
"use_reloader",
"=",
"False",
",",
"use_debugger",
"=",
"False",
",",
"use_evalex",
"=",
"True",
",",
"extra_files",
"=",
"None",
",",
"reloader_interval",
"=",
"1",
",",
"reloader_t... | Start a WSGI application. Optional features include a reloader,
multithreading and fork support.
This function has a command-line interface too::
python -m werkzeug.serving --help
.. versionadded:: 0.5
`static_files` was added to simplify serving of static files as well
as `passthro... | [
"Start",
"a",
"WSGI",
"application",
".",
"Optional",
"features",
"include",
"a",
"reloader",
"multithreading",
"and",
"fork",
"support",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/serving.py#L814-L990 | train | Start a simple WSGI 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/serving.py | main | def main():
"""A simple command-line interface for :py:func:`run_simple`."""
# in contrast to argparse, this works at least under Python < 2.7
import optparse
from .utils import import_string
parser = optparse.OptionParser(usage="Usage: %prog [options] app_module:app_object")
parser.add_option... | python | def main():
"""A simple command-line interface for :py:func:`run_simple`."""
# in contrast to argparse, this works at least under Python < 2.7
import optparse
from .utils import import_string
parser = optparse.OptionParser(usage="Usage: %prog [options] app_module:app_object")
parser.add_option... | [
"def",
"main",
"(",
")",
":",
"# in contrast to argparse, this works at least under Python < 2.7",
"import",
"optparse",
"from",
".",
"utils",
"import",
"import_string",
"parser",
"=",
"optparse",
".",
"OptionParser",
"(",
"usage",
"=",
"\"Usage: %prog [options] app_module:... | A simple command-line interface for :py:func:`run_simple`. | [
"A",
"simple",
"command",
"-",
"line",
"interface",
"for",
":",
"py",
":",
"func",
":",
"run_simple",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/serving.py#L1001-L1051 | train | A simple command - line interface for Werkzeug s main 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 | src/werkzeug/serving.py | WSGIRequestHandler.handle | def handle(self):
"""Handles a request ignoring dropped connections."""
rv = None
try:
rv = BaseHTTPRequestHandler.handle(self)
except (_ConnectionError, socket.timeout) as e:
self.connection_dropped(e)
except Exception as e:
if self.server.ssl... | python | def handle(self):
"""Handles a request ignoring dropped connections."""
rv = None
try:
rv = BaseHTTPRequestHandler.handle(self)
except (_ConnectionError, socket.timeout) as e:
self.connection_dropped(e)
except Exception as e:
if self.server.ssl... | [
"def",
"handle",
"(",
"self",
")",
":",
"rv",
"=",
"None",
"try",
":",
"rv",
"=",
"BaseHTTPRequestHandler",
".",
"handle",
"(",
"self",
")",
"except",
"(",
"_ConnectionError",
",",
"socket",
".",
"timeout",
")",
"as",
"e",
":",
"self",
".",
"connection... | Handles a request ignoring dropped connections. | [
"Handles",
"a",
"request",
"ignoring",
"dropped",
"connections",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/serving.py#L321-L333 | train | Handles a request ignoring dropped connections. | 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/serving.py | WSGIRequestHandler.initiate_shutdown | def initiate_shutdown(self):
"""A horrible, horrible way to kill the server for Python 2.6 and
later. It's the best we can do.
"""
# Windows does not provide SIGKILL, go with SIGTERM then.
sig = getattr(signal, "SIGKILL", signal.SIGTERM)
# reloader active
if is_r... | python | def initiate_shutdown(self):
"""A horrible, horrible way to kill the server for Python 2.6 and
later. It's the best we can do.
"""
# Windows does not provide SIGKILL, go with SIGTERM then.
sig = getattr(signal, "SIGKILL", signal.SIGTERM)
# reloader active
if is_r... | [
"def",
"initiate_shutdown",
"(",
"self",
")",
":",
"# Windows does not provide SIGKILL, go with SIGTERM then.",
"sig",
"=",
"getattr",
"(",
"signal",
",",
"\"SIGKILL\"",
",",
"signal",
".",
"SIGTERM",
")",
"# reloader active",
"if",
"is_running_from_reloader",
"(",
")",... | A horrible, horrible way to kill the server for Python 2.6 and
later. It's the best we can do. | [
"A",
"horrible",
"horrible",
"way",
"to",
"kill",
"the",
"server",
"for",
"Python",
"2",
".",
"6",
"and",
"later",
".",
"It",
"s",
"the",
"best",
"we",
"can",
"do",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/serving.py#L335-L347 | train | This method is called by the server when it is shutting down. | 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/serving.py | WSGIRequestHandler.handle_one_request | def handle_one_request(self):
"""Handle a single HTTP request."""
self.raw_requestline = self.rfile.readline()
if not self.raw_requestline:
self.close_connection = 1
elif self.parse_request():
return self.run_wsgi() | python | def handle_one_request(self):
"""Handle a single HTTP request."""
self.raw_requestline = self.rfile.readline()
if not self.raw_requestline:
self.close_connection = 1
elif self.parse_request():
return self.run_wsgi() | [
"def",
"handle_one_request",
"(",
"self",
")",
":",
"self",
".",
"raw_requestline",
"=",
"self",
".",
"rfile",
".",
"readline",
"(",
")",
"if",
"not",
"self",
".",
"raw_requestline",
":",
"self",
".",
"close_connection",
"=",
"1",
"elif",
"self",
".",
"p... | Handle a single HTTP request. | [
"Handle",
"a",
"single",
"HTTP",
"request",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/serving.py#L354-L360 | train | Handle a single HTTP 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/serving.py | WSGIRequestHandler.send_response | def send_response(self, code, message=None):
"""Send the response header and log the response code."""
self.log_request(code)
if message is None:
message = code in self.responses and self.responses[code][0] or ""
if self.request_version != "HTTP/0.9":
hdr = "%s %d... | python | def send_response(self, code, message=None):
"""Send the response header and log the response code."""
self.log_request(code)
if message is None:
message = code in self.responses and self.responses[code][0] or ""
if self.request_version != "HTTP/0.9":
hdr = "%s %d... | [
"def",
"send_response",
"(",
"self",
",",
"code",
",",
"message",
"=",
"None",
")",
":",
"self",
".",
"log_request",
"(",
"code",
")",
"if",
"message",
"is",
"None",
":",
"message",
"=",
"code",
"in",
"self",
".",
"responses",
"and",
"self",
".",
"re... | Send the response header and log the response code. | [
"Send",
"the",
"response",
"header",
"and",
"log",
"the",
"response",
"code",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/serving.py#L362-L369 | train | Send the response header and log the response code and message. | 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/serving.py | WSGIRequestHandler.get_header_items | def get_header_items(self):
"""
Get an iterable list of key/value pairs representing headers.
This function provides Python 2/3 compatibility as related to the
parsing of request headers. Python 2.7 is not compliant with
RFC 3875 Section 4.1.18 which requires multiple values for... | python | def get_header_items(self):
"""
Get an iterable list of key/value pairs representing headers.
This function provides Python 2/3 compatibility as related to the
parsing of request headers. Python 2.7 is not compliant with
RFC 3875 Section 4.1.18 which requires multiple values for... | [
"def",
"get_header_items",
"(",
"self",
")",
":",
"if",
"PY2",
":",
"# For Python 2, process the headers manually according to",
"# W3C RFC 2616 Section 4.2.",
"items",
"=",
"[",
"]",
"for",
"header",
"in",
"self",
".",
"headers",
".",
"headers",
":",
"# Remove \"\\n\... | Get an iterable list of key/value pairs representing headers.
This function provides Python 2/3 compatibility as related to the
parsing of request headers. Python 2.7 is not compliant with
RFC 3875 Section 4.1.18 which requires multiple values for headers
to be provided. This function w... | [
"Get",
"an",
"iterable",
"list",
"of",
"key",
"/",
"value",
"pairs",
"representing",
"headers",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/serving.py#L430-L460 | train | Get an iterable list of key value pairs representing headers. | 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/_internal.py | _has_level_handler | def _has_level_handler(logger):
"""Check if there is a handler in the logging chain that will handle
the given logger's effective level.
"""
level = logger.getEffectiveLevel()
current = logger
while current:
if any(handler.level <= level for handler in current.handlers):
ret... | python | def _has_level_handler(logger):
"""Check if there is a handler in the logging chain that will handle
the given logger's effective level.
"""
level = logger.getEffectiveLevel()
current = logger
while current:
if any(handler.level <= level for handler in current.handlers):
ret... | [
"def",
"_has_level_handler",
"(",
"logger",
")",
":",
"level",
"=",
"logger",
".",
"getEffectiveLevel",
"(",
")",
"current",
"=",
"logger",
"while",
"current",
":",
"if",
"any",
"(",
"handler",
".",
"level",
"<=",
"level",
"for",
"handler",
"in",
"current"... | Check if there is a handler in the logging chain that will handle
the given logger's effective level. | [
"Check",
"if",
"there",
"is",
"a",
"handler",
"in",
"the",
"logging",
"chain",
"that",
"will",
"handle",
"the",
"given",
"logger",
"s",
"effective",
"level",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/_internal.py#L75-L91 | train | Check if a given logger has a handler at the given level. | 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/_internal.py | _log | def _log(type, message, *args, **kwargs):
"""Log a message to the 'werkzeug' logger.
The logger is created the first time it is needed. If there is no
level set, it is set to :data:`logging.INFO`. If there is no handler
for the logger's effective level, a :class:`logging.StreamHandler`
is added.
... | python | def _log(type, message, *args, **kwargs):
"""Log a message to the 'werkzeug' logger.
The logger is created the first time it is needed. If there is no
level set, it is set to :data:`logging.INFO`. If there is no handler
for the logger's effective level, a :class:`logging.StreamHandler`
is added.
... | [
"def",
"_log",
"(",
"type",
",",
"message",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"global",
"_logger",
"if",
"_logger",
"is",
"None",
":",
"_logger",
"=",
"logging",
".",
"getLogger",
"(",
"\"werkzeug\"",
")",
"if",
"_logger",
".",
"le... | Log a message to the 'werkzeug' logger.
The logger is created the first time it is needed. If there is no
level set, it is set to :data:`logging.INFO`. If there is no handler
for the logger's effective level, a :class:`logging.StreamHandler`
is added. | [
"Log",
"a",
"message",
"to",
"the",
"werkzeug",
"logger",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/_internal.py#L94-L113 | train | Log a message to the werskzeug logger. | 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/_internal.py | _parse_signature | def _parse_signature(func):
"""Return a signature object for the function."""
if hasattr(func, "im_func"):
func = func.im_func
# if we have a cached validator for this function, return it
parse = _signature_cache.get(func)
if parse is not None:
return parse
# inspect the functi... | python | def _parse_signature(func):
"""Return a signature object for the function."""
if hasattr(func, "im_func"):
func = func.im_func
# if we have a cached validator for this function, return it
parse = _signature_cache.get(func)
if parse is not None:
return parse
# inspect the functi... | [
"def",
"_parse_signature",
"(",
"func",
")",
":",
"if",
"hasattr",
"(",
"func",
",",
"\"im_func\"",
")",
":",
"func",
"=",
"func",
".",
"im_func",
"# if we have a cached validator for this function, return it",
"parse",
"=",
"_signature_cache",
".",
"get",
"(",
"f... | Return a signature object for the function. | [
"Return",
"a",
"signature",
"object",
"for",
"the",
"function",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/_internal.py#L116-L191 | train | Return a signature object for the 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 | src/werkzeug/_internal.py | _date_to_unix | def _date_to_unix(arg):
"""Converts a timetuple, integer or datetime object into the seconds from
epoch in utc.
"""
if isinstance(arg, datetime):
arg = arg.utctimetuple()
elif isinstance(arg, integer_types + (float,)):
return int(arg)
year, month, day, hour, minute, second = arg[... | python | def _date_to_unix(arg):
"""Converts a timetuple, integer or datetime object into the seconds from
epoch in utc.
"""
if isinstance(arg, datetime):
arg = arg.utctimetuple()
elif isinstance(arg, integer_types + (float,)):
return int(arg)
year, month, day, hour, minute, second = arg[... | [
"def",
"_date_to_unix",
"(",
"arg",
")",
":",
"if",
"isinstance",
"(",
"arg",
",",
"datetime",
")",
":",
"arg",
"=",
"arg",
".",
"utctimetuple",
"(",
")",
"elif",
"isinstance",
"(",
"arg",
",",
"integer_types",
"+",
"(",
"float",
",",
")",
")",
":",
... | Converts a timetuple, integer or datetime object into the seconds from
epoch in utc. | [
"Converts",
"a",
"timetuple",
"integer",
"or",
"datetime",
"object",
"into",
"the",
"seconds",
"from",
"epoch",
"in",
"utc",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/_internal.py#L194-L207 | train | Converts a timetuple integer or datetime object into the seconds from
epoch in utc. | 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/_internal.py | _cookie_parse_impl | def _cookie_parse_impl(b):
"""Lowlevel cookie parsing facility that operates on bytes."""
i = 0
n = len(b)
while i < n:
match = _cookie_re.search(b + b";", i)
if not match:
break
key = match.group("key").strip()
value = match.group("val") or b""
i = ... | python | def _cookie_parse_impl(b):
"""Lowlevel cookie parsing facility that operates on bytes."""
i = 0
n = len(b)
while i < n:
match = _cookie_re.search(b + b";", i)
if not match:
break
key = match.group("key").strip()
value = match.group("val") or b""
i = ... | [
"def",
"_cookie_parse_impl",
"(",
"b",
")",
":",
"i",
"=",
"0",
"n",
"=",
"len",
"(",
"b",
")",
"while",
"i",
"<",
"n",
":",
"match",
"=",
"_cookie_re",
".",
"search",
"(",
"b",
"+",
"b\";\"",
",",
"i",
")",
"if",
"not",
"match",
":",
"break",
... | Lowlevel cookie parsing facility that operates on bytes. | [
"Lowlevel",
"cookie",
"parsing",
"facility",
"that",
"operates",
"on",
"bytes",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/_internal.py#L315-L329 | train | Lowlevel cookie parsing facility that operates on 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/_internal.py | _easteregg | def _easteregg(app=None):
"""Like the name says. But who knows how it works?"""
def bzzzzzzz(gyver):
import base64
import zlib
return zlib.decompress(base64.b64decode(gyver)).decode("ascii")
gyver = u"\n".join(
[
x + (77 - len(x)) * u" "
for x in b... | python | def _easteregg(app=None):
"""Like the name says. But who knows how it works?"""
def bzzzzzzz(gyver):
import base64
import zlib
return zlib.decompress(base64.b64decode(gyver)).decode("ascii")
gyver = u"\n".join(
[
x + (77 - len(x)) * u" "
for x in b... | [
"def",
"_easteregg",
"(",
"app",
"=",
"None",
")",
":",
"def",
"bzzzzzzz",
"(",
"gyver",
")",
":",
"import",
"base64",
"import",
"zlib",
"return",
"zlib",
".",
"decompress",
"(",
"base64",
".",
"b64decode",
"(",
"gyver",
")",
")",
".",
"decode",
"(",
... | Like the name says. But who knows how it works? | [
"Like",
"the",
"name",
"says",
".",
"But",
"who",
"knows",
"how",
"it",
"works?"
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/_internal.py#L391-L473 | train | Like the name says. But who knows how it works? | 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/__init__.py | get_pin_and_cookie_name | def get_pin_and_cookie_name(app):
"""Given an application object this returns a semi-stable 9 digit pin
code and a random key. The hope is that this is stable between
restarts to not make debugging particularly frustrating. If the pin
was forcefully disabled this returns `None`.
Second item in th... | python | def get_pin_and_cookie_name(app):
"""Given an application object this returns a semi-stable 9 digit pin
code and a random key. The hope is that this is stable between
restarts to not make debugging particularly frustrating. If the pin
was forcefully disabled this returns `None`.
Second item in th... | [
"def",
"get_pin_and_cookie_name",
"(",
"app",
")",
":",
"pin",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"\"WERKZEUG_DEBUG_PIN\"",
")",
"rv",
"=",
"None",
"num",
"=",
"None",
"# Pin was explicitly disabled",
"if",
"pin",
"==",
"\"off\"",
":",
"return",
"No... | Given an application object this returns a semi-stable 9 digit pin
code and a random key. The hope is that this is stable between
restarts to not make debugging particularly frustrating. If the pin
was forcefully disabled this returns `None`.
Second item in the resulting tuple is the cookie name for ... | [
"Given",
"an",
"application",
"object",
"this",
"returns",
"a",
"semi",
"-",
"stable",
"9",
"digit",
"pin",
"code",
"and",
"a",
"random",
"key",
".",
"The",
"hope",
"is",
"that",
"this",
"is",
"stable",
"between",
"restarts",
"to",
"not",
"make",
"debugg... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/debug/__init__.py#L120-L200 | train | Given an application object this returns a semi - stable 9 digit pin
code and a random key. | 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/__init__.py | DebuggedApplication.pin_cookie_name | def pin_cookie_name(self):
"""The name of the pin cookie."""
if not hasattr(self, "_pin_cookie"):
self._pin, self._pin_cookie = get_pin_and_cookie_name(self.app)
return self._pin_cookie | python | def pin_cookie_name(self):
"""The name of the pin cookie."""
if not hasattr(self, "_pin_cookie"):
self._pin, self._pin_cookie = get_pin_and_cookie_name(self.app)
return self._pin_cookie | [
"def",
"pin_cookie_name",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"\"_pin_cookie\"",
")",
":",
"self",
".",
"_pin",
",",
"self",
".",
"_pin_cookie",
"=",
"get_pin_and_cookie_name",
"(",
"self",
".",
"app",
")",
"return",
"self",
... | The name of the pin cookie. | [
"The",
"name",
"of",
"the",
"pin",
"cookie",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/debug/__init__.py#L278-L282 | train | The name of the pin cookie. | 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/__init__.py | DebuggedApplication.execute_command | def execute_command(self, request, command, frame):
"""Execute a command in a console."""
return Response(frame.console.eval(command), mimetype="text/html") | python | def execute_command(self, request, command, frame):
"""Execute a command in a console."""
return Response(frame.console.eval(command), mimetype="text/html") | [
"def",
"execute_command",
"(",
"self",
",",
"request",
",",
"command",
",",
"frame",
")",
":",
"return",
"Response",
"(",
"frame",
".",
"console",
".",
"eval",
"(",
"command",
")",
",",
"mimetype",
"=",
"\"text/html\"",
")"
] | Execute a command in a console. | [
"Execute",
"a",
"command",
"in",
"a",
"console",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/debug/__init__.py#L333-L335 | train | Execute a command in a 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/__init__.py | DebuggedApplication.display_console | def display_console(self, request):
"""Display a standalone shell."""
if 0 not in self.frames:
if self.console_init_func is None:
ns = {}
else:
ns = dict(self.console_init_func())
ns.setdefault("app", self.app)
self.frames[0... | python | def display_console(self, request):
"""Display a standalone shell."""
if 0 not in self.frames:
if self.console_init_func is None:
ns = {}
else:
ns = dict(self.console_init_func())
ns.setdefault("app", self.app)
self.frames[0... | [
"def",
"display_console",
"(",
"self",
",",
"request",
")",
":",
"if",
"0",
"not",
"in",
"self",
".",
"frames",
":",
"if",
"self",
".",
"console_init_func",
"is",
"None",
":",
"ns",
"=",
"{",
"}",
"else",
":",
"ns",
"=",
"dict",
"(",
"self",
".",
... | Display a standalone shell. | [
"Display",
"a",
"standalone",
"shell",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/debug/__init__.py#L337-L350 | train | Display a standalone shell. | 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/__init__.py | DebuggedApplication.get_resource | def get_resource(self, request, filename):
"""Return a static resource from the shared folder."""
filename = join("shared", basename(filename))
try:
data = pkgutil.get_data(__package__, filename)
except OSError:
data = None
if data is not None:
... | python | def get_resource(self, request, filename):
"""Return a static resource from the shared folder."""
filename = join("shared", basename(filename))
try:
data = pkgutil.get_data(__package__, filename)
except OSError:
data = None
if data is not None:
... | [
"def",
"get_resource",
"(",
"self",
",",
"request",
",",
"filename",
")",
":",
"filename",
"=",
"join",
"(",
"\"shared\"",
",",
"basename",
"(",
"filename",
")",
")",
"try",
":",
"data",
"=",
"pkgutil",
".",
"get_data",
"(",
"__package__",
",",
"filename... | Return a static resource from the shared folder. | [
"Return",
"a",
"static",
"resource",
"from",
"the",
"shared",
"folder",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/debug/__init__.py#L357-L367 | train | Return a static resource from the shared folder. | 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/__init__.py | DebuggedApplication.check_pin_trust | def check_pin_trust(self, environ):
"""Checks if the request passed the pin test. This returns `True` if the
request is trusted on a pin/cookie basis and returns `False` if not.
Additionally if the cookie's stored pin hash is wrong it will return
`None` so that appropriate action can be... | python | def check_pin_trust(self, environ):
"""Checks if the request passed the pin test. This returns `True` if the
request is trusted on a pin/cookie basis and returns `False` if not.
Additionally if the cookie's stored pin hash is wrong it will return
`None` so that appropriate action can be... | [
"def",
"check_pin_trust",
"(",
"self",
",",
"environ",
")",
":",
"if",
"self",
".",
"pin",
"is",
"None",
":",
"return",
"True",
"val",
"=",
"parse_cookie",
"(",
"environ",
")",
".",
"get",
"(",
"self",
".",
"pin_cookie_name",
")",
"if",
"not",
"val",
... | Checks if the request passed the pin test. This returns `True` if the
request is trusted on a pin/cookie basis and returns `False` if not.
Additionally if the cookie's stored pin hash is wrong it will return
`None` so that appropriate action can be taken. | [
"Checks",
"if",
"the",
"request",
"passed",
"the",
"pin",
"test",
".",
"This",
"returns",
"True",
"if",
"the",
"request",
"is",
"trusted",
"on",
"a",
"pin",
"/",
"cookie",
"basis",
"and",
"returns",
"False",
"if",
"not",
".",
"Additionally",
"if",
"the",... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/debug/__init__.py#L369-L385 | train | Checks if the request passed the pin test. | 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/__init__.py | DebuggedApplication.pin_auth | def pin_auth(self, request):
"""Authenticates with the pin."""
exhausted = False
auth = False
trust = self.check_pin_trust(request.environ)
# If the trust return value is `None` it means that the cookie is
# set but the stored pin hash value is bad. This means that the
... | python | def pin_auth(self, request):
"""Authenticates with the pin."""
exhausted = False
auth = False
trust = self.check_pin_trust(request.environ)
# If the trust return value is `None` it means that the cookie is
# set but the stored pin hash value is bad. This means that the
... | [
"def",
"pin_auth",
"(",
"self",
",",
"request",
")",
":",
"exhausted",
"=",
"False",
"auth",
"=",
"False",
"trust",
"=",
"self",
".",
"check_pin_trust",
"(",
"request",
".",
"environ",
")",
"# If the trust return value is `None` it means that the cookie is",
"# set ... | Authenticates with the pin. | [
"Authenticates",
"with",
"the",
"pin",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/debug/__init__.py#L391-L436 | train | Authenticates with the pin. | 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/__init__.py | DebuggedApplication.log_pin_request | def log_pin_request(self):
"""Log the pin if needed."""
if self.pin_logging and self.pin is not None:
_log(
"info", " * To enable the debugger you need to enter the security pin:"
)
_log("info", " * Debugger pin code: %s" % self.pin)
return Res... | python | def log_pin_request(self):
"""Log the pin if needed."""
if self.pin_logging and self.pin is not None:
_log(
"info", " * To enable the debugger you need to enter the security pin:"
)
_log("info", " * Debugger pin code: %s" % self.pin)
return Res... | [
"def",
"log_pin_request",
"(",
"self",
")",
":",
"if",
"self",
".",
"pin_logging",
"and",
"self",
".",
"pin",
"is",
"not",
"None",
":",
"_log",
"(",
"\"info\"",
",",
"\" * To enable the debugger you need to enter the security pin:\"",
")",
"_log",
"(",
"\"info\"",... | Log the pin if needed. | [
"Log",
"the",
"pin",
"if",
"needed",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/debug/__init__.py#L438-L445 | train | Log the pin if needed. | 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/http.py | unquote_header_value | def unquote_header_value(value, is_filename=False):
r"""Unquotes a header value. (Reversal of :func:`quote_header_value`).
This does not use the real unquoting but what browsers are actually
using for quoting.
.. versionadded:: 0.5
:param value: the header value to unquote.
"""
if value a... | python | def unquote_header_value(value, is_filename=False):
r"""Unquotes a header value. (Reversal of :func:`quote_header_value`).
This does not use the real unquoting but what browsers are actually
using for quoting.
.. versionadded:: 0.5
:param value: the header value to unquote.
"""
if value a... | [
"def",
"unquote_header_value",
"(",
"value",
",",
"is_filename",
"=",
"False",
")",
":",
"if",
"value",
"and",
"value",
"[",
"0",
"]",
"==",
"value",
"[",
"-",
"1",
"]",
"==",
"'\"'",
":",
"# this is not the real unquoting, but fixing this so that the",
"# RFC i... | r"""Unquotes a header value. (Reversal of :func:`quote_header_value`).
This does not use the real unquoting but what browsers are actually
using for quoting.
.. versionadded:: 0.5
:param value: the header value to unquote. | [
"r",
"Unquotes",
"a",
"header",
"value",
".",
"(",
"Reversal",
"of",
":",
"func",
":",
"quote_header_value",
")",
".",
"This",
"does",
"not",
"use",
"the",
"real",
"unquoting",
"but",
"what",
"browsers",
"are",
"actually",
"using",
"for",
"quoting",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/http.py#L235-L258 | train | Unquotes a header 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... |
pallets/werkzeug | src/werkzeug/http.py | dump_options_header | def dump_options_header(header, options):
"""The reverse function to :func:`parse_options_header`.
:param header: the header to dump
:param options: a dict of options to append.
"""
segments = []
if header is not None:
segments.append(header)
for key, value in iteritems(options):
... | python | def dump_options_header(header, options):
"""The reverse function to :func:`parse_options_header`.
:param header: the header to dump
:param options: a dict of options to append.
"""
segments = []
if header is not None:
segments.append(header)
for key, value in iteritems(options):
... | [
"def",
"dump_options_header",
"(",
"header",
",",
"options",
")",
":",
"segments",
"=",
"[",
"]",
"if",
"header",
"is",
"not",
"None",
":",
"segments",
".",
"append",
"(",
"header",
")",
"for",
"key",
",",
"value",
"in",
"iteritems",
"(",
"options",
")... | The reverse function to :func:`parse_options_header`.
:param header: the header to dump
:param options: a dict of options to append. | [
"The",
"reverse",
"function",
"to",
":",
"func",
":",
"parse_options_header",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/http.py#L261-L275 | train | Dump the options header into 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/http.py | dump_header | def dump_header(iterable, allow_token=True):
"""Dump an HTTP header again. This is the reversal of
:func:`parse_list_header`, :func:`parse_set_header` and
:func:`parse_dict_header`. This also quotes strings that include an
equals sign unless you pass it as dict of key, value pairs.
>>> dump_heade... | python | def dump_header(iterable, allow_token=True):
"""Dump an HTTP header again. This is the reversal of
:func:`parse_list_header`, :func:`parse_set_header` and
:func:`parse_dict_header`. This also quotes strings that include an
equals sign unless you pass it as dict of key, value pairs.
>>> dump_heade... | [
"def",
"dump_header",
"(",
"iterable",
",",
"allow_token",
"=",
"True",
")",
":",
"if",
"isinstance",
"(",
"iterable",
",",
"dict",
")",
":",
"items",
"=",
"[",
"]",
"for",
"key",
",",
"value",
"in",
"iteritems",
"(",
"iterable",
")",
":",
"if",
"val... | Dump an HTTP header again. This is the reversal of
:func:`parse_list_header`, :func:`parse_set_header` and
:func:`parse_dict_header`. This also quotes strings that include an
equals sign unless you pass it as dict of key, value pairs.
>>> dump_header({'foo': 'bar baz'})
'foo="bar baz"'
>>> du... | [
"Dump",
"an",
"HTTP",
"header",
"again",
".",
"This",
"is",
"the",
"reversal",
"of",
":",
"func",
":",
"parse_list_header",
":",
"func",
":",
"parse_set_header",
"and",
":",
"func",
":",
"parse_dict_header",
".",
"This",
"also",
"quotes",
"strings",
"that",
... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/http.py#L278-L304 | train | Dump an HTTP header for an anisotope. | 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/http.py | parse_dict_header | def parse_dict_header(value, cls=dict):
"""Parse lists of key, value pairs as described by RFC 2068 Section 2 and
convert them into a python dict (or any other mapping object created from
the type with a dict like interface provided by the `cls` argument):
>>> d = parse_dict_header('foo="is a fish", ba... | python | def parse_dict_header(value, cls=dict):
"""Parse lists of key, value pairs as described by RFC 2068 Section 2 and
convert them into a python dict (or any other mapping object created from
the type with a dict like interface provided by the `cls` argument):
>>> d = parse_dict_header('foo="is a fish", ba... | [
"def",
"parse_dict_header",
"(",
"value",
",",
"cls",
"=",
"dict",
")",
":",
"result",
"=",
"cls",
"(",
")",
"if",
"not",
"isinstance",
"(",
"value",
",",
"text_type",
")",
":",
"# XXX: validate",
"value",
"=",
"bytes_to_wsgi",
"(",
"value",
")",
"for",
... | Parse lists of key, value pairs as described by RFC 2068 Section 2 and
convert them into a python dict (or any other mapping object created from
the type with a dict like interface provided by the `cls` argument):
>>> d = parse_dict_header('foo="is a fish", bar="as well"')
>>> type(d) is dict
True
... | [
"Parse",
"lists",
"of",
"key",
"value",
"pairs",
"as",
"described",
"by",
"RFC",
"2068",
"Section",
"2",
"and",
"convert",
"them",
"into",
"a",
"python",
"dict",
"(",
"or",
"any",
"other",
"mapping",
"object",
"created",
"from",
"the",
"type",
"with",
"a... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/http.py#L337-L375 | train | Parse a string with a dict header. | 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/http.py | parse_options_header | def parse_options_header(value, multiple=False):
"""Parse a ``Content-Type`` like header into a tuple with the content
type and the options:
>>> parse_options_header('text/html; charset=utf8')
('text/html', {'charset': 'utf8'})
This should not be used to parse ``Cache-Control`` like headers that u... | python | def parse_options_header(value, multiple=False):
"""Parse a ``Content-Type`` like header into a tuple with the content
type and the options:
>>> parse_options_header('text/html; charset=utf8')
('text/html', {'charset': 'utf8'})
This should not be used to parse ``Cache-Control`` like headers that u... | [
"def",
"parse_options_header",
"(",
"value",
",",
"multiple",
"=",
"False",
")",
":",
"if",
"not",
"value",
":",
"return",
"\"\"",
",",
"{",
"}",
"result",
"=",
"[",
"]",
"value",
"=",
"\",\"",
"+",
"value",
".",
"replace",
"(",
"\"\\n\"",
",",
"\",\... | Parse a ``Content-Type`` like header into a tuple with the content
type and the options:
>>> parse_options_header('text/html; charset=utf8')
('text/html', {'charset': 'utf8'})
This should not be used to parse ``Cache-Control`` like headers that use
a slightly different format. For these headers u... | [
"Parse",
"a",
"Content",
"-",
"Type",
"like",
"header",
"into",
"a",
"tuple",
"with",
"the",
"content",
"type",
"and",
"the",
"options",
":"
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/http.py#L378-L447 | train | Parse a Content - Type - like header into a tuple with the mimetype options and language. | 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/http.py | parse_accept_header | def parse_accept_header(value, cls=None):
"""Parses an HTTP Accept-* header. This does not implement a complete
valid algorithm but one that supports at least value and quality
extraction.
Returns a new :class:`Accept` object (basically a list of ``(value, quality)``
tuples sorted by the quality w... | python | def parse_accept_header(value, cls=None):
"""Parses an HTTP Accept-* header. This does not implement a complete
valid algorithm but one that supports at least value and quality
extraction.
Returns a new :class:`Accept` object (basically a list of ``(value, quality)``
tuples sorted by the quality w... | [
"def",
"parse_accept_header",
"(",
"value",
",",
"cls",
"=",
"None",
")",
":",
"if",
"cls",
"is",
"None",
":",
"cls",
"=",
"Accept",
"if",
"not",
"value",
":",
"return",
"cls",
"(",
"None",
")",
"result",
"=",
"[",
"]",
"for",
"match",
"in",
"_acce... | Parses an HTTP Accept-* header. This does not implement a complete
valid algorithm but one that supports at least value and quality
extraction.
Returns a new :class:`Accept` object (basically a list of ``(value, quality)``
tuples sorted by the quality with some additional accessor methods).
The s... | [
"Parses",
"an",
"HTTP",
"Accept",
"-",
"*",
"header",
".",
"This",
"does",
"not",
"implement",
"a",
"complete",
"valid",
"algorithm",
"but",
"one",
"that",
"supports",
"at",
"least",
"value",
"and",
"quality",
"extraction",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/http.py#L450-L480 | train | Parses an HTTP Accept - * header string and returns an instance of cls. | 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/http.py | parse_cache_control_header | def parse_cache_control_header(value, on_update=None, cls=None):
"""Parse a cache control header. The RFC differs between response and
request cache control, this method does not. It's your responsibility
to not use the wrong control statements.
.. versionadded:: 0.5
The `cls` was added. If n... | python | def parse_cache_control_header(value, on_update=None, cls=None):
"""Parse a cache control header. The RFC differs between response and
request cache control, this method does not. It's your responsibility
to not use the wrong control statements.
.. versionadded:: 0.5
The `cls` was added. If n... | [
"def",
"parse_cache_control_header",
"(",
"value",
",",
"on_update",
"=",
"None",
",",
"cls",
"=",
"None",
")",
":",
"if",
"cls",
"is",
"None",
":",
"cls",
"=",
"RequestCacheControl",
"if",
"not",
"value",
":",
"return",
"cls",
"(",
"None",
",",
"on_upda... | Parse a cache control header. The RFC differs between response and
request cache control, this method does not. It's your responsibility
to not use the wrong control statements.
.. versionadded:: 0.5
The `cls` was added. If not specified an immutable
:class:`~werkzeug.datastructures.Reques... | [
"Parse",
"a",
"cache",
"control",
"header",
".",
"The",
"RFC",
"differs",
"between",
"response",
"and",
"request",
"cache",
"control",
"this",
"method",
"does",
"not",
".",
"It",
"s",
"your",
"responsibility",
"to",
"not",
"use",
"the",
"wrong",
"control",
... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/http.py#L483-L504 | train | Parses a cache control header. | 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/http.py | parse_set_header | def parse_set_header(value, on_update=None):
"""Parse a set-like header and return a
:class:`~werkzeug.datastructures.HeaderSet` object:
>>> hs = parse_set_header('token, "quoted value"')
The return value is an object that treats the items case-insensitively
and keeps the order of the items:
... | python | def parse_set_header(value, on_update=None):
"""Parse a set-like header and return a
:class:`~werkzeug.datastructures.HeaderSet` object:
>>> hs = parse_set_header('token, "quoted value"')
The return value is an object that treats the items case-insensitively
and keeps the order of the items:
... | [
"def",
"parse_set_header",
"(",
"value",
",",
"on_update",
"=",
"None",
")",
":",
"if",
"not",
"value",
":",
"return",
"HeaderSet",
"(",
"None",
",",
"on_update",
")",
"return",
"HeaderSet",
"(",
"parse_list_header",
"(",
"value",
")",
",",
"on_update",
")... | Parse a set-like header and return a
:class:`~werkzeug.datastructures.HeaderSet` object:
>>> hs = parse_set_header('token, "quoted value"')
The return value is an object that treats the items case-insensitively
and keeps the order of the items:
>>> 'TOKEN' in hs
True
>>> hs.index('quoted ... | [
"Parse",
"a",
"set",
"-",
"like",
"header",
"and",
"return",
"a",
":",
"class",
":",
"~werkzeug",
".",
"datastructures",
".",
"HeaderSet",
"object",
":"
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/http.py#L507-L534 | train | Parse a set - like header and return a new HeaderSet 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/http.py | parse_authorization_header | def parse_authorization_header(value):
"""Parse an HTTP basic/digest authorization header transmitted by the web
browser. The return value is either `None` if the header was invalid or
not given, otherwise an :class:`~werkzeug.datastructures.Authorization`
object.
:param value: the authorization h... | python | def parse_authorization_header(value):
"""Parse an HTTP basic/digest authorization header transmitted by the web
browser. The return value is either `None` if the header was invalid or
not given, otherwise an :class:`~werkzeug.datastructures.Authorization`
object.
:param value: the authorization h... | [
"def",
"parse_authorization_header",
"(",
"value",
")",
":",
"if",
"not",
"value",
":",
"return",
"value",
"=",
"wsgi_to_bytes",
"(",
"value",
")",
"try",
":",
"auth_type",
",",
"auth_info",
"=",
"value",
".",
"split",
"(",
"None",
",",
"1",
")",
"auth_t... | Parse an HTTP basic/digest authorization header transmitted by the web
browser. The return value is either `None` if the header was invalid or
not given, otherwise an :class:`~werkzeug.datastructures.Authorization`
object.
:param value: the authorization header to parse.
:return: a :class:`~werkze... | [
"Parse",
"an",
"HTTP",
"basic",
"/",
"digest",
"authorization",
"header",
"transmitted",
"by",
"the",
"web",
"browser",
".",
"The",
"return",
"value",
"is",
"either",
"None",
"if",
"the",
"header",
"was",
"invalid",
"or",
"not",
"given",
"otherwise",
"an",
... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/http.py#L537-L574 | train | Parses an HTTP basic or digest authorization header transmitted by the web
browser. | 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/http.py | parse_www_authenticate_header | def parse_www_authenticate_header(value, on_update=None):
"""Parse an HTTP WWW-Authenticate header into a
:class:`~werkzeug.datastructures.WWWAuthenticate` object.
:param value: a WWW-Authenticate header to parse.
:param on_update: an optional callable that is called every time a value
... | python | def parse_www_authenticate_header(value, on_update=None):
"""Parse an HTTP WWW-Authenticate header into a
:class:`~werkzeug.datastructures.WWWAuthenticate` object.
:param value: a WWW-Authenticate header to parse.
:param on_update: an optional callable that is called every time a value
... | [
"def",
"parse_www_authenticate_header",
"(",
"value",
",",
"on_update",
"=",
"None",
")",
":",
"if",
"not",
"value",
":",
"return",
"WWWAuthenticate",
"(",
"on_update",
"=",
"on_update",
")",
"try",
":",
"auth_type",
",",
"auth_info",
"=",
"value",
".",
"spl... | Parse an HTTP WWW-Authenticate header into a
:class:`~werkzeug.datastructures.WWWAuthenticate` object.
:param value: a WWW-Authenticate header to parse.
:param on_update: an optional callable that is called every time a value
on the :class:`~werkzeug.datastructures.WWWAuthenticate`
... | [
"Parse",
"an",
"HTTP",
"WWW",
"-",
"Authenticate",
"header",
"into",
"a",
":",
"class",
":",
"~werkzeug",
".",
"datastructures",
".",
"WWWAuthenticate",
"object",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/http.py#L577-L594 | train | Parse an HTTP WWW - Authenticate header into a new 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/http.py | parse_if_range_header | def parse_if_range_header(value):
"""Parses an if-range header which can be an etag or a date. Returns
a :class:`~werkzeug.datastructures.IfRange` object.
.. versionadded:: 0.7
"""
if not value:
return IfRange()
date = parse_date(value)
if date is not None:
return IfRange(d... | python | def parse_if_range_header(value):
"""Parses an if-range header which can be an etag or a date. Returns
a :class:`~werkzeug.datastructures.IfRange` object.
.. versionadded:: 0.7
"""
if not value:
return IfRange()
date = parse_date(value)
if date is not None:
return IfRange(d... | [
"def",
"parse_if_range_header",
"(",
"value",
")",
":",
"if",
"not",
"value",
":",
"return",
"IfRange",
"(",
")",
"date",
"=",
"parse_date",
"(",
"value",
")",
"if",
"date",
"is",
"not",
"None",
":",
"return",
"IfRange",
"(",
"date",
"=",
"date",
")",
... | Parses an if-range header which can be an etag or a date. Returns
a :class:`~werkzeug.datastructures.IfRange` object.
.. versionadded:: 0.7 | [
"Parses",
"an",
"if",
"-",
"range",
"header",
"which",
"can",
"be",
"an",
"etag",
"or",
"a",
"date",
".",
"Returns",
"a",
":",
"class",
":",
"~werkzeug",
".",
"datastructures",
".",
"IfRange",
"object",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/http.py#L597-L609 | train | Parses an if - range header which can be an etag or a date. Returns a : class : ~werkzeug. datastructures. IfRange 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/http.py | parse_date | def parse_date(value):
"""Parse one of the following date formats into a datetime object:
.. sourcecode:: text
Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
Sun Nov 6 08:49:37 1994 ; ANSI C's asctime... | python | def parse_date(value):
"""Parse one of the following date formats into a datetime object:
.. sourcecode:: text
Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
Sun Nov 6 08:49:37 1994 ; ANSI C's asctime... | [
"def",
"parse_date",
"(",
"value",
")",
":",
"if",
"value",
":",
"t",
"=",
"parsedate_tz",
"(",
"value",
".",
"strip",
"(",
")",
")",
"if",
"t",
"is",
"not",
"None",
":",
"try",
":",
"year",
"=",
"t",
"[",
"0",
"]",
"# unfortunately that function doe... | Parse one of the following date formats into a datetime object:
.. sourcecode:: text
Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format
If parsing fail... | [
"Parse",
"one",
"of",
"the",
"following",
"date",
"formats",
"into",
"a",
"datetime",
"object",
":"
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/http.py#L780-L809 | train | Parse one of the date formats into a datetime 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/http.py | _dump_date | def _dump_date(d, delim):
"""Used for `http_date` and `cookie_date`."""
if d is None:
d = gmtime()
elif isinstance(d, datetime):
d = d.utctimetuple()
elif isinstance(d, (integer_types, float)):
d = gmtime(d)
return "%s, %02d%s%s%s%s %02d:%02d:%02d GMT" % (
("Mon", "Tu... | python | def _dump_date(d, delim):
"""Used for `http_date` and `cookie_date`."""
if d is None:
d = gmtime()
elif isinstance(d, datetime):
d = d.utctimetuple()
elif isinstance(d, (integer_types, float)):
d = gmtime(d)
return "%s, %02d%s%s%s%s %02d:%02d:%02d GMT" % (
("Mon", "Tu... | [
"def",
"_dump_date",
"(",
"d",
",",
"delim",
")",
":",
"if",
"d",
"is",
"None",
":",
"d",
"=",
"gmtime",
"(",
")",
"elif",
"isinstance",
"(",
"d",
",",
"datetime",
")",
":",
"d",
"=",
"d",
".",
"utctimetuple",
"(",
")",
"elif",
"isinstance",
"(",... | Used for `http_date` and `cookie_date`. | [
"Used",
"for",
"http_date",
"and",
"cookie_date",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/http.py#L812-L843 | train | Used for http_date and cookie_date. | 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/http.py | parse_age | def parse_age(value=None):
"""Parses a base-10 integer count of seconds into a timedelta.
If parsing fails, the return value is `None`.
:param value: a string consisting of an integer represented in base-10
:return: a :class:`datetime.timedelta` object or `None`.
"""
if not value:
retu... | python | def parse_age(value=None):
"""Parses a base-10 integer count of seconds into a timedelta.
If parsing fails, the return value is `None`.
:param value: a string consisting of an integer represented in base-10
:return: a :class:`datetime.timedelta` object or `None`.
"""
if not value:
retu... | [
"def",
"parse_age",
"(",
"value",
"=",
"None",
")",
":",
"if",
"not",
"value",
":",
"return",
"None",
"try",
":",
"seconds",
"=",
"int",
"(",
"value",
")",
"except",
"ValueError",
":",
"return",
"None",
"if",
"seconds",
"<",
"0",
":",
"return",
"None... | Parses a base-10 integer count of seconds into a timedelta.
If parsing fails, the return value is `None`.
:param value: a string consisting of an integer represented in base-10
:return: a :class:`datetime.timedelta` object or `None`. | [
"Parses",
"a",
"base",
"-",
"10",
"integer",
"count",
"of",
"seconds",
"into",
"a",
"timedelta",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/http.py#L875-L894 | train | Parses a base - 10 integer count of seconds into a timedelta. | 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/http.py | dump_age | def dump_age(age=None):
"""Formats the duration as a base-10 integer.
:param age: should be an integer number of seconds,
a :class:`datetime.timedelta` object, or,
if the age is unknown, `None` (default).
"""
if age is None:
return
if isinstance(age, timedelt... | python | def dump_age(age=None):
"""Formats the duration as a base-10 integer.
:param age: should be an integer number of seconds,
a :class:`datetime.timedelta` object, or,
if the age is unknown, `None` (default).
"""
if age is None:
return
if isinstance(age, timedelt... | [
"def",
"dump_age",
"(",
"age",
"=",
"None",
")",
":",
"if",
"age",
"is",
"None",
":",
"return",
"if",
"isinstance",
"(",
"age",
",",
"timedelta",
")",
":",
"# do the equivalent of Python 2.7's timedelta.total_seconds(),",
"# but disregarding fractional seconds",
"age"... | Formats the duration as a base-10 integer.
:param age: should be an integer number of seconds,
a :class:`datetime.timedelta` object, or,
if the age is unknown, `None` (default). | [
"Formats",
"the",
"duration",
"as",
"a",
"base",
"-",
"10",
"integer",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/http.py#L897-L915 | train | Formats the duration as a base - 10 integer. | 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/http.py | is_resource_modified | def is_resource_modified(
environ, etag=None, data=None, last_modified=None, ignore_if_range=True
):
"""Convenience method for conditional requests.
:param environ: the WSGI environment of the request to be checked.
:param etag: the etag for the response for comparison.
:param data: or alternativel... | python | def is_resource_modified(
environ, etag=None, data=None, last_modified=None, ignore_if_range=True
):
"""Convenience method for conditional requests.
:param environ: the WSGI environment of the request to be checked.
:param etag: the etag for the response for comparison.
:param data: or alternativel... | [
"def",
"is_resource_modified",
"(",
"environ",
",",
"etag",
"=",
"None",
",",
"data",
"=",
"None",
",",
"last_modified",
"=",
"None",
",",
"ignore_if_range",
"=",
"True",
")",
":",
"if",
"etag",
"is",
"None",
"and",
"data",
"is",
"not",
"None",
":",
"e... | Convenience method for conditional requests.
:param environ: the WSGI environment of the request to be checked.
:param etag: the etag for the response for comparison.
:param data: or alternatively the data of the response to automatically
generate an etag using :func:`generate_etag`.
:... | [
"Convenience",
"method",
"for",
"conditional",
"requests",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/http.py#L918-L982 | train | Returns True if the resource was modified. | 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/http.py | remove_entity_headers | def remove_entity_headers(headers, allowed=("expires", "content-location")):
"""Remove all entity headers from a list or :class:`Headers` object. This
operation works in-place. `Expires` and `Content-Location` headers are
by default not removed. The reason for this is :rfc:`2616` section
10.3.5 which... | python | def remove_entity_headers(headers, allowed=("expires", "content-location")):
"""Remove all entity headers from a list or :class:`Headers` object. This
operation works in-place. `Expires` and `Content-Location` headers are
by default not removed. The reason for this is :rfc:`2616` section
10.3.5 which... | [
"def",
"remove_entity_headers",
"(",
"headers",
",",
"allowed",
"=",
"(",
"\"expires\"",
",",
"\"content-location\"",
")",
")",
":",
"allowed",
"=",
"set",
"(",
"x",
".",
"lower",
"(",
")",
"for",
"x",
"in",
"allowed",
")",
"headers",
"[",
":",
"]",
"=... | Remove all entity headers from a list or :class:`Headers` object. This
operation works in-place. `Expires` and `Content-Location` headers are
by default not removed. The reason for this is :rfc:`2616` section
10.3.5 which specifies some entity headers that should be sent.
.. versionchanged:: 0.5
... | [
"Remove",
"all",
"entity",
"headers",
"from",
"a",
"list",
"or",
":",
"class",
":",
"Headers",
"object",
".",
"This",
"operation",
"works",
"in",
"-",
"place",
".",
"Expires",
"and",
"Content",
"-",
"Location",
"headers",
"are",
"by",
"default",
"not",
"... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/http.py#L985-L1003 | train | Removes all entity headers from a list or a list of headers. | 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/http.py | remove_hop_by_hop_headers | def remove_hop_by_hop_headers(headers):
"""Remove all HTTP/1.1 "Hop-by-Hop" headers from a list or
:class:`Headers` object. This operation works in-place.
.. versionadded:: 0.5
:param headers: a list or :class:`Headers` object.
"""
headers[:] = [
(key, value) for key, value in headers... | python | def remove_hop_by_hop_headers(headers):
"""Remove all HTTP/1.1 "Hop-by-Hop" headers from a list or
:class:`Headers` object. This operation works in-place.
.. versionadded:: 0.5
:param headers: a list or :class:`Headers` object.
"""
headers[:] = [
(key, value) for key, value in headers... | [
"def",
"remove_hop_by_hop_headers",
"(",
"headers",
")",
":",
"headers",
"[",
":",
"]",
"=",
"[",
"(",
"key",
",",
"value",
")",
"for",
"key",
",",
"value",
"in",
"headers",
"if",
"not",
"is_hop_by_hop_header",
"(",
"key",
")",
"]"
] | Remove all HTTP/1.1 "Hop-by-Hop" headers from a list or
:class:`Headers` object. This operation works in-place.
.. versionadded:: 0.5
:param headers: a list or :class:`Headers` object. | [
"Remove",
"all",
"HTTP",
"/",
"1",
".",
"1",
"Hop",
"-",
"by",
"-",
"Hop",
"headers",
"from",
"a",
"list",
"or",
":",
"class",
":",
"Headers",
"object",
".",
"This",
"operation",
"works",
"in",
"-",
"place",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/http.py#L1006-L1016 | train | Removes all HTTP / 1. 1 Hop - by - Hop headers from a list or
. | 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/http.py | parse_cookie | def parse_cookie(header, charset="utf-8", errors="replace", cls=None):
"""Parse a cookie. Either from a string or WSGI environ.
Per default encoding errors are ignored. If you want a different behavior
you can set `errors` to ``'replace'`` or ``'strict'``. In strict mode a
:exc:`HTTPUnicodeError` is... | python | def parse_cookie(header, charset="utf-8", errors="replace", cls=None):
"""Parse a cookie. Either from a string or WSGI environ.
Per default encoding errors are ignored. If you want a different behavior
you can set `errors` to ``'replace'`` or ``'strict'``. In strict mode a
:exc:`HTTPUnicodeError` is... | [
"def",
"parse_cookie",
"(",
"header",
",",
"charset",
"=",
"\"utf-8\"",
",",
"errors",
"=",
"\"replace\"",
",",
"cls",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"header",
",",
"dict",
")",
":",
"header",
"=",
"header",
".",
"get",
"(",
"\"HTTP_CO... | Parse a cookie. Either from a string or WSGI environ.
Per default encoding errors are ignored. If you want a different behavior
you can set `errors` to ``'replace'`` or ``'strict'``. In strict mode a
:exc:`HTTPUnicodeError` is raised.
.. versionchanged:: 0.5
This function now returns a :clas... | [
"Parse",
"a",
"cookie",
".",
"Either",
"from",
"a",
"string",
"or",
"WSGI",
"environ",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/http.py#L1041-L1083 | train | Parse a cookie from a string or WSGI environment. | 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/http.py | dump_cookie | def dump_cookie(
key,
value="",
max_age=None,
expires=None,
path="/",
domain=None,
secure=False,
httponly=False,
charset="utf-8",
sync_expires=True,
max_size=4093,
samesite=None,
):
"""Creates a new Set-Cookie header without the ``Set-Cookie`` prefix
The parameter... | python | def dump_cookie(
key,
value="",
max_age=None,
expires=None,
path="/",
domain=None,
secure=False,
httponly=False,
charset="utf-8",
sync_expires=True,
max_size=4093,
samesite=None,
):
"""Creates a new Set-Cookie header without the ``Set-Cookie`` prefix
The parameter... | [
"def",
"dump_cookie",
"(",
"key",
",",
"value",
"=",
"\"\"",
",",
"max_age",
"=",
"None",
",",
"expires",
"=",
"None",
",",
"path",
"=",
"\"/\"",
",",
"domain",
"=",
"None",
",",
"secure",
"=",
"False",
",",
"httponly",
"=",
"False",
",",
"charset",
... | Creates a new Set-Cookie header without the ``Set-Cookie`` prefix
The parameters are the same as in the cookie Morsel object in the
Python standard library but it accepts unicode data, too.
On Python 3 the return value of this function will be a unicode
string, on Python 2 it will be a native string. ... | [
"Creates",
"a",
"new",
"Set",
"-",
"Cookie",
"header",
"without",
"the",
"Set",
"-",
"Cookie",
"prefix",
"The",
"parameters",
"are",
"the",
"same",
"as",
"in",
"the",
"cookie",
"Morsel",
"object",
"in",
"the",
"Python",
"standard",
"library",
"but",
"it",
... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/http.py#L1086-L1219 | train | Dump a cookie to a new Set - Cookie header. | 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/http.py | is_byte_range_valid | def is_byte_range_valid(start, stop, length):
"""Checks if a given byte content range is valid for the given length.
.. versionadded:: 0.7
"""
if (start is None) != (stop is None):
return False
elif start is None:
return length is None or length >= 0
elif length is None:
... | python | def is_byte_range_valid(start, stop, length):
"""Checks if a given byte content range is valid for the given length.
.. versionadded:: 0.7
"""
if (start is None) != (stop is None):
return False
elif start is None:
return length is None or length >= 0
elif length is None:
... | [
"def",
"is_byte_range_valid",
"(",
"start",
",",
"stop",
",",
"length",
")",
":",
"if",
"(",
"start",
"is",
"None",
")",
"!=",
"(",
"stop",
"is",
"None",
")",
":",
"return",
"False",
"elif",
"start",
"is",
"None",
":",
"return",
"length",
"is",
"None... | Checks if a given byte content range is valid for the given length.
.. versionadded:: 0.7 | [
"Checks",
"if",
"a",
"given",
"byte",
"content",
"range",
"is",
"valid",
"for",
"the",
"given",
"length",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/http.py#L1222-L1235 | train | Checks if a given byte content range is valid for the given length. | 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/utils.py | expose | def expose(url_rule, endpoint=None, **kwargs):
"""Expose this function to the web layer."""
def decorate(f):
e = endpoint or f.__name__
endpoints[e] = f
url_map.add(Rule(url_rule, endpoint=e, **kwargs))
return f
return decorate | python | def expose(url_rule, endpoint=None, **kwargs):
"""Expose this function to the web layer."""
def decorate(f):
e = endpoint or f.__name__
endpoints[e] = f
url_map.add(Rule(url_rule, endpoint=e, **kwargs))
return f
return decorate | [
"def",
"expose",
"(",
"url_rule",
",",
"endpoint",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"decorate",
"(",
"f",
")",
":",
"e",
"=",
"endpoint",
"or",
"f",
".",
"__name__",
"endpoints",
"[",
"e",
"]",
"=",
"f",
"url_map",
".",
"add... | Expose this function to the web layer. | [
"Expose",
"this",
"function",
"to",
"the",
"web",
"layer",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/examples/plnt/utils.py#L64-L73 | train | Expose this function to the web layer. | 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/utils.py | render_template | def render_template(template_name, **context):
"""Render a template into a response."""
tmpl = jinja_env.get_template(template_name)
context["url_for"] = url_for
return Response(tmpl.render(context), mimetype="text/html") | python | def render_template(template_name, **context):
"""Render a template into a response."""
tmpl = jinja_env.get_template(template_name)
context["url_for"] = url_for
return Response(tmpl.render(context), mimetype="text/html") | [
"def",
"render_template",
"(",
"template_name",
",",
"*",
"*",
"context",
")",
":",
"tmpl",
"=",
"jinja_env",
".",
"get_template",
"(",
"template_name",
")",
"context",
"[",
"\"url_for\"",
"]",
"=",
"url_for",
"return",
"Response",
"(",
"tmpl",
".",
"render"... | Render a template into a response. | [
"Render",
"a",
"template",
"into",
"a",
"response",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/examples/plnt/utils.py#L76-L80 | train | Render a template into a 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 | examples/plnt/utils.py | nl2p | def nl2p(s):
"""Add paragraphs to a text."""
return u"\n".join(u"<p>%s</p>" % p for p in _par_re.split(s)) | python | def nl2p(s):
"""Add paragraphs to a text."""
return u"\n".join(u"<p>%s</p>" % p for p in _par_re.split(s)) | [
"def",
"nl2p",
"(",
"s",
")",
":",
"return",
"u\"\\n\"",
".",
"join",
"(",
"u\"<p>%s</p>\"",
"%",
"p",
"for",
"p",
"in",
"_par_re",
".",
"split",
"(",
"s",
")",
")"
] | Add paragraphs to a text. | [
"Add",
"paragraphs",
"to",
"a",
"text",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/examples/plnt/utils.py#L83-L85 | train | Add paragraphs to a text. | 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/utils.py | strip_tags | def strip_tags(s):
"""Resolve HTML entities and remove tags from a string."""
def handle_match(m):
name = m.group(1)
if name in html_entities:
return unichr(html_entities[name])
if name[:2] in ("#x", "#X"):
try:
return unichr(int(name[2:], 16))
... | python | def strip_tags(s):
"""Resolve HTML entities and remove tags from a string."""
def handle_match(m):
name = m.group(1)
if name in html_entities:
return unichr(html_entities[name])
if name[:2] in ("#x", "#X"):
try:
return unichr(int(name[2:], 16))
... | [
"def",
"strip_tags",
"(",
"s",
")",
":",
"def",
"handle_match",
"(",
"m",
")",
":",
"name",
"=",
"m",
".",
"group",
"(",
"1",
")",
"if",
"name",
"in",
"html_entities",
":",
"return",
"unichr",
"(",
"html_entities",
"[",
"name",
"]",
")",
"if",
"nam... | Resolve HTML entities and remove tags from a string. | [
"Resolve",
"HTML",
"entities",
"and",
"remove",
"tags",
"from",
"a",
"string",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/examples/plnt/utils.py#L93-L112 | train | Resolve HTML entities and remove tags from 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/wrappers/json.py | JSONMixin.is_json | def is_json(self):
"""Check if the mimetype indicates JSON data, either
:mimetype:`application/json` or :mimetype:`application/*+json`.
"""
mt = self.mimetype
return (
mt == "application/json"
or mt.startswith("application/")
and mt.endswith("+... | python | def is_json(self):
"""Check if the mimetype indicates JSON data, either
:mimetype:`application/json` or :mimetype:`application/*+json`.
"""
mt = self.mimetype
return (
mt == "application/json"
or mt.startswith("application/")
and mt.endswith("+... | [
"def",
"is_json",
"(",
"self",
")",
":",
"mt",
"=",
"self",
".",
"mimetype",
"return",
"(",
"mt",
"==",
"\"application/json\"",
"or",
"mt",
".",
"startswith",
"(",
"\"application/\"",
")",
"and",
"mt",
".",
"endswith",
"(",
"\"+json\"",
")",
")"
] | Check if the mimetype indicates JSON data, either
:mimetype:`application/json` or :mimetype:`application/*+json`. | [
"Check",
"if",
"the",
"mimetype",
"indicates",
"JSON",
"data",
"either",
":",
"mimetype",
":",
"application",
"/",
"json",
"or",
":",
"mimetype",
":",
"application",
"/",
"*",
"+",
"json",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/wrappers/json.py#L72-L81 | train | Check if the mimetype indicates JSON 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/json.py | JSONMixin.get_json | def get_json(self, force=False, silent=False, cache=True):
"""Parse :attr:`data` as JSON.
If the mimetype does not indicate JSON
(:mimetype:`application/json`, see :meth:`is_json`), this
returns ``None``.
If parsing fails, :meth:`on_json_loading_failed` is called and
it... | python | def get_json(self, force=False, silent=False, cache=True):
"""Parse :attr:`data` as JSON.
If the mimetype does not indicate JSON
(:mimetype:`application/json`, see :meth:`is_json`), this
returns ``None``.
If parsing fails, :meth:`on_json_loading_failed` is called and
it... | [
"def",
"get_json",
"(",
"self",
",",
"force",
"=",
"False",
",",
"silent",
"=",
"False",
",",
"cache",
"=",
"True",
")",
":",
"if",
"cache",
"and",
"self",
".",
"_cached_json",
"[",
"silent",
"]",
"is",
"not",
"Ellipsis",
":",
"return",
"self",
".",
... | Parse :attr:`data` as JSON.
If the mimetype does not indicate JSON
(:mimetype:`application/json`, see :meth:`is_json`), this
returns ``None``.
If parsing fails, :meth:`on_json_loading_failed` is called and
its return value is used as the return value.
:param force: Ign... | [
"Parse",
":",
"attr",
":",
"data",
"as",
"JSON",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/wrappers/json.py#L94-L137 | train | Parse the data as JSON and return the 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... |
pallets/werkzeug | src/werkzeug/middleware/proxy_fix.py | ProxyFix._get_trusted_comma | def _get_trusted_comma(self, trusted, value):
"""Get the real value from a comma-separated header based on the
configured number of trusted proxies.
:param trusted: Number of values to trust in the header.
:param value: Header value to parse.
:return: The real value, or ``None``... | python | def _get_trusted_comma(self, trusted, value):
"""Get the real value from a comma-separated header based on the
configured number of trusted proxies.
:param trusted: Number of values to trust in the header.
:param value: Header value to parse.
:return: The real value, or ``None``... | [
"def",
"_get_trusted_comma",
"(",
"self",
",",
"trusted",
",",
"value",
")",
":",
"if",
"not",
"(",
"trusted",
"and",
"value",
")",
":",
"return",
"values",
"=",
"[",
"x",
".",
"strip",
"(",
")",
"for",
"x",
"in",
"value",
".",
"split",
"(",
"\",\"... | Get the real value from a comma-separated header based on the
configured number of trusted proxies.
:param trusted: Number of values to trust in the header.
:param value: Header value to parse.
:return: The real value, or ``None`` if there are fewer values
than the number of... | [
"Get",
"the",
"real",
"value",
"from",
"a",
"comma",
"-",
"separated",
"header",
"based",
"on",
"the",
"configured",
"number",
"of",
"trusted",
"proxies",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/middleware/proxy_fix.py#L93-L108 | train | Get the real value from a comma - separated header based on the
configured number of trusted proxies. | 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/sync.py | sync | def sync():
"""
Performs a synchronization. Articles that are already syncronized aren't
touched anymore.
"""
for blog in Blog.query.all():
# parse the feed. feedparser.parse will never given an exception
# but the bozo bit might be defined.
feed = feedparser.parse(blog.feed_... | python | def sync():
"""
Performs a synchronization. Articles that are already syncronized aren't
touched anymore.
"""
for blog in Blog.query.all():
# parse the feed. feedparser.parse will never given an exception
# but the bozo bit might be defined.
feed = feedparser.parse(blog.feed_... | [
"def",
"sync",
"(",
")",
":",
"for",
"blog",
"in",
"Blog",
".",
"query",
".",
"all",
"(",
")",
":",
"# parse the feed. feedparser.parse will never given an exception",
"# but the bozo bit might be defined.",
"feed",
"=",
"feedparser",
".",
"parse",
"(",
"blog",
".",... | Performs a synchronization. Articles that are already syncronized aren't
touched anymore. | [
"Performs",
"a",
"synchronization",
".",
"Articles",
"that",
"are",
"already",
"syncronized",
"aren",
"t",
"touched",
"anymore",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/examples/plnt/sync.py#L26-L109 | train | Synchronizes the articles with the current blog. | 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/urls.py | _make_fast_url_quote | def _make_fast_url_quote(charset="utf-8", errors="strict", safe="/:", unsafe=""):
"""Precompile the translation table for a URL encoding function.
Unlike :func:`url_quote`, the generated function only takes the
string to quote.
:param charset: The charset to encode the result with.
:param errors: ... | python | def _make_fast_url_quote(charset="utf-8", errors="strict", safe="/:", unsafe=""):
"""Precompile the translation table for a URL encoding function.
Unlike :func:`url_quote`, the generated function only takes the
string to quote.
:param charset: The charset to encode the result with.
:param errors: ... | [
"def",
"_make_fast_url_quote",
"(",
"charset",
"=",
"\"utf-8\"",
",",
"errors",
"=",
"\"strict\"",
",",
"safe",
"=",
"\"/:\"",
",",
"unsafe",
"=",
"\"\"",
")",
":",
"if",
"isinstance",
"(",
"safe",
",",
"text_type",
")",
":",
"safe",
"=",
"safe",
".",
... | Precompile the translation table for a URL encoding function.
Unlike :func:`url_quote`, the generated function only takes the
string to quote.
:param charset: The charset to encode the result with.
:param errors: How to handle encoding errors.
:param safe: An optional sequence of safe characters t... | [
"Precompile",
"the",
"translation",
"table",
"for",
"a",
"URL",
"encoding",
"function",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/urls.py#L487-L517 | train | Precompile the translation table for a URL encoding 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 | src/werkzeug/urls.py | url_unquote_plus | def url_unquote_plus(s, charset="utf-8", errors="replace"):
"""URL decode a single string with the given `charset` and decode "+" to
whitespace.
Per default encoding errors are ignored. If you want a different behavior
you can set `errors` to ``'replace'`` or ``'strict'``. In strict mode a
:exc:`... | python | def url_unquote_plus(s, charset="utf-8", errors="replace"):
"""URL decode a single string with the given `charset` and decode "+" to
whitespace.
Per default encoding errors are ignored. If you want a different behavior
you can set `errors` to ``'replace'`` or ``'strict'``. In strict mode a
:exc:`... | [
"def",
"url_unquote_plus",
"(",
"s",
",",
"charset",
"=",
"\"utf-8\"",
",",
"errors",
"=",
"\"replace\"",
")",
":",
"if",
"isinstance",
"(",
"s",
",",
"text_type",
")",
":",
"s",
"=",
"s",
".",
"replace",
"(",
"u\"+\"",
",",
"u\" \"",
")",
"else",
":... | URL decode a single string with the given `charset` and decode "+" to
whitespace.
Per default encoding errors are ignored. If you want a different behavior
you can set `errors` to ``'replace'`` or ``'strict'``. In strict mode a
:exc:`HTTPUnicodeError` is raised.
:param s: The string to unquote.
... | [
"URL",
"decode",
"a",
"single",
"string",
"with",
"the",
"given",
"charset",
"and",
"decode",
"+",
"to",
"whitespace",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/urls.py#L614-L631 | train | URL decode a single string with the given charset and decode + to
whitespace. | 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/urls.py | _codec_error_url_quote | def _codec_error_url_quote(e):
"""Used in :func:`uri_to_iri` after unquoting to re-quote any
invalid bytes.
"""
out = _fast_url_quote(e.object[e.start : e.end])
if PY2:
out = out.decode("utf-8")
return out, e.end | python | def _codec_error_url_quote(e):
"""Used in :func:`uri_to_iri` after unquoting to re-quote any
invalid bytes.
"""
out = _fast_url_quote(e.object[e.start : e.end])
if PY2:
out = out.decode("utf-8")
return out, e.end | [
"def",
"_codec_error_url_quote",
"(",
"e",
")",
":",
"out",
"=",
"_fast_url_quote",
"(",
"e",
".",
"object",
"[",
"e",
".",
"start",
":",
"e",
".",
"end",
"]",
")",
"if",
"PY2",
":",
"out",
"=",
"out",
".",
"decode",
"(",
"\"utf-8\"",
")",
"return"... | Used in :func:`uri_to_iri` after unquoting to re-quote any
invalid bytes. | [
"Used",
"in",
":",
"func",
":",
"uri_to_iri",
"after",
"unquoting",
"to",
"re",
"-",
"quote",
"any",
"invalid",
"bytes",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/urls.py#L668-L677 | train | Used in codec_error_url_quote to re - quote any
invalid 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/urls.py | url_join | def url_join(base, url, allow_fragments=True):
"""Join a base URL and a possibly relative URL to form an absolute
interpretation of the latter.
:param base: the base URL for the join operation.
:param url: the URL to join.
:param allow_fragments: indicates whether fragments should be allowed.
"... | python | def url_join(base, url, allow_fragments=True):
"""Join a base URL and a possibly relative URL to form an absolute
interpretation of the latter.
:param base: the base URL for the join operation.
:param url: the URL to join.
:param allow_fragments: indicates whether fragments should be allowed.
"... | [
"def",
"url_join",
"(",
"base",
",",
"url",
",",
"allow_fragments",
"=",
"True",
")",
":",
"if",
"isinstance",
"(",
"base",
",",
"tuple",
")",
":",
"base",
"=",
"url_unparse",
"(",
"base",
")",
"if",
"isinstance",
"(",
"url",
",",
"tuple",
")",
":",
... | Join a base URL and a possibly relative URL to form an absolute
interpretation of the latter.
:param base: the base URL for the join operation.
:param url: the URL to join.
:param allow_fragments: indicates whether fragments should be allowed. | [
"Join",
"a",
"base",
"URL",
"and",
"a",
"possibly",
"relative",
"URL",
"to",
"form",
"an",
"absolute",
"interpretation",
"of",
"the",
"latter",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/urls.py#L975-L1039 | train | Join a base URL and a possibly relative URL to form an absolute 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/urls.py | BaseURL.ascii_host | def ascii_host(self):
"""Works exactly like :attr:`host` but will return a result that
is restricted to ASCII. If it finds a netloc that is not ASCII
it will attempt to idna decode it. This is useful for socket
operations when the URL might include internationalized characters.
... | python | def ascii_host(self):
"""Works exactly like :attr:`host` but will return a result that
is restricted to ASCII. If it finds a netloc that is not ASCII
it will attempt to idna decode it. This is useful for socket
operations when the URL might include internationalized characters.
... | [
"def",
"ascii_host",
"(",
"self",
")",
":",
"rv",
"=",
"self",
".",
"host",
"if",
"rv",
"is",
"not",
"None",
"and",
"isinstance",
"(",
"rv",
",",
"text_type",
")",
":",
"try",
":",
"rv",
"=",
"_encode_idna",
"(",
"rv",
")",
"except",
"UnicodeError",
... | Works exactly like :attr:`host` but will return a result that
is restricted to ASCII. If it finds a netloc that is not ASCII
it will attempt to idna decode it. This is useful for socket
operations when the URL might include internationalized characters. | [
"Works",
"exactly",
"like",
":",
"attr",
":",
"host",
"but",
"will",
"return",
"a",
"result",
"that",
"is",
"restricted",
"to",
"ASCII",
".",
"If",
"it",
"finds",
"a",
"netloc",
"that",
"is",
"not",
"ASCII",
"it",
"will",
"attempt",
"to",
"idna",
"deco... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/urls.py#L81-L93 | train | Returns a result that is restricted to 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/urls.py | BaseURL.port | def port(self):
"""The port in the URL as an integer if it was present, `None`
otherwise. This does not fill in default ports.
"""
try:
rv = int(to_native(self._split_host()[1]))
if 0 <= rv <= 65535:
return rv
except (ValueError, TypeError... | python | def port(self):
"""The port in the URL as an integer if it was present, `None`
otherwise. This does not fill in default ports.
"""
try:
rv = int(to_native(self._split_host()[1]))
if 0 <= rv <= 65535:
return rv
except (ValueError, TypeError... | [
"def",
"port",
"(",
"self",
")",
":",
"try",
":",
"rv",
"=",
"int",
"(",
"to_native",
"(",
"self",
".",
"_split_host",
"(",
")",
"[",
"1",
"]",
")",
")",
"if",
"0",
"<=",
"rv",
"<=",
"65535",
":",
"return",
"rv",
"except",
"(",
"ValueError",
",... | The port in the URL as an integer if it was present, `None`
otherwise. This does not fill in default ports. | [
"The",
"port",
"in",
"the",
"URL",
"as",
"an",
"integer",
"if",
"it",
"was",
"present",
"None",
"otherwise",
".",
"This",
"does",
"not",
"fill",
"in",
"default",
"ports",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/urls.py#L96-L105 | train | The port in the URL as an integer if it was present None otherwise. | 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/urls.py | BaseURL.get_file_location | def get_file_location(self, pathformat=None):
"""Returns a tuple with the location of the file in the form
``(server, location)``. If the netloc is empty in the URL or
points to localhost, it's represented as ``None``.
The `pathformat` by default is autodetection but needs to be set
... | python | def get_file_location(self, pathformat=None):
"""Returns a tuple with the location of the file in the form
``(server, location)``. If the netloc is empty in the URL or
points to localhost, it's represented as ``None``.
The `pathformat` by default is autodetection but needs to be set
... | [
"def",
"get_file_location",
"(",
"self",
",",
"pathformat",
"=",
"None",
")",
":",
"if",
"self",
".",
"scheme",
"!=",
"\"file\"",
":",
"return",
"None",
",",
"None",
"path",
"=",
"url_unquote",
"(",
"self",
".",
"path",
")",
"host",
"=",
"self",
".",
... | Returns a tuple with the location of the file in the form
``(server, location)``. If the netloc is empty in the URL or
points to localhost, it's represented as ``None``.
The `pathformat` by default is autodetection but needs to be set
when working with URLs of a specific system. The s... | [
"Returns",
"a",
"tuple",
"with",
"the",
"location",
"of",
"the",
"file",
"in",
"the",
"form",
"(",
"server",
"location",
")",
".",
"If",
"the",
"netloc",
"is",
"empty",
"in",
"the",
"URL",
"or",
"points",
"to",
"localhost",
"it",
"s",
"represented",
"a... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/urls.py#L210-L268 | train | Returns the server and location of the file in the form of tuple with the server and location. | 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/utils.py | generate_template | def generate_template(template_name, **context):
"""Load and generate a template."""
context.update(href=href, format_datetime=format_datetime)
return template_loader.load(template_name).generate(**context) | python | def generate_template(template_name, **context):
"""Load and generate a template."""
context.update(href=href, format_datetime=format_datetime)
return template_loader.load(template_name).generate(**context) | [
"def",
"generate_template",
"(",
"template_name",
",",
"*",
"*",
"context",
")",
":",
"context",
".",
"update",
"(",
"href",
"=",
"href",
",",
"format_datetime",
"=",
"format_datetime",
")",
"return",
"template_loader",
".",
"load",
"(",
"template_name",
")",
... | Load and generate a template. | [
"Load",
"and",
"generate",
"a",
"template",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/examples/simplewiki/utils.py#L54-L57 | train | Load and generate a template. | 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/utils.py | href | def href(*args, **kw):
"""
Simple function for URL generation. Position arguments are used for the
URL path and keyword arguments are used for the url parameters.
"""
result = [(request.script_root if request else "") + "/"]
for idx, arg in enumerate(args):
result.append(("/" if idx els... | python | def href(*args, **kw):
"""
Simple function for URL generation. Position arguments are used for the
URL path and keyword arguments are used for the url parameters.
"""
result = [(request.script_root if request else "") + "/"]
for idx, arg in enumerate(args):
result.append(("/" if idx els... | [
"def",
"href",
"(",
"*",
"args",
",",
"*",
"*",
"kw",
")",
":",
"result",
"=",
"[",
"(",
"request",
".",
"script_root",
"if",
"request",
"else",
"\"\"",
")",
"+",
"\"/\"",
"]",
"for",
"idx",
",",
"arg",
"in",
"enumerate",
"(",
"args",
")",
":",
... | Simple function for URL generation. Position arguments are used for the
URL path and keyword arguments are used for the url parameters. | [
"Simple",
"function",
"for",
"URL",
"generation",
".",
"Position",
"arguments",
"are",
"used",
"for",
"the",
"URL",
"path",
"and",
"keyword",
"arguments",
"are",
"used",
"for",
"the",
"url",
"parameters",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/examples/simplewiki/utils.py#L65-L75 | train | Simple function for URL generation. | 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/routing.py | parse_rule | def parse_rule(rule):
"""Parse a rule and return it as generator. Each iteration yields tuples
in the form ``(converter, arguments, variable)``. If the converter is
`None` it's a static url part, otherwise it's a dynamic one.
:internal:
"""
pos = 0
end = len(rule)
do_match = _rule_re.ma... | python | def parse_rule(rule):
"""Parse a rule and return it as generator. Each iteration yields tuples
in the form ``(converter, arguments, variable)``. If the converter is
`None` it's a static url part, otherwise it's a dynamic one.
:internal:
"""
pos = 0
end = len(rule)
do_match = _rule_re.ma... | [
"def",
"parse_rule",
"(",
"rule",
")",
":",
"pos",
"=",
"0",
"end",
"=",
"len",
"(",
"rule",
")",
"do_match",
"=",
"_rule_re",
".",
"match",
"used_names",
"=",
"set",
"(",
")",
"while",
"pos",
"<",
"end",
":",
"m",
"=",
"do_match",
"(",
"rule",
"... | Parse a rule and return it as generator. Each iteration yields tuples
in the form ``(converter, arguments, variable)``. If the converter is
`None` it's a static url part, otherwise it's a dynamic one.
:internal: | [
"Parse",
"a",
"rule",
"and",
"return",
"it",
"as",
"generator",
".",
"Each",
"iteration",
"yields",
"tuples",
"in",
"the",
"form",
"(",
"converter",
"arguments",
"variable",
")",
".",
"If",
"the",
"converter",
"is",
"None",
"it",
"s",
"a",
"static",
"url... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/routing.py#L202-L231 | train | Parse a rule and return it as generator. | 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/routing.py | Map.is_endpoint_expecting | def is_endpoint_expecting(self, endpoint, *arguments):
"""Iterate over all rules and check if the endpoint expects
the arguments provided. This is for example useful if you have
some URLs that expect a language code and others that do not and
you want to wrap the builder a bit so that t... | python | def is_endpoint_expecting(self, endpoint, *arguments):
"""Iterate over all rules and check if the endpoint expects
the arguments provided. This is for example useful if you have
some URLs that expect a language code and others that do not and
you want to wrap the builder a bit so that t... | [
"def",
"is_endpoint_expecting",
"(",
"self",
",",
"endpoint",
",",
"*",
"arguments",
")",
":",
"self",
".",
"update",
"(",
")",
"arguments",
"=",
"set",
"(",
"arguments",
")",
"for",
"rule",
"in",
"self",
".",
"_rules_by_endpoint",
"[",
"endpoint",
"]",
... | Iterate over all rules and check if the endpoint expects
the arguments provided. This is for example useful if you have
some URLs that expect a language code and others that do not and
you want to wrap the builder a bit so that the current language
code is automatically added if not pro... | [
"Iterate",
"over",
"all",
"rules",
"and",
"check",
"if",
"the",
"endpoint",
"expects",
"the",
"arguments",
"provided",
".",
"This",
"is",
"for",
"example",
"useful",
"if",
"you",
"have",
"some",
"URLs",
"that",
"expect",
"a",
"language",
"code",
"and",
"ot... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/routing.py#L1523-L1541 | train | Checks if the given endpoint expects the given 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/routing.py | Map.iter_rules | def iter_rules(self, endpoint=None):
"""Iterate over all rules or the rules of an endpoint.
:param endpoint: if provided only the rules for that endpoint
are returned.
:return: an iterator
"""
self.update()
if endpoint is not None:
re... | python | def iter_rules(self, endpoint=None):
"""Iterate over all rules or the rules of an endpoint.
:param endpoint: if provided only the rules for that endpoint
are returned.
:return: an iterator
"""
self.update()
if endpoint is not None:
re... | [
"def",
"iter_rules",
"(",
"self",
",",
"endpoint",
"=",
"None",
")",
":",
"self",
".",
"update",
"(",
")",
"if",
"endpoint",
"is",
"not",
"None",
":",
"return",
"iter",
"(",
"self",
".",
"_rules_by_endpoint",
"[",
"endpoint",
"]",
")",
"return",
"iter"... | Iterate over all rules or the rules of an endpoint.
:param endpoint: if provided only the rules for that endpoint
are returned.
:return: an iterator | [
"Iterate",
"over",
"all",
"rules",
"or",
"the",
"rules",
"of",
"an",
"endpoint",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/routing.py#L1543-L1553 | train | Iterate over all rules or the rules of an endpoint. | 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/routing.py | Map.add | def add(self, rulefactory):
"""Add a new rule or factory to the map and bind it. Requires that the
rule is not bound to another map.
:param rulefactory: a :class:`Rule` or :class:`RuleFactory`
"""
for rule in rulefactory.get_rules(self):
rule.bind(self)
... | python | def add(self, rulefactory):
"""Add a new rule or factory to the map and bind it. Requires that the
rule is not bound to another map.
:param rulefactory: a :class:`Rule` or :class:`RuleFactory`
"""
for rule in rulefactory.get_rules(self):
rule.bind(self)
... | [
"def",
"add",
"(",
"self",
",",
"rulefactory",
")",
":",
"for",
"rule",
"in",
"rulefactory",
".",
"get_rules",
"(",
"self",
")",
":",
"rule",
".",
"bind",
"(",
"self",
")",
"self",
".",
"_rules",
".",
"append",
"(",
"rule",
")",
"self",
".",
"_rule... | Add a new rule or factory to the map and bind it. Requires that the
rule is not bound to another map.
:param rulefactory: a :class:`Rule` or :class:`RuleFactory` | [
"Add",
"a",
"new",
"rule",
"or",
"factory",
"to",
"the",
"map",
"and",
"bind",
"it",
".",
"Requires",
"that",
"the",
"rule",
"is",
"not",
"bound",
"to",
"another",
"map",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/routing.py#L1555-L1565 | train | Adds a new rule or factory to the map and binds it to the rules_by_endpoint. | 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/routing.py | Map.bind | def bind(
self,
server_name,
script_name=None,
subdomain=None,
url_scheme="http",
default_method="GET",
path_info=None,
query_args=None,
):
"""Return a new :class:`MapAdapter` with the details specified to the
call. Note that `script_n... | python | def bind(
self,
server_name,
script_name=None,
subdomain=None,
url_scheme="http",
default_method="GET",
path_info=None,
query_args=None,
):
"""Return a new :class:`MapAdapter` with the details specified to the
call. Note that `script_n... | [
"def",
"bind",
"(",
"self",
",",
"server_name",
",",
"script_name",
"=",
"None",
",",
"subdomain",
"=",
"None",
",",
"url_scheme",
"=",
"\"http\"",
",",
"default_method",
"=",
"\"GET\"",
",",
"path_info",
"=",
"None",
",",
"query_args",
"=",
"None",
",",
... | Return a new :class:`MapAdapter` with the details specified to the
call. Note that `script_name` will default to ``'/'`` if not further
specified or `None`. The `server_name` at least is a requirement
because the HTTP RFC requires absolute URLs for redirects and so all
redirect excepti... | [
"Return",
"a",
"new",
":",
"class",
":",
"MapAdapter",
"with",
"the",
"details",
"specified",
"to",
"the",
"call",
".",
"Note",
"that",
"script_name",
"will",
"default",
"to",
"/",
"if",
"not",
"further",
"specified",
"or",
"None",
".",
"The",
"server_name... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/routing.py#L1567-L1625 | train | Bind a new instance of the class MapAdapter with the details specified to the current instance. | 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/routing.py | Map.bind_to_environ | def bind_to_environ(self, environ, server_name=None, subdomain=None):
"""Like :meth:`bind` but you can pass it an WSGI environment and it
will fetch the information from that dictionary. Note that because of
limitations in the protocol there is no way to get the current
subdomain and re... | python | def bind_to_environ(self, environ, server_name=None, subdomain=None):
"""Like :meth:`bind` but you can pass it an WSGI environment and it
will fetch the information from that dictionary. Note that because of
limitations in the protocol there is no way to get the current
subdomain and re... | [
"def",
"bind_to_environ",
"(",
"self",
",",
"environ",
",",
"server_name",
"=",
"None",
",",
"subdomain",
"=",
"None",
")",
":",
"environ",
"=",
"_get_environ",
"(",
"environ",
")",
"wsgi_server_name",
"=",
"get_host",
"(",
"environ",
")",
".",
"lower",
"(... | Like :meth:`bind` but you can pass it an WSGI environment and it
will fetch the information from that dictionary. Note that because of
limitations in the protocol there is no way to get the current
subdomain and real `server_name` from the environment. If you don't
provide it, Werkzeug... | [
"Like",
":",
"meth",
":",
"bind",
"but",
"you",
"can",
"pass",
"it",
"an",
"WSGI",
"environment",
"and",
"it",
"will",
"fetch",
"the",
"information",
"from",
"that",
"dictionary",
".",
"Note",
"that",
"because",
"of",
"limitations",
"in",
"the",
"protocol"... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/routing.py#L1627-L1701 | train | Bind to the WSGI environment and return the server name and subdomain. | 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/routing.py | Map.update | def update(self):
"""Called before matching and building to keep the compiled rules
in the correct order after things changed.
"""
if not self._remap:
return
with self._remap_lock:
if not self._remap:
return
self._rules.sort(k... | python | def update(self):
"""Called before matching and building to keep the compiled rules
in the correct order after things changed.
"""
if not self._remap:
return
with self._remap_lock:
if not self._remap:
return
self._rules.sort(k... | [
"def",
"update",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_remap",
":",
"return",
"with",
"self",
".",
"_remap_lock",
":",
"if",
"not",
"self",
".",
"_remap",
":",
"return",
"self",
".",
"_rules",
".",
"sort",
"(",
"key",
"=",
"lambda",
"x... | Called before matching and building to keep the compiled rules
in the correct order after things changed. | [
"Called",
"before",
"matching",
"and",
"building",
"to",
"keep",
"the",
"compiled",
"rules",
"in",
"the",
"correct",
"order",
"after",
"things",
"changed",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/routing.py#L1703-L1717 | train | Called before matching and building to keep the compiled rules
in the correct order after things changed. | 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/routing.py | MapAdapter.dispatch | def dispatch(
self, view_func, path_info=None, method=None, catch_http_exceptions=False
):
"""Does the complete dispatching process. `view_func` is called with
the endpoint and a dict with the values for the view. It should
look up the view function, call it, and return a response ... | python | def dispatch(
self, view_func, path_info=None, method=None, catch_http_exceptions=False
):
"""Does the complete dispatching process. `view_func` is called with
the endpoint and a dict with the values for the view. It should
look up the view function, call it, and return a response ... | [
"def",
"dispatch",
"(",
"self",
",",
"view_func",
",",
"path_info",
"=",
"None",
",",
"method",
"=",
"None",
",",
"catch_http_exceptions",
"=",
"False",
")",
":",
"try",
":",
"try",
":",
"endpoint",
",",
"args",
"=",
"self",
".",
"match",
"(",
"path_in... | Does the complete dispatching process. `view_func` is called with
the endpoint and a dict with the values for the view. It should
look up the view function, call it, and return a response object
or WSGI application. http exceptions are not caught by default
so that applications can di... | [
"Does",
"the",
"complete",
"dispatching",
"process",
".",
"view_func",
"is",
"called",
"with",
"the",
"endpoint",
"and",
"a",
"dict",
"with",
"the",
"values",
"for",
"the",
"view",
".",
"It",
"should",
"look",
"up",
"the",
"view",
"function",
"call",
"it",... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/routing.py#L1753-L1807 | train | This method is called by the dispatching process. It is called by the dispatching process. It is called by the dispatching process. It is called by the dispatching process. | 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/routing.py | MapAdapter.allowed_methods | def allowed_methods(self, path_info=None):
"""Returns the valid methods that match for a given path.
.. versionadded:: 0.7
"""
try:
self.match(path_info, method="--")
except MethodNotAllowed as e:
return e.valid_methods
except HTTPException:
... | python | def allowed_methods(self, path_info=None):
"""Returns the valid methods that match for a given path.
.. versionadded:: 0.7
"""
try:
self.match(path_info, method="--")
except MethodNotAllowed as e:
return e.valid_methods
except HTTPException:
... | [
"def",
"allowed_methods",
"(",
"self",
",",
"path_info",
"=",
"None",
")",
":",
"try",
":",
"self",
".",
"match",
"(",
"path_info",
",",
"method",
"=",
"\"--\"",
")",
"except",
"MethodNotAllowed",
"as",
"e",
":",
"return",
"e",
".",
"valid_methods",
"exc... | Returns the valid methods that match for a given path.
.. versionadded:: 0.7 | [
"Returns",
"the",
"valid",
"methods",
"that",
"match",
"for",
"a",
"given",
"path",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/routing.py#L1979-L1990 | train | Returns the list of allowed methods that match for a 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/routing.py | MapAdapter.get_host | def get_host(self, domain_part):
"""Figures out the full host name for the given domain part. The
domain part is a subdomain in case host matching is disabled or
a full host name.
"""
if self.map.host_matching:
if domain_part is None:
return self.serv... | python | def get_host(self, domain_part):
"""Figures out the full host name for the given domain part. The
domain part is a subdomain in case host matching is disabled or
a full host name.
"""
if self.map.host_matching:
if domain_part is None:
return self.serv... | [
"def",
"get_host",
"(",
"self",
",",
"domain_part",
")",
":",
"if",
"self",
".",
"map",
".",
"host_matching",
":",
"if",
"domain_part",
"is",
"None",
":",
"return",
"self",
".",
"server_name",
"return",
"to_unicode",
"(",
"domain_part",
",",
"\"ascii\"",
"... | Figures out the full host name for the given domain part. The
domain part is a subdomain in case host matching is disabled or
a full host name. | [
"Figures",
"out",
"the",
"full",
"host",
"name",
"for",
"the",
"given",
"domain",
"part",
".",
"The",
"domain",
"part",
"is",
"a",
"subdomain",
"in",
"case",
"host",
"matching",
"is",
"disabled",
"or",
"a",
"full",
"host",
"name",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/routing.py#L1992-L2006 | train | Figures out the full host name for the given domain part. | 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/routing.py | MapAdapter.get_default_redirect | def get_default_redirect(self, rule, method, values, query_args):
"""A helper that returns the URL to redirect to if it finds one.
This is used for default redirecting only.
:internal:
"""
assert self.map.redirect_defaults
for r in self.map._rules_by_endpoint[rule.endpoi... | python | def get_default_redirect(self, rule, method, values, query_args):
"""A helper that returns the URL to redirect to if it finds one.
This is used for default redirecting only.
:internal:
"""
assert self.map.redirect_defaults
for r in self.map._rules_by_endpoint[rule.endpoi... | [
"def",
"get_default_redirect",
"(",
"self",
",",
"rule",
",",
"method",
",",
"values",
",",
"query_args",
")",
":",
"assert",
"self",
".",
"map",
".",
"redirect_defaults",
"for",
"r",
"in",
"self",
".",
"map",
".",
"_rules_by_endpoint",
"[",
"rule",
".",
... | A helper that returns the URL to redirect to if it finds one.
This is used for default redirecting only.
:internal: | [
"A",
"helper",
"that",
"returns",
"the",
"URL",
"to",
"redirect",
"to",
"if",
"it",
"finds",
"one",
".",
"This",
"is",
"used",
"for",
"default",
"redirecting",
"only",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/routing.py#L2008-L2024 | train | A helper that returns the URL to redirect to if it finds one. | 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/routing.py | MapAdapter.make_redirect_url | def make_redirect_url(self, path_info, query_args=None, domain_part=None):
"""Creates a redirect URL.
:internal:
"""
suffix = ""
if query_args:
suffix = "?" + self.encode_query_args(query_args)
return str(
"%s://%s/%s%s"
% (
... | python | def make_redirect_url(self, path_info, query_args=None, domain_part=None):
"""Creates a redirect URL.
:internal:
"""
suffix = ""
if query_args:
suffix = "?" + self.encode_query_args(query_args)
return str(
"%s://%s/%s%s"
% (
... | [
"def",
"make_redirect_url",
"(",
"self",
",",
"path_info",
",",
"query_args",
"=",
"None",
",",
"domain_part",
"=",
"None",
")",
":",
"suffix",
"=",
"\"\"",
"if",
"query_args",
":",
"suffix",
"=",
"\"?\"",
"+",
"self",
".",
"encode_query_args",
"(",
"query... | Creates a redirect URL.
:internal: | [
"Creates",
"a",
"redirect",
"URL",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/routing.py#L2031-L2049 | train | Creates a redirect 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/routing.py | MapAdapter._partial_build | def _partial_build(self, endpoint, values, method, append_unknown):
"""Helper for :meth:`build`. Returns subdomain and path for the
rule that accepts this endpoint, values and method.
:internal:
"""
# in case the method is none, try with the default method first
if meth... | python | def _partial_build(self, endpoint, values, method, append_unknown):
"""Helper for :meth:`build`. Returns subdomain and path for the
rule that accepts this endpoint, values and method.
:internal:
"""
# in case the method is none, try with the default method first
if meth... | [
"def",
"_partial_build",
"(",
"self",
",",
"endpoint",
",",
"values",
",",
"method",
",",
"append_unknown",
")",
":",
"# in case the method is none, try with the default method first",
"if",
"method",
"is",
"None",
":",
"rv",
"=",
"self",
".",
"_partial_build",
"(",... | Helper for :meth:`build`. Returns subdomain and path for the
rule that accepts this endpoint, values and method.
:internal: | [
"Helper",
"for",
":",
"meth",
":",
"build",
".",
"Returns",
"subdomain",
"and",
"path",
"for",
"the",
"rule",
"that",
"accepts",
"this",
"endpoint",
"values",
"and",
"method",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/routing.py#L2061-L2081 | train | Helper for build. | 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/routing.py | MapAdapter.build | def build(
self,
endpoint,
values=None,
method=None,
force_external=False,
append_unknown=True,
):
"""Building URLs works pretty much the other way round. Instead of
`match` you call `build` and pass it the endpoint and a dict of
arguments for... | python | def build(
self,
endpoint,
values=None,
method=None,
force_external=False,
append_unknown=True,
):
"""Building URLs works pretty much the other way round. Instead of
`match` you call `build` and pass it the endpoint and a dict of
arguments for... | [
"def",
"build",
"(",
"self",
",",
"endpoint",
",",
"values",
"=",
"None",
",",
"method",
"=",
"None",
",",
"force_external",
"=",
"False",
",",
"append_unknown",
"=",
"True",
",",
")",
":",
"self",
".",
"map",
".",
"update",
"(",
")",
"if",
"values",... | Building URLs works pretty much the other way round. Instead of
`match` you call `build` and pass it the endpoint and a dict of
arguments for the placeholders.
The `build` function also accepts an argument called `force_external`
which, if you set it to `True` will force external URLs.... | [
"Building",
"URLs",
"works",
"pretty",
"much",
"the",
"other",
"way",
"round",
".",
"Instead",
"of",
"match",
"you",
"call",
"build",
"and",
"pass",
"it",
"the",
"endpoint",
"and",
"a",
"dict",
"of",
"arguments",
"for",
"the",
"placeholders",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/routing.py#L2083-L2200 | train | Builds a URL for the given base 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 | examples/coolmagic/utils.py | export | def export(string, template=None, **extra):
"""
Decorator for registering view functions and adding
templates to it.
"""
def wrapped(f):
endpoint = (f.__module__ + "." + f.__name__)[16:]
if template is not None:
old_f = f
def f(**kwargs):
rv ... | python | def export(string, template=None, **extra):
"""
Decorator for registering view functions and adding
templates to it.
"""
def wrapped(f):
endpoint = (f.__module__ + "." + f.__name__)[16:]
if template is not None:
old_f = f
def f(**kwargs):
rv ... | [
"def",
"export",
"(",
"string",
",",
"template",
"=",
"None",
",",
"*",
"*",
"extra",
")",
":",
"def",
"wrapped",
"(",
"f",
")",
":",
"endpoint",
"=",
"(",
"f",
".",
"__module__",
"+",
"\".\"",
"+",
"f",
".",
"__name__",
")",
"[",
"16",
":",
"]... | Decorator for registering view functions and adding
templates to it. | [
"Decorator",
"for",
"registering",
"view",
"functions",
"and",
"adding",
"templates",
"to",
"it",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/examples/coolmagic/utils.py#L33-L55 | train | Decorator for registering a function and adding a new template to the views 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... |
pallets/werkzeug | src/werkzeug/local.py | LocalStack.push | def push(self, obj):
"""Pushes a new item to the stack"""
rv = getattr(self._local, "stack", None)
if rv is None:
self._local.stack = rv = []
rv.append(obj)
return rv | python | def push(self, obj):
"""Pushes a new item to the stack"""
rv = getattr(self._local, "stack", None)
if rv is None:
self._local.stack = rv = []
rv.append(obj)
return rv | [
"def",
"push",
"(",
"self",
",",
"obj",
")",
":",
"rv",
"=",
"getattr",
"(",
"self",
".",
"_local",
",",
"\"stack\"",
",",
"None",
")",
"if",
"rv",
"is",
"None",
":",
"self",
".",
"_local",
".",
"stack",
"=",
"rv",
"=",
"[",
"]",
"rv",
".",
"... | Pushes a new item to the stack | [
"Pushes",
"a",
"new",
"item",
"to",
"the",
"stack"
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/local.py#L142-L148 | train | Pushes a new item to the stack | 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/local.py | LocalStack.pop | def pop(self):
"""Removes the topmost item from the stack, will return the
old value or `None` if the stack was already empty.
"""
stack = getattr(self._local, "stack", None)
if stack is None:
return None
elif len(stack) == 1:
release_local(self._l... | python | def pop(self):
"""Removes the topmost item from the stack, will return the
old value or `None` if the stack was already empty.
"""
stack = getattr(self._local, "stack", None)
if stack is None:
return None
elif len(stack) == 1:
release_local(self._l... | [
"def",
"pop",
"(",
"self",
")",
":",
"stack",
"=",
"getattr",
"(",
"self",
".",
"_local",
",",
"\"stack\"",
",",
"None",
")",
"if",
"stack",
"is",
"None",
":",
"return",
"None",
"elif",
"len",
"(",
"stack",
")",
"==",
"1",
":",
"release_local",
"("... | Removes the topmost item from the stack, will return the
old value or `None` if the stack was already empty. | [
"Removes",
"the",
"topmost",
"item",
"from",
"the",
"stack",
"will",
"return",
"the",
"old",
"value",
"or",
"None",
"if",
"the",
"stack",
"was",
"already",
"empty",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/local.py#L150-L161 | train | Removes the topmost item from the stack. Returns None if the stack is empty. | 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/local.py | LocalManager.make_middleware | def make_middleware(self, app):
"""Wrap a WSGI application so that cleaning up happens after
request end.
"""
def application(environ, start_response):
return ClosingIterator(app(environ, start_response), self.cleanup)
return application | python | def make_middleware(self, app):
"""Wrap a WSGI application so that cleaning up happens after
request end.
"""
def application(environ, start_response):
return ClosingIterator(app(environ, start_response), self.cleanup)
return application | [
"def",
"make_middleware",
"(",
"self",
",",
"app",
")",
":",
"def",
"application",
"(",
"environ",
",",
"start_response",
")",
":",
"return",
"ClosingIterator",
"(",
"app",
"(",
"environ",
",",
"start_response",
")",
",",
"self",
".",
"cleanup",
")",
"retu... | Wrap a WSGI application so that cleaning up happens after
request end. | [
"Wrap",
"a",
"WSGI",
"application",
"so",
"that",
"cleaning",
"up",
"happens",
"after",
"request",
"end",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/local.py#L225-L233 | train | Wrap a WSGI application so that cleaning up happens after
request end. | 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/etag.py | ETagResponseMixin._wrap_response | def _wrap_response(self, start, length):
"""Wrap existing Response in case of Range Request context."""
if self.status_code == 206:
self.response = _RangeWrapper(self.response, start, length) | python | def _wrap_response(self, start, length):
"""Wrap existing Response in case of Range Request context."""
if self.status_code == 206:
self.response = _RangeWrapper(self.response, start, length) | [
"def",
"_wrap_response",
"(",
"self",
",",
"start",
",",
"length",
")",
":",
"if",
"self",
".",
"status_code",
"==",
"206",
":",
"self",
".",
"response",
"=",
"_RangeWrapper",
"(",
"self",
".",
"response",
",",
"start",
",",
"length",
")"
] | Wrap existing Response in case of Range Request context. | [
"Wrap",
"existing",
"Response",
"in",
"case",
"of",
"Range",
"Request",
"context",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/wrappers/etag.py#L112-L115 | train | Wrap existing Response in case of Range Request context. | 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/etag.py | ETagResponseMixin._is_range_request_processable | def _is_range_request_processable(self, environ):
"""Return ``True`` if `Range` header is present and if underlying
resource is considered unchanged when compared with `If-Range` header.
"""
return (
"HTTP_IF_RANGE" not in environ
or not is_resource_modified(
... | python | def _is_range_request_processable(self, environ):
"""Return ``True`` if `Range` header is present and if underlying
resource is considered unchanged when compared with `If-Range` header.
"""
return (
"HTTP_IF_RANGE" not in environ
or not is_resource_modified(
... | [
"def",
"_is_range_request_processable",
"(",
"self",
",",
"environ",
")",
":",
"return",
"(",
"\"HTTP_IF_RANGE\"",
"not",
"in",
"environ",
"or",
"not",
"is_resource_modified",
"(",
"environ",
",",
"self",
".",
"headers",
".",
"get",
"(",
"\"etag\"",
")",
",",
... | Return ``True`` if `Range` header is present and if underlying
resource is considered unchanged when compared with `If-Range` header. | [
"Return",
"True",
"if",
"Range",
"header",
"is",
"present",
"and",
"if",
"underlying",
"resource",
"is",
"considered",
"unchanged",
"when",
"compared",
"with",
"If",
"-",
"Range",
"header",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/wrappers/etag.py#L117-L130 | train | Return True if Range header is present and if If - Range header is not present and if the underlying
resource is considered unchanged when compared with If - Range header. | 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/etag.py | ETagResponseMixin._process_range_request | def _process_range_request(self, environ, complete_length=None, accept_ranges=None):
"""Handle Range Request related headers (RFC7233). If `Accept-Ranges`
header is valid, and Range Request is processable, we set the headers
as described by the RFC, and wrap the underlying response in a
... | python | def _process_range_request(self, environ, complete_length=None, accept_ranges=None):
"""Handle Range Request related headers (RFC7233). If `Accept-Ranges`
header is valid, and Range Request is processable, we set the headers
as described by the RFC, and wrap the underlying response in a
... | [
"def",
"_process_range_request",
"(",
"self",
",",
"environ",
",",
"complete_length",
"=",
"None",
",",
"accept_ranges",
"=",
"None",
")",
":",
"from",
".",
".",
"exceptions",
"import",
"RequestedRangeNotSatisfiable",
"if",
"accept_ranges",
"is",
"None",
":",
"r... | Handle Range Request related headers (RFC7233). If `Accept-Ranges`
header is valid, and Range Request is processable, we set the headers
as described by the RFC, and wrap the underlying response in a
RangeWrapper.
Returns ``True`` if Range Request can be fulfilled, ``False`` otherwise.... | [
"Handle",
"Range",
"Request",
"related",
"headers",
"(",
"RFC7233",
")",
".",
"If",
"Accept",
"-",
"Ranges",
"header",
"is",
"valid",
"and",
"Range",
"Request",
"is",
"processable",
"we",
"set",
"the",
"headers",
"as",
"described",
"by",
"the",
"RFC",
"and... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/wrappers/etag.py#L132-L166 | train | Handle Range Request related headers. | 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/etag.py | ETagResponseMixin.make_conditional | def make_conditional(
self, request_or_environ, accept_ranges=False, complete_length=None
):
"""Make the response conditional to the request. This method works
best if an etag was defined for the response already. The `add_etag`
method can be used to do that. If called without eta... | python | def make_conditional(
self, request_or_environ, accept_ranges=False, complete_length=None
):
"""Make the response conditional to the request. This method works
best if an etag was defined for the response already. The `add_etag`
method can be used to do that. If called without eta... | [
"def",
"make_conditional",
"(",
"self",
",",
"request_or_environ",
",",
"accept_ranges",
"=",
"False",
",",
"complete_length",
"=",
"None",
")",
":",
"environ",
"=",
"_get_environ",
"(",
"request_or_environ",
")",
"if",
"environ",
"[",
"\"REQUEST_METHOD\"",
"]",
... | Make the response conditional to the request. This method works
best if an etag was defined for the response already. The `add_etag`
method can be used to do that. If called without etag just the date
header is set.
This does nothing if the request method in the request or environ is... | [
"Make",
"the",
"response",
"conditional",
"to",
"the",
"request",
".",
"This",
"method",
"works",
"best",
"if",
"an",
"etag",
"was",
"defined",
"for",
"the",
"response",
"already",
".",
"The",
"add_etag",
"method",
"can",
"be",
"used",
"to",
"do",
"that",
... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/wrappers/etag.py#L168-L234 | train | This method creates a new response object that is a conditional to 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/etag.py | ETagResponseMixin.add_etag | def add_etag(self, overwrite=False, weak=False):
"""Add an etag for the current response if there is none yet."""
if overwrite or "etag" not in self.headers:
self.set_etag(generate_etag(self.get_data()), weak) | python | def add_etag(self, overwrite=False, weak=False):
"""Add an etag for the current response if there is none yet."""
if overwrite or "etag" not in self.headers:
self.set_etag(generate_etag(self.get_data()), weak) | [
"def",
"add_etag",
"(",
"self",
",",
"overwrite",
"=",
"False",
",",
"weak",
"=",
"False",
")",
":",
"if",
"overwrite",
"or",
"\"etag\"",
"not",
"in",
"self",
".",
"headers",
":",
"self",
".",
"set_etag",
"(",
"generate_etag",
"(",
"self",
".",
"get_da... | Add an etag for the current response if there is none yet. | [
"Add",
"an",
"etag",
"for",
"the",
"current",
"response",
"if",
"there",
"is",
"none",
"yet",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/wrappers/etag.py#L236-L239 | train | Add an etag for the current response if it does not already 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 | src/werkzeug/wrappers/etag.py | ETagResponseMixin.set_etag | def set_etag(self, etag, weak=False):
"""Set the etag, and override the old one if there was one."""
self.headers["ETag"] = quote_etag(etag, weak) | python | def set_etag(self, etag, weak=False):
"""Set the etag, and override the old one if there was one."""
self.headers["ETag"] = quote_etag(etag, weak) | [
"def",
"set_etag",
"(",
"self",
",",
"etag",
",",
"weak",
"=",
"False",
")",
":",
"self",
".",
"headers",
"[",
"\"ETag\"",
"]",
"=",
"quote_etag",
"(",
"etag",
",",
"weak",
")"
] | Set the etag, and override the old one if there was one. | [
"Set",
"the",
"etag",
"and",
"override",
"the",
"old",
"one",
"if",
"there",
"was",
"one",
"."
] | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/wrappers/etag.py#L241-L243 | train | Set the etag and override the old one. | 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/etag.py | ETagResponseMixin.freeze | def freeze(self, no_etag=False):
"""Call this method if you want to make your response object ready for
pickeling. This buffers the generator if there is one. This also
sets the etag unless `no_etag` is set to `True`.
"""
if not no_etag:
self.add_etag()
supe... | python | def freeze(self, no_etag=False):
"""Call this method if you want to make your response object ready for
pickeling. This buffers the generator if there is one. This also
sets the etag unless `no_etag` is set to `True`.
"""
if not no_etag:
self.add_etag()
supe... | [
"def",
"freeze",
"(",
"self",
",",
"no_etag",
"=",
"False",
")",
":",
"if",
"not",
"no_etag",
":",
"self",
".",
"add_etag",
"(",
")",
"super",
"(",
"ETagResponseMixin",
",",
"self",
")",
".",
"freeze",
"(",
")"
] | Call this method if you want to make your response object ready for
pickeling. This buffers the generator if there is one. This also
sets the etag unless `no_etag` is set to `True`. | [
"Call",
"this",
"method",
"if",
"you",
"want",
"to",
"make",
"your",
"response",
"object",
"ready",
"for",
"pickeling",
".",
"This",
"buffers",
"the",
"generator",
"if",
"there",
"is",
"one",
".",
"This",
"also",
"sets",
"the",
"etag",
"unless",
"no_etag",... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/wrappers/etag.py#L251-L258 | train | Call this method if you want to make your response object ready for pickeling. | 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 | get_host | def get_host(environ, trusted_hosts=None):
"""Return the host for the given WSGI environment. This first checks
the ``Host`` header. If it's not present, then ``SERVER_NAME`` and
``SERVER_PORT`` are used. The host will only contain the port if it
is different than the standard port for the protocol.
... | python | def get_host(environ, trusted_hosts=None):
"""Return the host for the given WSGI environment. This first checks
the ``Host`` header. If it's not present, then ``SERVER_NAME`` and
``SERVER_PORT`` are used. The host will only contain the port if it
is different than the standard port for the protocol.
... | [
"def",
"get_host",
"(",
"environ",
",",
"trusted_hosts",
"=",
"None",
")",
":",
"if",
"\"HTTP_HOST\"",
"in",
"environ",
":",
"rv",
"=",
"environ",
"[",
"\"HTTP_HOST\"",
"]",
"if",
"environ",
"[",
"\"wsgi.url_scheme\"",
"]",
"==",
"\"http\"",
"and",
"rv",
"... | Return the host for the given WSGI environment. This first checks
the ``Host`` header. If it's not present, then ``SERVER_NAME`` and
``SERVER_PORT`` are used. The host will only contain the port if it
is different than the standard port for the protocol.
Optionally, verify that the host is trusted usin... | [
"Return",
"the",
"host",
"for",
"the",
"given",
"WSGI",
"environment",
".",
"This",
"first",
"checks",
"the",
"Host",
"header",
".",
"If",
"it",
"s",
"not",
"present",
"then",
"SERVER_NAME",
"and",
"SERVER_PORT",
"are",
"used",
".",
"The",
"host",
"will",
... | a220671d66755a94630a212378754bb432811158 | https://github.com/pallets/werkzeug/blob/a220671d66755a94630a212378754bb432811158/src/werkzeug/wsgi.py#L145-L179 | train | Returns the host for the given WSGI environment. | 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.