id int32 0 252k | 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 list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
29,500 | apple/turicreate | src/external/xgboost/python-package/xgboost/training.py | cv | def cv(params, dtrain, num_boost_round=10, nfold=3, metrics=(),
obj=None, feval=None, fpreproc=None, as_pandas=True,
show_progress=None, show_stdv=True, seed=0):
# pylint: disable = invalid-name
"""Cross-validation with given paramaters.
Parameters
----------
params : dict
Boo... | python | def cv(params, dtrain, num_boost_round=10, nfold=3, metrics=(),
obj=None, feval=None, fpreproc=None, as_pandas=True,
show_progress=None, show_stdv=True, seed=0):
# pylint: disable = invalid-name
"""Cross-validation with given paramaters.
Parameters
----------
params : dict
Boo... | [
"def",
"cv",
"(",
"params",
",",
"dtrain",
",",
"num_boost_round",
"=",
"10",
",",
"nfold",
"=",
"3",
",",
"metrics",
"=",
"(",
")",
",",
"obj",
"=",
"None",
",",
"feval",
"=",
"None",
",",
"fpreproc",
"=",
"None",
",",
"as_pandas",
"=",
"True",
... | Cross-validation with given paramaters.
Parameters
----------
params : dict
Booster params.
dtrain : DMatrix
Data to be trained.
num_boost_round : int
Number of boosting iterations.
nfold : int
Number of folds in CV.
metrics : list of strings
Evaluati... | [
"Cross",
"-",
"validation",
"with",
"given",
"paramaters",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/training.py#L294-L354 |
29,501 | apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology2.py | NetGraph._remove_layer_and_reconnect | def _remove_layer_and_reconnect(self, layer):
""" Remove the layer, and reconnect each of its predecessor to each of
its successor
"""
successors = self.get_successors(layer)
predecessors = self.get_predecessors(layer)
# remove layer's edges
for succ in successors... | python | def _remove_layer_and_reconnect(self, layer):
""" Remove the layer, and reconnect each of its predecessor to each of
its successor
"""
successors = self.get_successors(layer)
predecessors = self.get_predecessors(layer)
# remove layer's edges
for succ in successors... | [
"def",
"_remove_layer_and_reconnect",
"(",
"self",
",",
"layer",
")",
":",
"successors",
"=",
"self",
".",
"get_successors",
"(",
"layer",
")",
"predecessors",
"=",
"self",
".",
"get_predecessors",
"(",
"layer",
")",
"# remove layer's edges",
"for",
"succ",
"in"... | Remove the layer, and reconnect each of its predecessor to each of
its successor | [
"Remove",
"the",
"layer",
"and",
"reconnect",
"each",
"of",
"its",
"predecessor",
"to",
"each",
"of",
"its",
"successor"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_topology2.py#L387-L421 |
29,502 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray.py | SArray.date_range | def date_range(cls,start_time,end_time,freq):
'''
Returns a new SArray that represents a fixed frequency datetime index.
Parameters
----------
start_time : datetime.datetime
Left bound for generating dates.
end_time : datetime.datetime
Right bound fo... | python | def date_range(cls,start_time,end_time,freq):
'''
Returns a new SArray that represents a fixed frequency datetime index.
Parameters
----------
start_time : datetime.datetime
Left bound for generating dates.
end_time : datetime.datetime
Right bound fo... | [
"def",
"date_range",
"(",
"cls",
",",
"start_time",
",",
"end_time",
",",
"freq",
")",
":",
"if",
"not",
"isinstance",
"(",
"start_time",
",",
"datetime",
".",
"datetime",
")",
":",
"raise",
"TypeError",
"(",
"\"The ``start_time`` argument must be from type dateti... | Returns a new SArray that represents a fixed frequency datetime index.
Parameters
----------
start_time : datetime.datetime
Left bound for generating dates.
end_time : datetime.datetime
Right bound for generating dates.
freq : datetime.timedelta
F... | [
"Returns",
"a",
"new",
"SArray",
"that",
"represents",
"a",
"fixed",
"frequency",
"datetime",
"index",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L431-L475 |
29,503 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray.py | SArray.from_const | def from_const(cls, value, size, dtype=type(None)):
"""
Constructs an SArray of size with a const value.
Parameters
----------
value : [int | float | str | array.array | list | dict | datetime]
The value to fill the SArray
size : int
The size of the S... | python | def from_const(cls, value, size, dtype=type(None)):
"""
Constructs an SArray of size with a const value.
Parameters
----------
value : [int | float | str | array.array | list | dict | datetime]
The value to fill the SArray
size : int
The size of the S... | [
"def",
"from_const",
"(",
"cls",
",",
"value",
",",
"size",
",",
"dtype",
"=",
"type",
"(",
"None",
")",
")",
":",
"assert",
"isinstance",
"(",
"size",
",",
"(",
"int",
",",
"long",
")",
")",
"and",
"size",
">=",
"0",
",",
"\"size must be a positive ... | Constructs an SArray of size with a const value.
Parameters
----------
value : [int | float | str | array.array | list | dict | datetime]
The value to fill the SArray
size : int
The size of the SArray
dtype : type
The type of the SArray. If not spec... | [
"Constructs",
"an",
"SArray",
"of",
"size",
"with",
"a",
"const",
"value",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L478-L508 |
29,504 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray.py | SArray.read_json | def read_json(cls, filename):
"""
Construct an SArray from a json file or glob of json files.
The json file must contain a list of dictionaries. The returned
SArray type will be of dict type
Parameters
----------
filename : str
The filename or glob to l... | python | def read_json(cls, filename):
"""
Construct an SArray from a json file or glob of json files.
The json file must contain a list of dictionaries. The returned
SArray type will be of dict type
Parameters
----------
filename : str
The filename or glob to l... | [
"def",
"read_json",
"(",
"cls",
",",
"filename",
")",
":",
"proxy",
"=",
"UnitySArrayProxy",
"(",
")",
"proxy",
".",
"load_from_json_record_files",
"(",
"_make_internal_url",
"(",
"filename",
")",
")",
"return",
"cls",
"(",
"_proxy",
"=",
"proxy",
")"
] | Construct an SArray from a json file or glob of json files.
The json file must contain a list of dictionaries. The returned
SArray type will be of dict type
Parameters
----------
filename : str
The filename or glob to load into an SArray.
Examples
----... | [
"Construct",
"an",
"SArray",
"from",
"a",
"json",
"file",
"or",
"glob",
"of",
"json",
"files",
".",
"The",
"json",
"file",
"must",
"contain",
"a",
"list",
"of",
"dictionaries",
".",
"The",
"returned",
"SArray",
"type",
"will",
"be",
"of",
"dict",
"type"
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L566-L590 |
29,505 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray.py | SArray.where | def where(cls, condition, istrue, isfalse, dtype=None):
"""
Selects elements from either istrue or isfalse depending on the value
of the condition SArray.
Parameters
----------
condition : SArray
An SArray of values such that for each value, if non-zero, yields a... | python | def where(cls, condition, istrue, isfalse, dtype=None):
"""
Selects elements from either istrue or isfalse depending on the value
of the condition SArray.
Parameters
----------
condition : SArray
An SArray of values such that for each value, if non-zero, yields a... | [
"def",
"where",
"(",
"cls",
",",
"condition",
",",
"istrue",
",",
"isfalse",
",",
"dtype",
"=",
"None",
")",
":",
"true_is_sarray",
"=",
"isinstance",
"(",
"istrue",
",",
"SArray",
")",
"false_is_sarray",
"=",
"isinstance",
"(",
"isfalse",
",",
"SArray",
... | Selects elements from either istrue or isfalse depending on the value
of the condition SArray.
Parameters
----------
condition : SArray
An SArray of values such that for each value, if non-zero, yields a
value from istrue, otherwise from isfalse.
istrue : SArray... | [
"Selects",
"elements",
"from",
"either",
"istrue",
"or",
"isfalse",
"depending",
"on",
"the",
"value",
"of",
"the",
"condition",
"SArray",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L593-L675 |
29,506 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray.py | SArray.save | def save(self, filename, format=None):
"""
Saves the SArray to file.
The saved SArray will be in a directory named with the `targetfile`
parameter.
Parameters
----------
filename : string
A local path or a remote URL. If format is 'text', it will be... | python | def save(self, filename, format=None):
"""
Saves the SArray to file.
The saved SArray will be in a directory named with the `targetfile`
parameter.
Parameters
----------
filename : string
A local path or a remote URL. If format is 'text', it will be... | [
"def",
"save",
"(",
"self",
",",
"filename",
",",
"format",
"=",
"None",
")",
":",
"from",
".",
"sframe",
"import",
"SFrame",
"as",
"_SFrame",
"if",
"format",
"is",
"None",
":",
"if",
"filename",
".",
"endswith",
"(",
"(",
"'.csv'",
",",
"'.csv.gz'",
... | Saves the SArray to file.
The saved SArray will be in a directory named with the `targetfile`
parameter.
Parameters
----------
filename : string
A local path or a remote URL. If format is 'text', it will be
saved as a text file. If format is 'binary', a... | [
"Saves",
"the",
"SArray",
"to",
"file",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L705-L743 |
29,507 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray.py | SArray._count_words | def _count_words(self, to_lower=True, delimiters=["\r", "\v", "\n", "\f", "\t", " "]):
"""
This returns an SArray with, for each input string, a dict from the unique,
delimited substrings to their number of occurrences within the original
string.
The SArray must be of type strin... | python | def _count_words(self, to_lower=True, delimiters=["\r", "\v", "\n", "\f", "\t", " "]):
"""
This returns an SArray with, for each input string, a dict from the unique,
delimited substrings to their number of occurrences within the original
string.
The SArray must be of type strin... | [
"def",
"_count_words",
"(",
"self",
",",
"to_lower",
"=",
"True",
",",
"delimiters",
"=",
"[",
"\"\\r\"",
",",
"\"\\v\"",
",",
"\"\\n\"",
",",
"\"\\f\"",
",",
"\"\\t\"",
",",
"\" \"",
"]",
")",
":",
"if",
"(",
"self",
".",
"dtype",
"!=",
"str",
")",
... | This returns an SArray with, for each input string, a dict from the unique,
delimited substrings to their number of occurrences within the original
string.
The SArray must be of type string.
..WARNING:: This function is deprecated, and will be removed in future
versions of Turi... | [
"This",
"returns",
"an",
"SArray",
"with",
"for",
"each",
"input",
"string",
"a",
"dict",
"from",
"the",
"unique",
"delimited",
"substrings",
"to",
"their",
"number",
"of",
"occurrences",
"within",
"the",
"original",
"string",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L1506-L1558 |
29,508 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray.py | SArray.dict_has_any_keys | def dict_has_any_keys(self, keys):
"""
Create a boolean SArray by checking the keys of an SArray of
dictionaries. An element of the output SArray is True if the
corresponding input element's dictionary has any of the given keys.
Fails on SArrays whose data type is not ``dict``.
... | python | def dict_has_any_keys(self, keys):
"""
Create a boolean SArray by checking the keys of an SArray of
dictionaries. An element of the output SArray is True if the
corresponding input element's dictionary has any of the given keys.
Fails on SArrays whose data type is not ``dict``.
... | [
"def",
"dict_has_any_keys",
"(",
"self",
",",
"keys",
")",
":",
"if",
"not",
"_is_non_string_iterable",
"(",
"keys",
")",
":",
"keys",
"=",
"[",
"keys",
"]",
"with",
"cython_context",
"(",
")",
":",
"return",
"SArray",
"(",
"_proxy",
"=",
"self",
".",
... | Create a boolean SArray by checking the keys of an SArray of
dictionaries. An element of the output SArray is True if the
corresponding input element's dictionary has any of the given keys.
Fails on SArrays whose data type is not ``dict``.
Parameters
----------
keys : li... | [
"Create",
"a",
"boolean",
"SArray",
"by",
"checking",
"the",
"keys",
"of",
"an",
"SArray",
"of",
"dictionaries",
".",
"An",
"element",
"of",
"the",
"output",
"SArray",
"is",
"True",
"if",
"the",
"corresponding",
"input",
"element",
"s",
"dictionary",
"has",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L1745-L1781 |
29,509 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray.py | SArray.dict_has_all_keys | def dict_has_all_keys(self, keys):
"""
Create a boolean SArray by checking the keys of an SArray of
dictionaries. An element of the output SArray is True if the
corresponding input element's dictionary has all of the given keys.
Fails on SArrays whose data type is not ``dict``.
... | python | def dict_has_all_keys(self, keys):
"""
Create a boolean SArray by checking the keys of an SArray of
dictionaries. An element of the output SArray is True if the
corresponding input element's dictionary has all of the given keys.
Fails on SArrays whose data type is not ``dict``.
... | [
"def",
"dict_has_all_keys",
"(",
"self",
",",
"keys",
")",
":",
"if",
"not",
"_is_non_string_iterable",
"(",
"keys",
")",
":",
"keys",
"=",
"[",
"keys",
"]",
"with",
"cython_context",
"(",
")",
":",
"return",
"SArray",
"(",
"_proxy",
"=",
"self",
".",
... | Create a boolean SArray by checking the keys of an SArray of
dictionaries. An element of the output SArray is True if the
corresponding input element's dictionary has all of the given keys.
Fails on SArrays whose data type is not ``dict``.
Parameters
----------
keys : li... | [
"Create",
"a",
"boolean",
"SArray",
"by",
"checking",
"the",
"keys",
"of",
"an",
"SArray",
"of",
"dictionaries",
".",
"An",
"element",
"of",
"the",
"output",
"SArray",
"is",
"True",
"if",
"the",
"corresponding",
"input",
"element",
"s",
"dictionary",
"has",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L1783-L1819 |
29,510 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray.py | SArray.filter | def filter(self, fn, skip_na=True, seed=None):
"""
Filter this SArray by a function.
Returns a new SArray filtered by this SArray. If `fn` evaluates an
element to true, this element is copied to the new SArray. If not, it
isn't. Throws an exception if the return type of `fn` is... | python | def filter(self, fn, skip_na=True, seed=None):
"""
Filter this SArray by a function.
Returns a new SArray filtered by this SArray. If `fn` evaluates an
element to true, this element is copied to the new SArray. If not, it
isn't. Throws an exception if the return type of `fn` is... | [
"def",
"filter",
"(",
"self",
",",
"fn",
",",
"skip_na",
"=",
"True",
",",
"seed",
"=",
"None",
")",
":",
"assert",
"callable",
"(",
"fn",
")",
",",
"\"Input must be callable\"",
"if",
"seed",
"is",
"None",
":",
"seed",
"=",
"abs",
"(",
"hash",
"(",
... | Filter this SArray by a function.
Returns a new SArray filtered by this SArray. If `fn` evaluates an
element to true, this element is copied to the new SArray. If not, it
isn't. Throws an exception if the return type of `fn` is not castable
to a boolean value.
Parameters
... | [
"Filter",
"this",
"SArray",
"by",
"a",
"function",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L1923-L1963 |
29,511 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray.py | SArray.sample | def sample(self, fraction, seed=None, exact=False):
"""
Create an SArray which contains a subsample of the current SArray.
Parameters
----------
fraction : float
Fraction of the rows to fetch. Must be between 0 and 1.
if exact is False (default), the numb... | python | def sample(self, fraction, seed=None, exact=False):
"""
Create an SArray which contains a subsample of the current SArray.
Parameters
----------
fraction : float
Fraction of the rows to fetch. Must be between 0 and 1.
if exact is False (default), the numb... | [
"def",
"sample",
"(",
"self",
",",
"fraction",
",",
"seed",
"=",
"None",
",",
"exact",
"=",
"False",
")",
":",
"if",
"(",
"fraction",
">",
"1",
"or",
"fraction",
"<",
"0",
")",
":",
"raise",
"ValueError",
"(",
"'Invalid sampling rate: '",
"+",
"str",
... | Create an SArray which contains a subsample of the current SArray.
Parameters
----------
fraction : float
Fraction of the rows to fetch. Must be between 0 and 1.
if exact is False (default), the number of rows returned is
approximately the fraction times the ... | [
"Create",
"an",
"SArray",
"which",
"contains",
"a",
"subsample",
"of",
"the",
"current",
"SArray",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L1966-L2006 |
29,512 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray.py | SArray.hash | def hash(self, seed=0):
"""
Returns an SArray with a hash of each element. seed can be used
to change the hash function to allow this method to be used for
random number generation.
Parameters
----------
seed : int
Defaults to 0. Can be changed to dif... | python | def hash(self, seed=0):
"""
Returns an SArray with a hash of each element. seed can be used
to change the hash function to allow this method to be used for
random number generation.
Parameters
----------
seed : int
Defaults to 0. Can be changed to dif... | [
"def",
"hash",
"(",
"self",
",",
"seed",
"=",
"0",
")",
":",
"with",
"cython_context",
"(",
")",
":",
"return",
"SArray",
"(",
"_proxy",
"=",
"self",
".",
"__proxy__",
".",
"hash",
"(",
"seed",
")",
")"
] | Returns an SArray with a hash of each element. seed can be used
to change the hash function to allow this method to be used for
random number generation.
Parameters
----------
seed : int
Defaults to 0. Can be changed to different values to get
different h... | [
"Returns",
"an",
"SArray",
"with",
"a",
"hash",
"of",
"each",
"element",
".",
"seed",
"can",
"be",
"used",
"to",
"change",
"the",
"hash",
"function",
"to",
"allow",
"this",
"method",
"to",
"be",
"used",
"for",
"random",
"number",
"generation",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2008-L2027 |
29,513 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray.py | SArray.random_integers | def random_integers(cls, size, seed=None):
"""
Returns an SArray with random integer values.
"""
if seed is None:
seed = abs(hash("%0.20f" % time.time())) % (2 ** 31)
return cls.from_sequence(size).hash(seed) | python | def random_integers(cls, size, seed=None):
"""
Returns an SArray with random integer values.
"""
if seed is None:
seed = abs(hash("%0.20f" % time.time())) % (2 ** 31)
return cls.from_sequence(size).hash(seed) | [
"def",
"random_integers",
"(",
"cls",
",",
"size",
",",
"seed",
"=",
"None",
")",
":",
"if",
"seed",
"is",
"None",
":",
"seed",
"=",
"abs",
"(",
"hash",
"(",
"\"%0.20f\"",
"%",
"time",
".",
"time",
"(",
")",
")",
")",
"%",
"(",
"2",
"**",
"31",... | Returns an SArray with random integer values. | [
"Returns",
"an",
"SArray",
"with",
"random",
"integer",
"values",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2030-L2036 |
29,514 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray.py | SArray.argmin | def argmin(self):
"""
Get the index of the minimum numeric value in SArray.
Returns None on an empty SArray. Raises an exception if called on an
SArray with non-numeric type.
Returns
-------
out : int
index of the minimum value of SArray
See... | python | def argmin(self):
"""
Get the index of the minimum numeric value in SArray.
Returns None on an empty SArray. Raises an exception if called on an
SArray with non-numeric type.
Returns
-------
out : int
index of the minimum value of SArray
See... | [
"def",
"argmin",
"(",
"self",
")",
":",
"from",
".",
"sframe",
"import",
"SFrame",
"as",
"_SFrame",
"if",
"len",
"(",
"self",
")",
"==",
"0",
":",
"return",
"None",
"if",
"not",
"any",
"(",
"[",
"isinstance",
"(",
"self",
"[",
"0",
"]",
",",
"i",... | Get the index of the minimum numeric value in SArray.
Returns None on an empty SArray. Raises an exception if called on an
SArray with non-numeric type.
Returns
-------
out : int
index of the minimum value of SArray
See Also
--------
argmax
... | [
"Get",
"the",
"index",
"of",
"the",
"minimum",
"numeric",
"value",
"in",
"SArray",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2201-L2231 |
29,515 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray.py | SArray.mean | def mean(self):
"""
Mean of all the values in the SArray, or mean image.
Returns None on an empty SArray. Raises an exception if called on an
SArray with non-numeric type or non-Image type.
Returns
-------
out : float | turicreate.Image
Mean of all v... | python | def mean(self):
"""
Mean of all the values in the SArray, or mean image.
Returns None on an empty SArray. Raises an exception if called on an
SArray with non-numeric type or non-Image type.
Returns
-------
out : float | turicreate.Image
Mean of all v... | [
"def",
"mean",
"(",
"self",
")",
":",
"with",
"cython_context",
"(",
")",
":",
"if",
"self",
".",
"dtype",
"==",
"_Image",
":",
"from",
".",
".",
"import",
"extensions",
"return",
"extensions",
".",
"generate_mean",
"(",
"self",
")",
"else",
":",
"retu... | Mean of all the values in the SArray, or mean image.
Returns None on an empty SArray. Raises an exception if called on an
SArray with non-numeric type or non-Image type.
Returns
-------
out : float | turicreate.Image
Mean of all values in SArray, or image holding pe... | [
"Mean",
"of",
"all",
"the",
"values",
"in",
"the",
"SArray",
"or",
"mean",
"image",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2252-L2270 |
29,516 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray.py | SArray.datetime_to_str | def datetime_to_str(self,format="%Y-%m-%dT%H:%M:%S%ZP"):
"""
Create a new SArray with all the values cast to str. The string format is
specified by the 'format' parameter.
Parameters
----------
format : str
The format to output the string. Default format is "... | python | def datetime_to_str(self,format="%Y-%m-%dT%H:%M:%S%ZP"):
"""
Create a new SArray with all the values cast to str. The string format is
specified by the 'format' parameter.
Parameters
----------
format : str
The format to output the string. Default format is "... | [
"def",
"datetime_to_str",
"(",
"self",
",",
"format",
"=",
"\"%Y-%m-%dT%H:%M:%S%ZP\"",
")",
":",
"if",
"(",
"self",
".",
"dtype",
"!=",
"datetime",
".",
"datetime",
")",
":",
"raise",
"TypeError",
"(",
"\"datetime_to_str expects SArray of datetime as input SArray\"",
... | Create a new SArray with all the values cast to str. The string format is
specified by the 'format' parameter.
Parameters
----------
format : str
The format to output the string. Default format is "%Y-%m-%dT%H:%M:%S%ZP".
Returns
-------
out : SArray[... | [
"Create",
"a",
"new",
"SArray",
"with",
"all",
"the",
"values",
"cast",
"to",
"str",
".",
"The",
"string",
"format",
"is",
"specified",
"by",
"the",
"format",
"parameter",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2338-L2375 |
29,517 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray.py | SArray.str_to_datetime | def str_to_datetime(self,format="%Y-%m-%dT%H:%M:%S%ZP"):
"""
Create a new SArray with all the values cast to datetime. The string format is
specified by the 'format' parameter.
Parameters
----------
format : str
The string format of the input SArray. Default ... | python | def str_to_datetime(self,format="%Y-%m-%dT%H:%M:%S%ZP"):
"""
Create a new SArray with all the values cast to datetime. The string format is
specified by the 'format' parameter.
Parameters
----------
format : str
The string format of the input SArray. Default ... | [
"def",
"str_to_datetime",
"(",
"self",
",",
"format",
"=",
"\"%Y-%m-%dT%H:%M:%S%ZP\"",
")",
":",
"if",
"(",
"self",
".",
"dtype",
"!=",
"str",
")",
":",
"raise",
"TypeError",
"(",
"\"str_to_datetime expects SArray of str as input SArray\"",
")",
"with",
"cython_cont... | Create a new SArray with all the values cast to datetime. The string format is
specified by the 'format' parameter.
Parameters
----------
format : str
The string format of the input SArray. Default format is "%Y-%m-%dT%H:%M:%S%ZP".
If format is "ISO", the the for... | [
"Create",
"a",
"new",
"SArray",
"with",
"all",
"the",
"values",
"cast",
"to",
"datetime",
".",
"The",
"string",
"format",
"is",
"specified",
"by",
"the",
"format",
"parameter",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2377-L2413 |
29,518 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray.py | SArray.astype | def astype(self, dtype, undefined_on_failure=False):
"""
Create a new SArray with all values cast to the given type. Throws an
exception if the types are not castable to the given type.
Parameters
----------
dtype : {int, float, str, list, array.array, dict, datetime.dat... | python | def astype(self, dtype, undefined_on_failure=False):
"""
Create a new SArray with all values cast to the given type. Throws an
exception if the types are not castable to the given type.
Parameters
----------
dtype : {int, float, str, list, array.array, dict, datetime.dat... | [
"def",
"astype",
"(",
"self",
",",
"dtype",
",",
"undefined_on_failure",
"=",
"False",
")",
":",
"if",
"(",
"dtype",
"==",
"_Image",
")",
"and",
"(",
"self",
".",
"dtype",
"==",
"array",
".",
"array",
")",
":",
"raise",
"TypeError",
"(",
"\"Cannot cast... | Create a new SArray with all values cast to the given type. Throws an
exception if the types are not castable to the given type.
Parameters
----------
dtype : {int, float, str, list, array.array, dict, datetime.datetime}
The type to cast the elements to in SArray
un... | [
"Create",
"a",
"new",
"SArray",
"with",
"all",
"values",
"cast",
"to",
"the",
"given",
"type",
".",
"Throws",
"an",
"exception",
"if",
"the",
"types",
"are",
"not",
"castable",
"to",
"the",
"given",
"type",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2480-L2531 |
29,519 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray.py | SArray.clip | def clip(self, lower=float('nan'), upper=float('nan')):
"""
Create a new SArray with each value clipped to be within the given
bounds.
In this case, "clipped" means that values below the lower bound will be
set to the lower bound value. Values above the upper bound will be set
... | python | def clip(self, lower=float('nan'), upper=float('nan')):
"""
Create a new SArray with each value clipped to be within the given
bounds.
In this case, "clipped" means that values below the lower bound will be
set to the lower bound value. Values above the upper bound will be set
... | [
"def",
"clip",
"(",
"self",
",",
"lower",
"=",
"float",
"(",
"'nan'",
")",
",",
"upper",
"=",
"float",
"(",
"'nan'",
")",
")",
":",
"with",
"cython_context",
"(",
")",
":",
"return",
"SArray",
"(",
"_proxy",
"=",
"self",
".",
"__proxy__",
".",
"cli... | Create a new SArray with each value clipped to be within the given
bounds.
In this case, "clipped" means that values below the lower bound will be
set to the lower bound value. Values above the upper bound will be set
to the upper bound value. This function can operate on SArrays of
... | [
"Create",
"a",
"new",
"SArray",
"with",
"each",
"value",
"clipped",
"to",
"be",
"within",
"the",
"given",
"bounds",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2533-L2573 |
29,520 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray.py | SArray.clip_lower | def clip_lower(self, threshold):
"""
Create new SArray with all values clipped to the given lower bound. This
function can operate on numeric arrays, as well as vector arrays, in
which case each individual element in each vector is clipped. Throws an
exception if the SArray is em... | python | def clip_lower(self, threshold):
"""
Create new SArray with all values clipped to the given lower bound. This
function can operate on numeric arrays, as well as vector arrays, in
which case each individual element in each vector is clipped. Throws an
exception if the SArray is em... | [
"def",
"clip_lower",
"(",
"self",
",",
"threshold",
")",
":",
"with",
"cython_context",
"(",
")",
":",
"return",
"SArray",
"(",
"_proxy",
"=",
"self",
".",
"__proxy__",
".",
"clip",
"(",
"threshold",
",",
"float",
"(",
"'nan'",
")",
")",
")"
] | Create new SArray with all values clipped to the given lower bound. This
function can operate on numeric arrays, as well as vector arrays, in
which case each individual element in each vector is clipped. Throws an
exception if the SArray is empty or the types are non-numeric.
Parameters... | [
"Create",
"new",
"SArray",
"with",
"all",
"values",
"clipped",
"to",
"the",
"given",
"lower",
"bound",
".",
"This",
"function",
"can",
"operate",
"on",
"numeric",
"arrays",
"as",
"well",
"as",
"vector",
"arrays",
"in",
"which",
"case",
"each",
"individual",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2575-L2604 |
29,521 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray.py | SArray.tail | def tail(self, n=10):
"""
Get an SArray that contains the last n elements in the SArray.
Parameters
----------
n : int
The number of elements to fetch
Returns
-------
out : SArray
A new SArray which contains the last n rows of the... | python | def tail(self, n=10):
"""
Get an SArray that contains the last n elements in the SArray.
Parameters
----------
n : int
The number of elements to fetch
Returns
-------
out : SArray
A new SArray which contains the last n rows of the... | [
"def",
"tail",
"(",
"self",
",",
"n",
"=",
"10",
")",
":",
"with",
"cython_context",
"(",
")",
":",
"return",
"SArray",
"(",
"_proxy",
"=",
"self",
".",
"__proxy__",
".",
"tail",
"(",
"n",
")",
")"
] | Get an SArray that contains the last n elements in the SArray.
Parameters
----------
n : int
The number of elements to fetch
Returns
-------
out : SArray
A new SArray which contains the last n rows of the current SArray. | [
"Get",
"an",
"SArray",
"that",
"contains",
"the",
"last",
"n",
"elements",
"in",
"the",
"SArray",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2637-L2652 |
29,522 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray.py | SArray.is_topk | def is_topk(self, topk=10, reverse=False):
"""
Create an SArray indicating which elements are in the top k.
Entries are '1' if the corresponding element in the current SArray is a
part of the top k elements, and '0' if that corresponding element is
not. Order is descending by de... | python | def is_topk(self, topk=10, reverse=False):
"""
Create an SArray indicating which elements are in the top k.
Entries are '1' if the corresponding element in the current SArray is a
part of the top k elements, and '0' if that corresponding element is
not. Order is descending by de... | [
"def",
"is_topk",
"(",
"self",
",",
"topk",
"=",
"10",
",",
"reverse",
"=",
"False",
")",
":",
"with",
"cython_context",
"(",
")",
":",
"return",
"SArray",
"(",
"_proxy",
"=",
"self",
".",
"__proxy__",
".",
"topk_index",
"(",
"topk",
",",
"reverse",
... | Create an SArray indicating which elements are in the top k.
Entries are '1' if the corresponding element in the current SArray is a
part of the top k elements, and '0' if that corresponding element is
not. Order is descending by default.
Parameters
----------
topk : in... | [
"Create",
"an",
"SArray",
"indicating",
"which",
"elements",
"are",
"in",
"the",
"top",
"k",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2697-L2722 |
29,523 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray.py | SArray.summary | def summary(self, background=False, sub_sketch_keys=None):
"""
Summary statistics that can be calculated with one pass over the SArray.
Returns a turicreate.Sketch object which can be further queried for many
descriptive statistics over this SArray. Many of the statistics are
ap... | python | def summary(self, background=False, sub_sketch_keys=None):
"""
Summary statistics that can be calculated with one pass over the SArray.
Returns a turicreate.Sketch object which can be further queried for many
descriptive statistics over this SArray. Many of the statistics are
ap... | [
"def",
"summary",
"(",
"self",
",",
"background",
"=",
"False",
",",
"sub_sketch_keys",
"=",
"None",
")",
":",
"from",
".",
".",
"data_structures",
".",
"sketch",
"import",
"Sketch",
"if",
"(",
"self",
".",
"dtype",
"==",
"_Image",
")",
":",
"raise",
"... | Summary statistics that can be calculated with one pass over the SArray.
Returns a turicreate.Sketch object which can be further queried for many
descriptive statistics over this SArray. Many of the statistics are
approximate. See the :class:`~turicreate.Sketch` documentation for more
d... | [
"Summary",
"statistics",
"that",
"can",
"be",
"calculated",
"with",
"one",
"pass",
"over",
"the",
"SArray",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2724-L2775 |
29,524 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray.py | SArray.value_counts | def value_counts(self):
"""
Return an SFrame containing counts of unique values. The resulting
SFrame will be sorted in descending frequency.
Returns
-------
out : SFrame
An SFrame containing 2 columns : 'value', and 'count'. The SFrame will
be so... | python | def value_counts(self):
"""
Return an SFrame containing counts of unique values. The resulting
SFrame will be sorted in descending frequency.
Returns
-------
out : SFrame
An SFrame containing 2 columns : 'value', and 'count'. The SFrame will
be so... | [
"def",
"value_counts",
"(",
"self",
")",
":",
"from",
".",
"sframe",
"import",
"SFrame",
"as",
"_SFrame",
"return",
"_SFrame",
"(",
"{",
"'value'",
":",
"self",
"}",
")",
".",
"groupby",
"(",
"'value'",
",",
"{",
"'count'",
":",
"_aggregate",
".",
"COU... | Return an SFrame containing counts of unique values. The resulting
SFrame will be sorted in descending frequency.
Returns
-------
out : SFrame
An SFrame containing 2 columns : 'value', and 'count'. The SFrame will
be sorted in descending order by the column 'coun... | [
"Return",
"an",
"SFrame",
"containing",
"counts",
"of",
"unique",
"values",
".",
"The",
"resulting",
"SFrame",
"will",
"be",
"sorted",
"in",
"descending",
"frequency",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2777-L2811 |
29,525 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray.py | SArray.append | def append(self, other):
"""
Append an SArray to the current SArray. Creates a new SArray with the
rows from both SArrays. Both SArrays must be of the same type.
Parameters
----------
other : SArray
Another SArray whose rows are appended to current SArray.
... | python | def append(self, other):
"""
Append an SArray to the current SArray. Creates a new SArray with the
rows from both SArrays. Both SArrays must be of the same type.
Parameters
----------
other : SArray
Another SArray whose rows are appended to current SArray.
... | [
"def",
"append",
"(",
"self",
",",
"other",
")",
":",
"if",
"type",
"(",
"other",
")",
"is",
"not",
"SArray",
":",
"raise",
"RuntimeError",
"(",
"\"SArray append can only work with SArray\"",
")",
"if",
"self",
".",
"dtype",
"!=",
"other",
".",
"dtype",
":... | Append an SArray to the current SArray. Creates a new SArray with the
rows from both SArrays. Both SArrays must be of the same type.
Parameters
----------
other : SArray
Another SArray whose rows are appended to current SArray.
Returns
-------
out : ... | [
"Append",
"an",
"SArray",
"to",
"the",
"current",
"SArray",
".",
"Creates",
"a",
"new",
"SArray",
"with",
"the",
"rows",
"from",
"both",
"SArrays",
".",
"Both",
"SArrays",
"must",
"be",
"of",
"the",
"same",
"type",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2814-L2850 |
29,526 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray.py | SArray.unique | def unique(self):
"""
Get all unique values in the current SArray.
Raises a TypeError if the SArray is of dictionary type. Will not
necessarily preserve the order of the given SArray in the new SArray.
Returns
-------
out : SArray
A new SArray that ... | python | def unique(self):
"""
Get all unique values in the current SArray.
Raises a TypeError if the SArray is of dictionary type. Will not
necessarily preserve the order of the given SArray in the new SArray.
Returns
-------
out : SArray
A new SArray that ... | [
"def",
"unique",
"(",
"self",
")",
":",
"from",
".",
"sframe",
"import",
"SFrame",
"as",
"_SFrame",
"tmp_sf",
"=",
"_SFrame",
"(",
")",
"tmp_sf",
".",
"add_column",
"(",
"self",
",",
"'X1'",
",",
"inplace",
"=",
"True",
")",
"res",
"=",
"tmp_sf",
"."... | Get all unique values in the current SArray.
Raises a TypeError if the SArray is of dictionary type. Will not
necessarily preserve the order of the given SArray in the new SArray.
Returns
-------
out : SArray
A new SArray that contains the unique values of the curr... | [
"Get",
"all",
"unique",
"values",
"in",
"the",
"current",
"SArray",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2852-L2876 |
29,527 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray.py | SArray.show | def show(self, title=LABEL_DEFAULT, xlabel=LABEL_DEFAULT, ylabel=LABEL_DEFAULT):
"""
Visualize the SArray.
Notes
-----
- The plot will render either inline in a Jupyter Notebook, or in a
native GUI window, depending on the value provided in
`turicreate.visual... | python | def show(self, title=LABEL_DEFAULT, xlabel=LABEL_DEFAULT, ylabel=LABEL_DEFAULT):
"""
Visualize the SArray.
Notes
-----
- The plot will render either inline in a Jupyter Notebook, or in a
native GUI window, depending on the value provided in
`turicreate.visual... | [
"def",
"show",
"(",
"self",
",",
"title",
"=",
"LABEL_DEFAULT",
",",
"xlabel",
"=",
"LABEL_DEFAULT",
",",
"ylabel",
"=",
"LABEL_DEFAULT",
")",
":",
"returned_plot",
"=",
"self",
".",
"plot",
"(",
"title",
",",
"xlabel",
",",
"ylabel",
")",
"returned_plot",... | Visualize the SArray.
Notes
-----
- The plot will render either inline in a Jupyter Notebook, or in a
native GUI window, depending on the value provided in
`turicreate.visualization.set_target` (defaults to 'auto').
Parameters
----------
title : str
... | [
"Visualize",
"the",
"SArray",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2905-L2946 |
29,528 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray.py | SArray.plot | def plot(self, title=LABEL_DEFAULT, xlabel=LABEL_DEFAULT, ylabel=LABEL_DEFAULT):
"""
Create a Plot object representing the SArray.
Notes
-----
- The plot will render either inline in a Jupyter Notebook, or in a
native GUI window, depending on the value provided in
... | python | def plot(self, title=LABEL_DEFAULT, xlabel=LABEL_DEFAULT, ylabel=LABEL_DEFAULT):
"""
Create a Plot object representing the SArray.
Notes
-----
- The plot will render either inline in a Jupyter Notebook, or in a
native GUI window, depending on the value provided in
... | [
"def",
"plot",
"(",
"self",
",",
"title",
"=",
"LABEL_DEFAULT",
",",
"xlabel",
"=",
"LABEL_DEFAULT",
",",
"ylabel",
"=",
"LABEL_DEFAULT",
")",
":",
"if",
"title",
"==",
"\"\"",
":",
"title",
"=",
"\" \"",
"if",
"xlabel",
"==",
"\"\"",
":",
"xlabel",
"=... | Create a Plot object representing the SArray.
Notes
-----
- The plot will render either inline in a Jupyter Notebook, or in a
native GUI window, depending on the value provided in
`turicreate.visualization.set_target` (defaults to 'auto').
Parameters
-------... | [
"Create",
"a",
"Plot",
"object",
"representing",
"the",
"SArray",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L2948-L3006 |
29,529 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray.py | SArray.item_length | def item_length(self):
"""
Length of each element in the current SArray.
Only works on SArrays of dict, array, or list type. If a given element
is a missing value, then the output elements is also a missing value.
This function is equivalent to the following but more performant:... | python | def item_length(self):
"""
Length of each element in the current SArray.
Only works on SArrays of dict, array, or list type. If a given element
is a missing value, then the output elements is also a missing value.
This function is equivalent to the following but more performant:... | [
"def",
"item_length",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"dtype",
"not",
"in",
"[",
"list",
",",
"dict",
",",
"array",
".",
"array",
"]",
")",
":",
"raise",
"TypeError",
"(",
"\"item_length() is only applicable for SArray of type list, dict and array... | Length of each element in the current SArray.
Only works on SArrays of dict, array, or list type. If a given element
is a missing value, then the output elements is also a missing value.
This function is equivalent to the following but more performant:
sa_item_len = sa.apply(lambd... | [
"Length",
"of",
"each",
"element",
"in",
"the",
"current",
"SArray",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L3008-L3043 |
29,530 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray.py | SArray.stack | def stack(self, new_column_name=None, drop_na=False, new_column_type=None):
"""
Convert a "wide" SArray to one or two "tall" columns in an SFrame by
stacking all values.
The stack works only for columns of dict, list, or array type. If the
column is dict type, two new columns a... | python | def stack(self, new_column_name=None, drop_na=False, new_column_type=None):
"""
Convert a "wide" SArray to one or two "tall" columns in an SFrame by
stacking all values.
The stack works only for columns of dict, list, or array type. If the
column is dict type, two new columns a... | [
"def",
"stack",
"(",
"self",
",",
"new_column_name",
"=",
"None",
",",
"drop_na",
"=",
"False",
",",
"new_column_type",
"=",
"None",
")",
":",
"from",
".",
"sframe",
"import",
"SFrame",
"as",
"_SFrame",
"return",
"_SFrame",
"(",
"{",
"'SArray'",
":",
"se... | Convert a "wide" SArray to one or two "tall" columns in an SFrame by
stacking all values.
The stack works only for columns of dict, list, or array type. If the
column is dict type, two new columns are created as a result of
stacking: one column holds the key and another column holds th... | [
"Convert",
"a",
"wide",
"SArray",
"to",
"one",
"or",
"two",
"tall",
"columns",
"in",
"an",
"SFrame",
"by",
"stacking",
"all",
"values",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L3219-L3294 |
29,531 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray.py | SArray.sort | def sort(self, ascending=True):
"""
Sort all values in this SArray.
Sort only works for sarray of type str, int and float, otherwise TypeError
will be raised. Creates a new, sorted SArray.
Parameters
----------
ascending: boolean, optional
If true, th... | python | def sort(self, ascending=True):
"""
Sort all values in this SArray.
Sort only works for sarray of type str, int and float, otherwise TypeError
will be raised. Creates a new, sorted SArray.
Parameters
----------
ascending: boolean, optional
If true, th... | [
"def",
"sort",
"(",
"self",
",",
"ascending",
"=",
"True",
")",
":",
"from",
".",
"sframe",
"import",
"SFrame",
"as",
"_SFrame",
"if",
"self",
".",
"dtype",
"not",
"in",
"(",
"int",
",",
"float",
",",
"str",
",",
"datetime",
".",
"datetime",
")",
"... | Sort all values in this SArray.
Sort only works for sarray of type str, int and float, otherwise TypeError
will be raised. Creates a new, sorted SArray.
Parameters
----------
ascending: boolean, optional
If true, the sarray values are sorted in ascending order, other... | [
"Sort",
"all",
"values",
"in",
"this",
"SArray",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L3495-L3526 |
29,532 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray.py | SArray.rolling_sum | def rolling_sum(self, window_start, window_end, min_observations=None):
"""
Calculate a new SArray of the sum of different subsets over this
SArray.
Also known as a "moving sum" or "running sum". The subset that
the sum is calculated over is defined as an inclusive range relativ... | python | def rolling_sum(self, window_start, window_end, min_observations=None):
"""
Calculate a new SArray of the sum of different subsets over this
SArray.
Also known as a "moving sum" or "running sum". The subset that
the sum is calculated over is defined as an inclusive range relativ... | [
"def",
"rolling_sum",
"(",
"self",
",",
"window_start",
",",
"window_end",
",",
"min_observations",
"=",
"None",
")",
":",
"min_observations",
"=",
"self",
".",
"__check_min_observations",
"(",
"min_observations",
")",
"agg_op",
"=",
"None",
"if",
"self",
".",
... | Calculate a new SArray of the sum of different subsets over this
SArray.
Also known as a "moving sum" or "running sum". The subset that
the sum is calculated over is defined as an inclusive range relative
to the position to each value in the SArray, using `window_start` and
`win... | [
"Calculate",
"a",
"new",
"SArray",
"of",
"the",
"sum",
"of",
"different",
"subsets",
"over",
"this",
"SArray",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L3640-L3743 |
29,533 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray.py | SArray.rolling_max | def rolling_max(self, window_start, window_end, min_observations=None):
"""
Calculate a new SArray of the maximum value of different subsets over
this SArray.
The subset that the maximum is calculated over is defined as an
inclusive range relative to the position to each value i... | python | def rolling_max(self, window_start, window_end, min_observations=None):
"""
Calculate a new SArray of the maximum value of different subsets over
this SArray.
The subset that the maximum is calculated over is defined as an
inclusive range relative to the position to each value i... | [
"def",
"rolling_max",
"(",
"self",
",",
"window_start",
",",
"window_end",
",",
"min_observations",
"=",
"None",
")",
":",
"min_observations",
"=",
"self",
".",
"__check_min_observations",
"(",
"min_observations",
")",
"agg_op",
"=",
"'__builtin__max__'",
"return",
... | Calculate a new SArray of the maximum value of different subsets over
this SArray.
The subset that the maximum is calculated over is defined as an
inclusive range relative to the position to each value in the SArray,
using `window_start` and `window_end`. For a better understanding of
... | [
"Calculate",
"a",
"new",
"SArray",
"of",
"the",
"maximum",
"value",
"of",
"different",
"subsets",
"over",
"this",
"SArray",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L3745-L3843 |
29,534 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray.py | SArray.rolling_count | def rolling_count(self, window_start, window_end):
"""
Count the number of non-NULL values of different subsets over this
SArray.
The subset that the count is executed on is defined as an inclusive
range relative to the position to each value in the SArray, using
`window... | python | def rolling_count(self, window_start, window_end):
"""
Count the number of non-NULL values of different subsets over this
SArray.
The subset that the count is executed on is defined as an inclusive
range relative to the position to each value in the SArray, using
`window... | [
"def",
"rolling_count",
"(",
"self",
",",
"window_start",
",",
"window_end",
")",
":",
"agg_op",
"=",
"'__builtin__nonnull__count__'",
"return",
"SArray",
"(",
"_proxy",
"=",
"self",
".",
"__proxy__",
".",
"builtin_rolling_apply",
"(",
"agg_op",
",",
"window_start... | Count the number of non-NULL values of different subsets over this
SArray.
The subset that the count is executed on is defined as an inclusive
range relative to the position to each value in the SArray, using
`window_start` and `window_end`. For a better understanding of this,
s... | [
"Count",
"the",
"number",
"of",
"non",
"-",
"NULL",
"values",
"of",
"different",
"subsets",
"over",
"this",
"SArray",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L4146-L4221 |
29,535 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray.py | SArray.cumulative_sum | def cumulative_sum(self):
"""
Return the cumulative sum of the elements in the SArray.
Returns an SArray where each element in the output corresponds to the
sum of all the elements preceding and including it. The SArray is
expected to be of numeric type (int, float), or a numeri... | python | def cumulative_sum(self):
"""
Return the cumulative sum of the elements in the SArray.
Returns an SArray where each element in the output corresponds to the
sum of all the elements preceding and including it. The SArray is
expected to be of numeric type (int, float), or a numeri... | [
"def",
"cumulative_sum",
"(",
"self",
")",
":",
"from",
".",
".",
"import",
"extensions",
"agg_op",
"=",
"\"__builtin__cum_sum__\"",
"return",
"SArray",
"(",
"_proxy",
"=",
"self",
".",
"__proxy__",
".",
"builtin_cumulative_aggregate",
"(",
"agg_op",
")",
")"
] | Return the cumulative sum of the elements in the SArray.
Returns an SArray where each element in the output corresponds to the
sum of all the elements preceding and including it. The SArray is
expected to be of numeric type (int, float), or a numeric vector type.
Returns
------... | [
"Return",
"the",
"cumulative",
"sum",
"of",
"the",
"elements",
"in",
"the",
"SArray",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L4223-L4252 |
29,536 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray.py | SArray.cumulative_mean | def cumulative_mean(self):
"""
Return the cumulative mean of the elements in the SArray.
Returns an SArray where each element in the output corresponds to the
mean value of all the elements preceding and including it. The SArray
is expected to be of numeric type (int, float), or... | python | def cumulative_mean(self):
"""
Return the cumulative mean of the elements in the SArray.
Returns an SArray where each element in the output corresponds to the
mean value of all the elements preceding and including it. The SArray
is expected to be of numeric type (int, float), or... | [
"def",
"cumulative_mean",
"(",
"self",
")",
":",
"from",
".",
".",
"import",
"extensions",
"agg_op",
"=",
"\"__builtin__cum_avg__\"",
"return",
"SArray",
"(",
"_proxy",
"=",
"self",
".",
"__proxy__",
".",
"builtin_cumulative_aggregate",
"(",
"agg_op",
")",
")"
] | Return the cumulative mean of the elements in the SArray.
Returns an SArray where each element in the output corresponds to the
mean value of all the elements preceding and including it. The SArray
is expected to be of numeric type (int, float), or a numeric vector
type.
Return... | [
"Return",
"the",
"cumulative",
"mean",
"of",
"the",
"elements",
"in",
"the",
"SArray",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L4254-L4284 |
29,537 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray.py | SArray.cumulative_min | def cumulative_min(self):
"""
Return the cumulative minimum value of the elements in the SArray.
Returns an SArray where each element in the output corresponds to the
minimum value of all the elements preceding and including it. The
SArray is expected to be of numeric type (int,... | python | def cumulative_min(self):
"""
Return the cumulative minimum value of the elements in the SArray.
Returns an SArray where each element in the output corresponds to the
minimum value of all the elements preceding and including it. The
SArray is expected to be of numeric type (int,... | [
"def",
"cumulative_min",
"(",
"self",
")",
":",
"from",
".",
".",
"import",
"extensions",
"agg_op",
"=",
"\"__builtin__cum_min__\"",
"return",
"SArray",
"(",
"_proxy",
"=",
"self",
".",
"__proxy__",
".",
"builtin_cumulative_aggregate",
"(",
"agg_op",
")",
")"
] | Return the cumulative minimum value of the elements in the SArray.
Returns an SArray where each element in the output corresponds to the
minimum value of all the elements preceding and including it. The
SArray is expected to be of numeric type (int, float).
Returns
-------
... | [
"Return",
"the",
"cumulative",
"minimum",
"value",
"of",
"the",
"elements",
"in",
"the",
"SArray",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L4286-L4313 |
29,538 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray.py | SArray.cumulative_max | def cumulative_max(self):
"""
Return the cumulative maximum value of the elements in the SArray.
Returns an SArray where each element in the output corresponds to the
maximum value of all the elements preceding and including it. The
SArray is expected to be of numeric type (int,... | python | def cumulative_max(self):
"""
Return the cumulative maximum value of the elements in the SArray.
Returns an SArray where each element in the output corresponds to the
maximum value of all the elements preceding and including it. The
SArray is expected to be of numeric type (int,... | [
"def",
"cumulative_max",
"(",
"self",
")",
":",
"from",
".",
".",
"import",
"extensions",
"agg_op",
"=",
"\"__builtin__cum_max__\"",
"return",
"SArray",
"(",
"_proxy",
"=",
"self",
".",
"__proxy__",
".",
"builtin_cumulative_aggregate",
"(",
"agg_op",
")",
")"
] | Return the cumulative maximum value of the elements in the SArray.
Returns an SArray where each element in the output corresponds to the
maximum value of all the elements preceding and including it. The
SArray is expected to be of numeric type (int, float).
Returns
-------
... | [
"Return",
"the",
"cumulative",
"maximum",
"value",
"of",
"the",
"elements",
"in",
"the",
"SArray",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L4315-L4342 |
29,539 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray.py | SArray.cumulative_std | def cumulative_std(self):
"""
Return the cumulative standard deviation of the elements in the SArray.
Returns an SArray where each element in the output corresponds to the
standard deviation of all the elements preceding and including it. The
SArray is expected to be of numeric ... | python | def cumulative_std(self):
"""
Return the cumulative standard deviation of the elements in the SArray.
Returns an SArray where each element in the output corresponds to the
standard deviation of all the elements preceding and including it. The
SArray is expected to be of numeric ... | [
"def",
"cumulative_std",
"(",
"self",
")",
":",
"from",
".",
".",
"import",
"extensions",
"agg_op",
"=",
"\"__builtin__cum_std__\"",
"return",
"SArray",
"(",
"_proxy",
"=",
"self",
".",
"__proxy__",
".",
"builtin_cumulative_aggregate",
"(",
"agg_op",
")",
")"
] | Return the cumulative standard deviation of the elements in the SArray.
Returns an SArray where each element in the output corresponds to the
standard deviation of all the elements preceding and including it. The
SArray is expected to be of numeric type, or a numeric vector type.
Retur... | [
"Return",
"the",
"cumulative",
"standard",
"deviation",
"of",
"the",
"elements",
"in",
"the",
"SArray",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L4344-L4371 |
29,540 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray.py | SArray.cumulative_var | def cumulative_var(self):
"""
Return the cumulative variance of the elements in the SArray.
Returns an SArray where each element in the output corresponds to the
variance of all the elements preceding and including it. The SArray is
expected to be of numeric type, or a numeric v... | python | def cumulative_var(self):
"""
Return the cumulative variance of the elements in the SArray.
Returns an SArray where each element in the output corresponds to the
variance of all the elements preceding and including it. The SArray is
expected to be of numeric type, or a numeric v... | [
"def",
"cumulative_var",
"(",
"self",
")",
":",
"from",
".",
".",
"import",
"extensions",
"agg_op",
"=",
"\"__builtin__cum_var__\"",
"return",
"SArray",
"(",
"_proxy",
"=",
"self",
".",
"__proxy__",
".",
"builtin_cumulative_aggregate",
"(",
"agg_op",
")",
")"
] | Return the cumulative variance of the elements in the SArray.
Returns an SArray where each element in the output corresponds to the
variance of all the elements preceding and including it. The SArray is
expected to be of numeric type, or a numeric vector type.
Returns
-------
... | [
"Return",
"the",
"cumulative",
"variance",
"of",
"the",
"elements",
"in",
"the",
"SArray",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray.py#L4373-L4400 |
29,541 | apple/turicreate | src/external/xgboost/subtree/rabit/doc/conf.py | generate_doxygen_xml | def generate_doxygen_xml(app):
"""Run the doxygen make commands if we're on the ReadTheDocs server"""
read_the_docs_build = os.environ.get('READTHEDOCS', None) == 'True'
if read_the_docs_build:
run_doxygen('..')
sys.stderr.write('Check if shared lib exists\n')
run_build_lib('..')
... | python | def generate_doxygen_xml(app):
"""Run the doxygen make commands if we're on the ReadTheDocs server"""
read_the_docs_build = os.environ.get('READTHEDOCS', None) == 'True'
if read_the_docs_build:
run_doxygen('..')
sys.stderr.write('Check if shared lib exists\n')
run_build_lib('..')
... | [
"def",
"generate_doxygen_xml",
"(",
"app",
")",
":",
"read_the_docs_build",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"'READTHEDOCS'",
",",
"None",
")",
"==",
"'True'",
"if",
"read_the_docs_build",
":",
"run_doxygen",
"(",
"'..'",
")",
"sys",
".",
"stderr"... | Run the doxygen make commands if we're on the ReadTheDocs server | [
"Run",
"the",
"doxygen",
"make",
"commands",
"if",
"we",
"re",
"on",
"the",
"ReadTheDocs",
"server"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/subtree/rabit/doc/conf.py#L167-L175 |
29,542 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py | MessageToJson | def MessageToJson(message,
including_default_value_fields=False,
preserving_proto_field_name=False):
"""Converts protobuf message to JSON format.
Args:
message: The protocol buffers message instance to serialize.
including_default_value_fields: If True, singular primitiv... | python | def MessageToJson(message,
including_default_value_fields=False,
preserving_proto_field_name=False):
"""Converts protobuf message to JSON format.
Args:
message: The protocol buffers message instance to serialize.
including_default_value_fields: If True, singular primitiv... | [
"def",
"MessageToJson",
"(",
"message",
",",
"including_default_value_fields",
"=",
"False",
",",
"preserving_proto_field_name",
"=",
"False",
")",
":",
"printer",
"=",
"_Printer",
"(",
"including_default_value_fields",
",",
"preserving_proto_field_name",
")",
"return",
... | Converts protobuf message to JSON format.
Args:
message: The protocol buffers message instance to serialize.
including_default_value_fields: If True, singular primitive fields,
repeated fields, and map fields will always be serialized. If
False, only serialize non-empty fields. Singular mes... | [
"Converts",
"protobuf",
"message",
"to",
"JSON",
"format",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L89-L109 |
29,543 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py | MessageToDict | def MessageToDict(message,
including_default_value_fields=False,
preserving_proto_field_name=False):
"""Converts protobuf message to a JSON dictionary.
Args:
message: The protocol buffers message instance to serialize.
including_default_value_fields: If True, singular pr... | python | def MessageToDict(message,
including_default_value_fields=False,
preserving_proto_field_name=False):
"""Converts protobuf message to a JSON dictionary.
Args:
message: The protocol buffers message instance to serialize.
including_default_value_fields: If True, singular pr... | [
"def",
"MessageToDict",
"(",
"message",
",",
"including_default_value_fields",
"=",
"False",
",",
"preserving_proto_field_name",
"=",
"False",
")",
":",
"printer",
"=",
"_Printer",
"(",
"including_default_value_fields",
",",
"preserving_proto_field_name",
")",
"# pylint: ... | Converts protobuf message to a JSON dictionary.
Args:
message: The protocol buffers message instance to serialize.
including_default_value_fields: If True, singular primitive fields,
repeated fields, and map fields will always be serialized. If
False, only serialize non-empty fields. Singul... | [
"Converts",
"protobuf",
"message",
"to",
"a",
"JSON",
"dictionary",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L112-L133 |
29,544 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py | ParseDict | def ParseDict(js_dict, message, ignore_unknown_fields=False):
"""Parses a JSON dictionary representation into a message.
Args:
js_dict: Dict representation of a JSON message.
message: A protocol buffer message to merge into.
ignore_unknown_fields: If True, do not raise errors for unknown fields.
Ret... | python | def ParseDict(js_dict, message, ignore_unknown_fields=False):
"""Parses a JSON dictionary representation into a message.
Args:
js_dict: Dict representation of a JSON message.
message: A protocol buffer message to merge into.
ignore_unknown_fields: If True, do not raise errors for unknown fields.
Ret... | [
"def",
"ParseDict",
"(",
"js_dict",
",",
"message",
",",
"ignore_unknown_fields",
"=",
"False",
")",
":",
"parser",
"=",
"_Parser",
"(",
"ignore_unknown_fields",
")",
"parser",
".",
"ConvertMessage",
"(",
"js_dict",
",",
"message",
")",
"return",
"message"
] | Parses a JSON dictionary representation into a message.
Args:
js_dict: Dict representation of a JSON message.
message: A protocol buffer message to merge into.
ignore_unknown_fields: If True, do not raise errors for unknown fields.
Returns:
The same message passed as argument. | [
"Parses",
"a",
"JSON",
"dictionary",
"representation",
"into",
"a",
"message",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L372-L385 |
29,545 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py | _ConvertScalarFieldValue | def _ConvertScalarFieldValue(value, field, require_str=False):
"""Convert a single scalar field value.
Args:
value: A scalar value to convert the scalar field value.
field: The descriptor of the field to convert.
require_str: If True, the field value must be a str.
Returns:
The converted scalar ... | python | def _ConvertScalarFieldValue(value, field, require_str=False):
"""Convert a single scalar field value.
Args:
value: A scalar value to convert the scalar field value.
field: The descriptor of the field to convert.
require_str: If True, the field value must be a str.
Returns:
The converted scalar ... | [
"def",
"_ConvertScalarFieldValue",
"(",
"value",
",",
"field",
",",
"require_str",
"=",
"False",
")",
":",
"if",
"field",
".",
"cpp_type",
"in",
"_INT_TYPES",
":",
"return",
"_ConvertInteger",
"(",
"value",
")",
"elif",
"field",
".",
"cpp_type",
"in",
"_FLOA... | Convert a single scalar field value.
Args:
value: A scalar value to convert the scalar field value.
field: The descriptor of the field to convert.
require_str: If True, the field value must be a str.
Returns:
The converted scalar field value
Raises:
ParseError: In case of convert problems. | [
"Convert",
"a",
"single",
"scalar",
"field",
"value",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L606-L648 |
29,546 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py | _ConvertInteger | def _ConvertInteger(value):
"""Convert an integer.
Args:
value: A scalar value to convert.
Returns:
The integer value.
Raises:
ParseError: If an integer couldn't be consumed.
"""
if isinstance(value, float) and not value.is_integer():
raise ParseError('Couldn\'t parse integer: {0}.'.forma... | python | def _ConvertInteger(value):
"""Convert an integer.
Args:
value: A scalar value to convert.
Returns:
The integer value.
Raises:
ParseError: If an integer couldn't be consumed.
"""
if isinstance(value, float) and not value.is_integer():
raise ParseError('Couldn\'t parse integer: {0}.'.forma... | [
"def",
"_ConvertInteger",
"(",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"float",
")",
"and",
"not",
"value",
".",
"is_integer",
"(",
")",
":",
"raise",
"ParseError",
"(",
"'Couldn\\'t parse integer: {0}.'",
".",
"format",
"(",
"value",
")",
... | Convert an integer.
Args:
value: A scalar value to convert.
Returns:
The integer value.
Raises:
ParseError: If an integer couldn't be consumed. | [
"Convert",
"an",
"integer",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L651-L669 |
29,547 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py | _ConvertFloat | def _ConvertFloat(value):
"""Convert an floating point number."""
if value == 'nan':
raise ParseError('Couldn\'t parse float "nan", use "NaN" instead.')
try:
# Assume Python compatible syntax.
return float(value)
except ValueError:
# Check alternative spellings.
if value == _NEG_INFINITY:
... | python | def _ConvertFloat(value):
"""Convert an floating point number."""
if value == 'nan':
raise ParseError('Couldn\'t parse float "nan", use "NaN" instead.')
try:
# Assume Python compatible syntax.
return float(value)
except ValueError:
# Check alternative spellings.
if value == _NEG_INFINITY:
... | [
"def",
"_ConvertFloat",
"(",
"value",
")",
":",
"if",
"value",
"==",
"'nan'",
":",
"raise",
"ParseError",
"(",
"'Couldn\\'t parse float \"nan\", use \"NaN\" instead.'",
")",
"try",
":",
"# Assume Python compatible syntax.",
"return",
"float",
"(",
"value",
")",
"excep... | Convert an floating point number. | [
"Convert",
"an",
"floating",
"point",
"number",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L672-L688 |
29,548 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py | _ConvertBool | def _ConvertBool(value, require_str):
"""Convert a boolean value.
Args:
value: A scalar value to convert.
require_str: If True, value must be a str.
Returns:
The bool parsed.
Raises:
ParseError: If a boolean value couldn't be consumed.
"""
if require_str:
if value == 'true':
ret... | python | def _ConvertBool(value, require_str):
"""Convert a boolean value.
Args:
value: A scalar value to convert.
require_str: If True, value must be a str.
Returns:
The bool parsed.
Raises:
ParseError: If a boolean value couldn't be consumed.
"""
if require_str:
if value == 'true':
ret... | [
"def",
"_ConvertBool",
"(",
"value",
",",
"require_str",
")",
":",
"if",
"require_str",
":",
"if",
"value",
"==",
"'true'",
":",
"return",
"True",
"elif",
"value",
"==",
"'false'",
":",
"return",
"False",
"else",
":",
"raise",
"ParseError",
"(",
"'Expected... | Convert a boolean value.
Args:
value: A scalar value to convert.
require_str: If True, value must be a str.
Returns:
The bool parsed.
Raises:
ParseError: If a boolean value couldn't be consumed. | [
"Convert",
"a",
"boolean",
"value",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L691-L714 |
29,549 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py | _Printer._MessageToJsonObject | def _MessageToJsonObject(self, message):
"""Converts message to an object according to Proto3 JSON Specification."""
message_descriptor = message.DESCRIPTOR
full_name = message_descriptor.full_name
if _IsWrapperMessage(message_descriptor):
return self._WrapperMessageToJsonObject(message)
if fu... | python | def _MessageToJsonObject(self, message):
"""Converts message to an object according to Proto3 JSON Specification."""
message_descriptor = message.DESCRIPTOR
full_name = message_descriptor.full_name
if _IsWrapperMessage(message_descriptor):
return self._WrapperMessageToJsonObject(message)
if fu... | [
"def",
"_MessageToJsonObject",
"(",
"self",
",",
"message",
")",
":",
"message_descriptor",
"=",
"message",
".",
"DESCRIPTOR",
"full_name",
"=",
"message_descriptor",
".",
"full_name",
"if",
"_IsWrapperMessage",
"(",
"message_descriptor",
")",
":",
"return",
"self",... | Converts message to an object according to Proto3 JSON Specification. | [
"Converts",
"message",
"to",
"an",
"object",
"according",
"to",
"Proto3",
"JSON",
"Specification",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L155-L164 |
29,550 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py | _Printer._RegularMessageToJsonObject | def _RegularMessageToJsonObject(self, message, js):
"""Converts normal message according to Proto3 JSON Specification."""
fields = message.ListFields()
try:
for field, value in fields:
if self.preserving_proto_field_name:
name = field.name
else:
name = field.json_n... | python | def _RegularMessageToJsonObject(self, message, js):
"""Converts normal message according to Proto3 JSON Specification."""
fields = message.ListFields()
try:
for field, value in fields:
if self.preserving_proto_field_name:
name = field.name
else:
name = field.json_n... | [
"def",
"_RegularMessageToJsonObject",
"(",
"self",
",",
"message",
",",
"js",
")",
":",
"fields",
"=",
"message",
".",
"ListFields",
"(",
")",
"try",
":",
"for",
"field",
",",
"value",
"in",
"fields",
":",
"if",
"self",
".",
"preserving_proto_field_name",
... | Converts normal message according to Proto3 JSON Specification. | [
"Converts",
"normal",
"message",
"according",
"to",
"Proto3",
"JSON",
"Specification",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L166-L225 |
29,551 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py | _Printer._FieldToJsonObject | def _FieldToJsonObject(self, field, value):
"""Converts field value according to Proto3 JSON Specification."""
if field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_MESSAGE:
return self._MessageToJsonObject(value)
elif field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_ENUM:
enum_value = fie... | python | def _FieldToJsonObject(self, field, value):
"""Converts field value according to Proto3 JSON Specification."""
if field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_MESSAGE:
return self._MessageToJsonObject(value)
elif field.cpp_type == descriptor.FieldDescriptor.CPPTYPE_ENUM:
enum_value = fie... | [
"def",
"_FieldToJsonObject",
"(",
"self",
",",
"field",
",",
"value",
")",
":",
"if",
"field",
".",
"cpp_type",
"==",
"descriptor",
".",
"FieldDescriptor",
".",
"CPPTYPE_MESSAGE",
":",
"return",
"self",
".",
"_MessageToJsonObject",
"(",
"value",
")",
"elif",
... | Converts field value according to Proto3 JSON Specification. | [
"Converts",
"field",
"value",
"according",
"to",
"Proto3",
"JSON",
"Specification",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L227-L256 |
29,552 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py | _Printer._AnyMessageToJsonObject | def _AnyMessageToJsonObject(self, message):
"""Converts Any message according to Proto3 JSON Specification."""
if not message.ListFields():
return {}
# Must print @type first, use OrderedDict instead of {}
js = OrderedDict()
type_url = message.type_url
js['@type'] = type_url
sub_messag... | python | def _AnyMessageToJsonObject(self, message):
"""Converts Any message according to Proto3 JSON Specification."""
if not message.ListFields():
return {}
# Must print @type first, use OrderedDict instead of {}
js = OrderedDict()
type_url = message.type_url
js['@type'] = type_url
sub_messag... | [
"def",
"_AnyMessageToJsonObject",
"(",
"self",
",",
"message",
")",
":",
"if",
"not",
"message",
".",
"ListFields",
"(",
")",
":",
"return",
"{",
"}",
"# Must print @type first, use OrderedDict instead of {}",
"js",
"=",
"OrderedDict",
"(",
")",
"type_url",
"=",
... | Converts Any message according to Proto3 JSON Specification. | [
"Converts",
"Any",
"message",
"according",
"to",
"Proto3",
"JSON",
"Specification",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L258-L277 |
29,553 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py | _Printer._ValueMessageToJsonObject | def _ValueMessageToJsonObject(self, message):
"""Converts Value message according to Proto3 JSON Specification."""
which = message.WhichOneof('kind')
# If the Value message is not set treat as null_value when serialize
# to JSON. The parse back result will be different from original message.
if whic... | python | def _ValueMessageToJsonObject(self, message):
"""Converts Value message according to Proto3 JSON Specification."""
which = message.WhichOneof('kind')
# If the Value message is not set treat as null_value when serialize
# to JSON. The parse back result will be different from original message.
if whic... | [
"def",
"_ValueMessageToJsonObject",
"(",
"self",
",",
"message",
")",
":",
"which",
"=",
"message",
".",
"WhichOneof",
"(",
"'kind'",
")",
"# If the Value message is not set treat as null_value when serialize",
"# to JSON. The parse back result will be different from original messa... | Converts Value message according to Proto3 JSON Specification. | [
"Converts",
"Value",
"message",
"according",
"to",
"Proto3",
"JSON",
"Specification",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L285-L299 |
29,554 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py | _Printer._StructMessageToJsonObject | def _StructMessageToJsonObject(self, message):
"""Converts Struct message according to Proto3 JSON Specification."""
fields = message.fields
ret = {}
for key in fields:
ret[key] = self._ValueMessageToJsonObject(fields[key])
return ret | python | def _StructMessageToJsonObject(self, message):
"""Converts Struct message according to Proto3 JSON Specification."""
fields = message.fields
ret = {}
for key in fields:
ret[key] = self._ValueMessageToJsonObject(fields[key])
return ret | [
"def",
"_StructMessageToJsonObject",
"(",
"self",
",",
"message",
")",
":",
"fields",
"=",
"message",
".",
"fields",
"ret",
"=",
"{",
"}",
"for",
"key",
"in",
"fields",
":",
"ret",
"[",
"key",
"]",
"=",
"self",
".",
"_ValueMessageToJsonObject",
"(",
"fie... | Converts Struct message according to Proto3 JSON Specification. | [
"Converts",
"Struct",
"message",
"according",
"to",
"Proto3",
"JSON",
"Specification",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L306-L312 |
29,555 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py | _Parser.ConvertMessage | def ConvertMessage(self, value, message):
"""Convert a JSON object into a message.
Args:
value: A JSON object.
message: A WKT or regular protocol message to record the data.
Raises:
ParseError: In case of convert problems.
"""
message_descriptor = message.DESCRIPTOR
full_name... | python | def ConvertMessage(self, value, message):
"""Convert a JSON object into a message.
Args:
value: A JSON object.
message: A WKT or regular protocol message to record the data.
Raises:
ParseError: In case of convert problems.
"""
message_descriptor = message.DESCRIPTOR
full_name... | [
"def",
"ConvertMessage",
"(",
"self",
",",
"value",
",",
"message",
")",
":",
"message_descriptor",
"=",
"message",
".",
"DESCRIPTOR",
"full_name",
"=",
"message_descriptor",
".",
"full_name",
"if",
"_IsWrapperMessage",
"(",
"message_descriptor",
")",
":",
"self",... | Convert a JSON object into a message.
Args:
value: A JSON object.
message: A WKT or regular protocol message to record the data.
Raises:
ParseError: In case of convert problems. | [
"Convert",
"a",
"JSON",
"object",
"into",
"a",
"message",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L398-L415 |
29,556 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py | _Parser._ConvertAnyMessage | def _ConvertAnyMessage(self, value, message):
"""Convert a JSON representation into Any message."""
if isinstance(value, dict) and not value:
return
try:
type_url = value['@type']
except KeyError:
raise ParseError('@type is missing when parsing any message.')
sub_message = _Create... | python | def _ConvertAnyMessage(self, value, message):
"""Convert a JSON representation into Any message."""
if isinstance(value, dict) and not value:
return
try:
type_url = value['@type']
except KeyError:
raise ParseError('@type is missing when parsing any message.')
sub_message = _Create... | [
"def",
"_ConvertAnyMessage",
"(",
"self",
",",
"value",
",",
"message",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"dict",
")",
"and",
"not",
"value",
":",
"return",
"try",
":",
"type_url",
"=",
"value",
"[",
"'@type'",
"]",
"except",
"KeyError",
... | Convert a JSON representation into Any message. | [
"Convert",
"a",
"JSON",
"representation",
"into",
"Any",
"message",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L509-L531 |
29,557 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py | _Parser._ConvertWrapperMessage | def _ConvertWrapperMessage(self, value, message):
"""Convert a JSON representation into Wrapper message."""
field = message.DESCRIPTOR.fields_by_name['value']
setattr(message, 'value', _ConvertScalarFieldValue(value, field)) | python | def _ConvertWrapperMessage(self, value, message):
"""Convert a JSON representation into Wrapper message."""
field = message.DESCRIPTOR.fields_by_name['value']
setattr(message, 'value', _ConvertScalarFieldValue(value, field)) | [
"def",
"_ConvertWrapperMessage",
"(",
"self",
",",
"value",
",",
"message",
")",
":",
"field",
"=",
"message",
".",
"DESCRIPTOR",
".",
"fields_by_name",
"[",
"'value'",
"]",
"setattr",
"(",
"message",
",",
"'value'",
",",
"_ConvertScalarFieldValue",
"(",
"valu... | Convert a JSON representation into Wrapper message. | [
"Convert",
"a",
"JSON",
"representation",
"into",
"Wrapper",
"message",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L574-L577 |
29,558 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py | _Parser._ConvertMapFieldValue | def _ConvertMapFieldValue(self, value, message, field):
"""Convert map field value for a message map field.
Args:
value: A JSON object to convert the map field value.
message: A protocol message to record the converted data.
field: The descriptor of the map field to be converted.
Raises:... | python | def _ConvertMapFieldValue(self, value, message, field):
"""Convert map field value for a message map field.
Args:
value: A JSON object to convert the map field value.
message: A protocol message to record the converted data.
field: The descriptor of the map field to be converted.
Raises:... | [
"def",
"_ConvertMapFieldValue",
"(",
"self",
",",
"value",
",",
"message",
",",
"field",
")",
":",
"if",
"not",
"isinstance",
"(",
"value",
",",
"dict",
")",
":",
"raise",
"ParseError",
"(",
"'Map field {0} must be in a dict which is {1}.'",
".",
"format",
"(",
... | Convert map field value for a message map field.
Args:
value: A JSON object to convert the map field value.
message: A protocol message to record the converted data.
field: The descriptor of the map field to be converted.
Raises:
ParseError: In case of convert problems. | [
"Convert",
"map",
"field",
"value",
"for",
"a",
"message",
"map",
"field",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/json_format.py#L579-L603 |
29,559 | apple/turicreate | src/unity/python/turicreate/visualization/show.py | categorical_heatmap | def categorical_heatmap(x, y, xlabel=LABEL_DEFAULT, ylabel=LABEL_DEFAULT, title=LABEL_DEFAULT):
"""
Plots the data in `x` on the X axis and the data in `y` on the Y axis
in a 2d categorical heatmap, and returns the resulting Plot object.
The function supports SArrays of dtypes str.
Parameters
... | python | def categorical_heatmap(x, y, xlabel=LABEL_DEFAULT, ylabel=LABEL_DEFAULT, title=LABEL_DEFAULT):
"""
Plots the data in `x` on the X axis and the data in `y` on the Y axis
in a 2d categorical heatmap, and returns the resulting Plot object.
The function supports SArrays of dtypes str.
Parameters
... | [
"def",
"categorical_heatmap",
"(",
"x",
",",
"y",
",",
"xlabel",
"=",
"LABEL_DEFAULT",
",",
"ylabel",
"=",
"LABEL_DEFAULT",
",",
"title",
"=",
"LABEL_DEFAULT",
")",
":",
"if",
"(",
"not",
"isinstance",
"(",
"x",
",",
"tc",
".",
"data_structures",
".",
"s... | Plots the data in `x` on the X axis and the data in `y` on the Y axis
in a 2d categorical heatmap, and returns the resulting Plot object.
The function supports SArrays of dtypes str.
Parameters
----------
x : SArray
The data to plot on the X axis of the categorical heatmap.
Must b... | [
"Plots",
"the",
"data",
"in",
"x",
"on",
"the",
"X",
"axis",
"and",
"the",
"data",
"in",
"y",
"on",
"the",
"Y",
"axis",
"in",
"a",
"2d",
"categorical",
"heatmap",
"and",
"returns",
"the",
"resulting",
"Plot",
"object",
".",
"The",
"function",
"supports... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/visualization/show.py#L195-L242 |
29,560 | apple/turicreate | src/unity/python/turicreate/visualization/show.py | columnwise_summary | def columnwise_summary(sf):
"""
Plots a columnwise summary of the sframe provided as input,
and returns the resulting Plot object.
The function supports SFrames.
Parameters
----------
sf : SFrame
The data to get a columnwise summary for.
Returns
-------
out : Pl... | python | def columnwise_summary(sf):
"""
Plots a columnwise summary of the sframe provided as input,
and returns the resulting Plot object.
The function supports SFrames.
Parameters
----------
sf : SFrame
The data to get a columnwise summary for.
Returns
-------
out : Pl... | [
"def",
"columnwise_summary",
"(",
"sf",
")",
":",
"if",
"not",
"isinstance",
"(",
"sf",
",",
"tc",
".",
"data_structures",
".",
"sframe",
".",
"SFrame",
")",
":",
"raise",
"ValueError",
"(",
"\"turicreate.visualization.columnwise_summary \"",
"+",
"\"supports SFra... | Plots a columnwise summary of the sframe provided as input,
and returns the resulting Plot object.
The function supports SFrames.
Parameters
----------
sf : SFrame
The data to get a columnwise summary for.
Returns
-------
out : Plot
A :class: Plot object that is t... | [
"Plots",
"a",
"columnwise",
"summary",
"of",
"the",
"sframe",
"provided",
"as",
"input",
"and",
"returns",
"the",
"resulting",
"Plot",
"object",
".",
"The",
"function",
"supports",
"SFrames",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/visualization/show.py#L339-L369 |
29,561 | apple/turicreate | src/unity/python/turicreate/visualization/show.py | histogram | def histogram(sa, xlabel=LABEL_DEFAULT, ylabel=LABEL_DEFAULT, title=LABEL_DEFAULT):
"""
Plots a histogram of the sarray provided as input, and returns the
resulting Plot object.
The function supports numeric SArrays with dtypes int or float.
Parameters
----------
sa : SArray
The... | python | def histogram(sa, xlabel=LABEL_DEFAULT, ylabel=LABEL_DEFAULT, title=LABEL_DEFAULT):
"""
Plots a histogram of the sarray provided as input, and returns the
resulting Plot object.
The function supports numeric SArrays with dtypes int or float.
Parameters
----------
sa : SArray
The... | [
"def",
"histogram",
"(",
"sa",
",",
"xlabel",
"=",
"LABEL_DEFAULT",
",",
"ylabel",
"=",
"LABEL_DEFAULT",
",",
"title",
"=",
"LABEL_DEFAULT",
")",
":",
"if",
"(",
"not",
"isinstance",
"(",
"sa",
",",
"tc",
".",
"data_structures",
".",
"sarray",
".",
"SArr... | Plots a histogram of the sarray provided as input, and returns the
resulting Plot object.
The function supports numeric SArrays with dtypes int or float.
Parameters
----------
sa : SArray
The data to get a histogram for. Must be numeric (int/float).
xlabel : str (optional)
The... | [
"Plots",
"a",
"histogram",
"of",
"the",
"sarray",
"provided",
"as",
"input",
"and",
"returns",
"the",
"resulting",
"Plot",
"object",
".",
"The",
"function",
"supports",
"numeric",
"SArrays",
"with",
"dtypes",
"int",
"or",
"float",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/visualization/show.py#L371-L411 |
29,562 | apple/turicreate | src/unity/python/turicreate/visualization/show.py | item_frequency | def item_frequency(sa, xlabel=LABEL_DEFAULT, ylabel=LABEL_DEFAULT, title=LABEL_DEFAULT):
"""
Plots an item frequency of the sarray provided as input, and returns the
resulting Plot object.
The function supports SArrays with dtype str.
Parameters
----------
sa : SArray
The data t... | python | def item_frequency(sa, xlabel=LABEL_DEFAULT, ylabel=LABEL_DEFAULT, title=LABEL_DEFAULT):
"""
Plots an item frequency of the sarray provided as input, and returns the
resulting Plot object.
The function supports SArrays with dtype str.
Parameters
----------
sa : SArray
The data t... | [
"def",
"item_frequency",
"(",
"sa",
",",
"xlabel",
"=",
"LABEL_DEFAULT",
",",
"ylabel",
"=",
"LABEL_DEFAULT",
",",
"title",
"=",
"LABEL_DEFAULT",
")",
":",
"if",
"(",
"not",
"isinstance",
"(",
"sa",
",",
"tc",
".",
"data_structures",
".",
"sarray",
".",
... | Plots an item frequency of the sarray provided as input, and returns the
resulting Plot object.
The function supports SArrays with dtype str.
Parameters
----------
sa : SArray
The data to get an item frequency for. Must have dtype str
xlabel : str (optional)
The text label for... | [
"Plots",
"an",
"item",
"frequency",
"of",
"the",
"sarray",
"provided",
"as",
"input",
"and",
"returns",
"the",
"resulting",
"Plot",
"object",
".",
"The",
"function",
"supports",
"SArrays",
"with",
"dtype",
"str",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/visualization/show.py#L413-L453 |
29,563 | apple/turicreate | deps/src/libevent-2.0.18-stable/event_rpcgen.py | Parse | def Parse(factory, file):
"""
Parses the input file and returns C code and corresponding header file.
"""
entities = []
while 1:
# Just gets the whole struct nicely formatted
data = GetNextStruct(file)
if not data:
break
entities.extend(ProcessStruct(f... | python | def Parse(factory, file):
"""
Parses the input file and returns C code and corresponding header file.
"""
entities = []
while 1:
# Just gets the whole struct nicely formatted
data = GetNextStruct(file)
if not data:
break
entities.extend(ProcessStruct(f... | [
"def",
"Parse",
"(",
"factory",
",",
"file",
")",
":",
"entities",
"=",
"[",
"]",
"while",
"1",
":",
"# Just gets the whole struct nicely formatted",
"data",
"=",
"GetNextStruct",
"(",
"file",
")",
"if",
"not",
"data",
":",
"break",
"entities",
".",
"extend"... | Parses the input file and returns C code and corresponding header file. | [
"Parses",
"the",
"input",
"file",
"and",
"returns",
"C",
"code",
"and",
"corresponding",
"header",
"file",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/libevent-2.0.18-stable/event_rpcgen.py#L1509-L1525 |
29,564 | apple/turicreate | deps/src/libevent-2.0.18-stable/event_rpcgen.py | Struct.EntryTagName | def EntryTagName(self, entry):
"""Creates the name inside an enumeration for distinguishing data
types."""
name = "%s_%s" % (self._name, entry.Name())
return name.upper() | python | def EntryTagName(self, entry):
"""Creates the name inside an enumeration for distinguishing data
types."""
name = "%s_%s" % (self._name, entry.Name())
return name.upper() | [
"def",
"EntryTagName",
"(",
"self",
",",
"entry",
")",
":",
"name",
"=",
"\"%s_%s\"",
"%",
"(",
"self",
".",
"_name",
",",
"entry",
".",
"Name",
"(",
")",
")",
"return",
"name",
".",
"upper",
"(",
")"
] | Creates the name inside an enumeration for distinguishing data
types. | [
"Creates",
"the",
"name",
"inside",
"an",
"enumeration",
"for",
"distinguishing",
"data",
"types",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/libevent-2.0.18-stable/event_rpcgen.py#L66-L70 |
29,565 | apple/turicreate | deps/src/libevent-2.0.18-stable/event_rpcgen.py | Struct.PrintIndented | def PrintIndented(self, file, ident, code):
"""Takes an array, add indentation to each entry and prints it."""
for entry in code:
print >>file, '%s%s' % (ident, entry) | python | def PrintIndented(self, file, ident, code):
"""Takes an array, add indentation to each entry and prints it."""
for entry in code:
print >>file, '%s%s' % (ident, entry) | [
"def",
"PrintIndented",
"(",
"self",
",",
"file",
",",
"ident",
",",
"code",
")",
":",
"for",
"entry",
"in",
"code",
":",
"print",
">>",
"file",
",",
"'%s%s'",
"%",
"(",
"ident",
",",
"entry",
")"
] | Takes an array, add indentation to each entry and prints it. | [
"Takes",
"an",
"array",
"add",
"indentation",
"to",
"each",
"entry",
"and",
"prints",
"it",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/libevent-2.0.18-stable/event_rpcgen.py#L72-L75 |
29,566 | apple/turicreate | deps/src/libevent-2.0.18-stable/event_rpcgen.py | StructCCode.PrintTags | def PrintTags(self, file):
"""Prints the tag definitions for a structure."""
print >>file, '/* Tag definition for %s */' % self._name
print >>file, 'enum %s_ {' % self._name.lower()
for entry in self._entries:
print >>file, ' %s=%d,' % (self.EntryTagName(entry),
... | python | def PrintTags(self, file):
"""Prints the tag definitions for a structure."""
print >>file, '/* Tag definition for %s */' % self._name
print >>file, 'enum %s_ {' % self._name.lower()
for entry in self._entries:
print >>file, ' %s=%d,' % (self.EntryTagName(entry),
... | [
"def",
"PrintTags",
"(",
"self",
",",
"file",
")",
":",
"print",
">>",
"file",
",",
"'/* Tag definition for %s */'",
"%",
"self",
".",
"_name",
"print",
">>",
"file",
",",
"'enum %s_ {'",
"%",
"self",
".",
"_name",
".",
"lower",
"(",
")",
"for",
"entry",... | Prints the tag definitions for a structure. | [
"Prints",
"the",
"tag",
"definitions",
"for",
"a",
"structure",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/libevent-2.0.18-stable/event_rpcgen.py#L83-L91 |
29,567 | apple/turicreate | src/unity/python/turicreate/toolkits/graph_analytics/kcore.py | create | def create(graph, kmin=0, kmax=10, verbose=True):
"""
Compute the K-core decomposition of the graph. Return a model object with
total number of cores as well as the core id for each vertex in the graph.
Parameters
----------
graph : SGraph
The graph on which to compute the k-core decomp... | python | def create(graph, kmin=0, kmax=10, verbose=True):
"""
Compute the K-core decomposition of the graph. Return a model object with
total number of cores as well as the core id for each vertex in the graph.
Parameters
----------
graph : SGraph
The graph on which to compute the k-core decomp... | [
"def",
"create",
"(",
"graph",
",",
"kmin",
"=",
"0",
",",
"kmax",
"=",
"10",
",",
"verbose",
"=",
"True",
")",
":",
"from",
"turicreate",
".",
"_cython",
".",
"cy_server",
"import",
"QuietProgress",
"if",
"not",
"isinstance",
"(",
"graph",
",",
"_SGra... | Compute the K-core decomposition of the graph. Return a model object with
total number of cores as well as the core id for each vertex in the graph.
Parameters
----------
graph : SGraph
The graph on which to compute the k-core decomposition.
kmin : int, optional
Minimum core id. Ve... | [
"Compute",
"the",
"K",
"-",
"core",
"decomposition",
"of",
"the",
"graph",
".",
"Return",
"a",
"model",
"object",
"with",
"total",
"number",
"of",
"cores",
"as",
"well",
"as",
"the",
"core",
"id",
"for",
"each",
"vertex",
"in",
"the",
"graph",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/graph_analytics/kcore.py#L86-L150 |
29,568 | apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_utils.py | raise_error_unsupported_categorical_option | def raise_error_unsupported_categorical_option(option_name, option_value, layer_type, layer_name):
"""
Raise an error if an option is not supported.
"""
raise RuntimeError("Unsupported option %s=%s in layer %s(%s)" % (option_name, option_value,
layer_type, layer_name)) | python | def raise_error_unsupported_categorical_option(option_name, option_value, layer_type, layer_name):
"""
Raise an error if an option is not supported.
"""
raise RuntimeError("Unsupported option %s=%s in layer %s(%s)" % (option_name, option_value,
layer_type, layer_name)) | [
"def",
"raise_error_unsupported_categorical_option",
"(",
"option_name",
",",
"option_value",
",",
"layer_type",
",",
"layer_name",
")",
":",
"raise",
"RuntimeError",
"(",
"\"Unsupported option %s=%s in layer %s(%s)\"",
"%",
"(",
"option_name",
",",
"option_value",
",",
"... | Raise an error if an option is not supported. | [
"Raise",
"an",
"error",
"if",
"an",
"option",
"is",
"not",
"supported",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_utils.py#L7-L12 |
29,569 | apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/_feature_management.py | process_or_validate_classifier_output_features | def process_or_validate_classifier_output_features(
output_features, class_labels, supports_class_scores = True):
"""
Given a list of class labels and a list of output_features, validate the
list and return a valid version of output_features with all the correct
data type information included.
... | python | def process_or_validate_classifier_output_features(
output_features, class_labels, supports_class_scores = True):
"""
Given a list of class labels and a list of output_features, validate the
list and return a valid version of output_features with all the correct
data type information included.
... | [
"def",
"process_or_validate_classifier_output_features",
"(",
"output_features",
",",
"class_labels",
",",
"supports_class_scores",
"=",
"True",
")",
":",
"def",
"raise_error",
"(",
"msg",
")",
":",
"raise",
"ValueError",
"(",
"\"Classifier error: %s\"",
"%",
"msg",
"... | Given a list of class labels and a list of output_features, validate the
list and return a valid version of output_features with all the correct
data type information included. | [
"Given",
"a",
"list",
"of",
"class",
"labels",
"and",
"a",
"list",
"of",
"output_features",
"validate",
"the",
"list",
"and",
"return",
"a",
"valid",
"version",
"of",
"output_features",
"with",
"all",
"the",
"correct",
"data",
"type",
"information",
"included"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/_feature_management.py#L19-L103 |
29,570 | apple/turicreate | deps/src/boost_1_68_0/libs/metaparse/tools/build_environment.py | main | def main():
"""The main function of the utility"""
parser = argparse.ArgumentParser(
description='Manage the build environment of Boost.Metaparse'
)
parser.add_argument(
'--dep_json',
required=True,
help='The json file describing the dependencies'
)
parser.add_arg... | python | def main():
"""The main function of the utility"""
parser = argparse.ArgumentParser(
description='Manage the build environment of Boost.Metaparse'
)
parser.add_argument(
'--dep_json',
required=True,
help='The json file describing the dependencies'
)
parser.add_arg... | [
"def",
"main",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"'Manage the build environment of Boost.Metaparse'",
")",
"parser",
".",
"add_argument",
"(",
"'--dep_json'",
",",
"required",
"=",
"True",
",",
"help",
"=",
... | The main function of the utility | [
"The",
"main",
"function",
"of",
"the",
"utility"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/build_environment.py#L81-L130 |
29,571 | apple/turicreate | src/unity/python/turicreate/data_structures/sarray_builder.py | SArrayBuilder.read_history | def read_history(self, num=10, segment=0):
"""
Outputs the last `num` elements that were appended either by `append` or
`append_multiple`.
Returns
-------
out : list
"""
if num < 0:
num = 0
if segment < 0:
raise TypeError(... | python | def read_history(self, num=10, segment=0):
"""
Outputs the last `num` elements that were appended either by `append` or
`append_multiple`.
Returns
-------
out : list
"""
if num < 0:
num = 0
if segment < 0:
raise TypeError(... | [
"def",
"read_history",
"(",
"self",
",",
"num",
"=",
"10",
",",
"segment",
"=",
"0",
")",
":",
"if",
"num",
"<",
"0",
":",
"num",
"=",
"0",
"if",
"segment",
"<",
"0",
":",
"raise",
"TypeError",
"(",
"\"segment must be >= 0\"",
")",
"return",
"self",
... | Outputs the last `num` elements that were appended either by `append` or
`append_multiple`.
Returns
-------
out : list | [
"Outputs",
"the",
"last",
"num",
"elements",
"that",
"were",
"appended",
"either",
"by",
"append",
"or",
"append_multiple",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sarray_builder.py#L114-L128 |
29,572 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/toolset.py | find_satisfied_condition | def find_satisfied_condition(conditions, ps):
"""Returns the first element of 'property-sets' which is a subset of
'properties', or an empty list if no such element exists."""
assert is_iterable_typed(conditions, property_set.PropertySet)
assert isinstance(ps, property_set.PropertySet)
for conditio... | python | def find_satisfied_condition(conditions, ps):
"""Returns the first element of 'property-sets' which is a subset of
'properties', or an empty list if no such element exists."""
assert is_iterable_typed(conditions, property_set.PropertySet)
assert isinstance(ps, property_set.PropertySet)
for conditio... | [
"def",
"find_satisfied_condition",
"(",
"conditions",
",",
"ps",
")",
":",
"assert",
"is_iterable_typed",
"(",
"conditions",
",",
"property_set",
".",
"PropertySet",
")",
"assert",
"isinstance",
"(",
"ps",
",",
"property_set",
".",
"PropertySet",
")",
"for",
"co... | Returns the first element of 'property-sets' which is a subset of
'properties', or an empty list if no such element exists. | [
"Returns",
"the",
"first",
"element",
"of",
"property",
"-",
"sets",
"which",
"is",
"a",
"subset",
"of",
"properties",
"or",
"an",
"empty",
"list",
"if",
"no",
"such",
"element",
"exists",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/toolset.py#L184-L216 |
29,573 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/toolset.py | __add_flag | def __add_flag (rule_or_module, variable_name, condition, values):
""" Adds a new flag setting with the specified values.
Does no checking.
"""
assert isinstance(rule_or_module, basestring)
assert isinstance(variable_name, basestring)
assert is_iterable_typed(condition, property_set.Property... | python | def __add_flag (rule_or_module, variable_name, condition, values):
""" Adds a new flag setting with the specified values.
Does no checking.
"""
assert isinstance(rule_or_module, basestring)
assert isinstance(variable_name, basestring)
assert is_iterable_typed(condition, property_set.Property... | [
"def",
"__add_flag",
"(",
"rule_or_module",
",",
"variable_name",
",",
"condition",
",",
"values",
")",
":",
"assert",
"isinstance",
"(",
"rule_or_module",
",",
"basestring",
")",
"assert",
"isinstance",
"(",
"variable_name",
",",
"basestring",
")",
"assert",
"i... | Adds a new flag setting with the specified values.
Does no checking. | [
"Adds",
"a",
"new",
"flag",
"setting",
"with",
"the",
"specified",
"values",
".",
"Does",
"no",
"checking",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/toolset.py#L365-L382 |
29,574 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/util/path.py | root | def root (path, root):
""" If 'path' is relative, it is rooted at 'root'. Otherwise, it's unchanged.
"""
if os.path.isabs (path):
return path
else:
return os.path.join (root, path) | python | def root (path, root):
""" If 'path' is relative, it is rooted at 'root'. Otherwise, it's unchanged.
"""
if os.path.isabs (path):
return path
else:
return os.path.join (root, path) | [
"def",
"root",
"(",
"path",
",",
"root",
")",
":",
"if",
"os",
".",
"path",
".",
"isabs",
"(",
"path",
")",
":",
"return",
"path",
"else",
":",
"return",
"os",
".",
"path",
".",
"join",
"(",
"root",
",",
"path",
")"
] | If 'path' is relative, it is rooted at 'root'. Otherwise, it's unchanged. | [
"If",
"path",
"is",
"relative",
"it",
"is",
"rooted",
"at",
"root",
".",
"Otherwise",
"it",
"s",
"unchanged",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/path.py#L28-L34 |
29,575 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/util/path.py | glob_tree | def glob_tree(roots, patterns, exclude_patterns=None):
"""Recursive version of GLOB. Builds the glob of files while
also searching in the subdirectories of the given roots. An
optional set of exclusion patterns will filter out the
matching entries from the result. The exclusions also apply
to the su... | python | def glob_tree(roots, patterns, exclude_patterns=None):
"""Recursive version of GLOB. Builds the glob of files while
also searching in the subdirectories of the given roots. An
optional set of exclusion patterns will filter out the
matching entries from the result. The exclusions also apply
to the su... | [
"def",
"glob_tree",
"(",
"roots",
",",
"patterns",
",",
"exclude_patterns",
"=",
"None",
")",
":",
"if",
"not",
"exclude_patterns",
":",
"exclude_patterns",
"=",
"[",
"]",
"result",
"=",
"glob",
"(",
"roots",
",",
"patterns",
",",
"exclude_patterns",
")",
... | Recursive version of GLOB. Builds the glob of files while
also searching in the subdirectories of the given roots. An
optional set of exclusion patterns will filter out the
matching entries from the result. The exclusions also apply
to the subdirectory scanning, such that directories that
match the ... | [
"Recursive",
"version",
"of",
"GLOB",
".",
"Builds",
"the",
"glob",
"of",
"files",
"while",
"also",
"searching",
"in",
"the",
"subdirectories",
"of",
"the",
"given",
"roots",
".",
"An",
"optional",
"set",
"of",
"exclusion",
"patterns",
"will",
"filter",
"out... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/path.py#L872-L888 |
29,576 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/util/path.py | glob_in_parents | def glob_in_parents(dir, patterns, upper_limit=None):
"""Recursive version of GLOB which glob sall parent directories
of dir until the first match is found. Returns an empty result if no match
is found"""
assert(isinstance(dir, str))
assert(isinstance(patterns, list))
result = []
absolute... | python | def glob_in_parents(dir, patterns, upper_limit=None):
"""Recursive version of GLOB which glob sall parent directories
of dir until the first match is found. Returns an empty result if no match
is found"""
assert(isinstance(dir, str))
assert(isinstance(patterns, list))
result = []
absolute... | [
"def",
"glob_in_parents",
"(",
"dir",
",",
"patterns",
",",
"upper_limit",
"=",
"None",
")",
":",
"assert",
"(",
"isinstance",
"(",
"dir",
",",
"str",
")",
")",
"assert",
"(",
"isinstance",
"(",
"patterns",
",",
"list",
")",
")",
"result",
"=",
"[",
... | Recursive version of GLOB which glob sall parent directories
of dir until the first match is found. Returns an empty result if no match
is found | [
"Recursive",
"version",
"of",
"GLOB",
"which",
"glob",
"sall",
"parent",
"directories",
"of",
"dir",
"until",
"the",
"first",
"match",
"is",
"found",
".",
"Returns",
"an",
"empty",
"result",
"if",
"no",
"match",
"is",
"found"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/path.py#L890-L911 |
29,577 | apple/turicreate | src/unity/python/turicreate/extensions.py | _wrap_function_return | def _wrap_function_return(val):
"""
Recursively walks each thing in val, opening lists and dictionaries,
converting all occurrences of UnityGraphProxy to an SGraph,
UnitySFrameProxy to SFrame, and UnitySArrayProxy to SArray.
"""
if type(val) is _UnityGraphProxy:
return _SGraph(_proxy = ... | python | def _wrap_function_return(val):
"""
Recursively walks each thing in val, opening lists and dictionaries,
converting all occurrences of UnityGraphProxy to an SGraph,
UnitySFrameProxy to SFrame, and UnitySArrayProxy to SArray.
"""
if type(val) is _UnityGraphProxy:
return _SGraph(_proxy = ... | [
"def",
"_wrap_function_return",
"(",
"val",
")",
":",
"if",
"type",
"(",
"val",
")",
"is",
"_UnityGraphProxy",
":",
"return",
"_SGraph",
"(",
"_proxy",
"=",
"val",
")",
"elif",
"type",
"(",
"val",
")",
"is",
"_UnitySFrameProxy",
":",
"return",
"_SFrame",
... | Recursively walks each thing in val, opening lists and dictionaries,
converting all occurrences of UnityGraphProxy to an SGraph,
UnitySFrameProxy to SFrame, and UnitySArrayProxy to SArray. | [
"Recursively",
"walks",
"each",
"thing",
"in",
"val",
"opening",
"lists",
"and",
"dictionaries",
"converting",
"all",
"occurrences",
"of",
"UnityGraphProxy",
"to",
"an",
"SGraph",
"UnitySFrameProxy",
"to",
"SFrame",
"and",
"UnitySArrayProxy",
"to",
"SArray",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/extensions.py#L82-L107 |
29,578 | apple/turicreate | src/unity/python/turicreate/extensions.py | _run_toolkit_function | def _run_toolkit_function(fnname, arguments, args, kwargs):
"""
Dispatches arguments to a toolkit function.
Parameters
----------
fnname : string
The toolkit function to run
arguments : list[string]
The list of all the arguments the function takes.
args : list
The ... | python | def _run_toolkit_function(fnname, arguments, args, kwargs):
"""
Dispatches arguments to a toolkit function.
Parameters
----------
fnname : string
The toolkit function to run
arguments : list[string]
The list of all the arguments the function takes.
args : list
The ... | [
"def",
"_run_toolkit_function",
"(",
"fnname",
",",
"arguments",
",",
"args",
",",
"kwargs",
")",
":",
"# scan for all the arguments in args",
"num_args_got",
"=",
"len",
"(",
"args",
")",
"+",
"len",
"(",
"kwargs",
")",
"num_args_required",
"=",
"len",
"(",
"... | Dispatches arguments to a toolkit function.
Parameters
----------
fnname : string
The toolkit function to run
arguments : list[string]
The list of all the arguments the function takes.
args : list
The arguments that were passed
kwargs : dictionary
The keyword ... | [
"Dispatches",
"arguments",
"to",
"a",
"toolkit",
"function",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/extensions.py#L118-L167 |
29,579 | apple/turicreate | src/unity/python/turicreate/extensions.py | _publish | def _publish():
import copy
"""
Publishes all functions and classes registered in unity_server.
The functions and classes will appear in the module turicreate.extensions
"""
unity = _get_unity()
fnlist = unity.list_toolkit_functions()
# Loop through all the functions and inject it into
... | python | def _publish():
import copy
"""
Publishes all functions and classes registered in unity_server.
The functions and classes will appear in the module turicreate.extensions
"""
unity = _get_unity()
fnlist = unity.list_toolkit_functions()
# Loop through all the functions and inject it into
... | [
"def",
"_publish",
"(",
")",
":",
"import",
"copy",
"unity",
"=",
"_get_unity",
"(",
")",
"fnlist",
"=",
"unity",
".",
"list_toolkit_functions",
"(",
")",
"# Loop through all the functions and inject it into",
"# turicreate.extensions.[blah]",
"# Note that [blah] may be som... | Publishes all functions and classes registered in unity_server.
The functions and classes will appear in the module turicreate.extensions | [
"Publishes",
"all",
"functions",
"and",
"classes",
"registered",
"in",
"unity_server",
".",
"The",
"functions",
"and",
"classes",
"will",
"appear",
"in",
"the",
"module",
"turicreate",
".",
"extensions"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/extensions.py#L319-L396 |
29,580 | apple/turicreate | src/unity/python/turicreate/extensions.py | _get_argument_list_from_toolkit_function_name | def _get_argument_list_from_toolkit_function_name(fn):
"""
Given a toolkit function name, return the argument list
"""
unity = _get_unity()
fnprops = unity.describe_toolkit_function(fn)
argnames = fnprops['arguments']
return argnames | python | def _get_argument_list_from_toolkit_function_name(fn):
"""
Given a toolkit function name, return the argument list
"""
unity = _get_unity()
fnprops = unity.describe_toolkit_function(fn)
argnames = fnprops['arguments']
return argnames | [
"def",
"_get_argument_list_from_toolkit_function_name",
"(",
"fn",
")",
":",
"unity",
"=",
"_get_unity",
"(",
")",
"fnprops",
"=",
"unity",
".",
"describe_toolkit_function",
"(",
"fn",
")",
"argnames",
"=",
"fnprops",
"[",
"'arguments'",
"]",
"return",
"argnames"
... | Given a toolkit function name, return the argument list | [
"Given",
"a",
"toolkit",
"function",
"name",
"return",
"the",
"argument",
"list"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/extensions.py#L602-L609 |
29,581 | apple/turicreate | src/unity/python/doc/source/sphinx_turicreate_ext/pycon.py | main | def main():
"""
Print lines of input along with output.
"""
source_lines = (line.rstrip() for line in sys.stdin)
console = InteractiveInterpreter()
console.runsource('import turicreate')
source = ''
try:
while True:
source = source_lines.next()
more = cons... | python | def main():
"""
Print lines of input along with output.
"""
source_lines = (line.rstrip() for line in sys.stdin)
console = InteractiveInterpreter()
console.runsource('import turicreate')
source = ''
try:
while True:
source = source_lines.next()
more = cons... | [
"def",
"main",
"(",
")",
":",
"source_lines",
"=",
"(",
"line",
".",
"rstrip",
"(",
")",
"for",
"line",
"in",
"sys",
".",
"stdin",
")",
"console",
"=",
"InteractiveInterpreter",
"(",
")",
"console",
".",
"runsource",
"(",
"'import turicreate'",
")",
"sou... | Print lines of input along with output. | [
"Print",
"lines",
"of",
"input",
"along",
"with",
"output",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/doc/source/sphinx_turicreate_ext/pycon.py#L10-L30 |
29,582 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/type_checkers.py | GetTypeChecker | def GetTypeChecker(field):
"""Returns a type checker for a message field of the specified types.
Args:
field: FieldDescriptor object for this field.
Returns:
An instance of TypeChecker which can be used to verify the types
of values assigned to a field of the specified type.
"""
if (field.cpp_ty... | python | def GetTypeChecker(field):
"""Returns a type checker for a message field of the specified types.
Args:
field: FieldDescriptor object for this field.
Returns:
An instance of TypeChecker which can be used to verify the types
of values assigned to a field of the specified type.
"""
if (field.cpp_ty... | [
"def",
"GetTypeChecker",
"(",
"field",
")",
":",
"if",
"(",
"field",
".",
"cpp_type",
"==",
"_FieldDescriptor",
".",
"CPPTYPE_STRING",
"and",
"field",
".",
"type",
"==",
"_FieldDescriptor",
".",
"TYPE_STRING",
")",
":",
"return",
"UnicodeValueChecker",
"(",
")... | Returns a type checker for a message field of the specified types.
Args:
field: FieldDescriptor object for this field.
Returns:
An instance of TypeChecker which can be used to verify the types
of values assigned to a field of the specified type. | [
"Returns",
"a",
"type",
"checker",
"for",
"a",
"message",
"field",
"of",
"the",
"specified",
"types",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/type_checkers.py#L65-L84 |
29,583 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/type_checkers.py | TypeChecker.CheckValue | def CheckValue(self, proposed_value):
"""Type check the provided value and return it.
The returned value might have been normalized to another type.
"""
if not isinstance(proposed_value, self._acceptable_types):
message = ('%.1024r has type %s, but expected one of: %s' %
(propose... | python | def CheckValue(self, proposed_value):
"""Type check the provided value and return it.
The returned value might have been normalized to another type.
"""
if not isinstance(proposed_value, self._acceptable_types):
message = ('%.1024r has type %s, but expected one of: %s' %
(propose... | [
"def",
"CheckValue",
"(",
"self",
",",
"proposed_value",
")",
":",
"if",
"not",
"isinstance",
"(",
"proposed_value",
",",
"self",
".",
"_acceptable_types",
")",
":",
"message",
"=",
"(",
"'%.1024r has type %s, but expected one of: %s'",
"%",
"(",
"proposed_value",
... | Type check the provided value and return it.
The returned value might have been normalized to another type. | [
"Type",
"check",
"the",
"provided",
"value",
"and",
"return",
"it",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/type_checkers.py#L101-L110 |
29,584 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/text_encoding.py | CEscape | def CEscape(text, as_utf8):
"""Escape a bytes string for use in an ascii protocol buffer.
text.encode('string_escape') does not seem to satisfy our needs as it
encodes unprintable characters using two-digit hex escapes whereas our
C++ unescaping function allows hex escapes to be any length. So,
"\0011".enco... | python | def CEscape(text, as_utf8):
"""Escape a bytes string for use in an ascii protocol buffer.
text.encode('string_escape') does not seem to satisfy our needs as it
encodes unprintable characters using two-digit hex escapes whereas our
C++ unescaping function allows hex escapes to be any length. So,
"\0011".enco... | [
"def",
"CEscape",
"(",
"text",
",",
"as_utf8",
")",
":",
"# PY3 hack: make Ord work for str and bytes:",
"# //platforms/networking/data uses unicode here, hence basestring.",
"Ord",
"=",
"ord",
"if",
"isinstance",
"(",
"text",
",",
"six",
".",
"string_types",
")",
"else",... | Escape a bytes string for use in an ascii protocol buffer.
text.encode('string_escape') does not seem to satisfy our needs as it
encodes unprintable characters using two-digit hex escapes whereas our
C++ unescaping function allows hex escapes to be any length. So,
"\0011".encode('string_escape') ends up being... | [
"Escape",
"a",
"bytes",
"string",
"for",
"use",
"in",
"an",
"ascii",
"protocol",
"buffer",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/text_encoding.py#L59-L79 |
29,585 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/text_encoding.py | CUnescape | def CUnescape(text):
"""Unescape a text string with C-style escape sequences to UTF-8 bytes."""
def ReplaceHex(m):
# Only replace the match if the number of leading back slashes is odd. i.e.
# the slash itself is not escaped.
if len(m.group(1)) & 1:
return m.group(1) + 'x0' + m.group(2)
retur... | python | def CUnescape(text):
"""Unescape a text string with C-style escape sequences to UTF-8 bytes."""
def ReplaceHex(m):
# Only replace the match if the number of leading back slashes is odd. i.e.
# the slash itself is not escaped.
if len(m.group(1)) & 1:
return m.group(1) + 'x0' + m.group(2)
retur... | [
"def",
"CUnescape",
"(",
"text",
")",
":",
"def",
"ReplaceHex",
"(",
"m",
")",
":",
"# Only replace the match if the number of leading back slashes is odd. i.e.",
"# the slash itself is not escaped.",
"if",
"len",
"(",
"m",
".",
"group",
"(",
"1",
")",
")",
"&",
"1"... | Unescape a text string with C-style escape sequences to UTF-8 bytes. | [
"Unescape",
"a",
"text",
"string",
"with",
"C",
"-",
"style",
"escape",
"sequences",
"to",
"UTF",
"-",
"8",
"bytes",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/text_encoding.py#L87-L107 |
29,586 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/type.py | register_suffixes | def register_suffixes (suffixes, type):
""" Specifies that targets with suffix from 'suffixes' have the type 'type'.
If a different type is already specified for any of syffixes, issues an error.
"""
assert is_iterable_typed(suffixes, basestring)
assert isinstance(type, basestring)
for s in ... | python | def register_suffixes (suffixes, type):
""" Specifies that targets with suffix from 'suffixes' have the type 'type'.
If a different type is already specified for any of syffixes, issues an error.
"""
assert is_iterable_typed(suffixes, basestring)
assert isinstance(type, basestring)
for s in ... | [
"def",
"register_suffixes",
"(",
"suffixes",
",",
"type",
")",
":",
"assert",
"is_iterable_typed",
"(",
"suffixes",
",",
"basestring",
")",
"assert",
"isinstance",
"(",
"type",
",",
"basestring",
")",
"for",
"s",
"in",
"suffixes",
":",
"if",
"s",
"in",
"__... | Specifies that targets with suffix from 'suffixes' have the type 'type'.
If a different type is already specified for any of syffixes, issues an error. | [
"Specifies",
"that",
"targets",
"with",
"suffix",
"from",
"suffixes",
"have",
"the",
"type",
"type",
".",
"If",
"a",
"different",
"type",
"is",
"already",
"specified",
"for",
"any",
"of",
"syffixes",
"issues",
"an",
"error",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/type.py#L123-L135 |
29,587 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/type.py | set_scanner | def set_scanner (type, scanner):
""" Sets a scanner class that will be used for this 'type'.
"""
if __debug__:
from .scanner import Scanner
assert isinstance(type, basestring)
assert issubclass(scanner, Scanner)
validate (type)
__types [type]['scanner'] = scanner | python | def set_scanner (type, scanner):
""" Sets a scanner class that will be used for this 'type'.
"""
if __debug__:
from .scanner import Scanner
assert isinstance(type, basestring)
assert issubclass(scanner, Scanner)
validate (type)
__types [type]['scanner'] = scanner | [
"def",
"set_scanner",
"(",
"type",
",",
"scanner",
")",
":",
"if",
"__debug__",
":",
"from",
".",
"scanner",
"import",
"Scanner",
"assert",
"isinstance",
"(",
"type",
",",
"basestring",
")",
"assert",
"issubclass",
"(",
"scanner",
",",
"Scanner",
")",
"val... | Sets a scanner class that will be used for this 'type'. | [
"Sets",
"a",
"scanner",
"class",
"that",
"will",
"be",
"used",
"for",
"this",
"type",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/type.py#L150-L158 |
29,588 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/type.py | get_scanner | def get_scanner (type, prop_set):
""" Returns a scanner instance appropriate to 'type' and 'property_set'.
"""
if __debug__:
from .property_set import PropertySet
assert isinstance(type, basestring)
assert isinstance(prop_set, PropertySet)
if registered (type):
scanner_ty... | python | def get_scanner (type, prop_set):
""" Returns a scanner instance appropriate to 'type' and 'property_set'.
"""
if __debug__:
from .property_set import PropertySet
assert isinstance(type, basestring)
assert isinstance(prop_set, PropertySet)
if registered (type):
scanner_ty... | [
"def",
"get_scanner",
"(",
"type",
",",
"prop_set",
")",
":",
"if",
"__debug__",
":",
"from",
".",
"property_set",
"import",
"PropertySet",
"assert",
"isinstance",
"(",
"type",
",",
"basestring",
")",
"assert",
"isinstance",
"(",
"prop_set",
",",
"PropertySet"... | Returns a scanner instance appropriate to 'type' and 'property_set'. | [
"Returns",
"a",
"scanner",
"instance",
"appropriate",
"to",
"type",
"and",
"property_set",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/type.py#L160-L173 |
29,589 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/type.py | all_bases | def all_bases (type):
""" Returns type and all of its bases, in the order of their distance from type.
"""
assert isinstance(type, basestring)
result = []
while type:
result.append (type)
type = __types [type]['base']
return result | python | def all_bases (type):
""" Returns type and all of its bases, in the order of their distance from type.
"""
assert isinstance(type, basestring)
result = []
while type:
result.append (type)
type = __types [type]['base']
return result | [
"def",
"all_bases",
"(",
"type",
")",
":",
"assert",
"isinstance",
"(",
"type",
",",
"basestring",
")",
"result",
"=",
"[",
"]",
"while",
"type",
":",
"result",
".",
"append",
"(",
"type",
")",
"type",
"=",
"__types",
"[",
"type",
"]",
"[",
"'base'",... | Returns type and all of its bases, in the order of their distance from type. | [
"Returns",
"type",
"and",
"all",
"of",
"its",
"bases",
"in",
"the",
"order",
"of",
"their",
"distance",
"from",
"type",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/type.py#L181-L190 |
29,590 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/type.py | all_derived | def all_derived (type):
""" Returns type and all classes that derive from it, in the order of their distance from type.
"""
assert isinstance(type, basestring)
result = [type]
for d in __types [type]['derived']:
result.extend (all_derived (d))
return result | python | def all_derived (type):
""" Returns type and all classes that derive from it, in the order of their distance from type.
"""
assert isinstance(type, basestring)
result = [type]
for d in __types [type]['derived']:
result.extend (all_derived (d))
return result | [
"def",
"all_derived",
"(",
"type",
")",
":",
"assert",
"isinstance",
"(",
"type",
",",
"basestring",
")",
"result",
"=",
"[",
"type",
"]",
"for",
"d",
"in",
"__types",
"[",
"type",
"]",
"[",
"'derived'",
"]",
":",
"result",
".",
"extend",
"(",
"all_d... | Returns type and all classes that derive from it, in the order of their distance from type. | [
"Returns",
"type",
"and",
"all",
"classes",
"that",
"derive",
"from",
"it",
"in",
"the",
"order",
"of",
"their",
"distance",
"from",
"type",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/type.py#L192-L200 |
29,591 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/type.py | is_derived | def is_derived (type, base):
""" Returns true if 'type' is 'base' or has 'base' as its direct or indirect base.
"""
assert isinstance(type, basestring)
assert isinstance(base, basestring)
# TODO: this isn't very efficient, especially for bases close to type
if base in all_bases (type):
r... | python | def is_derived (type, base):
""" Returns true if 'type' is 'base' or has 'base' as its direct or indirect base.
"""
assert isinstance(type, basestring)
assert isinstance(base, basestring)
# TODO: this isn't very efficient, especially for bases close to type
if base in all_bases (type):
r... | [
"def",
"is_derived",
"(",
"type",
",",
"base",
")",
":",
"assert",
"isinstance",
"(",
"type",
",",
"basestring",
")",
"assert",
"isinstance",
"(",
"base",
",",
"basestring",
")",
"# TODO: this isn't very efficient, especially for bases close to type",
"if",
"base",
... | Returns true if 'type' is 'base' or has 'base' as its direct or indirect base. | [
"Returns",
"true",
"if",
"type",
"is",
"base",
"or",
"has",
"base",
"as",
"its",
"direct",
"or",
"indirect",
"base",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/type.py#L202-L211 |
29,592 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/type.py | is_subtype | def is_subtype (type, base):
""" Same as is_derived. Should be removed.
"""
assert isinstance(type, basestring)
assert isinstance(base, basestring)
# TODO: remove this method
return is_derived (type, base) | python | def is_subtype (type, base):
""" Same as is_derived. Should be removed.
"""
assert isinstance(type, basestring)
assert isinstance(base, basestring)
# TODO: remove this method
return is_derived (type, base) | [
"def",
"is_subtype",
"(",
"type",
",",
"base",
")",
":",
"assert",
"isinstance",
"(",
"type",
",",
"basestring",
")",
"assert",
"isinstance",
"(",
"base",
",",
"basestring",
")",
"# TODO: remove this method",
"return",
"is_derived",
"(",
"type",
",",
"base",
... | Same as is_derived. Should be removed. | [
"Same",
"as",
"is_derived",
".",
"Should",
"be",
"removed",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/type.py#L213-L219 |
29,593 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/type.py | generated_target_ps | def generated_target_ps(is_suffix, type, prop_set):
""" Returns suffix that should be used when generating target of 'type',
with the specified properties. If not suffix were specified for
'type', returns suffix for base type, if any.
"""
if __debug__:
from .property_set import Prope... | python | def generated_target_ps(is_suffix, type, prop_set):
""" Returns suffix that should be used when generating target of 'type',
with the specified properties. If not suffix were specified for
'type', returns suffix for base type, if any.
"""
if __debug__:
from .property_set import Prope... | [
"def",
"generated_target_ps",
"(",
"is_suffix",
",",
"type",
",",
"prop_set",
")",
":",
"if",
"__debug__",
":",
"from",
".",
"property_set",
"import",
"PropertySet",
"assert",
"isinstance",
"(",
"is_suffix",
",",
"(",
"int",
",",
"bool",
")",
")",
"assert",
... | Returns suffix that should be used when generating target of 'type',
with the specified properties. If not suffix were specified for
'type', returns suffix for base type, if any. | [
"Returns",
"suffix",
"that",
"should",
"be",
"used",
"when",
"generating",
"target",
"of",
"type",
"with",
"the",
"specified",
"properties",
".",
"If",
"not",
"suffix",
"were",
"specified",
"for",
"type",
"returns",
"suffix",
"for",
"base",
"type",
"if",
"an... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/type.py#L334-L351 |
29,594 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/type.py | type | def type(filename):
""" Returns file type given it's name. If there are several dots in filename,
tries each suffix. E.g. for name of "file.so.1.2" suffixes "2", "1", and
"so" will be tried.
"""
assert isinstance(filename, basestring)
while 1:
filename, suffix = os.path.splitext... | python | def type(filename):
""" Returns file type given it's name. If there are several dots in filename,
tries each suffix. E.g. for name of "file.so.1.2" suffixes "2", "1", and
"so" will be tried.
"""
assert isinstance(filename, basestring)
while 1:
filename, suffix = os.path.splitext... | [
"def",
"type",
"(",
"filename",
")",
":",
"assert",
"isinstance",
"(",
"filename",
",",
"basestring",
")",
"while",
"1",
":",
"filename",
",",
"suffix",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"filename",
")",
"if",
"not",
"suffix",
":",
"return"... | Returns file type given it's name. If there are several dots in filename,
tries each suffix. E.g. for name of "file.so.1.2" suffixes "2", "1", and
"so" will be tried. | [
"Returns",
"file",
"type",
"given",
"it",
"s",
"name",
".",
"If",
"there",
"are",
"several",
"dots",
"in",
"filename",
"tries",
"each",
"suffix",
".",
"E",
".",
"g",
".",
"for",
"name",
"of",
"file",
".",
"so",
".",
"1",
".",
"2",
"suffixes",
"2",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/type.py#L353-L365 |
29,595 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/type.py | register_type | def register_type (type, suffixes, base_type = None, os = []):
""" Register the given type on the specified OSes, or on remaining OSes
if os is not specified. This rule is injected into each of the type
modules for the sake of convenience.
"""
assert isinstance(type, basestring)
assert ... | python | def register_type (type, suffixes, base_type = None, os = []):
""" Register the given type on the specified OSes, or on remaining OSes
if os is not specified. This rule is injected into each of the type
modules for the sake of convenience.
"""
assert isinstance(type, basestring)
assert ... | [
"def",
"register_type",
"(",
"type",
",",
"suffixes",
",",
"base_type",
"=",
"None",
",",
"os",
"=",
"[",
"]",
")",
":",
"assert",
"isinstance",
"(",
"type",
",",
"basestring",
")",
"assert",
"is_iterable_typed",
"(",
"suffixes",
",",
"basestring",
")",
... | Register the given type on the specified OSes, or on remaining OSes
if os is not specified. This rule is injected into each of the type
modules for the sake of convenience. | [
"Register",
"the",
"given",
"type",
"on",
"the",
"specified",
"OSes",
"or",
"on",
"remaining",
"OSes",
"if",
"os",
"is",
"not",
"specified",
".",
"This",
"rule",
"is",
"injected",
"into",
"each",
"of",
"the",
"type",
"modules",
"for",
"the",
"sake",
"of"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/type.py#L368-L381 |
29,596 | apple/turicreate | src/unity/python/turicreate/toolkits/_feature_engineering/_internal_utils.py | pretty_print_list | def pretty_print_list(lst, name = 'features', repr_format=True):
""" Pretty print a list to be readable.
"""
if not lst or len(lst) < 8:
if repr_format:
return lst.__repr__()
else:
return ', '.join(map(str, lst))
else:
topk = ', '.join(map(str, lst[:3]))
... | python | def pretty_print_list(lst, name = 'features', repr_format=True):
""" Pretty print a list to be readable.
"""
if not lst or len(lst) < 8:
if repr_format:
return lst.__repr__()
else:
return ', '.join(map(str, lst))
else:
topk = ', '.join(map(str, lst[:3]))
... | [
"def",
"pretty_print_list",
"(",
"lst",
",",
"name",
"=",
"'features'",
",",
"repr_format",
"=",
"True",
")",
":",
"if",
"not",
"lst",
"or",
"len",
"(",
"lst",
")",
"<",
"8",
":",
"if",
"repr_format",
":",
"return",
"lst",
".",
"__repr__",
"(",
")",
... | Pretty print a list to be readable. | [
"Pretty",
"print",
"a",
"list",
"to",
"be",
"readable",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_feature_engineering/_internal_utils.py#L140-L159 |
29,597 | apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py | convert_flatten | def convert_flatten(builder, layer, input_names, output_names, keras_layer):
"""Convert a flatten layer from keras to coreml.
Parameters
keras_layer: layer
----------
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object.
"""
input_name, output... | python | def convert_flatten(builder, layer, input_names, output_names, keras_layer):
"""Convert a flatten layer from keras to coreml.
Parameters
keras_layer: layer
----------
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object.
"""
input_name, output... | [
"def",
"convert_flatten",
"(",
"builder",
",",
"layer",
",",
"input_names",
",",
"output_names",
",",
"keras_layer",
")",
":",
"input_name",
",",
"output_name",
"=",
"(",
"input_names",
"[",
"0",
"]",
",",
"output_names",
"[",
"0",
"]",
")",
"# blob_order ==... | Convert a flatten layer from keras to coreml.
Parameters
keras_layer: layer
----------
A keras layer object.
builder: NeuralNetworkBuilder
A neural network builder object. | [
"Convert",
"a",
"flatten",
"layer",
"from",
"keras",
"to",
"coreml",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/keras/_layers.py#L878-L900 |
29,598 | apple/turicreate | src/external/xgboost/python-package/xgboost/core.py | _maybe_from_pandas | def _maybe_from_pandas(data, feature_names, feature_types):
""" Extract internal data from pd.DataFrame """
try:
import pandas as pd
except ImportError:
return data, feature_names, feature_types
if not isinstance(data, pd.DataFrame):
return data, feature_names, feature_types
... | python | def _maybe_from_pandas(data, feature_names, feature_types):
""" Extract internal data from pd.DataFrame """
try:
import pandas as pd
except ImportError:
return data, feature_names, feature_types
if not isinstance(data, pd.DataFrame):
return data, feature_names, feature_types
... | [
"def",
"_maybe_from_pandas",
"(",
"data",
",",
"feature_names",
",",
"feature_types",
")",
":",
"try",
":",
"import",
"pandas",
"as",
"pd",
"except",
"ImportError",
":",
"return",
"data",
",",
"feature_names",
",",
"feature_types",
"if",
"not",
"isinstance",
"... | Extract internal data from pd.DataFrame | [
"Extract",
"internal",
"data",
"from",
"pd",
".",
"DataFrame"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/core.py#L141-L161 |
29,599 | apple/turicreate | src/external/xgboost/python-package/xgboost/core.py | DMatrix.get_float_info | def get_float_info(self, field):
"""Get float property from the DMatrix.
Parameters
----------
field: str
The field name of the information
Returns
-------
info : array
a numpy array of float information of the data
"""
le... | python | def get_float_info(self, field):
"""Get float property from the DMatrix.
Parameters
----------
field: str
The field name of the information
Returns
-------
info : array
a numpy array of float information of the data
"""
le... | [
"def",
"get_float_info",
"(",
"self",
",",
"field",
")",
":",
"length",
"=",
"ctypes",
".",
"c_ulong",
"(",
")",
"ret",
"=",
"ctypes",
".",
"POINTER",
"(",
"ctypes",
".",
"c_float",
")",
"(",
")",
"_check_call",
"(",
"_LIB",
".",
"XGDMatrixGetFloatInfo",... | Get float property from the DMatrix.
Parameters
----------
field: str
The field name of the information
Returns
-------
info : array
a numpy array of float information of the data | [
"Get",
"float",
"property",
"from",
"the",
"DMatrix",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/core.py#L277-L296 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.