id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
28,800
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py
NeuralNetworkBuilder.add_load_constant
def add_load_constant(self, name, output_name, constant_value, shape): """ Add a load constant layer. Parameters ---------- name: str The name of this layer. output_name: str The output blob name of this layer. constant_value: numpy.arra...
python
def add_load_constant(self, name, output_name, constant_value, shape): """ Add a load constant layer. Parameters ---------- name: str The name of this layer. output_name: str The output blob name of this layer. constant_value: numpy.arra...
[ "def", "add_load_constant", "(", "self", ",", "name", ",", "output_name", ",", "constant_value", ",", "shape", ")", ":", "spec", "=", "self", ".", "spec", "nn_spec", "=", "self", ".", "nn_spec", "# Add a new layer", "spec_layer", "=", "nn_spec", ".", "layers...
Add a load constant layer. Parameters ---------- name: str The name of this layer. output_name: str The output blob name of this layer. constant_value: numpy.array value of the constant as a numpy array. shape: [int] Lis...
[ "Add", "a", "load", "constant", "layer", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L2411-L2452
28,801
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py
NeuralNetworkBuilder.add_custom
def add_custom(self, name, input_names, output_names, custom_proto_spec = None): """ Add a custom layer. Parameters ---------- name: str The name of this layer. input_names: [str] The input blob names to this layer. output_names: [str] ...
python
def add_custom(self, name, input_names, output_names, custom_proto_spec = None): """ Add a custom layer. Parameters ---------- name: str The name of this layer. input_names: [str] The input blob names to this layer. output_names: [str] ...
[ "def", "add_custom", "(", "self", ",", "name", ",", "input_names", ",", "output_names", ",", "custom_proto_spec", "=", "None", ")", ":", "spec", "=", "self", ".", "spec", "nn_spec", "=", "self", ".", "nn_spec", "# custom layers require a newer specification versio...
Add a custom layer. Parameters ---------- name: str The name of this layer. input_names: [str] The input blob names to this layer. output_names: [str] The output blob names from this layer. custom_proto_spec: CustomLayerParams ...
[ "Add", "a", "custom", "layer", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L2455-L2491
28,802
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py
NeuralNetworkBuilder.set_pre_processing_parameters
def set_pre_processing_parameters(self, image_input_names = [], is_bgr = False, red_bias = 0.0, green_bias = 0.0, blue_bias = 0.0, gray_bias = 0.0, image_scale = 1.0): """Add pre-processing parameters to the neural network object Parameters ---------- image_input_names: [str...
python
def set_pre_processing_parameters(self, image_input_names = [], is_bgr = False, red_bias = 0.0, green_bias = 0.0, blue_bias = 0.0, gray_bias = 0.0, image_scale = 1.0): """Add pre-processing parameters to the neural network object Parameters ---------- image_input_names: [str...
[ "def", "set_pre_processing_parameters", "(", "self", ",", "image_input_names", "=", "[", "]", ",", "is_bgr", "=", "False", ",", "red_bias", "=", "0.0", ",", "green_bias", "=", "0.0", ",", "blue_bias", "=", "0.0", ",", "gray_bias", "=", "0.0", ",", "image_s...
Add pre-processing parameters to the neural network object Parameters ---------- image_input_names: [str] Name of input blobs that are images is_bgr: boolean | dict() Channel order for input blobs that are images. BGR if True else RGB. To specify a d...
[ "Add", "pre", "-", "processing", "parameters", "to", "the", "neural", "network", "object" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network.py#L2494-L2570
28,803
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/scanner.py
get
def get(scanner_class, properties): """ Returns an instance of previously registered scanner with the specified properties. """ assert issubclass(scanner_class, Scanner) assert is_iterable_typed(properties, basestring) scanner_name = str(scanner_class) if not registered(scanner_name): ...
python
def get(scanner_class, properties): """ Returns an instance of previously registered scanner with the specified properties. """ assert issubclass(scanner_class, Scanner) assert is_iterable_typed(properties, basestring) scanner_name = str(scanner_class) if not registered(scanner_name): ...
[ "def", "get", "(", "scanner_class", ",", "properties", ")", ":", "assert", "issubclass", "(", "scanner_class", ",", "Scanner", ")", "assert", "is_iterable_typed", "(", "properties", ",", "basestring", ")", "scanner_name", "=", "str", "(", "scanner_class", ")", ...
Returns an instance of previously registered scanner with the specified properties.
[ "Returns", "an", "instance", "of", "previously", "registered", "scanner", "with", "the", "specified", "properties", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/scanner.py#L68-L87
28,804
apple/turicreate
src/unity/python/turicreate/util/_cloudpickle.py
CloudPickler._save_subimports
def _save_subimports(self, code, top_level_dependencies): """ Ensure de-pickler imports any package child-modules that are needed by the function """ # check if any known dependency is an imported package for x in top_level_dependencies: if isinstance(x, types...
python
def _save_subimports(self, code, top_level_dependencies): """ Ensure de-pickler imports any package child-modules that are needed by the function """ # check if any known dependency is an imported package for x in top_level_dependencies: if isinstance(x, types...
[ "def", "_save_subimports", "(", "self", ",", "code", ",", "top_level_dependencies", ")", ":", "# check if any known dependency is an imported package", "for", "x", "in", "top_level_dependencies", ":", "if", "isinstance", "(", "x", ",", "types", ".", "ModuleType", ")",...
Ensure de-pickler imports any package child-modules that are needed by the function
[ "Ensure", "de", "-", "pickler", "imports", "any", "package", "child", "-", "modules", "that", "are", "needed", "by", "the", "function" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/_cloudpickle.py#L405-L424
28,805
apple/turicreate
src/unity/python/turicreate/util/_cloudpickle.py
CloudPickler.extract_code_globals
def extract_code_globals(cls, co): """ Find all globals names read or written to by codeblock co """ out_names = cls._extract_code_globals_cache.get(co) if out_names is None: try: names = co.co_names except AttributeError: #...
python
def extract_code_globals(cls, co): """ Find all globals names read or written to by codeblock co """ out_names = cls._extract_code_globals_cache.get(co) if out_names is None: try: names = co.co_names except AttributeError: #...
[ "def", "extract_code_globals", "(", "cls", ",", "co", ")", ":", "out_names", "=", "cls", ".", "_extract_code_globals_cache", ".", "get", "(", "co", ")", "if", "out_names", "is", "None", ":", "try", ":", "names", "=", "co", ".", "co_names", "except", "Att...
Find all globals names read or written to by codeblock co
[ "Find", "all", "globals", "names", "read", "or", "written", "to", "by", "codeblock", "co" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/_cloudpickle.py#L551-L574
28,806
apple/turicreate
src/unity/python/turicreate/util/_cloudpickle.py
CloudPickler.save_file
def save_file(self, obj): """Save a file""" try: import StringIO as pystringIO #we can't use cStringIO as it lacks the name attribute except ImportError: import io as pystringIO if not hasattr(obj, 'name') or not hasattr(obj, 'mode'): raise pickle.Pi...
python
def save_file(self, obj): """Save a file""" try: import StringIO as pystringIO #we can't use cStringIO as it lacks the name attribute except ImportError: import io as pystringIO if not hasattr(obj, 'name') or not hasattr(obj, 'mode'): raise pickle.Pi...
[ "def", "save_file", "(", "self", ",", "obj", ")", ":", "try", ":", "import", "StringIO", "as", "pystringIO", "#we can't use cStringIO as it lacks the name attribute", "except", "ImportError", ":", "import", "io", "as", "pystringIO", "if", "not", "hasattr", "(", "o...
Save a file
[ "Save", "a", "file" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/_cloudpickle.py#L847-L886
28,807
apple/turicreate
src/unity/python/turicreate/util/_cloudpickle.py
CloudPickler.save_ufunc
def save_ufunc(self, obj): """Hack function for saving numpy ufunc objects""" name = obj.__name__ numpy_tst_mods = ['numpy', 'scipy.special'] for tst_mod_name in numpy_tst_mods: tst_mod = sys.modules.get(tst_mod_name, None) if tst_mod and name in tst_mod.__dict__:...
python
def save_ufunc(self, obj): """Hack function for saving numpy ufunc objects""" name = obj.__name__ numpy_tst_mods = ['numpy', 'scipy.special'] for tst_mod_name in numpy_tst_mods: tst_mod = sys.modules.get(tst_mod_name, None) if tst_mod and name in tst_mod.__dict__:...
[ "def", "save_ufunc", "(", "self", ",", "obj", ")", ":", "name", "=", "obj", ".", "__name__", "numpy_tst_mods", "=", "[", "'numpy'", ",", "'scipy.special'", "]", "for", "tst_mod_name", "in", "numpy_tst_mods", ":", "tst_mod", "=", "sys", ".", "modules", ".",...
Hack function for saving numpy ufunc objects
[ "Hack", "function", "for", "saving", "numpy", "ufunc", "objects" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/util/_cloudpickle.py#L915-L924
28,808
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_database.py
_ExtractSymbols
def _ExtractSymbols(desc_proto, package): """Pulls out all the symbols from a descriptor proto. Args: desc_proto: The proto to extract symbols from. package: The package containing the descriptor type. Yields: The fully qualified name found in the descriptor. """ message_name = '.'.join((packag...
python
def _ExtractSymbols(desc_proto, package): """Pulls out all the symbols from a descriptor proto. Args: desc_proto: The proto to extract symbols from. package: The package containing the descriptor type. Yields: The fully qualified name found in the descriptor. """ message_name = '.'.join((packag...
[ "def", "_ExtractSymbols", "(", "desc_proto", ",", "package", ")", ":", "message_name", "=", "'.'", ".", "join", "(", "(", "package", ",", "desc_proto", ".", "name", ")", ")", "yield", "message_name", "for", "nested_type", "in", "desc_proto", ".", "nested_typ...
Pulls out all the symbols from a descriptor proto. Args: desc_proto: The proto to extract symbols from. package: The package containing the descriptor type. Yields: The fully qualified name found in the descriptor.
[ "Pulls", "out", "all", "the", "symbols", "from", "a", "descriptor", "proto", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_database.py#L127-L144
28,809
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_database.py
DescriptorDatabase.Add
def Add(self, file_desc_proto): """Adds the FileDescriptorProto and its types to this database. Args: file_desc_proto: The FileDescriptorProto to add. Raises: DescriptorDatabaseConflictingDefinitionError: if an attempt is made to add a proto with the same name but different definition t...
python
def Add(self, file_desc_proto): """Adds the FileDescriptorProto and its types to this database. Args: file_desc_proto: The FileDescriptorProto to add. Raises: DescriptorDatabaseConflictingDefinitionError: if an attempt is made to add a proto with the same name but different definition t...
[ "def", "Add", "(", "self", ",", "file_desc_proto", ")", ":", "proto_name", "=", "file_desc_proto", ".", "name", "if", "proto_name", "not", "in", "self", ".", "_file_desc_protos_by_file", ":", "self", ".", "_file_desc_protos_by_file", "[", "proto_name", "]", "=",...
Adds the FileDescriptorProto and its types to this database. Args: file_desc_proto: The FileDescriptorProto to add. Raises: DescriptorDatabaseConflictingDefinitionError: if an attempt is made to add a proto with the same name but different definition than an exisiting proto in the d...
[ "Adds", "the", "FileDescriptorProto", "and", "its", "types", "to", "this", "database", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor_database.py#L51-L81
28,810
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_normalizer.py
convert
def convert(model, input_features, output_features): """Convert a normalizer model to the protobuf spec. Parameters ---------- model: Normalizer A Normalizer. input_features: str Name of the input column. output_features: str Name of the output column. Returns ...
python
def convert(model, input_features, output_features): """Convert a normalizer model to the protobuf spec. Parameters ---------- model: Normalizer A Normalizer. input_features: str Name of the input column. output_features: str Name of the output column. Returns ...
[ "def", "convert", "(", "model", ",", "input_features", ",", "output_features", ")", ":", "if", "not", "(", "_HAS_SKLEARN", ")", ":", "raise", "RuntimeError", "(", "'scikit-learn not found. scikit-learn conversion API is disabled.'", ")", "# Test the scikit-learn model", "...
Convert a normalizer model to the protobuf spec. Parameters ---------- model: Normalizer A Normalizer. input_features: str Name of the input column. output_features: str Name of the output column. Returns ------- model_spec: An object of type Model_pb. ...
[ "Convert", "a", "normalizer", "model", "to", "the", "protobuf", "spec", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_normalizer.py#L24-L64
28,811
apple/turicreate
src/unity/python/turicreate/meta/bytecodetools/bytecode_consumer.py
ByteCodeConsumer.consume
def consume(self): ''' Consume byte-code ''' generic_consume = getattr(self, 'generic_consume', None) for instr in disassembler(self.code): method_name = 'consume_%s' % (instr.opname) method = getattr(self, method_name, generic_consume) ...
python
def consume(self): ''' Consume byte-code ''' generic_consume = getattr(self, 'generic_consume', None) for instr in disassembler(self.code): method_name = 'consume_%s' % (instr.opname) method = getattr(self, method_name, generic_consume) ...
[ "def", "consume", "(", "self", ")", ":", "generic_consume", "=", "getattr", "(", "self", ",", "'generic_consume'", ",", "None", ")", "for", "instr", "in", "disassembler", "(", "self", ".", "code", ")", ":", "method_name", "=", "'consume_%s'", "%", "(", "...
Consume byte-code
[ "Consume", "byte", "-", "code" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/bytecodetools/bytecode_consumer.py#L25-L39
28,812
apple/turicreate
src/external/xgboost/python-package/xgboost/libpath.py
find_lib_path
def find_lib_path(): """Load find the path to xgboost dynamic library files. Returns ------- lib_path: list(string) List of all found library path to xgboost """ curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__))) # make pythonpack hack: copy this directory one...
python
def find_lib_path(): """Load find the path to xgboost dynamic library files. Returns ------- lib_path: list(string) List of all found library path to xgboost """ curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__))) # make pythonpack hack: copy this directory one...
[ "def", "find_lib_path", "(", ")", ":", "curr_path", "=", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "expanduser", "(", "__file__", ")", ")", ")", "# make pythonpack hack: copy this directory one le...
Load find the path to xgboost dynamic library files. Returns ------- lib_path: list(string) List of all found library path to xgboost
[ "Load", "find", "the", "path", "to", "xgboost", "dynamic", "library", "files", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/libpath.py#L13-L45
28,813
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_sklearn_util.py
check_expected_type
def check_expected_type(model, expected_type): """Check if a model is of the right type. Raise error if not. Parameters ---------- model: model Any scikit-learn model expected_type: Type Expected type of the scikit-learn. """ if (model.__class__.__name__ != expected_type.__...
python
def check_expected_type(model, expected_type): """Check if a model is of the right type. Raise error if not. Parameters ---------- model: model Any scikit-learn model expected_type: Type Expected type of the scikit-learn. """ if (model.__class__.__name__ != expected_type.__...
[ "def", "check_expected_type", "(", "model", ",", "expected_type", ")", ":", "if", "(", "model", ".", "__class__", ".", "__name__", "!=", "expected_type", ".", "__name__", ")", ":", "raise", "TypeError", "(", "\"Expected model of type '%s' (got %s)\"", "%", "(", ...
Check if a model is of the right type. Raise error if not. Parameters ---------- model: model Any scikit-learn model expected_type: Type Expected type of the scikit-learn.
[ "Check", "if", "a", "model", "is", "of", "the", "right", "type", ".", "Raise", "error", "if", "not", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_sklearn_util.py#L20-L33
28,814
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/libsvm/__init__.py
convert
def convert(model, input_names='input', target_name='target', probability='classProbability', input_length='auto'): """ Convert a LIBSVM model to Core ML format. Parameters ---------- model: a libsvm model (C-SVC, nu-SVC, epsilon-SVR, or nu-SVR) or string path to a saved model....
python
def convert(model, input_names='input', target_name='target', probability='classProbability', input_length='auto'): """ Convert a LIBSVM model to Core ML format. Parameters ---------- model: a libsvm model (C-SVC, nu-SVC, epsilon-SVR, or nu-SVR) or string path to a saved model....
[ "def", "convert", "(", "model", ",", "input_names", "=", "'input'", ",", "target_name", "=", "'target'", ",", "probability", "=", "'classProbability'", ",", "input_length", "=", "'auto'", ")", ":", "if", "not", "(", "_HAS_LIBSVM", ")", ":", "raise", "Runtime...
Convert a LIBSVM model to Core ML format. Parameters ---------- model: a libsvm model (C-SVC, nu-SVC, epsilon-SVR, or nu-SVR) or string path to a saved model. input_names: str | [str] Name of the input column(s). If a single string is used (the default) the input will be an ar...
[ "Convert", "a", "LIBSVM", "model", "to", "Core", "ML", "format", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/libsvm/__init__.py#L17-L93
28,815
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/containers.py
RepeatedScalarFieldContainer.MergeFrom
def MergeFrom(self, other): """Appends the contents of another repeated field of the same type to this one. We do not check the types of the individual fields. """ self._values.extend(other._values) self._message_listener.Modified()
python
def MergeFrom(self, other): """Appends the contents of another repeated field of the same type to this one. We do not check the types of the individual fields. """ self._values.extend(other._values) self._message_listener.Modified()
[ "def", "MergeFrom", "(", "self", ",", "other", ")", ":", "self", ".", "_values", ".", "extend", "(", "other", ".", "_values", ")", "self", ".", "_message_listener", ".", "Modified", "(", ")" ]
Appends the contents of another repeated field of the same type to this one. We do not check the types of the individual fields.
[ "Appends", "the", "contents", "of", "another", "repeated", "field", "of", "the", "same", "type", "to", "this", "one", ".", "We", "do", "not", "check", "the", "types", "of", "the", "individual", "fields", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/containers.py#L280-L285
28,816
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/containers.py
RepeatedCompositeFieldContainer.add
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) ...
python
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", ")", ":", "new_element", "=", "self", ".", "_message_descriptor", ".", "_concrete_class", "(", "*", "*", "kwargs", ")", "new_element", ".", "_SetListener", "(", "self", ".", "_message_listener", ")", "sel...
Adds a new element at the end of the list and returns it. Keyword arguments may be used to initialize the element.
[ "Adds", "a", "new", "element", "at", "the", "end", "of", "the", "list", "and", "returns", "it", ".", "Keyword", "arguments", "may", "be", "used", "to", "initialize", "the", "element", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/containers.py#L368-L377
28,817
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/containers.py
RepeatedCompositeFieldContainer.extend
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: ...
python
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", ")", ":", "message_class", "=", "self", ".", "_message_descriptor", ".", "_concrete_class", "listener", "=", "self", ".", "_message_listener", "values", "=", "self", ".", "_values", "for", "message", "in", "elem_s...
Extends by appending the given sequence of elements of the same type as this one, copying each individual message.
[ "Extends", "by", "appending", "the", "given", "sequence", "of", "elements", "of", "the", "same", "type", "as", "this", "one", "copying", "each", "individual", "message", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/containers.py#L379-L391
28,818
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/util/set.py
difference
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
python
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", ")", ":", "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.
[ "Returns", "the", "elements", "of", "B", "that", "are", "not", "in", "A", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/set.py#L10-L18
28,819
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/util/set.py
intersection
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
python
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", ")", ":", "assert", "is_iterable", "(", "set1", ")", "assert", "is_iterable", "(", "set2", ")", "result", "=", "[", "]", "for", "v", "in", "set1", ":", "if", "v", "in", "set2", ":", "result", ".", "a...
Removes from set1 any items which don't appear in set2 and returns the result.
[ "Removes", "from", "set1", "any", "items", "which", "don", "t", "appear", "in", "set2", "and", "returns", "the", "result", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/set.py#L20-L29
28,820
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/util/set.py
contains
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
python
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", ")", ":", "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'.
[ "Returns", "true", "iff", "all", "elements", "of", "small", "exist", "in", "large", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/set.py#L31-L40
28,821
apple/turicreate
src/unity/python/turicreate/toolkits/image_classifier/_annotate.py
annotate
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 ...
python
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'", ")", ":", "# Check Value of Column Variables", "if", "image_column", "==", "None", ":", "image_column", "=", "_tkutl", ".", "_find_only_image_column", "...
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...
[ "Annotate", "your", "images", "loaded", "in", "either", "an", "SFrame", "or", "SArray", "Format" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/image_classifier/_annotate.py#L30-L171
28,822
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_imputer.py
convert
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...
python
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", ")", ":", "if", "not", "(", "_HAS_SKLEARN", ")", ":", "raise", "RuntimeError", "(", "'scikit-learn not found. scikit-learn conversion API is disabled.'", ")", "# Set the interface params.", "sp...
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 ...
[ "Convert", "a", "DictVectorizer", "model", "to", "the", "protobuf", "spec", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/converters/sklearn/_imputer.py#L21-L76
28,823
apple/turicreate
src/unity/python/turicreate/_cython/python_printer_callback.py
print_callback
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: ...
python
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", ")", ":", "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", ...
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.
[ "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...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/_cython/python_printer_callback.py#L17-L38
28,824
apple/turicreate
src/unity/python/turicreate/toolkits/_main.py
run
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...
python
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", ")", ":", "unity", "=", "glconnect", ".", "get_unity", "(", ")", "if", "(", "not", "verbose", ")", ":", "glconnect", ".", "get_server", ...
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 ...
[ "Internal", "function", "to", "execute", "toolkit", "on", "the", "turicreate", "server", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_main.py#L25-L69
28,825
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
_RoundTowardZero
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 ...
python
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", ")", ":", "# 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...
Truncates the remainder part after division.
[ "Truncates", "the", "remainder", "part", "after", "division", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L378-L390
28,826
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
_IsValidPath
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...
python
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", ")", ":", "parts", "=", "path", ".", "split", "(", "'.'", ")", "last", "=", "parts", ".", "pop", "(", ")", "for", "name", "in", "parts", ":", "field", "=", "message_descriptor", ".", "field...
Checks whether the path is valid for Message Descriptor.
[ "Checks", "whether", "the", "path", "is", "valid", "for", "Message", "Descriptor", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L471-L482
28,827
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
_CheckFieldMaskMessage
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...
python
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", ")", ":", "message_descriptor", "=", "message", ".", "DESCRIPTOR", "if", "(", "message_descriptor", ".", "name", "!=", "'FieldMask'", "or", "message_descriptor", ".", "file", ".", "name", "!=", "'google/protobuf/field...
Raises ValueError if message is not a FieldMask.
[ "Raises", "ValueError", "if", "message", "is", "not", "a", "FieldMask", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L485-L491
28,828
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
_SnakeCaseToCamelCase
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...
python
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", ")", ":", "result", "=", "[", "]", "after_underscore", "=", "False", "for", "c", "in", "path_name", ":", "if", "c", ".", "isupper", "(", ")", ":", "raise", "Error", "(", "'Fail to print FieldMask to Json string...
Converts a path name from snake_case to camelCase.
[ "Converts", "a", "path", "name", "from", "snake_case", "to", "camelCase", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L494-L518
28,829
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
_CamelCaseToSnakeCase
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 += '...
python
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", ")", ":", "result", "=", "[", "]", "for", "c", "in", "path_name", ":", "if", "c", "==", "'_'", ":", "raise", "ParseError", "(", "'Fail to parse FieldMask: Path name '", "'{0} must not contain \"_\"s.'", ".", "forma...
Converts a field name from camelCase to snake_case.
[ "Converts", "a", "field", "name", "from", "camelCase", "to", "snake_case", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L521-L533
28,830
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
_MergeMessage
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: ...
python
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", ")", ":", "source_descriptor", "=", "source", ".", "DESCRIPTOR", "for", "name", "in", "node", ":", "child", "=", "node", "[", "name", "]"...
Merge all fields specified by a sub-tree from source to destination.
[ "Merge", "all", "fields", "specified", "by", "a", "sub", "-", "tree", "from", "source", "to", "destination", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L633-L671
28,831
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
_AddFieldPaths
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...
python
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", ")", ":", "if", "not", "node", ":", "field_mask", ".", "paths", ".", "append", "(", "prefix", ")", "return", "for", "name", "in", "sorted", "(", "node", ")", ":", "if", "prefix", ...
Adds the field paths descended from node to field_mask.
[ "Adds", "the", "field", "paths", "descended", "from", "node", "to", "field_mask", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L674-L684
28,832
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
Any.Pack
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...
python
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/'", ")", ":", "if", "len", "(", "type_url_prefix", ")", "<", "1", "or", "type_url_prefix", "[", "-", "1", "]", "!=", "'/'", ":", "self", ".", "type_url", "=", "'...
Packs the specified message into current Any message.
[ "Packs", "the", "specified", "message", "into", "current", "Any", "message", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L70-L76
28,833
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
Any.Unpack
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
python
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", ")", ":", "descriptor", "=", "msg", ".", "DESCRIPTOR", "if", "not", "self", ".", "Is", "(", "descriptor", ")", ":", "return", "False", "msg", ".", "ParseFromString", "(", "self", ".", "value", ")", "return", ...
Unpacks the current Any message into specified message.
[ "Unpacks", "the", "current", "Any", "message", "into", "specified", "message", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L78-L84
28,834
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
Timestamp.ToJsonString
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' ...
python
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", ")", ":", "nanos", "=", "self", ".", "nanos", "%", "_NANOS_PER_SECOND", "total_sec", "=", "self", ".", "seconds", "+", "(", "self", ".", "nanos", "-", "nanos", ")", "//", "_NANOS_PER_SECOND", "seconds", "=", "total_sec",...
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", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L99-L125
28,835
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
Timestamp.FromJsonString
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' ...
python
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", ")", ":", "timezone_offset", "=", "value", ".", "find", "(", "'Z'", ")", "if", "timezone_offset", "==", "-", "1", ":", "timezone_offset", "=", "value", ".", "find", "(", "'+'", ")", "if", "timezone_offs...
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 ...
[ "Parse", "a", "RFC", "3339", "date", "string", "format", "to", "Timestamp", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L127-L183
28,836
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
Timestamp.FromNanoseconds
def FromNanoseconds(self, nanos): """Converts nanoseconds since epoch to Timestamp.""" self.seconds = nanos // _NANOS_PER_SECOND self.nanos = nanos % _NANOS_PER_SECOND
python
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", ")", ":", "self", ".", "seconds", "=", "nanos", "//", "_NANOS_PER_SECOND", "self", ".", "nanos", "=", "nanos", "%", "_NANOS_PER_SECOND" ]
Converts nanoseconds since epoch to Timestamp.
[ "Converts", "nanoseconds", "since", "epoch", "to", "Timestamp", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L207-L210
28,837
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
Timestamp.FromMicroseconds
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
python
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", ")", ":", "self", ".", "seconds", "=", "micros", "//", "_MICROS_PER_SECOND", "self", ".", "nanos", "=", "(", "micros", "%", "_MICROS_PER_SECOND", ")", "*", "_NANOS_PER_MICROSECOND" ]
Converts microseconds since epoch to Timestamp.
[ "Converts", "microseconds", "since", "epoch", "to", "Timestamp", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L212-L215
28,838
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
Timestamp.FromMilliseconds
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
python
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", ")", ":", "self", ".", "seconds", "=", "millis", "//", "_MILLIS_PER_SECOND", "self", ".", "nanos", "=", "(", "millis", "%", "_MILLIS_PER_SECOND", ")", "*", "_NANOS_PER_MILLISECOND" ]
Converts milliseconds since epoch to Timestamp.
[ "Converts", "milliseconds", "since", "epoch", "to", "Timestamp", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L217-L220
28,839
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
Timestamp.ToDatetime
def ToDatetime(self): """Converts Timestamp to datetime.""" return datetime.utcfromtimestamp( self.seconds + self.nanos / float(_NANOS_PER_SECOND))
python
def ToDatetime(self): """Converts Timestamp to datetime.""" return datetime.utcfromtimestamp( self.seconds + self.nanos / float(_NANOS_PER_SECOND))
[ "def", "ToDatetime", "(", "self", ")", ":", "return", "datetime", ".", "utcfromtimestamp", "(", "self", ".", "seconds", "+", "self", ".", "nanos", "/", "float", "(", "_NANOS_PER_SECOND", ")", ")" ]
Converts Timestamp to datetime.
[ "Converts", "Timestamp", "to", "datetime", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L227-L230
28,840
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
Timestamp.FromDatetime
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
python
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", ")", ":", "td", "=", "dt", "-", "datetime", "(", "1970", ",", "1", ",", "1", ")", "self", ".", "seconds", "=", "td", ".", "seconds", "+", "td", ".", "days", "*", "_SECONDS_PER_DAY", "self", ".", "nan...
Converts datetime to Timestamp.
[ "Converts", "datetime", "to", "Timestamp", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L232-L236
28,841
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
Duration.ToMicroseconds
def ToMicroseconds(self): """Converts a Duration to microseconds.""" micros = _RoundTowardZero(self.nanos, _NANOS_PER_MICROSECOND) return self.seconds * _MICROS_PER_SECOND + micros
python
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", ")", ":", "micros", "=", "_RoundTowardZero", "(", "self", ".", "nanos", ",", "_NANOS_PER_MICROSECOND", ")", "return", "self", ".", "seconds", "*", "_MICROS_PER_SECOND", "+", "micros" ]
Converts a Duration to microseconds.
[ "Converts", "a", "Duration", "to", "microseconds", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L310-L313
28,842
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
Duration.ToMilliseconds
def ToMilliseconds(self): """Converts a Duration to milliseconds.""" millis = _RoundTowardZero(self.nanos, _NANOS_PER_MILLISECOND) return self.seconds * _MILLIS_PER_SECOND + millis
python
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", ")", ":", "millis", "=", "_RoundTowardZero", "(", "self", ".", "nanos", ",", "_NANOS_PER_MILLISECOND", ")", "return", "self", ".", "seconds", "*", "_MILLIS_PER_SECOND", "+", "millis" ]
Converts a Duration to milliseconds.
[ "Converts", "a", "Duration", "to", "milliseconds", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L315-L318
28,843
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
Duration.FromMicroseconds
def FromMicroseconds(self, micros): """Converts microseconds to Duration.""" self._NormalizeDuration( micros // _MICROS_PER_SECOND, (micros % _MICROS_PER_SECOND) * _NANOS_PER_MICROSECOND)
python
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", ")", ":", "self", ".", "_NormalizeDuration", "(", "micros", "//", "_MICROS_PER_SECOND", ",", "(", "micros", "%", "_MICROS_PER_SECOND", ")", "*", "_NANOS_PER_MICROSECOND", ")" ]
Converts microseconds to Duration.
[ "Converts", "microseconds", "to", "Duration", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L329-L333
28,844
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
Duration.FromMilliseconds
def FromMilliseconds(self, millis): """Converts milliseconds to Duration.""" self._NormalizeDuration( millis // _MILLIS_PER_SECOND, (millis % _MILLIS_PER_SECOND) * _NANOS_PER_MILLISECOND)
python
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", ")", ":", "self", ".", "_NormalizeDuration", "(", "millis", "//", "_MILLIS_PER_SECOND", ",", "(", "millis", "%", "_MILLIS_PER_SECOND", ")", "*", "_NANOS_PER_MILLISECOND", ")" ]
Converts milliseconds to Duration.
[ "Converts", "milliseconds", "to", "Duration", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L335-L339
28,845
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
Duration.ToTimedelta
def ToTimedelta(self): """Converts Duration to timedelta.""" return timedelta( seconds=self.seconds, microseconds=_RoundTowardZero( self.nanos, _NANOS_PER_MICROSECOND))
python
def ToTimedelta(self): """Converts Duration to timedelta.""" return timedelta( seconds=self.seconds, microseconds=_RoundTowardZero( self.nanos, _NANOS_PER_MICROSECOND))
[ "def", "ToTimedelta", "(", "self", ")", ":", "return", "timedelta", "(", "seconds", "=", "self", ".", "seconds", ",", "microseconds", "=", "_RoundTowardZero", "(", "self", ".", "nanos", ",", "_NANOS_PER_MICROSECOND", ")", ")" ]
Converts Duration to timedelta.
[ "Converts", "Duration", "to", "timedelta", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L346-L350
28,846
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
Duration.FromTimedelta
def FromTimedelta(self, td): """Convertd timedelta to Duration.""" self._NormalizeDuration(td.seconds + td.days * _SECONDS_PER_DAY, td.microseconds * _NANOS_PER_MICROSECOND)
python
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", ")", ":", "self", ".", "_NormalizeDuration", "(", "td", ".", "seconds", "+", "td", ".", "days", "*", "_SECONDS_PER_DAY", ",", "td", ".", "microseconds", "*", "_NANOS_PER_MICROSECOND", ")" ]
Convertd timedelta to Duration.
[ "Convertd", "timedelta", "to", "Duration", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L352-L355
28,847
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
Duration._NormalizeDuration
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
python
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", ")", ":", "# Force nanos to be negative if the duration is negative.", "if", "seconds", "<", "0", "and", "nanos", ">", "0", ":", "seconds", "+=", "1", "nanos", "-=", "_NANOS_PER_SECOND", "self...
Set Duration by seconds and nonas.
[ "Set", "Duration", "by", "seconds", "and", "nonas", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L357-L364
28,848
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
FieldMask.ToJsonString
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)
python
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", ")", ":", "camelcase_paths", "=", "[", "]", "for", "path", "in", "self", ".", "paths", ":", "camelcase_paths", ".", "append", "(", "_SnakeCaseToCamelCase", "(", "path", ")", ")", "return", "','", ".", "join", "(", "cam...
Converts FieldMask to string according to proto3 JSON spec.
[ "Converts", "FieldMask", "to", "string", "according", "to", "proto3", "JSON", "spec", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L396-L401
28,849
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
FieldMask.IsValidForDescriptor
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
python
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", ")", ":", "for", "path", "in", "self", ".", "paths", ":", "if", "not", "_IsValidPath", "(", "message_descriptor", ",", "path", ")", ":", "return", "False", "return", "True" ]
Checks whether the FieldMask is valid for Message Descriptor.
[ "Checks", "whether", "the", "FieldMask", "is", "valid", "for", "Message", "Descriptor", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L409-L414
28,850
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
FieldMask.AllFieldsFromDescriptor
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)
python
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", ")", ":", "self", ".", "Clear", "(", ")", "for", "field", "in", "message_descriptor", ".", "fields", ":", "self", ".", "paths", ".", "append", "(", "field", ".", "name", ")" ]
Gets all direct fields of Message Descriptor to FieldMask.
[ "Gets", "all", "direct", "fields", "of", "Message", "Descriptor", "to", "FieldMask", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L416-L420
28,851
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
FieldMask.Union
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)
python
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", ")", ":", "_CheckFieldMaskMessage", "(", "mask1", ")", "_CheckFieldMaskMessage", "(", "mask2", ")", "tree", "=", "_FieldMaskTree", "(", "mask1", ")", "tree", ".", "MergeFromFieldMask", "(", "mask2", ")...
Merges mask1 and mask2 into this FieldMask.
[ "Merges", "mask1", "and", "mask2", "into", "this", "FieldMask", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L435-L441
28,852
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
FieldMask.Intersect
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...
python
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", ")", ":", "_CheckFieldMaskMessage", "(", "mask1", ")", "_CheckFieldMaskMessage", "(", "mask2", ")", "tree", "=", "_FieldMaskTree", "(", "mask1", ")", "intersection", "=", "_FieldMaskTree", "(", ")", ...
Intersects mask1 and mask2 into this FieldMask.
[ "Intersects", "mask1", "and", "mask2", "into", "this", "FieldMask", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L443-L451
28,853
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
FieldMask.MergeMessage
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:...
python
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", ")", ":", "tree", "=", "_FieldMaskTree", "(", "self", ")", "tree", ".", "MergeMessage", "(", "source...
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...
[ "Merges", "fields", "specified", "in", "FieldMask", "from", "source", "to", "destination", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L453-L468
28,854
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
_FieldMaskTree.AddPath
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 ...
python
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", ")", ":", "node", "=", "self", ".", "_root", "for", "name", "in", "path", ".", "split", "(", "'.'", ")", ":", "if", "name", "not", "in", "node", ":", "node", "[", "name", "]", "=", "{", "}", "elif", ...
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...
[ "Adds", "a", "field", "path", "into", "the", "tree", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L560-L583
28,855
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
_FieldMaskTree.IntersectPath
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 ...
python
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", ")", ":", "node", "=", "self", ".", "_root", "for", "name", "in", "path", ".", "split", "(", "'.'", ")", ":", "if", "name", "not", "in", "node", ":", "return", "elif", "not", "n...
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.
[ "Calculates", "the", "intersection", "part", "of", "a", "field", "path", "with", "this", "tree", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L590-L605
28,856
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
_FieldMaskTree.AddLeafNodes
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])
python
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", ")", ":", "if", "not", "node", ":", "self", ".", "AddPath", "(", "prefix", ")", "for", "name", "in", "node", ":", "child_path", "=", "prefix", "+", "'.'", "+", "name", "self", ".", "Ad...
Adds leaf nodes begin with prefix to this tree.
[ "Adds", "leaf", "nodes", "begin", "with", "prefix", "to", "this", "tree", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L607-L613
28,857
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py
_FieldMaskTree.MergeMessage
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)
python
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", ")", ":", "_MergeMessage", "(", "self", ".", "_root", ",", "source", ",", "destination", ",", "replace_message", ",", "replace_repeated", ")" ...
Merge all fields specified by this tree from source to destination.
[ "Merge", "all", "fields", "specified", "by", "this", "tree", "from", "source", "to", "destination", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/internal/well_known_types.py#L615-L620
28,858
apple/turicreate
src/unity/python/turicreate/toolkits/regression/linear_regression.py
LinearRegression.predict
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 ---------- ...
python
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", "super", "(", "LinearRegression", ",", "self", ")", ".", "predict", "(", "dataset", ",", "missing_value_action", "=", "missing_value_action", ")" ]
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...
[ "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", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/regression/linear_regression.py#L519-L564
28,859
apple/turicreate
src/unity/python/turicreate/toolkits/regression/linear_regression.py
LinearRegression.evaluate
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 ...
python
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'", ")", ":", "_raise_error_evaluation_metric_is_valid", "(", "metric", ",", "[", "'auto'", ",", "'rmse'", ",", "'max_error'", "]", ")", "retu...
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 ...
[ "r", "Evaluate", "the", "model", "by", "making", "target", "value", "predictions", "and", "comparing", "to", "actual", "values", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/regression/linear_regression.py#L567-L635
28,860
apple/turicreate
src/unity/python/turicreate/toolkits/sound_classifier/mel_features.py
frame
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 ...
python
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", ")", ":", "num_samples", "=", "data", ".", "shape", "[", "0", "]", "num_frames", "=", "1", "+", "int", "(", "np", ".", "floor", "(", "(", "num_samples", "-", "window_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 one. This is accomplished using stride_tricks,...
[ "Convert", "array", "into", "a", "sequence", "of", "successive", "possibly", "overlapping", "frames", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/sound_classifier/mel_features.py#L21-L45
28,861
apple/turicreate
src/unity/python/turicreate/toolkits/sound_classifier/mel_features.py
periodic_hann
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 ...
python
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", ")", ":", "return", "0.5", "-", "(", "0.5", "*", "np", ".", "cos", "(", "2", "*", "np", ".", "pi", "/", "window_length", "*", "np", ".", "arange", "(", "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 it. However, for Fourier analysis, thi...
[ "Calculate", "a", "periodic", "Hann", "window", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/sound_classifier/mel_features.py#L48-L68
28,862
apple/turicreate
src/unity/python/turicreate/toolkits/sound_classifier/mel_features.py
stft_magnitude
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...
python
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", ")", ":", "frames", "=", "frame", "(", "signal", ",", "window_length", ",", "hop_length", ")", "# Apply frame window to each frame. We use...
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...
[ "Calculate", "the", "short", "-", "time", "Fourier", "transform", "magnitude", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/sound_classifier/mel_features.py#L71-L92
28,863
apple/turicreate
src/unity/python/turicreate/toolkits/sound_classifier/mel_features.py
spectrogram_to_mel_matrix
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...
python
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", ")", ":", "nyquist_hertz", "=", "audi...
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...
[ "Return", "a", "matrix", "that", "can", "post", "-", "multiply", "spectrogram", "rows", "to", "make", "mel", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/sound_classifier/mel_features.py#L114-L189
28,864
apple/turicreate
src/unity/python/turicreate/toolkits/sound_classifier/mel_features.py
log_mel_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. ...
python
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", ")", ":", "window_length_samples", "=", "in...
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...
[ "Convert", "waveform", "to", "a", "log", "magnitude", "mel", "-", "frequency", "spectrogram", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/sound_classifier/mel_features.py#L192-L223
28,865
apple/turicreate
src/unity/python/turicreate/toolkits/activity_classifier/_activity_classifier.py
ActivityClassifier.classify
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 ...
python
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'", ")", ":", "_tkutl", ".", "_check_categorical_option_type", "(", "'output_frequency'", ",", "output_frequency", ",", "[", "'per_window'", ",", "'per_row'", "]", ")", "id_targ...
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 ...
[ "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", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/activity_classifier/_activity_classifier.py#L745-L795
28,866
apple/turicreate
deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/char_stat.py
count_characters
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 ...
python
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", ")", ":", "if", "os", ".", "path", ".", "isfile", "(", "root", ")", ":", "with", "open", "(", "root", ",", "'rb'", ")", "as", "in_f", ":", "for", "line", "in", "in_f", ":", "for", "char", "in", ...
Count the occurrances of the different characters in the files
[ "Count", "the", "occurrances", "of", "the", "different", "characters", "in", "the", "files" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/metaparse/tools/benchmark/char_stat.py#L13-L24
28,867
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/utils.py
save_spec
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...
python
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", ")", ":", "name", ",", "ext", "=", "_os", ".", "path", ".", "splitext", "(", "filename", ")", "if", "not", "ext", ":", "filename", "=", "\"%s.mlmodel\"", "%", "filename", "else", ":", "if", "ext", "!=...
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...
[ "Save", "a", "protobuf", "model", "specification", "to", "file", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/utils.py#L28-L59
28,868
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/utils.py
load_spec
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...
python
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", ")", ":", "from", ".", ".", "proto", "import", "Model_pb2", "spec", "=", "Model_pb2", ".", "Model", "(", ")", "with", "open", "(", "filename", ",", "'rb'", ")", "as", "f", ":", "contents", "=", "f", ".", "read", ...
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 -------- ...
[ "Load", "a", "protobuf", "model", "specification", "from", "file" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/utils.py#L62-L93
28,869
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/utils.py
_get_nn_layers
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 """ ...
python
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", ")", ":", "layers", "=", "[", "]", "if", "spec", ".", "WhichOneof", "(", "'Type'", ")", "==", "'pipeline'", ":", "layers", "=", "[", "]", "for", "model_spec", "in", "spec", ".", "pipeline", ".", "models", ":", "i...
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", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/utils.py#L96-L137
28,870
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/utils.py
evaluate_classifier_with_probabilities
def evaluate_classifier_with_probabilities(model, data, probabilities='probabilities', verbose = False): """ Evaluate a classifier specification for testing. Parameters ---------- filename: [str | Model] F...
python
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", ")", ":", "model", "=", "_get_model", "(", "model", ")", "if", "verbose", ":", "print", "(", "\"\"", ")", ...
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...
[ "Evaluate", "a", "classifier", "specification", "for", "testing", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/utils.py#L512-L571
28,871
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/utils.py
rename_feature
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...
python
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", ")", ":", "from", "coremltools", ".", "models", "import", "MLModel", "if", "not", "rename_inputs", "and", "not", ...
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...
[ "Rename", "a", "feature", "in", "the", "specification", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/utils.py#L574-L674
28,872
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/utils.py
_sanitize_value
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(...
python
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", ")", ":", "if", "isinstance", "(", "x", ",", "_six", ".", "string_types", "+", "_six", ".", "integer_types", "+", "(", "float", ",", ")", ")", ":", "return", "x", "elif", "_HAS_SKLEARN", "and", "_sp", ".", "issparse"...
Performs cleaning steps on the data so various type comparisons can be performed correctly.
[ "Performs", "cleaning", "steps", "on", "the", "data", "so", "various", "type", "comparisons", "can", "be", "performed", "correctly", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/utils.py#L677-L695
28,873
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/utils.py
_element_equal
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): ...
python
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", ")", ":", "if", "isinstance", "(", "x", ",", "_np", ".", "ndarray", ")", "or", "isinstance", "(", "y", ",", "_np", ".", "ndarray", ")", ":", "try", ":", "return", "(", "abs", "(", "_np", ".", "asarray"...
Performs a robust equality test between elements.
[ "Performs", "a", "robust", "equality", "test", "between", "elements", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/utils.py#L698-L716
28,874
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/utils.py
evaluate_transformer
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...
python
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", ")", ":", "model", "=", "_get_model", "(", "model", ")", "if", "verbose", ":", "print", "(", "model", ")", "print", "(", "\"\"", ")", "...
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...
[ "Evaluate", "a", "transformer", "specification", "for", "testing", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/utils.py#L719-L786
28,875
apple/turicreate
src/unity/python/turicreate/toolkits/graph_analytics/degree_counting.py
create
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 :...
python
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", ")", ":", "from", "turicreate", ".", "_cython", ".", "cy_server", "import", "QuietProgress", "if", "not", "isinstance", "(", "graph", ",", "_SGraph", ")", ":", "raise", "TypeError", "(", "'\"graph...
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 ------...
[ "Compute", "the", "in", "degree", "out", "degree", "and", "total", "degree", "of", "each", "vertex", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/graph_analytics/degree_counting.py#L57-L119
28,876
apple/turicreate
deps/src/boost_1_68_0/tools/litre/cplusplus.py
Example.replace_emphasis
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]
python
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", ")", ":", "e", "=", "self", ".", "emphasized", "[", "index", "]", "self", ".", "body", "[", "e", "[", "0", "]", ":", "e", "[", "1", "]", "]", "=", "[", "s", "]", "del...
replace the index'th emphasized text with s
[ "replace", "the", "index", "th", "emphasized", "text", "with", "s" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/litre/cplusplus.py#L90-L94
28,877
apple/turicreate
deps/src/boost_1_68_0/tools/litre/cplusplus.py
CPlusPlusTranslator._execute
def _execute(self, code): """Override of litre._execute; sets up variable context before evaluating code """ self.globals['example'] = self.example eval(code, self.globals)
python
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", ")", ":", "self", ".", "globals", "[", "'example'", "]", "=", "self", ".", "example", "eval", "(", "code", ",", "self", ".", "globals", ")" ]
Override of litre._execute; sets up variable context before evaluating code
[ "Override", "of", "litre", ".", "_execute", ";", "sets", "up", "variable", "context", "before", "evaluating", "code" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/litre/cplusplus.py#L320-L325
28,878
apple/turicreate
deps/src/boost_1_68_0/tools/litre/cplusplus.py
CPlusPlusTranslator.compile
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...
python
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...
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...
[ "Compile", "examples", "on", "the", "stack", "whose", "topmost", "item", "is", "the", "last", "example", "seen", "but", "not", "yet", "handled", "so", "far", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/litre/cplusplus.py#L357-L490
28,879
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/project.py
ProjectRegistry.load
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.""" ...
python
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", ")", ":", "assert", "isinstance", "(", "jamfile_location", ",", "basestring", ")", "absolute", "=", "os", ".", "path", ".", "join", "(", "os", ".", "getcwd", "(", ")", ",", "jamfile_location", ")", "ab...
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"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L132-L164
28,880
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/project.py
ProjectRegistry.load_parent
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...
python
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", ")", ":", "assert", "isinstance", "(", "location", ",", "basestring", ")", "found", "=", "b2", ".", "util", ".", "path", ".", "glob_in_parents", "(", "location", ",", "self", ".", "JAMROOT", "+", "self"...
Loads parent of Jamfile at 'location'. Issues an error if nothing is found.
[ "Loads", "parent", "of", "Jamfile", "at", "location", ".", "Issues", "an", "error", "if", "nothing", "is", "found", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L178-L190
28,881
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/project.py
ProjectRegistry.find
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...
python
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", ")", ":", "assert", "isinstance", "(", "name", ",", "basestring", ")", "assert", "isinstance", "(", "current_location", ",", "basestring", ")", "project_module", "=", "None", "# Try interpreting n...
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.
[ "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", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L192-L219
28,882
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/project.py
ProjectRegistry.module_name
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...
python
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", ")", ":", "assert", "isinstance", "(", "jamfile_location", ",", "basestring", ")", "module", "=", "self", ".", "location2module", ".", "get", "(", "jamfile_location", ")", "if", "not", "module", ":", ...
Returns the name of module corresponding to 'jamfile-location'. If no module corresponds to location yet, associates default module name with that location.
[ "Returns", "the", "name", "of", "module", "corresponding", "to", "jamfile", "-", "location", ".", "If", "no", "module", "corresponds", "to", "location", "yet", "associates", "default", "module", "name", "with", "that", "location", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L221-L235
28,883
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/project.py
ProjectRegistry.load_standalone
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...
python
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", ")", ":", "assert", "isinstance", "(", "jamfile_module", ",", "basestring", ")", "assert", "isinstance", "(", "file", ",", "basestring", ")", "self", ".", "used_projects", "[", "jamfile...
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...
[ "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",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L387-L402
28,884
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/project.py
ProjectRegistry.initialize
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...
python
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", "=", "''", ")", ":", "assert", "isinstance", "(", "module_name", ",", "basestring", ")", "assert", "isinstance", "(", ...
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. ...
[ "Initialize", "the", "module", "for", "a", "project", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L412-L509
28,885
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/project.py
ProjectRegistry.inherit_attributes
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...
python
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", ")", ":", "assert", "isinstance", "(", "project_module", ",", "basestring", ")", "assert", "isinstance", "(", "parent_module", ",", "basestring", ")", "attributes", "=", "self",...
Make 'project-module' inherit attributes of project root and parent module.
[ "Make", "project", "-", "module", "inherit", "attributes", "of", "project", "root", "and", "parent", "module", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L511-L549
28,886
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/project.py
ProjectRegistry.register_id
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
python
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", ")", ":", "assert", "isinstance", "(", "id", ",", "basestring", ")", "assert", "isinstance", "(", "module", ",", "basestring", ")", "self", ".", "id2module", "[", "id", "]", "=", "module" ]
Associate the given id with the given project module.
[ "Associate", "the", "given", "id", "with", "the", "given", "project", "module", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L551-L555
28,887
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/project.py
ProjectRegistry.push_current
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...
python
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", ")", ":", "if", "__debug__", ":", "from", ".", "targets", "import", "ProjectTarget", "assert", "isinstance", "(", "project", ",", "ProjectTarget", ")", "self", ".", "saved_current_project", ".", "append", "("...
Temporary changes the current project to 'project'. Should be followed by 'pop-current'.
[ "Temporary", "changes", "the", "current", "project", "to", "project", ".", "Should", "be", "followed", "by", "pop", "-", "current", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L572-L579
28,888
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/project.py
ProjectRegistry.target
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...
python
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", ")", ":", "assert", "isinstance", "(", "project_module", ",", "basestring", ")", "if", "project_module", "not", "in", "self", ".", "module2target", ":", "self", ".", "module2target", "[", "project_module", "...
Returns the project target corresponding to the 'project-module'.
[ "Returns", "the", "project", "target", "corresponding", "to", "the", "project", "-", "module", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L611-L619
28,889
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/project.py
ProjectRegistry.add_rule
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_)
python
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_", ")", ":", "assert", "isinstance", "(", "name", ",", "basestring", ")", "assert", "callable", "(", "callable_", ")", "self", ".", "project_rules_", ".", "add_rule", "(", "name", ",", "callable_"...
Makes rule 'name' available to all subsequently loaded Jamfiles. Calling that rule wil relay to 'callable'.
[ "Makes", "rule", "name", "available", "to", "all", "subsequently", "loaded", "Jamfiles", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L639-L645
28,890
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/project.py
ProjectRegistry.load_module
def load_module(self, name, extra_path=None): """Load a Python module that should be useable from Jamfiles. There are generally two types of modules Jamfiles might want to use: - Core Boost.Build. Those are imported using plain names, e.g. 'toolset', so this function checks if w...
python
def load_module(self, name, extra_path=None): """Load a Python module that should be useable from Jamfiles. There are generally two types of modules Jamfiles might want to use: - Core Boost.Build. Those are imported using plain names, e.g. 'toolset', so this function checks if w...
[ "def", "load_module", "(", "self", ",", "name", ",", "extra_path", "=", "None", ")", ":", "assert", "isinstance", "(", "name", ",", "basestring", ")", "assert", "is_iterable_typed", "(", "extra_path", ",", "basestring", ")", "or", "extra_path", "is", "None",...
Load a Python module that should be useable from Jamfiles. There are generally two types of modules Jamfiles might want to use: - Core Boost.Build. Those are imported using plain names, e.g. 'toolset', so this function checks if we have module named b2.package.module already. ...
[ "Load", "a", "Python", "module", "that", "should", "be", "useable", "from", "Jamfiles", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L726-L806
28,891
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/project.py
ProjectAttributes.dump
def dump(self): """Prints the project attributes.""" id = self.get("id") if not id: id = "(none)" else: id = id[0] parent = self.get("parent") if not parent: parent = "(none)" else: parent = parent[0] print...
python
def dump(self): """Prints the project attributes.""" id = self.get("id") if not id: id = "(none)" else: id = id[0] parent = self.get("parent") if not parent: parent = "(none)" else: parent = parent[0] print...
[ "def", "dump", "(", "self", ")", ":", "id", "=", "self", ".", "get", "(", "\"id\"", ")", "if", "not", "id", ":", "id", "=", "\"(none)\"", "else", ":", "id", "=", "id", "[", "0", "]", "parent", "=", "self", ".", "get", "(", "\"parent\"", ")", ...
Prints the project attributes.
[ "Prints", "the", "project", "attributes", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L954-L973
28,892
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/project.py
ProjectRules.make_wrapper
def make_wrapper(self, callable_): """Given a free-standing function 'callable', return a new callable that will call 'callable' and report all exceptins, using 'call_and_report_errors'.""" assert callable(callable_) def wrapper(*args, **kw): return self.call_and_repo...
python
def make_wrapper(self, callable_): """Given a free-standing function 'callable', return a new callable that will call 'callable' and report all exceptins, using 'call_and_report_errors'.""" assert callable(callable_) def wrapper(*args, **kw): return self.call_and_repo...
[ "def", "make_wrapper", "(", "self", ",", "callable_", ")", ":", "assert", "callable", "(", "callable_", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kw", ")", ":", "return", "self", ".", "call_and_report_errors", "(", "callable_", ",", "*", ...
Given a free-standing function 'callable', return a new callable that will call 'callable' and report all exceptins, using 'call_and_report_errors'.
[ "Given", "a", "free", "-", "standing", "function", "callable", "return", "a", "new", "callable", "that", "will", "call", "callable", "and", "report", "all", "exceptins", "using", "call_and_report_errors", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L1044-L1051
28,893
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/project.py
ProjectRules.constant
def constant(self, name, value): """Declare and set a project global constant. Project global constants are normal variables but should not be changed. They are applied to every child Jamfile.""" assert is_iterable_typed(name, basestring) assert is_iterable_typed(value, basestrin...
python
def constant(self, name, value): """Declare and set a project global constant. Project global constants are normal variables but should not be changed. They are applied to every child Jamfile.""" assert is_iterable_typed(name, basestring) assert is_iterable_typed(value, basestrin...
[ "def", "constant", "(", "self", ",", "name", ",", "value", ")", ":", "assert", "is_iterable_typed", "(", "name", ",", "basestring", ")", "assert", "is_iterable_typed", "(", "value", ",", "basestring", ")", "self", ".", "registry", ".", "current", "(", ")",...
Declare and set a project global constant. Project global constants are normal variables but should not be changed. They are applied to every child Jamfile.
[ "Declare", "and", "set", "a", "project", "global", "constant", ".", "Project", "global", "constants", "are", "normal", "variables", "but", "should", "not", "be", "changed", ".", "They", "are", "applied", "to", "every", "child", "Jamfile", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L1136-L1142
28,894
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/project.py
ProjectRules.path_constant
def path_constant(self, name, value): """Declare and set a project global constant, whose value is a path. The path is adjusted to be relative to the invocation directory. The given value path is taken to be either absolute, or relative to this project root.""" assert is_iterable...
python
def path_constant(self, name, value): """Declare and set a project global constant, whose value is a path. The path is adjusted to be relative to the invocation directory. The given value path is taken to be either absolute, or relative to this project root.""" assert is_iterable...
[ "def", "path_constant", "(", "self", ",", "name", ",", "value", ")", ":", "assert", "is_iterable_typed", "(", "name", ",", "basestring", ")", "assert", "is_iterable_typed", "(", "value", ",", "basestring", ")", "if", "len", "(", "value", ")", ">", "1", "...
Declare and set a project global constant, whose value is a path. The path is adjusted to be relative to the invocation directory. The given value path is taken to be either absolute, or relative to this project root.
[ "Declare", "and", "set", "a", "project", "global", "constant", "whose", "value", "is", "a", "path", ".", "The", "path", "is", "adjusted", "to", "be", "relative", "to", "the", "invocation", "directory", ".", "The", "given", "value", "path", "is", "taken", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/project.py#L1144-L1153
28,895
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/array_feature_extractor.py
create_array_feature_extractor
def create_array_feature_extractor(input_features, output_name, extract_indices, output_type = None): """ Creates a feature extractor from an input array feature, return input_features is a list of one (name, array) tuple. extract_indices is either an integer or a li...
python
def create_array_feature_extractor(input_features, output_name, extract_indices, output_type = None): """ Creates a feature extractor from an input array feature, return input_features is a list of one (name, array) tuple. extract_indices is either an integer or a li...
[ "def", "create_array_feature_extractor", "(", "input_features", ",", "output_name", ",", "extract_indices", ",", "output_type", "=", "None", ")", ":", "# Make sure that our starting stuff is in the proper form.", "assert", "len", "(", "input_features", ")", "==", "1", "as...
Creates a feature extractor from an input array feature, return input_features is a list of one (name, array) tuple. extract_indices is either an integer or a list. If it's an integer, the output type is by default a double (but may also be an integer). If a list, the output type is an array.
[ "Creates", "a", "feature", "extractor", "from", "an", "input", "array", "feature", "return" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/array_feature_extractor.py#L16-L59
28,896
apple/turicreate
deps/src/boost_1_68_0/libs/predef/tools/ci/build_log.py
BuildOutputProcessor.add_input
def add_input(self, input): ''' Add a single build XML output file to our data. ''' events = xml.dom.pulldom.parse(input) context = [] for (event,node) in events: if event == xml.dom.pulldom.START_ELEMENT: context.append(node) i...
python
def add_input(self, input): ''' Add a single build XML output file to our data. ''' events = xml.dom.pulldom.parse(input) context = [] for (event,node) in events: if event == xml.dom.pulldom.START_ELEMENT: context.append(node) i...
[ "def", "add_input", "(", "self", ",", "input", ")", ":", "events", "=", "xml", ".", "dom", ".", "pulldom", ".", "parse", "(", "input", ")", "context", "=", "[", "]", "for", "(", "event", ",", "node", ")", "in", "events", ":", "if", "event", "==",...
Add a single build XML output file to our data.
[ "Add", "a", "single", "build", "XML", "output", "file", "to", "our", "data", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/predef/tools/ci/build_log.py#L85-L103
28,897
apple/turicreate
deps/src/boost_1_68_0/libs/predef/tools/ci/build_log.py
BuildOutputProcessor.x_build_targets_target
def x_build_targets_target( self, node ): ''' Process the target dependency DAG into an ancestry tree so we can look up which top-level library and test targets specific build actions correspond to. ''' target_node = node name = self.get_child_data(target_node,tag='name',...
python
def x_build_targets_target( self, node ): ''' Process the target dependency DAG into an ancestry tree so we can look up which top-level library and test targets specific build actions correspond to. ''' target_node = node name = self.get_child_data(target_node,tag='name',...
[ "def", "x_build_targets_target", "(", "self", ",", "node", ")", ":", "target_node", "=", "node", "name", "=", "self", ".", "get_child_data", "(", "target_node", ",", "tag", "=", "'name'", ",", "strip", "=", "True", ")", "path", "=", "self", ".", "get_chi...
Process the target dependency DAG into an ancestry tree so we can look up which top-level library and test targets specific build actions correspond to.
[ "Process", "the", "target", "dependency", "DAG", "into", "an", "ancestry", "tree", "so", "we", "can", "look", "up", "which", "top", "-", "level", "library", "and", "test", "targets", "specific", "build", "actions", "correspond", "to", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/predef/tools/ci/build_log.py#L146-L167
28,898
apple/turicreate
deps/src/boost_1_68_0/libs/predef/tools/ci/build_log.py
BuildOutputProcessor.x_build_action
def x_build_action( self, node ): ''' Given a build action log, process into the corresponding test log and specific test log sub-part. ''' action_node = node name = self.get_child(action_node,tag='name') if name: name = self.get_data(name) ...
python
def x_build_action( self, node ): ''' Given a build action log, process into the corresponding test log and specific test log sub-part. ''' action_node = node name = self.get_child(action_node,tag='name') if name: name = self.get_data(name) ...
[ "def", "x_build_action", "(", "self", ",", "node", ")", ":", "action_node", "=", "node", "name", "=", "self", ".", "get_child", "(", "action_node", ",", "tag", "=", "'name'", ")", "if", "name", ":", "name", "=", "self", ".", "get_data", "(", "name", ...
Given a build action log, process into the corresponding test log and specific test log sub-part.
[ "Given", "a", "build", "action", "log", "process", "into", "the", "corresponding", "test", "log", "and", "specific", "test", "log", "sub", "-", "part", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/predef/tools/ci/build_log.py#L169-L233
28,899
apple/turicreate
deps/src/boost_1_68_0/libs/predef/tools/ci/build_log.py
BuildOutputProcessor.x_build_timestamp
def x_build_timestamp( self, node ): ''' The time-stamp goes to the corresponding attribute in the result. ''' self.timestamps.append(self.get_data(node).strip()) return None
python
def x_build_timestamp( self, node ): ''' The time-stamp goes to the corresponding attribute in the result. ''' self.timestamps.append(self.get_data(node).strip()) return None
[ "def", "x_build_timestamp", "(", "self", ",", "node", ")", ":", "self", ".", "timestamps", ".", "append", "(", "self", ".", "get_data", "(", "node", ")", ".", "strip", "(", ")", ")", "return", "None" ]
The time-stamp goes to the corresponding attribute in the result.
[ "The", "time", "-", "stamp", "goes", "to", "the", "corresponding", "attribute", "in", "the", "result", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/predef/tools/ci/build_log.py#L235-L240