Search is not available for this dataset
identifier stringlengths 1 155 | parameters stringlengths 2 6.09k | docstring stringlengths 11 63.4k | docstring_summary stringlengths 0 63.4k | function stringlengths 29 99.8k | function_tokens list | start_point list | end_point list | language stringclasses 1
value | docstring_language stringlengths 2 7 | docstring_language_predictions stringlengths 18 23 | is_langid_reliable stringclasses 2
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
log | (function) | Logger that records which phase processes each token | Logger that records which phase processes each token | def log(function):
"""Logger that records which phase processes each token"""
type_names = {value: key for key, value in tokenTypes.items()}
def wrapped(self, *args, **kwargs):
if function.__name__.startswith("process") and len(args) > 0:
token = args[0]
... | [
"def",
"log",
"(",
"function",
")",
":",
"type_names",
"=",
"{",
"value",
":",
"key",
"for",
"key",
",",
"value",
"in",
"tokenTypes",
".",
"items",
"(",
")",
"}",
"def",
"wrapped",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",... | [
397,
4
] | [
416,
22
] | python | en | ['en', 'en', 'en'] | True |
HTMLParser.__init__ | (self, tree=None, strict=False, namespaceHTMLElements=True, debug=False) |
:arg tree: a treebuilder class controlling the type of tree that will be
returned. Built in treebuilders can be accessed through
html5lib.treebuilders.getTreeBuilder(treeType)
:arg strict: raise an exception when a parse error is encountered
:arg namespaceHTMLElements:... |
:arg tree: a treebuilder class controlling the type of tree that will be
returned. Built in treebuilders can be accessed through
html5lib.treebuilders.getTreeBuilder(treeType) | def __init__(self, tree=None, strict=False, namespaceHTMLElements=True, debug=False):
"""
:arg tree: a treebuilder class controlling the type of tree that will be
returned. Built in treebuilders can be accessed through
html5lib.treebuilders.getTreeBuilder(treeType)
:arg ... | [
"def",
"__init__",
"(",
"self",
",",
"tree",
"=",
"None",
",",
"strict",
"=",
"False",
",",
"namespaceHTMLElements",
"=",
"True",
",",
"debug",
"=",
"False",
")",
":",
"# Raise an exception on the first error encountered",
"self",
".",
"strict",
"=",
"strict",
... | [
92,
4
] | [
121,
48
] | python | en | ['en', 'error', 'th'] | False |
HTMLParser.documentEncoding | (self) | Name of the character encoding that was used to decode the input stream, or
:obj:`None` if that is not determined yet
| Name of the character encoding that was used to decode the input stream, or
:obj:`None` if that is not determined yet | def documentEncoding(self):
"""Name of the character encoding that was used to decode the input stream, or
:obj:`None` if that is not determined yet
"""
if not hasattr(self, 'tokenizer'):
return None
return self.tokenizer.stream.charEncoding[0].name | [
"def",
"documentEncoding",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'tokenizer'",
")",
":",
"return",
"None",
"return",
"self",
".",
"tokenizer",
".",
"stream",
".",
"charEncoding",
"[",
"0",
"]",
".",
"name"
] | [
172,
4
] | [
179,
57
] | python | en | ['en', 'en', 'en'] | True |
HTMLParser.parse | (self, stream, *args, **kwargs) | Parse a HTML document into a well-formed tree
:arg stream: a file-like object or string containing the HTML to be parsed
The optional encoding parameter must be a string that indicates
the encoding. If specified, that encoding will be used,
regardless of any BOM or later d... | Parse a HTML document into a well-formed tree | def parse(self, stream, *args, **kwargs):
"""Parse a HTML document into a well-formed tree
:arg stream: a file-like object or string containing the HTML to be parsed
The optional encoding parameter must be a string that indicates
the encoding. If specified, that encoding will ... | [
"def",
"parse",
"(",
"self",
",",
"stream",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_parse",
"(",
"stream",
",",
"False",
",",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"self",
".",
"tree",
"."... | [
261,
4
] | [
284,
38
] | python | en | ['en', 'en', 'en'] | True |
HTMLParser.parseFragment | (self, stream, *args, **kwargs) | Parse a HTML fragment into a well-formed tree fragment
:arg container: name of the element we're setting the innerHTML
property if set to None, default to 'div'
:arg stream: a file-like object or string containing the HTML to be parsed
The optional encoding parameter must be a... | Parse a HTML fragment into a well-formed tree fragment | def parseFragment(self, stream, *args, **kwargs):
"""Parse a HTML fragment into a well-formed tree fragment
:arg container: name of the element we're setting the innerHTML
property if set to None, default to 'div'
:arg stream: a file-like object or string containing the HTML to be ... | [
"def",
"parseFragment",
"(",
"self",
",",
"stream",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"_parse",
"(",
"stream",
",",
"True",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"return",
"self",
".",
"tree",
".",
"getFr... | [
286,
4
] | [
312,
38
] | python | en | ['en', 'en', 'en'] | True |
InBodyPhase.startTagRawtext | (self, token) | iframe, noembed noframes, noscript(if scripting enabled) | iframe, noembed noframes, noscript(if scripting enabled) | def startTagRawtext(self, token):
"""iframe, noembed noframes, noscript(if scripting enabled)"""
self.parser.parseRCDataRawtext(token, "RAWTEXT") | [
"def",
"startTagRawtext",
"(",
"self",
",",
"token",
")",
":",
"self",
".",
"parser",
".",
"parseRCDataRawtext",
"(",
"token",
",",
"\"RAWTEXT\"",
")"
] | [
1239,
8
] | [
1241,
60
] | python | en | ['en', 'en', 'nl'] | True |
InBodyPhase.startTagMisplaced | (self, token) | Elements that should be children of other elements that have a
different insertion mode; here they are ignored
"caption", "col", "colgroup", "frame", "frameset", "head",
"option", "optgroup", "tbody", "td", "tfoot", "th", "thead",
"tr", "noscript"
| Elements that should be children of other elements that have a
different insertion mode; here they are ignored
"caption", "col", "colgroup", "frame", "frameset", "head",
"option", "optgroup", "tbody", "td", "tfoot", "th", "thead",
"tr", "noscript"
| def startTagMisplaced(self, token):
""" Elements that should be children of other elements that have a
different insertion mode; here they are ignored
"caption", "col", "colgroup", "frame", "frameset", "head",
"option", "optgroup", "tbody", "td", "tfoot", "th", "thead",
... | [
"def",
"startTagMisplaced",
"(",
"self",
",",
"token",
")",
":",
"self",
".",
"parser",
".",
"parseError",
"(",
"\"unexpected-start-tag-ignored\"",
",",
"{",
"\"name\"",
":",
"token",
"[",
"\"name\"",
"]",
"}",
")"
] | [
1294,
8
] | [
1301,
91
] | python | en | ['en', 'en', 'en'] | True |
InBodyPhase.endTagFormatting | (self, token) | The much-feared adoption agency algorithm | The much-feared adoption agency algorithm | def endTagFormatting(self, token):
"""The much-feared adoption agency algorithm"""
# http://svn.whatwg.org/webapps/complete.html#adoptionAgency revision 7867
# XXX Better parseError messages appreciated.
# Step 1
outerLoopCounter = 0
# Step 2
... | [
"def",
"endTagFormatting",
"(",
"self",
",",
"token",
")",
":",
"# http://svn.whatwg.org/webapps/complete.html#adoptionAgency revision 7867",
"# XXX Better parseError messages appreciated.",
"# Step 1",
"outerLoopCounter",
"=",
"0",
"# Step 2",
"while",
"outerLoopCounter",
"<",
"... | [
1403,
8
] | [
1564,
75
] | python | en | ['en', 'en', 'en'] | True |
iDRACStreaming.__recursive_append_char__ | (self, str_data, position) |
Appends a character recursively after every n characters
:param str_data: the input string
:param position: the position
:type str_data: str
:type position: int
:return: the output string
:rtype: str
|
Appends a character recursively after every n characters | def __recursive_append_char__(self, str_data, position):
"""
Appends a character recursively after every n characters
:param str_data: the input string
:param position: the position
:type str_data: str
:type position: int
:return: the output string
:rtype... | [
"def",
"__recursive_append_char__",
"(",
"self",
",",
"str_data",
",",
"position",
")",
":",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"str_data",
")",
",",
"position",
")",
":",
"yield",
"str_data",
"[",
"i",
":",
"i",
"+",
"position",
"... | [
52,
4
] | [
64,
42
] | python | en | ['en', 'error', 'th'] | False |
iDRACStreaming.__chunkify_data__ | (self, data, chunk_size) |
Breaks down the data into chunks of equal size
:param data: the input data
:param chunk_size: the size of each chunk
:type data: str
:type chunk_size: int
:return: the list of chunked data
:rtype: list
|
Breaks down the data into chunks of equal size | def __chunkify_data__(self, data, chunk_size):
"""
Breaks down the data into chunks of equal size
:param data: the input data
:param chunk_size: the size of each chunk
:type data: str
:type chunk_size: int
:return: the list of chunked data
:rtype: list
... | [
"def",
"__chunkify_data__",
"(",
"self",
",",
"data",
",",
"chunk_size",
")",
":",
"return",
"[",
"data",
"[",
"i",
":",
"i",
"+",
"chunk_size",
"]",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"len",
"(",
"data",
")",
",",
"chunk_size",
")",
"]"
] | [
66,
4
] | [
77,
80
] | python | en | ['en', 'error', 'th'] | False |
iDRACStreaming.__calculate_crc__ | (self, data) |
Calculates the CRC for a given data
:param data: the input data
:type data: str
:return: the CRC
:rtype: int
|
Calculates the CRC for a given data | def __calculate_crc__(self, data):
"""
Calculates the CRC for a given data
:param data: the input data
:type data: str
:return: the CRC
:rtype: int
"""
md5_hash = hashlib.md5()
md5_hash.update(data)
return md5_hash.hexdigest() | [
"def",
"__calculate_crc__",
"(",
"self",
",",
"data",
")",
":",
"md5_hash",
"=",
"hashlib",
".",
"md5",
"(",
")",
"md5_hash",
".",
"update",
"(",
"data",
")",
"return",
"md5_hash",
".",
"hexdigest",
"(",
")"
] | [
79,
4
] | [
91,
35
] | python | en | ['en', 'error', 'th'] | False |
iDRACStreaming.export_data | (self, file_type=FileTypeEnum.SystemConfigXML, export_file="", **kwargs) |
Exports the data
:param file_type: The Type of File
:param export_file: The export file
:param kwargs: Keyword args having the export options
:type file_type: FileTypeEnum <Enum>
:type export_file: str
:type kwargs: list
:return: the success or failure r... |
Exports the data | def export_data(self, file_type=FileTypeEnum.SystemConfigXML, export_file="", **kwargs):
"""
Exports the data
:param file_type: The Type of File
:param export_file: The export file
:param kwargs: Keyword args having the export options
:type file_type: FileTypeEnum <Enum>... | [
"def",
"export_data",
"(",
"self",
",",
"file_type",
"=",
"FileTypeEnum",
".",
"SystemConfigXML",
",",
"export_file",
"=",
"\"\"",
",",
"*",
"*",
"kwargs",
")",
":",
"gen_str",
"=",
"self",
".",
"_config_mgr",
".",
"entity",
".",
"ServerGeneration",
".",
"... | [
157,
4
] | [
334,
30
] | python | en | ['en', 'error', 'th'] | False |
HarvesterAPI.harvester_handshake | (self, harvester_handshake: harvester_protocol.HarvesterHandshake) |
Handshake between the harvester and farmer. The harvester receives the pool public keys,
as well as the farmer pks, which must be put into the plots, before the plotting process begins.
We cannot use any plots which have different keys in them.
|
Handshake between the harvester and farmer. The harvester receives the pool public keys,
as well as the farmer pks, which must be put into the plots, before the plotting process begins.
We cannot use any plots which have different keys in them.
| async def harvester_handshake(self, harvester_handshake: harvester_protocol.HarvesterHandshake):
"""
Handshake between the harvester and farmer. The harvester receives the pool public keys,
as well as the farmer pks, which must be put into the plots, before the plotting process begins.
W... | [
"async",
"def",
"harvester_handshake",
"(",
"self",
",",
"harvester_handshake",
":",
"harvester_protocol",
".",
"HarvesterHandshake",
")",
":",
"self",
".",
"harvester",
".",
"farmer_public_keys",
"=",
"harvester_handshake",
".",
"farmer_public_keys",
"self",
".",
"ha... | [
32,
4
] | [
45,
23
] | python | en | ['en', 'error', 'th'] | False |
HarvesterAPI.new_signage_point_harvester | (
self, new_challenge: harvester_protocol.NewSignagePointHarvester, peer: WSKaleConnection
) |
The harvester receives a new signage point from the farmer, this happens at the start of each slot.
The harvester does a few things:
1. The harvester applies the plot filter for each of the plots, to select the proportion which are eligible
for this signage point and challenge.
... |
The harvester receives a new signage point from the farmer, this happens at the start of each slot.
The harvester does a few things:
1. The harvester applies the plot filter for each of the plots, to select the proportion which are eligible
for this signage point and challenge.
... | async def new_signage_point_harvester(
self, new_challenge: harvester_protocol.NewSignagePointHarvester, peer: WSKaleConnection
):
"""
The harvester receives a new signage point from the farmer, this happens at the start of each slot.
The harvester does a few things:
1. The h... | [
"async",
"def",
"new_signage_point_harvester",
"(",
"self",
",",
"new_challenge",
":",
"harvester_protocol",
".",
"NewSignagePointHarvester",
",",
"peer",
":",
"WSKaleConnection",
")",
":",
"if",
"len",
"(",
"self",
".",
"harvester",
".",
"pool_public_keys",
")",
... | [
49,
4
] | [
229,
9
] | python | en | ['en', 'error', 'th'] | False |
HarvesterAPI.request_signatures | (self, request: harvester_protocol.RequestSignatures) |
The farmer requests a signature on the header hash, for one of the proofs that we found.
A signature is created on the header hash using the harvester private key. This can also
be used for pooling.
|
The farmer requests a signature on the header hash, for one of the proofs that we found.
A signature is created on the header hash using the harvester private key. This can also
be used for pooling.
| async def request_signatures(self, request: harvester_protocol.RequestSignatures):
"""
The farmer requests a signature on the header hash, for one of the proofs that we found.
A signature is created on the header hash using the harvester private key. This can also
be used for pooling.
... | [
"async",
"def",
"request_signatures",
"(",
"self",
",",
"request",
":",
"harvester_protocol",
".",
"RequestSignatures",
")",
":",
"plot_filename",
"=",
"Path",
"(",
"request",
".",
"plot_identifier",
"[",
"64",
":",
"]",
")",
".",
"resolve",
"(",
")",
"try",... | [
232,
4
] | [
271,
74
] | python | en | ['en', 'error', 'th'] | False |
keys_cmd | (ctx: click.Context) | Create, delete, view and use your key pairs | Create, delete, view and use your key pairs | def keys_cmd(ctx: click.Context):
"""Create, delete, view and use your key pairs"""
from pathlib import Path
root_path: Path = ctx.obj["root_path"]
if not root_path.is_dir():
raise RuntimeError("Please initialize (or migrate) your config directory with kale init") | [
"def",
"keys_cmd",
"(",
"ctx",
":",
"click",
".",
"Context",
")",
":",
"from",
"pathlib",
"import",
"Path",
"root_path",
":",
"Path",
"=",
"ctx",
".",
"obj",
"[",
"\"root_path\"",
"]",
"if",
"not",
"root_path",
".",
"is_dir",
"(",
")",
":",
"raise",
... | [
5,
0
] | [
11,
97
] | python | en | ['en', 'en', 'en'] | True |
validate_input | (hass: core.HomeAssistant, data) | Validate the user input allows us to connect.
Data has the keys from DATA_SCHEMA with values provided by the user.
| Validate the user input allows us to connect. | async def validate_input(hass: core.HomeAssistant, data):
"""Validate the user input allows us to connect.
Data has the keys from DATA_SCHEMA with values provided by the user.
"""
spm = SunPowerMonitor(data["host"])
name = "PVS {}".format(data["host"])
try:
response = await hass.async_... | [
"async",
"def",
"validate_input",
"(",
"hass",
":",
"core",
".",
"HomeAssistant",
",",
"data",
")",
":",
"spm",
"=",
"SunPowerMonitor",
"(",
"data",
"[",
"\"host\"",
"]",
")",
"name",
"=",
"\"PVS {}\"",
".",
"format",
"(",
"data",
"[",
"\"host\"",
"]",
... | [
14,
0
] | [
28,
26
] | python | en | ['en', 'en', 'en'] | True |
ConfigFlow.async_step_user | (self, user_input=None) | Handle the initial step. | Handle the initial step. | async def async_step_user(self, user_input=None):
"""Handle the initial step."""
errors = {}
if user_input is not None:
try:
info = await validate_input(self.hass, user_input)
await self.async_set_unique_id(user_input[SUNPOWER_HOST])
re... | [
"async",
"def",
"async_step_user",
"(",
"self",
",",
"user_input",
"=",
"None",
")",
":",
"errors",
"=",
"{",
"}",
"if",
"user_input",
"is",
"not",
"None",
":",
"try",
":",
"info",
"=",
"await",
"validate_input",
"(",
"self",
".",
"hass",
",",
"user_in... | [
37,
4
] | [
53,
9
] | python | en | ['en', 'en', 'en'] | True |
ConfigFlow.async_step_import | (self, user_input) | Handle import. | Handle import. | async def async_step_import(self, user_input):
"""Handle import."""
await self.async_set_unique_id(user_input["host"])
self._abort_if_unique_id_configured()
return await self.async_step_user(user_input) | [
"async",
"def",
"async_step_import",
"(",
"self",
",",
"user_input",
")",
":",
"await",
"self",
".",
"async_set_unique_id",
"(",
"user_input",
"[",
"\"host\"",
"]",
")",
"self",
".",
"_abort_if_unique_id_configured",
"(",
")",
"return",
"await",
"self",
".",
"... | [
55,
4
] | [
60,
53
] | python | en | ['en', 'ja', 'en'] | False |
infix | (bp, func) |
Creates an infix operator, given a binding power and a function that
evaluates the node
|
Creates an infix operator, given a binding power and a function that
evaluates the node
| def infix(bp, func):
"""
Creates an infix operator, given a binding power and a function that
evaluates the node
"""
class Operator(TokenBase):
lbp = bp
def led(self, left, parser):
self.first = left
self.second = parser.expression(bp)
return self... | [
"def",
"infix",
"(",
"bp",
",",
"func",
")",
":",
"class",
"Operator",
"(",
"TokenBase",
")",
":",
"lbp",
"=",
"bp",
"def",
"led",
"(",
"self",
",",
"left",
",",
"parser",
")",
":",
"self",
".",
"first",
"=",
"left",
"self",
".",
"second",
"=",
... | [
42,
0
] | [
64,
19
] | python | en | ['en', 'error', 'th'] | False |
prefix | (bp, func) |
Creates a prefix operator, given a binding power and a function that
evaluates the node.
|
Creates a prefix operator, given a binding power and a function that
evaluates the node.
| def prefix(bp, func):
"""
Creates a prefix operator, given a binding power and a function that
evaluates the node.
"""
class Operator(TokenBase):
lbp = bp
def nud(self, parser):
self.first = parser.expression(bp)
self.second = None
return self
... | [
"def",
"prefix",
"(",
"bp",
",",
"func",
")",
":",
"class",
"Operator",
"(",
"TokenBase",
")",
":",
"lbp",
"=",
"bp",
"def",
"nud",
"(",
"self",
",",
"parser",
")",
":",
"self",
".",
"first",
"=",
"parser",
".",
"expression",
"(",
"bp",
")",
"sel... | [
67,
0
] | [
86,
19
] | python | en | ['en', 'error', 'th'] | False |
TokenBase.display | (self) |
Returns what to display in error messages for this node
|
Returns what to display in error messages for this node
| def display(self):
"""
Returns what to display in error messages for this node
"""
return self.id | [
"def",
"display",
"(",
"self",
")",
":",
"return",
"self",
".",
"id"
] | [
31,
4
] | [
35,
22
] | python | en | ['en', 'error', 'th'] | False |
inject_rename_contenttypes_operations | (plan=None, apps=global_apps, using=DEFAULT_DB_ALIAS, **kwargs) |
Insert a `RenameContentType` operation after every planned `RenameModel`
operation.
|
Insert a `RenameContentType` operation after every planned `RenameModel`
operation.
| def inject_rename_contenttypes_operations(plan=None, apps=global_apps, using=DEFAULT_DB_ALIAS, **kwargs):
"""
Insert a `RenameContentType` operation after every planned `RenameModel`
operation.
"""
if plan is None:
return
# Determine whether or not the ContentType model is available.
... | [
"def",
"inject_rename_contenttypes_operations",
"(",
"plan",
"=",
"None",
",",
"apps",
"=",
"global_apps",
",",
"using",
"=",
"DEFAULT_DB_ALIAS",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"plan",
"is",
"None",
":",
"return",
"# Determine whether or not the ContentT... | [
45,
0
] | [
84,
68
] | python | en | ['en', 'error', 'th'] | False |
create_contenttypes | (app_config, verbosity=2, interactive=True, using=DEFAULT_DB_ALIAS, apps=global_apps, **kwargs) |
Creates content types for models in the given app.
|
Creates content types for models in the given app.
| def create_contenttypes(app_config, verbosity=2, interactive=True, using=DEFAULT_DB_ALIAS, apps=global_apps, **kwargs):
"""
Creates content types for models in the given app.
"""
if not app_config.models_module:
return
app_label = app_config.label
try:
app_config = apps.get_app_... | [
"def",
"create_contenttypes",
"(",
"app_config",
",",
"verbosity",
"=",
"2",
",",
"interactive",
"=",
"True",
",",
"using",
"=",
"DEFAULT_DB_ALIAS",
",",
"apps",
"=",
"global_apps",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"app_config",
".",
"models... | [
104,
0
] | [
134,
77
] | python | en | ['en', 'error', 'th'] | False |
serve_file_url_backend | (
request: HttpRequest, user_profile: UserProfile, realm_id_str: str, filename: str
) |
We should return a signed, short-lived URL
that the client can use for native mobile download, rather than serving a redirect.
|
We should return a signed, short-lived URL
that the client can use for native mobile download, rather than serving a redirect.
| def serve_file_url_backend(
request: HttpRequest, user_profile: UserProfile, realm_id_str: str, filename: str
) -> HttpResponse:
"""
We should return a signed, short-lived URL
that the client can use for native mobile download, rather than serving a redirect.
"""
return serve_file(request, user... | [
"def",
"serve_file_url_backend",
"(",
"request",
":",
"HttpRequest",
",",
"user_profile",
":",
"UserProfile",
",",
"realm_id_str",
":",
"str",
",",
"filename",
":",
"str",
")",
"->",
"HttpResponse",
":",
"return",
"serve_file",
"(",
"request",
",",
"user_profile... | [
72,
0
] | [
80,
83
] | python | en | ['en', 'error', 'th'] | False |
_check_dist_requires_python | (
dist, # type: Distribution
version_info, # type: Tuple[int, int, int]
ignore_requires_python=False, # type: bool
) |
Check whether the given Python version is compatible with a distribution's
"Requires-Python" value.
:param version_info: A 3-tuple of ints representing the Python
major-minor-micro version to check.
:param ignore_requires_python: Whether to ignore the "Requires-Python"
value if the giv... |
Check whether the given Python version is compatible with a distribution's
"Requires-Python" value. | def _check_dist_requires_python(
dist, # type: Distribution
version_info, # type: Tuple[int, int, int]
ignore_requires_python=False, # type: bool
):
# type: (...) -> None
"""
Check whether the given Python version is compatible with a distribution's
"Requires-Python" value.
:param ve... | [
"def",
"_check_dist_requires_python",
"(",
"dist",
",",
"# type: Distribution",
"version_info",
",",
"# type: Tuple[int, int, int]",
"ignore_requires_python",
"=",
"False",
",",
"# type: bool",
")",
":",
"# type: (...) -> None",
"requires_python",
"=",
"get_requires_python",
... | [
56,
0
] | [
101,
10
] | python | en | ['en', 'error', 'th'] | False |
Resolver.resolve | (self, root_reqs, check_supported_wheels) | Resolve what operations need to be done
As a side-effect of this method, the packages (and their dependencies)
are downloaded, unpacked and prepared for installation. This
preparation is done by ``pip.operations.prepare``.
Once PyPI has static dependency metadata available, it would be... | Resolve what operations need to be done | def resolve(self, root_reqs, check_supported_wheels):
# type: (List[InstallRequirement], bool) -> RequirementSet
"""Resolve what operations need to be done
As a side-effect of this method, the packages (and their dependencies)
are downloaded, unpacked and prepared for installation. This... | [
"def",
"resolve",
"(",
"self",
",",
"root_reqs",
",",
"check_supported_wheels",
")",
":",
"# type: (List[InstallRequirement], bool) -> RequirementSet",
"requirement_set",
"=",
"RequirementSet",
"(",
"check_supported_wheels",
"=",
"check_supported_wheels",
")",
"for",
"req",
... | [
151,
4
] | [
187,
30
] | python | en | ['en', 'en', 'en'] | True |
Resolver._set_req_to_reinstall | (self, req) |
Set a requirement to be installed.
|
Set a requirement to be installed.
| def _set_req_to_reinstall(self, req):
# type: (InstallRequirement) -> None
"""
Set a requirement to be installed.
"""
# Don't uninstall the conflict if doing a user install and the
# conflict is not a user install.
if not self.use_user_site or dist_in_usersite(req... | [
"def",
"_set_req_to_reinstall",
"(",
"self",
",",
"req",
")",
":",
"# type: (InstallRequirement) -> None",
"# Don't uninstall the conflict if doing a user install and the",
"# conflict is not a user install.",
"if",
"not",
"self",
".",
"use_user_site",
"or",
"dist_in_usersite",
"... | [
199,
4
] | [
208,
31
] | python | en | ['en', 'error', 'th'] | False |
Resolver._check_skip_installed | (self, req_to_install) | Check if req_to_install should be skipped.
This will check if the req is installed, and whether we should upgrade
or reinstall it, taking into account all the relevant user options.
After calling this req_to_install will only have satisfied_by set to
None if the req_to_install is to be... | Check if req_to_install should be skipped. | def _check_skip_installed(self, req_to_install):
# type: (InstallRequirement) -> Optional[str]
"""Check if req_to_install should be skipped.
This will check if the req is installed, and whether we should upgrade
or reinstall it, taking into account all the relevant user options.
... | [
"def",
"_check_skip_installed",
"(",
"self",
",",
"req_to_install",
")",
":",
"# type: (InstallRequirement) -> Optional[str]",
"if",
"self",
".",
"ignore_installed",
":",
"return",
"None",
"req_to_install",
".",
"check_if_exists",
"(",
"self",
".",
"use_user_site",
")",... | [
210,
4
] | [
261,
19
] | python | en | ['en', 'en', 'en'] | True |
Resolver._populate_link | (self, req) | Ensure that if a link can be found for this, that it is found.
Note that req.link may still be None - if the requirement is already
installed and not needed to be upgraded based on the return value of
_is_upgrade_allowed().
If preparer.require_hashes is True, don't use the wheel cache,... | Ensure that if a link can be found for this, that it is found. | def _populate_link(self, req):
# type: (InstallRequirement) -> None
"""Ensure that if a link can be found for this, that it is found.
Note that req.link may still be None - if the requirement is already
installed and not needed to be upgraded based on the return value of
_is_upg... | [
"def",
"_populate_link",
"(",
"self",
",",
"req",
")",
":",
"# type: (InstallRequirement) -> None",
"if",
"req",
".",
"link",
"is",
"None",
":",
"req",
".",
"link",
"=",
"self",
".",
"_find_requirement_link",
"(",
"req",
")",
"if",
"self",
".",
"wheel_cache"... | [
286,
4
] | [
314,
39
] | python | en | ['en', 'en', 'en'] | True |
Resolver._get_dist_for | (self, req) | Takes a InstallRequirement and returns a single AbstractDist \
representing a prepared variant of the same.
| Takes a InstallRequirement and returns a single AbstractDist \
representing a prepared variant of the same.
| def _get_dist_for(self, req):
# type: (InstallRequirement) -> Distribution
"""Takes a InstallRequirement and returns a single AbstractDist \
representing a prepared variant of the same.
"""
if req.editable:
return self.preparer.prepare_editable_requirement(req)
... | [
"def",
"_get_dist_for",
"(",
"self",
",",
"req",
")",
":",
"# type: (InstallRequirement) -> Distribution",
"if",
"req",
".",
"editable",
":",
"return",
"self",
".",
"preparer",
".",
"prepare_editable_requirement",
"(",
"req",
")",
"# satisfied_by is only evaluated by ca... | [
316,
4
] | [
363,
19
] | python | en | ['en', 'en', 'en'] | True |
Resolver._resolve_one | (
self,
requirement_set, # type: RequirementSet
req_to_install, # type: InstallRequirement
) | Prepare a single requirements file.
:return: A list of additional InstallRequirements to also install.
| Prepare a single requirements file. | def _resolve_one(
self,
requirement_set, # type: RequirementSet
req_to_install, # type: InstallRequirement
):
# type: (...) -> List[InstallRequirement]
"""Prepare a single requirements file.
:return: A list of additional InstallRequirements to also install.
... | [
"def",
"_resolve_one",
"(",
"self",
",",
"requirement_set",
",",
"# type: RequirementSet",
"req_to_install",
",",
"# type: InstallRequirement",
")",
":",
"# type: (...) -> List[InstallRequirement]",
"# Tell user what we are doing for this requirement:",
"# obtain (editable), skipping, ... | [
365,
4
] | [
444,
24
] | python | en | ['en', 'it', 'en'] | True |
Resolver.get_installation_order | (self, req_set) | Create the installation order.
The installation order is topological - requirements are installed
before the requiring thing. We break cycles at an arbitrary point,
and make no other guarantees.
| Create the installation order. | def get_installation_order(self, req_set):
# type: (RequirementSet) -> List[InstallRequirement]
"""Create the installation order.
The installation order is topological - requirements are installed
before the requiring thing. We break cycles at an arbitrary point,
and make no oth... | [
"def",
"get_installation_order",
"(",
"self",
",",
"req_set",
")",
":",
"# type: (RequirementSet) -> List[InstallRequirement]",
"# The current implementation, which we may change at any point",
"# installs the user specified things in the order given, except when",
"# dependencies must come ea... | [
446,
4
] | [
472,
20
] | python | en | ['en', 'en', 'en'] | True |
TarIO.__init__ | (self, tarfile, file) |
Create file object.
:param tarfile: Name of TAR file.
:param file: Name of member file.
|
Create file object. | def __init__(self, tarfile, file):
"""
Create file object.
:param tarfile: Name of TAR file.
:param file: Name of member file.
"""
self.fh = open(tarfile, "rb")
while True:
s = self.fh.read(512)
if len(s) != 512:
raise OS... | [
"def",
"__init__",
"(",
"self",
",",
"tarfile",
",",
"file",
")",
":",
"self",
".",
"fh",
"=",
"open",
"(",
"tarfile",
",",
"\"rb\"",
")",
"while",
"True",
":",
"s",
"=",
"self",
".",
"fh",
".",
"read",
"(",
"512",
")",
"if",
"len",
"(",
"s",
... | [
24,
4
] | [
54,
55
] | python | en | ['en', 'error', 'th'] | False |
TestInspectView.test_author_name_present | (self) |
The author name should appear twice. Once in the header, and once
more in the field listing
|
The author name should appear twice. Once in the header, and once
more in the field listing
| def test_author_name_present(self):
"""
The author name should appear twice. Once in the header, and once
more in the field listing
"""
response = self.get_for_author(1)
self.assertContains(response, 'J. R. R. Tolkien', 2) | [
"def",
"test_author_name_present",
"(",
"self",
")",
":",
"response",
"=",
"self",
".",
"get_for_author",
"(",
"1",
")",
"self",
".",
"assertContains",
"(",
"response",
",",
"'J. R. R. Tolkien'",
",",
"2",
")"
] | [
319,
4
] | [
325,
60
] | python | en | ['en', 'error', 'th'] | False |
TestInspectView.test_author_dob_not_present | (self) |
The date of birth shouldn't appear, because the field wasn't included
in the `inspect_view_fields` list
|
The date of birth shouldn't appear, because the field wasn't included
in the `inspect_view_fields` list
| def test_author_dob_not_present(self):
"""
The date of birth shouldn't appear, because the field wasn't included
in the `inspect_view_fields` list
"""
response = self.get_for_author(1)
self.assertNotContains(response, '1892') | [
"def",
"test_author_dob_not_present",
"(",
"self",
")",
":",
"response",
"=",
"self",
".",
"get_for_author",
"(",
"1",
")",
"self",
".",
"assertNotContains",
"(",
"response",
",",
"'1892'",
")"
] | [
327,
4
] | [
333,
48
] | python | en | ['en', 'error', 'th'] | False |
TestInspectView.test_book_title_present | (self) |
The book title should appear once only, in the header, as 'title'
was added to the `inspect_view_fields_ignore` list
|
The book title should appear once only, in the header, as 'title'
was added to the `inspect_view_fields_ignore` list
| def test_book_title_present(self):
"""
The book title should appear once only, in the header, as 'title'
was added to the `inspect_view_fields_ignore` list
"""
response = self.get_for_book(1)
self.assertContains(response, 'The Lord of the Rings', 1) | [
"def",
"test_book_title_present",
"(",
"self",
")",
":",
"response",
"=",
"self",
".",
"get_for_book",
"(",
"1",
")",
"self",
".",
"assertContains",
"(",
"response",
",",
"'The Lord of the Rings'",
",",
"1",
")"
] | [
339,
4
] | [
345,
65
] | python | en | ['en', 'error', 'th'] | False |
TestInspectView.test_book_author_present | (self) |
The author name should appear, because 'author' is not in
`inspect_view_fields_ignore` and should be returned by the
`get_inspect_view_fields` method.
|
The author name should appear, because 'author' is not in
`inspect_view_fields_ignore` and should be returned by the
`get_inspect_view_fields` method.
| def test_book_author_present(self):
"""
The author name should appear, because 'author' is not in
`inspect_view_fields_ignore` and should be returned by the
`get_inspect_view_fields` method.
"""
response = self.get_for_book(1)
self.assertContains(response, 'J. R. ... | [
"def",
"test_book_author_present",
"(",
"self",
")",
":",
"response",
"=",
"self",
".",
"get_for_book",
"(",
"1",
")",
"self",
".",
"assertContains",
"(",
"response",
",",
"'J. R. R. Tolkien'",
",",
"1",
")"
] | [
347,
4
] | [
354,
60
] | python | en | ['en', 'error', 'th'] | False |
CalculateVariables | (default_variables, params) | Calculate additional variables for use in the build (called by gyp). | Calculate additional variables for use in the build (called by gyp). | def CalculateVariables(default_variables, params):
"""Calculate additional variables for use in the build (called by gyp)."""
flavor = gyp.common.GetFlavor(params)
if flavor == "mac":
default_variables.setdefault("OS", "mac")
default_variables.setdefault("SHARED_LIB_SUFFIX", ".dylib")
... | [
"def",
"CalculateVariables",
"(",
"default_variables",
",",
"params",
")",
":",
"flavor",
"=",
"gyp",
".",
"common",
".",
"GetFlavor",
"(",
"params",
")",
"if",
"flavor",
"==",
"\"mac\"",
":",
"default_variables",
".",
"setdefault",
"(",
"\"OS\"",
",",
"\"ma... | [
65,
0
] | [
105,
68
] | python | en | ['en', 'en', 'en'] | True |
CalculateGeneratorInputInfo | (params) | Calculate the generator specific info that gets fed to input (called by
gyp). | Calculate the generator specific info that gets fed to input (called by
gyp). | def CalculateGeneratorInputInfo(params):
"""Calculate the generator specific info that gets fed to input (called by
gyp)."""
generator_flags = params.get("generator_flags", {})
android_ndk_version = generator_flags.get("android_ndk_version", None)
# Android NDK requires a strict link order.
if and... | [
"def",
"CalculateGeneratorInputInfo",
"(",
"params",
")",
":",
"generator_flags",
"=",
"params",
".",
"get",
"(",
"\"generator_flags\"",
",",
"{",
"}",
")",
"android_ndk_version",
"=",
"generator_flags",
".",
"get",
"(",
"\"android_ndk_version\"",
",",
"None",
")"... | [
108,
0
] | [
128,
5
] | python | en | ['en', 'en', 'en'] | True |
Compilable | (filename) | Return true if the file is compilable (should be in OBJS). | Return true if the file is compilable (should be in OBJS). | def Compilable(filename):
"""Return true if the file is compilable (should be in OBJS)."""
for res in (filename.endswith(e) for e in COMPILABLE_EXTENSIONS):
if res:
return True
return False | [
"def",
"Compilable",
"(",
"filename",
")",
":",
"for",
"res",
"in",
"(",
"filename",
".",
"endswith",
"(",
"e",
")",
"for",
"e",
"in",
"COMPILABLE_EXTENSIONS",
")",
":",
"if",
"res",
":",
"return",
"True",
"return",
"False"
] | [
597,
0
] | [
602,
16
] | python | en | ['en', 'en', 'en'] | True |
Linkable | (filename) | Return true if the file is linkable (should be on the link line). | Return true if the file is linkable (should be on the link line). | def Linkable(filename):
"""Return true if the file is linkable (should be on the link line)."""
return filename.endswith(".o") | [
"def",
"Linkable",
"(",
"filename",
")",
":",
"return",
"filename",
".",
"endswith",
"(",
"\".o\"",
")"
] | [
605,
0
] | [
607,
34
] | python | en | ['en', 'en', 'en'] | True |
Target | (filename) | Translate a compilable filename to its .o target. | Translate a compilable filename to its .o target. | def Target(filename):
"""Translate a compilable filename to its .o target."""
return os.path.splitext(filename)[0] + ".o" | [
"def",
"Target",
"(",
"filename",
")",
":",
"return",
"os",
".",
"path",
".",
"splitext",
"(",
"filename",
")",
"[",
"0",
"]",
"+",
"\".o\""
] | [
610,
0
] | [
612,
47
] | python | en | ['en', 'en', 'en'] | True |
EscapeShellArgument | (s) | Quotes an argument so that it will be interpreted literally by a POSIX
shell. Taken from
http://stackoverflow.com/questions/35817/whats-the-best-way-to-escape-ossystem-calls-in-python
| Quotes an argument so that it will be interpreted literally by a POSIX
shell. Taken from
http://stackoverflow.com/questions/35817/whats-the-best-way-to-escape-ossystem-calls-in-python
| def EscapeShellArgument(s):
"""Quotes an argument so that it will be interpreted literally by a POSIX
shell. Taken from
http://stackoverflow.com/questions/35817/whats-the-best-way-to-escape-ossystem-calls-in-python
"""
return "'" + s.replace("'", "'\\''") + "'" | [
"def",
"EscapeShellArgument",
"(",
"s",
")",
":",
"return",
"\"'\"",
"+",
"s",
".",
"replace",
"(",
"\"'\"",
",",
"\"'\\\\''\"",
")",
"+",
"\"'\""
] | [
615,
0
] | [
620,
46
] | python | en | ['en', 'en', 'en'] | True |
EscapeMakeVariableExpansion | (s) | Make has its own variable expansion syntax using $. We must escape it for
string to be interpreted literally. | Make has its own variable expansion syntax using $. We must escape it for
string to be interpreted literally. | def EscapeMakeVariableExpansion(s):
"""Make has its own variable expansion syntax using $. We must escape it for
string to be interpreted literally."""
return s.replace("$", "$$") | [
"def",
"EscapeMakeVariableExpansion",
"(",
"s",
")",
":",
"return",
"s",
".",
"replace",
"(",
"\"$\"",
",",
"\"$$\"",
")"
] | [
623,
0
] | [
626,
31
] | python | en | ['en', 'en', 'en'] | True |
EscapeCppDefine | (s) | Escapes a CPP define so that it will reach the compiler unaltered. | Escapes a CPP define so that it will reach the compiler unaltered. | def EscapeCppDefine(s):
"""Escapes a CPP define so that it will reach the compiler unaltered."""
s = EscapeShellArgument(s)
s = EscapeMakeVariableExpansion(s)
# '#' characters must be escaped even embedded in a string, else Make will
# treat it as the start of a comment.
return s.replace("#", r"... | [
"def",
"EscapeCppDefine",
"(",
"s",
")",
":",
"s",
"=",
"EscapeShellArgument",
"(",
"s",
")",
"s",
"=",
"EscapeMakeVariableExpansion",
"(",
"s",
")",
"# '#' characters must be escaped even embedded in a string, else Make will",
"# treat it as the start of a comment.",
"return... | [
629,
0
] | [
635,
32
] | python | en | ['en', 'en', 'en'] | True |
QuoteIfNecessary | (string) | TODO: Should this ideally be replaced with one or more of the above
functions? | TODO: Should this ideally be replaced with one or more of the above
functions? | def QuoteIfNecessary(string):
"""TODO: Should this ideally be replaced with one or more of the above
functions?"""
if '"' in string:
string = '"' + string.replace('"', '\\"') + '"'
return string | [
"def",
"QuoteIfNecessary",
"(",
"string",
")",
":",
"if",
"'\"'",
"in",
"string",
":",
"string",
"=",
"'\"'",
"+",
"string",
".",
"replace",
"(",
"'\"'",
",",
"'\\\\\"'",
")",
"+",
"'\"'",
"return",
"string"
] | [
638,
0
] | [
643,
17
] | python | en | ['en', 'en', 'en'] | True |
StringToMakefileVariable | (string) | Convert a string to a value that is acceptable as a make variable name. | Convert a string to a value that is acceptable as a make variable name. | def StringToMakefileVariable(string):
"""Convert a string to a value that is acceptable as a make variable name."""
return re.sub("[^a-zA-Z0-9_]", "_", string) | [
"def",
"StringToMakefileVariable",
"(",
"string",
")",
":",
"return",
"re",
".",
"sub",
"(",
"\"[^a-zA-Z0-9_]\"",
",",
"\"_\"",
",",
"string",
")"
] | [
646,
0
] | [
648,
47
] | python | en | ['en', 'en', 'en'] | True |
Sourceify | (path) | Convert a path to its source directory form. | Convert a path to its source directory form. | def Sourceify(path):
"""Convert a path to its source directory form."""
if "$(" in path:
return path
if os.path.isabs(path):
return path
return srcdir_prefix + path | [
"def",
"Sourceify",
"(",
"path",
")",
":",
"if",
"\"$(\"",
"in",
"path",
":",
"return",
"path",
"if",
"os",
".",
"path",
".",
"isabs",
"(",
"path",
")",
":",
"return",
"path",
"return",
"srcdir_prefix",
"+",
"path"
] | [
654,
0
] | [
660,
31
] | python | en | ['en', 'en', 'en'] | True |
SourceifyAndQuoteSpaces | (path) | Convert a path to its source directory form and quote spaces. | Convert a path to its source directory form and quote spaces. | def SourceifyAndQuoteSpaces(path):
"""Convert a path to its source directory form and quote spaces."""
return QuoteSpaces(Sourceify(path)) | [
"def",
"SourceifyAndQuoteSpaces",
"(",
"path",
")",
":",
"return",
"QuoteSpaces",
"(",
"Sourceify",
"(",
"path",
")",
")"
] | [
667,
0
] | [
669,
39
] | python | en | ['en', 'en', 'en'] | True |
WriteAutoRegenerationRule | (params, root_makefile, makefile_name, build_files) | Write the target to regenerate the Makefile. | Write the target to regenerate the Makefile. | def WriteAutoRegenerationRule(params, root_makefile, makefile_name, build_files):
"""Write the target to regenerate the Makefile."""
options = params["options"]
build_files_args = [
gyp.common.RelativePath(filename, options.toplevel_dir)
for filename in params["build_files_arg"]
]
g... | [
"def",
"WriteAutoRegenerationRule",
"(",
"params",
",",
"root_makefile",
",",
"makefile_name",
",",
"build_files",
")",
":",
"options",
"=",
"params",
"[",
"\"options\"",
"]",
"build_files_args",
"=",
"[",
"gyp",
".",
"common",
".",
"RelativePath",
"(",
"filenam... | [
2185,
0
] | [
2211,
5
] | python | en | ['en', 'en', 'en'] | True |
MakefileWriter.Write | (
self, qualified_target, base_path, output_filename, spec, configs, part_of_all
) | The main entry point: writes a .mk file for a single target.
Arguments:
qualified_target: target we're generating
base_path: path relative to source root we're building in, used to resolve
target-relative paths
output_filename: output .mk file name to write
spec, configs: g... | The main entry point: writes a .mk file for a single target. | def Write(
self, qualified_target, base_path, output_filename, spec, configs, part_of_all
):
"""The main entry point: writes a .mk file for a single target.
Arguments:
qualified_target: target we're generating
base_path: path relative to source root we're building in, used to resolv... | [
"def",
"Write",
"(",
"self",
",",
"qualified_target",
",",
"base_path",
",",
"output_filename",
",",
"spec",
",",
"configs",
",",
"part_of_all",
")",
":",
"gyp",
".",
"common",
".",
"EnsureDirExists",
"(",
"output_filename",
")",
"self",
".",
"fp",
"=",
"o... | [
734,
4
] | [
885,
23
] | python | en | ['en', 'en', 'en'] | True |
MakefileWriter.WriteSubMake | (self, output_filename, makefile_path, targets, build_dir) | Write a "sub-project" Makefile.
This is a small, wrapper Makefile that calls the top-level Makefile to build
the targets from a single gyp file (i.e. a sub-project).
Arguments:
output_filename: sub-project Makefile name to write
makefile_path: path to the top-level Makefile
targets: list... | Write a "sub-project" Makefile. | def WriteSubMake(self, output_filename, makefile_path, targets, build_dir):
"""Write a "sub-project" Makefile.
This is a small, wrapper Makefile that calls the top-level Makefile to build
the targets from a single gyp file (i.e. a sub-project).
Arguments:
output_filename: sub-project Makefil... | [
"def",
"WriteSubMake",
"(",
"self",
",",
"output_filename",
",",
"makefile_path",
",",
"targets",
",",
"build_dir",
")",
":",
"gyp",
".",
"common",
".",
"EnsureDirExists",
"(",
"output_filename",
")",
"self",
".",
"fp",
"=",
"open",
"(",
"output_filename",
"... | [
887,
4
] | [
913,
23
] | python | en | ['en', 'en', 'en'] | True |
MakefileWriter.WriteActions | (
self,
actions,
extra_sources,
extra_outputs,
extra_mac_bundle_resources,
part_of_all,
) | Write Makefile code for any 'actions' from the gyp input.
extra_sources: a list that will be filled in with newly generated source
files, if any
extra_outputs: a list that will be filled in with any outputs of these
actions (used to make other pieces dependent on these
... | Write Makefile code for any 'actions' from the gyp input. | def WriteActions(
self,
actions,
extra_sources,
extra_outputs,
extra_mac_bundle_resources,
part_of_all,
):
"""Write Makefile code for any 'actions' from the gyp input.
extra_sources: a list that will be filled in with newly generated source
... | [
"def",
"WriteActions",
"(",
"self",
",",
"actions",
",",
"extra_sources",
",",
"extra_outputs",
",",
"extra_mac_bundle_resources",
",",
"part_of_all",
",",
")",
":",
"env",
"=",
"self",
".",
"GetSortedXcodeEnv",
"(",
")",
"for",
"action",
"in",
"actions",
":",... | [
915,
4
] | [
1028,
22
] | python | en | ['en', 'en', 'en'] | True |
MakefileWriter.WriteRules | (
self,
rules,
extra_sources,
extra_outputs,
extra_mac_bundle_resources,
part_of_all,
) | Write Makefile code for any 'rules' from the gyp input.
extra_sources: a list that will be filled in with newly generated source
files, if any
extra_outputs: a list that will be filled in with any outputs of these
rules (used to make other pieces dependent on these rules)
... | Write Makefile code for any 'rules' from the gyp input. | def WriteRules(
self,
rules,
extra_sources,
extra_outputs,
extra_mac_bundle_resources,
part_of_all,
):
"""Write Makefile code for any 'rules' from the gyp input.
extra_sources: a list that will be filled in with newly generated source
f... | [
"def",
"WriteRules",
"(",
"self",
",",
"rules",
",",
"extra_sources",
",",
"extra_outputs",
",",
"extra_mac_bundle_resources",
",",
"part_of_all",
",",
")",
":",
"env",
"=",
"self",
".",
"GetSortedXcodeEnv",
"(",
")",
"for",
"rule",
"in",
"rules",
":",
"name... | [
1030,
4
] | [
1172,
24
] | python | en | ['en', 'en', 'en'] | True |
MakefileWriter.WriteCopies | (self, copies, extra_outputs, part_of_all) | Write Makefile code for any 'copies' from the gyp input.
extra_outputs: a list that will be filled in with any outputs of this action
(used to make other pieces dependent on this action)
part_of_all: flag indicating this target is part of 'all'
| Write Makefile code for any 'copies' from the gyp input. | def WriteCopies(self, copies, extra_outputs, part_of_all):
"""Write Makefile code for any 'copies' from the gyp input.
extra_outputs: a list that will be filled in with any outputs of this action
(used to make other pieces dependent on this action)
part_of_all: flag indicating this t... | [
"def",
"WriteCopies",
"(",
"self",
",",
"copies",
",",
"extra_outputs",
",",
"part_of_all",
")",
":",
"self",
".",
"WriteLn",
"(",
"\"### Generated for copy rule.\"",
")",
"variable",
"=",
"StringToMakefileVariable",
"(",
"self",
".",
"qualified_target",
"+",
"\"_... | [
1174,
4
] | [
1210,
22
] | python | en | ['en', 'en', 'en'] | True |
MakefileWriter.WriteMacBundleResources | (self, resources, bundle_deps) | Writes Makefile code for 'mac_bundle_resources'. | Writes Makefile code for 'mac_bundle_resources'. | def WriteMacBundleResources(self, resources, bundle_deps):
"""Writes Makefile code for 'mac_bundle_resources'."""
self.WriteLn("### Generated for mac_bundle_resources")
for output, res in gyp.xcode_emulation.GetMacBundleResources(
generator_default_variables["PRODUCT_DIR"],
... | [
"def",
"WriteMacBundleResources",
"(",
"self",
",",
"resources",
",",
"bundle_deps",
")",
":",
"self",
".",
"WriteLn",
"(",
"\"### Generated for mac_bundle_resources\"",
")",
"for",
"output",
",",
"res",
"in",
"gyp",
".",
"xcode_emulation",
".",
"GetMacBundleResourc... | [
1212,
4
] | [
1227,
42
] | python | en | ['da', 'en', 'en'] | True |
MakefileWriter.WriteMacInfoPlist | (self, bundle_deps) | Write Makefile code for bundle Info.plist files. | Write Makefile code for bundle Info.plist files. | def WriteMacInfoPlist(self, bundle_deps):
"""Write Makefile code for bundle Info.plist files."""
info_plist, out, defines, extra_env = gyp.xcode_emulation.GetMacInfoPlist(
generator_default_variables["PRODUCT_DIR"],
self.xcode_settings,
lambda p: Sourceify(self.Absolu... | [
"def",
"WriteMacInfoPlist",
"(",
"self",
",",
"bundle_deps",
")",
":",
"info_plist",
",",
"out",
",",
"defines",
",",
"extra_env",
"=",
"gyp",
".",
"xcode_emulation",
".",
"GetMacInfoPlist",
"(",
"generator_default_variables",
"[",
"\"PRODUCT_DIR\"",
"]",
",",
"... | [
1229,
4
] | [
1267,
31
] | python | da | ['da', 'it', 'en'] | False |
MakefileWriter.WriteSources | (
self,
configs,
deps,
sources,
extra_outputs,
extra_link_deps,
part_of_all,
precompiled_header,
) | Write Makefile code for any 'sources' from the gyp input.
These are source files necessary to build the current target.
configs, deps, sources: input from gyp.
extra_outputs: a list of extra outputs this action should be dependent on;
used to serialize action/rules before compilation
... | Write Makefile code for any 'sources' from the gyp input.
These are source files necessary to build the current target. | def WriteSources(
self,
configs,
deps,
sources,
extra_outputs,
extra_link_deps,
part_of_all,
precompiled_header,
):
"""Write Makefile code for any 'sources' from the gyp input.
These are source files necessary to build the current target.
... | [
"def",
"WriteSources",
"(",
"self",
",",
"configs",
",",
"deps",
",",
"sources",
",",
"extra_outputs",
",",
"extra_link_deps",
",",
"part_of_all",
",",
"precompiled_header",
",",
")",
":",
"# Write configuration-specific variables for CFLAGS, etc.",
"for",
"configname",... | [
1269,
4
] | [
1417,
22
] | python | en | ['en', 'en', 'en'] | True |
MakefileWriter.WritePchTargets | (self, pch_commands) | Writes make rules to compile prefix headers. | Writes make rules to compile prefix headers. | def WritePchTargets(self, pch_commands):
"""Writes make rules to compile prefix headers."""
if not pch_commands:
return
for gch, lang_flag, lang, input in pch_commands:
extra_flags = {
"c": "$(CFLAGS_C_$(BUILDTYPE))",
"cc": "$(CFLAGS_CC_$(... | [
"def",
"WritePchTargets",
"(",
"self",
",",
"pch_commands",
")",
":",
"if",
"not",
"pch_commands",
":",
"return",
"for",
"gch",
",",
"lang_flag",
",",
"lang",
",",
"input",
"in",
"pch_commands",
":",
"extra_flags",
"=",
"{",
"\"c\"",
":",
"\"$(CFLAGS_C_$(BUI... | [
1419,
4
] | [
1448,
28
] | python | en | ['en', 'en', 'en'] | True |
MakefileWriter.ComputeOutputBasename | (self, spec) | Return the 'output basename' of a gyp spec.
E.g., the loadable module 'foobar' in directory 'baz' will produce
'libfoobar.so'
| Return the 'output basename' of a gyp spec. | def ComputeOutputBasename(self, spec):
"""Return the 'output basename' of a gyp spec.
E.g., the loadable module 'foobar' in directory 'baz' will produce
'libfoobar.so'
"""
assert not self.is_mac_bundle
if self.flavor == "mac" and self.type in (
"static_library",
... | [
"def",
"ComputeOutputBasename",
"(",
"self",
",",
"spec",
")",
":",
"assert",
"not",
"self",
".",
"is_mac_bundle",
"if",
"self",
".",
"flavor",
"==",
"\"mac\"",
"and",
"self",
".",
"type",
"in",
"(",
"\"static_library\"",
",",
"\"executable\"",
",",
"\"share... | [
1450,
4
] | [
1499,
50
] | python | en | ['en', 'haw', 'en'] | True |
MakefileWriter.ComputeOutput | (self, spec) | Return the 'output' (full output path) of a gyp spec.
E.g., the loadable module 'foobar' in directory 'baz' will produce
'$(obj)/baz/libfoobar.so'
| Return the 'output' (full output path) of a gyp spec. | def ComputeOutput(self, spec):
"""Return the 'output' (full output path) of a gyp spec.
E.g., the loadable module 'foobar' in directory 'baz' will produce
'$(obj)/baz/libfoobar.so'
"""
assert not self.is_mac_bundle
path = os.path.join("$(obj)." + self.toolset, self.path)
... | [
"def",
"ComputeOutput",
"(",
"self",
",",
"spec",
")",
":",
"assert",
"not",
"self",
".",
"is_mac_bundle",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"\"$(obj).\"",
"+",
"self",
".",
"toolset",
",",
"self",
".",
"path",
")",
"if",
"self",
".",... | [
1509,
4
] | [
1521,
67
] | python | en | ['en', 'en', 'en'] | True |
MakefileWriter.ComputeMacBundleOutput | (self, spec) | Return the 'output' (full output path) to a bundle output directory. | Return the 'output' (full output path) to a bundle output directory. | def ComputeMacBundleOutput(self, spec):
"""Return the 'output' (full output path) to a bundle output directory."""
assert self.is_mac_bundle
path = generator_default_variables["PRODUCT_DIR"]
return os.path.join(path, self.xcode_settings.GetWrapperName()) | [
"def",
"ComputeMacBundleOutput",
"(",
"self",
",",
"spec",
")",
":",
"assert",
"self",
".",
"is_mac_bundle",
"path",
"=",
"generator_default_variables",
"[",
"\"PRODUCT_DIR\"",
"]",
"return",
"os",
".",
"path",
".",
"join",
"(",
"path",
",",
"self",
".",
"xc... | [
1523,
4
] | [
1527,
71
] | python | en | ['en', 'en', 'en'] | True |
MakefileWriter.ComputeMacBundleBinaryOutput | (self, spec) | Return the 'output' (full output path) to the binary in a bundle. | Return the 'output' (full output path) to the binary in a bundle. | def ComputeMacBundleBinaryOutput(self, spec):
"""Return the 'output' (full output path) to the binary in a bundle."""
path = generator_default_variables["PRODUCT_DIR"]
return os.path.join(path, self.xcode_settings.GetExecutablePath()) | [
"def",
"ComputeMacBundleBinaryOutput",
"(",
"self",
",",
"spec",
")",
":",
"path",
"=",
"generator_default_variables",
"[",
"\"PRODUCT_DIR\"",
"]",
"return",
"os",
".",
"path",
".",
"join",
"(",
"path",
",",
"self",
".",
"xcode_settings",
".",
"GetExecutablePath... | [
1529,
4
] | [
1532,
74
] | python | en | ['en', 'en', 'en'] | True |
MakefileWriter.ComputeDeps | (self, spec) | Compute the dependencies of a gyp spec.
Returns a tuple (deps, link_deps), where each is a list of
filenames that will need to be put in front of make for either
building (deps) or linking (link_deps).
| Compute the dependencies of a gyp spec. | def ComputeDeps(self, spec):
"""Compute the dependencies of a gyp spec.
Returns a tuple (deps, link_deps), where each is a list of
filenames that will need to be put in front of make for either
building (deps) or linking (link_deps).
"""
deps = []
link_deps = []
if "depe... | [
"def",
"ComputeDeps",
"(",
"self",
",",
"spec",
")",
":",
"deps",
"=",
"[",
"]",
"link_deps",
"=",
"[",
"]",
"if",
"\"dependencies\"",
"in",
"spec",
":",
"deps",
".",
"extend",
"(",
"[",
"target_outputs",
"[",
"dep",
"]",
"for",
"dep",
"in",
"spec",
... | [
1534,
4
] | [
1558,
72
] | python | en | ['en', 'en', 'en'] | True |
MakefileWriter.WriteTarget | (
self, spec, configs, deps, link_deps, bundle_deps, extra_outputs, part_of_all
) | Write Makefile code to produce the final target of the gyp spec.
spec, configs: input from gyp.
deps, link_deps: dependency lists; see ComputeDeps()
extra_outputs: any extra outputs that our target should depend on
part_of_all: flag indicating this target is part of 'all'
| Write Makefile code to produce the final target of the gyp spec. | def WriteTarget(
self, spec, configs, deps, link_deps, bundle_deps, extra_outputs, part_of_all
):
"""Write Makefile code to produce the final target of the gyp spec.
spec, configs: input from gyp.
deps, link_deps: dependency lists; see ComputeDeps()
extra_outputs: any extra outputs that... | [
"def",
"WriteTarget",
"(",
"self",
",",
"spec",
",",
"configs",
",",
"deps",
",",
"link_deps",
",",
"bundle_deps",
",",
"extra_outputs",
",",
"part_of_all",
")",
":",
"self",
".",
"WriteLn",
"(",
"\"### Rules for final target.\"",
")",
"if",
"extra_outputs",
"... | [
1568,
4
] | [
1894,
17
] | python | en | ['en', 'en', 'en'] | True |
MakefileWriter.WriteList | (self, value_list, variable=None, prefix="", quoter=QuoteIfNecessary) | Write a variable definition that is a list of values.
E.g. WriteList(['a','b'], 'foo', prefix='blah') writes out
foo = blaha blahb
but in a pretty-printed style.
| Write a variable definition that is a list of values. | def WriteList(self, value_list, variable=None, prefix="", quoter=QuoteIfNecessary):
"""Write a variable definition that is a list of values.
E.g. WriteList(['a','b'], 'foo', prefix='blah') writes out
foo = blaha blahb
but in a pretty-printed style.
"""
values = ""
if value_... | [
"def",
"WriteList",
"(",
"self",
",",
"value_list",
",",
"variable",
"=",
"None",
",",
"prefix",
"=",
"\"\"",
",",
"quoter",
"=",
"QuoteIfNecessary",
")",
":",
"values",
"=",
"\"\"",
"if",
"value_list",
":",
"value_list",
"=",
"[",
"quoter",
"(",
"prefix... | [
1896,
4
] | [
1907,
57
] | python | en | ['en', 'en', 'en'] | True |
MakefileWriter.WriteDoCmd | (
self, outputs, inputs, command, part_of_all, comment=None, postbuilds=False
) | Write a Makefile rule that uses do_cmd.
This makes the outputs dependent on the command line that was run,
as well as support the V= make command line flag.
| Write a Makefile rule that uses do_cmd. | def WriteDoCmd(
self, outputs, inputs, command, part_of_all, comment=None, postbuilds=False
):
"""Write a Makefile rule that uses do_cmd.
This makes the outputs dependent on the command line that was run,
as well as support the V= make command line flag.
"""
suffix = ""
... | [
"def",
"WriteDoCmd",
"(",
"self",
",",
"outputs",
",",
"inputs",
",",
"command",
",",
"part_of_all",
",",
"comment",
"=",
"None",
",",
"postbuilds",
"=",
"False",
")",
":",
"suffix",
"=",
"\"\"",
"if",
"postbuilds",
":",
"assert",
"\",\"",
"not",
"in",
... | [
1909,
4
] | [
1934,
58
] | python | en | ['en', 'en', 'en'] | True |
MakefileWriter.WriteMakeRule | (
self,
outputs,
inputs,
actions=None,
comment=None,
order_only=False,
force=False,
phony=False,
command=None,
) | Write a Makefile rule, with some extra tricks.
outputs: a list of outputs for the rule (note: this is not directly
supported by make; see comments below)
inputs: a list of inputs for the rule
actions: a list of shell commands to run for the rule
comment: a comment to put in the Makefile ab... | Write a Makefile rule, with some extra tricks. | def WriteMakeRule(
self,
outputs,
inputs,
actions=None,
comment=None,
order_only=False,
force=False,
phony=False,
command=None,
):
"""Write a Makefile rule, with some extra tricks.
outputs: a list of outputs for the rule (note: thi... | [
"def",
"WriteMakeRule",
"(",
"self",
",",
"outputs",
",",
"inputs",
",",
"actions",
"=",
"None",
",",
"comment",
"=",
"None",
",",
"order_only",
"=",
"False",
",",
"force",
"=",
"False",
",",
"phony",
"=",
"False",
",",
"command",
"=",
"None",
",",
"... | [
1936,
4
] | [
2005,
22
] | python | en | ['en', 'en', 'en'] | True |
MakefileWriter.WriteAndroidNdkModuleRule | (self, module_name, all_sources, link_deps) | Write a set of LOCAL_XXX definitions for Android NDK.
These variable definitions will be used by Android NDK but do nothing for
non-Android applications.
Arguments:
module_name: Android NDK module name, which must be unique among all
module names.
all_sources: A list of source files ... | Write a set of LOCAL_XXX definitions for Android NDK. | def WriteAndroidNdkModuleRule(self, module_name, all_sources, link_deps):
"""Write a set of LOCAL_XXX definitions for Android NDK.
These variable definitions will be used by Android NDK but do nothing for
non-Android applications.
Arguments:
module_name: Android NDK module name, which must b... | [
"def",
"WriteAndroidNdkModuleRule",
"(",
"self",
",",
"module_name",
",",
"all_sources",
",",
"link_deps",
")",
":",
"if",
"self",
".",
"type",
"not",
"in",
"(",
"\"executable\"",
",",
"\"shared_library\"",
",",
"\"static_library\"",
")",
":",
"return",
"self",
... | [
2007,
4
] | [
2097,
22
] | python | en | ['en', 'en', 'en'] | True |
MakefileWriter.Objectify | (self, path) | Convert a path to its output directory form. | Convert a path to its output directory form. | def Objectify(self, path):
"""Convert a path to its output directory form."""
if "$(" in path:
path = path.replace("$(obj)/", "$(obj).%s/$(TARGET)/" % self.toolset)
if "$(obj)" not in path:
path = "$(obj).%s/$(TARGET)/%s" % (self.toolset, path)
return path | [
"def",
"Objectify",
"(",
"self",
",",
"path",
")",
":",
"if",
"\"$(\"",
"in",
"path",
":",
"path",
"=",
"path",
".",
"replace",
"(",
"\"$(obj)/\"",
",",
"\"$(obj).%s/$(TARGET)/\"",
"%",
"self",
".",
"toolset",
")",
"if",
"\"$(obj)\"",
"not",
"in",
"path"... | [
2133,
4
] | [
2139,
19
] | python | en | ['en', 'en', 'en'] | True |
MakefileWriter.Pchify | (self, path, lang) | Convert a prefix header path to its output directory form. | Convert a prefix header path to its output directory form. | def Pchify(self, path, lang):
"""Convert a prefix header path to its output directory form."""
path = self.Absolutify(path)
if "$(" in path:
path = path.replace(
"$(obj)/", "$(obj).%s/$(TARGET)/pch-%s" % (self.toolset, lang)
)
return path
... | [
"def",
"Pchify",
"(",
"self",
",",
"path",
",",
"lang",
")",
":",
"path",
"=",
"self",
".",
"Absolutify",
"(",
"path",
")",
"if",
"\"$(\"",
"in",
"path",
":",
"path",
"=",
"path",
".",
"replace",
"(",
"\"$(obj)/\"",
",",
"\"$(obj).%s/$(TARGET)/pch-%s\"",... | [
2141,
4
] | [
2149,
75
] | python | en | ['en', 'lb', 'en'] | True |
MakefileWriter.Absolutify | (self, path) | Convert a subdirectory-relative path into a base-relative path.
Skips over paths that contain variables. | Convert a subdirectory-relative path into a base-relative path.
Skips over paths that contain variables. | def Absolutify(self, path):
"""Convert a subdirectory-relative path into a base-relative path.
Skips over paths that contain variables."""
if "$(" in path:
# Don't call normpath in this case, as it might collapse the
# path too aggressively if it features '..'. However it's s... | [
"def",
"Absolutify",
"(",
"self",
",",
"path",
")",
":",
"if",
"\"$(\"",
"in",
"path",
":",
"# Don't call normpath in this case, as it might collapse the",
"# path too aggressively if it features '..'. However it's still",
"# important to strip trailing slashes.",
"return",
"path",... | [
2151,
4
] | [
2159,
62
] | python | en | ['it', 'en', 'en'] | True |
MakefileWriter._InstallableTargetInstallPath | (self) | Returns the location of the final output for an installable target. | Returns the location of the final output for an installable target. | def _InstallableTargetInstallPath(self):
"""Returns the location of the final output for an installable target."""
# Functionality removed for all platforms to match Xcode and hoist
# shared libraries into PRODUCT_DIR for users:
# Xcode puts shared_library results into PRODUCT_DIR, and s... | [
"def",
"_InstallableTargetInstallPath",
"(",
"self",
")",
":",
"# Functionality removed for all platforms to match Xcode and hoist",
"# shared libraries into PRODUCT_DIR for users:",
"# Xcode puts shared_library results into PRODUCT_DIR, and some gyp files",
"# rely on this. Emulate this behavior ... | [
2170,
4
] | [
2182,
42
] | python | en | ['en', 'en', 'en'] | True |
build_wheel_pep517 | (
name, # type: str
backend, # type: Pep517HookCaller
metadata_directory, # type: str
build_options, # type: List[str]
tempd, # type: str
) | Build one InstallRequirement using the PEP 517 build process.
Returns path to wheel if successfully built. Otherwise, returns None.
| Build one InstallRequirement using the PEP 517 build process. | def build_wheel_pep517(
name, # type: str
backend, # type: Pep517HookCaller
metadata_directory, # type: str
build_options, # type: List[str]
tempd, # type: str
):
# type: (...) -> Optional[str]
"""Build one InstallRequirement using the PEP 517 build process.
Returns path to wheel i... | [
"def",
"build_wheel_pep517",
"(",
"name",
",",
"# type: str",
"backend",
",",
"# type: Pep517HookCaller",
"metadata_directory",
",",
"# type: str",
"build_options",
",",
"# type: List[str]",
"tempd",
",",
"# type: str",
")",
":",
"# type: (...) -> Optional[str]",
"assert",
... | [
14,
0
] | [
46,
42
] | python | en | ['en', 'en', 'en'] | True |
bulk_related_objects | (field, objs, using) |
Return all objects related to ``objs`` via this ``GenericRelation``.
|
Return all objects related to ``objs`` via this ``GenericRelation``.
| def bulk_related_objects(field, objs, using):
# This overrides the method in django.contrib.contenttypes.fields.py
"""
Return all objects related to ``objs`` via this ``GenericRelation``.
"""
return field.remote_field.model._base_manager.db_manager(using).filter(
**{
"%s__pk"
... | [
"def",
"bulk_related_objects",
"(",
"field",
",",
"objs",
",",
"using",
")",
":",
"# This overrides the method in django.contrib.contenttypes.fields.py",
"return",
"field",
".",
"remote_field",
".",
"model",
".",
"_base_manager",
".",
"db_manager",
"(",
"using",
")",
... | [
11,
0
] | [
22,
5
] | python | en | ['en', 'error', 'th'] | False |
AWXCollector.add | (self, objs, source=None, nullable=False, reverse_dependency=False) |
Add 'objs' to the collection of objects to be deleted. If the call is
the result of a cascade, 'source' should be the model that caused it,
and 'nullable' should be set to True if the relation can be null.
Return a list of all objects that were not already collected.
|
Add 'objs' to the collection of objects to be deleted. If the call is
the result of a cascade, 'source' should be the model that caused it,
and 'nullable' should be set to True if the relation can be null. | def add(self, objs, source=None, nullable=False, reverse_dependency=False):
"""
Add 'objs' to the collection of objects to be deleted. If the call is
the result of a cascade, 'source' should be the model that caused it,
and 'nullable' should be set to True if the relation can be null.
... | [
"def",
"add",
"(",
"self",
",",
"objs",
",",
"source",
"=",
"None",
",",
"nullable",
"=",
"False",
",",
"reverse_dependency",
"=",
"False",
")",
":",
"if",
"not",
"objs",
".",
"exists",
"(",
")",
":",
"return",
"objs",
"model",
"=",
"objs",
".",
"m... | [
47,
4
] | [
67,
19
] | python | en | ['en', 'error', 'th'] | False |
AWXCollector.add_field_update | (self, field, value, objs) |
Schedule a field update. 'objs' must be a homogeneous iterable
collection of model instances (e.g. a QuerySet).
|
Schedule a field update. 'objs' must be a homogeneous iterable
collection of model instances (e.g. a QuerySet).
| def add_field_update(self, field, value, objs):
"""
Schedule a field update. 'objs' must be a homogeneous iterable
collection of model instances (e.g. a QuerySet).
"""
if not objs.exists():
return
model = objs.model
self.field_updates.setdefault(model,... | [
"def",
"add_field_update",
"(",
"self",
",",
"field",
",",
"value",
",",
"objs",
")",
":",
"if",
"not",
"objs",
".",
"exists",
"(",
")",
":",
"return",
"model",
"=",
"objs",
".",
"model",
"self",
".",
"field_updates",
".",
"setdefault",
"(",
"model",
... | [
69,
4
] | [
79,
62
] | python | en | ['en', 'error', 'th'] | False |
AWXCollector.collect | (self, objs, source=None, nullable=False, collect_related=True, source_attr=None, reverse_dependency=False, keep_parents=False) |
Add 'objs' to the collection of objects to be deleted as well as all
parent instances. 'objs' must be a homogeneous iterable collection of
model instances (e.g. a QuerySet). If 'collect_related' is True,
related objects will be handled by their respective on_delete handler.
I... |
Add 'objs' to the collection of objects to be deleted as well as all
parent instances. 'objs' must be a homogeneous iterable collection of
model instances (e.g. a QuerySet). If 'collect_related' is True,
related objects will be handled by their respective on_delete handler. | def collect(self, objs, source=None, nullable=False, collect_related=True, source_attr=None, reverse_dependency=False, keep_parents=False):
"""
Add 'objs' to the collection of objects to be deleted as well as all
parent instances. 'objs' must be a homogeneous iterable collection of
mode... | [
"def",
"collect",
"(",
"self",
",",
"objs",
",",
"source",
"=",
"None",
",",
"nullable",
"=",
"False",
",",
"collect_related",
"=",
"True",
",",
"source_attr",
"=",
"None",
",",
"reverse_dependency",
"=",
"False",
",",
"keep_parents",
"=",
"False",
")",
... | [
81,
4
] | [
138,
71
] | python | en | ['en', 'error', 'th'] | False |
CommonMiddleware.process_request | (self, request) |
Check for denied User-Agents and rewrite the URL based on
settings.APPEND_SLASH and settings.PREPEND_WWW
|
Check for denied User-Agents and rewrite the URL based on
settings.APPEND_SLASH and settings.PREPEND_WWW
| def process_request(self, request):
"""
Check for denied User-Agents and rewrite the URL based on
settings.APPEND_SLASH and settings.PREPEND_WWW
"""
# Check for denied User-Agents
if 'HTTP_USER_AGENT' in request.META:
for user_agent_regex in settings.DISALLOW... | [
"def",
"process_request",
"(",
"self",
",",
"request",
")",
":",
"# Check for denied User-Agents",
"if",
"'HTTP_USER_AGENT'",
"in",
"request",
".",
"META",
":",
"for",
"user_agent_regex",
"in",
"settings",
".",
"DISALLOWED_USER_AGENTS",
":",
"if",
"user_agent_regex",
... | [
43,
4
] | [
69,
61
] | python | en | ['en', 'error', 'th'] | False |
CommonMiddleware.should_redirect_with_slash | (self, request) |
Return True if settings.APPEND_SLASH is True and appending a slash to
the request path turns an invalid path into a valid one.
|
Return True if settings.APPEND_SLASH is True and appending a slash to
the request path turns an invalid path into a valid one.
| def should_redirect_with_slash(self, request):
"""
Return True if settings.APPEND_SLASH is True and appending a slash to
the request path turns an invalid path into a valid one.
"""
if settings.APPEND_SLASH and not request.path_info.endswith('/'):
urlconf = getattr(re... | [
"def",
"should_redirect_with_slash",
"(",
"self",
",",
"request",
")",
":",
"if",
"settings",
".",
"APPEND_SLASH",
"and",
"not",
"request",
".",
"path_info",
".",
"endswith",
"(",
"'/'",
")",
":",
"urlconf",
"=",
"getattr",
"(",
"request",
",",
"'urlconf'",
... | [
71,
4
] | [
82,
20
] | python | en | ['en', 'error', 'th'] | False |
CommonMiddleware.get_full_path_with_slash | (self, request) |
Return the full path of the request with a trailing slash appended.
Raise a RuntimeError if settings.DEBUG is True and request.method is
POST, PUT, or PATCH.
|
Return the full path of the request with a trailing slash appended. | def get_full_path_with_slash(self, request):
"""
Return the full path of the request with a trailing slash appended.
Raise a RuntimeError if settings.DEBUG is True and request.method is
POST, PUT, or PATCH.
"""
new_path = request.get_full_path(force_append_slash=True)
... | [
"def",
"get_full_path_with_slash",
"(",
"self",
",",
"request",
")",
":",
"new_path",
"=",
"request",
".",
"get_full_path",
"(",
"force_append_slash",
"=",
"True",
")",
"if",
"settings",
".",
"DEBUG",
"and",
"request",
".",
"method",
"in",
"(",
"'POST'",
","... | [
84,
4
] | [
103,
23
] | python | en | ['en', 'error', 'th'] | False |
CommonMiddleware.process_response | (self, request, response) |
Calculate the ETag, if needed.
When the status code of the response is 404, it may redirect to a path
with an appended slash if should_redirect_with_slash() returns True.
|
Calculate the ETag, if needed. | def process_response(self, request, response):
"""
Calculate the ETag, if needed.
When the status code of the response is 404, it may redirect to a path
with an appended slash if should_redirect_with_slash() returns True.
"""
# If the given URL is "Not Found", then check... | [
"def",
"process_response",
"(",
"self",
",",
"request",
",",
"response",
")",
":",
"# If the given URL is \"Not Found\", then check if we should redirect to",
"# a path with a slash appended.",
"if",
"response",
".",
"status_code",
"==",
"404",
":",
"if",
"self",
".",
"sh... | [
105,
4
] | [
140,
23
] | python | en | ['en', 'error', 'th'] | False |
CommonMiddleware.needs_etag | (self, response) |
Return True if an ETag header should be added to response.
|
Return True if an ETag header should be added to response.
| def needs_etag(self, response):
"""
Return True if an ETag header should be added to response.
"""
cache_control_headers = cc_delim_re.split(response.get('Cache-Control', ''))
return all(header.lower() != 'no-store' for header in cache_control_headers) | [
"def",
"needs_etag",
"(",
"self",
",",
"response",
")",
":",
"cache_control_headers",
"=",
"cc_delim_re",
".",
"split",
"(",
"response",
".",
"get",
"(",
"'Cache-Control'",
",",
"''",
")",
")",
"return",
"all",
"(",
"header",
".",
"lower",
"(",
")",
"!="... | [
142,
4
] | [
147,
84
] | python | en | ['en', 'error', 'th'] | False |
BrokenLinkEmailsMiddleware.process_response | (self, request, response) |
Send broken link emails for relevant 404 NOT FOUND responses.
|
Send broken link emails for relevant 404 NOT FOUND responses.
| def process_response(self, request, response):
"""
Send broken link emails for relevant 404 NOT FOUND responses.
"""
if response.status_code == 404 and not settings.DEBUG:
domain = request.get_host()
path = request.get_full_path()
referer = force_text(... | [
"def",
"process_response",
"(",
"self",
",",
"request",
",",
"response",
")",
":",
"if",
"response",
".",
"status_code",
"==",
"404",
"and",
"not",
"settings",
".",
"DEBUG",
":",
"domain",
"=",
"request",
".",
"get_host",
"(",
")",
"path",
"=",
"request"... | [
152,
4
] | [
172,
23
] | python | en | ['en', 'error', 'th'] | False |
BrokenLinkEmailsMiddleware.is_internal_request | (self, domain, referer) |
Returns True if the referring URL is the same domain as the current request.
|
Returns True if the referring URL is the same domain as the current request.
| def is_internal_request(self, domain, referer):
"""
Returns True if the referring URL is the same domain as the current request.
"""
# Different subdomains are treated as different domains.
return bool(re.match("^https?://%s/" % re.escape(domain), referer)) | [
"def",
"is_internal_request",
"(",
"self",
",",
"domain",
",",
"referer",
")",
":",
"# Different subdomains are treated as different domains.",
"return",
"bool",
"(",
"re",
".",
"match",
"(",
"\"^https?://%s/\"",
"%",
"re",
".",
"escape",
"(",
"domain",
")",
",",
... | [
174,
4
] | [
179,
75
] | python | en | ['en', 'error', 'th'] | False |
BrokenLinkEmailsMiddleware.is_ignorable_request | (self, request, uri, domain, referer) |
Return True if the given request *shouldn't* notify the site managers
according to project settings or in situations outlined by the inline
comments.
|
Return True if the given request *shouldn't* notify the site managers
according to project settings or in situations outlined by the inline
comments.
| def is_ignorable_request(self, request, uri, domain, referer):
"""
Return True if the given request *shouldn't* notify the site managers
according to project settings or in situations outlined by the inline
comments.
"""
# The referer is empty.
if not referer:
... | [
"def",
"is_ignorable_request",
"(",
"self",
",",
"request",
",",
"uri",
",",
"domain",
",",
"referer",
")",
":",
"# The referer is empty.",
"if",
"not",
"referer",
":",
"return",
"True",
"# APPEND_SLASH is enabled and the referer is equal to the current URL",
"# without a... | [
181,
4
] | [
206,
82
] | python | en | ['en', 'error', 'th'] | False |
GeoQuerySet.area | (self, tolerance=0.05, **kwargs) |
Returns the area of the geographic field in an `area` attribute on
each element of this GeoQuerySet.
|
Returns the area of the geographic field in an `area` attribute on
each element of this GeoQuerySet.
| def area(self, tolerance=0.05, **kwargs):
"""
Returns the area of the geographic field in an `area` attribute on
each element of this GeoQuerySet.
"""
# Performing setup here rather than in `_spatial_attribute` so that
# we can get the units for `AreaField`.
proce... | [
"def",
"area",
"(",
"self",
",",
"tolerance",
"=",
"0.05",
",",
"*",
"*",
"kwargs",
")",
":",
"# Performing setup here rather than in `_spatial_attribute` so that",
"# we can get the units for `AreaField`.",
"procedure_args",
",",
"geo_field",
"=",
"self",
".",
"_spatial_... | [
24,
4
] | [
53,
59
] | python | en | ['en', 'error', 'th'] | False |
GeoQuerySet.centroid | (self, **kwargs) |
Returns the centroid of the geographic field in a `centroid`
attribute on each element of this GeoQuerySet.
|
Returns the centroid of the geographic field in a `centroid`
attribute on each element of this GeoQuerySet.
| def centroid(self, **kwargs):
"""
Returns the centroid of the geographic field in a `centroid`
attribute on each element of this GeoQuerySet.
"""
return self._geom_attribute('centroid', **kwargs) | [
"def",
"centroid",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_geom_attribute",
"(",
"'centroid'",
",",
"*",
"*",
"kwargs",
")"
] | [
55,
4
] | [
60,
57
] | python | en | ['en', 'error', 'th'] | False |
GeoQuerySet.difference | (self, geom, **kwargs) |
Returns the spatial difference of the geographic field in a `difference`
attribute on each element of this GeoQuerySet.
|
Returns the spatial difference of the geographic field in a `difference`
attribute on each element of this GeoQuerySet.
| def difference(self, geom, **kwargs):
"""
Returns the spatial difference of the geographic field in a `difference`
attribute on each element of this GeoQuerySet.
"""
return self._geomset_attribute('difference', geom, **kwargs) | [
"def",
"difference",
"(",
"self",
",",
"geom",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_geomset_attribute",
"(",
"'difference'",
",",
"geom",
",",
"*",
"*",
"kwargs",
")"
] | [
62,
4
] | [
67,
68
] | python | en | ['en', 'error', 'th'] | False |
GeoQuerySet.distance | (self, geom, **kwargs) |
Returns the distance from the given geographic field name to the
given geometry in a `distance` attribute on each element of the
GeoQuerySet.
Keyword Arguments:
`spheroid` => If the geometry field is geodetic and PostGIS is
the spatial database, then t... |
Returns the distance from the given geographic field name to the
given geometry in a `distance` attribute on each element of the
GeoQuerySet. | def distance(self, geom, **kwargs):
"""
Returns the distance from the given geographic field name to the
given geometry in a `distance` attribute on each element of the
GeoQuerySet.
Keyword Arguments:
`spheroid` => If the geometry field is geodetic and PostGIS is
... | [
"def",
"distance",
"(",
"self",
",",
"geom",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_distance_attribute",
"(",
"'distance'",
",",
"geom",
",",
"*",
"*",
"kwargs",
")"
] | [
69,
4
] | [
85,
67
] | python | en | ['en', 'error', 'th'] | False |
GeoQuerySet.envelope | (self, **kwargs) |
Returns a Geometry representing the bounding box of the
Geometry field in an `envelope` attribute on each element of
the GeoQuerySet.
|
Returns a Geometry representing the bounding box of the
Geometry field in an `envelope` attribute on each element of
the GeoQuerySet.
| def envelope(self, **kwargs):
"""
Returns a Geometry representing the bounding box of the
Geometry field in an `envelope` attribute on each element of
the GeoQuerySet.
"""
return self._geom_attribute('envelope', **kwargs) | [
"def",
"envelope",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_geom_attribute",
"(",
"'envelope'",
",",
"*",
"*",
"kwargs",
")"
] | [
87,
4
] | [
93,
57
] | python | en | ['en', 'error', 'th'] | False |
GeoQuerySet.force_rhr | (self, **kwargs) |
Returns a modified version of the Polygon/MultiPolygon in which
all of the vertices follow the Right-Hand-Rule. By default,
this is attached as the `force_rhr` attribute on each element
of the GeoQuerySet.
|
Returns a modified version of the Polygon/MultiPolygon in which
all of the vertices follow the Right-Hand-Rule. By default,
this is attached as the `force_rhr` attribute on each element
of the GeoQuerySet.
| def force_rhr(self, **kwargs):
"""
Returns a modified version of the Polygon/MultiPolygon in which
all of the vertices follow the Right-Hand-Rule. By default,
this is attached as the `force_rhr` attribute on each element
of the GeoQuerySet.
"""
return self._geom_... | [
"def",
"force_rhr",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_geom_attribute",
"(",
"'force_rhr'",
",",
"*",
"*",
"kwargs",
")"
] | [
95,
4
] | [
102,
58
] | python | en | ['en', 'error', 'th'] | False |
GeoQuerySet.geojson | (self, precision=8, crs=False, bbox=False, **kwargs) |
Returns a GeoJSON representation of the geometry field in a `geojson`
attribute on each element of the GeoQuerySet.
The `crs` and `bbox` keywords may be set to True if the user wants
the coordinate reference system and the bounding box to be included
in the GeoJSON representati... |
Returns a GeoJSON representation of the geometry field in a `geojson`
attribute on each element of the GeoQuerySet. | def geojson(self, precision=8, crs=False, bbox=False, **kwargs):
"""
Returns a GeoJSON representation of the geometry field in a `geojson`
attribute on each element of the GeoQuerySet.
The `crs` and `bbox` keywords may be set to True if the user wants
the coordinate reference sy... | [
"def",
"geojson",
"(",
"self",
",",
"precision",
"=",
"8",
",",
"crs",
"=",
"False",
",",
"bbox",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"backend",
"=",
"connections",
"[",
"self",
".",
"db",
"]",
".",
"ops",
"if",
"not",
"backend",
"."... | [
104,
4
] | [
131,
62
] | python | en | ['en', 'error', 'th'] | False |
GeoQuerySet.geohash | (self, precision=20, **kwargs) |
Returns a GeoHash representation of the given field in a `geohash`
attribute on each element of the GeoQuerySet.
The `precision` keyword may be used to custom the number of
_characters_ used in the output GeoHash, the default is 20.
|
Returns a GeoHash representation of the given field in a `geohash`
attribute on each element of the GeoQuerySet. | def geohash(self, precision=20, **kwargs):
"""
Returns a GeoHash representation of the given field in a `geohash`
attribute on each element of the GeoQuerySet.
The `precision` keyword may be used to custom the number of
_characters_ used in the output GeoHash, the default is 20.... | [
"def",
"geohash",
"(",
"self",
",",
"precision",
"=",
"20",
",",
"*",
"*",
"kwargs",
")",
":",
"s",
"=",
"{",
"'desc'",
":",
"'GeoHash'",
",",
"'procedure_args'",
":",
"{",
"'precision'",
":",
"precision",
"}",
",",
"'procedure_fmt'",
":",
"'%(geo_col)s,... | [
133,
4
] | [
145,
62
] | python | en | ['en', 'error', 'th'] | False |
GeoQuerySet.gml | (self, precision=8, version=2, **kwargs) |
Returns GML representation of the given field in a `gml` attribute
on each element of the GeoQuerySet.
|
Returns GML representation of the given field in a `gml` attribute
on each element of the GeoQuerySet.
| def gml(self, precision=8, version=2, **kwargs):
"""
Returns GML representation of the given field in a `gml` attribute
on each element of the GeoQuerySet.
"""
backend = connections[self.db].ops
s = {'desc': 'GML', 'procedure_args': {'precision': precision}}
if ba... | [
"def",
"gml",
"(",
"self",
",",
"precision",
"=",
"8",
",",
"version",
"=",
"2",
",",
"*",
"*",
"kwargs",
")",
":",
"backend",
"=",
"connections",
"[",
"self",
".",
"db",
"]",
".",
"ops",
"s",
"=",
"{",
"'desc'",
":",
"'GML'",
",",
"'procedure_ar... | [
147,
4
] | [
160,
58
] | python | en | ['en', 'error', 'th'] | False |
GeoQuerySet.intersection | (self, geom, **kwargs) |
Returns the spatial intersection of the Geometry field in
an `intersection` attribute on each element of this
GeoQuerySet.
|
Returns the spatial intersection of the Geometry field in
an `intersection` attribute on each element of this
GeoQuerySet.
| def intersection(self, geom, **kwargs):
"""
Returns the spatial intersection of the Geometry field in
an `intersection` attribute on each element of this
GeoQuerySet.
"""
return self._geomset_attribute('intersection', geom, **kwargs) | [
"def",
"intersection",
"(",
"self",
",",
"geom",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_geomset_attribute",
"(",
"'intersection'",
",",
"geom",
",",
"*",
"*",
"kwargs",
")"
] | [
162,
4
] | [
168,
70
] | python | en | ['en', 'error', 'th'] | False |
GeoQuerySet.kml | (self, **kwargs) |
Returns KML representation of the geometry field in a `kml`
attribute on each element of this GeoQuerySet.
|
Returns KML representation of the geometry field in a `kml`
attribute on each element of this GeoQuerySet.
| def kml(self, **kwargs):
"""
Returns KML representation of the geometry field in a `kml`
attribute on each element of this GeoQuerySet.
"""
s = {'desc': 'KML',
'procedure_fmt': '%(geo_col)s,%(precision)s',
'procedure_args': {'precision': kwargs.pop('prec... | [
"def",
"kml",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"s",
"=",
"{",
"'desc'",
":",
"'KML'",
",",
"'procedure_fmt'",
":",
"'%(geo_col)s,%(precision)s'",
",",
"'procedure_args'",
":",
"{",
"'precision'",
":",
"kwargs",
".",
"pop",
"(",
"'precision'"... | [
170,
4
] | [
179,
58
] | python | en | ['en', 'error', 'th'] | False |
GeoQuerySet.length | (self, **kwargs) |
Returns the length of the geometry field as a `Distance` object
stored in a `length` attribute on each element of this GeoQuerySet.
|
Returns the length of the geometry field as a `Distance` object
stored in a `length` attribute on each element of this GeoQuerySet.
| def length(self, **kwargs):
"""
Returns the length of the geometry field as a `Distance` object
stored in a `length` attribute on each element of this GeoQuerySet.
"""
return self._distance_attribute('length', None, **kwargs) | [
"def",
"length",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_distance_attribute",
"(",
"'length'",
",",
"None",
",",
"*",
"*",
"kwargs",
")"
] | [
181,
4
] | [
186,
65
] | python | en | ['en', 'error', 'th'] | False |
GeoQuerySet.mem_size | (self, **kwargs) |
Returns the memory size (number of bytes) that the geometry field takes
in a `mem_size` attribute on each element of this GeoQuerySet.
|
Returns the memory size (number of bytes) that the geometry field takes
in a `mem_size` attribute on each element of this GeoQuerySet.
| def mem_size(self, **kwargs):
"""
Returns the memory size (number of bytes) that the geometry field takes
in a `mem_size` attribute on each element of this GeoQuerySet.
"""
return self._spatial_attribute('mem_size', {}, **kwargs) | [
"def",
"mem_size",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"_spatial_attribute",
"(",
"'mem_size'",
",",
"{",
"}",
",",
"*",
"*",
"kwargs",
")"
] | [
188,
4
] | [
193,
64
] | python | en | ['en', 'error', 'th'] | False |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.