repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
aouyar/PyMunin
pymunin/plugins/ntphostoffsets.py
MuninNTPhostOffsetsPlugin.autoconf
def autoconf(self): """Implements Munin Plugin Auto-Configuration Option. @return: True if plugin can be auto-configured, False otherwise. """ ntpinfo = NTPinfo() ntpstats = ntpinfo.getHostOffsets(self._remoteHosts) return len(ntpstats) > 0
python
def autoconf(self): """Implements Munin Plugin Auto-Configuration Option. @return: True if plugin can be auto-configured, False otherwise. """ ntpinfo = NTPinfo() ntpstats = ntpinfo.getHostOffsets(self._remoteHosts) return len(ntpstats) > 0
[ "def", "autoconf", "(", "self", ")", ":", "ntpinfo", "=", "NTPinfo", "(", ")", "ntpstats", "=", "ntpinfo", ".", "getHostOffsets", "(", "self", ".", "_remoteHosts", ")", "return", "len", "(", "ntpstats", ")", ">", "0" ]
Implements Munin Plugin Auto-Configuration Option. @return: True if plugin can be auto-configured, False otherwise.
[ "Implements", "Munin", "Plugin", "Auto", "-", "Configuration", "Option", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/ntphostoffsets.py#L138-L146
aouyar/PyMunin
pymunin/plugins/lighttpdstats.py
MuninLighttpdPlugin.retrieveVals
def retrieveVals(self): """Retrieve values for graphs.""" lighttpdInfo = LighttpdInfo(self._host, self._port, self._user, self._password, self._statuspath, self._ssl) stats = lighttpdInfo.getServerStats() if self.hasGraph('...
python
def retrieveVals(self): """Retrieve values for graphs.""" lighttpdInfo = LighttpdInfo(self._host, self._port, self._user, self._password, self._statuspath, self._ssl) stats = lighttpdInfo.getServerStats() if self.hasGraph('...
[ "def", "retrieveVals", "(", "self", ")", ":", "lighttpdInfo", "=", "LighttpdInfo", "(", "self", ".", "_host", ",", "self", ".", "_port", ",", "self", ".", "_user", ",", "self", ".", "_password", ",", "self", ".", "_statuspath", ",", "self", ".", "_ssl"...
Retrieve values for graphs.
[ "Retrieve", "values", "for", "graphs", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/lighttpdstats.py#L124-L138
aouyar/PyMunin
pymunin/plugins/lighttpdstats.py
MuninLighttpdPlugin.autoconf
def autoconf(self): """Implements Munin Plugin Auto-Configuration Option. @return: True if plugin can be auto-configured, False otherwise. """ lighttpdInfo = LighttpdInfo(self._host, self._port, self._user, self._password, ...
python
def autoconf(self): """Implements Munin Plugin Auto-Configuration Option. @return: True if plugin can be auto-configured, False otherwise. """ lighttpdInfo = LighttpdInfo(self._host, self._port, self._user, self._password, ...
[ "def", "autoconf", "(", "self", ")", ":", "lighttpdInfo", "=", "LighttpdInfo", "(", "self", ".", "_host", ",", "self", ".", "_port", ",", "self", ".", "_user", ",", "self", ".", "_password", ",", "self", ".", "_statuspath", ",", "self", ".", "_ssl", ...
Implements Munin Plugin Auto-Configuration Option. @return: True if plugin can be auto-configured, False otherwise.
[ "Implements", "Munin", "Plugin", "Auto", "-", "Configuration", "Option", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/lighttpdstats.py#L140-L149
aouyar/PyMunin
pymunin/plugins/diskusagestats.py
MuninDiskUsagePlugin.retrieveVals
def retrieveVals(self): """Retrieve values for graphs.""" name = 'diskspace' if self.hasGraph(name): for fspath in self._fslist: if self._statsSpace.has_key(fspath): self.setGraphVal(name, fspath, self._statsSp...
python
def retrieveVals(self): """Retrieve values for graphs.""" name = 'diskspace' if self.hasGraph(name): for fspath in self._fslist: if self._statsSpace.has_key(fspath): self.setGraphVal(name, fspath, self._statsSp...
[ "def", "retrieveVals", "(", "self", ")", ":", "name", "=", "'diskspace'", "if", "self", ".", "hasGraph", "(", "name", ")", ":", "for", "fspath", "in", "self", ".", "_fslist", ":", "if", "self", ".", "_statsSpace", ".", "has_key", "(", "fspath", ")", ...
Retrieve values for graphs.
[ "Retrieve", "values", "for", "graphs", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/diskusagestats.py#L121-L134
scikit-umfpack/scikit-umfpack
scikits/umfpack/umfpack.py
UmfpackContext.symbolic
def symbolic(self, mtx): """ Perform symbolic object (symbolic LU decomposition) computation for a given sparsity pattern. """ self.free_symbolic() indx = self._getIndx(mtx) if not assumeSortedIndices: # row/column indices cannot be assumed to be sor...
python
def symbolic(self, mtx): """ Perform symbolic object (symbolic LU decomposition) computation for a given sparsity pattern. """ self.free_symbolic() indx = self._getIndx(mtx) if not assumeSortedIndices: # row/column indices cannot be assumed to be sor...
[ "def", "symbolic", "(", "self", ",", "mtx", ")", ":", "self", ".", "free_symbolic", "(", ")", "indx", "=", "self", ".", "_getIndx", "(", "mtx", ")", "if", "not", "assumeSortedIndices", ":", "# row/column indices cannot be assumed to be sorted", "mtx", ".", "so...
Perform symbolic object (symbolic LU decomposition) computation for a given sparsity pattern.
[ "Perform", "symbolic", "object", "(", "symbolic", "LU", "decomposition", ")", "computation", "for", "a", "given", "sparsity", "pattern", "." ]
train
https://github.com/scikit-umfpack/scikit-umfpack/blob/a2102ef92f4dd060138e72bb5d7c444f8ec49cbc/scikits/umfpack/umfpack.py#L492-L525
scikit-umfpack/scikit-umfpack
scikits/umfpack/umfpack.py
UmfpackContext.numeric
def numeric(self, mtx): """ Perform numeric object (LU decomposition) computation using the symbolic decomposition. The symbolic decomposition is (re)computed if necessary. """ self.free_numeric() if self._symbolic is None: self.symbolic(mtx) ...
python
def numeric(self, mtx): """ Perform numeric object (LU decomposition) computation using the symbolic decomposition. The symbolic decomposition is (re)computed if necessary. """ self.free_numeric() if self._symbolic is None: self.symbolic(mtx) ...
[ "def", "numeric", "(", "self", ",", "mtx", ")", ":", "self", ".", "free_numeric", "(", ")", "if", "self", ".", "_symbolic", "is", "None", ":", "self", ".", "symbolic", "(", "mtx", ")", "indx", "=", "self", ".", "_getIndx", "(", "mtx", ")", "failCou...
Perform numeric object (LU decomposition) computation using the symbolic decomposition. The symbolic decomposition is (re)computed if necessary.
[ "Perform", "numeric", "object", "(", "LU", "decomposition", ")", "computation", "using", "the", "symbolic", "decomposition", ".", "The", "symbolic", "decomposition", "is", "(", "re", ")", "computed", "if", "necessary", "." ]
train
https://github.com/scikit-umfpack/scikit-umfpack/blob/a2102ef92f4dd060138e72bb5d7c444f8ec49cbc/scikits/umfpack/umfpack.py#L532-L577
scikit-umfpack/scikit-umfpack
scikits/umfpack/umfpack.py
UmfpackContext.free_symbolic
def free_symbolic(self): """Free symbolic data""" if self._symbolic is not None: self.funs.free_symbolic(self._symbolic) self._symbolic = None self.mtx = None
python
def free_symbolic(self): """Free symbolic data""" if self._symbolic is not None: self.funs.free_symbolic(self._symbolic) self._symbolic = None self.mtx = None
[ "def", "free_symbolic", "(", "self", ")", ":", "if", "self", ".", "_symbolic", "is", "not", "None", ":", "self", ".", "funs", ".", "free_symbolic", "(", "self", ".", "_symbolic", ")", "self", ".", "_symbolic", "=", "None", "self", ".", "mtx", "=", "N...
Free symbolic data
[ "Free", "symbolic", "data" ]
train
https://github.com/scikit-umfpack/scikit-umfpack/blob/a2102ef92f4dd060138e72bb5d7c444f8ec49cbc/scikits/umfpack/umfpack.py#L615-L620
scikit-umfpack/scikit-umfpack
scikits/umfpack/umfpack.py
UmfpackContext.free_numeric
def free_numeric(self): """Free numeric data""" if self._numeric is not None: self.funs.free_numeric(self._numeric) self._numeric = None self.free_symbolic()
python
def free_numeric(self): """Free numeric data""" if self._numeric is not None: self.funs.free_numeric(self._numeric) self._numeric = None self.free_symbolic()
[ "def", "free_numeric", "(", "self", ")", ":", "if", "self", ".", "_numeric", "is", "not", "None", ":", "self", ".", "funs", ".", "free_numeric", "(", "self", ".", "_numeric", ")", "self", ".", "_numeric", "=", "None", "self", ".", "free_symbolic", "(",...
Free numeric data
[ "Free", "numeric", "data" ]
train
https://github.com/scikit-umfpack/scikit-umfpack/blob/a2102ef92f4dd060138e72bb5d7c444f8ec49cbc/scikits/umfpack/umfpack.py#L625-L630
scikit-umfpack/scikit-umfpack
scikits/umfpack/umfpack.py
UmfpackContext.solve
def solve(self, sys, mtx, rhs, autoTranspose=False): """ Solution of system of linear equation using the Numeric object. Parameters ---------- sys : constant one of UMFPACK system description constants, like UMFPACK_A, UMFPACK_At, see umfSys list and UMFP...
python
def solve(self, sys, mtx, rhs, autoTranspose=False): """ Solution of system of linear equation using the Numeric object. Parameters ---------- sys : constant one of UMFPACK system description constants, like UMFPACK_A, UMFPACK_At, see umfSys list and UMFP...
[ "def", "solve", "(", "self", ",", "sys", ",", "mtx", ",", "rhs", ",", "autoTranspose", "=", "False", ")", ":", "if", "sys", "not", "in", "umfSys", ":", "raise", "ValueError", "(", "'sys must be in'", "%", "umfSys", ")", "if", "autoTranspose", "and", "s...
Solution of system of linear equation using the Numeric object. Parameters ---------- sys : constant one of UMFPACK system description constants, like UMFPACK_A, UMFPACK_At, see umfSys list and UMFPACK docs mtx : scipy.sparse.csc_matrix or scipy.sparse.csr_matrix...
[ "Solution", "of", "system", "of", "linear", "equation", "using", "the", "Numeric", "object", "." ]
train
https://github.com/scikit-umfpack/scikit-umfpack/blob/a2102ef92f4dd060138e72bb5d7c444f8ec49cbc/scikits/umfpack/umfpack.py#L645-L723
scikit-umfpack/scikit-umfpack
scikits/umfpack/umfpack.py
UmfpackContext.linsolve
def linsolve(self, sys, mtx, rhs, autoTranspose=False): """ One-shot solution of system of linear equation. Reuses Numeric object if possible. Parameters ---------- sys : constant one of UMFPACK system description constants, like UMFPACK_A, UMFPAC...
python
def linsolve(self, sys, mtx, rhs, autoTranspose=False): """ One-shot solution of system of linear equation. Reuses Numeric object if possible. Parameters ---------- sys : constant one of UMFPACK system description constants, like UMFPACK_A, UMFPAC...
[ "def", "linsolve", "(", "self", ",", "sys", ",", "mtx", ",", "rhs", ",", "autoTranspose", "=", "False", ")", ":", "if", "sys", "not", "in", "umfSys", ":", "raise", "ValueError", "(", "'sys must be in'", "%", "umfSys", ")", "if", "self", ".", "_numeric"...
One-shot solution of system of linear equation. Reuses Numeric object if possible. Parameters ---------- sys : constant one of UMFPACK system description constants, like UMFPACK_A, UMFPACK_At, see umfSys list and UMFPACK docs mtx : scipy.sparse.csc_matrix...
[ "One", "-", "shot", "solution", "of", "system", "of", "linear", "equation", ".", "Reuses", "Numeric", "object", "if", "possible", "." ]
train
https://github.com/scikit-umfpack/scikit-umfpack/blob/a2102ef92f4dd060138e72bb5d7c444f8ec49cbc/scikits/umfpack/umfpack.py#L728-L764
scikit-umfpack/scikit-umfpack
scikits/umfpack/umfpack.py
UmfpackContext.lu
def lu(self, mtx): """ Perform LU decomposition. For a given matrix A, the decomposition satisfies:: LU = PRAQ when do_recip is true LU = P(R^-1)AQ when do_recip is false Parameters ---------- mtx : scipy.sparse.csc_matrix or sc...
python
def lu(self, mtx): """ Perform LU decomposition. For a given matrix A, the decomposition satisfies:: LU = PRAQ when do_recip is true LU = P(R^-1)AQ when do_recip is false Parameters ---------- mtx : scipy.sparse.csc_matrix or sc...
[ "def", "lu", "(", "self", ",", "mtx", ")", ":", "# this should probably be changed", "mtx", "=", "mtx", ".", "tocsc", "(", ")", "self", ".", "numeric", "(", "mtx", ")", "# first find out how much space to reserve", "(", "status", ",", "lnz", ",", "unz", ",",...
Perform LU decomposition. For a given matrix A, the decomposition satisfies:: LU = PRAQ when do_recip is true LU = P(R^-1)AQ when do_recip is false Parameters ---------- mtx : scipy.sparse.csc_matrix or scipy.sparse.csr_matrix Input...
[ "Perform", "LU", "decomposition", "." ]
train
https://github.com/scikit-umfpack/scikit-umfpack/blob/a2102ef92f4dd060138e72bb5d7c444f8ec49cbc/scikits/umfpack/umfpack.py#L801-L903
ContextLab/quail
quail/fingerprint.py
order_stick
def order_stick(presenter, egg, dist_dict, strategy, fingerprint): """ Reorders a list according to strategy """ def compute_feature_stick(features, weights, alpha): '''create a 'stick' of feature weights''' feature_stick = [] for f, w in zip(features, weights): fea...
python
def order_stick(presenter, egg, dist_dict, strategy, fingerprint): """ Reorders a list according to strategy """ def compute_feature_stick(features, weights, alpha): '''create a 'stick' of feature weights''' feature_stick = [] for f, w in zip(features, weights): fea...
[ "def", "order_stick", "(", "presenter", ",", "egg", ",", "dist_dict", ",", "strategy", ",", "fingerprint", ")", ":", "def", "compute_feature_stick", "(", "features", ",", "weights", ",", "alpha", ")", ":", "'''create a 'stick' of feature weights'''", "feature_stick"...
Reorders a list according to strategy
[ "Reorders", "a", "list", "according", "to", "strategy" ]
train
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/fingerprint.py#L346-L464
ContextLab/quail
quail/fingerprint.py
stick_perm
def stick_perm(presenter, egg, dist_dict, strategy): """Computes weights for one reordering using stick-breaking method""" # seed RNG np.random.seed() # unpack egg egg_pres, egg_rec, egg_features, egg_dist_funcs = parse_egg(egg) # reorder regg = order_stick(presenter, egg, dist_dict, stra...
python
def stick_perm(presenter, egg, dist_dict, strategy): """Computes weights for one reordering using stick-breaking method""" # seed RNG np.random.seed() # unpack egg egg_pres, egg_rec, egg_features, egg_dist_funcs = parse_egg(egg) # reorder regg = order_stick(presenter, egg, dist_dict, stra...
[ "def", "stick_perm", "(", "presenter", ",", "egg", ",", "dist_dict", ",", "strategy", ")", ":", "# seed RNG", "np", ".", "random", ".", "seed", "(", ")", "# unpack egg", "egg_pres", ",", "egg_rec", ",", "egg_features", ",", "egg_dist_funcs", "=", "parse_egg"...
Computes weights for one reordering using stick-breaking method
[ "Computes", "weights", "for", "one", "reordering", "using", "stick", "-", "breaking", "method" ]
train
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/fingerprint.py#L577-L603
ContextLab/quail
quail/fingerprint.py
compute_distances_dict
def compute_distances_dict(egg): """ Creates a nested dict of distances """ pres, rec, features, dist_funcs = parse_egg(egg) pres_list = list(pres) features_list = list(features) # initialize dist dict distances = {} # for each word in the list for idx1, item1 in enumerate(pres_list): ...
python
def compute_distances_dict(egg): """ Creates a nested dict of distances """ pres, rec, features, dist_funcs = parse_egg(egg) pres_list = list(pres) features_list = list(features) # initialize dist dict distances = {} # for each word in the list for idx1, item1 in enumerate(pres_list): ...
[ "def", "compute_distances_dict", "(", "egg", ")", ":", "pres", ",", "rec", ",", "features", ",", "dist_funcs", "=", "parse_egg", "(", "egg", ")", "pres_list", "=", "list", "(", "pres", ")", "features_list", "=", "list", "(", "features", ")", "# initialize ...
Creates a nested dict of distances
[ "Creates", "a", "nested", "dict", "of", "distances" ]
train
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/fingerprint.py#L637-L660
ContextLab/quail
quail/fingerprint.py
compute_feature_weights_dict
def compute_feature_weights_dict(pres_list, rec_list, feature_list, dist_dict): """ Compute clustering scores along a set of feature dimensions Parameters ---------- pres_list : list list of presented words rec_list : list list of recalled words feature_list : list l...
python
def compute_feature_weights_dict(pres_list, rec_list, feature_list, dist_dict): """ Compute clustering scores along a set of feature dimensions Parameters ---------- pres_list : list list of presented words rec_list : list list of recalled words feature_list : list l...
[ "def", "compute_feature_weights_dict", "(", "pres_list", ",", "rec_list", ",", "feature_list", ",", "dist_dict", ")", ":", "# initialize the weights object for just this list", "weights", "=", "{", "}", "for", "feature", "in", "feature_list", "[", "0", "]", ":", "we...
Compute clustering scores along a set of feature dimensions Parameters ---------- pres_list : list list of presented words rec_list : list list of recalled words feature_list : list list of feature dicts for presented words distances : dict dict of distance matri...
[ "Compute", "clustering", "scores", "along", "a", "set", "of", "feature", "dimensions" ]
train
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/fingerprint.py#L662-L739
ContextLab/quail
quail/fingerprint.py
Fingerprint.update
def update(self, egg, permute=False, nperms=1000, parallel=False): """ In-place method that updates fingerprint with new data Parameters ---------- egg : quail.Egg Data to update fingerprint Returns ---------- None """...
python
def update(self, egg, permute=False, nperms=1000, parallel=False): """ In-place method that updates fingerprint with new data Parameters ---------- egg : quail.Egg Data to update fingerprint Returns ---------- None """...
[ "def", "update", "(", "self", ",", "egg", ",", "permute", "=", "False", ",", "nperms", "=", "1000", ",", "parallel", "=", "False", ")", ":", "# increment n", "self", ".", "n", "+=", "1", "next_weights", "=", "np", ".", "nanmean", "(", "_analyze_chunk",...
In-place method that updates fingerprint with new data Parameters ---------- egg : quail.Egg Data to update fingerprint Returns ---------- None
[ "In", "-", "place", "method", "that", "updates", "fingerprint", "with", "new", "data" ]
train
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/fingerprint.py#L83-L121
ContextLab/quail
quail/fingerprint.py
OptimalPresenter.order
def order(self, egg, method='permute', nperms=2500, strategy=None, distfun='correlation', fingerprint=None): """ Reorders a list of stimuli to match a fingerprint Parameters ---------- egg : quail.Egg Data to compute fingerprint method : str ...
python
def order(self, egg, method='permute', nperms=2500, strategy=None, distfun='correlation', fingerprint=None): """ Reorders a list of stimuli to match a fingerprint Parameters ---------- egg : quail.Egg Data to compute fingerprint method : str ...
[ "def", "order", "(", "self", ",", "egg", ",", "method", "=", "'permute'", ",", "nperms", "=", "2500", ",", "strategy", "=", "None", ",", "distfun", "=", "'correlation'", ",", "fingerprint", "=", "None", ")", ":", "def", "order_perm", "(", "self", ",", ...
Reorders a list of stimuli to match a fingerprint Parameters ---------- egg : quail.Egg Data to compute fingerprint method : str Method to re-sort list. Can be 'stick' or 'permute' (default: permute) nperms : int Number of permutations to us...
[ "Reorders", "a", "list", "of", "stimuli", "to", "match", "a", "fingerprint" ]
train
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/fingerprint.py#L203-L344
aouyar/PyMunin
pysysinfo/phpopc.py
OPCinfo.initStats
def initStats(self, extras=None): """Query and parse Web Server Status Page. @param extras: Include extra metrics, which can be computationally more expensive. """ url = "%s://%s:%d/%s" % (self._proto, self._host, self._port, self._monpath) ...
python
def initStats(self, extras=None): """Query and parse Web Server Status Page. @param extras: Include extra metrics, which can be computationally more expensive. """ url = "%s://%s:%d/%s" % (self._proto, self._host, self._port, self._monpath) ...
[ "def", "initStats", "(", "self", ",", "extras", "=", "None", ")", ":", "url", "=", "\"%s://%s:%d/%s\"", "%", "(", "self", ".", "_proto", ",", "self", ".", "_host", ",", "self", ".", "_port", ",", "self", ".", "_monpath", ")", "response", "=", "util",...
Query and parse Web Server Status Page. @param extras: Include extra metrics, which can be computationally more expensive.
[ "Query", "and", "parse", "Web", "Server", "Status", "Page", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/phpopc.py#L72-L83
aouyar/PyMunin
pysysinfo/diskio.py
DiskIOinfo._getDevMajorMinor
def _getDevMajorMinor(self, devpath): """Return major and minor device number for block device path devpath. @param devpath: Full path for block device. @return: Tuple (major, minor). """ fstat = os.stat(devpath) if stat.S_ISBLK(fstat.st_mode): ...
python
def _getDevMajorMinor(self, devpath): """Return major and minor device number for block device path devpath. @param devpath: Full path for block device. @return: Tuple (major, minor). """ fstat = os.stat(devpath) if stat.S_ISBLK(fstat.st_mode): ...
[ "def", "_getDevMajorMinor", "(", "self", ",", "devpath", ")", ":", "fstat", "=", "os", ".", "stat", "(", "devpath", ")", "if", "stat", ".", "S_ISBLK", "(", "fstat", ".", "st_mode", ")", ":", "return", "(", "os", ".", "major", "(", "fstat", ".", "st...
Return major and minor device number for block device path devpath. @param devpath: Full path for block device. @return: Tuple (major, minor).
[ "Return", "major", "and", "minor", "device", "number", "for", "block", "device", "path", "devpath", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/diskio.py#L53-L63
aouyar/PyMunin
pysysinfo/diskio.py
DiskIOinfo._getUniqueDev
def _getUniqueDev(self, devpath): """Return unique device for any block device path. @param devpath: Full path for block device. @return: Unique device string without the /dev prefix. """ realpath = os.path.realpath(devpath) mobj = re.match('\/dev...
python
def _getUniqueDev(self, devpath): """Return unique device for any block device path. @param devpath: Full path for block device. @return: Unique device string without the /dev prefix. """ realpath = os.path.realpath(devpath) mobj = re.match('\/dev...
[ "def", "_getUniqueDev", "(", "self", ",", "devpath", ")", ":", "realpath", "=", "os", ".", "path", ".", "realpath", "(", "devpath", ")", "mobj", "=", "re", ".", "match", "(", "'\\/dev\\/(.*)$'", ",", "realpath", ")", "if", "mobj", ":", "dev", "=", "m...
Return unique device for any block device path. @param devpath: Full path for block device. @return: Unique device string without the /dev prefix.
[ "Return", "unique", "device", "for", "any", "block", "device", "path", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/diskio.py#L65-L84
aouyar/PyMunin
pysysinfo/diskio.py
DiskIOinfo._initBlockMajorMap
def _initBlockMajorMap(self): """Parses /proc/devices to initialize device class - major number map for block devices. """ self._mapMajorDevclass = {} try: fp = open(devicesFile, 'r') data = fp.read() fp.close() except: ...
python
def _initBlockMajorMap(self): """Parses /proc/devices to initialize device class - major number map for block devices. """ self._mapMajorDevclass = {} try: fp = open(devicesFile, 'r') data = fp.read() fp.close() except: ...
[ "def", "_initBlockMajorMap", "(", "self", ")", ":", "self", ".", "_mapMajorDevclass", "=", "{", "}", "try", ":", "fp", "=", "open", "(", "devicesFile", ",", "'r'", ")", "data", "=", "fp", ".", "read", "(", ")", "fp", ".", "close", "(", ")", "except...
Parses /proc/devices to initialize device class - major number map for block devices.
[ "Parses", "/", "proc", "/", "devices", "to", "initialize", "device", "class", "-", "major", "number", "map", "for", "block", "devices", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/diskio.py#L86-L111
aouyar/PyMunin
pysysinfo/diskio.py
DiskIOinfo._initDMinfo
def _initDMinfo(self): """Check files in /dev/mapper to initialize data structures for mappings between device-mapper devices, minor device numbers, VGs and LVs. """ self._mapLVtuple2dm = {} self._mapLVname2dm = {} self._vgTree = {} if self._dmM...
python
def _initDMinfo(self): """Check files in /dev/mapper to initialize data structures for mappings between device-mapper devices, minor device numbers, VGs and LVs. """ self._mapLVtuple2dm = {} self._mapLVname2dm = {} self._vgTree = {} if self._dmM...
[ "def", "_initDMinfo", "(", "self", ")", ":", "self", ".", "_mapLVtuple2dm", "=", "{", "}", "self", ".", "_mapLVname2dm", "=", "{", "}", "self", ".", "_vgTree", "=", "{", "}", "if", "self", ".", "_dmMajorNum", "is", "None", ":", "self", ".", "_initBlo...
Check files in /dev/mapper to initialize data structures for mappings between device-mapper devices, minor device numbers, VGs and LVs.
[ "Check", "files", "in", "/", "dev", "/", "mapper", "to", "initialize", "data", "structures", "for", "mappings", "between", "device", "-", "mapper", "devices", "minor", "device", "numbers", "VGs", "and", "LVs", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/diskio.py#L113-L137
aouyar/PyMunin
pysysinfo/diskio.py
DiskIOinfo._initFilesystemInfo
def _initFilesystemInfo(self): """Initialize filesystem to device mappings.""" self._mapFSpathDev = {} fsinfo = FilesystemInfo() for fs in fsinfo.getFSlist(): devpath = fsinfo.getFSdev(fs) dev = self._getUniqueDev(devpath) if dev is not None: ...
python
def _initFilesystemInfo(self): """Initialize filesystem to device mappings.""" self._mapFSpathDev = {} fsinfo = FilesystemInfo() for fs in fsinfo.getFSlist(): devpath = fsinfo.getFSdev(fs) dev = self._getUniqueDev(devpath) if dev is not None: ...
[ "def", "_initFilesystemInfo", "(", "self", ")", ":", "self", ".", "_mapFSpathDev", "=", "{", "}", "fsinfo", "=", "FilesystemInfo", "(", ")", "for", "fs", "in", "fsinfo", ".", "getFSlist", "(", ")", ":", "devpath", "=", "fsinfo", ".", "getFSdev", "(", "...
Initialize filesystem to device mappings.
[ "Initialize", "filesystem", "to", "device", "mappings", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/diskio.py#L139-L147
aouyar/PyMunin
pysysinfo/diskio.py
DiskIOinfo._initSwapInfo
def _initSwapInfo(self): """Initialize swap partition to device mappings.""" self._swapList = [] sysinfo = SystemInfo() for (swap,attrs) in sysinfo.getSwapStats().iteritems(): if attrs['type'] == 'partition': dev = self._getUniqueDev(swap) if d...
python
def _initSwapInfo(self): """Initialize swap partition to device mappings.""" self._swapList = [] sysinfo = SystemInfo() for (swap,attrs) in sysinfo.getSwapStats().iteritems(): if attrs['type'] == 'partition': dev = self._getUniqueDev(swap) if d...
[ "def", "_initSwapInfo", "(", "self", ")", ":", "self", ".", "_swapList", "=", "[", "]", "sysinfo", "=", "SystemInfo", "(", ")", "for", "(", "swap", ",", "attrs", ")", "in", "sysinfo", ".", "getSwapStats", "(", ")", ".", "iteritems", "(", ")", ":", ...
Initialize swap partition to device mappings.
[ "Initialize", "swap", "partition", "to", "device", "mappings", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/diskio.py#L149-L157
aouyar/PyMunin
pysysinfo/diskio.py
DiskIOinfo._initDiskStats
def _initDiskStats(self): """Parse and initialize block device I/O stats in /proc/diskstats.""" self._diskStats = {} self._mapMajorMinor2dev = {} try: fp = open(diskStatsFile, 'r') data = fp.read() fp.close() except: raise IOError('...
python
def _initDiskStats(self): """Parse and initialize block device I/O stats in /proc/diskstats.""" self._diskStats = {} self._mapMajorMinor2dev = {} try: fp = open(diskStatsFile, 'r') data = fp.read() fp.close() except: raise IOError('...
[ "def", "_initDiskStats", "(", "self", ")", ":", "self", ".", "_diskStats", "=", "{", "}", "self", ".", "_mapMajorMinor2dev", "=", "{", "}", "try", ":", "fp", "=", "open", "(", "diskStatsFile", ",", "'r'", ")", "data", "=", "fp", ".", "read", "(", "...
Parse and initialize block device I/O stats in /proc/diskstats.
[ "Parse", "and", "initialize", "block", "device", "I", "/", "O", "stats", "in", "/", "proc", "/", "diskstats", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/diskio.py#L159-L192
aouyar/PyMunin
pysysinfo/diskio.py
DiskIOinfo._initDevClasses
def _initDevClasses(self): """Sort block devices into lists depending on device class and initialize device type map and partition map.""" self._devClassTree = {} self._partitionTree = {} self._mapDevType = {} basedevs = [] otherdevs = [] if self._mapMajo...
python
def _initDevClasses(self): """Sort block devices into lists depending on device class and initialize device type map and partition map.""" self._devClassTree = {} self._partitionTree = {} self._mapDevType = {} basedevs = [] otherdevs = [] if self._mapMajo...
[ "def", "_initDevClasses", "(", "self", ")", ":", "self", ".", "_devClassTree", "=", "{", "}", "self", ".", "_partitionTree", "=", "{", "}", "self", ".", "_mapDevType", "=", "{", "}", "basedevs", "=", "[", "]", "otherdevs", "=", "[", "]", "if", "self"...
Sort block devices into lists depending on device class and initialize device type map and partition map.
[ "Sort", "block", "devices", "into", "lists", "depending", "on", "device", "class", "and", "initialize", "device", "type", "map", "and", "partition", "map", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/diskio.py#L194-L228
aouyar/PyMunin
pysysinfo/diskio.py
DiskIOinfo.getDevType
def getDevType(self, dev): """Returns type of device dev. @return: Device type as string. """ if self._devClassTree is None: self._initDevClasses() return self._mapDevType.get(dev)
python
def getDevType(self, dev): """Returns type of device dev. @return: Device type as string. """ if self._devClassTree is None: self._initDevClasses() return self._mapDevType.get(dev)
[ "def", "getDevType", "(", "self", ",", "dev", ")", ":", "if", "self", ".", "_devClassTree", "is", "None", ":", "self", ".", "_initDevClasses", "(", ")", "return", "self", ".", "_mapDevType", ".", "get", "(", "dev", ")" ]
Returns type of device dev. @return: Device type as string.
[ "Returns", "type", "of", "device", "dev", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/diskio.py#L230-L238
aouyar/PyMunin
pysysinfo/diskio.py
DiskIOinfo.getPartitionList
def getPartitionList(self): """Returns list of partitions. @return: List of (disk,partition) pairs. """ if self._partList is None: self._partList = [] for (disk,parts) in self.getPartitionDict().iteritems(): for part in parts: ...
python
def getPartitionList(self): """Returns list of partitions. @return: List of (disk,partition) pairs. """ if self._partList is None: self._partList = [] for (disk,parts) in self.getPartitionDict().iteritems(): for part in parts: ...
[ "def", "getPartitionList", "(", "self", ")", ":", "if", "self", ".", "_partList", "is", "None", ":", "self", ".", "_partList", "=", "[", "]", "for", "(", "disk", ",", "parts", ")", "in", "self", ".", "getPartitionDict", "(", ")", ".", "iteritems", "(...
Returns list of partitions. @return: List of (disk,partition) pairs.
[ "Returns", "list", "of", "partitions", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/diskio.py#L288-L299
aouyar/PyMunin
pysysinfo/diskio.py
DiskIOinfo.getDevStats
def getDevStats(self, dev, devtype = None): """Returns I/O stats for block device. @param dev: Device name @param devtype: Device type. (Ignored if None.) @return: Dict of stats. """ if devtype is not None: if self._devClassTree is...
python
def getDevStats(self, dev, devtype = None): """Returns I/O stats for block device. @param dev: Device name @param devtype: Device type. (Ignored if None.) @return: Dict of stats. """ if devtype is not None: if self._devClassTree is...
[ "def", "getDevStats", "(", "self", ",", "dev", ",", "devtype", "=", "None", ")", ":", "if", "devtype", "is", "not", "None", ":", "if", "self", ".", "_devClassTree", "is", "None", ":", "self", ".", "_initDevClasses", "(", ")", "if", "devtype", "<>", "...
Returns I/O stats for block device. @param dev: Device name @param devtype: Device type. (Ignored if None.) @return: Dict of stats.
[ "Returns", "I", "/", "O", "stats", "for", "block", "device", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/diskio.py#L367-L380
aouyar/PyMunin
pysysinfo/diskio.py
DiskIOinfo.getSwapStats
def getSwapStats(self, dev): """Returns I/O stats for swap partition. @param dev: Device name for swap partition. @return: Dict of stats. """ if self._swapList is None: self._initSwapInfo() if dev in self._swapList: return self.ge...
python
def getSwapStats(self, dev): """Returns I/O stats for swap partition. @param dev: Device name for swap partition. @return: Dict of stats. """ if self._swapList is None: self._initSwapInfo() if dev in self._swapList: return self.ge...
[ "def", "getSwapStats", "(", "self", ",", "dev", ")", ":", "if", "self", ".", "_swapList", "is", "None", ":", "self", ".", "_initSwapInfo", "(", ")", "if", "dev", "in", "self", ".", "_swapList", ":", "return", "self", ".", "getDevStats", "(", "dev", "...
Returns I/O stats for swap partition. @param dev: Device name for swap partition. @return: Dict of stats.
[ "Returns", "I", "/", "O", "stats", "for", "swap", "partition", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/diskio.py#L418-L430
aouyar/PyMunin
pysysinfo/diskio.py
DiskIOinfo.getLVstats
def getLVstats(self, *args): """Returns I/O stats for LV. @param args: Two calling conventions are implemented: - Passing two parameters vg and lv. - Passing only one parameter in 'vg-lv' format. @return: Dict of stats. ""...
python
def getLVstats(self, *args): """Returns I/O stats for LV. @param args: Two calling conventions are implemented: - Passing two parameters vg and lv. - Passing only one parameter in 'vg-lv' format. @return: Dict of stats. ""...
[ "def", "getLVstats", "(", "self", ",", "*", "args", ")", ":", "if", "not", "len", "(", "args", ")", "in", "(", "1", ",", "2", ")", ":", "raise", "TypeError", "(", "\"The getLVstats must be called with either \"", "\"one or two arguments.\"", ")", "if", "self...
Returns I/O stats for LV. @param args: Two calling conventions are implemented: - Passing two parameters vg and lv. - Passing only one parameter in 'vg-lv' format. @return: Dict of stats.
[ "Returns", "I", "/", "O", "stats", "for", "LV", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/diskio.py#L432-L453
aouyar/PyMunin
pysysinfo/diskio.py
DiskIOinfo.getFilesystemStats
def getFilesystemStats(self, fs): """Returns I/O stats for filesystem. @param fs: Filesystem path. @return: Dict of stats. """ if self._mapFSpathDev is None: self._initFilesystemInfo() return self._diskStats.get(self._mapFSpathDev.get(fs))
python
def getFilesystemStats(self, fs): """Returns I/O stats for filesystem. @param fs: Filesystem path. @return: Dict of stats. """ if self._mapFSpathDev is None: self._initFilesystemInfo() return self._diskStats.get(self._mapFSpathDev.get(fs))
[ "def", "getFilesystemStats", "(", "self", ",", "fs", ")", ":", "if", "self", ".", "_mapFSpathDev", "is", "None", ":", "self", ".", "_initFilesystemInfo", "(", ")", "return", "self", ".", "_diskStats", ".", "get", "(", "self", ".", "_mapFSpathDev", ".", "...
Returns I/O stats for filesystem. @param fs: Filesystem path. @return: Dict of stats.
[ "Returns", "I", "/", "O", "stats", "for", "filesystem", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/diskio.py#L455-L464
aouyar/PyMunin
pymunin/plugins/ntphostoffset_.py
MuninNTPhostOffsetPlugin.retrieveVals
def retrieveVals(self): """Retrieve values for graphs.""" ntpinfo = NTPinfo() stats = ntpinfo.getHostOffset(self._remoteHost) if stats: graph_name = 'ntp_host_stratum_%s' % self._remoteHost if self.hasGraph(graph_name): self.setGraphVal(graph_name,...
python
def retrieveVals(self): """Retrieve values for graphs.""" ntpinfo = NTPinfo() stats = ntpinfo.getHostOffset(self._remoteHost) if stats: graph_name = 'ntp_host_stratum_%s' % self._remoteHost if self.hasGraph(graph_name): self.setGraphVal(graph_name,...
[ "def", "retrieveVals", "(", "self", ")", ":", "ntpinfo", "=", "NTPinfo", "(", ")", "stats", "=", "ntpinfo", ".", "getHostOffset", "(", "self", ".", "_remoteHost", ")", "if", "stats", ":", "graph_name", "=", "'ntp_host_stratum_%s'", "%", "self", ".", "_remo...
Retrieve values for graphs.
[ "Retrieve", "values", "for", "graphs", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/ntphostoffset_.py#L105-L116
aouyar/PyMunin
pysysinfo/rackspace.py
CloudFilesInfo.getContainerStats
def getContainerStats(self, limit=None, marker=None): """Returns Rackspace Cloud Files usage stats for containers. @param limit: Number of containers to return. @param marker: Return only results whose name is greater than marker. @return: Dictionary of container stats in...
python
def getContainerStats(self, limit=None, marker=None): """Returns Rackspace Cloud Files usage stats for containers. @param limit: Number of containers to return. @param marker: Return only results whose name is greater than marker. @return: Dictionary of container stats in...
[ "def", "getContainerStats", "(", "self", ",", "limit", "=", "None", ",", "marker", "=", "None", ")", ":", "stats", "=", "{", "}", "for", "row", "in", "self", ".", "_conn", ".", "list_containers_info", "(", "limit", ",", "marker", ")", ":", "stats", "...
Returns Rackspace Cloud Files usage stats for containers. @param limit: Number of containers to return. @param marker: Return only results whose name is greater than marker. @return: Dictionary of container stats indexed by container name.
[ "Returns", "Rackspace", "Cloud", "Files", "usage", "stats", "for", "containers", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/rackspace.py#L58-L69
ContextLab/quail
quail/decode_speech.py
decode_speech
def decode_speech(path, keypath=None, save=False, speech_context=None, sample_rate=44100, max_alternatives=1, language_code='en-US', enable_word_time_offsets=True, return_raw=False): """ Decode speech for a file or folder and return results This function wraps the Google...
python
def decode_speech(path, keypath=None, save=False, speech_context=None, sample_rate=44100, max_alternatives=1, language_code='en-US', enable_word_time_offsets=True, return_raw=False): """ Decode speech for a file or folder and return results This function wraps the Google...
[ "def", "decode_speech", "(", "path", ",", "keypath", "=", "None", ",", "save", "=", "False", ",", "speech_context", "=", "None", ",", "sample_rate", "=", "44100", ",", "max_alternatives", "=", "1", ",", "language_code", "=", "'en-US'", ",", "enable_word_time...
Decode speech for a file or folder and return results This function wraps the Google Speech API and ffmpeg to decode speech for free recall experiments. Note: in order for this to work, you must have a Google Speech account, a google speech credentials file referenced in your _bash_profile, and ffmpeg...
[ "Decode", "speech", "for", "a", "file", "or", "folder", "and", "return", "results" ]
train
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/decode_speech.py#L24-L265
aouyar/PyMunin
pysysinfo/squid.py
parse_value
def parse_value(val): """Parse input string and return int, float or str depending on format. @param val: Input string. @return: Value of type int, float or str. """ mobj = re.match('(-{0,1}\d+)\s*(\sseconds|/\s*\w+)$', val) if mobj: return int(mobj.group(1)) m...
python
def parse_value(val): """Parse input string and return int, float or str depending on format. @param val: Input string. @return: Value of type int, float or str. """ mobj = re.match('(-{0,1}\d+)\s*(\sseconds|/\s*\w+)$', val) if mobj: return int(mobj.group(1)) m...
[ "def", "parse_value", "(", "val", ")", ":", "mobj", "=", "re", ".", "match", "(", "'(-{0,1}\\d+)\\s*(\\sseconds|/\\s*\\w+)$'", ",", "val", ")", "if", "mobj", ":", "return", "int", "(", "mobj", ".", "group", "(", "1", ")", ")", "mobj", "=", "re", ".", ...
Parse input string and return int, float or str depending on format. @param val: Input string. @return: Value of type int, float or str.
[ "Parse", "input", "string", "and", "return", "int", "float", "or", "str", "depending", "on", "format", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/squid.py#L31-L51
aouyar/PyMunin
pysysinfo/squid.py
SquidInfo._connect
def _connect(self): """Connect to Squid Proxy Manager interface.""" if sys.version_info[:2] < (2,6): self._conn = httplib.HTTPConnection(self._host, self._port) else: self._conn = httplib.HTTPConnection(self._host, self._port, ...
python
def _connect(self): """Connect to Squid Proxy Manager interface.""" if sys.version_info[:2] < (2,6): self._conn = httplib.HTTPConnection(self._host, self._port) else: self._conn = httplib.HTTPConnection(self._host, self._port, ...
[ "def", "_connect", "(", "self", ")", ":", "if", "sys", ".", "version_info", "[", ":", "2", "]", "<", "(", "2", ",", "6", ")", ":", "self", ".", "_conn", "=", "httplib", ".", "HTTPConnection", "(", "self", ".", "_host", ",", "self", ".", "_port", ...
Connect to Squid Proxy Manager interface.
[ "Connect", "to", "Squid", "Proxy", "Manager", "interface", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/squid.py#L90-L96
aouyar/PyMunin
pysysinfo/squid.py
SquidInfo._retrieve
def _retrieve(self, map): """Query Squid Proxy Server Manager Interface for stats. @param map: Statistics map name. @return: Dictionary of query results. """ self._conn.request('GET', "cache_object://%s/%s" % (self._host, map), Non...
python
def _retrieve(self, map): """Query Squid Proxy Server Manager Interface for stats. @param map: Statistics map name. @return: Dictionary of query results. """ self._conn.request('GET', "cache_object://%s/%s" % (self._host, map), Non...
[ "def", "_retrieve", "(", "self", ",", "map", ")", ":", "self", ".", "_conn", ".", "request", "(", "'GET'", ",", "\"cache_object://%s/%s\"", "%", "(", "self", ".", "_host", ",", "map", ")", ",", "None", ",", "self", ".", "_httpHeaders", ")", "rp", "="...
Query Squid Proxy Server Manager Interface for stats. @param map: Statistics map name. @return: Dictionary of query results.
[ "Query", "Squid", "Proxy", "Server", "Manager", "Interface", "for", "stats", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/squid.py#L98-L115
aouyar/PyMunin
pysysinfo/squid.py
SquidInfo._parseCounters
def _parseCounters(self, data): """Parse simple stats list of key, value pairs. @param data: Multiline data with one key-value pair in each line. @return: Dictionary of stats. """ info_dict = util.NestedDict() for line in data.splitlines(): ...
python
def _parseCounters(self, data): """Parse simple stats list of key, value pairs. @param data: Multiline data with one key-value pair in each line. @return: Dictionary of stats. """ info_dict = util.NestedDict() for line in data.splitlines(): ...
[ "def", "_parseCounters", "(", "self", ",", "data", ")", ":", "info_dict", "=", "util", ".", "NestedDict", "(", ")", "for", "line", "in", "data", ".", "splitlines", "(", ")", ":", "mobj", "=", "re", ".", "match", "(", "'^\\s*([\\w\\.]+)\\s*=\\s*(\\S.*)$'", ...
Parse simple stats list of key, value pairs. @param data: Multiline data with one key-value pair in each line. @return: Dictionary of stats.
[ "Parse", "simple", "stats", "list", "of", "key", "value", "pairs", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/squid.py#L117-L131
aouyar/PyMunin
pysysinfo/squid.py
SquidInfo._parseSections
def _parseSections(self, data): """Parse data and separate sections. Returns dictionary that maps section name to section data. @param data: Multiline data. @return: Dictionary that maps section names to section data. """ section_dict = {} l...
python
def _parseSections(self, data): """Parse data and separate sections. Returns dictionary that maps section name to section data. @param data: Multiline data. @return: Dictionary that maps section names to section data. """ section_dict = {} l...
[ "def", "_parseSections", "(", "self", ",", "data", ")", ":", "section_dict", "=", "{", "}", "lines", "=", "data", ".", "splitlines", "(", ")", "idx", "=", "0", "numlines", "=", "len", "(", "lines", ")", "section", "=", "None", "while", "idx", "<", ...
Parse data and separate sections. Returns dictionary that maps section name to section data. @param data: Multiline data. @return: Dictionary that maps section names to section data.
[ "Parse", "data", "and", "separate", "sections", ".", "Returns", "dictionary", "that", "maps", "section", "name", "to", "section", "data", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/squid.py#L133-L168
aouyar/PyMunin
pysysinfo/squid.py
SquidInfo.getMenu
def getMenu(self): """Get manager interface section list from Squid Proxy Server @return: List of tuples (section, description, type) """ data = self._retrieve('') info_list = [] for line in data.splitlines(): mobj = re.match('^\s*(\S.*\S...
python
def getMenu(self): """Get manager interface section list from Squid Proxy Server @return: List of tuples (section, description, type) """ data = self._retrieve('') info_list = [] for line in data.splitlines(): mobj = re.match('^\s*(\S.*\S...
[ "def", "getMenu", "(", "self", ")", ":", "data", "=", "self", ".", "_retrieve", "(", "''", ")", "info_list", "=", "[", "]", "for", "line", "in", "data", ".", "splitlines", "(", ")", ":", "mobj", "=", "re", ".", "match", "(", "'^\\s*(\\S.*\\S)\\s*\\t\...
Get manager interface section list from Squid Proxy Server @return: List of tuples (section, description, type)
[ "Get", "manager", "interface", "section", "list", "from", "Squid", "Proxy", "Server" ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/squid.py#L170-L182
aouyar/PyMunin
pysysinfo/wanpipe.py
WanpipeInfo.getIfaceStats
def getIfaceStats(self): """Return dictionary of Traffic Stats for each Wanpipe Interface. @return: Nested dictionary of statistics for each interface. """ ifInfo = netiface.NetIfaceInfo() ifStats = ifInfo.getIfStats() info_dict = {} for ifname i...
python
def getIfaceStats(self): """Return dictionary of Traffic Stats for each Wanpipe Interface. @return: Nested dictionary of statistics for each interface. """ ifInfo = netiface.NetIfaceInfo() ifStats = ifInfo.getIfStats() info_dict = {} for ifname i...
[ "def", "getIfaceStats", "(", "self", ")", ":", "ifInfo", "=", "netiface", ".", "NetIfaceInfo", "(", ")", "ifStats", "=", "ifInfo", ".", "getIfStats", "(", ")", "info_dict", "=", "{", "}", "for", "ifname", "in", "ifStats", ":", "if", "re", ".", "match",...
Return dictionary of Traffic Stats for each Wanpipe Interface. @return: Nested dictionary of statistics for each interface.
[ "Return", "dictionary", "of", "Traffic", "Stats", "for", "each", "Wanpipe", "Interface", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/wanpipe.py#L27-L39
aouyar/PyMunin
pysysinfo/wanpipe.py
WanpipeInfo.getPRIstats
def getPRIstats(self, iface): """Return RDSI Operational Stats for interface. @param iface: Interface name. (Ex. w1g1) @return: Nested dictionary of statistics for interface. """ info_dict = {} output = util.exec_command([wanpipemonCmd, '-i', iface, '-c', ...
python
def getPRIstats(self, iface): """Return RDSI Operational Stats for interface. @param iface: Interface name. (Ex. w1g1) @return: Nested dictionary of statistics for interface. """ info_dict = {} output = util.exec_command([wanpipemonCmd, '-i', iface, '-c', ...
[ "def", "getPRIstats", "(", "self", ",", "iface", ")", ":", "info_dict", "=", "{", "}", "output", "=", "util", ".", "exec_command", "(", "[", "wanpipemonCmd", ",", "'-i'", ",", "iface", ",", "'-c'", ",", "'Ta'", "]", ")", "for", "line", "in", "output"...
Return RDSI Operational Stats for interface. @param iface: Interface name. (Ex. w1g1) @return: Nested dictionary of statistics for interface.
[ "Return", "RDSI", "Operational", "Stats", "for", "interface", ".", "@param", "iface", ":", "Interface", "name", ".", "(", "Ex", ".", "w1g1", ")", "@return", ":", "Nested", "dictionary", "of", "statistics", "for", "interface", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/wanpipe.py#L41-L62
aouyar/PyMunin
pysysinfo/freeswitch.py
FSinfo._connect
def _connect(self): """Connect to FreeSWITCH ESL Interface.""" try: self._eslconn = ESL.ESLconnection(self._eslhost, str(self._eslport), self._eslpass) except: pass if no...
python
def _connect(self): """Connect to FreeSWITCH ESL Interface.""" try: self._eslconn = ESL.ESLconnection(self._eslhost, str(self._eslport), self._eslpass) except: pass if no...
[ "def", "_connect", "(", "self", ")", ":", "try", ":", "self", ".", "_eslconn", "=", "ESL", ".", "ESLconnection", "(", "self", ".", "_eslhost", ",", "str", "(", "self", ".", "_eslport", ")", ",", "self", ".", "_eslpass", ")", "except", ":", "pass", ...
Connect to FreeSWITCH ESL Interface.
[ "Connect", "to", "FreeSWITCH", "ESL", "Interface", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/freeswitch.py#L60-L72
aouyar/PyMunin
pysysinfo/freeswitch.py
FSinfo._execCmd
def _execCmd(self, cmd, args): """Execute command and return result body as list of lines. @param cmd: Command string. @param args: Comand arguments string. @return: Result dictionary. """ output = self._eslconn.api(cmd, args) ...
python
def _execCmd(self, cmd, args): """Execute command and return result body as list of lines. @param cmd: Command string. @param args: Comand arguments string. @return: Result dictionary. """ output = self._eslconn.api(cmd, args) ...
[ "def", "_execCmd", "(", "self", ",", "cmd", ",", "args", ")", ":", "output", "=", "self", ".", "_eslconn", ".", "api", "(", "cmd", ",", "args", ")", "if", "output", ":", "body", "=", "output", ".", "getBody", "(", ")", "if", "body", ":", "return"...
Execute command and return result body as list of lines. @param cmd: Command string. @param args: Comand arguments string. @return: Result dictionary.
[ "Execute", "command", "and", "return", "result", "body", "as", "list", "of", "lines", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/freeswitch.py#L74-L87
aouyar/PyMunin
pysysinfo/freeswitch.py
FSinfo._execShowCmd
def _execShowCmd(self, showcmd): """Execute 'show' command and return result dictionary. @param cmd: Command string. @return: Result dictionary. """ result = None lines = self._execCmd("show", showcmd) if lines and len(lines) >= 2 and...
python
def _execShowCmd(self, showcmd): """Execute 'show' command and return result dictionary. @param cmd: Command string. @return: Result dictionary. """ result = None lines = self._execCmd("show", showcmd) if lines and len(lines) >= 2 and...
[ "def", "_execShowCmd", "(", "self", ",", "showcmd", ")", ":", "result", "=", "None", "lines", "=", "self", ".", "_execCmd", "(", "\"show\"", ",", "showcmd", ")", "if", "lines", "and", "len", "(", "lines", ")", ">=", "2", "and", "lines", "[", "0", "...
Execute 'show' command and return result dictionary. @param cmd: Command string. @return: Result dictionary.
[ "Execute", "show", "command", "and", "return", "result", "dictionary", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/freeswitch.py#L89-L107
aouyar/PyMunin
pysysinfo/freeswitch.py
FSinfo._execShowCountCmd
def _execShowCountCmd(self, showcmd): """Execute 'show' command and return result dictionary. @param cmd: Command string. @return: Result dictionary. """ result = None lines = self._execCmd("show", showcmd + " count") for line in line...
python
def _execShowCountCmd(self, showcmd): """Execute 'show' command and return result dictionary. @param cmd: Command string. @return: Result dictionary. """ result = None lines = self._execCmd("show", showcmd + " count") for line in line...
[ "def", "_execShowCountCmd", "(", "self", ",", "showcmd", ")", ":", "result", "=", "None", "lines", "=", "self", ".", "_execCmd", "(", "\"show\"", ",", "showcmd", "+", "\" count\"", ")", "for", "line", "in", "lines", ":", "mobj", "=", "re", ".", "match"...
Execute 'show' command and return result dictionary. @param cmd: Command string. @return: Result dictionary.
[ "Execute", "show", "command", "and", "return", "result", "dictionary", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/freeswitch.py#L109-L122
aouyar/PyMunin
pymunin/plugins/asteriskstats.py
MuninAsteriskPlugin.retrieveVals
def retrieveVals(self): """Retrieve values for graphs.""" if self.hasGraph('asterisk_calls') or self.hasGraph('asterisk_channels'): stats = self._ami.getChannelStats(self._chanList) if self.hasGraph('asterisk_calls') and stats: self.setGraphVal('asterisk_calls',...
python
def retrieveVals(self): """Retrieve values for graphs.""" if self.hasGraph('asterisk_calls') or self.hasGraph('asterisk_channels'): stats = self._ami.getChannelStats(self._chanList) if self.hasGraph('asterisk_calls') and stats: self.setGraphVal('asterisk_calls',...
[ "def", "retrieveVals", "(", "self", ")", ":", "if", "self", ".", "hasGraph", "(", "'asterisk_calls'", ")", "or", "self", ".", "hasGraph", "(", "'asterisk_channels'", ")", ":", "stats", "=", "self", ".", "_ami", ".", "getChannelStats", "(", "self", ".", "...
Retrieve values for graphs.
[ "Retrieve", "values", "for", "graphs", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/asteriskstats.py#L309-L426
aouyar/PyMunin
pymunin/plugins/phpfpmstats.py
MuninPHPfpmPlugin.retrieveVals
def retrieveVals(self): """Retrieve values for graphs.""" fpminfo = PHPfpmInfo(self._host, self._port, self._user, self._password, self._monpath, self._ssl) stats = fpminfo.getStats() if self.hasGraph('php_fpm_connections') and stats: self.setGr...
python
def retrieveVals(self): """Retrieve values for graphs.""" fpminfo = PHPfpmInfo(self._host, self._port, self._user, self._password, self._monpath, self._ssl) stats = fpminfo.getStats() if self.hasGraph('php_fpm_connections') and stats: self.setGr...
[ "def", "retrieveVals", "(", "self", ")", ":", "fpminfo", "=", "PHPfpmInfo", "(", "self", ".", "_host", ",", "self", ".", "_port", ",", "self", ".", "_user", ",", "self", ".", "_password", ",", "self", ".", "_monpath", ",", "self", ".", "_ssl", ")", ...
Retrieve values for graphs.
[ "Retrieve", "values", "for", "graphs", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/phpfpmstats.py#L111-L125
aouyar/PyMunin
pymunin/plugins/phpfpmstats.py
MuninPHPfpmPlugin.autoconf
def autoconf(self): """Implements Munin Plugin Auto-Configuration Option. @return: True if plugin can be auto-configured, False otherwise. """ fpminfo = PHPfpmInfo(self._host, self._port, self._user, self._password, self._monpath,...
python
def autoconf(self): """Implements Munin Plugin Auto-Configuration Option. @return: True if plugin can be auto-configured, False otherwise. """ fpminfo = PHPfpmInfo(self._host, self._port, self._user, self._password, self._monpath,...
[ "def", "autoconf", "(", "self", ")", ":", "fpminfo", "=", "PHPfpmInfo", "(", "self", ".", "_host", ",", "self", ".", "_port", ",", "self", ".", "_user", ",", "self", ".", "_password", ",", "self", ".", "_monpath", ",", "self", ".", "_ssl", ")", "re...
Implements Munin Plugin Auto-Configuration Option. @return: True if plugin can be auto-configured, False otherwise.
[ "Implements", "Munin", "Plugin", "Auto", "-", "Configuration", "Option", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/phpfpmstats.py#L127-L135
aouyar/PyMunin
pysysinfo/redisdb.py
RedisInfo.ping
def ping(self): """Ping Redis Server and return Round-Trip-Time in seconds. @return: Round-trip-time in seconds as float. """ start = time.time() self._conn.ping() return (time.time() - start)
python
def ping(self): """Ping Redis Server and return Round-Trip-Time in seconds. @return: Round-trip-time in seconds as float. """ start = time.time() self._conn.ping() return (time.time() - start)
[ "def", "ping", "(", "self", ")", ":", "start", "=", "time", ".", "time", "(", ")", "self", ".", "_conn", ".", "ping", "(", ")", "return", "(", "time", ".", "time", "(", ")", "-", "start", ")" ]
Ping Redis Server and return Round-Trip-Time in seconds. @return: Round-trip-time in seconds as float.
[ "Ping", "Redis", "Server", "and", "return", "Round", "-", "Trip", "-", "Time", "in", "seconds", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/redisdb.py#L49-L57
ContextLab/quail
quail/helpers.py
list2pd
def list2pd(all_data, subjindex=None, listindex=None): """ Makes multi-indexed dataframe of subject data Parameters ---------- all_data : list of lists of strings strings are either all presented or all recalled items, in the order of presentation or recall *should also work for pre...
python
def list2pd(all_data, subjindex=None, listindex=None): """ Makes multi-indexed dataframe of subject data Parameters ---------- all_data : list of lists of strings strings are either all presented or all recalled items, in the order of presentation or recall *should also work for pre...
[ "def", "list2pd", "(", "all_data", ",", "subjindex", "=", "None", ",", "listindex", "=", "None", ")", ":", "# set default index if it is not defined", "# max_nlists = max(map(lambda x: len(x), all_data))", "listindex", "=", "[", "[", "idx", "for", "idx", "in", "range"...
Makes multi-indexed dataframe of subject data Parameters ---------- all_data : list of lists of strings strings are either all presented or all recalled items, in the order of presentation or recall *should also work for presented / recalled ints and floats, if desired Returns ---...
[ "Makes", "multi", "-", "indexed", "dataframe", "of", "subject", "data" ]
train
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/helpers.py#L11-L43
ContextLab/quail
quail/helpers.py
recmat2egg
def recmat2egg(recmat, list_length=None): """ Creates egg data object from zero-indexed recall matrix Parameters ---------- recmat : list of lists (subs) of lists (encoding lists) of ints or 2D numpy array recall matrix representing serial positions of freely recalle...
python
def recmat2egg(recmat, list_length=None): """ Creates egg data object from zero-indexed recall matrix Parameters ---------- recmat : list of lists (subs) of lists (encoding lists) of ints or 2D numpy array recall matrix representing serial positions of freely recalle...
[ "def", "recmat2egg", "(", "recmat", ",", "list_length", "=", "None", ")", ":", "from", ".", "egg", "import", "Egg", "as", "Egg", "pres", "=", "[", "[", "[", "str", "(", "word", ")", "for", "word", "in", "list", "(", "range", "(", "0", ",", "list_...
Creates egg data object from zero-indexed recall matrix Parameters ---------- recmat : list of lists (subs) of lists (encoding lists) of ints or 2D numpy array recall matrix representing serial positions of freely recalled words \ e.g. [[[16, 15, 0, 2, 3, None, None...],...
[ "Creates", "egg", "data", "object", "from", "zero", "-", "indexed", "recall", "matrix" ]
train
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/helpers.py#L72-L96
ContextLab/quail
quail/helpers.py
default_dist_funcs
def default_dist_funcs(dist_funcs, feature_example): """ Fills in default distance metrics for fingerprint analyses """ if dist_funcs is None: dist_funcs = dict() for key in feature_example: if key in dist_funcs: pass if key =...
python
def default_dist_funcs(dist_funcs, feature_example): """ Fills in default distance metrics for fingerprint analyses """ if dist_funcs is None: dist_funcs = dict() for key in feature_example: if key in dist_funcs: pass if key =...
[ "def", "default_dist_funcs", "(", "dist_funcs", ",", "feature_example", ")", ":", "if", "dist_funcs", "is", "None", ":", "dist_funcs", "=", "dict", "(", ")", "for", "key", "in", "feature_example", ":", "if", "key", "in", "dist_funcs", ":", "pass", "if", "k...
Fills in default distance metrics for fingerprint analyses
[ "Fills", "in", "default", "distance", "metrics", "for", "fingerprint", "analyses" ]
train
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/helpers.py#L98-L116
ContextLab/quail
quail/helpers.py
stack_eggs
def stack_eggs(eggs, meta='concatenate'): ''' Takes a list of eggs, stacks them and reindexes the subject number Parameters ---------- eggs : list of Egg data objects A list of Eggs that you want to combine meta : string Determines how the meta data of each Egg combines. Default...
python
def stack_eggs(eggs, meta='concatenate'): ''' Takes a list of eggs, stacks them and reindexes the subject number Parameters ---------- eggs : list of Egg data objects A list of Eggs that you want to combine meta : string Determines how the meta data of each Egg combines. Default...
[ "def", "stack_eggs", "(", "eggs", ",", "meta", "=", "'concatenate'", ")", ":", "from", ".", "egg", "import", "Egg", "pres", "=", "[", "egg", ".", "pres", ".", "loc", "[", "sub", ",", ":", "]", ".", "values", ".", "tolist", "(", ")", "for", "egg",...
Takes a list of eggs, stacks them and reindexes the subject number Parameters ---------- eggs : list of Egg data objects A list of Eggs that you want to combine meta : string Determines how the meta data of each Egg combines. Default is 'concatenate' 'concatenate' concatenates k...
[ "Takes", "a", "list", "of", "eggs", "stacks", "them", "and", "reindexes", "the", "subject", "number" ]
train
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/helpers.py#L118-L156
ContextLab/quail
quail/helpers.py
crack_egg
def crack_egg(egg, subjects=None, lists=None): ''' Takes an egg and returns a subset of the subjects or lists Parameters ---------- egg : Egg data object Egg that you want to crack subjects : list List of subject idxs lists : list List of lists idxs Returns ...
python
def crack_egg(egg, subjects=None, lists=None): ''' Takes an egg and returns a subset of the subjects or lists Parameters ---------- egg : Egg data object Egg that you want to crack subjects : list List of subject idxs lists : list List of lists idxs Returns ...
[ "def", "crack_egg", "(", "egg", ",", "subjects", "=", "None", ",", "lists", "=", "None", ")", ":", "from", ".", "egg", "import", "Egg", "if", "hasattr", "(", "egg", ",", "'features'", ")", ":", "all_have_features", "=", "egg", ".", "features", "is", ...
Takes an egg and returns a subset of the subjects or lists Parameters ---------- egg : Egg data object Egg that you want to crack subjects : list List of subject idxs lists : list List of lists idxs Returns ---------- new_egg : Egg data object A sliced...
[ "Takes", "an", "egg", "and", "returns", "a", "subset", "of", "the", "subjects", "or", "lists" ]
train
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/helpers.py#L158-L208
ContextLab/quail
quail/helpers.py
df2list
def df2list(df): """ Convert a MultiIndex df to list Parameters ---------- df : pandas.DataFrame A MultiIndex DataFrame where the first level is subjects and the second level is lists (e.g. egg.pres) Returns ---------- lst : a list of lists of lists of values ...
python
def df2list(df): """ Convert a MultiIndex df to list Parameters ---------- df : pandas.DataFrame A MultiIndex DataFrame where the first level is subjects and the second level is lists (e.g. egg.pres) Returns ---------- lst : a list of lists of lists of values ...
[ "def", "df2list", "(", "df", ")", ":", "subjects", "=", "df", ".", "index", ".", "levels", "[", "0", "]", ".", "values", ".", "tolist", "(", ")", "lists", "=", "df", ".", "index", ".", "levels", "[", "1", "]", ".", "values", ".", "tolist", "(",...
Convert a MultiIndex df to list Parameters ---------- df : pandas.DataFrame A MultiIndex DataFrame where the first level is subjects and the second level is lists (e.g. egg.pres) Returns ---------- lst : a list of lists of lists of values The input df reformatted as a...
[ "Convert", "a", "MultiIndex", "df", "to", "list" ]
train
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/helpers.py#L210-L233
ContextLab/quail
quail/helpers.py
fill_missing
def fill_missing(x): """ Fills in missing lists (assumes end lists are missing) """ # find subject with max number of lists maxlen = max([len(xi) for xi in x]) subs = [] for sub in x: if len(sub)<maxlen: for i in range(maxlen-len(sub)): sub.append([]) ...
python
def fill_missing(x): """ Fills in missing lists (assumes end lists are missing) """ # find subject with max number of lists maxlen = max([len(xi) for xi in x]) subs = [] for sub in x: if len(sub)<maxlen: for i in range(maxlen-len(sub)): sub.append([]) ...
[ "def", "fill_missing", "(", "x", ")", ":", "# find subject with max number of lists", "maxlen", "=", "max", "(", "[", "len", "(", "xi", ")", "for", "xi", "in", "x", "]", ")", "subs", "=", "[", "]", "for", "sub", "in", "x", ":", "if", "len", "(", "s...
Fills in missing lists (assumes end lists are missing)
[ "Fills", "in", "missing", "lists", "(", "assumes", "end", "lists", "are", "missing", ")" ]
train
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/helpers.py#L235-L253
ContextLab/quail
quail/helpers.py
parse_egg
def parse_egg(egg): """Parses an egg and returns fields""" pres_list = egg.get_pres_items().values[0] rec_list = egg.get_rec_items().values[0] feature_list = egg.get_pres_features().values[0] dist_funcs = egg.dist_funcs return pres_list, rec_list, feature_list, dist_funcs
python
def parse_egg(egg): """Parses an egg and returns fields""" pres_list = egg.get_pres_items().values[0] rec_list = egg.get_rec_items().values[0] feature_list = egg.get_pres_features().values[0] dist_funcs = egg.dist_funcs return pres_list, rec_list, feature_list, dist_funcs
[ "def", "parse_egg", "(", "egg", ")", ":", "pres_list", "=", "egg", ".", "get_pres_items", "(", ")", ".", "values", "[", "0", "]", "rec_list", "=", "egg", ".", "get_rec_items", "(", ")", ".", "values", "[", "0", "]", "feature_list", "=", "egg", ".", ...
Parses an egg and returns fields
[ "Parses", "an", "egg", "and", "returns", "fields" ]
train
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/helpers.py#L255-L261
ContextLab/quail
quail/helpers.py
merge_pres_feats
def merge_pres_feats(pres, features): """ Helper function to merge pres and features to support legacy features argument """ sub = [] for psub, fsub in zip(pres, features): exp = [] for pexp, fexp in zip(psub, fsub): lst = [] for p, f in zip(pexp, fexp): ...
python
def merge_pres_feats(pres, features): """ Helper function to merge pres and features to support legacy features argument """ sub = [] for psub, fsub in zip(pres, features): exp = [] for pexp, fexp in zip(psub, fsub): lst = [] for p, f in zip(pexp, fexp): ...
[ "def", "merge_pres_feats", "(", "pres", ",", "features", ")", ":", "sub", "=", "[", "]", "for", "psub", ",", "fsub", "in", "zip", "(", "pres", ",", "features", ")", ":", "exp", "=", "[", "]", "for", "pexp", ",", "fexp", "in", "zip", "(", "psub", ...
Helper function to merge pres and features to support legacy features argument
[ "Helper", "function", "to", "merge", "pres", "and", "features", "to", "support", "legacy", "features", "argument" ]
train
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/helpers.py#L263-L278
ContextLab/quail
quail/helpers.py
r2z
def r2z(r): """ Function that calculates the Fisher z-transformation Parameters ---------- r : int or ndarray Correlation value Returns ---------- result : int or ndarray Fishers z transformed correlation value """ with np.errstate(invalid='ignore', divide='ig...
python
def r2z(r): """ Function that calculates the Fisher z-transformation Parameters ---------- r : int or ndarray Correlation value Returns ---------- result : int or ndarray Fishers z transformed correlation value """ with np.errstate(invalid='ignore', divide='ig...
[ "def", "r2z", "(", "r", ")", ":", "with", "np", ".", "errstate", "(", "invalid", "=", "'ignore'", ",", "divide", "=", "'ignore'", ")", ":", "return", "0.5", "*", "(", "np", ".", "log", "(", "1", "+", "r", ")", "-", "np", ".", "log", "(", "1",...
Function that calculates the Fisher z-transformation Parameters ---------- r : int or ndarray Correlation value Returns ---------- result : int or ndarray Fishers z transformed correlation value
[ "Function", "that", "calculates", "the", "Fisher", "z", "-", "transformation" ]
train
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/helpers.py#L287-L304
ContextLab/quail
quail/helpers.py
z2r
def z2r(z): """ Function that calculates the inverse Fisher z-transformation Parameters ---------- z : int or ndarray Fishers z transformed correlation value Returns ---------- result : int or ndarray Correlation value """ with np.errstate(invalid='ignore', di...
python
def z2r(z): """ Function that calculates the inverse Fisher z-transformation Parameters ---------- z : int or ndarray Fishers z transformed correlation value Returns ---------- result : int or ndarray Correlation value """ with np.errstate(invalid='ignore', di...
[ "def", "z2r", "(", "z", ")", ":", "with", "np", ".", "errstate", "(", "invalid", "=", "'ignore'", ",", "divide", "=", "'ignore'", ")", ":", "return", "(", "np", ".", "exp", "(", "2", "*", "z", ")", "-", "1", ")", "/", "(", "np", ".", "exp", ...
Function that calculates the inverse Fisher z-transformation Parameters ---------- z : int or ndarray Fishers z transformed correlation value Returns ---------- result : int or ndarray Correlation value
[ "Function", "that", "calculates", "the", "inverse", "Fisher", "z", "-", "transformation" ]
train
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/helpers.py#L306-L323
ContextLab/quail
quail/helpers.py
shuffle_egg
def shuffle_egg(egg): """ Shuffle an Egg's recalls""" from .egg import Egg pres, rec, features, dist_funcs = parse_egg(egg) if pres.ndim==1: pres = pres.reshape(1, pres.shape[0]) rec = rec.reshape(1, rec.shape[0]) features = features.reshape(1, features.shape[0]) for ilist ...
python
def shuffle_egg(egg): """ Shuffle an Egg's recalls""" from .egg import Egg pres, rec, features, dist_funcs = parse_egg(egg) if pres.ndim==1: pres = pres.reshape(1, pres.shape[0]) rec = rec.reshape(1, rec.shape[0]) features = features.reshape(1, features.shape[0]) for ilist ...
[ "def", "shuffle_egg", "(", "egg", ")", ":", "from", ".", "egg", "import", "Egg", "pres", ",", "rec", ",", "features", ",", "dist_funcs", "=", "parse_egg", "(", "egg", ")", "if", "pres", ".", "ndim", "==", "1", ":", "pres", "=", "pres", ".", "reshap...
Shuffle an Egg's recalls
[ "Shuffle", "an", "Egg", "s", "recalls" ]
train
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/helpers.py#L335-L349
aouyar/PyMunin
pymunin/plugins/netifacestats.py
MuninNetIfacePlugin.retrieveVals
def retrieveVals(self): """Retrieve values for graphs.""" for iface in self._ifaceList: stats = self._ifaceStats.get(iface) graph_name = 'netiface_traffic_%s' % iface if self.hasGraph(graph_name): self.setGraphVal(graph_name, 'rx', stats.get('rxbytes')...
python
def retrieveVals(self): """Retrieve values for graphs.""" for iface in self._ifaceList: stats = self._ifaceStats.get(iface) graph_name = 'netiface_traffic_%s' % iface if self.hasGraph(graph_name): self.setGraphVal(graph_name, 'rx', stats.get('rxbytes')...
[ "def", "retrieveVals", "(", "self", ")", ":", "for", "iface", "in", "self", ".", "_ifaceList", ":", "stats", "=", "self", ".", "_ifaceStats", ".", "get", "(", "iface", ")", "graph_name", "=", "'netiface_traffic_%s'", "%", "iface", "if", "self", ".", "has...
Retrieve values for graphs.
[ "Retrieve", "values", "for", "graphs", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/netifacestats.py#L122-L134
aouyar/PyMunin
pysysinfo/ntp.py
NTPinfo.getPeerStats
def getPeerStats(self): """Get NTP Peer Stats for localhost by querying local NTP Server. @return: Dictionary of NTP stats converted to seconds. """ info_dict = {} output = util.exec_command([ntpqCmd, '-n', '-c', 'peers']) for line in output.splitlines(): ...
python
def getPeerStats(self): """Get NTP Peer Stats for localhost by querying local NTP Server. @return: Dictionary of NTP stats converted to seconds. """ info_dict = {} output = util.exec_command([ntpqCmd, '-n', '-c', 'peers']) for line in output.splitlines(): ...
[ "def", "getPeerStats", "(", "self", ")", ":", "info_dict", "=", "{", "}", "output", "=", "util", ".", "exec_command", "(", "[", "ntpqCmd", ",", "'-n'", ",", "'-c'", ",", "'peers'", "]", ")", "for", "line", "in", "output", ".", "splitlines", "(", ")",...
Get NTP Peer Stats for localhost by querying local NTP Server. @return: Dictionary of NTP stats converted to seconds.
[ "Get", "NTP", "Peer", "Stats", "for", "localhost", "by", "querying", "local", "NTP", "Server", ".", "@return", ":", "Dictionary", "of", "NTP", "stats", "converted", "to", "seconds", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/ntp.py#L29-L49
aouyar/PyMunin
pysysinfo/ntp.py
NTPinfo.getHostOffset
def getHostOffset(self, host): """Get NTP Stats and offset of remote host relative to localhost by querying NTP Server on remote host. @param host: Remote Host IP. @return: Dictionary of NTP stats converted to seconds. """ info_dict = {} output = uti...
python
def getHostOffset(self, host): """Get NTP Stats and offset of remote host relative to localhost by querying NTP Server on remote host. @param host: Remote Host IP. @return: Dictionary of NTP stats converted to seconds. """ info_dict = {} output = uti...
[ "def", "getHostOffset", "(", "self", ",", "host", ")", ":", "info_dict", "=", "{", "}", "output", "=", "util", ".", "exec_command", "(", "[", "ntpdateCmd", ",", "'-u'", ",", "'-q'", ",", "host", "]", ")", "for", "line", "in", "output", ".", "splitlin...
Get NTP Stats and offset of remote host relative to localhost by querying NTP Server on remote host. @param host: Remote Host IP. @return: Dictionary of NTP stats converted to seconds.
[ "Get", "NTP", "Stats", "and", "offset", "of", "remote", "host", "relative", "to", "localhost", "by", "querying", "NTP", "Server", "on", "remote", "host", ".", "@param", "host", ":", "Remote", "Host", "IP", ".", "@return", ":", "Dictionary", "of", "NTP", ...
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/ntp.py#L51-L70
aouyar/PyMunin
pysysinfo/ntp.py
NTPinfo.getHostOffsets
def getHostOffsets(self, hosts): """Get NTP Stats and offset of multiple remote hosts relative to localhost by querying NTP Servers on remote hosts. @param host: List of Remote Host IPs. @return: Dictionary of NTP stats converted to seconds. """ info_dict = ...
python
def getHostOffsets(self, hosts): """Get NTP Stats and offset of multiple remote hosts relative to localhost by querying NTP Servers on remote hosts. @param host: List of Remote Host IPs. @return: Dictionary of NTP stats converted to seconds. """ info_dict = ...
[ "def", "getHostOffsets", "(", "self", ",", "hosts", ")", ":", "info_dict", "=", "{", "}", "output", "=", "util", ".", "exec_command", "(", "[", "ntpdateCmd", ",", "'-u'", ",", "'-q'", "]", "+", "list", "(", "hosts", ")", ")", "for", "line", "in", "...
Get NTP Stats and offset of multiple remote hosts relative to localhost by querying NTP Servers on remote hosts. @param host: List of Remote Host IPs. @return: Dictionary of NTP stats converted to seconds.
[ "Get", "NTP", "Stats", "and", "offset", "of", "multiple", "remote", "hosts", "relative", "to", "localhost", "by", "querying", "NTP", "Servers", "on", "remote", "hosts", ".", "@param", "host", ":", "List", "of", "Remote", "Host", "IPs", ".", "@return", ":",...
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/ntp.py#L72-L93
aouyar/PyMunin
pysysinfo/system.py
SystemInfo.getUptime
def getUptime(self): """Return system uptime in seconds. @return: Float that represents uptime in seconds. """ try: fp = open(uptimeFile, 'r') line = fp.readline() fp.close() except: raise IOError('Failed reading s...
python
def getUptime(self): """Return system uptime in seconds. @return: Float that represents uptime in seconds. """ try: fp = open(uptimeFile, 'r') line = fp.readline() fp.close() except: raise IOError('Failed reading s...
[ "def", "getUptime", "(", "self", ")", ":", "try", ":", "fp", "=", "open", "(", "uptimeFile", ",", "'r'", ")", "line", "=", "fp", ".", "readline", "(", ")", "fp", ".", "close", "(", ")", "except", ":", "raise", "IOError", "(", "'Failed reading stats f...
Return system uptime in seconds. @return: Float that represents uptime in seconds.
[ "Return", "system", "uptime", "in", "seconds", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/system.py#L46-L58
aouyar/PyMunin
pysysinfo/system.py
SystemInfo.getLoadAvg
def getLoadAvg(self): """Return system Load Average. @return: List of 1 min, 5 min and 15 min Load Average figures. """ try: fp = open(loadavgFile, 'r') line = fp.readline() fp.close() except: raise IOError('Failed...
python
def getLoadAvg(self): """Return system Load Average. @return: List of 1 min, 5 min and 15 min Load Average figures. """ try: fp = open(loadavgFile, 'r') line = fp.readline() fp.close() except: raise IOError('Failed...
[ "def", "getLoadAvg", "(", "self", ")", ":", "try", ":", "fp", "=", "open", "(", "loadavgFile", ",", "'r'", ")", "line", "=", "fp", ".", "readline", "(", ")", "fp", ".", "close", "(", ")", "except", ":", "raise", "IOError", "(", "'Failed reading stats...
Return system Load Average. @return: List of 1 min, 5 min and 15 min Load Average figures.
[ "Return", "system", "Load", "Average", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/system.py#L60-L76
aouyar/PyMunin
pysysinfo/system.py
SystemInfo.getCPUuse
def getCPUuse(self): """Return cpu time utilization in seconds. @return: Dictionary of stats. """ hz = os.sysconf('SC_CLK_TCK') info_dict = {} try: fp = open(cpustatFile, 'r') line = fp.readline() fp.close() ex...
python
def getCPUuse(self): """Return cpu time utilization in seconds. @return: Dictionary of stats. """ hz = os.sysconf('SC_CLK_TCK') info_dict = {} try: fp = open(cpustatFile, 'r') line = fp.readline() fp.close() ex...
[ "def", "getCPUuse", "(", "self", ")", ":", "hz", "=", "os", ".", "sysconf", "(", "'SC_CLK_TCK'", ")", "info_dict", "=", "{", "}", "try", ":", "fp", "=", "open", "(", "cpustatFile", ",", "'r'", ")", "line", "=", "fp", ".", "readline", "(", ")", "f...
Return cpu time utilization in seconds. @return: Dictionary of stats.
[ "Return", "cpu", "time", "utilization", "in", "seconds", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/system.py#L78-L96
aouyar/PyMunin
pysysinfo/system.py
SystemInfo.getProcessStats
def getProcessStats(self): """Return stats for running and blocked processes, forks, context switches and interrupts. @return: Dictionary of stats. """ info_dict = {} try: fp = open(cpustatFile, 'r') data = fp.read() ...
python
def getProcessStats(self): """Return stats for running and blocked processes, forks, context switches and interrupts. @return: Dictionary of stats. """ info_dict = {} try: fp = open(cpustatFile, 'r') data = fp.read() ...
[ "def", "getProcessStats", "(", "self", ")", ":", "info_dict", "=", "{", "}", "try", ":", "fp", "=", "open", "(", "cpustatFile", ",", "'r'", ")", "data", "=", "fp", ".", "read", "(", ")", "fp", ".", "close", "(", ")", "except", ":", "raise", "IOEr...
Return stats for running and blocked processes, forks, context switches and interrupts. @return: Dictionary of stats.
[ "Return", "stats", "for", "running", "and", "blocked", "processes", "forks", "context", "switches", "and", "interrupts", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/system.py#L98-L118
aouyar/PyMunin
pysysinfo/system.py
SystemInfo.getMemoryUse
def getMemoryUse(self): """Return stats for memory utilization. @return: Dictionary of stats. """ info_dict = {} try: fp = open(meminfoFile, 'r') data = fp.read() fp.close() except: raise IOError('Failed re...
python
def getMemoryUse(self): """Return stats for memory utilization. @return: Dictionary of stats. """ info_dict = {} try: fp = open(meminfoFile, 'r') data = fp.read() fp.close() except: raise IOError('Failed re...
[ "def", "getMemoryUse", "(", "self", ")", ":", "info_dict", "=", "{", "}", "try", ":", "fp", "=", "open", "(", "meminfoFile", ",", "'r'", ")", "data", "=", "fp", ".", "read", "(", ")", "fp", ".", "close", "(", ")", "except", ":", "raise", "IOError...
Return stats for memory utilization. @return: Dictionary of stats.
[ "Return", "stats", "for", "memory", "utilization", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/system.py#L120-L141
aouyar/PyMunin
pysysinfo/system.py
SystemInfo.getSwapStats
def getSwapStats(self): """Return information on swap partition and / or files. @return: Dictionary of stats. """ info_dict = {} try: fp = open(swapsFile, 'r') data = fp.read() fp.close() except: ra...
python
def getSwapStats(self): """Return information on swap partition and / or files. @return: Dictionary of stats. """ info_dict = {} try: fp = open(swapsFile, 'r') data = fp.read() fp.close() except: ra...
[ "def", "getSwapStats", "(", "self", ")", ":", "info_dict", "=", "{", "}", "try", ":", "fp", "=", "open", "(", "swapsFile", ",", "'r'", ")", "data", "=", "fp", ".", "read", "(", ")", "fp", ".", "close", "(", ")", "except", ":", "raise", "IOError",...
Return information on swap partition and / or files. @return: Dictionary of stats.
[ "Return", "information", "on", "swap", "partition", "and", "/", "or", "files", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/system.py#L143-L162
aouyar/PyMunin
pysysinfo/system.py
SystemInfo.getVMstats
def getVMstats(self): """Return stats for Virtual Memory Subsystem. @return: Dictionary of stats. """ info_dict = {} try: fp = open(vmstatFile, 'r') data = fp.read() fp.close() except: raise IOError('Failed...
python
def getVMstats(self): """Return stats for Virtual Memory Subsystem. @return: Dictionary of stats. """ info_dict = {} try: fp = open(vmstatFile, 'r') data = fp.read() fp.close() except: raise IOError('Failed...
[ "def", "getVMstats", "(", "self", ")", ":", "info_dict", "=", "{", "}", "try", ":", "fp", "=", "open", "(", "vmstatFile", ",", "'r'", ")", "data", "=", "fp", ".", "read", "(", ")", "fp", ".", "close", "(", ")", "except", ":", "raise", "IOError", ...
Return stats for Virtual Memory Subsystem. @return: Dictionary of stats.
[ "Return", "stats", "for", "Virtual", "Memory", "Subsystem", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/system.py#L164-L181
aouyar/PyMunin
pysysinfo/memcached.py
MemcachedInfo._connect
def _connect(self): """Connect to Memcached.""" if self._socketFile is not None: if not os.path.exists(self._socketFile): raise Exception("Socket file (%s) for Memcached Instance not found." % self._socketFile) try: if self....
python
def _connect(self): """Connect to Memcached.""" if self._socketFile is not None: if not os.path.exists(self._socketFile): raise Exception("Socket file (%s) for Memcached Instance not found." % self._socketFile) try: if self....
[ "def", "_connect", "(", "self", ")", ":", "if", "self", ".", "_socketFile", "is", "not", "None", ":", "if", "not", "os", ".", "path", ".", "exists", "(", "self", ".", "_socketFile", ")", ":", "raise", "Exception", "(", "\"Socket file (%s) for Memcached Ins...
Connect to Memcached.
[ "Connect", "to", "Memcached", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/memcached.py#L66-L79
aouyar/PyMunin
pysysinfo/memcached.py
MemcachedInfo._sendStatCmd
def _sendStatCmd(self, cmd): """Send stat command to Memcached Server and return response lines. @param cmd: Command string. @return: Array of strings. """ try: self._conn.write("%s\r\n" % cmd) regex = re.compile('^(END|ERROR)\r\n', r...
python
def _sendStatCmd(self, cmd): """Send stat command to Memcached Server and return response lines. @param cmd: Command string. @return: Array of strings. """ try: self._conn.write("%s\r\n" % cmd) regex = re.compile('^(END|ERROR)\r\n', r...
[ "def", "_sendStatCmd", "(", "self", ",", "cmd", ")", ":", "try", ":", "self", ".", "_conn", ".", "write", "(", "\"%s\\r\\n\"", "%", "cmd", ")", "regex", "=", "re", ".", "compile", "(", "'^(END|ERROR)\\r\\n'", ",", "re", ".", "MULTILINE", ")", "(", "i...
Send stat command to Memcached Server and return response lines. @param cmd: Command string. @return: Array of strings.
[ "Send", "stat", "command", "to", "Memcached", "Server", "and", "return", "response", "lines", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/memcached.py#L81-L101
aouyar/PyMunin
pysysinfo/memcached.py
MemcachedInfo._parseStats
def _parseStats(self, lines, parse_slabs = False): """Parse stats output from memcached and return dictionary of stats- @param lines: Array of lines of input text. @param parse_slabs: Parse slab stats if True. @return: Stats dictionary. """ ...
python
def _parseStats(self, lines, parse_slabs = False): """Parse stats output from memcached and return dictionary of stats- @param lines: Array of lines of input text. @param parse_slabs: Parse slab stats if True. @return: Stats dictionary. """ ...
[ "def", "_parseStats", "(", "self", ",", "lines", ",", "parse_slabs", "=", "False", ")", ":", "info_dict", "=", "{", "}", "info_dict", "[", "'slabs'", "]", "=", "{", "}", "for", "line", "in", "lines", ":", "mobj", "=", "re", ".", "match", "(", "'^ST...
Parse stats output from memcached and return dictionary of stats- @param lines: Array of lines of input text. @param parse_slabs: Parse slab stats if True. @return: Stats dictionary.
[ "Parse", "stats", "output", "from", "memcached", "and", "return", "dictionary", "of", "stats", "-" ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/memcached.py#L102-L124
aouyar/PyMunin
pymunin/plugins/memcachedstats.py
MuninMemcachedPlugin.retrieveVals
def retrieveVals(self): """Retrieve values for graphs.""" if self._stats is None: serverInfo = MemcachedInfo(self._host, self._port, self._socket_file) stats = serverInfo.getStats() else: stats = self._stats if stats is None: raise Excepti...
python
def retrieveVals(self): """Retrieve values for graphs.""" if self._stats is None: serverInfo = MemcachedInfo(self._host, self._port, self._socket_file) stats = serverInfo.getStats() else: stats = self._stats if stats is None: raise Excepti...
[ "def", "retrieveVals", "(", "self", ")", ":", "if", "self", ".", "_stats", "is", "None", ":", "serverInfo", "=", "MemcachedInfo", "(", "self", ".", "_host", ",", "self", ".", "_port", ",", "self", ".", "_socket_file", ")", "stats", "=", "serverInfo", "...
Retrieve values for graphs.
[ "Retrieve", "values", "for", "graphs", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/memcachedstats.py#L305-L440
aouyar/PyMunin
pymunin/plugins/memcachedstats.py
MuninMemcachedPlugin.autoconf
def autoconf(self): """Implements Munin Plugin Auto-Configuration Option. @return: True if plugin can be auto-configured, False otherwise. """ serverInfo = MemcachedInfo(self._host, self._port, self._socket_file) return (serverInfo is not None)
python
def autoconf(self): """Implements Munin Plugin Auto-Configuration Option. @return: True if plugin can be auto-configured, False otherwise. """ serverInfo = MemcachedInfo(self._host, self._port, self._socket_file) return (serverInfo is not None)
[ "def", "autoconf", "(", "self", ")", ":", "serverInfo", "=", "MemcachedInfo", "(", "self", ".", "_host", ",", "self", ".", "_port", ",", "self", ".", "_socket_file", ")", "return", "(", "serverInfo", "is", "not", "None", ")" ]
Implements Munin Plugin Auto-Configuration Option. @return: True if plugin can be auto-configured, False otherwise.
[ "Implements", "Munin", "Plugin", "Auto", "-", "Configuration", "Option", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/memcachedstats.py#L442-L449
ContextLab/quail
quail/distance.py
correlation
def correlation(a, b): "Returns correlation distance between a and b" if isinstance(a, list): a = np.array(a) if isinstance(b, list): b = np.array(b) a = a.reshape(1, -1) b = b.reshape(1, -1) return cdist(a, b, 'correlation')
python
def correlation(a, b): "Returns correlation distance between a and b" if isinstance(a, list): a = np.array(a) if isinstance(b, list): b = np.array(b) a = a.reshape(1, -1) b = b.reshape(1, -1) return cdist(a, b, 'correlation')
[ "def", "correlation", "(", "a", ",", "b", ")", ":", "if", "isinstance", "(", "a", ",", "list", ")", ":", "a", "=", "np", ".", "array", "(", "a", ")", "if", "isinstance", "(", "b", ",", "list", ")", ":", "b", "=", "np", ".", "array", "(", "b...
Returns correlation distance between a and b
[ "Returns", "correlation", "distance", "between", "a", "and", "b" ]
train
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/distance.py#L9-L17
ContextLab/quail
quail/distance.py
euclidean
def euclidean(a, b): "Returns euclidean distance between a and b" return np.linalg.norm(np.subtract(a, b))
python
def euclidean(a, b): "Returns euclidean distance between a and b" return np.linalg.norm(np.subtract(a, b))
[ "def", "euclidean", "(", "a", ",", "b", ")", ":", "return", "np", ".", "linalg", ".", "norm", "(", "np", ".", "subtract", "(", "a", ",", "b", ")", ")" ]
Returns euclidean distance between a and b
[ "Returns", "euclidean", "distance", "between", "a", "and", "b" ]
train
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/distance.py#L19-L21
aouyar/PyMunin
pysysinfo/process.py
ProcessInfo.execProcCmd
def execProcCmd(self, *args): """Execute ps command with positional params args and return result as list of lines. @param *args: Positional params for ps command. @return: List of output lines """ out = util.exec_command([psCmd,] + list(args)) ...
python
def execProcCmd(self, *args): """Execute ps command with positional params args and return result as list of lines. @param *args: Positional params for ps command. @return: List of output lines """ out = util.exec_command([psCmd,] + list(args)) ...
[ "def", "execProcCmd", "(", "self", ",", "*", "args", ")", ":", "out", "=", "util", ".", "exec_command", "(", "[", "psCmd", ",", "]", "+", "list", "(", "args", ")", ")", "return", "out", ".", "splitlines", "(", ")" ]
Execute ps command with positional params args and return result as list of lines. @param *args: Positional params for ps command. @return: List of output lines
[ "Execute", "ps", "command", "with", "positional", "params", "args", "and", "return", "result", "as", "list", "of", "lines", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/process.py#L47-L56
aouyar/PyMunin
pysysinfo/process.py
ProcessInfo.parseProcCmd
def parseProcCmd(self, fields=('pid', 'user', 'cmd',), threads=False): """Execute ps command with custom output format with columns from fields and return result as a nested list. The Standard Format Specifiers from ps man page must be used for the fields parameter. ...
python
def parseProcCmd(self, fields=('pid', 'user', 'cmd',), threads=False): """Execute ps command with custom output format with columns from fields and return result as a nested list. The Standard Format Specifiers from ps man page must be used for the fields parameter. ...
[ "def", "parseProcCmd", "(", "self", ",", "fields", "=", "(", "'pid'", ",", "'user'", ",", "'cmd'", ",", ")", ",", "threads", "=", "False", ")", ":", "args", "=", "[", "]", "headers", "=", "[", "f", ".", "lower", "(", ")", "for", "f", "in", "fie...
Execute ps command with custom output format with columns from fields and return result as a nested list. The Standard Format Specifiers from ps man page must be used for the fields parameter. @param fields: List of fields included in the output. ...
[ "Execute", "ps", "command", "with", "custom", "output", "format", "with", "columns", "from", "fields", "and", "return", "result", "as", "a", "nested", "list", ".", "The", "Standard", "Format", "Specifiers", "from", "ps", "man", "page", "must", "be", "used", ...
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/process.py#L58-L98
aouyar/PyMunin
pysysinfo/process.py
ProcessInfo.getProcList
def getProcList(self, fields=('pid', 'user', 'cmd',), threads=False, **kwargs): """Execute ps command with custom output format with columns columns from fields, select lines using the filters defined by kwargs and return result as a nested list. The Standa...
python
def getProcList(self, fields=('pid', 'user', 'cmd',), threads=False, **kwargs): """Execute ps command with custom output format with columns columns from fields, select lines using the filters defined by kwargs and return result as a nested list. The Standa...
[ "def", "getProcList", "(", "self", ",", "fields", "=", "(", "'pid'", ",", "'user'", ",", "'cmd'", ",", ")", ",", "threads", "=", "False", ",", "*", "*", "kwargs", ")", ":", "field_list", "=", "list", "(", "fields", ")", "for", "key", "in", "kwargs"...
Execute ps command with custom output format with columns columns from fields, select lines using the filters defined by kwargs and return result as a nested list. The Standard Format Specifiers from ps man page must be used for the fields parameter. @param fi...
[ "Execute", "ps", "command", "with", "custom", "output", "format", "with", "columns", "columns", "from", "fields", "select", "lines", "using", "the", "filters", "defined", "by", "kwargs", "and", "return", "result", "as", "a", "nested", "list", ".", "The", "St...
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/process.py#L100-L144
aouyar/PyMunin
pysysinfo/process.py
ProcessInfo.getProcDict
def getProcDict(self, fields=('user', 'cmd',), threads=False, **kwargs): """Execute ps command with custom output format with columns format with columns from fields, and return result as a nested dictionary with the key PID or SPID. The Standard Format Specifiers from ps man ...
python
def getProcDict(self, fields=('user', 'cmd',), threads=False, **kwargs): """Execute ps command with custom output format with columns format with columns from fields, and return result as a nested dictionary with the key PID or SPID. The Standard Format Specifiers from ps man ...
[ "def", "getProcDict", "(", "self", ",", "fields", "=", "(", "'user'", ",", "'cmd'", ",", ")", ",", "threads", "=", "False", ",", "*", "*", "kwargs", ")", ":", "stats", "=", "{", "}", "field_list", "=", "list", "(", "fields", ")", "num_cols", "=", ...
Execute ps command with custom output format with columns format with columns from fields, and return result as a nested dictionary with the key PID or SPID. The Standard Format Specifiers from ps man page must be used for the fields parameter. @param fields:...
[ "Execute", "ps", "command", "with", "custom", "output", "format", "with", "columns", "format", "with", "columns", "from", "fields", "and", "return", "result", "as", "a", "nested", "dictionary", "with", "the", "key", "PID", "or", "SPID", ".", "The", "Standard...
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/process.py#L146-L198
aouyar/PyMunin
pysysinfo/process.py
ProcessInfo.getProcStatStatus
def getProcStatStatus(self, threads=False, **kwargs): """Return process counts per status and priority. @param **kwargs: Keyword variables are used for filtering the results depending on the values of the columns. Each keyword must correspond t...
python
def getProcStatStatus(self, threads=False, **kwargs): """Return process counts per status and priority. @param **kwargs: Keyword variables are used for filtering the results depending on the values of the columns. Each keyword must correspond t...
[ "def", "getProcStatStatus", "(", "self", ",", "threads", "=", "False", ",", "*", "*", "kwargs", ")", ":", "procs", "=", "self", ".", "getProcList", "(", "[", "'stat'", ",", "]", ",", "threads", "=", "threads", ",", "*", "*", "kwargs", ")", "status", ...
Return process counts per status and priority. @param **kwargs: Keyword variables are used for filtering the results depending on the values of the columns. Each keyword must correspond to a field name with an optional suffix:...
[ "Return", "process", "counts", "per", "status", "and", "priority", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/process.py#L200-L242
aouyar/PyMunin
pymunin/plugins/ntpstats.py
MuninNTPstatsPlugin.retrieveVals
def retrieveVals(self): """Retrieve values for graphs.""" ntpinfo = NTPinfo() stats = ntpinfo.getPeerStats() if stats: if self.hasGraph('ntp_peer_stratum'): self.setGraphVal('ntp_peer_stratum', 'stratum', stats.get('stratum'))...
python
def retrieveVals(self): """Retrieve values for graphs.""" ntpinfo = NTPinfo() stats = ntpinfo.getPeerStats() if stats: if self.hasGraph('ntp_peer_stratum'): self.setGraphVal('ntp_peer_stratum', 'stratum', stats.get('stratum'))...
[ "def", "retrieveVals", "(", "self", ")", ":", "ntpinfo", "=", "NTPinfo", "(", ")", "stats", "=", "ntpinfo", ".", "getPeerStats", "(", ")", "if", "stats", ":", "if", "self", ".", "hasGraph", "(", "'ntp_peer_stratum'", ")", ":", "self", ".", "setGraphVal",...
Retrieve values for graphs.
[ "Retrieve", "values", "for", "graphs", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/ntpstats.py#L84-L98
aouyar/PyMunin
pymunin/__init__.py
muninMain
def muninMain(pluginClass, argv=None, env=None, debug=False): """Main Block for Munin Plugins. @param pluginClass: Child class of MuninPlugin that implements plugin. @param argv: List of command line arguments to Munin Plugin. @param env: Dictionary of environment variables passed to...
python
def muninMain(pluginClass, argv=None, env=None, debug=False): """Main Block for Munin Plugins. @param pluginClass: Child class of MuninPlugin that implements plugin. @param argv: List of command line arguments to Munin Plugin. @param env: Dictionary of environment variables passed to...
[ "def", "muninMain", "(", "pluginClass", ",", "argv", "=", "None", ",", "env", "=", "None", ",", "debug", "=", "False", ")", ":", "if", "argv", "is", "None", ":", "argv", "=", "sys", ".", "argv", "if", "env", "is", "None", ":", "env", "=", "os", ...
Main Block for Munin Plugins. @param pluginClass: Child class of MuninPlugin that implements plugin. @param argv: List of command line arguments to Munin Plugin. @param env: Dictionary of environment variables passed to Munin Plugin. @param debug: Print debugging messages if Tr...
[ "Main", "Block", "for", "Munin", "Plugins", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L938-L973
aouyar/PyMunin
pymunin/__init__.py
fixLabel
def fixLabel(label, maxlen, delim=None, repl='', truncend=True): """Truncate long graph and field labels. @param label: Label text. @param maxlen: Maximum field label length in characters. No maximum field label length is enforced by default. @param delim: ...
python
def fixLabel(label, maxlen, delim=None, repl='', truncend=True): """Truncate long graph and field labels. @param label: Label text. @param maxlen: Maximum field label length in characters. No maximum field label length is enforced by default. @param delim: ...
[ "def", "fixLabel", "(", "label", ",", "maxlen", ",", "delim", "=", "None", ",", "repl", "=", "''", ",", "truncend", "=", "True", ")", ":", "if", "len", "(", "label", ")", "<=", "maxlen", ":", "return", "label", "else", ":", "maxlen", "-=", "len", ...
Truncate long graph and field labels. @param label: Label text. @param maxlen: Maximum field label length in characters. No maximum field label length is enforced by default. @param delim: Delimiter for field labels field labels longer than ...
[ "Truncate", "long", "graph", "and", "field", "labels", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L975-L1004
aouyar/PyMunin
pymunin/__init__.py
MuninPlugin._parseEnv
def _parseEnv(self, env=None): """Private method for parsing through environment variables. Parses for environment variables common to all Munin Plugins: - MUNIN_STATEFILE - MUNIN_CAP_DIRTY_CONFIG - nested_graphs @param env: Dictionary of env...
python
def _parseEnv(self, env=None): """Private method for parsing through environment variables. Parses for environment variables common to all Munin Plugins: - MUNIN_STATEFILE - MUNIN_CAP_DIRTY_CONFIG - nested_graphs @param env: Dictionary of env...
[ "def", "_parseEnv", "(", "self", ",", "env", "=", "None", ")", ":", "if", "not", "env", ":", "env", "=", "self", ".", "_env", "if", "env", ".", "has_key", "(", "'MUNIN_STATEFILE'", ")", ":", "self", ".", "_stateFile", "=", "env", ".", "get", "(", ...
Private method for parsing through environment variables. Parses for environment variables common to all Munin Plugins: - MUNIN_STATEFILE - MUNIN_CAP_DIRTY_CONFIG - nested_graphs @param env: Dictionary of environment variables. (O...
[ "Private", "method", "for", "parsing", "through", "environment", "variables", ".", "Parses", "for", "environment", "variables", "common", "to", "all", "Munin", "Plugins", ":", "-", "MUNIN_STATEFILE", "-", "MUNIN_CAP_DIRTY_CONFIG", "-", "nested_graphs" ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L149-L169
aouyar/PyMunin
pymunin/__init__.py
MuninPlugin._getGraph
def _getGraph(self, graph_name, fail_noexist=False): """Private method for returning graph object with name graph_name. @param graph_name: Graph Name @param fail_noexist: If true throw exception if there is no graph with name graph_name. @return: ...
python
def _getGraph(self, graph_name, fail_noexist=False): """Private method for returning graph object with name graph_name. @param graph_name: Graph Name @param fail_noexist: If true throw exception if there is no graph with name graph_name. @return: ...
[ "def", "_getGraph", "(", "self", ",", "graph_name", ",", "fail_noexist", "=", "False", ")", ":", "graph", "=", "self", ".", "_graphDict", ".", "get", "(", "graph_name", ")", "if", "fail_noexist", "and", "graph", "is", "None", ":", "raise", "AttributeError"...
Private method for returning graph object with name graph_name. @param graph_name: Graph Name @param fail_noexist: If true throw exception if there is no graph with name graph_name. @return: Graph Object or None
[ "Private", "method", "for", "returning", "graph", "object", "with", "name", "graph_name", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L171-L184
aouyar/PyMunin
pymunin/__init__.py
MuninPlugin._getSubGraph
def _getSubGraph(self, parent_name, graph_name, fail_noexist=False): """Private method for returning subgraph object with name graph_name and parent graph with name parent_name. @param parent_name: Root Graph Name @param graph_name: Subgraph Name @param fail_noexist...
python
def _getSubGraph(self, parent_name, graph_name, fail_noexist=False): """Private method for returning subgraph object with name graph_name and parent graph with name parent_name. @param parent_name: Root Graph Name @param graph_name: Subgraph Name @param fail_noexist...
[ "def", "_getSubGraph", "(", "self", ",", "parent_name", ",", "graph_name", ",", "fail_noexist", "=", "False", ")", ":", "if", "not", "self", ".", "isMultigraph", ":", "raise", "AttributeError", "(", "\"Simple Munin Plugins cannot have subgraphs.\"", ")", "if", "se...
Private method for returning subgraph object with name graph_name and parent graph with name parent_name. @param parent_name: Root Graph Name @param graph_name: Subgraph Name @param fail_noexist: If true throw exception if there is no subgraph ...
[ "Private", "method", "for", "returning", "subgraph", "object", "with", "name", "graph_name", "and", "parent", "graph", "with", "name", "parent_name", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L186-L214
aouyar/PyMunin
pymunin/__init__.py
MuninPlugin._getMultigraphID
def _getMultigraphID(self, graph_name, subgraph_name=None): """Private method for generating Multigraph ID from graph name and subgraph name. @param graph_name: Graph Name. @param subgraph_name: Subgraph Name. @return: Multigraph ID. ...
python
def _getMultigraphID(self, graph_name, subgraph_name=None): """Private method for generating Multigraph ID from graph name and subgraph name. @param graph_name: Graph Name. @param subgraph_name: Subgraph Name. @return: Multigraph ID. ...
[ "def", "_getMultigraphID", "(", "self", ",", "graph_name", ",", "subgraph_name", "=", "None", ")", ":", "if", "self", ".", "isMultiInstance", "and", "self", ".", "_instanceName", "is", "not", "None", ":", "if", "subgraph_name", "is", "None", ":", "return", ...
Private method for generating Multigraph ID from graph name and subgraph name. @param graph_name: Graph Name. @param subgraph_name: Subgraph Name. @return: Multigraph ID.
[ "Private", "method", "for", "generating", "Multigraph", "ID", "from", "graph", "name", "and", "subgraph", "name", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L216-L235
aouyar/PyMunin
pymunin/__init__.py
MuninPlugin._formatConfig
def _formatConfig(self, conf_dict): """Formats configuration directory from Munin Graph and returns multi-line value entries for the plugin config cycle. @param conf_dict: Configuration directory. @return: Multi-line text. """ confs = [] ...
python
def _formatConfig(self, conf_dict): """Formats configuration directory from Munin Graph and returns multi-line value entries for the plugin config cycle. @param conf_dict: Configuration directory. @return: Multi-line text. """ confs = [] ...
[ "def", "_formatConfig", "(", "self", ",", "conf_dict", ")", ":", "confs", "=", "[", "]", "graph_dict", "=", "conf_dict", "[", "'graph'", "]", "field_list", "=", "conf_dict", "[", "'fields'", "]", "# Order and format Graph Attributes", "title", "=", "graph_dict",...
Formats configuration directory from Munin Graph and returns multi-line value entries for the plugin config cycle. @param conf_dict: Configuration directory. @return: Multi-line text.
[ "Formats", "configuration", "directory", "from", "Munin", "Graph", "and", "returns", "multi", "-", "line", "value", "entries", "for", "the", "plugin", "config", "cycle", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L237-L287
aouyar/PyMunin
pymunin/__init__.py
MuninPlugin._formatVals
def _formatVals(self, val_list): """Formats value list from Munin Graph and returns multi-line value entries for the plugin fetch cycle. @param val_list: List of name-value pairs. @return: Multi-line text. """ vals = [] for (name, val) i...
python
def _formatVals(self, val_list): """Formats value list from Munin Graph and returns multi-line value entries for the plugin fetch cycle. @param val_list: List of name-value pairs. @return: Multi-line text. """ vals = [] for (name, val) i...
[ "def", "_formatVals", "(", "self", ",", "val_list", ")", ":", "vals", "=", "[", "]", "for", "(", "name", ",", "val", ")", "in", "val_list", ":", "if", "val", "is", "not", "None", ":", "if", "isinstance", "(", "val", ",", "float", ")", ":", "vals"...
Formats value list from Munin Graph and returns multi-line value entries for the plugin fetch cycle. @param val_list: List of name-value pairs. @return: Multi-line text.
[ "Formats", "value", "list", "from", "Munin", "Graph", "and", "returns", "multi", "-", "line", "value", "entries", "for", "the", "plugin", "fetch", "cycle", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L289-L306
aouyar/PyMunin
pymunin/__init__.py
MuninPlugin.envGet
def envGet(self, name, default=None, conv=None): """Return value for environment variable or None. @param name: Name of environment variable. @param default: Default value if variable is undefined. @param conv: Function for converting value to desired type. @retu...
python
def envGet(self, name, default=None, conv=None): """Return value for environment variable or None. @param name: Name of environment variable. @param default: Default value if variable is undefined. @param conv: Function for converting value to desired type. @retu...
[ "def", "envGet", "(", "self", ",", "name", ",", "default", "=", "None", ",", "conv", "=", "None", ")", ":", "if", "self", ".", "_env", ".", "has_key", "(", "name", ")", ":", "if", "conv", "is", "not", "None", ":", "return", "conv", "(", "self", ...
Return value for environment variable or None. @param name: Name of environment variable. @param default: Default value if variable is undefined. @param conv: Function for converting value to desired type. @return: Value of environment variable.
[ "Return", "value", "for", "environment", "variable", "or", "None", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L317-L332
aouyar/PyMunin
pymunin/__init__.py
MuninPlugin.envGetList
def envGetList(self, name, attr_regex = '^\w+$', conv=None): """Parse the plugin environment variables to return list from variable with name list_<name>. The value of the variable must be a comma separated list of items. @param name: Name of list. ...
python
def envGetList(self, name, attr_regex = '^\w+$', conv=None): """Parse the plugin environment variables to return list from variable with name list_<name>. The value of the variable must be a comma separated list of items. @param name: Name of list. ...
[ "def", "envGetList", "(", "self", ",", "name", ",", "attr_regex", "=", "'^\\w+$'", ",", "conv", "=", "None", ")", ":", "key", "=", "\"list_%s\"", "%", "name", "item_list", "=", "[", "]", "if", "self", ".", "_env", ".", "has_key", "(", "key", ")", "...
Parse the plugin environment variables to return list from variable with name list_<name>. The value of the variable must be a comma separated list of items. @param name: Name of list. (Also determines suffix for environment variable name.) @par...
[ "Parse", "the", "plugin", "environment", "variables", "to", "return", "list", "from", "variable", "with", "name", "list_<name", ">", ".", "The", "value", "of", "the", "variable", "must", "be", "a", "comma", "separated", "list", "of", "items", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L335-L364
aouyar/PyMunin
pymunin/__init__.py
MuninPlugin.envRegisterFilter
def envRegisterFilter(self, name, attr_regex = '^\w+$', default = True): """Register filter for including, excluding attributes in graphs through the use of include_<name> and exclude_<name> environment variables. The value of the variables must be a comma separated list of items. ...
python
def envRegisterFilter(self, name, attr_regex = '^\w+$', default = True): """Register filter for including, excluding attributes in graphs through the use of include_<name> and exclude_<name> environment variables. The value of the variables must be a comma separated list of items. ...
[ "def", "envRegisterFilter", "(", "self", ",", "name", ",", "attr_regex", "=", "'^\\w+$'", ",", "default", "=", "True", ")", ":", "attrs", "=", "{", "}", "for", "prefix", "in", "(", "'include'", ",", "'exclude'", ")", ":", "key", "=", "\"%s_%s\"", "%", ...
Register filter for including, excluding attributes in graphs through the use of include_<name> and exclude_<name> environment variables. The value of the variables must be a comma separated list of items. @param name: Name of filter. (Also determines ...
[ "Register", "filter", "for", "including", "excluding", "attributes", "in", "graphs", "through", "the", "use", "of", "include_<name", ">", "and", "exclude_<name", ">", "environment", "variables", ".", "The", "value", "of", "the", "variables", "must", "be", "a", ...
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L366-L387
aouyar/PyMunin
pymunin/__init__.py
MuninPlugin.envCheckFilter
def envCheckFilter(self, name, attr): """Check if a specific graph attribute is enabled or disabled through the use of a filter based on include_<name> and exclude_<name> environment variables. @param name: Name of the Filter. @param attr: Name of the Attribute. ...
python
def envCheckFilter(self, name, attr): """Check if a specific graph attribute is enabled or disabled through the use of a filter based on include_<name> and exclude_<name> environment variables. @param name: Name of the Filter. @param attr: Name of the Attribute. ...
[ "def", "envCheckFilter", "(", "self", ",", "name", ",", "attr", ")", ":", "flt", "=", "self", ".", "_filters", ".", "get", "(", "name", ")", "if", "flt", ":", "return", "flt", ".", "check", "(", "attr", ")", "else", ":", "raise", "AttributeError", ...
Check if a specific graph attribute is enabled or disabled through the use of a filter based on include_<name> and exclude_<name> environment variables. @param name: Name of the Filter. @param attr: Name of the Attribute. @return: Return True if the attribute is en...
[ "Check", "if", "a", "specific", "graph", "attribute", "is", "enabled", "or", "disabled", "through", "the", "use", "of", "a", "filter", "based", "on", "include_<name", ">", "and", "exclude_<name", ">", "environment", "variables", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L389-L403
aouyar/PyMunin
pymunin/__init__.py
MuninPlugin.envCheckFlag
def envCheckFlag(self, name, default = False): """Check graph flag for enabling / disabling attributes through the use of <name> environment variable. @param name: Name of flag. (Also determines the environment variable name.) @param default: Boolean (...
python
def envCheckFlag(self, name, default = False): """Check graph flag for enabling / disabling attributes through the use of <name> environment variable. @param name: Name of flag. (Also determines the environment variable name.) @param default: Boolean (...
[ "def", "envCheckFlag", "(", "self", ",", "name", ",", "default", "=", "False", ")", ":", "if", "self", ".", "_flags", ".", "has_key", "(", "name", ")", ":", "return", "self", ".", "_flags", "[", "name", "]", "else", ":", "val", "=", "self", ".", ...
Check graph flag for enabling / disabling attributes through the use of <name> environment variable. @param name: Name of flag. (Also determines the environment variable name.) @param default: Boolean (True or False). Default value for flag. @return: ...
[ "Check", "graph", "flag", "for", "enabling", "/", "disabling", "attributes", "through", "the", "use", "of", "<name", ">", "environment", "variable", "." ]
train
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L405-L429