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
yougov/solr-doc-manager
mongo_connector/doc_managers/solr_doc_manager.py
DocManager._build_fields
def _build_fields(self): """ Builds a list of valid fields """ declared_fields = self.solr._send_request('get', ADMIN_URL) result = decoder.decode(declared_fields) self.field_list = self._parse_fields(result, 'fields') # Build regular expressions to match dynamic fields....
python
def _build_fields(self): """ Builds a list of valid fields """ declared_fields = self.solr._send_request('get', ADMIN_URL) result = decoder.decode(declared_fields) self.field_list = self._parse_fields(result, 'fields') # Build regular expressions to match dynamic fields....
[ "def", "_build_fields", "(", "self", ")", ":", "declared_fields", "=", "self", ".", "solr", ".", "_send_request", "(", "'get'", ",", "ADMIN_URL", ")", "result", "=", "decoder", ".", "decode", "(", "declared_fields", ")", "self", ".", "field_list", "=", "se...
Builds a list of valid fields
[ "Builds", "a", "list", "of", "valid", "fields" ]
train
https://github.com/yougov/solr-doc-manager/blob/1978bf6f3387b1afd6dd6b41a1bbaea9932d60fd/mongo_connector/doc_managers/solr_doc_manager.py#L93-L110
yougov/solr-doc-manager
mongo_connector/doc_managers/solr_doc_manager.py
DocManager._clean_doc
def _clean_doc(self, doc, namespace, timestamp): """Reformats the given document before insertion into Solr. This method reformats the document in the following ways: - removes extraneous fields that aren't defined in schema.xml - unwinds arrays in order to find and later flatten su...
python
def _clean_doc(self, doc, namespace, timestamp): """Reformats the given document before insertion into Solr. This method reformats the document in the following ways: - removes extraneous fields that aren't defined in schema.xml - unwinds arrays in order to find and later flatten su...
[ "def", "_clean_doc", "(", "self", ",", "doc", ",", "namespace", ",", "timestamp", ")", ":", "# Translate the _id field to whatever unique key we're using.", "# _id may not exist in the doc, if we retrieved it from Solr", "# as part of update.", "if", "'_id'", "in", "doc", ":", ...
Reformats the given document before insertion into Solr. This method reformats the document in the following ways: - removes extraneous fields that aren't defined in schema.xml - unwinds arrays in order to find and later flatten sub-documents - flattens the document so that there ...
[ "Reformats", "the", "given", "document", "before", "insertion", "into", "Solr", "." ]
train
https://github.com/yougov/solr-doc-manager/blob/1978bf6f3387b1afd6dd6b41a1bbaea9932d60fd/mongo_connector/doc_managers/solr_doc_manager.py#L112-L165
yougov/solr-doc-manager
mongo_connector/doc_managers/solr_doc_manager.py
DocManager.apply_update
def apply_update(self, doc, update_spec): """Override DocManagerBase.apply_update to have flat documents.""" # Replace a whole document if not '$set' in update_spec and not '$unset' in update_spec: # update_spec contains the new document. # Update the key in Solr based on...
python
def apply_update(self, doc, update_spec): """Override DocManagerBase.apply_update to have flat documents.""" # Replace a whole document if not '$set' in update_spec and not '$unset' in update_spec: # update_spec contains the new document. # Update the key in Solr based on...
[ "def", "apply_update", "(", "self", ",", "doc", ",", "update_spec", ")", ":", "# Replace a whole document", "if", "not", "'$set'", "in", "update_spec", "and", "not", "'$unset'", "in", "update_spec", ":", "# update_spec contains the new document.", "# Update the key in S...
Override DocManagerBase.apply_update to have flat documents.
[ "Override", "DocManagerBase", ".", "apply_update", "to", "have", "flat", "documents", "." ]
train
https://github.com/yougov/solr-doc-manager/blob/1978bf6f3387b1afd6dd6b41a1bbaea9932d60fd/mongo_connector/doc_managers/solr_doc_manager.py#L195-L226
yougov/solr-doc-manager
mongo_connector/doc_managers/solr_doc_manager.py
DocManager.update
def update(self, document_id, update_spec, namespace, timestamp): """Apply updates given in update_spec to the document whose id matches that of doc. """ # Commit outstanding changes so that the document to be updated is the # same version to which the changes apply. sel...
python
def update(self, document_id, update_spec, namespace, timestamp): """Apply updates given in update_spec to the document whose id matches that of doc. """ # Commit outstanding changes so that the document to be updated is the # same version to which the changes apply. sel...
[ "def", "update", "(", "self", ",", "document_id", ",", "update_spec", ",", "namespace", ",", "timestamp", ")", ":", "# Commit outstanding changes so that the document to be updated is the", "# same version to which the changes apply.", "self", ".", "commit", "(", ")", "# Ne...
Apply updates given in update_spec to the document whose id matches that of doc.
[ "Apply", "updates", "given", "in", "update_spec", "to", "the", "document", "whose", "id", "matches", "that", "of", "doc", "." ]
train
https://github.com/yougov/solr-doc-manager/blob/1978bf6f3387b1afd6dd6b41a1bbaea9932d60fd/mongo_connector/doc_managers/solr_doc_manager.py#L229-L258
yougov/solr-doc-manager
mongo_connector/doc_managers/solr_doc_manager.py
DocManager.upsert
def upsert(self, doc, namespace, timestamp): """Update or insert a document into Solr This method should call whatever add/insert/update method exists for the backend engine and add the document in there. The input will always be one mongo document, represented as a Python dictionary. ...
python
def upsert(self, doc, namespace, timestamp): """Update or insert a document into Solr This method should call whatever add/insert/update method exists for the backend engine and add the document in there. The input will always be one mongo document, represented as a Python dictionary. ...
[ "def", "upsert", "(", "self", ",", "doc", ",", "namespace", ",", "timestamp", ")", ":", "if", "self", ".", "auto_commit_interval", "is", "not", "None", ":", "self", ".", "solr", ".", "add", "(", "[", "self", ".", "_clean_doc", "(", "doc", ",", "names...
Update or insert a document into Solr This method should call whatever add/insert/update method exists for the backend engine and add the document in there. The input will always be one mongo document, represented as a Python dictionary.
[ "Update", "or", "insert", "a", "document", "into", "Solr" ]
train
https://github.com/yougov/solr-doc-manager/blob/1978bf6f3387b1afd6dd6b41a1bbaea9932d60fd/mongo_connector/doc_managers/solr_doc_manager.py#L261-L274
yougov/solr-doc-manager
mongo_connector/doc_managers/solr_doc_manager.py
DocManager.bulk_upsert
def bulk_upsert(self, docs, namespace, timestamp): """Update or insert multiple documents into Solr docs may be any iterable """ if self.auto_commit_interval is not None: add_kwargs = { "commit": (self.auto_commit_interval == 0), "commitWithin...
python
def bulk_upsert(self, docs, namespace, timestamp): """Update or insert multiple documents into Solr docs may be any iterable """ if self.auto_commit_interval is not None: add_kwargs = { "commit": (self.auto_commit_interval == 0), "commitWithin...
[ "def", "bulk_upsert", "(", "self", ",", "docs", ",", "namespace", ",", "timestamp", ")", ":", "if", "self", ".", "auto_commit_interval", "is", "not", "None", ":", "add_kwargs", "=", "{", "\"commit\"", ":", "(", "self", ".", "auto_commit_interval", "==", "0...
Update or insert multiple documents into Solr docs may be any iterable
[ "Update", "or", "insert", "multiple", "documents", "into", "Solr" ]
train
https://github.com/yougov/solr-doc-manager/blob/1978bf6f3387b1afd6dd6b41a1bbaea9932d60fd/mongo_connector/doc_managers/solr_doc_manager.py#L277-L298
yougov/solr-doc-manager
mongo_connector/doc_managers/solr_doc_manager.py
DocManager.remove
def remove(self, document_id, namespace, timestamp): """Removes documents from Solr The input is a python dictionary that represents a mongo document. """ self.solr.delete(id=u(document_id), commit=(self.auto_commit_interval == 0))
python
def remove(self, document_id, namespace, timestamp): """Removes documents from Solr The input is a python dictionary that represents a mongo document. """ self.solr.delete(id=u(document_id), commit=(self.auto_commit_interval == 0))
[ "def", "remove", "(", "self", ",", "document_id", ",", "namespace", ",", "timestamp", ")", ":", "self", ".", "solr", ".", "delete", "(", "id", "=", "u", "(", "document_id", ")", ",", "commit", "=", "(", "self", ".", "auto_commit_interval", "==", "0", ...
Removes documents from Solr The input is a python dictionary that represents a mongo document.
[ "Removes", "documents", "from", "Solr" ]
train
https://github.com/yougov/solr-doc-manager/blob/1978bf6f3387b1afd6dd6b41a1bbaea9932d60fd/mongo_connector/doc_managers/solr_doc_manager.py#L320-L326
yougov/solr-doc-manager
mongo_connector/doc_managers/solr_doc_manager.py
DocManager._stream_search
def _stream_search(self, query): """Helper method for iterating over Solr search results.""" for doc in self.solr.search(query, rows=100000000): if self.unique_key != "_id": doc["_id"] = doc.pop(self.unique_key) yield doc
python
def _stream_search(self, query): """Helper method for iterating over Solr search results.""" for doc in self.solr.search(query, rows=100000000): if self.unique_key != "_id": doc["_id"] = doc.pop(self.unique_key) yield doc
[ "def", "_stream_search", "(", "self", ",", "query", ")", ":", "for", "doc", "in", "self", ".", "solr", ".", "search", "(", "query", ",", "rows", "=", "100000000", ")", ":", "if", "self", ".", "unique_key", "!=", "\"_id\"", ":", "doc", "[", "\"_id\"",...
Helper method for iterating over Solr search results.
[ "Helper", "method", "for", "iterating", "over", "Solr", "search", "results", "." ]
train
https://github.com/yougov/solr-doc-manager/blob/1978bf6f3387b1afd6dd6b41a1bbaea9932d60fd/mongo_connector/doc_managers/solr_doc_manager.py#L329-L334
yougov/solr-doc-manager
mongo_connector/doc_managers/solr_doc_manager.py
DocManager.search
def search(self, start_ts, end_ts): """Called to query Solr for documents in a time range.""" query = '_ts: [%s TO %s]' % (start_ts, end_ts) return self._stream_search(query)
python
def search(self, start_ts, end_ts): """Called to query Solr for documents in a time range.""" query = '_ts: [%s TO %s]' % (start_ts, end_ts) return self._stream_search(query)
[ "def", "search", "(", "self", ",", "start_ts", ",", "end_ts", ")", ":", "query", "=", "'_ts: [%s TO %s]'", "%", "(", "start_ts", ",", "end_ts", ")", "return", "self", ".", "_stream_search", "(", "query", ")" ]
Called to query Solr for documents in a time range.
[ "Called", "to", "query", "Solr", "for", "documents", "in", "a", "time", "range", "." ]
train
https://github.com/yougov/solr-doc-manager/blob/1978bf6f3387b1afd6dd6b41a1bbaea9932d60fd/mongo_connector/doc_managers/solr_doc_manager.py#L337-L340
yougov/solr-doc-manager
mongo_connector/doc_managers/solr_doc_manager.py
DocManager.get_last_doc
def get_last_doc(self): """Returns the last document stored in the Solr engine. """ #search everything, sort by descending timestamp, return 1 row try: result = self.solr.search('*:*', sort='_ts desc', rows=1) except ValueError: return None for r ...
python
def get_last_doc(self): """Returns the last document stored in the Solr engine. """ #search everything, sort by descending timestamp, return 1 row try: result = self.solr.search('*:*', sort='_ts desc', rows=1) except ValueError: return None for r ...
[ "def", "get_last_doc", "(", "self", ")", ":", "#search everything, sort by descending timestamp, return 1 row", "try", ":", "result", "=", "self", ".", "solr", ".", "search", "(", "'*:*'", ",", "sort", "=", "'_ts desc'", ",", "rows", "=", "1", ")", "except", "...
Returns the last document stored in the Solr engine.
[ "Returns", "the", "last", "document", "stored", "in", "the", "Solr", "engine", "." ]
train
https://github.com/yougov/solr-doc-manager/blob/1978bf6f3387b1afd6dd6b41a1bbaea9932d60fd/mongo_connector/doc_managers/solr_doc_manager.py#L348-L359
ricmoo/pyscrypt
pyscrypt/hash.py
pbkdf2_single
def pbkdf2_single(password, salt, key_length, prf): '''Returns the result of the Password-Based Key Derivation Function 2 with a single iteration (i.e. count = 1). prf - a psuedorandom function See http://en.wikipedia.org/wiki/PBKDF2 ''' block_number = 0 result = b'' # The i...
python
def pbkdf2_single(password, salt, key_length, prf): '''Returns the result of the Password-Based Key Derivation Function 2 with a single iteration (i.e. count = 1). prf - a psuedorandom function See http://en.wikipedia.org/wiki/PBKDF2 ''' block_number = 0 result = b'' # The i...
[ "def", "pbkdf2_single", "(", "password", ",", "salt", ",", "key_length", ",", "prf", ")", ":", "block_number", "=", "0", "result", "=", "b''", "# The iterations", "while", "len", "(", "result", ")", "<", "key_length", ":", "block_number", "+=", "1", "resul...
Returns the result of the Password-Based Key Derivation Function 2 with a single iteration (i.e. count = 1). prf - a psuedorandom function See http://en.wikipedia.org/wiki/PBKDF2
[ "Returns", "the", "result", "of", "the", "Password", "-", "Based", "Key", "Derivation", "Function", "2", "with", "a", "single", "iteration", "(", "i", ".", "e", ".", "count", "=", "1", ")", "." ]
train
https://github.com/ricmoo/pyscrypt/blob/131ca39acee4963afd704b4c4631497e4fe34c97/pyscrypt/hash.py#L56-L73
ricmoo/pyscrypt
pyscrypt/hash.py
salsa20_8
def salsa20_8(B): '''Salsa 20/8 stream cypher; Used by BlockMix. See http://en.wikipedia.org/wiki/Salsa20''' # Create a working copy x = B[:] # Expanded form of this code. The expansion is significantly faster but # this is much easier to understand # ROUNDS = ( # (4, 0, 12, 7), (8, ...
python
def salsa20_8(B): '''Salsa 20/8 stream cypher; Used by BlockMix. See http://en.wikipedia.org/wiki/Salsa20''' # Create a working copy x = B[:] # Expanded form of this code. The expansion is significantly faster but # this is much easier to understand # ROUNDS = ( # (4, 0, 12, 7), (8, ...
[ "def", "salsa20_8", "(", "B", ")", ":", "# Create a working copy", "x", "=", "B", "[", ":", "]", "# Expanded form of this code. The expansion is significantly faster but", "# this is much easier to understand", "# ROUNDS = (", "# (4, 0, 12, 7), (8, 4, 0, 9), (12, 8, 4, 13), ...
Salsa 20/8 stream cypher; Used by BlockMix. See http://en.wikipedia.org/wiki/Salsa20
[ "Salsa", "20", "/", "8", "stream", "cypher", ";", "Used", "by", "BlockMix", ".", "See", "http", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", "/", "Salsa20" ]
train
https://github.com/ricmoo/pyscrypt/blob/131ca39acee4963afd704b4c4631497e4fe34c97/pyscrypt/hash.py#L76-L167
ricmoo/pyscrypt
pyscrypt/hash.py
blockmix_salsa8
def blockmix_salsa8(BY, Yi, r): '''Blockmix; Used by SMix.''' start = (2 * r - 1) * 16 X = BY[start:start + 16] # BlockMix - 1 for i in xrange(0, 2 * r): # BlockMix - 2 for xi in xrange(0, 16): ...
python
def blockmix_salsa8(BY, Yi, r): '''Blockmix; Used by SMix.''' start = (2 * r - 1) * 16 X = BY[start:start + 16] # BlockMix - 1 for i in xrange(0, 2 * r): # BlockMix - 2 for xi in xrange(0, 16): ...
[ "def", "blockmix_salsa8", "(", "BY", ",", "Yi", ",", "r", ")", ":", "start", "=", "(", "2", "*", "r", "-", "1", ")", "*", "16", "X", "=", "BY", "[", "start", ":", "start", "+", "16", "]", "# BlockMix - 1", "for", "i", "in", "xrange", "(", "0"...
Blockmix; Used by SMix.
[ "Blockmix", ";", "Used", "by", "SMix", "." ]
train
https://github.com/ricmoo/pyscrypt/blob/131ca39acee4963afd704b4c4631497e4fe34c97/pyscrypt/hash.py#L170-L193
ricmoo/pyscrypt
pyscrypt/hash.py
smix
def smix(B, Bi, r, N, V, X): '''SMix; a specific case of ROMix. See scrypt.pdf in the links above.''' X[:32 * r] = B[Bi:Bi + 32 * r] # ROMix - 1 for i in xrange(0, N): # ROMix - 2 aod = i * 32 * r # ROMix - 3 V[aod:aod...
python
def smix(B, Bi, r, N, V, X): '''SMix; a specific case of ROMix. See scrypt.pdf in the links above.''' X[:32 * r] = B[Bi:Bi + 32 * r] # ROMix - 1 for i in xrange(0, N): # ROMix - 2 aod = i * 32 * r # ROMix - 3 V[aod:aod...
[ "def", "smix", "(", "B", ",", "Bi", ",", "r", ",", "N", ",", "V", ",", "X", ")", ":", "X", "[", ":", "32", "*", "r", "]", "=", "B", "[", "Bi", ":", "Bi", "+", "32", "*", "r", "]", "# ROMix - 1", "for", "i", "in", "xrange", "(", "0", "...
SMix; a specific case of ROMix. See scrypt.pdf in the links above.
[ "SMix", ";", "a", "specific", "case", "of", "ROMix", ".", "See", "scrypt", ".", "pdf", "in", "the", "links", "above", "." ]
train
https://github.com/ricmoo/pyscrypt/blob/131ca39acee4963afd704b4c4631497e4fe34c97/pyscrypt/hash.py#L196-L213
ricmoo/pyscrypt
pyscrypt/hash.py
hash
def hash(password, salt, N, r, p, dkLen): """Returns the result of the scrypt password-based key derivation function. Constraints: r * p < (2 ** 30) dkLen <= (((2 ** 32) - 1) * 32 N must be a power of 2 greater than 1 (eg. 2, 4, 8, 16, 32...) N, r, p must be positive ...
python
def hash(password, salt, N, r, p, dkLen): """Returns the result of the scrypt password-based key derivation function. Constraints: r * p < (2 ** 30) dkLen <= (((2 ** 32) - 1) * 32 N must be a power of 2 greater than 1 (eg. 2, 4, 8, 16, 32...) N, r, p must be positive ...
[ "def", "hash", "(", "password", ",", "salt", ",", "N", ",", "r", ",", "p", ",", "dkLen", ")", ":", "# This only matters to Python 3", "if", "not", "check_bytes", "(", "password", ")", ":", "raise", "ValueError", "(", "'password must be a byte array'", ")", "...
Returns the result of the scrypt password-based key derivation function. Constraints: r * p < (2 ** 30) dkLen <= (((2 ** 32) - 1) * 32 N must be a power of 2 greater than 1 (eg. 2, 4, 8, 16, 32...) N, r, p must be positive
[ "Returns", "the", "result", "of", "the", "scrypt", "password", "-", "based", "key", "derivation", "function", "." ]
train
https://github.com/ricmoo/pyscrypt/blob/131ca39acee4963afd704b4c4631497e4fe34c97/pyscrypt/hash.py#L217-L258
ricmoo/pyscrypt
pyscrypt/file.py
ScryptFile._load_get_attr
def _load_get_attr(self, name): 'Return an internal attribute after ensuring the headers is loaded if necessary.' if self._mode in _allowed_read and self._N is None: self._read_header() return getattr(self, name)
python
def _load_get_attr(self, name): 'Return an internal attribute after ensuring the headers is loaded if necessary.' if self._mode in _allowed_read and self._N is None: self._read_header() return getattr(self, name)
[ "def", "_load_get_attr", "(", "self", ",", "name", ")", ":", "if", "self", ".", "_mode", "in", "_allowed_read", "and", "self", ".", "_N", "is", "None", ":", "self", ".", "_read_header", "(", ")", "return", "getattr", "(", "self", ",", "name", ")" ]
Return an internal attribute after ensuring the headers is loaded if necessary.
[ "Return", "an", "internal", "attribute", "after", "ensuring", "the", "headers", "is", "loaded", "if", "necessary", "." ]
train
https://github.com/ricmoo/pyscrypt/blob/131ca39acee4963afd704b4c4631497e4fe34c97/pyscrypt/file.py#L190-L194
ricmoo/pyscrypt
pyscrypt/file.py
ScryptFile.close
def close(self): '''Close the underlying file. Sets data attribute .closed to True. A closed file cannot be used for further I/O operations. close() may be called more than once without error. Some kinds of file objects (for example, opened by popen()) may return an exit status ...
python
def close(self): '''Close the underlying file. Sets data attribute .closed to True. A closed file cannot be used for further I/O operations. close() may be called more than once without error. Some kinds of file objects (for example, opened by popen()) may return an exit status ...
[ "def", "close", "(", "self", ")", ":", "if", "self", ".", "_mode", "in", "_allowed_write", "and", "self", ".", "_valid", "is", "None", ":", "self", ".", "_finalize_write", "(", ")", "result", "=", "self", ".", "_fp", ".", "close", "(", ")", "self", ...
Close the underlying file. Sets data attribute .closed to True. A closed file cannot be used for further I/O operations. close() may be called more than once without error. Some kinds of file objects (for example, opened by popen()) may return an exit status upon closing.
[ "Close", "the", "underlying", "file", "." ]
train
https://github.com/ricmoo/pyscrypt/blob/131ca39acee4963afd704b4c4631497e4fe34c97/pyscrypt/file.py#L241-L254
ricmoo/pyscrypt
pyscrypt/file.py
ScryptFile.verify_file
def verify_file(fp, password): 'Returns whether a scrypt encrypted file is valid.' sf = ScryptFile(fp = fp, password = password) for line in sf: pass sf.close() return sf.valid
python
def verify_file(fp, password): 'Returns whether a scrypt encrypted file is valid.' sf = ScryptFile(fp = fp, password = password) for line in sf: pass sf.close() return sf.valid
[ "def", "verify_file", "(", "fp", ",", "password", ")", ":", "sf", "=", "ScryptFile", "(", "fp", "=", "fp", ",", "password", "=", "password", ")", "for", "line", "in", "sf", ":", "pass", "sf", ".", "close", "(", ")", "return", "sf", ".", "valid" ]
Returns whether a scrypt encrypted file is valid.
[ "Returns", "whether", "a", "scrypt", "encrypted", "file", "is", "valid", "." ]
train
https://github.com/ricmoo/pyscrypt/blob/131ca39acee4963afd704b4c4631497e4fe34c97/pyscrypt/file.py#L267-L273
ricmoo/pyscrypt
pyscrypt/file.py
ScryptFile.readline
def readline(self, size = None): '''Next line from the decrypted file, as a string. Retain newline. A non-negative size argument limits the maximum number of bytes to return (an incomplete line may be returned then). Return an empty string at EOF.''' if self.closed: raise Valu...
python
def readline(self, size = None): '''Next line from the decrypted file, as a string. Retain newline. A non-negative size argument limits the maximum number of bytes to return (an incomplete line may be returned then). Return an empty string at EOF.''' if self.closed: raise Valu...
[ "def", "readline", "(", "self", ",", "size", "=", "None", ")", ":", "if", "self", ".", "closed", ":", "raise", "ValueError", "(", "'file closed'", ")", "if", "self", ".", "_mode", "in", "_allowed_write", ":", "raise", "Exception", "(", "'file opened for wr...
Next line from the decrypted file, as a string. Retain newline. A non-negative size argument limits the maximum number of bytes to return (an incomplete line may be returned then). Return an empty string at EOF.
[ "Next", "line", "from", "the", "decrypted", "file", "as", "a", "string", "." ]
train
https://github.com/ricmoo/pyscrypt/blob/131ca39acee4963afd704b4c4631497e4fe34c97/pyscrypt/file.py#L276-L291
ricmoo/pyscrypt
pyscrypt/file.py
ScryptFile._read_header
def _read_header(self): '''Read and parse the header and calculate derived keys.''' try: # Read the entire header header = self._fp.read(96) if len(header) != 96: raise InvalidScryptFileFormat("Incomplete header") # Magic number ...
python
def _read_header(self): '''Read and parse the header and calculate derived keys.''' try: # Read the entire header header = self._fp.read(96) if len(header) != 96: raise InvalidScryptFileFormat("Incomplete header") # Magic number ...
[ "def", "_read_header", "(", "self", ")", ":", "try", ":", "# Read the entire header", "header", "=", "self", ".", "_fp", ".", "read", "(", "96", ")", "if", "len", "(", "header", ")", "!=", "96", ":", "raise", "InvalidScryptFileFormat", "(", "\"Incomplete h...
Read and parse the header and calculate derived keys.
[ "Read", "and", "parse", "the", "header", "and", "calculate", "derived", "keys", "." ]
train
https://github.com/ricmoo/pyscrypt/blob/131ca39acee4963afd704b4c4631497e4fe34c97/pyscrypt/file.py#L308-L358
ricmoo/pyscrypt
pyscrypt/file.py
ScryptFile.read
def read(self, size = None): '''Read at most size bytes, returned as a string. If the size argument is negative or omitted, read until EOF is reached. Notice that when in non-blocking mode, less data than what was requested may be returned, even if no size parameter was given.''' ...
python
def read(self, size = None): '''Read at most size bytes, returned as a string. If the size argument is negative or omitted, read until EOF is reached. Notice that when in non-blocking mode, less data than what was requested may be returned, even if no size parameter was given.''' ...
[ "def", "read", "(", "self", ",", "size", "=", "None", ")", ":", "if", "self", ".", "closed", ":", "raise", "ValueError", "(", "'File closed'", ")", "if", "self", ".", "_mode", "in", "_allowed_write", ":", "raise", "Exception", "(", "'File opened for write ...
Read at most size bytes, returned as a string. If the size argument is negative or omitted, read until EOF is reached. Notice that when in non-blocking mode, less data than what was requested may be returned, even if no size parameter was given.
[ "Read", "at", "most", "size", "bytes", "returned", "as", "a", "string", "." ]
train
https://github.com/ricmoo/pyscrypt/blob/131ca39acee4963afd704b4c4631497e4fe34c97/pyscrypt/file.py#L366-L427
ricmoo/pyscrypt
pyscrypt/file.py
ScryptFile._write_header
def _write_header(self): 'Writes the header to the underlying file object.' header = b'scrypt' + CHR0 + struct.pack('>BII', int(math.log(self.N, 2)), self.r, self.p) + self.salt # Add the header checksum to the header checksum = hashlib.sha256(header).digest()[:16] header += ch...
python
def _write_header(self): 'Writes the header to the underlying file object.' header = b'scrypt' + CHR0 + struct.pack('>BII', int(math.log(self.N, 2)), self.r, self.p) + self.salt # Add the header checksum to the header checksum = hashlib.sha256(header).digest()[:16] header += ch...
[ "def", "_write_header", "(", "self", ")", ":", "header", "=", "b'scrypt'", "+", "CHR0", "+", "struct", ".", "pack", "(", "'>BII'", ",", "int", "(", "math", ".", "log", "(", "self", ".", "N", ",", "2", ")", ")", ",", "self", ".", "r", ",", "self...
Writes the header to the underlying file object.
[ "Writes", "the", "header", "to", "the", "underlying", "file", "object", "." ]
train
https://github.com/ricmoo/pyscrypt/blob/131ca39acee4963afd704b4c4631497e4fe34c97/pyscrypt/file.py#L444-L466
ricmoo/pyscrypt
pyscrypt/file.py
ScryptFile._finalize_write
def _finalize_write(self): 'Finishes any unencrypted bytes and writes the final checksum.' # Make sure we have written the header if not self._done_header: self._write_header() # Write the remaining decrypted part to disk block = self._crypto.encrypt(self._decrypted...
python
def _finalize_write(self): 'Finishes any unencrypted bytes and writes the final checksum.' # Make sure we have written the header if not self._done_header: self._write_header() # Write the remaining decrypted part to disk block = self._crypto.encrypt(self._decrypted...
[ "def", "_finalize_write", "(", "self", ")", ":", "# Make sure we have written the header", "if", "not", "self", ".", "_done_header", ":", "self", ".", "_write_header", "(", ")", "# Write the remaining decrypted part to disk", "block", "=", "self", ".", "_crypto", ".",...
Finishes any unencrypted bytes and writes the final checksum.
[ "Finishes", "any", "unencrypted", "bytes", "and", "writes", "the", "final", "checksum", "." ]
train
https://github.com/ricmoo/pyscrypt/blob/131ca39acee4963afd704b4c4631497e4fe34c97/pyscrypt/file.py#L468-L483
ricmoo/pyscrypt
pyscrypt/file.py
ScryptFile.write
def write(self, str): '''Write string str to the underlying file. Note that due to buffering, flush() or close() may be needed before the file on disk reflects the data written.''' if self.closed: raise ValueError('File closed') if self._mode in _allowed_read: raise...
python
def write(self, str): '''Write string str to the underlying file. Note that due to buffering, flush() or close() may be needed before the file on disk reflects the data written.''' if self.closed: raise ValueError('File closed') if self._mode in _allowed_read: raise...
[ "def", "write", "(", "self", ",", "str", ")", ":", "if", "self", ".", "closed", ":", "raise", "ValueError", "(", "'File closed'", ")", "if", "self", ".", "_mode", "in", "_allowed_read", ":", "raise", "Exception", "(", "'File opened for read only'", ")", "i...
Write string str to the underlying file. Note that due to buffering, flush() or close() may be needed before the file on disk reflects the data written.
[ "Write", "string", "str", "to", "the", "underlying", "file", "." ]
train
https://github.com/ricmoo/pyscrypt/blob/131ca39acee4963afd704b4c4631497e4fe34c97/pyscrypt/file.py#L485-L504
dnanhkhoa/logone
logone/__init__.py
get_logger
def get_logger(logger_name): """ Return a logger with the specified name, creating it if necessary. """ # Use default global logger if logger_name is None: return __instance assert isinstance(logger_name, str), 'Logger name must be a string!' with __lock: if logger_name in...
python
def get_logger(logger_name): """ Return a logger with the specified name, creating it if necessary. """ # Use default global logger if logger_name is None: return __instance assert isinstance(logger_name, str), 'Logger name must be a string!' with __lock: if logger_name in...
[ "def", "get_logger", "(", "logger_name", ")", ":", "# Use default global logger", "if", "logger_name", "is", "None", ":", "return", "__instance", "assert", "isinstance", "(", "logger_name", ",", "str", ")", ",", "'Logger name must be a string!'", "with", "__lock", "...
Return a logger with the specified name, creating it if necessary.
[ "Return", "a", "logger", "with", "the", "specified", "name", "creating", "it", "if", "necessary", "." ]
train
https://github.com/dnanhkhoa/logone/blob/7345a59e54ae59418a2c35ae7e7af5b2784fa1b5/logone/__init__.py#L59-L76
mikemelch/hallie
hallie/modules/files.py
removeFile
def removeFile(file): """remove a file""" if "y" in speech.question("Are you sure you want to remove " + file + "? (Y/N): "): speech.speak("Removing " + file + " with the 'rm' command.") subprocess.call(["rm", "-r", file]) else: speech.speak("Okay, I won't remove " + file + ".")
python
def removeFile(file): """remove a file""" if "y" in speech.question("Are you sure you want to remove " + file + "? (Y/N): "): speech.speak("Removing " + file + " with the 'rm' command.") subprocess.call(["rm", "-r", file]) else: speech.speak("Okay, I won't remove " + file + ".")
[ "def", "removeFile", "(", "file", ")", ":", "if", "\"y\"", "in", "speech", ".", "question", "(", "\"Are you sure you want to remove \"", "+", "file", "+", "\"? (Y/N): \"", ")", ":", "speech", ".", "speak", "(", "\"Removing \"", "+", "file", "+", "\" with the '...
remove a file
[ "remove", "a", "file" ]
train
https://github.com/mikemelch/hallie/blob/a6dbb691145a85b776a1919e4c7930e0ae598437/hallie/modules/files.py#L19-L25
mikemelch/hallie
hallie/modules/files.py
copy
def copy(location): """copy file or directory at a given location; can be pasted later""" copyData = settings.getDataFile() copyFileLocation = os.path.abspath(location) copy = {"copyLocation": copyFileLocation} dataFile = open(copyData, "wb") pickle.dump(copy, dataFile) speech.speak(location + " copied successfu...
python
def copy(location): """copy file or directory at a given location; can be pasted later""" copyData = settings.getDataFile() copyFileLocation = os.path.abspath(location) copy = {"copyLocation": copyFileLocation} dataFile = open(copyData, "wb") pickle.dump(copy, dataFile) speech.speak(location + " copied successfu...
[ "def", "copy", "(", "location", ")", ":", "copyData", "=", "settings", ".", "getDataFile", "(", ")", "copyFileLocation", "=", "os", ".", "path", ".", "abspath", "(", "location", ")", "copy", "=", "{", "\"copyLocation\"", ":", "copyFileLocation", "}", "data...
copy file or directory at a given location; can be pasted later
[ "copy", "file", "or", "directory", "at", "a", "given", "location", ";", "can", "be", "pasted", "later" ]
train
https://github.com/mikemelch/hallie/blob/a6dbb691145a85b776a1919e4c7930e0ae598437/hallie/modules/files.py#L42-L50
mikemelch/hallie
hallie/modules/files.py
paste
def paste(location): """paste a file or directory that has been previously copied""" copyData = settings.getDataFile() if not location: location = "." try: data = pickle.load(open(copyData, "rb")) speech.speak("Pasting " + data["copyLocation"] + " to current directory.") except: speech.fail("It doesn't loo...
python
def paste(location): """paste a file or directory that has been previously copied""" copyData = settings.getDataFile() if not location: location = "." try: data = pickle.load(open(copyData, "rb")) speech.speak("Pasting " + data["copyLocation"] + " to current directory.") except: speech.fail("It doesn't loo...
[ "def", "paste", "(", "location", ")", ":", "copyData", "=", "settings", ".", "getDataFile", "(", ")", "if", "not", "location", ":", "location", "=", "\".\"", "try", ":", "data", "=", "pickle", ".", "load", "(", "open", "(", "copyData", ",", "\"rb\"", ...
paste a file or directory that has been previously copied
[ "paste", "a", "file", "or", "directory", "that", "has", "been", "previously", "copied" ]
train
https://github.com/mikemelch/hallie/blob/a6dbb691145a85b776a1919e4c7930e0ae598437/hallie/modules/files.py#L53-L67
pyBookshelf/bookshelf
bookshelf/api_v2/pkg.py
add_zfs_apt_repository
def add_zfs_apt_repository(): """ adds the ZFS repository """ with settings(hide('warnings', 'running', 'stdout'), warn_only=False, capture=True): sudo('DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get update') install_ubuntu_development_tools() apt_install(packages=['so...
python
def add_zfs_apt_repository(): """ adds the ZFS repository """ with settings(hide('warnings', 'running', 'stdout'), warn_only=False, capture=True): sudo('DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get update') install_ubuntu_development_tools() apt_install(packages=['so...
[ "def", "add_zfs_apt_repository", "(", ")", ":", "with", "settings", "(", "hide", "(", "'warnings'", ",", "'running'", ",", "'stdout'", ")", ",", "warn_only", "=", "False", ",", "capture", "=", "True", ")", ":", "sudo", "(", "'DEBIAN_FRONTEND=noninteractive /us...
adds the ZFS repository
[ "adds", "the", "ZFS", "repository" ]
train
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/pkg.py#L24-L36
pyBookshelf/bookshelf
bookshelf/api_v2/pkg.py
apt_install
def apt_install(**kwargs): """ installs a apt package """ for pkg in list(kwargs['packages']): if is_package_installed(distribution='ubuntu', pkg=pkg) is False: sudo("DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get install -y %s" % pkg) # if we didn't abort above, we shou...
python
def apt_install(**kwargs): """ installs a apt package """ for pkg in list(kwargs['packages']): if is_package_installed(distribution='ubuntu', pkg=pkg) is False: sudo("DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get install -y %s" % pkg) # if we didn't abort above, we shou...
[ "def", "apt_install", "(", "*", "*", "kwargs", ")", ":", "for", "pkg", "in", "list", "(", "kwargs", "[", "'packages'", "]", ")", ":", "if", "is_package_installed", "(", "distribution", "=", "'ubuntu'", ",", "pkg", "=", "pkg", ")", "is", "False", ":", ...
installs a apt package
[ "installs", "a", "apt", "package" ]
train
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/pkg.py#L48-L56
pyBookshelf/bookshelf
bookshelf/api_v2/pkg.py
apt_install_from_url
def apt_install_from_url(pkg_name, url, log=False): """ installs a pkg from a url p pkg_name: the name of the package to install p url: the full URL for the rpm package """ if is_package_installed(distribution='ubuntu', pkg=pkg_name) is False: if log: log_green( ...
python
def apt_install_from_url(pkg_name, url, log=False): """ installs a pkg from a url p pkg_name: the name of the package to install p url: the full URL for the rpm package """ if is_package_installed(distribution='ubuntu', pkg=pkg_name) is False: if log: log_green( ...
[ "def", "apt_install_from_url", "(", "pkg_name", ",", "url", ",", "log", "=", "False", ")", ":", "if", "is_package_installed", "(", "distribution", "=", "'ubuntu'", ",", "pkg", "=", "pkg_name", ")", "is", "False", ":", "if", "log", ":", "log_green", "(", ...
installs a pkg from a url p pkg_name: the name of the package to install p url: the full URL for the rpm package
[ "installs", "a", "pkg", "from", "a", "url", "p", "pkg_name", ":", "the", "name", "of", "the", "package", "to", "install", "p", "url", ":", "the", "full", "URL", "for", "the", "rpm", "package" ]
train
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/pkg.py#L59-L76
pyBookshelf/bookshelf
bookshelf/api_v2/pkg.py
apt_add_key
def apt_add_key(keyid, keyserver='keyserver.ubuntu.com', log=False): """ trust a new PGP key related to a apt-repository """ if log: log_green( 'trusting keyid %s from %s' % (keyid, keyserver) ) with settings(hide('warnings', 'running', 'stdout')): sudo('apt-key adv --key...
python
def apt_add_key(keyid, keyserver='keyserver.ubuntu.com', log=False): """ trust a new PGP key related to a apt-repository """ if log: log_green( 'trusting keyid %s from %s' % (keyid, keyserver) ) with settings(hide('warnings', 'running', 'stdout')): sudo('apt-key adv --key...
[ "def", "apt_add_key", "(", "keyid", ",", "keyserver", "=", "'keyserver.ubuntu.com'", ",", "log", "=", "False", ")", ":", "if", "log", ":", "log_green", "(", "'trusting keyid %s from %s'", "%", "(", "keyid", ",", "keyserver", ")", ")", "with", "settings", "("...
trust a new PGP key related to a apt-repository
[ "trust", "a", "new", "PGP", "key", "related", "to", "a", "apt", "-", "repository" ]
train
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/pkg.py#L96-L104
pyBookshelf/bookshelf
bookshelf/api_v2/pkg.py
enable_apt_repositories
def enable_apt_repositories(prefix, url, version, repositories): """ adds an apt repository """ with settings(hide('warnings', 'running', 'stdout'), warn_only=False, capture=True): sudo('apt-add-repository "%s %s %s %s"' % (prefix, url...
python
def enable_apt_repositories(prefix, url, version, repositories): """ adds an apt repository """ with settings(hide('warnings', 'running', 'stdout'), warn_only=False, capture=True): sudo('apt-add-repository "%s %s %s %s"' % (prefix, url...
[ "def", "enable_apt_repositories", "(", "prefix", ",", "url", ",", "version", ",", "repositories", ")", ":", "with", "settings", "(", "hide", "(", "'warnings'", ",", "'running'", ",", "'stdout'", ")", ",", "warn_only", "=", "False", ",", "capture", "=", "Tr...
adds an apt repository
[ "adds", "an", "apt", "repository" ]
train
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/pkg.py#L107-L121
pyBookshelf/bookshelf
bookshelf/api_v2/pkg.py
install_gem
def install_gem(gem): """ install a particular gem """ with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=False, capture=True): # convert 0 into True, any errors will always raise an exception return not bool( run("gem install %s --no-rdoc --no...
python
def install_gem(gem): """ install a particular gem """ with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=False, capture=True): # convert 0 into True, any errors will always raise an exception return not bool( run("gem install %s --no-rdoc --no...
[ "def", "install_gem", "(", "gem", ")", ":", "with", "settings", "(", "hide", "(", "'warnings'", ",", "'running'", ",", "'stdout'", ",", "'stderr'", ")", ",", "warn_only", "=", "False", ",", "capture", "=", "True", ")", ":", "# convert 0 into True, any errors...
install a particular gem
[ "install", "a", "particular", "gem" ]
train
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/pkg.py#L124-L130
pyBookshelf/bookshelf
bookshelf/api_v2/pkg.py
install_python_module_locally
def install_python_module_locally(name): """ instals a python module using pip """ with settings(hide('everything'), warn_only=False, capture=True): # convert 0 into True, any errors will always raise an exception print(not bool(local('pip --quiet install %s' % name).return_cod...
python
def install_python_module_locally(name): """ instals a python module using pip """ with settings(hide('everything'), warn_only=False, capture=True): # convert 0 into True, any errors will always raise an exception print(not bool(local('pip --quiet install %s' % name).return_cod...
[ "def", "install_python_module_locally", "(", "name", ")", ":", "with", "settings", "(", "hide", "(", "'everything'", ")", ",", "warn_only", "=", "False", ",", "capture", "=", "True", ")", ":", "# convert 0 into True, any errors will always raise an exception", "print"...
instals a python module using pip
[ "instals", "a", "python", "module", "using", "pip" ]
train
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/pkg.py#L143-L150
pyBookshelf/bookshelf
bookshelf/api_v2/pkg.py
is_package_installed
def is_package_installed(distribution, pkg): """ checks if a particular package is installed """ if ('centos' in distribution or 'el' in distribution or 'redhat' in distribution): return(is_rpm_package_installed(pkg)) if ('ubuntu' in distribution or 'debian' in d...
python
def is_package_installed(distribution, pkg): """ checks if a particular package is installed """ if ('centos' in distribution or 'el' in distribution or 'redhat' in distribution): return(is_rpm_package_installed(pkg)) if ('ubuntu' in distribution or 'debian' in d...
[ "def", "is_package_installed", "(", "distribution", ",", "pkg", ")", ":", "if", "(", "'centos'", "in", "distribution", "or", "'el'", "in", "distribution", "or", "'redhat'", "in", "distribution", ")", ":", "return", "(", "is_rpm_package_installed", "(", "pkg", ...
checks if a particular package is installed
[ "checks", "if", "a", "particular", "package", "is", "installed" ]
train
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/pkg.py#L181-L190
pyBookshelf/bookshelf
bookshelf/api_v2/pkg.py
is_rpm_package_installed
def is_rpm_package_installed(pkg): """ checks if a particular rpm package is installed """ with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=True, capture=True): result = sudo("rpm -q %s" % pkg) if result.return_code == 0: return True ...
python
def is_rpm_package_installed(pkg): """ checks if a particular rpm package is installed """ with settings(hide('warnings', 'running', 'stdout', 'stderr'), warn_only=True, capture=True): result = sudo("rpm -q %s" % pkg) if result.return_code == 0: return True ...
[ "def", "is_rpm_package_installed", "(", "pkg", ")", ":", "with", "settings", "(", "hide", "(", "'warnings'", ",", "'running'", ",", "'stdout'", ",", "'stderr'", ")", ",", "warn_only", "=", "True", ",", "capture", "=", "True", ")", ":", "result", "=", "su...
checks if a particular rpm package is installed
[ "checks", "if", "a", "particular", "rpm", "package", "is", "installed" ]
train
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/pkg.py#L193-L206
pyBookshelf/bookshelf
bookshelf/api_v2/pkg.py
yum_install
def yum_install(**kwargs): """ installs a yum package """ if 'repo' in kwargs: repo = kwargs['repo'] for pkg in list(kwargs['packages']): if is_package_installed(distribution='el', pkg=pkg) is False: if 'repo' in locals(): log_green( ...
python
def yum_install(**kwargs): """ installs a yum package """ if 'repo' in kwargs: repo = kwargs['repo'] for pkg in list(kwargs['packages']): if is_package_installed(distribution='el', pkg=pkg) is False: if 'repo' in locals(): log_green( ...
[ "def", "yum_install", "(", "*", "*", "kwargs", ")", ":", "if", "'repo'", "in", "kwargs", ":", "repo", "=", "kwargs", "[", "'repo'", "]", "for", "pkg", "in", "list", "(", "kwargs", "[", "'packages'", "]", ")", ":", "if", "is_package_installed", "(", "...
installs a yum package
[ "installs", "a", "yum", "package" ]
train
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/pkg.py#L209-L224
pyBookshelf/bookshelf
bookshelf/api_v2/pkg.py
yum_group_install
def yum_group_install(**kwargs): """ instals a yum group """ for grp in list(kwargs['groups']): log_green("installing %s ..." % grp) if 'repo' in kwargs: repo = kwargs['repo'] sudo("yum groupinstall -y --quiet " "--enablerepo=%s '%s'" % (repo, grp)) ...
python
def yum_group_install(**kwargs): """ instals a yum group """ for grp in list(kwargs['groups']): log_green("installing %s ..." % grp) if 'repo' in kwargs: repo = kwargs['repo'] sudo("yum groupinstall -y --quiet " "--enablerepo=%s '%s'" % (repo, grp)) ...
[ "def", "yum_group_install", "(", "*", "*", "kwargs", ")", ":", "for", "grp", "in", "list", "(", "kwargs", "[", "'groups'", "]", ")", ":", "log_green", "(", "\"installing %s ...\"", "%", "grp", ")", "if", "'repo'", "in", "kwargs", ":", "repo", "=", "kwa...
instals a yum group
[ "instals", "a", "yum", "group" ]
train
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/pkg.py#L227-L238
pyBookshelf/bookshelf
bookshelf/api_v2/pkg.py
yum_install_from_url
def yum_install_from_url(pkg_name, url): """ installs a pkg from a url p pkg_name: the name of the package to install p url: the full URL for the rpm package """ if is_package_installed(distribution='el', pkg=pkg_name) is False: log_green( "installing %s from %s" % (pkg_n...
python
def yum_install_from_url(pkg_name, url): """ installs a pkg from a url p pkg_name: the name of the package to install p url: the full URL for the rpm package """ if is_package_installed(distribution='el', pkg=pkg_name) is False: log_green( "installing %s from %s" % (pkg_n...
[ "def", "yum_install_from_url", "(", "pkg_name", ",", "url", ")", ":", "if", "is_package_installed", "(", "distribution", "=", "'el'", ",", "pkg", "=", "pkg_name", ")", "is", "False", ":", "log_green", "(", "\"installing %s from %s\"", "%", "(", "pkg_name", ","...
installs a pkg from a url p pkg_name: the name of the package to install p url: the full URL for the rpm package
[ "installs", "a", "pkg", "from", "a", "url", "p", "pkg_name", ":", "the", "name", "of", "the", "package", "to", "install", "p", "url", ":", "the", "full", "URL", "for", "the", "rpm", "package" ]
train
https://github.com/pyBookshelf/bookshelf/blob/a6770678e735de95b194f6e6989223970db5f654/bookshelf/api_v2/pkg.py#L241-L259
benoitkugler/abstractDataLibrary
pyDLib/Core/controller.py
abstractInterface.recherche
def recherche(self, pattern, entete, in_all=False): """abstractSearch in fields of collection and reset rendering. Returns number of results. If in_all is True, call get_all before doing the search.""" if in_all: self.collection = self.get_all() self.collection.recher...
python
def recherche(self, pattern, entete, in_all=False): """abstractSearch in fields of collection and reset rendering. Returns number of results. If in_all is True, call get_all before doing the search.""" if in_all: self.collection = self.get_all() self.collection.recher...
[ "def", "recherche", "(", "self", ",", "pattern", ",", "entete", ",", "in_all", "=", "False", ")", ":", "if", "in_all", ":", "self", ".", "collection", "=", "self", ".", "get_all", "(", ")", "self", ".", "collection", ".", "recherche", "(", "pattern", ...
abstractSearch in fields of collection and reset rendering. Returns number of results. If in_all is True, call get_all before doing the search.
[ "abstractSearch", "in", "fields", "of", "collection", "and", "reset", "rendering", ".", "Returns", "number", "of", "results", ".", "If", "in_all", "is", "True", "call", "get_all", "before", "doing", "the", "search", "." ]
train
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/controller.py#L119-L127
benoitkugler/abstractDataLibrary
pyDLib/Core/controller.py
abstractInterface.launch_background_job
def launch_background_job(self, job, on_error=None, on_success=None): """Launch the callable job in background thread. Succes or failure are controlled by on_error and on_success """ if not self.main.mode_online: self.sortie_erreur_GUI( "Local mode activated. ...
python
def launch_background_job(self, job, on_error=None, on_success=None): """Launch the callable job in background thread. Succes or failure are controlled by on_error and on_success """ if not self.main.mode_online: self.sortie_erreur_GUI( "Local mode activated. ...
[ "def", "launch_background_job", "(", "self", ",", "job", ",", "on_error", "=", "None", ",", "on_success", "=", "None", ")", ":", "if", "not", "self", ".", "main", ".", "mode_online", ":", "self", ".", "sortie_erreur_GUI", "(", "\"Local mode activated. Can't ru...
Launch the callable job in background thread. Succes or failure are controlled by on_error and on_success
[ "Launch", "the", "callable", "job", "in", "background", "thread", ".", "Succes", "or", "failure", "are", "controlled", "by", "on_error", "and", "on_success" ]
train
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/controller.py#L129-L153
benoitkugler/abstractDataLibrary
pyDLib/Core/controller.py
abstractInterface.filtre
def filtre(liste_base, criteres) -> groups.Collection: """ Return a filter list, bases on criteres :param liste_base: Acces list :param criteres: Criteria { `attribut`:[valeurs,...] } """ def choisi(ac): for cat, li in criteres.items(): v = a...
python
def filtre(liste_base, criteres) -> groups.Collection: """ Return a filter list, bases on criteres :param liste_base: Acces list :param criteres: Criteria { `attribut`:[valeurs,...] } """ def choisi(ac): for cat, li in criteres.items(): v = a...
[ "def", "filtre", "(", "liste_base", ",", "criteres", ")", "->", "groups", ".", "Collection", ":", "def", "choisi", "(", "ac", ")", ":", "for", "cat", ",", "li", "in", "criteres", ".", "items", "(", ")", ":", "v", "=", "ac", "[", "cat", "]", "if",...
Return a filter list, bases on criteres :param liste_base: Acces list :param criteres: Criteria { `attribut`:[valeurs,...] }
[ "Return", "a", "filter", "list", "bases", "on", "criteres" ]
train
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/controller.py#L175-L190
benoitkugler/abstractDataLibrary
pyDLib/Core/controller.py
abstractInterInterfaces.load_remote_data
def load_remote_data(self, callback_etat=print): """ Load remote data. On succes, build base. On failure, raise :class:`~.Core.exceptions.StructureError`, :class:`~.Core.exceptions.ConnexionError` :param callback_etat: State renderer str , int , int -> None """ callback_...
python
def load_remote_data(self, callback_etat=print): """ Load remote data. On succes, build base. On failure, raise :class:`~.Core.exceptions.StructureError`, :class:`~.Core.exceptions.ConnexionError` :param callback_etat: State renderer str , int , int -> None """ callback_...
[ "def", "load_remote_data", "(", "self", ",", "callback_etat", "=", "print", ")", ":", "callback_etat", "(", "\"Chargement des utilisateurs\"", ",", "0", ",", "1", ")", "self", ".", "_load_users", "(", ")", "self", ".", "base", "=", "self", ".", "BASE_CLASS",...
Load remote data. On succes, build base. On failure, raise :class:`~.Core.exceptions.StructureError`, :class:`~.Core.exceptions.ConnexionError` :param callback_etat: State renderer str , int , int -> None
[ "Load", "remote", "data", ".", "On", "succes", "build", "base", ".", "On", "failure", "raise", ":", "class", ":", "~", ".", "Core", ".", "exceptions", ".", "StructureError", ":", "class", ":", "~", ".", "Core", ".", "exceptions", ".", "ConnexionError" ]
train
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/controller.py#L247-L256
benoitkugler/abstractDataLibrary
pyDLib/Core/controller.py
abstractInterInterfaces._load_users
def _load_users(self): """Default implentation requires users from DB. Should setup `users` attribute""" r = sql.abstractRequetesSQL.get_users()() self.users = {d["id"]: dict(d) for d in r}
python
def _load_users(self): """Default implentation requires users from DB. Should setup `users` attribute""" r = sql.abstractRequetesSQL.get_users()() self.users = {d["id"]: dict(d) for d in r}
[ "def", "_load_users", "(", "self", ")", ":", "r", "=", "sql", ".", "abstractRequetesSQL", ".", "get_users", "(", ")", "(", ")", "self", ".", "users", "=", "{", "d", "[", "\"id\"", "]", ":", "dict", "(", "d", ")", "for", "d", "in", "r", "}" ]
Default implentation requires users from DB. Should setup `users` attribute
[ "Default", "implentation", "requires", "users", "from", "DB", ".", "Should", "setup", "users", "attribute" ]
train
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/controller.py#L258-L262
benoitkugler/abstractDataLibrary
pyDLib/Core/controller.py
abstractInterInterfaces.load_modules
def load_modules(self): """Should instance interfaces and set them to interface, following `modules`""" if self.INTERFACES_MODULE is None: raise NotImplementedError("A module containing interfaces modules " "should be setup in INTERFACES_MODULE !") ...
python
def load_modules(self): """Should instance interfaces and set them to interface, following `modules`""" if self.INTERFACES_MODULE is None: raise NotImplementedError("A module containing interfaces modules " "should be setup in INTERFACES_MODULE !") ...
[ "def", "load_modules", "(", "self", ")", ":", "if", "self", ".", "INTERFACES_MODULE", "is", "None", ":", "raise", "NotImplementedError", "(", "\"A module containing interfaces modules \"", "\"should be setup in INTERFACES_MODULE !\"", ")", "else", ":", "for", "module", ...
Should instance interfaces and set them to interface, following `modules`
[ "Should", "instance", "interfaces", "and", "set", "them", "to", "interface", "following", "modules" ]
train
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/controller.py#L273-L282
benoitkugler/abstractDataLibrary
pyDLib/Core/controller.py
abstractInterInterfaces.has_autolog
def has_autolog(self, user_id): """ Read auto-connection parameters and returns local password or None """ try: with open("local/init", "rb") as f: s = f.read() s = security.protege_data(s, False) self.autolog = json.loads(s).ge...
python
def has_autolog(self, user_id): """ Read auto-connection parameters and returns local password or None """ try: with open("local/init", "rb") as f: s = f.read() s = security.protege_data(s, False) self.autolog = json.loads(s).ge...
[ "def", "has_autolog", "(", "self", ",", "user_id", ")", ":", "try", ":", "with", "open", "(", "\"local/init\"", ",", "\"rb\"", ")", "as", "f", ":", "s", "=", "f", ".", "read", "(", ")", "s", "=", "security", ".", "protege_data", "(", "s", ",", "F...
Read auto-connection parameters and returns local password or None
[ "Read", "auto", "-", "connection", "parameters", "and", "returns", "local", "password", "or", "None" ]
train
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/controller.py#L307-L320
benoitkugler/abstractDataLibrary
pyDLib/Core/controller.py
abstractInterInterfaces.loggin
def loggin(self, user_id, mdp, autolog): """Check mdp and return True it's ok""" r = sql.abstractRequetesSQL.check_mdp_user(user_id, mdp) if r(): # update auto-log params self.autolog[user_id] = autolog and mdp or False self.modules = self.users[user_id]["modu...
python
def loggin(self, user_id, mdp, autolog): """Check mdp and return True it's ok""" r = sql.abstractRequetesSQL.check_mdp_user(user_id, mdp) if r(): # update auto-log params self.autolog[user_id] = autolog and mdp or False self.modules = self.users[user_id]["modu...
[ "def", "loggin", "(", "self", ",", "user_id", ",", "mdp", ",", "autolog", ")", ":", "r", "=", "sql", ".", "abstractRequetesSQL", ".", "check_mdp_user", "(", "user_id", ",", "mdp", ")", "if", "r", "(", ")", ":", "# update auto-log params", "self", ".", ...
Check mdp and return True it's ok
[ "Check", "mdp", "and", "return", "True", "it", "s", "ok" ]
train
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/Core/controller.py#L322-L339
benoitkugler/abstractDataLibrary
pyDLib/GUI/fenetres.py
Window.add_widget
def add_widget(self, w): """Convenience function""" if self.layout(): self.layout().addWidget(w) else: layout = QVBoxLayout(self) layout.addWidget(w)
python
def add_widget(self, w): """Convenience function""" if self.layout(): self.layout().addWidget(w) else: layout = QVBoxLayout(self) layout.addWidget(w)
[ "def", "add_widget", "(", "self", ",", "w", ")", ":", "if", "self", ".", "layout", "(", ")", ":", "self", ".", "layout", "(", ")", ".", "addWidget", "(", "w", ")", "else", ":", "layout", "=", "QVBoxLayout", "(", "self", ")", "layout", ".", "addWi...
Convenience function
[ "Convenience", "function" ]
train
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/GUI/fenetres.py#L114-L120
benoitkugler/abstractDataLibrary
pyDLib/GUI/fenetres.py
Window.add_layout
def add_layout(self, l): """Convenience function""" if self.layout(): self.layout().addLayout(l) else: layout = QVBoxLayout(self) layout.addLayout(l)
python
def add_layout(self, l): """Convenience function""" if self.layout(): self.layout().addLayout(l) else: layout = QVBoxLayout(self) layout.addLayout(l)
[ "def", "add_layout", "(", "self", ",", "l", ")", ":", "if", "self", ".", "layout", "(", ")", ":", "self", ".", "layout", "(", ")", ".", "addLayout", "(", "l", ")", "else", ":", "layout", "=", "QVBoxLayout", "(", "self", ")", "layout", ".", "addLa...
Convenience function
[ "Convenience", "function" ]
train
https://github.com/benoitkugler/abstractDataLibrary/blob/16be28e99837e40287a63803bbfdf67ac1806b7b/pyDLib/GUI/fenetres.py#L122-L128
tslight/columns
columns/columns.py
mkpad
def mkpad(items): ''' Find the length of the longest element of a list. Return that value + two. ''' pad = 0 stritems = [str(e) for e in items] # cast list to strings for e in stritems: index = stritems.index(e) if len(stritems[index]) > pad: pad = len(stritems[index...
python
def mkpad(items): ''' Find the length of the longest element of a list. Return that value + two. ''' pad = 0 stritems = [str(e) for e in items] # cast list to strings for e in stritems: index = stritems.index(e) if len(stritems[index]) > pad: pad = len(stritems[index...
[ "def", "mkpad", "(", "items", ")", ":", "pad", "=", "0", "stritems", "=", "[", "str", "(", "e", ")", "for", "e", "in", "items", "]", "# cast list to strings", "for", "e", "in", "stritems", ":", "index", "=", "stritems", ".", "index", "(", "e", ")",...
Find the length of the longest element of a list. Return that value + two.
[ "Find", "the", "length", "of", "the", "longest", "element", "of", "a", "list", ".", "Return", "that", "value", "+", "two", "." ]
train
https://github.com/tslight/columns/blob/609ec92c00c9a6d452d4c6cc20551882997d4871/columns/columns.py#L5-L16
tslight/columns
columns/columns.py
mkcols
def mkcols(l, rows): ''' Compute the size of our columns by first making them a divisible of our row height and then splitting our list into smaller lists the size of the row height. ''' cols = [] base = 0 while len(l) > rows and len(l) % rows != 0: l.append("") for i in rang...
python
def mkcols(l, rows): ''' Compute the size of our columns by first making them a divisible of our row height and then splitting our list into smaller lists the size of the row height. ''' cols = [] base = 0 while len(l) > rows and len(l) % rows != 0: l.append("") for i in rang...
[ "def", "mkcols", "(", "l", ",", "rows", ")", ":", "cols", "=", "[", "]", "base", "=", "0", "while", "len", "(", "l", ")", ">", "rows", "and", "len", "(", "l", ")", "%", "rows", "!=", "0", ":", "l", ".", "append", "(", "\"\"", ")", "for", ...
Compute the size of our columns by first making them a divisible of our row height and then splitting our list into smaller lists the size of the row height.
[ "Compute", "the", "size", "of", "our", "columns", "by", "first", "making", "them", "a", "divisible", "of", "our", "row", "height", "and", "then", "splitting", "our", "list", "into", "smaller", "lists", "the", "size", "of", "the", "row", "height", "." ]
train
https://github.com/tslight/columns/blob/609ec92c00c9a6d452d4c6cc20551882997d4871/columns/columns.py#L19-L32
tslight/columns
columns/columns.py
mkrows
def mkrows(l, pad, width, height): ''' Compute the optimal number of rows based on our lists' largest element and our terminal size in columns and rows. Work out our maximum column number by dividing the width of the terminal by our largest element. While the length of our list is greater than...
python
def mkrows(l, pad, width, height): ''' Compute the optimal number of rows based on our lists' largest element and our terminal size in columns and rows. Work out our maximum column number by dividing the width of the terminal by our largest element. While the length of our list is greater than...
[ "def", "mkrows", "(", "l", ",", "pad", ",", "width", ",", "height", ")", ":", "maxcols", "=", "int", "(", "width", "/", "pad", ")", "while", "len", "(", "l", ")", ">", "height", "*", "maxcols", ":", "height", "+=", "1", "return", "height" ]
Compute the optimal number of rows based on our lists' largest element and our terminal size in columns and rows. Work out our maximum column number by dividing the width of the terminal by our largest element. While the length of our list is greater than the total number of elements we can fit on...
[ "Compute", "the", "optimal", "number", "of", "rows", "based", "on", "our", "lists", "largest", "element", "and", "our", "terminal", "size", "in", "columns", "and", "rows", "." ]
train
https://github.com/tslight/columns/blob/609ec92c00c9a6d452d4c6cc20551882997d4871/columns/columns.py#L35-L49
tslight/columns
columns/columns.py
prtcols
def prtcols(items, vpad=6): ''' After computing the size of our rows and columns based on the terminal size and length of the largest element, use zip to aggregate our column lists into row lists and then iterate over the row lists and print them. ''' from os import get_terminal_size items =...
python
def prtcols(items, vpad=6): ''' After computing the size of our rows and columns based on the terminal size and length of the largest element, use zip to aggregate our column lists into row lists and then iterate over the row lists and print them. ''' from os import get_terminal_size items =...
[ "def", "prtcols", "(", "items", ",", "vpad", "=", "6", ")", ":", "from", "os", "import", "get_terminal_size", "items", "=", "list", "(", "items", ")", "# copy list so we don't mutate it", "width", ",", "height", "=", "get_terminal_size", "(", ")", "height", ...
After computing the size of our rows and columns based on the terminal size and length of the largest element, use zip to aggregate our column lists into row lists and then iterate over the row lists and print them.
[ "After", "computing", "the", "size", "of", "our", "rows", "and", "columns", "based", "on", "the", "terminal", "size", "and", "length", "of", "the", "largest", "element", "use", "zip", "to", "aggregate", "our", "column", "lists", "into", "row", "lists", "an...
train
https://github.com/tslight/columns/blob/609ec92c00c9a6d452d4c6cc20551882997d4871/columns/columns.py#L52-L68
OLC-Bioinformatics/sipprverse
cgecore/cmdline.py
cmd2list
def cmd2list(cmd): ''' Executes a command through the operating system and returns the output as a list, or on error a string with the standard error. EXAMPLE: >>> from subprocess import Popen, PIPE >>> CMDout2array('ls -l') ''' p = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=True) stdout, ...
python
def cmd2list(cmd): ''' Executes a command through the operating system and returns the output as a list, or on error a string with the standard error. EXAMPLE: >>> from subprocess import Popen, PIPE >>> CMDout2array('ls -l') ''' p = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=True) stdout, ...
[ "def", "cmd2list", "(", "cmd", ")", ":", "p", "=", "Popen", "(", "cmd", ",", "stdout", "=", "PIPE", ",", "stderr", "=", "PIPE", ",", "shell", "=", "True", ")", "stdout", ",", "stderr", "=", "p", ".", "communicate", "(", ")", "if", "p", ".", "re...
Executes a command through the operating system and returns the output as a list, or on error a string with the standard error. EXAMPLE: >>> from subprocess import Popen, PIPE >>> CMDout2array('ls -l')
[ "Executes", "a", "command", "through", "the", "operating", "system", "and", "returns", "the", "output", "as", "a", "list", "or", "on", "error", "a", "string", "with", "the", "standard", "error", ".", "EXAMPLE", ":", ">>>", "from", "subprocess", "import", "...
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/cmdline.py#L532-L544
OLC-Bioinformatics/sipprverse
cgecore/cmdline.py
ProgramList.return_timer
def return_timer(self, name, status, timer): ''' Return a text formatted timer ''' timer_template = '%s %s %s : %s : %9s' t = str(timedelta(0, timer)).split(',')[-1].strip().split(':') #t = str(timedelta(0, timer)).split(':') if len(t) == 4: h, m, s = int(t[0])*24 + int(t[1]), i...
python
def return_timer(self, name, status, timer): ''' Return a text formatted timer ''' timer_template = '%s %s %s : %s : %9s' t = str(timedelta(0, timer)).split(',')[-1].strip().split(':') #t = str(timedelta(0, timer)).split(':') if len(t) == 4: h, m, s = int(t[0])*24 + int(t[1]), i...
[ "def", "return_timer", "(", "self", ",", "name", ",", "status", ",", "timer", ")", ":", "timer_template", "=", "'%s %s %s : %s : %9s'", "t", "=", "str", "(", "timedelta", "(", "0", ",", "timer", ")", ")", ".", "split", "(", "','", ")", "[", "-", "1...
Return a text formatted timer
[ "Return", "a", "text", "formatted", "timer" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/cmdline.py#L77-L92
OLC-Bioinformatics/sipprverse
cgecore/cmdline.py
ProgramList.print_timers
def print_timers(self): ''' PRINT EXECUTION TIMES FOR THE LIST OF PROGRAMS ''' self.timer += time() total_time = self.timer tmp = '* %s *' debug.log( '', '* '*29, tmp%(' '*51), tmp%('%s %s %s'%('Program Name'.ljust(20), 'Status'.ljust(7), 'Execute Ti...
python
def print_timers(self): ''' PRINT EXECUTION TIMES FOR THE LIST OF PROGRAMS ''' self.timer += time() total_time = self.timer tmp = '* %s *' debug.log( '', '* '*29, tmp%(' '*51), tmp%('%s %s %s'%('Program Name'.ljust(20), 'Status'.ljust(7), 'Execute Ti...
[ "def", "print_timers", "(", "self", ")", ":", "self", ".", "timer", "+=", "time", "(", ")", "total_time", "=", "self", ".", "timer", "tmp", "=", "'* %s *'", "debug", ".", "log", "(", "''", ",", "'* '", "*", "29", ",", "tmp", "%", "(", "' '", "*...
PRINT EXECUTION TIMES FOR THE LIST OF PROGRAMS
[ "PRINT", "EXECUTION", "TIMES", "FOR", "THE", "LIST", "OF", "PROGRAMS" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/cmdline.py#L93-L120
OLC-Bioinformatics/sipprverse
cgecore/cmdline.py
Program.get_cmd
def get_cmd(self): """ This function combines and return the commanline call of the program. """ cmd = [] if self.path is not None: if '/' in self.path and not os.path.exists(self.path): debug.log('Error: path contains / but does not exist: %s'%self.path) else: ...
python
def get_cmd(self): """ This function combines and return the commanline call of the program. """ cmd = [] if self.path is not None: if '/' in self.path and not os.path.exists(self.path): debug.log('Error: path contains / but does not exist: %s'%self.path) else: ...
[ "def", "get_cmd", "(", "self", ")", ":", "cmd", "=", "[", "]", "if", "self", ".", "path", "is", "not", "None", ":", "if", "'/'", "in", "self", ".", "path", "and", "not", "os", ".", "path", ".", "exists", "(", "self", ".", "path", ")", ":", "d...
This function combines and return the commanline call of the program.
[ "This", "function", "combines", "and", "return", "the", "commanline", "call", "of", "the", "program", "." ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/cmdline.py#L186-L211
OLC-Bioinformatics/sipprverse
cgecore/cmdline.py
Program.append_args
def append_args(self, arg): """ This function appends the provided arguments to the program object. """ debug.log("Adding Arguments: %s"%(arg)) if isinstance(arg, (int,float)): self.args.append(str(arg)) if isinstance(arg, str): self.args.append(arg) if isinstance(arg, list): ...
python
def append_args(self, arg): """ This function appends the provided arguments to the program object. """ debug.log("Adding Arguments: %s"%(arg)) if isinstance(arg, (int,float)): self.args.append(str(arg)) if isinstance(arg, str): self.args.append(arg) if isinstance(arg, list): ...
[ "def", "append_args", "(", "self", ",", "arg", ")", ":", "debug", ".", "log", "(", "\"Adding Arguments: %s\"", "%", "(", "arg", ")", ")", "if", "isinstance", "(", "arg", ",", "(", "int", ",", "float", ")", ")", ":", "self", ".", "args", ".", "appen...
This function appends the provided arguments to the program object.
[ "This", "function", "appends", "the", "provided", "arguments", "to", "the", "program", "object", "." ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/cmdline.py#L215-L225
OLC-Bioinformatics/sipprverse
cgecore/cmdline.py
Program.execute
def execute(self): """ This function Executes the program with set arguments. """ prog_cmd = self.get_cmd().strip() if prog_cmd == '': self.status = 'Failure' debug.log("Error: No program to execute for %s!"%self.name) debug.log(("Could not combine path and arguments into cm...
python
def execute(self): """ This function Executes the program with set arguments. """ prog_cmd = self.get_cmd().strip() if prog_cmd == '': self.status = 'Failure' debug.log("Error: No program to execute for %s!"%self.name) debug.log(("Could not combine path and arguments into cm...
[ "def", "execute", "(", "self", ")", ":", "prog_cmd", "=", "self", ".", "get_cmd", "(", ")", ".", "strip", "(", ")", "if", "prog_cmd", "==", "''", ":", "self", ".", "status", "=", "'Failure'", "debug", ".", "log", "(", "\"Error: No program to execute for ...
This function Executes the program with set arguments.
[ "This", "function", "Executes", "the", "program", "with", "set", "arguments", "." ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/cmdline.py#L226-L305
OLC-Bioinformatics/sipprverse
cgecore/cmdline.py
Program.wait
def wait(self, pattern='Done', interval=None, epatterns=['error','Error','STACK','Traceback']): """ This function will wait on a given pattern being shown on the last line of a given outputfile. OPTIONS pattern - The string pattern to recognise when a program ...
python
def wait(self, pattern='Done', interval=None, epatterns=['error','Error','STACK','Traceback']): """ This function will wait on a given pattern being shown on the last line of a given outputfile. OPTIONS pattern - The string pattern to recognise when a program ...
[ "def", "wait", "(", "self", ",", "pattern", "=", "'Done'", ",", "interval", "=", "None", ",", "epatterns", "=", "[", "'error'", ",", "'Error'", ",", "'STACK'", ",", "'Traceback'", "]", ")", ":", "increasing_interval", "=", "False", "if", "interval", "is"...
This function will wait on a given pattern being shown on the last line of a given outputfile. OPTIONS pattern - The string pattern to recognise when a program finished properly. interval - The amount of seconds to wait between checking the ...
[ "This", "function", "will", "wait", "on", "a", "given", "pattern", "being", "shown", "on", "the", "last", "line", "of", "a", "given", "outputfile", "." ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/cmdline.py#L306-L454
OLC-Bioinformatics/sipprverse
cgecore/cmdline.py
Program.print_stdout
def print_stdout(self): """ This function will read the standard out of the program and print it """ # First we check if the file we want to print does exists if self.wdir != '': stdout = "%s/%s"%(self.wdir, self.stdout) else: stdout = self.stdout if os.path.exists(...
python
def print_stdout(self): """ This function will read the standard out of the program and print it """ # First we check if the file we want to print does exists if self.wdir != '': stdout = "%s/%s"%(self.wdir, self.stdout) else: stdout = self.stdout if os.path.exists(...
[ "def", "print_stdout", "(", "self", ")", ":", "# First we check if the file we want to print does exists", "if", "self", ".", "wdir", "!=", "''", ":", "stdout", "=", "\"%s/%s\"", "%", "(", "self", ".", "wdir", ",", "self", ".", "stdout", ")", "else", ":", "s...
This function will read the standard out of the program and print it
[ "This", "function", "will", "read", "the", "standard", "out", "of", "the", "program", "and", "print", "it" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/cmdline.py#L455-L467
OLC-Bioinformatics/sipprverse
cgecore/cmdline.py
Program.find_out_var
def find_out_var(self, varnames=[]): """ This function will read the standard out of the program, catch variables and return the values EG. #varname=value """ if self.wdir != '': stdout = "%s/%s"%(self.wdir, self.stdout) else: stdout = self.stdout res...
python
def find_out_var(self, varnames=[]): """ This function will read the standard out of the program, catch variables and return the values EG. #varname=value """ if self.wdir != '': stdout = "%s/%s"%(self.wdir, self.stdout) else: stdout = self.stdout res...
[ "def", "find_out_var", "(", "self", ",", "varnames", "=", "[", "]", ")", ":", "if", "self", ".", "wdir", "!=", "''", ":", "stdout", "=", "\"%s/%s\"", "%", "(", "self", ".", "wdir", ",", "self", ".", "stdout", ")", "else", ":", "stdout", "=", "sel...
This function will read the standard out of the program, catch variables and return the values EG. #varname=value
[ "This", "function", "will", "read", "the", "standard", "out", "of", "the", "program", "catch", "variables", "and", "return", "the", "values" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/cmdline.py#L468-L490
OLC-Bioinformatics/sipprverse
cgecore/cmdline.py
Program.find_err_pattern
def find_err_pattern(self, pattern): """ This function will read the standard error of the program and return a matching pattern if found. EG. prog_obj.FindErrPattern("Update of mySQL failed") """ if self.wdir != '': stderr = "%s/%s"%(self.wdir, self.stderr) else: ...
python
def find_err_pattern(self, pattern): """ This function will read the standard error of the program and return a matching pattern if found. EG. prog_obj.FindErrPattern("Update of mySQL failed") """ if self.wdir != '': stderr = "%s/%s"%(self.wdir, self.stderr) else: ...
[ "def", "find_err_pattern", "(", "self", ",", "pattern", ")", ":", "if", "self", ".", "wdir", "!=", "''", ":", "stderr", "=", "\"%s/%s\"", "%", "(", "self", ".", "wdir", ",", "self", ".", "stderr", ")", "else", ":", "stderr", "=", "self", ".", "stde...
This function will read the standard error of the program and return a matching pattern if found. EG. prog_obj.FindErrPattern("Update of mySQL failed")
[ "This", "function", "will", "read", "the", "standard", "error", "of", "the", "program", "and", "return", "a", "matching", "pattern", "if", "found", "." ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/cmdline.py#L491-L510
OLC-Bioinformatics/sipprverse
cgecore/cmdline.py
Program.find_out_pattern
def find_out_pattern(self, pattern): """ This function will read the standard error of the program and return a matching pattern if found. EG. prog_obj.FindErrPattern("Update of mySQL failed") """ if self.wdir != '': stdout = "%s/%s"%(self.wdir, self.stdout) else: ...
python
def find_out_pattern(self, pattern): """ This function will read the standard error of the program and return a matching pattern if found. EG. prog_obj.FindErrPattern("Update of mySQL failed") """ if self.wdir != '': stdout = "%s/%s"%(self.wdir, self.stdout) else: ...
[ "def", "find_out_pattern", "(", "self", ",", "pattern", ")", ":", "if", "self", ".", "wdir", "!=", "''", ":", "stdout", "=", "\"%s/%s\"", "%", "(", "self", ".", "wdir", ",", "self", ".", "stdout", ")", "else", ":", "stdout", "=", "self", ".", "stdo...
This function will read the standard error of the program and return a matching pattern if found. EG. prog_obj.FindErrPattern("Update of mySQL failed")
[ "This", "function", "will", "read", "the", "standard", "error", "of", "the", "program", "and", "return", "a", "matching", "pattern", "if", "found", "." ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/cgecore/cmdline.py#L511-L530
moralrecordings/mrcrowbar
mrcrowbar/lib/os/dos.py
decode_nfo
def decode_nfo( buffer ): """Decodes a byte string in NFO format (beloved by PC scener groups) from DOS Code Page 437 to Unicode.""" assert utils.is_bytes( buffer ) return '\n'.join( [''.join( [CP437[y] for y in x] ) for x in buffer.split( b'\r\n' )] )
python
def decode_nfo( buffer ): """Decodes a byte string in NFO format (beloved by PC scener groups) from DOS Code Page 437 to Unicode.""" assert utils.is_bytes( buffer ) return '\n'.join( [''.join( [CP437[y] for y in x] ) for x in buffer.split( b'\r\n' )] )
[ "def", "decode_nfo", "(", "buffer", ")", ":", "assert", "utils", ".", "is_bytes", "(", "buffer", ")", "return", "'\\n'", ".", "join", "(", "[", "''", ".", "join", "(", "[", "CP437", "[", "y", "]", "for", "y", "in", "x", "]", ")", "for", "x", "i...
Decodes a byte string in NFO format (beloved by PC scener groups) from DOS Code Page 437 to Unicode.
[ "Decodes", "a", "byte", "string", "in", "NFO", "format", "(", "beloved", "by", "PC", "scener", "groups", ")", "from", "DOS", "Code", "Page", "437", "to", "Unicode", "." ]
train
https://github.com/moralrecordings/mrcrowbar/blob/b1ed882c4555552e7656b2d84aca543184577fa3/mrcrowbar/lib/os/dos.py#L10-L14
OLC-Bioinformatics/sipprverse
MLSTsippr/mlst.py
GeneSippr.runner
def runner(self): """ Run the necessary methods in the correct order """ if os.path.isfile(self.report): self.report_parse() else: logging.info('Starting {} analysis pipeline'.format(self.analysistype)) # Create the objects to be used in the an...
python
def runner(self): """ Run the necessary methods in the correct order """ if os.path.isfile(self.report): self.report_parse() else: logging.info('Starting {} analysis pipeline'.format(self.analysistype)) # Create the objects to be used in the an...
[ "def", "runner", "(", "self", ")", ":", "if", "os", ".", "path", ".", "isfile", "(", "self", ".", "report", ")", ":", "self", ".", "report_parse", "(", ")", "else", ":", "logging", ".", "info", "(", "'Starting {} analysis pipeline'", ".", "format", "("...
Run the necessary methods in the correct order
[ "Run", "the", "necessary", "methods", "in", "the", "correct", "order" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/MLSTsippr/mlst.py#L22-L44
OLC-Bioinformatics/sipprverse
MLSTsippr/mlst.py
GeneSippr.reporter
def reporter(self): """ Runs the necessary methods to parse raw read outputs """ logging.info('Preparing reports') # Populate self.plusdict in order to reuse parsing code from an assembly-based method for sample in self.runmetadata.samples: self.plusdict[sampl...
python
def reporter(self): """ Runs the necessary methods to parse raw read outputs """ logging.info('Preparing reports') # Populate self.plusdict in order to reuse parsing code from an assembly-based method for sample in self.runmetadata.samples: self.plusdict[sampl...
[ "def", "reporter", "(", "self", ")", ":", "logging", ".", "info", "(", "'Preparing reports'", ")", "# Populate self.plusdict in order to reuse parsing code from an assembly-based method", "for", "sample", "in", "self", ".", "runmetadata", ".", "samples", ":", "self", "....
Runs the necessary methods to parse raw read outputs
[ "Runs", "the", "necessary", "methods", "to", "parse", "raw", "read", "outputs" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/MLSTsippr/mlst.py#L46-L82
OLC-Bioinformatics/sipprverse
MLSTsippr/mlst.py
GeneSippr.profiler
def profiler(self): """Creates a dictionary from the profile scheme(s)""" logging.info('Loading profiles') # Initialise variables profiledata = defaultdict(make_dict) reverse_profiledata = dict() profileset = set() # Find all the unique profiles to use with a set ...
python
def profiler(self): """Creates a dictionary from the profile scheme(s)""" logging.info('Loading profiles') # Initialise variables profiledata = defaultdict(make_dict) reverse_profiledata = dict() profileset = set() # Find all the unique profiles to use with a set ...
[ "def", "profiler", "(", "self", ")", ":", "logging", ".", "info", "(", "'Loading profiles'", ")", "# Initialise variables", "profiledata", "=", "defaultdict", "(", "make_dict", ")", "reverse_profiledata", "=", "dict", "(", ")", "profileset", "=", "set", "(", "...
Creates a dictionary from the profile scheme(s)
[ "Creates", "a", "dictionary", "from", "the", "profile", "scheme", "(", "s", ")" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/MLSTsippr/mlst.py#L84-L150
OLC-Bioinformatics/sipprverse
MLSTsippr/mlst.py
GeneSippr.sequencetyper
def sequencetyper(self): """Determines the sequence type of each strain based on comparisons to sequence type profiles""" logging.info('Performing sequence typing') for sample in self.runmetadata.samples: if sample.general.bestassemblyfile != 'NA': if type(sample[self...
python
def sequencetyper(self): """Determines the sequence type of each strain based on comparisons to sequence type profiles""" logging.info('Performing sequence typing') for sample in self.runmetadata.samples: if sample.general.bestassemblyfile != 'NA': if type(sample[self...
[ "def", "sequencetyper", "(", "self", ")", ":", "logging", ".", "info", "(", "'Performing sequence typing'", ")", "for", "sample", "in", "self", ".", "runmetadata", ".", "samples", ":", "if", "sample", ".", "general", ".", "bestassemblyfile", "!=", "'NA'", ":...
Determines the sequence type of each strain based on comparisons to sequence type profiles
[ "Determines", "the", "sequence", "type", "of", "each", "strain", "based", "on", "comparisons", "to", "sequence", "type", "profiles" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/MLSTsippr/mlst.py#L152-L337
OLC-Bioinformatics/sipprverse
MLSTsippr/mlst.py
GeneSippr.mlstreporter
def mlstreporter(self): """ Parse the results into a report""" logging.info('Writing reports') # Initialise variables header_row = str() combinedrow = str() combined_header_row = str() reportdirset = set() mlst_dict = dict() # Populate a set of all...
python
def mlstreporter(self): """ Parse the results into a report""" logging.info('Writing reports') # Initialise variables header_row = str() combinedrow = str() combined_header_row = str() reportdirset = set() mlst_dict = dict() # Populate a set of all...
[ "def", "mlstreporter", "(", "self", ")", ":", "logging", ".", "info", "(", "'Writing reports'", ")", "# Initialise variables", "header_row", "=", "str", "(", ")", "combinedrow", "=", "str", "(", ")", "combined_header_row", "=", "str", "(", ")", "reportdirset",...
Parse the results into a report
[ "Parse", "the", "results", "into", "a", "report" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/MLSTsippr/mlst.py#L339-L517
OLC-Bioinformatics/sipprverse
MLSTsippr/mlst.py
GeneSippr.report_parse
def report_parse(self): """ If the pipeline has previously been run on these data, instead of reading through the results, parse the report instead """ # Initialise lists report_strains = list() genus_list = list() if self.analysistype == 'mlst': ...
python
def report_parse(self): """ If the pipeline has previously been run on these data, instead of reading through the results, parse the report instead """ # Initialise lists report_strains = list() genus_list = list() if self.analysistype == 'mlst': ...
[ "def", "report_parse", "(", "self", ")", ":", "# Initialise lists", "report_strains", "=", "list", "(", ")", "genus_list", "=", "list", "(", ")", "if", "self", ".", "analysistype", "==", "'mlst'", ":", "for", "sample", "in", "self", ".", "runmetadata", "."...
If the pipeline has previously been run on these data, instead of reading through the results, parse the report instead
[ "If", "the", "pipeline", "has", "previously", "been", "run", "on", "these", "data", "instead", "of", "reading", "through", "the", "results", "parse", "the", "report", "instead" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/MLSTsippr/mlst.py#L519-L556
kappius/pyheaderfile
pyheaderfile/helpers.py
guess_type
def guess_type(filename, **kwargs): """ Utility function to call classes based on filename extension. Just usefull if you are reading the file and don't know file extension. You can pass kwargs and these args are passed to class only if they are used in class. """ extension = os.path.splitext(f...
python
def guess_type(filename, **kwargs): """ Utility function to call classes based on filename extension. Just usefull if you are reading the file and don't know file extension. You can pass kwargs and these args are passed to class only if they are used in class. """ extension = os.path.splitext(f...
[ "def", "guess_type", "(", "filename", ",", "*", "*", "kwargs", ")", ":", "extension", "=", "os", ".", "path", ".", "splitext", "(", "filename", ")", "[", "1", "]", "case", "=", "{", "'.xls'", ":", "Xls", ",", "'.xlsx'", ":", "Xlsx", ",", "'.csv'", ...
Utility function to call classes based on filename extension. Just usefull if you are reading the file and don't know file extension. You can pass kwargs and these args are passed to class only if they are used in class.
[ "Utility", "function", "to", "call", "classes", "based", "on", "filename", "extension", ".", "Just", "usefull", "if", "you", "are", "reading", "the", "file", "and", "don", "t", "know", "file", "extension", ".", "You", "can", "pass", "kwargs", "and", "these...
train
https://github.com/kappius/pyheaderfile/blob/8d587dadae538adcec527fd8e74ad89ed5e2006a/pyheaderfile/helpers.py#L10-L31
OLC-Bioinformatics/sipprverse
pointfinder/PointFinder.py
get_gene_seqs
def get_gene_seqs(database_path, gene): """ This function takes the database path and a gene name as inputs and returns the gene sequence contained in the file given by the gene name """ gene_path = database_path + "/" + gene + ".fsa" gene_seq = "" # Open fasta file with open(gene_path)...
python
def get_gene_seqs(database_path, gene): """ This function takes the database path and a gene name as inputs and returns the gene sequence contained in the file given by the gene name """ gene_path = database_path + "/" + gene + ".fsa" gene_seq = "" # Open fasta file with open(gene_path)...
[ "def", "get_gene_seqs", "(", "database_path", ",", "gene", ")", ":", "gene_path", "=", "database_path", "+", "\"/\"", "+", "gene", "+", "\".fsa\"", "gene_seq", "=", "\"\"", "# Open fasta file", "with", "open", "(", "gene_path", ")", "as", "gene_file", ":", "...
This function takes the database path and a gene name as inputs and returns the gene sequence contained in the file given by the gene name
[ "This", "function", "takes", "the", "database", "path", "and", "a", "gene", "name", "as", "inputs", "and", "returns", "the", "gene", "sequence", "contained", "in", "the", "file", "given", "by", "the", "gene", "name" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L10-L23
OLC-Bioinformatics/sipprverse
pointfinder/PointFinder.py
get_db_mutations
def get_db_mutations(mut_db_path, gene_list, res_stop_codons): """ This function opens the file resistenss-overview.txt, and reads the content into a dict of dicts. The dict will contain information about all known mutations given in the database. This dict is returned. """ # Open resistens-ove...
python
def get_db_mutations(mut_db_path, gene_list, res_stop_codons): """ This function opens the file resistenss-overview.txt, and reads the content into a dict of dicts. The dict will contain information about all known mutations given in the database. This dict is returned. """ # Open resistens-ove...
[ "def", "get_db_mutations", "(", "mut_db_path", ",", "gene_list", ",", "res_stop_codons", ")", ":", "# Open resistens-overview.txt", "try", ":", "drugfile", "=", "open", "(", "mut_db_path", ",", "\"r\"", ")", "except", ":", "sys", ".", "exit", "(", "\"Wrong path:...
This function opens the file resistenss-overview.txt, and reads the content into a dict of dicts. The dict will contain information about all known mutations given in the database. This dict is returned.
[ "This", "function", "opens", "the", "file", "resistenss", "-", "overview", ".", "txt", "and", "reads", "the", "content", "into", "a", "dict", "of", "dicts", ".", "The", "dict", "will", "contain", "information", "about", "all", "known", "mutations", "given", ...
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L25-L128
OLC-Bioinformatics/sipprverse
pointfinder/PointFinder.py
KMA
def KMA(inputfile_1, gene_list, kma_db, out_path, sample_name, min_cov, mapping_path): """ This function is called when KMA is the method of choice. The function calls kma externally and waits for it to finish. The kma output files with the prefixes .res and .aln are parsed throught to obtain the...
python
def KMA(inputfile_1, gene_list, kma_db, out_path, sample_name, min_cov, mapping_path): """ This function is called when KMA is the method of choice. The function calls kma externally and waits for it to finish. The kma output files with the prefixes .res and .aln are parsed throught to obtain the...
[ "def", "KMA", "(", "inputfile_1", ",", "gene_list", ",", "kma_db", ",", "out_path", ",", "sample_name", ",", "min_cov", ",", "mapping_path", ")", ":", "# Get full path to input of output files", "inputfile_1", "=", "os", ".", "path", ".", "abspath", "(", "inputf...
This function is called when KMA is the method of choice. The function calls kma externally and waits for it to finish. The kma output files with the prefixes .res and .aln are parsed throught to obtain the required alignment informations. The subject and query sequences as well as the start and sto...
[ "This", "function", "is", "called", "when", "KMA", "is", "the", "method", "of", "choice", ".", "The", "function", "calls", "kma", "externally", "and", "waits", "for", "it", "to", "finish", ".", "The", "kma", "output", "files", "with", "the", "prefixes", ...
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L130-L250
OLC-Bioinformatics/sipprverse
pointfinder/PointFinder.py
find_best_sequence
def find_best_sequence(hits_found, specie_path, gene, silent_N_flag): """ This function takes the list hits_found as argument. This contains all hits found for the blast search of one gene. A hit includes the subjct sequence, the query, and the start and stop position of the allignment correspond...
python
def find_best_sequence(hits_found, specie_path, gene, silent_N_flag): """ This function takes the list hits_found as argument. This contains all hits found for the blast search of one gene. A hit includes the subjct sequence, the query, and the start and stop position of the allignment correspond...
[ "def", "find_best_sequence", "(", "hits_found", ",", "specie_path", ",", "gene", ",", "silent_N_flag", ")", ":", "# Get information from the fisrt hit found\t", "all_start", "=", "hits_found", "[", "0", "]", "[", "0", "]", "current_end", "=", "hits_found", "[", "0...
This function takes the list hits_found as argument. This contains all hits found for the blast search of one gene. A hit includes the subjct sequence, the query, and the start and stop position of the allignment corresponding to the subject sequence. This function finds the best hit by concatinatin...
[ "This", "function", "takes", "the", "list", "hits_found", "as", "argument", ".", "This", "contains", "all", "hits", "found", "for", "the", "blast", "search", "of", "one", "gene", ".", "A", "hit", "includes", "the", "subjct", "sequence", "the", "query", "an...
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L252-L367
OLC-Bioinformatics/sipprverse
pointfinder/PointFinder.py
find_mismatches
def find_mismatches(gene, sbjct_start, sbjct_seq, qry_seq, alternative_overlaps = []): """ This function finds mis matches between two sequeces. Depending on the the sequence type either the function find_codon_mismatches or find_nucleotid_mismatches are called, if the sequences contains both a pr...
python
def find_mismatches(gene, sbjct_start, sbjct_seq, qry_seq, alternative_overlaps = []): """ This function finds mis matches between two sequeces. Depending on the the sequence type either the function find_codon_mismatches or find_nucleotid_mismatches are called, if the sequences contains both a pr...
[ "def", "find_mismatches", "(", "gene", ",", "sbjct_start", ",", "sbjct_seq", ",", "qry_seq", ",", "alternative_overlaps", "=", "[", "]", ")", ":", "# Initiate the mis_matches list that will store all found mis matcehs", "mis_matches", "=", "[", "]", "# Find mis matches in...
This function finds mis matches between two sequeces. Depending on the the sequence type either the function find_codon_mismatches or find_nucleotid_mismatches are called, if the sequences contains both a promoter and a coding region both functions are called. The function can also call it self if al...
[ "This", "function", "finds", "mis", "matches", "between", "two", "sequeces", ".", "Depending", "on", "the", "the", "sequence", "type", "either", "the", "function", "find_codon_mismatches", "or", "find_nucleotid_mismatches", "are", "called", "if", "the", "sequences",...
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L370-L455
OLC-Bioinformatics/sipprverse
pointfinder/PointFinder.py
find_nucleotid_mismatches
def find_nucleotid_mismatches(sbjct_start, sbjct_seq, qry_seq, promoter = False): """ This function takes two alligned sequence (subject and query), and the position on the subject where the alignment starts. The sequences are compared one nucleotide at a time. If mis matches are found they are ...
python
def find_nucleotid_mismatches(sbjct_start, sbjct_seq, qry_seq, promoter = False): """ This function takes two alligned sequence (subject and query), and the position on the subject where the alignment starts. The sequences are compared one nucleotide at a time. If mis matches are found they are ...
[ "def", "find_nucleotid_mismatches", "(", "sbjct_start", ",", "sbjct_seq", ",", "qry_seq", ",", "promoter", "=", "False", ")", ":", "# Initiate the mis_matches list that will store all found mis matcehs", "mis_matches", "=", "[", "]", "sbjct_start", "=", "abs", "(", "sbj...
This function takes two alligned sequence (subject and query), and the position on the subject where the alignment starts. The sequences are compared one nucleotide at a time. If mis matches are found they are saved. If a gap is found the function find_nuc_indel is called to find the entire indel and...
[ "This", "function", "takes", "two", "alligned", "sequence", "(", "subject", "and", "query", ")", "and", "the", "position", "on", "the", "subject", "where", "the", "alignment", "starts", ".", "The", "sequences", "are", "compared", "one", "nucleotide", "at", "...
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L458-L549
OLC-Bioinformatics/sipprverse
pointfinder/PointFinder.py
find_nuc_indel
def find_nuc_indel(gapped_seq, indel_seq): """ This function finds the entire indel missing in from a gapped sequence compared to the indel_seqeunce. It is assumes that the sequences start with the first position of the gap. """ ref_indel = indel_seq[0] for j in range(1,len(gapped_seq)): ...
python
def find_nuc_indel(gapped_seq, indel_seq): """ This function finds the entire indel missing in from a gapped sequence compared to the indel_seqeunce. It is assumes that the sequences start with the first position of the gap. """ ref_indel = indel_seq[0] for j in range(1,len(gapped_seq)): ...
[ "def", "find_nuc_indel", "(", "gapped_seq", ",", "indel_seq", ")", ":", "ref_indel", "=", "indel_seq", "[", "0", "]", "for", "j", "in", "range", "(", "1", ",", "len", "(", "gapped_seq", ")", ")", ":", "if", "gapped_seq", "[", "j", "]", "==", "\"-\"",...
This function finds the entire indel missing in from a gapped sequence compared to the indel_seqeunce. It is assumes that the sequences start with the first position of the gap.
[ "This", "function", "finds", "the", "entire", "indel", "missing", "in", "from", "a", "gapped", "sequence", "compared", "to", "the", "indel_seqeunce", ".", "It", "is", "assumes", "that", "the", "sequences", "start", "with", "the", "first", "position", "of", "...
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L552-L564
OLC-Bioinformatics/sipprverse
pointfinder/PointFinder.py
aa
def aa(codon): """ This function converts a codon to an amino acid. If the codon is not valid an error message is given, or else, the amino acid is returned. """ codon = codon.upper() aa = {"ATT": "I", "ATC": "I", "ATA": "I", "CTT": "L", "CTC": "L", "CTA": "L", "CTG": "L", "TTA": "L...
python
def aa(codon): """ This function converts a codon to an amino acid. If the codon is not valid an error message is given, or else, the amino acid is returned. """ codon = codon.upper() aa = {"ATT": "I", "ATC": "I", "ATA": "I", "CTT": "L", "CTC": "L", "CTA": "L", "CTG": "L", "TTA": "L...
[ "def", "aa", "(", "codon", ")", ":", "codon", "=", "codon", ".", "upper", "(", ")", "aa", "=", "{", "\"ATT\"", ":", "\"I\"", ",", "\"ATC\"", ":", "\"I\"", ",", "\"ATA\"", ":", "\"I\"", ",", "\"CTT\"", ":", "\"L\"", ",", "\"CTC\"", ":", "\"L\"", "...
This function converts a codon to an amino acid. If the codon is not valid an error message is given, or else, the amino acid is returned.
[ "This", "function", "converts", "a", "codon", "to", "an", "amino", "acid", ".", "If", "the", "codon", "is", "not", "valid", "an", "error", "message", "is", "given", "or", "else", "the", "amino", "acid", "is", "returned", "." ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L567-L600
OLC-Bioinformatics/sipprverse
pointfinder/PointFinder.py
get_codon
def get_codon(seq, codon_no, start_offset): """ This function takes a sequece and a codon number and returns the codon found in the sequence at that position """ seq = seq.replace("-","") codon_start_pos = int(codon_no - 1)*3 - start_offset codon = seq[codon_start_pos:codon_start_pos + 3] ...
python
def get_codon(seq, codon_no, start_offset): """ This function takes a sequece and a codon number and returns the codon found in the sequence at that position """ seq = seq.replace("-","") codon_start_pos = int(codon_no - 1)*3 - start_offset codon = seq[codon_start_pos:codon_start_pos + 3] ...
[ "def", "get_codon", "(", "seq", ",", "codon_no", ",", "start_offset", ")", ":", "seq", "=", "seq", ".", "replace", "(", "\"-\"", ",", "\"\"", ")", "codon_start_pos", "=", "int", "(", "codon_no", "-", "1", ")", "*", "3", "-", "start_offset", "codon", ...
This function takes a sequece and a codon number and returns the codon found in the sequence at that position
[ "This", "function", "takes", "a", "sequece", "and", "a", "codon", "number", "and", "returns", "the", "codon", "found", "in", "the", "sequence", "at", "that", "position" ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L603-L611
OLC-Bioinformatics/sipprverse
pointfinder/PointFinder.py
name_insertion
def name_insertion(sbjct_seq, codon_no, sbjct_nucs, aa_alt, start_offset): """ This function is used to name a insertion mutation based on the HGVS recommendation. """ start_codon_no = codon_no - 1 if len(sbjct_nucs) == 3: start_codon_no = codon_no start_codon = get_codon(sbjct_seq...
python
def name_insertion(sbjct_seq, codon_no, sbjct_nucs, aa_alt, start_offset): """ This function is used to name a insertion mutation based on the HGVS recommendation. """ start_codon_no = codon_no - 1 if len(sbjct_nucs) == 3: start_codon_no = codon_no start_codon = get_codon(sbjct_seq...
[ "def", "name_insertion", "(", "sbjct_seq", ",", "codon_no", ",", "sbjct_nucs", ",", "aa_alt", ",", "start_offset", ")", ":", "start_codon_no", "=", "codon_no", "-", "1", "if", "len", "(", "sbjct_nucs", ")", "==", "3", ":", "start_codon_no", "=", "codon_no", ...
This function is used to name a insertion mutation based on the HGVS recommendation.
[ "This", "function", "is", "used", "to", "name", "a", "insertion", "mutation", "based", "on", "the", "HGVS", "recommendation", "." ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L614-L625
OLC-Bioinformatics/sipprverse
pointfinder/PointFinder.py
name_indel_mutation
def name_indel_mutation(sbjct_seq, indel, sbjct_rf_indel, qry_rf_indel, codon_no, mut, start_offset): """ This function serves to name the individual mutations dependently on the type of the mutation. """ # Get the subject and query sequences without gaps sbjct_nucs = sbjct_rf_indel.replace("-"...
python
def name_indel_mutation(sbjct_seq, indel, sbjct_rf_indel, qry_rf_indel, codon_no, mut, start_offset): """ This function serves to name the individual mutations dependently on the type of the mutation. """ # Get the subject and query sequences without gaps sbjct_nucs = sbjct_rf_indel.replace("-"...
[ "def", "name_indel_mutation", "(", "sbjct_seq", ",", "indel", ",", "sbjct_rf_indel", ",", "qry_rf_indel", ",", "codon_no", ",", "mut", ",", "start_offset", ")", ":", "# Get the subject and query sequences without gaps", "sbjct_nucs", "=", "sbjct_rf_indel", ".", "replace...
This function serves to name the individual mutations dependently on the type of the mutation.
[ "This", "function", "serves", "to", "name", "the", "individual", "mutations", "dependently", "on", "the", "type", "of", "the", "mutation", "." ]
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L643-L696
OLC-Bioinformatics/sipprverse
pointfinder/PointFinder.py
get_inframe_gap
def get_inframe_gap(seq, nucs_needed = 3): """ This funtion takes a sequnece starting with a gap or the complementary seqeuence to the gap, and the number of nucleotides that the seqeunce should contain in order to maintain the correct reading frame. The sequence is gone through and the number of ...
python
def get_inframe_gap(seq, nucs_needed = 3): """ This funtion takes a sequnece starting with a gap or the complementary seqeuence to the gap, and the number of nucleotides that the seqeunce should contain in order to maintain the correct reading frame. The sequence is gone through and the number of ...
[ "def", "get_inframe_gap", "(", "seq", ",", "nucs_needed", "=", "3", ")", ":", "nuc_count", "=", "0", "gap_indel", "=", "\"\"", "nucs", "=", "\"\"", "for", "i", "in", "range", "(", "len", "(", "seq", ")", ")", ":", "# Check if the character is not a gap", ...
This funtion takes a sequnece starting with a gap or the complementary seqeuence to the gap, and the number of nucleotides that the seqeunce should contain in order to maintain the correct reading frame. The sequence is gone through and the number of non-gap characters are counted. When the number ha...
[ "This", "funtion", "takes", "a", "sequnece", "starting", "with", "a", "gap", "or", "the", "complementary", "seqeuence", "to", "the", "gap", "and", "the", "number", "of", "nucleotides", "that", "the", "seqeunce", "should", "contain", "in", "order", "to", "mai...
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L699-L730
OLC-Bioinformatics/sipprverse
pointfinder/PointFinder.py
get_indels
def get_indels(sbjct_seq, qry_seq, start_pos): """ This function uses regex to find inserts and deletions in sequences given as arguments. A list of these indels are returned. The list includes, type of mutations(ins/del), subject codon no of found mutation, subject sequence position, insert/delet...
python
def get_indels(sbjct_seq, qry_seq, start_pos): """ This function uses regex to find inserts and deletions in sequences given as arguments. A list of these indels are returned. The list includes, type of mutations(ins/del), subject codon no of found mutation, subject sequence position, insert/delet...
[ "def", "get_indels", "(", "sbjct_seq", ",", "qry_seq", ",", "start_pos", ")", ":", "seqs", "=", "[", "sbjct_seq", ",", "qry_seq", "]", "indels", "=", "[", "]", "gap_obj", "=", "re", ".", "compile", "(", "r\"-+\"", ")", "for", "i", "in", "range", "(",...
This function uses regex to find inserts and deletions in sequences given as arguments. A list of these indels are returned. The list includes, type of mutations(ins/del), subject codon no of found mutation, subject sequence position, insert/deletions nucleotide sequence, and the affected qry codon n...
[ "This", "function", "uses", "regex", "to", "find", "inserts", "and", "deletions", "in", "sequences", "given", "as", "arguments", ".", "A", "list", "of", "these", "indels", "are", "returned", ".", "The", "list", "includes", "type", "of", "mutations", "(", "...
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L733-L770
OLC-Bioinformatics/sipprverse
pointfinder/PointFinder.py
find_codon_mismatches
def find_codon_mismatches(sbjct_start, sbjct_seq, qry_seq): """ This function takes two alligned sequence (subject and query), and the position on the subject where the alignment starts. The sequences are compared codon by codon. If a mis matches is found it is saved in 'mis_matches'. If a gap is ...
python
def find_codon_mismatches(sbjct_start, sbjct_seq, qry_seq): """ This function takes two alligned sequence (subject and query), and the position on the subject where the alignment starts. The sequences are compared codon by codon. If a mis matches is found it is saved in 'mis_matches'. If a gap is ...
[ "def", "find_codon_mismatches", "(", "sbjct_start", ",", "sbjct_seq", ",", "qry_seq", ")", ":", "mis_matches", "=", "[", "]", "# Find start pos of first codon in frame, i_start", "codon_offset", "=", "(", "sbjct_start", "-", "1", ")", "%", "3", "i_start", "=", "0"...
This function takes two alligned sequence (subject and query), and the position on the subject where the alignment starts. The sequences are compared codon by codon. If a mis matches is found it is saved in 'mis_matches'. If a gap is found the function get_inframe_gap is used to find the indel sequen...
[ "This", "function", "takes", "two", "alligned", "sequence", "(", "subject", "and", "query", ")", "and", "the", "position", "on", "the", "subject", "where", "the", "alignment", "starts", ".", "The", "sequences", "are", "compared", "codon", "by", "codon", ".",...
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L773-L931
OLC-Bioinformatics/sipprverse
pointfinder/PointFinder.py
write_output
def write_output(gene, gene_name, mis_matches, known_mutations, known_stop_codon, unknown_flag, GENES): """ This function takes a gene name a list of mis matches found betreewn subject and query of this gene, the dictionary of known mutation in the point finder database, and the flag telling weather th...
python
def write_output(gene, gene_name, mis_matches, known_mutations, known_stop_codon, unknown_flag, GENES): """ This function takes a gene name a list of mis matches found betreewn subject and query of this gene, the dictionary of known mutation in the point finder database, and the flag telling weather th...
[ "def", "write_output", "(", "gene", ",", "gene_name", ",", "mis_matches", ",", "known_mutations", ",", "known_stop_codon", ",", "unknown_flag", ",", "GENES", ")", ":", "RNA", "=", "False", "known_header", "=", "\"Mutation\\tNucleotide change\\tAmino acid change\\tResist...
This function takes a gene name a list of mis matches found betreewn subject and query of this gene, the dictionary of known mutation in the point finder database, and the flag telling weather the user wants unknown mutations to be reported. All mis matches are looked up in the known mutation dict to se if...
[ "This", "function", "takes", "a", "gene", "name", "a", "list", "of", "mis", "matches", "found", "betreewn", "subject", "and", "query", "of", "this", "gene", "the", "dictionary", "of", "known", "mutation", "in", "the", "point", "finder", "database", "and", ...
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/pointfinder/PointFinder.py#L933-L1046
pymacaron/pymacaron-core
pymacaron_core/swagger/apipool.py
ApiPool.merge
def merge(self): """Try merging all the bravado_core models across all loaded APIs. If duplicates occur, use the same bravado-core model to represent each, so bravado-core won't treat them as different models when passing them from one PyMacaron client stub to an other or when returning ...
python
def merge(self): """Try merging all the bravado_core models across all loaded APIs. If duplicates occur, use the same bravado-core model to represent each, so bravado-core won't treat them as different models when passing them from one PyMacaron client stub to an other or when returning ...
[ "def", "merge", "(", "self", ")", ":", "# The sole purpose of this method is to trick isinstance to return true", "# on model_values of the same kind but different apis/specs at:", "# https://github.com/Yelp/bravado-core/blob/4840a6e374611bb917226157b5948ee263913abc/bravado_core/marshal.py#L160", ...
Try merging all the bravado_core models across all loaded APIs. If duplicates occur, use the same bravado-core model to represent each, so bravado-core won't treat them as different models when passing them from one PyMacaron client stub to an other or when returning them via the PyMacar...
[ "Try", "merging", "all", "the", "bravado_core", "models", "across", "all", "loaded", "APIs", ".", "If", "duplicates", "occur", "use", "the", "same", "bravado", "-", "core", "model", "to", "represent", "each", "so", "bravado", "-", "core", "won", "t", "trea...
train
https://github.com/pymacaron/pymacaron-core/blob/95070a39ed7065a84244ff5601fea4d54cc72b66/pymacaron_core/swagger/apipool.py#L65-L102
pymacaron/pymacaron-core
pymacaron_core/swagger/apipool.py
ApiPool._cmp_models
def _cmp_models(self, m1, m2): """Compare two models from different swagger APIs and tell if they are equal (return 0), or not (return != 0)""" # Don't alter m1/m2 by mistake m1 = copy.deepcopy(m1) m2 = copy.deepcopy(m2) # Remove keys added by bravado-core def _...
python
def _cmp_models(self, m1, m2): """Compare two models from different swagger APIs and tell if they are equal (return 0), or not (return != 0)""" # Don't alter m1/m2 by mistake m1 = copy.deepcopy(m1) m2 = copy.deepcopy(m2) # Remove keys added by bravado-core def _...
[ "def", "_cmp_models", "(", "self", ",", "m1", ",", "m2", ")", ":", "# Don't alter m1/m2 by mistake", "m1", "=", "copy", ".", "deepcopy", "(", "m1", ")", "m2", "=", "copy", ".", "deepcopy", "(", "m2", ")", "# Remove keys added by bravado-core", "def", "_clean...
Compare two models from different swagger APIs and tell if they are equal (return 0), or not (return != 0)
[ "Compare", "two", "models", "from", "different", "swagger", "APIs", "and", "tell", "if", "they", "are", "equal", "(", "return", "0", ")", "or", "not", "(", "return", "!", "=", "0", ")" ]
train
https://github.com/pymacaron/pymacaron-core/blob/95070a39ed7065a84244ff5601fea4d54cc72b66/pymacaron_core/swagger/apipool.py#L105-L128
saltant-org/saltant-py
saltant/models/base_task_type.py
BaseTaskType.sync
def sync(self): """Sync this model with latest data on the saltant server. Note that in addition to returning the updated object, it also updates the existing object. Returns: :class:`saltant.models.base_task_type.BaseTaskType`: This task type instance after...
python
def sync(self): """Sync this model with latest data on the saltant server. Note that in addition to returning the updated object, it also updates the existing object. Returns: :class:`saltant.models.base_task_type.BaseTaskType`: This task type instance after...
[ "def", "sync", "(", "self", ")", ":", "self", "=", "self", ".", "manager", ".", "get", "(", "id", "=", "self", ".", "id", ")", "return", "self" ]
Sync this model with latest data on the saltant server. Note that in addition to returning the updated object, it also updates the existing object. Returns: :class:`saltant.models.base_task_type.BaseTaskType`: This task type instance after syncing.
[ "Sync", "this", "model", "with", "latest", "data", "on", "the", "saltant", "server", "." ]
train
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/base_task_type.py#L82-L94
saltant-org/saltant-py
saltant/models/base_task_type.py
BaseTaskTypeManager.create
def create( self, name, command_to_run, description="", environment_variables=None, required_arguments=None, required_arguments_default_values=None, extra_data_to_post=None, ): """Create a task type. Args: name (str): The n...
python
def create( self, name, command_to_run, description="", environment_variables=None, required_arguments=None, required_arguments_default_values=None, extra_data_to_post=None, ): """Create a task type. Args: name (str): The n...
[ "def", "create", "(", "self", ",", "name", ",", "command_to_run", ",", "description", "=", "\"\"", ",", "environment_variables", "=", "None", ",", "required_arguments", "=", "None", ",", "required_arguments_default_values", "=", "None", ",", "extra_data_to_post", ...
Create a task type. Args: name (str): The name of the task. command_to_run (str): The command to run to execute the task. description (str, optional): The description of the task type. environment_variables (list, optional): The environment variab...
[ "Create", "a", "task", "type", "." ]
train
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/base_task_type.py#L160-L229
saltant-org/saltant-py
saltant/models/base_task_type.py
BaseTaskTypeManager.put
def put( self, id, name, description, command_to_run, environment_variables, required_arguments, required_arguments_default_values, extra_data_to_put=None, ): """Updates a task type on the saltant server. Args: id (...
python
def put( self, id, name, description, command_to_run, environment_variables, required_arguments, required_arguments_default_values, extra_data_to_put=None, ): """Updates a task type on the saltant server. Args: id (...
[ "def", "put", "(", "self", ",", "id", ",", "name", ",", "description", ",", "command_to_run", ",", "environment_variables", ",", "required_arguments", ",", "required_arguments_default_values", ",", "extra_data_to_put", "=", "None", ",", ")", ":", "# Update the objec...
Updates a task type on the saltant server. Args: id (int): The ID of the task type. name (str): The name of the task type. description (str): The description of the task type. command_to_run (str): The command to run to execute the task. environment_v...
[ "Updates", "a", "task", "type", "on", "the", "saltant", "server", "." ]
train
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/base_task_type.py#L231-L292
saltant-org/saltant-py
saltant/models/base_task_type.py
BaseTaskTypeManager.response_data_to_model_instance
def response_data_to_model_instance(self, response_data): """Convert response data to a task type model. Args: response_data (dict): The data from the request's response. Returns: :class:`saltant.models.base_task_type.BaseTaskType`: A model instance repr...
python
def response_data_to_model_instance(self, response_data): """Convert response data to a task type model. Args: response_data (dict): The data from the request's response. Returns: :class:`saltant.models.base_task_type.BaseTaskType`: A model instance repr...
[ "def", "response_data_to_model_instance", "(", "self", ",", "response_data", ")", ":", "# Coerce datetime strings into datetime objects", "response_data", "[", "\"datetime_created\"", "]", "=", "dateutil", ".", "parser", ".", "parse", "(", "response_data", "[", "\"datetim...
Convert response data to a task type model. Args: response_data (dict): The data from the request's response. Returns: :class:`saltant.models.base_task_type.BaseTaskType`: A model instance representing the task type from the reponse data.
[ "Convert", "response", "data", "to", "a", "task", "type", "model", "." ]
train
https://github.com/saltant-org/saltant-py/blob/bf3bdbc4ec9c772c7f621f8bd6a76c5932af68be/saltant/models/base_task_type.py#L294-L313
crdoconnor/pathquery
hitch/key.py
regression
def regression(): """ Run regression testing - lint and then run all tests. """ # HACK: Start using hitchbuildpy to get around this. Command("touch", DIR.project.joinpath("pathquery", "__init__.py").abspath()).run() storybook = _storybook({}).only_uninherited() #storybook.with_params(**{"pyt...
python
def regression(): """ Run regression testing - lint and then run all tests. """ # HACK: Start using hitchbuildpy to get around this. Command("touch", DIR.project.joinpath("pathquery", "__init__.py").abspath()).run() storybook = _storybook({}).only_uninherited() #storybook.with_params(**{"pyt...
[ "def", "regression", "(", ")", ":", "# HACK: Start using hitchbuildpy to get around this.", "Command", "(", "\"touch\"", ",", "DIR", ".", "project", ".", "joinpath", "(", "\"pathquery\"", ",", "\"__init__.py\"", ")", ".", "abspath", "(", ")", ")", ".", "run", "(...
Run regression testing - lint and then run all tests.
[ "Run", "regression", "testing", "-", "lint", "and", "then", "run", "all", "tests", "." ]
train
https://github.com/crdoconnor/pathquery/blob/4905fef27fc666ea4511eb0eee5098f754bb52ed/hitch/key.py#L291-L302
crdoconnor/pathquery
hitch/key.py
deploy
def deploy(version): """ Deploy to pypi as specified version. """ NAME = "pathquery" git = Command("git").in_dir(DIR.project) version_file = DIR.project.joinpath("VERSION") old_version = version_file.bytes().decode('utf8') if version_file.bytes().decode("utf8") != version: DIR.pr...
python
def deploy(version): """ Deploy to pypi as specified version. """ NAME = "pathquery" git = Command("git").in_dir(DIR.project) version_file = DIR.project.joinpath("VERSION") old_version = version_file.bytes().decode('utf8') if version_file.bytes().decode("utf8") != version: DIR.pr...
[ "def", "deploy", "(", "version", ")", ":", "NAME", "=", "\"pathquery\"", "git", "=", "Command", "(", "\"git\"", ")", ".", "in_dir", "(", "DIR", ".", "project", ")", "version_file", "=", "DIR", ".", "project", ".", "joinpath", "(", "\"VERSION\"", ")", "...
Deploy to pypi as specified version.
[ "Deploy", "to", "pypi", "as", "specified", "version", "." ]
train
https://github.com/crdoconnor/pathquery/blob/4905fef27fc666ea4511eb0eee5098f754bb52ed/hitch/key.py#L308-L341
crdoconnor/pathquery
hitch/key.py
hvenvup
def hvenvup(package, directory): """ Install a new version of a package in the hitch venv. """ pip = Command(DIR.gen.joinpath("hvenv", "bin", "pip")) pip("uninstall", package, "-y").run() pip("install", DIR.project.joinpath(directory).abspath()).run()
python
def hvenvup(package, directory): """ Install a new version of a package in the hitch venv. """ pip = Command(DIR.gen.joinpath("hvenv", "bin", "pip")) pip("uninstall", package, "-y").run() pip("install", DIR.project.joinpath(directory).abspath()).run()
[ "def", "hvenvup", "(", "package", ",", "directory", ")", ":", "pip", "=", "Command", "(", "DIR", ".", "gen", ".", "joinpath", "(", "\"hvenv\"", ",", "\"bin\"", ",", "\"pip\"", ")", ")", "pip", "(", "\"uninstall\"", ",", "package", ",", "\"-y\"", ")", ...
Install a new version of a package in the hitch venv.
[ "Install", "a", "new", "version", "of", "a", "package", "in", "the", "hitch", "venv", "." ]
train
https://github.com/crdoconnor/pathquery/blob/4905fef27fc666ea4511eb0eee5098f754bb52ed/hitch/key.py#L352-L358
crdoconnor/pathquery
hitch/key.py
Engine.set_up
def set_up(self): """Set up your applications and the test environment.""" self.path.state = self.path.gen.joinpath("state") if self.path.state.exists(): self.path.state.rmtree(ignore_errors=True) self.path.state.mkdir() if self.path.gen.joinpath("q").exists(): ...
python
def set_up(self): """Set up your applications and the test environment.""" self.path.state = self.path.gen.joinpath("state") if self.path.state.exists(): self.path.state.rmtree(ignore_errors=True) self.path.state.mkdir() if self.path.gen.joinpath("q").exists(): ...
[ "def", "set_up", "(", "self", ")", ":", "self", ".", "path", ".", "state", "=", "self", ".", "path", ".", "gen", ".", "joinpath", "(", "\"state\"", ")", "if", "self", ".", "path", ".", "state", ".", "exists", "(", ")", ":", "self", ".", "path", ...
Set up your applications and the test environment.
[ "Set", "up", "your", "applications", "and", "the", "test", "environment", "." ]
train
https://github.com/crdoconnor/pathquery/blob/4905fef27fc666ea4511eb0eee5098f754bb52ed/hitch/key.py#L38-L86
beczkowb/csvparser
csvparser/parser.py
Parser.is_valid
def is_valid(self): """ Validates single instance. Returns boolean value and store errors in self.errors """ self.errors = [] for field in self.get_all_field_names_declared_by_user(): getattr(type(self), field).is_valid(self, type(self), field) field_erro...
python
def is_valid(self): """ Validates single instance. Returns boolean value and store errors in self.errors """ self.errors = [] for field in self.get_all_field_names_declared_by_user(): getattr(type(self), field).is_valid(self, type(self), field) field_erro...
[ "def", "is_valid", "(", "self", ")", ":", "self", ".", "errors", "=", "[", "]", "for", "field", "in", "self", ".", "get_all_field_names_declared_by_user", "(", ")", ":", "getattr", "(", "type", "(", "self", ")", ",", "field", ")", ".", "is_valid", "(",...
Validates single instance. Returns boolean value and store errors in self.errors
[ "Validates", "single", "instance", ".", "Returns", "boolean", "value", "and", "store", "errors", "in", "self", ".", "errors" ]
train
https://github.com/beczkowb/csvparser/blob/f9f9bd37e10e3c1c223d559194367b25900a822a/csvparser/parser.py#L41-L52
OLC-Bioinformatics/sipprverse
method.py
Method.main
def main(self): """ Run the analyses using the inputted values for forward and reverse read length. However, if not all strains pass the quality thresholds, continue to periodically run the analyses on these incomplete strains until either all strains are complete, or the sequencing run ...
python
def main(self): """ Run the analyses using the inputted values for forward and reverse read length. However, if not all strains pass the quality thresholds, continue to periodically run the analyses on these incomplete strains until either all strains are complete, or the sequencing run ...
[ "def", "main", "(", "self", ")", ":", "logging", ".", "info", "(", "'Starting {} analysis pipeline'", ".", "format", "(", "self", ".", "analysistype", ")", ")", "self", ".", "createobjects", "(", ")", "# Run the genesipping analyses", "self", ".", "methods", "...
Run the analyses using the inputted values for forward and reverse read length. However, if not all strains pass the quality thresholds, continue to periodically run the analyses on these incomplete strains until either all strains are complete, or the sequencing run is finished
[ "Run", "the", "analyses", "using", "the", "inputted", "values", "for", "forward", "and", "reverse", "read", "length", ".", "However", "if", "not", "all", "strains", "pass", "the", "quality", "thresholds", "continue", "to", "periodically", "run", "the", "analys...
train
https://github.com/OLC-Bioinformatics/sipprverse/blob/d4f10cdf8e1a39dac0953db61c21c97efc6006de/method.py#L25-L44