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
jmgilman/Neolib
neolib/pyamf/amf3.py
DataOutput.writeMultiByte
def writeMultiByte(self, value, charset): """ Writes a multibyte string to the datastream using the specified character set. @type value: C{str} @param value: The string value to be written. @type charset: C{str} @param charset: The string denoting the character ...
python
def writeMultiByte(self, value, charset): """ Writes a multibyte string to the datastream using the specified character set. @type value: C{str} @param value: The string value to be written. @type charset: C{str} @param charset: The string denoting the character ...
[ "def", "writeMultiByte", "(", "self", ",", "value", ",", "charset", ")", ":", "if", "type", "(", "value", ")", "is", "unicode", ":", "value", "=", "value", ".", "encode", "(", "charset", ")", "self", ".", "stream", ".", "write", "(", "value", ")" ]
Writes a multibyte string to the datastream using the specified character set. @type value: C{str} @param value: The string value to be written. @type charset: C{str} @param charset: The string denoting the character set to use. Possible character set strings include...
[ "Writes", "a", "multibyte", "string", "to", "the", "datastream", "using", "the", "specified", "character", "set", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/amf3.py#L235-L252
jmgilman/Neolib
neolib/pyamf/amf3.py
DataOutput.writeUTF
def writeUTF(self, value): """ Writes a UTF-8 string to the data stream. The length of the UTF-8 string in bytes is written first, as a 16-bit integer, followed by the bytes representing the characters of the string. @type value: C{str} @param value: The string ...
python
def writeUTF(self, value): """ Writes a UTF-8 string to the data stream. The length of the UTF-8 string in bytes is written first, as a 16-bit integer, followed by the bytes representing the characters of the string. @type value: C{str} @param value: The string ...
[ "def", "writeUTF", "(", "self", ",", "value", ")", ":", "buf", "=", "util", ".", "BufferedByteStream", "(", ")", "buf", ".", "write_utf8_string", "(", "value", ")", "bytes", "=", "buf", ".", "getvalue", "(", ")", "self", ".", "stream", ".", "write_usho...
Writes a UTF-8 string to the data stream. The length of the UTF-8 string in bytes is written first, as a 16-bit integer, followed by the bytes representing the characters of the string. @type value: C{str} @param value: The string value to be written.
[ "Writes", "a", "UTF", "-", "8", "string", "to", "the", "data", "stream", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/amf3.py#L290-L306
jmgilman/Neolib
neolib/pyamf/amf3.py
DataOutput.writeUTFBytes
def writeUTFBytes(self, value): """ Writes a UTF-8 string. Similar to L{writeUTF}, but does not prefix the string with a 16-bit length word. @type value: C{str} @param value: The string value to be written. """ val = None if isinstance(value, unicode): ...
python
def writeUTFBytes(self, value): """ Writes a UTF-8 string. Similar to L{writeUTF}, but does not prefix the string with a 16-bit length word. @type value: C{str} @param value: The string value to be written. """ val = None if isinstance(value, unicode): ...
[ "def", "writeUTFBytes", "(", "self", ",", "value", ")", ":", "val", "=", "None", "if", "isinstance", "(", "value", ",", "unicode", ")", ":", "val", "=", "value", "else", ":", "val", "=", "unicode", "(", "value", ",", "'utf8'", ")", "self", ".", "st...
Writes a UTF-8 string. Similar to L{writeUTF}, but does not prefix the string with a 16-bit length word. @type value: C{str} @param value: The string value to be written.
[ "Writes", "a", "UTF", "-", "8", "string", ".", "Similar", "to", "L", "{", "writeUTF", "}", "but", "does", "not", "prefix", "the", "string", "with", "a", "16", "-", "bit", "length", "word", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/amf3.py#L308-L323
jmgilman/Neolib
neolib/pyamf/amf3.py
DataInput.readBoolean
def readBoolean(self): """ Read C{Boolean}. @raise ValueError: Error reading Boolean. @rtype: C{bool} @return: A Boolean value, C{True} if the byte is nonzero, C{False} otherwise. """ byte = self.stream.read(1) if byte == '\x00': retu...
python
def readBoolean(self): """ Read C{Boolean}. @raise ValueError: Error reading Boolean. @rtype: C{bool} @return: A Boolean value, C{True} if the byte is nonzero, C{False} otherwise. """ byte = self.stream.read(1) if byte == '\x00': retu...
[ "def", "readBoolean", "(", "self", ")", ":", "byte", "=", "self", ".", "stream", ".", "read", "(", "1", ")", "if", "byte", "==", "'\\x00'", ":", "return", "False", "elif", "byte", "==", "'\\x01'", ":", "return", "True", "else", ":", "raise", "ValueEr...
Read C{Boolean}. @raise ValueError: Error reading Boolean. @rtype: C{bool} @return: A Boolean value, C{True} if the byte is nonzero, C{False} otherwise.
[ "Read", "C", "{", "Boolean", "}", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/amf3.py#L345-L361
jmgilman/Neolib
neolib/pyamf/amf3.py
DataInput.readMultiByte
def readMultiByte(self, length, charset): """ Reads a multibyte string of specified length from the data stream using the specified character set. @type length: C{int} @param length: The number of bytes from the data stream to read. @type charset: C{str} @param c...
python
def readMultiByte(self, length, charset): """ Reads a multibyte string of specified length from the data stream using the specified character set. @type length: C{int} @param length: The number of bytes from the data stream to read. @type charset: C{str} @param c...
[ "def", "readMultiByte", "(", "self", ",", "length", ",", "charset", ")", ":", "#FIXME nick: how to work out the code point byte size (on the fly)?", "bytes", "=", "self", ".", "stream", ".", "read", "(", "length", ")", "return", "unicode", "(", "bytes", ",", "char...
Reads a multibyte string of specified length from the data stream using the specified character set. @type length: C{int} @param length: The number of bytes from the data stream to read. @type charset: C{str} @param charset: The string denoting the character set to use. ...
[ "Reads", "a", "multibyte", "string", "of", "specified", "length", "from", "the", "data", "stream", "using", "the", "specified", "character", "set", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/amf3.py#L401-L417
jmgilman/Neolib
neolib/pyamf/amf3.py
DataInput.readUTF
def readUTF(self): """ Reads a UTF-8 string from the data stream. The string is assumed to be prefixed with an unsigned short indicating the length in bytes. @rtype: C{str} @return: A UTF-8 string produced by the byte representation of characters. """ ...
python
def readUTF(self): """ Reads a UTF-8 string from the data stream. The string is assumed to be prefixed with an unsigned short indicating the length in bytes. @rtype: C{str} @return: A UTF-8 string produced by the byte representation of characters. """ ...
[ "def", "readUTF", "(", "self", ")", ":", "length", "=", "self", ".", "stream", ".", "read_ushort", "(", ")", "return", "self", ".", "stream", ".", "read_utf8_string", "(", "length", ")" ]
Reads a UTF-8 string from the data stream. The string is assumed to be prefixed with an unsigned short indicating the length in bytes. @rtype: C{str} @return: A UTF-8 string produced by the byte representation of characters.
[ "Reads", "a", "UTF", "-", "8", "string", "from", "the", "data", "stream", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/amf3.py#L463-L475
jmgilman/Neolib
neolib/pyamf/amf3.py
Context.clear
def clear(self): """ Clears the context. """ codec.Context.clear(self) self.strings.clear() self.proxied_objects = {} self.classes = {} self.class_ref = {} self.class_idx = 0
python
def clear(self): """ Clears the context. """ codec.Context.clear(self) self.strings.clear() self.proxied_objects = {} self.classes = {} self.class_ref = {} self.class_idx = 0
[ "def", "clear", "(", "self", ")", ":", "codec", ".", "Context", ".", "clear", "(", "self", ")", "self", ".", "strings", ".", "clear", "(", ")", "self", ".", "proxied_objects", "=", "{", "}", "self", ".", "classes", "=", "{", "}", "self", ".", "cl...
Clears the context.
[ "Clears", "the", "context", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/amf3.py#L605-L616
jmgilman/Neolib
neolib/pyamf/amf3.py
Context.addString
def addString(self, s): """ Creates a reference to C{s}. If the reference already exists, that reference is returned. @type s: C{str} @param s: The string to be referenced. @rtype: C{int} @return: The reference index. @raise TypeError: The parameter C{s}...
python
def addString(self, s): """ Creates a reference to C{s}. If the reference already exists, that reference is returned. @type s: C{str} @param s: The string to be referenced. @rtype: C{int} @return: The reference index. @raise TypeError: The parameter C{s}...
[ "def", "addString", "(", "self", ",", "s", ")", ":", "if", "not", "isinstance", "(", "s", ",", "basestring", ")", ":", "raise", "TypeError", "if", "len", "(", "s", ")", "==", "0", ":", "return", "-", "1", "return", "self", ".", "strings", ".", "a...
Creates a reference to C{s}. If the reference already exists, that reference is returned. @type s: C{str} @param s: The string to be referenced. @rtype: C{int} @return: The reference index. @raise TypeError: The parameter C{s} is not of C{basestring} type.
[ "Creates", "a", "reference", "to", "C", "{", "s", "}", ".", "If", "the", "reference", "already", "exists", "that", "reference", "is", "returned", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/amf3.py#L641-L659
jmgilman/Neolib
neolib/pyamf/amf3.py
Context.addClass
def addClass(self, alias, klass): """ Creates a reference to C{class_def}. @param alias: C{ClassDefinition} instance. """ ref = self.class_idx self.class_ref[ref] = alias cd = self.classes[klass] = alias cd.reference = ref self.class_idx += 1 ...
python
def addClass(self, alias, klass): """ Creates a reference to C{class_def}. @param alias: C{ClassDefinition} instance. """ ref = self.class_idx self.class_ref[ref] = alias cd = self.classes[klass] = alias cd.reference = ref self.class_idx += 1 ...
[ "def", "addClass", "(", "self", ",", "alias", ",", "klass", ")", ":", "ref", "=", "self", ".", "class_idx", "self", ".", "class_ref", "[", "ref", "]", "=", "alias", "cd", "=", "self", ".", "classes", "[", "klass", "]", "=", "alias", "cd", ".", "r...
Creates a reference to C{class_def}. @param alias: C{ClassDefinition} instance.
[ "Creates", "a", "reference", "to", "C", "{", "class_def", "}", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/amf3.py#L677-L692
jmgilman/Neolib
neolib/pyamf/amf3.py
Context.getObjectForProxy
def getObjectForProxy(self, proxy): """ Returns the unproxied version of C{proxy} as stored in the context, or unproxies the proxy and returns that 'raw' object. @see: L{pyamf.flex.unproxy_object} @since: 0.6 """ obj = self.proxied_objects.get(id(proxy)) ...
python
def getObjectForProxy(self, proxy): """ Returns the unproxied version of C{proxy} as stored in the context, or unproxies the proxy and returns that 'raw' object. @see: L{pyamf.flex.unproxy_object} @since: 0.6 """ obj = self.proxied_objects.get(id(proxy)) ...
[ "def", "getObjectForProxy", "(", "self", ",", "proxy", ")", ":", "obj", "=", "self", ".", "proxied_objects", ".", "get", "(", "id", "(", "proxy", ")", ")", "if", "obj", "is", "None", ":", "from", "pyamf", "import", "flex", "obj", "=", "flex", ".", ...
Returns the unproxied version of C{proxy} as stored in the context, or unproxies the proxy and returns that 'raw' object. @see: L{pyamf.flex.unproxy_object} @since: 0.6
[ "Returns", "the", "unproxied", "version", "of", "C", "{", "proxy", "}", "as", "stored", "in", "the", "context", "or", "unproxies", "the", "proxy", "and", "returns", "that", "raw", "object", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/amf3.py#L694-L711
jmgilman/Neolib
neolib/pyamf/amf3.py
Context.addProxyObject
def addProxyObject(self, obj, proxied): """ Stores a reference to the unproxied and proxied versions of C{obj} for later retrieval. @since: 0.6 """ self.proxied_objects[id(obj)] = proxied self.proxied_objects[id(proxied)] = obj
python
def addProxyObject(self, obj, proxied): """ Stores a reference to the unproxied and proxied versions of C{obj} for later retrieval. @since: 0.6 """ self.proxied_objects[id(obj)] = proxied self.proxied_objects[id(proxied)] = obj
[ "def", "addProxyObject", "(", "self", ",", "obj", ",", "proxied", ")", ":", "self", ".", "proxied_objects", "[", "id", "(", "obj", ")", "]", "=", "proxied", "self", ".", "proxied_objects", "[", "id", "(", "proxied", ")", "]", "=", "obj" ]
Stores a reference to the unproxied and proxied versions of C{obj} for later retrieval. @since: 0.6
[ "Stores", "a", "reference", "to", "the", "unproxied", "and", "proxied", "versions", "of", "C", "{", "obj", "}", "for", "later", "retrieval", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/amf3.py#L713-L721
jmgilman/Neolib
neolib/pyamf/amf3.py
Context.getProxyForObject
def getProxyForObject(self, obj): """ Returns the proxied version of C{obj} as stored in the context, or creates a new proxied object and returns that. @see: L{pyamf.flex.proxy_object} @since: 0.6 """ proxied = self.proxied_objects.get(id(obj)) if proxie...
python
def getProxyForObject(self, obj): """ Returns the proxied version of C{obj} as stored in the context, or creates a new proxied object and returns that. @see: L{pyamf.flex.proxy_object} @since: 0.6 """ proxied = self.proxied_objects.get(id(obj)) if proxie...
[ "def", "getProxyForObject", "(", "self", ",", "obj", ")", ":", "proxied", "=", "self", ".", "proxied_objects", ".", "get", "(", "id", "(", "obj", ")", ")", "if", "proxied", "is", "None", ":", "from", "pyamf", "import", "flex", "proxied", "=", "flex", ...
Returns the proxied version of C{obj} as stored in the context, or creates a new proxied object and returns that. @see: L{pyamf.flex.proxy_object} @since: 0.6
[ "Returns", "the", "proxied", "version", "of", "C", "{", "obj", "}", "as", "stored", "in", "the", "context", "or", "creates", "a", "new", "proxied", "object", "and", "returns", "that", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/amf3.py#L723-L740
jmgilman/Neolib
neolib/pyamf/amf3.py
Decoder.readBytes
def readBytes(self): """ Reads and returns a utf-8 encoded byte array. """ length, is_reference = self._readLength() if is_reference: return self.context.getString(length) if length == 0: return '' result = self.stream.read(length) ...
python
def readBytes(self): """ Reads and returns a utf-8 encoded byte array. """ length, is_reference = self._readLength() if is_reference: return self.context.getString(length) if length == 0: return '' result = self.stream.read(length) ...
[ "def", "readBytes", "(", "self", ")", ":", "length", ",", "is_reference", "=", "self", ".", "_readLength", "(", ")", "if", "is_reference", ":", "return", "self", ".", "context", ".", "getString", "(", "length", ")", "if", "length", "==", "0", ":", "ret...
Reads and returns a utf-8 encoded byte array.
[ "Reads", "and", "returns", "a", "utf", "-", "8", "encoded", "byte", "array", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/amf3.py#L847-L862
jmgilman/Neolib
neolib/pyamf/amf3.py
Decoder.readString
def readString(self): """ Reads and returns a string from the stream. """ length, is_reference = self._readLength() if is_reference: result = self.context.getString(length) return self.context.getStringForBytes(result) if length == 0: ...
python
def readString(self): """ Reads and returns a string from the stream. """ length, is_reference = self._readLength() if is_reference: result = self.context.getString(length) return self.context.getStringForBytes(result) if length == 0: ...
[ "def", "readString", "(", "self", ")", ":", "length", ",", "is_reference", "=", "self", ".", "_readLength", "(", ")", "if", "is_reference", ":", "result", "=", "self", ".", "context", ".", "getString", "(", "length", ")", "return", "self", ".", "context"...
Reads and returns a string from the stream.
[ "Reads", "and", "returns", "a", "string", "from", "the", "stream", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/amf3.py#L864-L881
jmgilman/Neolib
neolib/pyamf/amf3.py
Decoder.readDate
def readDate(self): """ Read date from the stream. The timezone is ignored as the date is always in UTC. """ ref = self.readInteger(False) if ref & REFERENCE_BIT == 0: return self.context.getObject(ref >> 1) ms = self.stream.read_double() re...
python
def readDate(self): """ Read date from the stream. The timezone is ignored as the date is always in UTC. """ ref = self.readInteger(False) if ref & REFERENCE_BIT == 0: return self.context.getObject(ref >> 1) ms = self.stream.read_double() re...
[ "def", "readDate", "(", "self", ")", ":", "ref", "=", "self", ".", "readInteger", "(", "False", ")", "if", "ref", "&", "REFERENCE_BIT", "==", "0", ":", "return", "self", ".", "context", ".", "getObject", "(", "ref", ">>", "1", ")", "ms", "=", "self...
Read date from the stream. The timezone is ignored as the date is always in UTC.
[ "Read", "date", "from", "the", "stream", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/amf3.py#L883-L902
jmgilman/Neolib
neolib/pyamf/amf3.py
Decoder.readArray
def readArray(self): """ Reads an array from the stream. @warning: There is a very specific problem with AMF3 where the first three bytes of an encoded empty C{dict} will mirror that of an encoded C{{'': 1, '2': 2}} """ size = self.readInteger(False) if ...
python
def readArray(self): """ Reads an array from the stream. @warning: There is a very specific problem with AMF3 where the first three bytes of an encoded empty C{dict} will mirror that of an encoded C{{'': 1, '2': 2}} """ size = self.readInteger(False) if ...
[ "def", "readArray", "(", "self", ")", ":", "size", "=", "self", ".", "readInteger", "(", "False", ")", "if", "size", "&", "REFERENCE_BIT", "==", "0", ":", "return", "self", ".", "context", ".", "getObject", "(", "size", ">>", "1", ")", "size", ">>=",...
Reads an array from the stream. @warning: There is a very specific problem with AMF3 where the first three bytes of an encoded empty C{dict} will mirror that of an encoded C{{'': 1, '2': 2}}
[ "Reads", "an", "array", "from", "the", "stream", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/amf3.py#L904-L942
jmgilman/Neolib
neolib/pyamf/amf3.py
Decoder._getClassDefinition
def _getClassDefinition(self, ref): """ Reads class definition from the stream. """ is_ref = ref & REFERENCE_BIT == 0 ref >>= 1 if is_ref: class_def = self.context.getClassByReference(ref) return class_def name = self.readBytes() ...
python
def _getClassDefinition(self, ref): """ Reads class definition from the stream. """ is_ref = ref & REFERENCE_BIT == 0 ref >>= 1 if is_ref: class_def = self.context.getClassByReference(ref) return class_def name = self.readBytes() ...
[ "def", "_getClassDefinition", "(", "self", ",", "ref", ")", ":", "is_ref", "=", "ref", "&", "REFERENCE_BIT", "==", "0", "ref", ">>=", "1", "if", "is_ref", ":", "class_def", "=", "self", ".", "context", ".", "getClassByReference", "(", "ref", ")", "return...
Reads class definition from the stream.
[ "Reads", "class", "definition", "from", "the", "stream", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/amf3.py#L944-L984
jmgilman/Neolib
neolib/pyamf/amf3.py
Decoder.readObject
def readObject(self): """ Reads an object from the stream. """ ref = self.readInteger(False) if ref & REFERENCE_BIT == 0: obj = self.context.getObject(ref >> 1) if obj is None: raise pyamf.ReferenceError('Unknown reference %d' % (ref >> 1...
python
def readObject(self): """ Reads an object from the stream. """ ref = self.readInteger(False) if ref & REFERENCE_BIT == 0: obj = self.context.getObject(ref >> 1) if obj is None: raise pyamf.ReferenceError('Unknown reference %d' % (ref >> 1...
[ "def", "readObject", "(", "self", ")", ":", "ref", "=", "self", ".", "readInteger", "(", "False", ")", "if", "ref", "&", "REFERENCE_BIT", "==", "0", ":", "obj", "=", "self", ".", "context", ".", "getObject", "(", "ref", ">>", "1", ")", "if", "obj",...
Reads an object from the stream.
[ "Reads", "an", "object", "from", "the", "stream", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/amf3.py#L997-L1044
jmgilman/Neolib
neolib/pyamf/amf3.py
Decoder.readXML
def readXML(self): """ Reads an xml object from the stream. @return: An etree interface compatible object @see: L{xml.set_default_interface} """ ref = self.readInteger(False) if ref & REFERENCE_BIT == 0: return self.context.getObject(ref >> 1) ...
python
def readXML(self): """ Reads an xml object from the stream. @return: An etree interface compatible object @see: L{xml.set_default_interface} """ ref = self.readInteger(False) if ref & REFERENCE_BIT == 0: return self.context.getObject(ref >> 1) ...
[ "def", "readXML", "(", "self", ")", ":", "ref", "=", "self", ".", "readInteger", "(", "False", ")", "if", "ref", "&", "REFERENCE_BIT", "==", "0", ":", "return", "self", ".", "context", ".", "getObject", "(", "ref", ">>", "1", ")", "xmlstring", "=", ...
Reads an xml object from the stream. @return: An etree interface compatible object @see: L{xml.set_default_interface}
[ "Reads", "an", "xml", "object", "from", "the", "stream", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/amf3.py#L1046-L1063
jmgilman/Neolib
neolib/pyamf/amf3.py
Decoder.readByteArray
def readByteArray(self): """ Reads a string of data from the stream. Detects if the L{ByteArray} was compressed using C{zlib}. @see: L{ByteArray} @note: This is not supported in ActionScript 1.0 and 2.0. """ ref = self.readInteger(False) if ref & REFERE...
python
def readByteArray(self): """ Reads a string of data from the stream. Detects if the L{ByteArray} was compressed using C{zlib}. @see: L{ByteArray} @note: This is not supported in ActionScript 1.0 and 2.0. """ ref = self.readInteger(False) if ref & REFERE...
[ "def", "readByteArray", "(", "self", ")", ":", "ref", "=", "self", ".", "readInteger", "(", "False", ")", "if", "ref", "&", "REFERENCE_BIT", "==", "0", ":", "return", "self", ".", "context", ".", "getObject", "(", "ref", ">>", "1", ")", "buffer", "="...
Reads a string of data from the stream. Detects if the L{ByteArray} was compressed using C{zlib}. @see: L{ByteArray} @note: This is not supported in ActionScript 1.0 and 2.0.
[ "Reads", "a", "string", "of", "data", "from", "the", "stream", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/amf3.py#L1074-L1101
jmgilman/Neolib
neolib/pyamf/amf3.py
Encoder.writeBoolean
def writeBoolean(self, n): """ Writes a Boolean to the stream. """ t = TYPE_BOOL_TRUE if n is False: t = TYPE_BOOL_FALSE self.stream.write(t)
python
def writeBoolean(self, n): """ Writes a Boolean to the stream. """ t = TYPE_BOOL_TRUE if n is False: t = TYPE_BOOL_FALSE self.stream.write(t)
[ "def", "writeBoolean", "(", "self", ",", "n", ")", ":", "t", "=", "TYPE_BOOL_TRUE", "if", "n", "is", "False", ":", "t", "=", "TYPE_BOOL_FALSE", "self", ".", "stream", ".", "write", "(", "t", ")" ]
Writes a Boolean to the stream.
[ "Writes", "a", "Boolean", "to", "the", "stream", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/amf3.py#L1145-L1154
jmgilman/Neolib
neolib/pyamf/amf3.py
Encoder.writeInteger
def writeInteger(self, n): """ Writes an integer to the stream. @type n: integer data @param n: The integer data to be encoded to the AMF3 data stream. """ if n < MIN_29B_INT or n > MAX_29B_INT: self.writeNumber(float(n)) return self....
python
def writeInteger(self, n): """ Writes an integer to the stream. @type n: integer data @param n: The integer data to be encoded to the AMF3 data stream. """ if n < MIN_29B_INT or n > MAX_29B_INT: self.writeNumber(float(n)) return self....
[ "def", "writeInteger", "(", "self", ",", "n", ")", ":", "if", "n", "<", "MIN_29B_INT", "or", "n", ">", "MAX_29B_INT", ":", "self", ".", "writeNumber", "(", "float", "(", "n", ")", ")", "return", "self", ".", "stream", ".", "write", "(", "TYPE_INTEGER...
Writes an integer to the stream. @type n: integer data @param n: The integer data to be encoded to the AMF3 data stream.
[ "Writes", "an", "integer", "to", "the", "stream", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/amf3.py#L1169-L1182
jmgilman/Neolib
neolib/pyamf/amf3.py
Encoder.writeNumber
def writeNumber(self, n): """ Writes a float to the stream. @type n: C{float} """ self.stream.write(TYPE_NUMBER) self.stream.write_double(n)
python
def writeNumber(self, n): """ Writes a float to the stream. @type n: C{float} """ self.stream.write(TYPE_NUMBER) self.stream.write_double(n)
[ "def", "writeNumber", "(", "self", ",", "n", ")", ":", "self", ".", "stream", ".", "write", "(", "TYPE_NUMBER", ")", "self", ".", "stream", ".", "write_double", "(", "n", ")" ]
Writes a float to the stream. @type n: C{float}
[ "Writes", "a", "float", "to", "the", "stream", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/amf3.py#L1184-L1191
jmgilman/Neolib
neolib/pyamf/amf3.py
Encoder.serialiseString
def serialiseString(self, s): """ Writes a raw string to the stream. @type s: C{str} @param s: The string data to be encoded to the AMF3 data stream. """ if type(s) is unicode: s = self.context.getBytesForString(s) self.serialiseBytes(s)
python
def serialiseString(self, s): """ Writes a raw string to the stream. @type s: C{str} @param s: The string data to be encoded to the AMF3 data stream. """ if type(s) is unicode: s = self.context.getBytesForString(s) self.serialiseBytes(s)
[ "def", "serialiseString", "(", "self", ",", "s", ")", ":", "if", "type", "(", "s", ")", "is", "unicode", ":", "s", "=", "self", ".", "context", ".", "getBytesForString", "(", "s", ")", "self", ".", "serialiseBytes", "(", "s", ")" ]
Writes a raw string to the stream. @type s: C{str} @param s: The string data to be encoded to the AMF3 data stream.
[ "Writes", "a", "raw", "string", "to", "the", "stream", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/amf3.py#L1212-L1222
jmgilman/Neolib
neolib/pyamf/amf3.py
Encoder.writeBytes
def writeBytes(self, b): """ Writes a raw string to the stream. """ self.stream.write(TYPE_STRING) self.serialiseBytes(b)
python
def writeBytes(self, b): """ Writes a raw string to the stream. """ self.stream.write(TYPE_STRING) self.serialiseBytes(b)
[ "def", "writeBytes", "(", "self", ",", "b", ")", ":", "self", ".", "stream", ".", "write", "(", "TYPE_STRING", ")", "self", ".", "serialiseBytes", "(", "b", ")" ]
Writes a raw string to the stream.
[ "Writes", "a", "raw", "string", "to", "the", "stream", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/amf3.py#L1224-L1230
jmgilman/Neolib
neolib/pyamf/amf3.py
Encoder.writeString
def writeString(self, s): """ Writes a string to the stream. It will be B{UTF-8} encoded. """ s = self.context.getBytesForString(s) self.writeBytes(s)
python
def writeString(self, s): """ Writes a string to the stream. It will be B{UTF-8} encoded. """ s = self.context.getBytesForString(s) self.writeBytes(s)
[ "def", "writeString", "(", "self", ",", "s", ")", ":", "s", "=", "self", ".", "context", ".", "getBytesForString", "(", "s", ")", "self", ".", "writeBytes", "(", "s", ")" ]
Writes a string to the stream. It will be B{UTF-8} encoded.
[ "Writes", "a", "string", "to", "the", "stream", ".", "It", "will", "be", "B", "{", "UTF", "-", "8", "}", "encoded", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/amf3.py#L1232-L1238
jmgilman/Neolib
neolib/pyamf/amf3.py
Encoder.writeDate
def writeDate(self, n): """ Writes a C{datetime} instance to the stream. @type n: L{datetime} @param n: The C{Date} data to be encoded to the AMF3 data stream. """ if isinstance(n, datetime.time): raise pyamf.EncodeError('A datetime.time instance was found bu...
python
def writeDate(self, n): """ Writes a C{datetime} instance to the stream. @type n: L{datetime} @param n: The C{Date} data to be encoded to the AMF3 data stream. """ if isinstance(n, datetime.time): raise pyamf.EncodeError('A datetime.time instance was found bu...
[ "def", "writeDate", "(", "self", ",", "n", ")", ":", "if", "isinstance", "(", "n", ",", "datetime", ".", "time", ")", ":", "raise", "pyamf", ".", "EncodeError", "(", "'A datetime.time instance was found but '", "'AMF3 has no way to encode time objects. Please use '", ...
Writes a C{datetime} instance to the stream. @type n: L{datetime} @param n: The C{Date} data to be encoded to the AMF3 data stream.
[ "Writes", "a", "C", "{", "datetime", "}", "instance", "to", "the", "stream", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/amf3.py#L1240-L1269
jmgilman/Neolib
neolib/pyamf/amf3.py
Encoder.writeList
def writeList(self, n, is_proxy=False): """ Writes a C{tuple}, C{set} or C{list} to the stream. @type n: One of C{__builtin__.tuple}, C{__builtin__.set} or C{__builtin__.list} @param n: The C{list} data to be encoded to the AMF3 data stream. """ if self.use_p...
python
def writeList(self, n, is_proxy=False): """ Writes a C{tuple}, C{set} or C{list} to the stream. @type n: One of C{__builtin__.tuple}, C{__builtin__.set} or C{__builtin__.list} @param n: The C{list} data to be encoded to the AMF3 data stream. """ if self.use_p...
[ "def", "writeList", "(", "self", ",", "n", ",", "is_proxy", "=", "False", ")", ":", "if", "self", ".", "use_proxies", "and", "not", "is_proxy", ":", "self", ".", "writeProxy", "(", "n", ")", "return", "self", ".", "stream", ".", "write", "(", "TYPE_A...
Writes a C{tuple}, C{set} or C{list} to the stream. @type n: One of C{__builtin__.tuple}, C{__builtin__.set} or C{__builtin__.list} @param n: The C{list} data to be encoded to the AMF3 data stream.
[ "Writes", "a", "C", "{", "tuple", "}", "C", "{", "set", "}", "or", "C", "{", "list", "}", "to", "the", "stream", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/amf3.py#L1271-L1298
jmgilman/Neolib
neolib/pyamf/amf3.py
Encoder.writeDict
def writeDict(self, n): """ Writes a C{dict} to the stream. @type n: C{__builtin__.dict} @param n: The C{dict} data to be encoded to the AMF3 data stream. @raise ValueError: Non C{int}/C{str} key value found in the C{dict} @raise EncodeError: C{dict} contains empty strin...
python
def writeDict(self, n): """ Writes a C{dict} to the stream. @type n: C{__builtin__.dict} @param n: The C{dict} data to be encoded to the AMF3 data stream. @raise ValueError: Non C{int}/C{str} key value found in the C{dict} @raise EncodeError: C{dict} contains empty strin...
[ "def", "writeDict", "(", "self", ",", "n", ")", ":", "# Design bug in AMF3 that cannot read/write empty key strings", "# for more info", "if", "''", "in", "n", ":", "raise", "pyamf", ".", "EncodeError", "(", "\"dicts cannot contain empty string keys\"", ")", "if", "self...
Writes a C{dict} to the stream. @type n: C{__builtin__.dict} @param n: The C{dict} data to be encoded to the AMF3 data stream. @raise ValueError: Non C{int}/C{str} key value found in the C{dict} @raise EncodeError: C{dict} contains empty string keys.
[ "Writes", "a", "C", "{", "dict", "}", "to", "the", "stream", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/amf3.py#L1300-L1369
jmgilman/Neolib
neolib/pyamf/amf3.py
Encoder.writeProxy
def writeProxy(self, obj): """ Encodes a proxied object to the stream. @since: 0.6 """ proxy = self.context.getProxyForObject(obj) self.writeObject(proxy, is_proxy=True)
python
def writeProxy(self, obj): """ Encodes a proxied object to the stream. @since: 0.6 """ proxy = self.context.getProxyForObject(obj) self.writeObject(proxy, is_proxy=True)
[ "def", "writeProxy", "(", "self", ",", "obj", ")", ":", "proxy", "=", "self", ".", "context", ".", "getProxyForObject", "(", "obj", ")", "self", ".", "writeObject", "(", "proxy", ",", "is_proxy", "=", "True", ")" ]
Encodes a proxied object to the stream. @since: 0.6
[ "Encodes", "a", "proxied", "object", "to", "the", "stream", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/amf3.py#L1371-L1379
jmgilman/Neolib
neolib/pyamf/amf3.py
Encoder.writeObject
def writeObject(self, obj, is_proxy=False): """ Writes an object to the stream. """ if self.use_proxies and not is_proxy: self.writeProxy(obj) return self.stream.write(TYPE_OBJECT) ref = self.context.getObjectReference(obj) if ref != -1...
python
def writeObject(self, obj, is_proxy=False): """ Writes an object to the stream. """ if self.use_proxies and not is_proxy: self.writeProxy(obj) return self.stream.write(TYPE_OBJECT) ref = self.context.getObjectReference(obj) if ref != -1...
[ "def", "writeObject", "(", "self", ",", "obj", ",", "is_proxy", "=", "False", ")", ":", "if", "self", ".", "use_proxies", "and", "not", "is_proxy", ":", "self", ".", "writeProxy", "(", "obj", ")", "return", "self", ".", "stream", ".", "write", "(", "...
Writes an object to the stream.
[ "Writes", "an", "object", "to", "the", "stream", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/amf3.py#L1381-L1470
jmgilman/Neolib
neolib/pyamf/amf3.py
Encoder.writeByteArray
def writeByteArray(self, n): """ Writes a L{ByteArray} to the data stream. @param n: The L{ByteArray} data to be encoded to the AMF3 data stream. @type n: L{ByteArray} """ self.stream.write(TYPE_BYTEARRAY) ref = self.context.getObjectReference(n) if ref...
python
def writeByteArray(self, n): """ Writes a L{ByteArray} to the data stream. @param n: The L{ByteArray} data to be encoded to the AMF3 data stream. @type n: L{ByteArray} """ self.stream.write(TYPE_BYTEARRAY) ref = self.context.getObjectReference(n) if ref...
[ "def", "writeByteArray", "(", "self", ",", "n", ")", ":", "self", ".", "stream", ".", "write", "(", "TYPE_BYTEARRAY", ")", "ref", "=", "self", ".", "context", ".", "getObjectReference", "(", "n", ")", "if", "ref", "!=", "-", "1", ":", "self", ".", ...
Writes a L{ByteArray} to the data stream. @param n: The L{ByteArray} data to be encoded to the AMF3 data stream. @type n: L{ByteArray}
[ "Writes", "a", "L", "{", "ByteArray", "}", "to", "the", "data", "stream", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/amf3.py#L1472-L1493
jmgilman/Neolib
neolib/pyamf/amf3.py
Encoder.writeXML
def writeXML(self, n): """ Writes a XML string to the data stream. @type n: L{ET<xml.ET>} @param n: The XML Document to be encoded to the AMF3 data stream. """ self.stream.write(TYPE_XMLSTRING) ref = self.context.getObjectReference(n) if ref != -1: ...
python
def writeXML(self, n): """ Writes a XML string to the data stream. @type n: L{ET<xml.ET>} @param n: The XML Document to be encoded to the AMF3 data stream. """ self.stream.write(TYPE_XMLSTRING) ref = self.context.getObjectReference(n) if ref != -1: ...
[ "def", "writeXML", "(", "self", ",", "n", ")", ":", "self", ".", "stream", ".", "write", "(", "TYPE_XMLSTRING", ")", "ref", "=", "self", ".", "context", ".", "getObjectReference", "(", "n", ")", "if", "ref", "!=", "-", "1", ":", "self", ".", "_writ...
Writes a XML string to the data stream. @type n: L{ET<xml.ET>} @param n: The XML Document to be encoded to the AMF3 data stream.
[ "Writes", "a", "XML", "string", "to", "the", "data", "stream", "." ]
train
https://github.com/jmgilman/Neolib/blob/228fafeaed0f3195676137732384a14820ae285c/neolib/pyamf/amf3.py#L1495-L1512
dossier/dossier.web
dossier/web/tags.py
v1_tag_associate
def v1_tag_associate(request, tags, tag): '''Associate an HTML element with a tag. The association should be a JSON serialized object on the request body. Here is an example association that should make the object's structure clear: .. code-block:: python { "url": "http://exam...
python
def v1_tag_associate(request, tags, tag): '''Associate an HTML element with a tag. The association should be a JSON serialized object on the request body. Here is an example association that should make the object's structure clear: .. code-block:: python { "url": "http://exam...
[ "def", "v1_tag_associate", "(", "request", ",", "tags", ",", "tag", ")", ":", "tag", "=", "tag", ".", "decode", "(", "'utf-8'", ")", ".", "strip", "(", ")", "assoc", "=", "dict", "(", "json", ".", "loads", "(", "request", ".", "body", ".", "read", ...
Associate an HTML element with a tag. The association should be a JSON serialized object on the request body. Here is an example association that should make the object's structure clear: .. code-block:: python { "url": "http://example.com/abc/xyz?foo=bar", "text": "Th...
[ "Associate", "an", "HTML", "element", "with", "a", "tag", "." ]
train
https://github.com/dossier/dossier.web/blob/1cad1cce3c37d3a4e956abc710a2bc1afe16a092/dossier/web/tags.py#L38-L68
dossier/dossier.web
dossier/web/tags.py
v1_tag_list
def v1_tag_list(tags, tag=''): '''List all direct children tags of the given parent. If no parent is specified, then list all top-level tags. The JSON returned for ``/dossier/v1/tags/list/foo/bar`` might look like this: .. code-block:: python { 'children': [ {...
python
def v1_tag_list(tags, tag=''): '''List all direct children tags of the given parent. If no parent is specified, then list all top-level tags. The JSON returned for ``/dossier/v1/tags/list/foo/bar`` might look like this: .. code-block:: python { 'children': [ {...
[ "def", "v1_tag_list", "(", "tags", ",", "tag", "=", "''", ")", ":", "tag", "=", "tag", ".", "decode", "(", "'utf-8'", ")", ".", "strip", "(", ")", "return", "{", "'children'", ":", "tags", ".", "list", "(", "tag", ")", "}" ]
List all direct children tags of the given parent. If no parent is specified, then list all top-level tags. The JSON returned for ``/dossier/v1/tags/list/foo/bar`` might look like this: .. code-block:: python { 'children': [ {'name': 'baz', 'parent': 'bar', 'tag':...
[ "List", "all", "direct", "children", "tags", "of", "the", "given", "parent", "." ]
train
https://github.com/dossier/dossier.web/blob/1cad1cce3c37d3a4e956abc710a2bc1afe16a092/dossier/web/tags.py#L73-L90
dossier/dossier.web
dossier/web/tags.py
v1_tag_suggest
def v1_tag_suggest(request, tags, prefix, parent=''): '''Provide fast suggestions for tag components. This yields suggestions for *components* of a tag and a given prefix. For example, given the tags ``foo/bar/baz`` and ``fob/bob``, here are some example completions (ordering may be different): ...
python
def v1_tag_suggest(request, tags, prefix, parent=''): '''Provide fast suggestions for tag components. This yields suggestions for *components* of a tag and a given prefix. For example, given the tags ``foo/bar/baz`` and ``fob/bob``, here are some example completions (ordering may be different): ...
[ "def", "v1_tag_suggest", "(", "request", ",", "tags", ",", "prefix", ",", "parent", "=", "''", ")", ":", "prefix", "=", "prefix", ".", "decode", "(", "'utf-8'", ")", ".", "strip", "(", ")", "parent", "=", "parent", ".", "decode", "(", "'utf-8'", ")",...
Provide fast suggestions for tag components. This yields suggestions for *components* of a tag and a given prefix. For example, given the tags ``foo/bar/baz`` and ``fob/bob``, here are some example completions (ordering may be different): .. code-block:: text /dossier/v1/tags/suggest/pref...
[ "Provide", "fast", "suggestions", "for", "tag", "components", "." ]
train
https://github.com/dossier/dossier.web/blob/1cad1cce3c37d3a4e956abc710a2bc1afe16a092/dossier/web/tags.py#L95-L124
dossier/dossier.web
dossier/web/tags.py
v1_stream_id_associations
def v1_stream_id_associations(tags, stream_id): '''Retrieve associations for a given stream_id. The associations returned have the exact same structure as defined in the ``v1_tag_associate`` route with one addition: a ``tag`` field contains the full tag name for the association. ''' stream_id =...
python
def v1_stream_id_associations(tags, stream_id): '''Retrieve associations for a given stream_id. The associations returned have the exact same structure as defined in the ``v1_tag_associate`` route with one addition: a ``tag`` field contains the full tag name for the association. ''' stream_id =...
[ "def", "v1_stream_id_associations", "(", "tags", ",", "stream_id", ")", ":", "stream_id", "=", "stream_id", ".", "decode", "(", "'utf-8'", ")", ".", "strip", "(", ")", "return", "{", "'associations'", ":", "tags", ".", "assocs_by_stream_id", "(", "stream_id", ...
Retrieve associations for a given stream_id. The associations returned have the exact same structure as defined in the ``v1_tag_associate`` route with one addition: a ``tag`` field contains the full tag name for the association.
[ "Retrieve", "associations", "for", "a", "given", "stream_id", "." ]
train
https://github.com/dossier/dossier.web/blob/1cad1cce3c37d3a4e956abc710a2bc1afe16a092/dossier/web/tags.py#L128-L136
dossier/dossier.web
dossier/web/tags.py
v1_url_associations
def v1_url_associations(tags, url): '''Retrieve associations for a given URL. The associations returned have the exact same structure as defined in the ``v1_tag_associate`` route with one addition: a ``tag`` field contains the full tag name for the association. ''' url = urllib.unquote_plus(url...
python
def v1_url_associations(tags, url): '''Retrieve associations for a given URL. The associations returned have the exact same structure as defined in the ``v1_tag_associate`` route with one addition: a ``tag`` field contains the full tag name for the association. ''' url = urllib.unquote_plus(url...
[ "def", "v1_url_associations", "(", "tags", ",", "url", ")", ":", "url", "=", "urllib", ".", "unquote_plus", "(", "url", ".", "decode", "(", "'utf-8'", ")", ")", ".", "strip", "(", ")", "return", "{", "'associations'", ":", "tags", ".", "assocs_by_url", ...
Retrieve associations for a given URL. The associations returned have the exact same structure as defined in the ``v1_tag_associate`` route with one addition: a ``tag`` field contains the full tag name for the association.
[ "Retrieve", "associations", "for", "a", "given", "URL", "." ]
train
https://github.com/dossier/dossier.web/blob/1cad1cce3c37d3a4e956abc710a2bc1afe16a092/dossier/web/tags.py#L140-L148
dossier/dossier.web
dossier/web/tags.py
v1_tag_associations
def v1_tag_associations(tags, tag): '''Retrieve associations for a given tag. The associations returned have the exact same structure as defined in the ``v1_tag_associate`` route with one addition: a ``tag`` field contains the full tag name for the association. ''' tag = tag.decode('utf-8').str...
python
def v1_tag_associations(tags, tag): '''Retrieve associations for a given tag. The associations returned have the exact same structure as defined in the ``v1_tag_associate`` route with one addition: a ``tag`` field contains the full tag name for the association. ''' tag = tag.decode('utf-8').str...
[ "def", "v1_tag_associations", "(", "tags", ",", "tag", ")", ":", "tag", "=", "tag", ".", "decode", "(", "'utf-8'", ")", ".", "strip", "(", ")", "return", "{", "'associations'", ":", "tags", ".", "assocs_by_tag", "(", "tag", ")", "}" ]
Retrieve associations for a given tag. The associations returned have the exact same structure as defined in the ``v1_tag_associate`` route with one addition: a ``tag`` field contains the full tag name for the association.
[ "Retrieve", "associations", "for", "a", "given", "tag", "." ]
train
https://github.com/dossier/dossier.web/blob/1cad1cce3c37d3a4e956abc710a2bc1afe16a092/dossier/web/tags.py#L152-L160
dossier/dossier.web
dossier/web/tags.py
Tags.delete_all
def delete_all(self): '''Deletes all tag data. This does not destroy the ES index, but instead only deletes all tags with the configured doc types. ''' try: self.conn.indices.delete_mapping( index=self.index, doc_type=self.type_tag) except Tra...
python
def delete_all(self): '''Deletes all tag data. This does not destroy the ES index, but instead only deletes all tags with the configured doc types. ''' try: self.conn.indices.delete_mapping( index=self.index, doc_type=self.type_tag) except Tra...
[ "def", "delete_all", "(", "self", ")", ":", "try", ":", "self", ".", "conn", ".", "indices", ".", "delete_mapping", "(", "index", "=", "self", ".", "index", ",", "doc_type", "=", "self", ".", "type_tag", ")", "except", "TransportError", ":", "logger", ...
Deletes all tag data. This does not destroy the ES index, but instead only deletes all tags with the configured doc types.
[ "Deletes", "all", "tag", "data", "." ]
train
https://github.com/dossier/dossier.web/blob/1cad1cce3c37d3a4e956abc710a2bc1afe16a092/dossier/web/tags.py#L272-L289
dossier/dossier.web
dossier/web/tags.py
Tags._create_mappings
def _create_mappings(self): 'Create the field type mapping.' created1 = self._create_tag_mapping() created2 = self._create_assoc_mapping() return created1 or created2
python
def _create_mappings(self): 'Create the field type mapping.' created1 = self._create_tag_mapping() created2 = self._create_assoc_mapping() return created1 or created2
[ "def", "_create_mappings", "(", "self", ")", ":", "created1", "=", "self", ".", "_create_tag_mapping", "(", ")", "created2", "=", "self", ".", "_create_assoc_mapping", "(", ")", "return", "created1", "or", "created2" ]
Create the field type mapping.
[ "Create", "the", "field", "type", "mapping", "." ]
train
https://github.com/dossier/dossier.web/blob/1cad1cce3c37d3a4e956abc710a2bc1afe16a092/dossier/web/tags.py#L311-L315
hweickert/itermate
itermate/operator.py
attrsetter
def attrsetter( attribute, *static_value ): """ Attrsetter function. The examples below show the 2 supported modes in conjunction with itertools.imap(). import itertools import itermate.operator >>> class Foo(object): >>> bar = 0 ...
python
def attrsetter( attribute, *static_value ): """ Attrsetter function. The examples below show the 2 supported modes in conjunction with itertools.imap(). import itertools import itermate.operator >>> class Foo(object): >>> bar = 0 ...
[ "def", "attrsetter", "(", "attribute", ",", "*", "static_value", ")", ":", "if", "static_value", ":", "def", "attrsetter_func", "(", "obj", ")", ":", "setattr", "(", "obj", ",", "attribute", ",", "static_value", "[", "0", "]", ")", "return", "obj", "else...
Attrsetter function. The examples below show the 2 supported modes in conjunction with itertools.imap(). import itertools import itermate.operator >>> class Foo(object): >>> bar = 0 >>> def __repr__(self): >>> r...
[ "Attrsetter", "function", ".", "The", "examples", "below", "show", "the", "2", "supported", "modes", "in", "conjunction", "with", "itertools", ".", "imap", "()", ".", "import", "itertools", "import", "itermate", ".", "operator", ">>>", "class", "Foo", "(", "...
train
https://github.com/hweickert/itermate/blob/501cb4c31c6435b2f99703eb516aca2886d513b6/itermate/operator.py#L1-L32
cogniteev/docido-python-sdk
docido_sdk/toolbox/__init__.py
get_last_traceback
def get_last_traceback(): """Retrieve the last traceback as an `unicode` string.""" import traceback from StringIO import StringIO tb = StringIO() traceback.print_exc(file=tb) return to_unicode(tb.getvalue())
python
def get_last_traceback(): """Retrieve the last traceback as an `unicode` string.""" import traceback from StringIO import StringIO tb = StringIO() traceback.print_exc(file=tb) return to_unicode(tb.getvalue())
[ "def", "get_last_traceback", "(", ")", ":", "import", "traceback", "from", "StringIO", "import", "StringIO", "tb", "=", "StringIO", "(", ")", "traceback", ".", "print_exc", "(", "file", "=", "tb", ")", "return", "to_unicode", "(", "tb", ".", "getvalue", "(...
Retrieve the last traceback as an `unicode` string.
[ "Retrieve", "the", "last", "traceback", "as", "an", "unicode", "string", "." ]
train
https://github.com/cogniteev/docido-python-sdk/blob/58ecb6c6f5757fd40c0601657ab18368da7ddf33/docido_sdk/toolbox/__init__.py#L5-L11
Sean1708/HipPy
hippy/__init__.py
write
def write(file_name, data): """Encode and write a Hip file.""" with open(file_name, 'w') as f: f.write(encode(data))
python
def write(file_name, data): """Encode and write a Hip file.""" with open(file_name, 'w') as f: f.write(encode(data))
[ "def", "write", "(", "file_name", ",", "data", ")", ":", "with", "open", "(", "file_name", ",", "'w'", ")", "as", "f", ":", "f", ".", "write", "(", "encode", "(", "data", ")", ")" ]
Encode and write a Hip file.
[ "Encode", "and", "write", "a", "Hip", "file", "." ]
train
https://github.com/Sean1708/HipPy/blob/d0ea8fb1e417f1fedaa8e215e3d420b90c4de691/hippy/__init__.py#L21-L24
fred49/linshare-api
linshareapi/user/threadmembers.py
ThreadsMembers2.get
def get(self, thread_uuid, uuid): """ Get one thread member.""" members = (v for v in self.list(thread_uuid) if v.get('userUuid') == uuid) for i in members: self.log.debug(i) return i return None
python
def get(self, thread_uuid, uuid): """ Get one thread member.""" members = (v for v in self.list(thread_uuid) if v.get('userUuid') == uuid) for i in members: self.log.debug(i) return i return None
[ "def", "get", "(", "self", ",", "thread_uuid", ",", "uuid", ")", ":", "members", "=", "(", "v", "for", "v", "in", "self", ".", "list", "(", "thread_uuid", ")", "if", "v", ".", "get", "(", "'userUuid'", ")", "==", "uuid", ")", "for", "i", "in", ...
Get one thread member.
[ "Get", "one", "thread", "member", "." ]
train
https://github.com/fred49/linshare-api/blob/be646c25aa8ba3718abb6869c620b157d53d6e41/linshareapi/user/threadmembers.py#L110-L116
fred49/linshare-api
linshareapi/user/threadmembers.py
WorkgroupMembers.get
def get(self, wg_uuid, uuid): """ Get one workgroup member.""" url = "%(base)s/%(wg_uuid)s/members/%(uuid)s" % { 'base': self.local_base_url, 'wg_uuid': wg_uuid, 'uuid': uuid } return self.core.get(url)
python
def get(self, wg_uuid, uuid): """ Get one workgroup member.""" url = "%(base)s/%(wg_uuid)s/members/%(uuid)s" % { 'base': self.local_base_url, 'wg_uuid': wg_uuid, 'uuid': uuid } return self.core.get(url)
[ "def", "get", "(", "self", ",", "wg_uuid", ",", "uuid", ")", ":", "url", "=", "\"%(base)s/%(wg_uuid)s/members/%(uuid)s\"", "%", "{", "'base'", ":", "self", ".", "local_base_url", ",", "'wg_uuid'", ":", "wg_uuid", ",", "'uuid'", ":", "uuid", "}", "return", ...
Get one workgroup member.
[ "Get", "one", "workgroup", "member", "." ]
train
https://github.com/fred49/linshare-api/blob/be646c25aa8ba3718abb6869c620b157d53d6e41/linshareapi/user/threadmembers.py#L159-L166
fred49/linshare-api
linshareapi/user/threadmembers.py
WorkgroupMembers.delete
def delete(self, wg_uuid, uuid): """ Delete one thread member.""" url = "%(base)s/%(wg_uuid)s/members/%(uuid)s" % { 'base': self.local_base_url, 'wg_uuid': wg_uuid, 'uuid': uuid } return self.core.delete(url)
python
def delete(self, wg_uuid, uuid): """ Delete one thread member.""" url = "%(base)s/%(wg_uuid)s/members/%(uuid)s" % { 'base': self.local_base_url, 'wg_uuid': wg_uuid, 'uuid': uuid } return self.core.delete(url)
[ "def", "delete", "(", "self", ",", "wg_uuid", ",", "uuid", ")", ":", "url", "=", "\"%(base)s/%(wg_uuid)s/members/%(uuid)s\"", "%", "{", "'base'", ":", "self", ".", "local_base_url", ",", "'wg_uuid'", ":", "wg_uuid", ",", "'uuid'", ":", "uuid", "}", "return",...
Delete one thread member.
[ "Delete", "one", "thread", "member", "." ]
train
https://github.com/fred49/linshare-api/blob/be646c25aa8ba3718abb6869c620b157d53d6e41/linshareapi/user/threadmembers.py#L170-L177
cariad/py-wpconfigr
wpconfigr/__main__.py
run_from_cli
def run_from_cli(): """ Perform an update instigated from a CLI. """ arg_parser = argparse.ArgumentParser( description='Read and write properties in a wp-config.php file. ' 'Include a --value argument to set the value, omit it to ' 'read the value of the ...
python
def run_from_cli(): """ Perform an update instigated from a CLI. """ arg_parser = argparse.ArgumentParser( description='Read and write properties in a wp-config.php file. ' 'Include a --value argument to set the value, omit it to ' 'read the value of the ...
[ "def", "run_from_cli", "(", ")", ":", "arg_parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'Read and write properties in a wp-config.php file. '", "'Include a --value argument to set the value, omit it to '", "'read the value of the specified key.'", ",", ...
Perform an update instigated from a CLI.
[ "Perform", "an", "update", "instigated", "from", "a", "CLI", "." ]
train
https://github.com/cariad/py-wpconfigr/blob/8f25bb849b72ce95957566544a2be8445316c818/wpconfigr/__main__.py#L12-L76
Dispersive-Hydrodynamics-Lab/PACE
PACE/PACE.py
manage_file_analysis
def manage_file_analysis(args: argparse.Namespace, filename: str, data: object) -> None: """ Take care of the analysis of a datafile """ key = DataStore.hashfile(filename) print('Analyzing {} --> {}'.format(filename, key)) if data.check_key(key): # if exists in database, prepopulate fit...
python
def manage_file_analysis(args: argparse.Namespace, filename: str, data: object) -> None: """ Take care of the analysis of a datafile """ key = DataStore.hashfile(filename) print('Analyzing {} --> {}'.format(filename, key)) if data.check_key(key): # if exists in database, prepopulate fit...
[ "def", "manage_file_analysis", "(", "args", ":", "argparse", ".", "Namespace", ",", "filename", ":", "str", ",", "data", ":", "object", ")", "->", "None", ":", "key", "=", "DataStore", ".", "hashfile", "(", "filename", ")", "print", "(", "'Analyzing {} -->...
Take care of the analysis of a datafile
[ "Take", "care", "of", "the", "analysis", "of", "a", "datafile" ]
train
https://github.com/Dispersive-Hydrodynamics-Lab/PACE/blob/4ce27d5fc9b02cc2ce55f6fea7fc8d6015317e1f/PACE/PACE.py#L79-L99
Dispersive-Hydrodynamics-Lab/PACE
PACE/PACE.py
get_args
def get_args() -> argparse.Namespace: """ Get program arguments. Just use --help.... """ parser = argparse.ArgumentParser(prog='python3 linefit.py', description=('Parameterize and analyze ' 'usability of conduit ...
python
def get_args() -> argparse.Namespace: """ Get program arguments. Just use --help.... """ parser = argparse.ArgumentParser(prog='python3 linefit.py', description=('Parameterize and analyze ' 'usability of conduit ...
[ "def", "get_args", "(", ")", "->", "argparse", ".", "Namespace", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "prog", "=", "'python3 linefit.py'", ",", "description", "=", "(", "'Parameterize and analyze '", "'usability of conduit edge data'", ")", ")...
Get program arguments. Just use --help....
[ "Get", "program", "arguments", "." ]
train
https://github.com/Dispersive-Hydrodynamics-Lab/PACE/blob/4ce27d5fc9b02cc2ce55f6fea7fc8d6015317e1f/PACE/PACE.py#L517-L559
Dispersive-Hydrodynamics-Lab/PACE
PACE/PACE.py
DataStore.get_keys
def get_keys(self) -> typing.List[str]: """ Return list of SHA512 hash keys that exist in datafile :return: list of keys """ keys = [] for key in self.data.keys(): if key not in ['__header__', '__version__', '__globals__']: keys.append(key) ...
python
def get_keys(self) -> typing.List[str]: """ Return list of SHA512 hash keys that exist in datafile :return: list of keys """ keys = [] for key in self.data.keys(): if key not in ['__header__', '__version__', '__globals__']: keys.append(key) ...
[ "def", "get_keys", "(", "self", ")", "->", "typing", ".", "List", "[", "str", "]", ":", "keys", "=", "[", "]", "for", "key", "in", "self", ".", "data", ".", "keys", "(", ")", ":", "if", "key", "not", "in", "[", "'__header__'", ",", "'__version__'...
Return list of SHA512 hash keys that exist in datafile :return: list of keys
[ "Return", "list", "of", "SHA512", "hash", "keys", "that", "exist", "in", "datafile" ]
train
https://github.com/Dispersive-Hydrodynamics-Lab/PACE/blob/4ce27d5fc9b02cc2ce55f6fea7fc8d6015317e1f/PACE/PACE.py#L151-L161
Dispersive-Hydrodynamics-Lab/PACE
PACE/PACE.py
DataStore.check_key
def check_key(self, key: str) -> bool: """ Checks if key exists in datastore. True if yes, False if no. :param: SHA512 hash key :return: whether or key not exists in datastore """ keys = self.get_keys() return key in keys
python
def check_key(self, key: str) -> bool: """ Checks if key exists in datastore. True if yes, False if no. :param: SHA512 hash key :return: whether or key not exists in datastore """ keys = self.get_keys() return key in keys
[ "def", "check_key", "(", "self", ",", "key", ":", "str", ")", "->", "bool", ":", "keys", "=", "self", ".", "get_keys", "(", ")", "return", "key", "in", "keys" ]
Checks if key exists in datastore. True if yes, False if no. :param: SHA512 hash key :return: whether or key not exists in datastore
[ "Checks", "if", "key", "exists", "in", "datastore", ".", "True", "if", "yes", "False", "if", "no", "." ]
train
https://github.com/Dispersive-Hydrodynamics-Lab/PACE/blob/4ce27d5fc9b02cc2ce55f6fea7fc8d6015317e1f/PACE/PACE.py#L164-L173
Dispersive-Hydrodynamics-Lab/PACE
PACE/PACE.py
DataStore.get_traindata
def get_traindata(self) -> np.ndarray: """ Pulls all available data and concatenates for model training :return: 2d array of points """ traindata = None for key, value in self.data.items(): if key not in ['__header__', '__version__', '__globals__']: ...
python
def get_traindata(self) -> np.ndarray: """ Pulls all available data and concatenates for model training :return: 2d array of points """ traindata = None for key, value in self.data.items(): if key not in ['__header__', '__version__', '__globals__']: ...
[ "def", "get_traindata", "(", "self", ")", "->", "np", ".", "ndarray", ":", "traindata", "=", "None", "for", "key", ",", "value", "in", "self", ".", "data", ".", "items", "(", ")", ":", "if", "key", "not", "in", "[", "'__header__'", ",", "'__version__...
Pulls all available data and concatenates for model training :return: 2d array of points
[ "Pulls", "all", "available", "data", "and", "concatenates", "for", "model", "training" ]
train
https://github.com/Dispersive-Hydrodynamics-Lab/PACE/blob/4ce27d5fc9b02cc2ce55f6fea7fc8d6015317e1f/PACE/PACE.py#L175-L188
Dispersive-Hydrodynamics-Lab/PACE
PACE/PACE.py
DataStore.plot_traindata
def plot_traindata(self, name: str='dataplot') -> None: """ Plots traindata.... choo choo... """ traindata = self.get_traindata() plt.figure(figsize=(16, 16)) plt.scatter(traindata[:, 1], traindata[:, 2], c=traindata[:, 5], marker='o', label='Datastor...
python
def plot_traindata(self, name: str='dataplot') -> None: """ Plots traindata.... choo choo... """ traindata = self.get_traindata() plt.figure(figsize=(16, 16)) plt.scatter(traindata[:, 1], traindata[:, 2], c=traindata[:, 5], marker='o', label='Datastor...
[ "def", "plot_traindata", "(", "self", ",", "name", ":", "str", "=", "'dataplot'", ")", "->", "None", ":", "traindata", "=", "self", ".", "get_traindata", "(", ")", "plt", ".", "figure", "(", "figsize", "=", "(", "16", ",", "16", ")", ")", "plt", "....
Plots traindata.... choo choo...
[ "Plots", "traindata", "....", "choo", "choo", "..." ]
train
https://github.com/Dispersive-Hydrodynamics-Lab/PACE/blob/4ce27d5fc9b02cc2ce55f6fea7fc8d6015317e1f/PACE/PACE.py#L191-L203
Dispersive-Hydrodynamics-Lab/PACE
PACE/PACE.py
DataStore.printdata
def printdata(self) -> None: """ Prints data to stdout """ np.set_printoptions(threshold=np.nan) print(self.data) np.set_printoptions(threshold=1000)
python
def printdata(self) -> None: """ Prints data to stdout """ np.set_printoptions(threshold=np.nan) print(self.data) np.set_printoptions(threshold=1000)
[ "def", "printdata", "(", "self", ")", "->", "None", ":", "np", ".", "set_printoptions", "(", "threshold", "=", "np", ".", "nan", ")", "print", "(", "self", ".", "data", ")", "np", ".", "set_printoptions", "(", "threshold", "=", "1000", ")" ]
Prints data to stdout
[ "Prints", "data", "to", "stdout" ]
train
https://github.com/Dispersive-Hydrodynamics-Lab/PACE/blob/4ce27d5fc9b02cc2ce55f6fea7fc8d6015317e1f/PACE/PACE.py#L205-L209
Dispersive-Hydrodynamics-Lab/PACE
PACE/PACE.py
DataStore.update
def update(self, key: str, data: np.ndarray) -> None: """ Update entry in datastore """ self.data[key] = data
python
def update(self, key: str, data: np.ndarray) -> None: """ Update entry in datastore """ self.data[key] = data
[ "def", "update", "(", "self", ",", "key", ":", "str", ",", "data", ":", "np", ".", "ndarray", ")", "->", "None", ":", "self", ".", "data", "[", "key", "]", "=", "data" ]
Update entry in datastore
[ "Update", "entry", "in", "datastore" ]
train
https://github.com/Dispersive-Hydrodynamics-Lab/PACE/blob/4ce27d5fc9b02cc2ce55f6fea7fc8d6015317e1f/PACE/PACE.py#L216-L218
Dispersive-Hydrodynamics-Lab/PACE
PACE/PACE.py
DataStore.update1
def update1(self, key: str, data: np.ndarray, size: int) -> None: """ Update one entry in specific record in datastore """ print(data) if key in self.get_keys(): self.data[key][data[0]] = data else: newdata = np.zeros((size, 6)) newdata[data[0]] = data...
python
def update1(self, key: str, data: np.ndarray, size: int) -> None: """ Update one entry in specific record in datastore """ print(data) if key in self.get_keys(): self.data[key][data[0]] = data else: newdata = np.zeros((size, 6)) newdata[data[0]] = data...
[ "def", "update1", "(", "self", ",", "key", ":", "str", ",", "data", ":", "np", ".", "ndarray", ",", "size", ":", "int", ")", "->", "None", ":", "print", "(", "data", ")", "if", "key", "in", "self", ".", "get_keys", "(", ")", ":", "self", ".", ...
Update one entry in specific record in datastore
[ "Update", "one", "entry", "in", "specific", "record", "in", "datastore" ]
train
https://github.com/Dispersive-Hydrodynamics-Lab/PACE/blob/4ce27d5fc9b02cc2ce55f6fea7fc8d6015317e1f/PACE/PACE.py#L220-L228
Dispersive-Hydrodynamics-Lab/PACE
PACE/PACE.py
DataStore.hashfile
def hashfile(name: str) -> str: """ Gets a hash of a file using block parsing http://stackoverflow.com/questions/3431825/generating-a-md5-checksum-of-a-file Using SHA512 for long-term support (hehehehe) """ hasher = hashlib.sha512() with open(name, 'rb') as openf...
python
def hashfile(name: str) -> str: """ Gets a hash of a file using block parsing http://stackoverflow.com/questions/3431825/generating-a-md5-checksum-of-a-file Using SHA512 for long-term support (hehehehe) """ hasher = hashlib.sha512() with open(name, 'rb') as openf...
[ "def", "hashfile", "(", "name", ":", "str", ")", "->", "str", ":", "hasher", "=", "hashlib", ".", "sha512", "(", ")", "with", "open", "(", "name", ",", "'rb'", ")", "as", "openfile", ":", "for", "chunk", "in", "iter", "(", "lambda", ":", "openfile"...
Gets a hash of a file using block parsing http://stackoverflow.com/questions/3431825/generating-a-md5-checksum-of-a-file Using SHA512 for long-term support (hehehehe)
[ "Gets", "a", "hash", "of", "a", "file", "using", "block", "parsing" ]
train
https://github.com/Dispersive-Hydrodynamics-Lab/PACE/blob/4ce27d5fc9b02cc2ce55f6fea7fc8d6015317e1f/PACE/PACE.py#L232-L243
Dispersive-Hydrodynamics-Lab/PACE
PACE/PACE.py
LineFit._loadedges
def _loadedges(self) -> typing.Tuple[np.ndarray, np.ndarray, np.ndarray, float, np.ndarray]: """ Attempts to intelligently load the .mat file and take average of left and right edges :return: left and right averages :return: times for each column :return: accept/reject for each ...
python
def _loadedges(self) -> typing.Tuple[np.ndarray, np.ndarray, np.ndarray, float, np.ndarray]: """ Attempts to intelligently load the .mat file and take average of left and right edges :return: left and right averages :return: times for each column :return: accept/reject for each ...
[ "def", "_loadedges", "(", "self", ")", "->", "typing", ".", "Tuple", "[", "np", ".", "ndarray", ",", "np", ".", "ndarray", ",", "np", ".", "ndarray", ",", "float", ",", "np", ".", "ndarray", "]", ":", "data", "=", "sco", ".", "loadmat", "(", "sel...
Attempts to intelligently load the .mat file and take average of left and right edges :return: left and right averages :return: times for each column :return: accept/reject for each column :return: pixel-inch ratio
[ "Attempts", "to", "intelligently", "load", "the", ".", "mat", "file", "and", "take", "average", "of", "left", "and", "right", "edges" ]
train
https://github.com/Dispersive-Hydrodynamics-Lab/PACE/blob/4ce27d5fc9b02cc2ce55f6fea7fc8d6015317e1f/PACE/PACE.py#L275-L308
Dispersive-Hydrodynamics-Lab/PACE
PACE/PACE.py
LineFit.plot_file
def plot_file(self, name: str=None, time: int=None) -> None: """ Plot specific time for provided datafile. If no time provided, will plot middle. :param: savefile name :param: time/data column """ if not time: time = int(len(self.times) / 2) i...
python
def plot_file(self, name: str=None, time: int=None) -> None: """ Plot specific time for provided datafile. If no time provided, will plot middle. :param: savefile name :param: time/data column """ if not time: time = int(len(self.times) / 2) i...
[ "def", "plot_file", "(", "self", ",", "name", ":", "str", "=", "None", ",", "time", ":", "int", "=", "None", ")", "->", "None", ":", "if", "not", "time", ":", "time", "=", "int", "(", "len", "(", "self", ".", "times", ")", "/", "2", ")", "if"...
Plot specific time for provided datafile. If no time provided, will plot middle. :param: savefile name :param: time/data column
[ "Plot", "specific", "time", "for", "provided", "datafile", ".", "If", "no", "time", "provided", "will", "plot", "middle", "." ]
train
https://github.com/Dispersive-Hydrodynamics-Lab/PACE/blob/4ce27d5fc9b02cc2ce55f6fea7fc8d6015317e1f/PACE/PACE.py#L310-L326
Dispersive-Hydrodynamics-Lab/PACE
PACE/PACE.py
LineFit._gaussian_function
def _gaussian_function(self, datalength: int, values: np.ndarray, height: int, index: int) -> np.ndarray: """ i'th Regression Model Gaussian :param: len(x) :param: x values :param: height of gaussian :param: position of gaussian :retur...
python
def _gaussian_function(self, datalength: int, values: np.ndarray, height: int, index: int) -> np.ndarray: """ i'th Regression Model Gaussian :param: len(x) :param: x values :param: height of gaussian :param: position of gaussian :retur...
[ "def", "_gaussian_function", "(", "self", ",", "datalength", ":", "int", ",", "values", ":", "np", ".", "ndarray", ",", "height", ":", "int", ",", "index", ":", "int", ")", "->", "np", ".", "ndarray", ":", "return", "height", "*", "np", ".", "exp", ...
i'th Regression Model Gaussian :param: len(x) :param: x values :param: height of gaussian :param: position of gaussian :return: gaussian bumps over domain
[ "i", "th", "Regression", "Model", "Gaussian" ]
train
https://github.com/Dispersive-Hydrodynamics-Lab/PACE/blob/4ce27d5fc9b02cc2ce55f6fea7fc8d6015317e1f/PACE/PACE.py#L339-L352
Dispersive-Hydrodynamics-Lab/PACE
PACE/PACE.py
LineFit._get_fit
def _get_fit(self, time: int) -> typing.Tuple[np.ndarray, np.ndarray, float, float]: """ Fit regression model to data :param: time (column of data) :return: predicted points :return: residuals :return: mean residual :return: error """ rawdata = s...
python
def _get_fit(self, time: int) -> typing.Tuple[np.ndarray, np.ndarray, float, float]: """ Fit regression model to data :param: time (column of data) :return: predicted points :return: residuals :return: mean residual :return: error """ rawdata = s...
[ "def", "_get_fit", "(", "self", ",", "time", ":", "int", ")", "->", "typing", ".", "Tuple", "[", "np", ".", "ndarray", ",", "np", ".", "ndarray", ",", "float", ",", "float", "]", ":", "rawdata", "=", "self", ".", "averagedata", "[", ":", ",", "ti...
Fit regression model to data :param: time (column of data) :return: predicted points :return: residuals :return: mean residual :return: error
[ "Fit", "regression", "model", "to", "data" ]
train
https://github.com/Dispersive-Hydrodynamics-Lab/PACE/blob/4ce27d5fc9b02cc2ce55f6fea7fc8d6015317e1f/PACE/PACE.py#L355-L378
Dispersive-Hydrodynamics-Lab/PACE
PACE/PACE.py
LineFit._get_noise
def _get_noise(self, residuals: np.ndarray) -> float: """ Determine Noise of Residuals. :param: residuals :return: noise """ return np.mean(np.abs(residuals))
python
def _get_noise(self, residuals: np.ndarray) -> float: """ Determine Noise of Residuals. :param: residuals :return: noise """ return np.mean(np.abs(residuals))
[ "def", "_get_noise", "(", "self", ",", "residuals", ":", "np", ".", "ndarray", ")", "->", "float", ":", "return", "np", ".", "mean", "(", "np", ".", "abs", "(", "residuals", ")", ")" ]
Determine Noise of Residuals. :param: residuals :return: noise
[ "Determine", "Noise", "of", "Residuals", "." ]
train
https://github.com/Dispersive-Hydrodynamics-Lab/PACE/blob/4ce27d5fc9b02cc2ce55f6fea7fc8d6015317e1f/PACE/PACE.py#L381-L389
Dispersive-Hydrodynamics-Lab/PACE
PACE/PACE.py
LineFit.analyze
def analyze(self, time: int=None) -> typing.Tuple[float, float, int, int]: """ Determine noise, curvature, range, and domain of specified array. :param: pixel to inch ratio :param: time (column) to use. :return: curvature :return: noise :return: range :r...
python
def analyze(self, time: int=None) -> typing.Tuple[float, float, int, int]: """ Determine noise, curvature, range, and domain of specified array. :param: pixel to inch ratio :param: time (column) to use. :return: curvature :return: noise :return: range :r...
[ "def", "analyze", "(", "self", ",", "time", ":", "int", "=", "None", ")", "->", "typing", ".", "Tuple", "[", "float", ",", "float", ",", "int", ",", "int", "]", ":", "if", "not", "time", ":", "time", "=", "int", "(", "len", "(", "self", ".", ...
Determine noise, curvature, range, and domain of specified array. :param: pixel to inch ratio :param: time (column) to use. :return: curvature :return: noise :return: range :return: domain
[ "Determine", "noise", "curvature", "range", "and", "domain", "of", "specified", "array", "." ]
train
https://github.com/Dispersive-Hydrodynamics-Lab/PACE/blob/4ce27d5fc9b02cc2ce55f6fea7fc8d6015317e1f/PACE/PACE.py#L392-L420
Dispersive-Hydrodynamics-Lab/PACE
PACE/PACE.py
LineFit.analyze_full
def analyze_full(self) -> typing.Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]: """ Determine noise, curvature, range, and domain of specified data. Like analyze, except examines the entire file. :param: float->pixel to inch ratio :return: array->curvatures :ret...
python
def analyze_full(self) -> typing.Tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]: """ Determine noise, curvature, range, and domain of specified data. Like analyze, except examines the entire file. :param: float->pixel to inch ratio :return: array->curvatures :ret...
[ "def", "analyze_full", "(", "self", ")", "->", "typing", ".", "Tuple", "[", "np", ".", "ndarray", ",", "np", ".", "ndarray", ",", "np", ".", "ndarray", ",", "np", ".", "ndarray", "]", ":", "if", "self", ".", "noises", "[", "0", "]", "==", "0", ...
Determine noise, curvature, range, and domain of specified data. Like analyze, except examines the entire file. :param: float->pixel to inch ratio :return: array->curvatures :return: array->noises :return: array->ranges :return: array->domains
[ "Determine", "noise", "curvature", "range", "and", "domain", "of", "specified", "data", ".", "Like", "analyze", "except", "examines", "the", "entire", "file", "." ]
train
https://github.com/Dispersive-Hydrodynamics-Lab/PACE/blob/4ce27d5fc9b02cc2ce55f6fea7fc8d6015317e1f/PACE/PACE.py#L423-L439
Dispersive-Hydrodynamics-Lab/PACE
PACE/PACE.py
ML.get_algo
def get_algo(self, args: argparse.Namespace, algo: str) -> object: """ Returns machine learning algorithm based on arguments """ if algo == 'nn': return NearestNeighbor(args.nnk)
python
def get_algo(self, args: argparse.Namespace, algo: str) -> object: """ Returns machine learning algorithm based on arguments """ if algo == 'nn': return NearestNeighbor(args.nnk)
[ "def", "get_algo", "(", "self", ",", "args", ":", "argparse", ".", "Namespace", ",", "algo", ":", "str", ")", "->", "object", ":", "if", "algo", "==", "'nn'", ":", "return", "NearestNeighbor", "(", "args", ".", "nnk", ")" ]
Returns machine learning algorithm based on arguments
[ "Returns", "machine", "learning", "algorithm", "based", "on", "arguments" ]
train
https://github.com/Dispersive-Hydrodynamics-Lab/PACE/blob/4ce27d5fc9b02cc2ce55f6fea7fc8d6015317e1f/PACE/PACE.py#L449-L452
Dispersive-Hydrodynamics-Lab/PACE
PACE/PACE.py
ML.plot_fitspace
def plot_fitspace(self, name: str, X: np.ndarray, y: np.ndarray, clf: object) -> None: """ Plot 2dplane of fitspace """ cmap_light = ListedColormap(['#FFAAAA', '#AAFFAA', '#AAAAFF']) cmap_bold = ListedColormap(['#FF0000', '#00FF00', '#0000FF']) # Plot the decision boundary. For that, we...
python
def plot_fitspace(self, name: str, X: np.ndarray, y: np.ndarray, clf: object) -> None: """ Plot 2dplane of fitspace """ cmap_light = ListedColormap(['#FFAAAA', '#AAFFAA', '#AAAAFF']) cmap_bold = ListedColormap(['#FF0000', '#00FF00', '#0000FF']) # Plot the decision boundary. For that, we...
[ "def", "plot_fitspace", "(", "self", ",", "name", ":", "str", ",", "X", ":", "np", ".", "ndarray", ",", "y", ":", "np", ".", "ndarray", ",", "clf", ":", "object", ")", "->", "None", ":", "cmap_light", "=", "ListedColormap", "(", "[", "'#FFAAAA'", "...
Plot 2dplane of fitspace
[ "Plot", "2dplane", "of", "fitspace" ]
train
https://github.com/Dispersive-Hydrodynamics-Lab/PACE/blob/4ce27d5fc9b02cc2ce55f6fea7fc8d6015317e1f/PACE/PACE.py#L469-L494
Dispersive-Hydrodynamics-Lab/PACE
PACE/PACE.py
NearestNeighbor.train
def train(self, traindata: np.ndarray) -> None: """ Trains on dataset """ self.clf.fit(traindata[:, 1:5], traindata[:, 5])
python
def train(self, traindata: np.ndarray) -> None: """ Trains on dataset """ self.clf.fit(traindata[:, 1:5], traindata[:, 5])
[ "def", "train", "(", "self", ",", "traindata", ":", "np", ".", "ndarray", ")", "->", "None", ":", "self", ".", "clf", ".", "fit", "(", "traindata", "[", ":", ",", "1", ":", "5", "]", ",", "traindata", "[", ":", ",", "5", "]", ")" ]
Trains on dataset
[ "Trains", "on", "dataset" ]
train
https://github.com/Dispersive-Hydrodynamics-Lab/PACE/blob/4ce27d5fc9b02cc2ce55f6fea7fc8d6015317e1f/PACE/PACE.py#L508-L510
Dispersive-Hydrodynamics-Lab/PACE
PACE/PACE.py
NearestNeighbor.predict
def predict(self, predictdata: np.ndarray) -> np.ndarray: """ predict given points """ return self.clf.predict(predictdata)
python
def predict(self, predictdata: np.ndarray) -> np.ndarray: """ predict given points """ return self.clf.predict(predictdata)
[ "def", "predict", "(", "self", ",", "predictdata", ":", "np", ".", "ndarray", ")", "->", "np", ".", "ndarray", ":", "return", "self", ".", "clf", ".", "predict", "(", "predictdata", ")" ]
predict given points
[ "predict", "given", "points" ]
train
https://github.com/Dispersive-Hydrodynamics-Lab/PACE/blob/4ce27d5fc9b02cc2ce55f6fea7fc8d6015317e1f/PACE/PACE.py#L512-L514
henrysher/kotocore
kotocore/session.py
Session.get_connection
def get_connection(self, service_name): """ Returns a ``Connection`` **class** for a given service. :param service_name: A string that specifies the name of the desired service. Ex. ``sqs``, ``sns``, ``dynamodb``, etc. :type service_name: string :rtype: <kotocore.co...
python
def get_connection(self, service_name): """ Returns a ``Connection`` **class** for a given service. :param service_name: A string that specifies the name of the desired service. Ex. ``sqs``, ``sns``, ``dynamodb``, etc. :type service_name: string :rtype: <kotocore.co...
[ "def", "get_connection", "(", "self", ",", "service_name", ")", ":", "try", ":", "return", "self", ".", "cache", ".", "get_connection", "(", "service_name", ")", "except", "NotCached", ":", "pass", "# We didn't find it. Construct it.", "new_class", "=", "self", ...
Returns a ``Connection`` **class** for a given service. :param service_name: A string that specifies the name of the desired service. Ex. ``sqs``, ``sns``, ``dynamodb``, etc. :type service_name: string :rtype: <kotocore.connection.Connection subclass>
[ "Returns", "a", "Connection", "**", "class", "**", "for", "a", "given", "service", "." ]
train
https://github.com/henrysher/kotocore/blob/c52d2f3878b924ceabca07f61c91abcb1b230ecc/kotocore/session.py#L77-L95
henrysher/kotocore
kotocore/session.py
Session.get_resource
def get_resource(self, service_name, resource_name, base_class=None): """ Returns a ``Resource`` **class** for a given service. :param service_name: A string that specifies the name of the desired service. Ex. ``sqs``, ``sns``, ``dynamodb``, etc. :type service_name: string ...
python
def get_resource(self, service_name, resource_name, base_class=None): """ Returns a ``Resource`` **class** for a given service. :param service_name: A string that specifies the name of the desired service. Ex. ``sqs``, ``sns``, ``dynamodb``, etc. :type service_name: string ...
[ "def", "get_resource", "(", "self", ",", "service_name", ",", "resource_name", ",", "base_class", "=", "None", ")", ":", "try", ":", "return", "self", ".", "cache", ".", "get_resource", "(", "service_name", ",", "resource_name", ",", "base_class", "=", "base...
Returns a ``Resource`` **class** for a given service. :param service_name: A string that specifies the name of the desired service. Ex. ``sqs``, ``sns``, ``dynamodb``, etc. :type service_name: string :param resource_name: A string that specifies the name of the desired ...
[ "Returns", "a", "Resource", "**", "class", "**", "for", "a", "given", "service", "." ]
train
https://github.com/henrysher/kotocore/blob/c52d2f3878b924ceabca07f61c91abcb1b230ecc/kotocore/session.py#L97-L131
henrysher/kotocore
kotocore/session.py
Session.get_collection
def get_collection(self, service_name, collection_name, base_class=None): """ Returns a ``Collection`` **class** for a given service. :param service_name: A string that specifies the name of the desired service. Ex. ``sqs``, ``sns``, ``dynamodb``, etc. :type service_name: st...
python
def get_collection(self, service_name, collection_name, base_class=None): """ Returns a ``Collection`` **class** for a given service. :param service_name: A string that specifies the name of the desired service. Ex. ``sqs``, ``sns``, ``dynamodb``, etc. :type service_name: st...
[ "def", "get_collection", "(", "self", ",", "service_name", ",", "collection_name", ",", "base_class", "=", "None", ")", ":", "try", ":", "return", "self", ".", "cache", ".", "get_collection", "(", "service_name", ",", "collection_name", ",", "base_class", "=",...
Returns a ``Collection`` **class** for a given service. :param service_name: A string that specifies the name of the desired service. Ex. ``sqs``, ``sns``, ``dynamodb``, etc. :type service_name: string :param collection_name: A string that specifies the name of the desired ...
[ "Returns", "a", "Collection", "**", "class", "**", "for", "a", "given", "service", "." ]
train
https://github.com/henrysher/kotocore/blob/c52d2f3878b924ceabca07f61c91abcb1b230ecc/kotocore/session.py#L133-L168
henrysher/kotocore
kotocore/session.py
Session.connect_to
def connect_to(self, service_name, **kwargs): """ Shortcut method to make instantiating the ``Connection`` classes easier. Forwards ``**kwargs`` like region, keys, etc. on to the constructor. :param service_name: A string that specifies the name of the desired servi...
python
def connect_to(self, service_name, **kwargs): """ Shortcut method to make instantiating the ``Connection`` classes easier. Forwards ``**kwargs`` like region, keys, etc. on to the constructor. :param service_name: A string that specifies the name of the desired servi...
[ "def", "connect_to", "(", "self", ",", "service_name", ",", "*", "*", "kwargs", ")", ":", "service_class", "=", "self", ".", "get_connection", "(", "service_name", ")", "return", "service_class", ".", "connect_to", "(", "*", "*", "kwargs", ")" ]
Shortcut method to make instantiating the ``Connection`` classes easier. Forwards ``**kwargs`` like region, keys, etc. on to the constructor. :param service_name: A string that specifies the name of the desired service. Ex. ``sqs``, ``sns``, ``dynamodb``, etc. :type service...
[ "Shortcut", "method", "to", "make", "instantiating", "the", "Connection", "classes", "easier", "." ]
train
https://github.com/henrysher/kotocore/blob/c52d2f3878b924ceabca07f61c91abcb1b230ecc/kotocore/session.py#L170-L184
minhhoit/yacms
yacms/forms/forms.py
FormForForm.save
def save(self, **kwargs): """ Create a ``FormEntry`` instance and related ``FieldEntry`` instances for each form field. """ entry = super(FormForForm, self).save(commit=False) entry.form = self.form entry.entry_time = now() entry.save() entry_field...
python
def save(self, **kwargs): """ Create a ``FormEntry`` instance and related ``FieldEntry`` instances for each form field. """ entry = super(FormForForm, self).save(commit=False) entry.form = self.form entry.entry_time = now() entry.save() entry_field...
[ "def", "save", "(", "self", ",", "*", "*", "kwargs", ")", ":", "entry", "=", "super", "(", "FormForForm", ",", "self", ")", ".", "save", "(", "commit", "=", "False", ")", "entry", ".", "form", "=", "self", ".", "form", "entry", ".", "entry_time", ...
Create a ``FormEntry`` instance and related ``FieldEntry`` instances for each form field.
[ "Create", "a", "FormEntry", "instance", "and", "related", "FieldEntry", "instances", "for", "each", "form", "field", "." ]
train
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/forms/forms.py#L202-L229
minhhoit/yacms
yacms/forms/forms.py
FormForForm.email_to
def email_to(self): """ Return the value entered for the first field of type ``forms.EmailField``. """ for field in self.form_fields: if issubclass(fields.CLASSES[field.field_type], forms.EmailField): return self.cleaned_data["field_%s" % field.id] ...
python
def email_to(self): """ Return the value entered for the first field of type ``forms.EmailField``. """ for field in self.form_fields: if issubclass(fields.CLASSES[field.field_type], forms.EmailField): return self.cleaned_data["field_%s" % field.id] ...
[ "def", "email_to", "(", "self", ")", ":", "for", "field", "in", "self", ".", "form_fields", ":", "if", "issubclass", "(", "fields", ".", "CLASSES", "[", "field", ".", "field_type", "]", ",", "forms", ".", "EmailField", ")", ":", "return", "self", ".", ...
Return the value entered for the first field of type ``forms.EmailField``.
[ "Return", "the", "value", "entered", "for", "the", "first", "field", "of", "type", "forms", ".", "EmailField", "." ]
train
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/forms/forms.py#L231-L239
minhhoit/yacms
yacms/forms/forms.py
EntriesForm.columns
def columns(self): """ Returns the list of selected column names. """ fields = [f.label for f in self.form_fields if self.cleaned_data["field_%s_export" % f.id]] if self.cleaned_data["field_0_export"]: fields.append(self.entry_time_name) retu...
python
def columns(self): """ Returns the list of selected column names. """ fields = [f.label for f in self.form_fields if self.cleaned_data["field_%s_export" % f.id]] if self.cleaned_data["field_0_export"]: fields.append(self.entry_time_name) retu...
[ "def", "columns", "(", "self", ")", ":", "fields", "=", "[", "f", ".", "label", "for", "f", "in", "self", ".", "form_fields", "if", "self", ".", "cleaned_data", "[", "\"field_%s_export\"", "%", "f", ".", "id", "]", "]", "if", "self", ".", "cleaned_da...
Returns the list of selected column names.
[ "Returns", "the", "list", "of", "selected", "column", "names", "." ]
train
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/forms/forms.py#L321-L329
minhhoit/yacms
yacms/forms/forms.py
EntriesForm.rows
def rows(self, csv=False): """ Returns each row based on the selected criteria. """ # Store the index of each field against its ID for building each # entry row with columns in the correct order. Also store the IDs of # fields with a type of FileField or Date-like for sp...
python
def rows(self, csv=False): """ Returns each row based on the selected criteria. """ # Store the index of each field against its ID for building each # entry row with columns in the correct order. Also store the IDs of # fields with a type of FileField or Date-like for sp...
[ "def", "rows", "(", "self", ",", "csv", "=", "False", ")", ":", "# Store the index of each field against its ID for building each", "# entry row with columns in the correct order. Also store the IDs of", "# fields with a type of FileField or Date-like for special handling of", "# their val...
Returns each row based on the selected criteria.
[ "Returns", "each", "row", "based", "on", "the", "selected", "criteria", "." ]
train
https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/forms/forms.py#L331-L426
WhereSoftwareGoesToDie/pymarquise
marquise/marquise.py
Marquise.close
def close(self): """Close the Marquise context, ensuring data is flushed and spool files are closed. This should always be closed explicitly, as there's no guarantees that it will happen when the instance is deleted. """ if self.marquise_ctx is None: self.__d...
python
def close(self): """Close the Marquise context, ensuring data is flushed and spool files are closed. This should always be closed explicitly, as there's no guarantees that it will happen when the instance is deleted. """ if self.marquise_ctx is None: self.__d...
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "marquise_ctx", "is", "None", ":", "self", ".", "__debug", "(", "\"Marquise handle is already closed, will do nothing.\"", ")", "# Multiple close() calls are okay.", "return", "self", ".", "__debug", "(", "\"...
Close the Marquise context, ensuring data is flushed and spool files are closed. This should always be closed explicitly, as there's no guarantees that it will happen when the instance is deleted.
[ "Close", "the", "Marquise", "context", "ensuring", "data", "is", "flushed", "and", "spool", "files", "are", "closed", "." ]
train
https://github.com/WhereSoftwareGoesToDie/pymarquise/blob/67e52df70c50ed53ad315a64fea430a9567e2b1b/marquise/marquise.py#L64-L82
WhereSoftwareGoesToDie/pymarquise
marquise/marquise.py
Marquise.send_simple
def send_simple(self, address, timestamp, value): """Queue a simple datapoint (ie. a 64-bit word), return True/False for success. Arguments: address -- uint64_t representing a unique metric. timestamp -- uint64_t representing number of nanoseconds (10^-9) since epoch. value -- u...
python
def send_simple(self, address, timestamp, value): """Queue a simple datapoint (ie. a 64-bit word), return True/False for success. Arguments: address -- uint64_t representing a unique metric. timestamp -- uint64_t representing number of nanoseconds (10^-9) since epoch. value -- u...
[ "def", "send_simple", "(", "self", ",", "address", ",", "timestamp", ",", "value", ")", ":", "if", "self", ".", "marquise_ctx", "is", "None", ":", "raise", "ValueError", "(", "\"Attempted to write to a closed Marquise handle.\"", ")", "self", ".", "__debug", "("...
Queue a simple datapoint (ie. a 64-bit word), return True/False for success. Arguments: address -- uint64_t representing a unique metric. timestamp -- uint64_t representing number of nanoseconds (10^-9) since epoch. value -- uint64_t value being stored. There are no formal rest...
[ "Queue", "a", "simple", "datapoint", "(", "ie", ".", "a", "64", "-", "bit", "word", ")", "return", "True", "/", "False", "for", "success", "." ]
train
https://github.com/WhereSoftwareGoesToDie/pymarquise/blob/67e52df70c50ed53ad315a64fea430a9567e2b1b/marquise/marquise.py#L100-L140
WhereSoftwareGoesToDie/pymarquise
marquise/marquise.py
Marquise.send_extended
def send_extended(self, address, timestamp, value): """Queue an extended datapoint (ie. a string), return True/False for success. Arguments: address -- uint64_t representing a unique metric. timestamp -- uint64_t representing number of nanoseconds (10^-9) since epoch. value -- s...
python
def send_extended(self, address, timestamp, value): """Queue an extended datapoint (ie. a string), return True/False for success. Arguments: address -- uint64_t representing a unique metric. timestamp -- uint64_t representing number of nanoseconds (10^-9) since epoch. value -- s...
[ "def", "send_extended", "(", "self", ",", "address", ",", "timestamp", ",", "value", ")", ":", "if", "self", ".", "marquise_ctx", "is", "None", ":", "raise", "ValueError", "(", "\"Attempted to write to a closed Marquise handle.\"", ")", "self", ".", "__debug", "...
Queue an extended datapoint (ie. a string), return True/False for success. Arguments: address -- uint64_t representing a unique metric. timestamp -- uint64_t representing number of nanoseconds (10^-9) since epoch. value -- string value being stored.
[ "Queue", "an", "extended", "datapoint", "(", "ie", ".", "a", "string", ")", "return", "True", "/", "False", "for", "success", "." ]
train
https://github.com/WhereSoftwareGoesToDie/pymarquise/blob/67e52df70c50ed53ad315a64fea430a9567e2b1b/marquise/marquise.py#L143-L179
WhereSoftwareGoesToDie/pymarquise
marquise/marquise.py
Marquise.update_source
def update_source(self, address, metadata_dict): """Pack the `metadata_dict` for an `address` into a data structure and ship it to the spool file. Arguments: address -- the address for which this metadata_dict applies. metadata_dict -- a Python dict of arbitrary string key-value pairs. ...
python
def update_source(self, address, metadata_dict): """Pack the `metadata_dict` for an `address` into a data structure and ship it to the spool file. Arguments: address -- the address for which this metadata_dict applies. metadata_dict -- a Python dict of arbitrary string key-value pairs. ...
[ "def", "update_source", "(", "self", ",", "address", ",", "metadata_dict", ")", ":", "if", "self", ".", "marquise_ctx", "is", "None", ":", "raise", "ValueError", "(", "\"Attempted to write to a closed Marquise handle.\"", ")", "self", ".", "__debug", "(", "\"Suppl...
Pack the `metadata_dict` for an `address` into a data structure and ship it to the spool file. Arguments: address -- the address for which this metadata_dict applies. metadata_dict -- a Python dict of arbitrary string key-value pairs.
[ "Pack", "the", "metadata_dict", "for", "an", "address", "into", "a", "data", "structure", "and", "ship", "it", "to", "the", "spool", "file", "." ]
train
https://github.com/WhereSoftwareGoesToDie/pymarquise/blob/67e52df70c50ed53ad315a64fea430a9567e2b1b/marquise/marquise.py#L182-L237
edeposit/edeposit.amqp.storage
src/edeposit/amqp/storage/storage_handler.py
StorageHandler._zeo_key
def _zeo_key(self, key, new_type=OOBTree): """ Get key from the :attr:`zeo` database root. If the key doesn't exist, create it by calling `new_type` argument. Args: key (str): Key in the root dict. new_type (func/obj): Object/function returning the new instance. ...
python
def _zeo_key(self, key, new_type=OOBTree): """ Get key from the :attr:`zeo` database root. If the key doesn't exist, create it by calling `new_type` argument. Args: key (str): Key in the root dict. new_type (func/obj): Object/function returning the new instance. ...
[ "def", "_zeo_key", "(", "self", ",", "key", ",", "new_type", "=", "OOBTree", ")", ":", "zeo_key", "=", "self", ".", "zeo", ".", "get", "(", "key", ",", "None", ")", "if", "zeo_key", "is", "None", ":", "zeo_key", "=", "new_type", "(", ")", "self", ...
Get key from the :attr:`zeo` database root. If the key doesn't exist, create it by calling `new_type` argument. Args: key (str): Key in the root dict. new_type (func/obj): Object/function returning the new instance. Returns: obj: Stored object, or `new_type`...
[ "Get", "key", "from", "the", ":", "attr", ":", "zeo", "database", "root", ".", "If", "the", "key", "doesn", "t", "exist", "create", "it", "by", "calling", "new_type", "argument", "." ]
train
https://github.com/edeposit/edeposit.amqp.storage/blob/fb6bd326249847de04b17b64e856c878665cea92/src/edeposit/amqp/storage/storage_handler.py#L79-L97
edeposit/edeposit.amqp.storage
src/edeposit/amqp/storage/storage_handler.py
StorageHandler._get_db_fields
def _get_db_fields(self, obj): """ Return list of database dictionaries, which are used as indexes for each attributes. Args: cached (bool, default True): Use cached connection to database. Returns: list: List of OOBTree's for each item in :attr:`.COMMON...
python
def _get_db_fields(self, obj): """ Return list of database dictionaries, which are used as indexes for each attributes. Args: cached (bool, default True): Use cached connection to database. Returns: list: List of OOBTree's for each item in :attr:`.COMMON...
[ "def", "_get_db_fields", "(", "self", ",", "obj", ")", ":", "for", "field", "in", "obj", ".", "indexes", ":", "yield", "field", ",", "self", ".", "_zeo_key", "(", "field", ")" ]
Return list of database dictionaries, which are used as indexes for each attributes. Args: cached (bool, default True): Use cached connection to database. Returns: list: List of OOBTree's for each item in :attr:`.COMMON_FIELDS`.
[ "Return", "list", "of", "database", "dictionaries", "which", "are", "used", "as", "indexes", "for", "each", "attributes", "." ]
train
https://github.com/edeposit/edeposit.amqp.storage/blob/fb6bd326249847de04b17b64e856c878665cea92/src/edeposit/amqp/storage/storage_handler.py#L99-L111
edeposit/edeposit.amqp.storage
src/edeposit/amqp/storage/storage_handler.py
StorageHandler._check_obj_properties
def _check_obj_properties(self, pub, name="pub"): """ Make sure, that `pub` has the right interface. Args: pub (obj): Instance which will be checked. name (str): Name of the instance. Used in exception. Default `pub`. Raises: InvalidType: When the `p...
python
def _check_obj_properties(self, pub, name="pub"): """ Make sure, that `pub` has the right interface. Args: pub (obj): Instance which will be checked. name (str): Name of the instance. Used in exception. Default `pub`. Raises: InvalidType: When the `p...
[ "def", "_check_obj_properties", "(", "self", ",", "pub", ",", "name", "=", "\"pub\"", ")", ":", "if", "not", "hasattr", "(", "pub", ",", "\"indexes\"", ")", ":", "raise", "InvalidType", "(", "\"`%s` doesn't have .indexes property!\"", "%", "name", ")", "if", ...
Make sure, that `pub` has the right interface. Args: pub (obj): Instance which will be checked. name (str): Name of the instance. Used in exception. Default `pub`. Raises: InvalidType: When the `pub` is not instance of `obj_type`.
[ "Make", "sure", "that", "pub", "has", "the", "right", "interface", "." ]
train
https://github.com/edeposit/edeposit.amqp.storage/blob/fb6bd326249847de04b17b64e856c878665cea92/src/edeposit/amqp/storage/storage_handler.py#L113-L136
edeposit/edeposit.amqp.storage
src/edeposit/amqp/storage/storage_handler.py
StorageHandler._put_into_indexes
def _put_into_indexes(self, obj): """ Put publication into all indexes. Attr: obj (obj): Indexable object. Raises: UnindexableObject: When there is no index (property) which can be used to index `obj` in database. """ no_of_used_i...
python
def _put_into_indexes(self, obj): """ Put publication into all indexes. Attr: obj (obj): Indexable object. Raises: UnindexableObject: When there is no index (property) which can be used to index `obj` in database. """ no_of_used_i...
[ "def", "_put_into_indexes", "(", "self", ",", "obj", ")", ":", "no_of_used_indexes", "=", "0", "for", "field_name", ",", "db_index", "in", "list", "(", "self", ".", "_get_db_fields", "(", "obj", ")", ")", ":", "attr_value", "=", "getattr", "(", "obj", ",...
Put publication into all indexes. Attr: obj (obj): Indexable object. Raises: UnindexableObject: When there is no index (property) which can be used to index `obj` in database.
[ "Put", "publication", "into", "all", "indexes", "." ]
train
https://github.com/edeposit/edeposit.amqp.storage/blob/fb6bd326249847de04b17b64e856c878665cea92/src/edeposit/amqp/storage/storage_handler.py#L138-L169
edeposit/edeposit.amqp.storage
src/edeposit/amqp/storage/storage_handler.py
StorageHandler.store_object
def store_object(self, obj): """ Save `obj` into database and into proper indexes. Attr: obj (obj): Indexable object. Raises: InvalidType: When the `obj` doesn't have right properties. Unindexableobjlication: When there is no indexes defined. ...
python
def store_object(self, obj): """ Save `obj` into database and into proper indexes. Attr: obj (obj): Indexable object. Raises: InvalidType: When the `obj` doesn't have right properties. Unindexableobjlication: When there is no indexes defined. ...
[ "def", "store_object", "(", "self", ",", "obj", ")", ":", "self", ".", "_check_obj_properties", "(", "obj", ")", "with", "transaction", ".", "manager", ":", "self", ".", "_put_into_indexes", "(", "obj", ")" ]
Save `obj` into database and into proper indexes. Attr: obj (obj): Indexable object. Raises: InvalidType: When the `obj` doesn't have right properties. Unindexableobjlication: When there is no indexes defined.
[ "Save", "obj", "into", "database", "and", "into", "proper", "indexes", "." ]
train
https://github.com/edeposit/edeposit.amqp.storage/blob/fb6bd326249847de04b17b64e856c878665cea92/src/edeposit/amqp/storage/storage_handler.py#L171-L185
edeposit/edeposit.amqp.storage
src/edeposit/amqp/storage/storage_handler.py
StorageHandler._get_subset_matches
def _get_subset_matches(self, query): """ Yield publications, at indexes defined by `query` property values. Args: query (obj): Object implementing proper interface. Yields: list: List of matching publications. """ for field_name, db_index in sel...
python
def _get_subset_matches(self, query): """ Yield publications, at indexes defined by `query` property values. Args: query (obj): Object implementing proper interface. Yields: list: List of matching publications. """ for field_name, db_index in sel...
[ "def", "_get_subset_matches", "(", "self", ",", "query", ")", ":", "for", "field_name", ",", "db_index", "in", "self", ".", "_get_db_fields", "(", "query", ")", ":", "attr", "=", "getattr", "(", "query", ",", "field_name", ")", "if", "attr", "is", "None"...
Yield publications, at indexes defined by `query` property values. Args: query (obj): Object implementing proper interface. Yields: list: List of matching publications.
[ "Yield", "publications", "at", "indexes", "defined", "by", "query", "property", "values", "." ]
train
https://github.com/edeposit/edeposit.amqp.storage/blob/fb6bd326249847de04b17b64e856c878665cea92/src/edeposit/amqp/storage/storage_handler.py#L187-L206
edeposit/edeposit.amqp.storage
src/edeposit/amqp/storage/storage_handler.py
StorageHandler.search_objects
def search_objects(self, query): """ Return list of objects which match all properties that are set (``not None``) using AND operator to all of them. Example: result = storage_handler.search_objects( DBPublication(isbn="azgabash") ) Args:...
python
def search_objects(self, query): """ Return list of objects which match all properties that are set (``not None``) using AND operator to all of them. Example: result = storage_handler.search_objects( DBPublication(isbn="azgabash") ) Args:...
[ "def", "search_objects", "(", "self", ",", "query", ")", ":", "self", ".", "_check_obj_properties", "(", "query", ",", "\"query\"", ")", "# AND operator between results", "final_result", "=", "None", "for", "result", "in", "self", ".", "_get_subset_matches", "(", ...
Return list of objects which match all properties that are set (``not None``) using AND operator to all of them. Example: result = storage_handler.search_objects( DBPublication(isbn="azgabash") ) Args: query (obj): Object implementing proper ...
[ "Return", "list", "of", "objects", "which", "match", "all", "properties", "that", "are", "set", "(", "not", "None", ")", "using", "AND", "operator", "to", "all", "of", "them", "." ]
train
https://github.com/edeposit/edeposit.amqp.storage/blob/fb6bd326249847de04b17b64e856c878665cea92/src/edeposit/amqp/storage/storage_handler.py#L208-L244
pjanis/funtool
funtool/group_measure.py
_wrap_measure
def _wrap_measure(individual_group_measure_process, group_measure, loaded_processes): """ Creates a function on a state_collection, which creates analysis_collections for each group in the collection. """ def wrapped_measure(state_collection,overriding_parameters=None,loggers=None): if loggers ...
python
def _wrap_measure(individual_group_measure_process, group_measure, loaded_processes): """ Creates a function on a state_collection, which creates analysis_collections for each group in the collection. """ def wrapped_measure(state_collection,overriding_parameters=None,loggers=None): if loggers ...
[ "def", "_wrap_measure", "(", "individual_group_measure_process", ",", "group_measure", ",", "loaded_processes", ")", ":", "def", "wrapped_measure", "(", "state_collection", ",", "overriding_parameters", "=", "None", ",", "loggers", "=", "None", ")", ":", "if", "logg...
Creates a function on a state_collection, which creates analysis_collections for each group in the collection.
[ "Creates", "a", "function", "on", "a", "state_collection", "which", "creates", "analysis_collections", "for", "each", "group", "in", "the", "collection", "." ]
train
https://github.com/pjanis/funtool/blob/231851238f0a62bc3682d8fa937db9053378c53d/funtool/group_measure.py#L38-L57
etcher-be/elib_config
elib_config/_value/_config_value_integer.py
ConfigValueInteger.set_limits
def set_limits(self, min_=None, max_=None): """ Sets limits for this config value If the resulting integer is outside those limits, an exception will be raised :param min_: minima :param max_: maxima """ self._min, self._max = min_, max_
python
def set_limits(self, min_=None, max_=None): """ Sets limits for this config value If the resulting integer is outside those limits, an exception will be raised :param min_: minima :param max_: maxima """ self._min, self._max = min_, max_
[ "def", "set_limits", "(", "self", ",", "min_", "=", "None", ",", "max_", "=", "None", ")", ":", "self", ".", "_min", ",", "self", ".", "_max", "=", "min_", ",", "max_" ]
Sets limits for this config value If the resulting integer is outside those limits, an exception will be raised :param min_: minima :param max_: maxima
[ "Sets", "limits", "for", "this", "config", "value" ]
train
https://github.com/etcher-be/elib_config/blob/5d8c839e84d70126620ab0186dc1f717e5868bd0/elib_config/_value/_config_value_integer.py#L46-L55
unixorn/haze
haze/ec2.py
getAWSAccountID
def getAWSAccountID(): ''' Print an instance's AWS account number or 0 when not in EC2 ''' link = "http://169.254.169.254/latest/dynamic/instance-identity/document" try: conn = urllib2.urlopen(url=link, timeout=5) except urllib2.URLError: return '0' jsonData = json.loads(conn.read()) return json...
python
def getAWSAccountID(): ''' Print an instance's AWS account number or 0 when not in EC2 ''' link = "http://169.254.169.254/latest/dynamic/instance-identity/document" try: conn = urllib2.urlopen(url=link, timeout=5) except urllib2.URLError: return '0' jsonData = json.loads(conn.read()) return json...
[ "def", "getAWSAccountID", "(", ")", ":", "link", "=", "\"http://169.254.169.254/latest/dynamic/instance-identity/document\"", "try", ":", "conn", "=", "urllib2", ".", "urlopen", "(", "url", "=", "link", ",", "timeout", "=", "5", ")", "except", "urllib2", ".", "U...
Print an instance's AWS account number or 0 when not in EC2
[ "Print", "an", "instance", "s", "AWS", "account", "number", "or", "0", "when", "not", "in", "EC2" ]
train
https://github.com/unixorn/haze/blob/77692b18e6574ac356e3e16659b96505c733afff/haze/ec2.py#L26-L36
unixorn/haze
haze/ec2.py
readInstanceTag
def readInstanceTag(instanceID, tagName="Name", connection=None): """ Load a tag from EC2 :param str instanceID: Instance ID to read the tag on :param str tagName: Name of tag to load :param connection: optional boto connection to use :returns: the tag's value :rtype: str """ assert isinstance(insta...
python
def readInstanceTag(instanceID, tagName="Name", connection=None): """ Load a tag from EC2 :param str instanceID: Instance ID to read the tag on :param str tagName: Name of tag to load :param connection: optional boto connection to use :returns: the tag's value :rtype: str """ assert isinstance(insta...
[ "def", "readInstanceTag", "(", "instanceID", ",", "tagName", "=", "\"Name\"", ",", "connection", "=", "None", ")", ":", "assert", "isinstance", "(", "instanceID", ",", "basestring", ")", ",", "(", "\"instanceID must be a string but is %r\"", "%", "instanceID", ")"...
Load a tag from EC2 :param str instanceID: Instance ID to read the tag on :param str tagName: Name of tag to load :param connection: optional boto connection to use :returns: the tag's value :rtype: str
[ "Load", "a", "tag", "from", "EC2" ]
train
https://github.com/unixorn/haze/blob/77692b18e6574ac356e3e16659b96505c733afff/haze/ec2.py#L105-L130
unixorn/haze
haze/ec2.py
readMyEC2Tag
def readMyEC2Tag(tagName, connection=None): """ Load an EC2 tag for the running instance & print it. :param str tagName: Name of the tag to read :param connection: Optional boto connection """ assert isinstance(tagName, basestring), ("tagName must be a string but is %r" % tagName) # Load metadata. if ==...
python
def readMyEC2Tag(tagName, connection=None): """ Load an EC2 tag for the running instance & print it. :param str tagName: Name of the tag to read :param connection: Optional boto connection """ assert isinstance(tagName, basestring), ("tagName must be a string but is %r" % tagName) # Load metadata. if ==...
[ "def", "readMyEC2Tag", "(", "tagName", ",", "connection", "=", "None", ")", ":", "assert", "isinstance", "(", "tagName", ",", "basestring", ")", ",", "(", "\"tagName must be a string but is %r\"", "%", "tagName", ")", "# Load metadata. if == {} we are on localhost", "...
Load an EC2 tag for the running instance & print it. :param str tagName: Name of the tag to read :param connection: Optional boto connection
[ "Load", "an", "EC2", "tag", "for", "the", "running", "instance", "&", "print", "it", "." ]
train
https://github.com/unixorn/haze/blob/77692b18e6574ac356e3e16659b96505c733afff/haze/ec2.py#L133-L151
vuolter/autoupgrade
autoupgrade/utils.py
normalize_version
def normalize_version(version): """ Helper function to normalize version. Returns a comparable object. Args: version (str) version, e.g. "0.1.0" """ rv = [] for x in version.split("."): try: rv.append(int(x)) except ValueError: for y in re.spli...
python
def normalize_version(version): """ Helper function to normalize version. Returns a comparable object. Args: version (str) version, e.g. "0.1.0" """ rv = [] for x in version.split("."): try: rv.append(int(x)) except ValueError: for y in re.spli...
[ "def", "normalize_version", "(", "version", ")", ":", "rv", "=", "[", "]", "for", "x", "in", "version", ".", "split", "(", "\".\"", ")", ":", "try", ":", "rv", ".", "append", "(", "int", "(", "x", ")", ")", "except", "ValueError", ":", "for", "y"...
Helper function to normalize version. Returns a comparable object. Args: version (str) version, e.g. "0.1.0"
[ "Helper", "function", "to", "normalize", "version", ".", "Returns", "a", "comparable", "object", ".", "Args", ":", "version", "(", "str", ")", "version", "e", ".", "g", ".", "0", ".", "1", ".", "0" ]
train
https://github.com/vuolter/autoupgrade/blob/e34aca9eacd6a6f5c7a7634a67c2ee911d48ac68/autoupgrade/utils.py#L6-L25
vuolter/autoupgrade
autoupgrade/utils.py
ver_to_tuple
def ver_to_tuple(value): """ Convert version like string to a tuple of integers. """ return tuple(int(_f) for _f in re.split(r'\D+', value) if _f)
python
def ver_to_tuple(value): """ Convert version like string to a tuple of integers. """ return tuple(int(_f) for _f in re.split(r'\D+', value) if _f)
[ "def", "ver_to_tuple", "(", "value", ")", ":", "return", "tuple", "(", "int", "(", "_f", ")", "for", "_f", "in", "re", ".", "split", "(", "r'\\D+'", ",", "value", ")", "if", "_f", ")" ]
Convert version like string to a tuple of integers.
[ "Convert", "version", "like", "string", "to", "a", "tuple", "of", "integers", "." ]
train
https://github.com/vuolter/autoupgrade/blob/e34aca9eacd6a6f5c7a7634a67c2ee911d48ac68/autoupgrade/utils.py#L28-L32
rinocloud/rinocloud-python
rinocloud/object.py
Object.increment_name
def increment_name(self, name, i): """ takes something like test.txt and returns test1.txt """ if i == 0: return name if '.' in name: split = name.split('.') split[-2] = split[-2] + str(i) return '.'....
python
def increment_name(self, name, i): """ takes something like test.txt and returns test1.txt """ if i == 0: return name if '.' in name: split = name.split('.') split[-2] = split[-2] + str(i) return '.'....
[ "def", "increment_name", "(", "self", ",", "name", ",", "i", ")", ":", "if", "i", "==", "0", ":", "return", "name", "if", "'.'", "in", "name", ":", "split", "=", "name", ".", "split", "(", "'.'", ")", "split", "[", "-", "2", "]", "=", "split", ...
takes something like test.txt and returns test1.txt
[ "takes", "something", "like", "test", ".", "txt", "and", "returns", "test1", ".", "txt" ]
train
https://github.com/rinocloud/rinocloud-python/blob/7c4bf994a518f961cffedb7260fc1e4fa1838b38/rinocloud/object.py#L71-L85
rinocloud/rinocloud-python
rinocloud/object.py
Object.set_name
def set_name(self, name, overwrite=False, increment=True): """ Sets the name of the file to be saved. @params name - the name to the file increment - whether or not to increment the filename if there is an existing file ie test.txt => test1.txt overwrite - wh...
python
def set_name(self, name, overwrite=False, increment=True): """ Sets the name of the file to be saved. @params name - the name to the file increment - whether or not to increment the filename if there is an existing file ie test.txt => test1.txt overwrite - wh...
[ "def", "set_name", "(", "self", ",", "name", ",", "overwrite", "=", "False", ",", "increment", "=", "True", ")", ":", "# check if the file exists", "exists", "=", "os", ".", "path", ".", "exists", "(", "os", ".", "path", ".", "join", "(", "self", ".", ...
Sets the name of the file to be saved. @params name - the name to the file increment - whether or not to increment the filename if there is an existing file ie test.txt => test1.txt overwrite - whether or not to overwrite existing local file, renders increment redundant
[ "Sets", "the", "name", "of", "the", "file", "to", "be", "saved", "." ]
train
https://github.com/rinocloud/rinocloud-python/blob/7c4bf994a518f961cffedb7260fc1e4fa1838b38/rinocloud/object.py#L87-L119
rinocloud/rinocloud-python
rinocloud/object.py
Object.save_local_metadata
def save_local_metadata(self): """ save all the exposed variables to a json file """ # save to the set local path and add .json with open(self.filepath + '.json', 'w+') as outfile: json.dump(self._prep_metadata(), outfile, indent=4)
python
def save_local_metadata(self): """ save all the exposed variables to a json file """ # save to the set local path and add .json with open(self.filepath + '.json', 'w+') as outfile: json.dump(self._prep_metadata(), outfile, indent=4)
[ "def", "save_local_metadata", "(", "self", ")", ":", "# save to the set local path and add .json", "with", "open", "(", "self", ".", "filepath", "+", "'.json'", ",", "'w+'", ")", "as", "outfile", ":", "json", ".", "dump", "(", "self", ".", "_prep_metadata", "(...
save all the exposed variables to a json file
[ "save", "all", "the", "exposed", "variables", "to", "a", "json", "file" ]
train
https://github.com/rinocloud/rinocloud-python/blob/7c4bf994a518f961cffedb7260fc1e4fa1838b38/rinocloud/object.py#L155-L161
rinocloud/rinocloud-python
rinocloud/object.py
Object.calculate_etag
def calculate_etag(self, expected=None): """ calculates a multipart upload etag in the same way as amazon s3 args: source_path -- The file to calculate the etage for chunk_size -- The chunk size to calculate for. expected -- optional If pas...
python
def calculate_etag(self, expected=None): """ calculates a multipart upload etag in the same way as amazon s3 args: source_path -- The file to calculate the etage for chunk_size -- The chunk size to calculate for. expected -- optional If pas...
[ "def", "calculate_etag", "(", "self", ",", "expected", "=", "None", ")", ":", "md5s", "=", "[", "]", "with", "open", "(", "self", ".", "filepath", ",", "'rb'", ")", "as", "fp", ":", "while", "True", ":", "data", "=", "fp", ".", "read", "(", "CHUN...
calculates a multipart upload etag in the same way as amazon s3 args: source_path -- The file to calculate the etage for chunk_size -- The chunk size to calculate for. expected -- optional If passed a string, the string will be compared to the ...
[ "calculates", "a", "multipart", "upload", "etag", "in", "the", "same", "way", "as", "amazon", "s3", "args", ":", "source_path", "--", "The", "file", "to", "calculate", "the", "etage", "for", "chunk_size", "--", "The", "chunk", "size", "to", "calculate", "f...
train
https://github.com/rinocloud/rinocloud-python/blob/7c4bf994a518f961cffedb7260fc1e4fa1838b38/rinocloud/object.py#L171-L195
tomi77/python-gddkia-impediments-on-roads
impediments/utils.py
get_impediments
def get_impediments(): """ :raise urllib2.URLError | urllib.error.URLError: When :return: """ file = urlopen(XML_URL) doc = dom.parse(file) xml = doc.documentElement nodes = xml.getElementsByTagName('utr') impediments = [extract(node) for node in nodes] return impediments
python
def get_impediments(): """ :raise urllib2.URLError | urllib.error.URLError: When :return: """ file = urlopen(XML_URL) doc = dom.parse(file) xml = doc.documentElement nodes = xml.getElementsByTagName('utr') impediments = [extract(node) for node in nodes] return impediments
[ "def", "get_impediments", "(", ")", ":", "file", "=", "urlopen", "(", "XML_URL", ")", "doc", "=", "dom", ".", "parse", "(", "file", ")", "xml", "=", "doc", ".", "documentElement", "nodes", "=", "xml", ".", "getElementsByTagName", "(", "'utr'", ")", "im...
:raise urllib2.URLError | urllib.error.URLError: When :return:
[ ":", "raise", "urllib2", ".", "URLError", "|", "urllib", ".", "error", ".", "URLError", ":", "When", ":", "return", ":" ]
train
https://github.com/tomi77/python-gddkia-impediments-on-roads/blob/9614da6807f71fee8551f1f7d2ca97fa59d8b8ef/impediments/utils.py#L64-L77