repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
DOM.getElementById
def getElementById(self, node, id, default=join): """Return the first child of node matching an id reference.""" attrget = self.getAttr ELEMENT_NODE = node.ELEMENT_NODE for child in node.childNodes: if child.nodeType == ELEMENT_NODE: if attrget(child, 'id') ==...
python
def getElementById(self, node, id, default=join): """Return the first child of node matching an id reference.""" attrget = self.getAttr ELEMENT_NODE = node.ELEMENT_NODE for child in node.childNodes: if child.nodeType == ELEMENT_NODE: if attrget(child, 'id') ==...
[ "def", "getElementById", "(", "self", ",", "node", ",", "id", ",", "default", "=", "join", ")", ":", "attrget", "=", "self", ".", "getAttr", "ELEMENT_NODE", "=", "node", ".", "ELEMENT_NODE", "for", "child", "in", "node", ".", "childNodes", ":", "if", "...
Return the first child of node matching an id reference.
[ "Return", "the", "first", "child", "of", "node", "matching", "an", "id", "reference", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L433-L443
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
DOM.getMappingById
def getMappingById(self, document, depth=None, element=None, mapping=None, level=1): """Create an id -> element mapping of those elements within a document that define an id attribute. The depth of the search may be controlled by using the (1-based) depth argument.""...
python
def getMappingById(self, document, depth=None, element=None, mapping=None, level=1): """Create an id -> element mapping of those elements within a document that define an id attribute. The depth of the search may be controlled by using the (1-based) depth argument.""...
[ "def", "getMappingById", "(", "self", ",", "document", ",", "depth", "=", "None", ",", "element", "=", "None", ",", "mapping", "=", "None", ",", "level", "=", "1", ")", ":", "if", "document", "is", "not", "None", ":", "element", "=", "document", ".",...
Create an id -> element mapping of those elements within a document that define an id attribute. The depth of the search may be controlled by using the (1-based) depth argument.
[ "Create", "an", "id", "-", ">", "element", "mapping", "of", "those", "elements", "within", "a", "document", "that", "define", "an", "id", "attribute", ".", "The", "depth", "of", "the", "search", "may", "be", "controlled", "by", "using", "the", "(", "1", ...
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L445-L462
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
DOM.getElements
def getElements(self, node, name, nsuri=None): """Return a sequence of the child elements of the given node that match the given name and optional namespace uri.""" nsmatch = self.nsUriMatch result = [] ELEMENT_NODE = node.ELEMENT_NODE for child in node.childNodes: ...
python
def getElements(self, node, name, nsuri=None): """Return a sequence of the child elements of the given node that match the given name and optional namespace uri.""" nsmatch = self.nsUriMatch result = [] ELEMENT_NODE = node.ELEMENT_NODE for child in node.childNodes: ...
[ "def", "getElements", "(", "self", ",", "node", ",", "name", ",", "nsuri", "=", "None", ")", ":", "nsmatch", "=", "self", ".", "nsUriMatch", "result", "=", "[", "]", "ELEMENT_NODE", "=", "node", ".", "ELEMENT_NODE", "for", "child", "in", "node", ".", ...
Return a sequence of the child elements of the given node that match the given name and optional namespace uri.
[ "Return", "a", "sequence", "of", "the", "child", "elements", "of", "the", "given", "node", "that", "match", "the", "given", "name", "and", "optional", "namespace", "uri", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L464-L475
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
DOM.hasAttr
def hasAttr(self, node, name, nsuri=None): """Return true if element has attribute with the given name and optional nsuri. If nsuri is not specified, returns true if an attribute exists with the given name with any namespace.""" if nsuri is None: if node.hasAttribute(na...
python
def hasAttr(self, node, name, nsuri=None): """Return true if element has attribute with the given name and optional nsuri. If nsuri is not specified, returns true if an attribute exists with the given name with any namespace.""" if nsuri is None: if node.hasAttribute(na...
[ "def", "hasAttr", "(", "self", ",", "node", ",", "name", ",", "nsuri", "=", "None", ")", ":", "if", "nsuri", "is", "None", ":", "if", "node", ".", "hasAttribute", "(", "name", ")", ":", "return", "True", "return", "False", "return", "node", ".", "h...
Return true if element has attribute with the given name and optional nsuri. If nsuri is not specified, returns true if an attribute exists with the given name with any namespace.
[ "Return", "true", "if", "element", "has", "attribute", "with", "the", "given", "name", "and", "optional", "nsuri", ".", "If", "nsuri", "is", "not", "specified", "returns", "true", "if", "an", "attribute", "exists", "with", "the", "given", "name", "with", "...
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L477-L485
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
DOM.getAttr
def getAttr(self, node, name, nsuri=None, default=join): """Return the value of the attribute named 'name' with the optional nsuri, or the default if one is specified. If nsuri is not specified, an attribute that matches the given name will be returned regardless of namespace.""...
python
def getAttr(self, node, name, nsuri=None, default=join): """Return the value of the attribute named 'name' with the optional nsuri, or the default if one is specified. If nsuri is not specified, an attribute that matches the given name will be returned regardless of namespace.""...
[ "def", "getAttr", "(", "self", ",", "node", ",", "name", ",", "nsuri", "=", "None", ",", "default", "=", "join", ")", ":", "if", "nsuri", "is", "None", ":", "result", "=", "node", ".", "_attrs", ".", "get", "(", "name", ",", "None", ")", "if", ...
Return the value of the attribute named 'name' with the optional nsuri, or the default if one is specified. If nsuri is not specified, an attribute that matches the given name will be returned regardless of namespace.
[ "Return", "the", "value", "of", "the", "attribute", "named", "name", "with", "the", "optional", "nsuri", "or", "the", "default", "if", "one", "is", "specified", ".", "If", "nsuri", "is", "not", "specified", "an", "attribute", "that", "matches", "the", "giv...
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L487-L505
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
DOM.getAttrs
def getAttrs(self, node): """Return a Collection of all attributes """ attrs = {} for k,v in node._attrs.items(): attrs[k] = v.value return attrs
python
def getAttrs(self, node): """Return a Collection of all attributes """ attrs = {} for k,v in node._attrs.items(): attrs[k] = v.value return attrs
[ "def", "getAttrs", "(", "self", ",", "node", ")", ":", "attrs", "=", "{", "}", "for", "k", ",", "v", "in", "node", ".", "_attrs", ".", "items", "(", ")", ":", "attrs", "[", "k", "]", "=", "v", ".", "value", "return", "attrs" ]
Return a Collection of all attributes
[ "Return", "a", "Collection", "of", "all", "attributes" ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L507-L513
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
DOM.getElementText
def getElementText(self, node, preserve_ws=None): """Return the text value of an xml element node. Leading and trailing whitespace is stripped from the value unless the preserve_ws flag is passed with a true value.""" result = [] for child in node.childNodes: no...
python
def getElementText(self, node, preserve_ws=None): """Return the text value of an xml element node. Leading and trailing whitespace is stripped from the value unless the preserve_ws flag is passed with a true value.""" result = [] for child in node.childNodes: no...
[ "def", "getElementText", "(", "self", ",", "node", ",", "preserve_ws", "=", "None", ")", ":", "result", "=", "[", "]", "for", "child", "in", "node", ".", "childNodes", ":", "nodetype", "=", "child", ".", "nodeType", "if", "nodetype", "==", "child", "."...
Return the text value of an xml element node. Leading and trailing whitespace is stripped from the value unless the preserve_ws flag is passed with a true value.
[ "Return", "the", "text", "value", "of", "an", "xml", "element", "node", ".", "Leading", "and", "trailing", "whitespace", "is", "stripped", "from", "the", "value", "unless", "the", "preserve_ws", "flag", "is", "passed", "with", "a", "true", "value", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L515-L528
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
DOM.findNamespaceURI
def findNamespaceURI(self, prefix, node): """Find a namespace uri given a prefix and a context node.""" attrkey = (self.NS_XMLNS, prefix) DOCUMENT_NODE = node.DOCUMENT_NODE ELEMENT_NODE = node.ELEMENT_NODE while 1: if node is None: raise DOMException('...
python
def findNamespaceURI(self, prefix, node): """Find a namespace uri given a prefix and a context node.""" attrkey = (self.NS_XMLNS, prefix) DOCUMENT_NODE = node.DOCUMENT_NODE ELEMENT_NODE = node.ELEMENT_NODE while 1: if node is None: raise DOMException('...
[ "def", "findNamespaceURI", "(", "self", ",", "prefix", ",", "node", ")", ":", "attrkey", "=", "(", "self", ".", "NS_XMLNS", ",", "prefix", ")", "DOCUMENT_NODE", "=", "node", ".", "DOCUMENT_NODE", "ELEMENT_NODE", "=", "node", ".", "ELEMENT_NODE", "while", "...
Find a namespace uri given a prefix and a context node.
[ "Find", "a", "namespace", "uri", "given", "a", "prefix", "and", "a", "context", "node", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L530-L548
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
DOM.findTargetNS
def findTargetNS(self, node): """Return the defined target namespace uri for the given node.""" attrget = self.getAttr attrkey = (self.NS_XMLNS, 'xmlns') DOCUMENT_NODE = node.DOCUMENT_NODE ELEMENT_NODE = node.ELEMENT_NODE while 1: if node.nodeType != ELEMENT_N...
python
def findTargetNS(self, node): """Return the defined target namespace uri for the given node.""" attrget = self.getAttr attrkey = (self.NS_XMLNS, 'xmlns') DOCUMENT_NODE = node.DOCUMENT_NODE ELEMENT_NODE = node.ELEMENT_NODE while 1: if node.nodeType != ELEMENT_N...
[ "def", "findTargetNS", "(", "self", ",", "node", ")", ":", "attrget", "=", "self", ".", "getAttr", "attrkey", "=", "(", "self", ".", "NS_XMLNS", ",", "'xmlns'", ")", "DOCUMENT_NODE", "=", "node", ".", "DOCUMENT_NODE", "ELEMENT_NODE", "=", "node", ".", "E...
Return the defined target namespace uri for the given node.
[ "Return", "the", "defined", "target", "namespace", "uri", "for", "the", "given", "node", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L568-L583
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
DOM.getTypeRef
def getTypeRef(self, element): """Return (namespaceURI, name) for a type attribue of the given element, or None if the element does not have a type attribute.""" typeattr = self.getAttr(element, 'type', default=None) if typeattr is None: return None parts = typeatt...
python
def getTypeRef(self, element): """Return (namespaceURI, name) for a type attribue of the given element, or None if the element does not have a type attribute.""" typeattr = self.getAttr(element, 'type', default=None) if typeattr is None: return None parts = typeatt...
[ "def", "getTypeRef", "(", "self", ",", "element", ")", ":", "typeattr", "=", "self", ".", "getAttr", "(", "element", ",", "'type'", ",", "default", "=", "None", ")", "if", "typeattr", "is", "None", ":", "return", "None", "parts", "=", "typeattr", ".", ...
Return (namespaceURI, name) for a type attribue of the given element, or None if the element does not have a type attribute.
[ "Return", "(", "namespaceURI", "name", ")", "for", "a", "type", "attribue", "of", "the", "given", "element", "or", "None", "if", "the", "element", "does", "not", "have", "a", "type", "attribute", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L585-L596
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
DOM.importNode
def importNode(self, document, node, deep=0): """Implements (well enough for our purposes) DOM node import.""" nodetype = node.nodeType if nodetype in (node.DOCUMENT_NODE, node.DOCUMENT_TYPE_NODE): raise DOMException('Illegal node type for importNode') if nodetype == node.ENT...
python
def importNode(self, document, node, deep=0): """Implements (well enough for our purposes) DOM node import.""" nodetype = node.nodeType if nodetype in (node.DOCUMENT_NODE, node.DOCUMENT_TYPE_NODE): raise DOMException('Illegal node type for importNode') if nodetype == node.ENT...
[ "def", "importNode", "(", "self", ",", "document", ",", "node", ",", "deep", "=", "0", ")", ":", "nodetype", "=", "node", ".", "nodeType", "if", "nodetype", "in", "(", "node", ".", "DOCUMENT_NODE", ",", "node", ".", "DOCUMENT_TYPE_NODE", ")", ":", "rai...
Implements (well enough for our purposes) DOM node import.
[ "Implements", "(", "well", "enough", "for", "our", "purposes", ")", "DOM", "node", "import", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L598-L608
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
DOM.nsUriMatch
def nsUriMatch(self, value, wanted, strict=0, tt=type(())): """Return a true value if two namespace uri values match.""" if value == wanted or (type(wanted) is tt) and value in wanted: return 1 if not strict and value is not None: wanted = type(wanted) is tt and wanted or...
python
def nsUriMatch(self, value, wanted, strict=0, tt=type(())): """Return a true value if two namespace uri values match.""" if value == wanted or (type(wanted) is tt) and value in wanted: return 1 if not strict and value is not None: wanted = type(wanted) is tt and wanted or...
[ "def", "nsUriMatch", "(", "self", ",", "value", ",", "wanted", ",", "strict", "=", "0", ",", "tt", "=", "type", "(", "(", ")", ")", ")", ":", "if", "value", "==", "wanted", "or", "(", "type", "(", "wanted", ")", "is", "tt", ")", "and", "value",...
Return a true value if two namespace uri values match.
[ "Return", "a", "true", "value", "if", "two", "namespace", "uri", "values", "match", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L615-L625
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
DOM.createDocument
def createDocument(self, nsuri, qname, doctype=None): """Create a new writable DOM document object.""" impl = xml.dom.minidom.getDOMImplementation() return impl.createDocument(nsuri, qname, doctype)
python
def createDocument(self, nsuri, qname, doctype=None): """Create a new writable DOM document object.""" impl = xml.dom.minidom.getDOMImplementation() return impl.createDocument(nsuri, qname, doctype)
[ "def", "createDocument", "(", "self", ",", "nsuri", ",", "qname", ",", "doctype", "=", "None", ")", ":", "impl", "=", "xml", ".", "dom", ".", "minidom", ".", "getDOMImplementation", "(", ")", "return", "impl", ".", "createDocument", "(", "nsuri", ",", ...
Create a new writable DOM document object.
[ "Create", "a", "new", "writable", "DOM", "document", "object", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L627-L630
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
DOM.loadFromURL
def loadFromURL(self, url): """Load an xml file from a URL and return a DOM document.""" if isfile(url) is True: file = open(url, 'r') else: file = urlopen(url) try: result = self.loadDocument(file) except Exception, ex: file....
python
def loadFromURL(self, url): """Load an xml file from a URL and return a DOM document.""" if isfile(url) is True: file = open(url, 'r') else: file = urlopen(url) try: result = self.loadDocument(file) except Exception, ex: file....
[ "def", "loadFromURL", "(", "self", ",", "url", ")", ":", "if", "isfile", "(", "url", ")", "is", "True", ":", "file", "=", "open", "(", "url", ",", "'r'", ")", "else", ":", "file", "=", "urlopen", "(", "url", ")", "try", ":", "result", "=", "sel...
Load an xml file from a URL and return a DOM document.
[ "Load", "an", "xml", "file", "from", "a", "URL", "and", "return", "a", "DOM", "document", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L637-L651
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
ElementProxy.evaluate
def evaluate(self, expression, processorNss=None): '''expression -- XPath compiled expression ''' from Ft.Xml import XPath if not processorNss: context = XPath.Context.Context(self.node, processorNss=self.processorNss) else: context = XPath.Context.Context...
python
def evaluate(self, expression, processorNss=None): '''expression -- XPath compiled expression ''' from Ft.Xml import XPath if not processorNss: context = XPath.Context.Context(self.node, processorNss=self.processorNss) else: context = XPath.Context.Context...
[ "def", "evaluate", "(", "self", ",", "expression", ",", "processorNss", "=", "None", ")", ":", "from", "Ft", ".", "Xml", "import", "XPath", "if", "not", "processorNss", ":", "context", "=", "XPath", ".", "Context", ".", "Context", "(", "self", ".", "no...
expression -- XPath compiled expression
[ "expression", "--", "XPath", "compiled", "expression" ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L771-L780
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
ElementProxy.checkNode
def checkNode(self, namespaceURI=None, localName=None): ''' namespaceURI -- namespace of element localName -- local name of element ''' namespaceURI = namespaceURI or self.namespaceURI localName = localName or self.name check = False if localName a...
python
def checkNode(self, namespaceURI=None, localName=None): ''' namespaceURI -- namespace of element localName -- local name of element ''' namespaceURI = namespaceURI or self.namespaceURI localName = localName or self.name check = False if localName a...
[ "def", "checkNode", "(", "self", ",", "namespaceURI", "=", "None", ",", "localName", "=", "None", ")", ":", "namespaceURI", "=", "namespaceURI", "or", "self", ".", "namespaceURI", "localName", "=", "localName", "or", "self", ".", "name", "check", "=", "Fal...
namespaceURI -- namespace of element localName -- local name of element
[ "namespaceURI", "--", "namespace", "of", "element", "localName", "--", "local", "name", "of", "element" ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L786-L797
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
ElementProxy._getUniquePrefix
def _getUniquePrefix(self): '''I guess we need to resolve all potential prefixes because when the current node is attached it copies the namespaces into the parent node. ''' while 1: self._indx += 1 prefix = 'ns%d' %self._indx try: ...
python
def _getUniquePrefix(self): '''I guess we need to resolve all potential prefixes because when the current node is attached it copies the namespaces into the parent node. ''' while 1: self._indx += 1 prefix = 'ns%d' %self._indx try: ...
[ "def", "_getUniquePrefix", "(", "self", ")", ":", "while", "1", ":", "self", ".", "_indx", "+=", "1", "prefix", "=", "'ns%d'", "%", "self", ".", "_indx", "try", ":", "self", ".", "_dom", ".", "findNamespaceURI", "(", "prefix", ",", "self", ".", "_get...
I guess we need to resolve all potential prefixes because when the current node is attached it copies the namespaces into the parent node.
[ "I", "guess", "we", "need", "to", "resolve", "all", "potential", "prefixes", "because", "when", "the", "current", "node", "is", "attached", "it", "copies", "the", "namespaces", "into", "the", "parent", "node", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L828-L840
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
ElementProxy._getPrefix
def _getPrefix(self, node, nsuri): ''' Keyword arguments: node -- DOM Element Node nsuri -- namespace of attribute value ''' try: if node and (node.nodeType == node.ELEMENT_NODE) and \ (nsuri == self._dom.findDefaultNS(node)): ...
python
def _getPrefix(self, node, nsuri): ''' Keyword arguments: node -- DOM Element Node nsuri -- namespace of attribute value ''' try: if node and (node.nodeType == node.ELEMENT_NODE) and \ (nsuri == self._dom.findDefaultNS(node)): ...
[ "def", "_getPrefix", "(", "self", ",", "node", ",", "nsuri", ")", ":", "try", ":", "if", "node", "and", "(", "node", ".", "nodeType", "==", "node", ".", "ELEMENT_NODE", ")", "and", "(", "nsuri", "==", "self", ".", "_dom", ".", "findDefaultNS", "(", ...
Keyword arguments: node -- DOM Element Node nsuri -- namespace of attribute value
[ "Keyword", "arguments", ":", "node", "--", "DOM", "Element", "Node", "nsuri", "--", "namespace", "of", "attribute", "value" ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L842-L864
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
ElementProxy._setAttributeNS
def _setAttributeNS(self, namespaceURI, qualifiedName, value): ''' Keyword arguments: namespaceURI -- namespace of attribute qualifiedName -- qualified name of new attribute value value -- value of attribute ''' self.node.setAttributeNS(namespaceURI, q...
python
def _setAttributeNS(self, namespaceURI, qualifiedName, value): ''' Keyword arguments: namespaceURI -- namespace of attribute qualifiedName -- qualified name of new attribute value value -- value of attribute ''' self.node.setAttributeNS(namespaceURI, q...
[ "def", "_setAttributeNS", "(", "self", ",", "namespaceURI", ",", "qualifiedName", ",", "value", ")", ":", "self", ".", "node", ".", "setAttributeNS", "(", "namespaceURI", ",", "qualifiedName", ",", "value", ")" ]
Keyword arguments: namespaceURI -- namespace of attribute qualifiedName -- qualified name of new attribute value value -- value of attribute
[ "Keyword", "arguments", ":", "namespaceURI", "--", "namespace", "of", "attribute", "qualifiedName", "--", "qualified", "name", "of", "new", "attribute", "value", "value", "--", "value", "of", "attribute" ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L883-L890
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
ElementProxy.createDocument
def createDocument(self, namespaceURI, localName, doctype=None): '''If specified must be a SOAP envelope, else may contruct an empty document. ''' prefix = self._soap_env_prefix if namespaceURI == self.reserved_ns[prefix]: qualifiedName = '%s:%s' %(prefix,localName) ...
python
def createDocument(self, namespaceURI, localName, doctype=None): '''If specified must be a SOAP envelope, else may contruct an empty document. ''' prefix = self._soap_env_prefix if namespaceURI == self.reserved_ns[prefix]: qualifiedName = '%s:%s' %(prefix,localName) ...
[ "def", "createDocument", "(", "self", ",", "namespaceURI", ",", "localName", ",", "doctype", "=", "None", ")", ":", "prefix", "=", "self", ".", "_soap_env_prefix", "if", "namespaceURI", "==", "self", ".", "reserved_ns", "[", "prefix", "]", ":", "qualifiedNam...
If specified must be a SOAP envelope, else may contruct an empty document.
[ "If", "specified", "must", "be", "a", "SOAP", "envelope", "else", "may", "contruct", "an", "empty", "document", "." ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L934-L954
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
ElementProxy.setAttributeType
def setAttributeType(self, namespaceURI, localName): '''set xsi:type Keyword arguments: namespaceURI -- namespace of attribute value localName -- name of new attribute value ''' self.logger.debug('setAttributeType: (%s,%s)', namespaceURI, localName) value...
python
def setAttributeType(self, namespaceURI, localName): '''set xsi:type Keyword arguments: namespaceURI -- namespace of attribute value localName -- name of new attribute value ''' self.logger.debug('setAttributeType: (%s,%s)', namespaceURI, localName) value...
[ "def", "setAttributeType", "(", "self", ",", "namespaceURI", ",", "localName", ")", ":", "self", ".", "logger", ".", "debug", "(", "'setAttributeType: (%s,%s)'", ",", "namespaceURI", ",", "localName", ")", "value", "=", "localName", "if", "namespaceURI", ":", ...
set xsi:type Keyword arguments: namespaceURI -- namespace of attribute value localName -- name of new attribute value
[ "set", "xsi", ":", "type", "Keyword", "arguments", ":", "namespaceURI", "--", "namespace", "of", "attribute", "value", "localName", "--", "name", "of", "new", "attribute", "value" ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L962-L975
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
ElementProxy.setAttributeNS
def setAttributeNS(self, namespaceURI, localName, value): ''' Keyword arguments: namespaceURI -- namespace of attribute to create, None is for attributes in no namespace. localName -- local name of new attribute value -- value of new attribute ...
python
def setAttributeNS(self, namespaceURI, localName, value): ''' Keyword arguments: namespaceURI -- namespace of attribute to create, None is for attributes in no namespace. localName -- local name of new attribute value -- value of new attribute ...
[ "def", "setAttributeNS", "(", "self", ",", "namespaceURI", ",", "localName", ",", "value", ")", ":", "prefix", "=", "None", "if", "namespaceURI", ":", "try", ":", "prefix", "=", "self", ".", "getPrefix", "(", "namespaceURI", ")", "except", "KeyError", ",",...
Keyword arguments: namespaceURI -- namespace of attribute to create, None is for attributes in no namespace. localName -- local name of new attribute value -- value of new attribute
[ "Keyword", "arguments", ":", "namespaceURI", "--", "namespace", "of", "attribute", "to", "create", "None", "is", "for", "attributes", "in", "no", "namespace", ".", "localName", "--", "local", "name", "of", "new", "attribute", "value", "--", "value", "of", "n...
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L981-L999
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
ElementProxy.setNamespaceAttribute
def setNamespaceAttribute(self, prefix, namespaceURI): ''' Keyword arguments: prefix -- xmlns prefix namespaceURI -- value of prefix ''' self._setAttributeNS(XMLNS.BASE, 'xmlns:%s' %prefix, namespaceURI)
python
def setNamespaceAttribute(self, prefix, namespaceURI): ''' Keyword arguments: prefix -- xmlns prefix namespaceURI -- value of prefix ''' self._setAttributeNS(XMLNS.BASE, 'xmlns:%s' %prefix, namespaceURI)
[ "def", "setNamespaceAttribute", "(", "self", ",", "prefix", ",", "namespaceURI", ")", ":", "self", ".", "_setAttributeNS", "(", "XMLNS", ".", "BASE", ",", "'xmlns:%s'", "%", "prefix", ",", "namespaceURI", ")" ]
Keyword arguments: prefix -- xmlns prefix namespaceURI -- value of prefix
[ "Keyword", "arguments", ":", "prefix", "--", "xmlns", "prefix", "namespaceURI", "--", "value", "of", "prefix" ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L1001-L1007
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
ElementProxy.createElementNS
def createElementNS(self, namespace, qname): ''' Keyword arguments: namespace -- namespace of element to create qname -- qualified name of new element ''' document = self._getOwnerDocument() node = document.createElementNS(namespace, qname) return ...
python
def createElementNS(self, namespace, qname): ''' Keyword arguments: namespace -- namespace of element to create qname -- qualified name of new element ''' document = self._getOwnerDocument() node = document.createElementNS(namespace, qname) return ...
[ "def", "createElementNS", "(", "self", ",", "namespace", ",", "qname", ")", ":", "document", "=", "self", ".", "_getOwnerDocument", "(", ")", "node", "=", "document", ".", "createElementNS", "(", "namespace", ",", "qname", ")", "return", "ElementProxy", "(",...
Keyword arguments: namespace -- namespace of element to create qname -- qualified name of new element
[ "Keyword", "arguments", ":", "namespace", "--", "namespace", "of", "element", "to", "create", "qname", "--", "qualified", "name", "of", "new", "element" ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L1012-L1020
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
ElementProxy.createAppendSetElement
def createAppendSetElement(self, namespaceURI, localName, prefix=None): '''Create a new element (namespaceURI,name), append it to current node, then set it to be the current node. Keyword arguments: namespaceURI -- namespace of element to create localName -- local name...
python
def createAppendSetElement(self, namespaceURI, localName, prefix=None): '''Create a new element (namespaceURI,name), append it to current node, then set it to be the current node. Keyword arguments: namespaceURI -- namespace of element to create localName -- local name...
[ "def", "createAppendSetElement", "(", "self", ",", "namespaceURI", ",", "localName", ",", "prefix", "=", "None", ")", ":", "node", "=", "self", ".", "createAppendElement", "(", "namespaceURI", ",", "localName", ",", "prefix", "=", "None", ")", "node", "=", ...
Create a new element (namespaceURI,name), append it to current node, then set it to be the current node. Keyword arguments: namespaceURI -- namespace of element to create localName -- local name of new element prefix -- if namespaceURI is not defined, declare prefi...
[ "Create", "a", "new", "element", "(", "namespaceURI", "name", ")", "append", "it", "to", "current", "node", "then", "set", "it", "to", "be", "the", "current", "node", ".", "Keyword", "arguments", ":", "namespaceURI", "--", "namespace", "of", "element", "to...
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L1022-L1033
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
ElementProxy.createAppendElement
def createAppendElement(self, namespaceURI, localName, prefix=None): '''Create a new element (namespaceURI,name), append it to current node, and return the newly created node. Keyword arguments: namespaceURI -- namespace of element to create localName -- local name of ...
python
def createAppendElement(self, namespaceURI, localName, prefix=None): '''Create a new element (namespaceURI,name), append it to current node, and return the newly created node. Keyword arguments: namespaceURI -- namespace of element to create localName -- local name of ...
[ "def", "createAppendElement", "(", "self", ",", "namespaceURI", ",", "localName", ",", "prefix", "=", "None", ")", ":", "declare", "=", "False", "qualifiedName", "=", "localName", "if", "namespaceURI", ":", "try", ":", "prefix", "=", "self", ".", "getPrefix"...
Create a new element (namespaceURI,name), append it to current node, and return the newly created node. Keyword arguments: namespaceURI -- namespace of element to create localName -- local name of new element prefix -- if namespaceURI is not defined, declare prefix...
[ "Create", "a", "new", "element", "(", "namespaceURI", "name", ")", "append", "it", "to", "current", "node", "and", "return", "the", "newly", "created", "node", ".", "Keyword", "arguments", ":", "namespaceURI", "--", "namespace", "of", "element", "to", "creat...
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L1035-L1058
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
ElementProxy.getElement
def getElement(self, namespaceURI, localName): ''' Keyword arguments: namespaceURI -- namespace of element localName -- local name of element ''' node = self._dom.getElement(self.node, localName, namespaceURI, default=None) if node: return Elem...
python
def getElement(self, namespaceURI, localName): ''' Keyword arguments: namespaceURI -- namespace of element localName -- local name of element ''' node = self._dom.getElement(self.node, localName, namespaceURI, default=None) if node: return Elem...
[ "def", "getElement", "(", "self", ",", "namespaceURI", ",", "localName", ")", ":", "node", "=", "self", ".", "_dom", ".", "getElement", "(", "self", ".", "node", ",", "localName", ",", "namespaceURI", ",", "default", "=", "None", ")", "if", "node", ":"...
Keyword arguments: namespaceURI -- namespace of element localName -- local name of element
[ "Keyword", "arguments", ":", "namespaceURI", "--", "namespace", "of", "element", "localName", "--", "local", "name", "of", "element" ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L1069-L1078
rameshg87/pyremotevbox
pyremotevbox/ZSI/wstools/Utility.py
ElementProxy.getAttributeValue
def getAttributeValue(self, namespaceURI, localName): ''' Keyword arguments: namespaceURI -- namespace of attribute localName -- local name of attribute ''' if self.hasAttribute(namespaceURI, localName): attr = self.node.getAttributeNodeNS(namespaceURI...
python
def getAttributeValue(self, namespaceURI, localName): ''' Keyword arguments: namespaceURI -- namespace of attribute localName -- local name of attribute ''' if self.hasAttribute(namespaceURI, localName): attr = self.node.getAttributeNodeNS(namespaceURI...
[ "def", "getAttributeValue", "(", "self", ",", "namespaceURI", ",", "localName", ")", ":", "if", "self", ".", "hasAttribute", "(", "namespaceURI", ",", "localName", ")", ":", "attr", "=", "self", ".", "node", ".", "getAttributeNodeNS", "(", "namespaceURI", ",...
Keyword arguments: namespaceURI -- namespace of attribute localName -- local name of attribute
[ "Keyword", "arguments", ":", "namespaceURI", "--", "namespace", "of", "attribute", "localName", "--", "local", "name", "of", "attribute" ]
train
https://github.com/rameshg87/pyremotevbox/blob/123dffff27da57c8faa3ac1dd4c68b1cf4558b1a/pyremotevbox/ZSI/wstools/Utility.py#L1080-L1089
callowayproject/Transmogrify
transmogrify/autodetect/__init__.py
face_and_energy_detector
def face_and_energy_detector(image_path, detect_faces=True): """ Finds faces and energy in an image """ source = Image.open(image_path) work_width = 800 if source.mode != 'RGB' or source.bits != 8: source24 = source.convert('RGB') else: source24 = source.copy() grayscale...
python
def face_and_energy_detector(image_path, detect_faces=True): """ Finds faces and energy in an image """ source = Image.open(image_path) work_width = 800 if source.mode != 'RGB' or source.bits != 8: source24 = source.convert('RGB') else: source24 = source.copy() grayscale...
[ "def", "face_and_energy_detector", "(", "image_path", ",", "detect_faces", "=", "True", ")", ":", "source", "=", "Image", ".", "open", "(", "image_path", ")", "work_width", "=", "800", "if", "source", ".", "mode", "!=", "'RGB'", "or", "source", ".", "bits"...
Finds faces and energy in an image
[ "Finds", "faces", "and", "energy", "in", "an", "image" ]
train
https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/autodetect/__init__.py#L136-L164
callowayproject/Transmogrify
transmogrify/autodetect/__init__.py
get_crop_size
def get_crop_size(crop_w, crop_h, image_w, image_h): """ Determines the correct scale size for the image when img w == crop w and img h > crop h Use these dimensions when img h == crop h and img w > crop w Use these dimensions """ scale1 = float(crop_w) / float(image_w) sca...
python
def get_crop_size(crop_w, crop_h, image_w, image_h): """ Determines the correct scale size for the image when img w == crop w and img h > crop h Use these dimensions when img h == crop h and img w > crop w Use these dimensions """ scale1 = float(crop_w) / float(image_w) sca...
[ "def", "get_crop_size", "(", "crop_w", ",", "crop_h", ",", "image_w", ",", "image_h", ")", ":", "scale1", "=", "float", "(", "crop_w", ")", "/", "float", "(", "image_w", ")", "scale2", "=", "float", "(", "crop_h", ")", "/", "float", "(", "image_h", "...
Determines the correct scale size for the image when img w == crop w and img h > crop h Use these dimensions when img h == crop h and img w > crop w Use these dimensions
[ "Determines", "the", "correct", "scale", "size", "for", "the", "image" ]
train
https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/autodetect/__init__.py#L167-L189
callowayproject/Transmogrify
transmogrify/autodetect/__init__.py
calc_subrange
def calc_subrange(range_max, sub_amount, weight): """ return the start and stop points that are sub_amount distance apart and contain weight, without going outside the provided range """ if weight > range_max or sub_amount > range_max: raise ValueError("sub_amount and weight must be less tha...
python
def calc_subrange(range_max, sub_amount, weight): """ return the start and stop points that are sub_amount distance apart and contain weight, without going outside the provided range """ if weight > range_max or sub_amount > range_max: raise ValueError("sub_amount and weight must be less tha...
[ "def", "calc_subrange", "(", "range_max", ",", "sub_amount", ",", "weight", ")", ":", "if", "weight", ">", "range_max", "or", "sub_amount", ">", "range_max", ":", "raise", "ValueError", "(", "\"sub_amount and weight must be less than range_max. range_max %s, sub_amount %s...
return the start and stop points that are sub_amount distance apart and contain weight, without going outside the provided range
[ "return", "the", "start", "and", "stop", "points", "that", "are", "sub_amount", "distance", "apart", "and", "contain", "weight", "without", "going", "outside", "the", "provided", "range" ]
train
https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/autodetect/__init__.py#L192-L209
callowayproject/Transmogrify
transmogrify/autodetect/__init__.py
smart_crop
def smart_crop(crop_w, crop_h, image_path): """ Return the scaled image size and crop rectangle """ cropping = face_and_energy_detector(image_path) img = Image.open(image_path) w, h = img.size scaled_size = get_crop_size(crop_w, crop_h, *img.size) gravity_x = int(round(scaled_size[0] * c...
python
def smart_crop(crop_w, crop_h, image_path): """ Return the scaled image size and crop rectangle """ cropping = face_and_energy_detector(image_path) img = Image.open(image_path) w, h = img.size scaled_size = get_crop_size(crop_w, crop_h, *img.size) gravity_x = int(round(scaled_size[0] * c...
[ "def", "smart_crop", "(", "crop_w", ",", "crop_h", ",", "image_path", ")", ":", "cropping", "=", "face_and_energy_detector", "(", "image_path", ")", "img", "=", "Image", ".", "open", "(", "image_path", ")", "w", ",", "h", "=", "img", ".", "size", "scaled...
Return the scaled image size and crop rectangle
[ "Return", "the", "scaled", "image", "size", "and", "crop", "rectangle" ]
train
https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/autodetect/__init__.py#L212-L229
django-py/django-doberman
doberman/models.py
AbstractFailedAccessAttempt.get_last_failed_access_attempt
def get_last_failed_access_attempt(cls, **kwargs): """ Return Failed access attempt of Client :param ip_adress: String :return: """ try: lockout = cls.objects.get( **kwargs ) except cls.DoesNotExist: lockout = No...
python
def get_last_failed_access_attempt(cls, **kwargs): """ Return Failed access attempt of Client :param ip_adress: String :return: """ try: lockout = cls.objects.get( **kwargs ) except cls.DoesNotExist: lockout = No...
[ "def", "get_last_failed_access_attempt", "(", "cls", ",", "*", "*", "kwargs", ")", ":", "try", ":", "lockout", "=", "cls", ".", "objects", ".", "get", "(", "*", "*", "kwargs", ")", "except", "cls", ".", "DoesNotExist", ":", "lockout", "=", "None", "if"...
Return Failed access attempt of Client :param ip_adress: String :return:
[ "Return", "Failed", "access", "attempt", "of", "Client", ":", "param", "ip_adress", ":", "String", ":", "return", ":" ]
train
https://github.com/django-py/django-doberman/blob/2e5959737a1b64234ed5a179c93f96a0de1c3e5c/doberman/models.py#L50-L70
django-py/django-doberman
doberman/models.py
AbstractFailedAccessAttempt.expiration_time
def expiration_time(self): """ Returns the time until this access attempt is forgotten. """ logging_forgotten_time = configuration.behavior.login_forgotten_seconds if logging_forgotten_time <= 0: return None now = timezone.now() delta = now - self.mo...
python
def expiration_time(self): """ Returns the time until this access attempt is forgotten. """ logging_forgotten_time = configuration.behavior.login_forgotten_seconds if logging_forgotten_time <= 0: return None now = timezone.now() delta = now - self.mo...
[ "def", "expiration_time", "(", "self", ")", ":", "logging_forgotten_time", "=", "configuration", ".", "behavior", ".", "login_forgotten_seconds", "if", "logging_forgotten_time", "<=", "0", ":", "return", "None", "now", "=", "timezone", ".", "now", "(", ")", "del...
Returns the time until this access attempt is forgotten.
[ "Returns", "the", "time", "until", "this", "access", "attempt", "is", "forgotten", "." ]
train
https://github.com/django-py/django-doberman/blob/2e5959737a1b64234ed5a179c93f96a0de1c3e5c/doberman/models.py#L73-L86
sarenji/pyrc
example.py
GangstaBot.bling
def bling(self, target, sender): "will print yo" if target.startswith("#"): self.message(target, "%s: yo" % sender) else: self.message(sender, "yo")
python
def bling(self, target, sender): "will print yo" if target.startswith("#"): self.message(target, "%s: yo" % sender) else: self.message(sender, "yo")
[ "def", "bling", "(", "self", ",", "target", ",", "sender", ")", ":", "if", "target", ".", "startswith", "(", "\"#\"", ")", ":", "self", ".", "message", "(", "target", ",", "\"%s: yo\"", "%", "sender", ")", "else", ":", "self", ".", "message", "(", ...
will print yo
[ "will", "print", "yo" ]
train
https://github.com/sarenji/pyrc/blob/5e8377ddcda6e0ef4ba7d66cf400e243b1fb8f68/example.py#L11-L16
sarenji/pyrc
example.py
GangstaBot.repeat
def repeat(self, target, sender, **kwargs): "will repeat whatever yo say" if target.startswith("#"): self.message(target, kwargs["msg"]) else: self.message(sender, kwargs["msg"])
python
def repeat(self, target, sender, **kwargs): "will repeat whatever yo say" if target.startswith("#"): self.message(target, kwargs["msg"]) else: self.message(sender, kwargs["msg"])
[ "def", "repeat", "(", "self", ",", "target", ",", "sender", ",", "*", "*", "kwargs", ")", ":", "if", "target", ".", "startswith", "(", "\"#\"", ")", ":", "self", ".", "message", "(", "target", ",", "kwargs", "[", "\"msg\"", "]", ")", "else", ":", ...
will repeat whatever yo say
[ "will", "repeat", "whatever", "yo", "say" ]
train
https://github.com/sarenji/pyrc/blob/5e8377ddcda6e0ef4ba7d66cf400e243b1fb8f68/example.py#L19-L24
sarenji/pyrc
example.py
GangstaBot.stopword
def stopword(self, target, sender, *args): """ will repeat 'lol', 'lmao, 'rofl' or 'roflmao' when seen in a message only applies to channel messages """ if target.startswith("#"): self.message(target, args[0])
python
def stopword(self, target, sender, *args): """ will repeat 'lol', 'lmao, 'rofl' or 'roflmao' when seen in a message only applies to channel messages """ if target.startswith("#"): self.message(target, args[0])
[ "def", "stopword", "(", "self", ",", "target", ",", "sender", ",", "*", "args", ")", ":", "if", "target", ".", "startswith", "(", "\"#\"", ")", ":", "self", ".", "message", "(", "target", ",", "args", "[", "0", "]", ")" ]
will repeat 'lol', 'lmao, 'rofl' or 'roflmao' when seen in a message only applies to channel messages
[ "will", "repeat", "lol", "lmao", "rofl", "or", "roflmao", "when", "seen", "in", "a", "message", "only", "applies", "to", "channel", "messages" ]
train
https://github.com/sarenji/pyrc/blob/5e8377ddcda6e0ef4ba7d66cf400e243b1fb8f68/example.py#L27-L33
collectiveacuity/labPack
labpack/parsing/regex.py
validate_extension
def validate_extension(self, file_name, extension_map, method_title, argument_title): ''' a method to extract (and test) the extension type of a file :param file_name: string with name of file :param extension_map: dictionary with regex patterns, extensions and mimetypes :param method_...
python
def validate_extension(self, file_name, extension_map, method_title, argument_title): ''' a method to extract (and test) the extension type of a file :param file_name: string with name of file :param extension_map: dictionary with regex patterns, extensions and mimetypes :param method_...
[ "def", "validate_extension", "(", "self", ",", "file_name", ",", "extension_map", ",", "method_title", ",", "argument_title", ")", ":", "title", "=", "'validate_extension'", "ext_arg", "=", "'%s(extension_map={...})'", "%", "title", "# validate inputs\r", "input_fields"...
a method to extract (and test) the extension type of a file :param file_name: string with name of file :param extension_map: dictionary with regex patterns, extensions and mimetypes :param method_title: string with title of feeder method :param argument_title: string with title of argument key fro...
[ "a", "method", "to", "extract", "(", "and", "test", ")", "the", "extension", "type", "of", "a", "file", ":", "param", "file_name", ":", "string", "with", "name", "of", "file", ":", "param", "extension_map", ":", "dictionary", "with", "regex", "patterns", ...
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/parsing/regex.py#L9-L62
20tab/twentytab-utils
twentytab/utils.py
compare_dicts
def compare_dicts(dict1, dict2): """ Checks if dict1 equals dict2 """ for k, v in dict2.items(): if v != dict1[k]: return False return True
python
def compare_dicts(dict1, dict2): """ Checks if dict1 equals dict2 """ for k, v in dict2.items(): if v != dict1[k]: return False return True
[ "def", "compare_dicts", "(", "dict1", ",", "dict2", ")", ":", "for", "k", ",", "v", "in", "dict2", ".", "items", "(", ")", ":", "if", "v", "!=", "dict1", "[", "k", "]", ":", "return", "False", "return", "True" ]
Checks if dict1 equals dict2
[ "Checks", "if", "dict1", "equals", "dict2" ]
train
https://github.com/20tab/twentytab-utils/blob/e02d55b1fd848c8e11ca9b7e97a5916780544d34/twentytab/utils.py#L21-L28
20tab/twentytab-utils
twentytab/utils.py
getItalianAccentedVocal
def getItalianAccentedVocal(vocal, acc_type="g"): """ It returns given vocal with grave or acute accent """ vocals = {'a': {'g': u'\xe0', 'a': u'\xe1'}, 'e': {'g': u'\xe8', 'a': u'\xe9'}, 'i': {'g': u'\xec', 'a': u'\xed'}, 'o': {'g': u'\xf2', 'a': u'\xf3'}, ...
python
def getItalianAccentedVocal(vocal, acc_type="g"): """ It returns given vocal with grave or acute accent """ vocals = {'a': {'g': u'\xe0', 'a': u'\xe1'}, 'e': {'g': u'\xe8', 'a': u'\xe9'}, 'i': {'g': u'\xec', 'a': u'\xed'}, 'o': {'g': u'\xf2', 'a': u'\xf3'}, ...
[ "def", "getItalianAccentedVocal", "(", "vocal", ",", "acc_type", "=", "\"g\"", ")", ":", "vocals", "=", "{", "'a'", ":", "{", "'g'", ":", "u'\\xe0'", ",", "'a'", ":", "u'\\xe1'", "}", ",", "'e'", ":", "{", "'g'", ":", "u'\\xe8'", ",", "'a'", ":", "...
It returns given vocal with grave or acute accent
[ "It", "returns", "given", "vocal", "with", "grave", "or", "acute", "accent" ]
train
https://github.com/20tab/twentytab-utils/blob/e02d55b1fd848c8e11ca9b7e97a5916780544d34/twentytab/utils.py#L31-L40
collectiveacuity/labPack
labpack/authentication/aws/iam.py
iamClient.list_certificates
def list_certificates(self): ''' a method to retrieve a list of server certificates :return: list with certificate name strings ''' title = '%s.list_certificates' % self.__class__.__name__ # send request for list of certificates self.printer('Querying AWS for ...
python
def list_certificates(self): ''' a method to retrieve a list of server certificates :return: list with certificate name strings ''' title = '%s.list_certificates' % self.__class__.__name__ # send request for list of certificates self.printer('Querying AWS for ...
[ "def", "list_certificates", "(", "self", ")", ":", "title", "=", "'%s.list_certificates'", "%", "self", ".", "__class__", ".", "__name__", "# send request for list of certificates", "self", ".", "printer", "(", "'Querying AWS for server certificates.'", ")", "try", ":",...
a method to retrieve a list of server certificates :return: list with certificate name strings
[ "a", "method", "to", "retrieve", "a", "list", "of", "server", "certificates" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/authentication/aws/iam.py#L126-L162
collectiveacuity/labPack
labpack/authentication/aws/iam.py
iamClient.read_certificate
def read_certificate(self, certificate_name): ''' a method to retrieve the details about a server certificate :param certificate_name: string with name of server certificate :return: dictionary with certificate details ''' title = '%s.read_certificate' % self.__cla...
python
def read_certificate(self, certificate_name): ''' a method to retrieve the details about a server certificate :param certificate_name: string with name of server certificate :return: dictionary with certificate details ''' title = '%s.read_certificate' % self.__cla...
[ "def", "read_certificate", "(", "self", ",", "certificate_name", ")", ":", "title", "=", "'%s.read_certificate'", "%", "self", ".", "__class__", ".", "__name__", "# validate inputs", "input_fields", "=", "{", "'certificate_name'", ":", "certificate_name", "}", "for"...
a method to retrieve the details about a server certificate :param certificate_name: string with name of server certificate :return: dictionary with certificate details
[ "a", "method", "to", "retrieve", "the", "details", "about", "a", "server", "certificate" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/authentication/aws/iam.py#L164-L210
collectiveacuity/labPack
labpack/authentication/aws/iam.py
iamClient.list_roles
def list_roles(self): ''' a method to retrieve a list of server certificates :return: list with certificate name strings ''' title = '%s.list_certificates' % self.__class__.__name__ # send request for list of certificates self.printer('Querying AWS for iam...
python
def list_roles(self): ''' a method to retrieve a list of server certificates :return: list with certificate name strings ''' title = '%s.list_certificates' % self.__class__.__name__ # send request for list of certificates self.printer('Querying AWS for iam...
[ "def", "list_roles", "(", "self", ")", ":", "title", "=", "'%s.list_certificates'", "%", "self", ".", "__class__", ".", "__name__", "# send request for list of certificates", "self", ".", "printer", "(", "'Querying AWS for iam roles.'", ")", "try", ":", "response", ...
a method to retrieve a list of server certificates :return: list with certificate name strings
[ "a", "method", "to", "retrieve", "a", "list", "of", "server", "certificates" ]
train
https://github.com/collectiveacuity/labPack/blob/52949ece35e72e3cc308f54d9ffa6bfbd96805b8/labpack/authentication/aws/iam.py#L212-L248
stephanepechard/projy
projy/TerminalView.py
TerminalView.text_in_color
def text_in_color(self, message, color_code): """ Print with a beautiful color. See codes at the top of this file. """ return self.term.color(color_code) + message + self.term.normal
python
def text_in_color(self, message, color_code): """ Print with a beautiful color. See codes at the top of this file. """ return self.term.color(color_code) + message + self.term.normal
[ "def", "text_in_color", "(", "self", ",", "message", ",", "color_code", ")", ":", "return", "self", ".", "term", ".", "color", "(", "color_code", ")", "+", "message", "+", "self", ".", "term", ".", "normal" ]
Print with a beautiful color. See codes at the top of this file.
[ "Print", "with", "a", "beautiful", "color", ".", "See", "codes", "at", "the", "top", "of", "this", "file", "." ]
train
https://github.com/stephanepechard/projy/blob/3146b0e3c207b977e1b51fcb33138746dae83c23/projy/TerminalView.py#L39-L41
SkyLothar/shcmd
shcmd/tar.py
TarGenerator.files
def files(self): """files that will be add to tar file later should be tuple, list or generator that returns strings """ ios_names = [info.name for info in self._ios_to_add.keys()] return set(self.files_to_add + ios_names)
python
def files(self): """files that will be add to tar file later should be tuple, list or generator that returns strings """ ios_names = [info.name for info in self._ios_to_add.keys()] return set(self.files_to_add + ios_names)
[ "def", "files", "(", "self", ")", ":", "ios_names", "=", "[", "info", ".", "name", "for", "info", "in", "self", ".", "_ios_to_add", ".", "keys", "(", ")", "]", "return", "set", "(", "self", ".", "files_to_add", "+", "ios_names", ")" ]
files that will be add to tar file later should be tuple, list or generator that returns strings
[ "files", "that", "will", "be", "add", "to", "tar", "file", "later", "should", "be", "tuple", "list", "or", "generator", "that", "returns", "strings" ]
train
https://github.com/SkyLothar/shcmd/blob/d8cad6311a4da7ef09f3419c86b58e30388b7ee3/shcmd/tar.py#L44-L49
SkyLothar/shcmd
shcmd/tar.py
TarGenerator.add_fileobj
def add_fileobj(self, fname, fcontent): """add file like object, it will be add to tar file later :param fname: name in tar file :param fcontent: content. bytes, string, BytesIO or StringIO """ tar_info = tarfile.TarInfo(fname) if isinstance(fcontent, io.BytesIO): ...
python
def add_fileobj(self, fname, fcontent): """add file like object, it will be add to tar file later :param fname: name in tar file :param fcontent: content. bytes, string, BytesIO or StringIO """ tar_info = tarfile.TarInfo(fname) if isinstance(fcontent, io.BytesIO): ...
[ "def", "add_fileobj", "(", "self", ",", "fname", ",", "fcontent", ")", ":", "tar_info", "=", "tarfile", ".", "TarInfo", "(", "fname", ")", "if", "isinstance", "(", "fcontent", ",", "io", ".", "BytesIO", ")", ":", "tar_info", ".", "size", "=", "len", ...
add file like object, it will be add to tar file later :param fname: name in tar file :param fcontent: content. bytes, string, BytesIO or StringIO
[ "add", "file", "like", "object", "it", "will", "be", "add", "to", "tar", "file", "later" ]
train
https://github.com/SkyLothar/shcmd/blob/d8cad6311a4da7ef09f3419c86b58e30388b7ee3/shcmd/tar.py#L59-L78
SkyLothar/shcmd
shcmd/tar.py
TarGenerator.generate
def generate(self): """generate tar file ..Usage:: >>> tarfile = b"".join(data for data in tg.generate()) """ if self._tar_buffer.tell(): self._tar_buffer.seek(0, 0) yield self._tar_buffer.read() for fname in self._files_to_add: ...
python
def generate(self): """generate tar file ..Usage:: >>> tarfile = b"".join(data for data in tg.generate()) """ if self._tar_buffer.tell(): self._tar_buffer.seek(0, 0) yield self._tar_buffer.read() for fname in self._files_to_add: ...
[ "def", "generate", "(", "self", ")", ":", "if", "self", ".", "_tar_buffer", ".", "tell", "(", ")", ":", "self", ".", "_tar_buffer", ".", "seek", "(", "0", ",", "0", ")", "yield", "self", ".", "_tar_buffer", ".", "read", "(", ")", "for", "fname", ...
generate tar file ..Usage:: >>> tarfile = b"".join(data for data in tg.generate())
[ "generate", "tar", "file" ]
train
https://github.com/SkyLothar/shcmd/blob/d8cad6311a4da7ef09f3419c86b58e30388b7ee3/shcmd/tar.py#L80-L107
SkyLothar/shcmd
shcmd/tar.py
TarGenerator.tar
def tar(self): """tar in bytes format""" if not self.generated: for data in self.generate(): pass return self._tar_buffer.getvalue()
python
def tar(self): """tar in bytes format""" if not self.generated: for data in self.generate(): pass return self._tar_buffer.getvalue()
[ "def", "tar", "(", "self", ")", ":", "if", "not", "self", ".", "generated", ":", "for", "data", "in", "self", ".", "generate", "(", ")", ":", "pass", "return", "self", ".", "_tar_buffer", ".", "getvalue", "(", ")" ]
tar in bytes format
[ "tar", "in", "bytes", "format" ]
train
https://github.com/SkyLothar/shcmd/blob/d8cad6311a4da7ef09f3419c86b58e30388b7ee3/shcmd/tar.py#L114-L119
SethDusek/define
define/define.py
print_thesaurus_response
def print_thesaurus_response(word, client): response = client.getThesaurus(word) print("SYNONYMS: ") """if "noun" in response: print("\nNouns:\n%s" % " ".join(response["noun"]["syn"])) if "verb" in response: print("Verbs:\n%s" % " ".join(response["verb"]["syn"]))""" try: prin...
python
def print_thesaurus_response(word, client): response = client.getThesaurus(word) print("SYNONYMS: ") """if "noun" in response: print("\nNouns:\n%s" % " ".join(response["noun"]["syn"])) if "verb" in response: print("Verbs:\n%s" % " ".join(response["verb"]["syn"]))""" try: prin...
[ "def", "print_thesaurus_response", "(", "word", ",", "client", ")", ":", "response", "=", "client", ".", "getThesaurus", "(", "word", ")", "print", "(", "\"SYNONYMS: \"", ")", "try", ":", "print", "(", "\",\"", ".", "join", "(", "response", "[", "\"words\"...
if "noun" in response: print("\nNouns:\n%s" % " ".join(response["noun"]["syn"])) if "verb" in response: print("Verbs:\n%s" % " ".join(response["verb"]["syn"]))
[ "if", "noun", "in", "response", ":", "print", "(", "\\", "nNouns", ":", "\\", "n%s", "%", ".", "join", "(", "response", "[", "noun", "]", "[", "syn", "]", "))", "if", "verb", "in", "response", ":", "print", "(", "Verbs", ":", "\\", "n%s", "%", ...
train
https://github.com/SethDusek/define/blob/ba538d367be989f425a75d889aae14bca7d07f34/define/define.py#L291-L301
SethDusek/define
define/define.py
dict.getThesaurus
def getThesaurus(self, word): """response = requests.get("http://words.bighugelabs.com/api/2/%s/%s/json" % (self.tkey, word)).json() return response""" response = requests.get( "http://api.wordnik.com:80/v4/word.json/%s/relatedWords?" "useCanon...
python
def getThesaurus(self, word): """response = requests.get("http://words.bighugelabs.com/api/2/%s/%s/json" % (self.tkey, word)).json() return response""" response = requests.get( "http://api.wordnik.com:80/v4/word.json/%s/relatedWords?" "useCanon...
[ "def", "getThesaurus", "(", "self", ",", "word", ")", ":", "response", "=", "requests", ".", "get", "(", "\"http://api.wordnik.com:80/v4/word.json/%s/relatedWords?\"", "\"useCanonical=false&relationshipTypes=synonym&limitPer\"", "\"RelationshipType=15&api_key=%s\"", "%", "(", "...
response = requests.get("http://words.bighugelabs.com/api/2/%s/%s/json" % (self.tkey, word)).json() return response
[ "response", "=", "requests", ".", "get", "(", "http", ":", "//", "words", ".", "bighugelabs", ".", "com", "/", "api", "/", "2", "/", "%s", "/", "%s", "/", "json", "%", "(", "self", ".", "tkey", "word", "))", ".", "json", "()", "return", "response...
train
https://github.com/SethDusek/define/blob/ba538d367be989f425a75d889aae14bca7d07f34/define/define.py#L81-L92
IntegralDefense/critsapi
critsapi/critsdbapi.py
CRITsDBAPI.connect
def connect(self): """ Starts the mongodb connection. Must be called before anything else will work. """ self.client = MongoClient(self.mongo_uri) self.db = self.client[self.db_name]
python
def connect(self): """ Starts the mongodb connection. Must be called before anything else will work. """ self.client = MongoClient(self.mongo_uri) self.db = self.client[self.db_name]
[ "def", "connect", "(", "self", ")", ":", "self", ".", "client", "=", "MongoClient", "(", "self", ".", "mongo_uri", ")", "self", ".", "db", "=", "self", ".", "client", "[", "self", ".", "db_name", "]" ]
Starts the mongodb connection. Must be called before anything else will work.
[ "Starts", "the", "mongodb", "connection", ".", "Must", "be", "called", "before", "anything", "else", "will", "work", "." ]
train
https://github.com/IntegralDefense/critsapi/blob/e770bd81e124eaaeb5f1134ba95f4a35ff345c5a/critsapi/critsdbapi.py#L68-L74
IntegralDefense/critsapi
critsapi/critsdbapi.py
CRITsDBAPI.find
def find(self, collection, query): """ Search a collection for the query provided. Just a raw interface to mongo to do any query you want. Args: collection: The db collection. See main class documentation. query: A mongo find query. Returns: p...
python
def find(self, collection, query): """ Search a collection for the query provided. Just a raw interface to mongo to do any query you want. Args: collection: The db collection. See main class documentation. query: A mongo find query. Returns: p...
[ "def", "find", "(", "self", ",", "collection", ",", "query", ")", ":", "obj", "=", "getattr", "(", "self", ".", "db", ",", "collection", ")", "result", "=", "obj", ".", "find", "(", "query", ")", "return", "result" ]
Search a collection for the query provided. Just a raw interface to mongo to do any query you want. Args: collection: The db collection. See main class documentation. query: A mongo find query. Returns: pymongo Cursor object with the results.
[ "Search", "a", "collection", "for", "the", "query", "provided", ".", "Just", "a", "raw", "interface", "to", "mongo", "to", "do", "any", "query", "you", "want", "." ]
train
https://github.com/IntegralDefense/critsapi/blob/e770bd81e124eaaeb5f1134ba95f4a35ff345c5a/critsapi/critsdbapi.py#L76-L89
IntegralDefense/critsapi
critsapi/critsdbapi.py
CRITsDBAPI.find_all
def find_all(self, collection): """ Search a collection for all available items. Args: collection: The db collection. See main class documentation. Returns: List of all items in the collection. """ obj = getattr(self.db, collection) result...
python
def find_all(self, collection): """ Search a collection for all available items. Args: collection: The db collection. See main class documentation. Returns: List of all items in the collection. """ obj = getattr(self.db, collection) result...
[ "def", "find_all", "(", "self", ",", "collection", ")", ":", "obj", "=", "getattr", "(", "self", ".", "db", ",", "collection", ")", "result", "=", "obj", ".", "find", "(", ")", "return", "result" ]
Search a collection for all available items. Args: collection: The db collection. See main class documentation. Returns: List of all items in the collection.
[ "Search", "a", "collection", "for", "all", "available", "items", "." ]
train
https://github.com/IntegralDefense/critsapi/blob/e770bd81e124eaaeb5f1134ba95f4a35ff345c5a/critsapi/critsdbapi.py#L91-L102
IntegralDefense/critsapi
critsapi/critsdbapi.py
CRITsDBAPI.find_one
def find_one(self, collection, query): """ Search a collection for the query provided and return one result. Just a raw interface to mongo to do any query you want. Args: collection: The db collection. See main class documentation. query: A mongo find query. ...
python
def find_one(self, collection, query): """ Search a collection for the query provided and return one result. Just a raw interface to mongo to do any query you want. Args: collection: The db collection. See main class documentation. query: A mongo find query. ...
[ "def", "find_one", "(", "self", ",", "collection", ",", "query", ")", ":", "obj", "=", "getattr", "(", "self", ".", "db", ",", "collection", ")", "result", "=", "obj", ".", "find_one", "(", "query", ")", "return", "result" ]
Search a collection for the query provided and return one result. Just a raw interface to mongo to do any query you want. Args: collection: The db collection. See main class documentation. query: A mongo find query. Returns: pymongo Cursor object with the res...
[ "Search", "a", "collection", "for", "the", "query", "provided", "and", "return", "one", "result", ".", "Just", "a", "raw", "interface", "to", "mongo", "to", "do", "any", "query", "you", "want", "." ]
train
https://github.com/IntegralDefense/critsapi/blob/e770bd81e124eaaeb5f1134ba95f4a35ff345c5a/critsapi/critsdbapi.py#L104-L117
IntegralDefense/critsapi
critsapi/critsdbapi.py
CRITsDBAPI.find_distinct
def find_distinct(self, collection, key): """ Search a collection for the distinct key values provided. Args: collection: The db collection. See main class documentation. key: The name of the key to find distinct values. For example with the indicators c...
python
def find_distinct(self, collection, key): """ Search a collection for the distinct key values provided. Args: collection: The db collection. See main class documentation. key: The name of the key to find distinct values. For example with the indicators c...
[ "def", "find_distinct", "(", "self", ",", "collection", ",", "key", ")", ":", "obj", "=", "getattr", "(", "self", ".", "db", ",", "collection", ")", "result", "=", "obj", ".", "distinct", "(", "key", ")", "return", "result" ]
Search a collection for the distinct key values provided. Args: collection: The db collection. See main class documentation. key: The name of the key to find distinct values. For example with the indicators collection, the key could be "type". Returns: ...
[ "Search", "a", "collection", "for", "the", "distinct", "key", "values", "provided", "." ]
train
https://github.com/IntegralDefense/critsapi/blob/e770bd81e124eaaeb5f1134ba95f4a35ff345c5a/critsapi/critsdbapi.py#L119-L132
IntegralDefense/critsapi
critsapi/critsdbapi.py
CRITsDBAPI.add_embedded_campaign
def add_embedded_campaign(self, id, collection, campaign, confidence, analyst, date, description): """ Adds an embedded campaign to the TLO. Args: id: the CRITs object id of the TLO collection: The db collection. See main class documentation...
python
def add_embedded_campaign(self, id, collection, campaign, confidence, analyst, date, description): """ Adds an embedded campaign to the TLO. Args: id: the CRITs object id of the TLO collection: The db collection. See main class documentation...
[ "def", "add_embedded_campaign", "(", "self", ",", "id", ",", "collection", ",", "campaign", ",", "confidence", ",", "analyst", ",", "date", ",", "description", ")", ":", "if", "type", "(", "id", ")", "is", "not", "ObjectId", ":", "id", "=", "ObjectId", ...
Adds an embedded campaign to the TLO. Args: id: the CRITs object id of the TLO collection: The db collection. See main class documentation. campaign: The campaign to assign. confidence: The campaign confidence analyst: The analyst making the assignmen...
[ "Adds", "an", "embedded", "campaign", "to", "the", "TLO", "." ]
train
https://github.com/IntegralDefense/critsapi/blob/e770bd81e124eaaeb5f1134ba95f4a35ff345c5a/critsapi/critsdbapi.py#L134-L171
IntegralDefense/critsapi
critsapi/critsdbapi.py
CRITsDBAPI.remove_bucket_list_item
def remove_bucket_list_item(self, id, collection, item): """ Removes an item from the bucket list Args: id: the CRITs object id of the TLO collection: The db collection. See main class documentation. item: the bucket list item to remove Returns: ...
python
def remove_bucket_list_item(self, id, collection, item): """ Removes an item from the bucket list Args: id: the CRITs object id of the TLO collection: The db collection. See main class documentation. item: the bucket list item to remove Returns: ...
[ "def", "remove_bucket_list_item", "(", "self", ",", "id", ",", "collection", ",", "item", ")", ":", "if", "type", "(", "id", ")", "is", "not", "ObjectId", ":", "id", "=", "ObjectId", "(", "id", ")", "obj", "=", "getattr", "(", "self", ".", "db", ",...
Removes an item from the bucket list Args: id: the CRITs object id of the TLO collection: The db collection. See main class documentation. item: the bucket list item to remove Returns: The mongodb result
[ "Removes", "an", "item", "from", "the", "bucket", "list" ]
train
https://github.com/IntegralDefense/critsapi/blob/e770bd81e124eaaeb5f1134ba95f4a35ff345c5a/critsapi/critsdbapi.py#L173-L191
IntegralDefense/critsapi
critsapi/critsdbapi.py
CRITsDBAPI.get_campaign_name_list
def get_campaign_name_list(self): """ Returns a list of all valid campaign names Returns: List of strings containing all valid campaign names """ campaigns = self.find('campaigns', {}) campaign_names = [] for campaign in campaigns: if 'nam...
python
def get_campaign_name_list(self): """ Returns a list of all valid campaign names Returns: List of strings containing all valid campaign names """ campaigns = self.find('campaigns', {}) campaign_names = [] for campaign in campaigns: if 'nam...
[ "def", "get_campaign_name_list", "(", "self", ")", ":", "campaigns", "=", "self", ".", "find", "(", "'campaigns'", ",", "{", "}", ")", "campaign_names", "=", "[", "]", "for", "campaign", "in", "campaigns", ":", "if", "'name'", "in", "campaign", ":", "cam...
Returns a list of all valid campaign names Returns: List of strings containing all valid campaign names
[ "Returns", "a", "list", "of", "all", "valid", "campaign", "names" ]
train
https://github.com/IntegralDefense/critsapi/blob/e770bd81e124eaaeb5f1134ba95f4a35ff345c5a/critsapi/critsdbapi.py#L213-L225
sassoo/goldman
goldman/deserializers/json_7159.py
Deserializer.deserialize
def deserialize(self): """ Invoke the RFC 7159 spec compliant parser :return: the parsed & vetted request body """ super(Deserializer, self).deserialize() try: return json.loads(self.req.get_body()) except TypeError: link = 'tools.ie...
python
def deserialize(self): """ Invoke the RFC 7159 spec compliant parser :return: the parsed & vetted request body """ super(Deserializer, self).deserialize() try: return json.loads(self.req.get_body()) except TypeError: link = 'tools.ie...
[ "def", "deserialize", "(", "self", ")", ":", "super", "(", "Deserializer", ",", "self", ")", ".", "deserialize", "(", ")", "try", ":", "return", "json", ".", "loads", "(", "self", ".", "req", ".", "get_body", "(", ")", ")", "except", "TypeError", ":"...
Invoke the RFC 7159 spec compliant parser :return: the parsed & vetted request body
[ "Invoke", "the", "RFC", "7159", "spec", "compliant", "parser" ]
train
https://github.com/sassoo/goldman/blob/b72540c9ad06b5c68aadb1b4fa8cb0b716260bf2/goldman/deserializers/json_7159.py#L22-L47
callowayproject/Transmogrify
transmogrify/images2gif.py
int_to_bin
def int_to_bin(i): """ Integer to two bytes """ # devide in two parts (bytes) i1 = i % 256 i2 = int(i / 256) # make string (little endian) return chr(i1) + chr(i2)
python
def int_to_bin(i): """ Integer to two bytes """ # devide in two parts (bytes) i1 = i % 256 i2 = int(i / 256) # make string (little endian) return chr(i1) + chr(i2)
[ "def", "int_to_bin", "(", "i", ")", ":", "# devide in two parts (bytes)", "i1", "=", "i", "%", "256", "i2", "=", "int", "(", "i", "/", "256", ")", "# make string (little endian)", "return", "chr", "(", "i1", ")", "+", "chr", "(", "i2", ")" ]
Integer to two bytes
[ "Integer", "to", "two", "bytes" ]
train
https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/images2gif.py#L138-L144
callowayproject/Transmogrify
transmogrify/images2gif.py
write_gif
def write_gif(filename, images, duration=0.1, repeat=True, dither=False, nq=0, sub_rectangles=True, dispose=None): """ write_gif(filename, images, duration=0.1, repeat=True, dither=False, nq=0, sub_rectangles=True, dispose=None) Write an animated gif from the specified image...
python
def write_gif(filename, images, duration=0.1, repeat=True, dither=False, nq=0, sub_rectangles=True, dispose=None): """ write_gif(filename, images, duration=0.1, repeat=True, dither=False, nq=0, sub_rectangles=True, dispose=None) Write an animated gif from the specified image...
[ "def", "write_gif", "(", "filename", ",", "images", ",", "duration", "=", "0.1", ",", "repeat", "=", "True", ",", "dither", "=", "False", ",", "nq", "=", "0", ",", "sub_rectangles", "=", "True", ",", "dispose", "=", "None", ")", ":", "# Check PIL", "...
write_gif(filename, images, duration=0.1, repeat=True, dither=False, nq=0, sub_rectangles=True, dispose=None) Write an animated gif from the specified images. Parameters ---------- filename : string The name of the file to write the image to. images : list Shoul...
[ "write_gif", "(", "filename", "images", "duration", "=", "0", ".", "1", "repeat", "=", "True", "dither", "=", "False", "nq", "=", "0", "sub_rectangles", "=", "True", "dispose", "=", "None", ")" ]
train
https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/images2gif.py#L485-L587
callowayproject/Transmogrify
transmogrify/images2gif.py
GifWriter.get_header_anim
def get_header_anim(self, im): """ get_header_anim(im) Get animation header. To replace PILs getheader()[0] """ bb = "GIF89a" bb += int_to_bin(im.size[0]) bb += int_to_bin(im.size[1]) bb += "\x87\x00\x00" return bb
python
def get_header_anim(self, im): """ get_header_anim(im) Get animation header. To replace PILs getheader()[0] """ bb = "GIF89a" bb += int_to_bin(im.size[0]) bb += int_to_bin(im.size[1]) bb += "\x87\x00\x00" return bb
[ "def", "get_header_anim", "(", "self", ",", "im", ")", ":", "bb", "=", "\"GIF89a\"", "bb", "+=", "int_to_bin", "(", "im", ".", "size", "[", "0", "]", ")", "bb", "+=", "int_to_bin", "(", "im", ".", "size", "[", "1", "]", ")", "bb", "+=", "\"\\x87\...
get_header_anim(im) Get animation header. To replace PILs getheader()[0]
[ "get_header_anim", "(", "im", ")" ]
train
https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/images2gif.py#L154-L164
callowayproject/Transmogrify
transmogrify/images2gif.py
GifWriter.get_image_descriptor
def get_image_descriptor(self, im, xy=None): """ get_image_descriptor(im, xy=None) Used for the local color table properties per image. Otherwise global color table applies to all frames irrespective of whether additional colors comes in play that require a redefined palette. St...
python
def get_image_descriptor(self, im, xy=None): """ get_image_descriptor(im, xy=None) Used for the local color table properties per image. Otherwise global color table applies to all frames irrespective of whether additional colors comes in play that require a redefined palette. St...
[ "def", "get_image_descriptor", "(", "self", ",", "im", ",", "xy", "=", "None", ")", ":", "# Defaule use full image and place at upper left", "if", "xy", "is", "None", ":", "xy", "=", "(", "0", ",", "0", ")", "# Image separator,", "bb", "=", "'\\x2C'", "# Ima...
get_image_descriptor(im, xy=None) Used for the local color table properties per image. Otherwise global color table applies to all frames irrespective of whether additional colors comes in play that require a redefined palette. Still a maximum of 256 color per frame, obviously. ...
[ "get_image_descriptor", "(", "im", "xy", "=", "None", ")" ]
train
https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/images2gif.py#L166-L197
callowayproject/Transmogrify
transmogrify/images2gif.py
GifWriter.get_app_ext
def get_app_ext(self, loops=float('inf')): """ get_app_ext(loops=float('inf')) Application extention. This part specifies the amount of loops. If loops is 0 or inf, it goes on infinitely. """ if loops == 0 or loops == float('inf'): loops = 2**16 - 1 # b...
python
def get_app_ext(self, loops=float('inf')): """ get_app_ext(loops=float('inf')) Application extention. This part specifies the amount of loops. If loops is 0 or inf, it goes on infinitely. """ if loops == 0 or loops == float('inf'): loops = 2**16 - 1 # b...
[ "def", "get_app_ext", "(", "self", ",", "loops", "=", "float", "(", "'inf'", ")", ")", ":", "if", "loops", "==", "0", "or", "loops", "==", "float", "(", "'inf'", ")", ":", "loops", "=", "2", "**", "16", "-", "1", "# bb = \"\" # application extension s...
get_app_ext(loops=float('inf')) Application extention. This part specifies the amount of loops. If loops is 0 or inf, it goes on infinitely.
[ "get_app_ext", "(", "loops", "=", "float", "(", "inf", "))" ]
train
https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/images2gif.py#L199-L216
callowayproject/Transmogrify
transmogrify/images2gif.py
GifWriter.get_graphics_control_ext
def get_graphics_control_ext(self, duration=0.1, dispose=2, transparent_flag=0, transparency_index=0): """ get_graphics_control_ext(duration=0.1, dispose=2) Graphics Control Extension. A sort of header at the start of each image. Specifies duration and transparancy. Dispose ---...
python
def get_graphics_control_ext(self, duration=0.1, dispose=2, transparent_flag=0, transparency_index=0): """ get_graphics_control_ext(duration=0.1, dispose=2) Graphics Control Extension. A sort of header at the start of each image. Specifies duration and transparancy. Dispose ---...
[ "def", "get_graphics_control_ext", "(", "self", ",", "duration", "=", "0.1", ",", "dispose", "=", "2", ",", "transparent_flag", "=", "0", ",", "transparency_index", "=", "0", ")", ":", "bb", "=", "'\\x21\\xF9\\x04'", "bb", "+=", "chr", "(", "(", "(", "di...
get_graphics_control_ext(duration=0.1, dispose=2) Graphics Control Extension. A sort of header at the start of each image. Specifies duration and transparancy. Dispose ------- * 0 - No disposal specified. * 1 - Do not dispose. The graphic is to be left in place. ...
[ "get_graphics_control_ext", "(", "duration", "=", "0", ".", "1", "dispose", "=", "2", ")" ]
train
https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/images2gif.py#L218-L244
callowayproject/Transmogrify
transmogrify/images2gif.py
GifWriter.handle_sub_rectangles
def handle_sub_rectangles(self, images, sub_rectangles): """ handle_sub_rectangles(images) Handle the sub-rectangle stuff. If the rectangles are given by the user, the values are checked. Otherwise the subrectangles are calculated automatically. """ image_info = [im.inf...
python
def handle_sub_rectangles(self, images, sub_rectangles): """ handle_sub_rectangles(images) Handle the sub-rectangle stuff. If the rectangles are given by the user, the values are checked. Otherwise the subrectangles are calculated automatically. """ image_info = [im.inf...
[ "def", "handle_sub_rectangles", "(", "self", ",", "images", ",", "sub_rectangles", ")", ":", "image_info", "=", "[", "im", ".", "info", "for", "im", "in", "images", "]", "if", "isinstance", "(", "sub_rectangles", ",", "(", "tuple", ",", "list", ")", ")",...
handle_sub_rectangles(images) Handle the sub-rectangle stuff. If the rectangles are given by the user, the values are checked. Otherwise the subrectangles are calculated automatically.
[ "handle_sub_rectangles", "(", "images", ")" ]
train
https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/images2gif.py#L246-L292
callowayproject/Transmogrify
transmogrify/images2gif.py
GifWriter.get_sub_rectangles
def get_sub_rectangles(self, ims): """ get_sub_rectangles(ims) Calculate the minimal rectangles that need updating each frame. Returns a two-element tuple containing the cropped images and a list of x-y positions. Calculating the subrectangles takes extra time, obviously. Howev...
python
def get_sub_rectangles(self, ims): """ get_sub_rectangles(ims) Calculate the minimal rectangles that need updating each frame. Returns a two-element tuple containing the cropped images and a list of x-y positions. Calculating the subrectangles takes extra time, obviously. Howev...
[ "def", "get_sub_rectangles", "(", "self", ",", "ims", ")", ":", "# Check image count", "if", "len", "(", "ims", ")", "<", "2", ":", "return", "ims", ",", "[", "(", "0", ",", "0", ")", "for", "i", "in", "ims", "]", "# We need numpy", "if", "np", "is...
get_sub_rectangles(ims) Calculate the minimal rectangles that need updating each frame. Returns a two-element tuple containing the cropped images and a list of x-y positions. Calculating the subrectangles takes extra time, obviously. However, if the image sizes were reduced, th...
[ "get_sub_rectangles", "(", "ims", ")" ]
train
https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/images2gif.py#L294-L344
callowayproject/Transmogrify
transmogrify/images2gif.py
GifWriter.convert_images_to_pil
def convert_images_to_pil(self, images, dither, nq=0, images_info=None): """ convert_images_to_pil(images, nq=0) Convert images to Paletted PIL images, which can then be written to a single animaged GIF. """ # Convert to PIL images images2 = [] for im in images...
python
def convert_images_to_pil(self, images, dither, nq=0, images_info=None): """ convert_images_to_pil(images, nq=0) Convert images to Paletted PIL images, which can then be written to a single animaged GIF. """ # Convert to PIL images images2 = [] for im in images...
[ "def", "convert_images_to_pil", "(", "self", ",", "images", ",", "dither", ",", "nq", "=", "0", ",", "images_info", "=", "None", ")", ":", "# Convert to PIL images", "images2", "=", "[", "]", "for", "im", "in", "images", ":", "if", "isinstance", "(", "im...
convert_images_to_pil(images, nq=0) Convert images to Paletted PIL images, which can then be written to a single animaged GIF.
[ "convert_images_to_pil", "(", "images", "nq", "=", "0", ")" ]
train
https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/images2gif.py#L346-L399
callowayproject/Transmogrify
transmogrify/images2gif.py
GifWriter.write_gif_to_file
def write_gif_to_file(self, fp, images, durations, loops, xys, disposes): """ write_gif_to_file(fp, images, durations, loops, xys, disposes) Given a set of images writes the bytes to the specified stream. """ # Obtain palette for all images and count each occurance palettes, o...
python
def write_gif_to_file(self, fp, images, durations, loops, xys, disposes): """ write_gif_to_file(fp, images, durations, loops, xys, disposes) Given a set of images writes the bytes to the specified stream. """ # Obtain palette for all images and count each occurance palettes, o...
[ "def", "write_gif_to_file", "(", "self", ",", "fp", ",", "images", ",", "durations", ",", "loops", ",", "xys", ",", "disposes", ")", ":", "# Obtain palette for all images and count each occurance", "palettes", ",", "occur", "=", "[", "]", ",", "[", "]", "for",...
write_gif_to_file(fp, images, durations, loops, xys, disposes) Given a set of images writes the bytes to the specified stream.
[ "write_gif_to_file", "(", "fp", "images", "durations", "loops", "xys", "disposes", ")" ]
train
https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/images2gif.py#L401-L480
callowayproject/Transmogrify
transmogrify/images2gif.py
NeuQuant.palette_image
def palette_image(self): """ PIL weird interface for making a paletted image: create an image which already has the palette, and use that in Image.quantize. This function returns this palette image. """ if self.pimage is None: palette = [] for i in range(s...
python
def palette_image(self): """ PIL weird interface for making a paletted image: create an image which already has the palette, and use that in Image.quantize. This function returns this palette image. """ if self.pimage is None: palette = [] for i in range(s...
[ "def", "palette_image", "(", "self", ")", ":", "if", "self", ".", "pimage", "is", "None", ":", "palette", "=", "[", "]", "for", "i", "in", "range", "(", "self", ".", "NETSIZE", ")", ":", "palette", ".", "extend", "(", "self", ".", "colormap", "[", ...
PIL weird interface for making a paletted image: create an image which already has the palette, and use that in Image.quantize. This function returns this palette image.
[ "PIL", "weird", "interface", "for", "making", "a", "paletted", "image", ":", "create", "an", "image", "which", "already", "has", "the", "palette", "and", "use", "that", "in", "Image", ".", "quantize", ".", "This", "function", "returns", "this", "palette", ...
train
https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/images2gif.py#L977-L991
callowayproject/Transmogrify
transmogrify/images2gif.py
NeuQuant.quantize_without_scipy
def quantize_without_scipy(self, image): """" This function can be used if no scipy is availabe. It's 7 times slower though. """ w, h = image.size px = np.asarray(image).copy() memo = {} for j in range(w): for i in range(h): key = (px[i...
python
def quantize_without_scipy(self, image): """" This function can be used if no scipy is availabe. It's 7 times slower though. """ w, h = image.size px = np.asarray(image).copy() memo = {} for j in range(w): for i in range(h): key = (px[i...
[ "def", "quantize_without_scipy", "(", "self", ",", "image", ")", ":", "w", ",", "h", "=", "image", ".", "size", "px", "=", "np", ".", "asarray", "(", "image", ")", ".", "copy", "(", ")", "memo", "=", "{", "}", "for", "j", "in", "range", "(", "w...
This function can be used if no scipy is availabe. It's 7 times slower though.
[ "This", "function", "can", "be", "used", "if", "no", "scipy", "is", "availabe", ".", "It", "s", "7", "times", "slower", "though", "." ]
train
https://github.com/callowayproject/Transmogrify/blob/f1f891b8b923b3a1ede5eac7f60531c1c472379e/transmogrify/images2gif.py#L1015-L1031
espenak/djangosenchatools
djangosenchatools/management/commands/senchatoolsbuild.py
get_installed_extjs_apps
def get_installed_extjs_apps(): """ Get all installed extjs apps. :return: List of ``(appdir, module, appname)``. """ installed_apps = [] checked = set() for app in settings.INSTALLED_APPS: if not app.startswith('django.') and not app in checked: checked.add(app) ...
python
def get_installed_extjs_apps(): """ Get all installed extjs apps. :return: List of ``(appdir, module, appname)``. """ installed_apps = [] checked = set() for app in settings.INSTALLED_APPS: if not app.startswith('django.') and not app in checked: checked.add(app) ...
[ "def", "get_installed_extjs_apps", "(", ")", ":", "installed_apps", "=", "[", "]", "checked", "=", "set", "(", ")", "for", "app", "in", "settings", ".", "INSTALLED_APPS", ":", "if", "not", "app", ".", "startswith", "(", "'django.'", ")", "and", "not", "a...
Get all installed extjs apps. :return: List of ``(appdir, module, appname)``.
[ "Get", "all", "installed", "extjs", "apps", "." ]
train
https://github.com/espenak/djangosenchatools/blob/da1bca9365300de303e833de4b4bd57671c1d11a/djangosenchatools/management/commands/senchatoolsbuild.py#L34-L49
espenak/djangosenchatools
djangosenchatools/management/commands/senchatoolsbuild.py
SenchaToolsWrapper.createJsbConfig
def createJsbConfig(self): """ Create JSB config file using ``sencha create jsb``. :return: The created jsb3 config as a string. """ tempdir = mkdtemp() tempfile = join(tempdir, 'app.jsb3') cmd = ['sencha', 'create', 'jsb', '-a', self.url, '-p', tempfile] ...
python
def createJsbConfig(self): """ Create JSB config file using ``sencha create jsb``. :return: The created jsb3 config as a string. """ tempdir = mkdtemp() tempfile = join(tempdir, 'app.jsb3') cmd = ['sencha', 'create', 'jsb', '-a', self.url, '-p', tempfile] ...
[ "def", "createJsbConfig", "(", "self", ")", ":", "tempdir", "=", "mkdtemp", "(", ")", "tempfile", "=", "join", "(", "tempdir", ",", "'app.jsb3'", ")", "cmd", "=", "[", "'sencha'", ",", "'create'", ",", "'jsb'", ",", "'-a'", ",", "self", ".", "url", "...
Create JSB config file using ``sencha create jsb``. :return: The created jsb3 config as a string.
[ "Create", "JSB", "config", "file", "using", "sencha", "create", "jsb", "." ]
train
https://github.com/espenak/djangosenchatools/blob/da1bca9365300de303e833de4b4bd57671c1d11a/djangosenchatools/management/commands/senchatoolsbuild.py#L76-L89
espenak/djangosenchatools
djangosenchatools/management/commands/senchatoolsbuild.py
SenchaToolsWrapper.cleanJsbConfig
def cleanJsbConfig(self, jsbconfig): """ Clean up the JSB config. """ config = json.loads(jsbconfig) self._cleanJsbAllClassesSection(config) self._cleanJsbAppAllSection(config) return json.dumps(config, indent=4)
python
def cleanJsbConfig(self, jsbconfig): """ Clean up the JSB config. """ config = json.loads(jsbconfig) self._cleanJsbAllClassesSection(config) self._cleanJsbAppAllSection(config) return json.dumps(config, indent=4)
[ "def", "cleanJsbConfig", "(", "self", ",", "jsbconfig", ")", ":", "config", "=", "json", ".", "loads", "(", "jsbconfig", ")", "self", ".", "_cleanJsbAllClassesSection", "(", "config", ")", "self", ".", "_cleanJsbAppAllSection", "(", "config", ")", "return", ...
Clean up the JSB config.
[ "Clean", "up", "the", "JSB", "config", "." ]
train
https://github.com/espenak/djangosenchatools/blob/da1bca9365300de303e833de4b4bd57671c1d11a/djangosenchatools/management/commands/senchatoolsbuild.py#L91-L98
espenak/djangosenchatools
djangosenchatools/management/commands/senchatoolsbuild.py
SenchaToolsWrapper.createCleanJsbConfig
def createCleanJsbConfig(self): """ Run :meth:`createJsbConfig`, clean up the JSB with :meth:`cleanJsbConfig` and return the result. """ jsb = self.createJsbConfig() log.debug('sencha generated JSB config: %s', jsb) jsb = self.cleanJsbConfig(jsb) log.debug...
python
def createCleanJsbConfig(self): """ Run :meth:`createJsbConfig`, clean up the JSB with :meth:`cleanJsbConfig` and return the result. """ jsb = self.createJsbConfig() log.debug('sencha generated JSB config: %s', jsb) jsb = self.cleanJsbConfig(jsb) log.debug...
[ "def", "createCleanJsbConfig", "(", "self", ")", ":", "jsb", "=", "self", ".", "createJsbConfig", "(", ")", "log", ".", "debug", "(", "'sencha generated JSB config: %s'", ",", "jsb", ")", "jsb", "=", "self", ".", "cleanJsbConfig", "(", "jsb", ")", "log", "...
Run :meth:`createJsbConfig`, clean up the JSB with :meth:`cleanJsbConfig` and return the result.
[ "Run", ":", "meth", ":", "createJsbConfig", "clean", "up", "the", "JSB", "with", ":", "meth", ":", "cleanJsbConfig", "and", "return", "the", "result", "." ]
train
https://github.com/espenak/djangosenchatools/blob/da1bca9365300de303e833de4b4bd57671c1d11a/djangosenchatools/management/commands/senchatoolsbuild.py#L100-L109
espenak/djangosenchatools
djangosenchatools/management/commands/senchatoolsbuild.py
SenchaToolsWrapper._cleanJsbAllClassesSection
def _cleanJsbAllClassesSection(self, config): """ Fixes two issues with the sencha created JSB: - All extjs urls are prefixed by ``../static`` instead of ``/static`` (no idea why). - We assume static files are served at ``/static``, but collectstatic may ...
python
def _cleanJsbAllClassesSection(self, config): """ Fixes two issues with the sencha created JSB: - All extjs urls are prefixed by ``../static`` instead of ``/static`` (no idea why). - We assume static files are served at ``/static``, but collectstatic may ...
[ "def", "_cleanJsbAllClassesSection", "(", "self", ",", "config", ")", ":", "allclasses", "=", "config", "[", "'builds'", "]", "[", "0", "]", "for", "fileinfo", "in", "allclasses", "[", "'files'", "]", ":", "path", "=", "fileinfo", "[", "'path'", "]", "if...
Fixes two issues with the sencha created JSB: - All extjs urls are prefixed by ``../static`` instead of ``/static`` (no idea why). - We assume static files are served at ``/static``, but collectstatic may not build files in ``static/``. Therefore, we replace ``/stati...
[ "Fixes", "two", "issues", "with", "the", "sencha", "created", "JSB", ":" ]
train
https://github.com/espenak/djangosenchatools/blob/da1bca9365300de303e833de4b4bd57671c1d11a/djangosenchatools/management/commands/senchatoolsbuild.py#L119-L135
espenak/djangosenchatools
djangosenchatools/management/commands/senchatoolsbuild.py
SenchaToolsWrapper.buildFromJsbString
def buildFromJsbString(self, jsb, nocompressjs=False): """ Build from the given config file using ``sencha build``. :param jsb: The JSB config as a string. :param nocompressjs: Compress the javascript? If ``True``, run ``sencha build --nocompress``. """ tempconffile = 't...
python
def buildFromJsbString(self, jsb, nocompressjs=False): """ Build from the given config file using ``sencha build``. :param jsb: The JSB config as a string. :param nocompressjs: Compress the javascript? If ``True``, run ``sencha build --nocompress``. """ tempconffile = 't...
[ "def", "buildFromJsbString", "(", "self", ",", "jsb", ",", "nocompressjs", "=", "False", ")", ":", "tempconffile", "=", "'temp-app.jsb3'", "cmd", "=", "[", "'sencha'", ",", "'build'", ",", "'-p'", ",", "tempconffile", ",", "'-d'", ",", "self", ".", "outdir...
Build from the given config file using ``sencha build``. :param jsb: The JSB config as a string. :param nocompressjs: Compress the javascript? If ``True``, run ``sencha build --nocompress``.
[ "Build", "from", "the", "given", "config", "file", "using", "sencha", "build", "." ]
train
https://github.com/espenak/djangosenchatools/blob/da1bca9365300de303e833de4b4bd57671c1d11a/djangosenchatools/management/commands/senchatoolsbuild.py#L149-L165
espenak/djangosenchatools
djangosenchatools/management/commands/senchatoolsbuild.py
SenchaToolsWrapper.configureAndBuild
def configureAndBuild(self, nocompressjs=False): """ Run :meth:`createCleanJsbConfig` and :meth:`build`. """ jsb = self.createCleanJsbConfig() self.buildFromJsbString(jsb, nocompressjs)
python
def configureAndBuild(self, nocompressjs=False): """ Run :meth:`createCleanJsbConfig` and :meth:`build`. """ jsb = self.createCleanJsbConfig() self.buildFromJsbString(jsb, nocompressjs)
[ "def", "configureAndBuild", "(", "self", ",", "nocompressjs", "=", "False", ")", ":", "jsb", "=", "self", ".", "createCleanJsbConfig", "(", ")", "self", ".", "buildFromJsbString", "(", "jsb", ",", "nocompressjs", ")" ]
Run :meth:`createCleanJsbConfig` and :meth:`build`.
[ "Run", ":", "meth", ":", "createCleanJsbConfig", "and", ":", "meth", ":", "build", "." ]
train
https://github.com/espenak/djangosenchatools/blob/da1bca9365300de303e833de4b4bd57671c1d11a/djangosenchatools/management/commands/senchatoolsbuild.py#L167-L172
ronaldguillen/wave
wave/metadata.py
SimpleMetadata.determine_actions
def determine_actions(self, request, view): """ For generic class based views we return information about the fields that are accepted for 'PUT' and 'POST' methods. """ actions = {} for method in {'PUT', 'POST'} & set(view.allowed_methods): view.request = clon...
python
def determine_actions(self, request, view): """ For generic class based views we return information about the fields that are accepted for 'PUT' and 'POST' methods. """ actions = {} for method in {'PUT', 'POST'} & set(view.allowed_methods): view.request = clon...
[ "def", "determine_actions", "(", "self", ",", "request", ",", "view", ")", ":", "actions", "=", "{", "}", "for", "method", "in", "{", "'PUT'", ",", "'POST'", "}", "&", "set", "(", "view", ".", "allowed_methods", ")", ":", "view", ".", "request", "=",...
For generic class based views we return information about the fields that are accepted for 'PUT' and 'POST' methods.
[ "For", "generic", "class", "based", "views", "we", "return", "information", "about", "the", "fields", "that", "are", "accepted", "for", "PUT", "and", "POST", "methods", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/metadata.py#L74-L99
ronaldguillen/wave
wave/metadata.py
SimpleMetadata.get_serializer_info
def get_serializer_info(self, serializer): """ Given an instance of a serializer, return a dictionary of metadata about its fields. """ if hasattr(serializer, 'child'): # If this is a `ListSerializer` then we want to examine the # underlying child serializ...
python
def get_serializer_info(self, serializer): """ Given an instance of a serializer, return a dictionary of metadata about its fields. """ if hasattr(serializer, 'child'): # If this is a `ListSerializer` then we want to examine the # underlying child serializ...
[ "def", "get_serializer_info", "(", "self", ",", "serializer", ")", ":", "if", "hasattr", "(", "serializer", ",", "'child'", ")", ":", "# If this is a `ListSerializer` then we want to examine the", "# underlying child serializer instance instead.", "serializer", "=", "serializ...
Given an instance of a serializer, return a dictionary of metadata about its fields.
[ "Given", "an", "instance", "of", "a", "serializer", "return", "a", "dictionary", "of", "metadata", "about", "its", "fields", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/metadata.py#L101-L113
ronaldguillen/wave
wave/metadata.py
SimpleMetadata.get_field_info
def get_field_info(self, field): """ Given an instance of a serializer field, return a dictionary of metadata about it. """ field_info = OrderedDict() field_info['type'] = self.label_lookup[field] field_info['required'] = getattr(field, 'required', False) ...
python
def get_field_info(self, field): """ Given an instance of a serializer field, return a dictionary of metadata about it. """ field_info = OrderedDict() field_info['type'] = self.label_lookup[field] field_info['required'] = getattr(field, 'required', False) ...
[ "def", "get_field_info", "(", "self", ",", "field", ")", ":", "field_info", "=", "OrderedDict", "(", ")", "field_info", "[", "'type'", "]", "=", "self", ".", "label_lookup", "[", "field", "]", "field_info", "[", "'required'", "]", "=", "getattr", "(", "f...
Given an instance of a serializer field, return a dictionary of metadata about it.
[ "Given", "an", "instance", "of", "a", "serializer", "field", "return", "a", "dictionary", "of", "metadata", "about", "it", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/metadata.py#L115-L149
dasevilla/rovi-python
roviclient/search.py
SearchApi.make_request
def make_request(self, endpoint, entitiy_type, query, params=None): """ Performs the API request. Most methods are a wrapper around this one. """ if params is None: params = {} params['entitytype'] = entitiy_type params['query'] = query params['countr...
python
def make_request(self, endpoint, entitiy_type, query, params=None): """ Performs the API request. Most methods are a wrapper around this one. """ if params is None: params = {} params['entitytype'] = entitiy_type params['query'] = query params['countr...
[ "def", "make_request", "(", "self", ",", "endpoint", ",", "entitiy_type", ",", "query", ",", "params", "=", "None", ")", ":", "if", "params", "is", "None", ":", "params", "=", "{", "}", "params", "[", "'entitytype'", "]", "=", "entitiy_type", "params", ...
Performs the API request. Most methods are a wrapper around this one.
[ "Performs", "the", "API", "request", ".", "Most", "methods", "are", "a", "wrapper", "around", "this", "one", "." ]
train
https://github.com/dasevilla/rovi-python/blob/46039d6ebfcf2ff20b4edb4636cb972682cf6af4/roviclient/search.py#L15-L28
dasevilla/rovi-python
roviclient/search.py
SearchApi.music_search
def music_search(self, entitiy_type, query, **kwargs): """ Search the music database Where ``entitiy_type`` is a comma separated list of: ``song`` songs ``album`` albums ``composition`` compositions ``artist`` p...
python
def music_search(self, entitiy_type, query, **kwargs): """ Search the music database Where ``entitiy_type`` is a comma separated list of: ``song`` songs ``album`` albums ``composition`` compositions ``artist`` p...
[ "def", "music_search", "(", "self", ",", "entitiy_type", ",", "query", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "make_request", "(", "'music'", ",", "entitiy_type", ",", "query", ",", "kwargs", ")" ]
Search the music database Where ``entitiy_type`` is a comma separated list of: ``song`` songs ``album`` albums ``composition`` compositions ``artist`` people working in music
[ "Search", "the", "music", "database" ]
train
https://github.com/dasevilla/rovi-python/blob/46039d6ebfcf2ff20b4edb4636cb972682cf6af4/roviclient/search.py#L30-L48
dasevilla/rovi-python
roviclient/search.py
SearchApi.amg_video_search
def amg_video_search(self, entitiy_type, query, **kwargs): """ Search the Movies and TV database Where ``entitiy_type`` is a comma separated list of: ``movie`` Movies ``tvseries`` TV series ``credit`` people working in TV or movies ...
python
def amg_video_search(self, entitiy_type, query, **kwargs): """ Search the Movies and TV database Where ``entitiy_type`` is a comma separated list of: ``movie`` Movies ``tvseries`` TV series ``credit`` people working in TV or movies ...
[ "def", "amg_video_search", "(", "self", ",", "entitiy_type", ",", "query", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "make_request", "(", "'amgvideo'", ",", "entitiy_type", ",", "query", ",", "kwargs", ")" ]
Search the Movies and TV database Where ``entitiy_type`` is a comma separated list of: ``movie`` Movies ``tvseries`` TV series ``credit`` people working in TV or movies
[ "Search", "the", "Movies", "and", "TV", "database" ]
train
https://github.com/dasevilla/rovi-python/blob/46039d6ebfcf2ff20b4edb4636cb972682cf6af4/roviclient/search.py#L50-L65
dasevilla/rovi-python
roviclient/search.py
SearchApi.video_search
def video_search(self, entitiy_type, query, **kwargs): """ Search the TV schedule database Where ``entitiy_type`` is a comma separated list of: ``movie`` Movie ``tvseries`` TV series ``episode`` Episode titles ``onetimeonly...
python
def video_search(self, entitiy_type, query, **kwargs): """ Search the TV schedule database Where ``entitiy_type`` is a comma separated list of: ``movie`` Movie ``tvseries`` TV series ``episode`` Episode titles ``onetimeonly...
[ "def", "video_search", "(", "self", ",", "entitiy_type", ",", "query", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "make_request", "(", "'video'", ",", "entitiy_type", ",", "query", ",", "kwargs", ")" ]
Search the TV schedule database Where ``entitiy_type`` is a comma separated list of: ``movie`` Movie ``tvseries`` TV series ``episode`` Episode titles ``onetimeonly`` TV programs ``credit`` People working i...
[ "Search", "the", "TV", "schedule", "database" ]
train
https://github.com/dasevilla/rovi-python/blob/46039d6ebfcf2ff20b4edb4636cb972682cf6af4/roviclient/search.py#L67-L88
TC01/calcpkg
calcrepo/index.py
structureOutput
def structureOutput(fileUrl, fileName, searchFiles, format=True, space=40): """Formats the output of a list of packages""" #First, remove the filename if format: splitUrls = fileUrl[1:].split('/') fileUrl = "" for splitUrl in splitUrls: # This is a gimmicky fix to make formatting consistent # Cemetech do...
python
def structureOutput(fileUrl, fileName, searchFiles, format=True, space=40): """Formats the output of a list of packages""" #First, remove the filename if format: splitUrls = fileUrl[1:].split('/') fileUrl = "" for splitUrl in splitUrls: # This is a gimmicky fix to make formatting consistent # Cemetech do...
[ "def", "structureOutput", "(", "fileUrl", ",", "fileName", ",", "searchFiles", ",", "format", "=", "True", ",", "space", "=", "40", ")", ":", "#First, remove the filename", "if", "format", ":", "splitUrls", "=", "fileUrl", "[", "1", ":", "]", ".", "split",...
Formats the output of a list of packages
[ "Formats", "the", "output", "of", "a", "list", "of", "packages" ]
train
https://github.com/TC01/calcpkg/blob/5168f606264620a090b42a64354331d208b00d5f/calcrepo/index.py#L257-L280
TC01/calcpkg
calcrepo/index.py
Index.count
def count(self, searchString, category="", math=False, game=False, searchFiles=False, extension=""): """Counts the number of ticalc.org files containing some search term, doesn't return them""" fileData = {} nameData = {} #Search the index if searchFiles: fileData = self.searchNamesIndex(self.fileIndex,...
python
def count(self, searchString, category="", math=False, game=False, searchFiles=False, extension=""): """Counts the number of ticalc.org files containing some search term, doesn't return them""" fileData = {} nameData = {} #Search the index if searchFiles: fileData = self.searchNamesIndex(self.fileIndex,...
[ "def", "count", "(", "self", ",", "searchString", ",", "category", "=", "\"\"", ",", "math", "=", "False", ",", "game", "=", "False", ",", "searchFiles", "=", "False", ",", "extension", "=", "\"\"", ")", ":", "fileData", "=", "{", "}", "nameData", "=...
Counts the number of ticalc.org files containing some search term, doesn't return them
[ "Counts", "the", "number", "of", "ticalc", ".", "org", "files", "containing", "some", "search", "term", "doesn", "t", "return", "them" ]
train
https://github.com/TC01/calcpkg/blob/5168f606264620a090b42a64354331d208b00d5f/calcrepo/index.py#L19-L49
TC01/calcpkg
calcrepo/index.py
Index.searchHierarchy
def searchHierarchy(self, fparent): """Core function to search directory structure for child files and folders of a parent""" data = [] returnData = [] parentslashes = fparent.count('/') filecount = 0 foldercount = 0 #open files for folder searching try: dirFile = open(self.dirIndex, 'rt') except...
python
def searchHierarchy(self, fparent): """Core function to search directory structure for child files and folders of a parent""" data = [] returnData = [] parentslashes = fparent.count('/') filecount = 0 foldercount = 0 #open files for folder searching try: dirFile = open(self.dirIndex, 'rt') except...
[ "def", "searchHierarchy", "(", "self", ",", "fparent", ")", ":", "data", "=", "[", "]", "returnData", "=", "[", "]", "parentslashes", "=", "fparent", ".", "count", "(", "'/'", ")", "filecount", "=", "0", "foldercount", "=", "0", "#open files for folder sea...
Core function to search directory structure for child files and folders of a parent
[ "Core", "function", "to", "search", "directory", "structure", "for", "child", "files", "and", "folders", "of", "a", "parent" ]
train
https://github.com/TC01/calcpkg/blob/5168f606264620a090b42a64354331d208b00d5f/calcrepo/index.py#L51-L98
TC01/calcpkg
calcrepo/index.py
Index.search
def search(self, searchString, category="", math=False, game=False, searchFiles=False, extension=""): """Core function to search the indexes and return data""" data = [] nameData = {} fileData = {} #Search the name index if searchFiles: fileData = self.searchNamesIndex(self.fileIndex, fileData, search...
python
def search(self, searchString, category="", math=False, game=False, searchFiles=False, extension=""): """Core function to search the indexes and return data""" data = [] nameData = {} fileData = {} #Search the name index if searchFiles: fileData = self.searchNamesIndex(self.fileIndex, fileData, search...
[ "def", "search", "(", "self", ",", "searchString", ",", "category", "=", "\"\"", ",", "math", "=", "False", ",", "game", "=", "False", ",", "searchFiles", "=", "False", ",", "extension", "=", "\"\"", ")", ":", "data", "=", "[", "]", "nameData", "=", ...
Core function to search the indexes and return data
[ "Core", "function", "to", "search", "the", "indexes", "and", "return", "data" ]
train
https://github.com/TC01/calcpkg/blob/5168f606264620a090b42a64354331d208b00d5f/calcrepo/index.py#L101-L157
TC01/calcpkg
calcrepo/index.py
Index.searchFilesIndex
def searchFilesIndex(self, nameData, fileData, fileIndex, searchString, category="", math=False, game=False, extension=""): """Search the files index using the namedata and returns the filedata""" try: fileFile = open(fileIndex, 'rt') except IOError: self.repo.printd("Error: Unable to read index file " + se...
python
def searchFilesIndex(self, nameData, fileData, fileIndex, searchString, category="", math=False, game=False, extension=""): """Search the files index using the namedata and returns the filedata""" try: fileFile = open(fileIndex, 'rt') except IOError: self.repo.printd("Error: Unable to read index file " + se...
[ "def", "searchFilesIndex", "(", "self", ",", "nameData", ",", "fileData", ",", "fileIndex", ",", "searchString", ",", "category", "=", "\"\"", ",", "math", "=", "False", ",", "game", "=", "False", ",", "extension", "=", "\"\"", ")", ":", "try", ":", "f...
Search the files index using the namedata and returns the filedata
[ "Search", "the", "files", "index", "using", "the", "namedata", "and", "returns", "the", "filedata" ]
train
https://github.com/TC01/calcpkg/blob/5168f606264620a090b42a64354331d208b00d5f/calcrepo/index.py#L159-L209
TC01/calcpkg
calcrepo/index.py
Index.searchNamesIndex
def searchNamesIndex(self, nameIndex, nameData, searchString, category="", math=False, game=False, extension="", searchFiles=False): """Search the names index for a string and returns the namedata""" nameData = {} try: nameFile = open(nameIndex, 'rt') except IOError: self.repo.printd("Error: Unable to rea...
python
def searchNamesIndex(self, nameIndex, nameData, searchString, category="", math=False, game=False, extension="", searchFiles=False): """Search the names index for a string and returns the namedata""" nameData = {} try: nameFile = open(nameIndex, 'rt') except IOError: self.repo.printd("Error: Unable to rea...
[ "def", "searchNamesIndex", "(", "self", ",", "nameIndex", ",", "nameData", ",", "searchString", ",", "category", "=", "\"\"", ",", "math", "=", "False", ",", "game", "=", "False", ",", "extension", "=", "\"\"", ",", "searchFiles", "=", "False", ")", ":",...
Search the names index for a string and returns the namedata
[ "Search", "the", "names", "index", "for", "a", "string", "and", "returns", "the", "namedata" ]
train
https://github.com/TC01/calcpkg/blob/5168f606264620a090b42a64354331d208b00d5f/calcrepo/index.py#L211-L255
ronaldguillen/wave
wave/negotiation.py
DefaultContentNegotiation.select_parser
def select_parser(self, request, parsers): """ Given a list of parsers and a media type, return the appropriate parser to handle the incoming request. """ for parser in parsers: if media_type_matches(parser.media_type, request.content_type): return par...
python
def select_parser(self, request, parsers): """ Given a list of parsers and a media type, return the appropriate parser to handle the incoming request. """ for parser in parsers: if media_type_matches(parser.media_type, request.content_type): return par...
[ "def", "select_parser", "(", "self", ",", "request", ",", "parsers", ")", ":", "for", "parser", "in", "parsers", ":", "if", "media_type_matches", "(", "parser", ".", "media_type", ",", "request", ".", "content_type", ")", ":", "return", "parser", "return", ...
Given a list of parsers and a media type, return the appropriate parser to handle the incoming request.
[ "Given", "a", "list", "of", "parsers", "and", "a", "media", "type", "return", "the", "appropriate", "parser", "to", "handle", "the", "incoming", "request", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/negotiation.py#L27-L35
ronaldguillen/wave
wave/negotiation.py
DefaultContentNegotiation.select_renderer
def select_renderer(self, request, renderers, format_suffix=None): """ Given a request and a list of renderers, return a two-tuple of: (renderer, media type). """ # Allow URL style format override. eg. "?format=json format_query_param = self.settings.URL_FORMAT_OVERRIDE ...
python
def select_renderer(self, request, renderers, format_suffix=None): """ Given a request and a list of renderers, return a two-tuple of: (renderer, media type). """ # Allow URL style format override. eg. "?format=json format_query_param = self.settings.URL_FORMAT_OVERRIDE ...
[ "def", "select_renderer", "(", "self", ",", "request", ",", "renderers", ",", "format_suffix", "=", "None", ")", ":", "# Allow URL style format override. eg. \"?format=json", "format_query_param", "=", "self", ".", "settings", ".", "URL_FORMAT_OVERRIDE", "format", "=",...
Given a request and a list of renderers, return a two-tuple of: (renderer, media type).
[ "Given", "a", "request", "and", "a", "list", "of", "renderers", "return", "a", "two", "-", "tuple", "of", ":", "(", "renderer", "media", "type", ")", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/negotiation.py#L37-L78
ronaldguillen/wave
wave/negotiation.py
DefaultContentNegotiation.filter_renderers
def filter_renderers(self, renderers, format): """ If there is a '.json' style format suffix, filter the renderers so that we only negotiation against those that accept that format. """ renderers = [renderer for renderer in renderers if renderer.format == for...
python
def filter_renderers(self, renderers, format): """ If there is a '.json' style format suffix, filter the renderers so that we only negotiation against those that accept that format. """ renderers = [renderer for renderer in renderers if renderer.format == for...
[ "def", "filter_renderers", "(", "self", ",", "renderers", ",", "format", ")", ":", "renderers", "=", "[", "renderer", "for", "renderer", "in", "renderers", "if", "renderer", ".", "format", "==", "format", "]", "if", "not", "renderers", ":", "raise", "Http4...
If there is a '.json' style format suffix, filter the renderers so that we only negotiation against those that accept that format.
[ "If", "there", "is", "a", ".", "json", "style", "format", "suffix", "filter", "the", "renderers", "so", "that", "we", "only", "negotiation", "against", "those", "that", "accept", "that", "format", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/negotiation.py#L80-L89
ronaldguillen/wave
wave/negotiation.py
DefaultContentNegotiation.get_accept_list
def get_accept_list(self, request): """ Given the incoming request, return a tokenised list of media type strings. """ header = request.META.get('HTTP_ACCEPT', '*/*') return [token.strip() for token in header.split(',')]
python
def get_accept_list(self, request): """ Given the incoming request, return a tokenised list of media type strings. """ header = request.META.get('HTTP_ACCEPT', '*/*') return [token.strip() for token in header.split(',')]
[ "def", "get_accept_list", "(", "self", ",", "request", ")", ":", "header", "=", "request", ".", "META", ".", "get", "(", "'HTTP_ACCEPT'", ",", "'*/*'", ")", "return", "[", "token", ".", "strip", "(", ")", "for", "token", "in", "header", ".", "split", ...
Given the incoming request, return a tokenised list of media type strings.
[ "Given", "the", "incoming", "request", "return", "a", "tokenised", "list", "of", "media", "type", "strings", "." ]
train
https://github.com/ronaldguillen/wave/blob/20bb979c917f7634d8257992e6d449dc751256a9/wave/negotiation.py#L91-L97
radjkarl/fancyTools
fancytools/fit/linregressIgnoringOutliers.py
linregressIgnoringOutliers
def linregressIgnoringOutliers(x, y, n_iter=3, nstd=2): """ do linear regression [n_iter] times successive removing [outliers] return result of normal linregress """ for _ in range(n_iter): m, n = linregress(x, y)[:2] y_fit = x * m + n dy = y - y_fit std = (dy**2)...
python
def linregressIgnoringOutliers(x, y, n_iter=3, nstd=2): """ do linear regression [n_iter] times successive removing [outliers] return result of normal linregress """ for _ in range(n_iter): m, n = linregress(x, y)[:2] y_fit = x * m + n dy = y - y_fit std = (dy**2)...
[ "def", "linregressIgnoringOutliers", "(", "x", ",", "y", ",", "n_iter", "=", "3", ",", "nstd", "=", "2", ")", ":", "for", "_", "in", "range", "(", "n_iter", ")", ":", "m", ",", "n", "=", "linregress", "(", "x", ",", "y", ")", "[", ":", "2", "...
do linear regression [n_iter] times successive removing [outliers] return result of normal linregress
[ "do", "linear", "regression", "[", "n_iter", "]", "times", "successive", "removing", "[", "outliers", "]", "return", "result", "of", "normal", "linregress" ]
train
https://github.com/radjkarl/fancyTools/blob/4c4d961003dc4ed6e46429a0c24f7e2bb52caa8b/fancytools/fit/linregressIgnoringOutliers.py#L5-L22
etcher-be/emiz
emiz/parking_spots.py
unit_pos_to_spot
def unit_pos_to_spot(unit_pos) -> ParkingSpot: """ Translates a unit position to a known parking spot Args: unit_pos: unit position as Vec2 Returns: ParkingSpot object """ min_ = 50 res = None for airport in parkings: for spot in parkings[airport]: # type: ignore ...
python
def unit_pos_to_spot(unit_pos) -> ParkingSpot: """ Translates a unit position to a known parking spot Args: unit_pos: unit position as Vec2 Returns: ParkingSpot object """ min_ = 50 res = None for airport in parkings: for spot in parkings[airport]: # type: ignore ...
[ "def", "unit_pos_to_spot", "(", "unit_pos", ")", "->", "ParkingSpot", ":", "min_", "=", "50", "res", "=", "None", "for", "airport", "in", "parkings", ":", "for", "spot", "in", "parkings", "[", "airport", "]", ":", "# type: ignore", "spot_pos", "=", "parkin...
Translates a unit position to a known parking spot Args: unit_pos: unit position as Vec2 Returns: ParkingSpot object
[ "Translates", "a", "unit", "position", "to", "a", "known", "parking", "spot" ]
train
https://github.com/etcher-be/emiz/blob/1c3e32711921d7e600e85558ffe5d337956372de/emiz/parking_spots.py#L39-L58
stephanepechard/projy
projy/collectors/Collector.py
Collector.collect
def collect(self): """ Select the best suited data of all available in the subclasses. In each subclass, the functions alphabetical order should correspond to their importance. Here, the first non null value is returned. """ class_functions = [] for ke...
python
def collect(self): """ Select the best suited data of all available in the subclasses. In each subclass, the functions alphabetical order should correspond to their importance. Here, the first non null value is returned. """ class_functions = [] for ke...
[ "def", "collect", "(", "self", ")", ":", "class_functions", "=", "[", "]", "for", "key", "in", "self", ".", "__class__", ".", "__dict__", ".", "keys", "(", ")", ":", "func", "=", "self", ".", "__class__", ".", "__dict__", "[", "key", "]", "if", "("...
Select the best suited data of all available in the subclasses. In each subclass, the functions alphabetical order should correspond to their importance. Here, the first non null value is returned.
[ "Select", "the", "best", "suited", "data", "of", "all", "available", "in", "the", "subclasses", ".", "In", "each", "subclass", "the", "functions", "alphabetical", "order", "should", "correspond", "to", "their", "importance", ".", "Here", "the", "first", "non",...
train
https://github.com/stephanepechard/projy/blob/3146b0e3c207b977e1b51fcb33138746dae83c23/projy/collectors/Collector.py#L15-L31
raags/passdb
passdb/manage_passdb.py
MPassdb.init
def init(self): """ Initialize a new password db store """ self.y = {"version": int(time.time())} recipient_email = raw_input("Enter Email ID: ") self.import_key(emailid=recipient_email) self.encrypt(emailid_list=[recipient_email])
python
def init(self): """ Initialize a new password db store """ self.y = {"version": int(time.time())} recipient_email = raw_input("Enter Email ID: ") self.import_key(emailid=recipient_email) self.encrypt(emailid_list=[recipient_email])
[ "def", "init", "(", "self", ")", ":", "self", ".", "y", "=", "{", "\"version\"", ":", "int", "(", "time", ".", "time", "(", ")", ")", "}", "recipient_email", "=", "raw_input", "(", "\"Enter Email ID: \"", ")", "self", ".", "import_key", "(", "emailid",...
Initialize a new password db store
[ "Initialize", "a", "new", "password", "db", "store" ]
train
https://github.com/raags/passdb/blob/7fd6665e291bbfb4db59c1230ae0257e48ad503e/passdb/manage_passdb.py#L28-L35
raags/passdb
passdb/manage_passdb.py
MPassdb.list_users
def list_users(self): """ Get user list from the encrypted passdb file """ crypt = self._decrypt_file() self.logger.info(crypt.stderr) raw_userlist = crypt.stderr.split('\n') userlist = list() for index, line in enumerate(raw_userlist): if 'gp...
python
def list_users(self): """ Get user list from the encrypted passdb file """ crypt = self._decrypt_file() self.logger.info(crypt.stderr) raw_userlist = crypt.stderr.split('\n') userlist = list() for index, line in enumerate(raw_userlist): if 'gp...
[ "def", "list_users", "(", "self", ")", ":", "crypt", "=", "self", ".", "_decrypt_file", "(", ")", "self", ".", "logger", ".", "info", "(", "crypt", ".", "stderr", ")", "raw_userlist", "=", "crypt", ".", "stderr", ".", "split", "(", "'\\n'", ")", "use...
Get user list from the encrypted passdb file
[ "Get", "user", "list", "from", "the", "encrypted", "passdb", "file" ]
train
https://github.com/raags/passdb/blob/7fd6665e291bbfb4db59c1230ae0257e48ad503e/passdb/manage_passdb.py#L37-L52