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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
make_docker_context | (
get_steps_fn, github_project, opts=None, default_context_dir=None
) |
Returns a path to the Docker context directory. See parse_args.py.
Helper for making a command-line utility that writes your project's
Dockerfile and associated data into a (temporary) directory. Your main
program might look something like this:
print(make_docker_context(
lambda ... |
Returns a path to the Docker context directory. See parse_args.py. | def make_docker_context(
get_steps_fn, github_project, opts=None, default_context_dir=None
):
'''
Returns a path to the Docker context directory. See parse_args.py.
Helper for making a command-line utility that writes your project's
Dockerfile and associated data into a (temporary) directory. Your... | [
"def",
"make_docker_context",
"(",
"get_steps_fn",
",",
"github_project",
",",
"opts",
"=",
"None",
",",
"default_context_dir",
"=",
"None",
")",
":",
"if",
"opts",
"is",
"None",
":",
"opts",
"=",
"{",
"}",
"valid_versions",
"=",
"(",
"(",
"'ubuntu:16.04'",
... | [
25,
0
] | [
162,
22
] | python | en | ['en', 'error', 'th'] | False |
_route_to_regex | (route, is_endpoint=False) |
Convert a path pattern into a regular expression. Return the regular
expression and a dictionary mapping the capture names to the converters.
For example, 'foo/<int:pk>' returns '^foo\\/(?P<pk>[0-9]+)'
and {'pk': <django.urls.converters.IntConverter>}.
|
Convert a path pattern into a regular expression. Return the regular
expression and a dictionary mapping the capture names to the converters.
For example, 'foo/<int:pk>' returns '^foo\\/(?P<pk>[0-9]+)'
and {'pk': <django.urls.converters.IntConverter>}.
| def _route_to_regex(route, is_endpoint=False):
"""
Convert a path pattern into a regular expression. Return the regular
expression and a dictionary mapping the capture names to the converters.
For example, 'foo/<int:pk>' returns '^foo\\/(?P<pk>[0-9]+)'
and {'pk': <django.urls.converters.IntConverter... | [
"def",
"_route_to_regex",
"(",
"route",
",",
"is_endpoint",
"=",
"False",
")",
":",
"original_route",
"=",
"route",
"parts",
"=",
"[",
"'^'",
"]",
"converters",
"=",
"{",
"}",
"while",
"True",
":",
"match",
"=",
"_PATH_PARAMETER_COMPONENT_RE",
".",
"search",... | [
204,
0
] | [
247,
37
] | python | en | ['en', 'error', 'th'] | False |
LocaleRegexDescriptor.__get__ | (self, instance, cls=None) |
Return a compiled regular expression based on the active language.
|
Return a compiled regular expression based on the active language.
| def __get__(self, instance, cls=None):
"""
Return a compiled regular expression based on the active language.
"""
if instance is None:
return self
# As a performance optimization, if the given regex string is a regular
# string (not a lazily-translated string ... | [
"def",
"__get__",
"(",
"self",
",",
"instance",
",",
"cls",
"=",
"None",
")",
":",
"if",
"instance",
"is",
"None",
":",
"return",
"self",
"# As a performance optimization, if the given regex string is a regular",
"# string (not a lazily-translated string proxy), compile it on... | [
93,
4
] | [
109,
50
] | python | en | ['en', 'error', 'th'] | False |
CheckURLMixin.describe | (self) |
Format the URL pattern for display in warning messages.
|
Format the URL pattern for display in warning messages.
| def describe(self):
"""
Format the URL pattern for display in warning messages.
"""
description = "'{}'".format(self)
if self.name:
description += " [name='{}']".format(self.name)
return description | [
"def",
"describe",
"(",
"self",
")",
":",
"description",
"=",
"\"'{}'\"",
".",
"format",
"(",
"self",
")",
"if",
"self",
".",
"name",
":",
"description",
"+=",
"\" [name='{}']\"",
".",
"format",
"(",
"self",
".",
"name",
")",
"return",
"description"
] | [
113,
4
] | [
120,
26
] | python | en | ['en', 'error', 'th'] | False |
CheckURLMixin._check_pattern_startswith_slash | (self) |
Check that the pattern does not begin with a forward slash.
|
Check that the pattern does not begin with a forward slash.
| def _check_pattern_startswith_slash(self):
"""
Check that the pattern does not begin with a forward slash.
"""
regex_pattern = self.regex.pattern
if not settings.APPEND_SLASH:
# Skip check as it can be useful to start a URL pattern with a slash
# when APPE... | [
"def",
"_check_pattern_startswith_slash",
"(",
"self",
")",
":",
"regex_pattern",
"=",
"self",
".",
"regex",
".",
"pattern",
"if",
"not",
"settings",
".",
"APPEND_SLASH",
":",
"# Skip check as it can be useful to start a URL pattern with a slash",
"# when APPEND_SLASH=False."... | [
122,
4
] | [
142,
21
] | python | en | ['en', 'error', 'th'] | False |
RegexPattern._compile | (self, regex) | Compile and return the given regular expression. | Compile and return the given regular expression. | def _compile(self, regex):
"""Compile and return the given regular expression."""
try:
return re.compile(regex)
except re.error as e:
raise ImproperlyConfigured(
'"%s" is not a valid regular expression: %s' % (regex, e)
) from e | [
"def",
"_compile",
"(",
"self",
",",
"regex",
")",
":",
"try",
":",
"return",
"re",
".",
"compile",
"(",
"regex",
")",
"except",
"re",
".",
"error",
"as",
"e",
":",
"raise",
"ImproperlyConfigured",
"(",
"'\"%s\" is not a valid regular expression: %s'",
"%",
... | [
186,
4
] | [
193,
20
] | python | en | ['en', 'en', 'en'] | True |
URLPattern._check_pattern_name | (self) |
Check that the pattern name does not contain a colon.
|
Check that the pattern name does not contain a colon.
| def _check_pattern_name(self):
"""
Check that the pattern name does not contain a colon.
"""
if self.pattern.name is not None and ":" in self.pattern.name:
warning = Warning(
"Your URL pattern {} has a name including a ':'. Remove the colon, to "
... | [
"def",
"_check_pattern_name",
"(",
"self",
")",
":",
"if",
"self",
".",
"pattern",
".",
"name",
"is",
"not",
"None",
"and",
"\":\"",
"in",
"self",
".",
"pattern",
".",
"name",
":",
"warning",
"=",
"Warning",
"(",
"\"Your URL pattern {} has a name including a '... | [
342,
4
] | [
354,
21
] | python | en | ['en', 'error', 'th'] | False |
URLPattern.lookup_str | (self) |
A string that identifies the view (e.g. 'path.to.view_function' or
'path.to.ClassBasedView').
|
A string that identifies the view (e.g. 'path.to.view_function' or
'path.to.ClassBasedView').
| def lookup_str(self):
"""
A string that identifies the view (e.g. 'path.to.view_function' or
'path.to.ClassBasedView').
"""
callback = self.callback
if isinstance(callback, functools.partial):
callback = callback.func
if not hasattr(callback, '__name__... | [
"def",
"lookup_str",
"(",
"self",
")",
":",
"callback",
"=",
"self",
".",
"callback",
"if",
"isinstance",
"(",
"callback",
",",
"functools",
".",
"partial",
")",
":",
"callback",
"=",
"callback",
".",
"func",
"if",
"not",
"hasattr",
"(",
"callback",
",",... | [
365,
4
] | [
375,
64
] | python | en | ['en', 'error', 'th'] | False |
URLResolver._join_route | (route1, route2) | Join two routes, without the starting ^ in the second route. | Join two routes, without the starting ^ in the second route. | def _join_route(route1, route2):
"""Join two routes, without the starting ^ in the second route."""
if not route1:
return route2
if route2.startswith('^'):
route2 = route2[1:]
return route1 + route2 | [
"def",
"_join_route",
"(",
"route1",
",",
"route2",
")",
":",
"if",
"not",
"route1",
":",
"return",
"route2",
"if",
"route2",
".",
"startswith",
"(",
"'^'",
")",
":",
"route2",
"=",
"route2",
"[",
"1",
":",
"]",
"return",
"route1",
"+",
"route2"
] | [
536,
4
] | [
542,
30
] | python | en | ['en', 'en', 'en'] | True |
KohlschuetterFeatures.fit | (self, blocks, y=None) |
This method returns the current instance unchanged, since no fitting is
required for this ``Feature``. It's here only for API consistency.
|
This method returns the current instance unchanged, since no fitting is
required for this ``Feature``. It's here only for API consistency.
| def fit(self, blocks, y=None):
"""
This method returns the current instance unchanged, since no fitting is
required for this ``Feature``. It's here only for API consistency.
"""
return self | [
"def",
"fit",
"(",
"self",
",",
"blocks",
",",
"y",
"=",
"None",
")",
":",
"return",
"self"
] | [
19,
4
] | [
24,
19
] | python | en | ['en', 'error', 'th'] | False |
KohlschuetterFeatures.transform | (self, blocks, y=None) |
Transform an ordered sequence of blocks into a 2D features matrix with
shape (num blocks, num features).
Args:
blocks (List[Block]): as output by :class:`Blockifier.blockify`
y (None): This isn't used, it's only here for API consistency.
Returns:
`n... |
Transform an ordered sequence of blocks into a 2D features matrix with
shape (num blocks, num features). | def transform(self, blocks, y=None):
"""
Transform an ordered sequence of blocks into a 2D features matrix with
shape (num blocks, num features).
Args:
blocks (List[Block]): as output by :class:`Blockifier.blockify`
y (None): This isn't used, it's only here for A... | [
"def",
"transform",
"(",
"self",
",",
"blocks",
",",
"y",
"=",
"None",
")",
":",
"return",
"make_kohlschuetter_features",
"(",
"blocks",
")"
] | [
26,
4
] | [
40,
50
] | python | en | ['en', 'error', 'th'] | False |
OracleOperations.geo_db_type | (self, f) |
Return the geometry database type for Oracle. Unlike other spatial
backends, no stored procedure is necessary and it's the same for all
geometry types.
|
Return the geometry database type for Oracle. Unlike other spatial
backends, no stored procedure is necessary and it's the same for all
geometry types.
| def geo_db_type(self, f):
"""
Return the geometry database type for Oracle. Unlike other spatial
backends, no stored procedure is necessary and it's the same for all
geometry types.
"""
return 'MDSYS.SDO_GEOMETRY' | [
"def",
"geo_db_type",
"(",
"self",
",",
"f",
")",
":",
"return",
"'MDSYS.SDO_GEOMETRY'"
] | [
141,
4
] | [
147,
35
] | python | en | ['en', 'error', 'th'] | False |
OracleOperations.get_distance | (self, f, value, lookup_type) |
Return the distance parameters given the value and the lookup type.
On Oracle, geometry columns with a geodetic coordinate system behave
implicitly like a geography column, and thus meters will be used as
the distance parameter on them.
|
Return the distance parameters given the value and the lookup type.
On Oracle, geometry columns with a geodetic coordinate system behave
implicitly like a geography column, and thus meters will be used as
the distance parameter on them.
| def get_distance(self, f, value, lookup_type):
"""
Return the distance parameters given the value and the lookup type.
On Oracle, geometry columns with a geodetic coordinate system behave
implicitly like a geography column, and thus meters will be used as
the distance parameter o... | [
"def",
"get_distance",
"(",
"self",
",",
"f",
",",
"value",
",",
"lookup_type",
")",
":",
"if",
"not",
"value",
":",
"return",
"[",
"]",
"value",
"=",
"value",
"[",
"0",
"]",
"if",
"isinstance",
"(",
"value",
",",
"Distance",
")",
":",
"if",
"f",
... | [
149,
4
] | [
172,
27
] | python | en | ['en', 'error', 'th'] | False |
OracleOperations.spatial_aggregate_name | (self, agg_name) |
Return the spatial aggregate SQL name.
|
Return the spatial aggregate SQL name.
| def spatial_aggregate_name(self, agg_name):
"""
Return the spatial aggregate SQL name.
"""
agg_name = 'unionagg' if agg_name.lower() == 'union' else agg_name.lower()
return getattr(self, agg_name) | [
"def",
"spatial_aggregate_name",
"(",
"self",
",",
"agg_name",
")",
":",
"agg_name",
"=",
"'unionagg'",
"if",
"agg_name",
".",
"lower",
"(",
")",
"==",
"'union'",
"else",
"agg_name",
".",
"lower",
"(",
")",
"return",
"getattr",
"(",
"self",
",",
"agg_name"... | [
179,
4
] | [
184,
38
] | python | en | ['en', 'error', 'th'] | False |
OracleOperations.modify_insert_params | (self, placeholder, params) | Drop out insert parameters for NULL placeholder. Needed for Oracle Spatial
backend due to #10888.
| Drop out insert parameters for NULL placeholder. Needed for Oracle Spatial
backend due to #10888.
| def modify_insert_params(self, placeholder, params):
"""Drop out insert parameters for NULL placeholder. Needed for Oracle Spatial
backend due to #10888.
"""
if placeholder == 'NULL':
return []
return super().modify_insert_params(placeholder, params) | [
"def",
"modify_insert_params",
"(",
"self",
",",
"placeholder",
",",
"params",
")",
":",
"if",
"placeholder",
"==",
"'NULL'",
":",
"return",
"[",
"]",
"return",
"super",
"(",
")",
".",
"modify_insert_params",
"(",
"placeholder",
",",
"params",
")"
] | [
199,
4
] | [
205,
64
] | python | en | ['en', 'en', 'en'] | True |
ChiaManager._wait_for_chiabox_docker | (num_trials: int = 20) | Returns true if the chiabox docker is up.
Otherwise it will keep trying checking the status of the
chiabox docker for num_trials times.
Returns False if the docker container is not up after that
many trials.
| Returns true if the chiabox docker is up.
Otherwise it will keep trying checking the status of the
chiabox docker for num_trials times.
Returns False if the docker container is not up after that
many trials.
| def _wait_for_chiabox_docker(num_trials: int = 20):
"""Returns true if the chiabox docker is up.
Otherwise it will keep trying checking the status of the
chiabox docker for num_trials times.
Returns False if the docker container is not up after that
many trials.
"""
... | [
"def",
"_wait_for_chiabox_docker",
"(",
"num_trials",
":",
"int",
"=",
"20",
")",
":",
"for",
"i",
"in",
"range",
"(",
"num_trials",
")",
":",
"if",
"i",
"!=",
"0",
":",
"time",
".",
"sleep",
"(",
"1",
")",
"docker_status",
"=",
"check_chiabox_docker_sta... | [
120,
4
] | [
135,
20
] | python | en | ['en', 'en', 'en'] | True |
GeoModelAdmin.media | (self) | Injects OpenLayers JavaScript into the admin. | Injects OpenLayers JavaScript into the admin. | def media(self):
"Injects OpenLayers JavaScript into the admin."
return super().media + Media(js=[self.openlayers_url] + self.extra_js) | [
"def",
"media",
"(",
"self",
")",
":",
"return",
"super",
"(",
")",
".",
"media",
"+",
"Media",
"(",
"js",
"=",
"[",
"self",
".",
"openlayers_url",
"]",
"+",
"self",
".",
"extra_js",
")"
] | [
47,
4
] | [
49,
78
] | python | en | ['en', 'en', 'en'] | True |
GeoModelAdmin.formfield_for_dbfield | (self, db_field, request, **kwargs) |
Overloaded from ModelAdmin so that an OpenLayersWidget is used
for viewing/editing 2D GeometryFields (OpenLayers 2 does not support
3D editing).
|
Overloaded from ModelAdmin so that an OpenLayersWidget is used
for viewing/editing 2D GeometryFields (OpenLayers 2 does not support
3D editing).
| def formfield_for_dbfield(self, db_field, request, **kwargs):
"""
Overloaded from ModelAdmin so that an OpenLayersWidget is used
for viewing/editing 2D GeometryFields (OpenLayers 2 does not support
3D editing).
"""
if isinstance(db_field, models.GeometryField) and db_fiel... | [
"def",
"formfield_for_dbfield",
"(",
"self",
",",
"db_field",
",",
"request",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"isinstance",
"(",
"db_field",
",",
"models",
".",
"GeometryField",
")",
"and",
"db_field",
".",
"dim",
"<",
"3",
":",
"# Setting the wid... | [
51,
4
] | [
62,
77
] | python | en | ['en', 'error', 'th'] | False |
GeoModelAdmin.get_map_widget | (self, db_field) |
Return a subclass of the OpenLayersWidget (or whatever was specified
in the `widget` attribute) using the settings from the attributes set
in this class.
|
Return a subclass of the OpenLayersWidget (or whatever was specified
in the `widget` attribute) using the settings from the attributes set
in this class.
| def get_map_widget(self, db_field):
"""
Return a subclass of the OpenLayersWidget (or whatever was specified
in the `widget` attribute) using the settings from the attributes set
in this class.
"""
is_collection = db_field.geom_type in ('MULTIPOINT', 'MULTILINESTRING', 'M... | [
"def",
"get_map_widget",
"(",
"self",
",",
"db_field",
")",
":",
"is_collection",
"=",
"db_field",
".",
"geom_type",
"in",
"(",
"'MULTIPOINT'",
",",
"'MULTILINESTRING'",
",",
"'MULTIPOLYGON'",
",",
"'GEOMETRYCOLLECTION'",
")",
"if",
"is_collection",
":",
"if",
"... | [
64,
4
] | [
123,
20
] | python | en | ['en', 'error', 'th'] | False |
unescape | (s) | The inverse of cgi.escape(). | The inverse of cgi.escape(). | def unescape(s):
"""The inverse of cgi.escape()."""
s = s.replace('"', '"').replace('>', '>').replace('<', '<')
return s.replace('&', '&') | [
"def",
"unescape",
"(",
"s",
")",
":",
"s",
"=",
"s",
".",
"replace",
"(",
"'"'",
",",
"'\"'",
")",
".",
"replace",
"(",
"'>'",
",",
"'>'",
")",
".",
"replace",
"(",
"'<'",
",",
"'<'",
")",
"return",
"s",
".",
"replace",
"(",
"'&'"... | [
13,
0
] | [
16,
34
] | python | en | ['en', 'it', 'en'] | True |
make_request | (url, pool, *, method='GET', headers=None, version='1.1') | Start an HTTP request. Return a Connection. | Start an HTTP request. Return a Connection. | def make_request(url, pool, *, method='GET', headers=None, version='1.1'):
"""Start an HTTP request. Return a Connection."""
parts = urllib.parse.urlparse(url)
assert parts.scheme in ('http', 'https'), repr(url)
ssl = parts.scheme == 'https'
port = parts.port or (443 if ssl else 80)
path = part... | [
"def",
"make_request",
"(",
"url",
",",
"pool",
",",
"*",
",",
"method",
"=",
"'GET'",
",",
"headers",
"=",
"None",
",",
"version",
"=",
"'1.1'",
")",
":",
"parts",
"=",
"urllib",
".",
"parse",
".",
"urlparse",
"(",
"url",
")",
"assert",
"parts",
"... | [
150,
0
] | [
174,
15
] | python | en | ['en', 'lb', 'en'] | True |
read_response | (conn) | Read an HTTP response from a connection. | Read an HTTP response from a connection. | def read_response(conn):
"""Read an HTTP response from a connection."""
@asyncio.coroutine
def getline():
line = (yield from conn.reader.readline()).decode('latin-1').rstrip()
logger.info('< %s', line)
return line
status_line = yield from getline()
status_parts = status_lin... | [
"def",
"read_response",
"(",
"conn",
")",
":",
"@",
"asyncio",
".",
"coroutine",
"def",
"getline",
"(",
")",
":",
"line",
"=",
"(",
"yield",
"from",
"conn",
".",
"reader",
".",
"readline",
"(",
")",
")",
".",
"decode",
"(",
"'latin-1'",
")",
".",
"... | [
178,
0
] | [
214,
60
] | python | en | ['en', 'en', 'en'] | True |
length_handler | (nbytes, input, output) | Async handler for reading a body given a Content-Length header. | Async handler for reading a body given a Content-Length header. | def length_handler(nbytes, input, output):
"""Async handler for reading a body given a Content-Length header."""
while nbytes > 0:
buffer = yield from input.read(min(nbytes, 256*1024))
if not buffer:
logger.error('premature end for content-length')
output.set_exception(EO... | [
"def",
"length_handler",
"(",
"nbytes",
",",
"input",
",",
"output",
")",
":",
"while",
"nbytes",
">",
"0",
":",
"buffer",
"=",
"yield",
"from",
"input",
".",
"read",
"(",
"min",
"(",
"nbytes",
",",
"256",
"*",
"1024",
")",
")",
"if",
"not",
"buffe... | [
218,
0
] | [
228,
21
] | python | en | ['en', 'gl', 'en'] | True |
chunked_handler | (input, output) | Async handler for reading a body using Transfer-Encoding: chunked. | Async handler for reading a body using Transfer-Encoding: chunked. | def chunked_handler(input, output):
"""Async handler for reading a body using Transfer-Encoding: chunked."""
logger.info('parsing chunked response')
nblocks = 0
nbytes = 0
while True:
size_header = yield from input.readline()
if not size_header:
logger.error('premature en... | [
"def",
"chunked_handler",
"(",
"input",
",",
"output",
")",
":",
"logger",
".",
"info",
"(",
"'parsing chunked response'",
")",
"nblocks",
"=",
"0",
"nbytes",
"=",
"0",
"while",
"True",
":",
"size_header",
"=",
"yield",
"from",
"input",
".",
"readline",
"(... | [
232,
0
] | [
258,
21
] | python | en | ['en', 'en', 'en'] | True |
ConnectionPool.close | (self) | Close all connections available for reuse. | Close all connections available for reuse. | def close(self):
"""Close all connections available for reuse."""
for conns in self.connections.values():
for conn in conns:
conn.close()
self.connections.clear()
self.queue.clear() | [
"def",
"close",
"(",
"self",
")",
":",
"for",
"conns",
"in",
"self",
".",
"connections",
".",
"values",
"(",
")",
":",
"for",
"conn",
"in",
"conns",
":",
"conn",
".",
"close",
"(",
")",
"self",
".",
"connections",
".",
"clear",
"(",
")",
"self",
... | [
40,
4
] | [
46,
26
] | python | en | ['en', 'en', 'en'] | True |
ConnectionPool.get_connection | (self, host, port, ssl) | Create or reuse a connection. | Create or reuse a connection. | def get_connection(self, host, port, ssl):
"""Create or reuse a connection."""
port = port or (443 if ssl else 80)
try:
ipaddrs = yield from self.loop.getaddrinfo(host, port)
except Exception as exc:
logger.error('Exception %r for (%r, %r)', exc, host, port)
... | [
"def",
"get_connection",
"(",
"self",
",",
"host",
",",
"port",
",",
"ssl",
")",
":",
"port",
"=",
"port",
"or",
"(",
"443",
"if",
"ssl",
"else",
"80",
")",
"try",
":",
"ipaddrs",
"=",
"yield",
"from",
"self",
".",
"loop",
".",
"getaddrinfo",
"(",
... | [
49,
4
] | [
81,
19
] | python | en | ['en', 'en', 'en'] | True |
ConnectionPool.recycle_connection | (self, conn) | Make a connection available for reuse.
This also prunes the pool if it exceeds the size limits.
| Make a connection available for reuse. | def recycle_connection(self, conn):
"""Make a connection available for reuse.
This also prunes the pool if it exceeds the size limits.
"""
conns = self.connections.setdefault(conn.key, [])
conns.append(conn)
self.queue.append(conn)
if len(conns) > self.max_tasks... | [
"def",
"recycle_connection",
"(",
"self",
",",
"conn",
")",
":",
"conns",
"=",
"self",
".",
"connections",
".",
"setdefault",
"(",
"conn",
".",
"key",
",",
"[",
"]",
")",
"conns",
".",
"append",
"(",
"conn",
")",
"self",
".",
"queue",
".",
"append",
... | [
83,
4
] | [
112,
22
] | python | en | ['en', 'en', 'en'] | True |
Fetcher.fetch | (self) | Attempt to fetch the contents of the URL.
If successful, and the data is HTML, extract further links and
add them to the crawler. Redirects are also added back there.
| Attempt to fetch the contents of the URL. | def fetch(self):
"""Attempt to fetch the contents of the URL.
If successful, and the data is HTML, extract further links and
add them to the crawler. Redirects are also added back there.
"""
while self.tries < self.max_tries:
self.tries += 1
conn = None
... | [
"def",
"fetch",
"(",
"self",
")",
":",
"while",
"self",
".",
"tries",
"<",
"self",
".",
"max_tries",
":",
"self",
".",
"tries",
"+=",
"1",
"conn",
"=",
"None",
"try",
":",
"conn",
"=",
"yield",
"from",
"make_request",
"(",
"self",
".",
"url",
",",
... | [
299,
4
] | [
362,
50
] | python | en | ['en', 'en', 'en'] | True |
Crawler.close | (self) | Close resources (currently only the pool). | Close resources (currently only the pool). | def close(self):
"""Close resources (currently only the pool)."""
self.pool.close() | [
"def",
"close",
"(",
"self",
")",
":",
"self",
".",
"pool",
".",
"close",
"(",
")"
] | [
410,
4
] | [
412,
25
] | python | en | ['en', 'en', 'en'] | True |
Crawler.host_okay | (self, host) | Check if a host should be crawled.
A literal match (after lowercasing) is always good. For hosts
that don't look like IP addresses, some approximate matches
are okay depending on the strict flag.
| Check if a host should be crawled. | def host_okay(self, host):
"""Check if a host should be crawled.
A literal match (after lowercasing) is always good. For hosts
that don't look like IP addresses, some approximate matches
are okay depending on the strict flag.
"""
host = host.lower()
if host in s... | [
"def",
"host_okay",
"(",
"self",
",",
"host",
")",
":",
"host",
"=",
"host",
".",
"lower",
"(",
")",
"if",
"host",
"in",
"self",
".",
"root_domains",
":",
"return",
"True",
"if",
"re",
".",
"match",
"(",
"r'\\A[\\d\\.]*\\Z'",
",",
"host",
")",
":",
... | [
414,
4
] | [
429,
48
] | python | en | ['en', 'en', 'en'] | True |
Crawler._host_okay_strictish | (self, host) | Check if a host should be crawled, strict-ish version.
This checks for equality modulo an initial 'www.' component.
| Check if a host should be crawled, strict-ish version. | def _host_okay_strictish(self, host):
"""Check if a host should be crawled, strict-ish version.
This checks for equality modulo an initial 'www.' component.
"""
host = host[4:] if host.startswith('www.') else 'www.' + host
return host in self.root_domains | [
"def",
"_host_okay_strictish",
"(",
"self",
",",
"host",
")",
":",
"host",
"=",
"host",
"[",
"4",
":",
"]",
"if",
"host",
".",
"startswith",
"(",
"'www.'",
")",
"else",
"'www.'",
"+",
"host",
"return",
"host",
"in",
"self",
".",
"root_domains"
] | [
431,
4
] | [
437,
40
] | python | en | ['en', 'en', 'en'] | True |
Crawler._host_okay_lenient | (self, host) | Check if a host should be crawled, lenient version.
This compares the last two components of the host.
| Check if a host should be crawled, lenient version. | def _host_okay_lenient(self, host):
"""Check if a host should be crawled, lenient version.
This compares the last two components of the host.
"""
return host in self.root_domains | [
"def",
"_host_okay_lenient",
"(",
"self",
",",
"host",
")",
":",
"return",
"host",
"in",
"self",
".",
"root_domains"
] | [
439,
4
] | [
444,
40
] | python | en | ['en', 'en', 'en'] | True |
Crawler.add_url | (self, url, max_redirect=None) | Add a URL to the todo list if not seen before. | Add a URL to the todo list if not seen before. | def add_url(self, url, max_redirect=None):
"""Add a URL to the todo list if not seen before."""
if self.exclude and re.search(self.exclude, url):
return False
parts = urllib.parse.urlparse(url)
if parts.scheme not in ('http', 'https'):
logger.info('skipping non-ht... | [
"def",
"add_url",
"(",
"self",
",",
"url",
",",
"max_redirect",
"=",
"None",
")",
":",
"if",
"self",
".",
"exclude",
"and",
"re",
".",
"search",
"(",
"self",
".",
"exclude",
",",
"url",
")",
":",
"return",
"False",
"parts",
"=",
"urllib",
".",
"par... | [
446,
4
] | [
464,
19
] | python | en | ['en', 'en', 'en'] | True |
Crawler.crawl | (self) | Run the crawler until all finished. | Run the crawler until all finished. | def crawl(self):
"""Run the crawler until all finished."""
with (yield from self.termination):
while self.todo or self.busy:
if self.todo:
url, max_redirect = self.todo.popitem()
fetcher = Fetcher(url,
... | [
"def",
"crawl",
"(",
"self",
")",
":",
"with",
"(",
"yield",
"from",
"self",
".",
"termination",
")",
":",
"while",
"self",
".",
"todo",
"or",
"self",
".",
"busy",
":",
"if",
"self",
".",
"todo",
":",
"url",
",",
"max_redirect",
"=",
"self",
".",
... | [
467,
4
] | [
482,
29
] | python | en | ['en', 'en', 'en'] | True |
Crawler.fetch | (self, fetcher) | Call the Fetcher's fetch(), with a limit on concurrency.
Once this returns, move the fetcher from busy to done.
| Call the Fetcher's fetch(), with a limit on concurrency. | def fetch(self, fetcher):
"""Call the Fetcher's fetch(), with a limit on concurrency.
Once this returns, move the fetcher from busy to done.
"""
url = fetcher.url
with (yield from self.governor):
try:
yield from fetcher.fetch() # Fetcher gonna fetch.... | [
"def",
"fetch",
"(",
"self",
",",
"fetcher",
")",
":",
"url",
"=",
"fetcher",
".",
"url",
"with",
"(",
"yield",
"from",
"self",
".",
"governor",
")",
":",
"try",
":",
"yield",
"from",
"fetcher",
".",
"fetch",
"(",
")",
"# Fetcher gonna fetch.",
"finall... | [
485,
4
] | [
500,
37
] | python | en | ['en', 'en', 'en'] | True |
finalize_featurized_objects | (featurized_objects: np.ndarray,
shift_direction=PositionShift.TO_CENTER_OF_MASS
) | Processes featurized objects returned by simulator.
Args:
shift_direction: Either PositionShift.TO_CENTER_OF_MASS or
PositionShift.FROM_CENTER_OF_MASS representing which direction
to shift position of jar objects. Default is
PositionShift.TO_CENTER_OF_MASS representi... | Processes featurized objects returned by simulator.
Args:
shift_direction: Either PositionShift.TO_CENTER_OF_MASS or
PositionShift.FROM_CENTER_OF_MASS representing which direction
to shift position of jar objects. Default is
PositionShift.TO_CENTER_OF_MASS representi... | def finalize_featurized_objects(featurized_objects: np.ndarray,
shift_direction=PositionShift.TO_CENTER_OF_MASS
) -> np.ndarray:
assert isinstance(shift_direction, PositionShift), shift_direction
"""Processes featurized objects returned by simulator... | [
"def",
"finalize_featurized_objects",
"(",
"featurized_objects",
":",
"np",
".",
"ndarray",
",",
"shift_direction",
"=",
"PositionShift",
".",
"TO_CENTER_OF_MASS",
")",
"->",
"np",
".",
"ndarray",
":",
"assert",
"isinstance",
"(",
"shift_direction",
",",
"PositionSh... | [
44,
0
] | [
87,
29
] | python | en | ['en', 'en', 'en'] | True |
FeaturizedObjects.num_objects | (self) | Number of objects in the scene. | Number of objects in the scene. | def num_objects(self) -> int:
"""Number of objects in the scene."""
return self.features.shape[1] | [
"def",
"num_objects",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"features",
".",
"shape",
"[",
"1",
"]"
] | [
217,
4
] | [
219,
37
] | python | en | ['en', 'en', 'en'] | True |
FeaturizedObjects.num_scene_objects | (self) | Number of scene objects in the scene. | Number of scene objects in the scene. | def num_scene_objects(self) -> int:
"""Number of scene objects in the scene."""
return self.num_objects - self.num_user_inputs | [
"def",
"num_scene_objects",
"(",
"self",
")",
"->",
"int",
":",
"return",
"self",
".",
"num_objects",
"-",
"self",
".",
"num_user_inputs"
] | [
231,
4
] | [
233,
54
] | python | en | ['en', 'en', 'en'] | True |
voice | () | Respond to incoming phone calls and mention the caller's city | Respond to incoming phone calls and mention the caller's city | def voice():
"""Respond to incoming phone calls and mention the caller's city"""
# Get the caller's city from Twilio's request to our app
city = request.values['FromCity']
# Start our TwiML response
resp = VoiceResponse()
# Read a message aloud to the caller
resp.say('Never gonna give you ... | [
"def",
"voice",
"(",
")",
":",
"# Get the caller's city from Twilio's request to our app",
"city",
"=",
"request",
".",
"values",
"[",
"'FromCity'",
"]",
"# Start our TwiML response",
"resp",
"=",
"VoiceResponse",
"(",
")",
"# Read a message aloud to the caller",
"resp",
... | [
7,
0
] | [
21,
20
] | python | en | ['en', 'en', 'en'] | True |
open | (fp, mode="r") |
Load texture from a GD image file.
:param filename: GD file name, or an opened file handle.
:param mode: Optional mode. In this version, if the mode argument
is given, it must be "r".
:returns: An image instance.
:raises OSError: If the image could not be read.
|
Load texture from a GD image file. | def open(fp, mode="r"):
"""
Load texture from a GD image file.
:param filename: GD file name, or an opened file handle.
:param mode: Optional mode. In this version, if the mode argument
is given, it must be "r".
:returns: An image instance.
:raises OSError: If the image could not be re... | [
"def",
"open",
"(",
"fp",
",",
"mode",
"=",
"\"r\"",
")",
":",
"if",
"mode",
"!=",
"\"r\"",
":",
"raise",
"ValueError",
"(",
"\"bad mode\"",
")",
"try",
":",
"return",
"GdImageFile",
"(",
"fp",
")",
"except",
"SyntaxError",
"as",
"e",
":",
"raise",
"... | [
73,
0
] | [
89,
78
] | python | en | ['en', 'error', 'th'] | False |
is_authenticated | (request) | whether or not request user is authenticated or not | whether or not request user is authenticated or not | def is_authenticated(request):
""" whether or not request user is authenticated or not """
return request.user and request.user.is_authenticated | [
"def",
"is_authenticated",
"(",
"request",
")",
":",
"return",
"request",
".",
"user",
"and",
"request",
".",
"user",
".",
"is_authenticated"
] | [
4,
0
] | [
6,
57
] | python | en | ['en', 'en', 'en'] | True |
backoff | (attempts) | Return a backoff delay, in seconds, given a number of attempts.
The delay increases very rapidly with the number of attempts:
1, 2, 4, 8, 16, 32, ... seconds
| Return a backoff delay, in seconds, given a number of attempts. | def backoff(attempts):
"""Return a backoff delay, in seconds, given a number of attempts.
The delay increases very rapidly with the number of attempts:
1, 2, 4, 8, 16, 32, ... seconds
"""
return 2 ** attempts | [
"def",
"backoff",
"(",
"attempts",
")",
":",
"return",
"2",
"**",
"attempts"
] | [
32,
0
] | [
39,
24
] | python | en | ['en', 'en', 'en'] | True |
ChoiceBase.to_list | (cls) | return a list of (name, value) which can be used as choice field in models | return a list of (name, value) which can be used as choice field in models | def to_list(cls):
""" return a list of (name, value) which can be used as choice field in models"""
return [(d.value, d.name) for d in cls] | [
"def",
"to_list",
"(",
"cls",
")",
":",
"return",
"[",
"(",
"d",
".",
"value",
",",
"d",
".",
"name",
")",
"for",
"d",
"in",
"cls",
"]"
] | [
21,
4
] | [
23,
47
] | python | en | ['en', 'en', 'en'] | True |
decoder | (conv_func) |
Convert bytestrings from Python's sqlite3 interface to a regular string.
|
Convert bytestrings from Python's sqlite3 interface to a regular string.
| def decoder(conv_func):
"""
Convert bytestrings from Python's sqlite3 interface to a regular string.
"""
return lambda s: conv_func(s.decode()) | [
"def",
"decoder",
"(",
"conv_func",
")",
":",
"return",
"lambda",
"s",
":",
"conv_func",
"(",
"s",
".",
"decode",
"(",
")",
")"
] | [
37,
0
] | [
41,
42
] | python | en | ['en', 'error', 'th'] | False |
none_guard | (func) |
Decorator that returns None if any of the arguments to the decorated
function are None. Many SQL functions return NULL if any of their arguments
are NULL. This decorator simplifies the implementation of this for the
custom functions registered below.
|
Decorator that returns None if any of the arguments to the decorated
function are None. Many SQL functions return NULL if any of their arguments
are NULL. This decorator simplifies the implementation of this for the
custom functions registered below.
| def none_guard(func):
"""
Decorator that returns None if any of the arguments to the decorated
function are None. Many SQL functions return NULL if any of their arguments
are NULL. This decorator simplifies the implementation of this for the
custom functions registered below.
"""
@functools.... | [
"def",
"none_guard",
"(",
"func",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"func",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"None",
"if",
"None",
"in",
"args",
"else",
"func",
"(",
"*",
"args",
"... | [
44,
0
] | [
54,
18
] | python | en | ['en', 'error', 'th'] | False |
list_aggregate | (function) |
Return an aggregate class that accumulates values in a list and applies
the provided function to the data.
|
Return an aggregate class that accumulates values in a list and applies
the provided function to the data.
| def list_aggregate(function):
"""
Return an aggregate class that accumulates values in a list and applies
the provided function to the data.
"""
return type('ListAggregate', (list,), {'finalize': function, 'step': list.append}) | [
"def",
"list_aggregate",
"(",
"function",
")",
":",
"return",
"type",
"(",
"'ListAggregate'",
",",
"(",
"list",
",",
")",
",",
"{",
"'finalize'",
":",
"function",
",",
"'step'",
":",
"list",
".",
"append",
"}",
")"
] | [
57,
0
] | [
62,
86
] | python | en | ['en', 'error', 'th'] | False |
_sqlite_format_dtdelta | (conn, lhs, rhs) |
LHS and RHS can be either:
- An integer number of microseconds
- A string representing a datetime
|
LHS and RHS can be either:
- An integer number of microseconds
- A string representing a datetime
| def _sqlite_format_dtdelta(conn, lhs, rhs):
"""
LHS and RHS can be either:
- An integer number of microseconds
- A string representing a datetime
"""
try:
real_lhs = datetime.timedelta(0, 0, lhs) if isinstance(lhs, int) else backend_utils.typecast_timestamp(lhs)
real_rhs = dateti... | [
"def",
"_sqlite_format_dtdelta",
"(",
"conn",
",",
"lhs",
",",
"rhs",
")",
":",
"try",
":",
"real_lhs",
"=",
"datetime",
".",
"timedelta",
"(",
"0",
",",
"0",
",",
"lhs",
")",
"if",
"isinstance",
"(",
"lhs",
",",
"int",
")",
"else",
"backend_utils",
... | [
558,
0
] | [
575,
19
] | python | en | ['en', 'error', 'th'] | False |
DatabaseWrapper.check_constraints | (self, table_names=None) |
Check each table name in `table_names` for rows with invalid foreign
key references. This method is intended to be used in conjunction with
`disable_constraint_checking()` and `enable_constraint_checking()`, to
determine if rows with invalid references were entered while constraint
... |
Check each table name in `table_names` for rows with invalid foreign
key references. This method is intended to be used in conjunction with
`disable_constraint_checking()` and `enable_constraint_checking()`, to
determine if rows with invalid references were entered while constraint
... | def check_constraints(self, table_names=None):
"""
Check each table name in `table_names` for rows with invalid foreign
key references. This method is intended to be used in conjunction with
`disable_constraint_checking()` and `enable_constraint_checking()`, to
determine if rows ... | [
"def",
"check_constraints",
"(",
"self",
",",
"table_names",
"=",
"None",
")",
":",
"if",
"self",
".",
"features",
".",
"supports_pragma_foreign_key_check",
":",
"with",
"self",
".",
"cursor",
"(",
")",
"as",
"cursor",
":",
"if",
"table_names",
"is",
"None",... | [
317,
4
] | [
391,
29
] | python | en | ['en', 'error', 'th'] | False |
DatabaseWrapper._start_transaction_under_autocommit | (self) |
Start a transaction explicitly in autocommit mode.
Staying in autocommit mode works around a bug of sqlite3 that breaks
savepoints when autocommit is disabled.
|
Start a transaction explicitly in autocommit mode. | def _start_transaction_under_autocommit(self):
"""
Start a transaction explicitly in autocommit mode.
Staying in autocommit mode works around a bug of sqlite3 that breaks
savepoints when autocommit is disabled.
"""
self.cursor().execute("BEGIN") | [
"def",
"_start_transaction_under_autocommit",
"(",
"self",
")",
":",
"self",
".",
"cursor",
"(",
")",
".",
"execute",
"(",
"\"BEGIN\"",
")"
] | [
396,
4
] | [
403,
38
] | python | en | ['en', 'error', 'th'] | False |
CompletionCommand.run | (self, options: Values, args: List[str]) | Prints the completion code of the given shell | Prints the completion code of the given shell | def run(self, options: Values, args: List[str]) -> int:
"""Prints the completion code of the given shell"""
shells = COMPLETION_SCRIPTS.keys()
shell_options = ['--' + shell for shell in sorted(shells)]
if options.shell in shells:
script = textwrap.dedent(
COMP... | [
"def",
"run",
"(",
"self",
",",
"options",
":",
"Values",
",",
"args",
":",
"List",
"[",
"str",
"]",
")",
"->",
"int",
":",
"shells",
"=",
"COMPLETION_SCRIPTS",
".",
"keys",
"(",
")",
"shell_options",
"=",
"[",
"'--'",
"+",
"shell",
"for",
"shell",
... | [
75,
4
] | [
90,
26
] | python | en | ['en', 'en', 'en'] | True |
is_django_module | (module) | Return True if the given module is nested under Django. | Return True if the given module is nested under Django. | def is_django_module(module):
"""Return True if the given module is nested under Django."""
return module.__name__.startswith('django.') | [
"def",
"is_django_module",
"(",
"module",
")",
":",
"return",
"module",
".",
"__name__",
".",
"startswith",
"(",
"'django.'",
")"
] | [
48,
0
] | [
50,
48
] | python | en | ['en', 'en', 'en'] | True |
is_django_path | (path) | Return True if the given file path is nested under Django. | Return True if the given file path is nested under Django. | def is_django_path(path):
"""Return True if the given file path is nested under Django."""
return Path(django.__file__).parent in Path(path).parents | [
"def",
"is_django_path",
"(",
"path",
")",
":",
"return",
"Path",
"(",
"django",
".",
"__file__",
")",
".",
"parent",
"in",
"Path",
"(",
"path",
")",
".",
"parents"
] | [
53,
0
] | [
55,
61
] | python | en | ['en', 'en', 'en'] | True |
ensure_echo_on | () |
Ensure that echo mode is enabled. Some tools such as PDB disable
it which causes usability issues after reload.
|
Ensure that echo mode is enabled. Some tools such as PDB disable
it which causes usability issues after reload.
| def ensure_echo_on():
"""
Ensure that echo mode is enabled. Some tools such as PDB disable
it which causes usability issues after reload.
"""
if not termios or not sys.stdin.isatty():
return
attr_list = termios.tcgetattr(sys.stdin)
if not attr_list[3] & termios.ECHO:
attr_lis... | [
"def",
"ensure_echo_on",
"(",
")",
":",
"if",
"not",
"termios",
"or",
"not",
"sys",
".",
"stdin",
".",
"isatty",
"(",
")",
":",
"return",
"attr_list",
"=",
"termios",
".",
"tcgetattr",
"(",
"sys",
".",
"stdin",
")",
"if",
"not",
"attr_list",
"[",
"3"... | [
89,
0
] | [
105,
54
] | python | en | ['en', 'error', 'th'] | False |
iter_modules_and_files | (modules, extra_files) | Iterate through all modules needed to be watched. | Iterate through all modules needed to be watched. | def iter_modules_and_files(modules, extra_files):
"""Iterate through all modules needed to be watched."""
sys_file_paths = []
for module in modules:
# During debugging (with PyDev) the 'typing.io' and 'typing.re' objects
# are added to sys.modules, however they are types not modules and so
... | [
"def",
"iter_modules_and_files",
"(",
"modules",
",",
"extra_files",
")",
":",
"sys_file_paths",
"=",
"[",
"]",
"for",
"module",
"in",
"modules",
":",
"# During debugging (with PyDev) the 'typing.io' and 'typing.re' objects",
"# are added to sys.modules, however they are types no... | [
119,
0
] | [
161,
29
] | python | en | ['en', 'en', 'en'] | True |
common_roots | (paths) |
Return a tuple of common roots that are shared between the given paths.
File system watchers operate on directories and aren't cheap to create.
Try to find the minimum set of directories to watch that encompass all of
the files that need to be watched.
|
Return a tuple of common roots that are shared between the given paths.
File system watchers operate on directories and aren't cheap to create.
Try to find the minimum set of directories to watch that encompass all of
the files that need to be watched.
| def common_roots(paths):
"""
Return a tuple of common roots that are shared between the given paths.
File system watchers operate on directories and aren't cheap to create.
Try to find the minimum set of directories to watch that encompass all of
the files that need to be watched.
"""
# Insp... | [
"def",
"common_roots",
"(",
"paths",
")",
":",
"# Inspired from Werkzeug:",
"# https://github.com/pallets/werkzeug/blob/7477be2853df70a022d9613e765581b9411c3c39/werkzeug/_reloader.py",
"# Create a sorted list of the path components, longest first.",
"path_parts",
"=",
"sorted",
"(",
"[",
... | [
165,
0
] | [
192,
33
] | python | en | ['en', 'error', 'th'] | False |
sys_path_directories | () |
Yield absolute directories from sys.path, ignoring entries that don't
exist.
|
Yield absolute directories from sys.path, ignoring entries that don't
exist.
| def sys_path_directories():
"""
Yield absolute directories from sys.path, ignoring entries that don't
exist.
"""
for path in sys.path:
path = Path(path)
if not path.exists():
continue
resolved_path = path.resolve().absolute()
# If the path is a file (like ... | [
"def",
"sys_path_directories",
"(",
")",
":",
"for",
"path",
"in",
"sys",
".",
"path",
":",
"path",
"=",
"Path",
"(",
"path",
")",
"if",
"not",
"path",
".",
"exists",
"(",
")",
":",
"continue",
"resolved_path",
"=",
"path",
".",
"resolve",
"(",
")",
... | [
195,
0
] | [
209,
31
] | python | en | ['en', 'error', 'th'] | False |
get_child_arguments | () |
Return the executable. This contains a workaround for Windows if the
executable is reported to not have the .exe extension which can cause bugs
on reloading.
|
Return the executable. This contains a workaround for Windows if the
executable is reported to not have the .exe extension which can cause bugs
on reloading.
| def get_child_arguments():
"""
Return the executable. This contains a workaround for Windows if the
executable is reported to not have the .exe extension which can cause bugs
on reloading.
"""
import __main__
py_script = Path(sys.argv[0])
args = [sys.executable] + ['-W%s' % o for o in s... | [
"def",
"get_child_arguments",
"(",
")",
":",
"import",
"__main__",
"py_script",
"=",
"Path",
"(",
"sys",
".",
"argv",
"[",
"0",
"]",
")",
"args",
"=",
"[",
"sys",
".",
"executable",
"]",
"+",
"[",
"'-W%s'",
"%",
"o",
"for",
"o",
"in",
"sys",
".",
... | [
212,
0
] | [
246,
15
] | python | en | ['en', 'error', 'th'] | False |
get_reloader | () | Return the most suitable reloader for this environment. | Return the most suitable reloader for this environment. | def get_reloader():
"""Return the most suitable reloader for this environment."""
try:
WatchmanReloader.check_availability()
except WatchmanUnavailable:
return StatReloader()
return WatchmanReloader() | [
"def",
"get_reloader",
"(",
")",
":",
"try",
":",
"WatchmanReloader",
".",
"check_availability",
"(",
")",
"except",
"WatchmanUnavailable",
":",
"return",
"StatReloader",
"(",
")",
"return",
"WatchmanReloader",
"(",
")"
] | [
603,
0
] | [
609,
29
] | python | en | ['en', 'en', 'en'] | True |
BaseReloader.watched_files | (self, include_globs=True) |
Yield all files that need to be watched, including module files and
files within globs.
|
Yield all files that need to be watched, including module files and
files within globs.
| def watched_files(self, include_globs=True):
"""
Yield all files that need to be watched, including module files and
files within globs.
"""
yield from iter_all_python_module_files()
yield from self.extra_files
if include_globs:
for directory, patterns... | [
"def",
"watched_files",
"(",
"self",
",",
"include_globs",
"=",
"True",
")",
":",
"yield",
"from",
"iter_all_python_module_files",
"(",
")",
"yield",
"from",
"self",
".",
"extra_files",
"if",
"include_globs",
":",
"for",
"directory",
",",
"patterns",
"in",
"se... | [
283,
4
] | [
293,
54
] | python | en | ['en', 'error', 'th'] | False |
BaseReloader.wait_for_apps_ready | (self, app_reg, django_main_thread) |
Wait until Django reports that the apps have been loaded. If the given
thread has terminated before the apps are ready, then a SyntaxError or
other non-recoverable error has been raised. In that case, stop waiting
for the apps_ready event and continue processing.
Return True if... |
Wait until Django reports that the apps have been loaded. If the given
thread has terminated before the apps are ready, then a SyntaxError or
other non-recoverable error has been raised. In that case, stop waiting
for the apps_ready event and continue processing. | def wait_for_apps_ready(self, app_reg, django_main_thread):
"""
Wait until Django reports that the apps have been loaded. If the given
thread has terminated before the apps are ready, then a SyntaxError or
other non-recoverable error has been raised. In that case, stop waiting
fo... | [
"def",
"wait_for_apps_ready",
"(",
"self",
",",
"app_reg",
",",
"django_main_thread",
")",
":",
"while",
"django_main_thread",
".",
"is_alive",
"(",
")",
":",
"if",
"app_reg",
".",
"ready_event",
".",
"wait",
"(",
"timeout",
"=",
"0.1",
")",
":",
"return",
... | [
295,
4
] | [
311,
24
] | python | en | ['en', 'error', 'th'] | False |
BaseReloader.tick | (self) |
This generator is called in a loop from run_loop. It's important that
the method takes care of pausing or otherwise waiting for a period of
time. This split between run_loop() and tick() is to improve the
testability of the reloader implementations by decoupling the work they
do... |
This generator is called in a loop from run_loop. It's important that
the method takes care of pausing or otherwise waiting for a period of
time. This split between run_loop() and tick() is to improve the
testability of the reloader implementations by decoupling the work they
do... | def tick(self):
"""
This generator is called in a loop from run_loop. It's important that
the method takes care of pausing or otherwise waiting for a period of
time. This split between run_loop() and tick() is to improve the
testability of the reloader implementations by decoupli... | [
"def",
"tick",
"(",
"self",
")",
":",
"raise",
"NotImplementedError",
"(",
"'subclasses must implement tick().'",
")"
] | [
339,
4
] | [
347,
70
] | python | en | ['en', 'error', 'th'] | False |
WatchmanReloader._watch_glob | (self, directory, patterns) |
Watch a directory with a specific glob. If the directory doesn't yet
exist, attempt to watch the parent directory and amend the patterns to
include this. It's important this method isn't called more than one per
directory when updating all subscriptions. Subsequent calls will
ov... |
Watch a directory with a specific glob. If the directory doesn't yet
exist, attempt to watch the parent directory and amend the patterns to
include this. It's important this method isn't called more than one per
directory when updating all subscriptions. Subsequent calls will
ov... | def _watch_glob(self, directory, patterns):
"""
Watch a directory with a specific glob. If the directory doesn't yet
exist, attempt to watch the parent directory and amend the patterns to
include this. It's important this method isn't called more than one per
directory when updat... | [
"def",
"_watch_glob",
"(",
"self",
",",
"directory",
",",
"patterns",
")",
":",
"prefix",
"=",
"'glob'",
"if",
"not",
"directory",
".",
"exists",
"(",
")",
":",
"if",
"not",
"directory",
".",
"parent",
".",
"exists",
"(",
")",
":",
"logger",
".",
"wa... | [
480,
4
] | [
501,
77
] | python | en | ['en', 'error', 'th'] | False |
WatchmanReloader.check_server_status | (self, inner_ex=None) | Return True if the server is available. | Return True if the server is available. | def check_server_status(self, inner_ex=None):
"""Return True if the server is available."""
try:
self.client.query('version')
except Exception:
raise WatchmanUnavailable(str(inner_ex)) from inner_ex
return True | [
"def",
"check_server_status",
"(",
"self",
",",
"inner_ex",
"=",
"None",
")",
":",
"try",
":",
"self",
".",
"client",
".",
"query",
"(",
"'version'",
")",
"except",
"Exception",
":",
"raise",
"WatchmanUnavailable",
"(",
"str",
"(",
"inner_ex",
")",
")",
... | [
577,
4
] | [
583,
19
] | python | en | ['en', 'en', 'en'] | True |
create_report | (BUCKET, gcsfilename, tmpdir) |
Creates report in gs://BUCKET/ based on contents in gcsfilename (gs://bucket/some/dir/filename)
|
Creates report in gs://BUCKET/ based on contents in gcsfilename (gs://bucket/some/dir/filename)
| def create_report(BUCKET, gcsfilename, tmpdir):
"""
Creates report in gs://BUCKET/ based on contents in gcsfilename (gs://bucket/some/dir/filename)
"""
# connect to BigQuery
client = bigquery.Client()
destination_table = client.get_table('sparktobq.kdd_cup')
# Specify table schema. Auto... | [
"def",
"create_report",
"(",
"BUCKET",
",",
"gcsfilename",
",",
"tmpdir",
")",
":",
"# connect to BigQuery",
"client",
"=",
"bigquery",
".",
"Client",
"(",
")",
"destination_table",
"=",
"client",
".",
"get_table",
"(",
"'sparktobq.kdd_cup'",
")",
"# Specify table... | [
6,
0
] | [
85,
74
] | python | en | ['en', 'error', 'th'] | False |
guess_content_type | (filename, default="application/octet-stream") |
Guess the "Content-Type" of a file.
:param filename:
The filename to guess the "Content-Type" of using :mod:`mimetypes`.
:param default:
If no "Content-Type" can be guessed, default to `default`.
|
Guess the "Content-Type" of a file. | def guess_content_type(filename, default="application/octet-stream"):
"""
Guess the "Content-Type" of a file.
:param filename:
The filename to guess the "Content-Type" of using :mod:`mimetypes`.
:param default:
If no "Content-Type" can be guessed, default to `default`.
"""
if fi... | [
"def",
"guess_content_type",
"(",
"filename",
",",
"default",
"=",
"\"application/octet-stream\"",
")",
":",
"if",
"filename",
":",
"return",
"mimetypes",
".",
"guess_type",
"(",
"filename",
")",
"[",
"0",
"]",
"or",
"default",
"return",
"default"
] | [
9,
0
] | [
20,
18
] | python | en | ['en', 'error', 'th'] | False |
format_header_param_rfc2231 | (name, value) |
Helper function to format and quote a single header parameter using the
strategy defined in RFC 2231.
Particularly useful for header parameters which might contain
non-ASCII values, like file names. This follows
`RFC 2388 Section 4.4 <https://tools.ietf.org/html/rfc2388#section-4.4>`_.
:param... |
Helper function to format and quote a single header parameter using the
strategy defined in RFC 2231. | def format_header_param_rfc2231(name, value):
"""
Helper function to format and quote a single header parameter using the
strategy defined in RFC 2231.
Particularly useful for header parameters which might contain
non-ASCII values, like file names. This follows
`RFC 2388 Section 4.4 <https://to... | [
"def",
"format_header_param_rfc2231",
"(",
"name",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"six",
".",
"binary_type",
")",
":",
"value",
"=",
"value",
".",
"decode",
"(",
"\"utf-8\"",
")",
"if",
"not",
"any",
"(",
"ch",
"in",
"va... | [
23,
0
] | [
62,
16
] | python | en | ['en', 'error', 'th'] | False |
format_header_param_html5 | (name, value) |
Helper function to format and quote a single header parameter using the
HTML5 strategy.
Particularly useful for header parameters which might contain
non-ASCII values, like file names. This follows the `HTML5 Working Draft
Section 4.10.22.7`_ and matches the behavior of curl and modern browsers.
... |
Helper function to format and quote a single header parameter using the
HTML5 strategy. | def format_header_param_html5(name, value):
"""
Helper function to format and quote a single header parameter using the
HTML5 strategy.
Particularly useful for header parameters which might contain
non-ASCII values, like file names. This follows the `HTML5 Working Draft
Section 4.10.22.7`_ and ... | [
"def",
"format_header_param_html5",
"(",
"name",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"six",
".",
"binary_type",
")",
":",
"value",
"=",
"value",
".",
"decode",
"(",
"\"utf-8\"",
")",
"value",
"=",
"_replace_multiple",
"(",
"value... | [
94,
0
] | [
118,
37
] | python | en | ['en', 'error', 'th'] | False |
RequestField.from_tuples | (cls, fieldname, value, header_formatter=format_header_param_html5) |
A :class:`~urllib3.fields.RequestField` factory from old-style tuple parameters.
Supports constructing :class:`~urllib3.fields.RequestField` from
parameter of key/value strings AND key/filetuple. A filetuple is a
(filename, data, MIME type) tuple where the MIME type is optional.
... |
A :class:`~urllib3.fields.RequestField` factory from old-style tuple parameters. | def from_tuples(cls, fieldname, value, header_formatter=format_header_param_html5):
"""
A :class:`~urllib3.fields.RequestField` factory from old-style tuple parameters.
Supports constructing :class:`~urllib3.fields.RequestField` from
parameter of key/value strings AND key/filetuple. A f... | [
"def",
"from_tuples",
"(",
"cls",
",",
"fieldname",
",",
"value",
",",
"header_formatter",
"=",
"format_header_param_html5",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"tuple",
")",
":",
"if",
"len",
"(",
"value",
")",
"==",
"3",
":",
"filename",
"... | [
159,
4
] | [
192,
28
] | python | en | ['en', 'error', 'th'] | False |
RequestField._render_part | (self, name, value) |
Overridable helper function to format a single header parameter. By
default, this calls ``self.header_formatter``.
:param name:
The name of the parameter, a string expected to be ASCII only.
:param value:
The value of the parameter, provided as a unicode string.... |
Overridable helper function to format a single header parameter. By
default, this calls ``self.header_formatter``. | def _render_part(self, name, value):
"""
Overridable helper function to format a single header parameter. By
default, this calls ``self.header_formatter``.
:param name:
The name of the parameter, a string expected to be ASCII only.
:param value:
The value... | [
"def",
"_render_part",
"(",
"self",
",",
"name",
",",
"value",
")",
":",
"return",
"self",
".",
"header_formatter",
"(",
"name",
",",
"value",
")"
] | [
194,
4
] | [
205,
49
] | python | en | ['en', 'error', 'th'] | False |
RequestField._render_parts | (self, header_parts) |
Helper function to format and quote a single header.
Useful for single headers that are composed of multiple items. E.g.,
'Content-Disposition' fields.
:param header_parts:
A sequence of (k, v) tuples or a :class:`dict` of (k, v) to format
as `k1="v1"; k2="v2";... |
Helper function to format and quote a single header. | def _render_parts(self, header_parts):
"""
Helper function to format and quote a single header.
Useful for single headers that are composed of multiple items. E.g.,
'Content-Disposition' fields.
:param header_parts:
A sequence of (k, v) tuples or a :class:`dict` of ... | [
"def",
"_render_parts",
"(",
"self",
",",
"header_parts",
")",
":",
"parts",
"=",
"[",
"]",
"iterable",
"=",
"header_parts",
"if",
"isinstance",
"(",
"header_parts",
",",
"dict",
")",
":",
"iterable",
"=",
"header_parts",
".",
"items",
"(",
")",
"for",
"... | [
207,
4
] | [
227,
32
] | python | en | ['en', 'error', 'th'] | False |
RequestField.render_headers | (self) |
Renders the headers for this request field.
|
Renders the headers for this request field.
| def render_headers(self):
"""
Renders the headers for this request field.
"""
lines = []
sort_keys = ["Content-Disposition", "Content-Type", "Content-Location"]
for sort_key in sort_keys:
if self.headers.get(sort_key, False):
lines.append(u"%s... | [
"def",
"render_headers",
"(",
"self",
")",
":",
"lines",
"=",
"[",
"]",
"sort_keys",
"=",
"[",
"\"Content-Disposition\"",
",",
"\"Content-Type\"",
",",
"\"Content-Location\"",
"]",
"for",
"sort_key",
"in",
"sort_keys",
":",
"if",
"self",
".",
"headers",
".",
... | [
229,
4
] | [
246,
34
] | python | en | ['en', 'error', 'th'] | False |
RequestField.make_multipart | (
self, content_disposition=None, content_type=None, content_location=None
) |
Makes this request field into a multipart request field.
This method overrides "Content-Disposition", "Content-Type" and
"Content-Location" headers to the request parameter.
:param content_type:
The 'Content-Type' of the request body.
:param content_location:
... |
Makes this request field into a multipart request field. | def make_multipart(
self, content_disposition=None, content_type=None, content_location=None
):
"""
Makes this request field into a multipart request field.
This method overrides "Content-Disposition", "Content-Type" and
"Content-Location" headers to the request parameter.
... | [
"def",
"make_multipart",
"(",
"self",
",",
"content_disposition",
"=",
"None",
",",
"content_type",
"=",
"None",
",",
"content_location",
"=",
"None",
")",
":",
"self",
".",
"headers",
"[",
"\"Content-Disposition\"",
"]",
"=",
"content_disposition",
"or",
"u\"fo... | [
248,
4
] | [
273,
59
] | python | en | ['en', 'error', 'th'] | False |
AbstractConnectionPool.__init__ | (self, minconn, maxconn, *args, **kwargs) | Initialize the connection pool.
New 'minconn' connections are created immediately calling 'connfunc'
with given parameters. The connection pool will support a maximum of
about 'maxconn' connections.
| Initialize the connection pool. | def __init__(self, minconn, maxconn, *args, **kwargs):
"""Initialize the connection pool.
New 'minconn' connections are created immediately calling 'connfunc'
with given parameters. The connection pool will support a maximum of
about 'maxconn' connections.
"""
self.minco... | [
"def",
"__init__",
"(",
"self",
",",
"minconn",
",",
"maxconn",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"minconn",
"=",
"int",
"(",
"minconn",
")",
"self",
".",
"maxconn",
"=",
"int",
"(",
"maxconn",
")",
"self",
".",
"c... | [
38,
4
] | [
58,
27
] | python | en | ['en', 'en', 'en'] | True |
AbstractConnectionPool._connect | (self, key=None) | Create a new connection and assign it to 'key' if not None. | Create a new connection and assign it to 'key' if not None. | def _connect(self, key=None):
"""Create a new connection and assign it to 'key' if not None."""
conn = psycopg2.connect(*self._args, **self._kwargs)
if key is not None:
self._used[key] = conn
self._rused[id(conn)] = key
else:
self._pool.append(conn)
... | [
"def",
"_connect",
"(",
"self",
",",
"key",
"=",
"None",
")",
":",
"conn",
"=",
"psycopg2",
".",
"connect",
"(",
"*",
"self",
".",
"_args",
",",
"*",
"*",
"self",
".",
"_kwargs",
")",
"if",
"key",
"is",
"not",
"None",
":",
"self",
".",
"_used",
... | [
60,
4
] | [
68,
19
] | python | en | ['en', 'en', 'en'] | True |
AbstractConnectionPool._getkey | (self) | Return a new unique key. | Return a new unique key. | def _getkey(self):
"""Return a new unique key."""
self._keys += 1
return self._keys | [
"def",
"_getkey",
"(",
"self",
")",
":",
"self",
".",
"_keys",
"+=",
"1",
"return",
"self",
".",
"_keys"
] | [
70,
4
] | [
73,
25
] | python | ca | ['fr', 'ca', 'en'] | False |
AbstractConnectionPool._getconn | (self, key=None) | Get a free connection and assign it to 'key' if not None. | Get a free connection and assign it to 'key' if not None. | def _getconn(self, key=None):
"""Get a free connection and assign it to 'key' if not None."""
if self.closed:
raise PoolError("connection pool is closed")
if key is None:
key = self._getkey()
if key in self._used:
return self._used[key]
if se... | [
"def",
"_getconn",
"(",
"self",
",",
"key",
"=",
"None",
")",
":",
"if",
"self",
".",
"closed",
":",
"raise",
"PoolError",
"(",
"\"connection pool is closed\"",
")",
"if",
"key",
"is",
"None",
":",
"key",
"=",
"self",
".",
"_getkey",
"(",
")",
"if",
... | [
75,
4
] | [
92,
37
] | python | en | ['en', 'en', 'en'] | True |
AbstractConnectionPool._putconn | (self, conn, key=None, close=False) | Put away a connection. | Put away a connection. | def _putconn(self, conn, key=None, close=False):
"""Put away a connection."""
if self.closed:
raise PoolError("connection pool is closed")
if key is None:
key = self._rused.get(id(conn))
if key is None:
raise PoolError("trying to put unkeyed c... | [
"def",
"_putconn",
"(",
"self",
",",
"conn",
",",
"key",
"=",
"None",
",",
"close",
"=",
"False",
")",
":",
"if",
"self",
".",
"closed",
":",
"raise",
"PoolError",
"(",
"\"connection pool is closed\"",
")",
"if",
"key",
"is",
"None",
":",
"key",
"=",
... | [
94,
4
] | [
127,
37
] | python | en | ['en', 'en', 'en'] | True |
AbstractConnectionPool._closeall | (self) | Close all connections.
Note that this can lead to some code fail badly when trying to use
an already closed connection. If you call .closeall() make sure
your code can deal with it.
| Close all connections. | def _closeall(self):
"""Close all connections.
Note that this can lead to some code fail badly when trying to use
an already closed connection. If you call .closeall() make sure
your code can deal with it.
"""
if self.closed:
raise PoolError("connection pool ... | [
"def",
"_closeall",
"(",
"self",
")",
":",
"if",
"self",
".",
"closed",
":",
"raise",
"PoolError",
"(",
"\"connection pool is closed\"",
")",
"for",
"conn",
"in",
"self",
".",
"_pool",
"+",
"list",
"(",
"self",
".",
"_used",
".",
"values",
"(",
")",
")... | [
129,
4
] | [
143,
26
] | python | en | ['en', 'en', 'en'] | True |
ThreadedConnectionPool.__init__ | (self, minconn, maxconn, *args, **kwargs) | Initialize the threading lock. | Initialize the threading lock. | def __init__(self, minconn, maxconn, *args, **kwargs):
"""Initialize the threading lock."""
import threading
AbstractConnectionPool.__init__(
self, minconn, maxconn, *args, **kwargs)
self._lock = threading.Lock() | [
"def",
"__init__",
"(",
"self",
",",
"minconn",
",",
"maxconn",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"import",
"threading",
"AbstractConnectionPool",
".",
"__init__",
"(",
"self",
",",
"minconn",
",",
"maxconn",
",",
"*",
"args",
",",
"... | [
157,
4
] | [
162,
37
] | python | en | ['en', 'en', 'en'] | True |
ThreadedConnectionPool.getconn | (self, key=None) | Get a free connection and assign it to 'key' if not None. | Get a free connection and assign it to 'key' if not None. | def getconn(self, key=None):
"""Get a free connection and assign it to 'key' if not None."""
self._lock.acquire()
try:
return self._getconn(key)
finally:
self._lock.release() | [
"def",
"getconn",
"(",
"self",
",",
"key",
"=",
"None",
")",
":",
"self",
".",
"_lock",
".",
"acquire",
"(",
")",
"try",
":",
"return",
"self",
".",
"_getconn",
"(",
"key",
")",
"finally",
":",
"self",
".",
"_lock",
".",
"release",
"(",
")"
] | [
164,
4
] | [
170,
32
] | python | en | ['en', 'en', 'en'] | True |
ThreadedConnectionPool.putconn | (self, conn=None, key=None, close=False) | Put away an unused connection. | Put away an unused connection. | def putconn(self, conn=None, key=None, close=False):
"""Put away an unused connection."""
self._lock.acquire()
try:
self._putconn(conn, key, close)
finally:
self._lock.release() | [
"def",
"putconn",
"(",
"self",
",",
"conn",
"=",
"None",
",",
"key",
"=",
"None",
",",
"close",
"=",
"False",
")",
":",
"self",
".",
"_lock",
".",
"acquire",
"(",
")",
"try",
":",
"self",
".",
"_putconn",
"(",
"conn",
",",
"key",
",",
"close",
... | [
172,
4
] | [
178,
32
] | python | en | ['en', 'en', 'en'] | True |
ThreadedConnectionPool.closeall | (self) | Close all connections (even the one currently in use.) | Close all connections (even the one currently in use.) | def closeall(self):
"""Close all connections (even the one currently in use.)"""
self._lock.acquire()
try:
self._closeall()
finally:
self._lock.release() | [
"def",
"closeall",
"(",
"self",
")",
":",
"self",
".",
"_lock",
".",
"acquire",
"(",
")",
"try",
":",
"self",
".",
"_closeall",
"(",
")",
"finally",
":",
"self",
".",
"_lock",
".",
"release",
"(",
")"
] | [
180,
4
] | [
186,
32
] | python | en | ['en', 'en', 'en'] | True |
sub_accounts | (enabled=None, ids=None, prefix=None, **options) |
List all sub accounts
:param enabled: Whether to only return enabled sub-accounts (true) or disabled accounts (false).
Default: all accounts are returned (both enabled and disabled).
:type enabled: bool, optional
:param ids: List of sub-account IDs. Up to 100. W... |
List all sub accounts
:param enabled: Whether to only return enabled sub-accounts (true) or disabled accounts (false).
Default: all accounts are returned (both enabled and disabled).
:type enabled: bool, optional
:param ids: List of sub-account IDs. Up to 100. W... | def sub_accounts(enabled=None, ids=None, prefix=None, **options):
"""
List all sub accounts
:param enabled: Whether to only return enabled sub-accounts (true) or disabled accounts (false).
Default: all accounts are returned (both enabled and disabled).
:type enabled: boo... | [
"def",
"sub_accounts",
"(",
"enabled",
"=",
"None",
",",
"ids",
"=",
"None",
",",
"prefix",
"=",
"None",
",",
"*",
"*",
"options",
")",
":",
"uri",
"=",
"[",
"SUB_ACCOUNTS_SUB_PATH",
"]",
"params",
"=",
"{",
"\"ids\"",
":",
"ids",
",",
"\"enabled\"",
... | [
22,
0
] | [
39,
66
] | python | en | ['en', 'error', 'th'] | False |
create_sub_account | (name, cloud_name=None, custom_attributes=None, enabled=None,
base_account=None, **options) |
Create a new sub account
:param name: Name of the new sub account
:type name: str
:param cloud_name: A case-insensitive cloud name comprised of alphanumeric and underscore characters.
* Generates an error if the cloud name is not u... |
Create a new sub account
:param name: Name of the new sub account
:type name: str
:param cloud_name: A case-insensitive cloud name comprised of alphanumeric and underscore characters.
* Generates an error if the cloud name is not u... | def create_sub_account(name, cloud_name=None, custom_attributes=None, enabled=None,
base_account=None, **options):
"""
Create a new sub account
:param name: Name of the new sub account
:type name: str
:param cloud_name: A case-insensitiv... | [
"def",
"create_sub_account",
"(",
"name",
",",
"cloud_name",
"=",
"None",
",",
"custom_attributes",
"=",
"None",
",",
"enabled",
"=",
"None",
",",
"base_account",
"=",
"None",
",",
"*",
"*",
"options",
")",
":",
"uri",
"=",
"[",
"SUB_ACCOUNTS_SUB_PATH",
"]... | [
42,
0
] | [
68,
67
] | python | en | ['en', 'error', 'th'] | False |
delete_sub_account | (sub_account_id, **options) |
Delete a sub account
:param sub_account_id: The id of the sub account
:type sub_account_id: str
:param options: Generic advanced options dict, see online documentation
:type options: dict, optional
:return: Result message
:rtype: ... |
Delete a sub account
:param sub_account_id: The id of the sub account
:type sub_account_id: str
:param options: Generic advanced options dict, see online documentation
:type options: dict, optional
:return: Result message
:rtype: ... | def delete_sub_account(sub_account_id, **options):
"""
Delete a sub account
:param sub_account_id: The id of the sub account
:type sub_account_id: str
:param options: Generic advanced options dict, see online documentation
:type options: dict, optional
:re... | [
"def",
"delete_sub_account",
"(",
"sub_account_id",
",",
"*",
"*",
"options",
")",
":",
"uri",
"=",
"[",
"SUB_ACCOUNTS_SUB_PATH",
",",
"sub_account_id",
"]",
"return",
"_call_account_api",
"(",
"\"delete\"",
",",
"uri",
",",
"{",
"}",
",",
"*",
"*",
"options... | [
71,
0
] | [
82,
58
] | python | en | ['en', 'error', 'th'] | False |
sub_account | (sub_account_id, **options) |
Get information of a sub account
:param sub_account_id: The id of the sub account
:type sub_account_id: str
:param options: Generic advanced options dict, see online documentation
:type options: dict, optional
:return: A sub account
:rt... |
Get information of a sub account
:param sub_account_id: The id of the sub account
:type sub_account_id: str
:param options: Generic advanced options dict, see online documentation
:type options: dict, optional
:return: A sub account
:rt... | def sub_account(sub_account_id, **options):
"""
Get information of a sub account
:param sub_account_id: The id of the sub account
:type sub_account_id: str
:param options: Generic advanced options dict, see online documentation
:type options: dict, optional
... | [
"def",
"sub_account",
"(",
"sub_account_id",
",",
"*",
"*",
"options",
")",
":",
"uri",
"=",
"[",
"SUB_ACCOUNTS_SUB_PATH",
",",
"sub_account_id",
"]",
"return",
"_call_account_api",
"(",
"\"get\"",
",",
"uri",
",",
"{",
"}",
",",
"*",
"*",
"options",
")"
] | [
85,
0
] | [
96,
55
] | python | en | ['en', 'error', 'th'] | False |
update_sub_account | (sub_account_id, name=None, cloud_name=None, custom_attributes=None,
enabled=None, base_account=None,
**options) |
Update a sub account
:param sub_account_id: The id of the sub account
:type sub_account_id: str
:param name: Name of the account
:type name: str, optional
:param cloud_name: Unique cloud name
:type cloud_name: str, optional
:p... |
Update a sub account
:param sub_account_id: The id of the sub account
:type sub_account_id: str
:param name: Name of the account
:type name: str, optional
:param cloud_name: Unique cloud name
:type cloud_name: str, optional
:p... | def update_sub_account(sub_account_id, name=None, cloud_name=None, custom_attributes=None,
enabled=None, base_account=None,
**options):
"""
Update a sub account
:param sub_account_id: The id of the sub account
:type sub_account_id: str
:param ... | [
"def",
"update_sub_account",
"(",
"sub_account_id",
",",
"name",
"=",
"None",
",",
"cloud_name",
"=",
"None",
",",
"custom_attributes",
"=",
"None",
",",
"enabled",
"=",
"None",
",",
"base_account",
"=",
"None",
",",
"*",
"*",
"options",
")",
":",
"uri",
... | [
99,
0
] | [
127,
66
] | python | en | ['en', 'error', 'th'] | False |
users | (user_ids=None, sub_account_id=None, pending=None, prefix=None, **options) |
List all users
:param user_ids: The ids of the users to fetch
:type user_ids: list, optional
:param sub_account_id: The id of a sub account
:type sub_account_id: str, optional
:param pending: Limit results to pending users (True),
users that... |
List all users
:param user_ids: The ids of the users to fetch
:type user_ids: list, optional
:param sub_account_id: The id of a sub account
:type sub_account_id: str, optional
:param pending: Limit results to pending users (True),
users that... | def users(user_ids=None, sub_account_id=None, pending=None, prefix=None, **options):
"""
List all users
:param user_ids: The ids of the users to fetch
:type user_ids: list, optional
:param sub_account_id: The id of a sub account
:type sub_account_id: str, optional
:param pe... | [
"def",
"users",
"(",
"user_ids",
"=",
"None",
",",
"sub_account_id",
"=",
"None",
",",
"pending",
"=",
"None",
",",
"prefix",
"=",
"None",
",",
"*",
"*",
"options",
")",
":",
"uri",
"=",
"[",
"USERS_SUB_PATH",
"]",
"user_ids",
"=",
"encode_list",
"(",
... | [
130,
0
] | [
154,
66
] | python | en | ['en', 'error', 'th'] | False |
create_user | (name, email, role, sub_account_ids=None, **options) |
Create a user
:param name: Username
:type name: str
:param email: User's email
:type email: str
:param role: User's role
:type role: str
:param sub_account_ids: Optional. Sub accounts to assoc... |
Create a user
:param name: Username
:type name: str
:param email: User's email
:type email: str
:param role: User's role
:type role: str
:param sub_account_ids: Optional. Sub accounts to assoc... | def create_user(name, email, role, sub_account_ids=None, **options):
"""
Create a user
:param name: Username
:type name: str
:param email: User's email
:type email: str
:param role: User's role
:type role: ... | [
"def",
"create_user",
"(",
"name",
",",
"email",
",",
"role",
",",
"sub_account_ids",
"=",
"None",
",",
"*",
"*",
"options",
")",
":",
"uri",
"=",
"[",
"USERS_SUB_PATH",
"]",
"params",
"=",
"{",
"\"name\"",
":",
"name",
",",
"\"email\"",
":",
"email",
... | [
157,
0
] | [
178,
67
] | python | en | ['en', 'error', 'th'] | False |
delete_user | (user_id, **options) |
Delete a user
:param user_id: The id of user to delete
:type user_id: str
:param options: Generic advanced options dict, see online documentation.
:type options: dict, optional
:return: Result message
:rtype: ... |
Delete a user
:param user_id: The id of user to delete
:type user_id: str
:param options: Generic advanced options dict, see online documentation.
:type options: dict, optional
:return: Result message
:rtype: ... | def delete_user(user_id, **options):
"""
Delete a user
:param user_id: The id of user to delete
:type user_id: str
:param options: Generic advanced options dict, see online documentation.
:type options: dict, optional
:return: ... | [
"def",
"delete_user",
"(",
"user_id",
",",
"*",
"*",
"options",
")",
":",
"uri",
"=",
"[",
"USERS_SUB_PATH",
",",
"user_id",
"]",
"return",
"_call_account_api",
"(",
"\"delete\"",
",",
"uri",
",",
"{",
"}",
",",
"*",
"*",
"options",
")"
] | [
181,
0
] | [
192,
58
] | python | en | ['en', 'error', 'th'] | False |
user | (user_id, **options) |
Get information of a user
:param user_id: The id of the user
:type user_id: str
:param options: Generic advanced options dict, see online documentation.
:type options: dict, optional
:return: A user
:rtype: ... |
Get information of a user
:param user_id: The id of the user
:type user_id: str
:param options: Generic advanced options dict, see online documentation.
:type options: dict, optional
:return: A user
:rtype: ... | def user(user_id, **options):
"""
Get information of a user
:param user_id: The id of the user
:type user_id: str
:param options: Generic advanced options dict, see online documentation.
:type options: dict, optional
:return: ... | [
"def",
"user",
"(",
"user_id",
",",
"*",
"*",
"options",
")",
":",
"uri",
"=",
"[",
"USERS_SUB_PATH",
",",
"user_id",
"]",
"return",
"_call_account_api",
"(",
"\"get\"",
",",
"uri",
",",
"{",
"}",
",",
"*",
"*",
"options",
")"
] | [
195,
0
] | [
206,
55
] | python | en | ['en', 'error', 'th'] | False |
update_user | (user_id, name=None, email=None, role=None, sub_account_ids=None, **options) |
Update a user
:param user_id: The id of the user to update
:type user_id: str
:param name: Username
:type name: str, optional
:param email: User's email
:type email: str, optional
:param role: ... |
Update a user
:param user_id: The id of the user to update
:type user_id: str
:param name: Username
:type name: str, optional
:param email: User's email
:type email: str, optional
:param role: ... | def update_user(user_id, name=None, email=None, role=None, sub_account_ids=None, **options):
"""
Update a user
:param user_id: The id of the user to update
:type user_id: str
:param name: Username
:type name: str, optional
:param email:... | [
"def",
"update_user",
"(",
"user_id",
",",
"name",
"=",
"None",
",",
"email",
"=",
"None",
",",
"role",
"=",
"None",
",",
"sub_account_ids",
"=",
"None",
",",
"*",
"*",
"options",
")",
":",
"uri",
"=",
"[",
"USERS_SUB_PATH",
",",
"user_id",
"]",
"par... | [
209,
0
] | [
233,
66
] | python | en | ['en', 'error', 'th'] | False |
user_groups | (**options) |
List all user groups
:param options: Generic advanced options dict, see online documentation
:type options: dict, optional
:return: List of user groups
:rtype: ProvisioningAPIRespose
|
List all user groups
:param options: Generic advanced options dict, see online documentation
:type options: dict, optional
:return: List of user groups
:rtype: ProvisioningAPIRespose
| def user_groups(**options):
"""
List all user groups
:param options: Generic advanced options dict, see online documentation
:type options: dict, optional
:return: List of user groups
:rtype: ProvisioningAPIRespose
"""
uri = [USER_GROUPS_SU... | [
"def",
"user_groups",
"(",
"*",
"*",
"options",
")",
":",
"uri",
"=",
"[",
"USER_GROUPS_SUB_PATH",
"]",
"return",
"_call_account_api",
"(",
"\"get\"",
",",
"uri",
",",
"{",
"}",
",",
"*",
"*",
"options",
")"
] | [
236,
0
] | [
245,
55
] | python | en | ['en', 'error', 'th'] | False |
create_user_group | (name, **options) |
Create a new user group
:param name: Name of the user group
:type name: str
:param options: Generic advanced options dict, see online documentation
:type options: dict, optional
:return: The newly created group
:rtype: d... |
Create a new user group
:param name: Name of the user group
:type name: str
:param options: Generic advanced options dict, see online documentation
:type options: dict, optional
:return: The newly created group
:rtype: d... | def create_user_group(name, **options):
"""
Create a new user group
:param name: Name of the user group
:type name: str
:param options: Generic advanced options dict, see online documentation
:type options: dict, optional
:return: The ne... | [
"def",
"create_user_group",
"(",
"name",
",",
"*",
"*",
"options",
")",
":",
"uri",
"=",
"[",
"USER_GROUPS_SUB_PATH",
"]",
"params",
"=",
"{",
"\"name\"",
":",
"name",
"}",
"return",
"_call_account_api",
"(",
"\"post\"",
",",
"uri",
",",
"params",
",",
"... | [
248,
0
] | [
260,
60
] | python | en | ['en', 'error', 'th'] | False |
update_user_group | (user_group_id, name, **options) |
Update a user group
:param user_group_id: The id of the user group to update
:type user_group_id: str
:param name: Name of the user group
:type name: str, optional
:param options: Generic advanced options dict, see online documentation
... |
Update a user group
:param user_group_id: The id of the user group to update
:type user_group_id: str
:param name: Name of the user group
:type name: str, optional
:param options: Generic advanced options dict, see online documentation
... | def update_user_group(user_group_id, name, **options):
"""
Update a user group
:param user_group_id: The id of the user group to update
:type user_group_id: str
:param name: Name of the user group
:type name: str, optional
:param options: ... | [
"def",
"update_user_group",
"(",
"user_group_id",
",",
"name",
",",
"*",
"*",
"options",
")",
":",
"uri",
"=",
"[",
"USER_GROUPS_SUB_PATH",
",",
"user_group_id",
"]",
"params",
"=",
"{",
"\"name\"",
":",
"name",
"}",
"return",
"_call_account_api",
"(",
"\"pu... | [
263,
0
] | [
277,
59
] | python | en | ['en', 'error', 'th'] | False |
delete_user_group | (user_group_id, **options) |
Delete a user group
:param user_group_id: The id of the user group to delete
:type user_group_id: str
:param options: Generic advanced options dict, see online documentation
:type options: dict, optional
:return: The result message
:r... |
Delete a user group
:param user_group_id: The id of the user group to delete
:type user_group_id: str
:param options: Generic advanced options dict, see online documentation
:type options: dict, optional
:return: The result message
:r... | def delete_user_group(user_group_id, **options):
"""
Delete a user group
:param user_group_id: The id of the user group to delete
:type user_group_id: str
:param options: Generic advanced options dict, see online documentation
:type options: dict, optional
... | [
"def",
"delete_user_group",
"(",
"user_group_id",
",",
"*",
"*",
"options",
")",
":",
"uri",
"=",
"[",
"USER_GROUPS_SUB_PATH",
",",
"user_group_id",
"]",
"return",
"_call_account_api",
"(",
"\"delete\"",
",",
"uri",
",",
"{",
"}",
",",
"*",
"*",
"options",
... | [
280,
0
] | [
291,
58
] | python | en | ['en', 'error', 'th'] | False |
user_group | (user_group_id, **options) |
Get information of a user group
:param user_group_id: The id of the user group
:type user_group_id: str
:param options: Generic advanced options dict, see online documentation
:type options: dict, optional
:return: Details of the group
... |
Get information of a user group
:param user_group_id: The id of the user group
:type user_group_id: str
:param options: Generic advanced options dict, see online documentation
:type options: dict, optional
:return: Details of the group
... | def user_group(user_group_id, **options):
"""
Get information of a user group
:param user_group_id: The id of the user group
:type user_group_id: str
:param options: Generic advanced options dict, see online documentation
:type options: dict, optional
:r... | [
"def",
"user_group",
"(",
"user_group_id",
",",
"*",
"*",
"options",
")",
":",
"uri",
"=",
"[",
"USER_GROUPS_SUB_PATH",
",",
"user_group_id",
"]",
"return",
"_call_account_api",
"(",
"\"get\"",
",",
"uri",
",",
"{",
"}",
",",
"*",
"*",
"options",
")"
] | [
294,
0
] | [
305,
55
] | python | en | ['en', 'error', 'th'] | False |
add_user_to_group | (user_group_id, user_id, **options) |
Add a user to a user group
:param user_group_id: The id of the user group to add the user to
:type user_group_id: str
:param user_id: The user id to add
:type user_id: str
:param options: Generic advanced options dict, see online documentation
... |
Add a user to a user group
:param user_group_id: The id of the user group to add the user to
:type user_group_id: str
:param user_id: The user id to add
:type user_id: str
:param options: Generic advanced options dict, see online documentation
... | def add_user_to_group(user_group_id, user_id, **options):
"""
Add a user to a user group
:param user_group_id: The id of the user group to add the user to
:type user_group_id: str
:param user_id: The user id to add
:type user_id: str
:param options: ... | [
"def",
"add_user_to_group",
"(",
"user_group_id",
",",
"user_id",
",",
"*",
"*",
"options",
")",
":",
"uri",
"=",
"[",
"USER_GROUPS_SUB_PATH",
",",
"user_group_id",
",",
"\"users\"",
",",
"user_id",
"]",
"return",
"_call_account_api",
"(",
"\"post\"",
",",
"ur... | [
308,
0
] | [
321,
56
] | python | en | ['en', 'error', 'th'] | False |
remove_user_from_group | (user_group_id, user_id, **options) |
Remove a user from a user group
:param user_group_id: The id of the user group to remove the user from
:type user_group_id: str
:param user_id: The id of the user to remove
:type user_id: str
:param options: Generic advanced options dict, see on... |
Remove a user from a user group
:param user_group_id: The id of the user group to remove the user from
:type user_group_id: str
:param user_id: The id of the user to remove
:type user_id: str
:param options: Generic advanced options dict, see on... | def remove_user_from_group(user_group_id, user_id, **options):
"""
Remove a user from a user group
:param user_group_id: The id of the user group to remove the user from
:type user_group_id: str
:param user_id: The id of the user to remove
:type user_id: str... | [
"def",
"remove_user_from_group",
"(",
"user_group_id",
",",
"user_id",
",",
"*",
"*",
"options",
")",
":",
"uri",
"=",
"[",
"USER_GROUPS_SUB_PATH",
",",
"user_group_id",
",",
"\"users\"",
",",
"user_id",
"]",
"return",
"_call_account_api",
"(",
"\"delete\"",
","... | [
324,
0
] | [
337,
58
] | python | en | ['en', 'error', 'th'] | False |
user_group_users | (user_group_id, **options) |
Get all users in a user group
:param user_group_id: The id of user group to get list of users
:type user_group_id: str
:param options: Generic advanced options dict, see online documentation
:type options: dict, optional
:return: List of ... |
Get all users in a user group
:param user_group_id: The id of user group to get list of users
:type user_group_id: str
:param options: Generic advanced options dict, see online documentation
:type options: dict, optional
:return: List of ... | def user_group_users(user_group_id, **options):
"""
Get all users in a user group
:param user_group_id: The id of user group to get list of users
:type user_group_id: str
:param options: Generic advanced options dict, see online documentation
:type options: ... | [
"def",
"user_group_users",
"(",
"user_group_id",
",",
"*",
"*",
"options",
")",
":",
"uri",
"=",
"[",
"USER_GROUPS_SUB_PATH",
",",
"user_group_id",
",",
"\"users\"",
"]",
"return",
"_call_account_api",
"(",
"\"get\"",
",",
"uri",
",",
"{",
"}",
",",
"*",
"... | [
340,
0
] | [
351,
55
] | 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.