repo stringclasses 85
values | path stringlengths 8 121 | func_name stringlengths 1 82 | original_string stringlengths 112 65.5k | language stringclasses 1
value | code stringlengths 112 65.5k | code_tokens listlengths 20 4.09k | docstring stringlengths 3 46.3k | docstring_tokens listlengths 1 564 | sha stringclasses 85
values | url stringlengths 93 218 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
apple/turicreate | src/unity/python/turicreate/config/__init__.py | set_runtime_config | def set_runtime_config(name, value):
"""
Configures system behavior at runtime. These configuration values are also
read from environment variables at program startup if available. See
:py:func:`turicreate.config.get_runtime_config()` to get the current values for
each variable.
Note that defau... | python | def set_runtime_config(name, value):
"""
Configures system behavior at runtime. These configuration values are also
read from environment variables at program startup if available. See
:py:func:`turicreate.config.get_runtime_config()` to get the current values for
each variable.
Note that defau... | [
"def",
"set_runtime_config",
"(",
"name",
",",
"value",
")",
":",
"from",
".",
".",
"_connect",
"import",
"main",
"as",
"_glconnect",
"unity",
"=",
"_glconnect",
".",
"get_unity",
"(",
")",
"ret",
"=",
"unity",
".",
"set_global",
"(",
"name",
",",
"value... | Configures system behavior at runtime. These configuration values are also
read from environment variables at program startup if available. See
:py:func:`turicreate.config.get_runtime_config()` to get the current values for
each variable.
Note that defaults may change across versions and the names
... | [
"Configures",
"system",
"behavior",
"at",
"runtime",
".",
"These",
"configuration",
"values",
"are",
"also",
"read",
"from",
"environment",
"variables",
"at",
"program",
"startup",
"if",
"available",
".",
"See",
":",
"py",
":",
"func",
":",
"turicreate",
".",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/config/__init__.py#L191-L306 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sgraph.py | _vertex_data_to_sframe | def _vertex_data_to_sframe(data, vid_field):
"""
Convert data into a vertex data sframe. Using vid_field to identify the id
column. The returned sframe will have id column name '__id'.
"""
if isinstance(data, SFrame):
# '__id' already in the sframe, and it is ok to not specify vid_field
... | python | def _vertex_data_to_sframe(data, vid_field):
"""
Convert data into a vertex data sframe. Using vid_field to identify the id
column. The returned sframe will have id column name '__id'.
"""
if isinstance(data, SFrame):
# '__id' already in the sframe, and it is ok to not specify vid_field
... | [
"def",
"_vertex_data_to_sframe",
"(",
"data",
",",
"vid_field",
")",
":",
"if",
"isinstance",
"(",
"data",
",",
"SFrame",
")",
":",
"# '__id' already in the sframe, and it is ok to not specify vid_field",
"if",
"vid_field",
"is",
"None",
"and",
"_VID_COLUMN",
"in",
"d... | Convert data into a vertex data sframe. Using vid_field to identify the id
column. The returned sframe will have id column name '__id'. | [
"Convert",
"data",
"into",
"a",
"vertex",
"data",
"sframe",
".",
"Using",
"vid_field",
"to",
"identify",
"the",
"id",
"column",
".",
"The",
"returned",
"sframe",
"will",
"have",
"id",
"column",
"name",
"__id",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sgraph.py#L1326-L1368 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sgraph.py | _edge_data_to_sframe | def _edge_data_to_sframe(data, src_field, dst_field):
"""
Convert data into an edge data sframe. Using src_field and dst_field to
identify the source and target id column. The returned sframe will have id
column name '__src_id', '__dst_id'
"""
if isinstance(data, SFrame):
# '__src_vid' a... | python | def _edge_data_to_sframe(data, src_field, dst_field):
"""
Convert data into an edge data sframe. Using src_field and dst_field to
identify the source and target id column. The returned sframe will have id
column name '__src_id', '__dst_id'
"""
if isinstance(data, SFrame):
# '__src_vid' a... | [
"def",
"_edge_data_to_sframe",
"(",
"data",
",",
"src_field",
",",
"dst_field",
")",
":",
"if",
"isinstance",
"(",
"data",
",",
"SFrame",
")",
":",
"# '__src_vid' and '__dst_vid' already in the sframe, and",
"# it is ok to not specify src_field and dst_field",
"if",
"src_fi... | Convert data into an edge data sframe. Using src_field and dst_field to
identify the source and target id column. The returned sframe will have id
column name '__src_id', '__dst_id' | [
"Convert",
"data",
"into",
"an",
"edge",
"data",
"sframe",
".",
"Using",
"src_field",
"and",
"dst_field",
"to",
"identify",
"the",
"source",
"and",
"target",
"id",
"column",
".",
"The",
"returned",
"sframe",
"will",
"have",
"id",
"column",
"name",
"__src_id"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sgraph.py#L1371-L1424 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sgraph.py | SGraph.get_vertices | def get_vertices(self, ids=[], fields={}, format='sframe'):
"""
get_vertices(self, ids=list(), fields={}, format='sframe')
Return a collection of vertices and their attributes.
Parameters
----------
ids : list [int | float | str] or SArray
List of vertex IDs... | python | def get_vertices(self, ids=[], fields={}, format='sframe'):
"""
get_vertices(self, ids=list(), fields={}, format='sframe')
Return a collection of vertices and their attributes.
Parameters
----------
ids : list [int | float | str] or SArray
List of vertex IDs... | [
"def",
"get_vertices",
"(",
"self",
",",
"ids",
"=",
"[",
"]",
",",
"fields",
"=",
"{",
"}",
",",
"format",
"=",
"'sframe'",
")",
":",
"if",
"not",
"_is_non_string_iterable",
"(",
"ids",
")",
":",
"ids",
"=",
"[",
"ids",
"]",
"if",
"type",
"(",
"... | get_vertices(self, ids=list(), fields={}, format='sframe')
Return a collection of vertices and their attributes.
Parameters
----------
ids : list [int | float | str] or SArray
List of vertex IDs to retrieve. Only vertices in this list will be
returned. Also acce... | [
"get_vertices",
"(",
"self",
"ids",
"=",
"list",
"()",
"fields",
"=",
"{}",
"format",
"=",
"sframe",
")",
"Return",
"a",
"collection",
"of",
"vertices",
"and",
"their",
"attributes",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sgraph.py#L387-L478 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sgraph.py | SGraph.get_edges | def get_edges(self, src_ids=[], dst_ids=[], fields={}, format='sframe'):
"""
get_edges(self, src_ids=list(), dst_ids=list(), fields={}, format='sframe')
Return a collection of edges and their attributes. This function is used
to find edges by vertex IDs, filter on edge attributes, or lis... | python | def get_edges(self, src_ids=[], dst_ids=[], fields={}, format='sframe'):
"""
get_edges(self, src_ids=list(), dst_ids=list(), fields={}, format='sframe')
Return a collection of edges and their attributes. This function is used
to find edges by vertex IDs, filter on edge attributes, or lis... | [
"def",
"get_edges",
"(",
"self",
",",
"src_ids",
"=",
"[",
"]",
",",
"dst_ids",
"=",
"[",
"]",
",",
"fields",
"=",
"{",
"}",
",",
"format",
"=",
"'sframe'",
")",
":",
"if",
"not",
"_is_non_string_iterable",
"(",
"src_ids",
")",
":",
"src_ids",
"=",
... | get_edges(self, src_ids=list(), dst_ids=list(), fields={}, format='sframe')
Return a collection of edges and their attributes. This function is used
to find edges by vertex IDs, filter on edge attributes, or list in-out
neighbors of vertex sets.
Parameters
----------
src... | [
"get_edges",
"(",
"self",
"src_ids",
"=",
"list",
"()",
"dst_ids",
"=",
"list",
"()",
"fields",
"=",
"{}",
"format",
"=",
"sframe",
")",
"Return",
"a",
"collection",
"of",
"edges",
"and",
"their",
"attributes",
".",
"This",
"function",
"is",
"used",
"to"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sgraph.py#L480-L587 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sgraph.py | SGraph.add_vertices | def add_vertices(self, vertices, vid_field=None):
"""
Add vertices to the SGraph. Vertices should be input as a list of
:class:`~turicreate.Vertex` objects, an :class:`~turicreate.SFrame`, or a
pandas DataFrame. If vertices are specified by SFrame or DataFrame,
``vid_field`` spec... | python | def add_vertices(self, vertices, vid_field=None):
"""
Add vertices to the SGraph. Vertices should be input as a list of
:class:`~turicreate.Vertex` objects, an :class:`~turicreate.SFrame`, or a
pandas DataFrame. If vertices are specified by SFrame or DataFrame,
``vid_field`` spec... | [
"def",
"add_vertices",
"(",
"self",
",",
"vertices",
",",
"vid_field",
"=",
"None",
")",
":",
"sf",
"=",
"_vertex_data_to_sframe",
"(",
"vertices",
",",
"vid_field",
")",
"with",
"cython_context",
"(",
")",
":",
"proxy",
"=",
"self",
".",
"__proxy__",
".",... | Add vertices to the SGraph. Vertices should be input as a list of
:class:`~turicreate.Vertex` objects, an :class:`~turicreate.SFrame`, or a
pandas DataFrame. If vertices are specified by SFrame or DataFrame,
``vid_field`` specifies which column contains the vertex ID. Remaining
columns a... | [
"Add",
"vertices",
"to",
"the",
"SGraph",
".",
"Vertices",
"should",
"be",
"input",
"as",
"a",
"list",
"of",
":",
"class",
":",
"~turicreate",
".",
"Vertex",
"objects",
"an",
":",
"class",
":",
"~turicreate",
".",
"SFrame",
"or",
"a",
"pandas",
"DataFram... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sgraph.py#L589-L652 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sgraph.py | SGraph.add_edges | def add_edges(self, edges, src_field=None, dst_field=None):
"""
Add edges to the SGraph. Edges should be input as a list of
:class:`~turicreate.Edge` objects, an :class:`~turicreate.SFrame`, or a
Pandas DataFrame. If the new edges are in an SFrame or DataFrame, then
``src_field``... | python | def add_edges(self, edges, src_field=None, dst_field=None):
"""
Add edges to the SGraph. Edges should be input as a list of
:class:`~turicreate.Edge` objects, an :class:`~turicreate.SFrame`, or a
Pandas DataFrame. If the new edges are in an SFrame or DataFrame, then
``src_field``... | [
"def",
"add_edges",
"(",
"self",
",",
"edges",
",",
"src_field",
"=",
"None",
",",
"dst_field",
"=",
"None",
")",
":",
"sf",
"=",
"_edge_data_to_sframe",
"(",
"edges",
",",
"src_field",
",",
"dst_field",
")",
"with",
"cython_context",
"(",
")",
":",
"pro... | Add edges to the SGraph. Edges should be input as a list of
:class:`~turicreate.Edge` objects, an :class:`~turicreate.SFrame`, or a
Pandas DataFrame. If the new edges are in an SFrame or DataFrame, then
``src_field`` and ``dst_field`` are required to specify the columns that
contain the ... | [
"Add",
"edges",
"to",
"the",
"SGraph",
".",
"Edges",
"should",
"be",
"input",
"as",
"a",
"list",
"of",
":",
"class",
":",
"~turicreate",
".",
"Edge",
"objects",
"an",
":",
"class",
":",
"~turicreate",
".",
"SFrame",
"or",
"a",
"Pandas",
"DataFrame",
".... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sgraph.py#L654-L724 | train |
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 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sgraph.py | SGraph.triple_apply | def triple_apply(self, triple_apply_fn, mutated_fields, input_fields=None):
'''
Apply a transform function to each edge and its associated source and
target vertices in parallel. Each edge is visited once and in parallel.
Modification to vertex data is protected by lock. The effect on th... | python | def triple_apply(self, triple_apply_fn, mutated_fields, input_fields=None):
'''
Apply a transform function to each edge and its associated source and
target vertices in parallel. Each edge is visited once and in parallel.
Modification to vertex data is protected by lock. The effect on th... | [
"def",
"triple_apply",
"(",
"self",
",",
"triple_apply_fn",
",",
"mutated_fields",
",",
"input_fields",
"=",
"None",
")",
":",
"assert",
"inspect",
".",
"isfunction",
"(",
"triple_apply_fn",
")",
",",
"\"Input must be a function\"",
"if",
"not",
"(",
"type",
"("... | Apply a transform function to each edge and its associated source and
target vertices in parallel. Each edge is visited once and in parallel.
Modification to vertex data is protected by lock. The effect on the
returned SGraph is equivalent to the following pseudocode:
>>> PARALLEL FOR (... | [
"Apply",
"a",
"transform",
"function",
"to",
"each",
"edge",
"and",
"its",
"associated",
"source",
"and",
"target",
"vertices",
"in",
"parallel",
".",
"Each",
"edge",
"is",
"visited",
"once",
"and",
"in",
"parallel",
".",
"Modification",
"to",
"vertex",
"dat... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sgraph.py#L868-L1012 | train |
apple/turicreate | src/unity/python/turicreate/data_structures/sgraph.py | SGraph.save | def save(self, filename, format='auto'):
"""
Save the SGraph to disk. If the graph is saved in binary format, the
graph can be re-loaded using the :py:func:`load_sgraph` method.
Alternatively, the SGraph can be saved in JSON format for a
human-readable and portable representation... | python | def save(self, filename, format='auto'):
"""
Save the SGraph to disk. If the graph is saved in binary format, the
graph can be re-loaded using the :py:func:`load_sgraph` method.
Alternatively, the SGraph can be saved in JSON format for a
human-readable and portable representation... | [
"def",
"save",
"(",
"self",
",",
"filename",
",",
"format",
"=",
"'auto'",
")",
":",
"if",
"format",
"is",
"'auto'",
":",
"if",
"filename",
".",
"endswith",
"(",
"(",
"'.json'",
",",
"'.json.gz'",
")",
")",
":",
"format",
"=",
"'json'",
"else",
":",
... | Save the SGraph to disk. If the graph is saved in binary format, the
graph can be re-loaded using the :py:func:`load_sgraph` method.
Alternatively, the SGraph can be saved in JSON format for a
human-readable and portable representation.
Parameters
----------
filename : s... | [
"Save",
"the",
"SGraph",
"to",
"disk",
".",
"If",
"the",
"graph",
"is",
"saved",
"in",
"binary",
"format",
"the",
"graph",
"can",
"be",
"re",
"-",
"loaded",
"using",
"the",
":",
"py",
":",
"func",
":",
"load_sgraph",
"method",
".",
"Alternatively",
"th... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/data_structures/sgraph.py#L1014-L1061 | train |
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 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/classifier/boosted_trees_classifier.py | create | def create(dataset, target,
features=None, max_iterations=10,
validation_set='auto',
class_weights = None,
max_depth=6, step_size=0.3,
min_loss_reduction=0.0, min_child_weight=0.1,
row_subsample=1.0, column_subsample=1.0,
verbose=True,
... | python | def create(dataset, target,
features=None, max_iterations=10,
validation_set='auto',
class_weights = None,
max_depth=6, step_size=0.3,
min_loss_reduction=0.0, min_child_weight=0.1,
row_subsample=1.0, column_subsample=1.0,
verbose=True,
... | [
"def",
"create",
"(",
"dataset",
",",
"target",
",",
"features",
"=",
"None",
",",
"max_iterations",
"=",
"10",
",",
"validation_set",
"=",
"'auto'",
",",
"class_weights",
"=",
"None",
",",
"max_depth",
"=",
"6",
",",
"step_size",
"=",
"0.3",
",",
"min_l... | Create a (binary or multi-class) classifier model of type
:class:`~turicreate.boosted_trees_classifier.BoostedTreesClassifier` using
gradient boosted trees (sometimes known as GBMs).
Parameters
----------
dataset : SFrame
A training dataset containing feature columns and a target column.
... | [
"Create",
"a",
"(",
"binary",
"or",
"multi",
"-",
"class",
")",
"classifier",
"model",
"of",
"type",
":",
"class",
":",
"~turicreate",
".",
"boosted_trees_classifier",
".",
"BoostedTreesClassifier",
"using",
"gradient",
"boosted",
"trees",
"(",
"sometimes",
"kno... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/classifier/boosted_trees_classifier.py#L450-L638 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/classifier/boosted_trees_classifier.py | BoostedTreesClassifier.classify | def classify(self, dataset, missing_value_action='auto'):
"""
Return a classification, for each example in the ``dataset``, using the
trained boosted trees model. The output SFrame contains predictions
as class labels (0 or 1) and probabilities associated with the the example.
P... | python | def classify(self, dataset, missing_value_action='auto'):
"""
Return a classification, for each example in the ``dataset``, using the
trained boosted trees model. The output SFrame contains predictions
as class labels (0 or 1) and probabilities associated with the the example.
P... | [
"def",
"classify",
"(",
"self",
",",
"dataset",
",",
"missing_value_action",
"=",
"'auto'",
")",
":",
"return",
"super",
"(",
"BoostedTreesClassifier",
",",
"self",
")",
".",
"classify",
"(",
"dataset",
",",
"missing_value_action",
"=",
"missing_value_action",
"... | Return a classification, for each example in the ``dataset``, using the
trained boosted trees model. The output SFrame contains predictions
as class labels (0 or 1) and probabilities associated with the the example.
Parameters
----------
dataset : SFrame
Dataset of n... | [
"Return",
"a",
"classification",
"for",
"each",
"example",
"in",
"the",
"dataset",
"using",
"the",
"trained",
"boosted",
"trees",
"model",
".",
"The",
"output",
"SFrame",
"contains",
"predictions",
"as",
"class",
"labels",
"(",
"0",
"or",
"1",
")",
"and",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/classifier/boosted_trees_classifier.py#L365-L413 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/classifier/boosted_trees_classifier.py | BoostedTreesClassifier.export_coreml | def export_coreml(self, filename):
"""
Export the model in Core ML format.
Parameters
----------
filename: str
A valid filename where the model can be saved.
Examples
--------
>>> model.export_coreml("MyModel.mlmodel")
"""
from ... | python | def export_coreml(self, filename):
"""
Export the model in Core ML format.
Parameters
----------
filename: str
A valid filename where the model can be saved.
Examples
--------
>>> model.export_coreml("MyModel.mlmodel")
"""
from ... | [
"def",
"export_coreml",
"(",
"self",
",",
"filename",
")",
":",
"from",
"turicreate",
".",
"toolkits",
"import",
"_coreml_utils",
"display_name",
"=",
"\"boosted trees classifier\"",
"short_description",
"=",
"_coreml_utils",
".",
"_mlmodel_short_description",
"(",
"dis... | Export the model in Core ML format.
Parameters
----------
filename: str
A valid filename where the model can be saved.
Examples
--------
>>> model.export_coreml("MyModel.mlmodel") | [
"Export",
"the",
"model",
"in",
"Core",
"ML",
"format",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/classifier/boosted_trees_classifier.py#L423-L448 | train |
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 | train |
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 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/graph_analytics/_model_base.py | GraphAnalyticsModel._get_summary_struct | def _get_summary_struct(self):
"""
Returns a structured description of the model, including (where relevant)
the schema of the training data, description of the training data,
training statistics, and model hyperparameters.
Returns
-------
sections : list (of lis... | python | def _get_summary_struct(self):
"""
Returns a structured description of the model, including (where relevant)
the schema of the training data, description of the training data,
training statistics, and model hyperparameters.
Returns
-------
sections : list (of lis... | [
"def",
"_get_summary_struct",
"(",
"self",
")",
":",
"g",
"=",
"self",
".",
"graph",
"section_titles",
"=",
"[",
"'Graph'",
"]",
"graph_summary",
"=",
"[",
"(",
"k",
",",
"_precomputed_field",
"(",
"v",
")",
")",
"for",
"k",
",",
"v",
"in",
"six",
".... | Returns a structured description of the model, including (where relevant)
the schema of the training data, description of the training data,
training statistics, and model hyperparameters.
Returns
-------
sections : list (of list of tuples)
A list of summary sections... | [
"Returns",
"a",
"structured",
"description",
"of",
"the",
"model",
"including",
"(",
"where",
"relevant",
")",
"the",
"schema",
"of",
"the",
"training",
"data",
"description",
"of",
"the",
"training",
"data",
"training",
"statistics",
"and",
"model",
"hyperparam... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/graph_analytics/_model_base.py#L90-L130 | train |
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 | train |
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 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/sound_classifier/vggish_input.py | wavfile_to_examples | def wavfile_to_examples(wav_file):
"""Convenience wrapper around waveform_to_examples() for a common WAV format.
Args:
wav_file: String path to a file, or a file-like object. The file
is assumed to contain WAV audio data with signed 16-bit PCM samples.
Returns:
See waveform_to_examples.
"""
from... | python | def wavfile_to_examples(wav_file):
"""Convenience wrapper around waveform_to_examples() for a common WAV format.
Args:
wav_file: String path to a file, or a file-like object. The file
is assumed to contain WAV audio data with signed 16-bit PCM samples.
Returns:
See waveform_to_examples.
"""
from... | [
"def",
"wavfile_to_examples",
"(",
"wav_file",
")",
":",
"from",
"scipy",
".",
"io",
"import",
"wavfile",
"sr",
",",
"wav_data",
"=",
"wavfile",
".",
"read",
"(",
"wav_file",
")",
"assert",
"wav_data",
".",
"dtype",
"==",
"np",
".",
"int16",
",",
"'Bad s... | Convenience wrapper around waveform_to_examples() for a common WAV format.
Args:
wav_file: String path to a file, or a file-like object. The file
is assumed to contain WAV audio data with signed 16-bit PCM samples.
Returns:
See waveform_to_examples. | [
"Convenience",
"wrapper",
"around",
"waveform_to_examples",
"()",
"for",
"a",
"common",
"WAV",
"format",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/sound_classifier/vggish_input.py#L74-L88 | train |
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 | train |
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 | train |
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 | train |
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 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/build_request.py | from_command_line | def from_command_line(command_line):
"""Takes the command line tokens (such as taken from ARGV rule)
and constructs build request from it. Returns a list of two
lists. First is the set of targets specified in the command line,
and second is the set of requested build properties."""
assert is_iterabl... | python | def from_command_line(command_line):
"""Takes the command line tokens (such as taken from ARGV rule)
and constructs build request from it. Returns a list of two
lists. First is the set of targets specified in the command line,
and second is the set of requested build properties."""
assert is_iterabl... | [
"def",
"from_command_line",
"(",
"command_line",
")",
":",
"assert",
"is_iterable_typed",
"(",
"command_line",
",",
"basestring",
")",
"targets",
"=",
"[",
"]",
"properties",
"=",
"[",
"]",
"for",
"e",
"in",
"command_line",
":",
"if",
"e",
"[",
":",
"1",
... | Takes the command line tokens (such as taken from ARGV rule)
and constructs build request from it. Returns a list of two
lists. First is the set of targets specified in the command line,
and second is the set of requested build properties. | [
"Takes",
"the",
"command",
"line",
"tokens",
"(",
"such",
"as",
"taken",
"from",
"ARGV",
"rule",
")",
"and",
"constructs",
"build",
"request",
"from",
"it",
".",
"Returns",
"a",
"list",
"of",
"two",
"lists",
".",
"First",
"is",
"the",
"set",
"of",
"tar... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/build_request.py#L108-L126 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
apple/turicreate | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py | main | def main():
"""The main function of the script"""
desc = 'Generate files to benchmark'
parser = argparse.ArgumentParser(description=desc)
parser.add_argument(
'--src',
dest='src_dir',
default='src',
help='The directory containing the templates'
)
parser.add_argume... | python | def main():
"""The main function of the script"""
desc = 'Generate files to benchmark'
parser = argparse.ArgumentParser(description=desc)
parser.add_argument(
'--src',
dest='src_dir',
default='src',
help='The directory containing the templates'
)
parser.add_argume... | [
"def",
"main",
"(",
")",
":",
"desc",
"=",
"'Generate files to benchmark'",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"desc",
")",
"parser",
".",
"add_argument",
"(",
"'--src'",
",",
"dest",
"=",
"'src_dir'",
",",
"default",
... | The main function of the script | [
"The",
"main",
"function",
"of",
"the",
"script"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py#L238-L295 | train |
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 | train |
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 | train |
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 | train |
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 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/models/pipeline.py | Pipeline.add_model | def add_model(self, spec):
"""
Add a protobuf spec or :py:class:`models.MLModel` instance to the pipeline.
All input features of this model must either match the input_features
of the pipeline, or match the outputs of a previous model.
Parameters
----------
spec... | python | def add_model(self, spec):
"""
Add a protobuf spec or :py:class:`models.MLModel` instance to the pipeline.
All input features of this model must either match the input_features
of the pipeline, or match the outputs of a previous model.
Parameters
----------
spec... | [
"def",
"add_model",
"(",
"self",
",",
"spec",
")",
":",
"if",
"isinstance",
"(",
"spec",
",",
"_model",
".",
"MLModel",
")",
":",
"spec",
"=",
"spec",
".",
"_spec",
"pipeline",
"=",
"self",
".",
"spec",
".",
"pipeline",
"step_spec",
"=",
"pipeline",
... | Add a protobuf spec or :py:class:`models.MLModel` instance to the pipeline.
All input features of this model must either match the input_features
of the pipeline, or match the outputs of a previous model.
Parameters
----------
spec: [MLModel, Model_pb2]
A protobuf s... | [
"Add",
"a",
"protobuf",
"spec",
"or",
":",
"py",
":",
"class",
":",
"models",
".",
"MLModel",
"instance",
"to",
"the",
"pipeline",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/pipeline.py#L61-L79 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/deps/protobuf/python/setup.py | GetVersion | def GetVersion():
"""Gets the version from google/protobuf/__init__.py
Do not import google.protobuf.__init__ directly, because an installed
protobuf library may be loaded instead."""
with open(os.path.join('google', 'protobuf', '__init__.py')) as version_file:
exec(version_file.read(), globals())
ret... | python | def GetVersion():
"""Gets the version from google/protobuf/__init__.py
Do not import google.protobuf.__init__ directly, because an installed
protobuf library may be loaded instead."""
with open(os.path.join('google', 'protobuf', '__init__.py')) as version_file:
exec(version_file.read(), globals())
ret... | [
"def",
"GetVersion",
"(",
")",
":",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"'google'",
",",
"'protobuf'",
",",
"'__init__.py'",
")",
")",
"as",
"version_file",
":",
"exec",
"(",
"version_file",
".",
"read",
"(",
")",
",",
"globals",
... | Gets the version from google/protobuf/__init__.py
Do not import google.protobuf.__init__ directly, because an installed
protobuf library may be loaded instead. | [
"Gets",
"the",
"version",
"from",
"google",
"/",
"protobuf",
"/",
"__init__",
".",
"py"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/setup.py#L39-L47 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
apple/turicreate | src/unity/python/turicreate/toolkits/_private_utils.py | _validate_lists | def _validate_lists(sa, allowed_types=[str], require_same_type=True,
require_equal_length=False, num_to_check=10):
"""
For a list-typed SArray, check whether the first elements are lists that
- contain only the provided types
- all have the same lengths (optionally)
Parameters
... | python | def _validate_lists(sa, allowed_types=[str], require_same_type=True,
require_equal_length=False, num_to_check=10):
"""
For a list-typed SArray, check whether the first elements are lists that
- contain only the provided types
- all have the same lengths (optionally)
Parameters
... | [
"def",
"_validate_lists",
"(",
"sa",
",",
"allowed_types",
"=",
"[",
"str",
"]",
",",
"require_same_type",
"=",
"True",
",",
"require_equal_length",
"=",
"False",
",",
"num_to_check",
"=",
"10",
")",
":",
"if",
"len",
"(",
"sa",
")",
"==",
"0",
":",
"r... | For a list-typed SArray, check whether the first elements are lists that
- contain only the provided types
- all have the same lengths (optionally)
Parameters
----------
sa : SArray
An SArray containing lists.
allowed_types : list
A list of types that are allowed in each list.
... | [
"For",
"a",
"list",
"-",
"typed",
"SArray",
"check",
"whether",
"the",
"first",
"elements",
"are",
"lists",
"that",
"-",
"contain",
"only",
"the",
"provided",
"types",
"-",
"all",
"have",
"the",
"same",
"lengths",
"(",
"optionally",
")"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_private_utils.py#L152-L217 | train |
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 | train |
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 | train |
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 | train |
apple/turicreate | src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_gradient_boosting_classifier.py | convert | def convert(model, feature_names, target):
"""Convert a boosted tree model to protobuf format.
Parameters
----------
decision_tree : GradientBoostingClassifier
A trained scikit-learn tree model.
feature_names: [str]
Name of the input columns.
target: str
Name of the ou... | python | def convert(model, feature_names, target):
"""Convert a boosted tree model to protobuf format.
Parameters
----------
decision_tree : GradientBoostingClassifier
A trained scikit-learn tree model.
feature_names: [str]
Name of the input columns.
target: str
Name of the ou... | [
"def",
"convert",
"(",
"model",
",",
"feature_names",
",",
"target",
")",
":",
"if",
"not",
"(",
"_HAS_SKLEARN",
")",
":",
"raise",
"RuntimeError",
"(",
"'scikit-learn not found. scikit-learn conversion API is disabled.'",
")",
"_sklearn_util",
".",
"check_expected_type... | Convert a boosted tree model to protobuf format.
Parameters
----------
decision_tree : GradientBoostingClassifier
A trained scikit-learn tree model.
feature_names: [str]
Name of the input columns.
target: str
Name of the output column.
Returns
-------
model_sp... | [
"Convert",
"a",
"boosted",
"tree",
"model",
"to",
"protobuf",
"format",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_gradient_boosting_classifier.py#L19-L62 | train |
apple/turicreate | src/unity/python/turicreate/meta/asttools/visitors/symbol_visitor.py | get_symbols | def get_symbols(node, ctx_types=(ast.Load, ast.Store)):
'''
Returns all symbols defined in an ast node.
if ctx_types is given, then restrict the symbols to ones with that context.
:param node: ast node
:param ctx_types: type or tuple of types that may be found assigned to the `ctx` attrib... | python | def get_symbols(node, ctx_types=(ast.Load, ast.Store)):
'''
Returns all symbols defined in an ast node.
if ctx_types is given, then restrict the symbols to ones with that context.
:param node: ast node
:param ctx_types: type or tuple of types that may be found assigned to the `ctx` attrib... | [
"def",
"get_symbols",
"(",
"node",
",",
"ctx_types",
"=",
"(",
"ast",
".",
"Load",
",",
"ast",
".",
"Store",
")",
")",
":",
"gen",
"=",
"SymbolVisitor",
"(",
"ctx_types",
")",
"return",
"gen",
".",
"visit",
"(",
"node",
")"
] | Returns all symbols defined in an ast node.
if ctx_types is given, then restrict the symbols to ones with that context.
:param node: ast node
:param ctx_types: type or tuple of types that may be found assigned to the `ctx` attribute of
an ast Name node. | [
"Returns",
"all",
"symbols",
"defined",
"in",
"an",
"ast",
"node",
".",
"if",
"ctx_types",
"is",
"given",
"then",
"restrict",
"the",
"symbols",
"to",
"ones",
"with",
"that",
"context",
".",
":",
"param",
"node",
":",
"ast",
"node",
":",
"param",
"ctx_typ... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/asttools/visitors/symbol_visitor.py#L58-L70 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/build/property.py | split_conditional | def split_conditional (property):
""" If 'property' is conditional property, returns
condition and the property, e.g
<variant>debug,<toolset>gcc:<inlining>full will become
<variant>debug,<toolset>gcc <inlining>full.
Otherwise, returns empty string.
"""
assert isinstance(prope... | python | def split_conditional (property):
""" If 'property' is conditional property, returns
condition and the property, e.g
<variant>debug,<toolset>gcc:<inlining>full will become
<variant>debug,<toolset>gcc <inlining>full.
Otherwise, returns empty string.
"""
assert isinstance(prope... | [
"def",
"split_conditional",
"(",
"property",
")",
":",
"assert",
"isinstance",
"(",
"property",
",",
"basestring",
")",
"m",
"=",
"__re_split_conditional",
".",
"match",
"(",
"property",
")",
"if",
"m",
":",
"return",
"(",
"m",
".",
"group",
"(",
"1",
")... | If 'property' is conditional property, returns
condition and the property, e.g
<variant>debug,<toolset>gcc:<inlining>full will become
<variant>debug,<toolset>gcc <inlining>full.
Otherwise, returns empty string. | [
"If",
"property",
"is",
"conditional",
"property",
"returns",
"condition",
"and",
"the",
"property",
"e",
".",
"g",
"<variant",
">",
"debug",
"<toolset",
">",
"gcc",
":",
"<inlining",
">",
"full",
"will",
"become",
"<variant",
">",
"debug",
"<toolset",
">",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property.py#L394-L407 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
apple/turicreate | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py | plot_diagrams | def plot_diagrams(results, configs, compiler, out_dir):
"""Plot all diagrams specified by the configs"""
compiler_fn = make_filename(compiler)
total = psutil.virtual_memory().total # pylint:disable=I0011,E1101
memory = int(math.ceil(byte_to_gb(total)))
images_dir = os.path.join(out_dir, 'images')
... | python | def plot_diagrams(results, configs, compiler, out_dir):
"""Plot all diagrams specified by the configs"""
compiler_fn = make_filename(compiler)
total = psutil.virtual_memory().total # pylint:disable=I0011,E1101
memory = int(math.ceil(byte_to_gb(total)))
images_dir = os.path.join(out_dir, 'images')
... | [
"def",
"plot_diagrams",
"(",
"results",
",",
"configs",
",",
"compiler",
",",
"out_dir",
")",
":",
"compiler_fn",
"=",
"make_filename",
"(",
"compiler",
")",
"total",
"=",
"psutil",
".",
"virtual_memory",
"(",
")",
".",
"total",
"# pylint:disable=I0011,E1101",
... | Plot all diagrams specified by the configs | [
"Plot",
"all",
"diagrams",
"specified",
"by",
"the",
"configs"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py#L268-L295 | train |
apple/turicreate | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py | main | def main():
"""The main function of the script"""
desc = 'Benchmark the files generated by generate.py'
parser = argparse.ArgumentParser(description=desc)
parser.add_argument(
'--src',
dest='src_dir',
default='generated',
help='The directory containing the sources to benc... | python | def main():
"""The main function of the script"""
desc = 'Benchmark the files generated by generate.py'
parser = argparse.ArgumentParser(description=desc)
parser.add_argument(
'--src',
dest='src_dir',
default='generated',
help='The directory containing the sources to benc... | [
"def",
"main",
"(",
")",
":",
"desc",
"=",
"'Benchmark the files generated by generate.py'",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"desc",
")",
"parser",
".",
"add_argument",
"(",
"'--src'",
",",
"dest",
"=",
"'src_dir'",
","... | The main function of the script | [
"The",
"main",
"function",
"of",
"the",
"script"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py#L298-L350 | train |
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 | train |
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 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/tools/common.py | reset | def reset ():
""" Clear the module state. This is mainly for testing purposes.
Note that this must be called _after_ resetting the module 'feature'.
"""
global __had_unspecified_value, __had_value, __declared_subfeature
global __init_loc
global __all_signatures, __debug_configuration, __show... | python | def reset ():
""" Clear the module state. This is mainly for testing purposes.
Note that this must be called _after_ resetting the module 'feature'.
"""
global __had_unspecified_value, __had_value, __declared_subfeature
global __init_loc
global __all_signatures, __debug_configuration, __show... | [
"def",
"reset",
"(",
")",
":",
"global",
"__had_unspecified_value",
",",
"__had_value",
",",
"__declared_subfeature",
"global",
"__init_loc",
"global",
"__all_signatures",
",",
"__debug_configuration",
",",
"__show_configuration",
"# Stores toolsets without specified initializa... | Clear the module state. This is mainly for testing purposes.
Note that this must be called _after_ resetting the module 'feature'. | [
"Clear",
"the",
"module",
"state",
".",
"This",
"is",
"mainly",
"for",
"testing",
"purposes",
".",
"Note",
"that",
"this",
"must",
"be",
"called",
"_after_",
"resetting",
"the",
"module",
"feature",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/common.py#L28-L72 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/tools/common.py | check_init_parameters | def check_init_parameters(toolset, requirement, *args):
""" The rule for checking toolset parameters. Trailing parameters should all be
parameter name/value pairs. The rule will check that each parameter either has
a value in each invocation or has no value in each invocation. Also, the rule
... | python | def check_init_parameters(toolset, requirement, *args):
""" The rule for checking toolset parameters. Trailing parameters should all be
parameter name/value pairs. The rule will check that each parameter either has
a value in each invocation or has no value in each invocation. Also, the rule
... | [
"def",
"check_init_parameters",
"(",
"toolset",
",",
"requirement",
",",
"*",
"args",
")",
":",
"assert",
"isinstance",
"(",
"toolset",
",",
"basestring",
")",
"assert",
"is_iterable_typed",
"(",
"requirement",
",",
"basestring",
")",
"or",
"requirement",
"is",
... | The rule for checking toolset parameters. Trailing parameters should all be
parameter name/value pairs. The rule will check that each parameter either has
a value in each invocation or has no value in each invocation. Also, the rule
will check that the combination of all parameter values is uniq... | [
"The",
"rule",
"for",
"checking",
"toolset",
"parameters",
".",
"Trailing",
"parameters",
"should",
"all",
"be",
"parameter",
"name",
"/",
"value",
"pairs",
".",
"The",
"rule",
"will",
"check",
"that",
"each",
"parameter",
"either",
"has",
"a",
"value",
"in"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/common.py#L171-L282 | train |
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 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/tools/common.py | get_invocation_command | def get_invocation_command(toolset, tool, user_provided_command = [],
additional_paths = [], path_last = False):
""" Same as get_invocation_command_nodefault, except that if no tool is found,
returns either the user-provided-command, if present, or the 'tool' parameter.
"""
... | python | def get_invocation_command(toolset, tool, user_provided_command = [],
additional_paths = [], path_last = False):
""" Same as get_invocation_command_nodefault, except that if no tool is found,
returns either the user-provided-command, if present, or the 'tool' parameter.
"""
... | [
"def",
"get_invocation_command",
"(",
"toolset",
",",
"tool",
",",
"user_provided_command",
"=",
"[",
"]",
",",
"additional_paths",
"=",
"[",
"]",
",",
"path_last",
"=",
"False",
")",
":",
"assert",
"isinstance",
"(",
"toolset",
",",
"basestring",
")",
"asse... | Same as get_invocation_command_nodefault, except that if no tool is found,
returns either the user-provided-command, if present, or the 'tool' parameter. | [
"Same",
"as",
"get_invocation_command_nodefault",
"except",
"that",
"if",
"no",
"tool",
"is",
"found",
"returns",
"either",
"the",
"user",
"-",
"provided",
"-",
"command",
"if",
"present",
"or",
"the",
"tool",
"parameter",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/common.py#L323-L347 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/tools/common.py | get_absolute_tool_path | def get_absolute_tool_path(command):
"""
Given an invocation command,
return the absolute path to the command. This works even if commnad
has not path element and is present in PATH.
"""
assert isinstance(command, basestring)
if os.path.dirname(command):
return os.path.di... | python | def get_absolute_tool_path(command):
"""
Given an invocation command,
return the absolute path to the command. This works even if commnad
has not path element and is present in PATH.
"""
assert isinstance(command, basestring)
if os.path.dirname(command):
return os.path.di... | [
"def",
"get_absolute_tool_path",
"(",
"command",
")",
":",
"assert",
"isinstance",
"(",
"command",
",",
"basestring",
")",
"if",
"os",
".",
"path",
".",
"dirname",
"(",
"command",
")",
":",
"return",
"os",
".",
"path",
".",
"dirname",
"(",
"command",
")"... | Given an invocation command,
return the absolute path to the command. This works even if commnad
has not path element and is present in PATH. | [
"Given",
"an",
"invocation",
"command",
"return",
"the",
"absolute",
"path",
"to",
"the",
"command",
".",
"This",
"works",
"even",
"if",
"commnad",
"has",
"not",
"path",
"element",
"and",
"is",
"present",
"in",
"PATH",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/common.py#L350-L366 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/tools/common.py | find_tool | def find_tool(name, additional_paths = [], path_last = False):
""" Attempts to find tool (binary) named 'name' in PATH and in
'additional-paths'. If found in path, returns 'name'. If
found in additional paths, returns full name. If the tool
is found in several directories, returns the fir... | python | def find_tool(name, additional_paths = [], path_last = False):
""" Attempts to find tool (binary) named 'name' in PATH and in
'additional-paths'. If found in path, returns 'name'. If
found in additional paths, returns full name. If the tool
is found in several directories, returns the fir... | [
"def",
"find_tool",
"(",
"name",
",",
"additional_paths",
"=",
"[",
"]",
",",
"path_last",
"=",
"False",
")",
":",
"assert",
"isinstance",
"(",
"name",
",",
"basestring",
")",
"assert",
"is_iterable_typed",
"(",
"additional_paths",
",",
"basestring",
")",
"a... | Attempts to find tool (binary) named 'name' in PATH and in
'additional-paths'. If found in path, returns 'name'. If
found in additional paths, returns full name. If the tool
is found in several directories, returns the first path found.
Otherwise, returns the empty string. If 'path_l... | [
"Attempts",
"to",
"find",
"tool",
"(",
"binary",
")",
"named",
"name",
"in",
"PATH",
"and",
"in",
"additional",
"-",
"paths",
".",
"If",
"found",
"in",
"path",
"returns",
"name",
".",
"If",
"found",
"in",
"additional",
"paths",
"returns",
"full",
"name",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/common.py#L369-L401 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/tools/common.py | check_tool_aux | def check_tool_aux(command):
""" Checks if 'command' can be found either in path
or is a full name to an existing file.
"""
assert isinstance(command, basestring)
dirname = os.path.dirname(command)
if dirname:
if os.path.exists(command):
return command
# Both NT a... | python | def check_tool_aux(command):
""" Checks if 'command' can be found either in path
or is a full name to an existing file.
"""
assert isinstance(command, basestring)
dirname = os.path.dirname(command)
if dirname:
if os.path.exists(command):
return command
# Both NT a... | [
"def",
"check_tool_aux",
"(",
"command",
")",
":",
"assert",
"isinstance",
"(",
"command",
",",
"basestring",
")",
"dirname",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"command",
")",
"if",
"dirname",
":",
"if",
"os",
".",
"path",
".",
"exists",
"("... | Checks if 'command' can be found either in path
or is a full name to an existing file. | [
"Checks",
"if",
"command",
"can",
"be",
"found",
"either",
"in",
"path",
"or",
"is",
"a",
"full",
"name",
"to",
"an",
"existing",
"file",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/common.py#L404-L422 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/tools/common.py | check_tool | def check_tool(command):
""" Checks that a tool can be invoked by 'command'.
If command is not an absolute path, checks if it can be found in 'path'.
If comand is absolute path, check that it exists. Returns 'command'
if ok and empty string otherwise.
"""
assert is_iterable_typed(com... | python | def check_tool(command):
""" Checks that a tool can be invoked by 'command'.
If command is not an absolute path, checks if it can be found in 'path'.
If comand is absolute path, check that it exists. Returns 'command'
if ok and empty string otherwise.
"""
assert is_iterable_typed(com... | [
"def",
"check_tool",
"(",
"command",
")",
":",
"assert",
"is_iterable_typed",
"(",
"command",
",",
"basestring",
")",
"#FIXME: why do we check the first and last elements????",
"if",
"check_tool_aux",
"(",
"command",
"[",
"0",
"]",
")",
"or",
"check_tool_aux",
"(",
... | Checks that a tool can be invoked by 'command'.
If command is not an absolute path, checks if it can be found in 'path'.
If comand is absolute path, check that it exists. Returns 'command'
if ok and empty string otherwise. | [
"Checks",
"that",
"a",
"tool",
"can",
"be",
"invoked",
"by",
"command",
".",
"If",
"command",
"is",
"not",
"an",
"absolute",
"path",
"checks",
"if",
"it",
"can",
"be",
"found",
"in",
"path",
".",
"If",
"comand",
"is",
"absolute",
"path",
"check",
"that... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/common.py#L425-L434 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/tools/common.py | handle_options | def handle_options(tool, condition, command, options):
""" Handle common options for toolset, specifically sets the following
flag variables:
- CONFIG_COMMAND to 'command'
- OPTIOns for compile to the value of <compileflags> in options
- OPTIONS for compile.c to the value of <cflags>... | python | def handle_options(tool, condition, command, options):
""" Handle common options for toolset, specifically sets the following
flag variables:
- CONFIG_COMMAND to 'command'
- OPTIOns for compile to the value of <compileflags> in options
- OPTIONS for compile.c to the value of <cflags>... | [
"def",
"handle_options",
"(",
"tool",
",",
"condition",
",",
"command",
",",
"options",
")",
":",
"from",
"b2",
".",
"build",
"import",
"toolset",
"assert",
"isinstance",
"(",
"tool",
",",
"basestring",
")",
"assert",
"is_iterable_typed",
"(",
"condition",
"... | Handle common options for toolset, specifically sets the following
flag variables:
- CONFIG_COMMAND to 'command'
- OPTIOns for compile to the value of <compileflags> in options
- OPTIONS for compile.c to the value of <cflags> in options
- OPTIONS for compile.c++ to the value of <... | [
"Handle",
"common",
"options",
"for",
"toolset",
"specifically",
"sets",
"the",
"following",
"flag",
"variables",
":",
"-",
"CONFIG_COMMAND",
"to",
"command",
"-",
"OPTIOns",
"for",
"compile",
"to",
"the",
"value",
"of",
"<compileflags",
">",
"in",
"options",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/common.py#L437-L458 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/tools/common.py | get_program_files_dir | def get_program_files_dir():
""" returns the location of the "program files" directory on a windows
platform
"""
ProgramFiles = bjam.variable("ProgramFiles")
if ProgramFiles:
ProgramFiles = ' '.join(ProgramFiles)
else:
ProgramFiles = "c:\\Program Files"
return ProgramFile... | python | def get_program_files_dir():
""" returns the location of the "program files" directory on a windows
platform
"""
ProgramFiles = bjam.variable("ProgramFiles")
if ProgramFiles:
ProgramFiles = ' '.join(ProgramFiles)
else:
ProgramFiles = "c:\\Program Files"
return ProgramFile... | [
"def",
"get_program_files_dir",
"(",
")",
":",
"ProgramFiles",
"=",
"bjam",
".",
"variable",
"(",
"\"ProgramFiles\"",
")",
"if",
"ProgramFiles",
":",
"ProgramFiles",
"=",
"' '",
".",
"join",
"(",
"ProgramFiles",
")",
"else",
":",
"ProgramFiles",
"=",
"\"c:\\\\... | returns the location of the "program files" directory on a windows
platform | [
"returns",
"the",
"location",
"of",
"the",
"program",
"files",
"directory",
"on",
"a",
"windows",
"platform"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/common.py#L461-L470 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/tools/common.py | variable_setting_command | def variable_setting_command(variable, value):
"""
Returns the command needed to set an environment variable on the current
platform. The variable setting persists through all following commands and is
visible in the environment seen by subsequently executed commands. In other
words,... | python | def variable_setting_command(variable, value):
"""
Returns the command needed to set an environment variable on the current
platform. The variable setting persists through all following commands and is
visible in the environment seen by subsequently executed commands. In other
words,... | [
"def",
"variable_setting_command",
"(",
"variable",
",",
"value",
")",
":",
"assert",
"isinstance",
"(",
"variable",
",",
"basestring",
")",
"assert",
"isinstance",
"(",
"value",
",",
"basestring",
")",
"if",
"os_name",
"(",
")",
"==",
"'NT'",
":",
"return",... | Returns the command needed to set an environment variable on the current
platform. The variable setting persists through all following commands and is
visible in the environment seen by subsequently executed commands. In other
words, on Unix systems, the variable is exported, which is consistent... | [
"Returns",
"the",
"command",
"needed",
"to",
"set",
"an",
"environment",
"variable",
"on",
"the",
"current",
"platform",
".",
"The",
"variable",
"setting",
"persists",
"through",
"all",
"following",
"commands",
"and",
"is",
"visible",
"in",
"the",
"environment",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/common.py#L481-L525 | train |
apple/turicreate | deps/src/boost_1_68_0/tools/build/src/tools/common.py | path_variable_setting_command | def path_variable_setting_command(variable, paths):
"""
Returns a command to sets a named shell path variable to the given NATIVE
paths on the current platform.
"""
assert isinstance(variable, basestring)
assert is_iterable_typed(paths, basestring)
sep = os.path.pathsep
return va... | python | def path_variable_setting_command(variable, paths):
"""
Returns a command to sets a named shell path variable to the given NATIVE
paths on the current platform.
"""
assert isinstance(variable, basestring)
assert is_iterable_typed(paths, basestring)
sep = os.path.pathsep
return va... | [
"def",
"path_variable_setting_command",
"(",
"variable",
",",
"paths",
")",
":",
"assert",
"isinstance",
"(",
"variable",
",",
"basestring",
")",
"assert",
"is_iterable_typed",
"(",
"paths",
",",
"basestring",
")",
"sep",
"=",
"os",
".",
"path",
".",
"pathsep"... | Returns a command to sets a named shell path variable to the given NATIVE
paths on the current platform. | [
"Returns",
"a",
"command",
"to",
"sets",
"a",
"named",
"shell",
"path",
"variable",
"to",
"the",
"given",
"NATIVE",
"paths",
"on",
"the",
"current",
"platform",
"."
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/common.py#L527-L535 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.