INSTRUCTION
stringlengths
1
8.43k
RESPONSE
stringlengths
75
104k
This tells the XML Reader to preserve the current node. The caller must also use xmlTextReaderCurrentDoc () to keep an handle on the resulting document once parsing has finished
def Preserve(self): """This tells the XML Reader to preserve the current node. The caller must also use xmlTextReaderCurrentDoc() to keep an handle on the resulting document once parsing has finished """ ret = libxml2mod.xmlTextReaderPreserve(self._o) if ret is None:raise tr...
Use RelaxNG to validate the document as it is processed. Activation is only possible before the first Read (). if
def RelaxNGSetSchema(self, schema): """Use RelaxNG to validate the document as it is processed. Activation is only possible before the first Read(). if @schema is None, then RelaxNG validation is desactivated. @ The @schema should not be freed until the reader is dealloc...
Use RelaxNG schema to validate the document as it is processed. Activation is only possible before the first Read (). If
def RelaxNGValidate(self, rng): """Use RelaxNG schema to validate the document as it is processed. Activation is only possible before the first Read(). If @rng is None, then RelaxNG schema validation is deactivated. """ ret = libxml2mod.xmlTextReaderRelaxNGValidate(self._o...
Use RelaxNG schema context to validate the document as it is processed. Activation is only possible before the first Read (). If
def RelaxNGValidateCtxt(self, ctxt, options): """Use RelaxNG schema context to validate the document as it is processed. Activation is only possible before the first Read(). If @ctxt is None, then RelaxNG schema validation is deactivated. """ if ctxt is None: ctxt__o = Non...
Use W3C XSD schema to validate the document as it is processed. Activation is only possible before the first Read (). If
def SchemaValidate(self, xsd): """Use W3C XSD schema to validate the document as it is processed. Activation is only possible before the first Read(). If @xsd is None, then XML Schema validation is deactivated. """ ret = libxml2mod.xmlTextReaderSchemaValidate(self._o, xsd)...
Use W3C XSD schema context to validate the document as it is processed. Activation is only possible before the first Read (). If
def SchemaValidateCtxt(self, ctxt, options): """Use W3C XSD schema context to validate the document as it is processed. Activation is only possible before the first Read(). If @ctxt is None, then XML Schema validation is deactivated. """ if ctxt is None: ctxt__o = None ...
Change the parser processing behaviour by changing some of its internal properties. Note that some properties can only be changed before any read has been done.
def SetParserProp(self, prop, value): """Change the parser processing behaviour by changing some of its internal properties. Note that some properties can only be changed before any read has been done. """ ret = libxml2mod.xmlTextReaderSetParserProp(self._o, prop, value) ret...
Use XSD Schema to validate the document as it is processed. Activation is only possible before the first Read (). if
def SetSchema(self, schema): """Use XSD Schema to validate the document as it is processed. Activation is only possible before the first Read(). if @schema is None, then Schema validation is desactivated. @ The @schema should not be freed until the reader is deallocated ...
Setup an XML reader with new options
def Setup(self, input, URL, encoding, options): """Setup an XML reader with new options """ if input is None: input__o = None else: input__o = input._o ret = libxml2mod.xmlTextReaderSetup(self._o, input__o, URL, encoding, options) return ret
Get an interned string from the reader allows for example to speedup string name comparisons
def String(self, str): """Get an interned string from the reader, allows for example to speedup string name comparisons """ ret = libxml2mod.xmlTextReaderConstString(self._o, str) return ret
Parse an URI reference string based on RFC 3986 and fills in the appropriate fields of the
def parseURIReference(self, str): """Parse an URI reference string based on RFC 3986 and fills in the appropriate fields of the @uri structure URI-reference = URI / relative-ref """ ret = libxml2mod.xmlParseURIReference(self._o, str) return ret
Does the validation related extra step of the normalization of attribute values: If the declared value is not CDATA then the XML processor must further process the normalized attribute value by discarding any leading and trailing space ( #x20 ) characters and by replacing sequences of space ( #x20 ) characters by singl...
def validCtxtNormalizeAttributeValue(self, doc, elem, name, value): """Does the validation related extra step of the normalization of attribute values: If the declared value is not CDATA, then the XML processor must further process the normalized attribute value by discarding any ...
Try to validate the document instance basically it does the all the checks described by the XML Rec i. e. validates the internal and external subset ( if present ) and validate the document tree.
def validateDocument(self, doc): """Try to validate the document instance basically it does the all the checks described by the XML Rec i.e. validates the internal and external subset (if present) and validate the document tree. """ if doc is None: doc__o = None e...
Does the final step for the document validation once all the incremental validation steps have been completed basically it does the following checks described by the XML Rec Check all the IDREF/ IDREFS attributes definition for validity
def validateDocumentFinal(self, doc): """Does the final step for the document validation once all the incremental validation steps have been completed basically it does the following checks described by the XML Rec Check all the IDREF/IDREFS attributes definition for va...
Try to validate the document against the dtd instance Basically it does check all the definitions in the DtD. Note the the internal subset ( if present ) is de - coupled ( i. e. not used ) which could give problems if ID or IDREF is present.
def validateDtd(self, doc, dtd): """Try to validate the document against the dtd instance Basically it does check all the definitions in the DtD. Note the the internal subset (if present) is de-coupled (i.e. not used), which could give problems if ID or IDREF is present....
Does the final step for the dtds validation once all the subsets have been parsed basically it does the following checks described by the XML Rec - check that ENTITY and ENTITIES type attributes default or possible values matches one of the defined entities. - check that NOTATION type attributes default or possible val...
def validateDtdFinal(self, doc): """Does the final step for the dtds validation once all the subsets have been parsed basically it does the following checks described by the XML Rec - check that ENTITY and ENTITIES type attributes default or possible values matches one o...
Try to validate the subtree under an element
def validateElement(self, doc, elem): """Try to validate the subtree under an element """ if doc is None: doc__o = None else: doc__o = doc._o if elem is None: elem__o = None else: elem__o = elem._o ret = libxml2mod.xmlValidateElement(self._o, doc__o, elem__o) retu...
Validate that the given name match a notation declaration. - [ VC: Notation Declared ]
def validateNotationUse(self, doc, notationName): """Validate that the given name match a notation declaration. - [ VC: Notation Declared ] """ if doc is None: doc__o = None else: doc__o = doc._o ret = libxml2mod.xmlValidateNotationUse(self._o, doc__o, notationName) re...
Try to validate a single attribute for an element basically it does the following checks as described by the XML - 1. 0 recommendation: - [ VC: Attribute Value Type ] - [ VC: Fixed Attribute Default ] - [ VC: Entity Name ] - [ VC: Name Token ] - [ VC: ID ] - [ VC: IDREF ] - [ VC: Entity Name ] - [ VC: Notation Attribut...
def validateOneAttribute(self, doc, elem, attr, value): """Try to validate a single attribute for an element basically it does the following checks as described by the XML-1.0 recommendation: - [ VC: Attribute Value Type ] - [ VC: Fixed Attribute Default ] - [ VC: Entity Name ] - [...
Try to validate a single element and it s attributes basically it does the following checks as described by the XML - 1. 0 recommendation: - [ VC: Element Valid ] - [ VC: Required Attribute ] Then call xmlValidateOneAttribute () for each attribute present. The ID/ IDREF checkings are done separately
def validateOneElement(self, doc, elem): """Try to validate a single element and it's attributes, basically it does the following checks as described by the XML-1.0 recommendation: - [ VC: Element Valid ] - [ VC: Required Attribute ] Then call xmlValidateOneAttribute() fo...
Try to validate a single namespace declaration for an element basically it does the following checks as described by the XML - 1. 0 recommendation: - [ VC: Attribute Value Type ] - [ VC: Fixed Attribute Default ] - [ VC: Entity Name ] - [ VC: Name Token ] - [ VC: ID ] - [ VC: IDREF ] - [ VC: Entity Name ] - [ VC: Notat...
def validateOneNamespace(self, doc, elem, prefix, ns, value): """Try to validate a single namespace declaration for an element basically it does the following checks as described by the XML-1.0 recommendation: - [ VC: Attribute Value Type ] - [ VC: Fixed Attribute Default ] - [ VC:...
Pop the element end from the validation stack.
def validatePopElement(self, doc, elem, qname): """Pop the element end from the validation stack. """ if doc is None: doc__o = None else: doc__o = doc._o if elem is None: elem__o = None else: elem__o = elem._o ret = libxml2mod.xmlValidatePopElement(self._o, doc__o, elem__...
check the CData parsed for validation in the current stack
def validatePushCData(self, data, len): """check the CData parsed for validation in the current stack """ ret = libxml2mod.xmlValidatePushCData(self._o, data, len) return ret
Push a new element start on the validation stack.
def validatePushElement(self, doc, elem, qname): """Push a new element start on the validation stack. """ if doc is None: doc__o = None else: doc__o = doc._o if elem is None: elem__o = None else: elem__o = elem._o ret = libxml2mod.xmlValidatePushElement(self._o, doc__o, e...
Try to validate a the root element basically it does the following check as described by the XML - 1. 0 recommendation: - [ VC: Root Element Type ] it doesn t try to recurse or apply other check to the element
def validateRoot(self, doc): """Try to validate a the root element basically it does the following check as described by the XML-1.0 recommendation: - [ VC: Root Element Type ] it doesn't try to recurse or apply other check to the element """ if doc is None: doc__o = None ...
Get the doc from an xpathContext
def contextDoc(self): """Get the doc from an xpathContext """ ret = libxml2mod.xmlXPathGetContextDoc(self._o) if ret is None:raise xpathError('xmlXPathGetContextDoc() failed') __tmp = xmlDoc(_obj=ret) return __tmp
Get the current node from an xpathContext
def contextNode(self): """Get the current node from an xpathContext """ ret = libxml2mod.xmlXPathGetContextNode(self._o) if ret is None:raise xpathError('xmlXPathGetContextNode() failed') __tmp = xmlNode(_obj=ret) return __tmp
Set the doc of an xpathContext
def setContextDoc(self, doc): """Set the doc of an xpathContext """ if doc is None: doc__o = None else: doc__o = doc._o libxml2mod.xmlXPathSetContextDoc(self._o, doc__o)
Set the current node of an xpathContext
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)
Register a Python written function to the XPath interpreter
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
Register a variable with the XPath context
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
Creates/ frees an object cache on the XPath context. If activates XPath objects ( xmlXPathObject ) will be cached internally to be reused.
def xpathContextSetCache(self, active, value, options): """Creates/frees an object cache on the XPath context. If activates XPath objects (xmlXPathObject) will be cached internally to be reused. @options: 0: This will set the XPath object caching: @value: This will set the maximum ...
Evaluate the XPath Location Path in the given context.
def xpathEval(self, str): """Evaluate the XPath Location Path in the given context. """ ret = libxml2mod.xmlXPathEval(str, self._o) if ret is None:raise xpathError('xmlXPathEval() failed') return xpathObjectRet(ret)
Evaluate the XPath expression in the given context.
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)
Create a new xmlXPathParserContext
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
Search in the namespace declaration array of the context for the given namespace name associated to the given prefix
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
Register a new namespace. If
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
Search in the Variable array of the context for the given variable value.
def xpathVariableLookup(self, name): """Search in the Variable array of the context for the given variable value. """ ret = libxml2mod.xmlXPathVariableLookup(self._o, name) if ret is None:raise xpathError('xmlXPathVariableLookup() failed') return xpathObjectRet(ret)
Search in the Variable array of the context for the given variable value.
def xpathVariableLookupNS(self, name, ns_uri): """Search in the Variable array of the context for the given variable value. """ ret = libxml2mod.xmlXPathVariableLookupNS(self._o, name, ns_uri) if ret is None:raise xpathError('xmlXPathVariableLookupNS() failed') return xpathObj...
Evaluate the XPath Location Path in the given context.
def xpointerEval(self, str): """Evaluate the XPath Location Path in the given context. """ ret = libxml2mod.xmlXPtrEval(str, self._o) if ret is None:raise treeError('xmlXPtrEval() failed') return xpathObjectRet(ret)
Get the xpathContext from an xpathParserContext
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
Implement the compare operation on XPath objects:
def xpathCompareValues(self, inf, strict): """Implement the compare operation on XPath objects: @arg1 < @arg2 (1, 1, ... @arg1 <= @arg2 (1, 0, ... @arg1 > @arg2 (0, 1, ... @arg1 >= @arg2 (0, 0, ... When neither object to be compared is a node-set and the operat...
Traversal function for the ancestor direction the ancestor axis contains the ancestors of the context node ; the ancestors of the context node consist of the parent of context node and the parent s parent and so on ; the nodes are ordered in reverse document order ; thus the parent is the first node on the axis and the...
def xpathNextAncestor(self, cur): """Traversal function for the "ancestor" direction the ancestor axis contains the ancestors of the context node; the ancestors of the context node consist of the parent of context node and the parent's parent and so on; the nodes are orde...
Traversal function for the ancestor - or - self direction he ancestor - or - self axis contains the context node and ancestors of the context node in reverse document order ; thus the context node is the first node on the axis and the context node s parent the second ; parent here is defined the same as with the parent...
def xpathNextAncestorOrSelf(self, cur): """Traversal function for the "ancestor-or-self" direction he ancestor-or-self axis contains the context node and ancestors of the context node in reverse document order; thus the context node is the first node on the axis, and the ...
Traversal function for the attribute direction TODO: support DTD inherited default attributes
def xpathNextAttribute(self, cur): """Traversal function for the "attribute" direction TODO: support DTD inherited default attributes """ if cur is None: cur__o = None else: cur__o = cur._o ret = libxml2mod.xmlXPathNextAttribute(self._o, cur__o) if ret is None:raise xp...
Traversal function for the child direction The child axis contains the children of the context node in document order.
def xpathNextChild(self, cur): """Traversal function for the "child" direction The child axis contains the children of the context node in document order. """ if cur is None: cur__o = None else: cur__o = cur._o ret = libxml2mod.xmlXPathNextChild(self._o, cur__o) if ret ...
Traversal function for the descendant direction the descendant axis contains the descendants of the context node in document order ; a descendant is a child or a child of a child and so on.
def xpathNextDescendant(self, cur): """Traversal function for the "descendant" direction the descendant axis contains the descendants of the context node in document order; a descendant is a child or a child of a child and so on. """ if cur is None: cur__o = None e...
Traversal function for the descendant - or - self direction the descendant - or - self axis contains the context node and the descendants of the context node in document order ; thus the context node is the first node on the axis and the first child of the context node is the second node on the axis
def xpathNextDescendantOrSelf(self, cur): """Traversal function for the "descendant-or-self" direction the descendant-or-self axis contains the context node and the descendants of the context node in document order; thus the context node is the first node on the axis, and the ...
Traversal function for the following direction The following axis contains all nodes in the same document as the context node that are after the context node in document order excluding any descendants and excluding attribute nodes and namespace nodes ; the nodes are ordered in document order
def xpathNextFollowing(self, cur): """Traversal function for the "following" direction The following axis contains all nodes in the same document as the context node that are after the context node in document order, excluding any descendants and excluding attribute nodes...
Traversal function for the following - sibling direction The following - sibling axis contains the following siblings of the context node in document order.
def xpathNextFollowingSibling(self, cur): """Traversal function for the "following-sibling" direction The following-sibling axis contains the following siblings of the context node in document order. """ if cur is None: cur__o = None else: cur__o = cur._o ret = libxm...
Traversal function for the namespace direction the namespace axis contains the namespace nodes of the context node ; the order of nodes on this axis is implementation - defined ; the axis will be empty unless the context node is an element We keep the XML namespace node at the end of the list.
def xpathNextNamespace(self, cur): """Traversal function for the "namespace" direction the namespace axis contains the namespace nodes of the context node; the order of nodes on this axis is implementation-defined; the axis will be empty unless the context node is an elem...
Traversal function for the parent direction The parent axis contains the parent of the context node if there is one.
def xpathNextParent(self, cur): """Traversal function for the "parent" direction The parent axis contains the parent of the context node, if there is one. """ if cur is None: cur__o = None else: cur__o = cur._o ret = libxml2mod.xmlXPathNextParent(self._o, cur__o) ...
Traversal function for the preceding direction the preceding axis contains all nodes in the same document as the context node that are before the context node in document order excluding any ancestors and excluding attribute nodes and namespace nodes ; the nodes are ordered in reverse document order
def xpathNextPreceding(self, cur): """Traversal function for the "preceding" direction the preceding axis contains all nodes in the same document as the context node that are before the context node in document order, excluding any ancestors and excluding attribute nodes ...
Traversal function for the preceding - sibling direction The preceding - sibling axis contains the preceding siblings of the context node in reverse document order ; the first preceding sibling is first on the axis ; the sibling preceding that node is the second on the axis and so on.
def xpathNextPrecedingSibling(self, cur): """Traversal function for the "preceding-sibling" direction The preceding-sibling axis contains the preceding siblings of the context node in reverse document order; the first preceding sibling is first on the axis; the sibling p...
Traversal function for the self direction The self axis contains just the context node itself
def xpathNextSelf(self, cur): """Traversal function for the "self" direction The self axis contains just the context node itself """ if cur is None: cur__o = None else: cur__o = cur._o ret = libxml2mod.xmlXPathNextSelf(self._o, cur__o) if ret is None:raise xpathError('...
Formats an error message.
def xpatherror(self, file, line, no): """Formats an error message. """ libxml2mod.xmlXPatherror(self._o, file, line, no)
Returns a structured description of the model including ( where relevant ) the schema of the training data description of the training data training statistics and model hyperparameters.
def _get_summary_struct(self): """ Returns a structured description of the model, including (where relevant) the schema of the training data, description of the training data, training statistics, and model hyperparameters. Returns ------- sections : list (of lis...
Return a classification for each example in the dataset using the trained logistic regression model. The output SFrame contains predictions as both class labels ( 0 or 1 ) as well as probabilities that the predicted value is the associated label.
def classify(self, dataset, missing_value_action='auto'): """ Return a classification, for each example in the ``dataset``, using the trained logistic regression model. The output SFrame contains predictions as both class labels (0 or 1) as well as probabilities that the predicted ...
Appends the suffix appropriate to type/ property - set combination to the specified name and returns the result.
def add_prefix_and_suffix(specified_name, type, property_set): """Appends the suffix appropriate to 'type/property-set' combination to the specified name and returns the result.""" property_set = b2.util.jam_to_value_maybe(property_set) suffix = "" if type: suffix = b2.build.type.generated...
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 traversed.
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 ...
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.
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...
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 registered and returned.
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...
Creates a virtual target with appropriate name and type from file. If a target with that name in that project was already created returns that already created target. TODO: more correct way would be to compute path to the file based on name and source location for the project and use that path to determine if the targe...
def from_file (self, file, file_location, project): """ Creates a virtual target with appropriate name and type from 'file'. If a target with that name in that project was already created, returns that already created target. TODO: more correct way would be to compute path to...
Appends the suffix appropriate to type/ property_set combination to the specified name and returns the result.
def add_suffix (self, specified_name, file_type, prop_set): """ Appends the suffix appropriate to 'type/property_set' combination to the specified name and returns the result. """ assert isinstance(specified_name, basestring) assert isinstance(file_type, basestring) a...
Adds additional instances of VirtualTarget that this one depends on.
def depends (self, d): """ Adds additional instances of 'VirtualTarget' that this one depends on. """ self.dependencies_ = unique (self.dependencies_ + d).sort ()
Generates all the actual targets and sets up build actions for this target.
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...
Sets the path. When generating target name it will override any path computation from properties.
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)
Sets/ gets the root flag. Target is root is it directly correspods to some variant of a main target.
def root (self, set = None): """ Sets/gets the 'root' flag. Target is root is it directly correspods to some variant of a main target. """ assert isinstance(set, (int, bool, type(None))) if set: self.root_ = True return self.root_
Gets or sets the subvariant which created this target. Subvariant is set when target is brought into existance and is never changed after that. In particual if target is shared by subvariant only the first is stored. s: If specified specified the value to set which should be instance of subvariant class.
def creating_subvariant (self, s = None): """ Gets or sets the subvariant which created this target. Subvariant is set when target is brought into existance, and is never changed after that. In particual, if target is shared by subvariant, only the first is stored. s: If specifi...
Helper to actual_name above. Compute unique prefix used to distinguish this target from other targets with the same name which create different file.
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...
Given the target name specified in constructor returns the name which should be really used by looking at the <tag > properties. The tag properties come in two flavour: - <tag > value - <tag >
def __adjust_name(self, specified_name): """Given the target name specified in constructor, returns the name which should be really used, by looking at the <tag> properties. The tag properties come in two flavour: - <tag>value, - <tag>@rule-name In the first case, val...
Returns the directory for this target.
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: # ...
Generates actual build instructions.
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 (): ...
Helper for actualize_sources. For each passed source actualizes it with the appropriate scanner. Returns the actualized virtual targets.
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...
Creates actual jam targets for sources. Initializes two member variables: self. actual_sources_ -- sources which are passed to updating action self. dependency_only_sources_ -- sources which are made dependencies but are not used otherwise.
def actualize_sources (self, sources, prop_set): """ Creates actual jam targets for sources. Initializes two member variables: 'self.actual_sources_' -- sources which are passed to updating action 'self.dependency_only_sources_' -- sources which are made dependencies, but ...
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.
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__: ...
Returns the properties which specify implicit include paths to generated headers. This traverses all targets in this subvariant and subvariants referred by <implcit - dependecy > properties. For all targets which are of type target - type ( or for all targets if target_type is not specified ) the result will contain <$...
def implicit_includes (self, feature, target_type): """ Returns the properties which specify implicit include paths to generated headers. This traverses all targets in this subvariant, and subvariants referred by <implcit-dependecy>properties. For all targets which are of typ...
Compare if two nodes are equal.
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, ...
Creates additional files for the individual MPL - containers.
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: ...
Creates additional source - and header - files for the numbered sequence MPL - containers.
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...
Adjusts the limits of variadic sequence MPL - containers.
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...
Returns the ( relative ) path to the Boost source - directory this file is located in ( if any ).
def current_boost_dir(): """Returns the (relative) path to the Boost source-directory this file is located in (if any).""" # Path to directory containing this script. path = os.path.dirname( os.path.realpath(__file__) ) # Making sure it is located in "${boost-dir}/libs/mpl/preprocessed". for directo...
Converts a string into its encoded positive integer ( greater zero ) or throws an exception.
def to_positive_multiple_of_10(string): """Converts a string into its encoded positive integer (greater zero) or throws an exception.""" try: value = int(string) except ValueError: msg = '"%r" is not a positive multiple of 10 (greater zero).' % string raise argparse.ArgumentTypeError...
The main function.
def main(): """The main function.""" # Find the current Boost source-directory in which this script is located. sourceDir = current_boost_dir() if sourceDir == None: sourceDir = "" # Prepare and run cmdline-parser. cmdlineParser = argparse.ArgumentParser(description="A generato...
Add an inner product layer to the model.
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...
Add a convolution layer to the network.
def add_convolution(self, name, kernel_channels, output_channels, height, width, stride_height, stride_width, border_mode, groups, W, b, has_bias, is_deconv = False, output_shape = None, input_name = 'data', output_name = 'out', dilation_factors = [1,1], paddi...
Add resize bilinear layer to the model. A layer that resizes the input to a given spatial size using bilinear interpolation.
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 ...
Add crop resize layer to the model. A layer that extracts cropped spatial patches or RoIs ( regions of interest ) from the input and resizes them to a pre - specified size using bilinear interpolation. Note that RoI Align layer can be implemented with this layer followed by a pooling layer. Kindly refer to NeuralNetwor...
def add_crop_resize(self, name, input_names, output_name, target_height=1, target_width=1, mode='STRICT_ALIGN_ENDPOINTS_MODE', normalized_roi=False, box_indices_mode='CORNERS_HEIGHT_FIRST', spatial_scale=1.0)...
Serialize model summary into a dict with ordered lists of sections and section titles
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...
Format a doc - string on the fly. @arg format_dict: A dictionary to format the doc - strings Example:
def _add_docstring(format_dict): """ Format a doc-string on the fly. @arg format_dict: A dictionary to format the doc-strings Example: @add_docstring({'context': __doc_string_context}) def predict(x): ''' {context} >> model.predict(data) '...
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.
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...
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.
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, ...
Finds the only column that can be interpreted as a drawing feature column. A drawing column can be a stroke - based drawing column ( with dtype list ) or a bitmap - based drawing column ( with dtype turicreate. Image ) If there are zero or more than one drawing columns an exception will be raised.
def _find_only_drawing_column(sframe): """ Finds the only column that can be interpreted as a drawing feature column. A drawing column can be a stroke-based drawing column (with dtype list) or a bitmap-based drawing column (with dtype turicreate.Image) If there are zero or more than one drawing...
Convert the Json Tree to SGraph
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 = [...
Return a tuple of sections and section titles. Sections are pretty print of model 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 ------- ...
Returns a tuple of the top k values from the positive and negative values in a SArray
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 -...
Extract a model summary field 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: ...
Serializes an SFrame to a list of strings that when printed creates a well - formatted table.
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...
Display a toolkit repr according to some simple rules.
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 ...
Map returning value if it is unity SFrame SArray map it
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: ...