id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
29,100 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/_parameterized.py | _ParameterDecorator | def _ParameterDecorator(naming_type, testcases):
"""Implementation of the parameterization decorators.
Args:
naming_type: The naming type.
testcases: Testcase parameters.
Returns:
A function for modifying the decorated object.
"""
def _Apply(obj):
if isinstance(obj, type):
_ModifyClass... | python | def _ParameterDecorator(naming_type, testcases):
"""Implementation of the parameterization decorators.
Args:
naming_type: The naming type.
testcases: Testcase parameters.
Returns:
A function for modifying the decorated object.
"""
def _Apply(obj):
if isinstance(obj, type):
_ModifyClass... | [
"def",
"_ParameterDecorator",
"(",
"naming_type",
",",
"testcases",
")",
":",
"def",
"_Apply",
"(",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"type",
")",
":",
"_ModifyClass",
"(",
"obj",
",",
"list",
"(",
"testcases",
")",
"if",
"not",
"is... | Implementation of the parameterization decorators.
Args:
naming_type: The naming type.
testcases: Testcase parameters.
Returns:
A function for modifying the decorated object. | [
"Implementation",
"of",
"the",
"parameterization",
"decorators",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/_parameterized.py#L280-L306 |
29,101 | apple/turicreate | deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py | check_header_comment | def check_header_comment(filename):
"""Checks if the header-comment of the given file needs fixing."""
# Check input file.
name = os.path.basename( filename )
# Read content of input file.
sourcefile = open( filename, "rU" )
content = sourcefile.read()
sourcefile.close()
# Search content... | python | def check_header_comment(filename):
"""Checks if the header-comment of the given file needs fixing."""
# Check input file.
name = os.path.basename( filename )
# Read content of input file.
sourcefile = open( filename, "rU" )
content = sourcefile.read()
sourcefile.close()
# Search content... | [
"def",
"check_header_comment",
"(",
"filename",
")",
":",
"# Check input file.",
"name",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"filename",
")",
"# Read content of input file.",
"sourcefile",
"=",
"open",
"(",
"filename",
",",
"\"rU\"",
")",
"content",
"=... | Checks if the header-comment of the given file needs fixing. | [
"Checks",
"if",
"the",
"header",
"-",
"comment",
"of",
"the",
"given",
"file",
"needs",
"fixing",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py#L19-L36 |
29,102 | apple/turicreate | deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py | check_input_files_for_variadic_seq | def check_input_files_for_variadic_seq(headerDir, sourceDir):
"""Checks if files, used as input when pre-processing MPL-containers in their variadic form, need fixing."""
# Check input files in include/source-directories.
files = glob.glob( os.path.join( headerDir, "*.hpp" ) )
files += glob.glob( os.pa... | python | def check_input_files_for_variadic_seq(headerDir, sourceDir):
"""Checks if files, used as input when pre-processing MPL-containers in their variadic form, need fixing."""
# Check input files in include/source-directories.
files = glob.glob( os.path.join( headerDir, "*.hpp" ) )
files += glob.glob( os.pa... | [
"def",
"check_input_files_for_variadic_seq",
"(",
"headerDir",
",",
"sourceDir",
")",
":",
"# Check input files in include/source-directories.",
"files",
"=",
"glob",
".",
"glob",
"(",
"os",
".",
"path",
".",
"join",
"(",
"headerDir",
",",
"\"*.hpp\"",
")",
")",
"... | Checks if files, used as input when pre-processing MPL-containers in their variadic form, need fixing. | [
"Checks",
"if",
"files",
"used",
"as",
"input",
"when",
"pre",
"-",
"processing",
"MPL",
"-",
"containers",
"in",
"their",
"variadic",
"form",
"need",
"fixing",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py#L39-L48 |
29,103 | apple/turicreate | deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py | check_input_files_for_numbered_seq | def check_input_files_for_numbered_seq(sourceDir, suffix, containers):
"""Check if files, used as input when pre-processing MPL-containers in their numbered form, need fixing."""
# Check input files for each MPL-container type.
for container in containers:
files = glob.glob( os.path.join( sourceDir,... | python | def check_input_files_for_numbered_seq(sourceDir, suffix, containers):
"""Check if files, used as input when pre-processing MPL-containers in their numbered form, need fixing."""
# Check input files for each MPL-container type.
for container in containers:
files = glob.glob( os.path.join( sourceDir,... | [
"def",
"check_input_files_for_numbered_seq",
"(",
"sourceDir",
",",
"suffix",
",",
"containers",
")",
":",
"# Check input files for each MPL-container type.",
"for",
"container",
"in",
"containers",
":",
"files",
"=",
"glob",
".",
"glob",
"(",
"os",
".",
"path",
"."... | Check if files, used as input when pre-processing MPL-containers in their numbered form, need fixing. | [
"Check",
"if",
"files",
"used",
"as",
"input",
"when",
"pre",
"-",
"processing",
"MPL",
"-",
"containers",
"in",
"their",
"numbered",
"form",
"need",
"fixing",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py#L51-L59 |
29,104 | apple/turicreate | deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py | check_input_files | def check_input_files(headerDir, sourceDir, containers=['vector', 'list', 'set', 'map'],
seqType='both', verbose=False):
"""Checks if source- and header-files, used as input when pre-processing MPL-containers, need fixing."""
# Check the input files for containers in their variadic form.
... | python | def check_input_files(headerDir, sourceDir, containers=['vector', 'list', 'set', 'map'],
seqType='both', verbose=False):
"""Checks if source- and header-files, used as input when pre-processing MPL-containers, need fixing."""
# Check the input files for containers in their variadic form.
... | [
"def",
"check_input_files",
"(",
"headerDir",
",",
"sourceDir",
",",
"containers",
"=",
"[",
"'vector'",
",",
"'list'",
",",
"'set'",
",",
"'map'",
"]",
",",
"seqType",
"=",
"'both'",
",",
"verbose",
"=",
"False",
")",
":",
"# Check the input files for contain... | Checks if source- and header-files, used as input when pre-processing MPL-containers, need fixing. | [
"Checks",
"if",
"source",
"-",
"and",
"header",
"-",
"files",
"used",
"as",
"input",
"when",
"pre",
"-",
"processing",
"MPL",
"-",
"containers",
"need",
"fixing",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py#L62-L90 |
29,105 | apple/turicreate | deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py | fix_header_comment | def fix_header_comment(filename, timestamp):
"""Fixes the header-comment of the given file."""
# Fix input file.
name = os.path.basename( filename )
for line in fileinput.input( filename, inplace=1, mode="rU" ):
# If header-comment already contains anything for '$Id$', remove it.
line = ... | python | def fix_header_comment(filename, timestamp):
"""Fixes the header-comment of the given file."""
# Fix input file.
name = os.path.basename( filename )
for line in fileinput.input( filename, inplace=1, mode="rU" ):
# If header-comment already contains anything for '$Id$', remove it.
line = ... | [
"def",
"fix_header_comment",
"(",
"filename",
",",
"timestamp",
")",
":",
"# Fix input file.",
"name",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"filename",
")",
"for",
"line",
"in",
"fileinput",
".",
"input",
"(",
"filename",
",",
"inplace",
"=",
"1",... | Fixes the header-comment of the given file. | [
"Fixes",
"the",
"header",
"-",
"comment",
"of",
"the",
"given",
"file",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py#L92-L101 |
29,106 | apple/turicreate | deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py | fix_input_files_for_variadic_seq | def fix_input_files_for_variadic_seq(headerDir, sourceDir, timestamp):
"""Fixes files used as input when pre-processing MPL-containers in their variadic form."""
# Fix files in include/source-directories.
files = glob.glob( os.path.join( headerDir, "*.hpp" ) )
files += glob.glob( os.path.join( headerDi... | python | def fix_input_files_for_variadic_seq(headerDir, sourceDir, timestamp):
"""Fixes files used as input when pre-processing MPL-containers in their variadic form."""
# Fix files in include/source-directories.
files = glob.glob( os.path.join( headerDir, "*.hpp" ) )
files += glob.glob( os.path.join( headerDi... | [
"def",
"fix_input_files_for_variadic_seq",
"(",
"headerDir",
",",
"sourceDir",
",",
"timestamp",
")",
":",
"# Fix files in include/source-directories.",
"files",
"=",
"glob",
".",
"glob",
"(",
"os",
".",
"path",
".",
"join",
"(",
"headerDir",
",",
"\"*.hpp\"",
")"... | Fixes files used as input when pre-processing MPL-containers in their variadic form. | [
"Fixes",
"files",
"used",
"as",
"input",
"when",
"pre",
"-",
"processing",
"MPL",
"-",
"containers",
"in",
"their",
"variadic",
"form",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py#L104-L111 |
29,107 | apple/turicreate | deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py | fix_input_files_for_numbered_seq | def fix_input_files_for_numbered_seq(sourceDir, suffix, timestamp, containers):
"""Fixes files used as input when pre-processing MPL-containers in their numbered form."""
# Fix input files for each MPL-container type.
for container in containers:
files = glob.glob( os.path.join( sourceDir, container... | python | def fix_input_files_for_numbered_seq(sourceDir, suffix, timestamp, containers):
"""Fixes files used as input when pre-processing MPL-containers in their numbered form."""
# Fix input files for each MPL-container type.
for container in containers:
files = glob.glob( os.path.join( sourceDir, container... | [
"def",
"fix_input_files_for_numbered_seq",
"(",
"sourceDir",
",",
"suffix",
",",
"timestamp",
",",
"containers",
")",
":",
"# Fix input files for each MPL-container type.",
"for",
"container",
"in",
"containers",
":",
"files",
"=",
"glob",
".",
"glob",
"(",
"os",
".... | Fixes files used as input when pre-processing MPL-containers in their numbered form. | [
"Fixes",
"files",
"used",
"as",
"input",
"when",
"pre",
"-",
"processing",
"MPL",
"-",
"containers",
"in",
"their",
"numbered",
"form",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py#L114-L120 |
29,108 | apple/turicreate | deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py | fix_input_files | def fix_input_files(headerDir, sourceDir, containers=['vector', 'list', 'set', 'map'],
seqType='both', verbose=False):
"""Fixes source- and header-files used as input when pre-processing MPL-containers."""
# The new modification time.
timestamp = datetime.datetime.now();
# Fix the in... | python | def fix_input_files(headerDir, sourceDir, containers=['vector', 'list', 'set', 'map'],
seqType='both', verbose=False):
"""Fixes source- and header-files used as input when pre-processing MPL-containers."""
# The new modification time.
timestamp = datetime.datetime.now();
# Fix the in... | [
"def",
"fix_input_files",
"(",
"headerDir",
",",
"sourceDir",
",",
"containers",
"=",
"[",
"'vector'",
",",
"'list'",
",",
"'set'",
",",
"'map'",
"]",
",",
"seqType",
"=",
"'both'",
",",
"verbose",
"=",
"False",
")",
":",
"# The new modification time.",
"tim... | Fixes source- and header-files used as input when pre-processing MPL-containers. | [
"Fixes",
"source",
"-",
"and",
"header",
"-",
"files",
"used",
"as",
"input",
"when",
"pre",
"-",
"processing",
"MPL",
"-",
"containers",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py#L123-L138 |
29,109 | apple/turicreate | deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py | to_existing_absolute_path | def to_existing_absolute_path(string):
"""Converts a path into its absolute path and verifies that it exists or throws an exception."""
value = os.path.abspath(string)
if not os.path.exists( value ) or not os.path.isdir( value ):
msg = '"%r" is not a valid path to a directory.' % string
rais... | python | def to_existing_absolute_path(string):
"""Converts a path into its absolute path and verifies that it exists or throws an exception."""
value = os.path.abspath(string)
if not os.path.exists( value ) or not os.path.isdir( value ):
msg = '"%r" is not a valid path to a directory.' % string
rais... | [
"def",
"to_existing_absolute_path",
"(",
"string",
")",
":",
"value",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"string",
")",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"value",
")",
"or",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"... | Converts a path into its absolute path and verifies that it exists or throws an exception. | [
"Converts",
"a",
"path",
"into",
"its",
"absolute",
"path",
"and",
"verifies",
"that",
"it",
"exists",
"or",
"throws",
"an",
"exception",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/mpl/preprocessed/fix_boost_mpl_preprocess.py#L141-L147 |
29,110 | apple/turicreate | src/unity/python/turicreate/toolkits/image_similarity/image_similarity.py | ImageSimilarityModel.query | def query(self, dataset, label=None, k=5, radius=None, verbose=True, batch_size=64):
"""
For each image, retrieve the nearest neighbors from the model's stored
data. In general, the query dataset does not need to be the same as
the reference data stored in the model.
Parameters
... | python | def query(self, dataset, label=None, k=5, radius=None, verbose=True, batch_size=64):
"""
For each image, retrieve the nearest neighbors from the model's stored
data. In general, the query dataset does not need to be the same as
the reference data stored in the model.
Parameters
... | [
"def",
"query",
"(",
"self",
",",
"dataset",
",",
"label",
"=",
"None",
",",
"k",
"=",
"5",
",",
"radius",
"=",
"None",
",",
"verbose",
"=",
"True",
",",
"batch_size",
"=",
"64",
")",
":",
"if",
"not",
"isinstance",
"(",
"dataset",
",",
"(",
"_tc... | For each image, retrieve the nearest neighbors from the model's stored
data. In general, the query dataset does not need to be the same as
the reference data stored in the model.
Parameters
----------
dataset : SFrame | SArray | turicreate.Image
Query data.
... | [
"For",
"each",
"image",
"retrieve",
"the",
"nearest",
"neighbors",
"from",
"the",
"model",
"s",
"stored",
"data",
".",
"In",
"general",
"the",
"query",
"dataset",
"does",
"not",
"need",
"to",
"be",
"the",
"same",
"as",
"the",
"reference",
"data",
"stored",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/image_similarity/image_similarity.py#L295-L381 |
29,111 | apple/turicreate | src/unity/python/turicreate/toolkits/image_similarity/image_similarity.py | ImageSimilarityModel.similarity_graph | def similarity_graph(self, k=5, radius=None, include_self_edges=False,
output_type='SGraph', verbose=True):
"""
Construct the similarity graph on the reference dataset, which is
already stored in the model to find the top `k` similar images for each
image in your... | python | def similarity_graph(self, k=5, radius=None, include_self_edges=False,
output_type='SGraph', verbose=True):
"""
Construct the similarity graph on the reference dataset, which is
already stored in the model to find the top `k` similar images for each
image in your... | [
"def",
"similarity_graph",
"(",
"self",
",",
"k",
"=",
"5",
",",
"radius",
"=",
"None",
",",
"include_self_edges",
"=",
"False",
",",
"output_type",
"=",
"'SGraph'",
",",
"verbose",
"=",
"True",
")",
":",
"return",
"self",
".",
"similarity_model",
".",
"... | Construct the similarity graph on the reference dataset, which is
already stored in the model to find the top `k` similar images for each
image in your input dataset.
This is conceptually very similar to running `query` with the reference
set, but this method is optimized for the purpos... | [
"Construct",
"the",
"similarity",
"graph",
"on",
"the",
"reference",
"dataset",
"which",
"is",
"already",
"stored",
"in",
"the",
"model",
"to",
"find",
"the",
"top",
"k",
"similar",
"images",
"for",
"each",
"image",
"in",
"your",
"input",
"dataset",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/image_similarity/image_similarity.py#L383-L456 |
29,112 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | _SimpleSizer | def _SimpleSizer(compute_value_size):
"""A sizer which uses the function compute_value_size to compute the size of
each value. Typically compute_value_size is _VarintSize."""
def SpecificSizer(field_number, is_repeated, is_packed):
tag_size = _TagSize(field_number)
if is_packed:
local_VarintSize =... | python | def _SimpleSizer(compute_value_size):
"""A sizer which uses the function compute_value_size to compute the size of
each value. Typically compute_value_size is _VarintSize."""
def SpecificSizer(field_number, is_repeated, is_packed):
tag_size = _TagSize(field_number)
if is_packed:
local_VarintSize =... | [
"def",
"_SimpleSizer",
"(",
"compute_value_size",
")",
":",
"def",
"SpecificSizer",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"tag_size",
"=",
"_TagSize",
"(",
"field_number",
")",
"if",
"is_packed",
":",
"local_VarintSize",
"=",
"_Var... | A sizer which uses the function compute_value_size to compute the size of
each value. Typically compute_value_size is _VarintSize. | [
"A",
"sizer",
"which",
"uses",
"the",
"function",
"compute_value_size",
"to",
"compute",
"the",
"size",
"of",
"each",
"value",
".",
"Typically",
"compute_value_size",
"is",
"_VarintSize",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L126-L152 |
29,113 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | _FixedSizer | def _FixedSizer(value_size):
"""Like _SimpleSizer except for a fixed-size field. The input is the size
of one value."""
def SpecificSizer(field_number, is_repeated, is_packed):
tag_size = _TagSize(field_number)
if is_packed:
local_VarintSize = _VarintSize
def PackedFieldSize(value):
... | python | def _FixedSizer(value_size):
"""Like _SimpleSizer except for a fixed-size field. The input is the size
of one value."""
def SpecificSizer(field_number, is_repeated, is_packed):
tag_size = _TagSize(field_number)
if is_packed:
local_VarintSize = _VarintSize
def PackedFieldSize(value):
... | [
"def",
"_FixedSizer",
"(",
"value_size",
")",
":",
"def",
"SpecificSizer",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"tag_size",
"=",
"_TagSize",
"(",
"field_number",
")",
"if",
"is_packed",
":",
"local_VarintSize",
"=",
"_VarintSize",... | Like _SimpleSizer except for a fixed-size field. The input is the size
of one value. | [
"Like",
"_SimpleSizer",
"except",
"for",
"a",
"fixed",
"-",
"size",
"field",
".",
"The",
"input",
"is",
"the",
"size",
"of",
"one",
"value",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L184-L207 |
29,114 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | BytesSizer | def BytesSizer(field_number, is_repeated, is_packed):
"""Returns a sizer for a bytes field."""
tag_size = _TagSize(field_number)
local_VarintSize = _VarintSize
local_len = len
assert not is_packed
if is_repeated:
def RepeatedFieldSize(value):
result = tag_size * len(value)
for element in va... | python | def BytesSizer(field_number, is_repeated, is_packed):
"""Returns a sizer for a bytes field."""
tag_size = _TagSize(field_number)
local_VarintSize = _VarintSize
local_len = len
assert not is_packed
if is_repeated:
def RepeatedFieldSize(value):
result = tag_size * len(value)
for element in va... | [
"def",
"BytesSizer",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"tag_size",
"=",
"_TagSize",
"(",
"field_number",
")",
"local_VarintSize",
"=",
"_VarintSize",
"local_len",
"=",
"len",
"assert",
"not",
"is_packed",
"if",
"is_repeated",
"... | Returns a sizer for a bytes field. | [
"Returns",
"a",
"sizer",
"for",
"a",
"bytes",
"field",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L252-L271 |
29,115 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | GroupSizer | def GroupSizer(field_number, is_repeated, is_packed):
"""Returns a sizer for a group field."""
tag_size = _TagSize(field_number) * 2
assert not is_packed
if is_repeated:
def RepeatedFieldSize(value):
result = tag_size * len(value)
for element in value:
result += element.ByteSize()
... | python | def GroupSizer(field_number, is_repeated, is_packed):
"""Returns a sizer for a group field."""
tag_size = _TagSize(field_number) * 2
assert not is_packed
if is_repeated:
def RepeatedFieldSize(value):
result = tag_size * len(value)
for element in value:
result += element.ByteSize()
... | [
"def",
"GroupSizer",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"tag_size",
"=",
"_TagSize",
"(",
"field_number",
")",
"*",
"2",
"assert",
"not",
"is_packed",
"if",
"is_repeated",
":",
"def",
"RepeatedFieldSize",
"(",
"value",
")",
... | Returns a sizer for a group field. | [
"Returns",
"a",
"sizer",
"for",
"a",
"group",
"field",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L274-L289 |
29,116 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | MessageSizer | def MessageSizer(field_number, is_repeated, is_packed):
"""Returns a sizer for a message field."""
tag_size = _TagSize(field_number)
local_VarintSize = _VarintSize
assert not is_packed
if is_repeated:
def RepeatedFieldSize(value):
result = tag_size * len(value)
for element in value:
l... | python | def MessageSizer(field_number, is_repeated, is_packed):
"""Returns a sizer for a message field."""
tag_size = _TagSize(field_number)
local_VarintSize = _VarintSize
assert not is_packed
if is_repeated:
def RepeatedFieldSize(value):
result = tag_size * len(value)
for element in value:
l... | [
"def",
"MessageSizer",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"tag_size",
"=",
"_TagSize",
"(",
"field_number",
")",
"local_VarintSize",
"=",
"_VarintSize",
"assert",
"not",
"is_packed",
"if",
"is_repeated",
":",
"def",
"RepeatedField... | Returns a sizer for a message field. | [
"Returns",
"a",
"sizer",
"for",
"a",
"message",
"field",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L292-L310 |
29,117 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | MessageSetItemSizer | def MessageSetItemSizer(field_number):
"""Returns a sizer for extensions of MessageSet.
The message set message looks like this:
message MessageSet {
repeated group Item = 1 {
required int32 type_id = 2;
required string message = 3;
}
}
"""
static_size = (_TagSize(1) * 2 + _... | python | def MessageSetItemSizer(field_number):
"""Returns a sizer for extensions of MessageSet.
The message set message looks like this:
message MessageSet {
repeated group Item = 1 {
required int32 type_id = 2;
required string message = 3;
}
}
"""
static_size = (_TagSize(1) * 2 + _... | [
"def",
"MessageSetItemSizer",
"(",
"field_number",
")",
":",
"static_size",
"=",
"(",
"_TagSize",
"(",
"1",
")",
"*",
"2",
"+",
"_TagSize",
"(",
"2",
")",
"+",
"_VarintSize",
"(",
"field_number",
")",
"+",
"_TagSize",
"(",
"3",
")",
")",
"local_VarintSiz... | Returns a sizer for extensions of MessageSet.
The message set message looks like this:
message MessageSet {
repeated group Item = 1 {
required int32 type_id = 2;
required string message = 3;
}
} | [
"Returns",
"a",
"sizer",
"for",
"extensions",
"of",
"MessageSet",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L317-L336 |
29,118 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | MapSizer | def MapSizer(field_descriptor, is_message_map):
"""Returns a sizer for a map field."""
# Can't look at field_descriptor.message_type._concrete_class because it may
# not have been initialized yet.
message_type = field_descriptor.message_type
message_sizer = MessageSizer(field_descriptor.number, False, False)... | python | def MapSizer(field_descriptor, is_message_map):
"""Returns a sizer for a map field."""
# Can't look at field_descriptor.message_type._concrete_class because it may
# not have been initialized yet.
message_type = field_descriptor.message_type
message_sizer = MessageSizer(field_descriptor.number, False, False)... | [
"def",
"MapSizer",
"(",
"field_descriptor",
",",
"is_message_map",
")",
":",
"# Can't look at field_descriptor.message_type._concrete_class because it may",
"# not have been initialized yet.",
"message_type",
"=",
"field_descriptor",
".",
"message_type",
"message_sizer",
"=",
"Mess... | Returns a sizer for a map field. | [
"Returns",
"a",
"sizer",
"for",
"a",
"map",
"field",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L343-L366 |
29,119 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | _VarintBytes | def _VarintBytes(value):
"""Encode the given integer as a varint and return the bytes. This is only
called at startup time so it doesn't need to be fast."""
pieces = []
_EncodeVarint(pieces.append, value)
return b"".join(pieces) | python | def _VarintBytes(value):
"""Encode the given integer as a varint and return the bytes. This is only
called at startup time so it doesn't need to be fast."""
pieces = []
_EncodeVarint(pieces.append, value)
return b"".join(pieces) | [
"def",
"_VarintBytes",
"(",
"value",
")",
":",
"pieces",
"=",
"[",
"]",
"_EncodeVarint",
"(",
"pieces",
".",
"append",
",",
"value",
")",
"return",
"b\"\"",
".",
"join",
"(",
"pieces",
")"
] | Encode the given integer as a varint and return the bytes. This is only
called at startup time so it doesn't need to be fast. | [
"Encode",
"the",
"given",
"integer",
"as",
"a",
"varint",
"and",
"return",
"the",
"bytes",
".",
"This",
"is",
"only",
"called",
"at",
"startup",
"time",
"so",
"it",
"doesn",
"t",
"need",
"to",
"be",
"fast",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L409-L415 |
29,120 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | _SimpleEncoder | def _SimpleEncoder(wire_type, encode_value, compute_value_size):
"""Return a constructor for an encoder for fields of a particular type.
Args:
wire_type: The field's wire type, for encoding tags.
encode_value: A function which encodes an individual value, e.g.
_EncodeVarint().
compute_v... | python | def _SimpleEncoder(wire_type, encode_value, compute_value_size):
"""Return a constructor for an encoder for fields of a particular type.
Args:
wire_type: The field's wire type, for encoding tags.
encode_value: A function which encodes an individual value, e.g.
_EncodeVarint().
compute_v... | [
"def",
"_SimpleEncoder",
"(",
"wire_type",
",",
"encode_value",
",",
"compute_value_size",
")",
":",
"def",
"SpecificEncoder",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"if",
"is_packed",
":",
"tag_bytes",
"=",
"TagBytes",
"(",
"field_... | Return a constructor for an encoder for fields of a particular type.
Args:
wire_type: The field's wire type, for encoding tags.
encode_value: A function which encodes an individual value, e.g.
_EncodeVarint().
compute_value_size: A function which computes the size of an individual
... | [
"Return",
"a",
"constructor",
"for",
"an",
"encoder",
"for",
"fields",
"of",
"a",
"particular",
"type",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L428-L466 |
29,121 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | _StructPackEncoder | def _StructPackEncoder(wire_type, format):
"""Return a constructor for an encoder for a fixed-width field.
Args:
wire_type: The field's wire type, for encoding tags.
format: The format string to pass to struct.pack().
"""
value_size = struct.calcsize(format)
def SpecificEncoder(field_number, ... | python | def _StructPackEncoder(wire_type, format):
"""Return a constructor for an encoder for a fixed-width field.
Args:
wire_type: The field's wire type, for encoding tags.
format: The format string to pass to struct.pack().
"""
value_size = struct.calcsize(format)
def SpecificEncoder(field_number, ... | [
"def",
"_StructPackEncoder",
"(",
"wire_type",
",",
"format",
")",
":",
"value_size",
"=",
"struct",
".",
"calcsize",
"(",
"format",
")",
"def",
"SpecificEncoder",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"local_struct_pack",
"=",
"... | Return a constructor for an encoder for a fixed-width field.
Args:
wire_type: The field's wire type, for encoding tags.
format: The format string to pass to struct.pack(). | [
"Return",
"a",
"constructor",
"for",
"an",
"encoder",
"for",
"a",
"fixed",
"-",
"width",
"field",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L503-L538 |
29,122 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | _FloatingPointEncoder | def _FloatingPointEncoder(wire_type, format):
"""Return a constructor for an encoder for float fields.
This is like StructPackEncoder, but catches errors that may be due to
passing non-finite floating-point values to struct.pack, and makes a
second attempt to encode those values.
Args:
wire_type: The... | python | def _FloatingPointEncoder(wire_type, format):
"""Return a constructor for an encoder for float fields.
This is like StructPackEncoder, but catches errors that may be due to
passing non-finite floating-point values to struct.pack, and makes a
second attempt to encode those values.
Args:
wire_type: The... | [
"def",
"_FloatingPointEncoder",
"(",
"wire_type",
",",
"format",
")",
":",
"value_size",
"=",
"struct",
".",
"calcsize",
"(",
"format",
")",
"if",
"value_size",
"==",
"4",
":",
"def",
"EncodeNonFiniteOrRaise",
"(",
"write",
",",
"value",
")",
":",
"# Remembe... | Return a constructor for an encoder for float fields.
This is like StructPackEncoder, but catches errors that may be due to
passing non-finite floating-point values to struct.pack, and makes a
second attempt to encode those values.
Args:
wire_type: The field's wire type, for encoding tags.
format... | [
"Return",
"a",
"constructor",
"for",
"an",
"encoder",
"for",
"float",
"fields",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L541-L615 |
29,123 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | BoolEncoder | def BoolEncoder(field_number, is_repeated, is_packed):
"""Returns an encoder for a boolean field."""
false_byte = b'\x00'
true_byte = b'\x01'
if is_packed:
tag_bytes = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED)
local_EncodeVarint = _EncodeVarint
def EncodePackedField(write, value... | python | def BoolEncoder(field_number, is_repeated, is_packed):
"""Returns an encoder for a boolean field."""
false_byte = b'\x00'
true_byte = b'\x01'
if is_packed:
tag_bytes = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED)
local_EncodeVarint = _EncodeVarint
def EncodePackedField(write, value... | [
"def",
"BoolEncoder",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"false_byte",
"=",
"b'\\x00'",
"true_byte",
"=",
"b'\\x01'",
"if",
"is_packed",
":",
"tag_bytes",
"=",
"TagBytes",
"(",
"field_number",
",",
"wire_format",
".",
"WIRETYPE_... | Returns an encoder for a boolean field. | [
"Returns",
"an",
"encoder",
"for",
"a",
"boolean",
"field",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L645-L679 |
29,124 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | StringEncoder | def StringEncoder(field_number, is_repeated, is_packed):
"""Returns an encoder for a string field."""
tag = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED)
local_EncodeVarint = _EncodeVarint
local_len = len
assert not is_packed
if is_repeated:
def EncodeRepeatedField(write, value):
... | python | def StringEncoder(field_number, is_repeated, is_packed):
"""Returns an encoder for a string field."""
tag = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED)
local_EncodeVarint = _EncodeVarint
local_len = len
assert not is_packed
if is_repeated:
def EncodeRepeatedField(write, value):
... | [
"def",
"StringEncoder",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"tag",
"=",
"TagBytes",
"(",
"field_number",
",",
"wire_format",
".",
"WIRETYPE_LENGTH_DELIMITED",
")",
"local_EncodeVarint",
"=",
"_EncodeVarint",
"local_len",
"=",
"len",
... | Returns an encoder for a string field. | [
"Returns",
"an",
"encoder",
"for",
"a",
"string",
"field",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L682-L703 |
29,125 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | GroupEncoder | def GroupEncoder(field_number, is_repeated, is_packed):
"""Returns an encoder for a group field."""
start_tag = TagBytes(field_number, wire_format.WIRETYPE_START_GROUP)
end_tag = TagBytes(field_number, wire_format.WIRETYPE_END_GROUP)
assert not is_packed
if is_repeated:
def EncodeRepeatedField(write, val... | python | def GroupEncoder(field_number, is_repeated, is_packed):
"""Returns an encoder for a group field."""
start_tag = TagBytes(field_number, wire_format.WIRETYPE_START_GROUP)
end_tag = TagBytes(field_number, wire_format.WIRETYPE_END_GROUP)
assert not is_packed
if is_repeated:
def EncodeRepeatedField(write, val... | [
"def",
"GroupEncoder",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"start_tag",
"=",
"TagBytes",
"(",
"field_number",
",",
"wire_format",
".",
"WIRETYPE_START_GROUP",
")",
"end_tag",
"=",
"TagBytes",
"(",
"field_number",
",",
"wire_format"... | Returns an encoder for a group field. | [
"Returns",
"an",
"encoder",
"for",
"a",
"group",
"field",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L728-L746 |
29,126 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py | MessageEncoder | def MessageEncoder(field_number, is_repeated, is_packed):
"""Returns an encoder for a message field."""
tag = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED)
local_EncodeVarint = _EncodeVarint
assert not is_packed
if is_repeated:
def EncodeRepeatedField(write, value):
for element in v... | python | def MessageEncoder(field_number, is_repeated, is_packed):
"""Returns an encoder for a message field."""
tag = TagBytes(field_number, wire_format.WIRETYPE_LENGTH_DELIMITED)
local_EncodeVarint = _EncodeVarint
assert not is_packed
if is_repeated:
def EncodeRepeatedField(write, value):
for element in v... | [
"def",
"MessageEncoder",
"(",
"field_number",
",",
"is_repeated",
",",
"is_packed",
")",
":",
"tag",
"=",
"TagBytes",
"(",
"field_number",
",",
"wire_format",
".",
"WIRETYPE_LENGTH_DELIMITED",
")",
"local_EncodeVarint",
"=",
"_EncodeVarint",
"assert",
"not",
"is_pac... | Returns an encoder for a message field. | [
"Returns",
"an",
"encoder",
"for",
"a",
"message",
"field",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/encoder.py#L749-L767 |
29,127 | apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/caffe/_caffe_converter.py | convert | def convert(model, image_input_names=[], is_bgr=False,
red_bias=0.0, blue_bias=0.0, green_bias=0.0, gray_bias=0.0,
image_scale=1.0, class_labels=None, predicted_feature_name=None, model_precision=_MLMODEL_FULL_PRECISION):
"""
Convert a Caffe model to Core ML format.
Parameters
-... | python | def convert(model, image_input_names=[], is_bgr=False,
red_bias=0.0, blue_bias=0.0, green_bias=0.0, gray_bias=0.0,
image_scale=1.0, class_labels=None, predicted_feature_name=None, model_precision=_MLMODEL_FULL_PRECISION):
"""
Convert a Caffe model to Core ML format.
Parameters
-... | [
"def",
"convert",
"(",
"model",
",",
"image_input_names",
"=",
"[",
"]",
",",
"is_bgr",
"=",
"False",
",",
"red_bias",
"=",
"0.0",
",",
"blue_bias",
"=",
"0.0",
",",
"green_bias",
"=",
"0.0",
",",
"gray_bias",
"=",
"0.0",
",",
"image_scale",
"=",
"1.0"... | Convert a Caffe model to Core ML format.
Parameters
----------
model: str | (str, str) | (str, str, str) | (str, str, dict)
A trained Caffe neural network model which can be represented as:
- Path on disk to a trained Caffe model (.caffemodel)
- A tuple of two paths, where the fir... | [
"Convert",
"a",
"Caffe",
"model",
"to",
"Core",
"ML",
"format",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/caffe/_caffe_converter.py#L10-L197 |
29,128 | apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_svm_common.py | _set_kernel | def _set_kernel(model, spec):
"""
Takes the sklearn SVM model and returns the spec with the protobuf kernel for that model.
"""
def gamma_value(model):
if(model.gamma == 'auto'):
# auto gamma value is 1/num_features
return 1/float(len(model.support_vectors_[0]))
e... | python | def _set_kernel(model, spec):
"""
Takes the sklearn SVM model and returns the spec with the protobuf kernel for that model.
"""
def gamma_value(model):
if(model.gamma == 'auto'):
# auto gamma value is 1/num_features
return 1/float(len(model.support_vectors_[0]))
e... | [
"def",
"_set_kernel",
"(",
"model",
",",
"spec",
")",
":",
"def",
"gamma_value",
"(",
"model",
")",
":",
"if",
"(",
"model",
".",
"gamma",
"==",
"'auto'",
")",
":",
"# auto gamma value is 1/num_features",
"return",
"1",
"/",
"float",
"(",
"len",
"(",
"mo... | Takes the sklearn SVM model and returns the spec with the protobuf kernel for that model. | [
"Takes",
"the",
"sklearn",
"SVM",
"model",
"and",
"returns",
"the",
"spec",
"with",
"the",
"protobuf",
"kernel",
"for",
"that",
"model",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_svm_common.py#L11-L37 |
29,129 | apple/turicreate | src/unity/python/turicreate/data_structures/sframe_builder.py | SFrameBuilder.append | def append(self, data, segment=0):
"""
Append a single row to an SFrame.
Throws a RuntimeError if one or more column's type is incompatible with
a type appended.
Parameters
----------
data : iterable
An iterable representation of a single row.
... | python | def append(self, data, segment=0):
"""
Append a single row to an SFrame.
Throws a RuntimeError if one or more column's type is incompatible with
a type appended.
Parameters
----------
data : iterable
An iterable representation of a single row.
... | [
"def",
"append",
"(",
"self",
",",
"data",
",",
"segment",
"=",
"0",
")",
":",
"# Assume this case refers to an SFrame with a single column",
"if",
"not",
"hasattr",
"(",
"data",
",",
"'__iter__'",
")",
":",
"data",
"=",
"[",
"data",
"]",
"self",
".",
"_buil... | Append a single row to an SFrame.
Throws a RuntimeError if one or more column's type is incompatible with
a type appended.
Parameters
----------
data : iterable
An iterable representation of a single row.
segment : int
The segment to write this... | [
"Append",
"a",
"single",
"row",
"to",
"an",
"SFrame",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe_builder.py#L108-L129 |
29,130 | apple/turicreate | src/unity/python/turicreate/data_structures/sframe_builder.py | SFrameBuilder.append_multiple | def append_multiple(self, data, segment=0):
"""
Append multiple rows to an SFrame.
Throws a RuntimeError if one or more column's type is incompatible with
a type appended.
Parameters
----------
data : iterable[iterable]
A collection of multiple iter... | python | def append_multiple(self, data, segment=0):
"""
Append multiple rows to an SFrame.
Throws a RuntimeError if one or more column's type is incompatible with
a type appended.
Parameters
----------
data : iterable[iterable]
A collection of multiple iter... | [
"def",
"append_multiple",
"(",
"self",
",",
"data",
",",
"segment",
"=",
"0",
")",
":",
"if",
"not",
"hasattr",
"(",
"data",
",",
"'__iter__'",
")",
":",
"raise",
"TypeError",
"(",
"\"append_multiple must be passed an iterable object\"",
")",
"tmp_list",
"=",
... | Append multiple rows to an SFrame.
Throws a RuntimeError if one or more column's type is incompatible with
a type appended.
Parameters
----------
data : iterable[iterable]
A collection of multiple iterables, each representing a single row.
segment : int
... | [
"Append",
"multiple",
"rows",
"to",
"an",
"SFrame",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sframe_builder.py#L131-L166 |
29,131 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/tools/stage.py | InstallTargetClass.targets_to_stage | def targets_to_stage(self, source_targets, ps):
"""Given the list of source targets explicitly passed to 'stage', returns the
list of targets which must be staged."""
result = []
# Traverse the dependencies, if needed.
if ps.get('install-dependencies') == ['on']:
so... | python | def targets_to_stage(self, source_targets, ps):
"""Given the list of source targets explicitly passed to 'stage', returns the
list of targets which must be staged."""
result = []
# Traverse the dependencies, if needed.
if ps.get('install-dependencies') == ['on']:
so... | [
"def",
"targets_to_stage",
"(",
"self",
",",
"source_targets",
",",
"ps",
")",
":",
"result",
"=",
"[",
"]",
"# Traverse the dependencies, if needed.",
"if",
"ps",
".",
"get",
"(",
"'install-dependencies'",
")",
"==",
"[",
"'on'",
"]",
":",
"source_targets",
"... | Given the list of source targets explicitly passed to 'stage', returns the
list of targets which must be staged. | [
"Given",
"the",
"list",
"of",
"source",
"targets",
"explicitly",
"passed",
"to",
"stage",
"returns",
"the",
"list",
"of",
"targets",
"which",
"must",
"be",
"staged",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/stage.py#L139-L166 |
29,132 | apple/turicreate | src/unity/python/turicreate/config/__init__.py | init_logger | def init_logger():
"""
Initialize the logging configuration for the turicreate package.
This does not affect the root logging config.
"""
import logging as _logging
import logging.config
# Package level logger
_logging.config.dictConfig({
'version': 1,
'disable_existing... | python | def init_logger():
"""
Initialize the logging configuration for the turicreate package.
This does not affect the root logging config.
"""
import logging as _logging
import logging.config
# Package level logger
_logging.config.dictConfig({
'version': 1,
'disable_existing... | [
"def",
"init_logger",
"(",
")",
":",
"import",
"logging",
"as",
"_logging",
"import",
"logging",
".",
"config",
"# Package level logger",
"_logging",
".",
"config",
".",
"dictConfig",
"(",
"{",
"'version'",
":",
"1",
",",
"'disable_existing_loggers'",
":",
"Fals... | Initialize the logging configuration for the turicreate package.
This does not affect the root logging config. | [
"Initialize",
"the",
"logging",
"configuration",
"for",
"the",
"turicreate",
"package",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/config/__init__.py#L34-L81 |
29,133 | apple/turicreate | src/unity/python/turicreate/config/__init__.py | get_environment_config | def get_environment_config():
"""
Returns all the Turi Create configuration variables that can only
be set via environment variables.
- *TURI_FILEIO_WRITER_BUFFER_SIZE*: The file write buffer size.
- *TURI_FILEIO_READER_BUFFER_SIZE*: The file read buffer size.
- *OMP_NUM_THREADS*: The maximum n... | python | def get_environment_config():
"""
Returns all the Turi Create configuration variables that can only
be set via environment variables.
- *TURI_FILEIO_WRITER_BUFFER_SIZE*: The file write buffer size.
- *TURI_FILEIO_READER_BUFFER_SIZE*: The file read buffer size.
- *OMP_NUM_THREADS*: The maximum n... | [
"def",
"get_environment_config",
"(",
")",
":",
"from",
".",
".",
"_connect",
"import",
"main",
"as",
"_glconnect",
"unity",
"=",
"_glconnect",
".",
"get_unity",
"(",
")",
"return",
"unity",
".",
"list_globals",
"(",
"False",
")"
] | Returns all the Turi Create configuration variables that can only
be set via environment variables.
- *TURI_FILEIO_WRITER_BUFFER_SIZE*: The file write buffer size.
- *TURI_FILEIO_READER_BUFFER_SIZE*: The file read buffer size.
- *OMP_NUM_THREADS*: The maximum number of threads to use for parallel proce... | [
"Returns",
"all",
"the",
"Turi",
"Create",
"configuration",
"variables",
"that",
"can",
"only",
"be",
"set",
"via",
"environment",
"variables",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/config/__init__.py#L145-L160 |
29,134 | apple/turicreate | src/unity/python/turicreate/config/__init__.py | set_log_level | def set_log_level(level):
"""
Sets the log level.
Lower log levels log more.
if level is 8, nothing is logged. If level is 0, everything is logged.
"""
from .._connect import main as _glconnect
unity = _glconnect.get_unity()
return unity.set_log_level(level) | python | def set_log_level(level):
"""
Sets the log level.
Lower log levels log more.
if level is 8, nothing is logged. If level is 0, everything is logged.
"""
from .._connect import main as _glconnect
unity = _glconnect.get_unity()
return unity.set_log_level(level) | [
"def",
"set_log_level",
"(",
"level",
")",
":",
"from",
".",
".",
"_connect",
"import",
"main",
"as",
"_glconnect",
"unity",
"=",
"_glconnect",
".",
"get_unity",
"(",
")",
"return",
"unity",
".",
"set_log_level",
"(",
"level",
")"
] | Sets the log level.
Lower log levels log more.
if level is 8, nothing is logged. If level is 0, everything is logged. | [
"Sets",
"the",
"log",
"level",
".",
"Lower",
"log",
"levels",
"log",
"more",
".",
"if",
"level",
"is",
"8",
"nothing",
"is",
"logged",
".",
"If",
"level",
"is",
"0",
"everything",
"is",
"logged",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/config/__init__.py#L162-L170 |
29,135 | apple/turicreate | src/unity/python/turicreate/data_structures/sgraph.py | load_sgraph | def load_sgraph(filename, format='binary', delimiter='auto'):
"""
Load SGraph from text file or previously saved SGraph binary.
Parameters
----------
filename : string
Location of the file. Can be a local path or a remote URL.
format : {'binary', 'snap', 'csv', 'tsv'}, optional
... | python | def load_sgraph(filename, format='binary', delimiter='auto'):
"""
Load SGraph from text file or previously saved SGraph binary.
Parameters
----------
filename : string
Location of the file. Can be a local path or a remote URL.
format : {'binary', 'snap', 'csv', 'tsv'}, optional
... | [
"def",
"load_sgraph",
"(",
"filename",
",",
"format",
"=",
"'binary'",
",",
"delimiter",
"=",
"'auto'",
")",
":",
"if",
"not",
"format",
"in",
"[",
"'binary'",
",",
"'snap'",
",",
"'csv'",
",",
"'tsv'",
"]",
":",
"raise",
"ValueError",
"(",
"'Invalid for... | Load SGraph from text file or previously saved SGraph binary.
Parameters
----------
filename : string
Location of the file. Can be a local path or a remote URL.
format : {'binary', 'snap', 'csv', 'tsv'}, optional
Format to of the file to load.
- 'binary': native graph format o... | [
"Load",
"SGraph",
"from",
"text",
"file",
"or",
"previously",
"saved",
"SGraph",
"binary",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sgraph.py#L1153-L1221 |
29,136 | apple/turicreate | src/unity/python/turicreate/data_structures/sgraph.py | _vertex_list_to_dataframe | def _vertex_list_to_dataframe(ls, id_column_name):
"""
Convert a list of vertices into dataframe.
"""
assert HAS_PANDAS, 'Cannot use dataframe because Pandas is not available or version is too low.'
cols = reduce(set.union, (set(v.attr.keys()) for v in ls))
df = pd.DataFrame({id_column_name: [v.... | python | def _vertex_list_to_dataframe(ls, id_column_name):
"""
Convert a list of vertices into dataframe.
"""
assert HAS_PANDAS, 'Cannot use dataframe because Pandas is not available or version is too low.'
cols = reduce(set.union, (set(v.attr.keys()) for v in ls))
df = pd.DataFrame({id_column_name: [v.... | [
"def",
"_vertex_list_to_dataframe",
"(",
"ls",
",",
"id_column_name",
")",
":",
"assert",
"HAS_PANDAS",
",",
"'Cannot use dataframe because Pandas is not available or version is too low.'",
"cols",
"=",
"reduce",
"(",
"set",
".",
"union",
",",
"(",
"set",
"(",
"v",
".... | Convert a list of vertices into dataframe. | [
"Convert",
"a",
"list",
"of",
"vertices",
"into",
"dataframe",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sgraph.py#L1229-L1238 |
29,137 | apple/turicreate | src/unity/python/turicreate/data_structures/sgraph.py | _vertex_list_to_sframe | def _vertex_list_to_sframe(ls, id_column_name):
"""
Convert a list of vertices into an SFrame.
"""
sf = SFrame()
if type(ls) == list:
cols = reduce(set.union, (set(v.attr.keys()) for v in ls))
sf[id_column_name] = [v.vid for v in ls]
for c in cols:
sf[c] = [v.att... | python | def _vertex_list_to_sframe(ls, id_column_name):
"""
Convert a list of vertices into an SFrame.
"""
sf = SFrame()
if type(ls) == list:
cols = reduce(set.union, (set(v.attr.keys()) for v in ls))
sf[id_column_name] = [v.vid for v in ls]
for c in cols:
sf[c] = [v.att... | [
"def",
"_vertex_list_to_sframe",
"(",
"ls",
",",
"id_column_name",
")",
":",
"sf",
"=",
"SFrame",
"(",
")",
"if",
"type",
"(",
"ls",
")",
"==",
"list",
":",
"cols",
"=",
"reduce",
"(",
"set",
".",
"union",
",",
"(",
"set",
"(",
"v",
".",
"attr",
... | Convert a list of vertices into an SFrame. | [
"Convert",
"a",
"list",
"of",
"vertices",
"into",
"an",
"SFrame",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sgraph.py#L1240-L1260 |
29,138 | apple/turicreate | src/unity/python/turicreate/data_structures/sgraph.py | _edge_list_to_dataframe | def _edge_list_to_dataframe(ls, src_column_name, dst_column_name):
"""
Convert a list of edges into dataframe.
"""
assert HAS_PANDAS, 'Cannot use dataframe because Pandas is not available or version is too low.'
cols = reduce(set.union, (set(e.attr.keys()) for e in ls))
df = pd.DataFrame({
... | python | def _edge_list_to_dataframe(ls, src_column_name, dst_column_name):
"""
Convert a list of edges into dataframe.
"""
assert HAS_PANDAS, 'Cannot use dataframe because Pandas is not available or version is too low.'
cols = reduce(set.union, (set(e.attr.keys()) for e in ls))
df = pd.DataFrame({
... | [
"def",
"_edge_list_to_dataframe",
"(",
"ls",
",",
"src_column_name",
",",
"dst_column_name",
")",
":",
"assert",
"HAS_PANDAS",
",",
"'Cannot use dataframe because Pandas is not available or version is too low.'",
"cols",
"=",
"reduce",
"(",
"set",
".",
"union",
",",
"(",
... | Convert a list of edges into dataframe. | [
"Convert",
"a",
"list",
"of",
"edges",
"into",
"dataframe",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sgraph.py#L1262-L1273 |
29,139 | apple/turicreate | src/unity/python/turicreate/data_structures/sgraph.py | _edge_list_to_sframe | def _edge_list_to_sframe(ls, src_column_name, dst_column_name):
"""
Convert a list of edges into an SFrame.
"""
sf = SFrame()
if type(ls) == list:
cols = reduce(set.union, (set(v.attr.keys()) for v in ls))
sf[src_column_name] = [e.src_vid for e in ls]
sf[dst_column_name] = [... | python | def _edge_list_to_sframe(ls, src_column_name, dst_column_name):
"""
Convert a list of edges into an SFrame.
"""
sf = SFrame()
if type(ls) == list:
cols = reduce(set.union, (set(v.attr.keys()) for v in ls))
sf[src_column_name] = [e.src_vid for e in ls]
sf[dst_column_name] = [... | [
"def",
"_edge_list_to_sframe",
"(",
"ls",
",",
"src_column_name",
",",
"dst_column_name",
")",
":",
"sf",
"=",
"SFrame",
"(",
")",
"if",
"type",
"(",
"ls",
")",
"==",
"list",
":",
"cols",
"=",
"reduce",
"(",
"set",
".",
"union",
",",
"(",
"set",
"(",... | Convert a list of edges into an SFrame. | [
"Convert",
"a",
"list",
"of",
"edges",
"into",
"an",
"SFrame",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sgraph.py#L1275-L1295 |
29,140 | apple/turicreate | src/unity/python/turicreate/data_structures/sgraph.py | _dataframe_to_vertex_list | def _dataframe_to_vertex_list(df):
"""
Convert dataframe into list of vertices, assuming that vertex ids are stored in _VID_COLUMN.
"""
cols = df.columns
if len(cols):
assert _VID_COLUMN in cols, "Vertex DataFrame must contain column %s" % _VID_COLUMN
df = df[cols].T
ret = [V... | python | def _dataframe_to_vertex_list(df):
"""
Convert dataframe into list of vertices, assuming that vertex ids are stored in _VID_COLUMN.
"""
cols = df.columns
if len(cols):
assert _VID_COLUMN in cols, "Vertex DataFrame must contain column %s" % _VID_COLUMN
df = df[cols].T
ret = [V... | [
"def",
"_dataframe_to_vertex_list",
"(",
"df",
")",
":",
"cols",
"=",
"df",
".",
"columns",
"if",
"len",
"(",
"cols",
")",
":",
"assert",
"_VID_COLUMN",
"in",
"cols",
",",
"\"Vertex DataFrame must contain column %s\"",
"%",
"_VID_COLUMN",
"df",
"=",
"df",
"[",... | Convert dataframe into list of vertices, assuming that vertex ids are stored in _VID_COLUMN. | [
"Convert",
"dataframe",
"into",
"list",
"of",
"vertices",
"assuming",
"that",
"vertex",
"ids",
"are",
"stored",
"in",
"_VID_COLUMN",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sgraph.py#L1297-L1308 |
29,141 | apple/turicreate | src/unity/python/turicreate/data_structures/sgraph.py | _dataframe_to_edge_list | def _dataframe_to_edge_list(df):
"""
Convert dataframe into list of edges, assuming that source and target ids are stored in _SRC_VID_COLUMN, and _DST_VID_COLUMN respectively.
"""
cols = df.columns
if len(cols):
assert _SRC_VID_COLUMN in cols, "Vertex DataFrame must contain column %s" % _SRC... | python | def _dataframe_to_edge_list(df):
"""
Convert dataframe into list of edges, assuming that source and target ids are stored in _SRC_VID_COLUMN, and _DST_VID_COLUMN respectively.
"""
cols = df.columns
if len(cols):
assert _SRC_VID_COLUMN in cols, "Vertex DataFrame must contain column %s" % _SRC... | [
"def",
"_dataframe_to_edge_list",
"(",
"df",
")",
":",
"cols",
"=",
"df",
".",
"columns",
"if",
"len",
"(",
"cols",
")",
":",
"assert",
"_SRC_VID_COLUMN",
"in",
"cols",
",",
"\"Vertex DataFrame must contain column %s\"",
"%",
"_SRC_VID_COLUMN",
"assert",
"_DST_VID... | Convert dataframe into list of edges, assuming that source and target ids are stored in _SRC_VID_COLUMN, and _DST_VID_COLUMN respectively. | [
"Convert",
"dataframe",
"into",
"list",
"of",
"edges",
"assuming",
"that",
"source",
"and",
"target",
"ids",
"are",
"stored",
"in",
"_SRC_VID_COLUMN",
"and",
"_DST_VID_COLUMN",
"respectively",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sgraph.py#L1311-L1323 |
29,142 | apple/turicreate | src/unity/python/turicreate/data_structures/sgraph.py | SGraph.select_fields | def select_fields(self, fields):
"""
Return a new SGraph with only the selected fields. Other fields are
discarded, while fields that do not exist in the SGraph are ignored.
Parameters
----------
fields : string | list [string]
A single field name or a list o... | python | def select_fields(self, fields):
"""
Return a new SGraph with only the selected fields. Other fields are
discarded, while fields that do not exist in the SGraph are ignored.
Parameters
----------
fields : string | list [string]
A single field name or a list o... | [
"def",
"select_fields",
"(",
"self",
",",
"fields",
")",
":",
"if",
"(",
"type",
"(",
"fields",
")",
"is",
"str",
")",
":",
"fields",
"=",
"[",
"fields",
"]",
"if",
"not",
"isinstance",
"(",
"fields",
",",
"list",
")",
"or",
"not",
"all",
"(",
"t... | Return a new SGraph with only the selected fields. Other fields are
discarded, while fields that do not exist in the SGraph are ignored.
Parameters
----------
fields : string | list [string]
A single field name or a list of field names to select.
Returns
---... | [
"Return",
"a",
"new",
"SGraph",
"with",
"only",
"the",
"selected",
"fields",
".",
"Other",
"fields",
"are",
"discarded",
"while",
"fields",
"that",
"do",
"not",
"exist",
"in",
"the",
"SGraph",
"are",
"ignored",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sgraph.py#L811-L866 |
29,143 | apple/turicreate | src/unity/python/turicreate/data_structures/sgraph.py | SGraph.get_neighborhood | def get_neighborhood(self, ids, radius=1, full_subgraph=True):
"""
Retrieve the graph neighborhood around a set of vertices, ignoring edge
directions. Note that setting radius greater than two often results in a
time-consuming query for a very large subgraph.
Parameters
... | python | def get_neighborhood(self, ids, radius=1, full_subgraph=True):
"""
Retrieve the graph neighborhood around a set of vertices, ignoring edge
directions. Note that setting radius greater than two often results in a
time-consuming query for a very large subgraph.
Parameters
... | [
"def",
"get_neighborhood",
"(",
"self",
",",
"ids",
",",
"radius",
"=",
"1",
",",
"full_subgraph",
"=",
"True",
")",
":",
"verts",
"=",
"ids",
"## find the vertices within radius (and the path edges)",
"for",
"i",
"in",
"range",
"(",
"radius",
")",
":",
"edges... | Retrieve the graph neighborhood around a set of vertices, ignoring edge
directions. Note that setting radius greater than two often results in a
time-consuming query for a very large subgraph.
Parameters
----------
ids : list [int | float | str]
List of target vertex... | [
"Retrieve",
"the",
"graph",
"neighborhood",
"around",
"a",
"set",
"of",
"vertices",
"ignoring",
"edge",
"directions",
".",
"Note",
"that",
"setting",
"radius",
"greater",
"than",
"two",
"often",
"results",
"in",
"a",
"time",
"-",
"consuming",
"query",
"for",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sgraph.py#L1063-L1145 |
29,144 | apple/turicreate | src/unity/python/turicreate/toolkits/graph_analytics/_model_base.py | GraphAnalyticsModel._get | def _get(self, field):
"""
Return the value for the queried field.
Get the value of a given field. The list of all queryable fields is
documented in the beginning of the model class.
>>> out = m._get('graph')
Parameters
----------
field : string
... | python | def _get(self, field):
"""
Return the value for the queried field.
Get the value of a given field. The list of all queryable fields is
documented in the beginning of the model class.
>>> out = m._get('graph')
Parameters
----------
field : string
... | [
"def",
"_get",
"(",
"self",
",",
"field",
")",
":",
"if",
"field",
"in",
"self",
".",
"_list_fields",
"(",
")",
":",
"return",
"self",
".",
"__proxy__",
".",
"get",
"(",
"field",
")",
"else",
":",
"raise",
"KeyError",
"(",
"'Key \\\"%s\\\" not in model. ... | Return the value for the queried field.
Get the value of a given field. The list of all queryable fields is
documented in the beginning of the model class.
>>> out = m._get('graph')
Parameters
----------
field : string
Name of the field to be retrieved.
... | [
"Return",
"the",
"value",
"for",
"the",
"queried",
"field",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/graph_analytics/_model_base.py#L31-L53 |
29,145 | apple/turicreate | src/unity/python/turicreate/toolkits/graph_analytics/_model_base.py | GraphAnalyticsModel._describe_fields | def _describe_fields(cls):
"""
Return a dictionary for the class fields description.
Fields should NOT be wrapped by _precomputed_field, if necessary
"""
dispatch_table = {
'ShortestPathModel': 'sssp',
'GraphColoringModel': 'graph_coloring',
'P... | python | def _describe_fields(cls):
"""
Return a dictionary for the class fields description.
Fields should NOT be wrapped by _precomputed_field, if necessary
"""
dispatch_table = {
'ShortestPathModel': 'sssp',
'GraphColoringModel': 'graph_coloring',
'P... | [
"def",
"_describe_fields",
"(",
"cls",
")",
":",
"dispatch_table",
"=",
"{",
"'ShortestPathModel'",
":",
"'sssp'",
",",
"'GraphColoringModel'",
":",
"'graph_coloring'",
",",
"'PagerankModel'",
":",
"'pagerank'",
",",
"'ConnectedComponentsModel'",
":",
"'connected_compon... | Return a dictionary for the class fields description.
Fields should NOT be wrapped by _precomputed_field, if necessary | [
"Return",
"a",
"dictionary",
"for",
"the",
"class",
"fields",
"description",
".",
"Fields",
"should",
"NOT",
"be",
"wrapped",
"by",
"_precomputed_field",
"if",
"necessary"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/graph_analytics/_model_base.py#L56-L76 |
29,146 | apple/turicreate | src/unity/python/turicreate/util/_type_checks.py | _raise_error_if_not_of_type | def _raise_error_if_not_of_type(arg, expected_type, arg_name=None):
"""
Check if the input is of expected type.
Parameters
----------
arg : Input argument.
expected_type : A type OR a list of types that the argument is expected
to be.
arg_name : The n... | python | def _raise_error_if_not_of_type(arg, expected_type, arg_name=None):
"""
Check if the input is of expected type.
Parameters
----------
arg : Input argument.
expected_type : A type OR a list of types that the argument is expected
to be.
arg_name : The n... | [
"def",
"_raise_error_if_not_of_type",
"(",
"arg",
",",
"expected_type",
",",
"arg_name",
"=",
"None",
")",
":",
"display_name",
"=",
"\"%s \"",
"%",
"arg_name",
"if",
"arg_name",
"is",
"not",
"None",
"else",
"\"Argument \"",
"lst_expected_type",
"=",
"[",
"expec... | Check if the input is of expected type.
Parameters
----------
arg : Input argument.
expected_type : A type OR a list of types that the argument is expected
to be.
arg_name : The name of the variable in the function being used. No
name is a... | [
"Check",
"if",
"the",
"input",
"is",
"of",
"expected",
"type",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/_type_checks.py#L11-L39 |
29,147 | apple/turicreate | src/unity/python/turicreate/toolkits/sound_classifier/vggish_input.py | waveform_to_examples | def waveform_to_examples(data, sample_rate):
"""Converts audio waveform into an array of examples for VGGish.
Args:
data: np.array of either one dimension (mono) or two dimensions
(multi-channel, with the outer dimension representing channels).
Each sample is generally expected to lie in the range ... | python | def waveform_to_examples(data, sample_rate):
"""Converts audio waveform into an array of examples for VGGish.
Args:
data: np.array of either one dimension (mono) or two dimensions
(multi-channel, with the outer dimension representing channels).
Each sample is generally expected to lie in the range ... | [
"def",
"waveform_to_examples",
"(",
"data",
",",
"sample_rate",
")",
":",
"import",
"resampy",
"# Convert to mono.",
"if",
"len",
"(",
"data",
".",
"shape",
")",
">",
"1",
":",
"data",
"=",
"np",
".",
"mean",
"(",
"data",
",",
"axis",
"=",
"1",
")",
... | Converts audio waveform into an array of examples for VGGish.
Args:
data: np.array of either one dimension (mono) or two dimensions
(multi-channel, with the outer dimension representing channels).
Each sample is generally expected to lie in the range [-1.0, +1.0],
although this is not required.... | [
"Converts",
"audio",
"waveform",
"into",
"an",
"array",
"of",
"examples",
"for",
"VGGish",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/sound_classifier/vggish_input.py#L24-L71 |
29,148 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/build_request.py | expand_no_defaults | def expand_no_defaults (property_sets):
""" Expand the given build request by combining all property_sets which don't
specify conflicting non-free features.
"""
assert is_iterable_typed(property_sets, property_set.PropertySet)
# First make all features and subfeatures explicit
expanded_prope... | python | def expand_no_defaults (property_sets):
""" Expand the given build request by combining all property_sets which don't
specify conflicting non-free features.
"""
assert is_iterable_typed(property_sets, property_set.PropertySet)
# First make all features and subfeatures explicit
expanded_prope... | [
"def",
"expand_no_defaults",
"(",
"property_sets",
")",
":",
"assert",
"is_iterable_typed",
"(",
"property_sets",
",",
"property_set",
".",
"PropertySet",
")",
"# First make all features and subfeatures explicit",
"expanded_property_sets",
"=",
"[",
"ps",
".",
"expand_subfe... | Expand the given build request by combining all property_sets which don't
specify conflicting non-free features. | [
"Expand",
"the",
"given",
"build",
"request",
"by",
"combining",
"all",
"property_sets",
"which",
"don",
"t",
"specify",
"conflicting",
"non",
"-",
"free",
"features",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/build_request.py#L17-L28 |
29,149 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/build_request.py | __x_product | def __x_product (property_sets):
""" Return the cross-product of all elements of property_sets, less any
that would contain conflicting values for single-valued features.
"""
assert is_iterable_typed(property_sets, property_set.PropertySet)
x_product_seen = set()
return __x_product_aux (prop... | python | def __x_product (property_sets):
""" Return the cross-product of all elements of property_sets, less any
that would contain conflicting values for single-valued features.
"""
assert is_iterable_typed(property_sets, property_set.PropertySet)
x_product_seen = set()
return __x_product_aux (prop... | [
"def",
"__x_product",
"(",
"property_sets",
")",
":",
"assert",
"is_iterable_typed",
"(",
"property_sets",
",",
"property_set",
".",
"PropertySet",
")",
"x_product_seen",
"=",
"set",
"(",
")",
"return",
"__x_product_aux",
"(",
"property_sets",
",",
"x_product_seen",... | Return the cross-product of all elements of property_sets, less any
that would contain conflicting values for single-valued features. | [
"Return",
"the",
"cross",
"-",
"product",
"of",
"all",
"elements",
"of",
"property_sets",
"less",
"any",
"that",
"would",
"contain",
"conflicting",
"values",
"for",
"single",
"-",
"valued",
"features",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/build_request.py#L31-L37 |
29,150 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/build_request.py | __x_product_aux | def __x_product_aux (property_sets, seen_features):
"""Returns non-conflicting combinations of property sets.
property_sets is a list of PropertySet instances. seen_features is a set of Property
instances.
Returns a tuple of:
- list of lists of Property instances, such that within each list, no tw... | python | def __x_product_aux (property_sets, seen_features):
"""Returns non-conflicting combinations of property sets.
property_sets is a list of PropertySet instances. seen_features is a set of Property
instances.
Returns a tuple of:
- list of lists of Property instances, such that within each list, no tw... | [
"def",
"__x_product_aux",
"(",
"property_sets",
",",
"seen_features",
")",
":",
"assert",
"is_iterable_typed",
"(",
"property_sets",
",",
"property_set",
".",
"PropertySet",
")",
"assert",
"isinstance",
"(",
"seen_features",
",",
"set",
")",
"if",
"not",
"property... | Returns non-conflicting combinations of property sets.
property_sets is a list of PropertySet instances. seen_features is a set of Property
instances.
Returns a tuple of:
- list of lists of Property instances, such that within each list, no two Property instance
have the same feature, and no Prope... | [
"Returns",
"non",
"-",
"conflicting",
"combinations",
"of",
"property",
"sets",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/build_request.py#L39-L91 |
29,151 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/build_request.py | looks_like_implicit_value | def looks_like_implicit_value(v):
"""Returns true if 'v' is either implicit value, or
the part before the first '-' symbol is implicit value."""
assert isinstance(v, basestring)
if feature.is_implicit_value(v):
return 1
else:
split = v.split("-")
if feature.is_implicit_value(... | python | def looks_like_implicit_value(v):
"""Returns true if 'v' is either implicit value, or
the part before the first '-' symbol is implicit value."""
assert isinstance(v, basestring)
if feature.is_implicit_value(v):
return 1
else:
split = v.split("-")
if feature.is_implicit_value(... | [
"def",
"looks_like_implicit_value",
"(",
"v",
")",
":",
"assert",
"isinstance",
"(",
"v",
",",
"basestring",
")",
"if",
"feature",
".",
"is_implicit_value",
"(",
"v",
")",
":",
"return",
"1",
"else",
":",
"split",
"=",
"v",
".",
"split",
"(",
"\"-\"",
... | Returns true if 'v' is either implicit value, or
the part before the first '-' symbol is implicit value. | [
"Returns",
"true",
"if",
"v",
"is",
"either",
"implicit",
"value",
"or",
"the",
"part",
"before",
"the",
"first",
"-",
"symbol",
"is",
"implicit",
"value",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/build_request.py#L95-L106 |
29,152 | apple/turicreate | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py | regex_to_error_msg | def regex_to_error_msg(regex):
"""Format a human-readable error message from a regex"""
return re.sub('([^\\\\])[()]', '\\1', regex) \
.replace('[ \t]*$', '') \
.replace('^', '') \
.replace('$', '') \
.replace('[ \t]*', ' ') \
.replace('[ \t]+', ' ') \
.replace('[... | python | def regex_to_error_msg(regex):
"""Format a human-readable error message from a regex"""
return re.sub('([^\\\\])[()]', '\\1', regex) \
.replace('[ \t]*$', '') \
.replace('^', '') \
.replace('$', '') \
.replace('[ \t]*', ' ') \
.replace('[ \t]+', ' ') \
.replace('[... | [
"def",
"regex_to_error_msg",
"(",
"regex",
")",
":",
"return",
"re",
".",
"sub",
"(",
"'([^\\\\\\\\])[()]'",
",",
"'\\\\1'",
",",
"regex",
")",
".",
"replace",
"(",
"'[ \\t]*$'",
",",
"''",
")",
".",
"replace",
"(",
"'^'",
",",
"''",
")",
".",
"replace... | Format a human-readable error message from a regex | [
"Format",
"a",
"human",
"-",
"readable",
"error",
"message",
"from",
"a",
"regex"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py#L20-L34 |
29,153 | apple/turicreate | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py | random_chars | def random_chars(number):
"""Generate random characters"""
char_map = {
k: v for k, v in chars.CHARS.iteritems()
if not format_character(k).startswith('\\x')
}
char_num = sum(char_map.values())
return (
format_character(nth_char(char_map, random.randint(0, char_num - 1)))
... | python | def random_chars(number):
"""Generate random characters"""
char_map = {
k: v for k, v in chars.CHARS.iteritems()
if not format_character(k).startswith('\\x')
}
char_num = sum(char_map.values())
return (
format_character(nth_char(char_map, random.randint(0, char_num - 1)))
... | [
"def",
"random_chars",
"(",
"number",
")",
":",
"char_map",
"=",
"{",
"k",
":",
"v",
"for",
"k",
",",
"v",
"in",
"chars",
".",
"CHARS",
".",
"iteritems",
"(",
")",
"if",
"not",
"format_character",
"(",
"k",
")",
".",
"startswith",
"(",
"'\\\\x'",
"... | Generate random characters | [
"Generate",
"random",
"characters"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py#L50-L61 |
29,154 | apple/turicreate | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py | templates_in | def templates_in(path):
"""Enumerate the templates found in path"""
ext = '.cpp'
return (
Template(f[0:-len(ext)], load_file(os.path.join(path, f)))
for f in os.listdir(path) if f.endswith(ext)
) | python | def templates_in(path):
"""Enumerate the templates found in path"""
ext = '.cpp'
return (
Template(f[0:-len(ext)], load_file(os.path.join(path, f)))
for f in os.listdir(path) if f.endswith(ext)
) | [
"def",
"templates_in",
"(",
"path",
")",
":",
"ext",
"=",
"'.cpp'",
"return",
"(",
"Template",
"(",
"f",
"[",
"0",
":",
"-",
"len",
"(",
"ext",
")",
"]",
",",
"load_file",
"(",
"os",
".",
"path",
".",
"join",
"(",
"path",
",",
"f",
")",
")",
... | Enumerate the templates found in path | [
"Enumerate",
"the",
"templates",
"found",
"in",
"path"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py#L186-L192 |
29,155 | apple/turicreate | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py | nth_char | def nth_char(char_map, index):
"""Returns the nth character of a character->occurrence map"""
for char in char_map:
if index < char_map[char]:
return char
index = index - char_map[char]
return None | python | def nth_char(char_map, index):
"""Returns the nth character of a character->occurrence map"""
for char in char_map:
if index < char_map[char]:
return char
index = index - char_map[char]
return None | [
"def",
"nth_char",
"(",
"char_map",
",",
"index",
")",
":",
"for",
"char",
"in",
"char_map",
":",
"if",
"index",
"<",
"char_map",
"[",
"char",
"]",
":",
"return",
"char",
"index",
"=",
"index",
"-",
"char_map",
"[",
"char",
"]",
"return",
"None"
] | Returns the nth character of a character->occurrence map | [
"Returns",
"the",
"nth",
"character",
"of",
"a",
"character",
"-",
">",
"occurrence",
"map"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py#L195-L201 |
29,156 | apple/turicreate | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py | format_character | def format_character(char):
"""Returns the C-formatting of the character"""
if \
char in string.ascii_letters \
or char in string.digits \
or char in [
'_', '.', ':', ';', ' ', '!', '?', '+', '-', '/', '=', '<',
'>', '$', '(', ')', '@', '~', '`', '|', '#',... | python | def format_character(char):
"""Returns the C-formatting of the character"""
if \
char in string.ascii_letters \
or char in string.digits \
or char in [
'_', '.', ':', ';', ' ', '!', '?', '+', '-', '/', '=', '<',
'>', '$', '(', ')', '@', '~', '`', '|', '#',... | [
"def",
"format_character",
"(",
"char",
")",
":",
"if",
"char",
"in",
"string",
".",
"ascii_letters",
"or",
"char",
"in",
"string",
".",
"digits",
"or",
"char",
"in",
"[",
"'_'",
",",
"'.'",
",",
"':'",
",",
"';'",
",",
"' '",
",",
"'!'",
",",
"'?'... | Returns the C-formatting of the character | [
"Returns",
"the",
"C",
"-",
"formatting",
"of",
"the",
"character"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py#L204-L223 |
29,157 | apple/turicreate | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py | write_file | def write_file(filename, content):
"""Create the file with the given content"""
print 'Generating {0}'.format(filename)
with open(filename, 'wb') as out_f:
out_f.write(content) | python | def write_file(filename, content):
"""Create the file with the given content"""
print 'Generating {0}'.format(filename)
with open(filename, 'wb') as out_f:
out_f.write(content) | [
"def",
"write_file",
"(",
"filename",
",",
"content",
")",
":",
"print",
"'Generating {0}'",
".",
"format",
"(",
"filename",
")",
"with",
"open",
"(",
"filename",
",",
"'wb'",
")",
"as",
"out_f",
":",
"out_f",
".",
"write",
"(",
"content",
")"
] | Create the file with the given content | [
"Create",
"the",
"file",
"with",
"the",
"given",
"content"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py#L226-L230 |
29,158 | apple/turicreate | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py | out_filename | def out_filename(template, n_val, mode):
"""Determine the output filename"""
return '{0}_{1}_{2}.cpp'.format(template.name, n_val, mode.identifier) | python | def out_filename(template, n_val, mode):
"""Determine the output filename"""
return '{0}_{1}_{2}.cpp'.format(template.name, n_val, mode.identifier) | [
"def",
"out_filename",
"(",
"template",
",",
"n_val",
",",
"mode",
")",
":",
"return",
"'{0}_{1}_{2}.cpp'",
".",
"format",
"(",
"template",
".",
"name",
",",
"n_val",
",",
"mode",
".",
"identifier",
")"
] | Determine the output filename | [
"Determine",
"the",
"output",
"filename"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py#L233-L235 |
29,159 | apple/turicreate | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py | Mode.convert_from | def convert_from(self, base):
"""Convert a BOOST_METAPARSE_STRING mode document into one with
this mode"""
if self.identifier == 'bmp':
return base
elif self.identifier == 'man':
result = []
prefix = 'BOOST_METAPARSE_STRING("'
while True:
... | python | def convert_from(self, base):
"""Convert a BOOST_METAPARSE_STRING mode document into one with
this mode"""
if self.identifier == 'bmp':
return base
elif self.identifier == 'man':
result = []
prefix = 'BOOST_METAPARSE_STRING("'
while True:
... | [
"def",
"convert_from",
"(",
"self",
",",
"base",
")",
":",
"if",
"self",
".",
"identifier",
"==",
"'bmp'",
":",
"return",
"base",
"elif",
"self",
".",
"identifier",
"==",
"'man'",
":",
"result",
"=",
"[",
"]",
"prefix",
"=",
"'BOOST_METAPARSE_STRING(\"'",
... | Convert a BOOST_METAPARSE_STRING mode document into one with
this mode | [
"Convert",
"a",
"BOOST_METAPARSE_STRING",
"mode",
"document",
"into",
"one",
"with",
"this",
"mode"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py#L89-L124 |
29,160 | apple/turicreate | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py | Template.instantiate | def instantiate(self, value_of_n):
"""Instantiates the template"""
template = Cheetah.Template.Template(
self.content,
searchList={'n': value_of_n}
)
template.random_string = random_string
return str(template) | python | def instantiate(self, value_of_n):
"""Instantiates the template"""
template = Cheetah.Template.Template(
self.content,
searchList={'n': value_of_n}
)
template.random_string = random_string
return str(template) | [
"def",
"instantiate",
"(",
"self",
",",
"value_of_n",
")",
":",
"template",
"=",
"Cheetah",
".",
"Template",
".",
"Template",
"(",
"self",
".",
"content",
",",
"searchList",
"=",
"{",
"'n'",
":",
"value_of_n",
"}",
")",
"template",
".",
"random_string",
... | Instantiates the template | [
"Instantiates",
"the",
"template"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py#L134-L141 |
29,161 | apple/turicreate | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py | Template.range | def range(self):
"""Returns the range for N"""
match = self._match(in_comment(
'n[ \t]+in[ \t]*\\[([0-9]+)\\.\\.([0-9]+)\\),[ \t]+'
'step[ \t]+([0-9]+)'
))
return range(
int(match.group(1)),
int(match.group(2)),
int(match.group(... | python | def range(self):
"""Returns the range for N"""
match = self._match(in_comment(
'n[ \t]+in[ \t]*\\[([0-9]+)\\.\\.([0-9]+)\\),[ \t]+'
'step[ \t]+([0-9]+)'
))
return range(
int(match.group(1)),
int(match.group(2)),
int(match.group(... | [
"def",
"range",
"(",
"self",
")",
":",
"match",
"=",
"self",
".",
"_match",
"(",
"in_comment",
"(",
"'n[ \\t]+in[ \\t]*\\\\[([0-9]+)\\\\.\\\\.([0-9]+)\\\\),[ \\t]+'",
"'step[ \\t]+([0-9]+)'",
")",
")",
"return",
"range",
"(",
"int",
"(",
"match",
".",
"group",
"("... | Returns the range for N | [
"Returns",
"the",
"range",
"for",
"N"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py#L143-L153 |
29,162 | apple/turicreate | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py | Template._match | def _match(self, regex):
"""Find the first line matching regex and return the match object"""
cregex = re.compile(regex)
for line in self.content.splitlines():
match = cregex.match(line)
if match:
return match
raise Exception('No "{0}" line in {1}.... | python | def _match(self, regex):
"""Find the first line matching regex and return the match object"""
cregex = re.compile(regex)
for line in self.content.splitlines():
match = cregex.match(line)
if match:
return match
raise Exception('No "{0}" line in {1}.... | [
"def",
"_match",
"(",
"self",
",",
"regex",
")",
":",
"cregex",
"=",
"re",
".",
"compile",
"(",
"regex",
")",
"for",
"line",
"in",
"self",
".",
"content",
".",
"splitlines",
"(",
")",
":",
"match",
"=",
"cregex",
".",
"match",
"(",
"line",
")",
"... | Find the first line matching regex and return the match object | [
"Find",
"the",
"first",
"line",
"matching",
"regex",
"and",
"return",
"the",
"match",
"object"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py#L163-L173 |
29,163 | apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/setup.py | generate_proto | def generate_proto(source, require = True):
"""Invokes the Protocol Compiler to generate a _pb2.py from the given
.proto file. Does nothing if the output already exists and is newer than
the input."""
if not require and not os.path.exists(source):
return
output = source.replace(".proto", "_pb2.py").rep... | python | def generate_proto(source, require = True):
"""Invokes the Protocol Compiler to generate a _pb2.py from the given
.proto file. Does nothing if the output already exists and is newer than
the input."""
if not require and not os.path.exists(source):
return
output = source.replace(".proto", "_pb2.py").rep... | [
"def",
"generate_proto",
"(",
"source",
",",
"require",
"=",
"True",
")",
":",
"if",
"not",
"require",
"and",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"source",
")",
":",
"return",
"output",
"=",
"source",
".",
"replace",
"(",
"\".proto\"",
",",
... | Invokes the Protocol Compiler to generate a _pb2.py from the given
.proto file. Does nothing if the output already exists and is newer than
the input. | [
"Invokes",
"the",
"Protocol",
"Compiler",
"to",
"generate",
"a",
"_pb2",
".",
"py",
"from",
"the",
"given",
".",
"proto",
"file",
".",
"Does",
"nothing",
"if",
"the",
"output",
"already",
"exists",
"and",
"is",
"newer",
"than",
"the",
"input",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/setup.py#L50-L77 |
29,164 | apple/turicreate | src/unity/python/turicreate/toolkits/_private_utils.py | _validate_row_label | def _validate_row_label(label, column_type_map):
"""
Validate a row label column.
Parameters
----------
label : str
Name of the row label column.
column_type_map : dict[str, type]
Dictionary mapping the name of each column in an SFrame to the type of
the values in the c... | python | def _validate_row_label(label, column_type_map):
"""
Validate a row label column.
Parameters
----------
label : str
Name of the row label column.
column_type_map : dict[str, type]
Dictionary mapping the name of each column in an SFrame to the type of
the values in the c... | [
"def",
"_validate_row_label",
"(",
"label",
",",
"column_type_map",
")",
":",
"if",
"not",
"isinstance",
"(",
"label",
",",
"str",
")",
":",
"raise",
"TypeError",
"(",
"\"The row label column name must be a string.\"",
")",
"if",
"not",
"label",
"in",
"column_type... | Validate a row label column.
Parameters
----------
label : str
Name of the row label column.
column_type_map : dict[str, type]
Dictionary mapping the name of each column in an SFrame to the type of
the values in the column. | [
"Validate",
"a",
"row",
"label",
"column",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_private_utils.py#L13-L33 |
29,165 | apple/turicreate | src/unity/python/turicreate/toolkits/_private_utils.py | _robust_column_name | def _robust_column_name(base_name, column_names):
"""
Generate a new column name that is guaranteed not to conflict with an
existing set of column names.
Parameters
----------
base_name : str
The base of the new column name. Usually this does not conflict with
the existing colum... | python | def _robust_column_name(base_name, column_names):
"""
Generate a new column name that is guaranteed not to conflict with an
existing set of column names.
Parameters
----------
base_name : str
The base of the new column name. Usually this does not conflict with
the existing colum... | [
"def",
"_robust_column_name",
"(",
"base_name",
",",
"column_names",
")",
":",
"robust_name",
"=",
"base_name",
"i",
"=",
"1",
"while",
"robust_name",
"in",
"column_names",
":",
"robust_name",
"=",
"base_name",
"+",
"'.{}'",
".",
"format",
"(",
"i",
")",
"i"... | Generate a new column name that is guaranteed not to conflict with an
existing set of column names.
Parameters
----------
base_name : str
The base of the new column name. Usually this does not conflict with
the existing column names, in which case this function simply returns
`b... | [
"Generate",
"a",
"new",
"column",
"name",
"that",
"is",
"guaranteed",
"not",
"to",
"conflict",
"with",
"an",
"existing",
"set",
"of",
"column",
"names",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_private_utils.py#L36-L66 |
29,166 | apple/turicreate | src/unity/python/turicreate/toolkits/_private_utils.py | _select_valid_features | def _select_valid_features(dataset, features, valid_feature_types,
target_column=None):
"""
Utility function for selecting columns of only valid feature types.
Parameters
----------
dataset: SFrame
The input SFrame containing columns of potential features.
fe... | python | def _select_valid_features(dataset, features, valid_feature_types,
target_column=None):
"""
Utility function for selecting columns of only valid feature types.
Parameters
----------
dataset: SFrame
The input SFrame containing columns of potential features.
fe... | [
"def",
"_select_valid_features",
"(",
"dataset",
",",
"features",
",",
"valid_feature_types",
",",
"target_column",
"=",
"None",
")",
":",
"if",
"features",
"is",
"not",
"None",
":",
"if",
"not",
"hasattr",
"(",
"features",
",",
"'__iter__'",
")",
":",
"rais... | Utility function for selecting columns of only valid feature types.
Parameters
----------
dataset: SFrame
The input SFrame containing columns of potential features.
features: list[str]
List of feature column names. If None, the candidate feature set is
taken to be all the colu... | [
"Utility",
"function",
"for",
"selecting",
"columns",
"of",
"only",
"valid",
"feature",
"types",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_private_utils.py#L68-L143 |
29,167 | apple/turicreate | src/unity/python/turicreate/toolkits/_private_utils.py | _check_elements_equal | def _check_elements_equal(lst):
"""
Returns true if all of the elements in the list are equal.
"""
assert isinstance(lst, list), "Input value must be a list."
return not lst or lst.count(lst[0]) == len(lst) | python | def _check_elements_equal(lst):
"""
Returns true if all of the elements in the list are equal.
"""
assert isinstance(lst, list), "Input value must be a list."
return not lst or lst.count(lst[0]) == len(lst) | [
"def",
"_check_elements_equal",
"(",
"lst",
")",
":",
"assert",
"isinstance",
"(",
"lst",
",",
"list",
")",
",",
"\"Input value must be a list.\"",
"return",
"not",
"lst",
"or",
"lst",
".",
"count",
"(",
"lst",
"[",
"0",
"]",
")",
"==",
"len",
"(",
"lst"... | Returns true if all of the elements in the list are equal. | [
"Returns",
"true",
"if",
"all",
"of",
"the",
"elements",
"in",
"the",
"list",
"are",
"equal",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_private_utils.py#L145-L150 |
29,168 | apple/turicreate | src/unity/python/turicreate/toolkits/_private_utils.py | _summarize_accessible_fields | def _summarize_accessible_fields(field_descriptions, width=40,
section_title='Accessible fields'):
"""
Create a summary string for the accessible fields in a model. Unlike
`_toolkit_repr_print`, this function does not look up the values of the
fields, it just formats the... | python | def _summarize_accessible_fields(field_descriptions, width=40,
section_title='Accessible fields'):
"""
Create a summary string for the accessible fields in a model. Unlike
`_toolkit_repr_print`, this function does not look up the values of the
fields, it just formats the... | [
"def",
"_summarize_accessible_fields",
"(",
"field_descriptions",
",",
"width",
"=",
"40",
",",
"section_title",
"=",
"'Accessible fields'",
")",
":",
"key_str",
"=",
"\"{:<{}}: {}\"",
"items",
"=",
"[",
"]",
"items",
".",
"append",
"(",
"section_title",
")",
"i... | Create a summary string for the accessible fields in a model. Unlike
`_toolkit_repr_print`, this function does not look up the values of the
fields, it just formats the names and descriptions.
Parameters
----------
field_descriptions : dict{str: str}
Name of each field and its description, ... | [
"Create",
"a",
"summary",
"string",
"for",
"the",
"accessible",
"fields",
"in",
"a",
"model",
".",
"Unlike",
"_toolkit_repr_print",
"this",
"function",
"does",
"not",
"look",
"up",
"the",
"values",
"of",
"the",
"fields",
"it",
"just",
"formats",
"the",
"name... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_private_utils.py#L219-L252 |
29,169 | apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/datatypes.py | _is_valid_datatype | def _is_valid_datatype(datatype_instance):
"""
Returns true if datatype_instance is a valid datatype object and false otherwise.
"""
# Remap so we can still use the python types for the simple cases
global _simple_type_remap
if datatype_instance in _simple_type_remap:
return True
#... | python | def _is_valid_datatype(datatype_instance):
"""
Returns true if datatype_instance is a valid datatype object and false otherwise.
"""
# Remap so we can still use the python types for the simple cases
global _simple_type_remap
if datatype_instance in _simple_type_remap:
return True
#... | [
"def",
"_is_valid_datatype",
"(",
"datatype_instance",
")",
":",
"# Remap so we can still use the python types for the simple cases",
"global",
"_simple_type_remap",
"if",
"datatype_instance",
"in",
"_simple_type_remap",
":",
"return",
"True",
"# Now set the protobuf from this interf... | Returns true if datatype_instance is a valid datatype object and false otherwise. | [
"Returns",
"true",
"if",
"datatype_instance",
"is",
"a",
"valid",
"datatype",
"object",
"and",
"false",
"otherwise",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/datatypes.py#L130-L150 |
29,170 | apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/datatypes.py | _normalize_datatype | def _normalize_datatype(datatype_instance):
"""
Translates a user specified datatype to an instance of the ones defined above.
Valid data types are passed through, and the following type specifications
are translated to the proper instances:
str, "String" -> String()
int, "Int64" -> Int64()
... | python | def _normalize_datatype(datatype_instance):
"""
Translates a user specified datatype to an instance of the ones defined above.
Valid data types are passed through, and the following type specifications
are translated to the proper instances:
str, "String" -> String()
int, "Int64" -> Int64()
... | [
"def",
"_normalize_datatype",
"(",
"datatype_instance",
")",
":",
"global",
"_simple_type_remap",
"if",
"datatype_instance",
"in",
"_simple_type_remap",
":",
"return",
"_simple_type_remap",
"[",
"datatype_instance",
"]",
"# Now set the protobuf from this interface.",
"if",
"i... | Translates a user specified datatype to an instance of the ones defined above.
Valid data types are passed through, and the following type specifications
are translated to the proper instances:
str, "String" -> String()
int, "Int64" -> Int64()
float, "Double" -> Double()
If a data type is not... | [
"Translates",
"a",
"user",
"specified",
"datatype",
"to",
"an",
"instance",
"of",
"the",
"ones",
"defined",
"above",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/datatypes.py#L152-L179 |
29,171 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/util/order.py | Order.order | def order (self, objects):
""" Given a list of objects, reorder them so that the constains specified
by 'add_pair' are satisfied.
The algorithm was adopted from an awk script by Nikita Youshchenko
(yoush at cs dot msu dot su)
"""
# The algorithm used is the s... | python | def order (self, objects):
""" Given a list of objects, reorder them so that the constains specified
by 'add_pair' are satisfied.
The algorithm was adopted from an awk script by Nikita Youshchenko
(yoush at cs dot msu dot su)
"""
# The algorithm used is the s... | [
"def",
"order",
"(",
"self",
",",
"objects",
")",
":",
"# The algorithm used is the same is standard transitive closure,",
"# except that we're not keeping in-degree for all vertices, but",
"# rather removing edges.",
"result",
"=",
"[",
"]",
"if",
"not",
"objects",
":",
"retur... | Given a list of objects, reorder them so that the constains specified
by 'add_pair' are satisfied.
The algorithm was adopted from an awk script by Nikita Youshchenko
(yoush at cs dot msu dot su) | [
"Given",
"a",
"list",
"of",
"objects",
"reorder",
"them",
"so",
"that",
"the",
"constains",
"specified",
"by",
"add_pair",
"are",
"satisfied",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/order.py#L37-L86 |
29,172 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/util/order.py | Order.__eliminate_unused_constraits | def __eliminate_unused_constraits (self, objects):
""" Eliminate constraints which mention objects not in 'objects'.
In graph-theory terms, this is finding subgraph induced by
ordered vertices.
"""
result = []
for c in self.constraints_:
if c [0] in ob... | python | def __eliminate_unused_constraits (self, objects):
""" Eliminate constraints which mention objects not in 'objects'.
In graph-theory terms, this is finding subgraph induced by
ordered vertices.
"""
result = []
for c in self.constraints_:
if c [0] in ob... | [
"def",
"__eliminate_unused_constraits",
"(",
"self",
",",
"objects",
")",
":",
"result",
"=",
"[",
"]",
"for",
"c",
"in",
"self",
".",
"constraints_",
":",
"if",
"c",
"[",
"0",
"]",
"in",
"objects",
"and",
"c",
"[",
"1",
"]",
"in",
"objects",
":",
... | Eliminate constraints which mention objects not in 'objects'.
In graph-theory terms, this is finding subgraph induced by
ordered vertices. | [
"Eliminate",
"constraints",
"which",
"mention",
"objects",
"not",
"in",
"objects",
".",
"In",
"graph",
"-",
"theory",
"terms",
"this",
"is",
"finding",
"subgraph",
"induced",
"by",
"ordered",
"vertices",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/order.py#L88-L98 |
29,173 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/util/order.py | Order.__has_no_dependents | def __has_no_dependents (self, obj, constraints):
""" Returns true if there's no constraint in 'constraints' where
'obj' comes second.
"""
failed = False
while constraints and not failed:
c = constraints [0]
if c [1] == obj:
failed = T... | python | def __has_no_dependents (self, obj, constraints):
""" Returns true if there's no constraint in 'constraints' where
'obj' comes second.
"""
failed = False
while constraints and not failed:
c = constraints [0]
if c [1] == obj:
failed = T... | [
"def",
"__has_no_dependents",
"(",
"self",
",",
"obj",
",",
"constraints",
")",
":",
"failed",
"=",
"False",
"while",
"constraints",
"and",
"not",
"failed",
":",
"c",
"=",
"constraints",
"[",
"0",
"]",
"if",
"c",
"[",
"1",
"]",
"==",
"obj",
":",
"fai... | Returns true if there's no constraint in 'constraints' where
'obj' comes second. | [
"Returns",
"true",
"if",
"there",
"s",
"no",
"constraint",
"in",
"constraints",
"where",
"obj",
"comes",
"second",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/order.py#L100-L113 |
29,174 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/property.py | path_order | def path_order (x, y):
""" Helper for as_path, below. Orders properties with the implicit ones
first, and within the two sections in alphabetical order of feature
name.
"""
if x == y:
return 0
xg = get_grist (x)
yg = get_grist (y)
if yg and not xg:
return -1
... | python | def path_order (x, y):
""" Helper for as_path, below. Orders properties with the implicit ones
first, and within the two sections in alphabetical order of feature
name.
"""
if x == y:
return 0
xg = get_grist (x)
yg = get_grist (y)
if yg and not xg:
return -1
... | [
"def",
"path_order",
"(",
"x",
",",
"y",
")",
":",
"if",
"x",
"==",
"y",
":",
"return",
"0",
"xg",
"=",
"get_grist",
"(",
"x",
")",
"yg",
"=",
"get_grist",
"(",
"y",
")",
"if",
"yg",
"and",
"not",
"xg",
":",
"return",
"-",
"1",
"elif",
"xg",
... | Helper for as_path, below. Orders properties with the implicit ones
first, and within the two sections in alphabetical order of feature
name. | [
"Helper",
"for",
"as_path",
"below",
".",
"Orders",
"properties",
"with",
"the",
"implicit",
"ones",
"first",
"and",
"within",
"the",
"two",
"sections",
"in",
"alphabetical",
"order",
"of",
"feature",
"name",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property.py#L244-L271 |
29,175 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/property.py | refine | def refine (properties, requirements):
""" Refines 'properties' by overriding any non-free properties
for which a different value is specified in 'requirements'.
Conditional requirements are just added without modification.
Returns the resulting list of properties.
"""
assert is_iter... | python | def refine (properties, requirements):
""" Refines 'properties' by overriding any non-free properties
for which a different value is specified in 'requirements'.
Conditional requirements are just added without modification.
Returns the resulting list of properties.
"""
assert is_iter... | [
"def",
"refine",
"(",
"properties",
",",
"requirements",
")",
":",
"assert",
"is_iterable_typed",
"(",
"properties",
",",
"Property",
")",
"assert",
"is_iterable_typed",
"(",
"requirements",
",",
"Property",
")",
"# The result has no duplicates, so we store it in a set",
... | Refines 'properties' by overriding any non-free properties
for which a different value is specified in 'requirements'.
Conditional requirements are just added without modification.
Returns the resulting list of properties. | [
"Refines",
"properties",
"by",
"overriding",
"any",
"non",
"-",
"free",
"properties",
"for",
"which",
"a",
"different",
"value",
"is",
"specified",
"in",
"requirements",
".",
"Conditional",
"requirements",
"are",
"just",
"added",
"without",
"modification",
".",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property.py#L277-L311 |
29,176 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/property.py | translate_paths | def translate_paths (properties, path):
""" Interpret all path properties in 'properties' as relative to 'path'
The property values are assumed to be in system-specific form, and
will be translated into normalized form.
"""
assert is_iterable_typed(properties, Property)
result = []
... | python | def translate_paths (properties, path):
""" Interpret all path properties in 'properties' as relative to 'path'
The property values are assumed to be in system-specific form, and
will be translated into normalized form.
"""
assert is_iterable_typed(properties, Property)
result = []
... | [
"def",
"translate_paths",
"(",
"properties",
",",
"path",
")",
":",
"assert",
"is_iterable_typed",
"(",
"properties",
",",
"Property",
")",
"result",
"=",
"[",
"]",
"for",
"p",
"in",
"properties",
":",
"if",
"p",
".",
"feature",
".",
"path",
":",
"values... | Interpret all path properties in 'properties' as relative to 'path'
The property values are assumed to be in system-specific form, and
will be translated into normalized form. | [
"Interpret",
"all",
"path",
"properties",
"in",
"properties",
"as",
"relative",
"to",
"path",
"The",
"property",
"values",
"are",
"assumed",
"to",
"be",
"in",
"system",
"-",
"specific",
"form",
"and",
"will",
"be",
"translated",
"into",
"normalized",
"form",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property.py#L313-L336 |
29,177 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/property.py | translate_indirect | def translate_indirect(properties, context_module):
"""Assumes that all feature values that start with '@' are
names of rules, used in 'context-module'. Such rules can be
either local to the module or global. Qualified local rules
with the name of the module."""
assert is_iterable_typed(properties, ... | python | def translate_indirect(properties, context_module):
"""Assumes that all feature values that start with '@' are
names of rules, used in 'context-module'. Such rules can be
either local to the module or global. Qualified local rules
with the name of the module."""
assert is_iterable_typed(properties, ... | [
"def",
"translate_indirect",
"(",
"properties",
",",
"context_module",
")",
":",
"assert",
"is_iterable_typed",
"(",
"properties",
",",
"Property",
")",
"assert",
"isinstance",
"(",
"context_module",
",",
"basestring",
")",
"result",
"=",
"[",
"]",
"for",
"p",
... | Assumes that all feature values that start with '@' are
names of rules, used in 'context-module'. Such rules can be
either local to the module or global. Qualified local rules
with the name of the module. | [
"Assumes",
"that",
"all",
"feature",
"values",
"that",
"start",
"with"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property.py#L338-L354 |
29,178 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/property.py | validate | def validate (properties):
""" Exit with error if any of the properties is not valid.
properties may be a single property or a sequence of properties.
"""
if isinstance(properties, Property):
properties = [properties]
assert is_iterable_typed(properties, Property)
for p in properties... | python | def validate (properties):
""" Exit with error if any of the properties is not valid.
properties may be a single property or a sequence of properties.
"""
if isinstance(properties, Property):
properties = [properties]
assert is_iterable_typed(properties, Property)
for p in properties... | [
"def",
"validate",
"(",
"properties",
")",
":",
"if",
"isinstance",
"(",
"properties",
",",
"Property",
")",
":",
"properties",
"=",
"[",
"properties",
"]",
"assert",
"is_iterable_typed",
"(",
"properties",
",",
"Property",
")",
"for",
"p",
"in",
"properties... | Exit with error if any of the properties is not valid.
properties may be a single property or a sequence of properties. | [
"Exit",
"with",
"error",
"if",
"any",
"of",
"the",
"properties",
"is",
"not",
"valid",
".",
"properties",
"may",
"be",
"a",
"single",
"property",
"or",
"a",
"sequence",
"of",
"properties",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property.py#L356-L364 |
29,179 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/property.py | select | def select (features, properties):
""" Selects properties which correspond to any of the given features.
"""
assert is_iterable_typed(properties, basestring)
result = []
# add any missing angle brackets
features = add_grist (features)
return [p for p in properties if get_grist(p) in featur... | python | def select (features, properties):
""" Selects properties which correspond to any of the given features.
"""
assert is_iterable_typed(properties, basestring)
result = []
# add any missing angle brackets
features = add_grist (features)
return [p for p in properties if get_grist(p) in featur... | [
"def",
"select",
"(",
"features",
",",
"properties",
")",
":",
"assert",
"is_iterable_typed",
"(",
"properties",
",",
"basestring",
")",
"result",
"=",
"[",
"]",
"# add any missing angle brackets",
"features",
"=",
"add_grist",
"(",
"features",
")",
"return",
"[... | Selects properties which correspond to any of the given features. | [
"Selects",
"properties",
"which",
"correspond",
"to",
"any",
"of",
"the",
"given",
"features",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property.py#L410-L419 |
29,180 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/property.py | evaluate_conditionals_in_context | def evaluate_conditionals_in_context (properties, context):
""" Removes all conditional properties which conditions are not met
For those with met conditions, removes the condition. Properies
in conditions are looked up in 'context'
"""
if __debug__:
from .property_set import Propert... | python | def evaluate_conditionals_in_context (properties, context):
""" Removes all conditional properties which conditions are not met
For those with met conditions, removes the condition. Properies
in conditions are looked up in 'context'
"""
if __debug__:
from .property_set import Propert... | [
"def",
"evaluate_conditionals_in_context",
"(",
"properties",
",",
"context",
")",
":",
"if",
"__debug__",
":",
"from",
".",
"property_set",
"import",
"PropertySet",
"assert",
"is_iterable_typed",
"(",
"properties",
",",
"Property",
")",
"assert",
"isinstance",
"(",... | Removes all conditional properties which conditions are not met
For those with met conditions, removes the condition. Properies
in conditions are looked up in 'context' | [
"Removes",
"all",
"conditional",
"properties",
"which",
"conditions",
"are",
"not",
"met",
"For",
"those",
"with",
"met",
"conditions",
"removes",
"the",
"condition",
".",
"Properies",
"in",
"conditions",
"are",
"looked",
"up",
"in",
"context"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property.py#L428-L454 |
29,181 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/property.py | change | def change (properties, feature, value = None):
""" Returns a modified version of properties with all values of the
given feature replaced by the given value.
If 'value' is None the feature will be removed.
"""
assert is_iterable_typed(properties, basestring)
assert isinstance(feature, b... | python | def change (properties, feature, value = None):
""" Returns a modified version of properties with all values of the
given feature replaced by the given value.
If 'value' is None the feature will be removed.
"""
assert is_iterable_typed(properties, basestring)
assert isinstance(feature, b... | [
"def",
"change",
"(",
"properties",
",",
"feature",
",",
"value",
"=",
"None",
")",
":",
"assert",
"is_iterable_typed",
"(",
"properties",
",",
"basestring",
")",
"assert",
"isinstance",
"(",
"feature",
",",
"basestring",
")",
"assert",
"isinstance",
"(",
"v... | Returns a modified version of properties with all values of the
given feature replaced by the given value.
If 'value' is None the feature will be removed. | [
"Returns",
"a",
"modified",
"version",
"of",
"properties",
"with",
"all",
"values",
"of",
"the",
"given",
"feature",
"replaced",
"by",
"the",
"given",
"value",
".",
"If",
"value",
"is",
"None",
"the",
"feature",
"will",
"be",
"removed",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property.py#L457-L477 |
29,182 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/property.py | __validate1 | def __validate1 (property):
""" Exit with error if property is not valid.
"""
assert isinstance(property, Property)
msg = None
if not property.feature.free:
feature.validate_value_string (property.feature, property.value) | python | def __validate1 (property):
""" Exit with error if property is not valid.
"""
assert isinstance(property, Property)
msg = None
if not property.feature.free:
feature.validate_value_string (property.feature, property.value) | [
"def",
"__validate1",
"(",
"property",
")",
":",
"assert",
"isinstance",
"(",
"property",
",",
"Property",
")",
"msg",
"=",
"None",
"if",
"not",
"property",
".",
"feature",
".",
"free",
":",
"feature",
".",
"validate_value_string",
"(",
"property",
".",
"f... | Exit with error if property is not valid. | [
"Exit",
"with",
"error",
"if",
"property",
"is",
"not",
"valid",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property.py#L483-L490 |
29,183 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/property.py | remove | def remove(attributes, properties):
"""Returns a property sets which include all the elements
in 'properties' that do not have attributes listed in 'attributes'."""
if isinstance(attributes, basestring):
attributes = [attributes]
assert is_iterable_typed(attributes, basestring)
assert is_ite... | python | def remove(attributes, properties):
"""Returns a property sets which include all the elements
in 'properties' that do not have attributes listed in 'attributes'."""
if isinstance(attributes, basestring):
attributes = [attributes]
assert is_iterable_typed(attributes, basestring)
assert is_ite... | [
"def",
"remove",
"(",
"attributes",
",",
"properties",
")",
":",
"if",
"isinstance",
"(",
"attributes",
",",
"basestring",
")",
":",
"attributes",
"=",
"[",
"attributes",
"]",
"assert",
"is_iterable_typed",
"(",
"attributes",
",",
"basestring",
")",
"assert",
... | Returns a property sets which include all the elements
in 'properties' that do not have attributes listed in 'attributes'. | [
"Returns",
"a",
"property",
"sets",
"which",
"include",
"all",
"the",
"elements",
"in",
"properties",
"that",
"do",
"not",
"have",
"attributes",
"listed",
"in",
"attributes",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property.py#L520-L539 |
29,184 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/property.py | take | def take(attributes, properties):
"""Returns a property set which include all
properties in 'properties' that have any of 'attributes'."""
assert is_iterable_typed(attributes, basestring)
assert is_iterable_typed(properties, basestring)
result = []
for e in properties:
if b2.util.set.int... | python | def take(attributes, properties):
"""Returns a property set which include all
properties in 'properties' that have any of 'attributes'."""
assert is_iterable_typed(attributes, basestring)
assert is_iterable_typed(properties, basestring)
result = []
for e in properties:
if b2.util.set.int... | [
"def",
"take",
"(",
"attributes",
",",
"properties",
")",
":",
"assert",
"is_iterable_typed",
"(",
"attributes",
",",
"basestring",
")",
"assert",
"is_iterable_typed",
"(",
"properties",
",",
"basestring",
")",
"result",
"=",
"[",
"]",
"for",
"e",
"in",
"pro... | Returns a property set which include all
properties in 'properties' that have any of 'attributes'. | [
"Returns",
"a",
"property",
"set",
"which",
"include",
"all",
"properties",
"in",
"properties",
"that",
"have",
"any",
"of",
"attributes",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property.py#L542-L551 |
29,185 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/property.py | PropertyMap.insert | def insert (self, properties, value):
""" Associate value with properties.
"""
assert is_iterable_typed(properties, basestring)
assert isinstance(value, basestring)
self.__properties.append(properties)
self.__values.append(value) | python | def insert (self, properties, value):
""" Associate value with properties.
"""
assert is_iterable_typed(properties, basestring)
assert isinstance(value, basestring)
self.__properties.append(properties)
self.__values.append(value) | [
"def",
"insert",
"(",
"self",
",",
"properties",
",",
"value",
")",
":",
"assert",
"is_iterable_typed",
"(",
"properties",
",",
"basestring",
")",
"assert",
"isinstance",
"(",
"value",
",",
"basestring",
")",
"self",
".",
"__properties",
".",
"append",
"(",
... | Associate value with properties. | [
"Associate",
"value",
"with",
"properties",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property.py#L590-L596 |
29,186 | apple/turicreate | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py | benchmark_command | def benchmark_command(cmd, progress):
"""Benchmark one command execution"""
full_cmd = '/usr/bin/time --format="%U %M" {0}'.format(cmd)
print '{0:6.2f}% Running {1}'.format(100.0 * progress, full_cmd)
(_, err) = subprocess.Popen(
['/bin/sh', '-c', full_cmd],
stdin=subprocess.PIPE,
... | python | def benchmark_command(cmd, progress):
"""Benchmark one command execution"""
full_cmd = '/usr/bin/time --format="%U %M" {0}'.format(cmd)
print '{0:6.2f}% Running {1}'.format(100.0 * progress, full_cmd)
(_, err) = subprocess.Popen(
['/bin/sh', '-c', full_cmd],
stdin=subprocess.PIPE,
... | [
"def",
"benchmark_command",
"(",
"cmd",
",",
"progress",
")",
":",
"full_cmd",
"=",
"'/usr/bin/time --format=\"%U %M\" {0}'",
".",
"format",
"(",
"cmd",
")",
"print",
"'{0:6.2f}% Running {1}'",
".",
"format",
"(",
"100.0",
"*",
"progress",
",",
"full_cmd",
")",
... | Benchmark one command execution | [
"Benchmark",
"one",
"command",
"execution"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py#L26-L45 |
29,187 | apple/turicreate | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py | benchmark_file | def benchmark_file(
filename, compiler, include_dirs, (progress_from, progress_to),
iter_count, extra_flags = ''):
"""Benchmark one file"""
time_sum = 0
mem_sum = 0
for nth_run in xrange(0, iter_count):
(time_spent, mem_used) = benchmark_command(
'{0} -std=c++11 {1} -... | python | def benchmark_file(
filename, compiler, include_dirs, (progress_from, progress_to),
iter_count, extra_flags = ''):
"""Benchmark one file"""
time_sum = 0
mem_sum = 0
for nth_run in xrange(0, iter_count):
(time_spent, mem_used) = benchmark_command(
'{0} -std=c++11 {1} -... | [
"def",
"benchmark_file",
"(",
"filename",
",",
"compiler",
",",
"include_dirs",
",",
"(",
"progress_from",
",",
"progress_to",
")",
",",
"iter_count",
",",
"extra_flags",
"=",
"''",
")",
":",
"time_sum",
"=",
"0",
"mem_sum",
"=",
"0",
"for",
"nth_run",
"in... | Benchmark one file | [
"Benchmark",
"one",
"file"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py#L48-L73 |
29,188 | apple/turicreate | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py | compiler_info | def compiler_info(compiler):
"""Determine the name + version of the compiler"""
(out, err) = subprocess.Popen(
['/bin/sh', '-c', '{0} -v'.format(compiler)],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
).communicate('')
gcc_clang = re.compile('(g... | python | def compiler_info(compiler):
"""Determine the name + version of the compiler"""
(out, err) = subprocess.Popen(
['/bin/sh', '-c', '{0} -v'.format(compiler)],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
).communicate('')
gcc_clang = re.compile('(g... | [
"def",
"compiler_info",
"(",
"compiler",
")",
":",
"(",
"out",
",",
"err",
")",
"=",
"subprocess",
".",
"Popen",
"(",
"[",
"'/bin/sh'",
",",
"'-c'",
",",
"'{0} -v'",
".",
"format",
"(",
"compiler",
")",
"]",
",",
"stdin",
"=",
"subprocess",
".",
"PIP... | Determine the name + version of the compiler | [
"Determine",
"the",
"name",
"+",
"version",
"of",
"the",
"compiler"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py#L76-L92 |
29,189 | apple/turicreate | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py | files_in_dir | def files_in_dir(path, extension):
"""Enumartes the files in path with the given extension"""
ends = '.{0}'.format(extension)
return (f for f in os.listdir(path) if f.endswith(ends)) | python | def files_in_dir(path, extension):
"""Enumartes the files in path with the given extension"""
ends = '.{0}'.format(extension)
return (f for f in os.listdir(path) if f.endswith(ends)) | [
"def",
"files_in_dir",
"(",
"path",
",",
"extension",
")",
":",
"ends",
"=",
"'.{0}'",
".",
"format",
"(",
"extension",
")",
"return",
"(",
"f",
"for",
"f",
"in",
"os",
".",
"listdir",
"(",
"path",
")",
"if",
"f",
".",
"endswith",
"(",
"ends",
")",... | Enumartes the files in path with the given extension | [
"Enumartes",
"the",
"files",
"in",
"path",
"with",
"the",
"given",
"extension"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py#L105-L108 |
29,190 | apple/turicreate | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py | format_time | def format_time(seconds):
"""Format a duration"""
minute = 60
hour = minute * 60
day = hour * 24
week = day * 7
result = []
for name, dur in [
('week', week), ('day', day), ('hour', hour),
('minute', minute), ('second', 1)
]:
if seconds > dur:
... | python | def format_time(seconds):
"""Format a duration"""
minute = 60
hour = minute * 60
day = hour * 24
week = day * 7
result = []
for name, dur in [
('week', week), ('day', day), ('hour', hour),
('minute', minute), ('second', 1)
]:
if seconds > dur:
... | [
"def",
"format_time",
"(",
"seconds",
")",
":",
"minute",
"=",
"60",
"hour",
"=",
"minute",
"*",
"60",
"day",
"=",
"hour",
"*",
"24",
"week",
"=",
"day",
"*",
"7",
"result",
"=",
"[",
"]",
"for",
"name",
",",
"dur",
"in",
"[",
"(",
"'week'",
",... | Format a duration | [
"Format",
"a",
"duration"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py#L111-L129 |
29,191 | apple/turicreate | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py | benchmark | def benchmark(src_dir, compiler, include_dirs, iter_count):
"""Do the benchmarking"""
files = list(files_in_dir(src_dir, 'cpp'))
random.shuffle(files)
has_string_templates = True
string_template_file_cnt = sum(1 for file in files if 'bmp' in file)
file_count = len(files) + string_template_file_... | python | def benchmark(src_dir, compiler, include_dirs, iter_count):
"""Do the benchmarking"""
files = list(files_in_dir(src_dir, 'cpp'))
random.shuffle(files)
has_string_templates = True
string_template_file_cnt = sum(1 for file in files if 'bmp' in file)
file_count = len(files) + string_template_file_... | [
"def",
"benchmark",
"(",
"src_dir",
",",
"compiler",
",",
"include_dirs",
",",
"iter_count",
")",
":",
"files",
"=",
"list",
"(",
"files_in_dir",
"(",
"src_dir",
",",
"'cpp'",
")",
")",
"random",
".",
"shuffle",
"(",
"files",
")",
"has_string_templates",
"... | Do the benchmarking | [
"Do",
"the",
"benchmarking"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py#L132-L174 |
29,192 | apple/turicreate | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py | plot | def plot(values, mode_names, title, (xlabel, ylabel), out_file):
"""Plot a diagram"""
matplotlib.pyplot.clf()
for mode, mode_name in mode_names.iteritems():
vals = values[mode]
matplotlib.pyplot.plot(
[x for x, _ in vals],
[y for _, y in vals],
label=mode_... | python | def plot(values, mode_names, title, (xlabel, ylabel), out_file):
"""Plot a diagram"""
matplotlib.pyplot.clf()
for mode, mode_name in mode_names.iteritems():
vals = values[mode]
matplotlib.pyplot.plot(
[x for x, _ in vals],
[y for _, y in vals],
label=mode_... | [
"def",
"plot",
"(",
"values",
",",
"mode_names",
",",
"title",
",",
"(",
"xlabel",
",",
"ylabel",
")",
",",
"out_file",
")",
":",
"matplotlib",
".",
"pyplot",
".",
"clf",
"(",
")",
"for",
"mode",
",",
"mode_name",
"in",
"mode_names",
".",
"iteritems",
... | Plot a diagram | [
"Plot",
"a",
"diagram"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py#L177-L192 |
29,193 | apple/turicreate | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py | configs_in | def configs_in(src_dir):
"""Enumerate all configs in src_dir"""
for filename in files_in_dir(src_dir, 'json'):
with open(os.path.join(src_dir, filename), 'rb') as in_f:
yield json.load(in_f) | python | def configs_in(src_dir):
"""Enumerate all configs in src_dir"""
for filename in files_in_dir(src_dir, 'json'):
with open(os.path.join(src_dir, filename), 'rb') as in_f:
yield json.load(in_f) | [
"def",
"configs_in",
"(",
"src_dir",
")",
":",
"for",
"filename",
"in",
"files_in_dir",
"(",
"src_dir",
",",
"'json'",
")",
":",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"src_dir",
",",
"filename",
")",
",",
"'rb'",
")",
"as",
"in_f"... | Enumerate all configs in src_dir | [
"Enumerate",
"all",
"configs",
"in",
"src_dir"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py#L203-L207 |
29,194 | apple/turicreate | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py | join_images | def join_images(img_files, out_file):
"""Join the list of images into the out file"""
images = [PIL.Image.open(f) for f in img_files]
joined = PIL.Image.new(
'RGB',
(sum(i.size[0] for i in images), max(i.size[1] for i in images))
)
left = 0
for img in images:
joined.paste... | python | def join_images(img_files, out_file):
"""Join the list of images into the out file"""
images = [PIL.Image.open(f) for f in img_files]
joined = PIL.Image.new(
'RGB',
(sum(i.size[0] for i in images), max(i.size[1] for i in images))
)
left = 0
for img in images:
joined.paste... | [
"def",
"join_images",
"(",
"img_files",
",",
"out_file",
")",
":",
"images",
"=",
"[",
"PIL",
".",
"Image",
".",
"open",
"(",
"f",
")",
"for",
"f",
"in",
"img_files",
"]",
"joined",
"=",
"PIL",
".",
"Image",
".",
"new",
"(",
"'RGB'",
",",
"(",
"s... | Join the list of images into the out file | [
"Join",
"the",
"list",
"of",
"images",
"into",
"the",
"out",
"file"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py#L215-L226 |
29,195 | apple/turicreate | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py | plot_temp_diagrams | def plot_temp_diagrams(config, results, temp_dir):
"""Plot temporary diagrams"""
display_name = {
'time': 'Compilation time (s)',
'memory': 'Compiler memory usage (MB)',
}
files = config['files']
img_files = []
if any('slt' in result for result in results) and 'bmp' in files.va... | python | def plot_temp_diagrams(config, results, temp_dir):
"""Plot temporary diagrams"""
display_name = {
'time': 'Compilation time (s)',
'memory': 'Compiler memory usage (MB)',
}
files = config['files']
img_files = []
if any('slt' in result for result in results) and 'bmp' in files.va... | [
"def",
"plot_temp_diagrams",
"(",
"config",
",",
"results",
",",
"temp_dir",
")",
":",
"display_name",
"=",
"{",
"'time'",
":",
"'Compilation time (s)'",
",",
"'memory'",
":",
"'Compiler memory usage (MB)'",
",",
"}",
"files",
"=",
"config",
"[",
"'files'",
"]",... | Plot temporary diagrams | [
"Plot",
"temporary",
"diagrams"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py#L229-L257 |
29,196 | apple/turicreate | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py | plot_diagram | def plot_diagram(config, results, images_dir, out_filename):
"""Plot one diagram"""
img_files = plot_temp_diagrams(config, results, images_dir)
join_images(img_files, out_filename)
for img_file in img_files:
os.remove(img_file) | python | def plot_diagram(config, results, images_dir, out_filename):
"""Plot one diagram"""
img_files = plot_temp_diagrams(config, results, images_dir)
join_images(img_files, out_filename)
for img_file in img_files:
os.remove(img_file) | [
"def",
"plot_diagram",
"(",
"config",
",",
"results",
",",
"images_dir",
",",
"out_filename",
")",
":",
"img_files",
"=",
"plot_temp_diagrams",
"(",
"config",
",",
"results",
",",
"images_dir",
")",
"join_images",
"(",
"img_files",
",",
"out_filename",
")",
"f... | Plot one diagram | [
"Plot",
"one",
"diagram"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py#L260-L265 |
29,197 | apple/turicreate | src/unity/python/turicreate/toolkits/_model.py | load_model | def load_model(location):
"""
Load any Turi Create model that was previously saved.
This function assumes the model (can be any model) was previously saved in
Turi Create model format with model.save(filename).
Parameters
----------
location : string
Location of the model to load. ... | python | def load_model(location):
"""
Load any Turi Create model that was previously saved.
This function assumes the model (can be any model) was previously saved in
Turi Create model format with model.save(filename).
Parameters
----------
location : string
Location of the model to load. ... | [
"def",
"load_model",
"(",
"location",
")",
":",
"# Check if the location is a dir_archive, if not, use glunpickler to load",
"# as pure python model",
"# If the location is a http location, skip the check, and directly proceed",
"# to load model as dir_archive. This is because",
"# 1) exists() d... | Load any Turi Create model that was previously saved.
This function assumes the model (can be any model) was previously saved in
Turi Create model format with model.save(filename).
Parameters
----------
location : string
Location of the model to load. Can be a local path or a remote URL.
... | [
"Load",
"any",
"Turi",
"Create",
"model",
"that",
"was",
"previously",
"saved",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_model.py#L30-L124 |
29,198 | apple/turicreate | src/unity/python/turicreate/toolkits/_model.py | _get_default_options_wrapper | def _get_default_options_wrapper(unity_server_model_name,
module_name='',
python_class_name='',
sdk_model = False):
"""
Internal function to return a get_default_options function.
Parameters
----------
u... | python | def _get_default_options_wrapper(unity_server_model_name,
module_name='',
python_class_name='',
sdk_model = False):
"""
Internal function to return a get_default_options function.
Parameters
----------
u... | [
"def",
"_get_default_options_wrapper",
"(",
"unity_server_model_name",
",",
"module_name",
"=",
"''",
",",
"python_class_name",
"=",
"''",
",",
"sdk_model",
"=",
"False",
")",
":",
"def",
"get_default_options_for_model",
"(",
"output_type",
"=",
"'sframe'",
")",
":"... | Internal function to return a get_default_options function.
Parameters
----------
unity_server_model_name: str
Name of the class/toolkit as registered with the unity server
module_name: str, optional
Name of the module.
python_class_name: str, optional
Name of the Python c... | [
"Internal",
"function",
"to",
"return",
"a",
"get_default_options",
"function",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_model.py#L127-L226 |
29,199 | apple/turicreate | deps/src/boost_1_68_0/tools/build/src/tools/common.py | get_invocation_command_nodefault | def get_invocation_command_nodefault(
toolset, tool, user_provided_command=[], additional_paths=[], path_last=False):
"""
A helper rule to get the command to invoke some tool. If
'user-provided-command' is not given, tries to find binary named 'tool' in
PATH and in the passed 'additional... | python | def get_invocation_command_nodefault(
toolset, tool, user_provided_command=[], additional_paths=[], path_last=False):
"""
A helper rule to get the command to invoke some tool. If
'user-provided-command' is not given, tries to find binary named 'tool' in
PATH and in the passed 'additional... | [
"def",
"get_invocation_command_nodefault",
"(",
"toolset",
",",
"tool",
",",
"user_provided_command",
"=",
"[",
"]",
",",
"additional_paths",
"=",
"[",
"]",
",",
"path_last",
"=",
"False",
")",
":",
"assert",
"isinstance",
"(",
"toolset",
",",
"basestring",
")... | A helper rule to get the command to invoke some tool. If
'user-provided-command' is not given, tries to find binary named 'tool' in
PATH and in the passed 'additional-path'. Otherwise, verifies that the first
element of 'user-provided-command' is an existing program.
This rule returns t... | [
"A",
"helper",
"rule",
"to",
"get",
"the",
"command",
"to",
"invoke",
"some",
"tool",
".",
"If",
"user",
"-",
"provided",
"-",
"command",
"is",
"not",
"given",
"tries",
"to",
"find",
"binary",
"named",
"tool",
"in",
"PATH",
"and",
"in",
"the",
"passed"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/common.py#L285-L320 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.