repo stringclasses 85
values | path stringlengths 8 121 | func_name stringlengths 1 82 | original_string stringlengths 112 65.5k | language stringclasses 1
value | code stringlengths 112 65.5k | code_tokens listlengths 20 4.09k | docstring stringlengths 3 46.3k | docstring_tokens listlengths 1 564 | sha stringclasses 85
values | url stringlengths 93 218 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py | add_enumerated_multiarray_shapes | def add_enumerated_multiarray_shapes(spec, feature_name, shapes):
"""
Annotate an input or output multiArray feature in a Neural Network spec to
to accommodate a list of enumerated array shapes
:param spec: MLModel
The MLModel spec containing the feature
:param feature_name: str
Th... | python | def add_enumerated_multiarray_shapes(spec, feature_name, shapes):
"""
Annotate an input or output multiArray feature in a Neural Network spec to
to accommodate a list of enumerated array shapes
:param spec: MLModel
The MLModel spec containing the feature
:param feature_name: str
Th... | [
"def",
"add_enumerated_multiarray_shapes",
"(",
"spec",
",",
"feature_name",
",",
"shapes",
")",
":",
"if",
"not",
"isinstance",
"(",
"shapes",
",",
"list",
")",
":",
"shapes",
"=",
"[",
"shapes",
"]",
"for",
"shape",
"in",
"shapes",
":",
"if",
"not",
"i... | Annotate an input or output multiArray feature in a Neural Network spec to
to accommodate a list of enumerated array shapes
:param spec: MLModel
The MLModel spec containing the feature
:param feature_name: str
The name of the image feature for which to add shape information.
If the... | [
"Annotate",
"an",
"input",
"or",
"output",
"multiArray",
"feature",
"in",
"a",
"Neural",
"Network",
"spec",
"to",
"to",
"accommodate",
"a",
"list",
"of",
"enumerated",
"array",
"shapes"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py#L291-L370 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py | add_enumerated_image_sizes | def add_enumerated_image_sizes(spec, feature_name, sizes):
"""
Annotate an input or output image feature in a Neural Network spec to
to accommodate a list of enumerated image sizes
:param spec: MLModel
The MLModel spec containing the feature
:param feature_name: str
The name of the... | python | def add_enumerated_image_sizes(spec, feature_name, sizes):
"""
Annotate an input or output image feature in a Neural Network spec to
to accommodate a list of enumerated image sizes
:param spec: MLModel
The MLModel spec containing the feature
:param feature_name: str
The name of the... | [
"def",
"add_enumerated_image_sizes",
"(",
"spec",
",",
"feature_name",
",",
"sizes",
")",
":",
"if",
"not",
"isinstance",
"(",
"sizes",
",",
"list",
")",
":",
"sizes",
"=",
"[",
"sizes",
"]",
"for",
"size",
"in",
"sizes",
":",
"if",
"not",
"isinstance",
... | Annotate an input or output image feature in a Neural Network spec to
to accommodate a list of enumerated image sizes
:param spec: MLModel
The MLModel spec containing the feature
:param feature_name: str
The name of the image feature for which to add size information.
If the featur... | [
"Annotate",
"an",
"input",
"or",
"output",
"image",
"feature",
"in",
"a",
"Neural",
"Network",
"spec",
"to",
"to",
"accommodate",
"a",
"list",
"of",
"enumerated",
"image",
"sizes"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py#L373-L437 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py | update_image_size_range | def update_image_size_range(spec, feature_name, size_range):
"""
Annotate an input or output Image feature in a Neural Network spec to
to accommodate a range of image sizes
:param spec: MLModel
The MLModel spec containing the feature
:param feature_name: str
The name of the Image f... | python | def update_image_size_range(spec, feature_name, size_range):
"""
Annotate an input or output Image feature in a Neural Network spec to
to accommodate a range of image sizes
:param spec: MLModel
The MLModel spec containing the feature
:param feature_name: str
The name of the Image f... | [
"def",
"update_image_size_range",
"(",
"spec",
",",
"feature_name",
",",
"size_range",
")",
":",
"if",
"not",
"isinstance",
"(",
"size_range",
",",
"NeuralNetworkImageSizeRange",
")",
":",
"raise",
"Exception",
"(",
"'Shape ranges should be of type NeuralNetworkImageSizeR... | Annotate an input or output Image feature in a Neural Network spec to
to accommodate a range of image sizes
:param spec: MLModel
The MLModel spec containing the feature
:param feature_name: str
The name of the Image feature for which to add shape information.
If the feature is not ... | [
"Annotate",
"an",
"input",
"or",
"output",
"Image",
"feature",
"in",
"a",
"Neural",
"Network",
"spec",
"to",
"to",
"accommodate",
"a",
"range",
"of",
"image",
"sizes"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py#L440-L490 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py | update_multiarray_shape_range | def update_multiarray_shape_range(spec, feature_name, shape_range):
"""
Annotate an input or output MLMultiArray feature in a Neural Network spec
to accommodate a range of shapes
:param spec: MLModel
The MLModel spec containing the feature
:param feature_name: str
The name of the f... | python | def update_multiarray_shape_range(spec, feature_name, shape_range):
"""
Annotate an input or output MLMultiArray feature in a Neural Network spec
to accommodate a range of shapes
:param spec: MLModel
The MLModel spec containing the feature
:param feature_name: str
The name of the f... | [
"def",
"update_multiarray_shape_range",
"(",
"spec",
",",
"feature_name",
",",
"shape_range",
")",
":",
"if",
"not",
"isinstance",
"(",
"shape_range",
",",
"NeuralNetworkMultiArrayShapeRange",
")",
":",
"raise",
"Exception",
"(",
"'Shape range should be of type MultiArray... | Annotate an input or output MLMultiArray feature in a Neural Network spec
to accommodate a range of shapes
:param spec: MLModel
The MLModel spec containing the feature
:param feature_name: str
The name of the feature for which to add shape range
information. If the feature is not f... | [
"Annotate",
"an",
"input",
"or",
"output",
"MLMultiArray",
"feature",
"in",
"a",
"Neural",
"Network",
"spec",
"to",
"accommodate",
"a",
"range",
"of",
"shapes"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py#L493-L556 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py | get_allowed_shape_ranges | def get_allowed_shape_ranges(spec):
"""
For a given model specification, returns a dictionary with a shape range object for each input feature name.
"""
shaper = NeuralNetworkShaper(spec, False)
inputs = _get_input_names(spec)
output = {}
for input in inputs:
output[input] = shaper... | python | def get_allowed_shape_ranges(spec):
"""
For a given model specification, returns a dictionary with a shape range object for each input feature name.
"""
shaper = NeuralNetworkShaper(spec, False)
inputs = _get_input_names(spec)
output = {}
for input in inputs:
output[input] = shaper... | [
"def",
"get_allowed_shape_ranges",
"(",
"spec",
")",
":",
"shaper",
"=",
"NeuralNetworkShaper",
"(",
"spec",
",",
"False",
")",
"inputs",
"=",
"_get_input_names",
"(",
"spec",
")",
"output",
"=",
"{",
"}",
"for",
"input",
"in",
"inputs",
":",
"output",
"["... | For a given model specification, returns a dictionary with a shape range object for each input feature name. | [
"For",
"a",
"given",
"model",
"specification",
"returns",
"a",
"dictionary",
"with",
"a",
"shape",
"range",
"object",
"for",
"each",
"input",
"feature",
"name",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py#L559-L571 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py | can_allow_multiple_input_shapes | def can_allow_multiple_input_shapes(spec):
"""
Examines a model specification and determines if it can compute results for more than one output shape.
:param spec: MLModel
The protobuf specification of the model.
:return: Bool
Returns True if the model can allow multiple input shapes, ... | python | def can_allow_multiple_input_shapes(spec):
"""
Examines a model specification and determines if it can compute results for more than one output shape.
:param spec: MLModel
The protobuf specification of the model.
:return: Bool
Returns True if the model can allow multiple input shapes, ... | [
"def",
"can_allow_multiple_input_shapes",
"(",
"spec",
")",
":",
"# First, check that the model actually has a neural network in it",
"try",
":",
"layers",
"=",
"_get_nn_layers",
"(",
"spec",
")",
"except",
":",
"raise",
"Exception",
"(",
"'Unable to verify that this model co... | Examines a model specification and determines if it can compute results for more than one output shape.
:param spec: MLModel
The protobuf specification of the model.
:return: Bool
Returns True if the model can allow multiple input shapes, False otherwise. | [
"Examines",
"a",
"model",
"specification",
"and",
"determines",
"if",
"it",
"can",
"compute",
"results",
"for",
"more",
"than",
"one",
"output",
"shape",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py#L575-L607 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py | NeuralNetworkMultiArrayShapeRange.isFlexible | def isFlexible(self):
"""
Returns true if any one of the channel, height, or width ranges of this shape allow more than one input value.
"""
for key, value in self.arrayShapeRange.items():
if key in _CONSTRAINED_KEYS:
if value.isFlexible:
r... | python | def isFlexible(self):
"""
Returns true if any one of the channel, height, or width ranges of this shape allow more than one input value.
"""
for key, value in self.arrayShapeRange.items():
if key in _CONSTRAINED_KEYS:
if value.isFlexible:
r... | [
"def",
"isFlexible",
"(",
"self",
")",
":",
"for",
"key",
",",
"value",
"in",
"self",
".",
"arrayShapeRange",
".",
"items",
"(",
")",
":",
"if",
"key",
"in",
"_CONSTRAINED_KEYS",
":",
"if",
"value",
".",
"isFlexible",
":",
"return",
"True",
"return",
"... | Returns true if any one of the channel, height, or width ranges of this shape allow more than one input value. | [
"Returns",
"true",
"if",
"any",
"one",
"of",
"the",
"channel",
"height",
"or",
"width",
"ranges",
"of",
"this",
"shape",
"allow",
"more",
"than",
"one",
"input",
"value",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/flexible_shape_utils.py#L220-L229 | train |
apple/turicreate | deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py | define_macro | def define_macro(out_f, (name, args, body), undefine=False, check=True):
"""Generate a macro definition or undefinition"""
if undefine:
out_f.write(
'#undef {0}\n'
.format(macro_name(name))
)
else:
if args:
arg_list = '({0})'.format(', '.join(args)... | python | def define_macro(out_f, (name, args, body), undefine=False, check=True):
"""Generate a macro definition or undefinition"""
if undefine:
out_f.write(
'#undef {0}\n'
.format(macro_name(name))
)
else:
if args:
arg_list = '({0})'.format(', '.join(args)... | [
"def",
"define_macro",
"(",
"out_f",
",",
"(",
"name",
",",
"args",
",",
"body",
")",
",",
"undefine",
"=",
"False",
",",
"check",
"=",
"True",
")",
":",
"if",
"undefine",
":",
"out_f",
".",
"write",
"(",
"'#undef {0}\\n'",
".",
"format",
"(",
"macro... | Generate a macro definition or undefinition | [
"Generate",
"a",
"macro",
"definition",
"or",
"undefinition"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py#L92-L115 | train |
apple/turicreate | deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py | filename | def filename(out_dir, name, undefine=False):
"""Generate the filename"""
if undefine:
prefix = 'undef_'
else:
prefix = ''
return os.path.join(out_dir, '{0}{1}.hpp'.format(prefix, name.lower())) | python | def filename(out_dir, name, undefine=False):
"""Generate the filename"""
if undefine:
prefix = 'undef_'
else:
prefix = ''
return os.path.join(out_dir, '{0}{1}.hpp'.format(prefix, name.lower())) | [
"def",
"filename",
"(",
"out_dir",
",",
"name",
",",
"undefine",
"=",
"False",
")",
":",
"if",
"undefine",
":",
"prefix",
"=",
"'undef_'",
"else",
":",
"prefix",
"=",
"''",
"return",
"os",
".",
"path",
".",
"join",
"(",
"out_dir",
",",
"'{0}{1}.hpp'",
... | Generate the filename | [
"Generate",
"the",
"filename"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py#L118-L124 | train |
apple/turicreate | deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py | length_limits | def length_limits(max_length_limit, length_limit_step):
"""Generates the length limits"""
string_len = len(str(max_length_limit))
return [
str(i).zfill(string_len) for i in
xrange(
length_limit_step,
max_length_limit + length_limit_step - 1,
length_limit_s... | python | def length_limits(max_length_limit, length_limit_step):
"""Generates the length limits"""
string_len = len(str(max_length_limit))
return [
str(i).zfill(string_len) for i in
xrange(
length_limit_step,
max_length_limit + length_limit_step - 1,
length_limit_s... | [
"def",
"length_limits",
"(",
"max_length_limit",
",",
"length_limit_step",
")",
":",
"string_len",
"=",
"len",
"(",
"str",
"(",
"max_length_limit",
")",
")",
"return",
"[",
"str",
"(",
"i",
")",
".",
"zfill",
"(",
"string_len",
")",
"for",
"i",
"in",
"xr... | Generates the length limits | [
"Generates",
"the",
"length",
"limits"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py#L127-L137 | train |
apple/turicreate | deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py | generate_take | def generate_take(out_f, steps, line_prefix):
"""Generate the take function"""
out_f.write(
'{0}constexpr inline int take(int n_)\n'
'{0}{{\n'
'{0} return {1} 0 {2};\n'
'{0}}}\n'
'\n'.format(
line_prefix,
''.join('n_ >= {0} ? {0} : ('.format(s) fo... | python | def generate_take(out_f, steps, line_prefix):
"""Generate the take function"""
out_f.write(
'{0}constexpr inline int take(int n_)\n'
'{0}{{\n'
'{0} return {1} 0 {2};\n'
'{0}}}\n'
'\n'.format(
line_prefix,
''.join('n_ >= {0} ? {0} : ('.format(s) fo... | [
"def",
"generate_take",
"(",
"out_f",
",",
"steps",
",",
"line_prefix",
")",
":",
"out_f",
".",
"write",
"(",
"'{0}constexpr inline int take(int n_)\\n'",
"'{0}{{\\n'",
"'{0} return {1} 0 {2};\\n'",
"'{0}}}\\n'",
"'\\n'",
".",
"format",
"(",
"line_prefix",
",",
"''",... | Generate the take function | [
"Generate",
"the",
"take",
"function"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py#L145-L157 | train |
apple/turicreate | deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py | generate_make_string | def generate_make_string(out_f, max_step):
"""Generate the make_string template"""
steps = [2 ** n for n in xrange(int(math.log(max_step, 2)), -1, -1)]
with Namespace(
out_f,
['boost', 'metaparse', 'v{0}'.format(VERSION), 'impl']
) as nsp:
generate_take(out_f, steps, nsp.prefix(... | python | def generate_make_string(out_f, max_step):
"""Generate the make_string template"""
steps = [2 ** n for n in xrange(int(math.log(max_step, 2)), -1, -1)]
with Namespace(
out_f,
['boost', 'metaparse', 'v{0}'.format(VERSION), 'impl']
) as nsp:
generate_take(out_f, steps, nsp.prefix(... | [
"def",
"generate_make_string",
"(",
"out_f",
",",
"max_step",
")",
":",
"steps",
"=",
"[",
"2",
"**",
"n",
"for",
"n",
"in",
"xrange",
"(",
"int",
"(",
"math",
".",
"log",
"(",
"max_step",
",",
"2",
")",
")",
",",
"-",
"1",
",",
"-",
"1",
")",
... | Generate the make_string template | [
"Generate",
"the",
"make_string",
"template"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py#L160-L199 | train |
apple/turicreate | deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py | generate_string | def generate_string(out_dir, limits):
"""Generate string.hpp"""
max_limit = max((int(v) for v in limits))
with open(filename(out_dir, 'string'), 'wb') as out_f:
with IncludeGuard(out_f):
out_f.write(
'\n'
'#include <boost/metaparse/v{0}/cpp11/impl/concat.... | python | def generate_string(out_dir, limits):
"""Generate string.hpp"""
max_limit = max((int(v) for v in limits))
with open(filename(out_dir, 'string'), 'wb') as out_f:
with IncludeGuard(out_f):
out_f.write(
'\n'
'#include <boost/metaparse/v{0}/cpp11/impl/concat.... | [
"def",
"generate_string",
"(",
"out_dir",
",",
"limits",
")",
":",
"max_limit",
"=",
"max",
"(",
"(",
"int",
"(",
"v",
")",
"for",
"v",
"in",
"limits",
")",
")",
"with",
"open",
"(",
"filename",
"(",
"out_dir",
",",
"'string'",
")",
",",
"'wb'",
")... | Generate string.hpp | [
"Generate",
"string",
".",
"hpp"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py#L202-L275 | train |
apple/turicreate | deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py | existing_path | def existing_path(value):
"""Throws when the path does not exist"""
if os.path.exists(value):
return value
else:
raise argparse.ArgumentTypeError("Path {0} not found".format(value)) | python | def existing_path(value):
"""Throws when the path does not exist"""
if os.path.exists(value):
return value
else:
raise argparse.ArgumentTypeError("Path {0} not found".format(value)) | [
"def",
"existing_path",
"(",
"value",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"value",
")",
":",
"return",
"value",
"else",
":",
"raise",
"argparse",
".",
"ArgumentTypeError",
"(",
"\"Path {0} not found\"",
".",
"format",
"(",
"value",
")",
... | Throws when the path does not exist | [
"Throws",
"when",
"the",
"path",
"does",
"not",
"exist"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py#L287-L292 | train |
apple/turicreate | deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py | main | def main():
"""The main function of the script"""
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
'--boost_dir',
required=False,
type=existing_path,
help='The path to the include/boost directory of Metaparse'
)
parser.add_argument(
'... | python | def main():
"""The main function of the script"""
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument(
'--boost_dir',
required=False,
type=existing_path,
help='The path to the include/boost directory of Metaparse'
)
parser.add_argument(
'... | [
"def",
"main",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"__doc__",
")",
"parser",
".",
"add_argument",
"(",
"'--boost_dir'",
",",
"required",
"=",
"False",
",",
"type",
"=",
"existing_path",
",",
"help",
"="... | The main function of the script | [
"The",
"main",
"function",
"of",
"the",
"script"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py#L295-L343 | train |
apple/turicreate | deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py | Namespace.begin | def begin(self):
"""Generate the beginning part"""
self.out_f.write('\n')
for depth, name in enumerate(self.names):
self.out_f.write(
'{0}namespace {1}\n{0}{{\n'.format(self.prefix(depth), name)
) | python | def begin(self):
"""Generate the beginning part"""
self.out_f.write('\n')
for depth, name in enumerate(self.names):
self.out_f.write(
'{0}namespace {1}\n{0}{{\n'.format(self.prefix(depth), name)
) | [
"def",
"begin",
"(",
"self",
")",
":",
"self",
".",
"out_f",
".",
"write",
"(",
"'\\n'",
")",
"for",
"depth",
",",
"name",
"in",
"enumerate",
"(",
"self",
".",
"names",
")",
":",
"self",
".",
"out_f",
".",
"write",
"(",
"'{0}namespace {1}\\n{0}{{\\n'",... | Generate the beginning part | [
"Generate",
"the",
"beginning",
"part"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py#L25-L31 | train |
apple/turicreate | deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py | Namespace.end | def end(self):
"""Generate the closing part"""
for depth in xrange(len(self.names) - 1, -1, -1):
self.out_f.write('{0}}}\n'.format(self.prefix(depth))) | python | def end(self):
"""Generate the closing part"""
for depth in xrange(len(self.names) - 1, -1, -1):
self.out_f.write('{0}}}\n'.format(self.prefix(depth))) | [
"def",
"end",
"(",
"self",
")",
":",
"for",
"depth",
"in",
"xrange",
"(",
"len",
"(",
"self",
".",
"names",
")",
"-",
"1",
",",
"-",
"1",
",",
"-",
"1",
")",
":",
"self",
".",
"out_f",
".",
"write",
"(",
"'{0}}}\\n'",
".",
"format",
"(",
"sel... | Generate the closing part | [
"Generate",
"the",
"closing",
"part"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py#L33-L36 | train |
apple/turicreate | deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py | IncludeGuard.begin | def begin(self):
"""Generate the beginning part"""
name = 'BOOST_METAPARSE_V1_CPP11_IMPL_STRING_HPP'
self.out_f.write('#ifndef {0}\n#define {0}\n'.format(name))
write_autogen_info(self.out_f) | python | def begin(self):
"""Generate the beginning part"""
name = 'BOOST_METAPARSE_V1_CPP11_IMPL_STRING_HPP'
self.out_f.write('#ifndef {0}\n#define {0}\n'.format(name))
write_autogen_info(self.out_f) | [
"def",
"begin",
"(",
"self",
")",
":",
"name",
"=",
"'BOOST_METAPARSE_V1_CPP11_IMPL_STRING_HPP'",
"self",
".",
"out_f",
".",
"write",
"(",
"'#ifndef {0}\\n#define {0}\\n'",
".",
"format",
"(",
"name",
")",
")",
"write_autogen_info",
"(",
"self",
".",
"out_f",
")... | Generate the beginning part | [
"Generate",
"the",
"beginning",
"part"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/string_headers.py#L69-L73 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/sound_classifier/sound_classifier.py | get_deep_features | def get_deep_features(audio_data, verbose=True):
'''
Calculates the deep features used by the Sound Classifier.
Internally the Sound Classifier calculates deep features for both model
creation and predictions. If the same data will be used multiple times,
calculating the deep features just once wil... | python | def get_deep_features(audio_data, verbose=True):
'''
Calculates the deep features used by the Sound Classifier.
Internally the Sound Classifier calculates deep features for both model
creation and predictions. If the same data will be used multiple times,
calculating the deep features just once wil... | [
"def",
"get_deep_features",
"(",
"audio_data",
",",
"verbose",
"=",
"True",
")",
":",
"from",
".",
"_audio_feature_extractor",
"import",
"_get_feature_extractor",
"if",
"not",
"_is_audio_data_sarray",
"(",
"audio_data",
")",
":",
"raise",
"TypeError",
"(",
"\"Input ... | Calculates the deep features used by the Sound Classifier.
Internally the Sound Classifier calculates deep features for both model
creation and predictions. If the same data will be used multiple times,
calculating the deep features just once will result in a significant speed
up.
Parameters
-... | [
"Calculates",
"the",
"deep",
"features",
"used",
"by",
"the",
"Sound",
"Classifier",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/sound_classifier/sound_classifier.py#L45-L75 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/sound_classifier/sound_classifier.py | create | def create(dataset, target, feature, max_iterations=10,
custom_layer_sizes=[100, 100], verbose=True,
validation_set='auto', batch_size=64):
'''
Creates a :class:`SoundClassifier` model.
Parameters
----------
dataset : SFrame
Input data. The column named by the 'feature... | python | def create(dataset, target, feature, max_iterations=10,
custom_layer_sizes=[100, 100], verbose=True,
validation_set='auto', batch_size=64):
'''
Creates a :class:`SoundClassifier` model.
Parameters
----------
dataset : SFrame
Input data. The column named by the 'feature... | [
"def",
"create",
"(",
"dataset",
",",
"target",
",",
"feature",
",",
"max_iterations",
"=",
"10",
",",
"custom_layer_sizes",
"=",
"[",
"100",
",",
"100",
"]",
",",
"verbose",
"=",
"True",
",",
"validation_set",
"=",
"'auto'",
",",
"batch_size",
"=",
"64"... | Creates a :class:`SoundClassifier` model.
Parameters
----------
dataset : SFrame
Input data. The column named by the 'feature' parameter will be
extracted for modeling.
target : string or int
Name of the column containing the target variable. The values in this
column m... | [
"Creates",
"a",
":",
"class",
":",
"SoundClassifier",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/sound_classifier/sound_classifier.py#L78-L303 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/sound_classifier/sound_classifier.py | SoundClassifier._load_version | def _load_version(cls, state, version):
"""
A function to load a previously saved SoundClassifier instance.
"""
from ._audio_feature_extractor import _get_feature_extractor
from .._mxnet import _mxnet_utils
state['_feature_extractor'] = _get_feature_extractor(state['feat... | python | def _load_version(cls, state, version):
"""
A function to load a previously saved SoundClassifier instance.
"""
from ._audio_feature_extractor import _get_feature_extractor
from .._mxnet import _mxnet_utils
state['_feature_extractor'] = _get_feature_extractor(state['feat... | [
"def",
"_load_version",
"(",
"cls",
",",
"state",
",",
"version",
")",
":",
"from",
".",
"_audio_feature_extractor",
"import",
"_get_feature_extractor",
"from",
".",
".",
"_mxnet",
"import",
"_mxnet_utils",
"state",
"[",
"'_feature_extractor'",
"]",
"=",
"_get_fea... | A function to load a previously saved SoundClassifier instance. | [
"A",
"function",
"to",
"load",
"a",
"previously",
"saved",
"SoundClassifier",
"instance",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/sound_classifier/sound_classifier.py#L363-L388 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/sound_classifier/sound_classifier.py | SoundClassifier.classify | def classify(self, dataset, verbose=True, batch_size=64):
"""
Return the classification for each examples in the ``dataset``.
The output SFrame contains predicted class labels and its probability.
Parameters
----------
dataset : SFrame | SArray | dict
The aud... | python | def classify(self, dataset, verbose=True, batch_size=64):
"""
Return the classification for each examples in the ``dataset``.
The output SFrame contains predicted class labels and its probability.
Parameters
----------
dataset : SFrame | SArray | dict
The aud... | [
"def",
"classify",
"(",
"self",
",",
"dataset",
",",
"verbose",
"=",
"True",
",",
"batch_size",
"=",
"64",
")",
":",
"prob_vector",
"=",
"self",
".",
"predict",
"(",
"dataset",
",",
"output_type",
"=",
"'probability_vector'",
",",
"verbose",
"=",
"verbose"... | Return the classification for each examples in the ``dataset``.
The output SFrame contains predicted class labels and its probability.
Parameters
----------
dataset : SFrame | SArray | dict
The audio data to be classified.
If dataset is an SFrame, it must have a ... | [
"Return",
"the",
"classification",
"for",
"each",
"examples",
"in",
"the",
"dataset",
".",
"The",
"output",
"SFrame",
"contains",
"predicted",
"class",
"labels",
"and",
"its",
"probability",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/sound_classifier/sound_classifier.py#L447-L487 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/sound_classifier/sound_classifier.py | SoundClassifier.evaluate | def evaluate(self, dataset, metric='auto', verbose=True, batch_size=64):
"""
Evaluate the model by making predictions of target values and comparing
these to actual values.
Parameters
----------
dataset : SFrame
Dataset to use for evaluation, must include a c... | python | def evaluate(self, dataset, metric='auto', verbose=True, batch_size=64):
"""
Evaluate the model by making predictions of target values and comparing
these to actual values.
Parameters
----------
dataset : SFrame
Dataset to use for evaluation, must include a c... | [
"def",
"evaluate",
"(",
"self",
",",
"dataset",
",",
"metric",
"=",
"'auto'",
",",
"verbose",
"=",
"True",
",",
"batch_size",
"=",
"64",
")",
":",
"from",
"turicreate",
".",
"toolkits",
"import",
"evaluation",
"# parameter checking",
"if",
"not",
"isinstance... | Evaluate the model by making predictions of target values and comparing
these to actual values.
Parameters
----------
dataset : SFrame
Dataset to use for evaluation, must include a column with the same
name as the features used for model training. Additional colu... | [
"Evaluate",
"the",
"model",
"by",
"making",
"predictions",
"of",
"target",
"values",
"and",
"comparing",
"these",
"to",
"actual",
"values",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/sound_classifier/sound_classifier.py#L489-L600 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/sound_classifier/sound_classifier.py | SoundClassifier.export_coreml | def export_coreml(self, filename):
"""
Save the model in Core ML format.
See Also
--------
save
Examples
--------
>>> model.export_coreml('./myModel.mlmodel')
"""
import coremltools
from coremltools.proto.FeatureTypes_pb2 import A... | python | def export_coreml(self, filename):
"""
Save the model in Core ML format.
See Also
--------
save
Examples
--------
>>> model.export_coreml('./myModel.mlmodel')
"""
import coremltools
from coremltools.proto.FeatureTypes_pb2 import A... | [
"def",
"export_coreml",
"(",
"self",
",",
"filename",
")",
":",
"import",
"coremltools",
"from",
"coremltools",
".",
"proto",
".",
"FeatureTypes_pb2",
"import",
"ArrayFeatureType",
"from",
".",
".",
"_mxnet",
"import",
"_mxnet_utils",
"prob_name",
"=",
"self",
"... | Save the model in Core ML format.
See Also
--------
save
Examples
--------
>>> model.export_coreml('./myModel.mlmodel') | [
"Save",
"the",
"model",
"in",
"Core",
"ML",
"format",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/sound_classifier/sound_classifier.py#L602-L721 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/sound_classifier/sound_classifier.py | SoundClassifier.predict | def predict(self, dataset, output_type='class', verbose=True, batch_size=64):
"""
Return predictions for ``dataset``. Predictions can be generated
as class labels or probabilities.
Parameters
----------
dataset : SFrame | SArray | dict
The audio data to be cl... | python | def predict(self, dataset, output_type='class', verbose=True, batch_size=64):
"""
Return predictions for ``dataset``. Predictions can be generated
as class labels or probabilities.
Parameters
----------
dataset : SFrame | SArray | dict
The audio data to be cl... | [
"def",
"predict",
"(",
"self",
",",
"dataset",
",",
"output_type",
"=",
"'class'",
",",
"verbose",
"=",
"True",
",",
"batch_size",
"=",
"64",
")",
":",
"from",
".",
".",
"_mxnet",
"import",
"_mxnet_utils",
"import",
"mxnet",
"as",
"mx",
"if",
"not",
"i... | Return predictions for ``dataset``. Predictions can be generated
as class labels or probabilities.
Parameters
----------
dataset : SFrame | SArray | dict
The audio data to be classified.
If dataset is an SFrame, it must have a column with the same name as
... | [
"Return",
"predictions",
"for",
"dataset",
".",
"Predictions",
"can",
"be",
"generated",
"as",
"class",
"labels",
"or",
"probabilities",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/sound_classifier/sound_classifier.py#L723-L851 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/sound_classifier/sound_classifier.py | SoundClassifier.predict_topk | def predict_topk(self, dataset, output_type='probability', k=3, verbose=True, batch_size=64):
"""
Return top-k predictions for the ``dataset``.
Predictions are returned as an SFrame with three columns: `id`,
`class`, and `probability` or `rank` depending on the ``output_type``
pa... | python | def predict_topk(self, dataset, output_type='probability', k=3, verbose=True, batch_size=64):
"""
Return top-k predictions for the ``dataset``.
Predictions are returned as an SFrame with three columns: `id`,
`class`, and `probability` or `rank` depending on the ``output_type``
pa... | [
"def",
"predict_topk",
"(",
"self",
",",
"dataset",
",",
"output_type",
"=",
"'probability'",
",",
"k",
"=",
"3",
",",
"verbose",
"=",
"True",
",",
"batch_size",
"=",
"64",
")",
":",
"prob_vector",
"=",
"self",
".",
"predict",
"(",
"dataset",
",",
"out... | Return top-k predictions for the ``dataset``.
Predictions are returned as an SFrame with three columns: `id`,
`class`, and `probability` or `rank` depending on the ``output_type``
parameter.
Parameters
----------
dataset : SFrame | SArray | dict
The audio dat... | [
"Return",
"top",
"-",
"k",
"predictions",
"for",
"the",
"dataset",
".",
"Predictions",
"are",
"returned",
"as",
"an",
"SFrame",
"with",
"three",
"columns",
":",
"id",
"class",
"and",
"probability",
"or",
"rank",
"depending",
"on",
"the",
"output_type",
"para... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/sound_classifier/sound_classifier.py#L853-L932 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_mxnet/_mx_sframe_iter.py | _init_data | def _init_data(data, allow_empty, default_name):
"""Convert data into canonical form."""
assert (data is not None) or allow_empty
if data is None:
data = []
if isinstance(data, (np.ndarray, NDArray)):
data = [data]
if isinstance(data, list):
if not allow_empty:
a... | python | def _init_data(data, allow_empty, default_name):
"""Convert data into canonical form."""
assert (data is not None) or allow_empty
if data is None:
data = []
if isinstance(data, (np.ndarray, NDArray)):
data = [data]
if isinstance(data, list):
if not allow_empty:
a... | [
"def",
"_init_data",
"(",
"data",
",",
"allow_empty",
",",
"default_name",
")",
":",
"assert",
"(",
"data",
"is",
"not",
"None",
")",
"or",
"allow_empty",
"if",
"data",
"is",
"None",
":",
"data",
"=",
"[",
"]",
"if",
"isinstance",
"(",
"data",
",",
"... | Convert data into canonical form. | [
"Convert",
"data",
"into",
"canonical",
"form",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_mxnet/_mx_sframe_iter.py#L37-L62 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_mxnet/_mx_sframe_iter.py | SFrameIter.provide_data | def provide_data(self):
"""The name and shape of data provided by this iterator"""
return [(k, tuple([self.batch_size] + list(v.shape[1:]))) for k, v in self.data] | python | def provide_data(self):
"""The name and shape of data provided by this iterator"""
return [(k, tuple([self.batch_size] + list(v.shape[1:]))) for k, v in self.data] | [
"def",
"provide_data",
"(",
"self",
")",
":",
"return",
"[",
"(",
"k",
",",
"tuple",
"(",
"[",
"self",
".",
"batch_size",
"]",
"+",
"list",
"(",
"v",
".",
"shape",
"[",
"1",
":",
"]",
")",
")",
")",
"for",
"k",
",",
"v",
"in",
"self",
".",
... | The name and shape of data provided by this iterator | [
"The",
"name",
"and",
"shape",
"of",
"data",
"provided",
"by",
"this",
"iterator"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_mxnet/_mx_sframe_iter.py#L134-L136 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_mxnet/_mx_sframe_iter.py | SFrameIter.provide_label | def provide_label(self):
"""The name and shape of label provided by this iterator"""
return [(k, tuple([self.batch_size] + list(v.shape[1:]))) for k, v in self.label] | python | def provide_label(self):
"""The name and shape of label provided by this iterator"""
return [(k, tuple([self.batch_size] + list(v.shape[1:]))) for k, v in self.label] | [
"def",
"provide_label",
"(",
"self",
")",
":",
"return",
"[",
"(",
"k",
",",
"tuple",
"(",
"[",
"self",
".",
"batch_size",
"]",
"+",
"list",
"(",
"v",
".",
"shape",
"[",
"1",
":",
"]",
")",
")",
")",
"for",
"k",
",",
"v",
"in",
"self",
".",
... | The name and shape of label provided by this iterator | [
"The",
"name",
"and",
"shape",
"of",
"label",
"provided",
"by",
"this",
"iterator"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_mxnet/_mx_sframe_iter.py#L139-L141 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/generators.py | reset | def reset ():
""" Clear the module state. This is mainly for testing purposes.
"""
global __generators, __type_to_generators, __generators_for_toolset, __construct_stack
global __overrides, __active_generators
global __viable_generators_cache, __viable_source_types_cache
global __vstg_cached_gen... | python | def reset ():
""" Clear the module state. This is mainly for testing purposes.
"""
global __generators, __type_to_generators, __generators_for_toolset, __construct_stack
global __overrides, __active_generators
global __viable_generators_cache, __viable_source_types_cache
global __vstg_cached_gen... | [
"def",
"reset",
"(",
")",
":",
"global",
"__generators",
",",
"__type_to_generators",
",",
"__generators_for_toolset",
",",
"__construct_stack",
"global",
"__overrides",
",",
"__active_generators",
"global",
"__viable_generators_cache",
",",
"__viable_source_types_cache",
"... | Clear the module state. This is mainly for testing purposes. | [
"Clear",
"the",
"module",
"state",
".",
"This",
"is",
"mainly",
"for",
"testing",
"purposes",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/generators.py#L65-L85 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/generators.py | register | def register (g):
""" Registers new generator instance 'g'.
"""
assert isinstance(g, Generator)
id = g.id()
__generators [id] = g
# A generator can produce several targets of the
# same type. We want unique occurence of that generator
# in .generators.$(t) in that case, otherwise, it w... | python | def register (g):
""" Registers new generator instance 'g'.
"""
assert isinstance(g, Generator)
id = g.id()
__generators [id] = g
# A generator can produce several targets of the
# same type. We want unique occurence of that generator
# in .generators.$(t) in that case, otherwise, it w... | [
"def",
"register",
"(",
"g",
")",
":",
"assert",
"isinstance",
"(",
"g",
",",
"Generator",
")",
"id",
"=",
"g",
".",
"id",
"(",
")",
"__generators",
"[",
"id",
"]",
"=",
"g",
"# A generator can produce several targets of the",
"# same type. We want unique occure... | Registers new generator instance 'g'. | [
"Registers",
"new",
"generator",
"instance",
"g",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/generators.py#L657-L706 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/generators.py | register_standard | def register_standard (id, source_types, target_types, requirements = []):
""" Creates new instance of the 'generator' class and registers it.
Returns the creates instance.
Rationale: the instance is returned so that it's possible to first register
a generator and then call 'run' method on t... | python | def register_standard (id, source_types, target_types, requirements = []):
""" Creates new instance of the 'generator' class and registers it.
Returns the creates instance.
Rationale: the instance is returned so that it's possible to first register
a generator and then call 'run' method on t... | [
"def",
"register_standard",
"(",
"id",
",",
"source_types",
",",
"target_types",
",",
"requirements",
"=",
"[",
"]",
")",
":",
"g",
"=",
"Generator",
"(",
"id",
",",
"False",
",",
"source_types",
",",
"target_types",
",",
"requirements",
")",
"register",
"... | Creates new instance of the 'generator' class and registers it.
Returns the creates instance.
Rationale: the instance is returned so that it's possible to first register
a generator and then call 'run' method on that generator, bypassing all
generator selection. | [
"Creates",
"new",
"instance",
"of",
"the",
"generator",
"class",
"and",
"registers",
"it",
".",
"Returns",
"the",
"creates",
"instance",
".",
"Rationale",
":",
"the",
"instance",
"is",
"returned",
"so",
"that",
"it",
"s",
"possible",
"to",
"first",
"register... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/generators.py#L723-L732 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/generators.py | override | def override (overrider_id, overridee_id):
"""Make generator 'overrider-id' be preferred to
'overridee-id'. If, when searching for generators
that could produce a target of certain type,
both those generators are amoung viable generators,
the overridden generator is immediately discarded.
The o... | python | def override (overrider_id, overridee_id):
"""Make generator 'overrider-id' be preferred to
'overridee-id'. If, when searching for generators
that could produce a target of certain type,
both those generators are amoung viable generators,
the overridden generator is immediately discarded.
The o... | [
"def",
"override",
"(",
"overrider_id",
",",
"overridee_id",
")",
":",
"assert",
"isinstance",
"(",
"overrider_id",
",",
"basestring",
")",
"assert",
"isinstance",
"(",
"overridee_id",
",",
"basestring",
")",
"__overrides",
".",
"setdefault",
"(",
"overrider_id",
... | Make generator 'overrider-id' be preferred to
'overridee-id'. If, when searching for generators
that could produce a target of certain type,
both those generators are amoung viable generators,
the overridden generator is immediately discarded.
The overridden generators are discarded immediately
... | [
"Make",
"generator",
"overrider",
"-",
"id",
"be",
"preferred",
"to",
"overridee",
"-",
"id",
".",
"If",
"when",
"searching",
"for",
"generators",
"that",
"could",
"produce",
"a",
"target",
"of",
"certain",
"type",
"both",
"those",
"generators",
"are",
"amou... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/generators.py#L747-L760 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/generators.py | __viable_source_types_real | def __viable_source_types_real (target_type):
""" Returns a list of source type which can possibly be converted
to 'target_type' by some chain of generator invocation.
More formally, takes all generators for 'target_type' and
returns union of source types for those generators and result
... | python | def __viable_source_types_real (target_type):
""" Returns a list of source type which can possibly be converted
to 'target_type' by some chain of generator invocation.
More formally, takes all generators for 'target_type' and
returns union of source types for those generators and result
... | [
"def",
"__viable_source_types_real",
"(",
"target_type",
")",
":",
"assert",
"isinstance",
"(",
"target_type",
",",
"basestring",
")",
"generators",
"=",
"[",
"]",
"# 't0' is the initial list of target types we need to process to get a list",
"# of their viable source target type... | Returns a list of source type which can possibly be converted
to 'target_type' by some chain of generator invocation.
More formally, takes all generators for 'target_type' and
returns union of source types for those generators and result
of calling itself recusrively on source types. | [
"Returns",
"a",
"list",
"of",
"source",
"type",
"which",
"can",
"possibly",
"be",
"converted",
"to",
"target_type",
"by",
"some",
"chain",
"of",
"generator",
"invocation",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/generators.py#L762-L820 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/generators.py | viable_source_types | def viable_source_types (target_type):
""" Helper rule, caches the result of '__viable_source_types_real'.
"""
assert isinstance(target_type, basestring)
if target_type not in __viable_source_types_cache:
__vst_cached_types.append(target_type)
__viable_source_types_cache [target_type] = ... | python | def viable_source_types (target_type):
""" Helper rule, caches the result of '__viable_source_types_real'.
"""
assert isinstance(target_type, basestring)
if target_type not in __viable_source_types_cache:
__vst_cached_types.append(target_type)
__viable_source_types_cache [target_type] = ... | [
"def",
"viable_source_types",
"(",
"target_type",
")",
":",
"assert",
"isinstance",
"(",
"target_type",
",",
"basestring",
")",
"if",
"target_type",
"not",
"in",
"__viable_source_types_cache",
":",
"__vst_cached_types",
".",
"append",
"(",
"target_type",
")",
"__via... | Helper rule, caches the result of '__viable_source_types_real'. | [
"Helper",
"rule",
"caches",
"the",
"result",
"of",
"__viable_source_types_real",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/generators.py#L823-L830 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/generators.py | viable_source_types_for_generator_real | def viable_source_types_for_generator_real (generator):
""" Returns the list of source types, which, when passed to 'run'
method of 'generator', has some change of being eventually used
(probably after conversion by other generators)
"""
assert isinstance(generator, Generator)
source_typ... | python | def viable_source_types_for_generator_real (generator):
""" Returns the list of source types, which, when passed to 'run'
method of 'generator', has some change of being eventually used
(probably after conversion by other generators)
"""
assert isinstance(generator, Generator)
source_typ... | [
"def",
"viable_source_types_for_generator_real",
"(",
"generator",
")",
":",
"assert",
"isinstance",
"(",
"generator",
",",
"Generator",
")",
"source_types",
"=",
"generator",
".",
"source_types",
"(",
")",
"if",
"not",
"source_types",
":",
"# If generator does not sp... | Returns the list of source types, which, when passed to 'run'
method of 'generator', has some change of being eventually used
(probably after conversion by other generators) | [
"Returns",
"the",
"list",
"of",
"source",
"types",
"which",
"when",
"passed",
"to",
"run",
"method",
"of",
"generator",
"has",
"some",
"change",
"of",
"being",
"eventually",
"used",
"(",
"probably",
"after",
"conversion",
"by",
"other",
"generators",
")"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/generators.py#L832-L857 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/generators.py | viable_source_types_for_generator | def viable_source_types_for_generator (generator):
""" Caches the result of 'viable_source_types_for_generator'.
"""
assert isinstance(generator, Generator)
if generator not in __viable_source_types_cache:
__vstg_cached_generators.append(generator)
__viable_source_types_cache[generator] ... | python | def viable_source_types_for_generator (generator):
""" Caches the result of 'viable_source_types_for_generator'.
"""
assert isinstance(generator, Generator)
if generator not in __viable_source_types_cache:
__vstg_cached_generators.append(generator)
__viable_source_types_cache[generator] ... | [
"def",
"viable_source_types_for_generator",
"(",
"generator",
")",
":",
"assert",
"isinstance",
"(",
"generator",
",",
"Generator",
")",
"if",
"generator",
"not",
"in",
"__viable_source_types_cache",
":",
"__vstg_cached_generators",
".",
"append",
"(",
"generator",
")... | Caches the result of 'viable_source_types_for_generator'. | [
"Caches",
"the",
"result",
"of",
"viable_source_types_for_generator",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/generators.py#L859-L867 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/generators.py | try_one_generator_really | def try_one_generator_really (project, name, generator, target_type, properties, sources):
""" Returns usage requirements + list of created targets.
"""
if __debug__:
from .targets import ProjectTarget
assert isinstance(project, ProjectTarget)
assert isinstance(name, basestring) or n... | python | def try_one_generator_really (project, name, generator, target_type, properties, sources):
""" Returns usage requirements + list of created targets.
"""
if __debug__:
from .targets import ProjectTarget
assert isinstance(project, ProjectTarget)
assert isinstance(name, basestring) or n... | [
"def",
"try_one_generator_really",
"(",
"project",
",",
"name",
",",
"generator",
",",
"target_type",
",",
"properties",
",",
"sources",
")",
":",
"if",
"__debug__",
":",
"from",
".",
"targets",
"import",
"ProjectTarget",
"assert",
"isinstance",
"(",
"project",
... | Returns usage requirements + list of created targets. | [
"Returns",
"usage",
"requirements",
"+",
"list",
"of",
"created",
"targets",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/generators.py#L869-L907 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/generators.py | try_one_generator | def try_one_generator (project, name, generator, target_type, properties, sources):
""" Checks if generator invocation can be pruned, because it's guaranteed
to fail. If so, quickly returns empty list. Otherwise, calls
try_one_generator_really.
"""
if __debug__:
from .targets import ... | python | def try_one_generator (project, name, generator, target_type, properties, sources):
""" Checks if generator invocation can be pruned, because it's guaranteed
to fail. If so, quickly returns empty list. Otherwise, calls
try_one_generator_really.
"""
if __debug__:
from .targets import ... | [
"def",
"try_one_generator",
"(",
"project",
",",
"name",
",",
"generator",
",",
"target_type",
",",
"properties",
",",
"sources",
")",
":",
"if",
"__debug__",
":",
"from",
".",
"targets",
"import",
"ProjectTarget",
"assert",
"isinstance",
"(",
"project",
",",
... | Checks if generator invocation can be pruned, because it's guaranteed
to fail. If so, quickly returns empty list. Otherwise, calls
try_one_generator_really. | [
"Checks",
"if",
"generator",
"invocation",
"can",
"be",
"pruned",
"because",
"it",
"s",
"guaranteed",
"to",
"fail",
".",
"If",
"so",
"quickly",
"returns",
"empty",
"list",
".",
"Otherwise",
"calls",
"try_one_generator_really",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/generators.py#L909-L940 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/generators.py | __ensure_type | def __ensure_type (targets):
""" Ensures all 'targets' have types. If this is not so, exists with
error.
"""
assert is_iterable_typed(targets, virtual_target.VirtualTarget)
for t in targets:
if not t.type ():
get_manager().errors()("target '%s' has no type" % str (t)) | python | def __ensure_type (targets):
""" Ensures all 'targets' have types. If this is not so, exists with
error.
"""
assert is_iterable_typed(targets, virtual_target.VirtualTarget)
for t in targets:
if not t.type ():
get_manager().errors()("target '%s' has no type" % str (t)) | [
"def",
"__ensure_type",
"(",
"targets",
")",
":",
"assert",
"is_iterable_typed",
"(",
"targets",
",",
"virtual_target",
".",
"VirtualTarget",
")",
"for",
"t",
"in",
"targets",
":",
"if",
"not",
"t",
".",
"type",
"(",
")",
":",
"get_manager",
"(",
")",
".... | Ensures all 'targets' have types. If this is not so, exists with
error. | [
"Ensures",
"all",
"targets",
"have",
"types",
".",
"If",
"this",
"is",
"not",
"so",
"exists",
"with",
"error",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/generators.py#L978-L985 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/generators.py | find_viable_generators_aux | def find_viable_generators_aux (target_type, prop_set):
""" Returns generators which can be used to construct target of specified type
with specified properties. Uses the following algorithm:
- iterates over requested target_type and all it's bases (in the order returned bt
type.all-bases.... | python | def find_viable_generators_aux (target_type, prop_set):
""" Returns generators which can be used to construct target of specified type
with specified properties. Uses the following algorithm:
- iterates over requested target_type and all it's bases (in the order returned bt
type.all-bases.... | [
"def",
"find_viable_generators_aux",
"(",
"target_type",
",",
"prop_set",
")",
":",
"assert",
"isinstance",
"(",
"target_type",
",",
"basestring",
")",
"assert",
"isinstance",
"(",
"prop_set",
",",
"property_set",
".",
"PropertySet",
")",
"# Select generators that can... | Returns generators which can be used to construct target of specified type
with specified properties. Uses the following algorithm:
- iterates over requested target_type and all it's bases (in the order returned bt
type.all-bases.
- for each type find all generators that generate that ... | [
"Returns",
"generators",
"which",
"can",
"be",
"used",
"to",
"construct",
"target",
"of",
"specified",
"type",
"with",
"specified",
"properties",
".",
"Uses",
"the",
"following",
"algorithm",
":",
"-",
"iterates",
"over",
"requested",
"target_type",
"and",
"all"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/generators.py#L987-L1045 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/generators.py | __construct_really | def __construct_really (project, name, target_type, prop_set, sources):
""" Attempts to construct target by finding viable generators, running them
and selecting the dependency graph.
"""
if __debug__:
from .targets import ProjectTarget
assert isinstance(project, ProjectTarget)
... | python | def __construct_really (project, name, target_type, prop_set, sources):
""" Attempts to construct target by finding viable generators, running them
and selecting the dependency graph.
"""
if __debug__:
from .targets import ProjectTarget
assert isinstance(project, ProjectTarget)
... | [
"def",
"__construct_really",
"(",
"project",
",",
"name",
",",
"target_type",
",",
"prop_set",
",",
"sources",
")",
":",
"if",
"__debug__",
":",
"from",
".",
"targets",
"import",
"ProjectTarget",
"assert",
"isinstance",
"(",
"project",
",",
"ProjectTarget",
")... | Attempts to construct target by finding viable generators, running them
and selecting the dependency graph. | [
"Attempts",
"to",
"construct",
"target",
"by",
"finding",
"viable",
"generators",
"running",
"them",
"and",
"selecting",
"the",
"dependency",
"graph",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/generators.py#L1091-L1136 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/generators.py | construct | def construct (project, name, target_type, prop_set, sources, top_level=False):
""" Attempts to create target of 'target-type' with 'properties'
from 'sources'. The 'sources' are treated as a collection of
*possible* ingridients -- i.e. it is not required to consume
them all. If 'multiple' i... | python | def construct (project, name, target_type, prop_set, sources, top_level=False):
""" Attempts to create target of 'target-type' with 'properties'
from 'sources'. The 'sources' are treated as a collection of
*possible* ingridients -- i.e. it is not required to consume
them all. If 'multiple' i... | [
"def",
"construct",
"(",
"project",
",",
"name",
",",
"target_type",
",",
"prop_set",
",",
"sources",
",",
"top_level",
"=",
"False",
")",
":",
"if",
"__debug__",
":",
"from",
".",
"targets",
"import",
"ProjectTarget",
"assert",
"isinstance",
"(",
"project",... | Attempts to create target of 'target-type' with 'properties'
from 'sources'. The 'sources' are treated as a collection of
*possible* ingridients -- i.e. it is not required to consume
them all. If 'multiple' is true, the rule is allowed to return
several targets of 'target-type'.
... | [
"Attempts",
"to",
"create",
"target",
"of",
"target",
"-",
"type",
"with",
"properties",
"from",
"sources",
".",
"The",
"sources",
"are",
"treated",
"as",
"a",
"collection",
"of",
"*",
"possible",
"*",
"ingridients",
"--",
"i",
".",
"e",
".",
"it",
"is",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/generators.py#L1139-L1194 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/generators.py | Generator.clone | def clone (self, new_id, new_toolset_properties):
""" Returns another generator which differers from $(self) in
- id
- value to <toolset> feature in properties
"""
assert isinstance(new_id, basestring)
assert is_iterable_typed(new_toolset_properties, basestrin... | python | def clone (self, new_id, new_toolset_properties):
""" Returns another generator which differers from $(self) in
- id
- value to <toolset> feature in properties
"""
assert isinstance(new_id, basestring)
assert is_iterable_typed(new_toolset_properties, basestrin... | [
"def",
"clone",
"(",
"self",
",",
"new_id",
",",
"new_toolset_properties",
")",
":",
"assert",
"isinstance",
"(",
"new_id",
",",
"basestring",
")",
"assert",
"is_iterable_typed",
"(",
"new_toolset_properties",
",",
"basestring",
")",
"return",
"self",
".",
"__cl... | Returns another generator which differers from $(self) in
- id
- value to <toolset> feature in properties | [
"Returns",
"another",
"generator",
"which",
"differers",
"from",
"$",
"(",
"self",
")",
"in",
"-",
"id",
"-",
"value",
"to",
"<toolset",
">",
"feature",
"in",
"properties"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/generators.py#L238-L251 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/generators.py | Generator.clone_and_change_target_type | def clone_and_change_target_type(self, base, type):
"""Creates another generator that is the same as $(self), except that
if 'base' is in target types of $(self), 'type' will in target types
of the new generator."""
assert isinstance(base, basestring)
assert isinstance(type, base... | python | def clone_and_change_target_type(self, base, type):
"""Creates another generator that is the same as $(self), except that
if 'base' is in target types of $(self), 'type' will in target types
of the new generator."""
assert isinstance(base, basestring)
assert isinstance(type, base... | [
"def",
"clone_and_change_target_type",
"(",
"self",
",",
"base",
",",
"type",
")",
":",
"assert",
"isinstance",
"(",
"base",
",",
"basestring",
")",
"assert",
"isinstance",
"(",
"type",
",",
"basestring",
")",
"target_types",
"=",
"[",
"]",
"for",
"t",
"in... | Creates another generator that is the same as $(self), except that
if 'base' is in target types of $(self), 'type' will in target types
of the new generator. | [
"Creates",
"another",
"generator",
"that",
"is",
"the",
"same",
"as",
"$",
"(",
"self",
")",
"except",
"that",
"if",
"base",
"is",
"in",
"target",
"types",
"of",
"$",
"(",
"self",
")",
"type",
"will",
"in",
"target",
"types",
"of",
"the",
"new",
"gen... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/generators.py#L253-L275 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/generators.py | Generator.match_rank | def match_rank (self, ps):
""" Returns true if the generator can be run with the specified
properties.
"""
# See if generator's requirements are satisfied by
# 'properties'. Treat a feature name in requirements
# (i.e. grist-only element), as matching any value of th... | python | def match_rank (self, ps):
""" Returns true if the generator can be run with the specified
properties.
"""
# See if generator's requirements are satisfied by
# 'properties'. Treat a feature name in requirements
# (i.e. grist-only element), as matching any value of th... | [
"def",
"match_rank",
"(",
"self",
",",
"ps",
")",
":",
"# See if generator's requirements are satisfied by",
"# 'properties'. Treat a feature name in requirements",
"# (i.e. grist-only element), as matching any value of the",
"# feature.",
"assert",
"isinstance",
"(",
"ps",
",",
"... | Returns true if the generator can be run with the specified
properties. | [
"Returns",
"true",
"if",
"the",
"generator",
"can",
"be",
"run",
"with",
"the",
"specified",
"properties",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/generators.py#L301-L325 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/generators.py | Generator.run | def run (self, project, name, prop_set, sources):
""" Tries to invoke this generator on the given sources. Returns a
list of generated targets (instances of 'virtual-target').
project: Project for which the targets are generated.
name: Determines the name o... | python | def run (self, project, name, prop_set, sources):
""" Tries to invoke this generator on the given sources. Returns a
list of generated targets (instances of 'virtual-target').
project: Project for which the targets are generated.
name: Determines the name o... | [
"def",
"run",
"(",
"self",
",",
"project",
",",
"name",
",",
"prop_set",
",",
"sources",
")",
":",
"if",
"__debug__",
":",
"from",
".",
"targets",
"import",
"ProjectTarget",
"assert",
"isinstance",
"(",
"project",
",",
"ProjectTarget",
")",
"# intermediary t... | Tries to invoke this generator on the given sources. Returns a
list of generated targets (instances of 'virtual-target').
project: Project for which the targets are generated.
name: Determines the name of 'name' attribute for
all generat... | [
"Tries",
"to",
"invoke",
"this",
"generator",
"on",
"the",
"given",
"sources",
".",
"Returns",
"a",
"list",
"of",
"generated",
"targets",
"(",
"instances",
"of",
"virtual",
"-",
"target",
")",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/generators.py#L327-L373 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/generators.py | Generator.construct_result | def construct_result (self, consumed, project, name, prop_set):
""" Constructs the dependency graph that will be returned by this
generator.
consumed: Already prepared list of consumable targets
If generator requires several source files will c... | python | def construct_result (self, consumed, project, name, prop_set):
""" Constructs the dependency graph that will be returned by this
generator.
consumed: Already prepared list of consumable targets
If generator requires several source files will c... | [
"def",
"construct_result",
"(",
"self",
",",
"consumed",
",",
"project",
",",
"name",
",",
"prop_set",
")",
":",
"if",
"__debug__",
":",
"from",
".",
"targets",
"import",
"ProjectTarget",
"assert",
"is_iterable_typed",
"(",
"consumed",
",",
"virtual_target",
"... | Constructs the dependency graph that will be returned by this
generator.
consumed: Already prepared list of consumable targets
If generator requires several source files will contain
exactly len $(self.source_types_) ta... | [
"Constructs",
"the",
"dependency",
"graph",
"that",
"will",
"be",
"returned",
"by",
"this",
"generator",
".",
"consumed",
":",
"Already",
"prepared",
"list",
"of",
"consumable",
"targets",
"If",
"generator",
"requires",
"several",
"source",
"files",
"will",
"con... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/generators.py#L403-L430 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/generators.py | Generator.determine_output_name | def determine_output_name(self, sources):
"""Determine the name of the produced target from the
names of the sources."""
assert is_iterable_typed(sources, virtual_target.VirtualTarget)
# The simple case if when a name
# of source has single dot. Then, we take the part before
... | python | def determine_output_name(self, sources):
"""Determine the name of the produced target from the
names of the sources."""
assert is_iterable_typed(sources, virtual_target.VirtualTarget)
# The simple case if when a name
# of source has single dot. Then, we take the part before
... | [
"def",
"determine_output_name",
"(",
"self",
",",
"sources",
")",
":",
"assert",
"is_iterable_typed",
"(",
"sources",
",",
"virtual_target",
".",
"VirtualTarget",
")",
"# The simple case if when a name",
"# of source has single dot. Then, we take the part before",
"# dot. Sever... | Determine the name of the produced target from the
names of the sources. | [
"Determine",
"the",
"name",
"of",
"the",
"produced",
"target",
"from",
"the",
"names",
"of",
"the",
"sources",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/generators.py#L451-L475 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/generators.py | Generator.generated_targets | def generated_targets (self, sources, prop_set, project, name):
""" Constructs targets that are created after consuming 'sources'.
The result will be the list of virtual-target, which the same length
as 'target_types' attribute and with corresponding types.
When 'name' is em... | python | def generated_targets (self, sources, prop_set, project, name):
""" Constructs targets that are created after consuming 'sources'.
The result will be the list of virtual-target, which the same length
as 'target_types' attribute and with corresponding types.
When 'name' is em... | [
"def",
"generated_targets",
"(",
"self",
",",
"sources",
",",
"prop_set",
",",
"project",
",",
"name",
")",
":",
"if",
"__debug__",
":",
"from",
".",
"targets",
"import",
"ProjectTarget",
"assert",
"is_iterable_typed",
"(",
"sources",
",",
"virtual_target",
".... | Constructs targets that are created after consuming 'sources'.
The result will be the list of virtual-target, which the same length
as 'target_types' attribute and with corresponding types.
When 'name' is empty, all source targets must have the same value of
the 'name' a... | [
"Constructs",
"targets",
"that",
"are",
"created",
"after",
"consuming",
"sources",
".",
"The",
"result",
"will",
"be",
"the",
"list",
"of",
"virtual",
"-",
"target",
"which",
"the",
"same",
"length",
"as",
"target_types",
"attribute",
"and",
"with",
"correspo... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/generators.py#L478-L526 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/generators.py | Generator.convert_to_consumable_types | def convert_to_consumable_types (self, project, name, prop_set, sources, only_one=False):
""" Attempts to convert 'source' to the types that this generator can
handle. The intention is to produce the set of targets can should be
used when generator is run.
only_one: convert... | python | def convert_to_consumable_types (self, project, name, prop_set, sources, only_one=False):
""" Attempts to convert 'source' to the types that this generator can
handle. The intention is to produce the set of targets can should be
used when generator is run.
only_one: convert... | [
"def",
"convert_to_consumable_types",
"(",
"self",
",",
"project",
",",
"name",
",",
"prop_set",
",",
"sources",
",",
"only_one",
"=",
"False",
")",
":",
"if",
"__debug__",
":",
"from",
".",
"targets",
"import",
"ProjectTarget",
"assert",
"isinstance",
"(",
... | Attempts to convert 'source' to the types that this generator can
handle. The intention is to produce the set of targets can should be
used when generator is run.
only_one: convert 'source' to only one of source types
if there's more that one possibility, re... | [
"Attempts",
"to",
"convert",
"source",
"to",
"the",
"types",
"that",
"this",
"generator",
"can",
"handle",
".",
"The",
"intention",
"is",
"to",
"produce",
"the",
"set",
"of",
"targets",
"can",
"should",
"be",
"used",
"when",
"generator",
"is",
"run",
".",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/generators.py#L528-L585 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/generators.py | Generator.convert_multiple_sources_to_consumable_types | def convert_multiple_sources_to_consumable_types (self, project, prop_set, sources):
""" Converts several files to consumable types.
"""
if __debug__:
from .targets import ProjectTarget
assert isinstance(project, ProjectTarget)
assert isinstance(prop_set, pro... | python | def convert_multiple_sources_to_consumable_types (self, project, prop_set, sources):
""" Converts several files to consumable types.
"""
if __debug__:
from .targets import ProjectTarget
assert isinstance(project, ProjectTarget)
assert isinstance(prop_set, pro... | [
"def",
"convert_multiple_sources_to_consumable_types",
"(",
"self",
",",
"project",
",",
"prop_set",
",",
"sources",
")",
":",
"if",
"__debug__",
":",
"from",
".",
"targets",
"import",
"ProjectTarget",
"assert",
"isinstance",
"(",
"project",
",",
"ProjectTarget",
... | Converts several files to consumable types. | [
"Converts",
"several",
"files",
"to",
"consumable",
"types",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/generators.py#L588-L619 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sketch.py | Sketch.element_sub_sketch | def element_sub_sketch(self, keys = None):
"""
Returns the sketch summary for the given set of keys. This is only
applicable for sketch summary created from SArray of sarray or dict type.
For dict SArray, the keys are the keys in dict value.
For array Sarray, the keys are indexes... | python | def element_sub_sketch(self, keys = None):
"""
Returns the sketch summary for the given set of keys. This is only
applicable for sketch summary created from SArray of sarray or dict type.
For dict SArray, the keys are the keys in dict value.
For array Sarray, the keys are indexes... | [
"def",
"element_sub_sketch",
"(",
"self",
",",
"keys",
"=",
"None",
")",
":",
"single_val",
"=",
"False",
"if",
"keys",
"is",
"None",
":",
"keys",
"=",
"[",
"]",
"else",
":",
"if",
"not",
"isinstance",
"(",
"keys",
",",
"list",
")",
":",
"single_val"... | Returns the sketch summary for the given set of keys. This is only
applicable for sketch summary created from SArray of sarray or dict type.
For dict SArray, the keys are the keys in dict value.
For array Sarray, the keys are indexes into the array value.
The keys must be passed into or... | [
"Returns",
"the",
"sketch",
"summary",
"for",
"the",
"given",
"set",
"of",
"keys",
".",
"This",
"is",
"only",
"applicable",
"for",
"sketch",
"summary",
"created",
"from",
"SArray",
"of",
"sarray",
"or",
"dict",
"type",
".",
"For",
"dict",
"SArray",
"the",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sketch.py#L662-L740 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_NuSVC.py | convert | def convert(model, feature_names, target):
"""Convert a Nu-Support Vector Classification (NuSVC) model to the protobuf spec.
Parameters
----------
model: NuSVC
A trained NuSVC encoder model.
feature_names: [str], optional (default=None)
Name of the input columns.
target: str, o... | python | def convert(model, feature_names, target):
"""Convert a Nu-Support Vector Classification (NuSVC) model to the protobuf spec.
Parameters
----------
model: NuSVC
A trained NuSVC encoder model.
feature_names: [str], optional (default=None)
Name of the input columns.
target: str, o... | [
"def",
"convert",
"(",
"model",
",",
"feature_names",
",",
"target",
")",
":",
"if",
"not",
"(",
"_HAS_SKLEARN",
")",
":",
"raise",
"RuntimeError",
"(",
"'scikit-learn not found. scikit-learn conversion API is disabled.'",
")",
"_sklearn_util",
".",
"check_expected_type... | Convert a Nu-Support Vector Classification (NuSVC) model to the protobuf spec.
Parameters
----------
model: NuSVC
A trained NuSVC encoder model.
feature_names: [str], optional (default=None)
Name of the input columns.
target: str, optional (default=None)
Name of the output ... | [
"Convert",
"a",
"Nu",
"-",
"Support",
"Vector",
"Classification",
"(",
"NuSVC",
")",
"model",
"to",
"the",
"protobuf",
"spec",
".",
"Parameters",
"----------",
"model",
":",
"NuSVC",
"A",
"trained",
"NuSVC",
"encoder",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_NuSVC.py#L18-L41 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_linear_regression.py | convert | def convert(model, features, target):
"""Convert a linear regression model to the protobuf spec.
Parameters
----------
model: LinearRegression
A trained linear regression encoder model.
feature_names: [str]
Name of the input columns.
target: str
Name of the output colu... | python | def convert(model, features, target):
"""Convert a linear regression model to the protobuf spec.
Parameters
----------
model: LinearRegression
A trained linear regression encoder model.
feature_names: [str]
Name of the input columns.
target: str
Name of the output colu... | [
"def",
"convert",
"(",
"model",
",",
"features",
",",
"target",
")",
":",
"if",
"not",
"(",
"_HAS_SKLEARN",
")",
":",
"raise",
"RuntimeError",
"(",
"'scikit-learn not found. scikit-learn conversion API is disabled.'",
")",
"# Check the scikit learn model",
"_sklearn_util"... | Convert a linear regression model to the protobuf spec.
Parameters
----------
model: LinearRegression
A trained linear regression encoder model.
feature_names: [str]
Name of the input columns.
target: str
Name of the output column.
Returns
-------
model_spec: A... | [
"Convert",
"a",
"linear",
"regression",
"model",
"to",
"the",
"protobuf",
"spec",
".",
"Parameters",
"----------",
"model",
":",
"LinearRegression",
"A",
"trained",
"linear",
"regression",
"encoder",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_linear_regression.py#L23-L49 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | _get_global_dbapi_info | def _get_global_dbapi_info(dbapi_module, conn):
"""
Fetches all needed information from the top-level DBAPI module,
guessing at the module if it wasn't passed as a parameter. Returns a
dictionary of all the needed variables. This is put in one place to
make sure the error message is clear if the mod... | python | def _get_global_dbapi_info(dbapi_module, conn):
"""
Fetches all needed information from the top-level DBAPI module,
guessing at the module if it wasn't passed as a parameter. Returns a
dictionary of all the needed variables. This is put in one place to
make sure the error message is clear if the mod... | [
"def",
"_get_global_dbapi_info",
"(",
"dbapi_module",
",",
"conn",
")",
":",
"module_given_msg",
"=",
"\"The DBAPI2 module given ({0}) is missing the global\\n\"",
"+",
"\"variable '{1}'. Please make sure you are supplying a module that\\n\"",
"+",
"\"conforms to the DBAPI 2.0 standard (... | Fetches all needed information from the top-level DBAPI module,
guessing at the module if it wasn't passed as a parameter. Returns a
dictionary of all the needed variables. This is put in one place to
make sure the error message is clear if the module "guess" is wrong. | [
"Fetches",
"all",
"needed",
"information",
"from",
"the",
"top",
"-",
"level",
"DBAPI",
"module",
"guessing",
"at",
"the",
"module",
"if",
"it",
"wasn",
"t",
"passed",
"as",
"a",
"parameter",
".",
"Returns",
"a",
"dictionary",
"of",
"all",
"the",
"needed",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L86-L144 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame._read_csv_impl | def _read_csv_impl(cls,
url,
delimiter=',',
header=True,
error_bad_lines=False,
comment_char='',
escape_char='\\',
double_quote=True,
qu... | python | def _read_csv_impl(cls,
url,
delimiter=',',
header=True,
error_bad_lines=False,
comment_char='',
escape_char='\\',
double_quote=True,
qu... | [
"def",
"_read_csv_impl",
"(",
"cls",
",",
"url",
",",
"delimiter",
"=",
"','",
",",
"header",
"=",
"True",
",",
"error_bad_lines",
"=",
"False",
",",
"comment_char",
"=",
"''",
",",
"escape_char",
"=",
"'\\\\'",
",",
"double_quote",
"=",
"True",
",",
"qu... | Constructs an SFrame from a CSV file or a path to multiple CSVs, and
returns a pair containing the SFrame and optionally
(if store_errors=True) a dict of filenames to SArrays
indicating for each file, what are the incorrectly parsed lines
encountered.
Parameters
--------... | [
"Constructs",
"an",
"SFrame",
"from",
"a",
"CSV",
"file",
"or",
"a",
"path",
"to",
"multiple",
"CSVs",
"and",
"returns",
"a",
"pair",
"containing",
"the",
"SFrame",
"and",
"optionally",
"(",
"if",
"store_errors",
"=",
"True",
")",
"a",
"dict",
"of",
"fil... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L866-L1063 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame.read_csv_with_errors | def read_csv_with_errors(cls,
url,
delimiter=',',
header=True,
comment_char='',
escape_char='\\',
double_quote=True,
... | python | def read_csv_with_errors(cls,
url,
delimiter=',',
header=True,
comment_char='',
escape_char='\\',
double_quote=True,
... | [
"def",
"read_csv_with_errors",
"(",
"cls",
",",
"url",
",",
"delimiter",
"=",
"','",
",",
"header",
"=",
"True",
",",
"comment_char",
"=",
"''",
",",
"escape_char",
"=",
"'\\\\'",
",",
"double_quote",
"=",
"True",
",",
"quote_char",
"=",
"'\\\"'",
",",
"... | Constructs an SFrame from a CSV file or a path to multiple CSVs, and
returns a pair containing the SFrame and a dict of filenames to SArrays
indicating for each file, what are the incorrectly parsed lines
encountered.
Parameters
----------
url : string
Locati... | [
"Constructs",
"an",
"SFrame",
"from",
"a",
"CSV",
"file",
"or",
"a",
"path",
"to",
"multiple",
"CSVs",
"and",
"returns",
"a",
"pair",
"containing",
"the",
"SFrame",
"and",
"a",
"dict",
"of",
"filenames",
"to",
"SArrays",
"indicating",
"for",
"each",
"file"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L1066-L1228 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame.read_json | def read_json(cls,
url,
orient='records'):
"""
Reads a JSON file representing a table into an SFrame.
Parameters
----------
url : string
Location of the CSV file or directory to load. If URL is a directory
or a "glob" p... | python | def read_json(cls,
url,
orient='records'):
"""
Reads a JSON file representing a table into an SFrame.
Parameters
----------
url : string
Location of the CSV file or directory to load. If URL is a directory
or a "glob" p... | [
"def",
"read_json",
"(",
"cls",
",",
"url",
",",
"orient",
"=",
"'records'",
")",
":",
"if",
"orient",
"==",
"\"records\"",
":",
"g",
"=",
"SArray",
".",
"read_json",
"(",
"url",
")",
"if",
"len",
"(",
"g",
")",
"==",
"0",
":",
"return",
"SFrame",
... | Reads a JSON file representing a table into an SFrame.
Parameters
----------
url : string
Location of the CSV file or directory to load. If URL is a directory
or a "glob" pattern, all matching files will be loaded.
orient : string, optional. Either "records" or ... | [
"Reads",
"a",
"JSON",
"file",
"representing",
"a",
"table",
"into",
"an",
"SFrame",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L1516-L1619 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame.from_sql | def from_sql(cls, conn, sql_statement, params=None, type_inference_rows=100,
dbapi_module=None, column_type_hints=None, cursor_arraysize=128):
"""
Convert the result of a SQL database query to an SFrame.
Parameters
----------
conn : dbapi2.Connection
A DBAPI2 c... | python | def from_sql(cls, conn, sql_statement, params=None, type_inference_rows=100,
dbapi_module=None, column_type_hints=None, cursor_arraysize=128):
"""
Convert the result of a SQL database query to an SFrame.
Parameters
----------
conn : dbapi2.Connection
A DBAPI2 c... | [
"def",
"from_sql",
"(",
"cls",
",",
"conn",
",",
"sql_statement",
",",
"params",
"=",
"None",
",",
"type_inference_rows",
"=",
"100",
",",
"dbapi_module",
"=",
"None",
",",
"column_type_hints",
"=",
"None",
",",
"cursor_arraysize",
"=",
"128",
")",
":",
"#... | Convert the result of a SQL database query to an SFrame.
Parameters
----------
conn : dbapi2.Connection
A DBAPI2 connection object. Any connection object originating from
the 'connect' method of a DBAPI2-compliant package can be used.
sql_statement : str
T... | [
"Convert",
"the",
"result",
"of",
"a",
"SQL",
"database",
"query",
"to",
"an",
"SFrame",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L1623-L1843 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame.to_sql | def to_sql(self, conn, table_name, dbapi_module=None,
use_python_type_specifiers=False, use_exact_column_names=True):
"""
Convert an SFrame to a single table in a SQL database.
This function does not attempt to create the table or check if a table
named `table_name` exists i... | python | def to_sql(self, conn, table_name, dbapi_module=None,
use_python_type_specifiers=False, use_exact_column_names=True):
"""
Convert an SFrame to a single table in a SQL database.
This function does not attempt to create the table or check if a table
named `table_name` exists i... | [
"def",
"to_sql",
"(",
"self",
",",
"conn",
",",
"table_name",
",",
"dbapi_module",
"=",
"None",
",",
"use_python_type_specifiers",
"=",
"False",
",",
"use_exact_column_names",
"=",
"True",
")",
":",
"mod_info",
"=",
"_get_global_dbapi_info",
"(",
"dbapi_module",
... | Convert an SFrame to a single table in a SQL database.
This function does not attempt to create the table or check if a table
named `table_name` exists in the database. It simply assumes that
`table_name` exists in the database and appends to it.
`to_sql` can be thought of as a conveni... | [
"Convert",
"an",
"SFrame",
"to",
"a",
"single",
"table",
"in",
"a",
"SQL",
"database",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L1845-L1942 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame.print_rows | def print_rows(self, num_rows=10, num_columns=40, max_column_width=30,
max_row_width=80, output_file=None):
"""
Print the first M rows and N columns of the SFrame in human readable
format.
Parameters
----------
num_rows : int, optional
Numb... | python | def print_rows(self, num_rows=10, num_columns=40, max_column_width=30,
max_row_width=80, output_file=None):
"""
Print the first M rows and N columns of the SFrame in human readable
format.
Parameters
----------
num_rows : int, optional
Numb... | [
"def",
"print_rows",
"(",
"self",
",",
"num_rows",
"=",
"10",
",",
"num_columns",
"=",
"40",
",",
"max_column_width",
"=",
"30",
",",
"max_row_width",
"=",
"80",
",",
"output_file",
"=",
"None",
")",
":",
"if",
"output_file",
"is",
"None",
":",
"output_f... | Print the first M rows and N columns of the SFrame in human readable
format.
Parameters
----------
num_rows : int, optional
Number of rows to print.
num_columns : int, optional
Number of columns to print.
max_column_width : int, optional
... | [
"Print",
"the",
"first",
"M",
"rows",
"and",
"N",
"columns",
"of",
"the",
"SFrame",
"in",
"human",
"readable",
"format",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L2117-L2160 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame._row_selector | def _row_selector(self, other):
"""
Where other is an SArray of identical length as the current Frame,
this returns a selection of a subset of rows in the current SFrame
where the corresponding row in the selector is non-zero.
"""
if type(other) is SArray:
if ... | python | def _row_selector(self, other):
"""
Where other is an SArray of identical length as the current Frame,
this returns a selection of a subset of rows in the current SFrame
where the corresponding row in the selector is non-zero.
"""
if type(other) is SArray:
if ... | [
"def",
"_row_selector",
"(",
"self",
",",
"other",
")",
":",
"if",
"type",
"(",
"other",
")",
"is",
"SArray",
":",
"if",
"self",
".",
"__has_size__",
"(",
")",
"and",
"other",
".",
"__has_size__",
"(",
")",
"and",
"len",
"(",
"other",
")",
"!=",
"l... | Where other is an SArray of identical length as the current Frame,
this returns a selection of a subset of rows in the current SFrame
where the corresponding row in the selector is non-zero. | [
"Where",
"other",
"is",
"an",
"SArray",
"of",
"identical",
"length",
"as",
"the",
"current",
"Frame",
"this",
"returns",
"a",
"selection",
"of",
"a",
"subset",
"of",
"rows",
"in",
"the",
"current",
"SFrame",
"where",
"the",
"corresponding",
"row",
"in",
"t... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L2268-L2278 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame.to_dataframe | def to_dataframe(self):
"""
Convert this SFrame to pandas.DataFrame.
This operation will construct a pandas.DataFrame in memory. Care must
be taken when size of the returned object is big.
Returns
-------
out : pandas.DataFrame
The dataframe which co... | python | def to_dataframe(self):
"""
Convert this SFrame to pandas.DataFrame.
This operation will construct a pandas.DataFrame in memory. Care must
be taken when size of the returned object is big.
Returns
-------
out : pandas.DataFrame
The dataframe which co... | [
"def",
"to_dataframe",
"(",
"self",
")",
":",
"assert",
"HAS_PANDAS",
",",
"'pandas is not installed.'",
"df",
"=",
"pandas",
".",
"DataFrame",
"(",
")",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"num_columns",
"(",
")",
")",
":",
"column_name",
"=",
... | Convert this SFrame to pandas.DataFrame.
This operation will construct a pandas.DataFrame in memory. Care must
be taken when size of the returned object is big.
Returns
-------
out : pandas.DataFrame
The dataframe which contains all rows of SFrame | [
"Convert",
"this",
"SFrame",
"to",
"pandas",
".",
"DataFrame",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L2376-L2395 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame.to_numpy | def to_numpy(self):
"""
Converts this SFrame to a numpy array
This operation will construct a numpy array in memory. Care must
be taken when size of the returned object is big.
Returns
-------
out : numpy.ndarray
A Numpy Array containing all the valu... | python | def to_numpy(self):
"""
Converts this SFrame to a numpy array
This operation will construct a numpy array in memory. Care must
be taken when size of the returned object is big.
Returns
-------
out : numpy.ndarray
A Numpy Array containing all the valu... | [
"def",
"to_numpy",
"(",
"self",
")",
":",
"assert",
"HAS_NUMPY",
",",
"'numpy is not installed.'",
"import",
"numpy",
"return",
"numpy",
".",
"transpose",
"(",
"numpy",
".",
"asarray",
"(",
"[",
"self",
"[",
"x",
"]",
"for",
"x",
"in",
"self",
".",
"colu... | Converts this SFrame to a numpy array
This operation will construct a numpy array in memory. Care must
be taken when size of the returned object is big.
Returns
-------
out : numpy.ndarray
A Numpy Array containing all the values of the SFrame | [
"Converts",
"this",
"SFrame",
"to",
"a",
"numpy",
"array"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L2397-L2412 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame.apply | def apply(self, fn, dtype=None, seed=None):
"""
Transform each row to an :class:`~turicreate.SArray` according to a
specified function. Returns a new SArray of ``dtype`` where each element
in this SArray is transformed by `fn(x)` where `x` is a single row in
the sframe represente... | python | def apply(self, fn, dtype=None, seed=None):
"""
Transform each row to an :class:`~turicreate.SArray` according to a
specified function. Returns a new SArray of ``dtype`` where each element
in this SArray is transformed by `fn(x)` where `x` is a single row in
the sframe represente... | [
"def",
"apply",
"(",
"self",
",",
"fn",
",",
"dtype",
"=",
"None",
",",
"seed",
"=",
"None",
")",
":",
"assert",
"callable",
"(",
"fn",
")",
",",
"\"Input must be callable\"",
"test_sf",
"=",
"self",
"[",
":",
"10",
"]",
"dryrun",
"=",
"[",
"fn",
"... | Transform each row to an :class:`~turicreate.SArray` according to a
specified function. Returns a new SArray of ``dtype`` where each element
in this SArray is transformed by `fn(x)` where `x` is a single row in
the sframe represented as a dictionary. The ``fn`` should return
exactly one... | [
"Transform",
"each",
"row",
"to",
"an",
":",
"class",
":",
"~turicreate",
".",
"SArray",
"according",
"to",
"a",
"specified",
"function",
".",
"Returns",
"a",
"new",
"SArray",
"of",
"dtype",
"where",
"each",
"element",
"in",
"this",
"SArray",
"is",
"transf... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L2434-L2500 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame.flat_map | def flat_map(self, column_names, fn, column_types='auto', seed=None):
"""
Map each row of the SFrame to multiple rows in a new SFrame via a
function.
The output of `fn` must have type List[List[...]]. Each inner list
will be a single row in the new output, and the collection of... | python | def flat_map(self, column_names, fn, column_types='auto', seed=None):
"""
Map each row of the SFrame to multiple rows in a new SFrame via a
function.
The output of `fn` must have type List[List[...]]. Each inner list
will be a single row in the new output, and the collection of... | [
"def",
"flat_map",
"(",
"self",
",",
"column_names",
",",
"fn",
",",
"column_types",
"=",
"'auto'",
",",
"seed",
"=",
"None",
")",
":",
"assert",
"callable",
"(",
"fn",
")",
",",
"\"Input must be callable\"",
"if",
"seed",
"is",
"None",
":",
"seed",
"=",... | Map each row of the SFrame to multiple rows in a new SFrame via a
function.
The output of `fn` must have type List[List[...]]. Each inner list
will be a single row in the new output, and the collection of these
rows within the outer list make up the data for the output SFrame.
... | [
"Map",
"each",
"row",
"of",
"the",
"SFrame",
"to",
"multiple",
"rows",
"in",
"a",
"new",
"SFrame",
"via",
"a",
"function",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L2502-L2599 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame.sample | def sample(self, fraction, seed=None, exact=False):
"""
Sample a fraction of the current SFrame's rows.
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... | python | def sample(self, fraction, seed=None, exact=False):
"""
Sample a fraction of the current SFrame's rows.
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... | [
"def",
"sample",
"(",
"self",
",",
"fraction",
",",
"seed",
"=",
"None",
",",
"exact",
"=",
"False",
")",
":",
"if",
"seed",
"is",
"None",
":",
"seed",
"=",
"abs",
"(",
"hash",
"(",
"\"%0.20f\"",
"%",
"time",
".",
"time",
"(",
")",
")",
")",
"%... | Sample a fraction of the current SFrame's rows.
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 number of rows.
... | [
"Sample",
"a",
"fraction",
"of",
"the",
"current",
"SFrame",
"s",
"rows",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L2601-L2648 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame.random_split | def random_split(self, fraction, seed=None, exact=False):
"""
Randomly split the rows of an SFrame into two SFrames. The first SFrame
contains *M* rows, sampled uniformly (without replacement) from the
original SFrame. *M* is approximately the fraction times the original
number o... | python | def random_split(self, fraction, seed=None, exact=False):
"""
Randomly split the rows of an SFrame into two SFrames. The first SFrame
contains *M* rows, sampled uniformly (without replacement) from the
original SFrame. *M* is approximately the fraction times the original
number o... | [
"def",
"random_split",
"(",
"self",
",",
"fraction",
",",
"seed",
"=",
"None",
",",
"exact",
"=",
"False",
")",
":",
"if",
"(",
"fraction",
">",
"1",
"or",
"fraction",
"<",
"0",
")",
":",
"raise",
"ValueError",
"(",
"'Invalid sampling rate: '",
"+",
"s... | Randomly split the rows of an SFrame into two SFrames. The first SFrame
contains *M* rows, sampled uniformly (without replacement) from the
original SFrame. *M* is approximately the fraction times the original
number of rows. The second SFrame contains the remaining rows of the
original ... | [
"Randomly",
"split",
"the",
"rows",
"of",
"an",
"SFrame",
"into",
"two",
"SFrames",
".",
"The",
"first",
"SFrame",
"contains",
"*",
"M",
"*",
"rows",
"sampled",
"uniformly",
"(",
"without",
"replacement",
")",
"from",
"the",
"original",
"SFrame",
".",
"*",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L2650-L2708 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame.topk | def topk(self, column_name, k=10, reverse=False):
"""
Get top k rows according to the given column. Result is according to and
sorted by `column_name` in the given order (default is descending).
When `k` is small, `topk` is more efficient than `sort`.
Parameters
--------... | python | def topk(self, column_name, k=10, reverse=False):
"""
Get top k rows according to the given column. Result is according to and
sorted by `column_name` in the given order (default is descending).
When `k` is small, `topk` is more efficient than `sort`.
Parameters
--------... | [
"def",
"topk",
"(",
"self",
",",
"column_name",
",",
"k",
"=",
"10",
",",
"reverse",
"=",
"False",
")",
":",
"if",
"type",
"(",
"column_name",
")",
"is",
"not",
"str",
":",
"raise",
"TypeError",
"(",
"\"column_name must be a string\"",
")",
"sf",
"=",
... | Get top k rows according to the given column. Result is according to and
sorted by `column_name` in the given order (default is descending).
When `k` is small, `topk` is more efficient than `sort`.
Parameters
----------
column_name : string
The column to sort on
... | [
"Get",
"top",
"k",
"rows",
"according",
"to",
"the",
"given",
"column",
".",
"Result",
"is",
"according",
"to",
"and",
"sorted",
"by",
"column_name",
"in",
"the",
"given",
"order",
"(",
"default",
"is",
"descending",
")",
".",
"When",
"k",
"is",
"small",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L2710-L2766 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame.save | def save(self, filename, format=None):
"""
Save the SFrame to a file system for later use.
Parameters
----------
filename : string
The location to save the SFrame. Either a local directory or a
remote URL. If the format is 'binary', a directory will be cr... | python | def save(self, filename, format=None):
"""
Save the SFrame to a file system for later use.
Parameters
----------
filename : string
The location to save the SFrame. Either a local directory or a
remote URL. If the format is 'binary', a directory will be cr... | [
"def",
"save",
"(",
"self",
",",
"filename",
",",
"format",
"=",
"None",
")",
":",
"if",
"format",
"is",
"None",
":",
"if",
"filename",
".",
"endswith",
"(",
"(",
"'.csv'",
",",
"'.csv.gz'",
")",
")",
":",
"format",
"=",
"'csv'",
"elif",
"filename",
... | Save the SFrame to a file system for later use.
Parameters
----------
filename : string
The location to save the SFrame. Either a local directory or a
remote URL. If the format is 'binary', a directory will be created
at the location which will contain the sf... | [
"Save",
"the",
"SFrame",
"to",
"a",
"file",
"system",
"for",
"later",
"use",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L2768-L2826 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame.export_csv | def export_csv(self, filename, delimiter=',', line_terminator='\n',
header=True, quote_level=csv.QUOTE_NONNUMERIC, double_quote=True,
escape_char='\\', quote_char='\"', na_rep='',
file_header='', file_footer='', line_prefix='',
_no_prefix_on_first_value=False, **kwargs):
... | python | def export_csv(self, filename, delimiter=',', line_terminator='\n',
header=True, quote_level=csv.QUOTE_NONNUMERIC, double_quote=True,
escape_char='\\', quote_char='\"', na_rep='',
file_header='', file_footer='', line_prefix='',
_no_prefix_on_first_value=False, **kwargs):
... | [
"def",
"export_csv",
"(",
"self",
",",
"filename",
",",
"delimiter",
"=",
"','",
",",
"line_terminator",
"=",
"'\\n'",
",",
"header",
"=",
"True",
",",
"quote_level",
"=",
"csv",
".",
"QUOTE_NONNUMERIC",
",",
"double_quote",
"=",
"True",
",",
"escape_char",
... | Writes an SFrame to a CSV file.
Parameters
----------
filename : string
The location to save the CSV.
delimiter : string, optional
This describes the delimiter used for writing csv files.
line_terminator: string, optional
The newline charact... | [
"Writes",
"an",
"SFrame",
"to",
"a",
"CSV",
"file",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L2828-L2917 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame.export_json | def export_json(self,
filename,
orient='records'):
"""
Writes an SFrame to a JSON file.
Parameters
----------
filename : string
The location to save the JSON file.
orient : string, optional. Either "records" or "lines"... | python | def export_json(self,
filename,
orient='records'):
"""
Writes an SFrame to a JSON file.
Parameters
----------
filename : string
The location to save the JSON file.
orient : string, optional. Either "records" or "lines"... | [
"def",
"export_json",
"(",
"self",
",",
"filename",
",",
"orient",
"=",
"'records'",
")",
":",
"if",
"orient",
"==",
"\"records\"",
":",
"self",
".",
"pack_columns",
"(",
"dtype",
"=",
"dict",
")",
".",
"export_csv",
"(",
"filename",
",",
"file_header",
... | Writes an SFrame to a JSON file.
Parameters
----------
filename : string
The location to save the JSON file.
orient : string, optional. Either "records" or "lines"
If orient="records" the file is saved as a single JSON array.
If orient="lines", the f... | [
"Writes",
"an",
"SFrame",
"to",
"a",
"JSON",
"file",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L2919-L2996 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame._save_reference | def _save_reference(self, filename):
"""
Performs an incomplete save of an existing SFrame into a directory.
This saved SFrame may reference SFrames in other locations in the same
filesystem for certain resources.
Parameters
----------
filename : string
... | python | def _save_reference(self, filename):
"""
Performs an incomplete save of an existing SFrame into a directory.
This saved SFrame may reference SFrames in other locations in the same
filesystem for certain resources.
Parameters
----------
filename : string
... | [
"def",
"_save_reference",
"(",
"self",
",",
"filename",
")",
":",
"## Save the SFrame",
"url",
"=",
"_make_internal_url",
"(",
"filename",
")",
"with",
"cython_context",
"(",
")",
":",
"self",
".",
"__proxy__",
".",
"save_reference",
"(",
"url",
")"
] | Performs an incomplete save of an existing SFrame into a directory.
This saved SFrame may reference SFrames in other locations in the same
filesystem for certain resources.
Parameters
----------
filename : string
The location to save the SFrame. Either a local direct... | [
"Performs",
"an",
"incomplete",
"save",
"of",
"an",
"existing",
"SFrame",
"into",
"a",
"directory",
".",
"This",
"saved",
"SFrame",
"may",
"reference",
"SFrames",
"in",
"other",
"locations",
"in",
"the",
"same",
"filesystem",
"for",
"certain",
"resources",
"."... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L2998-L3023 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame.select_column | def select_column(self, column_name):
"""
Get a reference to the :class:`~turicreate.SArray` that corresponds with
the given column_name. Throws an exception if the column_name is
something other than a string or if the column name is not found.
Parameters
----------
... | python | def select_column(self, column_name):
"""
Get a reference to the :class:`~turicreate.SArray` that corresponds with
the given column_name. Throws an exception if the column_name is
something other than a string or if the column name is not found.
Parameters
----------
... | [
"def",
"select_column",
"(",
"self",
",",
"column_name",
")",
":",
"if",
"not",
"isinstance",
"(",
"column_name",
",",
"str",
")",
":",
"raise",
"TypeError",
"(",
"\"Invalid column_nametype: must be str\"",
")",
"with",
"cython_context",
"(",
")",
":",
"return",... | Get a reference to the :class:`~turicreate.SArray` that corresponds with
the given column_name. Throws an exception if the column_name is
something other than a string or if the column name is not found.
Parameters
----------
column_name: str
The column name.
... | [
"Get",
"a",
"reference",
"to",
"the",
":",
"class",
":",
"~turicreate",
".",
"SArray",
"that",
"corresponds",
"with",
"the",
"given",
"column_name",
".",
"Throws",
"an",
"exception",
"if",
"the",
"column_name",
"is",
"something",
"other",
"than",
"a",
"strin... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L3026-L3060 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame.select_columns | def select_columns(self, column_names):
"""
Selects all columns where the name of the column or the type of column
is included in the column_names. An exception is raised if duplicate columns
are selected i.e. sf.select_columns(['a','a']), or non-existent columns
are selected.
... | python | def select_columns(self, column_names):
"""
Selects all columns where the name of the column or the type of column
is included in the column_names. An exception is raised if duplicate columns
are selected i.e. sf.select_columns(['a','a']), or non-existent columns
are selected.
... | [
"def",
"select_columns",
"(",
"self",
",",
"column_names",
")",
":",
"if",
"not",
"_is_non_string_iterable",
"(",
"column_names",
")",
":",
"raise",
"TypeError",
"(",
"\"column_names must be an iterable\"",
")",
"if",
"not",
"(",
"all",
"(",
"[",
"isinstance",
"... | Selects all columns where the name of the column or the type of column
is included in the column_names. An exception is raised if duplicate columns
are selected i.e. sf.select_columns(['a','a']), or non-existent columns
are selected.
Throws an exception for all other input types.
... | [
"Selects",
"all",
"columns",
"where",
"the",
"name",
"of",
"the",
"column",
"or",
"the",
"type",
"of",
"column",
"is",
"included",
"in",
"the",
"column_names",
".",
"An",
"exception",
"is",
"raised",
"if",
"duplicate",
"columns",
"are",
"selected",
"i",
".... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L3062-L3137 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame.add_column | def add_column(self, data, column_name="", inplace=False):
"""
Returns an SFrame with a new column. The number of elements in the data
given must match the length of every other column of the SFrame.
If no name is given, a default name is chosen.
If inplace == False (default) th... | python | def add_column(self, data, column_name="", inplace=False):
"""
Returns an SFrame with a new column. The number of elements in the data
given must match the length of every other column of the SFrame.
If no name is given, a default name is chosen.
If inplace == False (default) th... | [
"def",
"add_column",
"(",
"self",
",",
"data",
",",
"column_name",
"=",
"\"\"",
",",
"inplace",
"=",
"False",
")",
":",
"# Check type for pandas dataframe or SArray?",
"if",
"not",
"isinstance",
"(",
"data",
",",
"SArray",
")",
":",
"if",
"isinstance",
"(",
... | Returns an SFrame with a new column. The number of elements in the data
given must match the length of every other column of the SFrame.
If no name is given, a default name is chosen.
If inplace == False (default) this operation does not modify the
current SFrame, returning a new SFrame... | [
"Returns",
"an",
"SFrame",
"with",
"a",
"new",
"column",
".",
"The",
"number",
"of",
"elements",
"in",
"the",
"data",
"given",
"must",
"match",
"the",
"length",
"of",
"every",
"other",
"column",
"of",
"the",
"SFrame",
".",
"If",
"no",
"name",
"is",
"gi... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L3139-L3212 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame.add_columns | def add_columns(self, data, column_names=None, inplace=False):
"""
Returns an SFrame with multiple columns added. The number of
elements in all columns must match the length of every other column of
the SFrame.
If inplace == False (default) this operation does not modify the
... | python | def add_columns(self, data, column_names=None, inplace=False):
"""
Returns an SFrame with multiple columns added. The number of
elements in all columns must match the length of every other column of
the SFrame.
If inplace == False (default) this operation does not modify the
... | [
"def",
"add_columns",
"(",
"self",
",",
"data",
",",
"column_names",
"=",
"None",
",",
"inplace",
"=",
"False",
")",
":",
"datalist",
"=",
"data",
"if",
"isinstance",
"(",
"data",
",",
"SFrame",
")",
":",
"other",
"=",
"data",
"datalist",
"=",
"[",
"... | Returns an SFrame with multiple columns added. The number of
elements in all columns must match the length of every other column of
the SFrame.
If inplace == False (default) this operation does not modify the
current SFrame, returning a new SFrame.
If inplace == True, this oper... | [
"Returns",
"an",
"SFrame",
"with",
"multiple",
"columns",
"added",
".",
"The",
"number",
"of",
"elements",
"in",
"all",
"columns",
"must",
"match",
"the",
"length",
"of",
"every",
"other",
"column",
"of",
"the",
"SFrame",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L3214-L3293 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame.remove_column | def remove_column(self, column_name, inplace=False):
"""
Returns an SFrame with a column removed.
If inplace == False (default) this operation does not modify the
current SFrame, returning a new SFrame.
If inplace == True, this operation modifies the current
SFrame, ret... | python | def remove_column(self, column_name, inplace=False):
"""
Returns an SFrame with a column removed.
If inplace == False (default) this operation does not modify the
current SFrame, returning a new SFrame.
If inplace == True, this operation modifies the current
SFrame, ret... | [
"def",
"remove_column",
"(",
"self",
",",
"column_name",
",",
"inplace",
"=",
"False",
")",
":",
"column_name",
"=",
"str",
"(",
"column_name",
")",
"if",
"column_name",
"not",
"in",
"self",
".",
"column_names",
"(",
")",
":",
"raise",
"KeyError",
"(",
"... | Returns an SFrame with a column removed.
If inplace == False (default) this operation does not modify the
current SFrame, returning a new SFrame.
If inplace == True, this operation modifies the current
SFrame, returning self.
Parameters
----------
column_name :... | [
"Returns",
"an",
"SFrame",
"with",
"a",
"column",
"removed",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L3295-L3347 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame.remove_columns | def remove_columns(self, column_names, inplace=False):
"""
Returns an SFrame with one or more columns removed.
If inplace == False (default) this operation does not modify the
current SFrame, returning a new SFrame.
If inplace == True, this operation modifies the current
... | python | def remove_columns(self, column_names, inplace=False):
"""
Returns an SFrame with one or more columns removed.
If inplace == False (default) this operation does not modify the
current SFrame, returning a new SFrame.
If inplace == True, this operation modifies the current
... | [
"def",
"remove_columns",
"(",
"self",
",",
"column_names",
",",
"inplace",
"=",
"False",
")",
":",
"column_names",
"=",
"list",
"(",
"column_names",
")",
"existing_columns",
"=",
"dict",
"(",
"(",
"k",
",",
"i",
")",
"for",
"i",
",",
"k",
"in",
"enumer... | Returns an SFrame with one or more columns removed.
If inplace == False (default) this operation does not modify the
current SFrame, returning a new SFrame.
If inplace == True, this operation modifies the current
SFrame, returning self.
Parameters
----------
co... | [
"Returns",
"an",
"SFrame",
"with",
"one",
"or",
"more",
"columns",
"removed",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L3349-L3406 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame.swap_columns | def swap_columns(self, column_name_1, column_name_2, inplace=False):
"""
Returns an SFrame with two column positions swapped.
If inplace == False (default) this operation does not modify the
current SFrame, returning a new SFrame.
If inplace == True, this operation modifies the... | python | def swap_columns(self, column_name_1, column_name_2, inplace=False):
"""
Returns an SFrame with two column positions swapped.
If inplace == False (default) this operation does not modify the
current SFrame, returning a new SFrame.
If inplace == True, this operation modifies the... | [
"def",
"swap_columns",
"(",
"self",
",",
"column_name_1",
",",
"column_name_2",
",",
"inplace",
"=",
"False",
")",
":",
"colnames",
"=",
"self",
".",
"column_names",
"(",
")",
"colid_1",
"=",
"colnames",
".",
"index",
"(",
"column_name_1",
")",
"colid_2",
... | Returns an SFrame with two column positions swapped.
If inplace == False (default) this operation does not modify the
current SFrame, returning a new SFrame.
If inplace == True, this operation modifies the current
SFrame, returning self.
Parameters
----------
c... | [
"Returns",
"an",
"SFrame",
"with",
"two",
"column",
"positions",
"swapped",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L3409-L3462 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame.rename | def rename(self, names, inplace=False):
"""
Returns an SFrame with columns renamed. ``names`` is expected to be a
dict specifying the old and new names. This changes the names of the
columns given as the keys and replaces them with the names given as the
values.
If inpla... | python | def rename(self, names, inplace=False):
"""
Returns an SFrame with columns renamed. ``names`` is expected to be a
dict specifying the old and new names. This changes the names of the
columns given as the keys and replaces them with the names given as the
values.
If inpla... | [
"def",
"rename",
"(",
"self",
",",
"names",
",",
"inplace",
"=",
"False",
")",
":",
"if",
"(",
"type",
"(",
"names",
")",
"is",
"not",
"dict",
")",
":",
"raise",
"TypeError",
"(",
"'names must be a dictionary: oldname -> newname'",
")",
"all_columns",
"=",
... | Returns an SFrame with columns renamed. ``names`` is expected to be a
dict specifying the old and new names. This changes the names of the
columns given as the keys and replaces them with the names given as the
values.
If inplace == False (default) this operation does not modify the
... | [
"Returns",
"an",
"SFrame",
"with",
"columns",
"renamed",
".",
"names",
"is",
"expected",
"to",
"be",
"a",
"dict",
"specifying",
"the",
"old",
"and",
"new",
"names",
".",
"This",
"changes",
"the",
"names",
"of",
"the",
"columns",
"given",
"as",
"the",
"ke... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L3464-L3525 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame.append | def append(self, other):
"""
Add the rows of an SFrame to the end of this SFrame.
Both SFrames must have the same set of columns with the same column
names and column types.
Parameters
----------
other : SFrame
Another SFrame whose rows are appended ... | python | def append(self, other):
"""
Add the rows of an SFrame to the end of this SFrame.
Both SFrames must have the same set of columns with the same column
names and column types.
Parameters
----------
other : SFrame
Another SFrame whose rows are appended ... | [
"def",
"append",
"(",
"self",
",",
"other",
")",
":",
"if",
"type",
"(",
"other",
")",
"is",
"not",
"SFrame",
":",
"raise",
"RuntimeError",
"(",
"\"SFrame append can only work with SFrame\"",
")",
"left_empty",
"=",
"len",
"(",
"self",
".",
"column_names",
"... | Add the rows of an SFrame to the end of this SFrame.
Both SFrames must have the same set of columns with the same column
names and column types.
Parameters
----------
other : SFrame
Another SFrame whose rows are appended to the current SFrame.
Returns
... | [
"Add",
"the",
"rows",
"of",
"an",
"SFrame",
"to",
"the",
"end",
"of",
"this",
"SFrame",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L3737-L3816 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame.groupby | def groupby(self, key_column_names, operations, *args):
"""
Perform a group on the key_column_names followed by aggregations on the
columns listed in operations.
The operations parameter is a dictionary that indicates which
aggregation operators to use and which columns to use t... | python | def groupby(self, key_column_names, operations, *args):
"""
Perform a group on the key_column_names followed by aggregations on the
columns listed in operations.
The operations parameter is a dictionary that indicates which
aggregation operators to use and which columns to use t... | [
"def",
"groupby",
"(",
"self",
",",
"key_column_names",
",",
"operations",
",",
"*",
"args",
")",
":",
"# some basic checking first",
"# make sure key_column_names is a list",
"if",
"isinstance",
"(",
"key_column_names",
",",
"str",
")",
":",
"key_column_names",
"=",
... | Perform a group on the key_column_names followed by aggregations on the
columns listed in operations.
The operations parameter is a dictionary that indicates which
aggregation operators to use and which columns to use them on. The
available operators are SUM, MAX, MIN, COUNT, AVG, VAR, ... | [
"Perform",
"a",
"group",
"on",
"the",
"key_column_names",
"followed",
"by",
"aggregations",
"on",
"the",
"columns",
"listed",
"in",
"operations",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L3818-L4217 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame.join | def join(self, right, on=None, how='inner'):
"""
Merge two SFrames. Merges the current (left) SFrame with the given
(right) SFrame using a SQL-style equi-join operation by columns.
Parameters
----------
right : SFrame
The SFrame to join.
on : None | ... | python | def join(self, right, on=None, how='inner'):
"""
Merge two SFrames. Merges the current (left) SFrame with the given
(right) SFrame using a SQL-style equi-join operation by columns.
Parameters
----------
right : SFrame
The SFrame to join.
on : None | ... | [
"def",
"join",
"(",
"self",
",",
"right",
",",
"on",
"=",
"None",
",",
"how",
"=",
"'inner'",
")",
":",
"available_join_types",
"=",
"[",
"'left'",
",",
"'right'",
",",
"'outer'",
",",
"'inner'",
"]",
"if",
"not",
"isinstance",
"(",
"right",
",",
"SF... | Merge two SFrames. Merges the current (left) SFrame with the given
(right) SFrame using a SQL-style equi-join operation by columns.
Parameters
----------
right : SFrame
The SFrame to join.
on : None | str | list | dict, optional
The column name(s) repres... | [
"Merge",
"two",
"SFrames",
".",
"Merges",
"the",
"current",
"(",
"left",
")",
"SFrame",
"with",
"the",
"given",
"(",
"right",
")",
"SFrame",
"using",
"a",
"SQL",
"-",
"style",
"equi",
"-",
"join",
"operation",
"by",
"columns",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L4219-L4352 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame.filter_by | def filter_by(self, values, column_name, exclude=False):
"""
Filter an SFrame by values inside an iterable object. Result is an
SFrame that only includes (or excludes) the rows that have a column
with the given ``column_name`` which holds one of the values in the
given ``values``... | python | def filter_by(self, values, column_name, exclude=False):
"""
Filter an SFrame by values inside an iterable object. Result is an
SFrame that only includes (or excludes) the rows that have a column
with the given ``column_name`` which holds one of the values in the
given ``values``... | [
"def",
"filter_by",
"(",
"self",
",",
"values",
",",
"column_name",
",",
"exclude",
"=",
"False",
")",
":",
"if",
"type",
"(",
"column_name",
")",
"is",
"not",
"str",
":",
"raise",
"TypeError",
"(",
"\"Must pass a str as column_name\"",
")",
"existing_columns"... | Filter an SFrame by values inside an iterable object. Result is an
SFrame that only includes (or excludes) the rows that have a column
with the given ``column_name`` which holds one of the values in the
given ``values`` :class:`~turicreate.SArray`. If ``values`` is not an
SArray, we atte... | [
"Filter",
"an",
"SFrame",
"by",
"values",
"inside",
"an",
"iterable",
"object",
".",
"Result",
"is",
"an",
"SFrame",
"that",
"only",
"includes",
"(",
"or",
"excludes",
")",
"the",
"rows",
"that",
"have",
"a",
"column",
"with",
"the",
"given",
"column_name"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L4354-L4449 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame.explore | def explore(self, title=None):
"""
Explore the SFrame in an interactive GUI. Opens a new app window.
Parameters
----------
title : str
The plot title to show for the resulting visualization. Defaults to None.
If the title is None, a default title will be ... | python | def explore(self, title=None):
"""
Explore the SFrame in an interactive GUI. Opens a new app window.
Parameters
----------
title : str
The plot title to show for the resulting visualization. Defaults to None.
If the title is None, a default title will be ... | [
"def",
"explore",
"(",
"self",
",",
"title",
"=",
"None",
")",
":",
"import",
"sys",
"import",
"os",
"if",
"sys",
".",
"platform",
"!=",
"'darwin'",
"and",
"sys",
".",
"platform",
"!=",
"'linux2'",
"and",
"sys",
".",
"platform",
"!=",
"'linux'",
":",
... | Explore the SFrame in an interactive GUI. Opens a new app window.
Parameters
----------
title : str
The plot title to show for the resulting visualization. Defaults to None.
If the title is None, a default title will be provided.
Returns
-------
... | [
"Explore",
"the",
"SFrame",
"in",
"an",
"interactive",
"GUI",
".",
"Opens",
"a",
"new",
"app",
"window",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L4451-L4486 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame.pack_columns | def pack_columns(self, column_names=None, column_name_prefix=None, dtype=list,
fill_na=None, remove_prefix=True, new_column_name=None):
"""
Pack columns of the current SFrame into one single column. The result
is a new SFrame with the unaffected columns from the original SFr... | python | def pack_columns(self, column_names=None, column_name_prefix=None, dtype=list,
fill_na=None, remove_prefix=True, new_column_name=None):
"""
Pack columns of the current SFrame into one single column. The result
is a new SFrame with the unaffected columns from the original SFr... | [
"def",
"pack_columns",
"(",
"self",
",",
"column_names",
"=",
"None",
",",
"column_name_prefix",
"=",
"None",
",",
"dtype",
"=",
"list",
",",
"fill_na",
"=",
"None",
",",
"remove_prefix",
"=",
"True",
",",
"new_column_name",
"=",
"None",
")",
":",
"if",
... | Pack columns of the current SFrame into one single column. The result
is a new SFrame with the unaffected columns from the original SFrame
plus the newly created column.
The list of columns that are packed is chosen through either the
``column_names`` or ``column_name_prefix`` parameter... | [
"Pack",
"columns",
"of",
"the",
"current",
"SFrame",
"into",
"one",
"single",
"column",
".",
"The",
"result",
"is",
"a",
"new",
"SFrame",
"with",
"the",
"unaffected",
"columns",
"from",
"the",
"original",
"SFrame",
"plus",
"the",
"newly",
"created",
"column"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L4541-L4777 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame.split_datetime | def split_datetime(self, column_name, column_name_prefix=None, limit=None, timezone=False):
"""
Splits a datetime column of SFrame to multiple columns, with each value in a
separate column. Returns a new SFrame with the expanded column replaced with
a list of new columns. The expanded co... | python | def split_datetime(self, column_name, column_name_prefix=None, limit=None, timezone=False):
"""
Splits a datetime column of SFrame to multiple columns, with each value in a
separate column. Returns a new SFrame with the expanded column replaced with
a list of new columns. The expanded co... | [
"def",
"split_datetime",
"(",
"self",
",",
"column_name",
",",
"column_name_prefix",
"=",
"None",
",",
"limit",
"=",
"None",
",",
"timezone",
"=",
"False",
")",
":",
"if",
"column_name",
"not",
"in",
"self",
".",
"column_names",
"(",
")",
":",
"raise",
"... | Splits a datetime column of SFrame to multiple columns, with each value in a
separate column. Returns a new SFrame with the expanded column replaced with
a list of new columns. The expanded column must be of datetime type.
For more details regarding name generation and
other, refer to :... | [
"Splits",
"a",
"datetime",
"column",
"of",
"SFrame",
"to",
"multiple",
"columns",
"with",
"each",
"value",
"in",
"a",
"separate",
"column",
".",
"Returns",
"a",
"new",
"SFrame",
"with",
"the",
"expanded",
"column",
"replaced",
"with",
"a",
"list",
"of",
"n... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L4780-L4862 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame.unpack | def unpack(self, column_name=None, column_name_prefix=None, column_types=None,
na_value=None, limit=None):
"""
Expand one column of this SFrame to multiple columns with each value in
a separate column. Returns a new SFrame with the unpacked column
replaced with a list of n... | python | def unpack(self, column_name=None, column_name_prefix=None, column_types=None,
na_value=None, limit=None):
"""
Expand one column of this SFrame to multiple columns with each value in
a separate column. Returns a new SFrame with the unpacked column
replaced with a list of n... | [
"def",
"unpack",
"(",
"self",
",",
"column_name",
"=",
"None",
",",
"column_name_prefix",
"=",
"None",
",",
"column_types",
"=",
"None",
",",
"na_value",
"=",
"None",
",",
"limit",
"=",
"None",
")",
":",
"if",
"column_name",
"is",
"None",
":",
"if",
"s... | Expand one column of this SFrame to multiple columns with each value in
a separate column. Returns a new SFrame with the unpacked column
replaced with a list of new columns. The column must be of
list/array/dict type.
For more details regarding name generation, missing value handling a... | [
"Expand",
"one",
"column",
"of",
"this",
"SFrame",
"to",
"multiple",
"columns",
"with",
"each",
"value",
"in",
"a",
"separate",
"column",
".",
"Returns",
"a",
"new",
"SFrame",
"with",
"the",
"unpacked",
"column",
"replaced",
"with",
"a",
"list",
"of",
"new... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L4864-L5039 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame.stack | def stack(self, column_name, new_column_name=None, drop_na=False, new_column_type=None):
"""
Convert a "wide" column of an SFrame to one or two "tall" columns by
stacking all values.
The stack works only for columns of dict, list, or array type. If the
column is dict type, two ... | python | def stack(self, column_name, new_column_name=None, drop_na=False, new_column_type=None):
"""
Convert a "wide" column of an SFrame to one or two "tall" columns by
stacking all values.
The stack works only for columns of dict, list, or array type. If the
column is dict type, two ... | [
"def",
"stack",
"(",
"self",
",",
"column_name",
",",
"new_column_name",
"=",
"None",
",",
"drop_na",
"=",
"False",
",",
"new_column_type",
"=",
"None",
")",
":",
"# validate column_name",
"column_name",
"=",
"str",
"(",
"column_name",
")",
"if",
"column_name"... | Convert a "wide" column of an SFrame to one or two "tall" columns 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",
"column",
"of",
"an",
"SFrame",
"to",
"one",
"or",
"two",
"tall",
"columns",
"by",
"stacking",
"all",
"values",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L5041-L5235 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame.unstack | def unstack(self, column_names, new_column_name=None):
"""
Concatenate values from one or two columns into one column, grouping by
all other columns. The resulting column could be of type list, array or
dictionary. If ``column_names`` is a numeric column, the result will be of
a... | python | def unstack(self, column_names, new_column_name=None):
"""
Concatenate values from one or two columns into one column, grouping by
all other columns. The resulting column could be of type list, array or
dictionary. If ``column_names`` is a numeric column, the result will be of
a... | [
"def",
"unstack",
"(",
"self",
",",
"column_names",
",",
"new_column_name",
"=",
"None",
")",
":",
"if",
"(",
"type",
"(",
"column_names",
")",
"!=",
"str",
"and",
"len",
"(",
"column_names",
")",
"!=",
"2",
")",
":",
"raise",
"TypeError",
"(",
"\"'col... | Concatenate values from one or two columns into one column, grouping by
all other columns. The resulting column could be of type list, array or
dictionary. If ``column_names`` is a numeric column, the result will be of
array.array type. If ``column_names`` is a non-numeric column, the new colu... | [
"Concatenate",
"values",
"from",
"one",
"or",
"two",
"columns",
"into",
"one",
"column",
"grouping",
"by",
"all",
"other",
"columns",
".",
"The",
"resulting",
"column",
"could",
"be",
"of",
"type",
"list",
"array",
"or",
"dictionary",
".",
"If",
"column_name... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L5237-L5324 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame.sort | def sort(self, key_column_names, ascending=True):
"""
Sort current SFrame by the given columns, using the given sort order.
Only columns that are type of str, int and float can be sorted.
Parameters
----------
key_column_names : str | list of str | list of (str, bool) pa... | python | def sort(self, key_column_names, ascending=True):
"""
Sort current SFrame by the given columns, using the given sort order.
Only columns that are type of str, int and float can be sorted.
Parameters
----------
key_column_names : str | list of str | list of (str, bool) pa... | [
"def",
"sort",
"(",
"self",
",",
"key_column_names",
",",
"ascending",
"=",
"True",
")",
":",
"sort_column_names",
"=",
"[",
"]",
"sort_column_orders",
"=",
"[",
"]",
"# validate key_column_names",
"if",
"(",
"type",
"(",
"key_column_names",
")",
"==",
"str",
... | Sort current SFrame by the given columns, using the given sort order.
Only columns that are type of str, int and float can be sorted.
Parameters
----------
key_column_names : str | list of str | list of (str, bool) pairs
Names of columns to be sorted. The result will be sor... | [
"Sort",
"current",
"SFrame",
"by",
"the",
"given",
"columns",
"using",
"the",
"given",
"sort",
"order",
".",
"Only",
"columns",
"that",
"are",
"type",
"of",
"str",
"int",
"and",
"float",
"can",
"be",
"sorted",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L5373-L5511 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame.dropna | def dropna(self, columns=None, how='any'):
"""
Remove missing values from an SFrame. A missing value is either ``None``
or ``NaN``. If ``how`` is 'any', a row will be removed if any of the
columns in the ``columns`` parameter contains at least one missing
value. If ``how`` is '... | python | def dropna(self, columns=None, how='any'):
"""
Remove missing values from an SFrame. A missing value is either ``None``
or ``NaN``. If ``how`` is 'any', a row will be removed if any of the
columns in the ``columns`` parameter contains at least one missing
value. If ``how`` is '... | [
"def",
"dropna",
"(",
"self",
",",
"columns",
"=",
"None",
",",
"how",
"=",
"'any'",
")",
":",
"# If the user gives me an empty list (the indicator to use all columns)",
"# NA values being dropped would not be the expected behavior. This",
"# is a NOOP, so let's not bother the server... | Remove missing values from an SFrame. A missing value is either ``None``
or ``NaN``. If ``how`` is 'any', a row will be removed if any of the
columns in the ``columns`` parameter contains at least one missing
value. If ``how`` is 'all', a row will be removed if all of the columns
in th... | [
"Remove",
"missing",
"values",
"from",
"an",
"SFrame",
".",
"A",
"missing",
"value",
"is",
"either",
"None",
"or",
"NaN",
".",
"If",
"how",
"is",
"any",
"a",
"row",
"will",
"be",
"removed",
"if",
"any",
"of",
"the",
"columns",
"in",
"the",
"columns",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L5513-L5588 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame.dropna_split | def dropna_split(self, columns=None, how='any'):
"""
Split rows with missing values from this SFrame. This function has the
same functionality as :py:func:`~turicreate.SFrame.dropna`, but returns a
tuple of two SFrames. The first item is the expected output from
:py:func:`~turic... | python | def dropna_split(self, columns=None, how='any'):
"""
Split rows with missing values from this SFrame. This function has the
same functionality as :py:func:`~turicreate.SFrame.dropna`, but returns a
tuple of two SFrames. The first item is the expected output from
:py:func:`~turic... | [
"def",
"dropna_split",
"(",
"self",
",",
"columns",
"=",
"None",
",",
"how",
"=",
"'any'",
")",
":",
"# If the user gives me an empty list (the indicator to use all columns)",
"# NA values being dropped would not be the expected behavior. This",
"# is a NOOP, so let's not bother the ... | Split rows with missing values from this SFrame. This function has the
same functionality as :py:func:`~turicreate.SFrame.dropna`, but returns a
tuple of two SFrames. The first item is the expected output from
:py:func:`~turicreate.SFrame.dropna`, and the second item contains all the
ro... | [
"Split",
"rows",
"with",
"missing",
"values",
"from",
"this",
"SFrame",
".",
"This",
"function",
"has",
"the",
"same",
"functionality",
"as",
":",
"py",
":",
"func",
":",
"~turicreate",
".",
"SFrame",
".",
"dropna",
"but",
"returns",
"a",
"tuple",
"of",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L5590-L5655 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame.fillna | def fillna(self, column_name, value):
"""
Fill all missing values with a given value in a given column. If the
``value`` is not the same type as the values in ``column_name``, this method
attempts to convert the value to the original column's type. If this
fails, an error is rais... | python | def fillna(self, column_name, value):
"""
Fill all missing values with a given value in a given column. If the
``value`` is not the same type as the values in ``column_name``, this method
attempts to convert the value to the original column's type. If this
fails, an error is rais... | [
"def",
"fillna",
"(",
"self",
",",
"column_name",
",",
"value",
")",
":",
"# Normal error checking",
"if",
"type",
"(",
"column_name",
")",
"is",
"not",
"str",
":",
"raise",
"TypeError",
"(",
"\"column_name must be a str\"",
")",
"ret",
"=",
"self",
"[",
"se... | Fill all missing values with a given value in a given column. If the
``value`` is not the same type as the values in ``column_name``, this method
attempts to convert the value to the original column's type. If this
fails, an error is raised.
Parameters
----------
column_... | [
"Fill",
"all",
"missing",
"values",
"with",
"a",
"given",
"value",
"in",
"a",
"given",
"column",
".",
"If",
"the",
"value",
"is",
"not",
"the",
"same",
"type",
"as",
"the",
"values",
"in",
"column_name",
"this",
"method",
"attempts",
"to",
"convert",
"th... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L5684-L5728 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sframe.py | SFrame.add_row_number | def add_row_number(self, column_name='id', start=0, inplace=False):
"""
Returns an SFrame with a new column that numbers each row
sequentially. By default the count starts at 0, but this can be changed
to a positive or negative number. The new column will be named with
the given... | python | def add_row_number(self, column_name='id', start=0, inplace=False):
"""
Returns an SFrame with a new column that numbers each row
sequentially. By default the count starts at 0, but this can be changed
to a positive or negative number. The new column will be named with
the given... | [
"def",
"add_row_number",
"(",
"self",
",",
"column_name",
"=",
"'id'",
",",
"start",
"=",
"0",
",",
"inplace",
"=",
"False",
")",
":",
"if",
"type",
"(",
"column_name",
")",
"is",
"not",
"str",
":",
"raise",
"TypeError",
"(",
"\"Must give column_name as st... | Returns an SFrame with a new column that numbers each row
sequentially. By default the count starts at 0, but this can be changed
to a positive or negative number. The new column will be named with
the given column name. An error will be raised if the given column
name already exists i... | [
"Returns",
"an",
"SFrame",
"with",
"a",
"new",
"column",
"that",
"numbers",
"each",
"row",
"sequentially",
".",
"By",
"default",
"the",
"count",
"starts",
"at",
"0",
"but",
"this",
"can",
"be",
"changed",
"to",
"a",
"positive",
"or",
"negative",
"number",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe.py#L5730-L5801 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py | DescriptorPool.AddSerializedFile | def AddSerializedFile(self, serialized_file_desc_proto):
"""Adds the FileDescriptorProto and its types to this pool.
Args:
serialized_file_desc_proto: A bytes string, serialization of the
FileDescriptorProto to add.
"""
# pylint: disable=g-import-not-at-top
from google.protobuf impor... | python | def AddSerializedFile(self, serialized_file_desc_proto):
"""Adds the FileDescriptorProto and its types to this pool.
Args:
serialized_file_desc_proto: A bytes string, serialization of the
FileDescriptorProto to add.
"""
# pylint: disable=g-import-not-at-top
from google.protobuf impor... | [
"def",
"AddSerializedFile",
"(",
"self",
",",
"serialized_file_desc_proto",
")",
":",
"# pylint: disable=g-import-not-at-top",
"from",
"google",
".",
"protobuf",
"import",
"descriptor_pb2",
"file_desc_proto",
"=",
"descriptor_pb2",
".",
"FileDescriptorProto",
".",
"FromStri... | Adds the FileDescriptorProto and its types to this pool.
Args:
serialized_file_desc_proto: A bytes string, serialization of the
FileDescriptorProto to add. | [
"Adds",
"the",
"FileDescriptorProto",
"and",
"its",
"types",
"to",
"this",
"pool",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py#L148-L160 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py | DescriptorPool.AddDescriptor | def AddDescriptor(self, desc):
"""Adds a Descriptor to the pool, non-recursively.
If the Descriptor contains nested messages or enums, the caller must
explicitly register them. This method also registers the FileDescriptor
associated with the message.
Args:
desc: A Descriptor.
"""
if... | python | def AddDescriptor(self, desc):
"""Adds a Descriptor to the pool, non-recursively.
If the Descriptor contains nested messages or enums, the caller must
explicitly register them. This method also registers the FileDescriptor
associated with the message.
Args:
desc: A Descriptor.
"""
if... | [
"def",
"AddDescriptor",
"(",
"self",
",",
"desc",
")",
":",
"if",
"not",
"isinstance",
"(",
"desc",
",",
"descriptor",
".",
"Descriptor",
")",
":",
"raise",
"TypeError",
"(",
"'Expected instance of descriptor.Descriptor.'",
")",
"self",
".",
"_descriptors",
"[",... | Adds a Descriptor to the pool, non-recursively.
If the Descriptor contains nested messages or enums, the caller must
explicitly register them. This method also registers the FileDescriptor
associated with the message.
Args:
desc: A Descriptor. | [
"Adds",
"a",
"Descriptor",
"to",
"the",
"pool",
"non",
"-",
"recursively",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py#L162-L176 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py | DescriptorPool.AddServiceDescriptor | def AddServiceDescriptor(self, service_desc):
"""Adds a ServiceDescriptor to the pool.
Args:
service_desc: A ServiceDescriptor.
"""
if not isinstance(service_desc, descriptor.ServiceDescriptor):
raise TypeError('Expected instance of descriptor.ServiceDescriptor.')
self._service_descri... | python | def AddServiceDescriptor(self, service_desc):
"""Adds a ServiceDescriptor to the pool.
Args:
service_desc: A ServiceDescriptor.
"""
if not isinstance(service_desc, descriptor.ServiceDescriptor):
raise TypeError('Expected instance of descriptor.ServiceDescriptor.')
self._service_descri... | [
"def",
"AddServiceDescriptor",
"(",
"self",
",",
"service_desc",
")",
":",
"if",
"not",
"isinstance",
"(",
"service_desc",
",",
"descriptor",
".",
"ServiceDescriptor",
")",
":",
"raise",
"TypeError",
"(",
"'Expected instance of descriptor.ServiceDescriptor.'",
")",
"s... | Adds a ServiceDescriptor to the pool.
Args:
service_desc: A ServiceDescriptor. | [
"Adds",
"a",
"ServiceDescriptor",
"to",
"the",
"pool",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_pool.py#L193-L203 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.