repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
ArangoDB-Community/pyArango
pyArango/graph.py
Graph.deleteEdge
def deleteEdge(self, edge, waitForSync = False) : """removes an edge from the graph""" url = "%s/edge/%s" % (self.URL, edge._id) r = self.connection.session.delete(url, params = {'waitForSync' : waitForSync}) if r.status_code == 200 or r.status_code == 202 : return True ...
python
def deleteEdge(self, edge, waitForSync = False) : """removes an edge from the graph""" url = "%s/edge/%s" % (self.URL, edge._id) r = self.connection.session.delete(url, params = {'waitForSync' : waitForSync}) if r.status_code == 200 or r.status_code == 202 : return True ...
[ "def", "deleteEdge", "(", "self", ",", "edge", ",", "waitForSync", "=", "False", ")", ":", "url", "=", "\"%s/edge/%s\"", "%", "(", "self", ".", "URL", ",", "edge", ".", "_id", ")", "r", "=", "self", ".", "connection", ".", "session", ".", "delete", ...
removes an edge from the graph
[ "removes", "an", "edge", "from", "the", "graph" ]
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/graph.py#L196-L202
train
ArangoDB-Community/pyArango
pyArango/collection.py
DocumentCache.delete
def delete(self, _key) : "removes a document from the cache" try : doc = self.cacheStore[_key] doc.prev.nextDoc = doc.nextDoc doc.nextDoc.prev = doc.prev del(self.cacheStore[_key]) except KeyError : raise KeyError("Document with _key %s...
python
def delete(self, _key) : "removes a document from the cache" try : doc = self.cacheStore[_key] doc.prev.nextDoc = doc.nextDoc doc.nextDoc.prev = doc.prev del(self.cacheStore[_key]) except KeyError : raise KeyError("Document with _key %s...
[ "def", "delete", "(", "self", ",", "_key", ")", ":", "\"removes a document from the cache\"", "try", ":", "doc", "=", "self", ".", "cacheStore", "[", "_key", "]", "doc", ".", "prev", ".", "nextDoc", "=", "doc", ".", "nextDoc", "doc", ".", "nextDoc", ".",...
removes a document from the cache
[ "removes", "a", "document", "from", "the", "cache" ]
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L73-L81
train
ArangoDB-Community/pyArango
pyArango/collection.py
DocumentCache.getChain
def getChain(self) : "returns a list of keys representing the chain of documents" l = [] h = self.head while h : l.append(h._key) h = h.nextDoc return l
python
def getChain(self) : "returns a list of keys representing the chain of documents" l = [] h = self.head while h : l.append(h._key) h = h.nextDoc return l
[ "def", "getChain", "(", "self", ")", ":", "\"returns a list of keys representing the chain of documents\"", "l", "=", "[", "]", "h", "=", "self", ".", "head", "while", "h", ":", "l", ".", "append", "(", "h", ".", "_key", ")", "h", "=", "h", ".", "nextDoc...
returns a list of keys representing the chain of documents
[ "returns", "a", "list", "of", "keys", "representing", "the", "chain", "of", "documents" ]
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L83-L90
train
ArangoDB-Community/pyArango
pyArango/collection.py
Field.validate
def validate(self, value) : """checks the validity of 'value' given the lits of validators""" for v in self.validators : v.validate(value) return True
python
def validate(self, value) : """checks the validity of 'value' given the lits of validators""" for v in self.validators : v.validate(value) return True
[ "def", "validate", "(", "self", ",", "value", ")", ":", "for", "v", "in", "self", ".", "validators", ":", "v", ".", "validate", "(", "value", ")", "return", "True" ]
checks the validity of 'value' given the lits of validators
[ "checks", "the", "validity", "of", "value", "given", "the", "lits", "of", "validators" ]
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L121-L125
train
ArangoDB-Community/pyArango
pyArango/collection.py
Collection_metaclass.getCollectionClass
def getCollectionClass(cls, name) : """Return the class object of a collection given its 'name'""" try : return cls.collectionClasses[name] except KeyError : raise KeyError( "There is no Collection Class of type: '%s'; currently supported values: [%s]" % (name, ', '.join(...
python
def getCollectionClass(cls, name) : """Return the class object of a collection given its 'name'""" try : return cls.collectionClasses[name] except KeyError : raise KeyError( "There is no Collection Class of type: '%s'; currently supported values: [%s]" % (name, ', '.join(...
[ "def", "getCollectionClass", "(", "cls", ",", "name", ")", ":", "try", ":", "return", "cls", ".", "collectionClasses", "[", "name", "]", "except", "KeyError", ":", "raise", "KeyError", "(", "\"There is no Collection Class of type: '%s'; currently supported values: [%s]\...
Return the class object of a collection given its 'name
[ "Return", "the", "class", "object", "of", "a", "collection", "given", "its", "name" ]
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L168-L173
train
ArangoDB-Community/pyArango
pyArango/collection.py
Collection_metaclass.isDocumentCollection
def isDocumentCollection(cls, name) : """return true or false wether 'name' is the name of a document collection.""" try : col = cls.getCollectionClass(name) return issubclass(col, Collection) except KeyError : return False
python
def isDocumentCollection(cls, name) : """return true or false wether 'name' is the name of a document collection.""" try : col = cls.getCollectionClass(name) return issubclass(col, Collection) except KeyError : return False
[ "def", "isDocumentCollection", "(", "cls", ",", "name", ")", ":", "try", ":", "col", "=", "cls", ".", "getCollectionClass", "(", "name", ")", "return", "issubclass", "(", "col", ",", "Collection", ")", "except", "KeyError", ":", "return", "False" ]
return true or false wether 'name' is the name of a document collection.
[ "return", "true", "or", "false", "wether", "name", "is", "the", "name", "of", "a", "document", "collection", "." ]
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L181-L187
train
ArangoDB-Community/pyArango
pyArango/collection.py
Collection_metaclass.isEdgeCollection
def isEdgeCollection(cls, name) : """return true or false wether 'name' is the name of an edge collection.""" try : col = cls.getCollectionClass(name) return issubclass(col, Edges) except KeyError : return False
python
def isEdgeCollection(cls, name) : """return true or false wether 'name' is the name of an edge collection.""" try : col = cls.getCollectionClass(name) return issubclass(col, Edges) except KeyError : return False
[ "def", "isEdgeCollection", "(", "cls", ",", "name", ")", ":", "try", ":", "col", "=", "cls", ".", "getCollectionClass", "(", "name", ")", "return", "issubclass", "(", "col", ",", "Edges", ")", "except", "KeyError", ":", "return", "False" ]
return true or false wether 'name' is the name of an edge collection.
[ "return", "true", "or", "false", "wether", "name", "is", "the", "name", "of", "an", "edge", "collection", "." ]
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L190-L196
train
ArangoDB-Community/pyArango
pyArango/collection.py
Collection.getIndexes
def getIndexes(self) : """Fills self.indexes with all the indexes associates with the collection and returns it""" url = "%s/index" % self.database.URL r = self.connection.session.get(url, params = {"collection": self.name}) data = r.json() for ind in data["indexes"] : ...
python
def getIndexes(self) : """Fills self.indexes with all the indexes associates with the collection and returns it""" url = "%s/index" % self.database.URL r = self.connection.session.get(url, params = {"collection": self.name}) data = r.json() for ind in data["indexes"] : ...
[ "def", "getIndexes", "(", "self", ")", ":", "url", "=", "\"%s/index\"", "%", "self", ".", "database", ".", "URL", "r", "=", "self", ".", "connection", ".", "session", ".", "get", "(", "url", ",", "params", "=", "{", "\"collection\"", ":", "self", "."...
Fills self.indexes with all the indexes associates with the collection and returns it
[ "Fills", "self", ".", "indexes", "with", "all", "the", "indexes", "associates", "with", "the", "collection", "and", "returns", "it" ]
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L265-L273
train
ArangoDB-Community/pyArango
pyArango/collection.py
Collection.delete
def delete(self) : """deletes the collection from the database""" r = self.connection.session.delete(self.URL) data = r.json() if not r.status_code == 200 or data["error"] : raise DeletionError(data["errorMessage"], data)
python
def delete(self) : """deletes the collection from the database""" r = self.connection.session.delete(self.URL) data = r.json() if not r.status_code == 200 or data["error"] : raise DeletionError(data["errorMessage"], data)
[ "def", "delete", "(", "self", ")", ":", "r", "=", "self", ".", "connection", ".", "session", ".", "delete", "(", "self", ".", "URL", ")", "data", "=", "r", ".", "json", "(", ")", "if", "not", "r", ".", "status_code", "==", "200", "or", "data", ...
deletes the collection from the database
[ "deletes", "the", "collection", "from", "the", "database" ]
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L283-L288
train
ArangoDB-Community/pyArango
pyArango/collection.py
Collection.createDocument
def createDocument(self, initDict = None) : """create and returns a document populated with the defaults or with the values in initDict""" if initDict is not None : return self.createDocument_(initDict) else : if self._validation["on_load"] : self._validat...
python
def createDocument(self, initDict = None) : """create and returns a document populated with the defaults or with the values in initDict""" if initDict is not None : return self.createDocument_(initDict) else : if self._validation["on_load"] : self._validat...
[ "def", "createDocument", "(", "self", ",", "initDict", "=", "None", ")", ":", "if", "initDict", "is", "not", "None", ":", "return", "self", ".", "createDocument_", "(", "initDict", ")", "else", ":", "if", "self", ".", "_validation", "[", "\"on_load\"", "...
create and returns a document populated with the defaults or with the values in initDict
[ "create", "and", "returns", "a", "document", "populated", "with", "the", "defaults", "or", "with", "the", "values", "in", "initDict" ]
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L290-L300
train
ArangoDB-Community/pyArango
pyArango/collection.py
Collection.createDocument_
def createDocument_(self, initDict = None) : "create and returns a completely empty document or one populated with initDict" if initDict is None : initV = {} else : initV = initDict return self.documentClass(self, initV)
python
def createDocument_(self, initDict = None) : "create and returns a completely empty document or one populated with initDict" if initDict is None : initV = {} else : initV = initDict return self.documentClass(self, initV)
[ "def", "createDocument_", "(", "self", ",", "initDict", "=", "None", ")", ":", "\"create and returns a completely empty document or one populated with initDict\"", "if", "initDict", "is", "None", ":", "initV", "=", "{", "}", "else", ":", "initV", "=", "initDict", "r...
create and returns a completely empty document or one populated with initDict
[ "create", "and", "returns", "a", "completely", "empty", "document", "or", "one", "populated", "with", "initDict" ]
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L302-L309
train
ArangoDB-Community/pyArango
pyArango/collection.py
Collection.ensureHashIndex
def ensureHashIndex(self, fields, unique = False, sparse = True, deduplicate = False) : """Creates a hash index if it does not already exist, and returns it""" data = { "type" : "hash", "fields" : fields, "unique" : unique, "sparse" : sparse, "...
python
def ensureHashIndex(self, fields, unique = False, sparse = True, deduplicate = False) : """Creates a hash index if it does not already exist, and returns it""" data = { "type" : "hash", "fields" : fields, "unique" : unique, "sparse" : sparse, "...
[ "def", "ensureHashIndex", "(", "self", ",", "fields", ",", "unique", "=", "False", ",", "sparse", "=", "True", ",", "deduplicate", "=", "False", ")", ":", "data", "=", "{", "\"type\"", ":", "\"hash\"", ",", "\"fields\"", ":", "fields", ",", "\"unique\"",...
Creates a hash index if it does not already exist, and returns it
[ "Creates", "a", "hash", "index", "if", "it", "does", "not", "already", "exist", "and", "returns", "it" ]
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L333-L344
train
ArangoDB-Community/pyArango
pyArango/collection.py
Collection.ensureGeoIndex
def ensureGeoIndex(self, fields) : """Creates a geo index if it does not already exist, and returns it""" data = { "type" : "geo", "fields" : fields, } ind = Index(self, creationData = data) self.indexes["geo"][ind.infos["id"]] = ind return ind
python
def ensureGeoIndex(self, fields) : """Creates a geo index if it does not already exist, and returns it""" data = { "type" : "geo", "fields" : fields, } ind = Index(self, creationData = data) self.indexes["geo"][ind.infos["id"]] = ind return ind
[ "def", "ensureGeoIndex", "(", "self", ",", "fields", ")", ":", "data", "=", "{", "\"type\"", ":", "\"geo\"", ",", "\"fields\"", ":", "fields", ",", "}", "ind", "=", "Index", "(", "self", ",", "creationData", "=", "data", ")", "self", ".", "indexes", ...
Creates a geo index if it does not already exist, and returns it
[ "Creates", "a", "geo", "index", "if", "it", "does", "not", "already", "exist", "and", "returns", "it" ]
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L359-L367
train
ArangoDB-Community/pyArango
pyArango/collection.py
Collection.ensureFulltextIndex
def ensureFulltextIndex(self, fields, minLength = None) : """Creates a fulltext index if it does not already exist, and returns it""" data = { "type" : "fulltext", "fields" : fields, } if minLength is not None : data["minLength"] = minLength i...
python
def ensureFulltextIndex(self, fields, minLength = None) : """Creates a fulltext index if it does not already exist, and returns it""" data = { "type" : "fulltext", "fields" : fields, } if minLength is not None : data["minLength"] = minLength i...
[ "def", "ensureFulltextIndex", "(", "self", ",", "fields", ",", "minLength", "=", "None", ")", ":", "data", "=", "{", "\"type\"", ":", "\"fulltext\"", ",", "\"fields\"", ":", "fields", ",", "}", "if", "minLength", "is", "not", "None", ":", "data", "[", ...
Creates a fulltext index if it does not already exist, and returns it
[ "Creates", "a", "fulltext", "index", "if", "it", "does", "not", "already", "exist", "and", "returns", "it" ]
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L369-L380
train
ArangoDB-Community/pyArango
pyArango/collection.py
Collection.validatePrivate
def validatePrivate(self, field, value) : """validate a private field value""" if field not in self.arangoPrivates : raise ValueError("%s is not a private field of collection %s" % (field, self)) if field in self._fields : self._fields[field].validate(value) retu...
python
def validatePrivate(self, field, value) : """validate a private field value""" if field not in self.arangoPrivates : raise ValueError("%s is not a private field of collection %s" % (field, self)) if field in self._fields : self._fields[field].validate(value) retu...
[ "def", "validatePrivate", "(", "self", ",", "field", ",", "value", ")", ":", "if", "field", "not", "in", "self", ".", "arangoPrivates", ":", "raise", "ValueError", "(", "\"%s is not a private field of collection %s\"", "%", "(", "field", ",", "self", ")", ")",...
validate a private field value
[ "validate", "a", "private", "field", "value" ]
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L383-L390
train
ArangoDB-Community/pyArango
pyArango/collection.py
Collection.simpleQuery
def simpleQuery(self, queryType, rawResults = False, **queryArgs) : """General interface for simple queries. queryType can be something like 'all', 'by-example' etc... everything is in the arango doc. If rawResults, the query will return dictionaries instead of Document objetcs. """ retu...
python
def simpleQuery(self, queryType, rawResults = False, **queryArgs) : """General interface for simple queries. queryType can be something like 'all', 'by-example' etc... everything is in the arango doc. If rawResults, the query will return dictionaries instead of Document objetcs. """ retu...
[ "def", "simpleQuery", "(", "self", ",", "queryType", ",", "rawResults", "=", "False", ",", "**", "queryArgs", ")", ":", "return", "SimpleQuery", "(", "self", ",", "queryType", ",", "rawResults", ",", "**", "queryArgs", ")" ]
General interface for simple queries. queryType can be something like 'all', 'by-example' etc... everything is in the arango doc. If rawResults, the query will return dictionaries instead of Document objetcs.
[ "General", "interface", "for", "simple", "queries", ".", "queryType", "can", "be", "something", "like", "all", "by", "-", "example", "etc", "...", "everything", "is", "in", "the", "arango", "doc", ".", "If", "rawResults", "the", "query", "will", "return", ...
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L486-L490
train
ArangoDB-Community/pyArango
pyArango/collection.py
Collection.action
def action(self, method, action, **params) : """a generic fct for interacting everything that doesn't have an assigned fct""" fct = getattr(self.connection.session, method.lower()) r = fct(self.URL + "/" + action, params = params) return r.json()
python
def action(self, method, action, **params) : """a generic fct for interacting everything that doesn't have an assigned fct""" fct = getattr(self.connection.session, method.lower()) r = fct(self.URL + "/" + action, params = params) return r.json()
[ "def", "action", "(", "self", ",", "method", ",", "action", ",", "**", "params", ")", ":", "fct", "=", "getattr", "(", "self", ".", "connection", ".", "session", ",", "method", ".", "lower", "(", ")", ")", "r", "=", "fct", "(", "self", ".", "URL"...
a generic fct for interacting everything that doesn't have an assigned fct
[ "a", "generic", "fct", "for", "interacting", "everything", "that", "doesn", "t", "have", "an", "assigned", "fct" ]
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L492-L496
train
ArangoDB-Community/pyArango
pyArango/collection.py
Collection.bulkSave
def bulkSave(self, docs, onDuplicate="error", **params) : """Parameter docs must be either an iterrable of documents or dictionnaries. This function will return the number of documents, created and updated, and will raise an UpdateError exception if there's at least one error. params are any par...
python
def bulkSave(self, docs, onDuplicate="error", **params) : """Parameter docs must be either an iterrable of documents or dictionnaries. This function will return the number of documents, created and updated, and will raise an UpdateError exception if there's at least one error. params are any par...
[ "def", "bulkSave", "(", "self", ",", "docs", ",", "onDuplicate", "=", "\"error\"", ",", "**", "params", ")", ":", "payload", "=", "[", "]", "for", "d", "in", "docs", ":", "if", "type", "(", "d", ")", "is", "dict", ":", "payload", ".", "append", "...
Parameter docs must be either an iterrable of documents or dictionnaries. This function will return the number of documents, created and updated, and will raise an UpdateError exception if there's at least one error. params are any parameters from arango's documentation
[ "Parameter", "docs", "must", "be", "either", "an", "iterrable", "of", "documents", "or", "dictionnaries", ".", "This", "function", "will", "return", "the", "number", "of", "documents", "created", "and", "updated", "and", "will", "raise", "an", "UpdateError", "...
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L498-L528
train
ArangoDB-Community/pyArango
pyArango/collection.py
Edges.getEdges
def getEdges(self, vertex, inEdges = True, outEdges = True, rawResults = False) : """returns in, out, or both edges liked to a given document. vertex can be either a Document object or a string for an _id. If rawResults a arango results will be return as fetched, if false, will return a liste of Edge ob...
python
def getEdges(self, vertex, inEdges = True, outEdges = True, rawResults = False) : """returns in, out, or both edges liked to a given document. vertex can be either a Document object or a string for an _id. If rawResults a arango results will be return as fetched, if false, will return a liste of Edge ob...
[ "def", "getEdges", "(", "self", ",", "vertex", ",", "inEdges", "=", "True", ",", "outEdges", "=", "True", ",", "rawResults", "=", "False", ")", ":", "if", "isinstance", "(", "vertex", ",", "Document", ")", ":", "vId", "=", "vertex", ".", "_id", "elif...
returns in, out, or both edges liked to a given document. vertex can be either a Document object or a string for an _id. If rawResults a arango results will be return as fetched, if false, will return a liste of Edge objects
[ "returns", "in", "out", "or", "both", "edges", "liked", "to", "a", "given", "document", ".", "vertex", "can", "be", "either", "a", "Document", "object", "or", "a", "string", "for", "an", "_id", ".", "If", "rawResults", "a", "arango", "results", "will", ...
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/collection.py#L695-L726
train
ArangoDB-Community/pyArango
pyArango/database.py
Database.reloadCollections
def reloadCollections(self) : "reloads the collection list." r = self.connection.session.get(self.collectionsURL) data = r.json() if r.status_code == 200 : self.collections = {} for colData in data["result"] : colName = colData['name'] ...
python
def reloadCollections(self) : "reloads the collection list." r = self.connection.session.get(self.collectionsURL) data = r.json() if r.status_code == 200 : self.collections = {} for colData in data["result"] : colName = colData['name'] ...
[ "def", "reloadCollections", "(", "self", ")", ":", "\"reloads the collection list.\"", "r", "=", "self", ".", "connection", ".", "session", ".", "get", "(", "self", ".", "collectionsURL", ")", "data", "=", "r", ".", "json", "(", ")", "if", "r", ".", "sta...
reloads the collection list.
[ "reloads", "the", "collection", "list", "." ]
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/database.py#L36-L62
train
ArangoDB-Community/pyArango
pyArango/database.py
Database.reloadGraphs
def reloadGraphs(self) : "reloads the graph list" r = self.connection.session.get(self.graphsURL) data = r.json() if r.status_code == 200 : self.graphs = {} for graphData in data["graphs"] : try : self.graphs[graphData["_key"]] ...
python
def reloadGraphs(self) : "reloads the graph list" r = self.connection.session.get(self.graphsURL) data = r.json() if r.status_code == 200 : self.graphs = {} for graphData in data["graphs"] : try : self.graphs[graphData["_key"]] ...
[ "def", "reloadGraphs", "(", "self", ")", ":", "\"reloads the graph list\"", "r", "=", "self", ".", "connection", ".", "session", ".", "get", "(", "self", ".", "graphsURL", ")", "data", "=", "r", ".", "json", "(", ")", "if", "r", ".", "status_code", "==...
reloads the graph list
[ "reloads", "the", "graph", "list" ]
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/database.py#L64-L76
train
ArangoDB-Community/pyArango
pyArango/database.py
Database.createGraph
def createGraph(self, name, createCollections = True, isSmart = False, numberOfShards = None, smartGraphAttribute = None) : """Creates a graph and returns it. 'name' must be the name of a class inheriting from Graph. Checks will be performed to make sure that every collection mentionned in the edges def...
python
def createGraph(self, name, createCollections = True, isSmart = False, numberOfShards = None, smartGraphAttribute = None) : """Creates a graph and returns it. 'name' must be the name of a class inheriting from Graph. Checks will be performed to make sure that every collection mentionned in the edges def...
[ "def", "createGraph", "(", "self", ",", "name", ",", "createCollections", "=", "True", ",", "isSmart", "=", "False", ",", "numberOfShards", "=", "None", ",", "smartGraphAttribute", "=", "None", ")", ":", "def", "_checkCollectionList", "(", "lst", ")", ":", ...
Creates a graph and returns it. 'name' must be the name of a class inheriting from Graph. Checks will be performed to make sure that every collection mentionned in the edges definition exist. Raises a ValueError in case of a non-existing collection.
[ "Creates", "a", "graph", "and", "returns", "it", ".", "name", "must", "be", "the", "name", "of", "a", "class", "inheriting", "from", "Graph", ".", "Checks", "will", "be", "performed", "to", "make", "sure", "that", "every", "collection", "mentionned", "in",...
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/database.py#L129-L179
train
ArangoDB-Community/pyArango
pyArango/database.py
Database.validateAQLQuery
def validateAQLQuery(self, query, bindVars = None, options = None) : "returns the server answer is the query is valid. Raises an AQLQueryError if not" if bindVars is None : bindVars = {} if options is None : options = {} payload = {'query' : query, 'bindVars' : bi...
python
def validateAQLQuery(self, query, bindVars = None, options = None) : "returns the server answer is the query is valid. Raises an AQLQueryError if not" if bindVars is None : bindVars = {} if options is None : options = {} payload = {'query' : query, 'bindVars' : bi...
[ "def", "validateAQLQuery", "(", "self", ",", "query", ",", "bindVars", "=", "None", ",", "options", "=", "None", ")", ":", "\"returns the server answer is the query is valid. Raises an AQLQueryError if not\"", "if", "bindVars", "is", "None", ":", "bindVars", "=", "{",...
returns the server answer is the query is valid. Raises an AQLQueryError if not
[ "returns", "the", "server", "answer", "is", "the", "query", "is", "valid", ".", "Raises", "an", "AQLQueryError", "if", "not" ]
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/database.py#L212-L224
train
ArangoDB-Community/pyArango
pyArango/database.py
Database.transaction
def transaction(self, collections, action, waitForSync = False, lockTimeout = None, params = None) : """Execute a server-side transaction""" payload = { "collections": collections, "action": action, "waitForSync": waitForSync} if lockTimeout is not...
python
def transaction(self, collections, action, waitForSync = False, lockTimeout = None, params = None) : """Execute a server-side transaction""" payload = { "collections": collections, "action": action, "waitForSync": waitForSync} if lockTimeout is not...
[ "def", "transaction", "(", "self", ",", "collections", ",", "action", ",", "waitForSync", "=", "False", ",", "lockTimeout", "=", "None", ",", "params", "=", "None", ")", ":", "payload", "=", "{", "\"collections\"", ":", "collections", ",", "\"action\"", ":...
Execute a server-side transaction
[ "Execute", "a", "server", "-", "side", "transaction" ]
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/database.py#L226-L248
train
ArangoDB-Community/pyArango
pyArango/document.py
DocumentStore.getPatches
def getPatches(self) : """get patches as a dictionary""" if not self.mustValidate : return self.getStore() res = {} res.update(self.patchStore) for k, v in self.subStores.items() : res[k] = v.getPatches() return res
python
def getPatches(self) : """get patches as a dictionary""" if not self.mustValidate : return self.getStore() res = {} res.update(self.patchStore) for k, v in self.subStores.items() : res[k] = v.getPatches() return res
[ "def", "getPatches", "(", "self", ")", ":", "if", "not", "self", ".", "mustValidate", ":", "return", "self", ".", "getStore", "(", ")", "res", "=", "{", "}", "res", ".", "update", "(", "self", ".", "patchStore", ")", "for", "k", ",", "v", "in", "...
get patches as a dictionary
[ "get", "patches", "as", "a", "dictionary" ]
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/document.py#L38-L48
train
ArangoDB-Community/pyArango
pyArango/document.py
DocumentStore.getStore
def getStore(self) : """get the inner store as dictionary""" res = {} res.update(self.store) for k, v in self.subStores.items() : res[k] = v.getStore() return res
python
def getStore(self) : """get the inner store as dictionary""" res = {} res.update(self.store) for k, v in self.subStores.items() : res[k] = v.getStore() return res
[ "def", "getStore", "(", "self", ")", ":", "res", "=", "{", "}", "res", ".", "update", "(", "self", ".", "store", ")", "for", "k", ",", "v", "in", "self", ".", "subStores", ".", "items", "(", ")", ":", "res", "[", "k", "]", "=", "v", ".", "g...
get the inner store as dictionary
[ "get", "the", "inner", "store", "as", "dictionary" ]
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/document.py#L50-L57
train
ArangoDB-Community/pyArango
pyArango/document.py
DocumentStore.validateField
def validateField(self, field) : """Validatie a field""" if field not in self.validators and not self.collection._validation['allow_foreign_fields'] : raise SchemaViolation(self.collection.__class__, field) if field in self.store: if isinstance(self.store[field], Documen...
python
def validateField(self, field) : """Validatie a field""" if field not in self.validators and not self.collection._validation['allow_foreign_fields'] : raise SchemaViolation(self.collection.__class__, field) if field in self.store: if isinstance(self.store[field], Documen...
[ "def", "validateField", "(", "self", ",", "field", ")", ":", "if", "field", "not", "in", "self", ".", "validators", "and", "not", "self", ".", "collection", ".", "_validation", "[", "'allow_foreign_fields'", "]", ":", "raise", "SchemaViolation", "(", "self",...
Validatie a field
[ "Validatie", "a", "field" ]
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/document.py#L59-L80
train
ArangoDB-Community/pyArango
pyArango/document.py
DocumentStore.validate
def validate(self) : """Validate the whole document""" if not self.mustValidate : return True res = {} for field in self.validators.keys() : try : if isinstance(self.validators[field], dict) and field not in self.store : self.s...
python
def validate(self) : """Validate the whole document""" if not self.mustValidate : return True res = {} for field in self.validators.keys() : try : if isinstance(self.validators[field], dict) and field not in self.store : self.s...
[ "def", "validate", "(", "self", ")", ":", "if", "not", "self", ".", "mustValidate", ":", "return", "True", "res", "=", "{", "}", "for", "field", "in", "self", ".", "validators", ".", "keys", "(", ")", ":", "try", ":", "if", "isinstance", "(", "self...
Validate the whole document
[ "Validate", "the", "whole", "document" ]
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/document.py#L82-L101
train
ArangoDB-Community/pyArango
pyArango/document.py
DocumentStore.set
def set(self, dct) : """Set the store using a dictionary""" # if not self.mustValidate : # self.store = dct # self.patchStore = dct # return for field, value in dct.items() : if field not in self.collection.arangoPrivates : if isin...
python
def set(self, dct) : """Set the store using a dictionary""" # if not self.mustValidate : # self.store = dct # self.patchStore = dct # return for field, value in dct.items() : if field not in self.collection.arangoPrivates : if isin...
[ "def", "set", "(", "self", ",", "dct", ")", ":", "for", "field", ",", "value", "in", "dct", ".", "items", "(", ")", ":", "if", "field", "not", "in", "self", ".", "collection", ".", "arangoPrivates", ":", "if", "isinstance", "(", "value", ",", "dict...
Set the store using a dictionary
[ "Set", "the", "store", "using", "a", "dictionary" ]
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/document.py#L103-L120
train
ArangoDB-Community/pyArango
pyArango/document.py
Document.reset
def reset(self, collection, jsonFieldInit = None) : if not jsonFieldInit: jsonFieldInit = {} """replaces the current values in the document by those in jsonFieldInit""" self.collection = collection self.connection = self.collection.connection self.documentsURL = self....
python
def reset(self, collection, jsonFieldInit = None) : if not jsonFieldInit: jsonFieldInit = {} """replaces the current values in the document by those in jsonFieldInit""" self.collection = collection self.connection = self.collection.connection self.documentsURL = self....
[ "def", "reset", "(", "self", ",", "collection", ",", "jsonFieldInit", "=", "None", ")", ":", "if", "not", "jsonFieldInit", ":", "jsonFieldInit", "=", "{", "}", "self", ".", "collection", "=", "collection", "self", ".", "connection", "=", "self", ".", "co...
replaces the current values in the document by those in jsonFieldInit
[ "replaces", "the", "current", "values", "in", "the", "document", "by", "those", "in", "jsonFieldInit" ]
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/document.py#L191-L206
train
ArangoDB-Community/pyArango
pyArango/document.py
Document.validate
def validate(self) : """validate the document""" self._store.validate() for pField in self.collection.arangoPrivates : self.collection.validatePrivate(pField, getattr(self, pField))
python
def validate(self) : """validate the document""" self._store.validate() for pField in self.collection.arangoPrivates : self.collection.validatePrivate(pField, getattr(self, pField))
[ "def", "validate", "(", "self", ")", ":", "self", ".", "_store", ".", "validate", "(", ")", "for", "pField", "in", "self", ".", "collection", ".", "arangoPrivates", ":", "self", ".", "collection", ".", "validatePrivate", "(", "pField", ",", "getattr", "(...
validate the document
[ "validate", "the", "document" ]
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/document.py#L208-L212
train
ArangoDB-Community/pyArango
pyArango/document.py
Document.setPrivates
def setPrivates(self, fieldDict) : """will set self._id, self._rev and self._key field.""" for priv in self.privates : if priv in fieldDict : setattr(self, priv, fieldDict[priv]) else : setattr(self, priv, None) if self._i...
python
def setPrivates(self, fieldDict) : """will set self._id, self._rev and self._key field.""" for priv in self.privates : if priv in fieldDict : setattr(self, priv, fieldDict[priv]) else : setattr(self, priv, None) if self._i...
[ "def", "setPrivates", "(", "self", ",", "fieldDict", ")", ":", "for", "priv", "in", "self", ".", "privates", ":", "if", "priv", "in", "fieldDict", ":", "setattr", "(", "self", ",", "priv", ",", "fieldDict", "[", "priv", "]", ")", "else", ":", "setatt...
will set self._id, self._rev and self._key field.
[ "will", "set", "self", ".", "_id", "self", ".", "_rev", "and", "self", ".", "_key", "field", "." ]
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/document.py#L214-L224
train
ArangoDB-Community/pyArango
pyArango/document.py
Document.patch
def patch(self, keepNull = True, **docArgs) : """Saves the document by only updating the modified fields. The default behaviour concening the keepNull parameter is the opposite of ArangoDB's default, Null values won't be ignored Use docArgs for things such as waitForSync = True""" if se...
python
def patch(self, keepNull = True, **docArgs) : """Saves the document by only updating the modified fields. The default behaviour concening the keepNull parameter is the opposite of ArangoDB's default, Null values won't be ignored Use docArgs for things such as waitForSync = True""" if se...
[ "def", "patch", "(", "self", ",", "keepNull", "=", "True", ",", "**", "docArgs", ")", ":", "if", "self", ".", "URL", "is", "None", ":", "raise", "ValueError", "(", "\"Cannot patch a document that was not previously saved\"", ")", "payload", "=", "self", ".", ...
Saves the document by only updating the modified fields. The default behaviour concening the keepNull parameter is the opposite of ArangoDB's default, Null values won't be ignored Use docArgs for things such as waitForSync = True
[ "Saves", "the", "document", "by", "only", "updating", "the", "modified", "fields", ".", "The", "default", "behaviour", "concening", "the", "keepNull", "parameter", "is", "the", "opposite", "of", "ArangoDB", "s", "default", "Null", "values", "won", "t", "be", ...
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/document.py#L289-L316
train
ArangoDB-Community/pyArango
pyArango/document.py
Document.delete
def delete(self) : "deletes the document from the database" if self.URL is None : raise DeletionError("Can't delete a document that was not saved") r = self.connection.session.delete(self.URL) data = r.json() if (r.status_code != 200 and r.status_code != 202) or 'err...
python
def delete(self) : "deletes the document from the database" if self.URL is None : raise DeletionError("Can't delete a document that was not saved") r = self.connection.session.delete(self.URL) data = r.json() if (r.status_code != 200 and r.status_code != 202) or 'err...
[ "def", "delete", "(", "self", ")", ":", "\"deletes the document from the database\"", "if", "self", ".", "URL", "is", "None", ":", "raise", "DeletionError", "(", "\"Can't delete a document that was not saved\"", ")", "r", "=", "self", ".", "connection", ".", "sessio...
deletes the document from the database
[ "deletes", "the", "document", "from", "the", "database" ]
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/document.py#L318-L329
train
ArangoDB-Community/pyArango
pyArango/document.py
Document.getEdges
def getEdges(self, edges, inEdges = True, outEdges = True, rawResults = False) : """returns in, out, or both edges linked to self belonging the collection 'edges'. If rawResults a arango results will be return as fetched, if false, will return a liste of Edge objects""" try : return ...
python
def getEdges(self, edges, inEdges = True, outEdges = True, rawResults = False) : """returns in, out, or both edges linked to self belonging the collection 'edges'. If rawResults a arango results will be return as fetched, if false, will return a liste of Edge objects""" try : return ...
[ "def", "getEdges", "(", "self", ",", "edges", ",", "inEdges", "=", "True", ",", "outEdges", "=", "True", ",", "rawResults", "=", "False", ")", ":", "try", ":", "return", "edges", ".", "getEdges", "(", "self", ",", "inEdges", ",", "outEdges", ",", "ra...
returns in, out, or both edges linked to self belonging the collection 'edges'. If rawResults a arango results will be return as fetched, if false, will return a liste of Edge objects
[ "returns", "in", "out", "or", "both", "edges", "linked", "to", "self", "belonging", "the", "collection", "edges", ".", "If", "rawResults", "a", "arango", "results", "will", "be", "return", "as", "fetched", "if", "false", "will", "return", "a", "liste", "of...
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/document.py#L339-L345
train
ArangoDB-Community/pyArango
pyArango/document.py
Document.getStore
def getStore(self) : """return the store in a dict format""" store = self._store.getStore() for priv in self.privates : v = getattr(self, priv) if v : store[priv] = v return store
python
def getStore(self) : """return the store in a dict format""" store = self._store.getStore() for priv in self.privates : v = getattr(self, priv) if v : store[priv] = v return store
[ "def", "getStore", "(", "self", ")", ":", "store", "=", "self", ".", "_store", ".", "getStore", "(", ")", "for", "priv", "in", "self", ".", "privates", ":", "v", "=", "getattr", "(", "self", ",", "priv", ")", "if", "v", ":", "store", "[", "priv",...
return the store in a dict format
[ "return", "the", "store", "in", "a", "dict", "format" ]
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/document.py#L347-L354
train
ArangoDB-Community/pyArango
pyArango/document.py
Edge.links
def links(self, fromVertice, toVertice, **edgeArgs) : """ An alias to save that updates the _from and _to attributes. fromVertice and toVertice, can be either strings or documents. It they are unsaved documents, they will be automatically saved. """ if isinstance(fromVertice, Doc...
python
def links(self, fromVertice, toVertice, **edgeArgs) : """ An alias to save that updates the _from and _to attributes. fromVertice and toVertice, can be either strings or documents. It they are unsaved documents, they will be automatically saved. """ if isinstance(fromVertice, Doc...
[ "def", "links", "(", "self", ",", "fromVertice", ",", "toVertice", ",", "**", "edgeArgs", ")", ":", "if", "isinstance", "(", "fromVertice", ",", "Document", ")", "or", "isinstance", "(", "getattr", "(", "fromVertice", ",", "'document'", ",", "None", ")", ...
An alias to save that updates the _from and _to attributes. fromVertice and toVertice, can be either strings or documents. It they are unsaved documents, they will be automatically saved.
[ "An", "alias", "to", "save", "that", "updates", "the", "_from", "and", "_to", "attributes", ".", "fromVertice", "and", "toVertice", "can", "be", "either", "strings", "or", "documents", ".", "It", "they", "are", "unsaved", "documents", "they", "will", "be", ...
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/document.py#L403-L426
train
ArangoDB-Community/pyArango
pyArango/users.py
User._set
def _set(self, jsonData) : """Initialize all fields at once. If no password is specified, it will be set as an empty string""" self["username"] = jsonData["user"] self["active"] = jsonData["active"] self["extra"] = jsonData["extra"] try: self["changePassword"...
python
def _set(self, jsonData) : """Initialize all fields at once. If no password is specified, it will be set as an empty string""" self["username"] = jsonData["user"] self["active"] = jsonData["active"] self["extra"] = jsonData["extra"] try: self["changePassword"...
[ "def", "_set", "(", "self", ",", "jsonData", ")", ":", "self", "[", "\"username\"", "]", "=", "jsonData", "[", "\"user\"", "]", "self", "[", "\"active\"", "]", "=", "jsonData", "[", "\"active\"", "]", "self", "[", "\"extra\"", "]", "=", "jsonData", "["...
Initialize all fields at once. If no password is specified, it will be set as an empty string
[ "Initialize", "all", "fields", "at", "once", ".", "If", "no", "password", "is", "specified", "it", "will", "be", "set", "as", "an", "empty", "string" ]
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/users.py#L24-L41
train
ArangoDB-Community/pyArango
pyArango/users.py
User.delete
def delete(self) : """Permanently remove the user""" if not self.URL : raise CreationError("Please save user first", None, None) r = self.connection.session.delete(self.URL) if r.status_code < 200 or r.status_code > 202 : raise DeletionError("Unable to delete use...
python
def delete(self) : """Permanently remove the user""" if not self.URL : raise CreationError("Please save user first", None, None) r = self.connection.session.delete(self.URL) if r.status_code < 200 or r.status_code > 202 : raise DeletionError("Unable to delete use...
[ "def", "delete", "(", "self", ")", ":", "if", "not", "self", ".", "URL", ":", "raise", "CreationError", "(", "\"Please save user first\"", ",", "None", ",", "None", ")", "r", "=", "self", ".", "connection", ".", "session", ".", "delete", "(", "self", "...
Permanently remove the user
[ "Permanently", "remove", "the", "user" ]
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/users.py#L95-L104
train
ArangoDB-Community/pyArango
pyArango/users.py
Users.fetchAllUsers
def fetchAllUsers(self, rawResults = False) : """Returns all available users. if rawResults, the result will be a list of python dicts instead of User objects""" r = self.connection.session.get(self.URL) if r.status_code == 200 : data = r.json() if rawResults : ...
python
def fetchAllUsers(self, rawResults = False) : """Returns all available users. if rawResults, the result will be a list of python dicts instead of User objects""" r = self.connection.session.get(self.URL) if r.status_code == 200 : data = r.json() if rawResults : ...
[ "def", "fetchAllUsers", "(", "self", ",", "rawResults", "=", "False", ")", ":", "r", "=", "self", ".", "connection", ".", "session", ".", "get", "(", "self", ".", "URL", ")", "if", "r", ".", "status_code", "==", "200", ":", "data", "=", "r", ".", ...
Returns all available users. if rawResults, the result will be a list of python dicts instead of User objects
[ "Returns", "all", "available", "users", ".", "if", "rawResults", "the", "result", "will", "be", "a", "list", "of", "python", "dicts", "instead", "of", "User", "objects" ]
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/users.py#L129-L143
train
ArangoDB-Community/pyArango
pyArango/users.py
Users.fetchUser
def fetchUser(self, username, rawResults = False) : """Returns a single user. if rawResults, the result will be a list of python dicts instead of User objects""" url = "%s/%s" % (self.URL, username) r = self.connection.session.get(url) if r.status_code == 200 : data = r.json...
python
def fetchUser(self, username, rawResults = False) : """Returns a single user. if rawResults, the result will be a list of python dicts instead of User objects""" url = "%s/%s" % (self.URL, username) r = self.connection.session.get(url) if r.status_code == 200 : data = r.json...
[ "def", "fetchUser", "(", "self", ",", "username", ",", "rawResults", "=", "False", ")", ":", "url", "=", "\"%s/%s\"", "%", "(", "self", ".", "URL", ",", "username", ")", "r", "=", "self", ".", "connection", ".", "session", ".", "get", "(", "url", "...
Returns a single user. if rawResults, the result will be a list of python dicts instead of User objects
[ "Returns", "a", "single", "user", ".", "if", "rawResults", "the", "result", "will", "be", "a", "list", "of", "python", "dicts", "instead", "of", "User", "objects" ]
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/users.py#L145-L158
train
ArangoDB-Community/pyArango
pyArango/connection.py
Connection.resetSession
def resetSession(self, username=None, password=None, verify=True) : """resets the session""" self.disconnectSession() self.session = AikidoSession(username, password, verify)
python
def resetSession(self, username=None, password=None, verify=True) : """resets the session""" self.disconnectSession() self.session = AikidoSession(username, password, verify)
[ "def", "resetSession", "(", "self", ",", "username", "=", "None", ",", "password", "=", "None", ",", "verify", "=", "True", ")", ":", "self", ".", "disconnectSession", "(", ")", "self", ".", "session", "=", "AikidoSession", "(", "username", ",", "passwor...
resets the session
[ "resets", "the", "session" ]
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/connection.py#L129-L132
train
ArangoDB-Community/pyArango
pyArango/connection.py
Connection.reload
def reload(self) : """Reloads the database list. Because loading a database triggers the loading of all collections and graphs within, only handles are loaded when this function is called. The full databases are loaded on demand when accessed """ r = self.session.get(self.databa...
python
def reload(self) : """Reloads the database list. Because loading a database triggers the loading of all collections and graphs within, only handles are loaded when this function is called. The full databases are loaded on demand when accessed """ r = self.session.get(self.databa...
[ "def", "reload", "(", "self", ")", ":", "r", "=", "self", ".", "session", ".", "get", "(", "self", ".", "databasesURL", ")", "data", "=", "r", ".", "json", "(", ")", "if", "r", ".", "status_code", "==", "200", "and", "not", "data", "[", "\"error\...
Reloads the database list. Because loading a database triggers the loading of all collections and graphs within, only handles are loaded when this function is called. The full databases are loaded on demand when accessed
[ "Reloads", "the", "database", "list", ".", "Because", "loading", "a", "database", "triggers", "the", "loading", "of", "all", "collections", "and", "graphs", "within", "only", "handles", "are", "loaded", "when", "this", "function", "is", "called", ".", "The", ...
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/connection.py#L134-L149
train
ArangoDB-Community/pyArango
pyArango/connection.py
Connection.createDatabase
def createDatabase(self, name, **dbArgs) : "use dbArgs for arguments other than name. for a full list of arguments please have a look at arangoDB's doc" dbArgs['name'] = name payload = json.dumps(dbArgs, default=str) url = self.URL + "/database" r = self.session.post(url, data = ...
python
def createDatabase(self, name, **dbArgs) : "use dbArgs for arguments other than name. for a full list of arguments please have a look at arangoDB's doc" dbArgs['name'] = name payload = json.dumps(dbArgs, default=str) url = self.URL + "/database" r = self.session.post(url, data = ...
[ "def", "createDatabase", "(", "self", ",", "name", ",", "**", "dbArgs", ")", ":", "\"use dbArgs for arguments other than name. for a full list of arguments please have a look at arangoDB's doc\"", "dbArgs", "[", "'name'", "]", "=", "name", "payload", "=", "json", ".", "du...
use dbArgs for arguments other than name. for a full list of arguments please have a look at arangoDB's doc
[ "use", "dbArgs", "for", "arguments", "other", "than", "name", ".", "for", "a", "full", "list", "of", "arguments", "please", "have", "a", "look", "at", "arangoDB", "s", "doc" ]
dd72e5f6c540e5e148943d615ddf7553bb78ce0b
https://github.com/ArangoDB-Community/pyArango/blob/dd72e5f6c540e5e148943d615ddf7553bb78ce0b/pyArango/connection.py#L151-L163
train
sensu-plugins/sensu-plugin-python
sensu_plugin/plugin.py
SensuPlugin.output
def output(self, args): ''' Print the output message. ''' print("SensuPlugin: {}".format(' '.join(str(a) for a in args)))
python
def output(self, args): ''' Print the output message. ''' print("SensuPlugin: {}".format(' '.join(str(a) for a in args)))
[ "def", "output", "(", "self", ",", "args", ")", ":", "print", "(", "\"SensuPlugin: {}\"", ".", "format", "(", "' '", ".", "join", "(", "str", "(", "a", ")", "for", "a", "in", "args", ")", ")", ")" ]
Print the output message.
[ "Print", "the", "output", "message", "." ]
bd43a5ea4d191e5e63494c8679aab02ac072d9ed
https://github.com/sensu-plugins/sensu-plugin-python/blob/bd43a5ea4d191e5e63494c8679aab02ac072d9ed/sensu_plugin/plugin.py#L51-L55
train
sensu-plugins/sensu-plugin-python
sensu_plugin/plugin.py
SensuPlugin.__make_dynamic
def __make_dynamic(self, method): ''' Create a method for each of the exit codes. ''' def dynamic(*args): self.plugin_info['status'] = method if not args: args = None self.output(args) sys.exit(getattr(self.exit_code, method...
python
def __make_dynamic(self, method): ''' Create a method for each of the exit codes. ''' def dynamic(*args): self.plugin_info['status'] = method if not args: args = None self.output(args) sys.exit(getattr(self.exit_code, method...
[ "def", "__make_dynamic", "(", "self", ",", "method", ")", ":", "def", "dynamic", "(", "*", "args", ")", ":", "self", ".", "plugin_info", "[", "'status'", "]", "=", "method", "if", "not", "args", ":", "args", "=", "None", "self", ".", "output", "(", ...
Create a method for each of the exit codes.
[ "Create", "a", "method", "for", "each", "of", "the", "exit", "codes", "." ]
bd43a5ea4d191e5e63494c8679aab02ac072d9ed
https://github.com/sensu-plugins/sensu-plugin-python/blob/bd43a5ea4d191e5e63494c8679aab02ac072d9ed/sensu_plugin/plugin.py#L57-L71
train
sensu-plugins/sensu-plugin-python
sensu_plugin/plugin.py
SensuPlugin.__exitfunction
def __exitfunction(self): ''' Method called by exit hook, ensures that both an exit code and output is supplied, also catches errors. ''' if self._hook.exit_code is None and self._hook.exception is None: print("Check did not exit! You should call an exit code method."...
python
def __exitfunction(self): ''' Method called by exit hook, ensures that both an exit code and output is supplied, also catches errors. ''' if self._hook.exit_code is None and self._hook.exception is None: print("Check did not exit! You should call an exit code method."...
[ "def", "__exitfunction", "(", "self", ")", ":", "if", "self", ".", "_hook", ".", "exit_code", "is", "None", "and", "self", ".", "_hook", ".", "exception", "is", "None", ":", "print", "(", "\"Check did not exit! You should call an exit code method.\"", ")", "sys"...
Method called by exit hook, ensures that both an exit code and output is supplied, also catches errors.
[ "Method", "called", "by", "exit", "hook", "ensures", "that", "both", "an", "exit", "code", "and", "output", "is", "supplied", "also", "catches", "errors", "." ]
bd43a5ea4d191e5e63494c8679aab02ac072d9ed
https://github.com/sensu-plugins/sensu-plugin-python/blob/bd43a5ea4d191e5e63494c8679aab02ac072d9ed/sensu_plugin/plugin.py#L79-L92
train
sensu-plugins/sensu-plugin-python
sensu_plugin/handler.py
SensuHandler.run
def run(self): ''' Set up the event object, global settings and command line arguments. ''' # Parse the stdin into a global event object stdin = self.read_stdin() self.event = self.read_event(stdin) # Prepare global settings self.settings = get_s...
python
def run(self): ''' Set up the event object, global settings and command line arguments. ''' # Parse the stdin into a global event object stdin = self.read_stdin() self.event = self.read_event(stdin) # Prepare global settings self.settings = get_s...
[ "def", "run", "(", "self", ")", ":", "stdin", "=", "self", ".", "read_stdin", "(", ")", "self", ".", "event", "=", "self", ".", "read_event", "(", "stdin", ")", "self", ".", "settings", "=", "get_settings", "(", ")", "self", ".", "api_settings", "=",...
Set up the event object, global settings and command line arguments.
[ "Set", "up", "the", "event", "object", "global", "settings", "and", "command", "line", "arguments", "." ]
bd43a5ea4d191e5e63494c8679aab02ac072d9ed
https://github.com/sensu-plugins/sensu-plugin-python/blob/bd43a5ea4d191e5e63494c8679aab02ac072d9ed/sensu_plugin/handler.py#L31-L65
train
sensu-plugins/sensu-plugin-python
sensu_plugin/handler.py
SensuHandler.filter
def filter(self): ''' Filters exit the proccess if the event should not be handled. Filtering events is deprecated and will be removed in a future release. ''' if self.deprecated_filtering_enabled(): print('warning: event filtering in sensu-plugin is deprecated,' + ...
python
def filter(self): ''' Filters exit the proccess if the event should not be handled. Filtering events is deprecated and will be removed in a future release. ''' if self.deprecated_filtering_enabled(): print('warning: event filtering in sensu-plugin is deprecated,' + ...
[ "def", "filter", "(", "self", ")", ":", "if", "self", ".", "deprecated_filtering_enabled", "(", ")", ":", "print", "(", "'warning: event filtering in sensu-plugin is deprecated,'", "+", "'see http://bit.ly/sensu-plugin'", ")", "self", ".", "filter_disabled", "(", ")", ...
Filters exit the proccess if the event should not be handled. Filtering events is deprecated and will be removed in a future release.
[ "Filters", "exit", "the", "proccess", "if", "the", "event", "should", "not", "be", "handled", ".", "Filtering", "events", "is", "deprecated", "and", "will", "be", "removed", "in", "a", "future", "release", "." ]
bd43a5ea4d191e5e63494c8679aab02ac072d9ed
https://github.com/sensu-plugins/sensu-plugin-python/blob/bd43a5ea4d191e5e63494c8679aab02ac072d9ed/sensu_plugin/handler.py#L95-L111
train
sensu-plugins/sensu-plugin-python
sensu_plugin/handler.py
SensuHandler.bail
def bail(self, msg): ''' Gracefully terminate with message ''' client_name = self.event['client'].get('name', 'error:no-client-name') check_name = self.event['check'].get('name', 'error:no-check-name') print('{}: {}/{}'.format(msg, client_name, check_name)) sys.ex...
python
def bail(self, msg): ''' Gracefully terminate with message ''' client_name = self.event['client'].get('name', 'error:no-client-name') check_name = self.event['check'].get('name', 'error:no-check-name') print('{}: {}/{}'.format(msg, client_name, check_name)) sys.ex...
[ "def", "bail", "(", "self", ",", "msg", ")", ":", "client_name", "=", "self", ".", "event", "[", "'client'", "]", ".", "get", "(", "'name'", ",", "'error:no-client-name'", ")", "check_name", "=", "self", ".", "event", "[", "'check'", "]", ".", "get", ...
Gracefully terminate with message
[ "Gracefully", "terminate", "with", "message" ]
bd43a5ea4d191e5e63494c8679aab02ac072d9ed
https://github.com/sensu-plugins/sensu-plugin-python/blob/bd43a5ea4d191e5e63494c8679aab02ac072d9ed/sensu_plugin/handler.py#L135-L142
train
sensu-plugins/sensu-plugin-python
sensu_plugin/handler.py
SensuHandler.api_request
def api_request(self, method, path): ''' Query Sensu api for information. ''' if not hasattr(self, 'api_settings'): ValueError('api.json settings not found') if method.lower() == 'get': _request = requests.get elif method.lower() == 'post': ...
python
def api_request(self, method, path): ''' Query Sensu api for information. ''' if not hasattr(self, 'api_settings'): ValueError('api.json settings not found') if method.lower() == 'get': _request = requests.get elif method.lower() == 'post': ...
[ "def", "api_request", "(", "self", ",", "method", ",", "path", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'api_settings'", ")", ":", "ValueError", "(", "'api.json settings not found'", ")", "if", "method", ".", "lower", "(", ")", "==", "'get'", ...
Query Sensu api for information.
[ "Query", "Sensu", "api", "for", "information", "." ]
bd43a5ea4d191e5e63494c8679aab02ac072d9ed
https://github.com/sensu-plugins/sensu-plugin-python/blob/bd43a5ea4d191e5e63494c8679aab02ac072d9ed/sensu_plugin/handler.py#L172-L191
train
sensu-plugins/sensu-plugin-python
sensu_plugin/handler.py
SensuHandler.event_exists
def event_exists(self, client, check): ''' Query Sensu API for event. ''' return self.api_request( 'get', 'events/{}/{}'.format(client, check) ).status_code == 200
python
def event_exists(self, client, check): ''' Query Sensu API for event. ''' return self.api_request( 'get', 'events/{}/{}'.format(client, check) ).status_code == 200
[ "def", "event_exists", "(", "self", ",", "client", ",", "check", ")", ":", "return", "self", ".", "api_request", "(", "'get'", ",", "'events/{}/{}'", ".", "format", "(", "client", ",", "check", ")", ")", ".", "status_code", "==", "200" ]
Query Sensu API for event.
[ "Query", "Sensu", "API", "for", "event", "." ]
bd43a5ea4d191e5e63494c8679aab02ac072d9ed
https://github.com/sensu-plugins/sensu-plugin-python/blob/bd43a5ea4d191e5e63494c8679aab02ac072d9ed/sensu_plugin/handler.py#L199-L206
train
sensu-plugins/sensu-plugin-python
sensu_plugin/handler.py
SensuHandler.filter_silenced
def filter_silenced(self): ''' Determine whether a check is silenced and shouldn't handle. ''' stashes = [ ('client', '/silence/{}'.format(self.event['client']['name'])), ('check', '/silence/{}/{}'.format( self.event['client']['name'], ...
python
def filter_silenced(self): ''' Determine whether a check is silenced and shouldn't handle. ''' stashes = [ ('client', '/silence/{}'.format(self.event['client']['name'])), ('check', '/silence/{}/{}'.format( self.event['client']['name'], ...
[ "def", "filter_silenced", "(", "self", ")", ":", "stashes", "=", "[", "(", "'client'", ",", "'/silence/{}'", ".", "format", "(", "self", ".", "event", "[", "'client'", "]", "[", "'name'", "]", ")", ")", ",", "(", "'check'", ",", "'/silence/{}/{}'", "."...
Determine whether a check is silenced and shouldn't handle.
[ "Determine", "whether", "a", "check", "is", "silenced", "and", "shouldn", "t", "handle", "." ]
bd43a5ea4d191e5e63494c8679aab02ac072d9ed
https://github.com/sensu-plugins/sensu-plugin-python/blob/bd43a5ea4d191e5e63494c8679aab02ac072d9ed/sensu_plugin/handler.py#L216-L229
train
sensu-plugins/sensu-plugin-python
sensu_plugin/handler.py
SensuHandler.filter_dependencies
def filter_dependencies(self): ''' Determine whether a check has dependencies. ''' dependencies = self.event['check'].get('dependencies', None) if dependencies is None or not isinstance(dependencies, list): return for dependency in self.event['check']['depende...
python
def filter_dependencies(self): ''' Determine whether a check has dependencies. ''' dependencies = self.event['check'].get('dependencies', None) if dependencies is None or not isinstance(dependencies, list): return for dependency in self.event['check']['depende...
[ "def", "filter_dependencies", "(", "self", ")", ":", "dependencies", "=", "self", ".", "event", "[", "'check'", "]", ".", "get", "(", "'dependencies'", ",", "None", ")", "if", "dependencies", "is", "None", "or", "not", "isinstance", "(", "dependencies", ",...
Determine whether a check has dependencies.
[ "Determine", "whether", "a", "check", "has", "dependencies", "." ]
bd43a5ea4d191e5e63494c8679aab02ac072d9ed
https://github.com/sensu-plugins/sensu-plugin-python/blob/bd43a5ea4d191e5e63494c8679aab02ac072d9ed/sensu_plugin/handler.py#L231-L250
train
sensu-plugins/sensu-plugin-python
sensu_plugin/handler.py
SensuHandler.filter_repeated
def filter_repeated(self): ''' Determine whether a check is repeating. ''' defaults = { 'occurrences': 1, 'interval': 30, 'refresh': 1800 } # Override defaults with anything defined in the settings if isinstance(self.settings['...
python
def filter_repeated(self): ''' Determine whether a check is repeating. ''' defaults = { 'occurrences': 1, 'interval': 30, 'refresh': 1800 } # Override defaults with anything defined in the settings if isinstance(self.settings['...
[ "def", "filter_repeated", "(", "self", ")", ":", "defaults", "=", "{", "'occurrences'", ":", "1", ",", "'interval'", ":", "30", ",", "'refresh'", ":", "1800", "}", "if", "isinstance", "(", "self", ".", "settings", "[", "'sensu_plugin'", "]", ",", "dict",...
Determine whether a check is repeating.
[ "Determine", "whether", "a", "check", "is", "repeating", "." ]
bd43a5ea4d191e5e63494c8679aab02ac072d9ed
https://github.com/sensu-plugins/sensu-plugin-python/blob/bd43a5ea4d191e5e63494c8679aab02ac072d9ed/sensu_plugin/handler.py#L252-L285
train
sensu-plugins/sensu-plugin-python
sensu_plugin/utils.py
config_files
def config_files(): ''' Get list of currently used config files. ''' sensu_loaded_tempfile = os.environ.get('SENSU_LOADED_TEMPFILE') sensu_config_files = os.environ.get('SENSU_CONFIG_FILES') sensu_v1_config = '/etc/sensu/config.json' sensu_v1_confd = '/etc/sensu/conf.d' if sensu_loaded_t...
python
def config_files(): ''' Get list of currently used config files. ''' sensu_loaded_tempfile = os.environ.get('SENSU_LOADED_TEMPFILE') sensu_config_files = os.environ.get('SENSU_CONFIG_FILES') sensu_v1_config = '/etc/sensu/config.json' sensu_v1_confd = '/etc/sensu/conf.d' if sensu_loaded_t...
[ "def", "config_files", "(", ")", ":", "sensu_loaded_tempfile", "=", "os", ".", "environ", ".", "get", "(", "'SENSU_LOADED_TEMPFILE'", ")", "sensu_config_files", "=", "os", ".", "environ", ".", "get", "(", "'SENSU_CONFIG_FILES'", ")", "sensu_v1_config", "=", "'/e...
Get list of currently used config files.
[ "Get", "list", "of", "currently", "used", "config", "files", "." ]
bd43a5ea4d191e5e63494c8679aab02ac072d9ed
https://github.com/sensu-plugins/sensu-plugin-python/blob/bd43a5ea4d191e5e63494c8679aab02ac072d9ed/sensu_plugin/utils.py#L10-L34
train
sensu-plugins/sensu-plugin-python
sensu_plugin/utils.py
get_settings
def get_settings(): ''' Get all currently loaded settings. ''' settings = {} for config_file in config_files(): config_contents = load_config(config_file) if config_contents is not None: settings = deep_merge(settings, config_contents) return settings
python
def get_settings(): ''' Get all currently loaded settings. ''' settings = {} for config_file in config_files(): config_contents = load_config(config_file) if config_contents is not None: settings = deep_merge(settings, config_contents) return settings
[ "def", "get_settings", "(", ")", ":", "settings", "=", "{", "}", "for", "config_file", "in", "config_files", "(", ")", ":", "config_contents", "=", "load_config", "(", "config_file", ")", "if", "config_contents", "is", "not", "None", ":", "settings", "=", ...
Get all currently loaded settings.
[ "Get", "all", "currently", "loaded", "settings", "." ]
bd43a5ea4d191e5e63494c8679aab02ac072d9ed
https://github.com/sensu-plugins/sensu-plugin-python/blob/bd43a5ea4d191e5e63494c8679aab02ac072d9ed/sensu_plugin/utils.py#L37-L46
train
sensu-plugins/sensu-plugin-python
sensu_plugin/utils.py
load_config
def load_config(filename): ''' Read contents of config file. ''' try: with open(filename, 'r') as config_file: return json.loads(config_file.read()) except IOError: pass
python
def load_config(filename): ''' Read contents of config file. ''' try: with open(filename, 'r') as config_file: return json.loads(config_file.read()) except IOError: pass
[ "def", "load_config", "(", "filename", ")", ":", "try", ":", "with", "open", "(", "filename", ",", "'r'", ")", "as", "config_file", ":", "return", "json", ".", "loads", "(", "config_file", ".", "read", "(", ")", ")", "except", "IOError", ":", "pass" ]
Read contents of config file.
[ "Read", "contents", "of", "config", "file", "." ]
bd43a5ea4d191e5e63494c8679aab02ac072d9ed
https://github.com/sensu-plugins/sensu-plugin-python/blob/bd43a5ea4d191e5e63494c8679aab02ac072d9ed/sensu_plugin/utils.py#L49-L57
train
sensu-plugins/sensu-plugin-python
sensu_plugin/utils.py
deep_merge
def deep_merge(dict_one, dict_two): ''' Deep merge two dicts. ''' merged = dict_one.copy() for key, value in dict_two.items(): # value is equivalent to dict_two[key] if (key in dict_one and isinstance(dict_one[key], dict) and isinstance(value, dict)): ...
python
def deep_merge(dict_one, dict_two): ''' Deep merge two dicts. ''' merged = dict_one.copy() for key, value in dict_two.items(): # value is equivalent to dict_two[key] if (key in dict_one and isinstance(dict_one[key], dict) and isinstance(value, dict)): ...
[ "def", "deep_merge", "(", "dict_one", ",", "dict_two", ")", ":", "merged", "=", "dict_one", ".", "copy", "(", ")", "for", "key", ",", "value", "in", "dict_two", ".", "items", "(", ")", ":", "if", "(", "key", "in", "dict_one", "and", "isinstance", "("...
Deep merge two dicts.
[ "Deep", "merge", "two", "dicts", "." ]
bd43a5ea4d191e5e63494c8679aab02ac072d9ed
https://github.com/sensu-plugins/sensu-plugin-python/blob/bd43a5ea4d191e5e63494c8679aab02ac072d9ed/sensu_plugin/utils.py#L60-L77
train
sensu-plugins/sensu-plugin-python
sensu_plugin/utils.py
map_v2_event_into_v1
def map_v2_event_into_v1(event): ''' Helper method to convert Sensu 2.x event into Sensu 1.x event. ''' # return the event if it has already been mapped if "v2_event_mapped_into_v1" in event: return event # Trigger mapping code if enity exists and client does not if not bool(event....
python
def map_v2_event_into_v1(event): ''' Helper method to convert Sensu 2.x event into Sensu 1.x event. ''' # return the event if it has already been mapped if "v2_event_mapped_into_v1" in event: return event # Trigger mapping code if enity exists and client does not if not bool(event....
[ "def", "map_v2_event_into_v1", "(", "event", ")", ":", "if", "\"v2_event_mapped_into_v1\"", "in", "event", ":", "return", "event", "if", "not", "bool", "(", "event", ".", "get", "(", "'client'", ")", ")", "and", "\"entity\"", "in", "event", ":", "event", "...
Helper method to convert Sensu 2.x event into Sensu 1.x event.
[ "Helper", "method", "to", "convert", "Sensu", "2", ".", "x", "event", "into", "Sensu", "1", ".", "x", "event", "." ]
bd43a5ea4d191e5e63494c8679aab02ac072d9ed
https://github.com/sensu-plugins/sensu-plugin-python/blob/bd43a5ea4d191e5e63494c8679aab02ac072d9ed/sensu_plugin/utils.py#L80-L139
train
sensu-plugins/sensu-plugin-python
sensu_plugin/check.py
SensuPluginCheck.check_name
def check_name(self, name=None): ''' Checks the plugin name and sets it accordingly. Uses name if specified, class name if not set. ''' if name: self.plugin_info['check_name'] = name if self.plugin_info['check_name'] is not None: return self.plugi...
python
def check_name(self, name=None): ''' Checks the plugin name and sets it accordingly. Uses name if specified, class name if not set. ''' if name: self.plugin_info['check_name'] = name if self.plugin_info['check_name'] is not None: return self.plugi...
[ "def", "check_name", "(", "self", ",", "name", "=", "None", ")", ":", "if", "name", ":", "self", ".", "plugin_info", "[", "'check_name'", "]", "=", "name", "if", "self", ".", "plugin_info", "[", "'check_name'", "]", "is", "not", "None", ":", "return", ...
Checks the plugin name and sets it accordingly. Uses name if specified, class name if not set.
[ "Checks", "the", "plugin", "name", "and", "sets", "it", "accordingly", ".", "Uses", "name", "if", "specified", "class", "name", "if", "not", "set", "." ]
bd43a5ea4d191e5e63494c8679aab02ac072d9ed
https://github.com/sensu-plugins/sensu-plugin-python/blob/bd43a5ea4d191e5e63494c8679aab02ac072d9ed/sensu_plugin/check.py#L11-L22
train
chainer/chainerui
chainerui/models/result.py
Result.sampled_logs
def sampled_logs(self, logs_limit=-1): """Return up to `logs_limit` logs. If `logs_limit` is -1, this function will return all logs that belong to the result. """ logs_count = len(self.logs) if logs_limit == -1 or logs_count <= logs_limit: return self.logs ...
python
def sampled_logs(self, logs_limit=-1): """Return up to `logs_limit` logs. If `logs_limit` is -1, this function will return all logs that belong to the result. """ logs_count = len(self.logs) if logs_limit == -1 or logs_count <= logs_limit: return self.logs ...
[ "def", "sampled_logs", "(", "self", ",", "logs_limit", "=", "-", "1", ")", ":", "logs_count", "=", "len", "(", "self", ".", "logs", ")", "if", "logs_limit", "==", "-", "1", "or", "logs_count", "<=", "logs_limit", ":", "return", "self", ".", "logs", "...
Return up to `logs_limit` logs. If `logs_limit` is -1, this function will return all logs that belong to the result.
[ "Return", "up", "to", "logs_limit", "logs", "." ]
87ad25e875bc332bfdad20197fd3d0cb81a078e8
https://github.com/chainer/chainerui/blob/87ad25e875bc332bfdad20197fd3d0cb81a078e8/chainerui/models/result.py#L60-L77
train
chainer/chainerui
chainerui/models/result.py
Result.serialize_with_sampled_logs
def serialize_with_sampled_logs(self, logs_limit=-1): """serialize a result with up to `logs_limit` logs. If `logs_limit` is -1, this function will return a result with all its logs. """ return { 'id': self.id, 'pathName': self.path_name, 'na...
python
def serialize_with_sampled_logs(self, logs_limit=-1): """serialize a result with up to `logs_limit` logs. If `logs_limit` is -1, this function will return a result with all its logs. """ return { 'id': self.id, 'pathName': self.path_name, 'na...
[ "def", "serialize_with_sampled_logs", "(", "self", ",", "logs_limit", "=", "-", "1", ")", ":", "return", "{", "'id'", ":", "self", ".", "id", ",", "'pathName'", ":", "self", ".", "path_name", ",", "'name'", ":", "self", ".", "name", ",", "'isUnregistered...
serialize a result with up to `logs_limit` logs. If `logs_limit` is -1, this function will return a result with all its logs.
[ "serialize", "a", "result", "with", "up", "to", "logs_limit", "logs", "." ]
87ad25e875bc332bfdad20197fd3d0cb81a078e8
https://github.com/chainer/chainerui/blob/87ad25e875bc332bfdad20197fd3d0cb81a078e8/chainerui/models/result.py#L79-L96
train
chainer/chainerui
chainerui/summary.py
reporter
def reporter(prefix=None, out=None, subdir='', timeout=5, **kwargs): """Summary media assets to visualize. ``reporter`` function collects media assets by the ``with`` statement and aggregates in same row to visualize. This function returns an object which provides the following methods. * :meth:`~...
python
def reporter(prefix=None, out=None, subdir='', timeout=5, **kwargs): """Summary media assets to visualize. ``reporter`` function collects media assets by the ``with`` statement and aggregates in same row to visualize. This function returns an object which provides the following methods. * :meth:`~...
[ "def", "reporter", "(", "prefix", "=", "None", ",", "out", "=", "None", ",", "subdir", "=", "''", ",", "timeout", "=", "5", ",", "**", "kwargs", ")", ":", "report", "=", "_Reporter", "(", "prefix", ",", "out", ",", "subdir", ",", "**", "kwargs", ...
Summary media assets to visualize. ``reporter`` function collects media assets by the ``with`` statement and aggregates in same row to visualize. This function returns an object which provides the following methods. * :meth:`~chainerui.summary._Reporter.image`: collect images. almost same \ as...
[ "Summary", "media", "assets", "to", "visualize", "." ]
87ad25e875bc332bfdad20197fd3d0cb81a078e8
https://github.com/chainer/chainerui/blob/87ad25e875bc332bfdad20197fd3d0cb81a078e8/chainerui/summary.py#L174-L208
train
chainer/chainerui
chainerui/summary.py
audio
def audio(audio, sample_rate, name=None, out=None, subdir='', timeout=5, **kwargs): """summary audio files to listen on a browser. An sampled array is converted as WAV audio file, saved to output directory, and reported to the ChainerUI server. The audio file is saved every called this functi...
python
def audio(audio, sample_rate, name=None, out=None, subdir='', timeout=5, **kwargs): """summary audio files to listen on a browser. An sampled array is converted as WAV audio file, saved to output directory, and reported to the ChainerUI server. The audio file is saved every called this functi...
[ "def", "audio", "(", "audio", ",", "sample_rate", ",", "name", "=", "None", ",", "out", "=", "None", ",", "subdir", "=", "''", ",", "timeout", "=", "5", ",", "**", "kwargs", ")", ":", "from", "chainerui", ".", "report", ".", "audio_report", "import",...
summary audio files to listen on a browser. An sampled array is converted as WAV audio file, saved to output directory, and reported to the ChainerUI server. The audio file is saved every called this function. The audio file will be listened on `assets` endpoint vertically. If need to aggregate audio f...
[ "summary", "audio", "files", "to", "listen", "on", "a", "browser", "." ]
87ad25e875bc332bfdad20197fd3d0cb81a078e8
https://github.com/chainer/chainerui/blob/87ad25e875bc332bfdad20197fd3d0cb81a078e8/chainerui/summary.py#L304-L359
train
chainer/chainerui
chainerui/summary.py
_Reporter.audio
def audio(self, audio, sample_rate, name=None, subdir=''): """Summary audio to listen on web browser. Args: audio (:class:`numpy.ndarray` or :class:`cupy.ndarray` or \ :class:`chainer.Variable`): sampled wave array. sample_rate (int): sampling rate. n...
python
def audio(self, audio, sample_rate, name=None, subdir=''): """Summary audio to listen on web browser. Args: audio (:class:`numpy.ndarray` or :class:`cupy.ndarray` or \ :class:`chainer.Variable`): sampled wave array. sample_rate (int): sampling rate. n...
[ "def", "audio", "(", "self", ",", "audio", ",", "sample_rate", ",", "name", "=", "None", ",", "subdir", "=", "''", ")", ":", "from", "chainerui", ".", "report", ".", "audio_report", "import", "check_available", "if", "not", "check_available", "(", ")", "...
Summary audio to listen on web browser. Args: audio (:class:`numpy.ndarray` or :class:`cupy.ndarray` or \ :class:`chainer.Variable`): sampled wave array. sample_rate (int): sampling rate. name (str): name of image. set as column name. when not setting, ...
[ "Summary", "audio", "to", "listen", "on", "web", "browser", "." ]
87ad25e875bc332bfdad20197fd3d0cb81a078e8
https://github.com/chainer/chainerui/blob/87ad25e875bc332bfdad20197fd3d0cb81a078e8/chainerui/summary.py#L106-L128
train
chainer/chainerui
chainerui/models/project.py
Project.create
def create(cls, path_name=None, name=None, crawlable=True): """initialize an instance and save it to db.""" project = cls(path_name, name, crawlable) db.session.add(project) db.session.commit() return collect_results(project, force=True)
python
def create(cls, path_name=None, name=None, crawlable=True): """initialize an instance and save it to db.""" project = cls(path_name, name, crawlable) db.session.add(project) db.session.commit() return collect_results(project, force=True)
[ "def", "create", "(", "cls", ",", "path_name", "=", "None", ",", "name", "=", "None", ",", "crawlable", "=", "True", ")", ":", "project", "=", "cls", "(", "path_name", ",", "name", ",", "crawlable", ")", "db", ".", "session", ".", "add", "(", "proj...
initialize an instance and save it to db.
[ "initialize", "an", "instance", "and", "save", "it", "to", "db", "." ]
87ad25e875bc332bfdad20197fd3d0cb81a078e8
https://github.com/chainer/chainerui/blob/87ad25e875bc332bfdad20197fd3d0cb81a078e8/chainerui/models/project.py#L36-L44
train
chainer/chainerui
chainerui/tasks/collect_assets.py
collect_assets
def collect_assets(result, force=False): """collect assets from meta file Collecting assets only when the metafile is updated. If number of assets are decreased, assets are reset and re-collect the assets. """ path_name = result.path_name info_path = os.path.join(path_name, summary.CHAINERUI_AS...
python
def collect_assets(result, force=False): """collect assets from meta file Collecting assets only when the metafile is updated. If number of assets are decreased, assets are reset and re-collect the assets. """ path_name = result.path_name info_path = os.path.join(path_name, summary.CHAINERUI_AS...
[ "def", "collect_assets", "(", "result", ",", "force", "=", "False", ")", ":", "path_name", "=", "result", ".", "path_name", "info_path", "=", "os", ".", "path", ".", "join", "(", "path_name", ",", "summary", ".", "CHAINERUI_ASSETS_METAFILE_NAME", ")", "if", ...
collect assets from meta file Collecting assets only when the metafile is updated. If number of assets are decreased, assets are reset and re-collect the assets.
[ "collect", "assets", "from", "meta", "file" ]
87ad25e875bc332bfdad20197fd3d0cb81a078e8
https://github.com/chainer/chainerui/blob/87ad25e875bc332bfdad20197fd3d0cb81a078e8/chainerui/tasks/collect_assets.py#L12-L50
train
chainer/chainerui
chainerui/utils/save_args.py
save_args
def save_args(conditions, out_path): """A util function to save experiment condition for job table. Args: conditions (:class:`argparse.Namespace` or dict): Experiment conditions to show on a job table. Keys are show as table header and values are show at a job row. out_p...
python
def save_args(conditions, out_path): """A util function to save experiment condition for job table. Args: conditions (:class:`argparse.Namespace` or dict): Experiment conditions to show on a job table. Keys are show as table header and values are show at a job row. out_p...
[ "def", "save_args", "(", "conditions", ",", "out_path", ")", ":", "if", "isinstance", "(", "conditions", ",", "argparse", ".", "Namespace", ")", ":", "args", "=", "vars", "(", "conditions", ")", "else", ":", "args", "=", "conditions", "try", ":", "os", ...
A util function to save experiment condition for job table. Args: conditions (:class:`argparse.Namespace` or dict): Experiment conditions to show on a job table. Keys are show as table header and values are show at a job row. out_path (str): Output directory name to save con...
[ "A", "util", "function", "to", "save", "experiment", "condition", "for", "job", "table", "." ]
87ad25e875bc332bfdad20197fd3d0cb81a078e8
https://github.com/chainer/chainerui/blob/87ad25e875bc332bfdad20197fd3d0cb81a078e8/chainerui/utils/save_args.py#L9-L36
train
sunt05/SuPy
src/supy/supy_misc.py
_path_insensitive
def _path_insensitive(path): """ Recursive part of path_insensitive to do the work. """ path = str(path) if path == '' or os.path.exists(path): return path base = os.path.basename(path) # may be a directory or a file dirname = os.path.dirname(path) suffix = '' if not base:...
python
def _path_insensitive(path): """ Recursive part of path_insensitive to do the work. """ path = str(path) if path == '' or os.path.exists(path): return path base = os.path.basename(path) # may be a directory or a file dirname = os.path.dirname(path) suffix = '' if not base:...
[ "def", "_path_insensitive", "(", "path", ")", ":", "path", "=", "str", "(", "path", ")", "if", "path", "==", "''", "or", "os", ".", "path", ".", "exists", "(", "path", ")", ":", "return", "path", "base", "=", "os", ".", "path", ".", "basename", "...
Recursive part of path_insensitive to do the work.
[ "Recursive", "part", "of", "path_insensitive", "to", "do", "the", "work", "." ]
47178bd5aee50a059414e3e504940662fbfae0dc
https://github.com/sunt05/SuPy/blob/47178bd5aee50a059414e3e504940662fbfae0dc/src/supy/supy_misc.py#L34-L74
train
sunt05/SuPy
docs/source/proc_var_info/nml_rst_proc.py
form_option
def form_option(str_opt): '''generate option name based suffix for URL :param str_opt: opt name :type str_opt: str :return: URL suffix for the specified option :rtype: str ''' str_base = '#cmdoption-arg-' str_opt_x = str_base+str_opt.lower()\ .replace('_', '-')\ .replac...
python
def form_option(str_opt): '''generate option name based suffix for URL :param str_opt: opt name :type str_opt: str :return: URL suffix for the specified option :rtype: str ''' str_base = '#cmdoption-arg-' str_opt_x = str_base+str_opt.lower()\ .replace('_', '-')\ .replac...
[ "def", "form_option", "(", "str_opt", ")", ":", "str_base", "=", "'#cmdoption-arg-'", "str_opt_x", "=", "str_base", "+", "str_opt", ".", "lower", "(", ")", ".", "replace", "(", "'_'", ",", "'-'", ")", ".", "replace", "(", "'('", ",", "'-'", ")", ".", ...
generate option name based suffix for URL :param str_opt: opt name :type str_opt: str :return: URL suffix for the specified option :rtype: str
[ "generate", "option", "name", "based", "suffix", "for", "URL" ]
47178bd5aee50a059414e3e504940662fbfae0dc
https://github.com/sunt05/SuPy/blob/47178bd5aee50a059414e3e504940662fbfae0dc/docs/source/proc_var_info/nml_rst_proc.py#L83-L97
train
sunt05/SuPy
docs/source/proc_var_info/nml_rst_proc.py
gen_url_option
def gen_url_option( str_opt, set_site=set_site, set_runcontrol=set_runcontrol, set_initcond=set_initcond, source='docs'): '''construct a URL for option based on source :param str_opt: option name, defaults to '' :param str_opt: str, optional :param source: URL source: 'docs' fo...
python
def gen_url_option( str_opt, set_site=set_site, set_runcontrol=set_runcontrol, set_initcond=set_initcond, source='docs'): '''construct a URL for option based on source :param str_opt: option name, defaults to '' :param str_opt: str, optional :param source: URL source: 'docs' fo...
[ "def", "gen_url_option", "(", "str_opt", ",", "set_site", "=", "set_site", ",", "set_runcontrol", "=", "set_runcontrol", ",", "set_initcond", "=", "set_initcond", ",", "source", "=", "'docs'", ")", ":", "dict_base", "=", "{", "'docs'", ":", "URL", "(", "'htt...
construct a URL for option based on source :param str_opt: option name, defaults to '' :param str_opt: str, optional :param source: URL source: 'docs' for readthedocs.org; 'github' for github repo, defaults to 'docs' :param source: str, optional :return: a valid URL pointing to the option related ...
[ "construct", "a", "URL", "for", "option", "based", "on", "source" ]
47178bd5aee50a059414e3e504940662fbfae0dc
https://github.com/sunt05/SuPy/blob/47178bd5aee50a059414e3e504940662fbfae0dc/docs/source/proc_var_info/nml_rst_proc.py#L154-L180
train
sunt05/SuPy
docs/source/proc_var_info/gen_df_forcing_output_csv.py
gen_df_forcing
def gen_df_forcing( path_csv_in='SSss_YYYY_data_tt.csv', url_base=url_repo_input,)->pd.DataFrame: '''Generate description info of supy forcing data into a dataframe Parameters ---------- path_csv_in : str, optional path to the input csv file relative to url_base (the default is ...
python
def gen_df_forcing( path_csv_in='SSss_YYYY_data_tt.csv', url_base=url_repo_input,)->pd.DataFrame: '''Generate description info of supy forcing data into a dataframe Parameters ---------- path_csv_in : str, optional path to the input csv file relative to url_base (the default is ...
[ "def", "gen_df_forcing", "(", "path_csv_in", "=", "'SSss_YYYY_data_tt.csv'", ",", "url_base", "=", "url_repo_input", ",", ")", "->", "pd", ".", "DataFrame", ":", "try", ":", "urlpath_table", "=", "url_base", "/", "path_csv_in", "df_var_info", "=", "pd", ".", "...
Generate description info of supy forcing data into a dataframe Parameters ---------- path_csv_in : str, optional path to the input csv file relative to url_base (the default is '/input_files/SSss_YYYY_data_tt.csv']) url_base : urlpath.URL, optional URL to the input files of repo base (...
[ "Generate", "description", "info", "of", "supy", "forcing", "data", "into", "a", "dataframe" ]
47178bd5aee50a059414e3e504940662fbfae0dc
https://github.com/sunt05/SuPy/blob/47178bd5aee50a059414e3e504940662fbfae0dc/docs/source/proc_var_info/gen_df_forcing_output_csv.py#L38-L76
train
sunt05/SuPy
docs/source/proc_var_info/gen_df_forcing_output_csv.py
gen_df_output
def gen_df_output( list_csv_in=[ 'SSss_YYYY_SUEWS_TT.csv', 'SSss_DailyState.csv', 'SSss_YYYY_snow_TT.csv', ], url_base=url_repo_output)->Path: '''Generate description info of supy output results into dataframe Parameters ---------- list_csv_in...
python
def gen_df_output( list_csv_in=[ 'SSss_YYYY_SUEWS_TT.csv', 'SSss_DailyState.csv', 'SSss_YYYY_snow_TT.csv', ], url_base=url_repo_output)->Path: '''Generate description info of supy output results into dataframe Parameters ---------- list_csv_in...
[ "def", "gen_df_output", "(", "list_csv_in", "=", "[", "'SSss_YYYY_SUEWS_TT.csv'", ",", "'SSss_DailyState.csv'", ",", "'SSss_YYYY_snow_TT.csv'", ",", "]", ",", "url_base", "=", "url_repo_output", ")", "->", "Path", ":", "list_url_table", "=", "[", "url_base", "/", ...
Generate description info of supy output results into dataframe Parameters ---------- list_csv_in : list, optional list of file names for csv files with meta info (the default is ['SSss_YYYY_SUEWS_TT.csv','SSss_DailyState.csv','SSss_YYYY_snow_TT.csv',], which [default_description]) url_base : [...
[ "Generate", "description", "info", "of", "supy", "output", "results", "into", "dataframe" ]
47178bd5aee50a059414e3e504940662fbfae0dc
https://github.com/sunt05/SuPy/blob/47178bd5aee50a059414e3e504940662fbfae0dc/docs/source/proc_var_info/gen_df_forcing_output_csv.py#L84-L147
train
sunt05/SuPy
docs/source/proc_var_info/gen_rst.py
gen_opt_str
def gen_opt_str(ser_rec: pd.Series)->str: '''generate rst option string Parameters ---------- ser_rec : pd.Series record for specifications Returns ------- str rst string ''' name = ser_rec.name indent = r' ' str_opt = f'.. option:: {name}'+'\n\n' fo...
python
def gen_opt_str(ser_rec: pd.Series)->str: '''generate rst option string Parameters ---------- ser_rec : pd.Series record for specifications Returns ------- str rst string ''' name = ser_rec.name indent = r' ' str_opt = f'.. option:: {name}'+'\n\n' fo...
[ "def", "gen_opt_str", "(", "ser_rec", ":", "pd", ".", "Series", ")", "->", "str", ":", "name", "=", "ser_rec", ".", "name", "indent", "=", "r' '", "str_opt", "=", "f'.. option:: {name}'", "+", "'\\n\\n'", "for", "spec", "in", "ser_rec", ".", "sort_index...
generate rst option string Parameters ---------- ser_rec : pd.Series record for specifications Returns ------- str rst string
[ "generate", "rst", "option", "string" ]
47178bd5aee50a059414e3e504940662fbfae0dc
https://github.com/sunt05/SuPy/blob/47178bd5aee50a059414e3e504940662fbfae0dc/docs/source/proc_var_info/gen_rst.py#L71-L92
train
sunt05/SuPy
src/supy/supy_module.py
init_supy
def init_supy(path_init: str)->pd.DataFrame: '''Initialise supy by loading initial model states. Parameters ---------- path_init : str Path to a file that can initialise SuPy, which can be either of the follows: * SUEWS :ref:`RunControl.nml<suews:RunControl.nml>`: a namelist file fo...
python
def init_supy(path_init: str)->pd.DataFrame: '''Initialise supy by loading initial model states. Parameters ---------- path_init : str Path to a file that can initialise SuPy, which can be either of the follows: * SUEWS :ref:`RunControl.nml<suews:RunControl.nml>`: a namelist file fo...
[ "def", "init_supy", "(", "path_init", ":", "str", ")", "->", "pd", ".", "DataFrame", ":", "try", ":", "path_init_x", "=", "Path", "(", "path_init", ")", ".", "expanduser", "(", ")", ".", "resolve", "(", ")", "except", "FileNotFoundError", ":", "print", ...
Initialise supy by loading initial model states. Parameters ---------- path_init : str Path to a file that can initialise SuPy, which can be either of the follows: * SUEWS :ref:`RunControl.nml<suews:RunControl.nml>`: a namelist file for SUEWS configurations * SuPy `df_state....
[ "Initialise", "supy", "by", "loading", "initial", "model", "states", "." ]
47178bd5aee50a059414e3e504940662fbfae0dc
https://github.com/sunt05/SuPy/blob/47178bd5aee50a059414e3e504940662fbfae0dc/src/supy/supy_module.py#L50-L95
train
sunt05/SuPy
src/supy/supy_module.py
load_SampleData
def load_SampleData()->Tuple[pandas.DataFrame, pandas.DataFrame]: '''Load sample data for quickly starting a demo run. Returns ------- df_state_init, df_forcing: Tuple[pandas.DataFrame, pandas.DataFrame] - df_state_init: `initial model states <df_state_var>` - df_forcing: `forcing data ...
python
def load_SampleData()->Tuple[pandas.DataFrame, pandas.DataFrame]: '''Load sample data for quickly starting a demo run. Returns ------- df_state_init, df_forcing: Tuple[pandas.DataFrame, pandas.DataFrame] - df_state_init: `initial model states <df_state_var>` - df_forcing: `forcing data ...
[ "def", "load_SampleData", "(", ")", "->", "Tuple", "[", "pandas", ".", "DataFrame", ",", "pandas", ".", "DataFrame", "]", ":", "path_SampleData", "=", "Path", "(", "path_supy_module", ")", "/", "'sample_run'", "path_runcontrol", "=", "path_SampleData", "/", "'...
Load sample data for quickly starting a demo run. Returns ------- df_state_init, df_forcing: Tuple[pandas.DataFrame, pandas.DataFrame] - df_state_init: `initial model states <df_state_var>` - df_forcing: `forcing data <df_forcing_var>` Examples -------- >>> df_state_init, df_f...
[ "Load", "sample", "data", "for", "quickly", "starting", "a", "demo", "run", "." ]
47178bd5aee50a059414e3e504940662fbfae0dc
https://github.com/sunt05/SuPy/blob/47178bd5aee50a059414e3e504940662fbfae0dc/src/supy/supy_module.py#L218-L242
train
sunt05/SuPy
src/supy/supy_module.py
save_supy
def save_supy( df_output: pandas.DataFrame, df_state_final: pandas.DataFrame, freq_s: int = 3600, site: str = '', path_dir_save: str = Path('.'), path_runcontrol: str = None,)->list: '''Save SuPy run results to files Parameters ---------- df_output : pand...
python
def save_supy( df_output: pandas.DataFrame, df_state_final: pandas.DataFrame, freq_s: int = 3600, site: str = '', path_dir_save: str = Path('.'), path_runcontrol: str = None,)->list: '''Save SuPy run results to files Parameters ---------- df_output : pand...
[ "def", "save_supy", "(", "df_output", ":", "pandas", ".", "DataFrame", ",", "df_state_final", ":", "pandas", ".", "DataFrame", ",", "freq_s", ":", "int", "=", "3600", ",", "site", ":", "str", "=", "''", ",", "path_dir_save", ":", "str", "=", "Path", "(...
Save SuPy run results to files Parameters ---------- df_output : pandas.DataFrame DataFrame of output df_state_final : pandas.DataFrame DataFrame of final model states freq_s : int, optional Output frequency in seconds (the default is 3600, which indicates hourly output) ...
[ "Save", "SuPy", "run", "results", "to", "files" ]
47178bd5aee50a059414e3e504940662fbfae0dc
https://github.com/sunt05/SuPy/blob/47178bd5aee50a059414e3e504940662fbfae0dc/src/supy/supy_module.py#L488-L547
train
sunt05/SuPy
src/supy/supy_load.py
load_df_state
def load_df_state(path_csv: Path)->pd.DataFrame: '''load `df_state` from `path_csv` Parameters ---------- path_csv : Path path to the csv file that stores `df_state` produced by a supy run Returns ------- pd.DataFrame `df_state` produced by a supy run ''' df_state ...
python
def load_df_state(path_csv: Path)->pd.DataFrame: '''load `df_state` from `path_csv` Parameters ---------- path_csv : Path path to the csv file that stores `df_state` produced by a supy run Returns ------- pd.DataFrame `df_state` produced by a supy run ''' df_state ...
[ "def", "load_df_state", "(", "path_csv", ":", "Path", ")", "->", "pd", ".", "DataFrame", ":", "df_state", "=", "pd", ".", "read_csv", "(", "path_csv", ",", "header", "=", "[", "0", ",", "1", "]", ",", "index_col", "=", "[", "0", ",", "1", "]", ",...
load `df_state` from `path_csv` Parameters ---------- path_csv : Path path to the csv file that stores `df_state` produced by a supy run Returns ------- pd.DataFrame `df_state` produced by a supy run
[ "load", "df_state", "from", "path_csv" ]
47178bd5aee50a059414e3e504940662fbfae0dc
https://github.com/sunt05/SuPy/blob/47178bd5aee50a059414e3e504940662fbfae0dc/src/supy/supy_load.py#L1600-L1621
train
sunt05/SuPy
docs/source/proc_var_info/gen_df_state_csv.py
extract_var_suews
def extract_var_suews(dict_var_full: dict, var_supy: str)->list: '''extract related SUEWS variables for a supy variable `var_supy` Parameters ---------- dict_var_full : dict dict_var_full = sp.supy_load.exp_dict_full(sp.supy_load.dict_var2SiteSelect) var_supy : str supy variable nam...
python
def extract_var_suews(dict_var_full: dict, var_supy: str)->list: '''extract related SUEWS variables for a supy variable `var_supy` Parameters ---------- dict_var_full : dict dict_var_full = sp.supy_load.exp_dict_full(sp.supy_load.dict_var2SiteSelect) var_supy : str supy variable nam...
[ "def", "extract_var_suews", "(", "dict_var_full", ":", "dict", ",", "var_supy", ":", "str", ")", "->", "list", ":", "x", "=", "sp", ".", "supy_load", ".", "flatten_list", "(", "dict_var_full", "[", "var_supy", "]", ")", "x", "=", "np", ".", "unique", "...
extract related SUEWS variables for a supy variable `var_supy` Parameters ---------- dict_var_full : dict dict_var_full = sp.supy_load.exp_dict_full(sp.supy_load.dict_var2SiteSelect) var_supy : str supy variable name Returns ------- list related SUEWS variables for ...
[ "extract", "related", "SUEWS", "variables", "for", "a", "supy", "variable", "var_supy" ]
47178bd5aee50a059414e3e504940662fbfae0dc
https://github.com/sunt05/SuPy/blob/47178bd5aee50a059414e3e504940662fbfae0dc/docs/source/proc_var_info/gen_df_state_csv.py#L56-L79
train
sunt05/SuPy
docs/source/proc_var_info/gen_df_state_csv.py
gen_df_site
def gen_df_site( list_csv_in=list_table, url_base=url_repo_input_site)->pd.DataFrame: '''Generate description info of supy output results as a dataframe Parameters ---------- path_csv_out : str, optional path to the output csv file (the default is 'df_output.csv') list_csv_i...
python
def gen_df_site( list_csv_in=list_table, url_base=url_repo_input_site)->pd.DataFrame: '''Generate description info of supy output results as a dataframe Parameters ---------- path_csv_out : str, optional path to the output csv file (the default is 'df_output.csv') list_csv_i...
[ "def", "gen_df_site", "(", "list_csv_in", "=", "list_table", ",", "url_base", "=", "url_repo_input_site", ")", "->", "pd", ".", "DataFrame", ":", "list_url_table", "=", "[", "url_base", "/", "table", "for", "table", "in", "list_csv_in", "]", "try", ":", "df_...
Generate description info of supy output results as a dataframe Parameters ---------- path_csv_out : str, optional path to the output csv file (the default is 'df_output.csv') list_csv_in : list, optional list of file names for csv files with meta info (the default is url_repo_input_sit...
[ "Generate", "description", "info", "of", "supy", "output", "results", "as", "a", "dataframe" ]
47178bd5aee50a059414e3e504940662fbfae0dc
https://github.com/sunt05/SuPy/blob/47178bd5aee50a059414e3e504940662fbfae0dc/docs/source/proc_var_info/gen_df_state_csv.py#L105-L178
train
sunt05/SuPy
docs/source/proc_var_info/gen_df_state_csv.py
gen_rst_url_split_opts
def gen_rst_url_split_opts(opts_str): """generate option list for RST docs Parameters ---------- opts_str : str a string including all SUEWS related options/variables. e.g. 'SUEWS_a, SUEWS_b' Returns ------- list a list of parsed RST `:ref:` roles. e.g. [':...
python
def gen_rst_url_split_opts(opts_str): """generate option list for RST docs Parameters ---------- opts_str : str a string including all SUEWS related options/variables. e.g. 'SUEWS_a, SUEWS_b' Returns ------- list a list of parsed RST `:ref:` roles. e.g. [':...
[ "def", "gen_rst_url_split_opts", "(", "opts_str", ")", ":", "if", "opts_str", "is", "not", "'None'", ":", "list_opts", "=", "opts_str", ".", "split", "(", "','", ")", "list_rst", "=", "[", "opt", ".", "strip", "(", ")", "for", "opt", "in", "list_opts", ...
generate option list for RST docs Parameters ---------- opts_str : str a string including all SUEWS related options/variables. e.g. 'SUEWS_a, SUEWS_b' Returns ------- list a list of parsed RST `:ref:` roles. e.g. [':option:`SUEWS_a <suews:SUEWS_a>`']
[ "generate", "option", "list", "for", "RST", "docs" ]
47178bd5aee50a059414e3e504940662fbfae0dc
https://github.com/sunt05/SuPy/blob/47178bd5aee50a059414e3e504940662fbfae0dc/docs/source/proc_var_info/gen_df_state_csv.py#L344-L370
train
sunt05/SuPy
docs/source/proc_var_info/gen_df_state_csv.py
gen_df_state
def gen_df_state( list_table: list, set_initcond: set, set_runcontrol: set, set_input_runcontrol: set)->pd.DataFrame: '''generate dataframe of all state variables used by supy Parameters ---------- list_table : list csv files for site info: `SUEWS_xx.csv` on gith...
python
def gen_df_state( list_table: list, set_initcond: set, set_runcontrol: set, set_input_runcontrol: set)->pd.DataFrame: '''generate dataframe of all state variables used by supy Parameters ---------- list_table : list csv files for site info: `SUEWS_xx.csv` on gith...
[ "def", "gen_df_state", "(", "list_table", ":", "list", ",", "set_initcond", ":", "set", ",", "set_runcontrol", ":", "set", ",", "set_input_runcontrol", ":", "set", ")", "->", "pd", ".", "DataFrame", ":", "df_var_site", "=", "gen_df_site", "(", "list_table", ...
generate dataframe of all state variables used by supy Parameters ---------- list_table : list csv files for site info: `SUEWS_xx.csv` on github SUEWS-docs repo set_initcond : set initial condition related variables set_runcontrol : set runcontrol related variables set_i...
[ "generate", "dataframe", "of", "all", "state", "variables", "used", "by", "supy" ]
47178bd5aee50a059414e3e504940662fbfae0dc
https://github.com/sunt05/SuPy/blob/47178bd5aee50a059414e3e504940662fbfae0dc/docs/source/proc_var_info/gen_df_state_csv.py#L510-L552
train
sunt05/SuPy
src/supy/supy_save.py
gen_df_save
def gen_df_save(df_grid_group: pd.DataFrame)->pd.DataFrame: '''generate a dataframe for saving Parameters ---------- df_output_grid_group : pd.DataFrame an output dataframe of a single group and grid Returns ------- pd.DataFrame a dataframe with date time info prepended for...
python
def gen_df_save(df_grid_group: pd.DataFrame)->pd.DataFrame: '''generate a dataframe for saving Parameters ---------- df_output_grid_group : pd.DataFrame an output dataframe of a single group and grid Returns ------- pd.DataFrame a dataframe with date time info prepended for...
[ "def", "gen_df_save", "(", "df_grid_group", ":", "pd", ".", "DataFrame", ")", "->", "pd", ".", "DataFrame", ":", "idx_dt", "=", "df_grid_group", ".", "index", "ser_year", "=", "pd", ".", "Series", "(", "idx_dt", ".", "year", ",", "index", "=", "idx_dt", ...
generate a dataframe for saving Parameters ---------- df_output_grid_group : pd.DataFrame an output dataframe of a single group and grid Returns ------- pd.DataFrame a dataframe with date time info prepended for saving
[ "generate", "a", "dataframe", "for", "saving" ]
47178bd5aee50a059414e3e504940662fbfae0dc
https://github.com/sunt05/SuPy/blob/47178bd5aee50a059414e3e504940662fbfae0dc/src/supy/supy_save.py#L12-L40
train
sunt05/SuPy
src/supy/supy_save.py
save_df_output
def save_df_output( df_output: pd.DataFrame, freq_s: int = 3600, site: str = '', path_dir_save: Path = Path('.'),)->list: '''save supy output dataframe to txt files Parameters ---------- df_output : pd.DataFrame output dataframe of supy simulation freq_s : in...
python
def save_df_output( df_output: pd.DataFrame, freq_s: int = 3600, site: str = '', path_dir_save: Path = Path('.'),)->list: '''save supy output dataframe to txt files Parameters ---------- df_output : pd.DataFrame output dataframe of supy simulation freq_s : in...
[ "def", "save_df_output", "(", "df_output", ":", "pd", ".", "DataFrame", ",", "freq_s", ":", "int", "=", "3600", ",", "site", ":", "str", "=", "''", ",", "path_dir_save", ":", "Path", "=", "Path", "(", "'.'", ")", ",", ")", "->", "list", ":", "list_...
save supy output dataframe to txt files Parameters ---------- df_output : pd.DataFrame output dataframe of supy simulation freq_s : int, optional output frequency in second (the default is 3600, which indicates the a txt with hourly values) path_dir_save : Path, optional dir...
[ "save", "supy", "output", "dataframe", "to", "txt", "files" ]
47178bd5aee50a059414e3e504940662fbfae0dc
https://github.com/sunt05/SuPy/blob/47178bd5aee50a059414e3e504940662fbfae0dc/src/supy/supy_save.py#L130-L189
train
sunt05/SuPy
src/supy/supy_save.py
save_df_state
def save_df_state( df_state: pd.DataFrame, site: str = '', path_dir_save: Path = Path('.'),)->Path: '''save `df_state` to a csv file Parameters ---------- df_state : pd.DataFrame a dataframe of model states produced by a supy run site : str, optional site ide...
python
def save_df_state( df_state: pd.DataFrame, site: str = '', path_dir_save: Path = Path('.'),)->Path: '''save `df_state` to a csv file Parameters ---------- df_state : pd.DataFrame a dataframe of model states produced by a supy run site : str, optional site ide...
[ "def", "save_df_state", "(", "df_state", ":", "pd", ".", "DataFrame", ",", "site", ":", "str", "=", "''", ",", "path_dir_save", ":", "Path", "=", "Path", "(", "'.'", ")", ",", ")", "->", "Path", ":", "file_state_save", "=", "'df_state_{site}.csv'", ".", ...
save `df_state` to a csv file Parameters ---------- df_state : pd.DataFrame a dataframe of model states produced by a supy run site : str, optional site identifier (the default is '', which indicates an empty site code) path_dir_save : Path, optional path to directory to sav...
[ "save", "df_state", "to", "a", "csv", "file" ]
47178bd5aee50a059414e3e504940662fbfae0dc
https://github.com/sunt05/SuPy/blob/47178bd5aee50a059414e3e504940662fbfae0dc/src/supy/supy_save.py#L194-L221
train
sunt05/SuPy
src/supy/supy_util.py
gen_FS_DF
def gen_FS_DF(df_output): """generate DataFrame of scores. Parameters ---------- df_WS_data : type Description of parameter `df_WS_data`. Returns ------- type Description of returned object. """ df_day = pd.pivot_table( df_output, values=['T2', 'U10...
python
def gen_FS_DF(df_output): """generate DataFrame of scores. Parameters ---------- df_WS_data : type Description of parameter `df_WS_data`. Returns ------- type Description of returned object. """ df_day = pd.pivot_table( df_output, values=['T2', 'U10...
[ "def", "gen_FS_DF", "(", "df_output", ")", ":", "df_day", "=", "pd", ".", "pivot_table", "(", "df_output", ",", "values", "=", "[", "'T2'", ",", "'U10'", ",", "'Kdown'", ",", "'RH2'", "]", ",", "index", "=", "[", "'Year'", ",", "'Month'", ",", "'Day'...
generate DataFrame of scores. Parameters ---------- df_WS_data : type Description of parameter `df_WS_data`. Returns ------- type Description of returned object.
[ "generate", "DataFrame", "of", "scores", "." ]
47178bd5aee50a059414e3e504940662fbfae0dc
https://github.com/sunt05/SuPy/blob/47178bd5aee50a059414e3e504940662fbfae0dc/src/supy/supy_util.py#L140-L174
train
sunt05/SuPy
src/supy/supy_util.py
gen_WS_DF
def gen_WS_DF(df_WS_data): """generate DataFrame of weighted sums. Parameters ---------- df_WS_data : type Description of parameter `df_WS_data`. Returns ------- type Description of returned object. """ df_fs = gen_FS_DF(df_WS_data) list_index = [('mean', 'T2'...
python
def gen_WS_DF(df_WS_data): """generate DataFrame of weighted sums. Parameters ---------- df_WS_data : type Description of parameter `df_WS_data`. Returns ------- type Description of returned object. """ df_fs = gen_FS_DF(df_WS_data) list_index = [('mean', 'T2'...
[ "def", "gen_WS_DF", "(", "df_WS_data", ")", ":", "df_fs", "=", "gen_FS_DF", "(", "df_WS_data", ")", "list_index", "=", "[", "(", "'mean'", ",", "'T2'", ")", ",", "(", "'max'", ",", "'T2'", ")", ",", "(", "'min'", ",", "'T2'", ")", ",", "(", "'mean'...
generate DataFrame of weighted sums. Parameters ---------- df_WS_data : type Description of parameter `df_WS_data`. Returns ------- type Description of returned object.
[ "generate", "DataFrame", "of", "weighted", "sums", "." ]
47178bd5aee50a059414e3e504940662fbfae0dc
https://github.com/sunt05/SuPy/blob/47178bd5aee50a059414e3e504940662fbfae0dc/src/supy/supy_util.py#L177-L208
train
sunt05/SuPy
src/supy/supy_util.py
_geoid_radius
def _geoid_radius(latitude: float) -> float: """Calculates the GEOID radius at a given latitude Parameters ---------- latitude : float Latitude (degrees) Returns ------- R : float GEOID Radius (meters) """ lat = deg2rad(latitude) return sqrt(1/(cos(lat) ** 2 / R...
python
def _geoid_radius(latitude: float) -> float: """Calculates the GEOID radius at a given latitude Parameters ---------- latitude : float Latitude (degrees) Returns ------- R : float GEOID Radius (meters) """ lat = deg2rad(latitude) return sqrt(1/(cos(lat) ** 2 / R...
[ "def", "_geoid_radius", "(", "latitude", ":", "float", ")", "->", "float", ":", "lat", "=", "deg2rad", "(", "latitude", ")", "return", "sqrt", "(", "1", "/", "(", "cos", "(", "lat", ")", "**", "2", "/", "Rmax_WGS84", "**", "2", "+", "sin", "(", "...
Calculates the GEOID radius at a given latitude Parameters ---------- latitude : float Latitude (degrees) Returns ------- R : float GEOID Radius (meters)
[ "Calculates", "the", "GEOID", "radius", "at", "a", "given", "latitude" ]
47178bd5aee50a059414e3e504940662fbfae0dc
https://github.com/sunt05/SuPy/blob/47178bd5aee50a059414e3e504940662fbfae0dc/src/supy/supy_util.py#L518-L532
train
sunt05/SuPy
src/supy/supy_util.py
geometric2geopotential
def geometric2geopotential(z: float, latitude: float) -> float: """Converts geometric height to geopoential height Parameters ---------- z : float Geometric height (meters) latitude : float Latitude (degrees) Returns ------- h : float Geopotential Height (meters...
python
def geometric2geopotential(z: float, latitude: float) -> float: """Converts geometric height to geopoential height Parameters ---------- z : float Geometric height (meters) latitude : float Latitude (degrees) Returns ------- h : float Geopotential Height (meters...
[ "def", "geometric2geopotential", "(", "z", ":", "float", ",", "latitude", ":", "float", ")", "->", "float", ":", "twolat", "=", "deg2rad", "(", "2", "*", "latitude", ")", "g", "=", "9.80616", "*", "(", "1", "-", "0.002637", "*", "cos", "(", "twolat",...
Converts geometric height to geopoential height Parameters ---------- z : float Geometric height (meters) latitude : float Latitude (degrees) Returns ------- h : float Geopotential Height (meters) above the reference ellipsoid
[ "Converts", "geometric", "height", "to", "geopoential", "height" ]
47178bd5aee50a059414e3e504940662fbfae0dc
https://github.com/sunt05/SuPy/blob/47178bd5aee50a059414e3e504940662fbfae0dc/src/supy/supy_util.py#L535-L553
train
sunt05/SuPy
src/supy/supy_util.py
geopotential2geometric
def geopotential2geometric(h: float, latitude: float) -> float: """Converts geopoential height to geometric height Parameters ---------- h : float Geopotential height (meters) latitude : float Latitude (degrees) Returns ------- z : float Geometric Height (meters...
python
def geopotential2geometric(h: float, latitude: float) -> float: """Converts geopoential height to geometric height Parameters ---------- h : float Geopotential height (meters) latitude : float Latitude (degrees) Returns ------- z : float Geometric Height (meters...
[ "def", "geopotential2geometric", "(", "h", ":", "float", ",", "latitude", ":", "float", ")", "->", "float", ":", "twolat", "=", "deg2rad", "(", "2", "*", "latitude", ")", "g", "=", "9.80616", "*", "(", "1", "-", "0.002637", "*", "cos", "(", "twolat",...
Converts geopoential height to geometric height Parameters ---------- h : float Geopotential height (meters) latitude : float Latitude (degrees) Returns ------- z : float Geometric Height (meters) above the reference ellipsoid
[ "Converts", "geopoential", "height", "to", "geometric", "height" ]
47178bd5aee50a059414e3e504940662fbfae0dc
https://github.com/sunt05/SuPy/blob/47178bd5aee50a059414e3e504940662fbfae0dc/src/supy/supy_util.py#L556-L574
train
sunt05/SuPy
src/supy/supy_util.py
get_ser_val_alt
def get_ser_val_alt(lat: float, lon: float, da_alt_x: xr.DataArray, da_alt: xr.DataArray, da_val: xr.DataArray)->pd.Series: '''interpolate atmospheric variable to a specified altitude Parameters ---------- lat : float latitude of specified site lon : ...
python
def get_ser_val_alt(lat: float, lon: float, da_alt_x: xr.DataArray, da_alt: xr.DataArray, da_val: xr.DataArray)->pd.Series: '''interpolate atmospheric variable to a specified altitude Parameters ---------- lat : float latitude of specified site lon : ...
[ "def", "get_ser_val_alt", "(", "lat", ":", "float", ",", "lon", ":", "float", ",", "da_alt_x", ":", "xr", ".", "DataArray", ",", "da_alt", ":", "xr", ".", "DataArray", ",", "da_val", ":", "xr", ".", "DataArray", ")", "->", "pd", ".", "Series", ":", ...
interpolate atmospheric variable to a specified altitude Parameters ---------- lat : float latitude of specified site lon : float longitude of specified site da_alt_x : xr.DataArray desired altitude to interpolate variable at da_alt : xr.DataArray altitude associ...
[ "interpolate", "atmospheric", "variable", "to", "a", "specified", "altitude" ]
47178bd5aee50a059414e3e504940662fbfae0dc
https://github.com/sunt05/SuPy/blob/47178bd5aee50a059414e3e504940662fbfae0dc/src/supy/supy_util.py#L578-L617
train
sunt05/SuPy
src/supy/supy_util.py
get_df_val_alt
def get_df_val_alt(lat: float, lon: float, da_alt_meas: xr.DataArray, ds_val: xr.Dataset): '''interpolate atmospheric variables to a specified altitude Parameters ---------- lat : float latitude of specified site lon : float longitude of specified site da_alt_x : xr.DataArray ...
python
def get_df_val_alt(lat: float, lon: float, da_alt_meas: xr.DataArray, ds_val: xr.Dataset): '''interpolate atmospheric variables to a specified altitude Parameters ---------- lat : float latitude of specified site lon : float longitude of specified site da_alt_x : xr.DataArray ...
[ "def", "get_df_val_alt", "(", "lat", ":", "float", ",", "lon", ":", "float", ",", "da_alt_meas", ":", "xr", ".", "DataArray", ",", "ds_val", ":", "xr", ".", "Dataset", ")", ":", "da_alt", "=", "geopotential2geometric", "(", "ds_val", ".", "z", ",", "ds...
interpolate atmospheric variables to a specified altitude Parameters ---------- lat : float latitude of specified site lon : float longitude of specified site da_alt_x : xr.DataArray desired altitude to interpolate variable at da_alt : xr.DataArray altitude assoc...
[ "interpolate", "atmospheric", "variables", "to", "a", "specified", "altitude" ]
47178bd5aee50a059414e3e504940662fbfae0dc
https://github.com/sunt05/SuPy/blob/47178bd5aee50a059414e3e504940662fbfae0dc/src/supy/supy_util.py#L620-L661
train
sunt05/SuPy
src/supy/supy_util.py
sel_list_pres
def sel_list_pres(ds_sfc_x): ''' select proper levels for model level data download ''' p_min, p_max = ds_sfc_x.sp.min().values, ds_sfc_x.sp.max().values list_pres_level = [ '1', '2', '3', '5', '7', '10', '20', '30', '50', '70', '100', '125', '150', '175', '20...
python
def sel_list_pres(ds_sfc_x): ''' select proper levels for model level data download ''' p_min, p_max = ds_sfc_x.sp.min().values, ds_sfc_x.sp.max().values list_pres_level = [ '1', '2', '3', '5', '7', '10', '20', '30', '50', '70', '100', '125', '150', '175', '20...
[ "def", "sel_list_pres", "(", "ds_sfc_x", ")", ":", "p_min", ",", "p_max", "=", "ds_sfc_x", ".", "sp", ".", "min", "(", ")", ".", "values", ",", "ds_sfc_x", ".", "sp", ".", "max", "(", ")", ".", "values", "list_pres_level", "=", "[", "'1'", ",", "'2...
select proper levels for model level data download
[ "select", "proper", "levels", "for", "model", "level", "data", "download" ]
47178bd5aee50a059414e3e504940662fbfae0dc
https://github.com/sunt05/SuPy/blob/47178bd5aee50a059414e3e504940662fbfae0dc/src/supy/supy_util.py#L811-L838
train
ecell/ecell4
ecell4/util/simulation.py
load_world
def load_world(filename): """ Load a world from the given HDF5 filename. The return type is determined by ``ecell4_base.core.load_version_information``. Parameters ---------- filename : str A HDF5 filename. Returns ------- w : World Return one from ``BDWorld``, ``EG...
python
def load_world(filename): """ Load a world from the given HDF5 filename. The return type is determined by ``ecell4_base.core.load_version_information``. Parameters ---------- filename : str A HDF5 filename. Returns ------- w : World Return one from ``BDWorld``, ``EG...
[ "def", "load_world", "(", "filename", ")", ":", "import", "ecell4_base", "vinfo", "=", "ecell4_base", ".", "core", ".", "load_version_information", "(", "filename", ")", "if", "vinfo", ".", "startswith", "(", "\"ecell4-bd\"", ")", ":", "return", "ecell4_base", ...
Load a world from the given HDF5 filename. The return type is determined by ``ecell4_base.core.load_version_information``. Parameters ---------- filename : str A HDF5 filename. Returns ------- w : World Return one from ``BDWorld``, ``EGFRDWorld``, ``MesoscopicWorld``, ...
[ "Load", "a", "world", "from", "the", "given", "HDF5", "filename", ".", "The", "return", "type", "is", "determined", "by", "ecell4_base", ".", "core", ".", "load_version_information", "." ]
a4a1229661c39b2059adbbacae9090e5ba664e01
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/util/simulation.py#L10-L44
train
ecell/ecell4
ecell4/util/show.py
show
def show(target, *args, **kwargs): """ An utility function to display the given target object in the proper way. Paramters --------- target : NumberObserver, TrajectoryObserver, World, str When a NumberObserver object is given, show it with viz.plot_number_observer. When a Trajector...
python
def show(target, *args, **kwargs): """ An utility function to display the given target object in the proper way. Paramters --------- target : NumberObserver, TrajectoryObserver, World, str When a NumberObserver object is given, show it with viz.plot_number_observer. When a Trajector...
[ "def", "show", "(", "target", ",", "*", "args", ",", "**", "kwargs", ")", ":", "if", "isinstance", "(", "target", ",", "(", "ecell4_base", ".", "core", ".", "FixedIntervalNumberObserver", ",", "ecell4_base", ".", "core", ".", "NumberObserver", ",", "ecell4...
An utility function to display the given target object in the proper way. Paramters --------- target : NumberObserver, TrajectoryObserver, World, str When a NumberObserver object is given, show it with viz.plot_number_observer. When a TrajectoryObserver object is given, show it with viz.plo...
[ "An", "utility", "function", "to", "display", "the", "given", "target", "object", "in", "the", "proper", "way", "." ]
a4a1229661c39b2059adbbacae9090e5ba664e01
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/util/show.py#L15-L43
train
ecell/ecell4
ecell4/extra/azure_batch.py
print_batch_exception
def print_batch_exception(batch_exception): """Prints the contents of the specified Batch exception. :param batch_exception: """ _log.error('-------------------------------------------') _log.error('Exception encountered:') if batch_exception.error and \ batch_exception.error.messag...
python
def print_batch_exception(batch_exception): """Prints the contents of the specified Batch exception. :param batch_exception: """ _log.error('-------------------------------------------') _log.error('Exception encountered:') if batch_exception.error and \ batch_exception.error.messag...
[ "def", "print_batch_exception", "(", "batch_exception", ")", ":", "_log", ".", "error", "(", "'-------------------------------------------'", ")", "_log", ".", "error", "(", "'Exception encountered:'", ")", "if", "batch_exception", ".", "error", "and", "batch_exception"...
Prints the contents of the specified Batch exception. :param batch_exception:
[ "Prints", "the", "contents", "of", "the", "specified", "Batch", "exception", "." ]
a4a1229661c39b2059adbbacae9090e5ba664e01
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/extra/azure_batch.py#L45-L60
train
ecell/ecell4
ecell4/extra/azure_batch.py
upload_file_to_container
def upload_file_to_container(block_blob_client, container_name, file_path): """Uploads a local file to an Azure Blob storage container. :param block_blob_client: A blob service client. :type block_blob_client: `azure.storage.blob.BlockBlobService` :param str container_name: The name of the Azure Blob s...
python
def upload_file_to_container(block_blob_client, container_name, file_path): """Uploads a local file to an Azure Blob storage container. :param block_blob_client: A blob service client. :type block_blob_client: `azure.storage.blob.BlockBlobService` :param str container_name: The name of the Azure Blob s...
[ "def", "upload_file_to_container", "(", "block_blob_client", ",", "container_name", ",", "file_path", ")", ":", "blob_name", "=", "os", ".", "path", ".", "basename", "(", "file_path", ")", "_log", ".", "info", "(", "'Uploading file {} to container [{}]...'", ".", ...
Uploads a local file to an Azure Blob storage container. :param block_blob_client: A blob service client. :type block_blob_client: `azure.storage.blob.BlockBlobService` :param str container_name: The name of the Azure Blob storage container. :param str file_path: The local path to the file. :rtype:...
[ "Uploads", "a", "local", "file", "to", "an", "Azure", "Blob", "storage", "container", "." ]
a4a1229661c39b2059adbbacae9090e5ba664e01
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/extra/azure_batch.py#L62-L91
train
ecell/ecell4
ecell4/extra/azure_batch.py
get_container_sas_token
def get_container_sas_token(block_blob_client, container_name, blob_permissions): """Obtains a shared access signature granting the specified permissions to the container. :param block_blob_client: A blob service client. :type block_blob_client: `azure.storage.blob.BlockBlob...
python
def get_container_sas_token(block_blob_client, container_name, blob_permissions): """Obtains a shared access signature granting the specified permissions to the container. :param block_blob_client: A blob service client. :type block_blob_client: `azure.storage.blob.BlockBlob...
[ "def", "get_container_sas_token", "(", "block_blob_client", ",", "container_name", ",", "blob_permissions", ")", ":", "container_sas_token", "=", "block_blob_client", ".", "generate_container_shared_access_signature", "(", "container_name", ",", "permission", "=", "blob_permi...
Obtains a shared access signature granting the specified permissions to the container. :param block_blob_client: A blob service client. :type block_blob_client: `azure.storage.blob.BlockBlobService` :param str container_name: The name of the Azure Blob storage container. :param BlobPermissions blob...
[ "Obtains", "a", "shared", "access", "signature", "granting", "the", "specified", "permissions", "to", "the", "container", "." ]
a4a1229661c39b2059adbbacae9090e5ba664e01
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/extra/azure_batch.py#L93-L114
train
ecell/ecell4
ecell4/extra/azure_batch.py
create_pool
def create_pool(batch_service_client, pool_id, resource_files, publisher, offer, sku, task_file, vm_size, node_count): """Creates a pool of compute nodes with the specified OS settings. :param batch_service_client: A Batch service client. :type batch_service_client: `azure.b...
python
def create_pool(batch_service_client, pool_id, resource_files, publisher, offer, sku, task_file, vm_size, node_count): """Creates a pool of compute nodes with the specified OS settings. :param batch_service_client: A Batch service client. :type batch_service_client: `azure.b...
[ "def", "create_pool", "(", "batch_service_client", ",", "pool_id", ",", "resource_files", ",", "publisher", ",", "offer", ",", "sku", ",", "task_file", ",", "vm_size", ",", "node_count", ")", ":", "_log", ".", "info", "(", "'Creating pool [{}]...'", ".", "form...
Creates a pool of compute nodes with the specified OS settings. :param batch_service_client: A Batch service client. :type batch_service_client: `azure.batch.BatchServiceClient` :param str pool_id: An ID for the new pool. :param list resource_files: A collection of resource files for the pool's sta...
[ "Creates", "a", "pool", "of", "compute", "nodes", "with", "the", "specified", "OS", "settings", "." ]
a4a1229661c39b2059adbbacae9090e5ba664e01
https://github.com/ecell/ecell4/blob/a4a1229661c39b2059adbbacae9090e5ba664e01/ecell4/extra/azure_batch.py#L161-L232
train