partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | _raise_error_if_not_of_type | 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... | src/unity/python/turicreate/util/_type_checks.py | 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):
"""
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... | [
"Check",
"if",
"the",
"input",
"is",
"of",
"expected",
"type",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/_type_checks.py#L11-L39 | [
"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... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | waveform_to_examples | 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.... | src/unity/python/turicreate/toolkits/sound_classifier/vggish_input.py | 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):
"""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 ... | [
"Converts",
"audio",
"waveform",
"into",
"an",
"array",
"of",
"examples",
"for",
"VGGish",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/sound_classifier/vggish_input.py#L24-L71 | [
"def",
"waveform_to_examples",
"(",
"data",
",",
"sample_rate",
")",
":",
"import",
"resampy",
"# Convert to mono.",
"if",
"len",
"(",
"data",
".",
"shape",
")",
">",
"1",
":",
"data",
"=",
"np",
".",
"mean",
"(",
"data",
",",
"axis",
"=",
"1",
")",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | wavfile_to_examples | 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. | src/unity/python/turicreate/toolkits/sound_classifier/vggish_input.py | 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):
"""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... | [
"Convenience",
"wrapper",
"around",
"waveform_to_examples",
"()",
"for",
"a",
"common",
"WAV",
"format",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/sound_classifier/vggish_input.py#L74-L88 | [
"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... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | expand_no_defaults | Expand the given build request by combining all property_sets which don't
specify conflicting non-free features. | deps/src/boost_1_68_0/tools/build/src/build/build_request.py | 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):
""" 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... | [
"Expand",
"the",
"given",
"build",
"request",
"by",
"combining",
"all",
"property_sets",
"which",
"don",
"t",
"specify",
"conflicting",
"non",
"-",
"free",
"features",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/build_request.py#L17-L28 | [
"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... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | __x_product | Return the cross-product of all elements of property_sets, less any
that would contain conflicting values for single-valued features. | deps/src/boost_1_68_0/tools/build/src/build/build_request.py | 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):
""" 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... | [
"Return",
"the",
"cross",
"-",
"product",
"of",
"all",
"elements",
"of",
"property_sets",
"less",
"any",
"that",
"would",
"contain",
"conflicting",
"values",
"for",
"single",
"-",
"valued",
"features",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/build_request.py#L31-L37 | [
"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",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | __x_product_aux | 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... | deps/src/boost_1_68_0/tools/build/src/build/build_request.py | 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):
"""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... | [
"Returns",
"non",
"-",
"conflicting",
"combinations",
"of",
"property",
"sets",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/build_request.py#L39-L91 | [
"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... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | looks_like_implicit_value | Returns true if 'v' is either implicit value, or
the part before the first '-' symbol is implicit value. | deps/src/boost_1_68_0/tools/build/src/build/build_request.py | 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):
"""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(... | [
"Returns",
"true",
"if",
"v",
"is",
"either",
"implicit",
"value",
"or",
"the",
"part",
"before",
"the",
"first",
"-",
"symbol",
"is",
"implicit",
"value",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/build_request.py#L95-L106 | [
"def",
"looks_like_implicit_value",
"(",
"v",
")",
":",
"assert",
"isinstance",
"(",
"v",
",",
"basestring",
")",
"if",
"feature",
".",
"is_implicit_value",
"(",
"v",
")",
":",
"return",
"1",
"else",
":",
"split",
"=",
"v",
".",
"split",
"(",
"\"-\"",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | from_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. | deps/src/boost_1_68_0/tools/build/src/build/build_request.py | 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):
"""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... | [
"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... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/build_request.py#L108-L126 | [
"def",
"from_command_line",
"(",
"command_line",
")",
":",
"assert",
"is_iterable_typed",
"(",
"command_line",
",",
"basestring",
")",
"targets",
"=",
"[",
"]",
"properties",
"=",
"[",
"]",
"for",
"e",
"in",
"command_line",
":",
"if",
"e",
"[",
":",
"1",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | regex_to_error_msg | Format a human-readable error message from a regex | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py | 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):
"""Format a human-readable error message from a regex"""
return re.sub('([^\\\\])[()]', '\\1', regex) \
.replace('[ \t]*$', '') \
.replace('^', '') \
.replace('$', '') \
.replace('[ \t]*', ' ') \
.replace('[ \t]+', ' ') \
.replace('[... | [
"Format",
"a",
"human",
"-",
"readable",
"error",
"message",
"from",
"a",
"regex"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py#L20-L34 | [
"def",
"regex_to_error_msg",
"(",
"regex",
")",
":",
"return",
"re",
".",
"sub",
"(",
"'([^\\\\\\\\])[()]'",
",",
"'\\\\1'",
",",
"regex",
")",
".",
"replace",
"(",
"'[ \\t]*$'",
",",
"''",
")",
".",
"replace",
"(",
"'^'",
",",
"''",
")",
".",
"replace... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | random_chars | Generate random characters | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py | 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):
"""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)))
... | [
"Generate",
"random",
"characters"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py#L50-L61 | [
"def",
"random_chars",
"(",
"number",
")",
":",
"char_map",
"=",
"{",
"k",
":",
"v",
"for",
"k",
",",
"v",
"in",
"chars",
".",
"CHARS",
".",
"iteritems",
"(",
")",
"if",
"not",
"format_character",
"(",
"k",
")",
".",
"startswith",
"(",
"'\\\\x'",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | templates_in | Enumerate the templates found in path | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py | 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):
"""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)
) | [
"Enumerate",
"the",
"templates",
"found",
"in",
"path"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py#L186-L192 | [
"def",
"templates_in",
"(",
"path",
")",
":",
"ext",
"=",
"'.cpp'",
"return",
"(",
"Template",
"(",
"f",
"[",
"0",
":",
"-",
"len",
"(",
"ext",
")",
"]",
",",
"load_file",
"(",
"os",
".",
"path",
".",
"join",
"(",
"path",
",",
"f",
")",
")",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | nth_char | Returns the nth character of a character->occurrence map | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py | 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):
"""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 | [
"Returns",
"the",
"nth",
"character",
"of",
"a",
"character",
"-",
">",
"occurrence",
"map"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py#L195-L201 | [
"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"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | format_character | Returns the C-formatting of the character | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py | 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):
"""Returns the C-formatting of the character"""
if \
char in string.ascii_letters \
or char in string.digits \
or char in [
'_', '.', ':', ';', ' ', '!', '?', '+', '-', '/', '=', '<',
'>', '$', '(', ')', '@', '~', '`', '|', '#',... | [
"Returns",
"the",
"C",
"-",
"formatting",
"of",
"the",
"character"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py#L204-L223 | [
"def",
"format_character",
"(",
"char",
")",
":",
"if",
"char",
"in",
"string",
".",
"ascii_letters",
"or",
"char",
"in",
"string",
".",
"digits",
"or",
"char",
"in",
"[",
"'_'",
",",
"'.'",
",",
"':'",
",",
"';'",
",",
"' '",
",",
"'!'",
",",
"'?'... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | write_file | Create the file with the given content | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py | 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):
"""Create the file with the given content"""
print 'Generating {0}'.format(filename)
with open(filename, 'wb') as out_f:
out_f.write(content) | [
"Create",
"the",
"file",
"with",
"the",
"given",
"content"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py#L226-L230 | [
"def",
"write_file",
"(",
"filename",
",",
"content",
")",
":",
"print",
"'Generating {0}'",
".",
"format",
"(",
"filename",
")",
"with",
"open",
"(",
"filename",
",",
"'wb'",
")",
"as",
"out_f",
":",
"out_f",
".",
"write",
"(",
"content",
")"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | out_filename | Determine the output filename | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py | 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):
"""Determine the output filename"""
return '{0}_{1}_{2}.cpp'.format(template.name, n_val, mode.identifier) | [
"Determine",
"the",
"output",
"filename"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py#L233-L235 | [
"def",
"out_filename",
"(",
"template",
",",
"n_val",
",",
"mode",
")",
":",
"return",
"'{0}_{1}_{2}.cpp'",
".",
"format",
"(",
"template",
".",
"name",
",",
"n_val",
",",
"mode",
".",
"identifier",
")"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | main | The main function of the script | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py | 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():
"""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... | [
"The",
"main",
"function",
"of",
"the",
"script"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py#L238-L295 | [
"def",
"main",
"(",
")",
":",
"desc",
"=",
"'Generate files to benchmark'",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"desc",
")",
"parser",
".",
"add_argument",
"(",
"'--src'",
",",
"dest",
"=",
"'src_dir'",
",",
"default",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | Mode.convert_from | Convert a BOOST_METAPARSE_STRING mode document into one with
this mode | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py | 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):
"""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:
... | [
"Convert",
"a",
"BOOST_METAPARSE_STRING",
"mode",
"document",
"into",
"one",
"with",
"this",
"mode"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py#L89-L124 | [
"def",
"convert_from",
"(",
"self",
",",
"base",
")",
":",
"if",
"self",
".",
"identifier",
"==",
"'bmp'",
":",
"return",
"base",
"elif",
"self",
".",
"identifier",
"==",
"'man'",
":",
"result",
"=",
"[",
"]",
"prefix",
"=",
"'BOOST_METAPARSE_STRING(\"'",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | Template.instantiate | Instantiates the template | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py | 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):
"""Instantiates the template"""
template = Cheetah.Template.Template(
self.content,
searchList={'n': value_of_n}
)
template.random_string = random_string
return str(template) | [
"Instantiates",
"the",
"template"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py#L134-L141 | [
"def",
"instantiate",
"(",
"self",
",",
"value_of_n",
")",
":",
"template",
"=",
"Cheetah",
".",
"Template",
".",
"Template",
"(",
"self",
".",
"content",
",",
"searchList",
"=",
"{",
"'n'",
":",
"value_of_n",
"}",
")",
"template",
".",
"random_string",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | Template.range | Returns the range for N | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py | 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):
"""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(... | [
"Returns",
"the",
"range",
"for",
"N"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py#L143-L153 | [
"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",
"("... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | Template._match | Find the first line matching regex and return the match object | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py | 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):
"""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}.... | [
"Find",
"the",
"first",
"line",
"matching",
"regex",
"and",
"return",
"the",
"match",
"object"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/generate.py#L163-L173 | [
"def",
"_match",
"(",
"self",
",",
"regex",
")",
":",
"cregex",
"=",
"re",
".",
"compile",
"(",
"regex",
")",
"for",
"line",
"in",
"self",
".",
"content",
".",
"splitlines",
"(",
")",
":",
"match",
"=",
"cregex",
".",
"match",
"(",
"line",
")",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | Pipeline.add_model | 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... | src/external/coremltools_wrap/coremltools/coremltools/models/pipeline.py | 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):
"""
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... | [
"Add",
"a",
"protobuf",
"spec",
"or",
":",
"py",
":",
"class",
":",
"models",
".",
"MLModel",
"instance",
"to",
"the",
"pipeline",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/pipeline.py#L61-L79 | [
"def",
"add_model",
"(",
"self",
",",
"spec",
")",
":",
"if",
"isinstance",
"(",
"spec",
",",
"_model",
".",
"MLModel",
")",
":",
"spec",
"=",
"spec",
".",
"_spec",
"pipeline",
"=",
"self",
".",
"spec",
".",
"pipeline",
"step_spec",
"=",
"pipeline",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | 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. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/setup.py | 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():
"""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... | [
"Gets",
"the",
"version",
"from",
"google",
"/",
"protobuf",
"/",
"__init__",
".",
"py"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/setup.py#L39-L47 | [
"def",
"GetVersion",
"(",
")",
":",
"with",
"open",
"(",
"os",
".",
"path",
".",
"join",
"(",
"'google'",
",",
"'protobuf'",
",",
"'__init__.py'",
")",
")",
"as",
"version_file",
":",
"exec",
"(",
"version_file",
".",
"read",
"(",
")",
",",
"globals",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | generate_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. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/setup.py | 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):
"""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... | [
"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",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/setup.py#L50-L77 | [
"def",
"generate_proto",
"(",
"source",
",",
"require",
"=",
"True",
")",
":",
"if",
"not",
"require",
"and",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"source",
")",
":",
"return",
"output",
"=",
"source",
".",
"replace",
"(",
"\".proto\"",
",",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _validate_row_label | 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. | src/unity/python/turicreate/toolkits/_private_utils.py | 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):
"""
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... | [
"Validate",
"a",
"row",
"label",
"column",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_private_utils.py#L13-L33 | [
"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... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _robust_column_name | 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... | src/unity/python/turicreate/toolkits/_private_utils.py | 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):
"""
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... | [
"Generate",
"a",
"new",
"column",
"name",
"that",
"is",
"guaranteed",
"not",
"to",
"conflict",
"with",
"an",
"existing",
"set",
"of",
"column",
"names",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_private_utils.py#L36-L66 | [
"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"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _select_valid_features | 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... | src/unity/python/turicreate/toolkits/_private_utils.py | 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):
"""
Utility function for selecting columns of only valid feature types.
Parameters
----------
dataset: SFrame
The input SFrame containing columns of potential features.
fe... | [
"Utility",
"function",
"for",
"selecting",
"columns",
"of",
"only",
"valid",
"feature",
"types",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_private_utils.py#L68-L143 | [
"def",
"_select_valid_features",
"(",
"dataset",
",",
"features",
",",
"valid_feature_types",
",",
"target_column",
"=",
"None",
")",
":",
"if",
"features",
"is",
"not",
"None",
":",
"if",
"not",
"hasattr",
"(",
"features",
",",
"'__iter__'",
")",
":",
"rais... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _check_elements_equal | Returns true if all of the elements in the list are equal. | src/unity/python/turicreate/toolkits/_private_utils.py | 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):
"""
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) | [
"Returns",
"true",
"if",
"all",
"of",
"the",
"elements",
"in",
"the",
"list",
"are",
"equal",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_private_utils.py#L145-L150 | [
"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"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _validate_lists | 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.
... | src/unity/python/turicreate/toolkits/_private_utils.py | 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):
"""
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
... | [
"For",
"a",
"list",
"-",
"typed",
"SArray",
"check",
"whether",
"the",
"first",
"elements",
"are",
"lists",
"that",
"-",
"contain",
"only",
"the",
"provided",
"types",
"-",
"all",
"have",
"the",
"same",
"lengths",
"(",
"optionally",
")"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_private_utils.py#L152-L217 | [
"def",
"_validate_lists",
"(",
"sa",
",",
"allowed_types",
"=",
"[",
"str",
"]",
",",
"require_same_type",
"=",
"True",
",",
"require_equal_length",
"=",
"False",
",",
"num_to_check",
"=",
"10",
")",
":",
"if",
"len",
"(",
"sa",
")",
"==",
"0",
":",
"r... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _summarize_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 names and descriptions.
Parameters
----------
field_descriptions : dict{str: str}
Name of each field and its description, ... | src/unity/python/turicreate/toolkits/_private_utils.py | 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'):
"""
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... | [
"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... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_private_utils.py#L219-L252 | [
"def",
"_summarize_accessible_fields",
"(",
"field_descriptions",
",",
"width",
"=",
"40",
",",
"section_title",
"=",
"'Accessible fields'",
")",
":",
"key_str",
"=",
"\"{:<{}}: {}\"",
"items",
"=",
"[",
"]",
"items",
".",
"append",
"(",
"section_title",
")",
"i... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _is_valid_datatype | Returns true if datatype_instance is a valid datatype object and false otherwise. | src/external/coremltools_wrap/coremltools/coremltools/models/datatypes.py | 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):
"""
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
#... | [
"Returns",
"true",
"if",
"datatype_instance",
"is",
"a",
"valid",
"datatype",
"object",
"and",
"false",
"otherwise",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/datatypes.py#L130-L150 | [
"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... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _normalize_datatype | 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... | src/external/coremltools_wrap/coremltools/coremltools/models/datatypes.py | 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):
"""
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()
... | [
"Translates",
"a",
"user",
"specified",
"datatype",
"to",
"an",
"instance",
"of",
"the",
"ones",
"defined",
"above",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/datatypes.py#L152-L179 | [
"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... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | convert | 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... | src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_gradient_boosting_classifier.py | 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):
"""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... | [
"Convert",
"a",
"boosted",
"tree",
"model",
"to",
"protobuf",
"format",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_gradient_boosting_classifier.py#L19-L62 | [
"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... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | get_symbols | 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. | src/unity/python/turicreate/meta/asttools/visitors/symbol_visitor.py | 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)):
'''
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... | [
"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... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/asttools/visitors/symbol_visitor.py#L58-L70 | [
"def",
"get_symbols",
"(",
"node",
",",
"ctx_types",
"=",
"(",
"ast",
".",
"Load",
",",
"ast",
".",
"Store",
")",
")",
":",
"gen",
"=",
"SymbolVisitor",
"(",
"ctx_types",
")",
"return",
"gen",
".",
"visit",
"(",
"node",
")"
] | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | Order.order | 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) | deps/src/boost_1_68_0/tools/build/src/util/order.py | 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):
""" 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... | [
"Given",
"a",
"list",
"of",
"objects",
"reorder",
"them",
"so",
"that",
"the",
"constains",
"specified",
"by",
"add_pair",
"are",
"satisfied",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/order.py#L37-L86 | [
"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... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | Order.__eliminate_unused_constraits | Eliminate constraints which mention objects not in 'objects'.
In graph-theory terms, this is finding subgraph induced by
ordered vertices. | deps/src/boost_1_68_0/tools/build/src/util/order.py | 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):
""" 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... | [
"Eliminate",
"constraints",
"which",
"mention",
"objects",
"not",
"in",
"objects",
".",
"In",
"graph",
"-",
"theory",
"terms",
"this",
"is",
"finding",
"subgraph",
"induced",
"by",
"ordered",
"vertices",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/order.py#L88-L98 | [
"def",
"__eliminate_unused_constraits",
"(",
"self",
",",
"objects",
")",
":",
"result",
"=",
"[",
"]",
"for",
"c",
"in",
"self",
".",
"constraints_",
":",
"if",
"c",
"[",
"0",
"]",
"in",
"objects",
"and",
"c",
"[",
"1",
"]",
"in",
"objects",
":",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | Order.__has_no_dependents | Returns true if there's no constraint in 'constraints' where
'obj' comes second. | deps/src/boost_1_68_0/tools/build/src/util/order.py | 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):
""" 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... | [
"Returns",
"true",
"if",
"there",
"s",
"no",
"constraint",
"in",
"constraints",
"where",
"obj",
"comes",
"second",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/order.py#L100-L113 | [
"def",
"__has_no_dependents",
"(",
"self",
",",
"obj",
",",
"constraints",
")",
":",
"failed",
"=",
"False",
"while",
"constraints",
"and",
"not",
"failed",
":",
"c",
"=",
"constraints",
"[",
"0",
"]",
"if",
"c",
"[",
"1",
"]",
"==",
"obj",
":",
"fai... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | path_order | Helper for as_path, below. Orders properties with the implicit ones
first, and within the two sections in alphabetical order of feature
name. | deps/src/boost_1_68_0/tools/build/src/build/property.py | 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):
""" 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
... | [
"Helper",
"for",
"as_path",
"below",
".",
"Orders",
"properties",
"with",
"the",
"implicit",
"ones",
"first",
"and",
"within",
"the",
"two",
"sections",
"in",
"alphabetical",
"order",
"of",
"feature",
"name",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property.py#L244-L271 | [
"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",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | refine | 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. | deps/src/boost_1_68_0/tools/build/src/build/property.py | 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):
""" 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... | [
"Refines",
"properties",
"by",
"overriding",
"any",
"non",
"-",
"free",
"properties",
"for",
"which",
"a",
"different",
"value",
"is",
"specified",
"in",
"requirements",
".",
"Conditional",
"requirements",
"are",
"just",
"added",
"without",
"modification",
".",
... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property.py#L277-L311 | [
"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",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | translate_paths | 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. | deps/src/boost_1_68_0/tools/build/src/build/property.py | 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):
""" 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 = []
... | [
"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",
... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property.py#L313-L336 | [
"def",
"translate_paths",
"(",
"properties",
",",
"path",
")",
":",
"assert",
"is_iterable_typed",
"(",
"properties",
",",
"Property",
")",
"result",
"=",
"[",
"]",
"for",
"p",
"in",
"properties",
":",
"if",
"p",
".",
"feature",
".",
"path",
":",
"values... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | translate_indirect | 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. | deps/src/boost_1_68_0/tools/build/src/build/property.py | 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):
"""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, ... | [
"Assumes",
"that",
"all",
"feature",
"values",
"that",
"start",
"with"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property.py#L338-L354 | [
"def",
"translate_indirect",
"(",
"properties",
",",
"context_module",
")",
":",
"assert",
"is_iterable_typed",
"(",
"properties",
",",
"Property",
")",
"assert",
"isinstance",
"(",
"context_module",
",",
"basestring",
")",
"result",
"=",
"[",
"]",
"for",
"p",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | validate | Exit with error if any of the properties is not valid.
properties may be a single property or a sequence of properties. | deps/src/boost_1_68_0/tools/build/src/build/property.py | 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):
""" 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... | [
"Exit",
"with",
"error",
"if",
"any",
"of",
"the",
"properties",
"is",
"not",
"valid",
".",
"properties",
"may",
"be",
"a",
"single",
"property",
"or",
"a",
"sequence",
"of",
"properties",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property.py#L356-L364 | [
"def",
"validate",
"(",
"properties",
")",
":",
"if",
"isinstance",
"(",
"properties",
",",
"Property",
")",
":",
"properties",
"=",
"[",
"properties",
"]",
"assert",
"is_iterable_typed",
"(",
"properties",
",",
"Property",
")",
"for",
"p",
"in",
"properties... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | split_conditional | 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. | deps/src/boost_1_68_0/tools/build/src/build/property.py | 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):
""" 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... | [
"If",
"property",
"is",
"conditional",
"property",
"returns",
"condition",
"and",
"the",
"property",
"e",
".",
"g",
"<variant",
">",
"debug",
"<toolset",
">",
"gcc",
":",
"<inlining",
">",
"full",
"will",
"become",
"<variant",
">",
"debug",
"<toolset",
">",
... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property.py#L394-L407 | [
"def",
"split_conditional",
"(",
"property",
")",
":",
"assert",
"isinstance",
"(",
"property",
",",
"basestring",
")",
"m",
"=",
"__re_split_conditional",
".",
"match",
"(",
"property",
")",
"if",
"m",
":",
"return",
"(",
"m",
".",
"group",
"(",
"1",
")... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | select | Selects properties which correspond to any of the given features. | deps/src/boost_1_68_0/tools/build/src/build/property.py | 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):
""" 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... | [
"Selects",
"properties",
"which",
"correspond",
"to",
"any",
"of",
"the",
"given",
"features",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property.py#L410-L419 | [
"def",
"select",
"(",
"features",
",",
"properties",
")",
":",
"assert",
"is_iterable_typed",
"(",
"properties",
",",
"basestring",
")",
"result",
"=",
"[",
"]",
"# add any missing angle brackets",
"features",
"=",
"add_grist",
"(",
"features",
")",
"return",
"[... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | evaluate_conditionals_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' | deps/src/boost_1_68_0/tools/build/src/build/property.py | 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):
""" 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... | [
"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"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property.py#L428-L454 | [
"def",
"evaluate_conditionals_in_context",
"(",
"properties",
",",
"context",
")",
":",
"if",
"__debug__",
":",
"from",
".",
"property_set",
"import",
"PropertySet",
"assert",
"is_iterable_typed",
"(",
"properties",
",",
"Property",
")",
"assert",
"isinstance",
"(",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | change | 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. | deps/src/boost_1_68_0/tools/build/src/build/property.py | 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):
""" 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... | [
"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",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property.py#L457-L477 | [
"def",
"change",
"(",
"properties",
",",
"feature",
",",
"value",
"=",
"None",
")",
":",
"assert",
"is_iterable_typed",
"(",
"properties",
",",
"basestring",
")",
"assert",
"isinstance",
"(",
"feature",
",",
"basestring",
")",
"assert",
"isinstance",
"(",
"v... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | __validate1 | Exit with error if property is not valid. | deps/src/boost_1_68_0/tools/build/src/build/property.py | 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):
""" 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) | [
"Exit",
"with",
"error",
"if",
"property",
"is",
"not",
"valid",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property.py#L483-L490 | [
"def",
"__validate1",
"(",
"property",
")",
":",
"assert",
"isinstance",
"(",
"property",
",",
"Property",
")",
"msg",
"=",
"None",
"if",
"not",
"property",
".",
"feature",
".",
"free",
":",
"feature",
".",
"validate_value_string",
"(",
"property",
".",
"f... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | remove | Returns a property sets which include all the elements
in 'properties' that do not have attributes listed in 'attributes'. | deps/src/boost_1_68_0/tools/build/src/build/property.py | 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):
"""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... | [
"Returns",
"a",
"property",
"sets",
"which",
"include",
"all",
"the",
"elements",
"in",
"properties",
"that",
"do",
"not",
"have",
"attributes",
"listed",
"in",
"attributes",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property.py#L520-L539 | [
"def",
"remove",
"(",
"attributes",
",",
"properties",
")",
":",
"if",
"isinstance",
"(",
"attributes",
",",
"basestring",
")",
":",
"attributes",
"=",
"[",
"attributes",
"]",
"assert",
"is_iterable_typed",
"(",
"attributes",
",",
"basestring",
")",
"assert",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | take | Returns a property set which include all
properties in 'properties' that have any of 'attributes'. | deps/src/boost_1_68_0/tools/build/src/build/property.py | 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):
"""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... | [
"Returns",
"a",
"property",
"set",
"which",
"include",
"all",
"properties",
"in",
"properties",
"that",
"have",
"any",
"of",
"attributes",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property.py#L542-L551 | [
"def",
"take",
"(",
"attributes",
",",
"properties",
")",
":",
"assert",
"is_iterable_typed",
"(",
"attributes",
",",
"basestring",
")",
"assert",
"is_iterable_typed",
"(",
"properties",
",",
"basestring",
")",
"result",
"=",
"[",
"]",
"for",
"e",
"in",
"pro... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | PropertyMap.insert | Associate value with properties. | deps/src/boost_1_68_0/tools/build/src/build/property.py | 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):
""" Associate value with properties.
"""
assert is_iterable_typed(properties, basestring)
assert isinstance(value, basestring)
self.__properties.append(properties)
self.__values.append(value) | [
"Associate",
"value",
"with",
"properties",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/property.py#L590-L596 | [
"def",
"insert",
"(",
"self",
",",
"properties",
",",
"value",
")",
":",
"assert",
"is_iterable_typed",
"(",
"properties",
",",
"basestring",
")",
"assert",
"isinstance",
"(",
"value",
",",
"basestring",
")",
"self",
".",
"__properties",
".",
"append",
"(",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | benchmark_command | Benchmark one command execution | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py | 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):
"""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,
... | [
"Benchmark",
"one",
"command",
"execution"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py#L26-L45 | [
"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",
")",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | benchmark_file | Benchmark one file | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py | 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 = ''):
"""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} -... | [
"Benchmark",
"one",
"file"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py#L48-L73 | [
"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... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | compiler_info | Determine the name + version of the compiler | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py | 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):
"""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... | [
"Determine",
"the",
"name",
"+",
"version",
"of",
"the",
"compiler"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py#L76-L92 | [
"def",
"compiler_info",
"(",
"compiler",
")",
":",
"(",
"out",
",",
"err",
")",
"=",
"subprocess",
".",
"Popen",
"(",
"[",
"'/bin/sh'",
",",
"'-c'",
",",
"'{0} -v'",
".",
"format",
"(",
"compiler",
")",
"]",
",",
"stdin",
"=",
"subprocess",
".",
"PIP... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | files_in_dir | Enumartes the files in path with the given extension | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py | 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):
"""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)) | [
"Enumartes",
"the",
"files",
"in",
"path",
"with",
"the",
"given",
"extension"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py#L105-L108 | [
"def",
"files_in_dir",
"(",
"path",
",",
"extension",
")",
":",
"ends",
"=",
"'.{0}'",
".",
"format",
"(",
"extension",
")",
"return",
"(",
"f",
"for",
"f",
"in",
"os",
".",
"listdir",
"(",
"path",
")",
"if",
"f",
".",
"endswith",
"(",
"ends",
")",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | format_time | Format a duration | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py | 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):
"""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:
... | [
"Format",
"a",
"duration"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py#L111-L129 | [
"def",
"format_time",
"(",
"seconds",
")",
":",
"minute",
"=",
"60",
"hour",
"=",
"minute",
"*",
"60",
"day",
"=",
"hour",
"*",
"24",
"week",
"=",
"day",
"*",
"7",
"result",
"=",
"[",
"]",
"for",
"name",
",",
"dur",
"in",
"[",
"(",
"'week'",
",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | benchmark | Do the benchmarking | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py | 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):
"""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_... | [
"Do",
"the",
"benchmarking"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py#L132-L174 | [
"def",
"benchmark",
"(",
"src_dir",
",",
"compiler",
",",
"include_dirs",
",",
"iter_count",
")",
":",
"files",
"=",
"list",
"(",
"files_in_dir",
"(",
"src_dir",
",",
"'cpp'",
")",
")",
"random",
".",
"shuffle",
"(",
"files",
")",
"has_string_templates",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | plot | Plot a diagram | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py | 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):
"""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_... | [
"Plot",
"a",
"diagram"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py#L177-L192 | [
"def",
"plot",
"(",
"values",
",",
"mode_names",
",",
"title",
",",
"(",
"xlabel",
",",
"ylabel",
")",
",",
"out_file",
")",
":",
"matplotlib",
".",
"pyplot",
".",
"clf",
"(",
")",
"for",
"mode",
",",
"mode_name",
"in",
"mode_names",
".",
"iteritems",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | configs_in | Enumerate all configs in src_dir | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py | 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):
"""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) | [
"Enumerate",
"all",
"configs",
"in",
"src_dir"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py#L203-L207 | [
"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"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | join_images | Join the list of images into the out file | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py | 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):
"""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... | [
"Join",
"the",
"list",
"of",
"images",
"into",
"the",
"out",
"file"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py#L215-L226 | [
"def",
"join_images",
"(",
"img_files",
",",
"out_file",
")",
":",
"images",
"=",
"[",
"PIL",
".",
"Image",
".",
"open",
"(",
"f",
")",
"for",
"f",
"in",
"img_files",
"]",
"joined",
"=",
"PIL",
".",
"Image",
".",
"new",
"(",
"'RGB'",
",",
"(",
"s... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | plot_temp_diagrams | Plot temporary diagrams | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py | 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):
"""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... | [
"Plot",
"temporary",
"diagrams"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py#L229-L257 | [
"def",
"plot_temp_diagrams",
"(",
"config",
",",
"results",
",",
"temp_dir",
")",
":",
"display_name",
"=",
"{",
"'time'",
":",
"'Compilation time (s)'",
",",
"'memory'",
":",
"'Compiler memory usage (MB)'",
",",
"}",
"files",
"=",
"config",
"[",
"'files'",
"]",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | plot_diagram | Plot one diagram | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py | 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):
"""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) | [
"Plot",
"one",
"diagram"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py#L260-L265 | [
"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... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | plot_diagrams | Plot all diagrams specified by the configs | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py | 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):
"""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')
... | [
"Plot",
"all",
"diagrams",
"specified",
"by",
"the",
"configs"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py#L268-L295 | [
"def",
"plot_diagrams",
"(",
"results",
",",
"configs",
",",
"compiler",
",",
"out_dir",
")",
":",
"compiler_fn",
"=",
"make_filename",
"(",
"compiler",
")",
"total",
"=",
"psutil",
".",
"virtual_memory",
"(",
")",
".",
"total",
"# pylint:disable=I0011,E1101",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | main | The main function of the script | deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py | 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():
"""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... | [
"The",
"main",
"function",
"of",
"the",
"script"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/benchmark.py#L298-L350 | [
"def",
"main",
"(",
")",
":",
"desc",
"=",
"'Benchmark the files generated by generate.py'",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"desc",
")",
"parser",
".",
"add_argument",
"(",
"'--src'",
",",
"dest",
"=",
"'src_dir'",
","... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | load_model | 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.
... | src/unity/python/turicreate/toolkits/_model.py | 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):
"""
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. ... | [
"Load",
"any",
"Turi",
"Create",
"model",
"that",
"was",
"previously",
"saved",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_model.py#L30-L124 | [
"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... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _get_default_options_wrapper | 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... | src/unity/python/turicreate/toolkits/_model.py | 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):
"""
Internal function to return a get_default_options function.
Parameters
----------
u... | [
"Internal",
"function",
"to",
"return",
"a",
"get_default_options",
"function",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_model.py#L127-L226 | [
"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'",
")",
":"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | reset | Clear the module state. This is mainly for testing purposes.
Note that this must be called _after_ resetting the module 'feature'. | deps/src/boost_1_68_0/tools/build/src/tools/common.py | 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 ():
""" 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... | [
"Clear",
"the",
"module",
"state",
".",
"This",
"is",
"mainly",
"for",
"testing",
"purposes",
".",
"Note",
"that",
"this",
"must",
"be",
"called",
"_after_",
"resetting",
"the",
"module",
"feature",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/common.py#L28-L72 | [
"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... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | check_init_parameters | 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... | deps/src/boost_1_68_0/tools/build/src/tools/common.py | 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):
""" 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
... | [
"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"... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/common.py#L171-L282 | [
"def",
"check_init_parameters",
"(",
"toolset",
",",
"requirement",
",",
"*",
"args",
")",
":",
"assert",
"isinstance",
"(",
"toolset",
",",
"basestring",
")",
"assert",
"is_iterable_typed",
"(",
"requirement",
",",
"basestring",
")",
"or",
"requirement",
"is",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | get_invocation_command_nodefault | 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... | deps/src/boost_1_68_0/tools/build/src/tools/common.py | 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):
"""
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... | [
"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"... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/common.py#L285-L320 | [
"def",
"get_invocation_command_nodefault",
"(",
"toolset",
",",
"tool",
",",
"user_provided_command",
"=",
"[",
"]",
",",
"additional_paths",
"=",
"[",
"]",
",",
"path_last",
"=",
"False",
")",
":",
"assert",
"isinstance",
"(",
"toolset",
",",
"basestring",
")... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | get_invocation_command | 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. | deps/src/boost_1_68_0/tools/build/src/tools/common.py | 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):
""" 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",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/common.py#L323-L347 | [
"def",
"get_invocation_command",
"(",
"toolset",
",",
"tool",
",",
"user_provided_command",
"=",
"[",
"]",
",",
"additional_paths",
"=",
"[",
"]",
",",
"path_last",
"=",
"False",
")",
":",
"assert",
"isinstance",
"(",
"toolset",
",",
"basestring",
")",
"asse... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | get_absolute_tool_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. | deps/src/boost_1_68_0/tools/build/src/tools/common.py | 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):
"""
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... | [
"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",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/common.py#L350-L366 | [
"def",
"get_absolute_tool_path",
"(",
"command",
")",
":",
"assert",
"isinstance",
"(",
"command",
",",
"basestring",
")",
"if",
"os",
".",
"path",
".",
"dirname",
"(",
"command",
")",
":",
"return",
"os",
".",
"path",
".",
"dirname",
"(",
"command",
")"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | find_tool | 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... | deps/src/boost_1_68_0/tools/build/src/tools/common.py | 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):
""" 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... | [
"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",... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/common.py#L369-L401 | [
"def",
"find_tool",
"(",
"name",
",",
"additional_paths",
"=",
"[",
"]",
",",
"path_last",
"=",
"False",
")",
":",
"assert",
"isinstance",
"(",
"name",
",",
"basestring",
")",
"assert",
"is_iterable_typed",
"(",
"additional_paths",
",",
"basestring",
")",
"a... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | check_tool_aux | Checks if 'command' can be found either in path
or is a full name to an existing file. | deps/src/boost_1_68_0/tools/build/src/tools/common.py | 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):
""" 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... | [
"Checks",
"if",
"command",
"can",
"be",
"found",
"either",
"in",
"path",
"or",
"is",
"a",
"full",
"name",
"to",
"an",
"existing",
"file",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/common.py#L404-L422 | [
"def",
"check_tool_aux",
"(",
"command",
")",
":",
"assert",
"isinstance",
"(",
"command",
",",
"basestring",
")",
"dirname",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"command",
")",
"if",
"dirname",
":",
"if",
"os",
".",
"path",
".",
"exists",
"("... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | check_tool | 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. | deps/src/boost_1_68_0/tools/build/src/tools/common.py | 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):
""" 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... | [
"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... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/common.py#L425-L434 | [
"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",
"(",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | handle_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> in options
- OPTIONS for compile.c++ to the value of <... | deps/src/boost_1_68_0/tools/build/src/tools/common.py | 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):
""" 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>... | [
"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",
... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/common.py#L437-L458 | [
"def",
"handle_options",
"(",
"tool",
",",
"condition",
",",
"command",
",",
"options",
")",
":",
"from",
"b2",
".",
"build",
"import",
"toolset",
"assert",
"isinstance",
"(",
"tool",
",",
"basestring",
")",
"assert",
"is_iterable_typed",
"(",
"condition",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | get_program_files_dir | returns the location of the "program files" directory on a windows
platform | deps/src/boost_1_68_0/tools/build/src/tools/common.py | 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():
""" 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... | [
"returns",
"the",
"location",
"of",
"the",
"program",
"files",
"directory",
"on",
"a",
"windows",
"platform"
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/common.py#L461-L470 | [
"def",
"get_program_files_dir",
"(",
")",
":",
"ProgramFiles",
"=",
"bjam",
".",
"variable",
"(",
"\"ProgramFiles\"",
")",
"if",
"ProgramFiles",
":",
"ProgramFiles",
"=",
"' '",
".",
"join",
"(",
"ProgramFiles",
")",
"else",
":",
"ProgramFiles",
"=",
"\"c:\\\\... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | variable_setting_command | 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... | deps/src/boost_1_68_0/tools/build/src/tools/common.py | 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):
"""
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,... | [
"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",... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/common.py#L481-L525 | [
"def",
"variable_setting_command",
"(",
"variable",
",",
"value",
")",
":",
"assert",
"isinstance",
"(",
"variable",
",",
"basestring",
")",
"assert",
"isinstance",
"(",
"value",
",",
"basestring",
")",
"if",
"os_name",
"(",
")",
"==",
"'NT'",
":",
"return",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | path_variable_setting_command | Returns a command to sets a named shell path variable to the given NATIVE
paths on the current platform. | deps/src/boost_1_68_0/tools/build/src/tools/common.py | 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):
"""
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... | [
"Returns",
"a",
"command",
"to",
"sets",
"a",
"named",
"shell",
"path",
"variable",
"to",
"the",
"given",
"NATIVE",
"paths",
"on",
"the",
"current",
"platform",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/common.py#L527-L535 | [
"def",
"path_variable_setting_command",
"(",
"variable",
",",
"paths",
")",
":",
"assert",
"isinstance",
"(",
"variable",
",",
"basestring",
")",
"assert",
"is_iterable_typed",
"(",
"paths",
",",
"basestring",
")",
"sep",
"=",
"os",
".",
"path",
".",
"pathsep"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | prepend_path_variable_command | Returns a command that prepends the given paths to the named path variable on
the current platform. | deps/src/boost_1_68_0/tools/build/src/tools/common.py | def prepend_path_variable_command(variable, paths):
"""
Returns a command that prepends the given paths to the named path variable on
the current platform.
"""
assert isinstance(variable, basestring)
assert is_iterable_typed(paths, basestring)
return path_variable_setting_command(
... | def prepend_path_variable_command(variable, paths):
"""
Returns a command that prepends the given paths to the named path variable on
the current platform.
"""
assert isinstance(variable, basestring)
assert is_iterable_typed(paths, basestring)
return path_variable_setting_command(
... | [
"Returns",
"a",
"command",
"that",
"prepends",
"the",
"given",
"paths",
"to",
"the",
"named",
"path",
"variable",
"on",
"the",
"current",
"platform",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/common.py#L537-L545 | [
"def",
"prepend_path_variable_command",
"(",
"variable",
",",
"paths",
")",
":",
"assert",
"isinstance",
"(",
"variable",
",",
"basestring",
")",
"assert",
"is_iterable_typed",
"(",
"paths",
",",
"basestring",
")",
"return",
"path_variable_setting_command",
"(",
"va... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | format_name | Given a target, as given to a custom tag rule, returns a string formatted
according to the passed format. Format is a list of properties that is
represented in the result. For each element of format the corresponding target
information is obtained and added to the result string. For all, but the... | deps/src/boost_1_68_0/tools/build/src/tools/common.py | def format_name(format, name, target_type, prop_set):
""" Given a target, as given to a custom tag rule, returns a string formatted
according to the passed format. Format is a list of properties that is
represented in the result. For each element of format the corresponding target
informatio... | def format_name(format, name, target_type, prop_set):
""" Given a target, as given to a custom tag rule, returns a string formatted
according to the passed format. Format is a list of properties that is
represented in the result. For each element of format the corresponding target
informatio... | [
"Given",
"a",
"target",
"as",
"given",
"to",
"a",
"custom",
"tag",
"rule",
"returns",
"a",
"string",
"formatted",
"according",
"to",
"the",
"passed",
"format",
".",
"Format",
"is",
"a",
"list",
"of",
"properties",
"that",
"is",
"represented",
"in",
"the",
... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/common.py#L607-L697 | [
"def",
"format_name",
"(",
"format",
",",
"name",
",",
"target_type",
",",
"prop_set",
")",
":",
"if",
"__debug__",
":",
"from",
".",
".",
"build",
".",
"property_set",
"import",
"PropertySet",
"assert",
"is_iterable_typed",
"(",
"format",
",",
"basestring",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | Configurations.register | Registers a configuration.
Returns True if the configuration has been added and False if
it already exists. Reports an error if the configuration is 'used'. | deps/src/boost_1_68_0/tools/build/src/tools/common.py | def register(self, id):
"""
Registers a configuration.
Returns True if the configuration has been added and False if
it already exists. Reports an error if the configuration is 'used'.
"""
assert isinstance(id, basestring)
if id in self.used_:
... | def register(self, id):
"""
Registers a configuration.
Returns True if the configuration has been added and False if
it already exists. Reports an error if the configuration is 'used'.
"""
assert isinstance(id, basestring)
if id in self.used_:
... | [
"Registers",
"a",
"configuration",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/common.py#L108-L126 | [
"def",
"register",
"(",
"self",
",",
"id",
")",
":",
"assert",
"isinstance",
"(",
"id",
",",
"basestring",
")",
"if",
"id",
"in",
"self",
".",
"used_",
":",
"#FIXME",
"errors",
".",
"error",
"(",
"\"common: the configuration '$(id)' is in use\"",
")",
"if",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | Configurations.get | Returns the value of a configuration parameter. | deps/src/boost_1_68_0/tools/build/src/tools/common.py | def get(self, id, param):
""" Returns the value of a configuration parameter. """
assert isinstance(id, basestring)
assert isinstance(param, basestring)
return self.params_.get(param, {}).get(id) | def get(self, id, param):
""" Returns the value of a configuration parameter. """
assert isinstance(id, basestring)
assert isinstance(param, basestring)
return self.params_.get(param, {}).get(id) | [
"Returns",
"the",
"value",
"of",
"a",
"configuration",
"parameter",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/common.py#L157-L161 | [
"def",
"get",
"(",
"self",
",",
"id",
",",
"param",
")",
":",
"assert",
"isinstance",
"(",
"id",
",",
"basestring",
")",
"assert",
"isinstance",
"(",
"param",
",",
"basestring",
")",
"return",
"self",
".",
"params_",
".",
"get",
"(",
"param",
",",
"{... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | Configurations.set | Sets the value of a configuration parameter. | deps/src/boost_1_68_0/tools/build/src/tools/common.py | def set (self, id, param, value):
""" Sets the value of a configuration parameter. """
assert isinstance(id, basestring)
assert isinstance(param, basestring)
assert is_iterable_typed(value, basestring)
self.params_.setdefault(param, {})[id] = value | def set (self, id, param, value):
""" Sets the value of a configuration parameter. """
assert isinstance(id, basestring)
assert isinstance(param, basestring)
assert is_iterable_typed(value, basestring)
self.params_.setdefault(param, {})[id] = value | [
"Sets",
"the",
"value",
"of",
"a",
"configuration",
"parameter",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/common.py#L163-L168 | [
"def",
"set",
"(",
"self",
",",
"id",
",",
"param",
",",
"value",
")",
":",
"assert",
"isinstance",
"(",
"id",
",",
"basestring",
")",
"assert",
"isinstance",
"(",
"param",
",",
"basestring",
")",
"assert",
"is_iterable_typed",
"(",
"value",
",",
"basest... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | get_gpus_in_use | Like get_num_gpus_in_use, but returns a list of dictionaries with just
queried GPU information. | src/unity/python/turicreate/toolkits/_mxnet/_mxnet_utils.py | def get_gpus_in_use(max_devices=None):
"""
Like get_num_gpus_in_use, but returns a list of dictionaries with just
queried GPU information.
"""
from turicreate.util import _get_cuda_gpus
gpu_indices = get_gpu_ids_in_use(max_devices=max_devices)
gpus = _get_cuda_gpus()
return [gpus[index] ... | def get_gpus_in_use(max_devices=None):
"""
Like get_num_gpus_in_use, but returns a list of dictionaries with just
queried GPU information.
"""
from turicreate.util import _get_cuda_gpus
gpu_indices = get_gpu_ids_in_use(max_devices=max_devices)
gpus = _get_cuda_gpus()
return [gpus[index] ... | [
"Like",
"get_num_gpus_in_use",
"but",
"returns",
"a",
"list",
"of",
"dictionaries",
"with",
"just",
"queried",
"GPU",
"information",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_mxnet/_mxnet_utils.py#L100-L108 | [
"def",
"get_gpus_in_use",
"(",
"max_devices",
"=",
"None",
")",
":",
"from",
"turicreate",
".",
"util",
"import",
"_get_cuda_gpus",
"gpu_indices",
"=",
"get_gpu_ids_in_use",
"(",
"max_devices",
"=",
"max_devices",
")",
"gpus",
"=",
"_get_cuda_gpus",
"(",
")",
"r... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | make_unity_server_env | Returns the environment for unity_server.
The environment is necessary to start the unity_server
by setting the proper environments for shared libraries,
hadoop classpath, and module search paths for python lambda workers.
The environment has 3 components:
1. CLASSPATH, contains hadoop class path
... | src/unity/python/turicreate/_sys_util.py | def make_unity_server_env():
"""
Returns the environment for unity_server.
The environment is necessary to start the unity_server
by setting the proper environments for shared libraries,
hadoop classpath, and module search paths for python lambda workers.
The environment has 3 components:
... | def make_unity_server_env():
"""
Returns the environment for unity_server.
The environment is necessary to start the unity_server
by setting the proper environments for shared libraries,
hadoop classpath, and module search paths for python lambda workers.
The environment has 3 components:
... | [
"Returns",
"the",
"environment",
"for",
"unity_server",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/_sys_util.py#L22-L86 | [
"def",
"make_unity_server_env",
"(",
")",
":",
"env",
"=",
"os",
".",
"environ",
".",
"copy",
"(",
")",
"# Add hadoop class path",
"classpath",
"=",
"get_hadoop_class_path",
"(",
")",
"if",
"(",
"\"CLASSPATH\"",
"in",
"env",
")",
":",
"env",
"[",
"\"CLASSPAT... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | set_windows_dll_path | Sets the dll load path so that things are resolved correctly. | src/unity/python/turicreate/_sys_util.py | def set_windows_dll_path():
"""
Sets the dll load path so that things are resolved correctly.
"""
lib_path = os.path.dirname(os.path.abspath(_pylambda_worker.__file__))
lib_path = os.path.abspath(os.path.join(lib_path, os.pardir))
def errcheck_bool(result, func, args):
if not result:
... | def set_windows_dll_path():
"""
Sets the dll load path so that things are resolved correctly.
"""
lib_path = os.path.dirname(os.path.abspath(_pylambda_worker.__file__))
lib_path = os.path.abspath(os.path.join(lib_path, os.pardir))
def errcheck_bool(result, func, args):
if not result:
... | [
"Sets",
"the",
"dll",
"load",
"path",
"so",
"that",
"things",
"are",
"resolved",
"correctly",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/_sys_util.py#L88-L117 | [
"def",
"set_windows_dll_path",
"(",
")",
":",
"lib_path",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"_pylambda_worker",
".",
"__file__",
")",
")",
"lib_path",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | dump_directory_structure | Dumps a detailed report of the turicreate/sframe directory structure
and files, along with the output of os.lstat for each. This is useful
for debugging purposes. | src/unity/python/turicreate/_sys_util.py | def dump_directory_structure(out = sys.stdout):
"""
Dumps a detailed report of the turicreate/sframe directory structure
and files, along with the output of os.lstat for each. This is useful
for debugging purposes.
"""
"Dumping Installation Directory Structure for Debugging: "
import sys,... | def dump_directory_structure(out = sys.stdout):
"""
Dumps a detailed report of the turicreate/sframe directory structure
and files, along with the output of os.lstat for each. This is useful
for debugging purposes.
"""
"Dumping Installation Directory Structure for Debugging: "
import sys,... | [
"Dumps",
"a",
"detailed",
"report",
"of",
"the",
"turicreate",
"/",
"sframe",
"directory",
"structure",
"and",
"files",
"along",
"with",
"the",
"output",
"of",
"os",
".",
"lstat",
"for",
"each",
".",
"This",
"is",
"useful",
"for",
"debugging",
"purposes",
... | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/_sys_util.py#L366-L402 | [
"def",
"dump_directory_structure",
"(",
"out",
"=",
"sys",
".",
"stdout",
")",
":",
"\"Dumping Installation Directory Structure for Debugging: \"",
"import",
"sys",
",",
"os",
"from",
"os",
".",
"path",
"import",
"split",
",",
"abspath",
",",
"join",
"from",
"iter... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _get_expanded_classpath | Take a classpath of the form:
/etc/hadoop/conf:/usr/lib/hadoop/lib/*:/usr/lib/hadoop/.//*: ...
and return it expanded to all the JARs (and nothing else):
/etc/hadoop/conf:/usr/lib/hadoop/lib/netty-3.6.2.Final.jar:/usr/lib/hadoop/lib/jaxb-api-2.2.2.jar: ...
mentioned in the path | src/unity/python/turicreate/_sys_util.py | def _get_expanded_classpath(classpath):
"""
Take a classpath of the form:
/etc/hadoop/conf:/usr/lib/hadoop/lib/*:/usr/lib/hadoop/.//*: ...
and return it expanded to all the JARs (and nothing else):
/etc/hadoop/conf:/usr/lib/hadoop/lib/netty-3.6.2.Final.jar:/usr/lib/hadoop/lib/jaxb-api-2.2.2.jar... | def _get_expanded_classpath(classpath):
"""
Take a classpath of the form:
/etc/hadoop/conf:/usr/lib/hadoop/lib/*:/usr/lib/hadoop/.//*: ...
and return it expanded to all the JARs (and nothing else):
/etc/hadoop/conf:/usr/lib/hadoop/lib/netty-3.6.2.Final.jar:/usr/lib/hadoop/lib/jaxb-api-2.2.2.jar... | [
"Take",
"a",
"classpath",
"of",
"the",
"form",
":",
"/",
"etc",
"/",
"hadoop",
"/",
"conf",
":",
"/",
"usr",
"/",
"lib",
"/",
"hadoop",
"/",
"lib",
"/",
"*",
":",
"/",
"usr",
"/",
"lib",
"/",
"hadoop",
"/",
".",
"//",
"*",
":",
"..."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/_sys_util.py#L432-L450 | [
"def",
"_get_expanded_classpath",
"(",
"classpath",
")",
":",
"if",
"classpath",
"is",
"None",
"or",
"classpath",
"==",
"''",
":",
"return",
"''",
"# so this set comprehension takes paths that end with * to be globbed to find the jars, and then",
"# recombined back into a colon... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | get_library_name | Returns either sframe or turicreate depending on which library
this file is bundled with. | src/unity/python/turicreate/_sys_util.py | def get_library_name():
"""
Returns either sframe or turicreate depending on which library
this file is bundled with.
"""
from os.path import split, abspath
__lib_name = split(split(abspath(sys.modules[__name__].__file__))[0])[1]
assert __lib_name in ["sframe", "turicreate"]
return __... | def get_library_name():
"""
Returns either sframe or turicreate depending on which library
this file is bundled with.
"""
from os.path import split, abspath
__lib_name = split(split(abspath(sys.modules[__name__].__file__))[0])[1]
assert __lib_name in ["sframe", "turicreate"]
return __... | [
"Returns",
"either",
"sframe",
"or",
"turicreate",
"depending",
"on",
"which",
"library",
"this",
"file",
"is",
"bundled",
"with",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/_sys_util.py#L452-L463 | [
"def",
"get_library_name",
"(",
")",
":",
"from",
"os",
".",
"path",
"import",
"split",
",",
"abspath",
"__lib_name",
"=",
"split",
"(",
"split",
"(",
"abspath",
"(",
"sys",
".",
"modules",
"[",
"__name__",
"]",
".",
"__file__",
")",
")",
"[",
"0",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | get_config_file | Returns the file name of the config file from which the environment
variables are written. | src/unity/python/turicreate/_sys_util.py | def get_config_file():
"""
Returns the file name of the config file from which the environment
variables are written.
"""
import os
from os.path import abspath, expanduser, join, exists
__lib_name = get_library_name()
assert __lib_name in ["sframe", "turicreate"]
__default_config_... | def get_config_file():
"""
Returns the file name of the config file from which the environment
variables are written.
"""
import os
from os.path import abspath, expanduser, join, exists
__lib_name = get_library_name()
assert __lib_name in ["sframe", "turicreate"]
__default_config_... | [
"Returns",
"the",
"file",
"name",
"of",
"the",
"config",
"file",
"from",
"which",
"the",
"environment",
"variables",
"are",
"written",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/_sys_util.py#L466-L488 | [
"def",
"get_config_file",
"(",
")",
":",
"import",
"os",
"from",
"os",
".",
"path",
"import",
"abspath",
",",
"expanduser",
",",
"join",
",",
"exists",
"__lib_name",
"=",
"get_library_name",
"(",
")",
"assert",
"__lib_name",
"in",
"[",
"\"sframe\"",
",",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | setup_environment_from_config_file | Imports the environmental configuration settings from the
config file, if present, and sets the environment
variables to test it. | src/unity/python/turicreate/_sys_util.py | def setup_environment_from_config_file():
"""
Imports the environmental configuration settings from the
config file, if present, and sets the environment
variables to test it.
"""
from os.path import exists
config_file = get_config_file()
if not exists(config_file):
return
... | def setup_environment_from_config_file():
"""
Imports the environmental configuration settings from the
config file, if present, and sets the environment
variables to test it.
"""
from os.path import exists
config_file = get_config_file()
if not exists(config_file):
return
... | [
"Imports",
"the",
"environmental",
"configuration",
"settings",
"from",
"the",
"config",
"file",
"if",
"present",
"and",
"sets",
"the",
"environment",
"variables",
"to",
"test",
"it",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/_sys_util.py#L491-L522 | [
"def",
"setup_environment_from_config_file",
"(",
")",
":",
"from",
"os",
".",
"path",
"import",
"exists",
"config_file",
"=",
"get_config_file",
"(",
")",
"if",
"not",
"exists",
"(",
"config_file",
")",
":",
"return",
"try",
":",
"config",
"=",
"_ConfigParser... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | write_config_file_value | Writes an environment variable configuration to the current
config file. This will be read in on the next restart.
The config file is created if not present.
Note: The variables will not take effect until after restart. | src/unity/python/turicreate/_sys_util.py | def write_config_file_value(key, value):
"""
Writes an environment variable configuration to the current
config file. This will be read in on the next restart.
The config file is created if not present.
Note: The variables will not take effect until after restart.
"""
filename = get_confi... | def write_config_file_value(key, value):
"""
Writes an environment variable configuration to the current
config file. This will be read in on the next restart.
The config file is created if not present.
Note: The variables will not take effect until after restart.
"""
filename = get_confi... | [
"Writes",
"an",
"environment",
"variable",
"configuration",
"to",
"the",
"current",
"config",
"file",
".",
"This",
"will",
"be",
"read",
"in",
"on",
"the",
"next",
"restart",
".",
"The",
"config",
"file",
"is",
"created",
"if",
"not",
"present",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/_sys_util.py#L525-L547 | [
"def",
"write_config_file_value",
"(",
"key",
",",
"value",
")",
":",
"filename",
"=",
"get_config_file",
"(",
")",
"config",
"=",
"_ConfigParser",
".",
"SafeConfigParser",
"(",
")",
"config",
".",
"read",
"(",
"filename",
")",
"__section",
"=",
"\"Environment... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _ServiceBuilder.BuildService | Constructs the service class.
Args:
cls: The class that will be constructed. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/service_reflection.py | def BuildService(self, cls):
"""Constructs the service class.
Args:
cls: The class that will be constructed.
"""
# CallMethod needs to operate with an instance of the Service class. This
# internal wrapper function exists only to be able to pass the service
# instance to the method that ... | def BuildService(self, cls):
"""Constructs the service class.
Args:
cls: The class that will be constructed.
"""
# CallMethod needs to operate with an instance of the Service class. This
# internal wrapper function exists only to be able to pass the service
# instance to the method that ... | [
"Constructs",
"the",
"service",
"class",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/service_reflection.py#L133-L154 | [
"def",
"BuildService",
"(",
"self",
",",
"cls",
")",
":",
"# CallMethod needs to operate with an instance of the Service class. This",
"# internal wrapper function exists only to be able to pass the service",
"# instance to the method that does the real CallMethod work.",
"def",
"_WrapCallMe... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _ServiceBuilder._CallMethod | Calls the method described by a given method descriptor.
Args:
srvc: Instance of the service for which this method is called.
method_descriptor: Descriptor that represent the method to call.
rpc_controller: RPC controller to use for this method's execution.
request: Request protocol message... | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/service_reflection.py | def _CallMethod(self, srvc, method_descriptor,
rpc_controller, request, callback):
"""Calls the method described by a given method descriptor.
Args:
srvc: Instance of the service for which this method is called.
method_descriptor: Descriptor that represent the method to call.
... | def _CallMethod(self, srvc, method_descriptor,
rpc_controller, request, callback):
"""Calls the method described by a given method descriptor.
Args:
srvc: Instance of the service for which this method is called.
method_descriptor: Descriptor that represent the method to call.
... | [
"Calls",
"the",
"method",
"described",
"by",
"a",
"given",
"method",
"descriptor",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/service_reflection.py#L156-L171 | [
"def",
"_CallMethod",
"(",
"self",
",",
"srvc",
",",
"method_descriptor",
",",
"rpc_controller",
",",
"request",
",",
"callback",
")",
":",
"if",
"method_descriptor",
".",
"containing_service",
"!=",
"self",
".",
"descriptor",
":",
"raise",
"RuntimeError",
"(",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _ServiceBuilder._GetRequestClass | Returns the class of the request protocol message.
Args:
method_descriptor: Descriptor of the method for which to return the
request protocol message class.
Returns:
A class that represents the input protocol message of the specified
method. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/service_reflection.py | def _GetRequestClass(self, method_descriptor):
"""Returns the class of the request protocol message.
Args:
method_descriptor: Descriptor of the method for which to return the
request protocol message class.
Returns:
A class that represents the input protocol message of the specified
... | def _GetRequestClass(self, method_descriptor):
"""Returns the class of the request protocol message.
Args:
method_descriptor: Descriptor of the method for which to return the
request protocol message class.
Returns:
A class that represents the input protocol message of the specified
... | [
"Returns",
"the",
"class",
"of",
"the",
"request",
"protocol",
"message",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/service_reflection.py#L173-L187 | [
"def",
"_GetRequestClass",
"(",
"self",
",",
"method_descriptor",
")",
":",
"if",
"method_descriptor",
".",
"containing_service",
"!=",
"self",
".",
"descriptor",
":",
"raise",
"RuntimeError",
"(",
"'GetRequestClass() given method descriptor for wrong service type.'",
")",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _ServiceBuilder._GetResponseClass | Returns the class of the response protocol message.
Args:
method_descriptor: Descriptor of the method for which to return the
response protocol message class.
Returns:
A class that represents the output protocol message of the specified
method. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/service_reflection.py | def _GetResponseClass(self, method_descriptor):
"""Returns the class of the response protocol message.
Args:
method_descriptor: Descriptor of the method for which to return the
response protocol message class.
Returns:
A class that represents the output protocol message of the specifie... | def _GetResponseClass(self, method_descriptor):
"""Returns the class of the response protocol message.
Args:
method_descriptor: Descriptor of the method for which to return the
response protocol message class.
Returns:
A class that represents the output protocol message of the specifie... | [
"Returns",
"the",
"class",
"of",
"the",
"response",
"protocol",
"message",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/service_reflection.py#L189-L203 | [
"def",
"_GetResponseClass",
"(",
"self",
",",
"method_descriptor",
")",
":",
"if",
"method_descriptor",
".",
"containing_service",
"!=",
"self",
".",
"descriptor",
":",
"raise",
"RuntimeError",
"(",
"'GetResponseClass() given method descriptor for wrong service type.'",
")"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _ServiceBuilder._GenerateNonImplementedMethod | Generates and returns a method that can be set for a service methods.
Args:
method: Descriptor of the service method for which a method is to be
generated.
Returns:
A method that can be added to the service class. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/service_reflection.py | def _GenerateNonImplementedMethod(self, method):
"""Generates and returns a method that can be set for a service methods.
Args:
method: Descriptor of the service method for which a method is to be
generated.
Returns:
A method that can be added to the service class.
"""
return l... | def _GenerateNonImplementedMethod(self, method):
"""Generates and returns a method that can be set for a service methods.
Args:
method: Descriptor of the service method for which a method is to be
generated.
Returns:
A method that can be added to the service class.
"""
return l... | [
"Generates",
"and",
"returns",
"a",
"method",
"that",
"can",
"be",
"set",
"for",
"a",
"service",
"methods",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/service_reflection.py#L205-L216 | [
"def",
"_GenerateNonImplementedMethod",
"(",
"self",
",",
"method",
")",
":",
"return",
"lambda",
"inst",
",",
"rpc_controller",
",",
"request",
",",
"callback",
":",
"(",
"self",
".",
"_NonImplementedMethod",
"(",
"method",
".",
"name",
",",
"rpc_controller",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _ServiceStubBuilder.BuildServiceStub | Constructs the stub class.
Args:
cls: The class that will be constructed. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/service_reflection.py | def BuildServiceStub(self, cls):
"""Constructs the stub class.
Args:
cls: The class that will be constructed.
"""
def _ServiceStubInit(stub, rpc_channel):
stub.rpc_channel = rpc_channel
self.cls = cls
cls.__init__ = _ServiceStubInit
for method in self.descriptor.methods:
... | def BuildServiceStub(self, cls):
"""Constructs the stub class.
Args:
cls: The class that will be constructed.
"""
def _ServiceStubInit(stub, rpc_channel):
stub.rpc_channel = rpc_channel
self.cls = cls
cls.__init__ = _ServiceStubInit
for method in self.descriptor.methods:
... | [
"Constructs",
"the",
"stub",
"class",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/service_reflection.py#L251-L263 | [
"def",
"BuildServiceStub",
"(",
"self",
",",
"cls",
")",
":",
"def",
"_ServiceStubInit",
"(",
"stub",
",",
"rpc_channel",
")",
":",
"stub",
".",
"rpc_channel",
"=",
"rpc_channel",
"self",
".",
"cls",
"=",
"cls",
"cls",
".",
"__init__",
"=",
"_ServiceStubIn... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _ServiceStubBuilder._StubMethod | The body of all service methods in the generated stub class.
Args:
stub: Stub instance.
method_descriptor: Descriptor of the invoked method.
rpc_controller: Rpc controller to execute the method.
request: Request protocol message.
callback: A callback to execute when the method finishe... | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/service_reflection.py | def _StubMethod(self, stub, method_descriptor,
rpc_controller, request, callback):
"""The body of all service methods in the generated stub class.
Args:
stub: Stub instance.
method_descriptor: Descriptor of the invoked method.
rpc_controller: Rpc controller to execute the me... | def _StubMethod(self, stub, method_descriptor,
rpc_controller, request, callback):
"""The body of all service methods in the generated stub class.
Args:
stub: Stub instance.
method_descriptor: Descriptor of the invoked method.
rpc_controller: Rpc controller to execute the me... | [
"The",
"body",
"of",
"all",
"service",
"methods",
"in",
"the",
"generated",
"stub",
"class",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/service_reflection.py#L269-L284 | [
"def",
"_StubMethod",
"(",
"self",
",",
"stub",
",",
"method_descriptor",
",",
"rpc_controller",
",",
"request",
",",
"callback",
")",
":",
"return",
"stub",
".",
"rpc_channel",
".",
"CallMethod",
"(",
"method_descriptor",
",",
"rpc_controller",
",",
"request",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | MessageToString | Convert protobuf message to text format.
Floating point values can be formatted compactly with 15 digits of
precision (which is the most that IEEE 754 "double" can guarantee)
using float_format='.15g'. To ensure that converting to text and back to a
proto will result in an identical value, float_format='.17g' ... | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/text_format.py | def MessageToString(message,
as_utf8=False,
as_one_line=False,
pointy_brackets=False,
use_index_order=False,
float_format=None,
use_field_number=False,
descriptor_pool=None,
... | def MessageToString(message,
as_utf8=False,
as_one_line=False,
pointy_brackets=False,
use_index_order=False,
float_format=None,
use_field_number=False,
descriptor_pool=None,
... | [
"Convert",
"protobuf",
"message",
"to",
"text",
"format",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/text_format.py#L121-L164 | [
"def",
"MessageToString",
"(",
"message",
",",
"as_utf8",
"=",
"False",
",",
"as_one_line",
"=",
"False",
",",
"pointy_brackets",
"=",
"False",
",",
"use_index_order",
"=",
"False",
",",
"float_format",
"=",
"None",
",",
"use_field_number",
"=",
"False",
",",
... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | PrintFieldValue | Print a single field value (not including name). | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/text_format.py | def PrintFieldValue(field,
value,
out,
indent=0,
as_utf8=False,
as_one_line=False,
pointy_brackets=False,
use_index_order=False,
float_format=None):
"""Print ... | def PrintFieldValue(field,
value,
out,
indent=0,
as_utf8=False,
as_one_line=False,
pointy_brackets=False,
use_index_order=False,
float_format=None):
"""Print ... | [
"Print",
"a",
"single",
"field",
"value",
"(",
"not",
"including",
"name",
")",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/text_format.py#L204-L216 | [
"def",
"PrintFieldValue",
"(",
"field",
",",
"value",
",",
"out",
",",
"indent",
"=",
"0",
",",
"as_utf8",
"=",
"False",
",",
"as_one_line",
"=",
"False",
",",
"pointy_brackets",
"=",
"False",
",",
"use_index_order",
"=",
"False",
",",
"float_format",
"=",... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
train | _BuildMessageFromTypeName | Returns a protobuf message instance.
Args:
type_name: Fully-qualified protobuf message type name string.
descriptor_pool: DescriptorPool instance.
Returns:
A Message instance of type matching type_name, or None if the a Descriptor
wasn't found matching type_name. | src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/text_format.py | def _BuildMessageFromTypeName(type_name, descriptor_pool):
"""Returns a protobuf message instance.
Args:
type_name: Fully-qualified protobuf message type name string.
descriptor_pool: DescriptorPool instance.
Returns:
A Message instance of type matching type_name, or None if the a Descriptor
wa... | def _BuildMessageFromTypeName(type_name, descriptor_pool):
"""Returns a protobuf message instance.
Args:
type_name: Fully-qualified protobuf message type name string.
descriptor_pool: DescriptorPool instance.
Returns:
A Message instance of type matching type_name, or None if the a Descriptor
wa... | [
"Returns",
"a",
"protobuf",
"message",
"instance",
"."
] | apple/turicreate | python | https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/text_format.py#L219-L238 | [
"def",
"_BuildMessageFromTypeName",
"(",
"type_name",
",",
"descriptor_pool",
")",
":",
"# pylint: disable=g-import-not-at-top",
"from",
"google",
".",
"protobuf",
"import",
"symbol_database",
"database",
"=",
"symbol_database",
".",
"Default",
"(",
")",
"try",
":",
"... | 74514c3f99e25b46f22c6e02977fe3da69221c2e |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.