partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | FSinfo._execShowCountCmd | Execute 'show' command and return result dictionary.
@param cmd: Command string.
@return: Result dictionary. | pysysinfo/freeswitch.py | 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):
"""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... | [
"Execute",
"show",
"command",
"and",
"return",
"result",
"dictionary",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/freeswitch.py#L109-L122 | [
"def",
"_execShowCountCmd",
"(",
"self",
",",
"showcmd",
")",
":",
"result",
"=",
"None",
"lines",
"=",
"self",
".",
"_execCmd",
"(",
"\"show\"",
",",
"showcmd",
"+",
"\" count\"",
")",
"for",
"line",
"in",
"lines",
":",
"mobj",
"=",
"re",
".",
"match"... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninAsteriskPlugin.retrieveVals | Retrieve values for graphs. | pymunin/plugins/asteriskstats.py | 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):
"""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',... | [
"Retrieve",
"values",
"for",
"graphs",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/asteriskstats.py#L309-L426 | [
"def",
"retrieveVals",
"(",
"self",
")",
":",
"if",
"self",
".",
"hasGraph",
"(",
"'asterisk_calls'",
")",
"or",
"self",
".",
"hasGraph",
"(",
"'asterisk_channels'",
")",
":",
"stats",
"=",
"self",
".",
"_ami",
".",
"getChannelStats",
"(",
"self",
".",
"... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninPHPfpmPlugin.retrieveVals | Retrieve values for graphs. | pymunin/plugins/phpfpmstats.py | 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):
"""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... | [
"Retrieve",
"values",
"for",
"graphs",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/phpfpmstats.py#L111-L125 | [
"def",
"retrieveVals",
"(",
"self",
")",
":",
"fpminfo",
"=",
"PHPfpmInfo",
"(",
"self",
".",
"_host",
",",
"self",
".",
"_port",
",",
"self",
".",
"_user",
",",
"self",
".",
"_password",
",",
"self",
".",
"_monpath",
",",
"self",
".",
"_ssl",
")",
... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninPHPfpmPlugin.autoconf | Implements Munin Plugin Auto-Configuration Option.
@return: True if plugin can be auto-configured, False otherwise. | pymunin/plugins/phpfpmstats.py | 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):
"""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,... | [
"Implements",
"Munin",
"Plugin",
"Auto",
"-",
"Configuration",
"Option",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/phpfpmstats.py#L127-L135 | [
"def",
"autoconf",
"(",
"self",
")",
":",
"fpminfo",
"=",
"PHPfpmInfo",
"(",
"self",
".",
"_host",
",",
"self",
".",
"_port",
",",
"self",
".",
"_user",
",",
"self",
".",
"_password",
",",
"self",
".",
"_monpath",
",",
"self",
".",
"_ssl",
")",
"re... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | RedisInfo.ping | Ping Redis Server and return Round-Trip-Time in seconds.
@return: Round-trip-time in seconds as float. | pysysinfo/redisdb.py | 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):
"""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) | [
"Ping",
"Redis",
"Server",
"and",
"return",
"Round",
"-",
"Trip",
"-",
"Time",
"in",
"seconds",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/redisdb.py#L49-L57 | [
"def",
"ping",
"(",
"self",
")",
":",
"start",
"=",
"time",
".",
"time",
"(",
")",
"self",
".",
"_conn",
".",
"ping",
"(",
")",
"return",
"(",
"time",
".",
"time",
"(",
")",
"-",
"start",
")"
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | list2pd | 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
---... | quail/helpers.py | 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):
"""
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... | [
"Makes",
"multi",
"-",
"indexed",
"dataframe",
"of",
"subject",
"data"
] | ContextLab/quail | python | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/helpers.py#L11-L43 | [
"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"... | 71dd53c792dd915dc84879d8237e3582dd68b7a4 |
train | recmat2egg | 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...],... | quail/helpers.py | 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):
"""
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... | [
"Creates",
"egg",
"data",
"object",
"from",
"zero",
"-",
"indexed",
"recall",
"matrix"
] | ContextLab/quail | python | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/helpers.py#L72-L96 | [
"def",
"recmat2egg",
"(",
"recmat",
",",
"list_length",
"=",
"None",
")",
":",
"from",
".",
"egg",
"import",
"Egg",
"as",
"Egg",
"pres",
"=",
"[",
"[",
"[",
"str",
"(",
"word",
")",
"for",
"word",
"in",
"list",
"(",
"range",
"(",
"0",
",",
"list_... | 71dd53c792dd915dc84879d8237e3582dd68b7a4 |
train | default_dist_funcs | Fills in default distance metrics for fingerprint analyses | quail/helpers.py | 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):
"""
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 =... | [
"Fills",
"in",
"default",
"distance",
"metrics",
"for",
"fingerprint",
"analyses"
] | ContextLab/quail | python | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/helpers.py#L98-L116 | [
"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... | 71dd53c792dd915dc84879d8237e3582dd68b7a4 |
train | stack_eggs | 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... | quail/helpers.py | 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'):
'''
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... | [
"Takes",
"a",
"list",
"of",
"eggs",
"stacks",
"them",
"and",
"reindexes",
"the",
"subject",
"number"
] | ContextLab/quail | python | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/helpers.py#L118-L156 | [
"def",
"stack_eggs",
"(",
"eggs",
",",
"meta",
"=",
"'concatenate'",
")",
":",
"from",
".",
"egg",
"import",
"Egg",
"pres",
"=",
"[",
"egg",
".",
"pres",
".",
"loc",
"[",
"sub",
",",
":",
"]",
".",
"values",
".",
"tolist",
"(",
")",
"for",
"egg",... | 71dd53c792dd915dc84879d8237e3582dd68b7a4 |
train | crack_egg | 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... | quail/helpers.py | 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):
'''
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
... | [
"Takes",
"an",
"egg",
"and",
"returns",
"a",
"subset",
"of",
"the",
"subjects",
"or",
"lists"
] | ContextLab/quail | python | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/helpers.py#L158-L208 | [
"def",
"crack_egg",
"(",
"egg",
",",
"subjects",
"=",
"None",
",",
"lists",
"=",
"None",
")",
":",
"from",
".",
"egg",
"import",
"Egg",
"if",
"hasattr",
"(",
"egg",
",",
"'features'",
")",
":",
"all_have_features",
"=",
"egg",
".",
"features",
"is",
... | 71dd53c792dd915dc84879d8237e3582dd68b7a4 |
train | df2list | 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... | quail/helpers.py | 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):
"""
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
... | [
"Convert",
"a",
"MultiIndex",
"df",
"to",
"list"
] | ContextLab/quail | python | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/helpers.py#L210-L233 | [
"def",
"df2list",
"(",
"df",
")",
":",
"subjects",
"=",
"df",
".",
"index",
".",
"levels",
"[",
"0",
"]",
".",
"values",
".",
"tolist",
"(",
")",
"lists",
"=",
"df",
".",
"index",
".",
"levels",
"[",
"1",
"]",
".",
"values",
".",
"tolist",
"(",... | 71dd53c792dd915dc84879d8237e3582dd68b7a4 |
train | fill_missing | Fills in missing lists (assumes end lists are missing) | quail/helpers.py | 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):
"""
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([])
... | [
"Fills",
"in",
"missing",
"lists",
"(",
"assumes",
"end",
"lists",
"are",
"missing",
")"
] | ContextLab/quail | python | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/helpers.py#L235-L253 | [
"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... | 71dd53c792dd915dc84879d8237e3582dd68b7a4 |
train | parse_egg | Parses an egg and returns fields | quail/helpers.py | 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):
"""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 | [
"Parses",
"an",
"egg",
"and",
"returns",
"fields"
] | ContextLab/quail | python | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/helpers.py#L255-L261 | [
"def",
"parse_egg",
"(",
"egg",
")",
":",
"pres_list",
"=",
"egg",
".",
"get_pres_items",
"(",
")",
".",
"values",
"[",
"0",
"]",
"rec_list",
"=",
"egg",
".",
"get_rec_items",
"(",
")",
".",
"values",
"[",
"0",
"]",
"feature_list",
"=",
"egg",
".",
... | 71dd53c792dd915dc84879d8237e3582dd68b7a4 |
train | merge_pres_feats | Helper function to merge pres and features to support legacy features argument | quail/helpers.py | 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):
"""
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):
... | [
"Helper",
"function",
"to",
"merge",
"pres",
"and",
"features",
"to",
"support",
"legacy",
"features",
"argument"
] | ContextLab/quail | python | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/helpers.py#L263-L278 | [
"def",
"merge_pres_feats",
"(",
"pres",
",",
"features",
")",
":",
"sub",
"=",
"[",
"]",
"for",
"psub",
",",
"fsub",
"in",
"zip",
"(",
"pres",
",",
"features",
")",
":",
"exp",
"=",
"[",
"]",
"for",
"pexp",
",",
"fexp",
"in",
"zip",
"(",
"psub",
... | 71dd53c792dd915dc84879d8237e3582dd68b7a4 |
train | r2z | Function that calculates the Fisher z-transformation
Parameters
----------
r : int or ndarray
Correlation value
Returns
----------
result : int or ndarray
Fishers z transformed correlation value | quail/helpers.py | 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):
"""
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... | [
"Function",
"that",
"calculates",
"the",
"Fisher",
"z",
"-",
"transformation"
] | ContextLab/quail | python | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/helpers.py#L287-L304 | [
"def",
"r2z",
"(",
"r",
")",
":",
"with",
"np",
".",
"errstate",
"(",
"invalid",
"=",
"'ignore'",
",",
"divide",
"=",
"'ignore'",
")",
":",
"return",
"0.5",
"*",
"(",
"np",
".",
"log",
"(",
"1",
"+",
"r",
")",
"-",
"np",
".",
"log",
"(",
"1",... | 71dd53c792dd915dc84879d8237e3582dd68b7a4 |
train | z2r | 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 | quail/helpers.py | 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):
"""
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... | [
"Function",
"that",
"calculates",
"the",
"inverse",
"Fisher",
"z",
"-",
"transformation"
] | ContextLab/quail | python | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/helpers.py#L306-L323 | [
"def",
"z2r",
"(",
"z",
")",
":",
"with",
"np",
".",
"errstate",
"(",
"invalid",
"=",
"'ignore'",
",",
"divide",
"=",
"'ignore'",
")",
":",
"return",
"(",
"np",
".",
"exp",
"(",
"2",
"*",
"z",
")",
"-",
"1",
")",
"/",
"(",
"np",
".",
"exp",
... | 71dd53c792dd915dc84879d8237e3582dd68b7a4 |
train | shuffle_egg | Shuffle an Egg's recalls | quail/helpers.py | 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):
""" 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 ... | [
"Shuffle",
"an",
"Egg",
"s",
"recalls"
] | ContextLab/quail | python | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/helpers.py#L335-L349 | [
"def",
"shuffle_egg",
"(",
"egg",
")",
":",
"from",
".",
"egg",
"import",
"Egg",
"pres",
",",
"rec",
",",
"features",
",",
"dist_funcs",
"=",
"parse_egg",
"(",
"egg",
")",
"if",
"pres",
".",
"ndim",
"==",
"1",
":",
"pres",
"=",
"pres",
".",
"reshap... | 71dd53c792dd915dc84879d8237e3582dd68b7a4 |
train | MuninNetIfacePlugin.retrieveVals | Retrieve values for graphs. | pymunin/plugins/netifacestats.py | 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):
"""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')... | [
"Retrieve",
"values",
"for",
"graphs",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/netifacestats.py#L122-L134 | [
"def",
"retrieveVals",
"(",
"self",
")",
":",
"for",
"iface",
"in",
"self",
".",
"_ifaceList",
":",
"stats",
"=",
"self",
".",
"_ifaceStats",
".",
"get",
"(",
"iface",
")",
"graph_name",
"=",
"'netiface_traffic_%s'",
"%",
"iface",
"if",
"self",
".",
"has... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | NTPinfo.getPeerStats | Get NTP Peer Stats for localhost by querying local NTP Server.
@return: Dictionary of NTP stats converted to seconds. | pysysinfo/ntp.py | 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):
"""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():
... | [
"Get",
"NTP",
"Peer",
"Stats",
"for",
"localhost",
"by",
"querying",
"local",
"NTP",
"Server",
".",
"@return",
":",
"Dictionary",
"of",
"NTP",
"stats",
"converted",
"to",
"seconds",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/ntp.py#L29-L49 | [
"def",
"getPeerStats",
"(",
"self",
")",
":",
"info_dict",
"=",
"{",
"}",
"output",
"=",
"util",
".",
"exec_command",
"(",
"[",
"ntpqCmd",
",",
"'-n'",
",",
"'-c'",
",",
"'peers'",
"]",
")",
"for",
"line",
"in",
"output",
".",
"splitlines",
"(",
")",... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | NTPinfo.getHostOffset | 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. | pysysinfo/ntp.py | 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):
"""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... | [
"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",
... | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/ntp.py#L51-L70 | [
"def",
"getHostOffset",
"(",
"self",
",",
"host",
")",
":",
"info_dict",
"=",
"{",
"}",
"output",
"=",
"util",
".",
"exec_command",
"(",
"[",
"ntpdateCmd",
",",
"'-u'",
",",
"'-q'",
",",
"host",
"]",
")",
"for",
"line",
"in",
"output",
".",
"splitlin... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | NTPinfo.getHostOffsets | 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. | pysysinfo/ntp.py | 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):
"""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 = ... | [
"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",
":",... | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/ntp.py#L72-L93 | [
"def",
"getHostOffsets",
"(",
"self",
",",
"hosts",
")",
":",
"info_dict",
"=",
"{",
"}",
"output",
"=",
"util",
".",
"exec_command",
"(",
"[",
"ntpdateCmd",
",",
"'-u'",
",",
"'-q'",
"]",
"+",
"list",
"(",
"hosts",
")",
")",
"for",
"line",
"in",
"... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | SystemInfo.getUptime | Return system uptime in seconds.
@return: Float that represents uptime in seconds. | pysysinfo/system.py | 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):
"""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... | [
"Return",
"system",
"uptime",
"in",
"seconds",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/system.py#L46-L58 | [
"def",
"getUptime",
"(",
"self",
")",
":",
"try",
":",
"fp",
"=",
"open",
"(",
"uptimeFile",
",",
"'r'",
")",
"line",
"=",
"fp",
".",
"readline",
"(",
")",
"fp",
".",
"close",
"(",
")",
"except",
":",
"raise",
"IOError",
"(",
"'Failed reading stats f... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | SystemInfo.getLoadAvg | Return system Load Average.
@return: List of 1 min, 5 min and 15 min Load Average figures. | pysysinfo/system.py | 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):
"""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... | [
"Return",
"system",
"Load",
"Average",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/system.py#L60-L76 | [
"def",
"getLoadAvg",
"(",
"self",
")",
":",
"try",
":",
"fp",
"=",
"open",
"(",
"loadavgFile",
",",
"'r'",
")",
"line",
"=",
"fp",
".",
"readline",
"(",
")",
"fp",
".",
"close",
"(",
")",
"except",
":",
"raise",
"IOError",
"(",
"'Failed reading stats... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | SystemInfo.getCPUuse | Return cpu time utilization in seconds.
@return: Dictionary of stats. | pysysinfo/system.py | 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):
"""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... | [
"Return",
"cpu",
"time",
"utilization",
"in",
"seconds",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/system.py#L78-L96 | [
"def",
"getCPUuse",
"(",
"self",
")",
":",
"hz",
"=",
"os",
".",
"sysconf",
"(",
"'SC_CLK_TCK'",
")",
"info_dict",
"=",
"{",
"}",
"try",
":",
"fp",
"=",
"open",
"(",
"cpustatFile",
",",
"'r'",
")",
"line",
"=",
"fp",
".",
"readline",
"(",
")",
"f... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | SystemInfo.getProcessStats | Return stats for running and blocked processes, forks,
context switches and interrupts.
@return: Dictionary of stats. | pysysinfo/system.py | 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):
"""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()
... | [
"Return",
"stats",
"for",
"running",
"and",
"blocked",
"processes",
"forks",
"context",
"switches",
"and",
"interrupts",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/system.py#L98-L118 | [
"def",
"getProcessStats",
"(",
"self",
")",
":",
"info_dict",
"=",
"{",
"}",
"try",
":",
"fp",
"=",
"open",
"(",
"cpustatFile",
",",
"'r'",
")",
"data",
"=",
"fp",
".",
"read",
"(",
")",
"fp",
".",
"close",
"(",
")",
"except",
":",
"raise",
"IOEr... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | SystemInfo.getMemoryUse | Return stats for memory utilization.
@return: Dictionary of stats. | pysysinfo/system.py | 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):
"""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... | [
"Return",
"stats",
"for",
"memory",
"utilization",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/system.py#L120-L141 | [
"def",
"getMemoryUse",
"(",
"self",
")",
":",
"info_dict",
"=",
"{",
"}",
"try",
":",
"fp",
"=",
"open",
"(",
"meminfoFile",
",",
"'r'",
")",
"data",
"=",
"fp",
".",
"read",
"(",
")",
"fp",
".",
"close",
"(",
")",
"except",
":",
"raise",
"IOError... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | SystemInfo.getSwapStats | Return information on swap partition and / or files.
@return: Dictionary of stats. | pysysinfo/system.py | 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):
"""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... | [
"Return",
"information",
"on",
"swap",
"partition",
"and",
"/",
"or",
"files",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/system.py#L143-L162 | [
"def",
"getSwapStats",
"(",
"self",
")",
":",
"info_dict",
"=",
"{",
"}",
"try",
":",
"fp",
"=",
"open",
"(",
"swapsFile",
",",
"'r'",
")",
"data",
"=",
"fp",
".",
"read",
"(",
")",
"fp",
".",
"close",
"(",
")",
"except",
":",
"raise",
"IOError",... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | SystemInfo.getVMstats | Return stats for Virtual Memory Subsystem.
@return: Dictionary of stats. | pysysinfo/system.py | 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):
"""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... | [
"Return",
"stats",
"for",
"Virtual",
"Memory",
"Subsystem",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/system.py#L164-L181 | [
"def",
"getVMstats",
"(",
"self",
")",
":",
"info_dict",
"=",
"{",
"}",
"try",
":",
"fp",
"=",
"open",
"(",
"vmstatFile",
",",
"'r'",
")",
"data",
"=",
"fp",
".",
"read",
"(",
")",
"fp",
".",
"close",
"(",
")",
"except",
":",
"raise",
"IOError",
... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MemcachedInfo._connect | Connect to Memcached. | pysysinfo/memcached.py | 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):
"""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.... | [
"Connect",
"to",
"Memcached",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/memcached.py#L66-L79 | [
"def",
"_connect",
"(",
"self",
")",
":",
"if",
"self",
".",
"_socketFile",
"is",
"not",
"None",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"_socketFile",
")",
":",
"raise",
"Exception",
"(",
"\"Socket file (%s) for Memcached Ins... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MemcachedInfo._sendStatCmd | Send stat command to Memcached Server and return response lines.
@param cmd: Command string.
@return: Array of strings. | pysysinfo/memcached.py | 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):
"""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... | [
"Send",
"stat",
"command",
"to",
"Memcached",
"Server",
"and",
"return",
"response",
"lines",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/memcached.py#L81-L101 | [
"def",
"_sendStatCmd",
"(",
"self",
",",
"cmd",
")",
":",
"try",
":",
"self",
".",
"_conn",
".",
"write",
"(",
"\"%s\\r\\n\"",
"%",
"cmd",
")",
"regex",
"=",
"re",
".",
"compile",
"(",
"'^(END|ERROR)\\r\\n'",
",",
"re",
".",
"MULTILINE",
")",
"(",
"i... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MemcachedInfo._parseStats | 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. | pysysinfo/memcached.py | 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):
"""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",
"-"
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/memcached.py#L102-L124 | [
"def",
"_parseStats",
"(",
"self",
",",
"lines",
",",
"parse_slabs",
"=",
"False",
")",
":",
"info_dict",
"=",
"{",
"}",
"info_dict",
"[",
"'slabs'",
"]",
"=",
"{",
"}",
"for",
"line",
"in",
"lines",
":",
"mobj",
"=",
"re",
".",
"match",
"(",
"'^ST... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninMemcachedPlugin.retrieveVals | Retrieve values for graphs. | pymunin/plugins/memcachedstats.py | 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):
"""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... | [
"Retrieve",
"values",
"for",
"graphs",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/memcachedstats.py#L305-L440 | [
"def",
"retrieveVals",
"(",
"self",
")",
":",
"if",
"self",
".",
"_stats",
"is",
"None",
":",
"serverInfo",
"=",
"MemcachedInfo",
"(",
"self",
".",
"_host",
",",
"self",
".",
"_port",
",",
"self",
".",
"_socket_file",
")",
"stats",
"=",
"serverInfo",
"... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninMemcachedPlugin.autoconf | Implements Munin Plugin Auto-Configuration Option.
@return: True if plugin can be auto-configured, False otherwise. | pymunin/plugins/memcachedstats.py | 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):
"""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) | [
"Implements",
"Munin",
"Plugin",
"Auto",
"-",
"Configuration",
"Option",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/memcachedstats.py#L442-L449 | [
"def",
"autoconf",
"(",
"self",
")",
":",
"serverInfo",
"=",
"MemcachedInfo",
"(",
"self",
".",
"_host",
",",
"self",
".",
"_port",
",",
"self",
".",
"_socket_file",
")",
"return",
"(",
"serverInfo",
"is",
"not",
"None",
")"
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | correlation | Returns correlation distance between a and b | quail/distance.py | 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):
"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') | [
"Returns",
"correlation",
"distance",
"between",
"a",
"and",
"b"
] | ContextLab/quail | python | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/distance.py#L9-L17 | [
"def",
"correlation",
"(",
"a",
",",
"b",
")",
":",
"if",
"isinstance",
"(",
"a",
",",
"list",
")",
":",
"a",
"=",
"np",
".",
"array",
"(",
"a",
")",
"if",
"isinstance",
"(",
"b",
",",
"list",
")",
":",
"b",
"=",
"np",
".",
"array",
"(",
"b... | 71dd53c792dd915dc84879d8237e3582dd68b7a4 |
train | euclidean | Returns euclidean distance between a and b | quail/distance.py | def euclidean(a, b):
"Returns euclidean distance between a and b"
return np.linalg.norm(np.subtract(a, b)) | def euclidean(a, b):
"Returns euclidean distance between a and b"
return np.linalg.norm(np.subtract(a, b)) | [
"Returns",
"euclidean",
"distance",
"between",
"a",
"and",
"b"
] | ContextLab/quail | python | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/distance.py#L19-L21 | [
"def",
"euclidean",
"(",
"a",
",",
"b",
")",
":",
"return",
"np",
".",
"linalg",
".",
"norm",
"(",
"np",
".",
"subtract",
"(",
"a",
",",
"b",
")",
")"
] | 71dd53c792dd915dc84879d8237e3582dd68b7a4 |
train | ProcessInfo.execProcCmd | 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 | pysysinfo/process.py | 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):
"""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))
... | [
"Execute",
"ps",
"command",
"with",
"positional",
"params",
"args",
"and",
"return",
"result",
"as",
"list",
"of",
"lines",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/process.py#L47-L56 | [
"def",
"execProcCmd",
"(",
"self",
",",
"*",
"args",
")",
":",
"out",
"=",
"util",
".",
"exec_command",
"(",
"[",
"psCmd",
",",
"]",
"+",
"list",
"(",
"args",
")",
")",
"return",
"out",
".",
"splitlines",
"(",
")"
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | ProcessInfo.parseProcCmd | 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.
... | pysysinfo/process.py | 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):
"""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.
... | [
"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",
... | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/process.py#L58-L98 | [
"def",
"parseProcCmd",
"(",
"self",
",",
"fields",
"=",
"(",
"'pid'",
",",
"'user'",
",",
"'cmd'",
",",
")",
",",
"threads",
"=",
"False",
")",
":",
"args",
"=",
"[",
"]",
"headers",
"=",
"[",
"f",
".",
"lower",
"(",
")",
"for",
"f",
"in",
"fie... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | ProcessInfo.getProcList | 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... | pysysinfo/process.py | 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):
"""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... | [
"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... | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/process.py#L100-L144 | [
"def",
"getProcList",
"(",
"self",
",",
"fields",
"=",
"(",
"'pid'",
",",
"'user'",
",",
"'cmd'",
",",
")",
",",
"threads",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"field_list",
"=",
"list",
"(",
"fields",
")",
"for",
"key",
"in",
"kwargs"... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | ProcessInfo.getProcDict | 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:... | pysysinfo/process.py | 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):
"""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 ... | [
"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... | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/process.py#L146-L198 | [
"def",
"getProcDict",
"(",
"self",
",",
"fields",
"=",
"(",
"'user'",
",",
"'cmd'",
",",
")",
",",
"threads",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"stats",
"=",
"{",
"}",
"field_list",
"=",
"list",
"(",
"fields",
")",
"num_cols",
"=",
... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | ProcessInfo.getProcStatStatus | 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:... | pysysinfo/process.py | 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):
"""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... | [
"Return",
"process",
"counts",
"per",
"status",
"and",
"priority",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/process.py#L200-L242 | [
"def",
"getProcStatStatus",
"(",
"self",
",",
"threads",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"procs",
"=",
"self",
".",
"getProcList",
"(",
"[",
"'stat'",
",",
"]",
",",
"threads",
"=",
"threads",
",",
"*",
"*",
"kwargs",
")",
"status",
... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninNTPstatsPlugin.retrieveVals | Retrieve values for graphs. | pymunin/plugins/ntpstats.py | 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):
"""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'))... | [
"Retrieve",
"values",
"for",
"graphs",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/ntpstats.py#L84-L98 | [
"def",
"retrieveVals",
"(",
"self",
")",
":",
"ntpinfo",
"=",
"NTPinfo",
"(",
")",
"stats",
"=",
"ntpinfo",
".",
"getPeerStats",
"(",
")",
"if",
"stats",
":",
"if",
"self",
".",
"hasGraph",
"(",
"'ntp_peer_stratum'",
")",
":",
"self",
".",
"setGraphVal",... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | muninMain | 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... | pymunin/__init__.py | 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):
"""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... | [
"Main",
"Block",
"for",
"Munin",
"Plugins",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L938-L973 | [
"def",
"muninMain",
"(",
"pluginClass",
",",
"argv",
"=",
"None",
",",
"env",
"=",
"None",
",",
"debug",
"=",
"False",
")",
":",
"if",
"argv",
"is",
"None",
":",
"argv",
"=",
"sys",
".",
"argv",
"if",
"env",
"is",
"None",
":",
"env",
"=",
"os",
... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | fixLabel | 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
... | pymunin/__init__.py | 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):
"""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: ... | [
"Truncate",
"long",
"graph",
"and",
"field",
"labels",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L975-L1004 | [
"def",
"fixLabel",
"(",
"label",
",",
"maxlen",
",",
"delim",
"=",
"None",
",",
"repl",
"=",
"''",
",",
"truncend",
"=",
"True",
")",
":",
"if",
"len",
"(",
"label",
")",
"<=",
"maxlen",
":",
"return",
"label",
"else",
":",
"maxlen",
"-=",
"len",
... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninPlugin._parseEnv | 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... | pymunin/__init__.py | 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):
"""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... | [
"Private",
"method",
"for",
"parsing",
"through",
"environment",
"variables",
".",
"Parses",
"for",
"environment",
"variables",
"common",
"to",
"all",
"Munin",
"Plugins",
":",
"-",
"MUNIN_STATEFILE",
"-",
"MUNIN_CAP_DIRTY_CONFIG",
"-",
"nested_graphs"
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L149-L169 | [
"def",
"_parseEnv",
"(",
"self",
",",
"env",
"=",
"None",
")",
":",
"if",
"not",
"env",
":",
"env",
"=",
"self",
".",
"_env",
"if",
"env",
".",
"has_key",
"(",
"'MUNIN_STATEFILE'",
")",
":",
"self",
".",
"_stateFile",
"=",
"env",
".",
"get",
"(",
... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninPlugin._getGraph | 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 | pymunin/__init__.py | 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):
"""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: ... | [
"Private",
"method",
"for",
"returning",
"graph",
"object",
"with",
"name",
"graph_name",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L171-L184 | [
"def",
"_getGraph",
"(",
"self",
",",
"graph_name",
",",
"fail_noexist",
"=",
"False",
")",
":",
"graph",
"=",
"self",
".",
"_graphDict",
".",
"get",
"(",
"graph_name",
")",
"if",
"fail_noexist",
"and",
"graph",
"is",
"None",
":",
"raise",
"AttributeError"... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninPlugin._getSubGraph | 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
... | pymunin/__init__.py | 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):
"""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... | [
"Private",
"method",
"for",
"returning",
"subgraph",
"object",
"with",
"name",
"graph_name",
"and",
"parent",
"graph",
"with",
"name",
"parent_name",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L186-L214 | [
"def",
"_getSubGraph",
"(",
"self",
",",
"parent_name",
",",
"graph_name",
",",
"fail_noexist",
"=",
"False",
")",
":",
"if",
"not",
"self",
".",
"isMultigraph",
":",
"raise",
"AttributeError",
"(",
"\"Simple Munin Plugins cannot have subgraphs.\"",
")",
"if",
"se... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninPlugin._getMultigraphID | 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. | pymunin/__init__.py | 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):
"""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",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L216-L235 | [
"def",
"_getMultigraphID",
"(",
"self",
",",
"graph_name",
",",
"subgraph_name",
"=",
"None",
")",
":",
"if",
"self",
".",
"isMultiInstance",
"and",
"self",
".",
"_instanceName",
"is",
"not",
"None",
":",
"if",
"subgraph_name",
"is",
"None",
":",
"return",
... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninPlugin._formatConfig | 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. | pymunin/__init__.py | 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):
"""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 = []
... | [
"Formats",
"configuration",
"directory",
"from",
"Munin",
"Graph",
"and",
"returns",
"multi",
"-",
"line",
"value",
"entries",
"for",
"the",
"plugin",
"config",
"cycle",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L237-L287 | [
"def",
"_formatConfig",
"(",
"self",
",",
"conf_dict",
")",
":",
"confs",
"=",
"[",
"]",
"graph_dict",
"=",
"conf_dict",
"[",
"'graph'",
"]",
"field_list",
"=",
"conf_dict",
"[",
"'fields'",
"]",
"# Order and format Graph Attributes",
"title",
"=",
"graph_dict",... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninPlugin._formatVals | 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. | pymunin/__init__.py | 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):
"""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... | [
"Formats",
"value",
"list",
"from",
"Munin",
"Graph",
"and",
"returns",
"multi",
"-",
"line",
"value",
"entries",
"for",
"the",
"plugin",
"fetch",
"cycle",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L289-L306 | [
"def",
"_formatVals",
"(",
"self",
",",
"val_list",
")",
":",
"vals",
"=",
"[",
"]",
"for",
"(",
"name",
",",
"val",
")",
"in",
"val_list",
":",
"if",
"val",
"is",
"not",
"None",
":",
"if",
"isinstance",
"(",
"val",
",",
"float",
")",
":",
"vals"... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninPlugin.envGet | 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. | pymunin/__init__.py | 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):
"""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... | [
"Return",
"value",
"for",
"environment",
"variable",
"or",
"None",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L317-L332 | [
"def",
"envGet",
"(",
"self",
",",
"name",
",",
"default",
"=",
"None",
",",
"conv",
"=",
"None",
")",
":",
"if",
"self",
".",
"_env",
".",
"has_key",
"(",
"name",
")",
":",
"if",
"conv",
"is",
"not",
"None",
":",
"return",
"conv",
"(",
"self",
... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninPlugin.envGetList | 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... | pymunin/__init__.py | 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):
"""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.
... | [
"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",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L335-L364 | [
"def",
"envGetList",
"(",
"self",
",",
"name",
",",
"attr_regex",
"=",
"'^\\w+$'",
",",
"conv",
"=",
"None",
")",
":",
"key",
"=",
"\"list_%s\"",
"%",
"name",
"item_list",
"=",
"[",
"]",
"if",
"self",
".",
"_env",
".",
"has_key",
"(",
"key",
")",
"... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninPlugin.envRegisterFilter | 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 ... | pymunin/__init__.py | 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):
"""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.
... | [
"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",
... | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L366-L387 | [
"def",
"envRegisterFilter",
"(",
"self",
",",
"name",
",",
"attr_regex",
"=",
"'^\\w+$'",
",",
"default",
"=",
"True",
")",
":",
"attrs",
"=",
"{",
"}",
"for",
"prefix",
"in",
"(",
"'include'",
",",
"'exclude'",
")",
":",
"key",
"=",
"\"%s_%s\"",
"%",
... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninPlugin.envCheckFilter | 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... | pymunin/__init__.py | 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):
"""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.
... | [
"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",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L389-L403 | [
"def",
"envCheckFilter",
"(",
"self",
",",
"name",
",",
"attr",
")",
":",
"flt",
"=",
"self",
".",
"_filters",
".",
"get",
"(",
"name",
")",
"if",
"flt",
":",
"return",
"flt",
".",
"check",
"(",
"attr",
")",
"else",
":",
"raise",
"AttributeError",
... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninPlugin.envCheckFlag | 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: ... | pymunin/__init__.py | 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):
"""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 (... | [
"Check",
"graph",
"flag",
"for",
"enabling",
"/",
"disabling",
"attributes",
"through",
"the",
"use",
"of",
"<name",
">",
"environment",
"variable",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L405-L429 | [
"def",
"envCheckFlag",
"(",
"self",
",",
"name",
",",
"default",
"=",
"False",
")",
":",
"if",
"self",
".",
"_flags",
".",
"has_key",
"(",
"name",
")",
":",
"return",
"self",
".",
"_flags",
"[",
"name",
"]",
"else",
":",
"val",
"=",
"self",
".",
... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninPlugin.saveState | Utility methos to save plugin state stored in stateObj to persistent
storage to permit access to previous state in subsequent plugin runs.
Any object that can be pickled and unpickled can be used to store the
plugin state.
@param stateObj: Object that stores plugin st... | pymunin/__init__.py | def saveState(self, stateObj):
"""Utility methos to save plugin state stored in stateObj to persistent
storage to permit access to previous state in subsequent plugin runs.
Any object that can be pickled and unpickled can be used to store the
plugin state.
@p... | def saveState(self, stateObj):
"""Utility methos to save plugin state stored in stateObj to persistent
storage to permit access to previous state in subsequent plugin runs.
Any object that can be pickled and unpickled can be used to store the
plugin state.
@p... | [
"Utility",
"methos",
"to",
"save",
"plugin",
"state",
"stored",
"in",
"stateObj",
"to",
"persistent",
"storage",
"to",
"permit",
"access",
"to",
"previous",
"state",
"in",
"subsequent",
"plugin",
"runs",
".",
"Any",
"object",
"that",
"can",
"be",
"pickled",
... | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L448-L464 | [
"def",
"saveState",
"(",
"self",
",",
"stateObj",
")",
":",
"try",
":",
"fp",
"=",
"open",
"(",
"self",
".",
"_stateFile",
",",
"'w'",
")",
"pickle",
".",
"dump",
"(",
"stateObj",
",",
"fp",
")",
"except",
":",
"raise",
"IOError",
"(",
"\"Failure in ... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninPlugin.restoreState | Utility method to restore plugin state from persistent storage to
permit access to previous plugin state.
@return: Object that stores plugin state. | pymunin/__init__.py | def restoreState(self):
"""Utility method to restore plugin state from persistent storage to
permit access to previous plugin state.
@return: Object that stores plugin state.
"""
if os.path.exists(self._stateFile):
try:
fp = open(sel... | def restoreState(self):
"""Utility method to restore plugin state from persistent storage to
permit access to previous plugin state.
@return: Object that stores plugin state.
"""
if os.path.exists(self._stateFile):
try:
fp = open(sel... | [
"Utility",
"method",
"to",
"restore",
"plugin",
"state",
"from",
"persistent",
"storage",
"to",
"permit",
"access",
"to",
"previous",
"plugin",
"state",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L466-L481 | [
"def",
"restoreState",
"(",
"self",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"_stateFile",
")",
":",
"try",
":",
"fp",
"=",
"open",
"(",
"self",
".",
"_stateFile",
",",
"'r'",
")",
"stateObj",
"=",
"pickle",
".",
"load",
... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninPlugin.appendGraph | Utility method to associate Graph Object to Plugin.
This utility method is for use in constructor of child classes for
associating a MuninGraph instances to the plugin.
@param graph_name: Graph Name
@param graph: MuninGraph Instance | pymunin/__init__.py | def appendGraph(self, graph_name, graph):
"""Utility method to associate Graph Object to Plugin.
This utility method is for use in constructor of child classes for
associating a MuninGraph instances to the plugin.
@param graph_name: Graph Name
@param graph: ... | def appendGraph(self, graph_name, graph):
"""Utility method to associate Graph Object to Plugin.
This utility method is for use in constructor of child classes for
associating a MuninGraph instances to the plugin.
@param graph_name: Graph Name
@param graph: ... | [
"Utility",
"method",
"to",
"associate",
"Graph",
"Object",
"to",
"Plugin",
".",
"This",
"utility",
"method",
"is",
"for",
"use",
"in",
"constructor",
"of",
"child",
"classes",
"for",
"associating",
"a",
"MuninGraph",
"instances",
"to",
"the",
"plugin",
".",
... | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L483-L496 | [
"def",
"appendGraph",
"(",
"self",
",",
"graph_name",
",",
"graph",
")",
":",
"self",
".",
"_graphDict",
"[",
"graph_name",
"]",
"=",
"graph",
"self",
".",
"_graphNames",
".",
"append",
"(",
"graph_name",
")",
"if",
"not",
"self",
".",
"isMultigraph",
"a... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninPlugin.appendSubgraph | Utility method to associate Subgraph Instance to Root Graph Instance.
This utility method is for use in constructor of child classes for
associating a MuninGraph Subgraph instance with a Root Graph instance.
@param parent_name: Root Graph Name
@param graph_name: Subgraph Name... | pymunin/__init__.py | def appendSubgraph(self, parent_name, graph_name, graph):
"""Utility method to associate Subgraph Instance to Root Graph Instance.
This utility method is for use in constructor of child classes for
associating a MuninGraph Subgraph instance with a Root Graph instance.
@param ... | def appendSubgraph(self, parent_name, graph_name, graph):
"""Utility method to associate Subgraph Instance to Root Graph Instance.
This utility method is for use in constructor of child classes for
associating a MuninGraph Subgraph instance with a Root Graph instance.
@param ... | [
"Utility",
"method",
"to",
"associate",
"Subgraph",
"Instance",
"to",
"Root",
"Graph",
"Instance",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L498-L519 | [
"def",
"appendSubgraph",
"(",
"self",
",",
"parent_name",
",",
"graph_name",
",",
"graph",
")",
":",
"if",
"not",
"self",
".",
"isMultigraph",
":",
"raise",
"AttributeError",
"(",
"\"Simple Munin Plugins cannot have subgraphs.\"",
")",
"if",
"self",
".",
"_graphDi... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninPlugin.setGraphVal | Utility method to set Value for Field in Graph.
The private method is for use in retrieveVals() method of child classes.
@param graph_name: Graph Name
@param field_name: Field Name.
@param val: Value for field. | pymunin/__init__.py | def setGraphVal(self, graph_name, field_name, val):
"""Utility method to set Value for Field in Graph.
The private method is for use in retrieveVals() method of child classes.
@param graph_name: Graph Name
@param field_name: Field Name.
@param val: Value ... | def setGraphVal(self, graph_name, field_name, val):
"""Utility method to set Value for Field in Graph.
The private method is for use in retrieveVals() method of child classes.
@param graph_name: Graph Name
@param field_name: Field Name.
@param val: Value ... | [
"Utility",
"method",
"to",
"set",
"Value",
"for",
"Field",
"in",
"Graph",
".",
"The",
"private",
"method",
"is",
"for",
"use",
"in",
"retrieveVals",
"()",
"method",
"of",
"child",
"classes",
".",
"@param",
"graph_name",
":",
"Graph",
"Name",
"@param",
"fie... | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L521-L536 | [
"def",
"setGraphVal",
"(",
"self",
",",
"graph_name",
",",
"field_name",
",",
"val",
")",
":",
"graph",
"=",
"self",
".",
"_getGraph",
"(",
"graph_name",
",",
"True",
")",
"if",
"graph",
".",
"hasField",
"(",
"field_name",
")",
":",
"graph",
".",
"setV... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninPlugin.setSubgraphVal | Set Value for Field in Subgraph.
The private method is for use in retrieveVals() method of child
classes.
@param parent_name: Root Graph Name
@param graph_name: Subgraph Name
@param field_name: Field Name.
@param val: Value for field. | pymunin/__init__.py | def setSubgraphVal(self, parent_name, graph_name, field_name, val):
"""Set Value for Field in Subgraph.
The private method is for use in retrieveVals() method of child
classes.
@param parent_name: Root Graph Name
@param graph_name: Subgraph Name
@param field_... | def setSubgraphVal(self, parent_name, graph_name, field_name, val):
"""Set Value for Field in Subgraph.
The private method is for use in retrieveVals() method of child
classes.
@param parent_name: Root Graph Name
@param graph_name: Subgraph Name
@param field_... | [
"Set",
"Value",
"for",
"Field",
"in",
"Subgraph",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L538-L556 | [
"def",
"setSubgraphVal",
"(",
"self",
",",
"parent_name",
",",
"graph_name",
",",
"field_name",
",",
"val",
")",
":",
"subgraph",
"=",
"self",
".",
"_getSubGraph",
"(",
"parent_name",
",",
"graph_name",
",",
"True",
")",
"if",
"subgraph",
".",
"hasField",
... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninPlugin.getSubgraphList | Returns list of names of subgraphs for Root Graph with name parent_name.
@param parent_name: Name of Root Graph.
@return: List of subgraph names. | pymunin/__init__.py | def getSubgraphList(self, parent_name):
"""Returns list of names of subgraphs for Root Graph with name parent_name.
@param parent_name: Name of Root Graph.
@return: List of subgraph names.
"""
if not self.isMultigraph:
raise AttributeError... | def getSubgraphList(self, parent_name):
"""Returns list of names of subgraphs for Root Graph with name parent_name.
@param parent_name: Name of Root Graph.
@return: List of subgraph names.
"""
if not self.isMultigraph:
raise AttributeError... | [
"Returns",
"list",
"of",
"names",
"of",
"subgraphs",
"for",
"Root",
"Graph",
"with",
"name",
"parent_name",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L594-L607 | [
"def",
"getSubgraphList",
"(",
"self",
",",
"parent_name",
")",
":",
"if",
"not",
"self",
".",
"isMultigraph",
":",
"raise",
"AttributeError",
"(",
"\"Simple Munin Plugins cannot have subgraphs.\"",
")",
"if",
"self",
".",
"_graphDict",
".",
"has_key",
"(",
"paren... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninPlugin.graphHasField | Return true if graph with name graph_name has field with
name field_name.
@param graph_name: Graph Name
@param field_name: Field Name.
@return: Boolean | pymunin/__init__.py | def graphHasField(self, graph_name, field_name):
"""Return true if graph with name graph_name has field with
name field_name.
@param graph_name: Graph Name
@param field_name: Field Name.
@return: Boolean
"""
graph = self._graphDict.get(graph_nam... | def graphHasField(self, graph_name, field_name):
"""Return true if graph with name graph_name has field with
name field_name.
@param graph_name: Graph Name
@param field_name: Field Name.
@return: Boolean
"""
graph = self._graphDict.get(graph_nam... | [
"Return",
"true",
"if",
"graph",
"with",
"name",
"graph_name",
"has",
"field",
"with",
"name",
"field_name",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L618-L628 | [
"def",
"graphHasField",
"(",
"self",
",",
"graph_name",
",",
"field_name",
")",
":",
"graph",
"=",
"self",
".",
"_graphDict",
".",
"get",
"(",
"graph_name",
",",
"True",
")",
"return",
"graph",
".",
"hasField",
"(",
"field_name",
")"
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninPlugin.subGraphHasField | Return true if subgraph with name graph_name with parent graph with
name parent_name has field with name field_name.
@param parent_name: Root Graph Name
@param graph_name: Subgraph Name
@param field_name: Field Name.
@return: Boolean | pymunin/__init__.py | def subGraphHasField(self, parent_name, graph_name, field_name):
"""Return true if subgraph with name graph_name with parent graph with
name parent_name has field with name field_name.
@param parent_name: Root Graph Name
@param graph_name: Subgraph Name
@param field_nam... | def subGraphHasField(self, parent_name, graph_name, field_name):
"""Return true if subgraph with name graph_name with parent graph with
name parent_name has field with name field_name.
@param parent_name: Root Graph Name
@param graph_name: Subgraph Name
@param field_nam... | [
"Return",
"true",
"if",
"subgraph",
"with",
"name",
"graph_name",
"with",
"parent",
"graph",
"with",
"name",
"parent_name",
"has",
"field",
"with",
"name",
"field_name",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L630-L641 | [
"def",
"subGraphHasField",
"(",
"self",
",",
"parent_name",
",",
"graph_name",
",",
"field_name",
")",
":",
"subgraph",
"=",
"self",
".",
"_getSubGraph",
"(",
"parent_name",
",",
"graph_name",
",",
"True",
")",
"return",
"subgraph",
".",
"hasField",
"(",
"fi... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninPlugin.getGraphFieldList | Returns list of names of fields for graph with name graph_name.
@param graph_name: Graph Name
@return: List of field names for graph. | pymunin/__init__.py | def getGraphFieldList(self, graph_name):
"""Returns list of names of fields for graph with name graph_name.
@param graph_name: Graph Name
@return: List of field names for graph.
"""
graph = self._getGraph(graph_name, True)
return graph.getField... | def getGraphFieldList(self, graph_name):
"""Returns list of names of fields for graph with name graph_name.
@param graph_name: Graph Name
@return: List of field names for graph.
"""
graph = self._getGraph(graph_name, True)
return graph.getField... | [
"Returns",
"list",
"of",
"names",
"of",
"fields",
"for",
"graph",
"with",
"name",
"graph_name",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L643-L651 | [
"def",
"getGraphFieldList",
"(",
"self",
",",
"graph_name",
")",
":",
"graph",
"=",
"self",
".",
"_getGraph",
"(",
"graph_name",
",",
"True",
")",
"return",
"graph",
".",
"getFieldList",
"(",
")"
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninPlugin.getGraphFieldCount | Returns number of fields for graph with name graph_name.
@param graph_name: Graph Name
@return: Number of fields for graph. | pymunin/__init__.py | def getGraphFieldCount(self, graph_name):
"""Returns number of fields for graph with name graph_name.
@param graph_name: Graph Name
@return: Number of fields for graph.
"""
graph = self._getGraph(graph_name, True)
return graph.getFieldCount() | def getGraphFieldCount(self, graph_name):
"""Returns number of fields for graph with name graph_name.
@param graph_name: Graph Name
@return: Number of fields for graph.
"""
graph = self._getGraph(graph_name, True)
return graph.getFieldCount() | [
"Returns",
"number",
"of",
"fields",
"for",
"graph",
"with",
"name",
"graph_name",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L653-L661 | [
"def",
"getGraphFieldCount",
"(",
"self",
",",
"graph_name",
")",
":",
"graph",
"=",
"self",
".",
"_getGraph",
"(",
"graph_name",
",",
"True",
")",
"return",
"graph",
".",
"getFieldCount",
"(",
")"
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninPlugin.getSubgraphFieldList | Returns list of names of fields for subgraph with name graph_name
and parent graph with name parent_name.
@param parent_name: Root Graph Name
@param graph_name: Subgraph Name
@return: List of field names for subgraph. | pymunin/__init__.py | def getSubgraphFieldList(self, parent_name, graph_name):
"""Returns list of names of fields for subgraph with name graph_name
and parent graph with name parent_name.
@param parent_name: Root Graph Name
@param graph_name: Subgraph Name
@return: List of field n... | def getSubgraphFieldList(self, parent_name, graph_name):
"""Returns list of names of fields for subgraph with name graph_name
and parent graph with name parent_name.
@param parent_name: Root Graph Name
@param graph_name: Subgraph Name
@return: List of field n... | [
"Returns",
"list",
"of",
"names",
"of",
"fields",
"for",
"subgraph",
"with",
"name",
"graph_name",
"and",
"parent",
"graph",
"with",
"name",
"parent_name",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L663-L673 | [
"def",
"getSubgraphFieldList",
"(",
"self",
",",
"parent_name",
",",
"graph_name",
")",
":",
"graph",
"=",
"self",
".",
"_getSubGraph",
"(",
"parent_name",
",",
"graph_name",
",",
"True",
")",
"return",
"graph",
".",
"getFieldList",
"(",
")"
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninPlugin.getSubgraphFieldCount | Returns number of fields for subgraph with name graph_name and parent
graph with name parent_name.
@param parent_name: Root Graph Name
@param graph_name: Subgraph Name
@return: Number of fields for subgraph. | pymunin/__init__.py | def getSubgraphFieldCount(self, parent_name, graph_name):
"""Returns number of fields for subgraph with name graph_name and parent
graph with name parent_name.
@param parent_name: Root Graph Name
@param graph_name: Subgraph Name
@return: Number of fields for... | def getSubgraphFieldCount(self, parent_name, graph_name):
"""Returns number of fields for subgraph with name graph_name and parent
graph with name parent_name.
@param parent_name: Root Graph Name
@param graph_name: Subgraph Name
@return: Number of fields for... | [
"Returns",
"number",
"of",
"fields",
"for",
"subgraph",
"with",
"name",
"graph_name",
"and",
"parent",
"graph",
"with",
"name",
"parent_name",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L675-L685 | [
"def",
"getSubgraphFieldCount",
"(",
"self",
",",
"parent_name",
",",
"graph_name",
")",
":",
"graph",
"=",
"self",
".",
"_getSubGraph",
"(",
"parent_name",
",",
"graph_name",
",",
"True",
")",
"return",
"graph",
".",
"getFieldCount",
"(",
")"
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninPlugin.config | Implements Munin Plugin Graph Configuration.
Prints out configuration for graphs.
Use as is. Not required to be overwritten in child classes. The plugin
will work correctly as long as the Munin Graph objects have been
populated. | pymunin/__init__.py | def config(self):
"""Implements Munin Plugin Graph Configuration.
Prints out configuration for graphs.
Use as is. Not required to be overwritten in child classes. The plugin
will work correctly as long as the Munin Graph objects have been
populated.
"""
... | def config(self):
"""Implements Munin Plugin Graph Configuration.
Prints out configuration for graphs.
Use as is. Not required to be overwritten in child classes. The plugin
will work correctly as long as the Munin Graph objects have been
populated.
"""
... | [
"Implements",
"Munin",
"Plugin",
"Graph",
"Configuration",
".",
"Prints",
"out",
"configuration",
"for",
"graphs",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L708-L733 | [
"def",
"config",
"(",
"self",
")",
":",
"for",
"parent_name",
"in",
"self",
".",
"_graphNames",
":",
"graph",
"=",
"self",
".",
"_graphDict",
"[",
"parent_name",
"]",
"if",
"self",
".",
"isMultigraph",
":",
"print",
"\"multigraph %s\"",
"%",
"self",
".",
... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninPlugin.fetch | Implements Munin Plugin Fetch Option.
Prints out measured values. | pymunin/__init__.py | def fetch(self):
"""Implements Munin Plugin Fetch Option.
Prints out measured values.
"""
self.retrieveVals()
for parent_name in self._graphNames:
graph = self._graphDict[parent_name]
if self.isMultigraph:
print "multigraph %s" % self._ge... | def fetch(self):
"""Implements Munin Plugin Fetch Option.
Prints out measured values.
"""
self.retrieveVals()
for parent_name in self._graphNames:
graph = self._graphDict[parent_name]
if self.isMultigraph:
print "multigraph %s" % self._ge... | [
"Implements",
"Munin",
"Plugin",
"Fetch",
"Option",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L744-L766 | [
"def",
"fetch",
"(",
"self",
")",
":",
"self",
".",
"retrieveVals",
"(",
")",
"for",
"parent_name",
"in",
"self",
".",
"_graphNames",
":",
"graph",
"=",
"self",
".",
"_graphDict",
"[",
"parent_name",
"]",
"if",
"self",
".",
"isMultigraph",
":",
"print",
... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninPlugin.run | Implements main entry point for plugin execution. | pymunin/__init__.py | def run(self):
"""Implements main entry point for plugin execution."""
if len(self._argv) > 1 and len(self._argv[1]) > 0:
oper = self._argv[1]
else:
oper = 'fetch'
if oper == 'fetch':
ret = self.fetch()
elif oper == 'config':
ret = ... | def run(self):
"""Implements main entry point for plugin execution."""
if len(self._argv) > 1 and len(self._argv[1]) > 0:
oper = self._argv[1]
else:
oper = 'fetch'
if oper == 'fetch':
ret = self.fetch()
elif oper == 'config':
ret = ... | [
"Implements",
"main",
"entry",
"point",
"for",
"plugin",
"execution",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L768-L791 | [
"def",
"run",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"_argv",
")",
">",
"1",
"and",
"len",
"(",
"self",
".",
"_argv",
"[",
"1",
"]",
")",
">",
"0",
":",
"oper",
"=",
"self",
".",
"_argv",
"[",
"1",
"]",
"else",
":",
"oper",
... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninGraph.addField | Add field to Munin Graph
@param name: Field Name
@param label: Field Label
@param type: Stat Type:
'COUNTER' / 'ABSOLUTE' / 'DERIVE' / 'GAUGE'
@param draw: Graph Type:
'AREA' / 'LINE{1,2,3}'... | pymunin/__init__.py | def addField(self, name, label, type=None, draw=None, info=None, #@ReservedAssignment
extinfo=None, colour=None, negative=None, graph=None,
min=None, max=None, cdef=None, line=None, #@ReservedAssignment
warning=None, critical=None):
"""Add field to Munin Grap... | def addField(self, name, label, type=None, draw=None, info=None, #@ReservedAssignment
extinfo=None, colour=None, negative=None, graph=None,
min=None, max=None, cdef=None, line=None, #@ReservedAssignment
warning=None, critical=None):
"""Add field to Munin Grap... | [
"Add",
"field",
"to",
"Munin",
"Graph"
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L836-L869 | [
"def",
"addField",
"(",
"self",
",",
"name",
",",
"label",
",",
"type",
"=",
"None",
",",
"draw",
"=",
"None",
",",
"info",
"=",
"None",
",",
"#@ReservedAssignment",
"extinfo",
"=",
"None",
",",
"colour",
"=",
"None",
",",
"negative",
"=",
"None",
",... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninGraph.hasField | Returns true if field with field_name exists.
@param name: Field Name
@return: Boolean | pymunin/__init__.py | def hasField(self, name):
"""Returns true if field with field_name exists.
@param name: Field Name
@return: Boolean
"""
if self._autoFixNames:
name = self._fixName(name)
return self._fieldAttrDict.has_key(name) | def hasField(self, name):
"""Returns true if field with field_name exists.
@param name: Field Name
@return: Boolean
"""
if self._autoFixNames:
name = self._fixName(name)
return self._fieldAttrDict.has_key(name) | [
"Returns",
"true",
"if",
"field",
"with",
"field_name",
"exists",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L871-L880 | [
"def",
"hasField",
"(",
"self",
",",
"name",
")",
":",
"if",
"self",
".",
"_autoFixNames",
":",
"name",
"=",
"self",
".",
"_fixName",
"(",
"name",
")",
"return",
"self",
".",
"_fieldAttrDict",
".",
"has_key",
"(",
"name",
")"
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninGraph.getConfig | Returns dictionary of config entries for Munin Graph.
@return: Dictionary of config entries. | pymunin/__init__.py | def getConfig(self):
"""Returns dictionary of config entries for Munin Graph.
@return: Dictionary of config entries.
"""
return {'graph': self._graphAttrDict,
'fields': [(field_name, self._fieldAttrDict.get(field_name))
for fi... | def getConfig(self):
"""Returns dictionary of config entries for Munin Graph.
@return: Dictionary of config entries.
"""
return {'graph': self._graphAttrDict,
'fields': [(field_name, self._fieldAttrDict.get(field_name))
for fi... | [
"Returns",
"dictionary",
"of",
"config",
"entries",
"for",
"Munin",
"Graph",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L898-L906 | [
"def",
"getConfig",
"(",
"self",
")",
":",
"return",
"{",
"'graph'",
":",
"self",
".",
"_graphAttrDict",
",",
"'fields'",
":",
"[",
"(",
"field_name",
",",
"self",
".",
"_fieldAttrDict",
".",
"get",
"(",
"field_name",
")",
")",
"for",
"field_name",
"in",... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninGraph.setVal | Set value for field in graph.
@param name : Graph Name
@param value : Value for field. | pymunin/__init__.py | def setVal(self, name, val):
"""Set value for field in graph.
@param name : Graph Name
@param value : Value for field.
"""
if self._autoFixNames:
name = self._fixName(name)
self._fieldValDict[name] = val | def setVal(self, name, val):
"""Set value for field in graph.
@param name : Graph Name
@param value : Value for field.
"""
if self._autoFixNames:
name = self._fixName(name)
self._fieldValDict[name] = val | [
"Set",
"value",
"for",
"field",
"in",
"graph",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L908-L917 | [
"def",
"setVal",
"(",
"self",
",",
"name",
",",
"val",
")",
":",
"if",
"self",
".",
"_autoFixNames",
":",
"name",
"=",
"self",
".",
"_fixName",
"(",
"name",
")",
"self",
".",
"_fieldValDict",
"[",
"name",
"]",
"=",
"val"
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninGraph.getVals | Returns value list for Munin Graph
@return: List of name-value pairs. | pymunin/__init__.py | def getVals(self):
"""Returns value list for Munin Graph
@return: List of name-value pairs.
"""
return [(name, self._fieldValDict.get(name))
for name in self._fieldNameList] | def getVals(self):
"""Returns value list for Munin Graph
@return: List of name-value pairs.
"""
return [(name, self._fieldValDict.get(name))
for name in self._fieldNameList] | [
"Returns",
"value",
"list",
"for",
"Munin",
"Graph"
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L919-L926 | [
"def",
"getVals",
"(",
"self",
")",
":",
"return",
"[",
"(",
"name",
",",
"self",
".",
"_fieldValDict",
".",
"get",
"(",
"name",
")",
")",
"for",
"name",
"in",
"self",
".",
"_fieldNameList",
"]"
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | APCinfo.initStats | Query and parse Web Server Status Page.
@param extras: Include extra metrics, which can be computationally more
expensive. | pysysinfo/phpapc.py | def initStats(self, extras=None):
"""Query and parse Web Server Status Page.
@param extras: Include extra metrics, which can be computationally more
expensive.
"""
if extras is not None:
self._extras = extras
if self._extras:
... | def initStats(self, extras=None):
"""Query and parse Web Server Status Page.
@param extras: Include extra metrics, which can be computationally more
expensive.
"""
if extras is not None:
self._extras = extras
if self._extras:
... | [
"Query",
"and",
"parse",
"Web",
"Server",
"Status",
"Page",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/phpapc.py#L71-L92 | [
"def",
"initStats",
"(",
"self",
",",
"extras",
"=",
"None",
")",
":",
"if",
"extras",
"is",
"not",
"None",
":",
"self",
".",
"_extras",
"=",
"extras",
"if",
"self",
".",
"_extras",
":",
"detail",
"=",
"1",
"else",
":",
"detail",
"=",
"0",
"url",
... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | NginxInfo.initStats | Query and parse Nginx Web Server Status Page. | pysysinfo/nginx.py | def initStats(self):
"""Query and parse Nginx Web Server Status Page."""
url = "%s://%s:%d/%s" % (self._proto, self._host, self._port,
self._statuspath)
response = util.get_url(url, self._user, self._password)
self._statusDict = {}
for line in re... | def initStats(self):
"""Query and parse Nginx Web Server Status Page."""
url = "%s://%s:%d/%s" % (self._proto, self._host, self._port,
self._statuspath)
response = util.get_url(url, self._user, self._password)
self._statusDict = {}
for line in re... | [
"Query",
"and",
"parse",
"Nginx",
"Web",
"Server",
"Status",
"Page",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/nginx.py#L68-L83 | [
"def",
"initStats",
"(",
"self",
")",
":",
"url",
"=",
"\"%s://%s:%d/%s\"",
"%",
"(",
"self",
".",
"_proto",
",",
"self",
".",
"_host",
",",
"self",
".",
"_port",
",",
"self",
".",
"_statuspath",
")",
"response",
"=",
"util",
".",
"get_url",
"(",
"ur... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | read_file | Read a file into a string | setup.py | def read_file(filename):
"""Read a file into a string"""
path = os.path.abspath(os.path.dirname(__file__))
filepath = os.path.join(path, filename)
try:
return open(filepath).read()
except IOError:
return '' | def read_file(filename):
"""Read a file into a string"""
path = os.path.abspath(os.path.dirname(__file__))
filepath = os.path.join(path, filename)
try:
return open(filepath).read()
except IOError:
return '' | [
"Read",
"a",
"file",
"into",
"a",
"string"
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/setup.py#L16-L23 | [
"def",
"read_file",
"(",
"filename",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"__file__",
")",
")",
"filepath",
"=",
"os",
".",
"path",
".",
"join",
"(",
"path",
",",
"filename",
")",
... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninProcStatsPlugin.retrieveVals | Retrieve values for graphs. | pymunin/plugins/procstats.py | def retrieveVals(self):
"""Retrieve values for graphs."""
proc_info = ProcessInfo()
stats = {}
for (prefix, is_thread) in (('proc', False),
('thread', True)):
graph_name = '%s_status' % prefix
if self.hasGraph(graph_name):
... | def retrieveVals(self):
"""Retrieve values for graphs."""
proc_info = ProcessInfo()
stats = {}
for (prefix, is_thread) in (('proc', False),
('thread', True)):
graph_name = '%s_status' % prefix
if self.hasGraph(graph_name):
... | [
"Retrieve",
"values",
"for",
"graphs",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/procstats.py#L105-L133 | [
"def",
"retrieveVals",
"(",
"self",
")",
":",
"proc_info",
"=",
"ProcessInfo",
"(",
")",
"stats",
"=",
"{",
"}",
"for",
"(",
"prefix",
",",
"is_thread",
")",
"in",
"(",
"(",
"'proc'",
",",
"False",
")",
",",
"(",
"'thread'",
",",
"True",
")",
")",
... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninRackspacePlugin.retrieveVals | Retrieve values for graphs. | pymunin/plugins/rackspacestats.py | def retrieveVals(self):
"""Retrieve values for graphs."""
file_stats = self._fileInfo.getContainerStats()
for contname in self._fileContList:
stats = file_stats.get(contname)
if stats is not None:
if self.hasGraph('rackspace_cloudfiles_container_size'):
... | def retrieveVals(self):
"""Retrieve values for graphs."""
file_stats = self._fileInfo.getContainerStats()
for contname in self._fileContList:
stats = file_stats.get(contname)
if stats is not None:
if self.hasGraph('rackspace_cloudfiles_container_size'):
... | [
"Retrieve",
"values",
"for",
"graphs",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/rackspacestats.py#L125-L136 | [
"def",
"retrieveVals",
"(",
"self",
")",
":",
"file_stats",
"=",
"self",
".",
"_fileInfo",
".",
"getContainerStats",
"(",
")",
"for",
"contname",
"in",
"self",
".",
"_fileContList",
":",
"stats",
"=",
"file_stats",
".",
"get",
"(",
"contname",
")",
"if",
... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | plot | General plot function that groups data by subject/list number and performs analysis.
Parameters
----------
results : quail.FriedEgg
Object containing results
subjgroup : list of strings or ints
String/int variables indicating how to group over subjects. Must be
the length of t... | quail/plot.py | def plot(results, subjgroup=None, subjname='Subject Group', listgroup=None,
listname='List', subjconds=None, listconds=None, plot_type=None,
plot_style=None, title=None, legend=True, xlim=None, ylim=None,
save_path=None, show=True, ax=None, **kwargs):
"""
General plot function that gr... | def plot(results, subjgroup=None, subjname='Subject Group', listgroup=None,
listname='List', subjconds=None, listconds=None, plot_type=None,
plot_style=None, title=None, legend=True, xlim=None, ylim=None,
save_path=None, show=True, ax=None, **kwargs):
"""
General plot function that gr... | [
"General",
"plot",
"function",
"that",
"groups",
"data",
"by",
"subject",
"/",
"list",
"number",
"and",
"performs",
"analysis",
"."
] | ContextLab/quail | python | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/plot.py#L12-L288 | [
"def",
"plot",
"(",
"results",
",",
"subjgroup",
"=",
"None",
",",
"subjname",
"=",
"'Subject Group'",
",",
"listgroup",
"=",
"None",
",",
"listname",
"=",
"'List'",
",",
"subjconds",
"=",
"None",
",",
"listconds",
"=",
"None",
",",
"plot_type",
"=",
"No... | 71dd53c792dd915dc84879d8237e3582dd68b7a4 |
train | NetIfaceInfo.getIfStats | Return dictionary of Traffic Stats for Network Interfaces.
@return: Nested dictionary of statistics for each interface. | pysysinfo/netiface.py | def getIfStats(self):
"""Return dictionary of Traffic Stats for Network Interfaces.
@return: Nested dictionary of statistics for each interface.
"""
info_dict = {}
try:
fp = open(ifaceStatsFile, 'r')
data = fp.read()
fp.close(... | def getIfStats(self):
"""Return dictionary of Traffic Stats for Network Interfaces.
@return: Nested dictionary of statistics for each interface.
"""
info_dict = {}
try:
fp = open(ifaceStatsFile, 'r')
data = fp.read()
fp.close(... | [
"Return",
"dictionary",
"of",
"Traffic",
"Stats",
"for",
"Network",
"Interfaces",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/netiface.py#L27-L53 | [
"def",
"getIfStats",
"(",
"self",
")",
":",
"info_dict",
"=",
"{",
"}",
"try",
":",
"fp",
"=",
"open",
"(",
"ifaceStatsFile",
",",
"'r'",
")",
"data",
"=",
"fp",
".",
"read",
"(",
")",
"fp",
".",
"close",
"(",
")",
"except",
":",
"raise",
"IOErro... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | NetIfaceInfo.getIfConfig | Return dictionary of Interface Configuration (ifconfig).
@return: Dictionary of if configurations keyed by if name. | pysysinfo/netiface.py | def getIfConfig(self):
"""Return dictionary of Interface Configuration (ifconfig).
@return: Dictionary of if configurations keyed by if name.
"""
conf = {}
try:
out = subprocess.Popen([ipCmd, "addr", "show"],
stdou... | def getIfConfig(self):
"""Return dictionary of Interface Configuration (ifconfig).
@return: Dictionary of if configurations keyed by if name.
"""
conf = {}
try:
out = subprocess.Popen([ipCmd, "addr", "show"],
stdou... | [
"Return",
"dictionary",
"of",
"Interface",
"Configuration",
"(",
"ifconfig",
")",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/netiface.py#L55-L94 | [
"def",
"getIfConfig",
"(",
"self",
")",
":",
"conf",
"=",
"{",
"}",
"try",
":",
"out",
"=",
"subprocess",
".",
"Popen",
"(",
"[",
"ipCmd",
",",
"\"addr\"",
",",
"\"show\"",
"]",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
")",
".",
"communicate",
... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | NetIfaceInfo.getRoutes | Get routing table.
@return: List of routes. | pysysinfo/netiface.py | def getRoutes(self):
"""Get routing table.
@return: List of routes.
"""
routes = []
try:
out = subprocess.Popen([routeCmd, "-n"],
stdout=subprocess.PIPE).communicate()[0]
except:
raise Exception... | def getRoutes(self):
"""Get routing table.
@return: List of routes.
"""
routes = []
try:
out = subprocess.Popen([routeCmd, "-n"],
stdout=subprocess.PIPE).communicate()[0]
except:
raise Exception... | [
"Get",
"routing",
"table",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/netiface.py#L96-L113 | [
"def",
"getRoutes",
"(",
"self",
")",
":",
"routes",
"=",
"[",
"]",
"try",
":",
"out",
"=",
"subprocess",
".",
"Popen",
"(",
"[",
"routeCmd",
",",
"\"-n\"",
"]",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
")",
".",
"communicate",
"(",
")",
"[",... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | NetstatInfo.execNetstatCmd | Execute ps command with positional params args and return result as
list of lines.
@param *args: Positional params for netstat command.
@return: List of output lines | pysysinfo/netstat.py | def execNetstatCmd(self, *args):
"""Execute ps command with positional params args and return result as
list of lines.
@param *args: Positional params for netstat command.
@return: List of output lines
"""
out = util.exec_command([netstatCmd,] + li... | def execNetstatCmd(self, *args):
"""Execute ps command with positional params args and return result as
list of lines.
@param *args: Positional params for netstat command.
@return: List of output lines
"""
out = util.exec_command([netstatCmd,] + li... | [
"Execute",
"ps",
"command",
"with",
"positional",
"params",
"args",
"and",
"return",
"result",
"as",
"list",
"of",
"lines",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/netstat.py#L30-L39 | [
"def",
"execNetstatCmd",
"(",
"self",
",",
"*",
"args",
")",
":",
"out",
"=",
"util",
".",
"exec_command",
"(",
"[",
"netstatCmd",
",",
"]",
"+",
"list",
"(",
"args",
")",
")",
"return",
"out",
".",
"splitlines",
"(",
")"
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | NetstatInfo.parseNetstatCmd | Execute netstat command and return result as a nested dictionary.
@param tcp: Include TCP ports in ouput if True.
@param udp: Include UDP ports in ouput if True.
@param ipv4: Include IPv4 ports in output if True.
@param ipv6: Include IPv... | pysysinfo/netstat.py | def parseNetstatCmd(self, tcp=True, udp=True, ipv4=True, ipv6=True,
include_listen=True, only_listen=False,
show_users=False, show_procs=False,
resolve_hosts=False, resolve_ports=False,
resolve_users=True):
"""Exec... | def parseNetstatCmd(self, tcp=True, udp=True, ipv4=True, ipv6=True,
include_listen=True, only_listen=False,
show_users=False, show_procs=False,
resolve_hosts=False, resolve_ports=False,
resolve_users=True):
"""Exec... | [
"Execute",
"netstat",
"command",
"and",
"return",
"result",
"as",
"a",
"nested",
"dictionary",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/netstat.py#L41-L117 | [
"def",
"parseNetstatCmd",
"(",
"self",
",",
"tcp",
"=",
"True",
",",
"udp",
"=",
"True",
",",
"ipv4",
"=",
"True",
",",
"ipv6",
"=",
"True",
",",
"include_listen",
"=",
"True",
",",
"only_listen",
"=",
"False",
",",
"show_users",
"=",
"False",
",",
"... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | NetstatInfo.getStats | Execute netstat command and return result as a nested dictionary.
@param tcp: Include TCP ports in ouput if True.
@param udp: Include UDP ports in ouput if True.
@param ipv4: Include IPv4 ports in output if True.
@param ipv6: Include IPv... | pysysinfo/netstat.py | def getStats(self, tcp=True, udp=True, ipv4=True, ipv6=True,
include_listen=True, only_listen=False,
show_users=False, show_procs=False,
resolve_hosts=False, resolve_ports=False, resolve_users=True,
**kwargs):
"""Execute netstat command and ... | def getStats(self, tcp=True, udp=True, ipv4=True, ipv6=True,
include_listen=True, only_listen=False,
show_users=False, show_procs=False,
resolve_hosts=False, resolve_ports=False, resolve_users=True,
**kwargs):
"""Execute netstat command and ... | [
"Execute",
"netstat",
"command",
"and",
"return",
"result",
"as",
"a",
"nested",
"dictionary",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/netstat.py#L119-L170 | [
"def",
"getStats",
"(",
"self",
",",
"tcp",
"=",
"True",
",",
"udp",
"=",
"True",
",",
"ipv4",
"=",
"True",
",",
"ipv6",
"=",
"True",
",",
"include_listen",
"=",
"True",
",",
"only_listen",
"=",
"False",
",",
"show_users",
"=",
"False",
",",
"show_pr... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | NetstatInfo.getTCPportConnStatus | Returns the number of TCP endpoints discriminated by status.
@param ipv4: Include IPv4 ports in output if True.
@param ipv6: Include IPv6 ports in output if True.
@param include_listen: Include listening ports in output if True.
@param **kwargs: Keyword... | pysysinfo/netstat.py | def getTCPportConnStatus(self, ipv4=True, ipv6=True, include_listen=False,
**kwargs):
"""Returns the number of TCP endpoints discriminated by status.
@param ipv4: Include IPv4 ports in output if True.
@param ipv6: Include IPv6 ports in ou... | def getTCPportConnStatus(self, ipv4=True, ipv6=True, include_listen=False,
**kwargs):
"""Returns the number of TCP endpoints discriminated by status.
@param ipv4: Include IPv4 ports in output if True.
@param ipv6: Include IPv6 ports in ou... | [
"Returns",
"the",
"number",
"of",
"TCP",
"endpoints",
"discriminated",
"by",
"status",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/netstat.py#L172-L209 | [
"def",
"getTCPportConnStatus",
"(",
"self",
",",
"ipv4",
"=",
"True",
",",
"ipv6",
"=",
"True",
",",
"include_listen",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"status_dict",
"=",
"{",
"}",
"result",
"=",
"self",
".",
"getStats",
"(",
"tcp",
... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | NetstatInfo.getTCPportConnCount | Returns TCP connection counts for each local port.
@param ipv4: Include IPv4 ports in output if True.
@param ipv6: Include IPv6 ports in output if True.
@param resolve_ports: Resolve numeric ports to names if True.
@param **kwargs: Keyword variables are us... | pysysinfo/netstat.py | def getTCPportConnCount(self, ipv4=True, ipv6=True, resolve_ports=False,
**kwargs):
"""Returns TCP connection counts for each local port.
@param ipv4: Include IPv4 ports in output if True.
@param ipv6: Include IPv6 ports in output if True.
... | def getTCPportConnCount(self, ipv4=True, ipv6=True, resolve_ports=False,
**kwargs):
"""Returns TCP connection counts for each local port.
@param ipv4: Include IPv4 ports in output if True.
@param ipv6: Include IPv6 ports in output if True.
... | [
"Returns",
"TCP",
"connection",
"counts",
"for",
"each",
"local",
"port",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/netstat.py#L211-L247 | [
"def",
"getTCPportConnCount",
"(",
"self",
",",
"ipv4",
"=",
"True",
",",
"ipv6",
"=",
"True",
",",
"resolve_ports",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"port_dict",
"=",
"{",
"}",
"result",
"=",
"self",
".",
"getStats",
"(",
"tcp",
"=",... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | accuracy_helper | Computes proportion of words recalled
Parameters
----------
egg : quail.Egg
Data to analyze
match : str (exact, best or smooth)
Matching approach to compute recall matrix. If exact, the presented and
recalled items must be identical (default). If best, the recalled item
... | quail/analysis/accuracy.py | def accuracy_helper(egg, match='exact', distance='euclidean',
features=None):
"""
Computes proportion of words recalled
Parameters
----------
egg : quail.Egg
Data to analyze
match : str (exact, best or smooth)
Matching approach to compute recall matrix. If ... | def accuracy_helper(egg, match='exact', distance='euclidean',
features=None):
"""
Computes proportion of words recalled
Parameters
----------
egg : quail.Egg
Data to analyze
match : str (exact, best or smooth)
Matching approach to compute recall matrix. If ... | [
"Computes",
"proportion",
"of",
"words",
"recalled"
] | ContextLab/quail | python | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/analysis/accuracy.py#L5-L50 | [
"def",
"accuracy_helper",
"(",
"egg",
",",
"match",
"=",
"'exact'",
",",
"distance",
"=",
"'euclidean'",
",",
"features",
"=",
"None",
")",
":",
"def",
"acc",
"(",
"lst",
")",
":",
"return",
"len",
"(",
"[",
"i",
"for",
"i",
"in",
"np",
".",
"uniqu... | 71dd53c792dd915dc84879d8237e3582dd68b7a4 |
train | PgInfo._connect | Establish connection to PostgreSQL Database. | pysysinfo/postgresql.py | def _connect(self):
"""Establish connection to PostgreSQL Database."""
if self._connParams:
self._conn = psycopg2.connect(**self._connParams)
else:
self._conn = psycopg2.connect('')
try:
ver_str = self._conn.get_parameter_status('server_version')
... | def _connect(self):
"""Establish connection to PostgreSQL Database."""
if self._connParams:
self._conn = psycopg2.connect(**self._connParams)
else:
self._conn = psycopg2.connect('')
try:
ver_str = self._conn.get_parameter_status('server_version')
... | [
"Establish",
"connection",
"to",
"PostgreSQL",
"Database",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/postgresql.py#L76-L86 | [
"def",
"_connect",
"(",
"self",
")",
":",
"if",
"self",
".",
"_connParams",
":",
"self",
".",
"_conn",
"=",
"psycopg2",
".",
"connect",
"(",
"*",
"*",
"self",
".",
"_connParams",
")",
"else",
":",
"self",
".",
"_conn",
"=",
"psycopg2",
".",
"connect"... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | PgInfo._createStatsDict | Utility method that returns database stats as a nested dictionary.
@param headers: List of columns in query result.
@param rows: List of rows in query result.
@return: Nested dictionary of values.
First key is the database name and the second key is the... | pysysinfo/postgresql.py | def _createStatsDict(self, headers, rows):
"""Utility method that returns database stats as a nested dictionary.
@param headers: List of columns in query result.
@param rows: List of rows in query result.
@return: Nested dictionary of values.
Fi... | def _createStatsDict(self, headers, rows):
"""Utility method that returns database stats as a nested dictionary.
@param headers: List of columns in query result.
@param rows: List of rows in query result.
@return: Nested dictionary of values.
Fi... | [
"Utility",
"method",
"that",
"returns",
"database",
"stats",
"as",
"a",
"nested",
"dictionary",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/postgresql.py#L88-L101 | [
"def",
"_createStatsDict",
"(",
"self",
",",
"headers",
",",
"rows",
")",
":",
"dbstats",
"=",
"{",
"}",
"for",
"row",
"in",
"rows",
":",
"dbstats",
"[",
"row",
"[",
"0",
"]",
"]",
"=",
"dict",
"(",
"zip",
"(",
"headers",
"[",
"1",
":",
"]",
",... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | PgInfo._createTotalsDict | Utility method that returns totals for database statistics.
@param headers: List of columns in query result.
@param rows: List of rows in query result.
@return: Dictionary of totals for each statistics column. | pysysinfo/postgresql.py | def _createTotalsDict(self, headers, rows):
"""Utility method that returns totals for database statistics.
@param headers: List of columns in query result.
@param rows: List of rows in query result.
@return: Dictionary of totals for each statistics column.
... | def _createTotalsDict(self, headers, rows):
"""Utility method that returns totals for database statistics.
@param headers: List of columns in query result.
@param rows: List of rows in query result.
@return: Dictionary of totals for each statistics column.
... | [
"Utility",
"method",
"that",
"returns",
"totals",
"for",
"database",
"statistics",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/postgresql.py#L103-L112 | [
"def",
"_createTotalsDict",
"(",
"self",
",",
"headers",
",",
"rows",
")",
":",
"totals",
"=",
"[",
"sum",
"(",
"col",
")",
"for",
"col",
"in",
"zip",
"(",
"*",
"rows",
")",
"[",
"1",
":",
"]",
"]",
"return",
"dict",
"(",
"zip",
"(",
"headers",
... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | PgInfo._simpleQuery | Executes simple query which returns a single column.
@param query: Query string.
@return: Query result string. | pysysinfo/postgresql.py | def _simpleQuery(self, query):
"""Executes simple query which returns a single column.
@param query: Query string.
@return: Query result string.
"""
cur = self._conn.cursor()
cur.execute(query)
row = cur.fetchone()
return util.parse_... | def _simpleQuery(self, query):
"""Executes simple query which returns a single column.
@param query: Query string.
@return: Query result string.
"""
cur = self._conn.cursor()
cur.execute(query)
row = cur.fetchone()
return util.parse_... | [
"Executes",
"simple",
"query",
"which",
"returns",
"a",
"single",
"column",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/postgresql.py#L114-L124 | [
"def",
"_simpleQuery",
"(",
"self",
",",
"query",
")",
":",
"cur",
"=",
"self",
".",
"_conn",
".",
"cursor",
"(",
")",
"cur",
".",
"execute",
"(",
"query",
")",
"row",
"=",
"cur",
".",
"fetchone",
"(",
")",
"return",
"util",
".",
"parse_value",
"("... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | PgInfo.getParam | Returns value of Run-time Database Parameter 'key'.
@param key: Run-time parameter name.
@return: Run-time parameter value. | pysysinfo/postgresql.py | def getParam(self, key):
"""Returns value of Run-time Database Parameter 'key'.
@param key: Run-time parameter name.
@return: Run-time parameter value.
"""
cur = self._conn.cursor()
cur.execute("SHOW %s" % key)
row = cur.fetchone()
ret... | def getParam(self, key):
"""Returns value of Run-time Database Parameter 'key'.
@param key: Run-time parameter name.
@return: Run-time parameter value.
"""
cur = self._conn.cursor()
cur.execute("SHOW %s" % key)
row = cur.fetchone()
ret... | [
"Returns",
"value",
"of",
"Run",
"-",
"time",
"Database",
"Parameter",
"key",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/postgresql.py#L151-L161 | [
"def",
"getParam",
"(",
"self",
",",
"key",
")",
":",
"cur",
"=",
"self",
".",
"_conn",
".",
"cursor",
"(",
")",
"cur",
".",
"execute",
"(",
"\"SHOW %s\"",
"%",
"key",
")",
"row",
"=",
"cur",
".",
"fetchone",
"(",
")",
"return",
"util",
".",
"par... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | PgInfo.getConnectionStats | Returns dictionary with number of connections for each database.
@return: Dictionary of database connection statistics. | pysysinfo/postgresql.py | def getConnectionStats(self):
"""Returns dictionary with number of connections for each database.
@return: Dictionary of database connection statistics.
"""
cur = self._conn.cursor()
cur.execute("""SELECT datname,numbackends FROM pg_stat_database;""")
ro... | def getConnectionStats(self):
"""Returns dictionary with number of connections for each database.
@return: Dictionary of database connection statistics.
"""
cur = self._conn.cursor()
cur.execute("""SELECT datname,numbackends FROM pg_stat_database;""")
ro... | [
"Returns",
"dictionary",
"with",
"number",
"of",
"connections",
"for",
"each",
"database",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/postgresql.py#L193-L205 | [
"def",
"getConnectionStats",
"(",
"self",
")",
":",
"cur",
"=",
"self",
".",
"_conn",
".",
"cursor",
"(",
")",
"cur",
".",
"execute",
"(",
"\"\"\"SELECT datname,numbackends FROM pg_stat_database;\"\"\"",
")",
"rows",
"=",
"cur",
".",
"fetchall",
"(",
")",
"if"... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | PgInfo.getDatabaseStats | Returns database block read, transaction and tuple stats for each
database.
@return: Nested dictionary of stats. | pysysinfo/postgresql.py | def getDatabaseStats(self):
"""Returns database block read, transaction and tuple stats for each
database.
@return: Nested dictionary of stats.
"""
headers = ('datname', 'numbackends', 'xact_commit', 'xact_rollback',
'blks_read', 'blks_hit',... | def getDatabaseStats(self):
"""Returns database block read, transaction and tuple stats for each
database.
@return: Nested dictionary of stats.
"""
headers = ('datname', 'numbackends', 'xact_commit', 'xact_rollback',
'blks_read', 'blks_hit',... | [
"Returns",
"database",
"block",
"read",
"transaction",
"and",
"tuple",
"stats",
"for",
"each",
"database",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/postgresql.py#L207-L223 | [
"def",
"getDatabaseStats",
"(",
"self",
")",
":",
"headers",
"=",
"(",
"'datname'",
",",
"'numbackends'",
",",
"'xact_commit'",
",",
"'xact_rollback'",
",",
"'blks_read'",
",",
"'blks_hit'",
",",
"'tup_returned'",
",",
"'tup_fetched'",
",",
"'tup_inserted'",
",",
... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | PgInfo.getLockStatsMode | Returns the number of active lock discriminated by lock mode.
@return: : Dictionary of stats. | pysysinfo/postgresql.py | def getLockStatsMode(self):
"""Returns the number of active lock discriminated by lock mode.
@return: : Dictionary of stats.
"""
info_dict = {'all': dict(zip(self.lockModes, (0,) * len(self.lockModes))),
'wait': dict(zip(self.lockModes, (0,) * len(s... | def getLockStatsMode(self):
"""Returns the number of active lock discriminated by lock mode.
@return: : Dictionary of stats.
"""
info_dict = {'all': dict(zip(self.lockModes, (0,) * len(self.lockModes))),
'wait': dict(zip(self.lockModes, (0,) * len(s... | [
"Returns",
"the",
"number",
"of",
"active",
"lock",
"discriminated",
"by",
"lock",
"mode",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/postgresql.py#L225-L241 | [
"def",
"getLockStatsMode",
"(",
"self",
")",
":",
"info_dict",
"=",
"{",
"'all'",
":",
"dict",
"(",
"zip",
"(",
"self",
".",
"lockModes",
",",
"(",
"0",
",",
")",
"*",
"len",
"(",
"self",
".",
"lockModes",
")",
")",
")",
",",
"'wait'",
":",
"dict... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | PgInfo.getLockStatsDB | Returns the number of active lock discriminated by database.
@return: : Dictionary of stats. | pysysinfo/postgresql.py | def getLockStatsDB(self):
"""Returns the number of active lock discriminated by database.
@return: : Dictionary of stats.
"""
info_dict = {'all': {},
'wait': {}}
cur = self._conn.cursor()
cur.execute("SELECT d.datname, l.granted, COU... | def getLockStatsDB(self):
"""Returns the number of active lock discriminated by database.
@return: : Dictionary of stats.
"""
info_dict = {'all': {},
'wait': {}}
cur = self._conn.cursor()
cur.execute("SELECT d.datname, l.granted, COU... | [
"Returns",
"the",
"number",
"of",
"active",
"lock",
"discriminated",
"by",
"database",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/postgresql.py#L243-L260 | [
"def",
"getLockStatsDB",
"(",
"self",
")",
":",
"info_dict",
"=",
"{",
"'all'",
":",
"{",
"}",
",",
"'wait'",
":",
"{",
"}",
"}",
"cur",
"=",
"self",
".",
"_conn",
".",
"cursor",
"(",
")",
"cur",
".",
"execute",
"(",
"\"SELECT d.datname, l.granted, COU... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | PgInfo.getBgWriterStats | Returns Global Background Writer and Checkpoint Activity stats.
@return: Nested dictionary of stats. | pysysinfo/postgresql.py | def getBgWriterStats(self):
"""Returns Global Background Writer and Checkpoint Activity stats.
@return: Nested dictionary of stats.
"""
info_dict = {}
if self.checkVersion('8.3'):
cur = self._conn.cursor(cursor_factory=psycopg2.extras.RealDictCursor)... | def getBgWriterStats(self):
"""Returns Global Background Writer and Checkpoint Activity stats.
@return: Nested dictionary of stats.
"""
info_dict = {}
if self.checkVersion('8.3'):
cur = self._conn.cursor(cursor_factory=psycopg2.extras.RealDictCursor)... | [
"Returns",
"Global",
"Background",
"Writer",
"and",
"Checkpoint",
"Activity",
"stats",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/postgresql.py#L262-L273 | [
"def",
"getBgWriterStats",
"(",
"self",
")",
":",
"info_dict",
"=",
"{",
"}",
"if",
"self",
".",
"checkVersion",
"(",
"'8.3'",
")",
":",
"cur",
"=",
"self",
".",
"_conn",
".",
"cursor",
"(",
"cursor_factory",
"=",
"psycopg2",
".",
"extras",
".",
"RealD... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.