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
RepeatedCompositeFieldContainer.add
Adds a new element at the end of the list and returns it. Keyword arguments may be used to initialize the element.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/containers.py
def add(self, **kwargs): """Adds a new element at the end of the list and returns it. Keyword arguments may be used to initialize the element. """ new_element = self._message_descriptor._concrete_class(**kwargs) new_element._SetListener(self._message_listener) self._values.append(new_element) ...
def add(self, **kwargs): """Adds a new element at the end of the list and returns it. Keyword arguments may be used to initialize the element. """ new_element = self._message_descriptor._concrete_class(**kwargs) new_element._SetListener(self._message_listener) self._values.append(new_element) ...
[ "Adds", "a", "new", "element", "at", "the", "end", "of", "the", "list", "and", "returns", "it", ".", "Keyword", "arguments", "may", "be", "used", "to", "initialize", "the", "element", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/containers.py#L368-L377
[ "def", "add", "(", "self", ",", "*", "*", "kwargs", ")", ":", "new_element", "=", "self", ".", "_message_descriptor", ".", "_concrete_class", "(", "*", "*", "kwargs", ")", "new_element", ".", "_SetListener", "(", "self", ".", "_message_listener", ")", "sel...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
RepeatedCompositeFieldContainer.extend
Extends by appending the given sequence of elements of the same type as this one, copying each individual message.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/containers.py
def extend(self, elem_seq): """Extends by appending the given sequence of elements of the same type as this one, copying each individual message. """ message_class = self._message_descriptor._concrete_class listener = self._message_listener values = self._values for message in elem_seq: ...
def extend(self, elem_seq): """Extends by appending the given sequence of elements of the same type as this one, copying each individual message. """ message_class = self._message_descriptor._concrete_class listener = self._message_listener values = self._values for message in elem_seq: ...
[ "Extends", "by", "appending", "the", "given", "sequence", "of", "elements", "of", "the", "same", "type", "as", "this", "one", "copying", "each", "individual", "message", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/containers.py#L379-L391
[ "def", "extend", "(", "self", ",", "elem_seq", ")", ":", "message_class", "=", "self", ".", "_message_descriptor", ".", "_concrete_class", "listener", "=", "self", ".", "_message_listener", "values", "=", "self", ".", "_values", "for", "message", "in", "elem_s...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
difference
Returns the elements of B that are not in A.
deps/src/boost_1_68_0/tools/build/src/util/set.py
def difference (b, a): """ Returns the elements of B that are not in A. """ a = set(a) result = [] for item in b: if item not in a: result.append(item) return result
def difference (b, a): """ Returns the elements of B that are not in A. """ a = set(a) result = [] for item in b: if item not in a: result.append(item) return result
[ "Returns", "the", "elements", "of", "B", "that", "are", "not", "in", "A", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/set.py#L10-L18
[ "def", "difference", "(", "b", ",", "a", ")", ":", "a", "=", "set", "(", "a", ")", "result", "=", "[", "]", "for", "item", "in", "b", ":", "if", "item", "not", "in", "a", ":", "result", ".", "append", "(", "item", ")", "return", "result" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
intersection
Removes from set1 any items which don't appear in set2 and returns the result.
deps/src/boost_1_68_0/tools/build/src/util/set.py
def intersection (set1, set2): """ Removes from set1 any items which don't appear in set2 and returns the result. """ assert is_iterable(set1) assert is_iterable(set2) result = [] for v in set1: if v in set2: result.append (v) return result
def intersection (set1, set2): """ Removes from set1 any items which don't appear in set2 and returns the result. """ assert is_iterable(set1) assert is_iterable(set2) result = [] for v in set1: if v in set2: result.append (v) return result
[ "Removes", "from", "set1", "any", "items", "which", "don", "t", "appear", "in", "set2", "and", "returns", "the", "result", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/set.py#L20-L29
[ "def", "intersection", "(", "set1", ",", "set2", ")", ":", "assert", "is_iterable", "(", "set1", ")", "assert", "is_iterable", "(", "set2", ")", "result", "=", "[", "]", "for", "v", "in", "set1", ":", "if", "v", "in", "set2", ":", "result", ".", "a...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
contains
Returns true iff all elements of 'small' exist in 'large'.
deps/src/boost_1_68_0/tools/build/src/util/set.py
def contains (small, large): """ Returns true iff all elements of 'small' exist in 'large'. """ small = to_seq (small) large = to_seq (large) for s in small: if not s in large: return False return True
def contains (small, large): """ Returns true iff all elements of 'small' exist in 'large'. """ small = to_seq (small) large = to_seq (large) for s in small: if not s in large: return False return True
[ "Returns", "true", "iff", "all", "elements", "of", "small", "exist", "in", "large", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/set.py#L31-L40
[ "def", "contains", "(", "small", ",", "large", ")", ":", "small", "=", "to_seq", "(", "small", ")", "large", "=", "to_seq", "(", "large", ")", "for", "s", "in", "small", ":", "if", "not", "s", "in", "large", ":", "return", "False", "return", "True"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
equal
Returns True iff 'a' contains the same elements as 'b', irrespective of their order. # TODO: Python 2.4 has a proper set class.
deps/src/boost_1_68_0/tools/build/src/util/set.py
def equal (a, b): """ Returns True iff 'a' contains the same elements as 'b', irrespective of their order. # TODO: Python 2.4 has a proper set class. """ assert is_iterable(a) assert is_iterable(b) return contains (a, b) and contains (b, a)
def equal (a, b): """ Returns True iff 'a' contains the same elements as 'b', irrespective of their order. # TODO: Python 2.4 has a proper set class. """ assert is_iterable(a) assert is_iterable(b) return contains (a, b) and contains (b, a)
[ "Returns", "True", "iff", "a", "contains", "the", "same", "elements", "as", "b", "irrespective", "of", "their", "order", ".", "#", "TODO", ":", "Python", "2", ".", "4", "has", "a", "proper", "set", "class", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/set.py#L42-L48
[ "def", "equal", "(", "a", ",", "b", ")", ":", "assert", "is_iterable", "(", "a", ")", "assert", "is_iterable", "(", "b", ")", "return", "contains", "(", "a", ",", "b", ")", "and", "contains", "(", "b", ",", "a", ")" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
annotate
Annotate your images loaded in either an SFrame or SArray Format The annotate util is a GUI assisted application used to create labels in SArray Image data. Specifying a column, with dtype Image, in an SFrame works as well since SFrames are composed of multiple SArrays. When the GUI is...
src/unity/python/turicreate/toolkits/image_classifier/_annotate.py
def annotate(data, image_column=None, annotation_column='annotations'): """ Annotate your images loaded in either an SFrame or SArray Format The annotate util is a GUI assisted application used to create labels in SArray Image data. Specifying a column, with dtype Image, in an SFrame ...
def annotate(data, image_column=None, annotation_column='annotations'): """ Annotate your images loaded in either an SFrame or SArray Format The annotate util is a GUI assisted application used to create labels in SArray Image data. Specifying a column, with dtype Image, in an SFrame ...
[ "Annotate", "your", "images", "loaded", "in", "either", "an", "SFrame", "or", "SArray", "Format" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/image_classifier/_annotate.py#L30-L171
[ "def", "annotate", "(", "data", ",", "image_column", "=", "None", ",", "annotation_column", "=", "'annotations'", ")", ":", "# Check Value of Column Variables", "if", "image_column", "==", "None", ":", "image_column", "=", "_tkutl", ".", "_find_only_image_column", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
recover_annotation
Recover the last annotated SFrame. If you annotate an SFrame and forget to assign it to a variable, this function allows you to recover the last annotated SFrame. Returns ------- out : SFrame A new SFrame that contains the recovered annotation data....
src/unity/python/turicreate/toolkits/image_classifier/_annotate.py
def recover_annotation(): """ Recover the last annotated SFrame. If you annotate an SFrame and forget to assign it to a variable, this function allows you to recover the last annotated SFrame. Returns ------- out : SFrame A new SFrame th...
def recover_annotation(): """ Recover the last annotated SFrame. If you annotate an SFrame and forget to assign it to a variable, this function allows you to recover the last annotated SFrame. Returns ------- out : SFrame A new SFrame th...
[ "Recover", "the", "last", "annotated", "SFrame", ".", "If", "you", "annotate", "an", "SFrame", "and", "forget", "to", "assign", "it", "to", "a", "variable", "this", "function", "allows", "you", "to", "recover", "the", "last", "annotated", "SFrame", ".", "R...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/image_classifier/_annotate.py#L173-L221
[ "def", "recover_annotation", "(", ")", ":", "empty_instance", "=", "__tc", ".", "extensions", ".", "ImageClassification", "(", ")", "annotation_wrapper", "=", "empty_instance", ".", "get_annotation_registry", "(", ")", "return", "annotation_wrapper", ".", "annotation_...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert
Convert a DictVectorizer model to the protobuf spec. Parameters ---------- model: DictVectorizer A fitted DictVectorizer model. input_features: str Name of the input column. output_features: str Name of the output column. Returns ------- model_spec: An object ...
src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_imputer.py
def convert(model, input_features, output_features): """Convert a DictVectorizer model to the protobuf spec. Parameters ---------- model: DictVectorizer A fitted DictVectorizer model. input_features: str Name of the input column. output_features: str Name of the output...
def convert(model, input_features, output_features): """Convert a DictVectorizer model to the protobuf spec. Parameters ---------- model: DictVectorizer A fitted DictVectorizer model. input_features: str Name of the input column. output_features: str Name of the output...
[ "Convert", "a", "DictVectorizer", "model", "to", "the", "protobuf", "spec", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_imputer.py#L21-L76
[ "def", "convert", "(", "model", ",", "input_features", ",", "output_features", ")", ":", "if", "not", "(", "_HAS_SKLEARN", ")", ":", "raise", "RuntimeError", "(", "'scikit-learn not found. scikit-learn conversion API is disabled.'", ")", "# Set the interface params.", "sp...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
print_callback
Internal function. This function is called via a call back returning from IPC to Cython to Python. It tries to perform incremental printing to IPython Notebook or Jupyter Notebook and when all else fails, just prints locally.
src/unity/python/turicreate/_cython/python_printer_callback.py
def print_callback(val): """ Internal function. This function is called via a call back returning from IPC to Cython to Python. It tries to perform incremental printing to IPython Notebook or Jupyter Notebook and when all else fails, just prints locally. """ success = False try: ...
def print_callback(val): """ Internal function. This function is called via a call back returning from IPC to Cython to Python. It tries to perform incremental printing to IPython Notebook or Jupyter Notebook and when all else fails, just prints locally. """ success = False try: ...
[ "Internal", "function", ".", "This", "function", "is", "called", "via", "a", "call", "back", "returning", "from", "IPC", "to", "Cython", "to", "Python", ".", "It", "tries", "to", "perform", "incremental", "printing", "to", "IPython", "Notebook", "or", "Jupyt...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/_cython/python_printer_callback.py#L17-L38
[ "def", "print_callback", "(", "val", ")", ":", "success", "=", "False", "try", ":", "# for reasons I cannot fathom, regular printing, even directly", "# to io.stdout does not work.", "# I have to intrude rather deep into IPython to make it behave", "if", "have_ipython", ":", "if", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
run
Internal function to execute toolkit on the turicreate server. Parameters ---------- toolkit_name : string The name of the toolkit. options : dict A map containing the required input for the toolkit function, for example: {'graph': g, 'reset_prob': 0.15}. verbose : bool ...
src/unity/python/turicreate/toolkits/_main.py
def run(toolkit_name, options, verbose=True, show_progress=False): """ Internal function to execute toolkit on the turicreate server. Parameters ---------- toolkit_name : string The name of the toolkit. options : dict A map containing the required input for the toolkit function...
def run(toolkit_name, options, verbose=True, show_progress=False): """ Internal function to execute toolkit on the turicreate server. Parameters ---------- toolkit_name : string The name of the toolkit. options : dict A map containing the required input for the toolkit function...
[ "Internal", "function", "to", "execute", "toolkit", "on", "the", "turicreate", "server", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_main.py#L25-L69
[ "def", "run", "(", "toolkit_name", ",", "options", ",", "verbose", "=", "True", ",", "show_progress", "=", "False", ")", ":", "unity", "=", "glconnect", ".", "get_unity", "(", ")", "if", "(", "not", "verbose", ")", ":", "glconnect", ".", "get_server", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_RoundTowardZero
Truncates the remainder part after division.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
def _RoundTowardZero(value, divider): """Truncates the remainder part after division.""" # For some languanges, the sign of the remainder is implementation # dependent if any of the operands is negative. Here we enforce # "rounded toward zero" semantics. For example, for (-5) / 2 an # implementation may give ...
def _RoundTowardZero(value, divider): """Truncates the remainder part after division.""" # For some languanges, the sign of the remainder is implementation # dependent if any of the operands is negative. Here we enforce # "rounded toward zero" semantics. For example, for (-5) / 2 an # implementation may give ...
[ "Truncates", "the", "remainder", "part", "after", "division", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L378-L390
[ "def", "_RoundTowardZero", "(", "value", ",", "divider", ")", ":", "# For some languanges, the sign of the remainder is implementation", "# dependent if any of the operands is negative. Here we enforce", "# \"rounded toward zero\" semantics. For example, for (-5) / 2 an", "# implementation may...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_IsValidPath
Checks whether the path is valid for Message Descriptor.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
def _IsValidPath(message_descriptor, path): """Checks whether the path is valid for Message Descriptor.""" parts = path.split('.') last = parts.pop() for name in parts: field = message_descriptor.fields_by_name[name] if (field is None or field.label == FieldDescriptor.LABEL_REPEATED or f...
def _IsValidPath(message_descriptor, path): """Checks whether the path is valid for Message Descriptor.""" parts = path.split('.') last = parts.pop() for name in parts: field = message_descriptor.fields_by_name[name] if (field is None or field.label == FieldDescriptor.LABEL_REPEATED or f...
[ "Checks", "whether", "the", "path", "is", "valid", "for", "Message", "Descriptor", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L471-L482
[ "def", "_IsValidPath", "(", "message_descriptor", ",", "path", ")", ":", "parts", "=", "path", ".", "split", "(", "'.'", ")", "last", "=", "parts", ".", "pop", "(", ")", "for", "name", "in", "parts", ":", "field", "=", "message_descriptor", ".", "field...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_CheckFieldMaskMessage
Raises ValueError if message is not a FieldMask.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
def _CheckFieldMaskMessage(message): """Raises ValueError if message is not a FieldMask.""" message_descriptor = message.DESCRIPTOR if (message_descriptor.name != 'FieldMask' or message_descriptor.file.name != 'google/protobuf/field_mask.proto'): raise ValueError('Message {0} is not a FieldMask.'.format...
def _CheckFieldMaskMessage(message): """Raises ValueError if message is not a FieldMask.""" message_descriptor = message.DESCRIPTOR if (message_descriptor.name != 'FieldMask' or message_descriptor.file.name != 'google/protobuf/field_mask.proto'): raise ValueError('Message {0} is not a FieldMask.'.format...
[ "Raises", "ValueError", "if", "message", "is", "not", "a", "FieldMask", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L485-L491
[ "def", "_CheckFieldMaskMessage", "(", "message", ")", ":", "message_descriptor", "=", "message", ".", "DESCRIPTOR", "if", "(", "message_descriptor", ".", "name", "!=", "'FieldMask'", "or", "message_descriptor", ".", "file", ".", "name", "!=", "'google/protobuf/field...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_SnakeCaseToCamelCase
Converts a path name from snake_case to camelCase.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
def _SnakeCaseToCamelCase(path_name): """Converts a path name from snake_case to camelCase.""" result = [] after_underscore = False for c in path_name: if c.isupper(): raise Error('Fail to print FieldMask to Json string: Path name ' '{0} must not contain uppercase letters.'.format(pa...
def _SnakeCaseToCamelCase(path_name): """Converts a path name from snake_case to camelCase.""" result = [] after_underscore = False for c in path_name: if c.isupper(): raise Error('Fail to print FieldMask to Json string: Path name ' '{0} must not contain uppercase letters.'.format(pa...
[ "Converts", "a", "path", "name", "from", "snake_case", "to", "camelCase", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L494-L518
[ "def", "_SnakeCaseToCamelCase", "(", "path_name", ")", ":", "result", "=", "[", "]", "after_underscore", "=", "False", "for", "c", "in", "path_name", ":", "if", "c", ".", "isupper", "(", ")", ":", "raise", "Error", "(", "'Fail to print FieldMask to Json string...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_CamelCaseToSnakeCase
Converts a field name from camelCase to snake_case.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
def _CamelCaseToSnakeCase(path_name): """Converts a field name from camelCase to snake_case.""" result = [] for c in path_name: if c == '_': raise ParseError('Fail to parse FieldMask: Path name ' '{0} must not contain "_"s.'.format(path_name)) if c.isupper(): result += '...
def _CamelCaseToSnakeCase(path_name): """Converts a field name from camelCase to snake_case.""" result = [] for c in path_name: if c == '_': raise ParseError('Fail to parse FieldMask: Path name ' '{0} must not contain "_"s.'.format(path_name)) if c.isupper(): result += '...
[ "Converts", "a", "field", "name", "from", "camelCase", "to", "snake_case", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L521-L533
[ "def", "_CamelCaseToSnakeCase", "(", "path_name", ")", ":", "result", "=", "[", "]", "for", "c", "in", "path_name", ":", "if", "c", "==", "'_'", ":", "raise", "ParseError", "(", "'Fail to parse FieldMask: Path name '", "'{0} must not contain \"_\"s.'", ".", "forma...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_MergeMessage
Merge all fields specified by a sub-tree from source to destination.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
def _MergeMessage( node, source, destination, replace_message, replace_repeated): """Merge all fields specified by a sub-tree from source to destination.""" source_descriptor = source.DESCRIPTOR for name in node: child = node[name] field = source_descriptor.fields_by_name[name] if field is None: ...
def _MergeMessage( node, source, destination, replace_message, replace_repeated): """Merge all fields specified by a sub-tree from source to destination.""" source_descriptor = source.DESCRIPTOR for name in node: child = node[name] field = source_descriptor.fields_by_name[name] if field is None: ...
[ "Merge", "all", "fields", "specified", "by", "a", "sub", "-", "tree", "from", "source", "to", "destination", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L633-L671
[ "def", "_MergeMessage", "(", "node", ",", "source", ",", "destination", ",", "replace_message", ",", "replace_repeated", ")", ":", "source_descriptor", "=", "source", ".", "DESCRIPTOR", "for", "name", "in", "node", ":", "child", "=", "node", "[", "name", "]"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_AddFieldPaths
Adds the field paths descended from node to field_mask.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
def _AddFieldPaths(node, prefix, field_mask): """Adds the field paths descended from node to field_mask.""" if not node: field_mask.paths.append(prefix) return for name in sorted(node): if prefix: child_path = prefix + '.' + name else: child_path = name _AddFieldPaths(node[name], c...
def _AddFieldPaths(node, prefix, field_mask): """Adds the field paths descended from node to field_mask.""" if not node: field_mask.paths.append(prefix) return for name in sorted(node): if prefix: child_path = prefix + '.' + name else: child_path = name _AddFieldPaths(node[name], c...
[ "Adds", "the", "field", "paths", "descended", "from", "node", "to", "field_mask", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L674-L684
[ "def", "_AddFieldPaths", "(", "node", ",", "prefix", ",", "field_mask", ")", ":", "if", "not", "node", ":", "field_mask", ".", "paths", ".", "append", "(", "prefix", ")", "return", "for", "name", "in", "sorted", "(", "node", ")", ":", "if", "prefix", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Any.Pack
Packs the specified message into current Any message.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
def Pack(self, msg, type_url_prefix='type.googleapis.com/'): """Packs the specified message into current Any message.""" if len(type_url_prefix) < 1 or type_url_prefix[-1] != '/': self.type_url = '%s/%s' % (type_url_prefix, msg.DESCRIPTOR.full_name) else: self.type_url = '%s%s' % (type_url_prefi...
def Pack(self, msg, type_url_prefix='type.googleapis.com/'): """Packs the specified message into current Any message.""" if len(type_url_prefix) < 1 or type_url_prefix[-1] != '/': self.type_url = '%s/%s' % (type_url_prefix, msg.DESCRIPTOR.full_name) else: self.type_url = '%s%s' % (type_url_prefi...
[ "Packs", "the", "specified", "message", "into", "current", "Any", "message", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L70-L76
[ "def", "Pack", "(", "self", ",", "msg", ",", "type_url_prefix", "=", "'type.googleapis.com/'", ")", ":", "if", "len", "(", "type_url_prefix", ")", "<", "1", "or", "type_url_prefix", "[", "-", "1", "]", "!=", "'/'", ":", "self", ".", "type_url", "=", "'...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Any.Unpack
Unpacks the current Any message into specified message.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
def Unpack(self, msg): """Unpacks the current Any message into specified message.""" descriptor = msg.DESCRIPTOR if not self.Is(descriptor): return False msg.ParseFromString(self.value) return True
def Unpack(self, msg): """Unpacks the current Any message into specified message.""" descriptor = msg.DESCRIPTOR if not self.Is(descriptor): return False msg.ParseFromString(self.value) return True
[ "Unpacks", "the", "current", "Any", "message", "into", "specified", "message", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L78-L84
[ "def", "Unpack", "(", "self", ",", "msg", ")", ":", "descriptor", "=", "msg", ".", "DESCRIPTOR", "if", "not", "self", ".", "Is", "(", "descriptor", ")", ":", "return", "False", "msg", ".", "ParseFromString", "(", "self", ".", "value", ")", "return", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Timestamp.ToJsonString
Converts Timestamp to RFC 3339 date string format. Returns: A string converted from timestamp. The string is always Z-normalized and uses 3, 6 or 9 fractional digits as required to represent the exact time. Example of the return format: '1972-01-01T10:00:20.021Z'
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
def ToJsonString(self): """Converts Timestamp to RFC 3339 date string format. Returns: A string converted from timestamp. The string is always Z-normalized and uses 3, 6 or 9 fractional digits as required to represent the exact time. Example of the return format: '1972-01-01T10:00:20.021Z' ...
def ToJsonString(self): """Converts Timestamp to RFC 3339 date string format. Returns: A string converted from timestamp. The string is always Z-normalized and uses 3, 6 or 9 fractional digits as required to represent the exact time. Example of the return format: '1972-01-01T10:00:20.021Z' ...
[ "Converts", "Timestamp", "to", "RFC", "3339", "date", "string", "format", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L99-L125
[ "def", "ToJsonString", "(", "self", ")", ":", "nanos", "=", "self", ".", "nanos", "%", "_NANOS_PER_SECOND", "total_sec", "=", "self", ".", "seconds", "+", "(", "self", ".", "nanos", "-", "nanos", ")", "//", "_NANOS_PER_SECOND", "seconds", "=", "total_sec",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Timestamp.FromJsonString
Parse a RFC 3339 date string format to Timestamp. Args: value: A date string. Any fractional digits (or none) and any offset are accepted as long as they fit into nano-seconds precision. Example of accepted format: '1972-01-01T10:00:20.021-05:00' Raises: ParseError: On parsing ...
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
def FromJsonString(self, value): """Parse a RFC 3339 date string format to Timestamp. Args: value: A date string. Any fractional digits (or none) and any offset are accepted as long as they fit into nano-seconds precision. Example of accepted format: '1972-01-01T10:00:20.021-05:00' ...
def FromJsonString(self, value): """Parse a RFC 3339 date string format to Timestamp. Args: value: A date string. Any fractional digits (or none) and any offset are accepted as long as they fit into nano-seconds precision. Example of accepted format: '1972-01-01T10:00:20.021-05:00' ...
[ "Parse", "a", "RFC", "3339", "date", "string", "format", "to", "Timestamp", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L127-L183
[ "def", "FromJsonString", "(", "self", ",", "value", ")", ":", "timezone_offset", "=", "value", ".", "find", "(", "'Z'", ")", "if", "timezone_offset", "==", "-", "1", ":", "timezone_offset", "=", "value", ".", "find", "(", "'+'", ")", "if", "timezone_offs...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Timestamp.FromNanoseconds
Converts nanoseconds since epoch to Timestamp.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
def FromNanoseconds(self, nanos): """Converts nanoseconds since epoch to Timestamp.""" self.seconds = nanos // _NANOS_PER_SECOND self.nanos = nanos % _NANOS_PER_SECOND
def FromNanoseconds(self, nanos): """Converts nanoseconds since epoch to Timestamp.""" self.seconds = nanos // _NANOS_PER_SECOND self.nanos = nanos % _NANOS_PER_SECOND
[ "Converts", "nanoseconds", "since", "epoch", "to", "Timestamp", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L207-L210
[ "def", "FromNanoseconds", "(", "self", ",", "nanos", ")", ":", "self", ".", "seconds", "=", "nanos", "//", "_NANOS_PER_SECOND", "self", ".", "nanos", "=", "nanos", "%", "_NANOS_PER_SECOND" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Timestamp.FromMicroseconds
Converts microseconds since epoch to Timestamp.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
def FromMicroseconds(self, micros): """Converts microseconds since epoch to Timestamp.""" self.seconds = micros // _MICROS_PER_SECOND self.nanos = (micros % _MICROS_PER_SECOND) * _NANOS_PER_MICROSECOND
def FromMicroseconds(self, micros): """Converts microseconds since epoch to Timestamp.""" self.seconds = micros // _MICROS_PER_SECOND self.nanos = (micros % _MICROS_PER_SECOND) * _NANOS_PER_MICROSECOND
[ "Converts", "microseconds", "since", "epoch", "to", "Timestamp", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L212-L215
[ "def", "FromMicroseconds", "(", "self", ",", "micros", ")", ":", "self", ".", "seconds", "=", "micros", "//", "_MICROS_PER_SECOND", "self", ".", "nanos", "=", "(", "micros", "%", "_MICROS_PER_SECOND", ")", "*", "_NANOS_PER_MICROSECOND" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Timestamp.FromMilliseconds
Converts milliseconds since epoch to Timestamp.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
def FromMilliseconds(self, millis): """Converts milliseconds since epoch to Timestamp.""" self.seconds = millis // _MILLIS_PER_SECOND self.nanos = (millis % _MILLIS_PER_SECOND) * _NANOS_PER_MILLISECOND
def FromMilliseconds(self, millis): """Converts milliseconds since epoch to Timestamp.""" self.seconds = millis // _MILLIS_PER_SECOND self.nanos = (millis % _MILLIS_PER_SECOND) * _NANOS_PER_MILLISECOND
[ "Converts", "milliseconds", "since", "epoch", "to", "Timestamp", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L217-L220
[ "def", "FromMilliseconds", "(", "self", ",", "millis", ")", ":", "self", ".", "seconds", "=", "millis", "//", "_MILLIS_PER_SECOND", "self", ".", "nanos", "=", "(", "millis", "%", "_MILLIS_PER_SECOND", ")", "*", "_NANOS_PER_MILLISECOND" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Timestamp.ToDatetime
Converts Timestamp to datetime.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
def ToDatetime(self): """Converts Timestamp to datetime.""" return datetime.utcfromtimestamp( self.seconds + self.nanos / float(_NANOS_PER_SECOND))
def ToDatetime(self): """Converts Timestamp to datetime.""" return datetime.utcfromtimestamp( self.seconds + self.nanos / float(_NANOS_PER_SECOND))
[ "Converts", "Timestamp", "to", "datetime", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L227-L230
[ "def", "ToDatetime", "(", "self", ")", ":", "return", "datetime", ".", "utcfromtimestamp", "(", "self", ".", "seconds", "+", "self", ".", "nanos", "/", "float", "(", "_NANOS_PER_SECOND", ")", ")" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Timestamp.FromDatetime
Converts datetime to Timestamp.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
def FromDatetime(self, dt): """Converts datetime to Timestamp.""" td = dt - datetime(1970, 1, 1) self.seconds = td.seconds + td.days * _SECONDS_PER_DAY self.nanos = td.microseconds * _NANOS_PER_MICROSECOND
def FromDatetime(self, dt): """Converts datetime to Timestamp.""" td = dt - datetime(1970, 1, 1) self.seconds = td.seconds + td.days * _SECONDS_PER_DAY self.nanos = td.microseconds * _NANOS_PER_MICROSECOND
[ "Converts", "datetime", "to", "Timestamp", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L232-L236
[ "def", "FromDatetime", "(", "self", ",", "dt", ")", ":", "td", "=", "dt", "-", "datetime", "(", "1970", ",", "1", ",", "1", ")", "self", ".", "seconds", "=", "td", ".", "seconds", "+", "td", ".", "days", "*", "_SECONDS_PER_DAY", "self", ".", "nan...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Duration.ToMicroseconds
Converts a Duration to microseconds.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
def ToMicroseconds(self): """Converts a Duration to microseconds.""" micros = _RoundTowardZero(self.nanos, _NANOS_PER_MICROSECOND) return self.seconds * _MICROS_PER_SECOND + micros
def ToMicroseconds(self): """Converts a Duration to microseconds.""" micros = _RoundTowardZero(self.nanos, _NANOS_PER_MICROSECOND) return self.seconds * _MICROS_PER_SECOND + micros
[ "Converts", "a", "Duration", "to", "microseconds", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L310-L313
[ "def", "ToMicroseconds", "(", "self", ")", ":", "micros", "=", "_RoundTowardZero", "(", "self", ".", "nanos", ",", "_NANOS_PER_MICROSECOND", ")", "return", "self", ".", "seconds", "*", "_MICROS_PER_SECOND", "+", "micros" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Duration.ToMilliseconds
Converts a Duration to milliseconds.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
def ToMilliseconds(self): """Converts a Duration to milliseconds.""" millis = _RoundTowardZero(self.nanos, _NANOS_PER_MILLISECOND) return self.seconds * _MILLIS_PER_SECOND + millis
def ToMilliseconds(self): """Converts a Duration to milliseconds.""" millis = _RoundTowardZero(self.nanos, _NANOS_PER_MILLISECOND) return self.seconds * _MILLIS_PER_SECOND + millis
[ "Converts", "a", "Duration", "to", "milliseconds", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L315-L318
[ "def", "ToMilliseconds", "(", "self", ")", ":", "millis", "=", "_RoundTowardZero", "(", "self", ".", "nanos", ",", "_NANOS_PER_MILLISECOND", ")", "return", "self", ".", "seconds", "*", "_MILLIS_PER_SECOND", "+", "millis" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Duration.FromMicroseconds
Converts microseconds to Duration.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
def FromMicroseconds(self, micros): """Converts microseconds to Duration.""" self._NormalizeDuration( micros // _MICROS_PER_SECOND, (micros % _MICROS_PER_SECOND) * _NANOS_PER_MICROSECOND)
def FromMicroseconds(self, micros): """Converts microseconds to Duration.""" self._NormalizeDuration( micros // _MICROS_PER_SECOND, (micros % _MICROS_PER_SECOND) * _NANOS_PER_MICROSECOND)
[ "Converts", "microseconds", "to", "Duration", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L329-L333
[ "def", "FromMicroseconds", "(", "self", ",", "micros", ")", ":", "self", ".", "_NormalizeDuration", "(", "micros", "//", "_MICROS_PER_SECOND", ",", "(", "micros", "%", "_MICROS_PER_SECOND", ")", "*", "_NANOS_PER_MICROSECOND", ")" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Duration.FromMilliseconds
Converts milliseconds to Duration.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
def FromMilliseconds(self, millis): """Converts milliseconds to Duration.""" self._NormalizeDuration( millis // _MILLIS_PER_SECOND, (millis % _MILLIS_PER_SECOND) * _NANOS_PER_MILLISECOND)
def FromMilliseconds(self, millis): """Converts milliseconds to Duration.""" self._NormalizeDuration( millis // _MILLIS_PER_SECOND, (millis % _MILLIS_PER_SECOND) * _NANOS_PER_MILLISECOND)
[ "Converts", "milliseconds", "to", "Duration", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L335-L339
[ "def", "FromMilliseconds", "(", "self", ",", "millis", ")", ":", "self", ".", "_NormalizeDuration", "(", "millis", "//", "_MILLIS_PER_SECOND", ",", "(", "millis", "%", "_MILLIS_PER_SECOND", ")", "*", "_NANOS_PER_MILLISECOND", ")" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Duration.ToTimedelta
Converts Duration to timedelta.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
def ToTimedelta(self): """Converts Duration to timedelta.""" return timedelta( seconds=self.seconds, microseconds=_RoundTowardZero( self.nanos, _NANOS_PER_MICROSECOND))
def ToTimedelta(self): """Converts Duration to timedelta.""" return timedelta( seconds=self.seconds, microseconds=_RoundTowardZero( self.nanos, _NANOS_PER_MICROSECOND))
[ "Converts", "Duration", "to", "timedelta", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L346-L350
[ "def", "ToTimedelta", "(", "self", ")", ":", "return", "timedelta", "(", "seconds", "=", "self", ".", "seconds", ",", "microseconds", "=", "_RoundTowardZero", "(", "self", ".", "nanos", ",", "_NANOS_PER_MICROSECOND", ")", ")" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Duration.FromTimedelta
Convertd timedelta to Duration.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
def FromTimedelta(self, td): """Convertd timedelta to Duration.""" self._NormalizeDuration(td.seconds + td.days * _SECONDS_PER_DAY, td.microseconds * _NANOS_PER_MICROSECOND)
def FromTimedelta(self, td): """Convertd timedelta to Duration.""" self._NormalizeDuration(td.seconds + td.days * _SECONDS_PER_DAY, td.microseconds * _NANOS_PER_MICROSECOND)
[ "Convertd", "timedelta", "to", "Duration", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L352-L355
[ "def", "FromTimedelta", "(", "self", ",", "td", ")", ":", "self", ".", "_NormalizeDuration", "(", "td", ".", "seconds", "+", "td", ".", "days", "*", "_SECONDS_PER_DAY", ",", "td", ".", "microseconds", "*", "_NANOS_PER_MICROSECOND", ")" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Duration._NormalizeDuration
Set Duration by seconds and nonas.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
def _NormalizeDuration(self, seconds, nanos): """Set Duration by seconds and nonas.""" # Force nanos to be negative if the duration is negative. if seconds < 0 and nanos > 0: seconds += 1 nanos -= _NANOS_PER_SECOND self.seconds = seconds self.nanos = nanos
def _NormalizeDuration(self, seconds, nanos): """Set Duration by seconds and nonas.""" # Force nanos to be negative if the duration is negative. if seconds < 0 and nanos > 0: seconds += 1 nanos -= _NANOS_PER_SECOND self.seconds = seconds self.nanos = nanos
[ "Set", "Duration", "by", "seconds", "and", "nonas", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L357-L364
[ "def", "_NormalizeDuration", "(", "self", ",", "seconds", ",", "nanos", ")", ":", "# Force nanos to be negative if the duration is negative.", "if", "seconds", "<", "0", "and", "nanos", ">", "0", ":", "seconds", "+=", "1", "nanos", "-=", "_NANOS_PER_SECOND", "self...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
FieldMask.ToJsonString
Converts FieldMask to string according to proto3 JSON spec.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
def ToJsonString(self): """Converts FieldMask to string according to proto3 JSON spec.""" camelcase_paths = [] for path in self.paths: camelcase_paths.append(_SnakeCaseToCamelCase(path)) return ','.join(camelcase_paths)
def ToJsonString(self): """Converts FieldMask to string according to proto3 JSON spec.""" camelcase_paths = [] for path in self.paths: camelcase_paths.append(_SnakeCaseToCamelCase(path)) return ','.join(camelcase_paths)
[ "Converts", "FieldMask", "to", "string", "according", "to", "proto3", "JSON", "spec", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L396-L401
[ "def", "ToJsonString", "(", "self", ")", ":", "camelcase_paths", "=", "[", "]", "for", "path", "in", "self", ".", "paths", ":", "camelcase_paths", ".", "append", "(", "_SnakeCaseToCamelCase", "(", "path", ")", ")", "return", "','", ".", "join", "(", "cam...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
FieldMask.IsValidForDescriptor
Checks whether the FieldMask is valid for Message Descriptor.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
def IsValidForDescriptor(self, message_descriptor): """Checks whether the FieldMask is valid for Message Descriptor.""" for path in self.paths: if not _IsValidPath(message_descriptor, path): return False return True
def IsValidForDescriptor(self, message_descriptor): """Checks whether the FieldMask is valid for Message Descriptor.""" for path in self.paths: if not _IsValidPath(message_descriptor, path): return False return True
[ "Checks", "whether", "the", "FieldMask", "is", "valid", "for", "Message", "Descriptor", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L409-L414
[ "def", "IsValidForDescriptor", "(", "self", ",", "message_descriptor", ")", ":", "for", "path", "in", "self", ".", "paths", ":", "if", "not", "_IsValidPath", "(", "message_descriptor", ",", "path", ")", ":", "return", "False", "return", "True" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
FieldMask.AllFieldsFromDescriptor
Gets all direct fields of Message Descriptor to FieldMask.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
def AllFieldsFromDescriptor(self, message_descriptor): """Gets all direct fields of Message Descriptor to FieldMask.""" self.Clear() for field in message_descriptor.fields: self.paths.append(field.name)
def AllFieldsFromDescriptor(self, message_descriptor): """Gets all direct fields of Message Descriptor to FieldMask.""" self.Clear() for field in message_descriptor.fields: self.paths.append(field.name)
[ "Gets", "all", "direct", "fields", "of", "Message", "Descriptor", "to", "FieldMask", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L416-L420
[ "def", "AllFieldsFromDescriptor", "(", "self", ",", "message_descriptor", ")", ":", "self", ".", "Clear", "(", ")", "for", "field", "in", "message_descriptor", ".", "fields", ":", "self", ".", "paths", ".", "append", "(", "field", ".", "name", ")" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
FieldMask.Union
Merges mask1 and mask2 into this FieldMask.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
def Union(self, mask1, mask2): """Merges mask1 and mask2 into this FieldMask.""" _CheckFieldMaskMessage(mask1) _CheckFieldMaskMessage(mask2) tree = _FieldMaskTree(mask1) tree.MergeFromFieldMask(mask2) tree.ToFieldMask(self)
def Union(self, mask1, mask2): """Merges mask1 and mask2 into this FieldMask.""" _CheckFieldMaskMessage(mask1) _CheckFieldMaskMessage(mask2) tree = _FieldMaskTree(mask1) tree.MergeFromFieldMask(mask2) tree.ToFieldMask(self)
[ "Merges", "mask1", "and", "mask2", "into", "this", "FieldMask", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L435-L441
[ "def", "Union", "(", "self", ",", "mask1", ",", "mask2", ")", ":", "_CheckFieldMaskMessage", "(", "mask1", ")", "_CheckFieldMaskMessage", "(", "mask2", ")", "tree", "=", "_FieldMaskTree", "(", "mask1", ")", "tree", ".", "MergeFromFieldMask", "(", "mask2", ")...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
FieldMask.Intersect
Intersects mask1 and mask2 into this FieldMask.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
def Intersect(self, mask1, mask2): """Intersects mask1 and mask2 into this FieldMask.""" _CheckFieldMaskMessage(mask1) _CheckFieldMaskMessage(mask2) tree = _FieldMaskTree(mask1) intersection = _FieldMaskTree() for path in mask2.paths: tree.IntersectPath(path, intersection) intersection...
def Intersect(self, mask1, mask2): """Intersects mask1 and mask2 into this FieldMask.""" _CheckFieldMaskMessage(mask1) _CheckFieldMaskMessage(mask2) tree = _FieldMaskTree(mask1) intersection = _FieldMaskTree() for path in mask2.paths: tree.IntersectPath(path, intersection) intersection...
[ "Intersects", "mask1", "and", "mask2", "into", "this", "FieldMask", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L443-L451
[ "def", "Intersect", "(", "self", ",", "mask1", ",", "mask2", ")", ":", "_CheckFieldMaskMessage", "(", "mask1", ")", "_CheckFieldMaskMessage", "(", "mask2", ")", "tree", "=", "_FieldMaskTree", "(", "mask1", ")", "intersection", "=", "_FieldMaskTree", "(", ")", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
FieldMask.MergeMessage
Merges fields specified in FieldMask from source to destination. Args: source: Source message. destination: The destination message to be merged into. replace_message_field: Replace message field if True. Merge message field if False. replace_repeated_field: Replace repeated field...
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
def MergeMessage( self, source, destination, replace_message_field=False, replace_repeated_field=False): """Merges fields specified in FieldMask from source to destination. Args: source: Source message. destination: The destination message to be merged into. replace_message_field:...
def MergeMessage( self, source, destination, replace_message_field=False, replace_repeated_field=False): """Merges fields specified in FieldMask from source to destination. Args: source: Source message. destination: The destination message to be merged into. replace_message_field:...
[ "Merges", "fields", "specified", "in", "FieldMask", "from", "source", "to", "destination", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L453-L468
[ "def", "MergeMessage", "(", "self", ",", "source", ",", "destination", ",", "replace_message_field", "=", "False", ",", "replace_repeated_field", "=", "False", ")", ":", "tree", "=", "_FieldMaskTree", "(", "self", ")", "tree", ".", "MergeMessage", "(", "source...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_FieldMaskTree.AddPath
Adds a field path into the tree. If the field path to add is a sub-path of an existing field path in the tree (i.e., a leaf node), it means the tree already matches the given path so nothing will be added to the tree. If the path matches an existing non-leaf node in the tree, that non-leaf node wil...
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
def AddPath(self, path): """Adds a field path into the tree. If the field path to add is a sub-path of an existing field path in the tree (i.e., a leaf node), it means the tree already matches the given path so nothing will be added to the tree. If the path matches an existing non-leaf node in the ...
def AddPath(self, path): """Adds a field path into the tree. If the field path to add is a sub-path of an existing field path in the tree (i.e., a leaf node), it means the tree already matches the given path so nothing will be added to the tree. If the path matches an existing non-leaf node in the ...
[ "Adds", "a", "field", "path", "into", "the", "tree", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L560-L583
[ "def", "AddPath", "(", "self", ",", "path", ")", ":", "node", "=", "self", ".", "_root", "for", "name", "in", "path", ".", "split", "(", "'.'", ")", ":", "if", "name", "not", "in", "node", ":", "node", "[", "name", "]", "=", "{", "}", "elif", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_FieldMaskTree.IntersectPath
Calculates the intersection part of a field path with this tree. Args: path: The field path to calculates. intersection: The out tree to record the intersection part.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
def IntersectPath(self, path, intersection): """Calculates the intersection part of a field path with this tree. Args: path: The field path to calculates. intersection: The out tree to record the intersection part. """ node = self._root for name in path.split('.'): if name not in ...
def IntersectPath(self, path, intersection): """Calculates the intersection part of a field path with this tree. Args: path: The field path to calculates. intersection: The out tree to record the intersection part. """ node = self._root for name in path.split('.'): if name not in ...
[ "Calculates", "the", "intersection", "part", "of", "a", "field", "path", "with", "this", "tree", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L590-L605
[ "def", "IntersectPath", "(", "self", ",", "path", ",", "intersection", ")", ":", "node", "=", "self", ".", "_root", "for", "name", "in", "path", ".", "split", "(", "'.'", ")", ":", "if", "name", "not", "in", "node", ":", "return", "elif", "not", "n...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_FieldMaskTree.AddLeafNodes
Adds leaf nodes begin with prefix to this tree.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
def AddLeafNodes(self, prefix, node): """Adds leaf nodes begin with prefix to this tree.""" if not node: self.AddPath(prefix) for name in node: child_path = prefix + '.' + name self.AddLeafNodes(child_path, node[name])
def AddLeafNodes(self, prefix, node): """Adds leaf nodes begin with prefix to this tree.""" if not node: self.AddPath(prefix) for name in node: child_path = prefix + '.' + name self.AddLeafNodes(child_path, node[name])
[ "Adds", "leaf", "nodes", "begin", "with", "prefix", "to", "this", "tree", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L607-L613
[ "def", "AddLeafNodes", "(", "self", ",", "prefix", ",", "node", ")", ":", "if", "not", "node", ":", "self", ".", "AddPath", "(", "prefix", ")", "for", "name", "in", "node", ":", "child_path", "=", "prefix", "+", "'.'", "+", "name", "self", ".", "Ad...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_FieldMaskTree.MergeMessage
Merge all fields specified by this tree from source to destination.
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
def MergeMessage( self, source, destination, replace_message, replace_repeated): """Merge all fields specified by this tree from source to destination.""" _MergeMessage( self._root, source, destination, replace_message, replace_repeated)
def MergeMessage( self, source, destination, replace_message, replace_repeated): """Merge all fields specified by this tree from source to destination.""" _MergeMessage( self._root, source, destination, replace_message, replace_repeated)
[ "Merge", "all", "fields", "specified", "by", "this", "tree", "from", "source", "to", "destination", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L615-L620
[ "def", "MergeMessage", "(", "self", ",", "source", ",", "destination", ",", "replace_message", ",", "replace_repeated", ")", ":", "_MergeMessage", "(", "self", ".", "_root", ",", "source", ",", "destination", ",", "replace_message", ",", "replace_repeated", ")" ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
configure
Configures a new resource compilation command specific to a condition, usually a toolset selection condition. The possible options are: * <rc-type>(rc|windres) - Indicates the type of options the command accepts. Even though the arguments are all optional, only when a command...
deps/src/boost_1_68_0/tools/build/src/tools/rc.py
def configure (command = None, condition = None, options = None): """ Configures a new resource compilation command specific to a condition, usually a toolset selection condition. The possible options are: * <rc-type>(rc|windres) - Indicates the type of options the command ...
def configure (command = None, condition = None, options = None): """ Configures a new resource compilation command specific to a condition, usually a toolset selection condition. The possible options are: * <rc-type>(rc|windres) - Indicates the type of options the command ...
[ "Configures", "a", "new", "resource", "compilation", "command", "specific", "to", "a", "condition", "usually", "a", "toolset", "selection", "condition", ".", "The", "possible", "options", "are", ":" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/rc.py#L50-L75
[ "def", "configure", "(", "command", "=", "None", ",", "condition", "=", "None", ",", "options", "=", "None", ")", ":", "rc_type", "=", "feature", ".", "get_values", "(", "'<rc-type>'", ",", "options", ")", "if", "rc_type", ":", "assert", "(", "len", "(...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert
Convert a Nu Support Vector Regression (NuSVR) model to the protobuf spec. Parameters ---------- model: NuSVR A trained NuSVR encoder model. feature_names: [str] Name of the input columns. target: str Name of the output column. Returns ------- model_spec: An ob...
src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_NuSVR.py
def convert(model, feature_names, target): """Convert a Nu Support Vector Regression (NuSVR) model to the protobuf spec. Parameters ---------- model: NuSVR A trained NuSVR encoder model. feature_names: [str] Name of the input columns. target: str Name of the output colu...
def convert(model, feature_names, target): """Convert a Nu Support Vector Regression (NuSVR) model to the protobuf spec. Parameters ---------- model: NuSVR A trained NuSVR encoder model. feature_names: [str] Name of the input columns. target: str Name of the output colu...
[ "Convert", "a", "Nu", "Support", "Vector", "Regression", "(", "NuSVR", ")", "model", "to", "the", "protobuf", "spec", ".", "Parameters", "----------", "model", ":", "NuSVR", "A", "trained", "NuSVR", "encoder", "model", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_NuSVR.py#L20-L42
[ "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
create
Create a :class:`~turicreate.linear_regression.LinearRegression` to predict a scalar target variable as a linear function of one or more features. In addition to standard numeric and categorical types, features can also be extracted automatically from list- or dictionary-type SFrame columns. The li...
src/unity/python/turicreate/toolkits/regression/linear_regression.py
def create(dataset, target, features=None, l2_penalty=1e-2, l1_penalty=0.0, solver='auto', feature_rescaling=True, convergence_threshold = _DEFAULT_SOLVER_OPTIONS['convergence_threshold'], step_size = _DEFAULT_SOLVER_OPTIONS['step_size'], lbfgs_memory_level = _DEFAULT_SOLVER_OPTIONS['lbfgs_memory_level'...
def create(dataset, target, features=None, l2_penalty=1e-2, l1_penalty=0.0, solver='auto', feature_rescaling=True, convergence_threshold = _DEFAULT_SOLVER_OPTIONS['convergence_threshold'], step_size = _DEFAULT_SOLVER_OPTIONS['step_size'], lbfgs_memory_level = _DEFAULT_SOLVER_OPTIONS['lbfgs_memory_level'...
[ "Create", "a", ":", "class", ":", "~turicreate", ".", "linear_regression", ".", "LinearRegression", "to", "predict", "a", "scalar", "target", "variable", "as", "a", "linear", "function", "of", "one", "or", "more", "features", ".", "In", "addition", "to", "st...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/regression/linear_regression.py#L28-L285
[ "def", "create", "(", "dataset", ",", "target", ",", "features", "=", "None", ",", "l2_penalty", "=", "1e-2", ",", "l1_penalty", "=", "0.0", ",", "solver", "=", "'auto'", ",", "feature_rescaling", "=", "True", ",", "convergence_threshold", "=", "_DEFAULT_SOL...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
LinearRegression.export_coreml
Export the model in Core ML format. Parameters ---------- filename: str A valid filename where the model can be saved. Examples -------- >>> model.export_coreml("MyModel.mlmodel")
src/unity/python/turicreate/toolkits/regression/linear_regression.py
def export_coreml(self, filename): """ Export the model in Core ML format. Parameters ---------- filename: str A valid filename where the model can be saved. Examples -------- >>> model.export_coreml("MyModel.mlmodel") """ from ...
def export_coreml(self, filename): """ Export the model in Core ML format. Parameters ---------- filename: str A valid filename where the model can be saved. Examples -------- >>> model.export_coreml("MyModel.mlmodel") """ from ...
[ "Export", "the", "model", "in", "Core", "ML", "format", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/regression/linear_regression.py#L427-L451
[ "def", "export_coreml", "(", "self", ",", "filename", ")", ":", "from", "turicreate", ".", "extensions", "import", "_linear_regression_export_as_model_asset", "from", "turicreate", ".", "toolkits", "import", "_coreml_utils", "display_name", "=", "\"linear regression\"", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
LinearRegression.predict
Return target value predictions for ``dataset``, using the trained linear regression model. This method can be used to get fitted values for the model by inputting the training dataset. Parameters ---------- dataset : SFrame | pandas.Dataframe Dataset of new observat...
src/unity/python/turicreate/toolkits/regression/linear_regression.py
def predict(self, dataset, missing_value_action='auto'): """ Return target value predictions for ``dataset``, using the trained linear regression model. This method can be used to get fitted values for the model by inputting the training dataset. Parameters ---------- ...
def predict(self, dataset, missing_value_action='auto'): """ Return target value predictions for ``dataset``, using the trained linear regression model. This method can be used to get fitted values for the model by inputting the training dataset. Parameters ---------- ...
[ "Return", "target", "value", "predictions", "for", "dataset", "using", "the", "trained", "linear", "regression", "model", ".", "This", "method", "can", "be", "used", "to", "get", "fitted", "values", "for", "the", "model", "by", "inputting", "the", "training", ...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/regression/linear_regression.py#L519-L564
[ "def", "predict", "(", "self", ",", "dataset", ",", "missing_value_action", "=", "'auto'", ")", ":", "return", "super", "(", "LinearRegression", ",", "self", ")", ".", "predict", "(", "dataset", ",", "missing_value_action", "=", "missing_value_action", ")" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
LinearRegression.evaluate
r"""Evaluate the model by making target value predictions and comparing to actual values. Two metrics are used to evaluate linear regression models. The first is root-mean-squared error (RMSE) while the second is the absolute value of the maximum error between the actual and predicted ...
src/unity/python/turicreate/toolkits/regression/linear_regression.py
def evaluate(self, dataset, metric='auto', missing_value_action='auto'): r"""Evaluate the model by making target value predictions and comparing to actual values. Two metrics are used to evaluate linear regression models. The first is root-mean-squared error (RMSE) while the second is ...
def evaluate(self, dataset, metric='auto', missing_value_action='auto'): r"""Evaluate the model by making target value predictions and comparing to actual values. Two metrics are used to evaluate linear regression models. The first is root-mean-squared error (RMSE) while the second is ...
[ "r", "Evaluate", "the", "model", "by", "making", "target", "value", "predictions", "and", "comparing", "to", "actual", "values", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/regression/linear_regression.py#L567-L635
[ "def", "evaluate", "(", "self", ",", "dataset", ",", "metric", "=", "'auto'", ",", "missing_value_action", "=", "'auto'", ")", ":", "_raise_error_evaluation_metric_is_valid", "(", "metric", ",", "[", "'auto'", ",", "'rmse'", ",", "'max_error'", "]", ")", "retu...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
frame
Convert array into a sequence of successive possibly overlapping frames. An n-dimensional array of shape (num_samples, ...) is converted into an (n+1)-D array of shape (num_frames, window_length, ...), where each frame starts hop_length points after the preceding one. This is accomplished using stride_tricks,...
src/unity/python/turicreate/toolkits/sound_classifier/mel_features.py
def frame(data, window_length, hop_length): """Convert array into a sequence of successive possibly overlapping frames. An n-dimensional array of shape (num_samples, ...) is converted into an (n+1)-D array of shape (num_frames, window_length, ...), where each frame starts hop_length points after the preceding ...
def frame(data, window_length, hop_length): """Convert array into a sequence of successive possibly overlapping frames. An n-dimensional array of shape (num_samples, ...) is converted into an (n+1)-D array of shape (num_frames, window_length, ...), where each frame starts hop_length points after the preceding ...
[ "Convert", "array", "into", "a", "sequence", "of", "successive", "possibly", "overlapping", "frames", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/sound_classifier/mel_features.py#L21-L45
[ "def", "frame", "(", "data", ",", "window_length", ",", "hop_length", ")", ":", "num_samples", "=", "data", ".", "shape", "[", "0", "]", "num_frames", "=", "1", "+", "int", "(", "np", ".", "floor", "(", "(", "num_samples", "-", "window_length", ")", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
periodic_hann
Calculate a "periodic" Hann window. The classic Hann window is defined as a raised cosine that starts and ends on zero, and where every value appears twice, except the middle point for an odd-length window. Matlab calls this a "symmetric" window and np.hanning() returns it. However, for Fourier analysis, thi...
src/unity/python/turicreate/toolkits/sound_classifier/mel_features.py
def periodic_hann(window_length): """Calculate a "periodic" Hann window. The classic Hann window is defined as a raised cosine that starts and ends on zero, and where every value appears twice, except the middle point for an odd-length window. Matlab calls this a "symmetric" window and np.hanning() returns ...
def periodic_hann(window_length): """Calculate a "periodic" Hann window. The classic Hann window is defined as a raised cosine that starts and ends on zero, and where every value appears twice, except the middle point for an odd-length window. Matlab calls this a "symmetric" window and np.hanning() returns ...
[ "Calculate", "a", "periodic", "Hann", "window", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/sound_classifier/mel_features.py#L48-L68
[ "def", "periodic_hann", "(", "window_length", ")", ":", "return", "0.5", "-", "(", "0.5", "*", "np", ".", "cos", "(", "2", "*", "np", ".", "pi", "/", "window_length", "*", "np", ".", "arange", "(", "window_length", ")", ")", ")" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
stft_magnitude
Calculate the short-time Fourier transform magnitude. Args: signal: 1D np.array of the input time-domain signal. fft_length: Size of the FFT to apply. hop_length: Advance (in samples) between each frame passed to FFT. window_length: Length of each block of samples to pass to FFT. Returns: 2D n...
src/unity/python/turicreate/toolkits/sound_classifier/mel_features.py
def stft_magnitude(signal, fft_length, hop_length=None, window_length=None): """Calculate the short-time Fourier transform magnitude. Args: signal: 1D np.array of the input time-domain signal. fft_length: Size of the FFT to apply. hop_length: Advance (in samples) b...
def stft_magnitude(signal, fft_length, hop_length=None, window_length=None): """Calculate the short-time Fourier transform magnitude. Args: signal: 1D np.array of the input time-domain signal. fft_length: Size of the FFT to apply. hop_length: Advance (in samples) b...
[ "Calculate", "the", "short", "-", "time", "Fourier", "transform", "magnitude", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/sound_classifier/mel_features.py#L71-L92
[ "def", "stft_magnitude", "(", "signal", ",", "fft_length", ",", "hop_length", "=", "None", ",", "window_length", "=", "None", ")", ":", "frames", "=", "frame", "(", "signal", ",", "window_length", ",", "hop_length", ")", "# Apply frame window to each frame. We use...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
spectrogram_to_mel_matrix
Return a matrix that can post-multiply spectrogram rows to make mel. Returns a np.array matrix A that can be used to post-multiply a matrix S of spectrogram values (STFT magnitudes) arranged as frames x bins to generate a "mel spectrogram" M of frames x num_mel_bins. M = S A. The classic HTK algorithm exploi...
src/unity/python/turicreate/toolkits/sound_classifier/mel_features.py
def spectrogram_to_mel_matrix(num_mel_bins=20, num_spectrogram_bins=129, audio_sample_rate=8000, lower_edge_hertz=125.0, upper_edge_hertz=3800.0): """Return a matrix that can post-multiply spectrogr...
def spectrogram_to_mel_matrix(num_mel_bins=20, num_spectrogram_bins=129, audio_sample_rate=8000, lower_edge_hertz=125.0, upper_edge_hertz=3800.0): """Return a matrix that can post-multiply spectrogr...
[ "Return", "a", "matrix", "that", "can", "post", "-", "multiply", "spectrogram", "rows", "to", "make", "mel", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/sound_classifier/mel_features.py#L114-L189
[ "def", "spectrogram_to_mel_matrix", "(", "num_mel_bins", "=", "20", ",", "num_spectrogram_bins", "=", "129", ",", "audio_sample_rate", "=", "8000", ",", "lower_edge_hertz", "=", "125.0", ",", "upper_edge_hertz", "=", "3800.0", ")", ":", "nyquist_hertz", "=", "audi...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
log_mel_spectrogram
Convert waveform to a log magnitude mel-frequency spectrogram. Args: data: 1D np.array of waveform data. audio_sample_rate: The sampling rate of data. log_offset: Add this to values when taking log to avoid -Infs. window_length_secs: Duration of each window to analyze. hop_length_secs: Advance be...
src/unity/python/turicreate/toolkits/sound_classifier/mel_features.py
def log_mel_spectrogram(data, audio_sample_rate=8000, log_offset=0.0, window_length_secs=0.025, hop_length_secs=0.010, **kwargs): """Convert waveform to a log magnitude mel-frequency spectrogram. ...
def log_mel_spectrogram(data, audio_sample_rate=8000, log_offset=0.0, window_length_secs=0.025, hop_length_secs=0.010, **kwargs): """Convert waveform to a log magnitude mel-frequency spectrogram. ...
[ "Convert", "waveform", "to", "a", "log", "magnitude", "mel", "-", "frequency", "spectrogram", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/sound_classifier/mel_features.py#L192-L223
[ "def", "log_mel_spectrogram", "(", "data", ",", "audio_sample_rate", "=", "8000", ",", "log_offset", "=", "0.0", ",", "window_length_secs", "=", "0.025", ",", "hop_length_secs", "=", "0.010", ",", "*", "*", "kwargs", ")", ":", "window_length_samples", "=", "in...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
generate_random_sframe
Creates a random SFrame with `num_rows` rows and randomly generated column types determined by `column_codes`. The output SFrame is deterministic based on `random_seed`. `column_types` is a string with each character denoting one type of column, with the output SFrame having one column for each ...
src/unity/python/turicreate/util/_sframe_generation.py
def generate_random_sframe(num_rows, column_codes, random_seed = 0): """ Creates a random SFrame with `num_rows` rows and randomly generated column types determined by `column_codes`. The output SFrame is deterministic based on `random_seed`. `column_types` is a string with each character denoti...
def generate_random_sframe(num_rows, column_codes, random_seed = 0): """ Creates a random SFrame with `num_rows` rows and randomly generated column types determined by `column_codes`. The output SFrame is deterministic based on `random_seed`. `column_types` is a string with each character denoti...
[ "Creates", "a", "random", "SFrame", "with", "num_rows", "rows", "and", "randomly", "generated", "column", "types", "determined", "by", "column_codes", ".", "The", "output", "SFrame", "is", "deterministic", "based", "on", "random_seed", ".", "column_types", "is", ...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/_sframe_generation.py#L13-L71
[ "def", "generate_random_sframe", "(", "num_rows", ",", "column_codes", ",", "random_seed", "=", "0", ")", ":", "from", ".", ".", "extensions", "import", "_generate_random_sframe", "assert", "isinstance", "(", "column_codes", ",", "str", ")", "assert", "isinstance"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
generate_random_regression_sframe
Creates a random SFrame with `num_rows` rows and randomly generated column types determined by `column_codes`. The output SFrame is deterministic based on `random_seed`. In addition, a target column is generated with values dependent on the randomly generated features in a given row. `column_ty...
src/unity/python/turicreate/util/_sframe_generation.py
def generate_random_regression_sframe(num_rows, column_codes, random_seed = 0, target_noise_level = 0.25): """ Creates a random SFrame with `num_rows` rows and randomly generated column types determined by `column_codes`. The output SFrame is deterministic based on `random_seed`. In addition, a ta...
def generate_random_regression_sframe(num_rows, column_codes, random_seed = 0, target_noise_level = 0.25): """ Creates a random SFrame with `num_rows` rows and randomly generated column types determined by `column_codes`. The output SFrame is deterministic based on `random_seed`. In addition, a ta...
[ "Creates", "a", "random", "SFrame", "with", "num_rows", "rows", "and", "randomly", "generated", "column", "types", "determined", "by", "column_codes", ".", "The", "output", "SFrame", "is", "deterministic", "based", "on", "random_seed", ".", "In", "addition", "a"...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/_sframe_generation.py#L73-L157
[ "def", "generate_random_regression_sframe", "(", "num_rows", ",", "column_codes", ",", "random_seed", "=", "0", ",", "target_noise_level", "=", "0.25", ")", ":", "from", ".", ".", "extensions", "import", "_generate_random_sframe", "assert", "isinstance", "(", "colum...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
generate_random_classification_sframe
Creates a random SFrame with `num_rows` rows and randomly generated column types determined by `column_codes`. The output SFrame is deterministic based on `random_seed`. In addition, a target column is generated with values dependent on the randomly generated features in a given row. `column_ty...
src/unity/python/turicreate/util/_sframe_generation.py
def generate_random_classification_sframe(num_rows, column_codes, num_classes, misclassification_spread = 0.25, num_extra_class_bins = None, random_seed = 0): """ Creates a random SFrame...
def generate_random_classification_sframe(num_rows, column_codes, num_classes, misclassification_spread = 0.25, num_extra_class_bins = None, random_seed = 0): """ Creates a random SFrame...
[ "Creates", "a", "random", "SFrame", "with", "num_rows", "rows", "and", "randomly", "generated", "column", "types", "determined", "by", "column_codes", ".", "The", "output", "SFrame", "is", "deterministic", "based", "on", "random_seed", ".", "In", "addition", "a"...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/_sframe_generation.py#L159-L255
[ "def", "generate_random_classification_sframe", "(", "num_rows", ",", "column_codes", ",", "num_classes", ",", "misclassification_spread", "=", "0.25", ",", "num_extra_class_bins", "=", "None", ",", "random_seed", "=", "0", ")", ":", "from", ".", ".", "extensions", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
infer_shapes
Input: spec : mlmodel spec input_shape_dict: dictionary of string --> tuple string: input name tuple: input shape as a 5 length tuple in order (Seq, Batch, C, H, W) If input_shape_dict is not provided, input shapes are inferred from the input descr...
src/external/coremltools_wrap/coremltools/coremltools/models/_infer_shapes_nn_mlmodel.py
def infer_shapes(nn_spec, input_spec, input_shape_dict = None): """ Input: spec : mlmodel spec input_shape_dict: dictionary of string --> tuple string: input name tuple: input shape as a 5 length tuple in order (Seq, Batch, C, H, W) If inp...
def infer_shapes(nn_spec, input_spec, input_shape_dict = None): """ Input: spec : mlmodel spec input_shape_dict: dictionary of string --> tuple string: input name tuple: input shape as a 5 length tuple in order (Seq, Batch, C, H, W) If inp...
[ "Input", ":" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/_infer_shapes_nn_mlmodel.py#L402-L466
[ "def", "infer_shapes", "(", "nn_spec", ",", "input_spec", ",", "input_shape_dict", "=", "None", ")", ":", "shape_dict", "=", "{", "}", "if", "input_shape_dict", ":", "for", "key", ",", "value", "in", "input_shape_dict", ".", "items", "(", ")", ":", "assert...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
convert
Convert a svm model to the protobuf spec. This currently supports: * C-SVC * nu-SVC * Epsilon-SVR * nu-SVR Parameters ---------- model_path: libsvm_model Libsvm representation of the model. feature_names : [str] | str Names of each of the features. targ...
src/external/coremltools_wrap/coremltools/coremltools/converters/libsvm/_libsvm_converter.py
def convert(libsvm_model, feature_names, target, input_length, probability): """Convert a svm model to the protobuf spec. This currently supports: * C-SVC * nu-SVC * Epsilon-SVR * nu-SVR Parameters ---------- model_path: libsvm_model Libsvm representation of the mode...
def convert(libsvm_model, feature_names, target, input_length, probability): """Convert a svm model to the protobuf spec. This currently supports: * C-SVC * nu-SVC * Epsilon-SVR * nu-SVR Parameters ---------- model_path: libsvm_model Libsvm representation of the mode...
[ "Convert", "a", "svm", "model", "to", "the", "protobuf", "spec", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/libsvm/_libsvm_converter.py#L23-L176
[ "def", "convert", "(", "libsvm_model", ",", "feature_names", ",", "target", ",", "input_length", ",", "probability", ")", ":", "if", "not", "(", "HAS_LIBSVM", ")", ":", "raise", "RuntimeError", "(", "'libsvm not found. libsvm conversion API is disabled.'", ")", "imp...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
create
Create an :class:`ActivityClassifier` model. Parameters ---------- dataset : SFrame Input data which consists of `sessions` of data where each session is a sequence of data. The data must be in `stacked` format, grouped by session. Within each session, the data is assumed to be sort...
src/unity/python/turicreate/toolkits/activity_classifier/_activity_classifier.py
def create(dataset, session_id, target, features=None, prediction_window=100, validation_set='auto', max_iterations=10, batch_size=32, verbose=True): """ Create an :class:`ActivityClassifier` model. Parameters ---------- dataset : SFrame Input data which consists of `sessions` of...
def create(dataset, session_id, target, features=None, prediction_window=100, validation_set='auto', max_iterations=10, batch_size=32, verbose=True): """ Create an :class:`ActivityClassifier` model. Parameters ---------- dataset : SFrame Input data which consists of `sessions` of...
[ "Create", "an", ":", "class", ":", "ActivityClassifier", "model", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/activity_classifier/_activity_classifier.py#L33-L286
[ "def", "create", "(", "dataset", ",", "session_id", ",", "target", ",", "features", "=", "None", ",", "prediction_window", "=", "100", ",", "validation_set", "=", "'auto'", ",", "max_iterations", "=", "10", ",", "batch_size", "=", "32", ",", "verbose", "="...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_encode_target
Encode targets to integers in [0, num_classes - 1]
src/unity/python/turicreate/toolkits/activity_classifier/_activity_classifier.py
def _encode_target(data, target, mapping=None): """ Encode targets to integers in [0, num_classes - 1] """ if mapping is None: mapping = {t: i for i, t in enumerate(sorted(data[target].unique()))} data[target] = data[target].apply(lambda t: mapping[t]) return data, mapping
def _encode_target(data, target, mapping=None): """ Encode targets to integers in [0, num_classes - 1] """ if mapping is None: mapping = {t: i for i, t in enumerate(sorted(data[target].unique()))} data[target] = data[target].apply(lambda t: mapping[t]) return data, mapping
[ "Encode", "targets", "to", "integers", "in", "[", "0", "num_classes", "-", "1", "]" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/activity_classifier/_activity_classifier.py#L289-L295
[ "def", "_encode_target", "(", "data", ",", "target", ",", "mapping", "=", "None", ")", ":", "if", "mapping", "is", "None", ":", "mapping", "=", "{", "t", ":", "i", "for", "i", ",", "t", "in", "enumerate", "(", "sorted", "(", "data", "[", "target", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ActivityClassifier.export_coreml
Export the model in Core ML format. Parameters ---------- filename: str A valid filename where the model can be saved. Examples -------- >>> model.export_coreml("MyModel.mlmodel")
src/unity/python/turicreate/toolkits/activity_classifier/_activity_classifier.py
def export_coreml(self, filename): """ Export the model in Core ML format. Parameters ---------- filename: str A valid filename where the model can be saved. Examples -------- >>> model.export_coreml("MyModel.mlmodel") """ impor...
def export_coreml(self, filename): """ Export the model in Core ML format. Parameters ---------- filename: str A valid filename where the model can be saved. Examples -------- >>> model.export_coreml("MyModel.mlmodel") """ impor...
[ "Export", "the", "model", "in", "Core", "ML", "format", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/activity_classifier/_activity_classifier.py#L351-L485
[ "def", "export_coreml", "(", "self", ",", "filename", ")", ":", "import", "coremltools", "as", "_cmt", "import", "mxnet", "as", "_mx", "from", ".", "_mx_model_architecture", "import", "_net_params", "prob_name", "=", "self", ".", "target", "+", "'Probability'", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ActivityClassifier.predict
Return predictions for ``dataset``, using the trained activity classifier. Predictions can be generated as class labels, or as a probability vector with probabilities for each class. The activity classifier generates a single prediction for each ``prediction_window`` rows in ``dataset``...
src/unity/python/turicreate/toolkits/activity_classifier/_activity_classifier.py
def predict(self, dataset, output_type='class', output_frequency='per_row'): """ Return predictions for ``dataset``, using the trained activity classifier. Predictions can be generated as class labels, or as a probability vector with probabilities for each class. The activity cl...
def predict(self, dataset, output_type='class', output_frequency='per_row'): """ Return predictions for ``dataset``, using the trained activity classifier. Predictions can be generated as class labels, or as a probability vector with probabilities for each class. The activity cl...
[ "Return", "predictions", "for", "dataset", "using", "the", "trained", "activity", "classifier", ".", "Predictions", "can", "be", "generated", "as", "class", "labels", "or", "as", "a", "probability", "vector", "with", "probabilities", "for", "each", "class", "." ...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/activity_classifier/_activity_classifier.py#L487-L664
[ "def", "predict", "(", "self", ",", "dataset", ",", "output_type", "=", "'class'", ",", "output_frequency", "=", "'per_row'", ")", ":", "_tkutl", ".", "_raise_error_if_not_sframe", "(", "dataset", ",", "'dataset'", ")", "_tkutl", ".", "_check_categorical_option_ty...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ActivityClassifier.evaluate
Evaluate the model by making predictions of target values and comparing these to actual values. Parameters ---------- dataset : SFrame Dataset of new observations. Must include columns with the same names as the session_id, target and features used for model trai...
src/unity/python/turicreate/toolkits/activity_classifier/_activity_classifier.py
def evaluate(self, dataset, metric='auto'): """ Evaluate the model by making predictions of target values and comparing these to actual values. Parameters ---------- dataset : SFrame Dataset of new observations. Must include columns with the same ...
def evaluate(self, dataset, metric='auto'): """ Evaluate the model by making predictions of target values and comparing these to actual values. Parameters ---------- dataset : SFrame Dataset of new observations. Must include columns with the same ...
[ "Evaluate", "the", "model", "by", "making", "predictions", "of", "target", "values", "and", "comparing", "these", "to", "actual", "values", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/activity_classifier/_activity_classifier.py#L666-L743
[ "def", "evaluate", "(", "self", ",", "dataset", ",", "metric", "=", "'auto'", ")", ":", "avail_metrics", "=", "[", "'accuracy'", ",", "'auc'", ",", "'precision'", ",", "'recall'", ",", "'f1_score'", ",", "'log_loss'", ",", "'confusion_matrix'", ",", "'roc_cu...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ActivityClassifier.classify
Return a classification, for each ``prediction_window`` examples in the ``dataset``, using the trained activity classification model. The output SFrame contains predictions as both class labels as well as probabilities that the predicted value is the associated label. Parameters ...
src/unity/python/turicreate/toolkits/activity_classifier/_activity_classifier.py
def classify(self, dataset, output_frequency='per_row'): """ Return a classification, for each ``prediction_window`` examples in the ``dataset``, using the trained activity classification model. The output SFrame contains predictions as both class labels as well as probabilities ...
def classify(self, dataset, output_frequency='per_row'): """ Return a classification, for each ``prediction_window`` examples in the ``dataset``, using the trained activity classification model. The output SFrame contains predictions as both class labels as well as probabilities ...
[ "Return", "a", "classification", "for", "each", "prediction_window", "examples", "in", "the", "dataset", "using", "the", "trained", "activity", "classification", "model", ".", "The", "output", "SFrame", "contains", "predictions", "as", "both", "class", "labels", "...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/activity_classifier/_activity_classifier.py#L745-L795
[ "def", "classify", "(", "self", ",", "dataset", ",", "output_frequency", "=", "'per_row'", ")", ":", "_tkutl", ".", "_check_categorical_option_type", "(", "'output_frequency'", ",", "output_frequency", ",", "[", "'per_window'", ",", "'per_row'", "]", ")", "id_targ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ActivityClassifier.predict_topk
Return top-k predictions for the ``dataset``, using the trained model. Predictions are returned as an SFrame with three columns: `prediction_id`, `class`, and `probability`, or `rank`, depending on the ``output_type`` parameter. Parameters ---------- dataset : SFrame ...
src/unity/python/turicreate/toolkits/activity_classifier/_activity_classifier.py
def predict_topk(self, dataset, output_type='probability', k=3, output_frequency='per_row'): """ Return top-k predictions for the ``dataset``, using the trained model. Predictions are returned as an SFrame with three columns: `prediction_id`, `class`, and `probability`, or `rank`, depen...
def predict_topk(self, dataset, output_type='probability', k=3, output_frequency='per_row'): """ Return top-k predictions for the ``dataset``, using the trained model. Predictions are returned as an SFrame with three columns: `prediction_id`, `class`, and `probability`, or `rank`, depen...
[ "Return", "top", "-", "k", "predictions", "for", "the", "dataset", "using", "the", "trained", "model", ".", "Predictions", "are", "returned", "as", "an", "SFrame", "with", "three", "columns", ":", "prediction_id", "class", "and", "probability", "or", "rank", ...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/activity_classifier/_activity_classifier.py#L797-L891
[ "def", "predict_topk", "(", "self", ",", "dataset", ",", "output_type", "=", "'probability'", ",", "k", "=", "3", ",", "output_frequency", "=", "'per_row'", ")", ":", "_tkutl", ".", "_check_categorical_option_type", "(", "'output_type'", ",", "output_type", ",",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
count_characters
Count the occurrances of the different characters in the files
deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/char_stat.py
def count_characters(root, out): """Count the occurrances of the different characters in the files""" if os.path.isfile(root): with open(root, 'rb') as in_f: for line in in_f: for char in line: if char not in out: out[char] = 0 ...
def count_characters(root, out): """Count the occurrances of the different characters in the files""" if os.path.isfile(root): with open(root, 'rb') as in_f: for line in in_f: for char in line: if char not in out: out[char] = 0 ...
[ "Count", "the", "occurrances", "of", "the", "different", "characters", "in", "the", "files" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/char_stat.py#L13-L24
[ "def", "count_characters", "(", "root", ",", "out", ")", ":", "if", "os", ".", "path", ".", "isfile", "(", "root", ")", ":", "with", "open", "(", "root", ",", "'rb'", ")", "as", "in_f", ":", "for", "line", "in", "in_f", ":", "for", "char", "in", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
main
The main function of the script
deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/char_stat.py
def main(): """The main function of the script""" desc = 'Generate character statistics from a source tree' parser = argparse.ArgumentParser(description=desc) parser.add_argument( '--src', dest='src', required=True, help='The root of the source tree' ) parser.add_...
def main(): """The main function of the script""" desc = 'Generate character statistics from a source tree' parser = argparse.ArgumentParser(description=desc) parser.add_argument( '--src', dest='src', required=True, help='The root of the source tree' ) parser.add_...
[ "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/char_stat.py#L34-L55
[ "def", "main", "(", ")", ":", "desc", "=", "'Generate character statistics from a source tree'", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "desc", ")", "parser", ".", "add_argument", "(", "'--src'", ",", "dest", "=", "'src'", ","...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
save_spec
Save a protobuf model specification to file. Parameters ---------- spec: Model_pb Protobuf representation of the model filename: str File path where the spec gets saved. Examples -------- .. sourcecode:: python >>> coremltools.utils.save_spec(spec, 'HousePricer.m...
src/external/coremltools_wrap/coremltools/coremltools/models/utils.py
def save_spec(spec, filename): """ Save a protobuf model specification to file. Parameters ---------- spec: Model_pb Protobuf representation of the model filename: str File path where the spec gets saved. Examples -------- .. sourcecode:: python >>> corem...
def save_spec(spec, filename): """ Save a protobuf model specification to file. Parameters ---------- spec: Model_pb Protobuf representation of the model filename: str File path where the spec gets saved. Examples -------- .. sourcecode:: python >>> corem...
[ "Save", "a", "protobuf", "model", "specification", "to", "file", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/utils.py#L28-L59
[ "def", "save_spec", "(", "spec", ",", "filename", ")", ":", "name", ",", "ext", "=", "_os", ".", "path", ".", "splitext", "(", "filename", ")", "if", "not", "ext", ":", "filename", "=", "\"%s.mlmodel\"", "%", "filename", "else", ":", "if", "ext", "!=...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
load_spec
Load a protobuf model specification from file Parameters ---------- filename: str Location on disk (a valid filepath) from which the file is loaded as a protobuf spec. Returns ------- model_spec: Model_pb Protobuf representation of the model Examples -------- ...
src/external/coremltools_wrap/coremltools/coremltools/models/utils.py
def load_spec(filename): """ Load a protobuf model specification from file Parameters ---------- filename: str Location on disk (a valid filepath) from which the file is loaded as a protobuf spec. Returns ------- model_spec: Model_pb Protobuf representation of t...
def load_spec(filename): """ Load a protobuf model specification from file Parameters ---------- filename: str Location on disk (a valid filepath) from which the file is loaded as a protobuf spec. Returns ------- model_spec: Model_pb Protobuf representation of t...
[ "Load", "a", "protobuf", "model", "specification", "from", "file" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/utils.py#L62-L93
[ "def", "load_spec", "(", "filename", ")", ":", "from", ".", ".", "proto", "import", "Model_pb2", "spec", "=", "Model_pb2", ".", "Model", "(", ")", "with", "open", "(", "filename", ",", "'rb'", ")", "as", "f", ":", "contents", "=", "f", ".", "read", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_get_nn_layers
Returns a list of neural network layers if the model contains any. Parameters ---------- spec: Model_pb A model protobuf specification. Returns ------- [NN layer] list of all layers (including layers from elements of a pipeline
src/external/coremltools_wrap/coremltools/coremltools/models/utils.py
def _get_nn_layers(spec): """ Returns a list of neural network layers if the model contains any. Parameters ---------- spec: Model_pb A model protobuf specification. Returns ------- [NN layer] list of all layers (including layers from elements of a pipeline """ ...
def _get_nn_layers(spec): """ Returns a list of neural network layers if the model contains any. Parameters ---------- spec: Model_pb A model protobuf specification. Returns ------- [NN layer] list of all layers (including layers from elements of a pipeline """ ...
[ "Returns", "a", "list", "of", "neural", "network", "layers", "if", "the", "model", "contains", "any", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/utils.py#L96-L137
[ "def", "_get_nn_layers", "(", "spec", ")", ":", "layers", "=", "[", "]", "if", "spec", ".", "WhichOneof", "(", "'Type'", ")", "==", "'pipeline'", ":", "layers", "=", "[", "]", "for", "model_spec", "in", "spec", ".", "pipeline", ".", "models", ":", "i...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
evaluate_regressor
Evaluate a CoreML regression model and compare against predictions from the original framework (for testing correctness of conversion) Parameters ---------- filename: [str | MLModel] File path from which to load the MLModel from (OR) a loaded version of MLModel. data: [str | Datafr...
src/external/coremltools_wrap/coremltools/coremltools/models/utils.py
def evaluate_regressor(model, data, target="target", verbose=False): """ Evaluate a CoreML regression model and compare against predictions from the original framework (for testing correctness of conversion) Parameters ---------- filename: [str | MLModel] File path from which to load th...
def evaluate_regressor(model, data, target="target", verbose=False): """ Evaluate a CoreML regression model and compare against predictions from the original framework (for testing correctness of conversion) Parameters ---------- filename: [str | MLModel] File path from which to load th...
[ "Evaluate", "a", "CoreML", "regression", "model", "and", "compare", "against", "predictions", "from", "the", "original", "framework", "(", "for", "testing", "correctness", "of", "conversion", ")" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/utils.py#L386-L448
[ "def", "evaluate_regressor", "(", "model", ",", "data", ",", "target", "=", "\"target\"", ",", "verbose", "=", "False", ")", ":", "model", "=", "_get_model", "(", "model", ")", "if", "verbose", ":", "print", "(", "\"\"", ")", "print", "(", "\"Other Frame...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
evaluate_classifier
Evaluate a CoreML classifier model and compare against predictions from the original framework (for testing correctness of conversion). Use this evaluation for models that don't deal with probabilities. Parameters ---------- filename: [str | MLModel] File from where to load the model from (...
src/external/coremltools_wrap/coremltools/coremltools/models/utils.py
def evaluate_classifier(model, data, target='target', verbose=False): """ Evaluate a CoreML classifier model and compare against predictions from the original framework (for testing correctness of conversion). Use this evaluation for models that don't deal with probabilities. Parameters -------...
def evaluate_classifier(model, data, target='target', verbose=False): """ Evaluate a CoreML classifier model and compare against predictions from the original framework (for testing correctness of conversion). Use this evaluation for models that don't deal with probabilities. Parameters -------...
[ "Evaluate", "a", "CoreML", "classifier", "model", "and", "compare", "against", "predictions", "from", "the", "original", "framework", "(", "for", "testing", "correctness", "of", "conversion", ")", ".", "Use", "this", "evaluation", "for", "models", "that", "don",...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/utils.py#L451-L509
[ "def", "evaluate_classifier", "(", "model", ",", "data", ",", "target", "=", "'target'", ",", "verbose", "=", "False", ")", ":", "model", "=", "_get_model", "(", "model", ")", "if", "verbose", ":", "print", "(", "\"\"", ")", "print", "(", "\"Other Framew...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
evaluate_classifier_with_probabilities
Evaluate a classifier specification for testing. Parameters ---------- filename: [str | Model] File from where to load the model from (OR) a loaded version of the MLModel. data: [str | Dataframe] Test data on which to evaluate the models (dataframe, or path to a csv fil...
src/external/coremltools_wrap/coremltools/coremltools/models/utils.py
def evaluate_classifier_with_probabilities(model, data, probabilities='probabilities', verbose = False): """ Evaluate a classifier specification for testing. Parameters ---------- filename: [str | Model] F...
def evaluate_classifier_with_probabilities(model, data, probabilities='probabilities', verbose = False): """ Evaluate a classifier specification for testing. Parameters ---------- filename: [str | Model] F...
[ "Evaluate", "a", "classifier", "specification", "for", "testing", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/utils.py#L512-L571
[ "def", "evaluate_classifier_with_probabilities", "(", "model", ",", "data", ",", "probabilities", "=", "'probabilities'", ",", "verbose", "=", "False", ")", ":", "model", "=", "_get_model", "(", "model", ")", "if", "verbose", ":", "print", "(", "\"\"", ")", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
rename_feature
Rename a feature in the specification. Parameters ---------- spec: Model_pb The specification containing the feature to rename. current_name: str Current name of the feature. If this feature doesn't exist, the rename is a no-op. new_name: str New name of the featur...
src/external/coremltools_wrap/coremltools/coremltools/models/utils.py
def rename_feature(spec, current_name, new_name, rename_inputs=True, rename_outputs=True): """ Rename a feature in the specification. Parameters ---------- spec: Model_pb The specification containing the feature to rename. current_name: str Current name of th...
def rename_feature(spec, current_name, new_name, rename_inputs=True, rename_outputs=True): """ Rename a feature in the specification. Parameters ---------- spec: Model_pb The specification containing the feature to rename. current_name: str Current name of th...
[ "Rename", "a", "feature", "in", "the", "specification", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/utils.py#L574-L674
[ "def", "rename_feature", "(", "spec", ",", "current_name", ",", "new_name", ",", "rename_inputs", "=", "True", ",", "rename_outputs", "=", "True", ")", ":", "from", "coremltools", ".", "models", "import", "MLModel", "if", "not", "rename_inputs", "and", "not", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_sanitize_value
Performs cleaning steps on the data so various type comparisons can be performed correctly.
src/external/coremltools_wrap/coremltools/coremltools/models/utils.py
def _sanitize_value(x): """ Performs cleaning steps on the data so various type comparisons can be performed correctly. """ if isinstance(x, _six.string_types + _six.integer_types + (float,)): return x elif _HAS_SKLEARN and _sp.issparse(x): return x.todense() elif isinstance(...
def _sanitize_value(x): """ Performs cleaning steps on the data so various type comparisons can be performed correctly. """ if isinstance(x, _six.string_types + _six.integer_types + (float,)): return x elif _HAS_SKLEARN and _sp.issparse(x): return x.todense() elif isinstance(...
[ "Performs", "cleaning", "steps", "on", "the", "data", "so", "various", "type", "comparisons", "can", "be", "performed", "correctly", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/utils.py#L677-L695
[ "def", "_sanitize_value", "(", "x", ")", ":", "if", "isinstance", "(", "x", ",", "_six", ".", "string_types", "+", "_six", ".", "integer_types", "+", "(", "float", ",", ")", ")", ":", "return", "x", "elif", "_HAS_SKLEARN", "and", "_sp", ".", "issparse"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_element_equal
Performs a robust equality test between elements.
src/external/coremltools_wrap/coremltools/coremltools/models/utils.py
def _element_equal(x, y): """ Performs a robust equality test between elements. """ if isinstance(x, _np.ndarray) or isinstance(y, _np.ndarray): try: return (abs(_np.asarray(x) - _np.asarray(y)) < 1e-5).all() except: return False elif isinstance(x, dict): ...
def _element_equal(x, y): """ Performs a robust equality test between elements. """ if isinstance(x, _np.ndarray) or isinstance(y, _np.ndarray): try: return (abs(_np.asarray(x) - _np.asarray(y)) < 1e-5).all() except: return False elif isinstance(x, dict): ...
[ "Performs", "a", "robust", "equality", "test", "between", "elements", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/utils.py#L698-L716
[ "def", "_element_equal", "(", "x", ",", "y", ")", ":", "if", "isinstance", "(", "x", ",", "_np", ".", "ndarray", ")", "or", "isinstance", "(", "y", ",", "_np", ".", "ndarray", ")", ":", "try", ":", "return", "(", "abs", "(", "_np", ".", "asarray"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
evaluate_transformer
Evaluate a transformer specification for testing. Parameters ---------- spec: [str | MLModel] File from where to load the Model from (OR) a loaded version of MLModel. input_data: list[dict] Test data on which to evaluate the models. reference_output: list[dict] Exp...
src/external/coremltools_wrap/coremltools/coremltools/models/utils.py
def evaluate_transformer(model, input_data, reference_output, verbose=False): """ Evaluate a transformer specification for testing. Parameters ---------- spec: [str | MLModel] File from where to load the Model from (OR) a loaded version of MLModel. inpu...
def evaluate_transformer(model, input_data, reference_output, verbose=False): """ Evaluate a transformer specification for testing. Parameters ---------- spec: [str | MLModel] File from where to load the Model from (OR) a loaded version of MLModel. inpu...
[ "Evaluate", "a", "transformer", "specification", "for", "testing", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/utils.py#L719-L786
[ "def", "evaluate_transformer", "(", "model", ",", "input_data", ",", "reference_output", ",", "verbose", "=", "False", ")", ":", "model", "=", "_get_model", "(", "model", ")", "if", "verbose", ":", "print", "(", "model", ")", "print", "(", "\"\"", ")", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
_get_input_names
Returns a list of the names of the inputs to this model. :param spec: The model protobuf specification :return: [str] A list of input feature names
src/external/coremltools_wrap/coremltools/coremltools/models/utils.py
def _get_input_names(spec): """ Returns a list of the names of the inputs to this model. :param spec: The model protobuf specification :return: [str] A list of input feature names """ retval = [feature.name for feature in spec.description.input] return retval
def _get_input_names(spec): """ Returns a list of the names of the inputs to this model. :param spec: The model protobuf specification :return: [str] A list of input feature names """ retval = [feature.name for feature in spec.description.input] return retval
[ "Returns", "a", "list", "of", "the", "names", "of", "the", "inputs", "to", "this", "model", ".", ":", "param", "spec", ":", "The", "model", "protobuf", "specification", ":", "return", ":", "[", "str", "]", "A", "list", "of", "input", "feature", "names"...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/utils.py#L912-L919
[ "def", "_get_input_names", "(", "spec", ")", ":", "retval", "=", "[", "feature", ".", "name", "for", "feature", "in", "spec", ".", "description", ".", "input", "]", "return", "retval" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
create
Compute the in degree, out degree and total degree of each vertex. Parameters ---------- graph : SGraph The graph on which to compute degree counts. verbose : bool, optional If True, print progress updates. Returns ------- out : DegreeCountingModel Examples ------...
src/unity/python/turicreate/toolkits/graph_analytics/degree_counting.py
def create(graph, verbose=True): """ Compute the in degree, out degree and total degree of each vertex. Parameters ---------- graph : SGraph The graph on which to compute degree counts. verbose : bool, optional If True, print progress updates. Returns ------- out :...
def create(graph, verbose=True): """ Compute the in degree, out degree and total degree of each vertex. Parameters ---------- graph : SGraph The graph on which to compute degree counts. verbose : bool, optional If True, print progress updates. Returns ------- out :...
[ "Compute", "the", "in", "degree", "out", "degree", "and", "total", "degree", "of", "each", "vertex", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/graph_analytics/degree_counting.py#L57-L119
[ "def", "create", "(", "graph", ",", "verbose", "=", "True", ")", ":", "from", "turicreate", ".", "_cython", ".", "cy_server", "import", "QuietProgress", "if", "not", "isinstance", "(", "graph", ",", "_SGraph", ")", ":", "raise", "TypeError", "(", "'\"graph...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
Example.replace_emphasis
replace the index'th emphasized text with s
deps/src/boost_1_68_0/tools/litre/cplusplus.py
def replace_emphasis(self, s, index = 0): """replace the index'th emphasized text with s""" e = self.emphasized[index] self.body[e[0]:e[1]] = [s] del self.emphasized[index]
def replace_emphasis(self, s, index = 0): """replace the index'th emphasized text with s""" e = self.emphasized[index] self.body[e[0]:e[1]] = [s] del self.emphasized[index]
[ "replace", "the", "index", "th", "emphasized", "text", "with", "s" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/litre/cplusplus.py#L90-L94
[ "def", "replace_emphasis", "(", "self", ",", "s", ",", "index", "=", "0", ")", ":", "e", "=", "self", ".", "emphasized", "[", "index", "]", "self", ".", "body", "[", "e", "[", "0", "]", ":", "e", "[", "1", "]", "]", "=", "[", "s", "]", "del...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
CPlusPlusTranslator._execute
Override of litre._execute; sets up variable context before evaluating code
deps/src/boost_1_68_0/tools/litre/cplusplus.py
def _execute(self, code): """Override of litre._execute; sets up variable context before evaluating code """ self.globals['example'] = self.example eval(code, self.globals)
def _execute(self, code): """Override of litre._execute; sets up variable context before evaluating code """ self.globals['example'] = self.example eval(code, self.globals)
[ "Override", "of", "litre", ".", "_execute", ";", "sets", "up", "variable", "context", "before", "evaluating", "code" ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/litre/cplusplus.py#L320-L325
[ "def", "_execute", "(", "self", ",", "code", ")", ":", "self", ".", "globals", "[", "'example'", "]", "=", "self", ".", "example", "eval", "(", "code", ",", "self", ".", "globals", ")" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
CPlusPlusTranslator.compile
Compile examples on the stack, whose topmost item is the last example seen but not yet handled so far. :howmany: How many of the topmost examples on the stack to compile. You can pass a number, or 'all' to indicate that all examples should be compiled. :pop: How many of t...
deps/src/boost_1_68_0/tools/litre/cplusplus.py
def compile( self , howmany = 1 , pop = -1 , expect_error = False , extension = '.o' , options = ['-c'] , built_handler = lambda built_file: None , source_file = None , source_suffix = '.cpp' # C-style comments by default; handles C++ a...
def compile( self , howmany = 1 , pop = -1 , expect_error = False , extension = '.o' , options = ['-c'] , built_handler = lambda built_file: None , source_file = None , source_suffix = '.cpp' # C-style comments by default; handles C++ a...
[ "Compile", "examples", "on", "the", "stack", "whose", "topmost", "item", "is", "the", "last", "example", "seen", "but", "not", "yet", "handled", "so", "far", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/litre/cplusplus.py#L357-L490
[ "def", "compile", "(", "self", ",", "howmany", "=", "1", ",", "pop", "=", "-", "1", ",", "expect_error", "=", "False", ",", "extension", "=", "'.o'", ",", "options", "=", "[", "'-c'", "]", ",", "built_handler", "=", "lambda", "built_file", ":", "None...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ProjectRegistry.load
Loads jamfile at the given location. After loading, project global file and jamfile needed by the loaded one will be loaded recursively. If the jamfile at that location is loaded already, does nothing. Returns the project module for the Jamfile.
deps/src/boost_1_68_0/tools/build/src/build/project.py
def load (self, jamfile_location): """Loads jamfile at the given location. After loading, project global file and jamfile needed by the loaded one will be loaded recursively. If the jamfile at that location is loaded already, does nothing. Returns the project module for the Jamfile.""" ...
def load (self, jamfile_location): """Loads jamfile at the given location. After loading, project global file and jamfile needed by the loaded one will be loaded recursively. If the jamfile at that location is loaded already, does nothing. Returns the project module for the Jamfile.""" ...
[ "Loads", "jamfile", "at", "the", "given", "location", ".", "After", "loading", "project", "global", "file", "and", "jamfile", "needed", "by", "the", "loaded", "one", "will", "be", "loaded", "recursively", ".", "If", "the", "jamfile", "at", "that", "location"...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L132-L164
[ "def", "load", "(", "self", ",", "jamfile_location", ")", ":", "assert", "isinstance", "(", "jamfile_location", ",", "basestring", ")", "absolute", "=", "os", ".", "path", ".", "join", "(", "os", ".", "getcwd", "(", ")", ",", "jamfile_location", ")", "ab...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ProjectRegistry.load_parent
Loads parent of Jamfile at 'location'. Issues an error if nothing is found.
deps/src/boost_1_68_0/tools/build/src/build/project.py
def load_parent(self, location): """Loads parent of Jamfile at 'location'. Issues an error if nothing is found.""" assert isinstance(location, basestring) found = b2.util.path.glob_in_parents( location, self.JAMROOT + self.JAMFILE) if not found: print "er...
def load_parent(self, location): """Loads parent of Jamfile at 'location'. Issues an error if nothing is found.""" assert isinstance(location, basestring) found = b2.util.path.glob_in_parents( location, self.JAMROOT + self.JAMFILE) if not found: print "er...
[ "Loads", "parent", "of", "Jamfile", "at", "location", ".", "Issues", "an", "error", "if", "nothing", "is", "found", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L178-L190
[ "def", "load_parent", "(", "self", ",", "location", ")", ":", "assert", "isinstance", "(", "location", ",", "basestring", ")", "found", "=", "b2", ".", "util", ".", "path", ".", "glob_in_parents", "(", "location", ",", "self", ".", "JAMROOT", "+", "self"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ProjectRegistry.find
Given 'name' which can be project-id or plain directory name, return project module corresponding to that id or directory. Returns nothing of project is not found.
deps/src/boost_1_68_0/tools/build/src/build/project.py
def find(self, name, current_location): """Given 'name' which can be project-id or plain directory name, return project module corresponding to that id or directory. Returns nothing of project is not found.""" assert isinstance(name, basestring) assert isinstance(current_location...
def find(self, name, current_location): """Given 'name' which can be project-id or plain directory name, return project module corresponding to that id or directory. Returns nothing of project is not found.""" assert isinstance(name, basestring) assert isinstance(current_location...
[ "Given", "name", "which", "can", "be", "project", "-", "id", "or", "plain", "directory", "name", "return", "project", "module", "corresponding", "to", "that", "id", "or", "directory", ".", "Returns", "nothing", "of", "project", "is", "not", "found", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L192-L219
[ "def", "find", "(", "self", ",", "name", ",", "current_location", ")", ":", "assert", "isinstance", "(", "name", ",", "basestring", ")", "assert", "isinstance", "(", "current_location", ",", "basestring", ")", "project_module", "=", "None", "# Try interpreting n...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ProjectRegistry.module_name
Returns the name of module corresponding to 'jamfile-location'. If no module corresponds to location yet, associates default module name with that location.
deps/src/boost_1_68_0/tools/build/src/build/project.py
def module_name(self, jamfile_location): """Returns the name of module corresponding to 'jamfile-location'. If no module corresponds to location yet, associates default module name with that location.""" assert isinstance(jamfile_location, basestring) module = self.location2modul...
def module_name(self, jamfile_location): """Returns the name of module corresponding to 'jamfile-location'. If no module corresponds to location yet, associates default module name with that location.""" assert isinstance(jamfile_location, basestring) module = self.location2modul...
[ "Returns", "the", "name", "of", "module", "corresponding", "to", "jamfile", "-", "location", ".", "If", "no", "module", "corresponds", "to", "location", "yet", "associates", "default", "module", "name", "with", "that", "location", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L221-L235
[ "def", "module_name", "(", "self", ",", "jamfile_location", ")", ":", "assert", "isinstance", "(", "jamfile_location", ",", "basestring", ")", "module", "=", "self", ".", "location2module", ".", "get", "(", "jamfile_location", ")", "if", "not", "module", ":", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ProjectRegistry.find_jamfile
Find the Jamfile at the given location. This returns the exact names of all the Jamfiles in the given directory. The optional parent-root argument causes this to search not the given directory but the ones above it up to the directory given in it.
deps/src/boost_1_68_0/tools/build/src/build/project.py
def find_jamfile (self, dir, parent_root=0, no_errors=0): """Find the Jamfile at the given location. This returns the exact names of all the Jamfiles in the given directory. The optional parent-root argument causes this to search not the given directory but the ones above it up to the di...
def find_jamfile (self, dir, parent_root=0, no_errors=0): """Find the Jamfile at the given location. This returns the exact names of all the Jamfiles in the given directory. The optional parent-root argument causes this to search not the given directory but the ones above it up to the di...
[ "Find", "the", "Jamfile", "at", "the", "given", "location", ".", "This", "returns", "the", "exact", "names", "of", "all", "the", "Jamfiles", "in", "the", "given", "directory", ".", "The", "optional", "parent", "-", "root", "argument", "causes", "this", "to...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L237-L289
[ "def", "find_jamfile", "(", "self", ",", "dir", ",", "parent_root", "=", "0", ",", "no_errors", "=", "0", ")", ":", "assert", "isinstance", "(", "dir", ",", "basestring", ")", "assert", "isinstance", "(", "parent_root", ",", "(", "int", ",", "bool", ")...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ProjectRegistry.load_jamfile
Load a Jamfile at the given directory. Returns nothing. Will attempt to load the file as indicated by the JAMFILE patterns. Effect of calling this rule twice with the same 'dir' is underfined.
deps/src/boost_1_68_0/tools/build/src/build/project.py
def load_jamfile(self, dir, jamfile_module): """Load a Jamfile at the given directory. Returns nothing. Will attempt to load the file as indicated by the JAMFILE patterns. Effect of calling this rule twice with the same 'dir' is underfined.""" assert isinstance(dir, basestring) a...
def load_jamfile(self, dir, jamfile_module): """Load a Jamfile at the given directory. Returns nothing. Will attempt to load the file as indicated by the JAMFILE patterns. Effect of calling this rule twice with the same 'dir' is underfined.""" assert isinstance(dir, basestring) a...
[ "Load", "a", "Jamfile", "at", "the", "given", "directory", ".", "Returns", "nothing", ".", "Will", "attempt", "to", "load", "the", "file", "as", "indicated", "by", "the", "JAMFILE", "patterns", ".", "Effect", "of", "calling", "this", "rule", "twice", "with...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L291-L370
[ "def", "load_jamfile", "(", "self", ",", "dir", ",", "jamfile_module", ")", ":", "assert", "isinstance", "(", "dir", ",", "basestring", ")", "assert", "isinstance", "(", "jamfile_module", ",", "basestring", ")", "# See if the Jamfile is where it should be.", "is_jam...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ProjectRegistry.load_standalone
Loads 'file' as standalone project that has no location associated with it. This is mostly useful for user-config.jam, which should be able to define targets, but although it has some location in filesystem, we do not want any build to happen in user's HOME, for example. The ca...
deps/src/boost_1_68_0/tools/build/src/build/project.py
def load_standalone(self, jamfile_module, file): """Loads 'file' as standalone project that has no location associated with it. This is mostly useful for user-config.jam, which should be able to define targets, but although it has some location in filesystem, we do not want any build to...
def load_standalone(self, jamfile_module, file): """Loads 'file' as standalone project that has no location associated with it. This is mostly useful for user-config.jam, which should be able to define targets, but although it has some location in filesystem, we do not want any build to...
[ "Loads", "file", "as", "standalone", "project", "that", "has", "no", "location", "associated", "with", "it", ".", "This", "is", "mostly", "useful", "for", "user", "-", "config", ".", "jam", "which", "should", "be", "able", "to", "define", "targets", "but",...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L387-L402
[ "def", "load_standalone", "(", "self", ",", "jamfile_module", ",", "file", ")", ":", "assert", "isinstance", "(", "jamfile_module", ",", "basestring", ")", "assert", "isinstance", "(", "file", ",", "basestring", ")", "self", ".", "used_projects", "[", "jamfile...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ProjectRegistry.initialize
Initialize the module for a project. module-name is the name of the project module. location is the location (directory) of the project to initialize. If not specified, standalone project will be initialized standalone_path is the path to the source-location. ...
deps/src/boost_1_68_0/tools/build/src/build/project.py
def initialize(self, module_name, location=None, basename=None, standalone_path=''): """Initialize the module for a project. module-name is the name of the project module. location is the location (directory) of the project to initialize. If not specified, standalone project wi...
def initialize(self, module_name, location=None, basename=None, standalone_path=''): """Initialize the module for a project. module-name is the name of the project module. location is the location (directory) of the project to initialize. If not specified, standalone project wi...
[ "Initialize", "the", "module", "for", "a", "project", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L412-L509
[ "def", "initialize", "(", "self", ",", "module_name", ",", "location", "=", "None", ",", "basename", "=", "None", ",", "standalone_path", "=", "''", ")", ":", "assert", "isinstance", "(", "module_name", ",", "basestring", ")", "assert", "isinstance", "(", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ProjectRegistry.inherit_attributes
Make 'project-module' inherit attributes of project root and parent module.
deps/src/boost_1_68_0/tools/build/src/build/project.py
def inherit_attributes(self, project_module, parent_module): """Make 'project-module' inherit attributes of project root and parent module.""" assert isinstance(project_module, basestring) assert isinstance(parent_module, basestring) attributes = self.module2attributes[project_m...
def inherit_attributes(self, project_module, parent_module): """Make 'project-module' inherit attributes of project root and parent module.""" assert isinstance(project_module, basestring) assert isinstance(parent_module, basestring) attributes = self.module2attributes[project_m...
[ "Make", "project", "-", "module", "inherit", "attributes", "of", "project", "root", "and", "parent", "module", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L511-L549
[ "def", "inherit_attributes", "(", "self", ",", "project_module", ",", "parent_module", ")", ":", "assert", "isinstance", "(", "project_module", ",", "basestring", ")", "assert", "isinstance", "(", "parent_module", ",", "basestring", ")", "attributes", "=", "self",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ProjectRegistry.register_id
Associate the given id with the given project module.
deps/src/boost_1_68_0/tools/build/src/build/project.py
def register_id(self, id, module): """Associate the given id with the given project module.""" assert isinstance(id, basestring) assert isinstance(module, basestring) self.id2module[id] = module
def register_id(self, id, module): """Associate the given id with the given project module.""" assert isinstance(id, basestring) assert isinstance(module, basestring) self.id2module[id] = module
[ "Associate", "the", "given", "id", "with", "the", "given", "project", "module", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L551-L555
[ "def", "register_id", "(", "self", ",", "id", ",", "module", ")", ":", "assert", "isinstance", "(", "id", ",", "basestring", ")", "assert", "isinstance", "(", "module", ",", "basestring", ")", "self", ".", "id2module", "[", "id", "]", "=", "module" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ProjectRegistry.push_current
Temporary changes the current project to 'project'. Should be followed by 'pop-current'.
deps/src/boost_1_68_0/tools/build/src/build/project.py
def push_current(self, project): """Temporary changes the current project to 'project'. Should be followed by 'pop-current'.""" if __debug__: from .targets import ProjectTarget assert isinstance(project, ProjectTarget) self.saved_current_project.append(self.curren...
def push_current(self, project): """Temporary changes the current project to 'project'. Should be followed by 'pop-current'.""" if __debug__: from .targets import ProjectTarget assert isinstance(project, ProjectTarget) self.saved_current_project.append(self.curren...
[ "Temporary", "changes", "the", "current", "project", "to", "project", ".", "Should", "be", "followed", "by", "pop", "-", "current", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L572-L579
[ "def", "push_current", "(", "self", ",", "project", ")", ":", "if", "__debug__", ":", "from", ".", "targets", "import", "ProjectTarget", "assert", "isinstance", "(", "project", ",", "ProjectTarget", ")", "self", ".", "saved_current_project", ".", "append", "("...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ProjectRegistry.attribute
Returns the value of the specified attribute in the specified jamfile module.
deps/src/boost_1_68_0/tools/build/src/build/project.py
def attribute(self, project, attribute): """Returns the value of the specified attribute in the specified jamfile module.""" assert isinstance(project, basestring) assert isinstance(attribute, basestring) try: return self.module2attributes[project].get(attribute) ...
def attribute(self, project, attribute): """Returns the value of the specified attribute in the specified jamfile module.""" assert isinstance(project, basestring) assert isinstance(attribute, basestring) try: return self.module2attributes[project].get(attribute) ...
[ "Returns", "the", "value", "of", "the", "specified", "attribute", "in", "the", "specified", "jamfile", "module", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L593-L601
[ "def", "attribute", "(", "self", ",", "project", ",", "attribute", ")", ":", "assert", "isinstance", "(", "project", ",", "basestring", ")", "assert", "isinstance", "(", "attribute", ",", "basestring", ")", "try", ":", "return", "self", ".", "module2attribut...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ProjectRegistry.attributeDefault
Returns the value of the specified attribute in the specified jamfile module.
deps/src/boost_1_68_0/tools/build/src/build/project.py
def attributeDefault(self, project, attribute, default): """Returns the value of the specified attribute in the specified jamfile module.""" assert isinstance(project, basestring) assert isinstance(attribute, basestring) assert isinstance(default, basestring) or default is None ...
def attributeDefault(self, project, attribute, default): """Returns the value of the specified attribute in the specified jamfile module.""" assert isinstance(project, basestring) assert isinstance(attribute, basestring) assert isinstance(default, basestring) or default is None ...
[ "Returns", "the", "value", "of", "the", "specified", "attribute", "in", "the", "specified", "jamfile", "module", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L603-L609
[ "def", "attributeDefault", "(", "self", ",", "project", ",", "attribute", ",", "default", ")", ":", "assert", "isinstance", "(", "project", ",", "basestring", ")", "assert", "isinstance", "(", "attribute", ",", "basestring", ")", "assert", "isinstance", "(", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ProjectRegistry.target
Returns the project target corresponding to the 'project-module'.
deps/src/boost_1_68_0/tools/build/src/build/project.py
def target(self, project_module): """Returns the project target corresponding to the 'project-module'.""" assert isinstance(project_module, basestring) if project_module not in self.module2target: self.module2target[project_module] = \ b2.build.targets.ProjectTarget(p...
def target(self, project_module): """Returns the project target corresponding to the 'project-module'.""" assert isinstance(project_module, basestring) if project_module not in self.module2target: self.module2target[project_module] = \ b2.build.targets.ProjectTarget(p...
[ "Returns", "the", "project", "target", "corresponding", "to", "the", "project", "-", "module", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L611-L619
[ "def", "target", "(", "self", ",", "project_module", ")", ":", "assert", "isinstance", "(", "project_module", ",", "basestring", ")", "if", "project_module", "not", "in", "self", ".", "module2target", ":", "self", ".", "module2target", "[", "project_module", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ProjectRegistry.add_rule
Makes rule 'name' available to all subsequently loaded Jamfiles. Calling that rule wil relay to 'callable'.
deps/src/boost_1_68_0/tools/build/src/build/project.py
def add_rule(self, name, callable_): """Makes rule 'name' available to all subsequently loaded Jamfiles. Calling that rule wil relay to 'callable'.""" assert isinstance(name, basestring) assert callable(callable_) self.project_rules_.add_rule(name, callable_)
def add_rule(self, name, callable_): """Makes rule 'name' available to all subsequently loaded Jamfiles. Calling that rule wil relay to 'callable'.""" assert isinstance(name, basestring) assert callable(callable_) self.project_rules_.add_rule(name, callable_)
[ "Makes", "rule", "name", "available", "to", "all", "subsequently", "loaded", "Jamfiles", "." ]
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L639-L645
[ "def", "add_rule", "(", "self", ",", "name", ",", "callable_", ")", ":", "assert", "isinstance", "(", "name", ",", "basestring", ")", "assert", "callable", "(", "callable_", ")", "self", ".", "project_rules_", ".", "add_rule", "(", "name", ",", "callable_"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
train
ProjectRegistry.__build_python_module_cache
Recursively walks through the b2/src subdirectories and creates an index of base module name to package name. The index is stored within self.__python_module_cache and allows for an O(1) module lookup. For example, given the base module name `toolset`, self.__python_module_cache...
deps/src/boost_1_68_0/tools/build/src/build/project.py
def __build_python_module_cache(self): """Recursively walks through the b2/src subdirectories and creates an index of base module name to package name. The index is stored within self.__python_module_cache and allows for an O(1) module lookup. For example, given the base module ...
def __build_python_module_cache(self): """Recursively walks through the b2/src subdirectories and creates an index of base module name to package name. The index is stored within self.__python_module_cache and allows for an O(1) module lookup. For example, given the base module ...
[ "Recursively", "walks", "through", "the", "b2", "/", "src", "subdirectories", "and", "creates", "an", "index", "of", "base", "module", "name", "to", "package", "name", ".", "The", "index", "is", "stored", "within", "self", ".", "__python_module_cache", "and", ...
apple/turicreate
python
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L693-L724
[ "def", "__build_python_module_cache", "(", "self", ")", ":", "cache", "=", "{", "}", "for", "importer", ",", "mname", ",", "ispkg", "in", "pkgutil", ".", "walk_packages", "(", "b2", ".", "__path__", ",", "prefix", "=", "'b2.'", ")", ":", "basename", "=",...
74514c3f99e25b46f22c6e02977fe3da69221c2e