repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens listlengths 20 707 | docstring stringlengths 3 17.3k | docstring_tokens listlengths 3 222 | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value | idx int64 0 252k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
emilmont/pyStatParser | stat_parser/eval_parser.py | FScore.increment | def increment(self, gold_set, test_set):
"Add examples from sets."
self.gold += len(gold_set)
self.test += len(test_set)
self.correct += len(gold_set & test_set) | python | def increment(self, gold_set, test_set):
"Add examples from sets."
self.gold += len(gold_set)
self.test += len(test_set)
self.correct += len(gold_set & test_set) | [
"def",
"increment",
"(",
"self",
",",
"gold_set",
",",
"test_set",
")",
":",
"self",
".",
"gold",
"+=",
"len",
"(",
"gold_set",
")",
"self",
".",
"test",
"+=",
"len",
"(",
"test_set",
")",
"self",
".",
"correct",
"+=",
"len",
"(",
"gold_set",
"&",
... | Add examples from sets. | [
"Add",
"examples",
"from",
"sets",
"."
] | 0e4990d7c1f0e3a0e0626ea2059ffd9030edf323 | https://github.com/emilmont/pyStatParser/blob/0e4990d7c1f0e3a0e0626ea2059ffd9030edf323/stat_parser/eval_parser.py#L100-L104 | train | 28,100 |
emilmont/pyStatParser | stat_parser/eval_parser.py | FScore.output_row | def output_row(self, name):
"Output a scoring row."
print("%10s %4d %0.3f %0.3f %0.3f"%(
name, self.gold, self.precision(), self.recall(), self.fscore())) | python | def output_row(self, name):
"Output a scoring row."
print("%10s %4d %0.3f %0.3f %0.3f"%(
name, self.gold, self.precision(), self.recall(), self.fscore())) | [
"def",
"output_row",
"(",
"self",
",",
"name",
")",
":",
"print",
"(",
"\"%10s %4d %0.3f %0.3f %0.3f\"",
"%",
"(",
"name",
",",
"self",
".",
"gold",
",",
"self",
".",
"precision",
"(",
")",
",",
"self",
".",
"recall",
"(",
")",
","... | Output a scoring row. | [
"Output",
"a",
"scoring",
"row",
"."
] | 0e4990d7c1f0e3a0e0626ea2059ffd9030edf323 | https://github.com/emilmont/pyStatParser/blob/0e4990d7c1f0e3a0e0626ea2059ffd9030edf323/stat_parser/eval_parser.py#L126-L129 | train | 28,101 |
emilmont/pyStatParser | stat_parser/eval_parser.py | ParseEvaluator.output | def output(self):
"Print out the f-score table."
FScore.output_header()
nts = list(self.nt_score.keys())
nts.sort()
for nt in nts:
self.nt_score[nt].output_row(nt)
print()
self.total_score.output_row("total") | python | def output(self):
"Print out the f-score table."
FScore.output_header()
nts = list(self.nt_score.keys())
nts.sort()
for nt in nts:
self.nt_score[nt].output_row(nt)
print()
self.total_score.output_row("total") | [
"def",
"output",
"(",
"self",
")",
":",
"FScore",
".",
"output_header",
"(",
")",
"nts",
"=",
"list",
"(",
"self",
".",
"nt_score",
".",
"keys",
"(",
")",
")",
"nts",
".",
"sort",
"(",
")",
"for",
"nt",
"in",
"nts",
":",
"self",
".",
"nt_score",
... | Print out the f-score table. | [
"Print",
"out",
"the",
"f",
"-",
"score",
"table",
"."
] | 0e4990d7c1f0e3a0e0626ea2059ffd9030edf323 | https://github.com/emilmont/pyStatParser/blob/0e4990d7c1f0e3a0e0626ea2059ffd9030edf323/stat_parser/eval_parser.py#L169-L177 | train | 28,102 |
garnaat/kappa | kappa/scripts/cli.py | invoke | def invoke(ctx, data_file):
"""Invoke the command synchronously"""
click.echo('invoking')
response = ctx.invoke(data_file.read())
log_data = base64.b64decode(response['LogResult'])
click.echo(log_data)
click.echo('Response:')
click.echo(response['Payload'].read())
click.echo('done') | python | def invoke(ctx, data_file):
"""Invoke the command synchronously"""
click.echo('invoking')
response = ctx.invoke(data_file.read())
log_data = base64.b64decode(response['LogResult'])
click.echo(log_data)
click.echo('Response:')
click.echo(response['Payload'].read())
click.echo('done') | [
"def",
"invoke",
"(",
"ctx",
",",
"data_file",
")",
":",
"click",
".",
"echo",
"(",
"'invoking'",
")",
"response",
"=",
"ctx",
".",
"invoke",
"(",
"data_file",
".",
"read",
"(",
")",
")",
"log_data",
"=",
"base64",
".",
"b64decode",
"(",
"response",
... | Invoke the command synchronously | [
"Invoke",
"the",
"command",
"synchronously"
] | 46709b6b790fead13294c2c18ffa5d63ea5133c7 | https://github.com/garnaat/kappa/blob/46709b6b790fead13294c2c18ffa5d63ea5133c7/kappa/scripts/cli.py#L66-L74 | train | 28,103 |
garnaat/kappa | kappa/scripts/cli.py | tail | def tail(ctx):
"""Show the last 10 lines of the log file"""
click.echo('tailing logs')
for e in ctx.tail()[-10:]:
ts = datetime.utcfromtimestamp(e['timestamp'] // 1000).isoformat()
click.echo("{}: {}".format(ts, e['message']))
click.echo('done') | python | def tail(ctx):
"""Show the last 10 lines of the log file"""
click.echo('tailing logs')
for e in ctx.tail()[-10:]:
ts = datetime.utcfromtimestamp(e['timestamp'] // 1000).isoformat()
click.echo("{}: {}".format(ts, e['message']))
click.echo('done') | [
"def",
"tail",
"(",
"ctx",
")",
":",
"click",
".",
"echo",
"(",
"'tailing logs'",
")",
"for",
"e",
"in",
"ctx",
".",
"tail",
"(",
")",
"[",
"-",
"10",
":",
"]",
":",
"ts",
"=",
"datetime",
".",
"utcfromtimestamp",
"(",
"e",
"[",
"'timestamp'",
"]... | Show the last 10 lines of the log file | [
"Show",
"the",
"last",
"10",
"lines",
"of",
"the",
"log",
"file"
] | 46709b6b790fead13294c2c18ffa5d63ea5133c7 | https://github.com/garnaat/kappa/blob/46709b6b790fead13294c2c18ffa5d63ea5133c7/kappa/scripts/cli.py#L88-L94 | train | 28,104 |
garnaat/kappa | kappa/scripts/cli.py | status | def status(ctx):
"""Print a status of this Lambda function"""
status = ctx.status()
click.echo(click.style('Policy', bold=True))
if status['policy']:
line = ' {} ({})'.format(
status['policy']['PolicyName'],
status['policy']['Arn'])
click.echo(click.style(line,... | python | def status(ctx):
"""Print a status of this Lambda function"""
status = ctx.status()
click.echo(click.style('Policy', bold=True))
if status['policy']:
line = ' {} ({})'.format(
status['policy']['PolicyName'],
status['policy']['Arn'])
click.echo(click.style(line,... | [
"def",
"status",
"(",
"ctx",
")",
":",
"status",
"=",
"ctx",
".",
"status",
"(",
")",
"click",
".",
"echo",
"(",
"click",
".",
"style",
"(",
"'Policy'",
",",
"bold",
"=",
"True",
")",
")",
"if",
"status",
"[",
"'policy'",
"]",
":",
"line",
"=",
... | Print a status of this Lambda function | [
"Print",
"a",
"status",
"of",
"this",
"Lambda",
"function"
] | 46709b6b790fead13294c2c18ffa5d63ea5133c7 | https://github.com/garnaat/kappa/blob/46709b6b790fead13294c2c18ffa5d63ea5133c7/kappa/scripts/cli.py#L99-L131 | train | 28,105 |
garnaat/kappa | kappa/scripts/cli.py | event_sources | def event_sources(ctx, command):
"""List, enable, and disable event sources specified in the config file"""
if command == 'list':
click.echo('listing event sources')
event_sources = ctx.list_event_sources()
for es in event_sources:
click.echo('arn: {}'.format(es['arn']))
... | python | def event_sources(ctx, command):
"""List, enable, and disable event sources specified in the config file"""
if command == 'list':
click.echo('listing event sources')
event_sources = ctx.list_event_sources()
for es in event_sources:
click.echo('arn: {}'.format(es['arn']))
... | [
"def",
"event_sources",
"(",
"ctx",
",",
"command",
")",
":",
"if",
"command",
"==",
"'list'",
":",
"click",
".",
"echo",
"(",
"'listing event sources'",
")",
"event_sources",
"=",
"ctx",
".",
"list_event_sources",
"(",
")",
"for",
"es",
"in",
"event_sources... | List, enable, and disable event sources specified in the config file | [
"List",
"enable",
"and",
"disable",
"event",
"sources",
"specified",
"in",
"the",
"config",
"file"
] | 46709b6b790fead13294c2c18ffa5d63ea5133c7 | https://github.com/garnaat/kappa/blob/46709b6b790fead13294c2c18ffa5d63ea5133c7/kappa/scripts/cli.py#L147-L165 | train | 28,106 |
leonardt/fault | fault/circuit_utils.py | check_interface_is_subset | def check_interface_is_subset(circuit1, circuit2):
"""
Checks that the interface of circuit1 is a subset of circuit2
Subset is defined as circuit2 contains all the ports of circuit1. Ports are
matched by name comparison, then the types are checked to see if one could
be converted to another.
""... | python | def check_interface_is_subset(circuit1, circuit2):
"""
Checks that the interface of circuit1 is a subset of circuit2
Subset is defined as circuit2 contains all the ports of circuit1. Ports are
matched by name comparison, then the types are checked to see if one could
be converted to another.
""... | [
"def",
"check_interface_is_subset",
"(",
"circuit1",
",",
"circuit2",
")",
":",
"circuit1_port_names",
"=",
"circuit1",
".",
"interface",
".",
"ports",
".",
"keys",
"(",
")",
"for",
"name",
"in",
"circuit1_port_names",
":",
"if",
"name",
"not",
"in",
"circuit2... | Checks that the interface of circuit1 is a subset of circuit2
Subset is defined as circuit2 contains all the ports of circuit1. Ports are
matched by name comparison, then the types are checked to see if one could
be converted to another. | [
"Checks",
"that",
"the",
"interface",
"of",
"circuit1",
"is",
"a",
"subset",
"of",
"circuit2"
] | da1b48ab727bd85abc54ae9b52841d08188c0df5 | https://github.com/leonardt/fault/blob/da1b48ab727bd85abc54ae9b52841d08188c0df5/fault/circuit_utils.py#L1-L21 | train | 28,107 |
google/google-visualization-python | gviz_api.py | DataTable.CoerceValue | def CoerceValue(value, value_type):
"""Coerces a single value into the type expected for its column.
Internal helper method.
Args:
value: The value which should be converted
value_type: One of "string", "number", "boolean", "date", "datetime" or
"timeofday".
Returns:
... | python | def CoerceValue(value, value_type):
"""Coerces a single value into the type expected for its column.
Internal helper method.
Args:
value: The value which should be converted
value_type: One of "string", "number", "boolean", "date", "datetime" or
"timeofday".
Returns:
... | [
"def",
"CoerceValue",
"(",
"value",
",",
"value_type",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"tuple",
")",
":",
"# In case of a tuple, we run the same function on the value itself and",
"# add the formatted value.",
"if",
"(",
"len",
"(",
"value",
")",
"not... | Coerces a single value into the type expected for its column.
Internal helper method.
Args:
value: The value which should be converted
value_type: One of "string", "number", "boolean", "date", "datetime" or
"timeofday".
Returns:
An item of the Python type appropriate t... | [
"Coerces",
"a",
"single",
"value",
"into",
"the",
"type",
"expected",
"for",
"its",
"column",
"."
] | cbfb4d69ad2f4ca30dc55791629280aa3214c8e3 | https://github.com/google/google-visualization-python/blob/cbfb4d69ad2f4ca30dc55791629280aa3214c8e3/gviz_api.py#L176-L270 | train | 28,108 |
google/google-visualization-python | gviz_api.py | DataTable.ColumnTypeParser | def ColumnTypeParser(description):
"""Parses a single column description. Internal helper method.
Args:
description: a column description in the possible formats:
'id'
('id',)
('id', 'type')
('id', 'type', 'label')
('id', 'type', 'label', {'custom_prop1': 'custom_val1'}... | python | def ColumnTypeParser(description):
"""Parses a single column description. Internal helper method.
Args:
description: a column description in the possible formats:
'id'
('id',)
('id', 'type')
('id', 'type', 'label')
('id', 'type', 'label', {'custom_prop1': 'custom_val1'}... | [
"def",
"ColumnTypeParser",
"(",
"description",
")",
":",
"if",
"not",
"description",
":",
"raise",
"DataTableException",
"(",
"\"Description error: empty description given\"",
")",
"if",
"not",
"isinstance",
"(",
"description",
",",
"(",
"six",
".",
"string_types",
... | Parses a single column description. Internal helper method.
Args:
description: a column description in the possible formats:
'id'
('id',)
('id', 'type')
('id', 'type', 'label')
('id', 'type', 'label', {'custom_prop1': 'custom_val1'})
Returns:
Dictionary with the f... | [
"Parses",
"a",
"single",
"column",
"description",
".",
"Internal",
"helper",
"method",
"."
] | cbfb4d69ad2f4ca30dc55791629280aa3214c8e3 | https://github.com/google/google-visualization-python/blob/cbfb4d69ad2f4ca30dc55791629280aa3214c8e3/gviz_api.py#L316-L375 | train | 28,109 |
google/google-visualization-python | gviz_api.py | DataTable.TableDescriptionParser | def TableDescriptionParser(table_description, depth=0):
"""Parses the table_description object for internal use.
Parses the user-submitted table description into an internal format used
by the Python DataTable class. Returns the flat list of parsed columns.
Args:
table_description: A description... | python | def TableDescriptionParser(table_description, depth=0):
"""Parses the table_description object for internal use.
Parses the user-submitted table description into an internal format used
by the Python DataTable class. Returns the flat list of parsed columns.
Args:
table_description: A description... | [
"def",
"TableDescriptionParser",
"(",
"table_description",
",",
"depth",
"=",
"0",
")",
":",
"# For the recursion step, we check for a scalar object (string or tuple)",
"if",
"isinstance",
"(",
"table_description",
",",
"(",
"six",
".",
"string_types",
",",
"tuple",
")",
... | Parses the table_description object for internal use.
Parses the user-submitted table description into an internal format used
by the Python DataTable class. Returns the flat list of parsed columns.
Args:
table_description: A description of the table which should comply
with... | [
"Parses",
"the",
"table_description",
"object",
"for",
"internal",
"use",
"."
] | cbfb4d69ad2f4ca30dc55791629280aa3214c8e3 | https://github.com/google/google-visualization-python/blob/cbfb4d69ad2f4ca30dc55791629280aa3214c8e3/gviz_api.py#L378-L525 | train | 28,110 |
google/google-visualization-python | gviz_api.py | DataTable.LoadData | def LoadData(self, data, custom_properties=None):
"""Loads new rows to the data table, clearing existing rows.
May also set the custom_properties for the added rows. The given custom
properties dictionary specifies the dictionary that will be used for *all*
given rows.
Args:
data: The rows t... | python | def LoadData(self, data, custom_properties=None):
"""Loads new rows to the data table, clearing existing rows.
May also set the custom_properties for the added rows. The given custom
properties dictionary specifies the dictionary that will be used for *all*
given rows.
Args:
data: The rows t... | [
"def",
"LoadData",
"(",
"self",
",",
"data",
",",
"custom_properties",
"=",
"None",
")",
":",
"self",
".",
"__data",
"=",
"[",
"]",
"self",
".",
"AppendData",
"(",
"data",
",",
"custom_properties",
")"
] | Loads new rows to the data table, clearing existing rows.
May also set the custom_properties for the added rows. The given custom
properties dictionary specifies the dictionary that will be used for *all*
given rows.
Args:
data: The rows that the table will contain.
custom_properties: A di... | [
"Loads",
"new",
"rows",
"to",
"the",
"data",
"table",
"clearing",
"existing",
"rows",
"."
] | cbfb4d69ad2f4ca30dc55791629280aa3214c8e3 | https://github.com/google/google-visualization-python/blob/cbfb4d69ad2f4ca30dc55791629280aa3214c8e3/gviz_api.py#L552-L565 | train | 28,111 |
google/google-visualization-python | gviz_api.py | DataTable.AppendData | def AppendData(self, data, custom_properties=None):
"""Appends new data to the table.
Data is appended in rows. Data must comply with
the table schema passed in to __init__(). See CoerceValue() for a list
of acceptable data types. See the class documentation for more information
and examples of sch... | python | def AppendData(self, data, custom_properties=None):
"""Appends new data to the table.
Data is appended in rows. Data must comply with
the table schema passed in to __init__(). See CoerceValue() for a list
of acceptable data types. See the class documentation for more information
and examples of sch... | [
"def",
"AppendData",
"(",
"self",
",",
"data",
",",
"custom_properties",
"=",
"None",
")",
":",
"# If the maximal depth is 0, we simply iterate over the data table",
"# lines and insert them using _InnerAppendData. Otherwise, we simply",
"# let the _InnerAppendData handle all the levels.... | Appends new data to the table.
Data is appended in rows. Data must comply with
the table schema passed in to __init__(). See CoerceValue() for a list
of acceptable data types. See the class documentation for more information
and examples of schema and data values.
Args:
data: The row to add ... | [
"Appends",
"new",
"data",
"to",
"the",
"table",
"."
] | cbfb4d69ad2f4ca30dc55791629280aa3214c8e3 | https://github.com/google/google-visualization-python/blob/cbfb4d69ad2f4ca30dc55791629280aa3214c8e3/gviz_api.py#L567-L591 | train | 28,112 |
google/google-visualization-python | gviz_api.py | DataTable._InnerAppendData | def _InnerAppendData(self, prev_col_values, data, col_index):
"""Inner function to assist LoadData."""
# We first check that col_index has not exceeded the columns size
if col_index >= len(self.__columns):
raise DataTableException("The data does not match description, too deep")
# Dealing with th... | python | def _InnerAppendData(self, prev_col_values, data, col_index):
"""Inner function to assist LoadData."""
# We first check that col_index has not exceeded the columns size
if col_index >= len(self.__columns):
raise DataTableException("The data does not match description, too deep")
# Dealing with th... | [
"def",
"_InnerAppendData",
"(",
"self",
",",
"prev_col_values",
",",
"data",
",",
"col_index",
")",
":",
"# We first check that col_index has not exceeded the columns size",
"if",
"col_index",
">=",
"len",
"(",
"self",
".",
"__columns",
")",
":",
"raise",
"DataTableEx... | Inner function to assist LoadData. | [
"Inner",
"function",
"to",
"assist",
"LoadData",
"."
] | cbfb4d69ad2f4ca30dc55791629280aa3214c8e3 | https://github.com/google/google-visualization-python/blob/cbfb4d69ad2f4ca30dc55791629280aa3214c8e3/gviz_api.py#L593-L642 | train | 28,113 |
google/google-visualization-python | gviz_api.py | DataTable._PreparedData | def _PreparedData(self, order_by=()):
"""Prepares the data for enumeration - sorting it by order_by.
Args:
order_by: Optional. Specifies the name of the column(s) to sort by, and
(optionally) which direction to sort in. Default sort direction
is asc. Following formats are ... | python | def _PreparedData(self, order_by=()):
"""Prepares the data for enumeration - sorting it by order_by.
Args:
order_by: Optional. Specifies the name of the column(s) to sort by, and
(optionally) which direction to sort in. Default sort direction
is asc. Following formats are ... | [
"def",
"_PreparedData",
"(",
"self",
",",
"order_by",
"=",
"(",
")",
")",
":",
"if",
"not",
"order_by",
":",
"return",
"self",
".",
"__data",
"sorted_data",
"=",
"self",
".",
"__data",
"[",
":",
"]",
"if",
"isinstance",
"(",
"order_by",
",",
"six",
"... | Prepares the data for enumeration - sorting it by order_by.
Args:
order_by: Optional. Specifies the name of the column(s) to sort by, and
(optionally) which direction to sort in. Default sort direction
is asc. Following formats are accepted:
"string_col_name" ... | [
"Prepares",
"the",
"data",
"for",
"enumeration",
"-",
"sorting",
"it",
"by",
"order_by",
"."
] | cbfb4d69ad2f4ca30dc55791629280aa3214c8e3 | https://github.com/google/google-visualization-python/blob/cbfb4d69ad2f4ca30dc55791629280aa3214c8e3/gviz_api.py#L644-L681 | train | 28,114 |
google/google-visualization-python | gviz_api.py | DataTable.ToJSCode | def ToJSCode(self, name, columns_order=None, order_by=()):
"""Writes the data table as a JS code string.
This method writes a string of JS code that can be run to
generate a DataTable with the specified data. Typically used for debugging
only.
Args:
name: The name of the table. The name woul... | python | def ToJSCode(self, name, columns_order=None, order_by=()):
"""Writes the data table as a JS code string.
This method writes a string of JS code that can be run to
generate a DataTable with the specified data. Typically used for debugging
only.
Args:
name: The name of the table. The name woul... | [
"def",
"ToJSCode",
"(",
"self",
",",
"name",
",",
"columns_order",
"=",
"None",
",",
"order_by",
"=",
"(",
")",
")",
":",
"encoder",
"=",
"DataTableJSONEncoder",
"(",
")",
"if",
"columns_order",
"is",
"None",
":",
"columns_order",
"=",
"[",
"col",
"[",
... | Writes the data table as a JS code string.
This method writes a string of JS code that can be run to
generate a DataTable with the specified data. Typically used for debugging
only.
Args:
name: The name of the table. The name would be used as the DataTable's
variable name in the crea... | [
"Writes",
"the",
"data",
"table",
"as",
"a",
"JS",
"code",
"string",
"."
] | cbfb4d69ad2f4ca30dc55791629280aa3214c8e3 | https://github.com/google/google-visualization-python/blob/cbfb4d69ad2f4ca30dc55791629280aa3214c8e3/gviz_api.py#L683-L768 | train | 28,115 |
google/google-visualization-python | gviz_api.py | DataTable.ToHtml | def ToHtml(self, columns_order=None, order_by=()):
"""Writes the data table as an HTML table code string.
Args:
columns_order: Optional. Specifies the order of columns in the
output table. Specify a list of all column IDs in the order
in which you want the table ... | python | def ToHtml(self, columns_order=None, order_by=()):
"""Writes the data table as an HTML table code string.
Args:
columns_order: Optional. Specifies the order of columns in the
output table. Specify a list of all column IDs in the order
in which you want the table ... | [
"def",
"ToHtml",
"(",
"self",
",",
"columns_order",
"=",
"None",
",",
"order_by",
"=",
"(",
")",
")",
":",
"table_template",
"=",
"\"<html><body><table border=\\\"1\\\">%s</table></body></html>\"",
"columns_template",
"=",
"\"<thead><tr>%s</tr></thead>\"",
"rows_template",
... | Writes the data table as an HTML table code string.
Args:
columns_order: Optional. Specifies the order of columns in the
output table. Specify a list of all column IDs in the order
in which you want the table created.
Note that you must list all ... | [
"Writes",
"the",
"data",
"table",
"as",
"an",
"HTML",
"table",
"code",
"string",
"."
] | cbfb4d69ad2f4ca30dc55791629280aa3214c8e3 | https://github.com/google/google-visualization-python/blob/cbfb4d69ad2f4ca30dc55791629280aa3214c8e3/gviz_api.py#L770-L831 | train | 28,116 |
google/google-visualization-python | gviz_api.py | DataTable.ToCsv | def ToCsv(self, columns_order=None, order_by=(), separator=","):
"""Writes the data table as a CSV string.
Output is encoded in UTF-8 because the Python "csv" module can't handle
Unicode properly according to its documentation.
Args:
columns_order: Optional. Specifies the order of columns in the... | python | def ToCsv(self, columns_order=None, order_by=(), separator=","):
"""Writes the data table as a CSV string.
Output is encoded in UTF-8 because the Python "csv" module can't handle
Unicode properly according to its documentation.
Args:
columns_order: Optional. Specifies the order of columns in the... | [
"def",
"ToCsv",
"(",
"self",
",",
"columns_order",
"=",
"None",
",",
"order_by",
"=",
"(",
")",
",",
"separator",
"=",
"\",\"",
")",
":",
"csv_buffer",
"=",
"six",
".",
"StringIO",
"(",
")",
"writer",
"=",
"csv",
".",
"writer",
"(",
"csv_buffer",
","... | Writes the data table as a CSV string.
Output is encoded in UTF-8 because the Python "csv" module can't handle
Unicode properly according to its documentation.
Args:
columns_order: Optional. Specifies the order of columns in the
output table. Specify a list of all column IDs in ... | [
"Writes",
"the",
"data",
"table",
"as",
"a",
"CSV",
"string",
"."
] | cbfb4d69ad2f4ca30dc55791629280aa3214c8e3 | https://github.com/google/google-visualization-python/blob/cbfb4d69ad2f4ca30dc55791629280aa3214c8e3/gviz_api.py#L833-L893 | train | 28,117 |
google/google-visualization-python | gviz_api.py | DataTable.ToTsvExcel | def ToTsvExcel(self, columns_order=None, order_by=()):
"""Returns a file in tab-separated-format readable by MS Excel.
Returns a file in UTF-16 little endian encoding, with tabs separating the
values.
Args:
columns_order: Delegated to ToCsv.
order_by: Delegated to ToCsv.
Returns:
... | python | def ToTsvExcel(self, columns_order=None, order_by=()):
"""Returns a file in tab-separated-format readable by MS Excel.
Returns a file in UTF-16 little endian encoding, with tabs separating the
values.
Args:
columns_order: Delegated to ToCsv.
order_by: Delegated to ToCsv.
Returns:
... | [
"def",
"ToTsvExcel",
"(",
"self",
",",
"columns_order",
"=",
"None",
",",
"order_by",
"=",
"(",
")",
")",
":",
"csv_result",
"=",
"self",
".",
"ToCsv",
"(",
"columns_order",
",",
"order_by",
",",
"separator",
"=",
"\"\\t\"",
")",
"if",
"not",
"isinstance... | Returns a file in tab-separated-format readable by MS Excel.
Returns a file in UTF-16 little endian encoding, with tabs separating the
values.
Args:
columns_order: Delegated to ToCsv.
order_by: Delegated to ToCsv.
Returns:
A tab-separated little endian UTF16 file representing the ta... | [
"Returns",
"a",
"file",
"in",
"tab",
"-",
"separated",
"-",
"format",
"readable",
"by",
"MS",
"Excel",
"."
] | cbfb4d69ad2f4ca30dc55791629280aa3214c8e3 | https://github.com/google/google-visualization-python/blob/cbfb4d69ad2f4ca30dc55791629280aa3214c8e3/gviz_api.py#L895-L911 | train | 28,118 |
google/google-visualization-python | gviz_api.py | DataTable._ToJSonObj | def _ToJSonObj(self, columns_order=None, order_by=()):
"""Returns an object suitable to be converted to JSON.
Args:
columns_order: Optional. A list of all column IDs in the order in which
you want them created in the output table. If specified,
all column IDs mus... | python | def _ToJSonObj(self, columns_order=None, order_by=()):
"""Returns an object suitable to be converted to JSON.
Args:
columns_order: Optional. A list of all column IDs in the order in which
you want them created in the output table. If specified,
all column IDs mus... | [
"def",
"_ToJSonObj",
"(",
"self",
",",
"columns_order",
"=",
"None",
",",
"order_by",
"=",
"(",
")",
")",
":",
"if",
"columns_order",
"is",
"None",
":",
"columns_order",
"=",
"[",
"col",
"[",
"\"id\"",
"]",
"for",
"col",
"in",
"self",
".",
"__columns",... | Returns an object suitable to be converted to JSON.
Args:
columns_order: Optional. A list of all column IDs in the order in which
you want them created in the output table. If specified,
all column IDs must be present.
order_by: Optional. Specifies the name of ... | [
"Returns",
"an",
"object",
"suitable",
"to",
"be",
"converted",
"to",
"JSON",
"."
] | cbfb4d69ad2f4ca30dc55791629280aa3214c8e3 | https://github.com/google/google-visualization-python/blob/cbfb4d69ad2f4ca30dc55791629280aa3214c8e3/gviz_api.py#L913-L966 | train | 28,119 |
google/google-visualization-python | gviz_api.py | DataTable.ToJSon | def ToJSon(self, columns_order=None, order_by=()):
"""Returns a string that can be used in a JS DataTable constructor.
This method writes a JSON string that can be passed directly into a Google
Visualization API DataTable constructor. Use this output if you are
hosting the visualization HTML on your si... | python | def ToJSon(self, columns_order=None, order_by=()):
"""Returns a string that can be used in a JS DataTable constructor.
This method writes a JSON string that can be passed directly into a Google
Visualization API DataTable constructor. Use this output if you are
hosting the visualization HTML on your si... | [
"def",
"ToJSon",
"(",
"self",
",",
"columns_order",
"=",
"None",
",",
"order_by",
"=",
"(",
")",
")",
":",
"encoded_response_str",
"=",
"DataTableJSONEncoder",
"(",
")",
".",
"encode",
"(",
"self",
".",
"_ToJSonObj",
"(",
"columns_order",
",",
"order_by",
... | Returns a string that can be used in a JS DataTable constructor.
This method writes a JSON string that can be passed directly into a Google
Visualization API DataTable constructor. Use this output if you are
hosting the visualization HTML on your site, and want to code the data
table in Python. Pass th... | [
"Returns",
"a",
"string",
"that",
"can",
"be",
"used",
"in",
"a",
"JS",
"DataTable",
"constructor",
"."
] | cbfb4d69ad2f4ca30dc55791629280aa3214c8e3 | https://github.com/google/google-visualization-python/blob/cbfb4d69ad2f4ca30dc55791629280aa3214c8e3/gviz_api.py#L968-L1009 | train | 28,120 |
google/google-visualization-python | gviz_api.py | DataTable.ToJSonResponse | def ToJSonResponse(self, columns_order=None, order_by=(), req_id=0,
response_handler="google.visualization.Query.setResponse"):
"""Writes a table as a JSON response that can be returned as-is to a client.
This method writes a JSON response to return to a client in response to a
Google ... | python | def ToJSonResponse(self, columns_order=None, order_by=(), req_id=0,
response_handler="google.visualization.Query.setResponse"):
"""Writes a table as a JSON response that can be returned as-is to a client.
This method writes a JSON response to return to a client in response to a
Google ... | [
"def",
"ToJSonResponse",
"(",
"self",
",",
"columns_order",
"=",
"None",
",",
"order_by",
"=",
"(",
")",
",",
"req_id",
"=",
"0",
",",
"response_handler",
"=",
"\"google.visualization.Query.setResponse\"",
")",
":",
"response_obj",
"=",
"{",
"\"version\"",
":",
... | Writes a table as a JSON response that can be returned as-is to a client.
This method writes a JSON response to return to a client in response to a
Google Visualization API query. This string can be processed by the calling
page, and is used to deliver a data table to a visualization hosted on
a differ... | [
"Writes",
"a",
"table",
"as",
"a",
"JSON",
"response",
"that",
"can",
"be",
"returned",
"as",
"-",
"is",
"to",
"a",
"client",
"."
] | cbfb4d69ad2f4ca30dc55791629280aa3214c8e3 | https://github.com/google/google-visualization-python/blob/cbfb4d69ad2f4ca30dc55791629280aa3214c8e3/gviz_api.py#L1011-L1049 | train | 28,121 |
google/google-visualization-python | gviz_api.py | DataTable.ToResponse | def ToResponse(self, columns_order=None, order_by=(), tqx=""):
"""Writes the right response according to the request string passed in tqx.
This method parses the tqx request string (format of which is defined in
the documentation for implementing a data source of Google Visualization),
and returns the ... | python | def ToResponse(self, columns_order=None, order_by=(), tqx=""):
"""Writes the right response according to the request string passed in tqx.
This method parses the tqx request string (format of which is defined in
the documentation for implementing a data source of Google Visualization),
and returns the ... | [
"def",
"ToResponse",
"(",
"self",
",",
"columns_order",
"=",
"None",
",",
"order_by",
"=",
"(",
")",
",",
"tqx",
"=",
"\"\"",
")",
":",
"tqx_dict",
"=",
"{",
"}",
"if",
"tqx",
":",
"tqx_dict",
"=",
"dict",
"(",
"opt",
".",
"split",
"(",
"\":\"",
... | Writes the right response according to the request string passed in tqx.
This method parses the tqx request string (format of which is defined in
the documentation for implementing a data source of Google Visualization),
and returns the right response according to the request.
It parses out the "out" p... | [
"Writes",
"the",
"right",
"response",
"according",
"to",
"the",
"request",
"string",
"passed",
"in",
"tqx",
"."
] | cbfb4d69ad2f4ca30dc55791629280aa3214c8e3 | https://github.com/google/google-visualization-python/blob/cbfb4d69ad2f4ca30dc55791629280aa3214c8e3/gviz_api.py#L1051-L1098 | train | 28,122 |
vvangelovski/django-audit-log | audit_log/models/managers.py | AuditLog.copy_fields | def copy_fields(self, model):
"""
Creates copies of the fields we are keeping
track of for the provided model, returning a
dictionary mapping field name to a copied field object.
"""
fields = {'__module__' : model.__module__}
for field in model._meta.fields:
... | python | def copy_fields(self, model):
"""
Creates copies of the fields we are keeping
track of for the provided model, returning a
dictionary mapping field name to a copied field object.
"""
fields = {'__module__' : model.__module__}
for field in model._meta.fields:
... | [
"def",
"copy_fields",
"(",
"self",
",",
"model",
")",
":",
"fields",
"=",
"{",
"'__module__'",
":",
"model",
".",
"__module__",
"}",
"for",
"field",
"in",
"model",
".",
"_meta",
".",
"fields",
":",
"if",
"not",
"field",
".",
"name",
"in",
"self",
"."... | Creates copies of the fields we are keeping
track of for the provided model, returning a
dictionary mapping field name to a copied field object. | [
"Creates",
"copies",
"of",
"the",
"fields",
"we",
"are",
"keeping",
"track",
"of",
"for",
"the",
"provided",
"model",
"returning",
"a",
"dictionary",
"mapping",
"field",
"name",
"to",
"a",
"copied",
"field",
"object",
"."
] | f1bee75360a67390fbef67c110e9a245b41ebb92 | https://github.com/vvangelovski/django-audit-log/blob/f1bee75360a67390fbef67c110e9a245b41ebb92/audit_log/models/managers.py#L128-L186 | train | 28,123 |
vvangelovski/django-audit-log | audit_log/models/managers.py | AuditLog.get_logging_fields | def get_logging_fields(self, model):
"""
Returns a dictionary mapping of the fields that are used for
keeping the acutal audit log entries.
"""
rel_name = '_%s_audit_log_entry'%model._meta.object_name.lower()
def entry_instance_to_unicode(log_entry):
try:
... | python | def get_logging_fields(self, model):
"""
Returns a dictionary mapping of the fields that are used for
keeping the acutal audit log entries.
"""
rel_name = '_%s_audit_log_entry'%model._meta.object_name.lower()
def entry_instance_to_unicode(log_entry):
try:
... | [
"def",
"get_logging_fields",
"(",
"self",
",",
"model",
")",
":",
"rel_name",
"=",
"'_%s_audit_log_entry'",
"%",
"model",
".",
"_meta",
".",
"object_name",
".",
"lower",
"(",
")",
"def",
"entry_instance_to_unicode",
"(",
"log_entry",
")",
":",
"try",
":",
"r... | Returns a dictionary mapping of the fields that are used for
keeping the acutal audit log entries. | [
"Returns",
"a",
"dictionary",
"mapping",
"of",
"the",
"fields",
"that",
"are",
"used",
"for",
"keeping",
"the",
"acutal",
"audit",
"log",
"entries",
"."
] | f1bee75360a67390fbef67c110e9a245b41ebb92 | https://github.com/vvangelovski/django-audit-log/blob/f1bee75360a67390fbef67c110e9a245b41ebb92/audit_log/models/managers.py#L190-L231 | train | 28,124 |
vvangelovski/django-audit-log | audit_log/models/managers.py | AuditLog.get_meta_options | def get_meta_options(self, model):
"""
Returns a dictionary of Meta options for the
autdit log model.
"""
result = {
'ordering' : ('-action_date',),
'app_label' : model._meta.app_label,
}
from django.db.models.options import DEFAULT_NAMES
... | python | def get_meta_options(self, model):
"""
Returns a dictionary of Meta options for the
autdit log model.
"""
result = {
'ordering' : ('-action_date',),
'app_label' : model._meta.app_label,
}
from django.db.models.options import DEFAULT_NAMES
... | [
"def",
"get_meta_options",
"(",
"self",
",",
"model",
")",
":",
"result",
"=",
"{",
"'ordering'",
":",
"(",
"'-action_date'",
",",
")",
",",
"'app_label'",
":",
"model",
".",
"_meta",
".",
"app_label",
",",
"}",
"from",
"django",
".",
"db",
".",
"model... | Returns a dictionary of Meta options for the
autdit log model. | [
"Returns",
"a",
"dictionary",
"of",
"Meta",
"options",
"for",
"the",
"autdit",
"log",
"model",
"."
] | f1bee75360a67390fbef67c110e9a245b41ebb92 | https://github.com/vvangelovski/django-audit-log/blob/f1bee75360a67390fbef67c110e9a245b41ebb92/audit_log/models/managers.py#L234-L246 | train | 28,125 |
vvangelovski/django-audit-log | audit_log/models/managers.py | AuditLog.create_log_entry_model | def create_log_entry_model(self, model):
"""
Creates a log entry model that will be associated with
the model provided.
"""
attrs = self.copy_fields(model)
attrs.update(self.get_logging_fields(model))
attrs.update(Meta = type(str('Meta'), (), self.get_meta_option... | python | def create_log_entry_model(self, model):
"""
Creates a log entry model that will be associated with
the model provided.
"""
attrs = self.copy_fields(model)
attrs.update(self.get_logging_fields(model))
attrs.update(Meta = type(str('Meta'), (), self.get_meta_option... | [
"def",
"create_log_entry_model",
"(",
"self",
",",
"model",
")",
":",
"attrs",
"=",
"self",
".",
"copy_fields",
"(",
"model",
")",
"attrs",
".",
"update",
"(",
"self",
".",
"get_logging_fields",
"(",
"model",
")",
")",
"attrs",
".",
"update",
"(",
"Meta"... | Creates a log entry model that will be associated with
the model provided. | [
"Creates",
"a",
"log",
"entry",
"model",
"that",
"will",
"be",
"associated",
"with",
"the",
"model",
"provided",
"."
] | f1bee75360a67390fbef67c110e9a245b41ebb92 | https://github.com/vvangelovski/django-audit-log/blob/f1bee75360a67390fbef67c110e9a245b41ebb92/audit_log/models/managers.py#L248-L258 | train | 28,126 |
seung-lab/cloud-volume | cloudvolume/chunks.py | decode_kempressed | def decode_kempressed(bytestring):
"""subvol not bytestring since numpy conversion is done inside fpzip extension."""
subvol = fpzip.decompress(bytestring, order='F')
return np.swapaxes(subvol, 3,2) - 2.0 | python | def decode_kempressed(bytestring):
"""subvol not bytestring since numpy conversion is done inside fpzip extension."""
subvol = fpzip.decompress(bytestring, order='F')
return np.swapaxes(subvol, 3,2) - 2.0 | [
"def",
"decode_kempressed",
"(",
"bytestring",
")",
":",
"subvol",
"=",
"fpzip",
".",
"decompress",
"(",
"bytestring",
",",
"order",
"=",
"'F'",
")",
"return",
"np",
".",
"swapaxes",
"(",
"subvol",
",",
"3",
",",
"2",
")",
"-",
"2.0"
] | subvol not bytestring since numpy conversion is done inside fpzip extension. | [
"subvol",
"not",
"bytestring",
"since",
"numpy",
"conversion",
"is",
"done",
"inside",
"fpzip",
"extension",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/chunks.py#L143-L146 | train | 28,127 |
seung-lab/cloud-volume | cloudvolume/sharedmemory.py | bbox2array | def bbox2array(vol, bbox, order='F', readonly=False, lock=None, location=None):
"""Convenince method for creating a
shared memory numpy array based on a CloudVolume
and Bbox. c.f. sharedmemory.ndarray for information
on the optional lock parameter."""
location = location or vol.shared_memory_id
shape = lis... | python | def bbox2array(vol, bbox, order='F', readonly=False, lock=None, location=None):
"""Convenince method for creating a
shared memory numpy array based on a CloudVolume
and Bbox. c.f. sharedmemory.ndarray for information
on the optional lock parameter."""
location = location or vol.shared_memory_id
shape = lis... | [
"def",
"bbox2array",
"(",
"vol",
",",
"bbox",
",",
"order",
"=",
"'F'",
",",
"readonly",
"=",
"False",
",",
"lock",
"=",
"None",
",",
"location",
"=",
"None",
")",
":",
"location",
"=",
"location",
"or",
"vol",
".",
"shared_memory_id",
"shape",
"=",
... | Convenince method for creating a
shared memory numpy array based on a CloudVolume
and Bbox. c.f. sharedmemory.ndarray for information
on the optional lock parameter. | [
"Convenince",
"method",
"for",
"creating",
"a",
"shared",
"memory",
"numpy",
"array",
"based",
"on",
"a",
"CloudVolume",
"and",
"Bbox",
".",
"c",
".",
"f",
".",
"sharedmemory",
".",
"ndarray",
"for",
"information",
"on",
"the",
"optional",
"lock",
"parameter... | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/sharedmemory.py#L38-L46 | train | 28,128 |
seung-lab/cloud-volume | cloudvolume/sharedmemory.py | ndarray_fs | def ndarray_fs(shape, dtype, location, lock, readonly=False, order='F', **kwargs):
"""Emulate shared memory using the filesystem."""
dbytes = np.dtype(dtype).itemsize
nbytes = Vec(*shape).rectVolume() * dbytes
directory = mkdir(EMULATED_SHM_DIRECTORY)
filename = os.path.join(directory, location)
if lock:
... | python | def ndarray_fs(shape, dtype, location, lock, readonly=False, order='F', **kwargs):
"""Emulate shared memory using the filesystem."""
dbytes = np.dtype(dtype).itemsize
nbytes = Vec(*shape).rectVolume() * dbytes
directory = mkdir(EMULATED_SHM_DIRECTORY)
filename = os.path.join(directory, location)
if lock:
... | [
"def",
"ndarray_fs",
"(",
"shape",
",",
"dtype",
",",
"location",
",",
"lock",
",",
"readonly",
"=",
"False",
",",
"order",
"=",
"'F'",
",",
"*",
"*",
"kwargs",
")",
":",
"dbytes",
"=",
"np",
".",
"dtype",
"(",
"dtype",
")",
".",
"itemsize",
"nbyte... | Emulate shared memory using the filesystem. | [
"Emulate",
"shared",
"memory",
"using",
"the",
"filesystem",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/sharedmemory.py#L75-L125 | train | 28,129 |
seung-lab/cloud-volume | cloudvolume/txrx.py | cutout | def cutout(vol, requested_bbox, steps, channel_slice=slice(None), parallel=1,
shared_memory_location=None, output_to_shared_memory=False):
"""Cutout a requested bounding box from storage and return it as a numpy array."""
global fs_lock
cloudpath_bbox = requested_bbox.expand_to_chunk_size(vol.underlying, offs... | python | def cutout(vol, requested_bbox, steps, channel_slice=slice(None), parallel=1,
shared_memory_location=None, output_to_shared_memory=False):
"""Cutout a requested bounding box from storage and return it as a numpy array."""
global fs_lock
cloudpath_bbox = requested_bbox.expand_to_chunk_size(vol.underlying, offs... | [
"def",
"cutout",
"(",
"vol",
",",
"requested_bbox",
",",
"steps",
",",
"channel_slice",
"=",
"slice",
"(",
"None",
")",
",",
"parallel",
"=",
"1",
",",
"shared_memory_location",
"=",
"None",
",",
"output_to_shared_memory",
"=",
"False",
")",
":",
"global",
... | Cutout a requested bounding box from storage and return it as a numpy array. | [
"Cutout",
"a",
"requested",
"bounding",
"box",
"from",
"storage",
"and",
"return",
"it",
"as",
"a",
"numpy",
"array",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/txrx.py#L109-L137 | train | 28,130 |
seung-lab/cloud-volume | cloudvolume/txrx.py | decode | def decode(vol, filename, content):
"""Decode content according to settings in a cloudvolume instance."""
bbox = Bbox.from_filename(filename)
content_len = len(content) if content is not None else 0
if not content:
if vol.fill_missing:
content = ''
else:
raise EmptyVolumeException(filename)... | python | def decode(vol, filename, content):
"""Decode content according to settings in a cloudvolume instance."""
bbox = Bbox.from_filename(filename)
content_len = len(content) if content is not None else 0
if not content:
if vol.fill_missing:
content = ''
else:
raise EmptyVolumeException(filename)... | [
"def",
"decode",
"(",
"vol",
",",
"filename",
",",
"content",
")",
":",
"bbox",
"=",
"Bbox",
".",
"from_filename",
"(",
"filename",
")",
"content_len",
"=",
"len",
"(",
"content",
")",
"if",
"content",
"is",
"not",
"None",
"else",
"0",
"if",
"not",
"... | Decode content according to settings in a cloudvolume instance. | [
"Decode",
"content",
"according",
"to",
"settings",
"in",
"a",
"cloudvolume",
"instance",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/txrx.py#L173-L197 | train | 28,131 |
seung-lab/cloud-volume | cloudvolume/txrx.py | shade | def shade(renderbuffer, bufferbbox, img3d, bbox):
"""Shade a renderbuffer with a downloaded chunk.
The buffer will only be painted in the overlapping
region of the content."""
if not Bbox.intersects(bufferbbox, bbox):
return
spt = max2(bbox.minpt, bufferbbox.minpt)
ept = min2(bbox.maxpt, bufferbb... | python | def shade(renderbuffer, bufferbbox, img3d, bbox):
"""Shade a renderbuffer with a downloaded chunk.
The buffer will only be painted in the overlapping
region of the content."""
if not Bbox.intersects(bufferbbox, bbox):
return
spt = max2(bbox.minpt, bufferbbox.minpt)
ept = min2(bbox.maxpt, bufferbb... | [
"def",
"shade",
"(",
"renderbuffer",
",",
"bufferbbox",
",",
"img3d",
",",
"bbox",
")",
":",
"if",
"not",
"Bbox",
".",
"intersects",
"(",
"bufferbbox",
",",
"bbox",
")",
":",
"return",
"spt",
"=",
"max2",
"(",
"bbox",
".",
"minpt",
",",
"bufferbbox",
... | Shade a renderbuffer with a downloaded chunk.
The buffer will only be painted in the overlapping
region of the content. | [
"Shade",
"a",
"renderbuffer",
"with",
"a",
"downloaded",
"chunk",
".",
"The",
"buffer",
"will",
"only",
"be",
"painted",
"in",
"the",
"overlapping",
"region",
"of",
"the",
"content",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/txrx.py#L199-L219 | train | 28,132 |
seung-lab/cloud-volume | cloudvolume/txrx.py | cdn_cache_control | def cdn_cache_control(val):
"""Translate cdn_cache into a Cache-Control HTTP header."""
if val is None:
return 'max-age=3600, s-max-age=3600'
elif type(val) is str:
return val
elif type(val) is bool:
if val:
return 'max-age=3600, s-max-age=3600'
else:
return 'no-cache'
elif type(va... | python | def cdn_cache_control(val):
"""Translate cdn_cache into a Cache-Control HTTP header."""
if val is None:
return 'max-age=3600, s-max-age=3600'
elif type(val) is str:
return val
elif type(val) is bool:
if val:
return 'max-age=3600, s-max-age=3600'
else:
return 'no-cache'
elif type(va... | [
"def",
"cdn_cache_control",
"(",
"val",
")",
":",
"if",
"val",
"is",
"None",
":",
"return",
"'max-age=3600, s-max-age=3600'",
"elif",
"type",
"(",
"val",
")",
"is",
"str",
":",
"return",
"val",
"elif",
"type",
"(",
"val",
")",
"is",
"bool",
":",
"if",
... | Translate cdn_cache into a Cache-Control HTTP header. | [
"Translate",
"cdn_cache",
"into",
"a",
"Cache",
"-",
"Control",
"HTTP",
"header",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/txrx.py#L241-L261 | train | 28,133 |
seung-lab/cloud-volume | cloudvolume/txrx.py | upload_image | def upload_image(vol, img, offset, parallel=1,
manual_shared_memory_id=None, manual_shared_memory_bbox=None, manual_shared_memory_order='F'):
"""Upload img to vol with offset. This is the primary entry point for uploads."""
global NON_ALIGNED_WRITE
if not np.issubdtype(img.dtype, np.dtype(vol.dtype).type):
... | python | def upload_image(vol, img, offset, parallel=1,
manual_shared_memory_id=None, manual_shared_memory_bbox=None, manual_shared_memory_order='F'):
"""Upload img to vol with offset. This is the primary entry point for uploads."""
global NON_ALIGNED_WRITE
if not np.issubdtype(img.dtype, np.dtype(vol.dtype).type):
... | [
"def",
"upload_image",
"(",
"vol",
",",
"img",
",",
"offset",
",",
"parallel",
"=",
"1",
",",
"manual_shared_memory_id",
"=",
"None",
",",
"manual_shared_memory_bbox",
"=",
"None",
",",
"manual_shared_memory_order",
"=",
"'F'",
")",
":",
"global",
"NON_ALIGNED_W... | Upload img to vol with offset. This is the primary entry point for uploads. | [
"Upload",
"img",
"to",
"vol",
"with",
"offset",
".",
"This",
"is",
"the",
"primary",
"entry",
"point",
"for",
"uploads",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/txrx.py#L273-L314 | train | 28,134 |
seung-lab/cloud-volume | cloudvolume/compression.py | decompress | def decompress(content, encoding, filename='N/A'):
"""
Decompress file content.
Required:
content (bytes): a file to be compressed
encoding: None (no compression) or 'gzip'
Optional:
filename (str:default:'N/A'): Used for debugging messages
Raises:
NotImplementedError if an unsupported ... | python | def decompress(content, encoding, filename='N/A'):
"""
Decompress file content.
Required:
content (bytes): a file to be compressed
encoding: None (no compression) or 'gzip'
Optional:
filename (str:default:'N/A'): Used for debugging messages
Raises:
NotImplementedError if an unsupported ... | [
"def",
"decompress",
"(",
"content",
",",
"encoding",
",",
"filename",
"=",
"'N/A'",
")",
":",
"try",
":",
"encoding",
"=",
"(",
"encoding",
"or",
"''",
")",
".",
"lower",
"(",
")",
"if",
"encoding",
"==",
"''",
":",
"return",
"content",
"elif",
"enc... | Decompress file content.
Required:
content (bytes): a file to be compressed
encoding: None (no compression) or 'gzip'
Optional:
filename (str:default:'N/A'): Used for debugging messages
Raises:
NotImplementedError if an unsupported codec is specified.
compression.EncodeError if the enc... | [
"Decompress",
"file",
"content",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/compression.py#L9-L34 | train | 28,135 |
seung-lab/cloud-volume | cloudvolume/compression.py | compress | def compress(content, method='gzip'):
"""
Compresses file content.
Required:
content (bytes): The information to be compressed
method (str, default: 'gzip'): None or gzip
Raises:
NotImplementedError if an unsupported codec is specified.
compression.DecodeError if the encoder has an issue
R... | python | def compress(content, method='gzip'):
"""
Compresses file content.
Required:
content (bytes): The information to be compressed
method (str, default: 'gzip'): None or gzip
Raises:
NotImplementedError if an unsupported codec is specified.
compression.DecodeError if the encoder has an issue
R... | [
"def",
"compress",
"(",
"content",
",",
"method",
"=",
"'gzip'",
")",
":",
"if",
"method",
"==",
"True",
":",
"method",
"=",
"'gzip'",
"# backwards compatibility",
"method",
"=",
"(",
"method",
"or",
"''",
")",
".",
"lower",
"(",
")",
"if",
"method",
"... | Compresses file content.
Required:
content (bytes): The information to be compressed
method (str, default: 'gzip'): None or gzip
Raises:
NotImplementedError if an unsupported codec is specified.
compression.DecodeError if the encoder has an issue
Return: compressed content | [
"Compresses",
"file",
"content",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/compression.py#L36-L58 | train | 28,136 |
seung-lab/cloud-volume | cloudvolume/compression.py | gunzip | def gunzip(content):
"""
Decompression is applied if the first to bytes matches with
the gzip magic numbers.
There is once chance in 65536 that a file that is not gzipped will
be ungzipped.
"""
gzip_magic_numbers = [ 0x1f, 0x8b ]
first_two_bytes = [ byte for byte in bytearray(content)[:2] ]
if first... | python | def gunzip(content):
"""
Decompression is applied if the first to bytes matches with
the gzip magic numbers.
There is once chance in 65536 that a file that is not gzipped will
be ungzipped.
"""
gzip_magic_numbers = [ 0x1f, 0x8b ]
first_two_bytes = [ byte for byte in bytearray(content)[:2] ]
if first... | [
"def",
"gunzip",
"(",
"content",
")",
":",
"gzip_magic_numbers",
"=",
"[",
"0x1f",
",",
"0x8b",
"]",
"first_two_bytes",
"=",
"[",
"byte",
"for",
"byte",
"in",
"bytearray",
"(",
"content",
")",
"[",
":",
"2",
"]",
"]",
"if",
"first_two_bytes",
"!=",
"gz... | Decompression is applied if the first to bytes matches with
the gzip magic numbers.
There is once chance in 65536 that a file that is not gzipped will
be ungzipped. | [
"Decompression",
"is",
"applied",
"if",
"the",
"first",
"to",
"bytes",
"matches",
"with",
"the",
"gzip",
"magic",
"numbers",
".",
"There",
"is",
"once",
"chance",
"in",
"65536",
"that",
"a",
"file",
"that",
"is",
"not",
"gzipped",
"will",
"be",
"ungzipped"... | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/compression.py#L71-L86 | train | 28,137 |
seung-lab/cloud-volume | cloudvolume/cacheservice.py | CacheService.flush | def flush(self, preserve=None):
"""
Delete the cache for this dataset. Optionally preserve
a region. Helpful when working with overlaping volumes.
Warning: the preserve option is not multi-process safe.
You're liable to end up deleting the entire cache.
Optional:
preserve (Bbox: None): P... | python | def flush(self, preserve=None):
"""
Delete the cache for this dataset. Optionally preserve
a region. Helpful when working with overlaping volumes.
Warning: the preserve option is not multi-process safe.
You're liable to end up deleting the entire cache.
Optional:
preserve (Bbox: None): P... | [
"def",
"flush",
"(",
"self",
",",
"preserve",
"=",
"None",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"path",
")",
":",
"return",
"if",
"preserve",
"is",
"None",
":",
"shutil",
".",
"rmtree",
"(",
"self",
".",
"pat... | Delete the cache for this dataset. Optionally preserve
a region. Helpful when working with overlaping volumes.
Warning: the preserve option is not multi-process safe.
You're liable to end up deleting the entire cache.
Optional:
preserve (Bbox: None): Preserve chunks located partially
or ... | [
"Delete",
"the",
"cache",
"for",
"this",
"dataset",
".",
"Optionally",
"preserve",
"a",
"region",
".",
"Helpful",
"when",
"working",
"with",
"overlaping",
"volumes",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/cacheservice.py#L97-L129 | train | 28,138 |
seung-lab/cloud-volume | cloudvolume/cacheservice.py | CacheService.flush_region | def flush_region(self, region, mips=None):
"""
Delete a cache region at one or more mip levels
bounded by a Bbox for this dataset. Bbox coordinates
should be specified in mip 0 coordinates.
Required:
region (Bbox): Delete cached chunks located partially
or entirely within this boundi... | python | def flush_region(self, region, mips=None):
"""
Delete a cache region at one or more mip levels
bounded by a Bbox for this dataset. Bbox coordinates
should be specified in mip 0 coordinates.
Required:
region (Bbox): Delete cached chunks located partially
or entirely within this boundi... | [
"def",
"flush_region",
"(",
"self",
",",
"region",
",",
"mips",
"=",
"None",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"path",
")",
":",
"return",
"if",
"type",
"(",
"region",
")",
"in",
"(",
"list",
",",
"tuple",... | Delete a cache region at one or more mip levels
bounded by a Bbox for this dataset. Bbox coordinates
should be specified in mip 0 coordinates.
Required:
region (Bbox): Delete cached chunks located partially
or entirely within this bounding box.
Optional:
mip (int: None): Flush the... | [
"Delete",
"a",
"cache",
"region",
"at",
"one",
"or",
"more",
"mip",
"levels",
"bounded",
"by",
"a",
"Bbox",
"for",
"this",
"dataset",
".",
"Bbox",
"coordinates",
"should",
"be",
"specified",
"in",
"mip",
"0",
"coordinates",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/cacheservice.py#L138-L175 | train | 28,139 |
seung-lab/cloud-volume | cloudvolume/volumecutout.py | VolumeCutout.save_images | def save_images(self, directory=None, axis='z', channel=None, global_norm=True, image_format='PNG'):
"""See cloudvolume.lib.save_images for more information."""
if directory is None:
directory = os.path.join('./saved_images', self.dataset_name, self.layer, str(self.mip), self.bounds.to_filename())
re... | python | def save_images(self, directory=None, axis='z', channel=None, global_norm=True, image_format='PNG'):
"""See cloudvolume.lib.save_images for more information."""
if directory is None:
directory = os.path.join('./saved_images', self.dataset_name, self.layer, str(self.mip), self.bounds.to_filename())
re... | [
"def",
"save_images",
"(",
"self",
",",
"directory",
"=",
"None",
",",
"axis",
"=",
"'z'",
",",
"channel",
"=",
"None",
",",
"global_norm",
"=",
"True",
",",
"image_format",
"=",
"'PNG'",
")",
":",
"if",
"directory",
"is",
"None",
":",
"directory",
"="... | See cloudvolume.lib.save_images for more information. | [
"See",
"cloudvolume",
".",
"lib",
".",
"save_images",
"for",
"more",
"information",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/volumecutout.py#L72-L77 | train | 28,140 |
seung-lab/cloud-volume | cloudvolume/skeletonservice.py | PrecomputedSkeleton.from_path | def from_path(kls, vertices):
"""
Given an Nx3 array of vertices that constitute a single path,
generate a skeleton with appropriate edges.
"""
if vertices.shape[0] == 0:
return PrecomputedSkeleton()
skel = PrecomputedSkeleton(vertices)
edges = np.zeros(shape=(skel.vertices.shape[0] ... | python | def from_path(kls, vertices):
"""
Given an Nx3 array of vertices that constitute a single path,
generate a skeleton with appropriate edges.
"""
if vertices.shape[0] == 0:
return PrecomputedSkeleton()
skel = PrecomputedSkeleton(vertices)
edges = np.zeros(shape=(skel.vertices.shape[0] ... | [
"def",
"from_path",
"(",
"kls",
",",
"vertices",
")",
":",
"if",
"vertices",
".",
"shape",
"[",
"0",
"]",
"==",
"0",
":",
"return",
"PrecomputedSkeleton",
"(",
")",
"skel",
"=",
"PrecomputedSkeleton",
"(",
"vertices",
")",
"edges",
"=",
"np",
".",
"zer... | Given an Nx3 array of vertices that constitute a single path,
generate a skeleton with appropriate edges. | [
"Given",
"an",
"Nx3",
"array",
"of",
"vertices",
"that",
"constitute",
"a",
"single",
"path",
"generate",
"a",
"skeleton",
"with",
"appropriate",
"edges",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/skeletonservice.py#L63-L76 | train | 28,141 |
seung-lab/cloud-volume | cloudvolume/skeletonservice.py | PrecomputedSkeleton.simple_merge | def simple_merge(kls, skeletons):
"""
Simple concatenation of skeletons into one object
without adding edges between them.
"""
if len(skeletons) == 0:
return PrecomputedSkeleton()
if type(skeletons[0]) is np.ndarray:
skeletons = [ skeletons ]
ct = 0
edges = []
for skel... | python | def simple_merge(kls, skeletons):
"""
Simple concatenation of skeletons into one object
without adding edges between them.
"""
if len(skeletons) == 0:
return PrecomputedSkeleton()
if type(skeletons[0]) is np.ndarray:
skeletons = [ skeletons ]
ct = 0
edges = []
for skel... | [
"def",
"simple_merge",
"(",
"kls",
",",
"skeletons",
")",
":",
"if",
"len",
"(",
"skeletons",
")",
"==",
"0",
":",
"return",
"PrecomputedSkeleton",
"(",
")",
"if",
"type",
"(",
"skeletons",
"[",
"0",
"]",
")",
"is",
"np",
".",
"ndarray",
":",
"skelet... | Simple concatenation of skeletons into one object
without adding edges between them. | [
"Simple",
"concatenation",
"of",
"skeletons",
"into",
"one",
"object",
"without",
"adding",
"edges",
"between",
"them",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/skeletonservice.py#L79-L103 | train | 28,142 |
seung-lab/cloud-volume | cloudvolume/skeletonservice.py | PrecomputedSkeleton.decode | def decode(kls, skelbuf, segid=None):
"""
Convert a buffer into a PrecomputedSkeleton object.
Format:
num vertices (Nv) (uint32)
num edges (Ne) (uint32)
XYZ x Nv (float32)
edge x Ne (2x uint32)
radii x Nv (optional, float32)
vertex_type x Nv (optional, req radii, uint8) (SWC definit... | python | def decode(kls, skelbuf, segid=None):
"""
Convert a buffer into a PrecomputedSkeleton object.
Format:
num vertices (Nv) (uint32)
num edges (Ne) (uint32)
XYZ x Nv (float32)
edge x Ne (2x uint32)
radii x Nv (optional, float32)
vertex_type x Nv (optional, req radii, uint8) (SWC definit... | [
"def",
"decode",
"(",
"kls",
",",
"skelbuf",
",",
"segid",
"=",
"None",
")",
":",
"if",
"len",
"(",
"skelbuf",
")",
"<",
"8",
":",
"raise",
"SkeletonDecodeError",
"(",
"\"{} bytes is fewer than needed to specify the number of verices and edges.\"",
".",
"format",
... | Convert a buffer into a PrecomputedSkeleton object.
Format:
num vertices (Nv) (uint32)
num edges (Ne) (uint32)
XYZ x Nv (float32)
edge x Ne (2x uint32)
radii x Nv (optional, float32)
vertex_type x Nv (optional, req radii, uint8) (SWC definition)
More documentation:
https://github.... | [
"Convert",
"a",
"buffer",
"into",
"a",
"PrecomputedSkeleton",
"object",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/skeletonservice.py#L142-L210 | train | 28,143 |
seung-lab/cloud-volume | cloudvolume/skeletonservice.py | PrecomputedSkeleton.equivalent | def equivalent(kls, first, second):
"""
Tests that two skeletons are the same in form not merely that
their array contents are exactly the same. This test can be
made more sophisticated.
"""
if first.empty() and second.empty():
return True
elif first.vertices.shape[0] != second.vertic... | python | def equivalent(kls, first, second):
"""
Tests that two skeletons are the same in form not merely that
their array contents are exactly the same. This test can be
made more sophisticated.
"""
if first.empty() and second.empty():
return True
elif first.vertices.shape[0] != second.vertic... | [
"def",
"equivalent",
"(",
"kls",
",",
"first",
",",
"second",
")",
":",
"if",
"first",
".",
"empty",
"(",
")",
"and",
"second",
".",
"empty",
"(",
")",
":",
"return",
"True",
"elif",
"first",
".",
"vertices",
".",
"shape",
"[",
"0",
"]",
"!=",
"s... | Tests that two skeletons are the same in form not merely that
their array contents are exactly the same. This test can be
made more sophisticated. | [
"Tests",
"that",
"two",
"skeletons",
"are",
"the",
"same",
"in",
"form",
"not",
"merely",
"that",
"their",
"array",
"contents",
"are",
"exactly",
"the",
"same",
".",
"This",
"test",
"can",
"be",
"made",
"more",
"sophisticated",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/skeletonservice.py#L213-L264 | train | 28,144 |
seung-lab/cloud-volume | cloudvolume/skeletonservice.py | PrecomputedSkeleton.crop | def crop(self, bbox):
"""
Crop away all vertices and edges that lie outside of the given bbox.
The edge counts as inside.
Returns: new PrecomputedSkeleton
"""
skeleton = self.clone()
bbox = Bbox.create(bbox)
if skeleton.empty():
return skeleton
nodes_valid_mask = np.array(
... | python | def crop(self, bbox):
"""
Crop away all vertices and edges that lie outside of the given bbox.
The edge counts as inside.
Returns: new PrecomputedSkeleton
"""
skeleton = self.clone()
bbox = Bbox.create(bbox)
if skeleton.empty():
return skeleton
nodes_valid_mask = np.array(
... | [
"def",
"crop",
"(",
"self",
",",
"bbox",
")",
":",
"skeleton",
"=",
"self",
".",
"clone",
"(",
")",
"bbox",
"=",
"Bbox",
".",
"create",
"(",
"bbox",
")",
"if",
"skeleton",
".",
"empty",
"(",
")",
":",
"return",
"skeleton",
"nodes_valid_mask",
"=",
... | Crop away all vertices and edges that lie outside of the given bbox.
The edge counts as inside.
Returns: new PrecomputedSkeleton | [
"Crop",
"away",
"all",
"vertices",
"and",
"edges",
"that",
"lie",
"outside",
"of",
"the",
"given",
"bbox",
".",
"The",
"edge",
"counts",
"as",
"inside",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/skeletonservice.py#L266-L295 | train | 28,145 |
seung-lab/cloud-volume | cloudvolume/skeletonservice.py | PrecomputedSkeleton.consolidate | def consolidate(self):
"""
Remove duplicate vertices and edges from this skeleton without
side effects.
Returns: new consolidated PrecomputedSkeleton
"""
nodes = self.vertices
edges = self.edges
radii = self.radii
vertex_types = self.vertex_types
if self.empty():
return... | python | def consolidate(self):
"""
Remove duplicate vertices and edges from this skeleton without
side effects.
Returns: new consolidated PrecomputedSkeleton
"""
nodes = self.vertices
edges = self.edges
radii = self.radii
vertex_types = self.vertex_types
if self.empty():
return... | [
"def",
"consolidate",
"(",
"self",
")",
":",
"nodes",
"=",
"self",
".",
"vertices",
"edges",
"=",
"self",
".",
"edges",
"radii",
"=",
"self",
".",
"radii",
"vertex_types",
"=",
"self",
".",
"vertex_types",
"if",
"self",
".",
"empty",
"(",
")",
":",
"... | Remove duplicate vertices and edges from this skeleton without
side effects.
Returns: new consolidated PrecomputedSkeleton | [
"Remove",
"duplicate",
"vertices",
"and",
"edges",
"from",
"this",
"skeleton",
"without",
"side",
"effects",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/skeletonservice.py#L297-L329 | train | 28,146 |
seung-lab/cloud-volume | cloudvolume/skeletonservice.py | PrecomputedSkeleton.downsample | def downsample(self, factor):
"""
Compute a downsampled version of the skeleton by striding while
preserving endpoints.
factor: stride length for downsampling the saved skeleton paths.
Returns: downsampled PrecomputedSkeleton
"""
if int(factor) != factor or factor < 1:
raise ValueEr... | python | def downsample(self, factor):
"""
Compute a downsampled version of the skeleton by striding while
preserving endpoints.
factor: stride length for downsampling the saved skeleton paths.
Returns: downsampled PrecomputedSkeleton
"""
if int(factor) != factor or factor < 1:
raise ValueEr... | [
"def",
"downsample",
"(",
"self",
",",
"factor",
")",
":",
"if",
"int",
"(",
"factor",
")",
"!=",
"factor",
"or",
"factor",
"<",
"1",
":",
"raise",
"ValueError",
"(",
"\"Argument `factor` must be a positive integer greater than or equal to 1. Got: <{}>({})\"",
",",
... | Compute a downsampled version of the skeleton by striding while
preserving endpoints.
factor: stride length for downsampling the saved skeleton paths.
Returns: downsampled PrecomputedSkeleton | [
"Compute",
"a",
"downsampled",
"version",
"of",
"the",
"skeleton",
"by",
"striding",
"while",
"preserving",
"endpoints",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/skeletonservice.py#L354-L389 | train | 28,147 |
seung-lab/cloud-volume | cloudvolume/skeletonservice.py | PrecomputedSkeleton._single_tree_paths | def _single_tree_paths(self, tree):
"""Get all traversal paths from a single tree."""
skel = tree.consolidate()
tree = defaultdict(list)
for edge in skel.edges:
svert = edge[0]
evert = edge[1]
tree[svert].append(evert)
tree[evert].append(svert)
def dfs(path, visited):
... | python | def _single_tree_paths(self, tree):
"""Get all traversal paths from a single tree."""
skel = tree.consolidate()
tree = defaultdict(list)
for edge in skel.edges:
svert = edge[0]
evert = edge[1]
tree[svert].append(evert)
tree[evert].append(svert)
def dfs(path, visited):
... | [
"def",
"_single_tree_paths",
"(",
"self",
",",
"tree",
")",
":",
"skel",
"=",
"tree",
".",
"consolidate",
"(",
")",
"tree",
"=",
"defaultdict",
"(",
"list",
")",
"for",
"edge",
"in",
"skel",
".",
"edges",
":",
"svert",
"=",
"edge",
"[",
"0",
"]",
"... | Get all traversal paths from a single tree. | [
"Get",
"all",
"traversal",
"paths",
"from",
"a",
"single",
"tree",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/skeletonservice.py#L391-L435 | train | 28,148 |
seung-lab/cloud-volume | cloudvolume/skeletonservice.py | PrecomputedSkeleton.paths | def paths(self):
"""
Assuming the skeleton is structured as a single tree, return a
list of all traversal paths across all components. For each component,
start from the first vertex, find the most distant vertex by
hops and set that as the root. Then use depth first traversal
to produce pat... | python | def paths(self):
"""
Assuming the skeleton is structured as a single tree, return a
list of all traversal paths across all components. For each component,
start from the first vertex, find the most distant vertex by
hops and set that as the root. Then use depth first traversal
to produce pat... | [
"def",
"paths",
"(",
"self",
")",
":",
"paths",
"=",
"[",
"]",
"for",
"tree",
"in",
"self",
".",
"components",
"(",
")",
":",
"paths",
"+=",
"self",
".",
"_single_tree_paths",
"(",
"tree",
")",
"return",
"paths"
] | Assuming the skeleton is structured as a single tree, return a
list of all traversal paths across all components. For each component,
start from the first vertex, find the most distant vertex by
hops and set that as the root. Then use depth first traversal
to produce paths.
Returns: [ [(x,y,z),... | [
"Assuming",
"the",
"skeleton",
"is",
"structured",
"as",
"a",
"single",
"tree",
"return",
"a",
"list",
"of",
"all",
"traversal",
"paths",
"across",
"all",
"components",
".",
"For",
"each",
"component",
"start",
"from",
"the",
"first",
"vertex",
"find",
"the"... | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/skeletonservice.py#L437-L450 | train | 28,149 |
seung-lab/cloud-volume | cloudvolume/skeletonservice.py | PrecomputedSkeleton.interjoint_paths | def interjoint_paths(self):
"""
Returns paths between the adjacent critical points
in the skeleton, where a critical point is the set of
terminal and branch points.
"""
paths = []
for tree in self.components():
subpaths = self._single_tree_interjoint_paths(tree)
paths.extend(subp... | python | def interjoint_paths(self):
"""
Returns paths between the adjacent critical points
in the skeleton, where a critical point is the set of
terminal and branch points.
"""
paths = []
for tree in self.components():
subpaths = self._single_tree_interjoint_paths(tree)
paths.extend(subp... | [
"def",
"interjoint_paths",
"(",
"self",
")",
":",
"paths",
"=",
"[",
"]",
"for",
"tree",
"in",
"self",
".",
"components",
"(",
")",
":",
"subpaths",
"=",
"self",
".",
"_single_tree_interjoint_paths",
"(",
"tree",
")",
"paths",
".",
"extend",
"(",
"subpat... | Returns paths between the adjacent critical points
in the skeleton, where a critical point is the set of
terminal and branch points. | [
"Returns",
"paths",
"between",
"the",
"adjacent",
"critical",
"points",
"in",
"the",
"skeleton",
"where",
"a",
"critical",
"point",
"is",
"the",
"set",
"of",
"terminal",
"and",
"branch",
"points",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/skeletonservice.py#L506-L517 | train | 28,150 |
seung-lab/cloud-volume | cloudvolume/skeletonservice.py | PrecomputedSkeleton.components | def components(self):
"""
Extract connected components from graph.
Useful for ensuring that you're working with a single tree.
Returns: [ PrecomputedSkeleton, PrecomputedSkeleton, ... ]
"""
skel, forest = self._compute_components()
if len(forest) == 0:
return []
elif len(forest)... | python | def components(self):
"""
Extract connected components from graph.
Useful for ensuring that you're working with a single tree.
Returns: [ PrecomputedSkeleton, PrecomputedSkeleton, ... ]
"""
skel, forest = self._compute_components()
if len(forest) == 0:
return []
elif len(forest)... | [
"def",
"components",
"(",
"self",
")",
":",
"skel",
",",
"forest",
"=",
"self",
".",
"_compute_components",
"(",
")",
"if",
"len",
"(",
"forest",
")",
"==",
"0",
":",
"return",
"[",
"]",
"elif",
"len",
"(",
"forest",
")",
"==",
"1",
":",
"return",
... | Extract connected components from graph.
Useful for ensuring that you're working with a single tree.
Returns: [ PrecomputedSkeleton, PrecomputedSkeleton, ... ] | [
"Extract",
"connected",
"components",
"from",
"graph",
".",
"Useful",
"for",
"ensuring",
"that",
"you",
"re",
"working",
"with",
"a",
"single",
"tree",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/skeletonservice.py#L566-L600 | train | 28,151 |
seung-lab/cloud-volume | cloudvolume/skeletonservice.py | PrecomputedSkeletonService.get | def get(self, segids):
"""
Retrieve one or more skeletons from the data layer.
Example:
skel = vol.skeleton.get(5)
skels = vol.skeleton.get([1, 2, 3])
Raises SkeletonDecodeError on missing files or decoding errors.
Required:
segids: list of integers or integer
Returns:
... | python | def get(self, segids):
"""
Retrieve one or more skeletons from the data layer.
Example:
skel = vol.skeleton.get(5)
skels = vol.skeleton.get([1, 2, 3])
Raises SkeletonDecodeError on missing files or decoding errors.
Required:
segids: list of integers or integer
Returns:
... | [
"def",
"get",
"(",
"self",
",",
"segids",
")",
":",
"list_return",
"=",
"True",
"if",
"type",
"(",
"segids",
")",
"in",
"(",
"int",
",",
"float",
")",
":",
"list_return",
"=",
"False",
"segids",
"=",
"[",
"int",
"(",
"segids",
")",
"]",
"paths",
... | Retrieve one or more skeletons from the data layer.
Example:
skel = vol.skeleton.get(5)
skels = vol.skeleton.get([1, 2, 3])
Raises SkeletonDecodeError on missing files or decoding errors.
Required:
segids: list of integers or integer
Returns:
if segids is a list, returns li... | [
"Retrieve",
"one",
"or",
"more",
"skeletons",
"from",
"the",
"data",
"layer",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/skeletonservice.py#L735-L787 | train | 28,152 |
seung-lab/cloud-volume | cloudvolume/threaded_queue.py | ThreadedQueue.put | def put(self, fn):
"""
Enqueue a task function for processing.
Requires:
fn: a function object that takes one argument
that is the interface associated with each
thread.
e.g. def download(api):
results.append(api.download())
self.put(download)
... | python | def put(self, fn):
"""
Enqueue a task function for processing.
Requires:
fn: a function object that takes one argument
that is the interface associated with each
thread.
e.g. def download(api):
results.append(api.download())
self.put(download)
... | [
"def",
"put",
"(",
"self",
",",
"fn",
")",
":",
"self",
".",
"_inserted",
"+=",
"1",
"self",
".",
"_queue",
".",
"put",
"(",
"fn",
",",
"block",
"=",
"True",
")",
"return",
"self"
] | Enqueue a task function for processing.
Requires:
fn: a function object that takes one argument
that is the interface associated with each
thread.
e.g. def download(api):
results.append(api.download())
self.put(download)
Returns: self | [
"Enqueue",
"a",
"task",
"function",
"for",
"processing",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/threaded_queue.py#L33-L51 | train | 28,153 |
seung-lab/cloud-volume | cloudvolume/threaded_queue.py | ThreadedQueue.start_threads | def start_threads(self, n_threads):
"""
Terminate existing threads and create a
new set if the thread number doesn't match
the desired number.
Required:
n_threads: (int) number of threads to spawn
Returns: self
"""
if n_threads == len(self._threads):
return self
... | python | def start_threads(self, n_threads):
"""
Terminate existing threads and create a
new set if the thread number doesn't match
the desired number.
Required:
n_threads: (int) number of threads to spawn
Returns: self
"""
if n_threads == len(self._threads):
return self
... | [
"def",
"start_threads",
"(",
"self",
",",
"n_threads",
")",
":",
"if",
"n_threads",
"==",
"len",
"(",
"self",
".",
"_threads",
")",
":",
"return",
"self",
"# Terminate all previous tasks with the existing",
"# event object, then create a new one for the next",
"# generati... | Terminate existing threads and create a
new set if the thread number doesn't match
the desired number.
Required:
n_threads: (int) number of threads to spawn
Returns: self | [
"Terminate",
"existing",
"threads",
"and",
"create",
"a",
"new",
"set",
"if",
"the",
"thread",
"number",
"doesn",
"t",
"match",
"the",
"desired",
"number",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/threaded_queue.py#L53-L87 | train | 28,154 |
seung-lab/cloud-volume | cloudvolume/threaded_queue.py | ThreadedQueue.kill_threads | def kill_threads(self):
"""Kill all threads."""
self._terminate.set()
while self.are_threads_alive():
time.sleep(0.001)
self._threads = ()
return self | python | def kill_threads(self):
"""Kill all threads."""
self._terminate.set()
while self.are_threads_alive():
time.sleep(0.001)
self._threads = ()
return self | [
"def",
"kill_threads",
"(",
"self",
")",
":",
"self",
".",
"_terminate",
".",
"set",
"(",
")",
"while",
"self",
".",
"are_threads_alive",
"(",
")",
":",
"time",
".",
"sleep",
"(",
"0.001",
")",
"self",
".",
"_threads",
"=",
"(",
")",
"return",
"self"... | Kill all threads. | [
"Kill",
"all",
"threads",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/threaded_queue.py#L93-L99 | train | 28,155 |
seung-lab/cloud-volume | cloudvolume/threaded_queue.py | ThreadedQueue.wait | def wait(self, progress=None):
"""
Allow background threads to process until the
task queue is empty. If there are no threads,
in theory the queue should always be empty
as processing happens immediately on the main thread.
Optional:
progress: (bool or str) show a tqdm progress bar option... | python | def wait(self, progress=None):
"""
Allow background threads to process until the
task queue is empty. If there are no threads,
in theory the queue should always be empty
as processing happens immediately on the main thread.
Optional:
progress: (bool or str) show a tqdm progress bar option... | [
"def",
"wait",
"(",
"self",
",",
"progress",
"=",
"None",
")",
":",
"if",
"not",
"len",
"(",
"self",
".",
"_threads",
")",
":",
"return",
"self",
"desc",
"=",
"None",
"if",
"type",
"(",
"progress",
")",
"is",
"str",
":",
"desc",
"=",
"progress",
... | Allow background threads to process until the
task queue is empty. If there are no threads,
in theory the queue should always be empty
as processing happens immediately on the main thread.
Optional:
progress: (bool or str) show a tqdm progress bar optionally
with a description if a string... | [
"Allow",
"background",
"threads",
"to",
"process",
"until",
"the",
"task",
"queue",
"is",
"empty",
".",
"If",
"there",
"are",
"no",
"threads",
"in",
"theory",
"the",
"queue",
"should",
"always",
"be",
"empty",
"as",
"processing",
"happens",
"immediately",
"o... | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/threaded_queue.py#L193-L241 | train | 28,156 |
seung-lab/cloud-volume | cloudvolume/storage.py | _radix_sort | def _radix_sort(L, i=0):
"""
Most significant char radix sort
"""
if len(L) <= 1:
return L
done_bucket = []
buckets = [ [] for x in range(255) ]
for s in L:
if i >= len(s):
done_bucket.append(s)
else:
buckets[ ord(s[i]) ].append(s)
buckets = [ _radix_sort(b, i + 1) for b in buck... | python | def _radix_sort(L, i=0):
"""
Most significant char radix sort
"""
if len(L) <= 1:
return L
done_bucket = []
buckets = [ [] for x in range(255) ]
for s in L:
if i >= len(s):
done_bucket.append(s)
else:
buckets[ ord(s[i]) ].append(s)
buckets = [ _radix_sort(b, i + 1) for b in buck... | [
"def",
"_radix_sort",
"(",
"L",
",",
"i",
"=",
"0",
")",
":",
"if",
"len",
"(",
"L",
")",
"<=",
"1",
":",
"return",
"L",
"done_bucket",
"=",
"[",
"]",
"buckets",
"=",
"[",
"[",
"]",
"for",
"x",
"in",
"range",
"(",
"255",
")",
"]",
"for",
"s... | Most significant char radix sort | [
"Most",
"significant",
"char",
"radix",
"sort"
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/storage.py#L818-L832 | train | 28,157 |
seung-lab/cloud-volume | cloudvolume/storage.py | Storage.files_exist | def files_exist(self, file_paths):
"""
Threaded exists for all file paths.
file_paths: (list) file paths to test for existence
Returns: { filepath: bool }
"""
results = {}
def exist_thunk(paths, interface):
results.update(interface.files_exist(paths))
if len(self._threads):
... | python | def files_exist(self, file_paths):
"""
Threaded exists for all file paths.
file_paths: (list) file paths to test for existence
Returns: { filepath: bool }
"""
results = {}
def exist_thunk(paths, interface):
results.update(interface.files_exist(paths))
if len(self._threads):
... | [
"def",
"files_exist",
"(",
"self",
",",
"file_paths",
")",
":",
"results",
"=",
"{",
"}",
"def",
"exist_thunk",
"(",
"paths",
",",
"interface",
")",
":",
"results",
".",
"update",
"(",
"interface",
".",
"files_exist",
"(",
"paths",
")",
")",
"if",
"len... | Threaded exists for all file paths.
file_paths: (list) file paths to test for existence
Returns: { filepath: bool } | [
"Threaded",
"exists",
"for",
"all",
"file",
"paths",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/storage.py#L317-L339 | train | 28,158 |
seung-lab/cloud-volume | cloudvolume/storage.py | Storage.get_files | def get_files(self, file_paths):
"""
returns a list of files faster by using threads
"""
results = []
def get_file_thunk(path, interface):
result = error = None
try:
result = interface.get_file(path)
except Exception as err:
error = err
# important to pr... | python | def get_files(self, file_paths):
"""
returns a list of files faster by using threads
"""
results = []
def get_file_thunk(path, interface):
result = error = None
try:
result = interface.get_file(path)
except Exception as err:
error = err
# important to pr... | [
"def",
"get_files",
"(",
"self",
",",
"file_paths",
")",
":",
"results",
"=",
"[",
"]",
"def",
"get_file_thunk",
"(",
"path",
",",
"interface",
")",
":",
"result",
"=",
"error",
"=",
"None",
"try",
":",
"result",
"=",
"interface",
".",
"get_file",
"(",... | returns a list of files faster by using threads | [
"returns",
"a",
"list",
"of",
"files",
"faster",
"by",
"using",
"threads"
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/storage.py#L352-L388 | train | 28,159 |
seung-lab/cloud-volume | cloudvolume/storage.py | S3Interface.get_file | def get_file(self, file_path):
"""
There are many types of execptions which can get raised
from this method. We want to make sure we only return
None when the file doesn't exist.
"""
try:
resp = self._conn.get_object(
Bucket=self._path.bucket,
Key=self.get_path_to_fi... | python | def get_file(self, file_path):
"""
There are many types of execptions which can get raised
from this method. We want to make sure we only return
None when the file doesn't exist.
"""
try:
resp = self._conn.get_object(
Bucket=self._path.bucket,
Key=self.get_path_to_fi... | [
"def",
"get_file",
"(",
"self",
",",
"file_path",
")",
":",
"try",
":",
"resp",
"=",
"self",
".",
"_conn",
".",
"get_object",
"(",
"Bucket",
"=",
"self",
".",
"_path",
".",
"bucket",
",",
"Key",
"=",
"self",
".",
"get_path_to_file",
"(",
"file_path",
... | There are many types of execptions which can get raised
from this method. We want to make sure we only return
None when the file doesn't exist. | [
"There",
"are",
"many",
"types",
"of",
"execptions",
"which",
"can",
"get",
"raised",
"from",
"this",
"method",
".",
"We",
"want",
"to",
"make",
"sure",
"we",
"only",
"return",
"None",
"when",
"the",
"file",
"doesn",
"t",
"exist",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/storage.py#L716-L738 | train | 28,160 |
seung-lab/cloud-volume | cloudvolume/cloudvolume.py | CloudVolume.init_submodules | def init_submodules(self, cache):
"""cache = path or bool"""
self.cache = CacheService(cache, weakref.proxy(self))
self.mesh = PrecomputedMeshService(weakref.proxy(self))
self.skeleton = PrecomputedSkeletonService(weakref.proxy(self)) | python | def init_submodules(self, cache):
"""cache = path or bool"""
self.cache = CacheService(cache, weakref.proxy(self))
self.mesh = PrecomputedMeshService(weakref.proxy(self))
self.skeleton = PrecomputedSkeletonService(weakref.proxy(self)) | [
"def",
"init_submodules",
"(",
"self",
",",
"cache",
")",
":",
"self",
".",
"cache",
"=",
"CacheService",
"(",
"cache",
",",
"weakref",
".",
"proxy",
"(",
"self",
")",
")",
"self",
".",
"mesh",
"=",
"PrecomputedMeshService",
"(",
"weakref",
".",
"proxy",... | cache = path or bool | [
"cache",
"=",
"path",
"or",
"bool"
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/cloudvolume.py#L239-L243 | train | 28,161 |
seung-lab/cloud-volume | cloudvolume/cloudvolume.py | CloudVolume.create_new_info | def create_new_info(cls,
num_channels, layer_type, data_type, encoding,
resolution, voxel_offset, volume_size,
mesh=None, skeletons=None, chunk_size=(64,64,64),
compressed_segmentation_block_size=(8,8,8),
max_mip=0, factor=Vec(2,2,1)
):
"""
Used for creating new neuroglancer info files... | python | def create_new_info(cls,
num_channels, layer_type, data_type, encoding,
resolution, voxel_offset, volume_size,
mesh=None, skeletons=None, chunk_size=(64,64,64),
compressed_segmentation_block_size=(8,8,8),
max_mip=0, factor=Vec(2,2,1)
):
"""
Used for creating new neuroglancer info files... | [
"def",
"create_new_info",
"(",
"cls",
",",
"num_channels",
",",
"layer_type",
",",
"data_type",
",",
"encoding",
",",
"resolution",
",",
"voxel_offset",
",",
"volume_size",
",",
"mesh",
"=",
"None",
",",
"skeletons",
"=",
"None",
",",
"chunk_size",
"=",
"(",... | Used for creating new neuroglancer info files.
Required:
num_channels: (int) 1 for grayscale, 3 for RGB
layer_type: (str) typically "image" or "segmentation"
data_type: (str) e.g. "uint8", "uint16", "uint32", "float32"
encoding: (str) "raw" for binaries like numpy arrays, "jpeg"
reso... | [
"Used",
"for",
"creating",
"new",
"neuroglancer",
"info",
"files",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/cloudvolume.py#L266-L342 | train | 28,162 |
seung-lab/cloud-volume | cloudvolume/cloudvolume.py | CloudVolume.bbox_to_mip | def bbox_to_mip(self, bbox, mip, to_mip):
"""Convert bbox or slices from one mip level to another."""
if not type(bbox) is Bbox:
bbox = lib.generate_slices(
bbox,
self.mip_bounds(mip).minpt,
self.mip_bounds(mip).maxpt,
bounded=False
)
bbox = Bbox.from_slices(... | python | def bbox_to_mip(self, bbox, mip, to_mip):
"""Convert bbox or slices from one mip level to another."""
if not type(bbox) is Bbox:
bbox = lib.generate_slices(
bbox,
self.mip_bounds(mip).minpt,
self.mip_bounds(mip).maxpt,
bounded=False
)
bbox = Bbox.from_slices(... | [
"def",
"bbox_to_mip",
"(",
"self",
",",
"bbox",
",",
"mip",
",",
"to_mip",
")",
":",
"if",
"not",
"type",
"(",
"bbox",
")",
"is",
"Bbox",
":",
"bbox",
"=",
"lib",
".",
"generate_slices",
"(",
"bbox",
",",
"self",
".",
"mip_bounds",
"(",
"mip",
")",... | Convert bbox or slices from one mip level to another. | [
"Convert",
"bbox",
"or",
"slices",
"from",
"one",
"mip",
"level",
"to",
"another",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/cloudvolume.py#L743-L770 | train | 28,163 |
seung-lab/cloud-volume | cloudvolume/cloudvolume.py | CloudVolume.slices_to_global_coords | def slices_to_global_coords(self, slices):
"""
Used to convert from a higher mip level into mip 0 resolution.
"""
bbox = self.bbox_to_mip(slices, self.mip, 0)
return bbox.to_slices() | python | def slices_to_global_coords(self, slices):
"""
Used to convert from a higher mip level into mip 0 resolution.
"""
bbox = self.bbox_to_mip(slices, self.mip, 0)
return bbox.to_slices() | [
"def",
"slices_to_global_coords",
"(",
"self",
",",
"slices",
")",
":",
"bbox",
"=",
"self",
".",
"bbox_to_mip",
"(",
"slices",
",",
"self",
".",
"mip",
",",
"0",
")",
"return",
"bbox",
".",
"to_slices",
"(",
")"
] | Used to convert from a higher mip level into mip 0 resolution. | [
"Used",
"to",
"convert",
"from",
"a",
"higher",
"mip",
"level",
"into",
"mip",
"0",
"resolution",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/cloudvolume.py#L772-L777 | train | 28,164 |
seung-lab/cloud-volume | cloudvolume/cloudvolume.py | CloudVolume.slices_from_global_coords | def slices_from_global_coords(self, slices):
"""
Used for converting from mip 0 coordinates to upper mip level
coordinates. This is mainly useful for debugging since the neuroglancer
client displays the mip 0 coordinates for your cursor.
"""
bbox = self.bbox_to_mip(slices, 0, self.mip)
retur... | python | def slices_from_global_coords(self, slices):
"""
Used for converting from mip 0 coordinates to upper mip level
coordinates. This is mainly useful for debugging since the neuroglancer
client displays the mip 0 coordinates for your cursor.
"""
bbox = self.bbox_to_mip(slices, 0, self.mip)
retur... | [
"def",
"slices_from_global_coords",
"(",
"self",
",",
"slices",
")",
":",
"bbox",
"=",
"self",
".",
"bbox_to_mip",
"(",
"slices",
",",
"0",
",",
"self",
".",
"mip",
")",
"return",
"bbox",
".",
"to_slices",
"(",
")"
] | Used for converting from mip 0 coordinates to upper mip level
coordinates. This is mainly useful for debugging since the neuroglancer
client displays the mip 0 coordinates for your cursor. | [
"Used",
"for",
"converting",
"from",
"mip",
"0",
"coordinates",
"to",
"upper",
"mip",
"level",
"coordinates",
".",
"This",
"is",
"mainly",
"useful",
"for",
"debugging",
"since",
"the",
"neuroglancer",
"client",
"displays",
"the",
"mip",
"0",
"coordinates",
"fo... | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/cloudvolume.py#L779-L786 | train | 28,165 |
seung-lab/cloud-volume | cloudvolume/cloudvolume.py | CloudVolume.__realized_bbox | def __realized_bbox(self, requested_bbox):
"""
The requested bbox might not be aligned to the underlying chunk grid
or even outside the bounds of the dataset. Convert the request into
a bbox representing something that can be actually downloaded.
Returns: Bbox
"""
realized_bbox = requested... | python | def __realized_bbox(self, requested_bbox):
"""
The requested bbox might not be aligned to the underlying chunk grid
or even outside the bounds of the dataset. Convert the request into
a bbox representing something that can be actually downloaded.
Returns: Bbox
"""
realized_bbox = requested... | [
"def",
"__realized_bbox",
"(",
"self",
",",
"requested_bbox",
")",
":",
"realized_bbox",
"=",
"requested_bbox",
".",
"expand_to_chunk_size",
"(",
"self",
".",
"underlying",
",",
"offset",
"=",
"self",
".",
"voxel_offset",
")",
"return",
"Bbox",
".",
"clamp",
"... | The requested bbox might not be aligned to the underlying chunk grid
or even outside the bounds of the dataset. Convert the request into
a bbox representing something that can be actually downloaded.
Returns: Bbox | [
"The",
"requested",
"bbox",
"might",
"not",
"be",
"aligned",
"to",
"the",
"underlying",
"chunk",
"grid",
"or",
"even",
"outside",
"the",
"bounds",
"of",
"the",
"dataset",
".",
"Convert",
"the",
"request",
"into",
"a",
"bbox",
"representing",
"something",
"th... | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/cloudvolume.py#L880-L889 | train | 28,166 |
seung-lab/cloud-volume | cloudvolume/cloudvolume.py | CloudVolume.exists | def exists(self, bbox_or_slices):
"""
Produce a summary of whether all the requested chunks exist.
bbox_or_slices: accepts either a Bbox or a tuple of slices representing
the requested volume.
Returns: { chunk_file_name: boolean, ... }
"""
if type(bbox_or_slices) is Bbox:
requested... | python | def exists(self, bbox_or_slices):
"""
Produce a summary of whether all the requested chunks exist.
bbox_or_slices: accepts either a Bbox or a tuple of slices representing
the requested volume.
Returns: { chunk_file_name: boolean, ... }
"""
if type(bbox_or_slices) is Bbox:
requested... | [
"def",
"exists",
"(",
"self",
",",
"bbox_or_slices",
")",
":",
"if",
"type",
"(",
"bbox_or_slices",
")",
"is",
"Bbox",
":",
"requested_bbox",
"=",
"bbox_or_slices",
"else",
":",
"(",
"requested_bbox",
",",
"_",
",",
"_",
")",
"=",
"self",
".",
"__interpr... | Produce a summary of whether all the requested chunks exist.
bbox_or_slices: accepts either a Bbox or a tuple of slices representing
the requested volume.
Returns: { chunk_file_name: boolean, ... } | [
"Produce",
"a",
"summary",
"of",
"whether",
"all",
"the",
"requested",
"chunks",
"exist",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/cloudvolume.py#L891-L909 | train | 28,167 |
seung-lab/cloud-volume | cloudvolume/cloudvolume.py | CloudVolume.delete | def delete(self, bbox_or_slices):
"""
Delete the files within the bounding box.
bbox_or_slices: accepts either a Bbox or a tuple of slices representing
the requested volume.
"""
if type(bbox_or_slices) is Bbox:
requested_bbox = bbox_or_slices
else:
(requested_bbox, _, _) = se... | python | def delete(self, bbox_or_slices):
"""
Delete the files within the bounding box.
bbox_or_slices: accepts either a Bbox or a tuple of slices representing
the requested volume.
"""
if type(bbox_or_slices) is Bbox:
requested_bbox = bbox_or_slices
else:
(requested_bbox, _, _) = se... | [
"def",
"delete",
"(",
"self",
",",
"bbox_or_slices",
")",
":",
"if",
"type",
"(",
"bbox_or_slices",
")",
"is",
"Bbox",
":",
"requested_bbox",
"=",
"bbox_or_slices",
"else",
":",
"(",
"requested_bbox",
",",
"_",
",",
"_",
")",
"=",
"self",
".",
"__interpr... | Delete the files within the bounding box.
bbox_or_slices: accepts either a Bbox or a tuple of slices representing
the requested volume. | [
"Delete",
"the",
"files",
"within",
"the",
"bounding",
"box",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/cloudvolume.py#L911-L938 | train | 28,168 |
seung-lab/cloud-volume | cloudvolume/cloudvolume.py | CloudVolume.transfer_to | def transfer_to(self, cloudpath, bbox, block_size=None, compress=True):
"""
Transfer files from one storage location to another, bypassing
volume painting. This enables using a single CloudVolume instance
to transfer big volumes. In some cases, gsutil or aws s3 cli tools
may be more appropriate. Thi... | python | def transfer_to(self, cloudpath, bbox, block_size=None, compress=True):
"""
Transfer files from one storage location to another, bypassing
volume painting. This enables using a single CloudVolume instance
to transfer big volumes. In some cases, gsutil or aws s3 cli tools
may be more appropriate. Thi... | [
"def",
"transfer_to",
"(",
"self",
",",
"cloudpath",
",",
"bbox",
",",
"block_size",
"=",
"None",
",",
"compress",
"=",
"True",
")",
":",
"if",
"type",
"(",
"bbox",
")",
"is",
"Bbox",
":",
"requested_bbox",
"=",
"bbox",
"else",
":",
"(",
"requested_bbo... | Transfer files from one storage location to another, bypassing
volume painting. This enables using a single CloudVolume instance
to transfer big volumes. In some cases, gsutil or aws s3 cli tools
may be more appropriate. This method is provided for convenience. It
may be optimized for better performance... | [
"Transfer",
"files",
"from",
"one",
"storage",
"location",
"to",
"another",
"bypassing",
"volume",
"painting",
".",
"This",
"enables",
"using",
"a",
"single",
"CloudVolume",
"instance",
"to",
"transfer",
"big",
"volumes",
".",
"In",
"some",
"cases",
"gsutil",
... | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/cloudvolume.py#L940-L1019 | train | 28,169 |
seung-lab/cloud-volume | cloudvolume/cloudvolume.py | CloudVolume.download_point | def download_point(self, pt, size=256, mip=None):
"""
Download to the right of point given in mip 0 coords.
Useful for quickly visualizing a neuroglancer coordinate
at an arbitary mip level.
pt: (x,y,z)
size: int or (sx,sy,sz)
Return: image
"""
if isinstance(size, int):
size ... | python | def download_point(self, pt, size=256, mip=None):
"""
Download to the right of point given in mip 0 coords.
Useful for quickly visualizing a neuroglancer coordinate
at an arbitary mip level.
pt: (x,y,z)
size: int or (sx,sy,sz)
Return: image
"""
if isinstance(size, int):
size ... | [
"def",
"download_point",
"(",
"self",
",",
"pt",
",",
"size",
"=",
"256",
",",
"mip",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"size",
",",
"int",
")",
":",
"size",
"=",
"Vec",
"(",
"size",
",",
"size",
",",
"size",
")",
"else",
":",
"si... | Download to the right of point given in mip 0 coords.
Useful for quickly visualizing a neuroglancer coordinate
at an arbitary mip level.
pt: (x,y,z)
size: int or (sx,sy,sz)
Return: image | [
"Download",
"to",
"the",
"right",
"of",
"point",
"given",
"in",
"mip",
"0",
"coords",
".",
"Useful",
"for",
"quickly",
"visualizing",
"a",
"neuroglancer",
"coordinate",
"at",
"an",
"arbitary",
"mip",
"level",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/cloudvolume.py#L1035-L1063 | train | 28,170 |
seung-lab/cloud-volume | cloudvolume/cloudvolume.py | CloudVolume.download_to_shared_memory | def download_to_shared_memory(self, slices, location=None):
"""
Download images to a shared memory array.
https://github.com/seung-lab/cloud-volume/wiki/Advanced-Topic:-Shared-Memory
tip: If you want to use slice notation, np.s_[...] will help in a pinch.
MEMORY LIFECYCLE WARNING: You are respon... | python | def download_to_shared_memory(self, slices, location=None):
"""
Download images to a shared memory array.
https://github.com/seung-lab/cloud-volume/wiki/Advanced-Topic:-Shared-Memory
tip: If you want to use slice notation, np.s_[...] will help in a pinch.
MEMORY LIFECYCLE WARNING: You are respon... | [
"def",
"download_to_shared_memory",
"(",
"self",
",",
"slices",
",",
"location",
"=",
"None",
")",
":",
"if",
"self",
".",
"path",
".",
"protocol",
"==",
"'boss'",
":",
"raise",
"NotImplementedError",
"(",
"'BOSS protocol does not support shared memory download.'",
... | Download images to a shared memory array.
https://github.com/seung-lab/cloud-volume/wiki/Advanced-Topic:-Shared-Memory
tip: If you want to use slice notation, np.s_[...] will help in a pinch.
MEMORY LIFECYCLE WARNING: You are responsible for managing the lifecycle of the
shared memory. CloudVolum... | [
"Download",
"images",
"to",
"a",
"shared",
"memory",
"array",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/cloudvolume.py#L1065-L1109 | train | 28,171 |
seung-lab/cloud-volume | cloudvolume/meshservice.py | PrecomputedMeshService.get | def get(self, segids, remove_duplicate_vertices=True, fuse=True,
chunk_size=None):
"""
Merge fragments derived from these segids into a single vertex and face list.
Why merge multiple segids into one mesh? For example, if you have a set of
segids that belong to the same neuron.
segids: (... | python | def get(self, segids, remove_duplicate_vertices=True, fuse=True,
chunk_size=None):
"""
Merge fragments derived from these segids into a single vertex and face list.
Why merge multiple segids into one mesh? For example, if you have a set of
segids that belong to the same neuron.
segids: (... | [
"def",
"get",
"(",
"self",
",",
"segids",
",",
"remove_duplicate_vertices",
"=",
"True",
",",
"fuse",
"=",
"True",
",",
"chunk_size",
"=",
"None",
")",
":",
"segids",
"=",
"toiter",
"(",
"segids",
")",
"dne",
"=",
"self",
".",
"_check_missing_manifests",
... | Merge fragments derived from these segids into a single vertex and face list.
Why merge multiple segids into one mesh? For example, if you have a set of
segids that belong to the same neuron.
segids: (iterable or int) segids to render into a single mesh
Optional:
remove_duplicate_vertices: bool... | [
"Merge",
"fragments",
"derived",
"from",
"these",
"segids",
"into",
"a",
"single",
"vertex",
"and",
"face",
"list",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/meshservice.py#L92-L166 | train | 28,172 |
seung-lab/cloud-volume | cloudvolume/meshservice.py | PrecomputedMeshService._check_missing_manifests | def _check_missing_manifests(self, segids):
"""Check if there are any missing mesh manifests prior to downloading."""
manifest_paths = [ self._manifest_path(segid) for segid in segids ]
with Storage(self.vol.layer_cloudpath, progress=self.vol.progress) as stor:
exists = stor.files_exist(manifest_paths... | python | def _check_missing_manifests(self, segids):
"""Check if there are any missing mesh manifests prior to downloading."""
manifest_paths = [ self._manifest_path(segid) for segid in segids ]
with Storage(self.vol.layer_cloudpath, progress=self.vol.progress) as stor:
exists = stor.files_exist(manifest_paths... | [
"def",
"_check_missing_manifests",
"(",
"self",
",",
"segids",
")",
":",
"manifest_paths",
"=",
"[",
"self",
".",
"_manifest_path",
"(",
"segid",
")",
"for",
"segid",
"in",
"segids",
"]",
"with",
"Storage",
"(",
"self",
".",
"vol",
".",
"layer_cloudpath",
... | Check if there are any missing mesh manifests prior to downloading. | [
"Check",
"if",
"there",
"are",
"any",
"missing",
"mesh",
"manifests",
"prior",
"to",
"downloading",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/meshservice.py#L168-L179 | train | 28,173 |
seung-lab/cloud-volume | cloudvolume/meshservice.py | PrecomputedMeshService.save | def save(self, segids, filepath=None, file_format='ply'):
"""
Save one or more segids into a common mesh format as a single file.
segids: int, string, or list thereof
filepath: string or None (optional)
file_format: string (optional)
Supported Formats: 'obj', 'ply'
"""
if type(segids) ... | python | def save(self, segids, filepath=None, file_format='ply'):
"""
Save one or more segids into a common mesh format as a single file.
segids: int, string, or list thereof
filepath: string or None (optional)
file_format: string (optional)
Supported Formats: 'obj', 'ply'
"""
if type(segids) ... | [
"def",
"save",
"(",
"self",
",",
"segids",
",",
"filepath",
"=",
"None",
",",
"file_format",
"=",
"'ply'",
")",
":",
"if",
"type",
"(",
"segids",
")",
"!=",
"list",
":",
"segids",
"=",
"[",
"segids",
"]",
"meshdata",
"=",
"self",
".",
"get",
"(",
... | Save one or more segids into a common mesh format as a single file.
segids: int, string, or list thereof
filepath: string or None (optional)
file_format: string (optional)
Supported Formats: 'obj', 'ply' | [
"Save",
"one",
"or",
"more",
"segids",
"into",
"a",
"common",
"mesh",
"format",
"as",
"a",
"single",
"file",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/meshservice.py#L181-L211 | train | 28,174 |
seung-lab/cloud-volume | cloudvolume/py_compressed_segmentation.py | pad_block | def pad_block(block, block_size):
"""Pad a block to block_size with its most frequent value"""
unique_vals, unique_counts = np.unique(block, return_counts=True)
most_frequent_value = unique_vals[np.argmax(unique_counts)]
return np.pad(block,
tuple((0, desired_size - actual_size)
... | python | def pad_block(block, block_size):
"""Pad a block to block_size with its most frequent value"""
unique_vals, unique_counts = np.unique(block, return_counts=True)
most_frequent_value = unique_vals[np.argmax(unique_counts)]
return np.pad(block,
tuple((0, desired_size - actual_size)
... | [
"def",
"pad_block",
"(",
"block",
",",
"block_size",
")",
":",
"unique_vals",
",",
"unique_counts",
"=",
"np",
".",
"unique",
"(",
"block",
",",
"return_counts",
"=",
"True",
")",
"most_frequent_value",
"=",
"unique_vals",
"[",
"np",
".",
"argmax",
"(",
"u... | Pad a block to block_size with its most frequent value | [
"Pad",
"a",
"block",
"to",
"block_size",
"with",
"its",
"most",
"frequent",
"value"
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/py_compressed_segmentation.py#L25-L33 | train | 28,175 |
seung-lab/cloud-volume | cloudvolume/lib.py | find_closest_divisor | def find_closest_divisor(to_divide, closest_to):
"""
This is used to find the right chunk size for
importing a neuroglancer dataset that has a
chunk import size that's not evenly divisible by
64,64,64.
e.g.
neuroglancer_chunk_size = find_closest_divisor(build_chunk_size, closest_to=[64,64,64])
Req... | python | def find_closest_divisor(to_divide, closest_to):
"""
This is used to find the right chunk size for
importing a neuroglancer dataset that has a
chunk import size that's not evenly divisible by
64,64,64.
e.g.
neuroglancer_chunk_size = find_closest_divisor(build_chunk_size, closest_to=[64,64,64])
Req... | [
"def",
"find_closest_divisor",
"(",
"to_divide",
",",
"closest_to",
")",
":",
"def",
"find_closest",
"(",
"td",
",",
"ct",
")",
":",
"min_distance",
"=",
"td",
"best",
"=",
"td",
"for",
"divisor",
"in",
"divisors",
"(",
"td",
")",
":",
"if",
"abs",
"("... | This is used to find the right chunk size for
importing a neuroglancer dataset that has a
chunk import size that's not evenly divisible by
64,64,64.
e.g.
neuroglancer_chunk_size = find_closest_divisor(build_chunk_size, closest_to=[64,64,64])
Required:
to_divide: (tuple) x,y,z chunk size to rechunk... | [
"This",
"is",
"used",
"to",
"find",
"the",
"right",
"chunk",
"size",
"for",
"importing",
"a",
"neuroglancer",
"dataset",
"that",
"has",
"a",
"chunk",
"import",
"size",
"that",
"s",
"not",
"evenly",
"divisible",
"by",
"64",
"64",
"64",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/lib.py#L178-L204 | train | 28,176 |
seung-lab/cloud-volume | cloudvolume/lib.py | divisors | def divisors(n):
"""Generate the divisors of n"""
for i in range(1, int(math.sqrt(n) + 1)):
if n % i == 0:
yield i
if i*i != n:
yield n / i | python | def divisors(n):
"""Generate the divisors of n"""
for i in range(1, int(math.sqrt(n) + 1)):
if n % i == 0:
yield i
if i*i != n:
yield n / i | [
"def",
"divisors",
"(",
"n",
")",
":",
"for",
"i",
"in",
"range",
"(",
"1",
",",
"int",
"(",
"math",
".",
"sqrt",
"(",
"n",
")",
"+",
"1",
")",
")",
":",
"if",
"n",
"%",
"i",
"==",
"0",
":",
"yield",
"i",
"if",
"i",
"*",
"i",
"!=",
"n",... | Generate the divisors of n | [
"Generate",
"the",
"divisors",
"of",
"n"
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/lib.py#L206-L212 | train | 28,177 |
seung-lab/cloud-volume | cloudvolume/lib.py | Bbox.expand_to_chunk_size | def expand_to_chunk_size(self, chunk_size, offset=Vec(0,0,0, dtype=int)):
"""
Align a potentially non-axis aligned bbox to the grid by growing it
to the nearest grid lines.
Required:
chunk_size: arraylike (x,y,z), the size of chunks in the
dataset e.g. (64,64,64)
Optional... | python | def expand_to_chunk_size(self, chunk_size, offset=Vec(0,0,0, dtype=int)):
"""
Align a potentially non-axis aligned bbox to the grid by growing it
to the nearest grid lines.
Required:
chunk_size: arraylike (x,y,z), the size of chunks in the
dataset e.g. (64,64,64)
Optional... | [
"def",
"expand_to_chunk_size",
"(",
"self",
",",
"chunk_size",
",",
"offset",
"=",
"Vec",
"(",
"0",
",",
"0",
",",
"0",
",",
"dtype",
"=",
"int",
")",
")",
":",
"chunk_size",
"=",
"np",
".",
"array",
"(",
"chunk_size",
",",
"dtype",
"=",
"np",
".",... | Align a potentially non-axis aligned bbox to the grid by growing it
to the nearest grid lines.
Required:
chunk_size: arraylike (x,y,z), the size of chunks in the
dataset e.g. (64,64,64)
Optional:
offset: arraylike (x,y,z), the starting coordinate of the dataset | [
"Align",
"a",
"potentially",
"non",
"-",
"axis",
"aligned",
"bbox",
"to",
"the",
"grid",
"by",
"growing",
"it",
"to",
"the",
"nearest",
"grid",
"lines",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/lib.py#L549-L565 | train | 28,178 |
seung-lab/cloud-volume | cloudvolume/lib.py | Bbox.round_to_chunk_size | def round_to_chunk_size(self, chunk_size, offset=Vec(0,0,0, dtype=int)):
"""
Align a potentially non-axis aligned bbox to the grid by rounding it
to the nearest grid lines.
Required:
chunk_size: arraylike (x,y,z), the size of chunks in the
dataset e.g. (64,64,64)
Optional... | python | def round_to_chunk_size(self, chunk_size, offset=Vec(0,0,0, dtype=int)):
"""
Align a potentially non-axis aligned bbox to the grid by rounding it
to the nearest grid lines.
Required:
chunk_size: arraylike (x,y,z), the size of chunks in the
dataset e.g. (64,64,64)
Optional... | [
"def",
"round_to_chunk_size",
"(",
"self",
",",
"chunk_size",
",",
"offset",
"=",
"Vec",
"(",
"0",
",",
"0",
",",
"0",
",",
"dtype",
"=",
"int",
")",
")",
":",
"chunk_size",
"=",
"np",
".",
"array",
"(",
"chunk_size",
",",
"dtype",
"=",
"np",
".",
... | Align a potentially non-axis aligned bbox to the grid by rounding it
to the nearest grid lines.
Required:
chunk_size: arraylike (x,y,z), the size of chunks in the
dataset e.g. (64,64,64)
Optional:
offset: arraylike (x,y,z), the starting coordinate of the dataset | [
"Align",
"a",
"potentially",
"non",
"-",
"axis",
"aligned",
"bbox",
"to",
"the",
"grid",
"by",
"rounding",
"it",
"to",
"the",
"nearest",
"grid",
"lines",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/lib.py#L592-L608 | train | 28,179 |
seung-lab/cloud-volume | cloudvolume/lib.py | Bbox.contains | def contains(self, point):
"""
Tests if a point on or within a bounding box.
Returns: boolean
"""
return (
point[0] >= self.minpt[0]
and point[1] >= self.minpt[1]
and point[2] >= self.minpt[2]
and point[0] <= self.maxpt[0]
and point[1] <= self.maxpt[1]
and... | python | def contains(self, point):
"""
Tests if a point on or within a bounding box.
Returns: boolean
"""
return (
point[0] >= self.minpt[0]
and point[1] >= self.minpt[1]
and point[2] >= self.minpt[2]
and point[0] <= self.maxpt[0]
and point[1] <= self.maxpt[1]
and... | [
"def",
"contains",
"(",
"self",
",",
"point",
")",
":",
"return",
"(",
"point",
"[",
"0",
"]",
">=",
"self",
".",
"minpt",
"[",
"0",
"]",
"and",
"point",
"[",
"1",
"]",
">=",
"self",
".",
"minpt",
"[",
"1",
"]",
"and",
"point",
"[",
"2",
"]",... | Tests if a point on or within a bounding box.
Returns: boolean | [
"Tests",
"if",
"a",
"point",
"on",
"or",
"within",
"a",
"bounding",
"box",
"."
] | d2fd4500333f1bc3cd3e3919a8b649cec5d8e214 | https://github.com/seung-lab/cloud-volume/blob/d2fd4500333f1bc3cd3e3919a8b649cec5d8e214/cloudvolume/lib.py#L610-L623 | train | 28,180 |
wavefrontHQ/python-client | wavefront_api_client/models/message.py | Message.display | def display(self, display):
"""Sets the display of this Message.
The form of display for this message # noqa: E501
:param display: The display of this Message. # noqa: E501
:type: str
"""
if display is None:
raise ValueError("Invalid value for `display`, m... | python | def display(self, display):
"""Sets the display of this Message.
The form of display for this message # noqa: E501
:param display: The display of this Message. # noqa: E501
:type: str
"""
if display is None:
raise ValueError("Invalid value for `display`, m... | [
"def",
"display",
"(",
"self",
",",
"display",
")",
":",
"if",
"display",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"Invalid value for `display`, must not be `None`\"",
")",
"# noqa: E501",
"allowed_values",
"=",
"[",
"\"BANNER\"",
",",
"\"TOASTER\"",
"]",
... | Sets the display of this Message.
The form of display for this message # noqa: E501
:param display: The display of this Message. # noqa: E501
:type: str | [
"Sets",
"the",
"display",
"of",
"this",
"Message",
"."
] | b0f1046a8f68c2c7d69e395f7167241f224c738a | https://github.com/wavefrontHQ/python-client/blob/b0f1046a8f68c2c7d69e395f7167241f224c738a/wavefront_api_client/models/message.py#L157-L174 | train | 28,181 |
wavefrontHQ/python-client | wavefront_api_client/models/message.py | Message.scope | def scope(self, scope):
"""Sets the scope of this Message.
The audience scope that this message should reach # noqa: E501
:param scope: The scope of this Message. # noqa: E501
:type: str
"""
if scope is None:
raise ValueError("Invalid value for `scope`, mu... | python | def scope(self, scope):
"""Sets the scope of this Message.
The audience scope that this message should reach # noqa: E501
:param scope: The scope of this Message. # noqa: E501
:type: str
"""
if scope is None:
raise ValueError("Invalid value for `scope`, mu... | [
"def",
"scope",
"(",
"self",
",",
"scope",
")",
":",
"if",
"scope",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"Invalid value for `scope`, must not be `None`\"",
")",
"# noqa: E501",
"allowed_values",
"=",
"[",
"\"CLUSTER\"",
",",
"\"CUSTOMER\"",
",",
"\"USE... | Sets the scope of this Message.
The audience scope that this message should reach # noqa: E501
:param scope: The scope of this Message. # noqa: E501
:type: str | [
"Sets",
"the",
"scope",
"of",
"this",
"Message",
"."
] | b0f1046a8f68c2c7d69e395f7167241f224c738a | https://github.com/wavefrontHQ/python-client/blob/b0f1046a8f68c2c7d69e395f7167241f224c738a/wavefront_api_client/models/message.py#L257-L274 | train | 28,182 |
wavefrontHQ/python-client | wavefront_api_client/models/message.py | Message.severity | def severity(self, severity):
"""Sets the severity of this Message.
Message severity # noqa: E501
:param severity: The severity of this Message. # noqa: E501
:type: str
"""
if severity is None:
raise ValueError("Invalid value for `severity`, must not be `N... | python | def severity(self, severity):
"""Sets the severity of this Message.
Message severity # noqa: E501
:param severity: The severity of this Message. # noqa: E501
:type: str
"""
if severity is None:
raise ValueError("Invalid value for `severity`, must not be `N... | [
"def",
"severity",
"(",
"self",
",",
"severity",
")",
":",
"if",
"severity",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"Invalid value for `severity`, must not be `None`\"",
")",
"# noqa: E501",
"allowed_values",
"=",
"[",
"\"MARKETING\"",
",",
"\"INFO\"",
","... | Sets the severity of this Message.
Message severity # noqa: E501
:param severity: The severity of this Message. # noqa: E501
:type: str | [
"Sets",
"the",
"severity",
"of",
"this",
"Message",
"."
] | b0f1046a8f68c2c7d69e395f7167241f224c738a | https://github.com/wavefrontHQ/python-client/blob/b0f1046a8f68c2c7d69e395f7167241f224c738a/wavefront_api_client/models/message.py#L288-L305 | train | 28,183 |
wavefrontHQ/python-client | wavefront_api_client/models/facet_search_request_container.py | FacetSearchRequestContainer.facet_query_matching_method | def facet_query_matching_method(self, facet_query_matching_method):
"""Sets the facet_query_matching_method of this FacetSearchRequestContainer.
The matching method used to filter when 'facetQuery' is used. Defaults to CONTAINS. # noqa: E501
:param facet_query_matching_method: The facet_query... | python | def facet_query_matching_method(self, facet_query_matching_method):
"""Sets the facet_query_matching_method of this FacetSearchRequestContainer.
The matching method used to filter when 'facetQuery' is used. Defaults to CONTAINS. # noqa: E501
:param facet_query_matching_method: The facet_query... | [
"def",
"facet_query_matching_method",
"(",
"self",
",",
"facet_query_matching_method",
")",
":",
"allowed_values",
"=",
"[",
"\"CONTAINS\"",
",",
"\"STARTSWITH\"",
",",
"\"EXACT\"",
",",
"\"TAGPATH\"",
"]",
"# noqa: E501",
"if",
"facet_query_matching_method",
"not",
"in... | Sets the facet_query_matching_method of this FacetSearchRequestContainer.
The matching method used to filter when 'facetQuery' is used. Defaults to CONTAINS. # noqa: E501
:param facet_query_matching_method: The facet_query_matching_method of this FacetSearchRequestContainer. # noqa: E501
:ty... | [
"Sets",
"the",
"facet_query_matching_method",
"of",
"this",
"FacetSearchRequestContainer",
"."
] | b0f1046a8f68c2c7d69e395f7167241f224c738a | https://github.com/wavefrontHQ/python-client/blob/b0f1046a8f68c2c7d69e395f7167241f224c738a/wavefront_api_client/models/facet_search_request_container.py#L107-L122 | train | 28,184 |
wavefrontHQ/python-client | wavefront_api_client/models/maintenance_window.py | MaintenanceWindow.running_state | def running_state(self, running_state):
"""Sets the running_state of this MaintenanceWindow.
:param running_state: The running_state of this MaintenanceWindow. # noqa: E501
:type: str
"""
allowed_values = ["ONGOING", "PENDING", "ENDED"] # noqa: E501
if running_state n... | python | def running_state(self, running_state):
"""Sets the running_state of this MaintenanceWindow.
:param running_state: The running_state of this MaintenanceWindow. # noqa: E501
:type: str
"""
allowed_values = ["ONGOING", "PENDING", "ENDED"] # noqa: E501
if running_state n... | [
"def",
"running_state",
"(",
"self",
",",
"running_state",
")",
":",
"allowed_values",
"=",
"[",
"\"ONGOING\"",
",",
"\"PENDING\"",
",",
"\"ENDED\"",
"]",
"# noqa: E501",
"if",
"running_state",
"not",
"in",
"allowed_values",
":",
"raise",
"ValueError",
"(",
"\"I... | Sets the running_state of this MaintenanceWindow.
:param running_state: The running_state of this MaintenanceWindow. # noqa: E501
:type: str | [
"Sets",
"the",
"running_state",
"of",
"this",
"MaintenanceWindow",
"."
] | b0f1046a8f68c2c7d69e395f7167241f224c738a | https://github.com/wavefrontHQ/python-client/blob/b0f1046a8f68c2c7d69e395f7167241f224c738a/wavefront_api_client/models/maintenance_window.py#L415-L429 | train | 28,185 |
wavefrontHQ/python-client | wavefront_api_client/models/dashboard_parameter_value.py | DashboardParameterValue.dynamic_field_type | def dynamic_field_type(self, dynamic_field_type):
"""Sets the dynamic_field_type of this DashboardParameterValue.
:param dynamic_field_type: The dynamic_field_type of this DashboardParameterValue. # noqa: E501
:type: str
"""
allowed_values = ["SOURCE", "SOURCE_TAG", "METRIC_NA... | python | def dynamic_field_type(self, dynamic_field_type):
"""Sets the dynamic_field_type of this DashboardParameterValue.
:param dynamic_field_type: The dynamic_field_type of this DashboardParameterValue. # noqa: E501
:type: str
"""
allowed_values = ["SOURCE", "SOURCE_TAG", "METRIC_NA... | [
"def",
"dynamic_field_type",
"(",
"self",
",",
"dynamic_field_type",
")",
":",
"allowed_values",
"=",
"[",
"\"SOURCE\"",
",",
"\"SOURCE_TAG\"",
",",
"\"METRIC_NAME\"",
",",
"\"TAG_KEY\"",
",",
"\"MATCHING_SOURCE_TAG\"",
"]",
"# noqa: E501",
"if",
"dynamic_field_type",
... | Sets the dynamic_field_type of this DashboardParameterValue.
:param dynamic_field_type: The dynamic_field_type of this DashboardParameterValue. # noqa: E501
:type: str | [
"Sets",
"the",
"dynamic_field_type",
"of",
"this",
"DashboardParameterValue",
"."
] | b0f1046a8f68c2c7d69e395f7167241f224c738a | https://github.com/wavefrontHQ/python-client/blob/b0f1046a8f68c2c7d69e395f7167241f224c738a/wavefront_api_client/models/dashboard_parameter_value.py#L179-L193 | train | 28,186 |
wavefrontHQ/python-client | wavefront_api_client/models/dashboard_parameter_value.py | DashboardParameterValue.parameter_type | def parameter_type(self, parameter_type):
"""Sets the parameter_type of this DashboardParameterValue.
:param parameter_type: The parameter_type of this DashboardParameterValue. # noqa: E501
:type: str
"""
allowed_values = ["SIMPLE", "LIST", "DYNAMIC"] # noqa: E501
if ... | python | def parameter_type(self, parameter_type):
"""Sets the parameter_type of this DashboardParameterValue.
:param parameter_type: The parameter_type of this DashboardParameterValue. # noqa: E501
:type: str
"""
allowed_values = ["SIMPLE", "LIST", "DYNAMIC"] # noqa: E501
if ... | [
"def",
"parameter_type",
"(",
"self",
",",
"parameter_type",
")",
":",
"allowed_values",
"=",
"[",
"\"SIMPLE\"",
",",
"\"LIST\"",
",",
"\"DYNAMIC\"",
"]",
"# noqa: E501",
"if",
"parameter_type",
"not",
"in",
"allowed_values",
":",
"raise",
"ValueError",
"(",
"\"... | Sets the parameter_type of this DashboardParameterValue.
:param parameter_type: The parameter_type of this DashboardParameterValue. # noqa: E501
:type: str | [
"Sets",
"the",
"parameter_type",
"of",
"this",
"DashboardParameterValue",
"."
] | b0f1046a8f68c2c7d69e395f7167241f224c738a | https://github.com/wavefrontHQ/python-client/blob/b0f1046a8f68c2c7d69e395f7167241f224c738a/wavefront_api_client/models/dashboard_parameter_value.py#L269-L283 | train | 28,187 |
wavefrontHQ/python-client | wavefront_api_client/models/chart_settings.py | ChartSettings.fixed_legend_filter_field | def fixed_legend_filter_field(self, fixed_legend_filter_field):
"""Sets the fixed_legend_filter_field of this ChartSettings.
Statistic to use for determining whether a series is displayed on the fixed legend # noqa: E501
:param fixed_legend_filter_field: The fixed_legend_filter_field of this ... | python | def fixed_legend_filter_field(self, fixed_legend_filter_field):
"""Sets the fixed_legend_filter_field of this ChartSettings.
Statistic to use for determining whether a series is displayed on the fixed legend # noqa: E501
:param fixed_legend_filter_field: The fixed_legend_filter_field of this ... | [
"def",
"fixed_legend_filter_field",
"(",
"self",
",",
"fixed_legend_filter_field",
")",
":",
"allowed_values",
"=",
"[",
"\"CURRENT\"",
",",
"\"MEAN\"",
",",
"\"MEDIAN\"",
",",
"\"SUM\"",
",",
"\"MIN\"",
",",
"\"MAX\"",
",",
"\"COUNT\"",
"]",
"# noqa: E501",
"if",... | Sets the fixed_legend_filter_field of this ChartSettings.
Statistic to use for determining whether a series is displayed on the fixed legend # noqa: E501
:param fixed_legend_filter_field: The fixed_legend_filter_field of this ChartSettings. # noqa: E501
:type: str | [
"Sets",
"the",
"fixed_legend_filter_field",
"of",
"this",
"ChartSettings",
"."
] | b0f1046a8f68c2c7d69e395f7167241f224c738a | https://github.com/wavefrontHQ/python-client/blob/b0f1046a8f68c2c7d69e395f7167241f224c738a/wavefront_api_client/models/chart_settings.py#L479-L494 | train | 28,188 |
wavefrontHQ/python-client | wavefront_api_client/models/chart_settings.py | ChartSettings.fixed_legend_filter_sort | def fixed_legend_filter_sort(self, fixed_legend_filter_sort):
"""Sets the fixed_legend_filter_sort of this ChartSettings.
Whether to display \"Top\"- or \"Bottom\"-ranked series in the fixed legend # noqa: E501
:param fixed_legend_filter_sort: The fixed_legend_filter_sort of this ChartSetting... | python | def fixed_legend_filter_sort(self, fixed_legend_filter_sort):
"""Sets the fixed_legend_filter_sort of this ChartSettings.
Whether to display \"Top\"- or \"Bottom\"-ranked series in the fixed legend # noqa: E501
:param fixed_legend_filter_sort: The fixed_legend_filter_sort of this ChartSetting... | [
"def",
"fixed_legend_filter_sort",
"(",
"self",
",",
"fixed_legend_filter_sort",
")",
":",
"allowed_values",
"=",
"[",
"\"TOP\"",
",",
"\"BOTTOM\"",
"]",
"# noqa: E501",
"if",
"fixed_legend_filter_sort",
"not",
"in",
"allowed_values",
":",
"raise",
"ValueError",
"(",
... | Sets the fixed_legend_filter_sort of this ChartSettings.
Whether to display \"Top\"- or \"Bottom\"-ranked series in the fixed legend # noqa: E501
:param fixed_legend_filter_sort: The fixed_legend_filter_sort of this ChartSettings. # noqa: E501
:type: str | [
"Sets",
"the",
"fixed_legend_filter_sort",
"of",
"this",
"ChartSettings",
"."
] | b0f1046a8f68c2c7d69e395f7167241f224c738a | https://github.com/wavefrontHQ/python-client/blob/b0f1046a8f68c2c7d69e395f7167241f224c738a/wavefront_api_client/models/chart_settings.py#L531-L546 | train | 28,189 |
wavefrontHQ/python-client | wavefront_api_client/models/chart_settings.py | ChartSettings.fixed_legend_position | def fixed_legend_position(self, fixed_legend_position):
"""Sets the fixed_legend_position of this ChartSettings.
Where the fixed legend should be displayed with respect to the chart # noqa: E501
:param fixed_legend_position: The fixed_legend_position of this ChartSettings. # noqa: E501
... | python | def fixed_legend_position(self, fixed_legend_position):
"""Sets the fixed_legend_position of this ChartSettings.
Where the fixed legend should be displayed with respect to the chart # noqa: E501
:param fixed_legend_position: The fixed_legend_position of this ChartSettings. # noqa: E501
... | [
"def",
"fixed_legend_position",
"(",
"self",
",",
"fixed_legend_position",
")",
":",
"allowed_values",
"=",
"[",
"\"RIGHT\"",
",",
"\"TOP\"",
",",
"\"LEFT\"",
",",
"\"BOTTOM\"",
"]",
"# noqa: E501",
"if",
"fixed_legend_position",
"not",
"in",
"allowed_values",
":",
... | Sets the fixed_legend_position of this ChartSettings.
Where the fixed legend should be displayed with respect to the chart # noqa: E501
:param fixed_legend_position: The fixed_legend_position of this ChartSettings. # noqa: E501
:type: str | [
"Sets",
"the",
"fixed_legend_position",
"of",
"this",
"ChartSettings",
"."
] | b0f1046a8f68c2c7d69e395f7167241f224c738a | https://github.com/wavefrontHQ/python-client/blob/b0f1046a8f68c2c7d69e395f7167241f224c738a/wavefront_api_client/models/chart_settings.py#L583-L598 | train | 28,190 |
wavefrontHQ/python-client | wavefront_api_client/models/chart_settings.py | ChartSettings.line_type | def line_type(self, line_type):
"""Sets the line_type of this ChartSettings.
Plot interpolation type. linear is default # noqa: E501
:param line_type: The line_type of this ChartSettings. # noqa: E501
:type: str
"""
allowed_values = ["linear", "step-before", "step-af... | python | def line_type(self, line_type):
"""Sets the line_type of this ChartSettings.
Plot interpolation type. linear is default # noqa: E501
:param line_type: The line_type of this ChartSettings. # noqa: E501
:type: str
"""
allowed_values = ["linear", "step-before", "step-af... | [
"def",
"line_type",
"(",
"self",
",",
"line_type",
")",
":",
"allowed_values",
"=",
"[",
"\"linear\"",
",",
"\"step-before\"",
",",
"\"step-after\"",
",",
"\"basis\"",
",",
"\"cardinal\"",
",",
"\"monotone\"",
"]",
"# noqa: E501",
"if",
"line_type",
"not",
"in",... | Sets the line_type of this ChartSettings.
Plot interpolation type. linear is default # noqa: E501
:param line_type: The line_type of this ChartSettings. # noqa: E501
:type: str | [
"Sets",
"the",
"line_type",
"of",
"this",
"ChartSettings",
"."
] | b0f1046a8f68c2c7d69e395f7167241f224c738a | https://github.com/wavefrontHQ/python-client/blob/b0f1046a8f68c2c7d69e395f7167241f224c738a/wavefront_api_client/models/chart_settings.py#L681-L696 | train | 28,191 |
wavefrontHQ/python-client | wavefront_api_client/models/chart_settings.py | ChartSettings.sparkline_display_horizontal_position | def sparkline_display_horizontal_position(self, sparkline_display_horizontal_position):
"""Sets the sparkline_display_horizontal_position of this ChartSettings.
For the single stat view, the horizontal position of the displayed text # noqa: E501
:param sparkline_display_horizontal_position: T... | python | def sparkline_display_horizontal_position(self, sparkline_display_horizontal_position):
"""Sets the sparkline_display_horizontal_position of this ChartSettings.
For the single stat view, the horizontal position of the displayed text # noqa: E501
:param sparkline_display_horizontal_position: T... | [
"def",
"sparkline_display_horizontal_position",
"(",
"self",
",",
"sparkline_display_horizontal_position",
")",
":",
"allowed_values",
"=",
"[",
"\"MIDDLE\"",
",",
"\"LEFT\"",
",",
"\"RIGHT\"",
"]",
"# noqa: E501",
"if",
"sparkline_display_horizontal_position",
"not",
"in",... | Sets the sparkline_display_horizontal_position of this ChartSettings.
For the single stat view, the horizontal position of the displayed text # noqa: E501
:param sparkline_display_horizontal_position: The sparkline_display_horizontal_position of this ChartSettings. # noqa: E501
:type: str | [
"Sets",
"the",
"sparkline_display_horizontal_position",
"of",
"this",
"ChartSettings",
"."
] | b0f1046a8f68c2c7d69e395f7167241f224c738a | https://github.com/wavefrontHQ/python-client/blob/b0f1046a8f68c2c7d69e395f7167241f224c738a/wavefront_api_client/models/chart_settings.py#L963-L978 | train | 28,192 |
wavefrontHQ/python-client | wavefront_api_client/models/chart_settings.py | ChartSettings.sparkline_display_value_type | def sparkline_display_value_type(self, sparkline_display_value_type):
"""Sets the sparkline_display_value_type of this ChartSettings.
For the single stat view, whether to display the name of the query or the value of query # noqa: E501
:param sparkline_display_value_type: The sparkline_displa... | python | def sparkline_display_value_type(self, sparkline_display_value_type):
"""Sets the sparkline_display_value_type of this ChartSettings.
For the single stat view, whether to display the name of the query or the value of query # noqa: E501
:param sparkline_display_value_type: The sparkline_displa... | [
"def",
"sparkline_display_value_type",
"(",
"self",
",",
"sparkline_display_value_type",
")",
":",
"allowed_values",
"=",
"[",
"\"VALUE\"",
",",
"\"LABEL\"",
"]",
"# noqa: E501",
"if",
"sparkline_display_value_type",
"not",
"in",
"allowed_values",
":",
"raise",
"ValueEr... | Sets the sparkline_display_value_type of this ChartSettings.
For the single stat view, whether to display the name of the query or the value of query # noqa: E501
:param sparkline_display_value_type: The sparkline_display_value_type of this ChartSettings. # noqa: E501
:type: str | [
"Sets",
"the",
"sparkline_display_value_type",
"of",
"this",
"ChartSettings",
"."
] | b0f1046a8f68c2c7d69e395f7167241f224c738a | https://github.com/wavefrontHQ/python-client/blob/b0f1046a8f68c2c7d69e395f7167241f224c738a/wavefront_api_client/models/chart_settings.py#L1038-L1053 | train | 28,193 |
wavefrontHQ/python-client | wavefront_api_client/models/chart_settings.py | ChartSettings.sparkline_size | def sparkline_size(self, sparkline_size):
"""Sets the sparkline_size of this ChartSettings.
For the single stat view, a misleadingly named property. This determines whether the sparkline of the statistic is displayed in the chart BACKGROUND, BOTTOM, or NONE # noqa: E501
:param sparkline_size... | python | def sparkline_size(self, sparkline_size):
"""Sets the sparkline_size of this ChartSettings.
For the single stat view, a misleadingly named property. This determines whether the sparkline of the statistic is displayed in the chart BACKGROUND, BOTTOM, or NONE # noqa: E501
:param sparkline_size... | [
"def",
"sparkline_size",
"(",
"self",
",",
"sparkline_size",
")",
":",
"allowed_values",
"=",
"[",
"\"BACKGROUND\"",
",",
"\"BOTTOM\"",
",",
"\"NONE\"",
"]",
"# noqa: E501",
"if",
"sparkline_size",
"not",
"in",
"allowed_values",
":",
"raise",
"ValueError",
"(",
... | Sets the sparkline_size of this ChartSettings.
For the single stat view, a misleadingly named property. This determines whether the sparkline of the statistic is displayed in the chart BACKGROUND, BOTTOM, or NONE # noqa: E501
:param sparkline_size: The sparkline_size of this ChartSettings. # noqa: ... | [
"Sets",
"the",
"sparkline_size",
"of",
"this",
"ChartSettings",
"."
] | b0f1046a8f68c2c7d69e395f7167241f224c738a | https://github.com/wavefrontHQ/python-client/blob/b0f1046a8f68c2c7d69e395f7167241f224c738a/wavefront_api_client/models/chart_settings.py#L1136-L1151 | train | 28,194 |
wavefrontHQ/python-client | wavefront_api_client/models/chart_settings.py | ChartSettings.sparkline_value_color_map_apply_to | def sparkline_value_color_map_apply_to(self, sparkline_value_color_map_apply_to):
"""Sets the sparkline_value_color_map_apply_to of this ChartSettings.
For the single stat view, whether to apply dynamic color settings to the displayed TEXT or BACKGROUND # noqa: E501
:param sparkline_value_col... | python | def sparkline_value_color_map_apply_to(self, sparkline_value_color_map_apply_to):
"""Sets the sparkline_value_color_map_apply_to of this ChartSettings.
For the single stat view, whether to apply dynamic color settings to the displayed TEXT or BACKGROUND # noqa: E501
:param sparkline_value_col... | [
"def",
"sparkline_value_color_map_apply_to",
"(",
"self",
",",
"sparkline_value_color_map_apply_to",
")",
":",
"allowed_values",
"=",
"[",
"\"TEXT\"",
",",
"\"BACKGROUND\"",
"]",
"# noqa: E501",
"if",
"sparkline_value_color_map_apply_to",
"not",
"in",
"allowed_values",
":",... | Sets the sparkline_value_color_map_apply_to of this ChartSettings.
For the single stat view, whether to apply dynamic color settings to the displayed TEXT or BACKGROUND # noqa: E501
:param sparkline_value_color_map_apply_to: The sparkline_value_color_map_apply_to of this ChartSettings. # noqa: E501
... | [
"Sets",
"the",
"sparkline_value_color_map_apply_to",
"of",
"this",
"ChartSettings",
"."
] | b0f1046a8f68c2c7d69e395f7167241f224c738a | https://github.com/wavefrontHQ/python-client/blob/b0f1046a8f68c2c7d69e395f7167241f224c738a/wavefront_api_client/models/chart_settings.py#L1165-L1180 | train | 28,195 |
wavefrontHQ/python-client | wavefront_api_client/models/chart_settings.py | ChartSettings.stack_type | def stack_type(self, stack_type):
"""Sets the stack_type of this ChartSettings.
Type of stacked chart (applicable only if chart type is stacked). zero (default) means stacked from y=0. expand means Normalized from 0 to 1. wiggle means Minimize weighted changes. silhouette means to Center the Stream ... | python | def stack_type(self, stack_type):
"""Sets the stack_type of this ChartSettings.
Type of stacked chart (applicable only if chart type is stacked). zero (default) means stacked from y=0. expand means Normalized from 0 to 1. wiggle means Minimize weighted changes. silhouette means to Center the Stream ... | [
"def",
"stack_type",
"(",
"self",
",",
"stack_type",
")",
":",
"allowed_values",
"=",
"[",
"\"zero\"",
",",
"\"expand\"",
",",
"\"wiggle\"",
",",
"\"silhouette\"",
"]",
"# noqa: E501",
"if",
"stack_type",
"not",
"in",
"allowed_values",
":",
"raise",
"ValueError"... | Sets the stack_type of this ChartSettings.
Type of stacked chart (applicable only if chart type is stacked). zero (default) means stacked from y=0. expand means Normalized from 0 to 1. wiggle means Minimize weighted changes. silhouette means to Center the Stream # noqa: E501
:param stack_type: The... | [
"Sets",
"the",
"stack_type",
"of",
"this",
"ChartSettings",
"."
] | b0f1046a8f68c2c7d69e395f7167241f224c738a | https://github.com/wavefrontHQ/python-client/blob/b0f1046a8f68c2c7d69e395f7167241f224c738a/wavefront_api_client/models/chart_settings.py#L1309-L1324 | train | 28,196 |
wavefrontHQ/python-client | wavefront_api_client/models/chart_settings.py | ChartSettings.tag_mode | def tag_mode(self, tag_mode):
"""Sets the tag_mode of this ChartSettings.
For the tabular view, which mode to use to determine which point tags to display # noqa: E501
:param tag_mode: The tag_mode of this ChartSettings. # noqa: E501
:type: str
"""
allowed_values = ["... | python | def tag_mode(self, tag_mode):
"""Sets the tag_mode of this ChartSettings.
For the tabular view, which mode to use to determine which point tags to display # noqa: E501
:param tag_mode: The tag_mode of this ChartSettings. # noqa: E501
:type: str
"""
allowed_values = ["... | [
"def",
"tag_mode",
"(",
"self",
",",
"tag_mode",
")",
":",
"allowed_values",
"=",
"[",
"\"all\"",
",",
"\"top\"",
",",
"\"custom\"",
"]",
"# noqa: E501",
"if",
"tag_mode",
"not",
"in",
"allowed_values",
":",
"raise",
"ValueError",
"(",
"\"Invalid value for `tag_... | Sets the tag_mode of this ChartSettings.
For the tabular view, which mode to use to determine which point tags to display # noqa: E501
:param tag_mode: The tag_mode of this ChartSettings. # noqa: E501
:type: str | [
"Sets",
"the",
"tag_mode",
"of",
"this",
"ChartSettings",
"."
] | b0f1046a8f68c2c7d69e395f7167241f224c738a | https://github.com/wavefrontHQ/python-client/blob/b0f1046a8f68c2c7d69e395f7167241f224c738a/wavefront_api_client/models/chart_settings.py#L1338-L1353 | train | 28,197 |
wavefrontHQ/python-client | wavefront_api_client/models/chart_settings.py | ChartSettings.windowing | def windowing(self, windowing):
"""Sets the windowing of this ChartSettings.
For the tabular view, whether to use the full time window for the query or the last X minutes # noqa: E501
:param windowing: The windowing of this ChartSettings. # noqa: E501
:type: str
"""
a... | python | def windowing(self, windowing):
"""Sets the windowing of this ChartSettings.
For the tabular view, whether to use the full time window for the query or the last X minutes # noqa: E501
:param windowing: The windowing of this ChartSettings. # noqa: E501
:type: str
"""
a... | [
"def",
"windowing",
"(",
"self",
",",
"windowing",
")",
":",
"allowed_values",
"=",
"[",
"\"full\"",
",",
"\"last\"",
"]",
"# noqa: E501",
"if",
"windowing",
"not",
"in",
"allowed_values",
":",
"raise",
"ValueError",
"(",
"\"Invalid value for `windowing` ({0}), must... | Sets the windowing of this ChartSettings.
For the tabular view, whether to use the full time window for the query or the last X minutes # noqa: E501
:param windowing: The windowing of this ChartSettings. # noqa: E501
:type: str | [
"Sets",
"the",
"windowing",
"of",
"this",
"ChartSettings",
"."
] | b0f1046a8f68c2c7d69e395f7167241f224c738a | https://github.com/wavefrontHQ/python-client/blob/b0f1046a8f68c2c7d69e395f7167241f224c738a/wavefront_api_client/models/chart_settings.py#L1444-L1459 | train | 28,198 |
wavefrontHQ/python-client | wavefront_api_client/models/response_status.py | ResponseStatus.result | def result(self, result):
"""Sets the result of this ResponseStatus.
:param result: The result of this ResponseStatus. # noqa: E501
:type: str
"""
if result is None:
raise ValueError("Invalid value for `result`, must not be `None`") # noqa: E501
allowed_va... | python | def result(self, result):
"""Sets the result of this ResponseStatus.
:param result: The result of this ResponseStatus. # noqa: E501
:type: str
"""
if result is None:
raise ValueError("Invalid value for `result`, must not be `None`") # noqa: E501
allowed_va... | [
"def",
"result",
"(",
"self",
",",
"result",
")",
":",
"if",
"result",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"Invalid value for `result`, must not be `None`\"",
")",
"# noqa: E501",
"allowed_values",
"=",
"[",
"\"OK\"",
",",
"\"ERROR\"",
"]",
"# noqa: E... | Sets the result of this ResponseStatus.
:param result: The result of this ResponseStatus. # noqa: E501
:type: str | [
"Sets",
"the",
"result",
"of",
"this",
"ResponseStatus",
"."
] | b0f1046a8f68c2c7d69e395f7167241f224c738a | https://github.com/wavefrontHQ/python-client/blob/b0f1046a8f68c2c7d69e395f7167241f224c738a/wavefront_api_client/models/response_status.py#L117-L133 | train | 28,199 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.