id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
29,400
apple/turicreate
deps/src/libxml2-2.9.1/python/libxml2.py
xpathContext.setContextNode
def setContextNode(self, node): """Set the current node of an xpathContext """ if node is None: node__o = None else: node__o = node._o libxml2mod.xmlXPathSetContextNode(self._o, node__o)
python
def setContextNode(self, node): """Set the current node of an xpathContext """ if node is None: node__o = None else: node__o = node._o libxml2mod.xmlXPathSetContextNode(self._o, node__o)
[ "def", "setContextNode", "(", "self", ",", "node", ")", ":", "if", "node", "is", "None", ":", "node__o", "=", "None", "else", ":", "node__o", "=", "node", ".", "_o", "libxml2mod", ".", "xmlXPathSetContextNode", "(", "self", ".", "_o", ",", "node__o", "...
Set the current node of an xpathContext
[ "Set", "the", "current", "node", "of", "an", "xpathContext" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/libxml2-2.9.1/python/libxml2.py#L7297-L7301
29,401
apple/turicreate
deps/src/libxml2-2.9.1/python/libxml2.py
xpathContext.registerXPathFunction
def registerXPathFunction(self, name, ns_uri, f): """Register a Python written function to the XPath interpreter """ ret = libxml2mod.xmlRegisterXPathFunction(self._o, name, ns_uri, f) return ret
python
def registerXPathFunction(self, name, ns_uri, f): """Register a Python written function to the XPath interpreter """ ret = libxml2mod.xmlRegisterXPathFunction(self._o, name, ns_uri, f) return ret
[ "def", "registerXPathFunction", "(", "self", ",", "name", ",", "ns_uri", ",", "f", ")", ":", "ret", "=", "libxml2mod", ".", "xmlRegisterXPathFunction", "(", "self", ".", "_o", ",", "name", ",", "ns_uri", ",", "f", ")", "return", "ret" ]
Register a Python written function to the XPath interpreter
[ "Register", "a", "Python", "written", "function", "to", "the", "XPath", "interpreter" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/libxml2-2.9.1/python/libxml2.py#L7307-L7310
29,402
apple/turicreate
deps/src/libxml2-2.9.1/python/libxml2.py
xpathContext.xpathRegisterVariable
def xpathRegisterVariable(self, name, ns_uri, value): """Register a variable with the XPath context """ ret = libxml2mod.xmlXPathRegisterVariable(self._o, name, ns_uri, value) return ret
python
def xpathRegisterVariable(self, name, ns_uri, value): """Register a variable with the XPath context """ ret = libxml2mod.xmlXPathRegisterVariable(self._o, name, ns_uri, value) return ret
[ "def", "xpathRegisterVariable", "(", "self", ",", "name", ",", "ns_uri", ",", "value", ")", ":", "ret", "=", "libxml2mod", ".", "xmlXPathRegisterVariable", "(", "self", ".", "_o", ",", "name", ",", "ns_uri", ",", "value", ")", "return", "ret" ]
Register a variable with the XPath context
[ "Register", "a", "variable", "with", "the", "XPath", "context" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/libxml2-2.9.1/python/libxml2.py#L7312-L7315
29,403
apple/turicreate
deps/src/libxml2-2.9.1/python/libxml2.py
xpathContext.xpathEvalExpression
def xpathEvalExpression(self, str): """Evaluate the XPath expression in the given context. """ ret = libxml2mod.xmlXPathEvalExpression(str, self._o) if ret is None:raise xpathError('xmlXPathEvalExpression() failed') return xpathObjectRet(ret)
python
def xpathEvalExpression(self, str): """Evaluate the XPath expression in the given context. """ ret = libxml2mod.xmlXPathEvalExpression(str, self._o) if ret is None:raise xpathError('xmlXPathEvalExpression() failed') return xpathObjectRet(ret)
[ "def", "xpathEvalExpression", "(", "self", ",", "str", ")", ":", "ret", "=", "libxml2mod", ".", "xmlXPathEvalExpression", "(", "str", ",", "self", ".", "_o", ")", "if", "ret", "is", "None", ":", "raise", "xpathError", "(", "'xmlXPathEvalExpression() failed'", ...
Evaluate the XPath expression in the given context.
[ "Evaluate", "the", "XPath", "expression", "in", "the", "given", "context", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/libxml2-2.9.1/python/libxml2.py#L7339-L7343
29,404
apple/turicreate
deps/src/libxml2-2.9.1/python/libxml2.py
xpathContext.xpathNewParserContext
def xpathNewParserContext(self, str): """Create a new xmlXPathParserContext """ ret = libxml2mod.xmlXPathNewParserContext(str, self._o) if ret is None:raise xpathError('xmlXPathNewParserContext() failed') __tmp = xpathParserContext(_obj=ret) return __tmp
python
def xpathNewParserContext(self, str): """Create a new xmlXPathParserContext """ ret = libxml2mod.xmlXPathNewParserContext(str, self._o) if ret is None:raise xpathError('xmlXPathNewParserContext() failed') __tmp = xpathParserContext(_obj=ret) return __tmp
[ "def", "xpathNewParserContext", "(", "self", ",", "str", ")", ":", "ret", "=", "libxml2mod", ".", "xmlXPathNewParserContext", "(", "str", ",", "self", ".", "_o", ")", "if", "ret", "is", "None", ":", "raise", "xpathError", "(", "'xmlXPathNewParserContext() fail...
Create a new xmlXPathParserContext
[ "Create", "a", "new", "xmlXPathParserContext" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/libxml2-2.9.1/python/libxml2.py#L7353-L7358
29,405
apple/turicreate
deps/src/libxml2-2.9.1/python/libxml2.py
xpathContext.xpathNsLookup
def xpathNsLookup(self, prefix): """Search in the namespace declaration array of the context for the given namespace name associated to the given prefix """ ret = libxml2mod.xmlXPathNsLookup(self._o, prefix) return ret
python
def xpathNsLookup(self, prefix): """Search in the namespace declaration array of the context for the given namespace name associated to the given prefix """ ret = libxml2mod.xmlXPathNsLookup(self._o, prefix) return ret
[ "def", "xpathNsLookup", "(", "self", ",", "prefix", ")", ":", "ret", "=", "libxml2mod", ".", "xmlXPathNsLookup", "(", "self", ".", "_o", ",", "prefix", ")", "return", "ret" ]
Search in the namespace declaration array of the context for the given namespace name associated to the given prefix
[ "Search", "in", "the", "namespace", "declaration", "array", "of", "the", "context", "for", "the", "given", "namespace", "name", "associated", "to", "the", "given", "prefix" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/libxml2-2.9.1/python/libxml2.py#L7360-L7364
29,406
apple/turicreate
deps/src/libxml2-2.9.1/python/libxml2.py
xpathContext.xpathRegisterNs
def xpathRegisterNs(self, prefix, ns_uri): """Register a new namespace. If @ns_uri is None it unregisters the namespace """ ret = libxml2mod.xmlXPathRegisterNs(self._o, prefix, ns_uri) return ret
python
def xpathRegisterNs(self, prefix, ns_uri): """Register a new namespace. If @ns_uri is None it unregisters the namespace """ ret = libxml2mod.xmlXPathRegisterNs(self._o, prefix, ns_uri) return ret
[ "def", "xpathRegisterNs", "(", "self", ",", "prefix", ",", "ns_uri", ")", ":", "ret", "=", "libxml2mod", ".", "xmlXPathRegisterNs", "(", "self", ".", "_o", ",", "prefix", ",", "ns_uri", ")", "return", "ret" ]
Register a new namespace. If @ns_uri is None it unregisters the namespace
[ "Register", "a", "new", "namespace", ".", "If" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/libxml2-2.9.1/python/libxml2.py#L7370-L7374
29,407
apple/turicreate
deps/src/libxml2-2.9.1/python/libxml2.py
xpathParserContext.context
def context(self): """Get the xpathContext from an xpathParserContext """ ret = libxml2mod.xmlXPathParserGetContext(self._o) if ret is None:raise xpathError('xmlXPathParserGetContext() failed') __tmp = xpathContext(_obj=ret) return __tmp
python
def context(self): """Get the xpathContext from an xpathParserContext """ ret = libxml2mod.xmlXPathParserGetContext(self._o) if ret is None:raise xpathError('xmlXPathParserGetContext() failed') __tmp = xpathContext(_obj=ret) return __tmp
[ "def", "context", "(", "self", ")", ":", "ret", "=", "libxml2mod", ".", "xmlXPathParserGetContext", "(", "self", ".", "_o", ")", "if", "ret", "is", "None", ":", "raise", "xpathError", "(", "'xmlXPathParserGetContext() failed'", ")", "__tmp", "=", "xpathContext...
Get the xpathContext from an xpathParserContext
[ "Get", "the", "xpathContext", "from", "an", "xpathParserContext" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/libxml2-2.9.1/python/libxml2.py#L7421-L7426
29,408
apple/turicreate
deps/src/libxml2-2.9.1/python/libxml2.py
xpathParserContext.xpatherror
def xpatherror(self, file, line, no): """Formats an error message. """ libxml2mod.xmlXPatherror(self._o, file, line, no)
python
def xpatherror(self, file, line, no): """Formats an error message. """ libxml2mod.xmlXPatherror(self._o, file, line, no)
[ "def", "xpatherror", "(", "self", ",", "file", ",", "line", ",", "no", ")", ":", "libxml2mod", ".", "xmlXPatherror", "(", "self", ".", "_o", ",", "file", ",", "line", ",", "no", ")" ]
Formats an error message.
[ "Formats", "an", "error", "message", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/libxml2-2.9.1/python/libxml2.py#L7969-L7971
29,409
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/virtual_target.py
traverse
def traverse (target, include_roots = False, include_sources = False): """ Traverses the dependency graph of 'target' and return all targets that will be created before this one is created. If root of some dependency graph is found during traversal, it's either included or not, dependencing of the ...
python
def traverse (target, include_roots = False, include_sources = False): """ Traverses the dependency graph of 'target' and return all targets that will be created before this one is created. If root of some dependency graph is found during traversal, it's either included or not, dependencing of the ...
[ "def", "traverse", "(", "target", ",", "include_roots", "=", "False", ",", "include_sources", "=", "False", ")", ":", "assert", "isinstance", "(", "target", ",", "VirtualTarget", ")", "assert", "isinstance", "(", "include_roots", ",", "(", "int", ",", "bool"...
Traverses the dependency graph of 'target' and return all targets that will be created before this one is created. If root of some dependency graph is found during traversal, it's either included or not, dependencing of the value of 'include_roots'. In either case, sources of root are not traver...
[ "Traverses", "the", "dependency", "graph", "of", "target", "and", "return", "all", "targets", "that", "will", "be", "created", "before", "this", "one", "is", "created", ".", "If", "root", "of", "some", "dependency", "graph", "is", "found", "during", "travers...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/virtual_target.py#L963-L996
29,410
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/virtual_target.py
clone_action
def clone_action (action, new_project, new_action_name, new_properties): """Takes an 'action' instances and creates new instance of it and all produced target. The rule-name and properties are set to 'new-rule-name' and 'new-properties', if those are specified. Returns the cloned action.""" if __deb...
python
def clone_action (action, new_project, new_action_name, new_properties): """Takes an 'action' instances and creates new instance of it and all produced target. The rule-name and properties are set to 'new-rule-name' and 'new-properties', if those are specified. Returns the cloned action.""" if __deb...
[ "def", "clone_action", "(", "action", ",", "new_project", ",", "new_action_name", ",", "new_properties", ")", ":", "if", "__debug__", ":", "from", ".", "targets", "import", "ProjectTarget", "assert", "isinstance", "(", "action", ",", "Action", ")", "assert", "...
Takes an 'action' instances and creates new instance of it and all produced target. The rule-name and properties are set to 'new-rule-name' and 'new-properties', if those are specified. Returns the cloned action.
[ "Takes", "an", "action", "instances", "and", "creates", "new", "instance", "of", "it", "and", "all", "produced", "target", ".", "The", "rule", "-", "name", "and", "properties", "are", "set", "to", "new", "-", "rule", "-", "name", "and", "new", "-", "pr...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/virtual_target.py#L998-L1034
29,411
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/virtual_target.py
VirtualTargetRegistry.register
def register (self, target): """ Registers a new virtual target. Checks if there's already registered target, with the same name, type, project and subvariant properties, and also with the same sources and equal action. If such target is found it is retured and 'target' is not registered...
python
def register (self, target): """ Registers a new virtual target. Checks if there's already registered target, with the same name, type, project and subvariant properties, and also with the same sources and equal action. If such target is found it is retured and 'target' is not registered...
[ "def", "register", "(", "self", ",", "target", ")", ":", "assert", "isinstance", "(", "target", ",", "VirtualTarget", ")", "if", "target", ".", "path", "(", ")", ":", "signature", "=", "target", ".", "path", "(", ")", "+", "\"-\"", "+", "target", "."...
Registers a new virtual target. Checks if there's already registered target, with the same name, type, project and subvariant properties, and also with the same sources and equal action. If such target is found it is retured and 'target' is not registered. Otherwise, 'target' is regi...
[ "Registers", "a", "new", "virtual", "target", ".", "Checks", "if", "there", "s", "already", "registered", "target", "with", "the", "same", "name", "type", "project", "and", "subvariant", "properties", "and", "also", "with", "the", "same", "sources", "and", "...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/virtual_target.py#L107-L150
29,412
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/virtual_target.py
VirtualTarget.depends
def depends (self, d): """ Adds additional instances of 'VirtualTarget' that this one depends on. """ self.dependencies_ = unique (self.dependencies_ + d).sort ()
python
def depends (self, d): """ Adds additional instances of 'VirtualTarget' that this one depends on. """ self.dependencies_ = unique (self.dependencies_ + d).sort ()
[ "def", "depends", "(", "self", ",", "d", ")", ":", "self", ".", "dependencies_", "=", "unique", "(", "self", ".", "dependencies_", "+", "d", ")", ".", "sort", "(", ")" ]
Adds additional instances of 'VirtualTarget' that this one depends on.
[ "Adds", "additional", "instances", "of", "VirtualTarget", "that", "this", "one", "depends", "on", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/virtual_target.py#L299-L303
29,413
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/virtual_target.py
VirtualTarget.actualize
def actualize (self, scanner = None): """ Generates all the actual targets and sets up build actions for this target. If 'scanner' is specified, creates an additional target with the same location as actual target, which will depend on the actual target and be as...
python
def actualize (self, scanner = None): """ Generates all the actual targets and sets up build actions for this target. If 'scanner' is specified, creates an additional target with the same location as actual target, which will depend on the actual target and be as...
[ "def", "actualize", "(", "self", ",", "scanner", "=", "None", ")", ":", "if", "__debug__", ":", "from", ".", "scanner", "import", "Scanner", "assert", "scanner", "is", "None", "or", "isinstance", "(", "scanner", ",", "Scanner", ")", "actual_name", "=", "...
Generates all the actual targets and sets up build actions for this target. If 'scanner' is specified, creates an additional target with the same location as actual target, which will depend on the actual target and be associated with 'scanner'. That additional ...
[ "Generates", "all", "the", "actual", "targets", "and", "sets", "up", "build", "actions", "for", "this", "target", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/virtual_target.py#L311-L349
29,414
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/virtual_target.py
AbstractFileTarget.set_path
def set_path (self, path): """ Sets the path. When generating target name, it will override any path computation from properties. """ assert isinstance(path, basestring) self.path_ = os.path.normpath(path)
python
def set_path (self, path): """ Sets the path. When generating target name, it will override any path computation from properties. """ assert isinstance(path, basestring) self.path_ = os.path.normpath(path)
[ "def", "set_path", "(", "self", ",", "path", ")", ":", "assert", "isinstance", "(", "path", ",", "basestring", ")", "self", ".", "path_", "=", "os", ".", "path", ".", "normpath", "(", "path", ")" ]
Sets the path. When generating target name, it will override any path computation from properties.
[ "Sets", "the", "path", ".", "When", "generating", "target", "name", "it", "will", "override", "any", "path", "computation", "from", "properties", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/virtual_target.py#L425-L430
29,415
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/virtual_target.py
AbstractFileTarget.grist
def grist (self): """Helper to 'actual_name', above. Compute unique prefix used to distinguish this target from other targets with the same name which create different file. """ # Depending on target, there may be different approaches to generating # unique prefix...
python
def grist (self): """Helper to 'actual_name', above. Compute unique prefix used to distinguish this target from other targets with the same name which create different file. """ # Depending on target, there may be different approaches to generating # unique prefix...
[ "def", "grist", "(", "self", ")", ":", "# Depending on target, there may be different approaches to generating", "# unique prefixes. We'll generate prefixes in the form", "# <one letter approach code> <the actual prefix>", "path", "=", "self", ".", "path", "(", ")", "if", "path", ...
Helper to 'actual_name', above. Compute unique prefix used to distinguish this target from other targets with the same name which create different file.
[ "Helper", "to", "actual_name", "above", ".", "Compute", "unique", "prefix", "used", "to", "distinguish", "this", "target", "from", "other", "targets", "with", "the", "same", "name", "which", "create", "different", "file", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/virtual_target.py#L500-L530
29,416
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/virtual_target.py
FileTarget.path
def path (self): """ Returns the directory for this target. """ if not self.path_: if self.action_: p = self.action_.properties () (target_path, relative_to_build_dir) = p.target_path () if relative_to_build_dir: # ...
python
def path (self): """ Returns the directory for this target. """ if not self.path_: if self.action_: p = self.action_.properties () (target_path, relative_to_build_dir) = p.target_path () if relative_to_build_dir: # ...
[ "def", "path", "(", "self", ")", ":", "if", "not", "self", ".", "path_", ":", "if", "self", ".", "action_", ":", "p", "=", "self", ".", "action_", ".", "properties", "(", ")", "(", "target_path", ",", "relative_to_build_dir", ")", "=", "p", ".", "t...
Returns the directory for this target.
[ "Returns", "the", "directory", "for", "this", "target", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/virtual_target.py#L727-L744
29,417
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/virtual_target.py
Action.actualize
def actualize (self): """ Generates actual build instructions. """ if self.actualized_: return self.actualized_ = True ps = self.properties () properties = self.adjust_properties (ps) actual_targets = [] for i in self.targets (): ...
python
def actualize (self): """ Generates actual build instructions. """ if self.actualized_: return self.actualized_ = True ps = self.properties () properties = self.adjust_properties (ps) actual_targets = [] for i in self.targets (): ...
[ "def", "actualize", "(", "self", ")", ":", "if", "self", ".", "actualized_", ":", "return", "self", ".", "actualized_", "=", "True", "ps", "=", "self", ".", "properties", "(", ")", "properties", "=", "self", ".", "adjust_properties", "(", "ps", ")", "a...
Generates actual build instructions.
[ "Generates", "actual", "build", "instructions", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/virtual_target.py#L818-L861
29,418
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/virtual_target.py
Action.actualize_source_type
def actualize_source_type (self, sources, prop_set): """ Helper for 'actualize_sources'. For each passed source, actualizes it with the appropriate scanner. Returns the actualized virtual targets. """ assert is_iterable_typed(sources, VirtualTarget) assert isinsta...
python
def actualize_source_type (self, sources, prop_set): """ Helper for 'actualize_sources'. For each passed source, actualizes it with the appropriate scanner. Returns the actualized virtual targets. """ assert is_iterable_typed(sources, VirtualTarget) assert isinsta...
[ "def", "actualize_source_type", "(", "self", ",", "sources", ",", "prop_set", ")", ":", "assert", "is_iterable_typed", "(", "sources", ",", "VirtualTarget", ")", "assert", "isinstance", "(", "prop_set", ",", "property_set", ".", "PropertySet", ")", "result", "="...
Helper for 'actualize_sources'. For each passed source, actualizes it with the appropriate scanner. Returns the actualized virtual targets.
[ "Helper", "for", "actualize_sources", ".", "For", "each", "passed", "source", "actualizes", "it", "with", "the", "appropriate", "scanner", ".", "Returns", "the", "actualized", "virtual", "targets", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/virtual_target.py#L863-L884
29,419
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/virtual_target.py
Subvariant.all_referenced_targets
def all_referenced_targets(self, result): """Returns all targets referenced by this subvariant, either directly or indirectly, and either as sources, or as dependency properties. Targets referred with dependency property are returned a properties, not targets.""" if __debug__: ...
python
def all_referenced_targets(self, result): """Returns all targets referenced by this subvariant, either directly or indirectly, and either as sources, or as dependency properties. Targets referred with dependency property are returned a properties, not targets.""" if __debug__: ...
[ "def", "all_referenced_targets", "(", "self", ",", "result", ")", ":", "if", "__debug__", ":", "from", ".", "property", "import", "Property", "assert", "is_iterable_typed", "(", "result", ",", "(", "VirtualTarget", ",", "Property", ")", ")", "# Find directly ref...
Returns all targets referenced by this subvariant, either directly or indirectly, and either as sources, or as dependency properties. Targets referred with dependency property are returned a properties, not targets.
[ "Returns", "all", "targets", "referenced", "by", "this", "subvariant", "either", "directly", "or", "indirectly", "and", "either", "as", "sources", "or", "as", "dependency", "properties", ".", "Targets", "referred", "with", "dependency", "property", "are", "returne...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/virtual_target.py#L1099-L1128
29,420
apple/turicreate
src/unity/python/turicreate/meta/asttools/__init__.py
cmp_ast
def cmp_ast(node1, node2): ''' Compare if two nodes are equal. ''' if type(node1) != type(node2): return False if isinstance(node1, (list, tuple)): if len(node1) != len(node2): return False for left, right in zip(node1, node2): if not cmp_ast(left, ...
python
def cmp_ast(node1, node2): ''' Compare if two nodes are equal. ''' if type(node1) != type(node2): return False if isinstance(node1, (list, tuple)): if len(node1) != len(node2): return False for left, right in zip(node1, node2): if not cmp_ast(left, ...
[ "def", "cmp_ast", "(", "node1", ",", "node2", ")", ":", "if", "type", "(", "node1", ")", "!=", "type", "(", "node2", ")", ":", "return", "False", "if", "isinstance", "(", "node1", ",", "(", "list", ",", "tuple", ")", ")", ":", "if", "len", "(", ...
Compare if two nodes are equal.
[ "Compare", "if", "two", "nodes", "are", "equal", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/meta/asttools/__init__.py#L23-L49
29,421
apple/turicreate
deps/src/boost_1_68_0/libs/mpl/preprocessed/boost_mpl_preprocess.py
create_more_container_files
def create_more_container_files(sourceDir, suffix, maxElements, containers, containers2): """Creates additional files for the individual MPL-containers.""" # Create files for each MPL-container with 20 to 'maxElements' elements # which will be used during generation. for container in containers: ...
python
def create_more_container_files(sourceDir, suffix, maxElements, containers, containers2): """Creates additional files for the individual MPL-containers.""" # Create files for each MPL-container with 20 to 'maxElements' elements # which will be used during generation. for container in containers: ...
[ "def", "create_more_container_files", "(", "sourceDir", ",", "suffix", ",", "maxElements", ",", "containers", ",", "containers2", ")", ":", "# Create files for each MPL-container with 20 to 'maxElements' elements", "# which will be used during generation.", "for", "container", "i...
Creates additional files for the individual MPL-containers.
[ "Creates", "additional", "files", "for", "the", "individual", "MPL", "-", "containers", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/mpl/preprocessed/boost_mpl_preprocess.py#L21-L53
29,422
apple/turicreate
deps/src/boost_1_68_0/libs/mpl/preprocessed/boost_mpl_preprocess.py
create_input_for_numbered_sequences
def create_input_for_numbered_sequences(headerDir, sourceDir, containers, maxElements): """Creates additional source- and header-files for the numbered sequence MPL-containers.""" # Create additional container-list without "map". containersWithoutMap = containers[:] try: containersWithoutMap.rem...
python
def create_input_for_numbered_sequences(headerDir, sourceDir, containers, maxElements): """Creates additional source- and header-files for the numbered sequence MPL-containers.""" # Create additional container-list without "map". containersWithoutMap = containers[:] try: containersWithoutMap.rem...
[ "def", "create_input_for_numbered_sequences", "(", "headerDir", ",", "sourceDir", ",", "containers", ",", "maxElements", ")", ":", "# Create additional container-list without \"map\".", "containersWithoutMap", "=", "containers", "[", ":", "]", "try", ":", "containersWithout...
Creates additional source- and header-files for the numbered sequence MPL-containers.
[ "Creates", "additional", "source", "-", "and", "header", "-", "files", "for", "the", "numbered", "sequence", "MPL", "-", "containers", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/mpl/preprocessed/boost_mpl_preprocess.py#L56-L67
29,423
apple/turicreate
deps/src/boost_1_68_0/libs/mpl/preprocessed/boost_mpl_preprocess.py
adjust_container_limits_for_variadic_sequences
def adjust_container_limits_for_variadic_sequences(headerDir, containers, maxElements): """Adjusts the limits of variadic sequence MPL-containers.""" for container in containers: headerFile = os.path.join( headerDir, "limits", container + ".hpp" ) regexMatch = r'(define\s+BOOST_MPL_LIMIT_' + c...
python
def adjust_container_limits_for_variadic_sequences(headerDir, containers, maxElements): """Adjusts the limits of variadic sequence MPL-containers.""" for container in containers: headerFile = os.path.join( headerDir, "limits", container + ".hpp" ) regexMatch = r'(define\s+BOOST_MPL_LIMIT_' + c...
[ "def", "adjust_container_limits_for_variadic_sequences", "(", "headerDir", ",", "containers", ",", "maxElements", ")", ":", "for", "container", "in", "containers", ":", "headerFile", "=", "os", ".", "path", ".", "join", "(", "headerDir", ",", "\"limits\"", ",", ...
Adjusts the limits of variadic sequence MPL-containers.
[ "Adjusts", "the", "limits", "of", "variadic", "sequence", "MPL", "-", "containers", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/libs/mpl/preprocessed/boost_mpl_preprocess.py#L70-L78
29,424
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/builder.py
NeuralNetworkBuilder.add_inner_product
def add_inner_product(self, name, W, b, input_channels, output_channels, has_bias, input_name, output_name, **kwargs): """ Add an inner product layer to the model. Parameters ---------- name: str The name of this layer W: numpy.array...
python
def add_inner_product(self, name, W, b, input_channels, output_channels, has_bias, input_name, output_name, **kwargs): """ Add an inner product layer to the model. Parameters ---------- name: str The name of this layer W: numpy.array...
[ "def", "add_inner_product", "(", "self", ",", "name", ",", "W", ",", "b", ",", "input_channels", ",", "output_channels", ",", "has_bias", ",", "input_name", ",", "output_name", ",", "*", "*", "kwargs", ")", ":", "spec", "=", "self", ".", "spec", "nn_spec...
Add an inner product layer to the model. Parameters ---------- name: str The name of this layer W: numpy.array or bytes() Weight matrix of shape (output_channels, input_channels) If W is of type bytes(), i.e. quantized, other quantization related argu...
[ "Add", "an", "inner", "product", "layer", "to", "the", "model", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/builder.py#L394-L471
29,425
apple/turicreate
src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/builder.py
NeuralNetworkBuilder.add_resize_bilinear
def add_resize_bilinear(self, name, input_name, output_name, target_height=1, target_width=1, mode='ALIGN_ENDPOINTS_MODE'): """ Add resize bilinear layer to the model. A layer that resizes the input to a given spatial size using bilinear interpolation. Parameters ...
python
def add_resize_bilinear(self, name, input_name, output_name, target_height=1, target_width=1, mode='ALIGN_ENDPOINTS_MODE'): """ Add resize bilinear layer to the model. A layer that resizes the input to a given spatial size using bilinear interpolation. Parameters ...
[ "def", "add_resize_bilinear", "(", "self", ",", "name", ",", "input_name", ",", "output_name", ",", "target_height", "=", "1", ",", "target_width", "=", "1", ",", "mode", "=", "'ALIGN_ENDPOINTS_MODE'", ")", ":", "spec", "=", "self", ".", "spec", "nn_spec", ...
Add resize bilinear layer to the model. A layer that resizes the input to a given spatial size using bilinear interpolation. Parameters ---------- name: str The name of this layer. input_name: str The input blob name of this layer. output_name: str ...
[ "Add", "resize", "bilinear", "layer", "to", "the", "model", ".", "A", "layer", "that", "resizes", "the", "input", "to", "a", "given", "spatial", "size", "using", "bilinear", "interpolation", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/coremltools/models/neural_network/builder.py#L2612-L2657
29,426
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_toolkit_serialize_summary_struct
def _toolkit_serialize_summary_struct(model, sections, section_titles): """ Serialize model summary into a dict with ordered lists of sections and section titles Parameters ---------- model : Model object sections : Ordered list of lists (sections) of tuples (field,value) [ [(fi...
python
def _toolkit_serialize_summary_struct(model, sections, section_titles): """ Serialize model summary into a dict with ordered lists of sections and section titles Parameters ---------- model : Model object sections : Ordered list of lists (sections) of tuples (field,value) [ [(fi...
[ "def", "_toolkit_serialize_summary_struct", "(", "model", ",", "sections", ",", "section_titles", ")", ":", "output_dict", "=", "dict", "(", ")", "output_dict", "[", "'sections'", "]", "=", "[", "[", "(", "field", "[", "0", "]", ",", "__extract_model_summary_v...
Serialize model summary into a dict with ordered lists of sections and section titles Parameters ---------- model : Model object sections : Ordered list of lists (sections) of tuples (field,value) [ [(field1, value1), (field2, value2)], [(field3, value3), (field4, value4)], ...
[ "Serialize", "model", "summary", "into", "a", "dict", "with", "ordered", "lists", "of", "sections", "and", "section", "titles" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L34-L61
29,427
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_find_only_column_of_type
def _find_only_column_of_type(sframe, target_type, type_name, col_name): """ Finds the only column in `SFrame` with a type specified by `target_type`. If there are zero or more than one such columns, an exception will be raised. The name and type of the target column should be provided as strings fo...
python
def _find_only_column_of_type(sframe, target_type, type_name, col_name): """ Finds the only column in `SFrame` with a type specified by `target_type`. If there are zero or more than one such columns, an exception will be raised. The name and type of the target column should be provided as strings fo...
[ "def", "_find_only_column_of_type", "(", "sframe", ",", "target_type", ",", "type_name", ",", "col_name", ")", ":", "image_column_name", "=", "None", "if", "type", "(", "target_type", ")", "!=", "list", ":", "target_type", "=", "[", "target_type", "]", "for", ...
Finds the only column in `SFrame` with a type specified by `target_type`. If there are zero or more than one such columns, an exception will be raised. The name and type of the target column should be provided as strings for the purpose of error feedback.
[ "Finds", "the", "only", "column", "in", "SFrame", "with", "a", "type", "specified", "by", "target_type", ".", "If", "there", "are", "zero", "or", "more", "than", "one", "such", "columns", "an", "exception", "will", "be", "raised", ".", "The", "name", "an...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L86-L103
29,428
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_find_only_image_column
def _find_only_image_column(sframe): """ Finds the only column in `sframe` with a type of turicreate.Image. If there are zero or more than one image columns, an exception will be raised. """ from turicreate import Image return _find_only_column_of_type(sframe, target_type=Image, ...
python
def _find_only_image_column(sframe): """ Finds the only column in `sframe` with a type of turicreate.Image. If there are zero or more than one image columns, an exception will be raised. """ from turicreate import Image return _find_only_column_of_type(sframe, target_type=Image, ...
[ "def", "_find_only_image_column", "(", "sframe", ")", ":", "from", "turicreate", "import", "Image", "return", "_find_only_column_of_type", "(", "sframe", ",", "target_type", "=", "Image", ",", "type_name", "=", "'image'", ",", "col_name", "=", "'feature'", ")" ]
Finds the only column in `sframe` with a type of turicreate.Image. If there are zero or more than one image columns, an exception will be raised.
[ "Finds", "the", "only", "column", "in", "sframe", "with", "a", "type", "of", "turicreate", ".", "Image", ".", "If", "there", "are", "zero", "or", "more", "than", "one", "image", "columns", "an", "exception", "will", "be", "raised", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L105-L113
29,429
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_SGraphFromJsonTree
def _SGraphFromJsonTree(json_str): """ Convert the Json Tree to SGraph """ g = json.loads(json_str) vertices = [_Vertex(x['id'], dict([(str(k), v) for k, v in _six.iteritems(x) if k != 'id'])) for x in g['vertices']] edges = [...
python
def _SGraphFromJsonTree(json_str): """ Convert the Json Tree to SGraph """ g = json.loads(json_str) vertices = [_Vertex(x['id'], dict([(str(k), v) for k, v in _six.iteritems(x) if k != 'id'])) for x in g['vertices']] edges = [...
[ "def", "_SGraphFromJsonTree", "(", "json_str", ")", ":", "g", "=", "json", ".", "loads", "(", "json_str", ")", "vertices", "=", "[", "_Vertex", "(", "x", "[", "'id'", "]", ",", "dict", "(", "[", "(", "str", "(", "k", ")", ",", "v", ")", "for", ...
Convert the Json Tree to SGraph
[ "Convert", "the", "Json", "Tree", "to", "SGraph" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L203-L217
29,430
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_summarize_coefficients
def _summarize_coefficients(top_coefs, bottom_coefs): """ Return a tuple of sections and section titles. Sections are pretty print of model coefficients Parameters ---------- top_coefs : SFrame of top k coefficients bottom_coefs : SFrame of bottom k coefficients Returns ------- ...
python
def _summarize_coefficients(top_coefs, bottom_coefs): """ Return a tuple of sections and section titles. Sections are pretty print of model coefficients Parameters ---------- top_coefs : SFrame of top k coefficients bottom_coefs : SFrame of bottom k coefficients Returns ------- ...
[ "def", "_summarize_coefficients", "(", "top_coefs", ",", "bottom_coefs", ")", ":", "def", "get_row_name", "(", "row", ")", ":", "if", "row", "[", "'index'", "]", "is", "None", ":", "return", "row", "[", "'name'", "]", "else", ":", "return", "\"%s[%s]\"", ...
Return a tuple of sections and section titles. Sections are pretty print of model coefficients Parameters ---------- top_coefs : SFrame of top k coefficients bottom_coefs : SFrame of bottom k coefficients Returns ------- (sections, section_titles) : tuple sections : list ...
[ "Return", "a", "tuple", "of", "sections", "and", "section", "titles", ".", "Sections", "are", "pretty", "print", "of", "model", "coefficients" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L223-L264
29,431
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_toolkit_get_topk_bottomk
def _toolkit_get_topk_bottomk(values, k=5): """ Returns a tuple of the top k values from the positive and negative values in a SArray Parameters ---------- values : SFrame of model coefficients k: Maximum number of largest positive and k lowest negative numbers to return Returns -...
python
def _toolkit_get_topk_bottomk(values, k=5): """ Returns a tuple of the top k values from the positive and negative values in a SArray Parameters ---------- values : SFrame of model coefficients k: Maximum number of largest positive and k lowest negative numbers to return Returns -...
[ "def", "_toolkit_get_topk_bottomk", "(", "values", ",", "k", "=", "5", ")", ":", "top_values", "=", "values", ".", "topk", "(", "'value'", ",", "k", "=", "k", ")", "top_values", "=", "top_values", "[", "top_values", "[", "'value'", "]", ">", "0", "]", ...
Returns a tuple of the top k values from the positive and negative values in a SArray Parameters ---------- values : SFrame of model coefficients k: Maximum number of largest positive and k lowest negative numbers to return Returns ------- (topk_positive, bottomk_positive) : tuple ...
[ "Returns", "a", "tuple", "of", "the", "top", "k", "values", "from", "the", "positive", "and", "negative", "values", "in", "a", "SArray" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L266-L294
29,432
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
__extract_model_summary_value
def __extract_model_summary_value(model, value): """ Extract a model summary field value """ field_value = None if isinstance(value, _precomputed_field): field_value = value.field else: field_value = model._get(value) if isinstance(field_value, float): try: ...
python
def __extract_model_summary_value(model, value): """ Extract a model summary field value """ field_value = None if isinstance(value, _precomputed_field): field_value = value.field else: field_value = model._get(value) if isinstance(field_value, float): try: ...
[ "def", "__extract_model_summary_value", "(", "model", ",", "value", ")", ":", "field_value", "=", "None", "if", "isinstance", "(", "value", ",", "_precomputed_field", ")", ":", "field_value", "=", "value", ".", "field", "else", ":", "field_value", "=", "model"...
Extract a model summary field value
[ "Extract", "a", "model", "summary", "field", "value" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L320-L334
29,433
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_make_repr_table_from_sframe
def _make_repr_table_from_sframe(X): """ Serializes an SFrame to a list of strings, that, when printed, creates a well-formatted table. """ assert isinstance(X, _SFrame) column_names = X.column_names() out_data = [ [None]*len(column_names) for i in range(X.num_rows())] column_sizes = [le...
python
def _make_repr_table_from_sframe(X): """ Serializes an SFrame to a list of strings, that, when printed, creates a well-formatted table. """ assert isinstance(X, _SFrame) column_names = X.column_names() out_data = [ [None]*len(column_names) for i in range(X.num_rows())] column_sizes = [le...
[ "def", "_make_repr_table_from_sframe", "(", "X", ")", ":", "assert", "isinstance", "(", "X", ",", "_SFrame", ")", "column_names", "=", "X", ".", "column_names", "(", ")", "out_data", "=", "[", "[", "None", "]", "*", "len", "(", "column_names", ")", "for"...
Serializes an SFrame to a list of strings, that, when printed, creates a well-formatted table.
[ "Serializes", "an", "SFrame", "to", "a", "list", "of", "strings", "that", "when", "printed", "creates", "a", "well", "-", "formatted", "table", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L336-L359
29,434
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_toolkit_repr_print
def _toolkit_repr_print(model, fields, section_titles, width = None): """ Display a toolkit repr according to some simple rules. Parameters ---------- model : Turi Create model fields: List of lists of tuples Each tuple should be (display_name, field_name), where field_name can ...
python
def _toolkit_repr_print(model, fields, section_titles, width = None): """ Display a toolkit repr according to some simple rules. Parameters ---------- model : Turi Create model fields: List of lists of tuples Each tuple should be (display_name, field_name), where field_name can ...
[ "def", "_toolkit_repr_print", "(", "model", ",", "fields", ",", "section_titles", ",", "width", "=", "None", ")", ":", "assert", "len", "(", "section_titles", ")", "==", "len", "(", "fields", ")", ",", "\"The number of section titles ({0}) \"", ".", "format", ...
Display a toolkit repr according to some simple rules. Parameters ---------- model : Turi Create model fields: List of lists of tuples Each tuple should be (display_name, field_name), where field_name can be a string or a _precomputed_field object. section_titles: List of section...
[ "Display", "a", "toolkit", "repr", "according", "to", "some", "simple", "rules", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L362-L446
29,435
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_map_unity_proxy_to_object
def _map_unity_proxy_to_object(value): """ Map returning value, if it is unity SFrame, SArray, map it """ vtype = type(value) if vtype in _proxy_map: return _proxy_map[vtype](value) elif vtype == list: return [_map_unity_proxy_to_object(v) for v in value] elif vtype == dict: ...
python
def _map_unity_proxy_to_object(value): """ Map returning value, if it is unity SFrame, SArray, map it """ vtype = type(value) if vtype in _proxy_map: return _proxy_map[vtype](value) elif vtype == list: return [_map_unity_proxy_to_object(v) for v in value] elif vtype == dict: ...
[ "def", "_map_unity_proxy_to_object", "(", "value", ")", ":", "vtype", "=", "type", "(", "value", ")", "if", "vtype", "in", "_proxy_map", ":", "return", "_proxy_map", "[", "vtype", "]", "(", "value", ")", "elif", "vtype", "==", "list", ":", "return", "[",...
Map returning value, if it is unity SFrame, SArray, map it
[ "Map", "returning", "value", "if", "it", "is", "unity", "SFrame", "SArray", "map", "it" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L448-L460
29,436
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_toolkits_select_columns
def _toolkits_select_columns(dataset, columns): """ Same as select columns but redirect runtime error to ToolkitError. """ try: return dataset.select_columns(columns) except RuntimeError: missing_features = list(set(columns).difference(set(dataset.column_names()))) raise Tool...
python
def _toolkits_select_columns(dataset, columns): """ Same as select columns but redirect runtime error to ToolkitError. """ try: return dataset.select_columns(columns) except RuntimeError: missing_features = list(set(columns).difference(set(dataset.column_names()))) raise Tool...
[ "def", "_toolkits_select_columns", "(", "dataset", ",", "columns", ")", ":", "try", ":", "return", "dataset", ".", "select_columns", "(", "columns", ")", "except", "RuntimeError", ":", "missing_features", "=", "list", "(", "set", "(", "columns", ")", ".", "d...
Same as select columns but redirect runtime error to ToolkitError.
[ "Same", "as", "select", "columns", "but", "redirect", "runtime", "error", "to", "ToolkitError", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L462-L471
29,437
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_raise_error_if_column_exists
def _raise_error_if_column_exists(dataset, column_name = 'dataset', dataset_variable_name = 'dataset', column_name_error_message_name = 'column_name'): """ Check if a column exists in an SFrame with error message. """ err_msg = 'The SFrame {0} must...
python
def _raise_error_if_column_exists(dataset, column_name = 'dataset', dataset_variable_name = 'dataset', column_name_error_message_name = 'column_name'): """ Check if a column exists in an SFrame with error message. """ err_msg = 'The SFrame {0} must...
[ "def", "_raise_error_if_column_exists", "(", "dataset", ",", "column_name", "=", "'dataset'", ",", "dataset_variable_name", "=", "'dataset'", ",", "column_name_error_message_name", "=", "'column_name'", ")", ":", "err_msg", "=", "'The SFrame {0} must contain the column {1}.'"...
Check if a column exists in an SFrame with error message.
[ "Check", "if", "a", "column", "exists", "in", "an", "SFrame", "with", "error", "message", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L473-L483
29,438
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_check_categorical_option_type
def _check_categorical_option_type(option_name, option_value, possible_values): """ Check whether or not the requested option is one of the allowed values. """ err_msg = '{0} is not a valid option for {1}. '.format(option_value, option_name) err_msg += ' Expected one of: '.format(possible_values) ...
python
def _check_categorical_option_type(option_name, option_value, possible_values): """ Check whether or not the requested option is one of the allowed values. """ err_msg = '{0} is not a valid option for {1}. '.format(option_value, option_name) err_msg += ' Expected one of: '.format(possible_values) ...
[ "def", "_check_categorical_option_type", "(", "option_name", ",", "option_value", ",", "possible_values", ")", ":", "err_msg", "=", "'{0} is not a valid option for {1}. '", ".", "format", "(", "option_value", ",", "option_name", ")", "err_msg", "+=", "' Expected one of: '...
Check whether or not the requested option is one of the allowed values.
[ "Check", "whether", "or", "not", "the", "requested", "option", "is", "one", "of", "the", "allowed", "values", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L485-L494
29,439
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_raise_error_if_not_sarray
def _raise_error_if_not_sarray(dataset, variable_name="SArray"): """ Check if the input is an SArray. Provide a proper error message otherwise. """ err_msg = "Input %s is not an SArray." if not isinstance(dataset, _SArray): raise ToolkitError(err_msg % variable_name)
python
def _raise_error_if_not_sarray(dataset, variable_name="SArray"): """ Check if the input is an SArray. Provide a proper error message otherwise. """ err_msg = "Input %s is not an SArray." if not isinstance(dataset, _SArray): raise ToolkitError(err_msg % variable_name)
[ "def", "_raise_error_if_not_sarray", "(", "dataset", ",", "variable_name", "=", "\"SArray\"", ")", ":", "err_msg", "=", "\"Input %s is not an SArray.\"", "if", "not", "isinstance", "(", "dataset", ",", "_SArray", ")", ":", "raise", "ToolkitError", "(", "err_msg", ...
Check if the input is an SArray. Provide a proper error message otherwise.
[ "Check", "if", "the", "input", "is", "an", "SArray", ".", "Provide", "a", "proper", "error", "message", "otherwise", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L496-L503
29,440
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_raise_error_if_sframe_empty
def _raise_error_if_sframe_empty(dataset, variable_name="SFrame"): """ Check if the input is empty. """ err_msg = "Input %s either has no rows or no columns. A non-empty SFrame " err_msg += "is required." if dataset.num_rows() == 0 or dataset.num_columns() == 0: raise ToolkitError(err_m...
python
def _raise_error_if_sframe_empty(dataset, variable_name="SFrame"): """ Check if the input is empty. """ err_msg = "Input %s either has no rows or no columns. A non-empty SFrame " err_msg += "is required." if dataset.num_rows() == 0 or dataset.num_columns() == 0: raise ToolkitError(err_m...
[ "def", "_raise_error_if_sframe_empty", "(", "dataset", ",", "variable_name", "=", "\"SFrame\"", ")", ":", "err_msg", "=", "\"Input %s either has no rows or no columns. A non-empty SFrame \"", "err_msg", "+=", "\"is required.\"", "if", "dataset", ".", "num_rows", "(", ")", ...
Check if the input is empty.
[ "Check", "if", "the", "input", "is", "empty", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L522-L530
29,441
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_numeric_param_check_range
def _numeric_param_check_range(variable_name, variable_value, range_bottom, range_top): """ Checks if numeric parameter is within given range """ err_msg = "%s must be between %i and %i" if variable_value < range_bottom or variable_value > range_top: raise ToolkitError(err_msg % (variable_n...
python
def _numeric_param_check_range(variable_name, variable_value, range_bottom, range_top): """ Checks if numeric parameter is within given range """ err_msg = "%s must be between %i and %i" if variable_value < range_bottom or variable_value > range_top: raise ToolkitError(err_msg % (variable_n...
[ "def", "_numeric_param_check_range", "(", "variable_name", ",", "variable_value", ",", "range_bottom", ",", "range_top", ")", ":", "err_msg", "=", "\"%s must be between %i and %i\"", "if", "variable_value", "<", "range_bottom", "or", "variable_value", ">", "range_top", ...
Checks if numeric parameter is within given range
[ "Checks", "if", "numeric", "parameter", "is", "within", "given", "range" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L554-L561
29,442
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_validate_data
def _validate_data(dataset, target, features=None, validation_set='auto'): """ Validate and canonicalize training and validation data. Parameters ---------- dataset : SFrame Dataset for training the model. target : string Name of the column containing the target variable. ...
python
def _validate_data(dataset, target, features=None, validation_set='auto'): """ Validate and canonicalize training and validation data. Parameters ---------- dataset : SFrame Dataset for training the model. target : string Name of the column containing the target variable. ...
[ "def", "_validate_data", "(", "dataset", ",", "target", ",", "features", "=", "None", ",", "validation_set", "=", "'auto'", ")", ":", "_raise_error_if_not_sframe", "(", "dataset", ",", "\"training dataset\"", ")", "# Determine columns to keep", "if", "features", "is...
Validate and canonicalize training and validation data. Parameters ---------- dataset : SFrame Dataset for training the model. target : string Name of the column containing the target variable. features : list[string], optional List of feature names used. validation_s...
[ "Validate", "and", "canonicalize", "training", "and", "validation", "data", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L563-L625
29,443
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_validate_row_label
def _validate_row_label(dataset, label=None, default_label='__id'): """ Validate a row label column. If the row label is not specified, a column is created with row numbers, named with the string in the `default_label` parameter. Parameters ---------- dataset : SFrame Input dataset....
python
def _validate_row_label(dataset, label=None, default_label='__id'): """ Validate a row label column. If the row label is not specified, a column is created with row numbers, named with the string in the `default_label` parameter. Parameters ---------- dataset : SFrame Input dataset....
[ "def", "_validate_row_label", "(", "dataset", ",", "label", "=", "None", ",", "default_label", "=", "'__id'", ")", ":", "## If no label is provided, set it to be a default and add a row number to", "# dataset. Check that this new name does not conflict with an existing", "# name.",...
Validate a row label column. If the row label is not specified, a column is created with row numbers, named with the string in the `default_label` parameter. Parameters ---------- dataset : SFrame Input dataset. label : str, optional Name of the column containing row labels. ...
[ "Validate", "a", "row", "label", "column", ".", "If", "the", "row", "label", "is", "not", "specified", "a", "column", "is", "created", "with", "row", "numbers", "named", "with", "the", "string", "in", "the", "default_label", "parameter", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L627-L682
29,444
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_mac_ver
def _mac_ver(): """ Returns Mac version as a tuple of integers, making it easy to do proper version comparisons. On non-Macs, it returns an empty tuple. """ import platform import sys if sys.platform == 'darwin': ver_str = platform.mac_ver()[0] return tuple([int(v) for v in v...
python
def _mac_ver(): """ Returns Mac version as a tuple of integers, making it easy to do proper version comparisons. On non-Macs, it returns an empty tuple. """ import platform import sys if sys.platform == 'darwin': ver_str = platform.mac_ver()[0] return tuple([int(v) for v in v...
[ "def", "_mac_ver", "(", ")", ":", "import", "platform", "import", "sys", "if", "sys", ".", "platform", "==", "'darwin'", ":", "ver_str", "=", "platform", ".", "mac_ver", "(", ")", "[", "0", "]", "return", "tuple", "(", "[", "int", "(", "v", ")", "f...
Returns Mac version as a tuple of integers, making it easy to do proper version comparisons. On non-Macs, it returns an empty tuple.
[ "Returns", "Mac", "version", "as", "a", "tuple", "of", "integers", "making", "it", "easy", "to", "do", "proper", "version", "comparisons", ".", "On", "non", "-", "Macs", "it", "returns", "an", "empty", "tuple", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L698-L709
29,445
apple/turicreate
src/unity/python/turicreate/toolkits/_internal_utils.py
_print_neural_compute_device
def _print_neural_compute_device(cuda_gpus, use_mps, cuda_mem_req=None, has_mps_impl=True): """ Print a message making it clear to the user what compute resource is used in neural network training. """ num_cuda_gpus = len(cuda_gpus) if num_cuda_gpus >= 1: gpu_names = ', '.join(gpu['name'...
python
def _print_neural_compute_device(cuda_gpus, use_mps, cuda_mem_req=None, has_mps_impl=True): """ Print a message making it clear to the user what compute resource is used in neural network training. """ num_cuda_gpus = len(cuda_gpus) if num_cuda_gpus >= 1: gpu_names = ', '.join(gpu['name'...
[ "def", "_print_neural_compute_device", "(", "cuda_gpus", ",", "use_mps", ",", "cuda_mem_req", "=", "None", ",", "has_mps_impl", "=", "True", ")", ":", "num_cuda_gpus", "=", "len", "(", "cuda_gpus", ")", "if", "num_cuda_gpus", ">=", "1", ":", "gpu_names", "=", ...
Print a message making it clear to the user what compute resource is used in neural network training.
[ "Print", "a", "message", "making", "it", "clear", "to", "the", "user", "what", "compute", "resource", "is", "used", "in", "neural", "network", "training", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_internal_utils.py#L711-L733
29,446
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/proto_builder.py
_GetMessageFromFactory
def _GetMessageFromFactory(factory, full_name): """Get a proto class from the MessageFactory by name. Args: factory: a MessageFactory instance. full_name: str, the fully qualified name of the proto type. Returns: A class, for the type identified by full_name. Raises: KeyError, if the proto is n...
python
def _GetMessageFromFactory(factory, full_name): """Get a proto class from the MessageFactory by name. Args: factory: a MessageFactory instance. full_name: str, the fully qualified name of the proto type. Returns: A class, for the type identified by full_name. Raises: KeyError, if the proto is n...
[ "def", "_GetMessageFromFactory", "(", "factory", ",", "full_name", ")", ":", "proto_descriptor", "=", "factory", ".", "pool", ".", "FindMessageTypeByName", "(", "full_name", ")", "proto_cls", "=", "factory", ".", "GetPrototype", "(", "proto_descriptor", ")", "retu...
Get a proto class from the MessageFactory by name. Args: factory: a MessageFactory instance. full_name: str, the fully qualified name of the proto type. Returns: A class, for the type identified by full_name. Raises: KeyError, if the proto is not found in the factory's descriptor pool.
[ "Get", "a", "proto", "class", "from", "the", "MessageFactory", "by", "name", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/proto_builder.py#L44-L57
29,447
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/proto_builder.py
MakeSimpleProtoClass
def MakeSimpleProtoClass(fields, full_name=None, pool=None): """Create a Protobuf class whose fields are basic types. Note: this doesn't validate field names! Args: fields: dict of {name: field_type} mappings for each field in the proto. If this is an OrderedDict the order will be maintained, otherw...
python
def MakeSimpleProtoClass(fields, full_name=None, pool=None): """Create a Protobuf class whose fields are basic types. Note: this doesn't validate field names! Args: fields: dict of {name: field_type} mappings for each field in the proto. If this is an OrderedDict the order will be maintained, otherw...
[ "def", "MakeSimpleProtoClass", "(", "fields", ",", "full_name", "=", "None", ",", "pool", "=", "None", ")", ":", "factory", "=", "message_factory", ".", "MessageFactory", "(", "pool", "=", "pool", ")", "if", "full_name", "is", "not", "None", ":", "try", ...
Create a Protobuf class whose fields are basic types. Note: this doesn't validate field names! Args: fields: dict of {name: field_type} mappings for each field in the proto. If this is an OrderedDict the order will be maintained, otherwise the fields will be sorted by name. full_name: opti...
[ "Create", "a", "Protobuf", "class", "whose", "fields", "are", "basic", "types", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/proto_builder.py#L60-L113
29,448
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/proto_builder.py
_MakeFileDescriptorProto
def _MakeFileDescriptorProto(proto_file_name, full_name, field_items): """Populate FileDescriptorProto for MessageFactory's DescriptorPool.""" package, name = full_name.rsplit('.', 1) file_proto = descriptor_pb2.FileDescriptorProto() file_proto.name = os.path.join(package.replace('.', '/'), proto_file_name) f...
python
def _MakeFileDescriptorProto(proto_file_name, full_name, field_items): """Populate FileDescriptorProto for MessageFactory's DescriptorPool.""" package, name = full_name.rsplit('.', 1) file_proto = descriptor_pb2.FileDescriptorProto() file_proto.name = os.path.join(package.replace('.', '/'), proto_file_name) f...
[ "def", "_MakeFileDescriptorProto", "(", "proto_file_name", ",", "full_name", ",", "field_items", ")", ":", "package", ",", "name", "=", "full_name", ".", "rsplit", "(", "'.'", ",", "1", ")", "file_proto", "=", "descriptor_pb2", ".", "FileDescriptorProto", "(", ...
Populate FileDescriptorProto for MessageFactory's DescriptorPool.
[ "Populate", "FileDescriptorProto", "for", "MessageFactory", "s", "DescriptorPool", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/proto_builder.py#L116-L130
29,449
apple/turicreate
src/unity/python/turicreate/toolkits/_coreml_utils.py
_get_model_metadata
def _get_model_metadata(model_class, metadata, version=None): """ Returns user-defined metadata, making sure information all models should have is also available, as a dictionary """ from turicreate import __version__ info = { 'turicreate_version': __version__, 'type': model_cla...
python
def _get_model_metadata(model_class, metadata, version=None): """ Returns user-defined metadata, making sure information all models should have is also available, as a dictionary """ from turicreate import __version__ info = { 'turicreate_version': __version__, 'type': model_cla...
[ "def", "_get_model_metadata", "(", "model_class", ",", "metadata", ",", "version", "=", "None", ")", ":", "from", "turicreate", "import", "__version__", "info", "=", "{", "'turicreate_version'", ":", "__version__", ",", "'type'", ":", "model_class", ",", "}", ...
Returns user-defined metadata, making sure information all models should have is also available, as a dictionary
[ "Returns", "user", "-", "defined", "metadata", "making", "sure", "information", "all", "models", "should", "have", "is", "also", "available", "as", "a", "dictionary" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_coreml_utils.py#L16-L29
29,450
apple/turicreate
src/unity/python/turicreate/toolkits/_coreml_utils.py
_set_model_metadata
def _set_model_metadata(mlmodel, model_class, metadata, version=None): """ Sets user-defined metadata, making sure information all models should have is also available """ info = _get_model_metadata(model_class, metadata, version) mlmodel.user_defined_metadata.update(info)
python
def _set_model_metadata(mlmodel, model_class, metadata, version=None): """ Sets user-defined metadata, making sure information all models should have is also available """ info = _get_model_metadata(model_class, metadata, version) mlmodel.user_defined_metadata.update(info)
[ "def", "_set_model_metadata", "(", "mlmodel", ",", "model_class", ",", "metadata", ",", "version", "=", "None", ")", ":", "info", "=", "_get_model_metadata", "(", "model_class", ",", "metadata", ",", "version", ")", "mlmodel", ".", "user_defined_metadata", ".", ...
Sets user-defined metadata, making sure information all models should have is also available
[ "Sets", "user", "-", "defined", "metadata", "making", "sure", "information", "all", "models", "should", "have", "is", "also", "available" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/_coreml_utils.py#L32-L38
29,451
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor.py
_ToCamelCase
def _ToCamelCase(name): """Converts name to camel-case and returns it.""" capitalize_next = False result = [] for c in name: if c == '_': if result: capitalize_next = True elif capitalize_next: result.append(c.upper()) capitalize_next = False else: result += c # L...
python
def _ToCamelCase(name): """Converts name to camel-case and returns it.""" capitalize_next = False result = [] for c in name: if c == '_': if result: capitalize_next = True elif capitalize_next: result.append(c.upper()) capitalize_next = False else: result += c # L...
[ "def", "_ToCamelCase", "(", "name", ")", ":", "capitalize_next", "=", "False", "result", "=", "[", "]", "for", "c", "in", "name", ":", "if", "c", "==", "'_'", ":", "if", "result", ":", "capitalize_next", "=", "True", "elif", "capitalize_next", ":", "re...
Converts name to camel-case and returns it.
[ "Converts", "name", "to", "camel", "-", "case", "and", "returns", "it", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor.py#L873-L891
29,452
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor.py
_ToJsonName
def _ToJsonName(name): """Converts name to Json name and returns it.""" capitalize_next = False result = [] for c in name: if c == '_': capitalize_next = True elif capitalize_next: result.append(c.upper()) capitalize_next = False else: result += c return ''.join(result)
python
def _ToJsonName(name): """Converts name to Json name and returns it.""" capitalize_next = False result = [] for c in name: if c == '_': capitalize_next = True elif capitalize_next: result.append(c.upper()) capitalize_next = False else: result += c return ''.join(result)
[ "def", "_ToJsonName", "(", "name", ")", ":", "capitalize_next", "=", "False", "result", "=", "[", "]", "for", "c", "in", "name", ":", "if", "c", "==", "'_'", ":", "capitalize_next", "=", "True", "elif", "capitalize_next", ":", "result", ".", "append", ...
Converts name to Json name and returns it.
[ "Converts", "name", "to", "Json", "name", "and", "returns", "it", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor.py#L902-L916
29,453
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor.py
DescriptorBase._SetOptions
def _SetOptions(self, options, options_class_name): """Sets the descriptor's options This function is used in generated proto2 files to update descriptor options. It must not be used outside proto2. """ self._options = options self._options_class_name = options_class_name # Does this descr...
python
def _SetOptions(self, options, options_class_name): """Sets the descriptor's options This function is used in generated proto2 files to update descriptor options. It must not be used outside proto2. """ self._options = options self._options_class_name = options_class_name # Does this descr...
[ "def", "_SetOptions", "(", "self", ",", "options", ",", "options_class_name", ")", ":", "self", ".", "_options", "=", "options", "self", ".", "_options_class_name", "=", "options_class_name", "# Does this descriptor have non-default options?", "self", ".", "has_options"...
Sets the descriptor's options This function is used in generated proto2 files to update descriptor options. It must not be used outside proto2.
[ "Sets", "the", "descriptor", "s", "options" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor.py#L106-L116
29,454
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor.py
DescriptorBase.GetOptions
def GetOptions(self): """Retrieves descriptor options. This method returns the options set or creates the default options for the descriptor. """ if self._options: return self._options from google.protobuf import descriptor_pb2 try: options_class = getattr(descriptor_pb2, self._...
python
def GetOptions(self): """Retrieves descriptor options. This method returns the options set or creates the default options for the descriptor. """ if self._options: return self._options from google.protobuf import descriptor_pb2 try: options_class = getattr(descriptor_pb2, self._...
[ "def", "GetOptions", "(", "self", ")", ":", "if", "self", ".", "_options", ":", "return", "self", ".", "_options", "from", "google", ".", "protobuf", "import", "descriptor_pb2", "try", ":", "options_class", "=", "getattr", "(", "descriptor_pb2", ",", "self",...
Retrieves descriptor options. This method returns the options set or creates the default options for the descriptor.
[ "Retrieves", "descriptor", "options", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor.py#L118-L133
29,455
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor.py
_NestedDescriptorBase.CopyToProto
def CopyToProto(self, proto): """Copies this to the matching proto in descriptor_pb2. Args: proto: An empty proto instance from descriptor_pb2. Raises: Error: If self couldnt be serialized, due to to few constructor arguments. """ if (self.file is not None and self._serialized_...
python
def CopyToProto(self, proto): """Copies this to the matching proto in descriptor_pb2. Args: proto: An empty proto instance from descriptor_pb2. Raises: Error: If self couldnt be serialized, due to to few constructor arguments. """ if (self.file is not None and self._serialized_...
[ "def", "CopyToProto", "(", "self", ",", "proto", ")", ":", "if", "(", "self", ".", "file", "is", "not", "None", "and", "self", ".", "_serialized_start", "is", "not", "None", "and", "self", ".", "_serialized_end", "is", "not", "None", ")", ":", "proto",...
Copies this to the matching proto in descriptor_pb2. Args: proto: An empty proto instance from descriptor_pb2. Raises: Error: If self couldnt be serialized, due to to few constructor arguments.
[ "Copies", "this", "to", "the", "matching", "proto", "in", "descriptor_pb2", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor.py#L174-L189
29,456
apple/turicreate
src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor.py
Descriptor.EnumValueName
def EnumValueName(self, enum, value): """Returns the string name of an enum value. This is just a small helper method to simplify a common operation. Args: enum: string name of the Enum. value: int, value of the enum. Returns: string name of the enum value. Raises: KeyErr...
python
def EnumValueName(self, enum, value): """Returns the string name of an enum value. This is just a small helper method to simplify a common operation. Args: enum: string name of the Enum. value: int, value of the enum. Returns: string name of the enum value. Raises: KeyErr...
[ "def", "EnumValueName", "(", "self", ",", "enum", ",", "value", ")", ":", "return", "self", ".", "enum_types_by_name", "[", "enum", "]", ".", "values_by_number", "[", "value", "]", ".", "name" ]
Returns the string name of an enum value. This is just a small helper method to simplify a common operation. Args: enum: string name of the Enum. value: int, value of the enum. Returns: string name of the enum value. Raises: KeyError if either the Enum doesn't exist or the va...
[ "Returns", "the", "string", "name", "of", "an", "enum", "value", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/coremltools_wrap/coremltools/deps/protobuf/python/google/protobuf/descriptor.py#L321-L337
29,457
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
resolve_reference
def resolve_reference(target_reference, project): """ Given a target_reference, made in context of 'project', returns the AbstractTarget instance that is referred to, as well as properties explicitly specified for this reference. """ # Separate target name from properties override assert isinsta...
python
def resolve_reference(target_reference, project): """ Given a target_reference, made in context of 'project', returns the AbstractTarget instance that is referred to, as well as properties explicitly specified for this reference. """ # Separate target name from properties override assert isinsta...
[ "def", "resolve_reference", "(", "target_reference", ",", "project", ")", ":", "# Separate target name from properties override", "assert", "isinstance", "(", "target_reference", ",", "basestring", ")", "assert", "isinstance", "(", "project", ",", "ProjectTarget", ")", ...
Given a target_reference, made in context of 'project', returns the AbstractTarget instance that is referred to, as well as properties explicitly specified for this reference.
[ "Given", "a", "target_reference", "made", "in", "context", "of", "project", "returns", "the", "AbstractTarget", "instance", "that", "is", "referred", "to", "as", "well", "as", "properties", "explicitly", "specified", "for", "this", "reference", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L841-L864
29,458
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
TargetRegistry.main_target_alternative
def main_target_alternative (self, target): """ Registers the specified target as a main target alternatives. Returns 'target'. """ assert isinstance(target, AbstractTarget) target.project ().add_alternative (target) return target
python
def main_target_alternative (self, target): """ Registers the specified target as a main target alternatives. Returns 'target'. """ assert isinstance(target, AbstractTarget) target.project ().add_alternative (target) return target
[ "def", "main_target_alternative", "(", "self", ",", "target", ")", ":", "assert", "isinstance", "(", "target", ",", "AbstractTarget", ")", "target", ".", "project", "(", ")", ".", "add_alternative", "(", "target", ")", "return", "target" ]
Registers the specified target as a main target alternatives. Returns 'target'.
[ "Registers", "the", "specified", "target", "as", "a", "main", "target", "alternatives", ".", "Returns", "target", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L107-L113
29,459
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
TargetRegistry.main_target_requirements
def main_target_requirements(self, specification, project): """Returns the requirement to use when declaring a main target, which are obtained by - translating all specified property paths, and - refining project requirements with the one specified for the target 'specificat...
python
def main_target_requirements(self, specification, project): """Returns the requirement to use when declaring a main target, which are obtained by - translating all specified property paths, and - refining project requirements with the one specified for the target 'specificat...
[ "def", "main_target_requirements", "(", "self", ",", "specification", ",", "project", ")", ":", "assert", "is_iterable_typed", "(", "specification", ",", "basestring", ")", "assert", "isinstance", "(", "project", ",", "ProjectTarget", ")", "# create a copy since the l...
Returns the requirement to use when declaring a main target, which are obtained by - translating all specified property paths, and - refining project requirements with the one specified for the target 'specification' are the properties xplicitly specified for a main target...
[ "Returns", "the", "requirement", "to", "use", "when", "declaring", "a", "main", "target", "which", "are", "obtained", "by", "-", "translating", "all", "specified", "property", "paths", "and", "-", "refining", "project", "requirements", "with", "the", "one", "s...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L148-L167
29,460
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
TargetRegistry.start_building
def start_building (self, main_target_instance): """ Helper rules to detect cycles in main target references. """ assert isinstance(main_target_instance, MainTarget) if id(main_target_instance) in self.targets_being_built_: names = [] for t in self.targets_being_b...
python
def start_building (self, main_target_instance): """ Helper rules to detect cycles in main target references. """ assert isinstance(main_target_instance, MainTarget) if id(main_target_instance) in self.targets_being_built_: names = [] for t in self.targets_being_b...
[ "def", "start_building", "(", "self", ",", "main_target_instance", ")", ":", "assert", "isinstance", "(", "main_target_instance", ",", "MainTarget", ")", "if", "id", "(", "main_target_instance", ")", "in", "self", ".", "targets_being_built_", ":", "names", "=", ...
Helper rules to detect cycles in main target references.
[ "Helper", "rules", "to", "detect", "cycles", "in", "main", "target", "references", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L204-L215
29,461
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
TargetRegistry.create_typed_target
def create_typed_target (self, type, project, name, sources, requirements, default_build, usage_requirements): """ Creates a TypedTarget with the specified properties. The 'name', 'sources', 'requirements', 'default_build' and 'usage_requirements' are assumed to be in the form specified ...
python
def create_typed_target (self, type, project, name, sources, requirements, default_build, usage_requirements): """ Creates a TypedTarget with the specified properties. The 'name', 'sources', 'requirements', 'default_build' and 'usage_requirements' are assumed to be in the form specified ...
[ "def", "create_typed_target", "(", "self", ",", "type", ",", "project", ",", "name", ",", "sources", ",", "requirements", ",", "default_build", ",", "usage_requirements", ")", ":", "assert", "isinstance", "(", "type", ",", "basestring", ")", "assert", "isinsta...
Creates a TypedTarget with the specified properties. The 'name', 'sources', 'requirements', 'default_build' and 'usage_requirements' are assumed to be in the form specified by the user in Jamfile corresponding to 'project'.
[ "Creates", "a", "TypedTarget", "with", "the", "specified", "properties", ".", "The", "name", "sources", "requirements", "default_build", "and", "usage_requirements", "are", "assumed", "to", "be", "in", "the", "form", "specified", "by", "the", "user", "in", "Jamf...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L222-L237
29,462
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
ProjectTarget.generate
def generate (self, ps): """ Generates all possible targets contained in this project. """ assert isinstance(ps, property_set.PropertySet) self.manager_.targets().log( "Building project '%s' with '%s'" % (self.name (), str(ps))) self.manager_.targets().increase_indent...
python
def generate (self, ps): """ Generates all possible targets contained in this project. """ assert isinstance(ps, property_set.PropertySet) self.manager_.targets().log( "Building project '%s' with '%s'" % (self.name (), str(ps))) self.manager_.targets().increase_indent...
[ "def", "generate", "(", "self", ",", "ps", ")", ":", "assert", "isinstance", "(", "ps", ",", "property_set", ".", "PropertySet", ")", "self", ".", "manager_", ".", "targets", "(", ")", ".", "log", "(", "\"Building project '%s' with '%s'\"", "%", "(", "self...
Generates all possible targets contained in this project.
[ "Generates", "all", "possible", "targets", "contained", "in", "this", "project", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L433-L448
29,463
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
ProjectTarget.targets_to_build
def targets_to_build (self): """ Computes and returns a list of AbstractTarget instances which must be built when this project is built. """ result = [] if not self.built_main_targets_: self.build_main_targets () # Collect all main targets here, except f...
python
def targets_to_build (self): """ Computes and returns a list of AbstractTarget instances which must be built when this project is built. """ result = [] if not self.built_main_targets_: self.build_main_targets () # Collect all main targets here, except f...
[ "def", "targets_to_build", "(", "self", ")", ":", "result", "=", "[", "]", "if", "not", "self", ".", "built_main_targets_", ":", "self", ".", "build_main_targets", "(", ")", "# Collect all main targets here, except for \"explicit\" ones.", "for", "n", ",", "t", "i...
Computes and returns a list of AbstractTarget instances which must be built when this project is built.
[ "Computes", "and", "returns", "a", "list", "of", "AbstractTarget", "instances", "which", "must", "be", "built", "when", "this", "project", "is", "built", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L450-L469
29,464
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
ProjectTarget.mark_targets_as_explicit
def mark_targets_as_explicit (self, target_names): """Add 'target' to the list of targets in this project that should be build only by explicit request.""" # Record the name of the target, not instance, since this # rule is called before main target instaces are created. assert ...
python
def mark_targets_as_explicit (self, target_names): """Add 'target' to the list of targets in this project that should be build only by explicit request.""" # Record the name of the target, not instance, since this # rule is called before main target instaces are created. assert ...
[ "def", "mark_targets_as_explicit", "(", "self", ",", "target_names", ")", ":", "# Record the name of the target, not instance, since this", "# rule is called before main target instaces are created.", "assert", "is_iterable_typed", "(", "target_names", ",", "basestring", ")", "self...
Add 'target' to the list of targets in this project that should be build only by explicit request.
[ "Add", "target", "to", "the", "list", "of", "targets", "in", "this", "project", "that", "should", "be", "build", "only", "by", "explicit", "request", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L471-L478
29,465
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
ProjectTarget.add_alternative
def add_alternative (self, target_instance): """ Add new target alternative. """ assert isinstance(target_instance, AbstractTarget) if self.built_main_targets_: raise IllegalOperation ("add-alternative called when main targets are already created for project '%s'" % self.full...
python
def add_alternative (self, target_instance): """ Add new target alternative. """ assert isinstance(target_instance, AbstractTarget) if self.built_main_targets_: raise IllegalOperation ("add-alternative called when main targets are already created for project '%s'" % self.full...
[ "def", "add_alternative", "(", "self", ",", "target_instance", ")", ":", "assert", "isinstance", "(", "target_instance", ",", "AbstractTarget", ")", "if", "self", ".", "built_main_targets_", ":", "raise", "IllegalOperation", "(", "\"add-alternative called when main targ...
Add new target alternative.
[ "Add", "new", "target", "alternative", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L484-L491
29,466
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
ProjectTarget.has_main_target
def has_main_target (self, name): """Tells if a main target with the specified name exists.""" assert isinstance(name, basestring) if not self.built_main_targets_: self.build_main_targets() return name in self.main_target_
python
def has_main_target (self, name): """Tells if a main target with the specified name exists.""" assert isinstance(name, basestring) if not self.built_main_targets_: self.build_main_targets() return name in self.main_target_
[ "def", "has_main_target", "(", "self", ",", "name", ")", ":", "assert", "isinstance", "(", "name", ",", "basestring", ")", "if", "not", "self", ".", "built_main_targets_", ":", "self", ".", "build_main_targets", "(", ")", "return", "name", "in", "self", "....
Tells if a main target with the specified name exists.
[ "Tells", "if", "a", "main", "target", "with", "the", "specified", "name", "exists", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L500-L506
29,467
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
ProjectTarget.create_main_target
def create_main_target (self, name): """ Returns a 'MainTarget' class instance corresponding to the 'name'. """ assert isinstance(name, basestring) if not self.built_main_targets_: self.build_main_targets () return self.main_targets_.get (name, None)
python
def create_main_target (self, name): """ Returns a 'MainTarget' class instance corresponding to the 'name'. """ assert isinstance(name, basestring) if not self.built_main_targets_: self.build_main_targets () return self.main_targets_.get (name, None)
[ "def", "create_main_target", "(", "self", ",", "name", ")", ":", "assert", "isinstance", "(", "name", ",", "basestring", ")", "if", "not", "self", ".", "built_main_targets_", ":", "self", ".", "build_main_targets", "(", ")", "return", "self", ".", "main_targ...
Returns a 'MainTarget' class instance corresponding to the 'name'.
[ "Returns", "a", "MainTarget", "class", "instance", "corresponding", "to", "the", "name", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L508-L515
29,468
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
ProjectTarget.find_really
def find_really(self, id): """ Find and return the target with the specified id, treated relative to self. """ assert isinstance(id, basestring) result = None current_location = self.get ('location') __re_split_project_target = re.compile (r'(.*)//(.*)') ...
python
def find_really(self, id): """ Find and return the target with the specified id, treated relative to self. """ assert isinstance(id, basestring) result = None current_location = self.get ('location') __re_split_project_target = re.compile (r'(.*)//(.*)') ...
[ "def", "find_really", "(", "self", ",", "id", ")", ":", "assert", "isinstance", "(", "id", ",", "basestring", ")", "result", "=", "None", "current_location", "=", "self", ".", "get", "(", "'location'", ")", "__re_split_project_target", "=", "re", ".", "com...
Find and return the target with the specified id, treated relative to self.
[ "Find", "and", "return", "the", "target", "with", "the", "specified", "id", "treated", "relative", "to", "self", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L518-L588
29,469
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
ProjectTarget.add_constant
def add_constant(self, name, value, path=0): """Adds a new constant for this project. The constant will be available for use in Jamfile module for this project. If 'path' is true, the constant will be interpreted relatively to the location of project. """ assert ...
python
def add_constant(self, name, value, path=0): """Adds a new constant for this project. The constant will be available for use in Jamfile module for this project. If 'path' is true, the constant will be interpreted relatively to the location of project. """ assert ...
[ "def", "add_constant", "(", "self", ",", "name", ",", "value", ",", "path", "=", "0", ")", ":", "assert", "isinstance", "(", "name", ",", "basestring", ")", "assert", "is_iterable_typed", "(", "value", ",", "basestring", ")", "assert", "isinstance", "(", ...
Adds a new constant for this project. The constant will be available for use in Jamfile module for this project. If 'path' is true, the constant will be interpreted relatively to the location of project.
[ "Adds", "a", "new", "constant", "for", "this", "project", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L619-L646
29,470
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
MainTarget.add_alternative
def add_alternative (self, target): """ Add a new alternative for this target. """ assert isinstance(target, BasicTarget) d = target.default_build () if self.alternatives_ and self.default_build_ != d: get_manager().errors()("default build must be identical in all al...
python
def add_alternative (self, target): """ Add a new alternative for this target. """ assert isinstance(target, BasicTarget) d = target.default_build () if self.alternatives_ and self.default_build_ != d: get_manager().errors()("default build must be identical in all al...
[ "def", "add_alternative", "(", "self", ",", "target", ")", ":", "assert", "isinstance", "(", "target", ",", "BasicTarget", ")", "d", "=", "target", ".", "default_build", "(", ")", "if", "self", ".", "alternatives_", "and", "self", ".", "default_build_", "!...
Add a new alternative for this target.
[ "Add", "a", "new", "alternative", "for", "this", "target", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L676-L691
29,471
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
MainTarget.generate
def generate (self, ps): """ Select an alternative for this main target, by finding all alternatives which requirements are satisfied by 'properties' and picking the one with longest requirements set. Returns the result of calling 'generate' on that alternative. """ ...
python
def generate (self, ps): """ Select an alternative for this main target, by finding all alternatives which requirements are satisfied by 'properties' and picking the one with longest requirements set. Returns the result of calling 'generate' on that alternative. """ ...
[ "def", "generate", "(", "self", ",", "ps", ")", ":", "assert", "isinstance", "(", "ps", ",", "property_set", ".", "PropertySet", ")", "self", ".", "manager_", ".", "targets", "(", ")", ".", "start_building", "(", "self", ")", "# We want composite properties ...
Select an alternative for this main target, by finding all alternatives which requirements are satisfied by 'properties' and picking the one with longest requirements set. Returns the result of calling 'generate' on that alternative.
[ "Select", "an", "alternative", "for", "this", "main", "target", "by", "finding", "all", "alternatives", "which", "requirements", "are", "satisfied", "by", "properties", "and", "picking", "the", "one", "with", "longest", "requirements", "set", ".", "Returns", "th...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L752-L774
29,472
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
MainTarget.__generate_really
def __generate_really (self, prop_set): """ Generates the main target with the given property set and returns a list which first element is property_set object containing usage_requirements of generated target and with generated virtual target in other elements. It's possible...
python
def __generate_really (self, prop_set): """ Generates the main target with the given property set and returns a list which first element is property_set object containing usage_requirements of generated target and with generated virtual target in other elements. It's possible...
[ "def", "__generate_really", "(", "self", ",", "prop_set", ")", ":", "assert", "isinstance", "(", "prop_set", ",", "property_set", ".", "PropertySet", ")", "best_alternative", "=", "self", ".", "__select_alternatives", "(", "prop_set", ",", "debug", "=", "0", "...
Generates the main target with the given property set and returns a list which first element is property_set object containing usage_requirements of generated target and with generated virtual target in other elements. It's possible that no targets are generated.
[ "Generates", "the", "main", "target", "with", "the", "given", "property", "set", "and", "returns", "a", "list", "which", "first", "element", "is", "property_set", "object", "containing", "usage_requirements", "of", "generated", "target", "and", "with", "generated"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L776-L797
29,473
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
BasicTarget.common_properties
def common_properties (self, build_request, requirements): """ Given build request and requirements, return properties common to dependency build request and target build properties. """ # For optimization, we add free unconditional requirements directly, # withou...
python
def common_properties (self, build_request, requirements): """ Given build request and requirements, return properties common to dependency build request and target build properties. """ # For optimization, we add free unconditional requirements directly, # withou...
[ "def", "common_properties", "(", "self", ",", "build_request", ",", "requirements", ")", ":", "# For optimization, we add free unconditional requirements directly,", "# without using complex algorithsm.", "# This gives the complex algorithm better chance of caching results.", "# The exact ...
Given build request and requirements, return properties common to dependency build request and target build properties.
[ "Given", "build", "request", "and", "requirements", "return", "properties", "common", "to", "dependency", "build", "request", "and", "target", "build", "properties", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L958-L982
29,474
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
BasicTarget.match
def match (self, property_set_, debug): """ Returns the alternative condition for this alternative, if the condition is satisfied by 'property_set'. """ # The condition is composed of all base non-conditional properties. # It's not clear if we should expand 'self.requirements...
python
def match (self, property_set_, debug): """ Returns the alternative condition for this alternative, if the condition is satisfied by 'property_set'. """ # The condition is composed of all base non-conditional properties. # It's not clear if we should expand 'self.requirements...
[ "def", "match", "(", "self", ",", "property_set_", ",", "debug", ")", ":", "# The condition is composed of all base non-conditional properties.", "# It's not clear if we should expand 'self.requirements_' or not.", "# For one thing, it would be nice to be able to put", "# <toolset>msvc-...
Returns the alternative condition for this alternative, if the condition is satisfied by 'property_set'.
[ "Returns", "the", "alternative", "condition", "for", "this", "alternative", "if", "the", "condition", "is", "satisfied", "by", "property_set", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L1103-L1131
29,475
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
BasicTarget.generate_dependency_properties
def generate_dependency_properties(self, properties, ps): """ Takes a target reference, which might be either target id or a dependency property, and generates that target using 'property_set' as build request. Returns a tuple (result, usage_requirements). """ ...
python
def generate_dependency_properties(self, properties, ps): """ Takes a target reference, which might be either target id or a dependency property, and generates that target using 'property_set' as build request. Returns a tuple (result, usage_requirements). """ ...
[ "def", "generate_dependency_properties", "(", "self", ",", "properties", ",", "ps", ")", ":", "assert", "is_iterable_typed", "(", "properties", ",", "property", ".", "Property", ")", "assert", "isinstance", "(", "ps", ",", "property_set", ".", "PropertySet", ")"...
Takes a target reference, which might be either target id or a dependency property, and generates that target using 'property_set' as build request. Returns a tuple (result, usage_requirements).
[ "Takes", "a", "target", "reference", "which", "might", "be", "either", "target", "id", "or", "a", "dependency", "property", "and", "generates", "that", "target", "using", "property_set", "as", "build", "request", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L1147-L1167
29,476
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
BasicTarget.compute_usage_requirements
def compute_usage_requirements (self, subvariant): """ Given the set of generated targets, and refined build properties, determines and sets appripriate usage requirements on those targets. """ assert isinstance(subvariant, virtual_target.Subvariant) rproperties =...
python
def compute_usage_requirements (self, subvariant): """ Given the set of generated targets, and refined build properties, determines and sets appripriate usage requirements on those targets. """ assert isinstance(subvariant, virtual_target.Subvariant) rproperties =...
[ "def", "compute_usage_requirements", "(", "self", ",", "subvariant", ")", ":", "assert", "isinstance", "(", "subvariant", ",", "virtual_target", ".", "Subvariant", ")", "rproperties", "=", "subvariant", ".", "build_properties", "(", ")", "xusage_requirements", "=", ...
Given the set of generated targets, and refined build properties, determines and sets appripriate usage requirements on those targets.
[ "Given", "the", "set", "of", "generated", "targets", "and", "refined", "build", "properties", "determines", "and", "sets", "appripriate", "usage", "requirements", "on", "those", "targets", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L1296-L1342
29,477
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/build/targets.py
BasicTarget.create_subvariant
def create_subvariant (self, root_targets, all_targets, build_request, sources, rproperties, usage_requirements): """Creates a new subvariant-dg instances for 'targets' - 'root-targets' the virtual targets will be returned to dependents - '...
python
def create_subvariant (self, root_targets, all_targets, build_request, sources, rproperties, usage_requirements): """Creates a new subvariant-dg instances for 'targets' - 'root-targets' the virtual targets will be returned to dependents - '...
[ "def", "create_subvariant", "(", "self", ",", "root_targets", ",", "all_targets", ",", "build_request", ",", "sources", ",", "rproperties", ",", "usage_requirements", ")", ":", "assert", "is_iterable_typed", "(", "root_targets", ",", "virtual_target", ".", "VirtualT...
Creates a new subvariant-dg instances for 'targets' - 'root-targets' the virtual targets will be returned to dependents - 'all-targets' all virtual targets created while building this main target - 'build-request' is property-set instance with requested build properties
[ "Creates", "a", "new", "subvariant", "-", "dg", "instances", "for", "targets", "-", "root", "-", "targets", "the", "virtual", "targets", "will", "be", "returned", "to", "dependents", "-", "all", "-", "targets", "all", "virtual", "targets", "created", "while"...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/build/targets.py#L1344-L1370
29,478
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/tools/builtin.py
variant
def variant (name, parents_or_properties, explicit_properties = []): """ Declares a new variant. First determines explicit properties for this variant, by refining parents' explicit properties with the passed explicit properties. The result is remembered and will be used if this vari...
python
def variant (name, parents_or_properties, explicit_properties = []): """ Declares a new variant. First determines explicit properties for this variant, by refining parents' explicit properties with the passed explicit properties. The result is remembered and will be used if this vari...
[ "def", "variant", "(", "name", ",", "parents_or_properties", ",", "explicit_properties", "=", "[", "]", ")", ":", "parents", "=", "[", "]", "if", "not", "explicit_properties", ":", "explicit_properties", "=", "parents_or_properties", "else", ":", "parents", "=",...
Declares a new variant. First determines explicit properties for this variant, by refining parents' explicit properties with the passed explicit properties. The result is remembered and will be used if this variant is used as parent. Second, determines the full property set for ...
[ "Declares", "a", "new", "variant", ".", "First", "determines", "explicit", "properties", "for", "this", "variant", "by", "refining", "parents", "explicit", "properties", "with", "the", "passed", "explicit", "properties", ".", "The", "result", "is", "remembered", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/builtin.py#L33-L82
29,479
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/tools/builtin.py
CompileAction.adjust_properties
def adjust_properties (self, prop_set): """ For all virtual targets for the same dependency graph as self, i.e. which belong to the same main target, add their directories to include path. """ assert isinstance(prop_set, property_set.PropertySet) s = self.targets ...
python
def adjust_properties (self, prop_set): """ For all virtual targets for the same dependency graph as self, i.e. which belong to the same main target, add their directories to include path. """ assert isinstance(prop_set, property_set.PropertySet) s = self.targets ...
[ "def", "adjust_properties", "(", "self", ",", "prop_set", ")", ":", "assert", "isinstance", "(", "prop_set", ",", "property_set", ".", "PropertySet", ")", "s", "=", "self", ".", "targets", "(", ")", "[", "0", "]", ".", "creating_subvariant", "(", ")", "r...
For all virtual targets for the same dependency graph as self, i.e. which belong to the same main target, add their directories to include path.
[ "For", "all", "virtual", "targets", "for", "the", "same", "dependency", "graph", "as", "self", "i", ".", "e", ".", "which", "belong", "to", "the", "same", "main", "target", "add", "their", "directories", "to", "include", "path", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/tools/builtin.py#L581-L589
29,480
apple/turicreate
src/unity/python/turicreate/toolkits/recommender/popularity_recommender.py
create
def create(observation_data, user_id='user_id', item_id='item_id', target=None, user_data=None, item_data=None, random_seed=0, verbose=True): """ Create a model that makes recommendations using item popularity. When no target column is provided, the popularity is ...
python
def create(observation_data, user_id='user_id', item_id='item_id', target=None, user_data=None, item_data=None, random_seed=0, verbose=True): """ Create a model that makes recommendations using item popularity. When no target column is provided, the popularity is ...
[ "def", "create", "(", "observation_data", ",", "user_id", "=", "'user_id'", ",", "item_id", "=", "'item_id'", ",", "target", "=", "None", ",", "user_data", "=", "None", ",", "item_data", "=", "None", ",", "random_seed", "=", "0", ",", "verbose", "=", "Tr...
Create a model that makes recommendations using item popularity. When no target column is provided, the popularity is determined by the number of observations involving each item. When a target is provided, popularity is computed using the item's mean target value. When the target column contains rating...
[ "Create", "a", "model", "that", "makes", "recommendations", "using", "item", "popularity", ".", "When", "no", "target", "column", "is", "provided", "the", "popularity", "is", "determined", "by", "the", "number", "of", "observations", "involving", "each", "item",...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/recommender/popularity_recommender.py#L15-L102
29,481
apple/turicreate
src/external/xgboost/python-package/xgboost/sklearn.py
XGBModel.get_params
def get_params(self, deep=False): """Get parameter.s""" params = super(XGBModel, self).get_params(deep=deep) if params['missing'] is np.nan: params['missing'] = None # sklearn doesn't handle nan. see #4725 if not params.get('eval_metric', True): del params['eval_...
python
def get_params(self, deep=False): """Get parameter.s""" params = super(XGBModel, self).get_params(deep=deep) if params['missing'] is np.nan: params['missing'] = None # sklearn doesn't handle nan. see #4725 if not params.get('eval_metric', True): del params['eval_...
[ "def", "get_params", "(", "self", ",", "deep", "=", "False", ")", ":", "params", "=", "super", "(", "XGBModel", ",", "self", ")", ".", "get_params", "(", "deep", "=", "deep", ")", "if", "params", "[", "'missing'", "]", "is", "np", ".", "nan", ":", ...
Get parameter.s
[ "Get", "parameter", ".", "s" ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/external/xgboost/python-package/xgboost/sklearn.py#L126-L133
29,482
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/util/utility.py
replace_grist
def replace_grist (features, new_grist): """ Replaces the grist of a string by a new one. Returns the string with the new grist. """ assert is_iterable_typed(features, basestring) or isinstance(features, basestring) assert isinstance(new_grist, basestring) # this function is used a lot in th...
python
def replace_grist (features, new_grist): """ Replaces the grist of a string by a new one. Returns the string with the new grist. """ assert is_iterable_typed(features, basestring) or isinstance(features, basestring) assert isinstance(new_grist, basestring) # this function is used a lot in th...
[ "def", "replace_grist", "(", "features", ",", "new_grist", ")", ":", "assert", "is_iterable_typed", "(", "features", ",", "basestring", ")", "or", "isinstance", "(", "features", ",", "basestring", ")", "assert", "isinstance", "(", "new_grist", ",", "basestring",...
Replaces the grist of a string by a new one. Returns the string with the new grist.
[ "Replaces", "the", "grist", "of", "a", "string", "by", "a", "new", "one", ".", "Returns", "the", "string", "with", "the", "new", "grist", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/utility.py#L56-L83
29,483
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/util/utility.py
get_value
def get_value (property): """ Gets the value of a property, that is, the part following the grist, if any. """ assert is_iterable_typed(property, basestring) or isinstance(property, basestring) return replace_grist (property, '')
python
def get_value (property): """ Gets the value of a property, that is, the part following the grist, if any. """ assert is_iterable_typed(property, basestring) or isinstance(property, basestring) return replace_grist (property, '')
[ "def", "get_value", "(", "property", ")", ":", "assert", "is_iterable_typed", "(", "property", ",", "basestring", ")", "or", "isinstance", "(", "property", ",", "basestring", ")", "return", "replace_grist", "(", "property", ",", "''", ")" ]
Gets the value of a property, that is, the part following the grist, if any.
[ "Gets", "the", "value", "of", "a", "property", "that", "is", "the", "part", "following", "the", "grist", "if", "any", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/utility.py#L85-L89
29,484
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/util/utility.py
get_grist
def get_grist (value): """ Returns the grist of a string. If value is a sequence, does it for every value and returns the result as a sequence. """ assert is_iterable_typed(value, basestring) or isinstance(value, basestring) def get_grist_one (name): split = __re_grist_and_value.match (n...
python
def get_grist (value): """ Returns the grist of a string. If value is a sequence, does it for every value and returns the result as a sequence. """ assert is_iterable_typed(value, basestring) or isinstance(value, basestring) def get_grist_one (name): split = __re_grist_and_value.match (n...
[ "def", "get_grist", "(", "value", ")", ":", "assert", "is_iterable_typed", "(", "value", ",", "basestring", ")", "or", "isinstance", "(", "value", ",", "basestring", ")", "def", "get_grist_one", "(", "name", ")", ":", "split", "=", "__re_grist_and_value", "....
Returns the grist of a string. If value is a sequence, does it for every value and returns the result as a sequence.
[ "Returns", "the", "grist", "of", "a", "string", ".", "If", "value", "is", "a", "sequence", "does", "it", "for", "every", "value", "and", "returns", "the", "result", "as", "a", "sequence", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/utility.py#L91-L106
29,485
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/util/utility.py
ungrist
def ungrist (value): """ Returns the value without grist. If value is a sequence, does it for every value and returns the result as a sequence. """ assert is_iterable_typed(value, basestring) or isinstance(value, basestring) def ungrist_one (value): stripped = __re_grist_content.match (v...
python
def ungrist (value): """ Returns the value without grist. If value is a sequence, does it for every value and returns the result as a sequence. """ assert is_iterable_typed(value, basestring) or isinstance(value, basestring) def ungrist_one (value): stripped = __re_grist_content.match (v...
[ "def", "ungrist", "(", "value", ")", ":", "assert", "is_iterable_typed", "(", "value", ",", "basestring", ")", "or", "isinstance", "(", "value", ",", "basestring", ")", "def", "ungrist_one", "(", "value", ")", ":", "stripped", "=", "__re_grist_content", ".",...
Returns the value without grist. If value is a sequence, does it for every value and returns the result as a sequence.
[ "Returns", "the", "value", "without", "grist", ".", "If", "value", "is", "a", "sequence", "does", "it", "for", "every", "value", "and", "returns", "the", "result", "as", "a", "sequence", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/utility.py#L108-L123
29,486
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/util/utility.py
replace_suffix
def replace_suffix (name, new_suffix): """ Replaces the suffix of name by new_suffix. If no suffix exists, the new one is added. """ assert isinstance(name, basestring) assert isinstance(new_suffix, basestring) split = os.path.splitext (name) return split [0] + new_suffix
python
def replace_suffix (name, new_suffix): """ Replaces the suffix of name by new_suffix. If no suffix exists, the new one is added. """ assert isinstance(name, basestring) assert isinstance(new_suffix, basestring) split = os.path.splitext (name) return split [0] + new_suffix
[ "def", "replace_suffix", "(", "name", ",", "new_suffix", ")", ":", "assert", "isinstance", "(", "name", ",", "basestring", ")", "assert", "isinstance", "(", "new_suffix", ",", "basestring", ")", "split", "=", "os", ".", "path", ".", "splitext", "(", "name"...
Replaces the suffix of name by new_suffix. If no suffix exists, the new one is added.
[ "Replaces", "the", "suffix", "of", "name", "by", "new_suffix", ".", "If", "no", "suffix", "exists", "the", "new", "one", "is", "added", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/utility.py#L125-L132
29,487
apple/turicreate
deps/src/boost_1_68_0/tools/build/src/util/utility.py
on_windows
def on_windows (): """ Returns true if running on windows, whether in cygwin or not. """ if bjam.variable("NT"): return True elif bjam.variable("UNIX"): uname = bjam.variable("JAMUNAME") if uname and uname[0].startswith("CYGWIN"): return True return False
python
def on_windows (): """ Returns true if running on windows, whether in cygwin or not. """ if bjam.variable("NT"): return True elif bjam.variable("UNIX"): uname = bjam.variable("JAMUNAME") if uname and uname[0].startswith("CYGWIN"): return True return False
[ "def", "on_windows", "(", ")", ":", "if", "bjam", ".", "variable", "(", "\"NT\"", ")", ":", "return", "True", "elif", "bjam", ".", "variable", "(", "\"UNIX\"", ")", ":", "uname", "=", "bjam", ".", "variable", "(", "\"JAMUNAME\"", ")", "if", "uname", ...
Returns true if running on windows, whether in cygwin or not.
[ "Returns", "true", "if", "running", "on", "windows", "whether", "in", "cygwin", "or", "not", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/deps/src/boost_1_68_0/tools/build/src/util/utility.py#L164-L176
29,488
apple/turicreate
src/unity/python/turicreate/toolkits/clustering/kmeans.py
_validate_dataset
def _validate_dataset(dataset): """ Validate the main Kmeans dataset. Parameters ---------- dataset: SFrame Input dataset. """ if not (isinstance(dataset, _SFrame)): raise TypeError("Input 'dataset' must be an SFrame.") if dataset.num_rows() == 0 or dataset.num_columns(...
python
def _validate_dataset(dataset): """ Validate the main Kmeans dataset. Parameters ---------- dataset: SFrame Input dataset. """ if not (isinstance(dataset, _SFrame)): raise TypeError("Input 'dataset' must be an SFrame.") if dataset.num_rows() == 0 or dataset.num_columns(...
[ "def", "_validate_dataset", "(", "dataset", ")", ":", "if", "not", "(", "isinstance", "(", "dataset", ",", "_SFrame", ")", ")", ":", "raise", "TypeError", "(", "\"Input 'dataset' must be an SFrame.\"", ")", "if", "dataset", ".", "num_rows", "(", ")", "==", "...
Validate the main Kmeans dataset. Parameters ---------- dataset: SFrame Input dataset.
[ "Validate", "the", "main", "Kmeans", "dataset", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/clustering/kmeans.py#L25-L38
29,489
apple/turicreate
src/unity/python/turicreate/toolkits/clustering/kmeans.py
_validate_initial_centers
def _validate_initial_centers(initial_centers): """ Validate the initial centers. Parameters ---------- initial_centers : SFrame Initial cluster center locations, in SFrame form. """ if not (isinstance(initial_centers, _SFrame)): raise TypeError("Input 'initial_centers' must...
python
def _validate_initial_centers(initial_centers): """ Validate the initial centers. Parameters ---------- initial_centers : SFrame Initial cluster center locations, in SFrame form. """ if not (isinstance(initial_centers, _SFrame)): raise TypeError("Input 'initial_centers' must...
[ "def", "_validate_initial_centers", "(", "initial_centers", ")", ":", "if", "not", "(", "isinstance", "(", "initial_centers", ",", "_SFrame", ")", ")", ":", "raise", "TypeError", "(", "\"Input 'initial_centers' must be an SFrame.\"", ")", "if", "initial_centers", ".",...
Validate the initial centers. Parameters ---------- initial_centers : SFrame Initial cluster center locations, in SFrame form.
[ "Validate", "the", "initial", "centers", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/clustering/kmeans.py#L41-L55
29,490
apple/turicreate
src/unity/python/turicreate/toolkits/clustering/kmeans.py
_validate_num_clusters
def _validate_num_clusters(num_clusters, initial_centers, num_rows): """ Validate the combination of the `num_clusters` and `initial_centers` parameters in the Kmeans model create function. If the combination is valid, determine and return the correct number of clusters. Parameters ---------- ...
python
def _validate_num_clusters(num_clusters, initial_centers, num_rows): """ Validate the combination of the `num_clusters` and `initial_centers` parameters in the Kmeans model create function. If the combination is valid, determine and return the correct number of clusters. Parameters ---------- ...
[ "def", "_validate_num_clusters", "(", "num_clusters", ",", "initial_centers", ",", "num_rows", ")", ":", "## Basic validation", "if", "num_clusters", "is", "not", "None", "and", "not", "isinstance", "(", "num_clusters", ",", "int", ")", ":", "raise", "_ToolkitErro...
Validate the combination of the `num_clusters` and `initial_centers` parameters in the Kmeans model create function. If the combination is valid, determine and return the correct number of clusters. Parameters ---------- num_clusters : int Specified number of clusters. initial_centers ...
[ "Validate", "the", "combination", "of", "the", "num_clusters", "and", "initial_centers", "parameters", "in", "the", "Kmeans", "model", "create", "function", ".", "If", "the", "combination", "is", "valid", "determine", "and", "return", "the", "correct", "number", ...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/clustering/kmeans.py#L58-L115
29,491
apple/turicreate
src/unity/python/turicreate/toolkits/clustering/kmeans.py
_validate_features
def _validate_features(features, column_type_map, valid_types, label): """ Identify the subset of desired `features` that are valid for the Kmeans model. A warning is emitted for each feature that is excluded. Parameters ---------- features : list[str] Desired feature names. column...
python
def _validate_features(features, column_type_map, valid_types, label): """ Identify the subset of desired `features` that are valid for the Kmeans model. A warning is emitted for each feature that is excluded. Parameters ---------- features : list[str] Desired feature names. column...
[ "def", "_validate_features", "(", "features", ",", "column_type_map", ",", "valid_types", ",", "label", ")", ":", "if", "not", "isinstance", "(", "features", ",", "list", ")", ":", "raise", "TypeError", "(", "\"Input 'features' must be a list, if specified.\"", ")",...
Identify the subset of desired `features` that are valid for the Kmeans model. A warning is emitted for each feature that is excluded. Parameters ---------- features : list[str] Desired feature names. column_type_map : dict[str, type] Dictionary mapping each column name to the type...
[ "Identify", "the", "subset", "of", "desired", "features", "that", "are", "valid", "for", "the", "Kmeans", "model", ".", "A", "warning", "is", "emitted", "for", "each", "feature", "that", "is", "excluded", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/clustering/kmeans.py#L118-L186
29,492
apple/turicreate
src/unity/python/turicreate/toolkits/clustering/kmeans.py
create
def create(dataset, num_clusters=None, features=None, label=None, initial_centers=None, max_iterations=10, batch_size=None, verbose=True): """ Create a k-means clustering model. The KmeansModel object contains the computed cluster centers and the cluster assignment for each instance in...
python
def create(dataset, num_clusters=None, features=None, label=None, initial_centers=None, max_iterations=10, batch_size=None, verbose=True): """ Create a k-means clustering model. The KmeansModel object contains the computed cluster centers and the cluster assignment for each instance in...
[ "def", "create", "(", "dataset", ",", "num_clusters", "=", "None", ",", "features", "=", "None", ",", "label", "=", "None", ",", "initial_centers", "=", "None", ",", "max_iterations", "=", "10", ",", "batch_size", "=", "None", ",", "verbose", "=", "True"...
Create a k-means clustering model. The KmeansModel object contains the computed cluster centers and the cluster assignment for each instance in the input 'dataset'. Given a number of clusters, k-means iteratively chooses the best cluster centers and assigns nearby points to the best cluster. If no poin...
[ "Create", "a", "k", "-", "means", "clustering", "model", ".", "The", "KmeansModel", "object", "contains", "the", "computed", "cluster", "centers", "and", "the", "cluster", "assignment", "for", "each", "instance", "in", "the", "input", "dataset", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/clustering/kmeans.py#L410-L602
29,493
apple/turicreate
src/unity/python/turicreate/toolkits/clustering/kmeans.py
KmeansModel.predict
def predict(self, dataset, output_type='cluster_id', verbose=True): """ Return predicted cluster label for instances in the new 'dataset'. K-means predictions are made by assigning each new instance to the closest cluster center. Parameters ---------- dataset : S...
python
def predict(self, dataset, output_type='cluster_id', verbose=True): """ Return predicted cluster label for instances in the new 'dataset'. K-means predictions are made by assigning each new instance to the closest cluster center. Parameters ---------- dataset : S...
[ "def", "predict", "(", "self", ",", "dataset", ",", "output_type", "=", "'cluster_id'", ",", "verbose", "=", "True", ")", ":", "## Validate the input dataset.", "_tkutl", ".", "_raise_error_if_not_sframe", "(", "dataset", ",", "\"dataset\"", ")", "_tkutl", ".", ...
Return predicted cluster label for instances in the new 'dataset'. K-means predictions are made by assigning each new instance to the closest cluster center. Parameters ---------- dataset : SFrame Dataset of new observations. Must include the features used for ...
[ "Return", "predicted", "cluster", "label", "for", "instances", "in", "the", "new", "dataset", ".", "K", "-", "means", "predictions", "are", "made", "by", "assigning", "each", "new", "instance", "to", "the", "closest", "cluster", "center", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/clustering/kmeans.py#L208-L287
29,494
apple/turicreate
src/unity/python/turicreate/toolkits/clustering/kmeans.py
KmeansModel._get
def _get(self, field): """ Return the value of a given field. +-----------------------+----------------------------------------------+ | Field | Description | +=======================+==============================================...
python
def _get(self, field): """ Return the value of a given field. +-----------------------+----------------------------------------------+ | Field | Description | +=======================+==============================================...
[ "def", "_get", "(", "self", ",", "field", ")", ":", "opts", "=", "{", "'model'", ":", "self", ".", "__proxy__", ",", "'model_name'", ":", "self", ".", "__name__", ",", "'field'", ":", "field", "}", "response", "=", "_tc", ".", "extensions", ".", "_km...
Return the value of a given field. +-----------------------+----------------------------------------------+ | Field | Description | +=======================+==============================================+ | batch_size | Number ...
[ "Return", "the", "value", "of", "a", "given", "field", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/clustering/kmeans.py#L289-L345
29,495
apple/turicreate
src/unity/python/turicreate/toolkits/text_analytics/_util.py
count_words
def count_words(text, to_lower=True, delimiters=DEFAULT_DELIMITERS): """ If `text` is an SArray of strings or an SArray of lists of strings, the occurances of word are counted for each row in the SArray. If `text` is an SArray of dictionaries, the keys are tokenized and the values are the counts. C...
python
def count_words(text, to_lower=True, delimiters=DEFAULT_DELIMITERS): """ If `text` is an SArray of strings or an SArray of lists of strings, the occurances of word are counted for each row in the SArray. If `text` is an SArray of dictionaries, the keys are tokenized and the values are the counts. C...
[ "def", "count_words", "(", "text", ",", "to_lower", "=", "True", ",", "delimiters", "=", "DEFAULT_DELIMITERS", ")", ":", "_raise_error_if_not_sarray", "(", "text", ",", "\"text\"", ")", "## Compute word counts", "sf", "=", "_turicreate", ".", "SFrame", "(", "{",...
If `text` is an SArray of strings or an SArray of lists of strings, the occurances of word are counted for each row in the SArray. If `text` is an SArray of dictionaries, the keys are tokenized and the values are the counts. Counts for the same word, in the same row, are added together. This outpu...
[ "If", "text", "is", "an", "SArray", "of", "strings", "or", "an", "SArray", "of", "lists", "of", "strings", "the", "occurances", "of", "word", "are", "counted", "for", "each", "row", "in", "the", "SArray", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/text_analytics/_util.py#L24-L117
29,496
apple/turicreate
src/unity/python/turicreate/toolkits/text_analytics/_util.py
count_ngrams
def count_ngrams(text, n=2, method="word", to_lower=True, delimiters=DEFAULT_DELIMITERS, ignore_punct=True, ignore_space=True): """ Return an SArray of ``dict`` type where each element contains the count for each of the n-grams that appear in the corresponding input element...
python
def count_ngrams(text, n=2, method="word", to_lower=True, delimiters=DEFAULT_DELIMITERS, ignore_punct=True, ignore_space=True): """ Return an SArray of ``dict`` type where each element contains the count for each of the n-grams that appear in the corresponding input element...
[ "def", "count_ngrams", "(", "text", ",", "n", "=", "2", ",", "method", "=", "\"word\"", ",", "to_lower", "=", "True", ",", "delimiters", "=", "DEFAULT_DELIMITERS", ",", "ignore_punct", "=", "True", ",", "ignore_space", "=", "True", ")", ":", "_raise_error_...
Return an SArray of ``dict`` type where each element contains the count for each of the n-grams that appear in the corresponding input element. The n-grams can be specified to be either character n-grams or word n-grams. The input SArray could contain strings, dicts with string keys and numeric values,...
[ "Return", "an", "SArray", "of", "dict", "type", "where", "each", "element", "contains", "the", "count", "for", "each", "of", "the", "n", "-", "grams", "that", "appear", "in", "the", "corresponding", "input", "element", ".", "The", "n", "-", "grams", "can...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/text_analytics/_util.py#L119-L243
29,497
apple/turicreate
src/unity/python/turicreate/toolkits/text_analytics/_util.py
tf_idf
def tf_idf(text): """ Compute the TF-IDF scores for each word in each document. The collection of documents must be in bag-of-words format. .. math:: \mbox{TF-IDF}(w, d) = tf(w, d) * log(N / f(w)) where :math:`tf(w, d)` is the number of times word :math:`w` appeared in document :math:`...
python
def tf_idf(text): """ Compute the TF-IDF scores for each word in each document. The collection of documents must be in bag-of-words format. .. math:: \mbox{TF-IDF}(w, d) = tf(w, d) * log(N / f(w)) where :math:`tf(w, d)` is the number of times word :math:`w` appeared in document :math:`...
[ "def", "tf_idf", "(", "text", ")", ":", "_raise_error_if_not_sarray", "(", "text", ",", "\"text\"", ")", "if", "len", "(", "text", ")", "==", "0", ":", "return", "_turicreate", ".", "SArray", "(", ")", "dataset", "=", "_turicreate", ".", "SFrame", "(", ...
Compute the TF-IDF scores for each word in each document. The collection of documents must be in bag-of-words format. .. math:: \mbox{TF-IDF}(w, d) = tf(w, d) * log(N / f(w)) where :math:`tf(w, d)` is the number of times word :math:`w` appeared in document :math:`d`, :math:`f(w)` is the number...
[ "Compute", "the", "TF", "-", "IDF", "scores", "for", "each", "word", "in", "each", "document", ".", "The", "collection", "of", "documents", "must", "be", "in", "bag", "-", "of", "-", "words", "format", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/text_analytics/_util.py#L246-L295
29,498
apple/turicreate
src/unity/python/turicreate/toolkits/text_analytics/_util.py
drop_words
def drop_words(text, threshold=2, to_lower=True, delimiters=DEFAULT_DELIMITERS, stop_words=None): ''' Remove words that occur below a certain number of times in an SArray. This is a common method of cleaning text before it is used, and can increase the quality and explainability of the mo...
python
def drop_words(text, threshold=2, to_lower=True, delimiters=DEFAULT_DELIMITERS, stop_words=None): ''' Remove words that occur below a certain number of times in an SArray. This is a common method of cleaning text before it is used, and can increase the quality and explainability of the mo...
[ "def", "drop_words", "(", "text", ",", "threshold", "=", "2", ",", "to_lower", "=", "True", ",", "delimiters", "=", "DEFAULT_DELIMITERS", ",", "stop_words", "=", "None", ")", ":", "_raise_error_if_not_sarray", "(", "text", ",", "\"text\"", ")", "## Compute wor...
Remove words that occur below a certain number of times in an SArray. This is a common method of cleaning text before it is used, and can increase the quality and explainability of the models learned on the transformed data. RareWordTrimmer can be applied to all the string-, dictionary-, and list-typed ...
[ "Remove", "words", "that", "occur", "below", "a", "certain", "number", "of", "times", "in", "an", "SArray", ".", "This", "is", "a", "common", "method", "of", "cleaning", "text", "before", "it", "is", "used", "and", "can", "increase", "the", "quality", "a...
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/text_analytics/_util.py#L298-L410
29,499
apple/turicreate
src/unity/python/turicreate/toolkits/text_analytics/_util.py
tokenize
def tokenize(text, to_lower=False, delimiters=DEFAULT_DELIMITERS): """ Tokenize the input SArray of text strings and return the list of tokens. Parameters ---------- text : SArray[str] Input data of strings representing English text. This tokenizer is not intended to process XML, HT...
python
def tokenize(text, to_lower=False, delimiters=DEFAULT_DELIMITERS): """ Tokenize the input SArray of text strings and return the list of tokens. Parameters ---------- text : SArray[str] Input data of strings representing English text. This tokenizer is not intended to process XML, HT...
[ "def", "tokenize", "(", "text", ",", "to_lower", "=", "False", ",", "delimiters", "=", "DEFAULT_DELIMITERS", ")", ":", "_raise_error_if_not_sarray", "(", "text", ",", "\"text\"", ")", "## Compute word counts", "sf", "=", "_turicreate", ".", "SFrame", "(", "{", ...
Tokenize the input SArray of text strings and return the list of tokens. Parameters ---------- text : SArray[str] Input data of strings representing English text. This tokenizer is not intended to process XML, HTML, or other structured text formats. to_lower : bool, optional If...
[ "Tokenize", "the", "input", "SArray", "of", "text", "strings", "and", "return", "the", "list", "of", "tokens", "." ]
74514c3f99e25b46f22c6e02977fe3da69221c2e
https://github.com/apple/turicreate/blob/74514c3f99e25b46f22c6e02977fe3da69221c2e/src/unity/python/turicreate/toolkits/text_analytics/_util.py#L412-L478