repo stringlengths 7 55 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 19 28.4k | docstring stringlengths 1 46.9k | docstring_tokens listlengths 1 1.97k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
aouyar/PyMunin | pysysinfo/diskio.py | DiskIOinfo._initFilesystemInfo | def _initFilesystemInfo(self):
"""Initialize filesystem to device mappings."""
self._mapFSpathDev = {}
fsinfo = FilesystemInfo()
for fs in fsinfo.getFSlist():
devpath = fsinfo.getFSdev(fs)
dev = self._getUniqueDev(devpath)
if dev is not None:
... | python | def _initFilesystemInfo(self):
"""Initialize filesystem to device mappings."""
self._mapFSpathDev = {}
fsinfo = FilesystemInfo()
for fs in fsinfo.getFSlist():
devpath = fsinfo.getFSdev(fs)
dev = self._getUniqueDev(devpath)
if dev is not None:
... | [
"def",
"_initFilesystemInfo",
"(",
"self",
")",
":",
"self",
".",
"_mapFSpathDev",
"=",
"{",
"}",
"fsinfo",
"=",
"FilesystemInfo",
"(",
")",
"for",
"fs",
"in",
"fsinfo",
".",
"getFSlist",
"(",
")",
":",
"devpath",
"=",
"fsinfo",
".",
"getFSdev",
"(",
"... | Initialize filesystem to device mappings. | [
"Initialize",
"filesystem",
"to",
"device",
"mappings",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/diskio.py#L139-L147 | train |
aouyar/PyMunin | pysysinfo/diskio.py | DiskIOinfo._initSwapInfo | def _initSwapInfo(self):
"""Initialize swap partition to device mappings."""
self._swapList = []
sysinfo = SystemInfo()
for (swap,attrs) in sysinfo.getSwapStats().iteritems():
if attrs['type'] == 'partition':
dev = self._getUniqueDev(swap)
if d... | python | def _initSwapInfo(self):
"""Initialize swap partition to device mappings."""
self._swapList = []
sysinfo = SystemInfo()
for (swap,attrs) in sysinfo.getSwapStats().iteritems():
if attrs['type'] == 'partition':
dev = self._getUniqueDev(swap)
if d... | [
"def",
"_initSwapInfo",
"(",
"self",
")",
":",
"self",
".",
"_swapList",
"=",
"[",
"]",
"sysinfo",
"=",
"SystemInfo",
"(",
")",
"for",
"(",
"swap",
",",
"attrs",
")",
"in",
"sysinfo",
".",
"getSwapStats",
"(",
")",
".",
"iteritems",
"(",
")",
":",
... | Initialize swap partition to device mappings. | [
"Initialize",
"swap",
"partition",
"to",
"device",
"mappings",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/diskio.py#L149-L157 | train |
aouyar/PyMunin | pysysinfo/diskio.py | DiskIOinfo._initDiskStats | def _initDiskStats(self):
"""Parse and initialize block device I/O stats in /proc/diskstats."""
self._diskStats = {}
self._mapMajorMinor2dev = {}
try:
fp = open(diskStatsFile, 'r')
data = fp.read()
fp.close()
except:
raise IOError('... | python | def _initDiskStats(self):
"""Parse and initialize block device I/O stats in /proc/diskstats."""
self._diskStats = {}
self._mapMajorMinor2dev = {}
try:
fp = open(diskStatsFile, 'r')
data = fp.read()
fp.close()
except:
raise IOError('... | [
"def",
"_initDiskStats",
"(",
"self",
")",
":",
"self",
".",
"_diskStats",
"=",
"{",
"}",
"self",
".",
"_mapMajorMinor2dev",
"=",
"{",
"}",
"try",
":",
"fp",
"=",
"open",
"(",
"diskStatsFile",
",",
"'r'",
")",
"data",
"=",
"fp",
".",
"read",
"(",
"... | Parse and initialize block device I/O stats in /proc/diskstats. | [
"Parse",
"and",
"initialize",
"block",
"device",
"I",
"/",
"O",
"stats",
"in",
"/",
"proc",
"/",
"diskstats",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/diskio.py#L159-L192 | train |
aouyar/PyMunin | pysysinfo/diskio.py | DiskIOinfo._initDevClasses | def _initDevClasses(self):
"""Sort block devices into lists depending on device class and
initialize device type map and partition map."""
self._devClassTree = {}
self._partitionTree = {}
self._mapDevType = {}
basedevs = []
otherdevs = []
if self._mapMajo... | python | def _initDevClasses(self):
"""Sort block devices into lists depending on device class and
initialize device type map and partition map."""
self._devClassTree = {}
self._partitionTree = {}
self._mapDevType = {}
basedevs = []
otherdevs = []
if self._mapMajo... | [
"def",
"_initDevClasses",
"(",
"self",
")",
":",
"self",
".",
"_devClassTree",
"=",
"{",
"}",
"self",
".",
"_partitionTree",
"=",
"{",
"}",
"self",
".",
"_mapDevType",
"=",
"{",
"}",
"basedevs",
"=",
"[",
"]",
"otherdevs",
"=",
"[",
"]",
"if",
"self"... | Sort block devices into lists depending on device class and
initialize device type map and partition map. | [
"Sort",
"block",
"devices",
"into",
"lists",
"depending",
"on",
"device",
"class",
"and",
"initialize",
"device",
"type",
"map",
"and",
"partition",
"map",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/diskio.py#L194-L228 | train |
aouyar/PyMunin | pysysinfo/diskio.py | DiskIOinfo.getDevType | def getDevType(self, dev):
"""Returns type of device dev.
@return: Device type as string.
"""
if self._devClassTree is None:
self._initDevClasses()
return self._mapDevType.get(dev) | python | def getDevType(self, dev):
"""Returns type of device dev.
@return: Device type as string.
"""
if self._devClassTree is None:
self._initDevClasses()
return self._mapDevType.get(dev) | [
"def",
"getDevType",
"(",
"self",
",",
"dev",
")",
":",
"if",
"self",
".",
"_devClassTree",
"is",
"None",
":",
"self",
".",
"_initDevClasses",
"(",
")",
"return",
"self",
".",
"_mapDevType",
".",
"get",
"(",
"dev",
")"
] | Returns type of device dev.
@return: Device type as string. | [
"Returns",
"type",
"of",
"device",
"dev",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/diskio.py#L230-L238 | train |
aouyar/PyMunin | pysysinfo/diskio.py | DiskIOinfo.getPartitionList | def getPartitionList(self):
"""Returns list of partitions.
@return: List of (disk,partition) pairs.
"""
if self._partList is None:
self._partList = []
for (disk,parts) in self.getPartitionDict().iteritems():
for part in parts:
... | python | def getPartitionList(self):
"""Returns list of partitions.
@return: List of (disk,partition) pairs.
"""
if self._partList is None:
self._partList = []
for (disk,parts) in self.getPartitionDict().iteritems():
for part in parts:
... | [
"def",
"getPartitionList",
"(",
"self",
")",
":",
"if",
"self",
".",
"_partList",
"is",
"None",
":",
"self",
".",
"_partList",
"=",
"[",
"]",
"for",
"(",
"disk",
",",
"parts",
")",
"in",
"self",
".",
"getPartitionDict",
"(",
")",
".",
"iteritems",
"(... | Returns list of partitions.
@return: List of (disk,partition) pairs. | [
"Returns",
"list",
"of",
"partitions",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/diskio.py#L288-L299 | train |
aouyar/PyMunin | pysysinfo/diskio.py | DiskIOinfo.getDevStats | def getDevStats(self, dev, devtype = None):
"""Returns I/O stats for block device.
@param dev: Device name
@param devtype: Device type. (Ignored if None.)
@return: Dict of stats.
"""
if devtype is not None:
if self._devClassTree is... | python | def getDevStats(self, dev, devtype = None):
"""Returns I/O stats for block device.
@param dev: Device name
@param devtype: Device type. (Ignored if None.)
@return: Dict of stats.
"""
if devtype is not None:
if self._devClassTree is... | [
"def",
"getDevStats",
"(",
"self",
",",
"dev",
",",
"devtype",
"=",
"None",
")",
":",
"if",
"devtype",
"is",
"not",
"None",
":",
"if",
"self",
".",
"_devClassTree",
"is",
"None",
":",
"self",
".",
"_initDevClasses",
"(",
")",
"if",
"devtype",
"<>",
"... | Returns I/O stats for block device.
@param dev: Device name
@param devtype: Device type. (Ignored if None.)
@return: Dict of stats. | [
"Returns",
"I",
"/",
"O",
"stats",
"for",
"block",
"device",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/diskio.py#L367-L380 | train |
aouyar/PyMunin | pysysinfo/diskio.py | DiskIOinfo.getSwapStats | def getSwapStats(self, dev):
"""Returns I/O stats for swap partition.
@param dev: Device name for swap partition.
@return: Dict of stats.
"""
if self._swapList is None:
self._initSwapInfo()
if dev in self._swapList:
return self.ge... | python | def getSwapStats(self, dev):
"""Returns I/O stats for swap partition.
@param dev: Device name for swap partition.
@return: Dict of stats.
"""
if self._swapList is None:
self._initSwapInfo()
if dev in self._swapList:
return self.ge... | [
"def",
"getSwapStats",
"(",
"self",
",",
"dev",
")",
":",
"if",
"self",
".",
"_swapList",
"is",
"None",
":",
"self",
".",
"_initSwapInfo",
"(",
")",
"if",
"dev",
"in",
"self",
".",
"_swapList",
":",
"return",
"self",
".",
"getDevStats",
"(",
"dev",
"... | Returns I/O stats for swap partition.
@param dev: Device name for swap partition.
@return: Dict of stats. | [
"Returns",
"I",
"/",
"O",
"stats",
"for",
"swap",
"partition",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/diskio.py#L418-L430 | train |
aouyar/PyMunin | pysysinfo/diskio.py | DiskIOinfo.getLVstats | def getLVstats(self, *args):
"""Returns I/O stats for LV.
@param args: Two calling conventions are implemented:
- Passing two parameters vg and lv.
- Passing only one parameter in 'vg-lv' format.
@return: Dict of stats.
""... | python | def getLVstats(self, *args):
"""Returns I/O stats for LV.
@param args: Two calling conventions are implemented:
- Passing two parameters vg and lv.
- Passing only one parameter in 'vg-lv' format.
@return: Dict of stats.
""... | [
"def",
"getLVstats",
"(",
"self",
",",
"*",
"args",
")",
":",
"if",
"not",
"len",
"(",
"args",
")",
"in",
"(",
"1",
",",
"2",
")",
":",
"raise",
"TypeError",
"(",
"\"The getLVstats must be called with either \"",
"\"one or two arguments.\"",
")",
"if",
"self... | Returns I/O stats for LV.
@param args: Two calling conventions are implemented:
- Passing two parameters vg and lv.
- Passing only one parameter in 'vg-lv' format.
@return: Dict of stats. | [
"Returns",
"I",
"/",
"O",
"stats",
"for",
"LV",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/diskio.py#L432-L453 | train |
aouyar/PyMunin | pysysinfo/diskio.py | DiskIOinfo.getFilesystemStats | def getFilesystemStats(self, fs):
"""Returns I/O stats for filesystem.
@param fs: Filesystem path.
@return: Dict of stats.
"""
if self._mapFSpathDev is None:
self._initFilesystemInfo()
return self._diskStats.get(self._mapFSpathDev.get(fs)) | python | def getFilesystemStats(self, fs):
"""Returns I/O stats for filesystem.
@param fs: Filesystem path.
@return: Dict of stats.
"""
if self._mapFSpathDev is None:
self._initFilesystemInfo()
return self._diskStats.get(self._mapFSpathDev.get(fs)) | [
"def",
"getFilesystemStats",
"(",
"self",
",",
"fs",
")",
":",
"if",
"self",
".",
"_mapFSpathDev",
"is",
"None",
":",
"self",
".",
"_initFilesystemInfo",
"(",
")",
"return",
"self",
".",
"_diskStats",
".",
"get",
"(",
"self",
".",
"_mapFSpathDev",
".",
"... | Returns I/O stats for filesystem.
@param fs: Filesystem path.
@return: Dict of stats. | [
"Returns",
"I",
"/",
"O",
"stats",
"for",
"filesystem",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/diskio.py#L455-L464 | train |
aouyar/PyMunin | pymunin/plugins/ntphostoffset_.py | MuninNTPhostOffsetPlugin.retrieveVals | def retrieveVals(self):
"""Retrieve values for graphs."""
ntpinfo = NTPinfo()
stats = ntpinfo.getHostOffset(self._remoteHost)
if stats:
graph_name = 'ntp_host_stratum_%s' % self._remoteHost
if self.hasGraph(graph_name):
self.setGraphVal(graph_name,... | python | def retrieveVals(self):
"""Retrieve values for graphs."""
ntpinfo = NTPinfo()
stats = ntpinfo.getHostOffset(self._remoteHost)
if stats:
graph_name = 'ntp_host_stratum_%s' % self._remoteHost
if self.hasGraph(graph_name):
self.setGraphVal(graph_name,... | [
"def",
"retrieveVals",
"(",
"self",
")",
":",
"ntpinfo",
"=",
"NTPinfo",
"(",
")",
"stats",
"=",
"ntpinfo",
".",
"getHostOffset",
"(",
"self",
".",
"_remoteHost",
")",
"if",
"stats",
":",
"graph_name",
"=",
"'ntp_host_stratum_%s'",
"%",
"self",
".",
"_remo... | Retrieve values for graphs. | [
"Retrieve",
"values",
"for",
"graphs",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/ntphostoffset_.py#L105-L116 | train |
aouyar/PyMunin | pysysinfo/rackspace.py | CloudFilesInfo.getContainerStats | def getContainerStats(self, limit=None, marker=None):
"""Returns Rackspace Cloud Files usage stats for containers.
@param limit: Number of containers to return.
@param marker: Return only results whose name is greater than marker.
@return: Dictionary of container stats in... | python | def getContainerStats(self, limit=None, marker=None):
"""Returns Rackspace Cloud Files usage stats for containers.
@param limit: Number of containers to return.
@param marker: Return only results whose name is greater than marker.
@return: Dictionary of container stats in... | [
"def",
"getContainerStats",
"(",
"self",
",",
"limit",
"=",
"None",
",",
"marker",
"=",
"None",
")",
":",
"stats",
"=",
"{",
"}",
"for",
"row",
"in",
"self",
".",
"_conn",
".",
"list_containers_info",
"(",
"limit",
",",
"marker",
")",
":",
"stats",
"... | Returns Rackspace Cloud Files usage stats for containers.
@param limit: Number of containers to return.
@param marker: Return only results whose name is greater than marker.
@return: Dictionary of container stats indexed by container name. | [
"Returns",
"Rackspace",
"Cloud",
"Files",
"usage",
"stats",
"for",
"containers",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/rackspace.py#L58-L69 | train |
ContextLab/quail | quail/decode_speech.py | decode_speech | def decode_speech(path, keypath=None, save=False, speech_context=None,
sample_rate=44100, max_alternatives=1, language_code='en-US',
enable_word_time_offsets=True, return_raw=False):
"""
Decode speech for a file or folder and return results
This function wraps the Google... | python | def decode_speech(path, keypath=None, save=False, speech_context=None,
sample_rate=44100, max_alternatives=1, language_code='en-US',
enable_word_time_offsets=True, return_raw=False):
"""
Decode speech for a file or folder and return results
This function wraps the Google... | [
"def",
"decode_speech",
"(",
"path",
",",
"keypath",
"=",
"None",
",",
"save",
"=",
"False",
",",
"speech_context",
"=",
"None",
",",
"sample_rate",
"=",
"44100",
",",
"max_alternatives",
"=",
"1",
",",
"language_code",
"=",
"'en-US'",
",",
"enable_word_time... | Decode speech for a file or folder and return results
This function wraps the Google Speech API and ffmpeg to decode speech for
free recall experiments. Note: in order for this to work, you must have a
Google Speech account, a google speech credentials file referenced in your
_bash_profile, and ffmpeg... | [
"Decode",
"speech",
"for",
"a",
"file",
"or",
"folder",
"and",
"return",
"results"
] | 71dd53c792dd915dc84879d8237e3582dd68b7a4 | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/decode_speech.py#L24-L265 | train |
aouyar/PyMunin | pysysinfo/squid.py | parse_value | def parse_value(val):
"""Parse input string and return int, float or str depending on format.
@param val: Input string.
@return: Value of type int, float or str.
"""
mobj = re.match('(-{0,1}\d+)\s*(\sseconds|/\s*\w+)$', val)
if mobj:
return int(mobj.group(1))
m... | python | def parse_value(val):
"""Parse input string and return int, float or str depending on format.
@param val: Input string.
@return: Value of type int, float or str.
"""
mobj = re.match('(-{0,1}\d+)\s*(\sseconds|/\s*\w+)$', val)
if mobj:
return int(mobj.group(1))
m... | [
"def",
"parse_value",
"(",
"val",
")",
":",
"mobj",
"=",
"re",
".",
"match",
"(",
"'(-{0,1}\\d+)\\s*(\\sseconds|/\\s*\\w+)$'",
",",
"val",
")",
"if",
"mobj",
":",
"return",
"int",
"(",
"mobj",
".",
"group",
"(",
"1",
")",
")",
"mobj",
"=",
"re",
".",
... | Parse input string and return int, float or str depending on format.
@param val: Input string.
@return: Value of type int, float or str. | [
"Parse",
"input",
"string",
"and",
"return",
"int",
"float",
"or",
"str",
"depending",
"on",
"format",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/squid.py#L31-L51 | train |
aouyar/PyMunin | pysysinfo/squid.py | SquidInfo._connect | def _connect(self):
"""Connect to Squid Proxy Manager interface."""
if sys.version_info[:2] < (2,6):
self._conn = httplib.HTTPConnection(self._host, self._port)
else:
self._conn = httplib.HTTPConnection(self._host, self._port,
... | python | def _connect(self):
"""Connect to Squid Proxy Manager interface."""
if sys.version_info[:2] < (2,6):
self._conn = httplib.HTTPConnection(self._host, self._port)
else:
self._conn = httplib.HTTPConnection(self._host, self._port,
... | [
"def",
"_connect",
"(",
"self",
")",
":",
"if",
"sys",
".",
"version_info",
"[",
":",
"2",
"]",
"<",
"(",
"2",
",",
"6",
")",
":",
"self",
".",
"_conn",
"=",
"httplib",
".",
"HTTPConnection",
"(",
"self",
".",
"_host",
",",
"self",
".",
"_port",
... | Connect to Squid Proxy Manager interface. | [
"Connect",
"to",
"Squid",
"Proxy",
"Manager",
"interface",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/squid.py#L90-L96 | train |
aouyar/PyMunin | pysysinfo/squid.py | SquidInfo._retrieve | def _retrieve(self, map):
"""Query Squid Proxy Server Manager Interface for stats.
@param map: Statistics map name.
@return: Dictionary of query results.
"""
self._conn.request('GET', "cache_object://%s/%s" % (self._host, map),
Non... | python | def _retrieve(self, map):
"""Query Squid Proxy Server Manager Interface for stats.
@param map: Statistics map name.
@return: Dictionary of query results.
"""
self._conn.request('GET', "cache_object://%s/%s" % (self._host, map),
Non... | [
"def",
"_retrieve",
"(",
"self",
",",
"map",
")",
":",
"self",
".",
"_conn",
".",
"request",
"(",
"'GET'",
",",
"\"cache_object://%s/%s\"",
"%",
"(",
"self",
".",
"_host",
",",
"map",
")",
",",
"None",
",",
"self",
".",
"_httpHeaders",
")",
"rp",
"="... | Query Squid Proxy Server Manager Interface for stats.
@param map: Statistics map name.
@return: Dictionary of query results. | [
"Query",
"Squid",
"Proxy",
"Server",
"Manager",
"Interface",
"for",
"stats",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/squid.py#L98-L115 | train |
aouyar/PyMunin | pysysinfo/squid.py | SquidInfo._parseCounters | def _parseCounters(self, data):
"""Parse simple stats list of key, value pairs.
@param data: Multiline data with one key-value pair in each line.
@return: Dictionary of stats.
"""
info_dict = util.NestedDict()
for line in data.splitlines():
... | python | def _parseCounters(self, data):
"""Parse simple stats list of key, value pairs.
@param data: Multiline data with one key-value pair in each line.
@return: Dictionary of stats.
"""
info_dict = util.NestedDict()
for line in data.splitlines():
... | [
"def",
"_parseCounters",
"(",
"self",
",",
"data",
")",
":",
"info_dict",
"=",
"util",
".",
"NestedDict",
"(",
")",
"for",
"line",
"in",
"data",
".",
"splitlines",
"(",
")",
":",
"mobj",
"=",
"re",
".",
"match",
"(",
"'^\\s*([\\w\\.]+)\\s*=\\s*(\\S.*)$'",
... | Parse simple stats list of key, value pairs.
@param data: Multiline data with one key-value pair in each line.
@return: Dictionary of stats. | [
"Parse",
"simple",
"stats",
"list",
"of",
"key",
"value",
"pairs",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/squid.py#L117-L131 | train |
aouyar/PyMunin | pysysinfo/squid.py | SquidInfo._parseSections | def _parseSections(self, data):
"""Parse data and separate sections. Returns dictionary that maps
section name to section data.
@param data: Multiline data.
@return: Dictionary that maps section names to section data.
"""
section_dict = {}
l... | python | def _parseSections(self, data):
"""Parse data and separate sections. Returns dictionary that maps
section name to section data.
@param data: Multiline data.
@return: Dictionary that maps section names to section data.
"""
section_dict = {}
l... | [
"def",
"_parseSections",
"(",
"self",
",",
"data",
")",
":",
"section_dict",
"=",
"{",
"}",
"lines",
"=",
"data",
".",
"splitlines",
"(",
")",
"idx",
"=",
"0",
"numlines",
"=",
"len",
"(",
"lines",
")",
"section",
"=",
"None",
"while",
"idx",
"<",
... | Parse data and separate sections. Returns dictionary that maps
section name to section data.
@param data: Multiline data.
@return: Dictionary that maps section names to section data. | [
"Parse",
"data",
"and",
"separate",
"sections",
".",
"Returns",
"dictionary",
"that",
"maps",
"section",
"name",
"to",
"section",
"data",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/squid.py#L133-L168 | train |
aouyar/PyMunin | pysysinfo/squid.py | SquidInfo.getMenu | def getMenu(self):
"""Get manager interface section list from Squid Proxy Server
@return: List of tuples (section, description, type)
"""
data = self._retrieve('')
info_list = []
for line in data.splitlines():
mobj = re.match('^\s*(\S.*\S... | python | def getMenu(self):
"""Get manager interface section list from Squid Proxy Server
@return: List of tuples (section, description, type)
"""
data = self._retrieve('')
info_list = []
for line in data.splitlines():
mobj = re.match('^\s*(\S.*\S... | [
"def",
"getMenu",
"(",
"self",
")",
":",
"data",
"=",
"self",
".",
"_retrieve",
"(",
"''",
")",
"info_list",
"=",
"[",
"]",
"for",
"line",
"in",
"data",
".",
"splitlines",
"(",
")",
":",
"mobj",
"=",
"re",
".",
"match",
"(",
"'^\\s*(\\S.*\\S)\\s*\\t\... | Get manager interface section list from Squid Proxy Server
@return: List of tuples (section, description, type) | [
"Get",
"manager",
"interface",
"section",
"list",
"from",
"Squid",
"Proxy",
"Server"
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/squid.py#L170-L182 | train |
aouyar/PyMunin | pysysinfo/wanpipe.py | WanpipeInfo.getIfaceStats | def getIfaceStats(self):
"""Return dictionary of Traffic Stats for each Wanpipe Interface.
@return: Nested dictionary of statistics for each interface.
"""
ifInfo = netiface.NetIfaceInfo()
ifStats = ifInfo.getIfStats()
info_dict = {}
for ifname i... | python | def getIfaceStats(self):
"""Return dictionary of Traffic Stats for each Wanpipe Interface.
@return: Nested dictionary of statistics for each interface.
"""
ifInfo = netiface.NetIfaceInfo()
ifStats = ifInfo.getIfStats()
info_dict = {}
for ifname i... | [
"def",
"getIfaceStats",
"(",
"self",
")",
":",
"ifInfo",
"=",
"netiface",
".",
"NetIfaceInfo",
"(",
")",
"ifStats",
"=",
"ifInfo",
".",
"getIfStats",
"(",
")",
"info_dict",
"=",
"{",
"}",
"for",
"ifname",
"in",
"ifStats",
":",
"if",
"re",
".",
"match",... | Return dictionary of Traffic Stats for each Wanpipe Interface.
@return: Nested dictionary of statistics for each interface. | [
"Return",
"dictionary",
"of",
"Traffic",
"Stats",
"for",
"each",
"Wanpipe",
"Interface",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/wanpipe.py#L27-L39 | train |
aouyar/PyMunin | pysysinfo/wanpipe.py | WanpipeInfo.getPRIstats | def getPRIstats(self, iface):
"""Return RDSI Operational Stats for interface.
@param iface: Interface name. (Ex. w1g1)
@return: Nested dictionary of statistics for interface.
"""
info_dict = {}
output = util.exec_command([wanpipemonCmd, '-i', iface, '-c', ... | python | def getPRIstats(self, iface):
"""Return RDSI Operational Stats for interface.
@param iface: Interface name. (Ex. w1g1)
@return: Nested dictionary of statistics for interface.
"""
info_dict = {}
output = util.exec_command([wanpipemonCmd, '-i', iface, '-c', ... | [
"def",
"getPRIstats",
"(",
"self",
",",
"iface",
")",
":",
"info_dict",
"=",
"{",
"}",
"output",
"=",
"util",
".",
"exec_command",
"(",
"[",
"wanpipemonCmd",
",",
"'-i'",
",",
"iface",
",",
"'-c'",
",",
"'Ta'",
"]",
")",
"for",
"line",
"in",
"output"... | Return RDSI Operational Stats for interface.
@param iface: Interface name. (Ex. w1g1)
@return: Nested dictionary of statistics for interface. | [
"Return",
"RDSI",
"Operational",
"Stats",
"for",
"interface",
".",
"@param",
"iface",
":",
"Interface",
"name",
".",
"(",
"Ex",
".",
"w1g1",
")",
"@return",
":",
"Nested",
"dictionary",
"of",
"statistics",
"for",
"interface",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/wanpipe.py#L41-L62 | train |
aouyar/PyMunin | pysysinfo/freeswitch.py | FSinfo._connect | def _connect(self):
"""Connect to FreeSWITCH ESL Interface."""
try:
self._eslconn = ESL.ESLconnection(self._eslhost,
str(self._eslport),
self._eslpass)
except:
pass
if no... | python | def _connect(self):
"""Connect to FreeSWITCH ESL Interface."""
try:
self._eslconn = ESL.ESLconnection(self._eslhost,
str(self._eslport),
self._eslpass)
except:
pass
if no... | [
"def",
"_connect",
"(",
"self",
")",
":",
"try",
":",
"self",
".",
"_eslconn",
"=",
"ESL",
".",
"ESLconnection",
"(",
"self",
".",
"_eslhost",
",",
"str",
"(",
"self",
".",
"_eslport",
")",
",",
"self",
".",
"_eslpass",
")",
"except",
":",
"pass",
... | Connect to FreeSWITCH ESL Interface. | [
"Connect",
"to",
"FreeSWITCH",
"ESL",
"Interface",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/freeswitch.py#L60-L72 | train |
aouyar/PyMunin | pysysinfo/freeswitch.py | FSinfo._execCmd | def _execCmd(self, cmd, args):
"""Execute command and return result body as list of lines.
@param cmd: Command string.
@param args: Comand arguments string.
@return: Result dictionary.
"""
output = self._eslconn.api(cmd, args)
... | python | def _execCmd(self, cmd, args):
"""Execute command and return result body as list of lines.
@param cmd: Command string.
@param args: Comand arguments string.
@return: Result dictionary.
"""
output = self._eslconn.api(cmd, args)
... | [
"def",
"_execCmd",
"(",
"self",
",",
"cmd",
",",
"args",
")",
":",
"output",
"=",
"self",
".",
"_eslconn",
".",
"api",
"(",
"cmd",
",",
"args",
")",
"if",
"output",
":",
"body",
"=",
"output",
".",
"getBody",
"(",
")",
"if",
"body",
":",
"return"... | Execute command and return result body as list of lines.
@param cmd: Command string.
@param args: Comand arguments string.
@return: Result dictionary. | [
"Execute",
"command",
"and",
"return",
"result",
"body",
"as",
"list",
"of",
"lines",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/freeswitch.py#L74-L87 | train |
aouyar/PyMunin | pysysinfo/freeswitch.py | FSinfo._execShowCmd | def _execShowCmd(self, showcmd):
"""Execute 'show' command and return result dictionary.
@param cmd: Command string.
@return: Result dictionary.
"""
result = None
lines = self._execCmd("show", showcmd)
if lines and len(lines) >= 2 and... | python | def _execShowCmd(self, showcmd):
"""Execute 'show' command and return result dictionary.
@param cmd: Command string.
@return: Result dictionary.
"""
result = None
lines = self._execCmd("show", showcmd)
if lines and len(lines) >= 2 and... | [
"def",
"_execShowCmd",
"(",
"self",
",",
"showcmd",
")",
":",
"result",
"=",
"None",
"lines",
"=",
"self",
".",
"_execCmd",
"(",
"\"show\"",
",",
"showcmd",
")",
"if",
"lines",
"and",
"len",
"(",
"lines",
")",
">=",
"2",
"and",
"lines",
"[",
"0",
"... | Execute 'show' command and return result dictionary.
@param cmd: Command string.
@return: Result dictionary. | [
"Execute",
"show",
"command",
"and",
"return",
"result",
"dictionary",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/freeswitch.py#L89-L107 | train |
aouyar/PyMunin | pysysinfo/freeswitch.py | FSinfo._execShowCountCmd | def _execShowCountCmd(self, showcmd):
"""Execute 'show' command and return result dictionary.
@param cmd: Command string.
@return: Result dictionary.
"""
result = None
lines = self._execCmd("show", showcmd + " count")
for line in line... | python | def _execShowCountCmd(self, showcmd):
"""Execute 'show' command and return result dictionary.
@param cmd: Command string.
@return: Result dictionary.
"""
result = None
lines = self._execCmd("show", showcmd + " count")
for line in line... | [
"def",
"_execShowCountCmd",
"(",
"self",
",",
"showcmd",
")",
":",
"result",
"=",
"None",
"lines",
"=",
"self",
".",
"_execCmd",
"(",
"\"show\"",
",",
"showcmd",
"+",
"\" count\"",
")",
"for",
"line",
"in",
"lines",
":",
"mobj",
"=",
"re",
".",
"match"... | Execute 'show' command and return result dictionary.
@param cmd: Command string.
@return: Result dictionary. | [
"Execute",
"show",
"command",
"and",
"return",
"result",
"dictionary",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/freeswitch.py#L109-L122 | train |
aouyar/PyMunin | pymunin/plugins/asteriskstats.py | MuninAsteriskPlugin.retrieveVals | def retrieveVals(self):
"""Retrieve values for graphs."""
if self.hasGraph('asterisk_calls') or self.hasGraph('asterisk_channels'):
stats = self._ami.getChannelStats(self._chanList)
if self.hasGraph('asterisk_calls') and stats:
self.setGraphVal('asterisk_calls',... | python | def retrieveVals(self):
"""Retrieve values for graphs."""
if self.hasGraph('asterisk_calls') or self.hasGraph('asterisk_channels'):
stats = self._ami.getChannelStats(self._chanList)
if self.hasGraph('asterisk_calls') and stats:
self.setGraphVal('asterisk_calls',... | [
"def",
"retrieveVals",
"(",
"self",
")",
":",
"if",
"self",
".",
"hasGraph",
"(",
"'asterisk_calls'",
")",
"or",
"self",
".",
"hasGraph",
"(",
"'asterisk_channels'",
")",
":",
"stats",
"=",
"self",
".",
"_ami",
".",
"getChannelStats",
"(",
"self",
".",
"... | Retrieve values for graphs. | [
"Retrieve",
"values",
"for",
"graphs",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/asteriskstats.py#L309-L426 | train |
aouyar/PyMunin | pymunin/plugins/phpfpmstats.py | MuninPHPfpmPlugin.retrieveVals | def retrieveVals(self):
"""Retrieve values for graphs."""
fpminfo = PHPfpmInfo(self._host, self._port, self._user, self._password,
self._monpath, self._ssl)
stats = fpminfo.getStats()
if self.hasGraph('php_fpm_connections') and stats:
self.setGr... | python | def retrieveVals(self):
"""Retrieve values for graphs."""
fpminfo = PHPfpmInfo(self._host, self._port, self._user, self._password,
self._monpath, self._ssl)
stats = fpminfo.getStats()
if self.hasGraph('php_fpm_connections') and stats:
self.setGr... | [
"def",
"retrieveVals",
"(",
"self",
")",
":",
"fpminfo",
"=",
"PHPfpmInfo",
"(",
"self",
".",
"_host",
",",
"self",
".",
"_port",
",",
"self",
".",
"_user",
",",
"self",
".",
"_password",
",",
"self",
".",
"_monpath",
",",
"self",
".",
"_ssl",
")",
... | Retrieve values for graphs. | [
"Retrieve",
"values",
"for",
"graphs",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/phpfpmstats.py#L111-L125 | train |
aouyar/PyMunin | pymunin/plugins/phpfpmstats.py | MuninPHPfpmPlugin.autoconf | def autoconf(self):
"""Implements Munin Plugin Auto-Configuration Option.
@return: True if plugin can be auto-configured, False otherwise.
"""
fpminfo = PHPfpmInfo(self._host, self._port, self._user, self._password,
self._monpath,... | python | def autoconf(self):
"""Implements Munin Plugin Auto-Configuration Option.
@return: True if plugin can be auto-configured, False otherwise.
"""
fpminfo = PHPfpmInfo(self._host, self._port, self._user, self._password,
self._monpath,... | [
"def",
"autoconf",
"(",
"self",
")",
":",
"fpminfo",
"=",
"PHPfpmInfo",
"(",
"self",
".",
"_host",
",",
"self",
".",
"_port",
",",
"self",
".",
"_user",
",",
"self",
".",
"_password",
",",
"self",
".",
"_monpath",
",",
"self",
".",
"_ssl",
")",
"re... | Implements Munin Plugin Auto-Configuration Option.
@return: True if plugin can be auto-configured, False otherwise. | [
"Implements",
"Munin",
"Plugin",
"Auto",
"-",
"Configuration",
"Option",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/phpfpmstats.py#L127-L135 | train |
aouyar/PyMunin | pysysinfo/redisdb.py | RedisInfo.ping | def ping(self):
"""Ping Redis Server and return Round-Trip-Time in seconds.
@return: Round-trip-time in seconds as float.
"""
start = time.time()
self._conn.ping()
return (time.time() - start) | python | def ping(self):
"""Ping Redis Server and return Round-Trip-Time in seconds.
@return: Round-trip-time in seconds as float.
"""
start = time.time()
self._conn.ping()
return (time.time() - start) | [
"def",
"ping",
"(",
"self",
")",
":",
"start",
"=",
"time",
".",
"time",
"(",
")",
"self",
".",
"_conn",
".",
"ping",
"(",
")",
"return",
"(",
"time",
".",
"time",
"(",
")",
"-",
"start",
")"
] | Ping Redis Server and return Round-Trip-Time in seconds.
@return: Round-trip-time in seconds as float. | [
"Ping",
"Redis",
"Server",
"and",
"return",
"Round",
"-",
"Trip",
"-",
"Time",
"in",
"seconds",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/redisdb.py#L49-L57 | train |
ContextLab/quail | quail/helpers.py | list2pd | def list2pd(all_data, subjindex=None, listindex=None):
"""
Makes multi-indexed dataframe of subject data
Parameters
----------
all_data : list of lists of strings
strings are either all presented or all recalled items, in the order of presentation or recall
*should also work for pre... | python | def list2pd(all_data, subjindex=None, listindex=None):
"""
Makes multi-indexed dataframe of subject data
Parameters
----------
all_data : list of lists of strings
strings are either all presented or all recalled items, in the order of presentation or recall
*should also work for pre... | [
"def",
"list2pd",
"(",
"all_data",
",",
"subjindex",
"=",
"None",
",",
"listindex",
"=",
"None",
")",
":",
"# set default index if it is not defined",
"# max_nlists = max(map(lambda x: len(x), all_data))",
"listindex",
"=",
"[",
"[",
"idx",
"for",
"idx",
"in",
"range"... | Makes multi-indexed dataframe of subject data
Parameters
----------
all_data : list of lists of strings
strings are either all presented or all recalled items, in the order of presentation or recall
*should also work for presented / recalled ints and floats, if desired
Returns
---... | [
"Makes",
"multi",
"-",
"indexed",
"dataframe",
"of",
"subject",
"data"
] | 71dd53c792dd915dc84879d8237e3582dd68b7a4 | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/helpers.py#L11-L43 | train |
ContextLab/quail | quail/helpers.py | recmat2egg | def recmat2egg(recmat, list_length=None):
"""
Creates egg data object from zero-indexed recall matrix
Parameters
----------
recmat : list of lists (subs) of lists (encoding lists) of ints or 2D numpy array
recall matrix representing serial positions of freely recalle... | python | def recmat2egg(recmat, list_length=None):
"""
Creates egg data object from zero-indexed recall matrix
Parameters
----------
recmat : list of lists (subs) of lists (encoding lists) of ints or 2D numpy array
recall matrix representing serial positions of freely recalle... | [
"def",
"recmat2egg",
"(",
"recmat",
",",
"list_length",
"=",
"None",
")",
":",
"from",
".",
"egg",
"import",
"Egg",
"as",
"Egg",
"pres",
"=",
"[",
"[",
"[",
"str",
"(",
"word",
")",
"for",
"word",
"in",
"list",
"(",
"range",
"(",
"0",
",",
"list_... | Creates egg data object from zero-indexed recall matrix
Parameters
----------
recmat : list of lists (subs) of lists (encoding lists) of ints or 2D numpy array
recall matrix representing serial positions of freely recalled words \
e.g. [[[16, 15, 0, 2, 3, None, None...],... | [
"Creates",
"egg",
"data",
"object",
"from",
"zero",
"-",
"indexed",
"recall",
"matrix"
] | 71dd53c792dd915dc84879d8237e3582dd68b7a4 | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/helpers.py#L72-L96 | train |
ContextLab/quail | quail/helpers.py | default_dist_funcs | def default_dist_funcs(dist_funcs, feature_example):
"""
Fills in default distance metrics for fingerprint analyses
"""
if dist_funcs is None:
dist_funcs = dict()
for key in feature_example:
if key in dist_funcs:
pass
if key =... | python | def default_dist_funcs(dist_funcs, feature_example):
"""
Fills in default distance metrics for fingerprint analyses
"""
if dist_funcs is None:
dist_funcs = dict()
for key in feature_example:
if key in dist_funcs:
pass
if key =... | [
"def",
"default_dist_funcs",
"(",
"dist_funcs",
",",
"feature_example",
")",
":",
"if",
"dist_funcs",
"is",
"None",
":",
"dist_funcs",
"=",
"dict",
"(",
")",
"for",
"key",
"in",
"feature_example",
":",
"if",
"key",
"in",
"dist_funcs",
":",
"pass",
"if",
"k... | Fills in default distance metrics for fingerprint analyses | [
"Fills",
"in",
"default",
"distance",
"metrics",
"for",
"fingerprint",
"analyses"
] | 71dd53c792dd915dc84879d8237e3582dd68b7a4 | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/helpers.py#L98-L116 | train |
ContextLab/quail | quail/helpers.py | stack_eggs | def stack_eggs(eggs, meta='concatenate'):
'''
Takes a list of eggs, stacks them and reindexes the subject number
Parameters
----------
eggs : list of Egg data objects
A list of Eggs that you want to combine
meta : string
Determines how the meta data of each Egg combines. Default... | python | def stack_eggs(eggs, meta='concatenate'):
'''
Takes a list of eggs, stacks them and reindexes the subject number
Parameters
----------
eggs : list of Egg data objects
A list of Eggs that you want to combine
meta : string
Determines how the meta data of each Egg combines. Default... | [
"def",
"stack_eggs",
"(",
"eggs",
",",
"meta",
"=",
"'concatenate'",
")",
":",
"from",
".",
"egg",
"import",
"Egg",
"pres",
"=",
"[",
"egg",
".",
"pres",
".",
"loc",
"[",
"sub",
",",
":",
"]",
".",
"values",
".",
"tolist",
"(",
")",
"for",
"egg",... | Takes a list of eggs, stacks them and reindexes the subject number
Parameters
----------
eggs : list of Egg data objects
A list of Eggs that you want to combine
meta : string
Determines how the meta data of each Egg combines. Default is 'concatenate'
'concatenate' concatenates k... | [
"Takes",
"a",
"list",
"of",
"eggs",
"stacks",
"them",
"and",
"reindexes",
"the",
"subject",
"number"
] | 71dd53c792dd915dc84879d8237e3582dd68b7a4 | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/helpers.py#L118-L156 | train |
ContextLab/quail | quail/helpers.py | crack_egg | def crack_egg(egg, subjects=None, lists=None):
'''
Takes an egg and returns a subset of the subjects or lists
Parameters
----------
egg : Egg data object
Egg that you want to crack
subjects : list
List of subject idxs
lists : list
List of lists idxs
Returns
... | python | def crack_egg(egg, subjects=None, lists=None):
'''
Takes an egg and returns a subset of the subjects or lists
Parameters
----------
egg : Egg data object
Egg that you want to crack
subjects : list
List of subject idxs
lists : list
List of lists idxs
Returns
... | [
"def",
"crack_egg",
"(",
"egg",
",",
"subjects",
"=",
"None",
",",
"lists",
"=",
"None",
")",
":",
"from",
".",
"egg",
"import",
"Egg",
"if",
"hasattr",
"(",
"egg",
",",
"'features'",
")",
":",
"all_have_features",
"=",
"egg",
".",
"features",
"is",
... | Takes an egg and returns a subset of the subjects or lists
Parameters
----------
egg : Egg data object
Egg that you want to crack
subjects : list
List of subject idxs
lists : list
List of lists idxs
Returns
----------
new_egg : Egg data object
A sliced... | [
"Takes",
"an",
"egg",
"and",
"returns",
"a",
"subset",
"of",
"the",
"subjects",
"or",
"lists"
] | 71dd53c792dd915dc84879d8237e3582dd68b7a4 | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/helpers.py#L158-L208 | train |
ContextLab/quail | quail/helpers.py | df2list | def df2list(df):
"""
Convert a MultiIndex df to list
Parameters
----------
df : pandas.DataFrame
A MultiIndex DataFrame where the first level is subjects and the second
level is lists (e.g. egg.pres)
Returns
----------
lst : a list of lists of lists of values
... | python | def df2list(df):
"""
Convert a MultiIndex df to list
Parameters
----------
df : pandas.DataFrame
A MultiIndex DataFrame where the first level is subjects and the second
level is lists (e.g. egg.pres)
Returns
----------
lst : a list of lists of lists of values
... | [
"def",
"df2list",
"(",
"df",
")",
":",
"subjects",
"=",
"df",
".",
"index",
".",
"levels",
"[",
"0",
"]",
".",
"values",
".",
"tolist",
"(",
")",
"lists",
"=",
"df",
".",
"index",
".",
"levels",
"[",
"1",
"]",
".",
"values",
".",
"tolist",
"(",... | Convert a MultiIndex df to list
Parameters
----------
df : pandas.DataFrame
A MultiIndex DataFrame where the first level is subjects and the second
level is lists (e.g. egg.pres)
Returns
----------
lst : a list of lists of lists of values
The input df reformatted as a... | [
"Convert",
"a",
"MultiIndex",
"df",
"to",
"list"
] | 71dd53c792dd915dc84879d8237e3582dd68b7a4 | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/helpers.py#L210-L233 | train |
ContextLab/quail | quail/helpers.py | fill_missing | def fill_missing(x):
"""
Fills in missing lists (assumes end lists are missing)
"""
# find subject with max number of lists
maxlen = max([len(xi) for xi in x])
subs = []
for sub in x:
if len(sub)<maxlen:
for i in range(maxlen-len(sub)):
sub.append([])
... | python | def fill_missing(x):
"""
Fills in missing lists (assumes end lists are missing)
"""
# find subject with max number of lists
maxlen = max([len(xi) for xi in x])
subs = []
for sub in x:
if len(sub)<maxlen:
for i in range(maxlen-len(sub)):
sub.append([])
... | [
"def",
"fill_missing",
"(",
"x",
")",
":",
"# find subject with max number of lists",
"maxlen",
"=",
"max",
"(",
"[",
"len",
"(",
"xi",
")",
"for",
"xi",
"in",
"x",
"]",
")",
"subs",
"=",
"[",
"]",
"for",
"sub",
"in",
"x",
":",
"if",
"len",
"(",
"s... | Fills in missing lists (assumes end lists are missing) | [
"Fills",
"in",
"missing",
"lists",
"(",
"assumes",
"end",
"lists",
"are",
"missing",
")"
] | 71dd53c792dd915dc84879d8237e3582dd68b7a4 | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/helpers.py#L235-L253 | train |
ContextLab/quail | quail/helpers.py | parse_egg | def parse_egg(egg):
"""Parses an egg and returns fields"""
pres_list = egg.get_pres_items().values[0]
rec_list = egg.get_rec_items().values[0]
feature_list = egg.get_pres_features().values[0]
dist_funcs = egg.dist_funcs
return pres_list, rec_list, feature_list, dist_funcs | python | def parse_egg(egg):
"""Parses an egg and returns fields"""
pres_list = egg.get_pres_items().values[0]
rec_list = egg.get_rec_items().values[0]
feature_list = egg.get_pres_features().values[0]
dist_funcs = egg.dist_funcs
return pres_list, rec_list, feature_list, dist_funcs | [
"def",
"parse_egg",
"(",
"egg",
")",
":",
"pres_list",
"=",
"egg",
".",
"get_pres_items",
"(",
")",
".",
"values",
"[",
"0",
"]",
"rec_list",
"=",
"egg",
".",
"get_rec_items",
"(",
")",
".",
"values",
"[",
"0",
"]",
"feature_list",
"=",
"egg",
".",
... | Parses an egg and returns fields | [
"Parses",
"an",
"egg",
"and",
"returns",
"fields"
] | 71dd53c792dd915dc84879d8237e3582dd68b7a4 | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/helpers.py#L255-L261 | train |
ContextLab/quail | quail/helpers.py | merge_pres_feats | def merge_pres_feats(pres, features):
"""
Helper function to merge pres and features to support legacy features argument
"""
sub = []
for psub, fsub in zip(pres, features):
exp = []
for pexp, fexp in zip(psub, fsub):
lst = []
for p, f in zip(pexp, fexp):
... | python | def merge_pres_feats(pres, features):
"""
Helper function to merge pres and features to support legacy features argument
"""
sub = []
for psub, fsub in zip(pres, features):
exp = []
for pexp, fexp in zip(psub, fsub):
lst = []
for p, f in zip(pexp, fexp):
... | [
"def",
"merge_pres_feats",
"(",
"pres",
",",
"features",
")",
":",
"sub",
"=",
"[",
"]",
"for",
"psub",
",",
"fsub",
"in",
"zip",
"(",
"pres",
",",
"features",
")",
":",
"exp",
"=",
"[",
"]",
"for",
"pexp",
",",
"fexp",
"in",
"zip",
"(",
"psub",
... | Helper function to merge pres and features to support legacy features argument | [
"Helper",
"function",
"to",
"merge",
"pres",
"and",
"features",
"to",
"support",
"legacy",
"features",
"argument"
] | 71dd53c792dd915dc84879d8237e3582dd68b7a4 | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/helpers.py#L263-L278 | train |
ContextLab/quail | quail/helpers.py | r2z | def r2z(r):
"""
Function that calculates the Fisher z-transformation
Parameters
----------
r : int or ndarray
Correlation value
Returns
----------
result : int or ndarray
Fishers z transformed correlation value
"""
with np.errstate(invalid='ignore', divide='ig... | python | def r2z(r):
"""
Function that calculates the Fisher z-transformation
Parameters
----------
r : int or ndarray
Correlation value
Returns
----------
result : int or ndarray
Fishers z transformed correlation value
"""
with np.errstate(invalid='ignore', divide='ig... | [
"def",
"r2z",
"(",
"r",
")",
":",
"with",
"np",
".",
"errstate",
"(",
"invalid",
"=",
"'ignore'",
",",
"divide",
"=",
"'ignore'",
")",
":",
"return",
"0.5",
"*",
"(",
"np",
".",
"log",
"(",
"1",
"+",
"r",
")",
"-",
"np",
".",
"log",
"(",
"1",... | Function that calculates the Fisher z-transformation
Parameters
----------
r : int or ndarray
Correlation value
Returns
----------
result : int or ndarray
Fishers z transformed correlation value | [
"Function",
"that",
"calculates",
"the",
"Fisher",
"z",
"-",
"transformation"
] | 71dd53c792dd915dc84879d8237e3582dd68b7a4 | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/helpers.py#L287-L304 | train |
ContextLab/quail | quail/helpers.py | z2r | def z2r(z):
"""
Function that calculates the inverse Fisher z-transformation
Parameters
----------
z : int or ndarray
Fishers z transformed correlation value
Returns
----------
result : int or ndarray
Correlation value
"""
with np.errstate(invalid='ignore', di... | python | def z2r(z):
"""
Function that calculates the inverse Fisher z-transformation
Parameters
----------
z : int or ndarray
Fishers z transformed correlation value
Returns
----------
result : int or ndarray
Correlation value
"""
with np.errstate(invalid='ignore', di... | [
"def",
"z2r",
"(",
"z",
")",
":",
"with",
"np",
".",
"errstate",
"(",
"invalid",
"=",
"'ignore'",
",",
"divide",
"=",
"'ignore'",
")",
":",
"return",
"(",
"np",
".",
"exp",
"(",
"2",
"*",
"z",
")",
"-",
"1",
")",
"/",
"(",
"np",
".",
"exp",
... | Function that calculates the inverse Fisher z-transformation
Parameters
----------
z : int or ndarray
Fishers z transformed correlation value
Returns
----------
result : int or ndarray
Correlation value | [
"Function",
"that",
"calculates",
"the",
"inverse",
"Fisher",
"z",
"-",
"transformation"
] | 71dd53c792dd915dc84879d8237e3582dd68b7a4 | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/helpers.py#L306-L323 | train |
ContextLab/quail | quail/helpers.py | shuffle_egg | def shuffle_egg(egg):
""" Shuffle an Egg's recalls"""
from .egg import Egg
pres, rec, features, dist_funcs = parse_egg(egg)
if pres.ndim==1:
pres = pres.reshape(1, pres.shape[0])
rec = rec.reshape(1, rec.shape[0])
features = features.reshape(1, features.shape[0])
for ilist ... | python | def shuffle_egg(egg):
""" Shuffle an Egg's recalls"""
from .egg import Egg
pres, rec, features, dist_funcs = parse_egg(egg)
if pres.ndim==1:
pres = pres.reshape(1, pres.shape[0])
rec = rec.reshape(1, rec.shape[0])
features = features.reshape(1, features.shape[0])
for ilist ... | [
"def",
"shuffle_egg",
"(",
"egg",
")",
":",
"from",
".",
"egg",
"import",
"Egg",
"pres",
",",
"rec",
",",
"features",
",",
"dist_funcs",
"=",
"parse_egg",
"(",
"egg",
")",
"if",
"pres",
".",
"ndim",
"==",
"1",
":",
"pres",
"=",
"pres",
".",
"reshap... | Shuffle an Egg's recalls | [
"Shuffle",
"an",
"Egg",
"s",
"recalls"
] | 71dd53c792dd915dc84879d8237e3582dd68b7a4 | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/helpers.py#L335-L349 | train |
aouyar/PyMunin | pymunin/plugins/netifacestats.py | MuninNetIfacePlugin.retrieveVals | def retrieveVals(self):
"""Retrieve values for graphs."""
for iface in self._ifaceList:
stats = self._ifaceStats.get(iface)
graph_name = 'netiface_traffic_%s' % iface
if self.hasGraph(graph_name):
self.setGraphVal(graph_name, 'rx', stats.get('rxbytes')... | python | def retrieveVals(self):
"""Retrieve values for graphs."""
for iface in self._ifaceList:
stats = self._ifaceStats.get(iface)
graph_name = 'netiface_traffic_%s' % iface
if self.hasGraph(graph_name):
self.setGraphVal(graph_name, 'rx', stats.get('rxbytes')... | [
"def",
"retrieveVals",
"(",
"self",
")",
":",
"for",
"iface",
"in",
"self",
".",
"_ifaceList",
":",
"stats",
"=",
"self",
".",
"_ifaceStats",
".",
"get",
"(",
"iface",
")",
"graph_name",
"=",
"'netiface_traffic_%s'",
"%",
"iface",
"if",
"self",
".",
"has... | Retrieve values for graphs. | [
"Retrieve",
"values",
"for",
"graphs",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/netifacestats.py#L122-L134 | train |
aouyar/PyMunin | pysysinfo/ntp.py | NTPinfo.getPeerStats | def getPeerStats(self):
"""Get NTP Peer Stats for localhost by querying local NTP Server.
@return: Dictionary of NTP stats converted to seconds.
"""
info_dict = {}
output = util.exec_command([ntpqCmd, '-n', '-c', 'peers'])
for line in output.splitlines():
... | python | def getPeerStats(self):
"""Get NTP Peer Stats for localhost by querying local NTP Server.
@return: Dictionary of NTP stats converted to seconds.
"""
info_dict = {}
output = util.exec_command([ntpqCmd, '-n', '-c', 'peers'])
for line in output.splitlines():
... | [
"def",
"getPeerStats",
"(",
"self",
")",
":",
"info_dict",
"=",
"{",
"}",
"output",
"=",
"util",
".",
"exec_command",
"(",
"[",
"ntpqCmd",
",",
"'-n'",
",",
"'-c'",
",",
"'peers'",
"]",
")",
"for",
"line",
"in",
"output",
".",
"splitlines",
"(",
")",... | Get NTP Peer Stats for localhost by querying local NTP Server.
@return: Dictionary of NTP stats converted to seconds. | [
"Get",
"NTP",
"Peer",
"Stats",
"for",
"localhost",
"by",
"querying",
"local",
"NTP",
"Server",
".",
"@return",
":",
"Dictionary",
"of",
"NTP",
"stats",
"converted",
"to",
"seconds",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/ntp.py#L29-L49 | train |
aouyar/PyMunin | pysysinfo/ntp.py | NTPinfo.getHostOffset | def getHostOffset(self, host):
"""Get NTP Stats and offset of remote host relative to localhost
by querying NTP Server on remote host.
@param host: Remote Host IP.
@return: Dictionary of NTP stats converted to seconds.
"""
info_dict = {}
output = uti... | python | def getHostOffset(self, host):
"""Get NTP Stats and offset of remote host relative to localhost
by querying NTP Server on remote host.
@param host: Remote Host IP.
@return: Dictionary of NTP stats converted to seconds.
"""
info_dict = {}
output = uti... | [
"def",
"getHostOffset",
"(",
"self",
",",
"host",
")",
":",
"info_dict",
"=",
"{",
"}",
"output",
"=",
"util",
".",
"exec_command",
"(",
"[",
"ntpdateCmd",
",",
"'-u'",
",",
"'-q'",
",",
"host",
"]",
")",
"for",
"line",
"in",
"output",
".",
"splitlin... | Get NTP Stats and offset of remote host relative to localhost
by querying NTP Server on remote host.
@param host: Remote Host IP.
@return: Dictionary of NTP stats converted to seconds. | [
"Get",
"NTP",
"Stats",
"and",
"offset",
"of",
"remote",
"host",
"relative",
"to",
"localhost",
"by",
"querying",
"NTP",
"Server",
"on",
"remote",
"host",
".",
"@param",
"host",
":",
"Remote",
"Host",
"IP",
".",
"@return",
":",
"Dictionary",
"of",
"NTP",
... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/ntp.py#L51-L70 | train |
aouyar/PyMunin | pysysinfo/ntp.py | NTPinfo.getHostOffsets | def getHostOffsets(self, hosts):
"""Get NTP Stats and offset of multiple remote hosts relative to localhost
by querying NTP Servers on remote hosts.
@param host: List of Remote Host IPs.
@return: Dictionary of NTP stats converted to seconds.
"""
info_dict = ... | python | def getHostOffsets(self, hosts):
"""Get NTP Stats and offset of multiple remote hosts relative to localhost
by querying NTP Servers on remote hosts.
@param host: List of Remote Host IPs.
@return: Dictionary of NTP stats converted to seconds.
"""
info_dict = ... | [
"def",
"getHostOffsets",
"(",
"self",
",",
"hosts",
")",
":",
"info_dict",
"=",
"{",
"}",
"output",
"=",
"util",
".",
"exec_command",
"(",
"[",
"ntpdateCmd",
",",
"'-u'",
",",
"'-q'",
"]",
"+",
"list",
"(",
"hosts",
")",
")",
"for",
"line",
"in",
"... | Get NTP Stats and offset of multiple remote hosts relative to localhost
by querying NTP Servers on remote hosts.
@param host: List of Remote Host IPs.
@return: Dictionary of NTP stats converted to seconds. | [
"Get",
"NTP",
"Stats",
"and",
"offset",
"of",
"multiple",
"remote",
"hosts",
"relative",
"to",
"localhost",
"by",
"querying",
"NTP",
"Servers",
"on",
"remote",
"hosts",
".",
"@param",
"host",
":",
"List",
"of",
"Remote",
"Host",
"IPs",
".",
"@return",
":",... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/ntp.py#L72-L93 | train |
aouyar/PyMunin | pysysinfo/system.py | SystemInfo.getUptime | def getUptime(self):
"""Return system uptime in seconds.
@return: Float that represents uptime in seconds.
"""
try:
fp = open(uptimeFile, 'r')
line = fp.readline()
fp.close()
except:
raise IOError('Failed reading s... | python | def getUptime(self):
"""Return system uptime in seconds.
@return: Float that represents uptime in seconds.
"""
try:
fp = open(uptimeFile, 'r')
line = fp.readline()
fp.close()
except:
raise IOError('Failed reading s... | [
"def",
"getUptime",
"(",
"self",
")",
":",
"try",
":",
"fp",
"=",
"open",
"(",
"uptimeFile",
",",
"'r'",
")",
"line",
"=",
"fp",
".",
"readline",
"(",
")",
"fp",
".",
"close",
"(",
")",
"except",
":",
"raise",
"IOError",
"(",
"'Failed reading stats f... | Return system uptime in seconds.
@return: Float that represents uptime in seconds. | [
"Return",
"system",
"uptime",
"in",
"seconds",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/system.py#L46-L58 | train |
aouyar/PyMunin | pysysinfo/system.py | SystemInfo.getLoadAvg | def getLoadAvg(self):
"""Return system Load Average.
@return: List of 1 min, 5 min and 15 min Load Average figures.
"""
try:
fp = open(loadavgFile, 'r')
line = fp.readline()
fp.close()
except:
raise IOError('Failed... | python | def getLoadAvg(self):
"""Return system Load Average.
@return: List of 1 min, 5 min and 15 min Load Average figures.
"""
try:
fp = open(loadavgFile, 'r')
line = fp.readline()
fp.close()
except:
raise IOError('Failed... | [
"def",
"getLoadAvg",
"(",
"self",
")",
":",
"try",
":",
"fp",
"=",
"open",
"(",
"loadavgFile",
",",
"'r'",
")",
"line",
"=",
"fp",
".",
"readline",
"(",
")",
"fp",
".",
"close",
"(",
")",
"except",
":",
"raise",
"IOError",
"(",
"'Failed reading stats... | Return system Load Average.
@return: List of 1 min, 5 min and 15 min Load Average figures. | [
"Return",
"system",
"Load",
"Average",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/system.py#L60-L76 | train |
aouyar/PyMunin | pysysinfo/system.py | SystemInfo.getCPUuse | def getCPUuse(self):
"""Return cpu time utilization in seconds.
@return: Dictionary of stats.
"""
hz = os.sysconf('SC_CLK_TCK')
info_dict = {}
try:
fp = open(cpustatFile, 'r')
line = fp.readline()
fp.close()
ex... | python | def getCPUuse(self):
"""Return cpu time utilization in seconds.
@return: Dictionary of stats.
"""
hz = os.sysconf('SC_CLK_TCK')
info_dict = {}
try:
fp = open(cpustatFile, 'r')
line = fp.readline()
fp.close()
ex... | [
"def",
"getCPUuse",
"(",
"self",
")",
":",
"hz",
"=",
"os",
".",
"sysconf",
"(",
"'SC_CLK_TCK'",
")",
"info_dict",
"=",
"{",
"}",
"try",
":",
"fp",
"=",
"open",
"(",
"cpustatFile",
",",
"'r'",
")",
"line",
"=",
"fp",
".",
"readline",
"(",
")",
"f... | Return cpu time utilization in seconds.
@return: Dictionary of stats. | [
"Return",
"cpu",
"time",
"utilization",
"in",
"seconds",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/system.py#L78-L96 | train |
aouyar/PyMunin | pysysinfo/system.py | SystemInfo.getProcessStats | def getProcessStats(self):
"""Return stats for running and blocked processes, forks,
context switches and interrupts.
@return: Dictionary of stats.
"""
info_dict = {}
try:
fp = open(cpustatFile, 'r')
data = fp.read()
... | python | def getProcessStats(self):
"""Return stats for running and blocked processes, forks,
context switches and interrupts.
@return: Dictionary of stats.
"""
info_dict = {}
try:
fp = open(cpustatFile, 'r')
data = fp.read()
... | [
"def",
"getProcessStats",
"(",
"self",
")",
":",
"info_dict",
"=",
"{",
"}",
"try",
":",
"fp",
"=",
"open",
"(",
"cpustatFile",
",",
"'r'",
")",
"data",
"=",
"fp",
".",
"read",
"(",
")",
"fp",
".",
"close",
"(",
")",
"except",
":",
"raise",
"IOEr... | Return stats for running and blocked processes, forks,
context switches and interrupts.
@return: Dictionary of stats. | [
"Return",
"stats",
"for",
"running",
"and",
"blocked",
"processes",
"forks",
"context",
"switches",
"and",
"interrupts",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/system.py#L98-L118 | train |
aouyar/PyMunin | pysysinfo/system.py | SystemInfo.getMemoryUse | def getMemoryUse(self):
"""Return stats for memory utilization.
@return: Dictionary of stats.
"""
info_dict = {}
try:
fp = open(meminfoFile, 'r')
data = fp.read()
fp.close()
except:
raise IOError('Failed re... | python | def getMemoryUse(self):
"""Return stats for memory utilization.
@return: Dictionary of stats.
"""
info_dict = {}
try:
fp = open(meminfoFile, 'r')
data = fp.read()
fp.close()
except:
raise IOError('Failed re... | [
"def",
"getMemoryUse",
"(",
"self",
")",
":",
"info_dict",
"=",
"{",
"}",
"try",
":",
"fp",
"=",
"open",
"(",
"meminfoFile",
",",
"'r'",
")",
"data",
"=",
"fp",
".",
"read",
"(",
")",
"fp",
".",
"close",
"(",
")",
"except",
":",
"raise",
"IOError... | Return stats for memory utilization.
@return: Dictionary of stats. | [
"Return",
"stats",
"for",
"memory",
"utilization",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/system.py#L120-L141 | train |
aouyar/PyMunin | pysysinfo/system.py | SystemInfo.getSwapStats | def getSwapStats(self):
"""Return information on swap partition and / or files.
@return: Dictionary of stats.
"""
info_dict = {}
try:
fp = open(swapsFile, 'r')
data = fp.read()
fp.close()
except:
ra... | python | def getSwapStats(self):
"""Return information on swap partition and / or files.
@return: Dictionary of stats.
"""
info_dict = {}
try:
fp = open(swapsFile, 'r')
data = fp.read()
fp.close()
except:
ra... | [
"def",
"getSwapStats",
"(",
"self",
")",
":",
"info_dict",
"=",
"{",
"}",
"try",
":",
"fp",
"=",
"open",
"(",
"swapsFile",
",",
"'r'",
")",
"data",
"=",
"fp",
".",
"read",
"(",
")",
"fp",
".",
"close",
"(",
")",
"except",
":",
"raise",
"IOError",... | Return information on swap partition and / or files.
@return: Dictionary of stats. | [
"Return",
"information",
"on",
"swap",
"partition",
"and",
"/",
"or",
"files",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/system.py#L143-L162 | train |
aouyar/PyMunin | pysysinfo/system.py | SystemInfo.getVMstats | def getVMstats(self):
"""Return stats for Virtual Memory Subsystem.
@return: Dictionary of stats.
"""
info_dict = {}
try:
fp = open(vmstatFile, 'r')
data = fp.read()
fp.close()
except:
raise IOError('Failed... | python | def getVMstats(self):
"""Return stats for Virtual Memory Subsystem.
@return: Dictionary of stats.
"""
info_dict = {}
try:
fp = open(vmstatFile, 'r')
data = fp.read()
fp.close()
except:
raise IOError('Failed... | [
"def",
"getVMstats",
"(",
"self",
")",
":",
"info_dict",
"=",
"{",
"}",
"try",
":",
"fp",
"=",
"open",
"(",
"vmstatFile",
",",
"'r'",
")",
"data",
"=",
"fp",
".",
"read",
"(",
")",
"fp",
".",
"close",
"(",
")",
"except",
":",
"raise",
"IOError",
... | Return stats for Virtual Memory Subsystem.
@return: Dictionary of stats. | [
"Return",
"stats",
"for",
"Virtual",
"Memory",
"Subsystem",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/system.py#L164-L181 | train |
aouyar/PyMunin | pysysinfo/memcached.py | MemcachedInfo._connect | def _connect(self):
"""Connect to Memcached."""
if self._socketFile is not None:
if not os.path.exists(self._socketFile):
raise Exception("Socket file (%s) for Memcached Instance not found."
% self._socketFile)
try:
if self.... | python | def _connect(self):
"""Connect to Memcached."""
if self._socketFile is not None:
if not os.path.exists(self._socketFile):
raise Exception("Socket file (%s) for Memcached Instance not found."
% self._socketFile)
try:
if self.... | [
"def",
"_connect",
"(",
"self",
")",
":",
"if",
"self",
".",
"_socketFile",
"is",
"not",
"None",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"_socketFile",
")",
":",
"raise",
"Exception",
"(",
"\"Socket file (%s) for Memcached Ins... | Connect to Memcached. | [
"Connect",
"to",
"Memcached",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/memcached.py#L66-L79 | train |
aouyar/PyMunin | pysysinfo/memcached.py | MemcachedInfo._sendStatCmd | def _sendStatCmd(self, cmd):
"""Send stat command to Memcached Server and return response lines.
@param cmd: Command string.
@return: Array of strings.
"""
try:
self._conn.write("%s\r\n" % cmd)
regex = re.compile('^(END|ERROR)\r\n', r... | python | def _sendStatCmd(self, cmd):
"""Send stat command to Memcached Server and return response lines.
@param cmd: Command string.
@return: Array of strings.
"""
try:
self._conn.write("%s\r\n" % cmd)
regex = re.compile('^(END|ERROR)\r\n', r... | [
"def",
"_sendStatCmd",
"(",
"self",
",",
"cmd",
")",
":",
"try",
":",
"self",
".",
"_conn",
".",
"write",
"(",
"\"%s\\r\\n\"",
"%",
"cmd",
")",
"regex",
"=",
"re",
".",
"compile",
"(",
"'^(END|ERROR)\\r\\n'",
",",
"re",
".",
"MULTILINE",
")",
"(",
"i... | Send stat command to Memcached Server and return response lines.
@param cmd: Command string.
@return: Array of strings. | [
"Send",
"stat",
"command",
"to",
"Memcached",
"Server",
"and",
"return",
"response",
"lines",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/memcached.py#L81-L101 | train |
aouyar/PyMunin | pysysinfo/memcached.py | MemcachedInfo._parseStats | def _parseStats(self, lines, parse_slabs = False):
"""Parse stats output from memcached and return dictionary of stats-
@param lines: Array of lines of input text.
@param parse_slabs: Parse slab stats if True.
@return: Stats dictionary.
"""
... | python | def _parseStats(self, lines, parse_slabs = False):
"""Parse stats output from memcached and return dictionary of stats-
@param lines: Array of lines of input text.
@param parse_slabs: Parse slab stats if True.
@return: Stats dictionary.
"""
... | [
"def",
"_parseStats",
"(",
"self",
",",
"lines",
",",
"parse_slabs",
"=",
"False",
")",
":",
"info_dict",
"=",
"{",
"}",
"info_dict",
"[",
"'slabs'",
"]",
"=",
"{",
"}",
"for",
"line",
"in",
"lines",
":",
"mobj",
"=",
"re",
".",
"match",
"(",
"'^ST... | Parse stats output from memcached and return dictionary of stats-
@param lines: Array of lines of input text.
@param parse_slabs: Parse slab stats if True.
@return: Stats dictionary. | [
"Parse",
"stats",
"output",
"from",
"memcached",
"and",
"return",
"dictionary",
"of",
"stats",
"-"
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/memcached.py#L102-L124 | train |
aouyar/PyMunin | pymunin/plugins/memcachedstats.py | MuninMemcachedPlugin.retrieveVals | def retrieveVals(self):
"""Retrieve values for graphs."""
if self._stats is None:
serverInfo = MemcachedInfo(self._host, self._port, self._socket_file)
stats = serverInfo.getStats()
else:
stats = self._stats
if stats is None:
raise Excepti... | python | def retrieveVals(self):
"""Retrieve values for graphs."""
if self._stats is None:
serverInfo = MemcachedInfo(self._host, self._port, self._socket_file)
stats = serverInfo.getStats()
else:
stats = self._stats
if stats is None:
raise Excepti... | [
"def",
"retrieveVals",
"(",
"self",
")",
":",
"if",
"self",
".",
"_stats",
"is",
"None",
":",
"serverInfo",
"=",
"MemcachedInfo",
"(",
"self",
".",
"_host",
",",
"self",
".",
"_port",
",",
"self",
".",
"_socket_file",
")",
"stats",
"=",
"serverInfo",
"... | Retrieve values for graphs. | [
"Retrieve",
"values",
"for",
"graphs",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/memcachedstats.py#L305-L440 | train |
aouyar/PyMunin | pymunin/plugins/memcachedstats.py | MuninMemcachedPlugin.autoconf | def autoconf(self):
"""Implements Munin Plugin Auto-Configuration Option.
@return: True if plugin can be auto-configured, False otherwise.
"""
serverInfo = MemcachedInfo(self._host, self._port, self._socket_file)
return (serverInfo is not None) | python | def autoconf(self):
"""Implements Munin Plugin Auto-Configuration Option.
@return: True if plugin can be auto-configured, False otherwise.
"""
serverInfo = MemcachedInfo(self._host, self._port, self._socket_file)
return (serverInfo is not None) | [
"def",
"autoconf",
"(",
"self",
")",
":",
"serverInfo",
"=",
"MemcachedInfo",
"(",
"self",
".",
"_host",
",",
"self",
".",
"_port",
",",
"self",
".",
"_socket_file",
")",
"return",
"(",
"serverInfo",
"is",
"not",
"None",
")"
] | Implements Munin Plugin Auto-Configuration Option.
@return: True if plugin can be auto-configured, False otherwise. | [
"Implements",
"Munin",
"Plugin",
"Auto",
"-",
"Configuration",
"Option",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/memcachedstats.py#L442-L449 | train |
ContextLab/quail | quail/distance.py | correlation | def correlation(a, b):
"Returns correlation distance between a and b"
if isinstance(a, list):
a = np.array(a)
if isinstance(b, list):
b = np.array(b)
a = a.reshape(1, -1)
b = b.reshape(1, -1)
return cdist(a, b, 'correlation') | python | def correlation(a, b):
"Returns correlation distance between a and b"
if isinstance(a, list):
a = np.array(a)
if isinstance(b, list):
b = np.array(b)
a = a.reshape(1, -1)
b = b.reshape(1, -1)
return cdist(a, b, 'correlation') | [
"def",
"correlation",
"(",
"a",
",",
"b",
")",
":",
"if",
"isinstance",
"(",
"a",
",",
"list",
")",
":",
"a",
"=",
"np",
".",
"array",
"(",
"a",
")",
"if",
"isinstance",
"(",
"b",
",",
"list",
")",
":",
"b",
"=",
"np",
".",
"array",
"(",
"b... | Returns correlation distance between a and b | [
"Returns",
"correlation",
"distance",
"between",
"a",
"and",
"b"
] | 71dd53c792dd915dc84879d8237e3582dd68b7a4 | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/distance.py#L9-L17 | train |
ContextLab/quail | quail/distance.py | euclidean | def euclidean(a, b):
"Returns euclidean distance between a and b"
return np.linalg.norm(np.subtract(a, b)) | python | def euclidean(a, b):
"Returns euclidean distance between a and b"
return np.linalg.norm(np.subtract(a, b)) | [
"def",
"euclidean",
"(",
"a",
",",
"b",
")",
":",
"return",
"np",
".",
"linalg",
".",
"norm",
"(",
"np",
".",
"subtract",
"(",
"a",
",",
"b",
")",
")"
] | Returns euclidean distance between a and b | [
"Returns",
"euclidean",
"distance",
"between",
"a",
"and",
"b"
] | 71dd53c792dd915dc84879d8237e3582dd68b7a4 | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/distance.py#L19-L21 | train |
aouyar/PyMunin | pysysinfo/process.py | ProcessInfo.execProcCmd | def execProcCmd(self, *args):
"""Execute ps command with positional params args and return result as
list of lines.
@param *args: Positional params for ps command.
@return: List of output lines
"""
out = util.exec_command([psCmd,] + list(args))
... | python | def execProcCmd(self, *args):
"""Execute ps command with positional params args and return result as
list of lines.
@param *args: Positional params for ps command.
@return: List of output lines
"""
out = util.exec_command([psCmd,] + list(args))
... | [
"def",
"execProcCmd",
"(",
"self",
",",
"*",
"args",
")",
":",
"out",
"=",
"util",
".",
"exec_command",
"(",
"[",
"psCmd",
",",
"]",
"+",
"list",
"(",
"args",
")",
")",
"return",
"out",
".",
"splitlines",
"(",
")"
] | Execute ps command with positional params args and return result as
list of lines.
@param *args: Positional params for ps command.
@return: List of output lines | [
"Execute",
"ps",
"command",
"with",
"positional",
"params",
"args",
"and",
"return",
"result",
"as",
"list",
"of",
"lines",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/process.py#L47-L56 | train |
aouyar/PyMunin | pysysinfo/process.py | ProcessInfo.parseProcCmd | def parseProcCmd(self, fields=('pid', 'user', 'cmd',), threads=False):
"""Execute ps command with custom output format with columns from
fields and return result as a nested list.
The Standard Format Specifiers from ps man page must be used for the
fields parameter.
... | python | def parseProcCmd(self, fields=('pid', 'user', 'cmd',), threads=False):
"""Execute ps command with custom output format with columns from
fields and return result as a nested list.
The Standard Format Specifiers from ps man page must be used for the
fields parameter.
... | [
"def",
"parseProcCmd",
"(",
"self",
",",
"fields",
"=",
"(",
"'pid'",
",",
"'user'",
",",
"'cmd'",
",",
")",
",",
"threads",
"=",
"False",
")",
":",
"args",
"=",
"[",
"]",
"headers",
"=",
"[",
"f",
".",
"lower",
"(",
")",
"for",
"f",
"in",
"fie... | Execute ps command with custom output format with columns from
fields and return result as a nested list.
The Standard Format Specifiers from ps man page must be used for the
fields parameter.
@param fields: List of fields included in the output.
... | [
"Execute",
"ps",
"command",
"with",
"custom",
"output",
"format",
"with",
"columns",
"from",
"fields",
"and",
"return",
"result",
"as",
"a",
"nested",
"list",
".",
"The",
"Standard",
"Format",
"Specifiers",
"from",
"ps",
"man",
"page",
"must",
"be",
"used",
... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/process.py#L58-L98 | train |
aouyar/PyMunin | pysysinfo/process.py | ProcessInfo.getProcList | def getProcList(self, fields=('pid', 'user', 'cmd',), threads=False,
**kwargs):
"""Execute ps command with custom output format with columns columns
from fields, select lines using the filters defined by kwargs and return
result as a nested list.
The Standa... | python | def getProcList(self, fields=('pid', 'user', 'cmd',), threads=False,
**kwargs):
"""Execute ps command with custom output format with columns columns
from fields, select lines using the filters defined by kwargs and return
result as a nested list.
The Standa... | [
"def",
"getProcList",
"(",
"self",
",",
"fields",
"=",
"(",
"'pid'",
",",
"'user'",
",",
"'cmd'",
",",
")",
",",
"threads",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"field_list",
"=",
"list",
"(",
"fields",
")",
"for",
"key",
"in",
"kwargs"... | Execute ps command with custom output format with columns columns
from fields, select lines using the filters defined by kwargs and return
result as a nested list.
The Standard Format Specifiers from ps man page must be used for the
fields parameter.
@param fi... | [
"Execute",
"ps",
"command",
"with",
"custom",
"output",
"format",
"with",
"columns",
"columns",
"from",
"fields",
"select",
"lines",
"using",
"the",
"filters",
"defined",
"by",
"kwargs",
"and",
"return",
"result",
"as",
"a",
"nested",
"list",
".",
"The",
"St... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/process.py#L100-L144 | train |
aouyar/PyMunin | pysysinfo/process.py | ProcessInfo.getProcDict | def getProcDict(self, fields=('user', 'cmd',), threads=False, **kwargs):
"""Execute ps command with custom output format with columns format with
columns from fields, and return result as a nested dictionary with
the key PID or SPID.
The Standard Format Specifiers from ps man ... | python | def getProcDict(self, fields=('user', 'cmd',), threads=False, **kwargs):
"""Execute ps command with custom output format with columns format with
columns from fields, and return result as a nested dictionary with
the key PID or SPID.
The Standard Format Specifiers from ps man ... | [
"def",
"getProcDict",
"(",
"self",
",",
"fields",
"=",
"(",
"'user'",
",",
"'cmd'",
",",
")",
",",
"threads",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"stats",
"=",
"{",
"}",
"field_list",
"=",
"list",
"(",
"fields",
")",
"num_cols",
"=",
... | Execute ps command with custom output format with columns format with
columns from fields, and return result as a nested dictionary with
the key PID or SPID.
The Standard Format Specifiers from ps man page must be used for the
fields parameter.
@param fields:... | [
"Execute",
"ps",
"command",
"with",
"custom",
"output",
"format",
"with",
"columns",
"format",
"with",
"columns",
"from",
"fields",
"and",
"return",
"result",
"as",
"a",
"nested",
"dictionary",
"with",
"the",
"key",
"PID",
"or",
"SPID",
".",
"The",
"Standard... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/process.py#L146-L198 | train |
aouyar/PyMunin | pysysinfo/process.py | ProcessInfo.getProcStatStatus | def getProcStatStatus(self, threads=False, **kwargs):
"""Return process counts per status and priority.
@param **kwargs: Keyword variables are used for filtering the results
depending on the values of the columns. Each keyword
must correspond t... | python | def getProcStatStatus(self, threads=False, **kwargs):
"""Return process counts per status and priority.
@param **kwargs: Keyword variables are used for filtering the results
depending on the values of the columns. Each keyword
must correspond t... | [
"def",
"getProcStatStatus",
"(",
"self",
",",
"threads",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"procs",
"=",
"self",
".",
"getProcList",
"(",
"[",
"'stat'",
",",
"]",
",",
"threads",
"=",
"threads",
",",
"*",
"*",
"kwargs",
")",
"status",
... | Return process counts per status and priority.
@param **kwargs: Keyword variables are used for filtering the results
depending on the values of the columns. Each keyword
must correspond to a field name with an optional
suffix:... | [
"Return",
"process",
"counts",
"per",
"status",
"and",
"priority",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/process.py#L200-L242 | train |
aouyar/PyMunin | pymunin/plugins/ntpstats.py | MuninNTPstatsPlugin.retrieveVals | def retrieveVals(self):
"""Retrieve values for graphs."""
ntpinfo = NTPinfo()
stats = ntpinfo.getPeerStats()
if stats:
if self.hasGraph('ntp_peer_stratum'):
self.setGraphVal('ntp_peer_stratum', 'stratum',
stats.get('stratum'))... | python | def retrieveVals(self):
"""Retrieve values for graphs."""
ntpinfo = NTPinfo()
stats = ntpinfo.getPeerStats()
if stats:
if self.hasGraph('ntp_peer_stratum'):
self.setGraphVal('ntp_peer_stratum', 'stratum',
stats.get('stratum'))... | [
"def",
"retrieveVals",
"(",
"self",
")",
":",
"ntpinfo",
"=",
"NTPinfo",
"(",
")",
"stats",
"=",
"ntpinfo",
".",
"getPeerStats",
"(",
")",
"if",
"stats",
":",
"if",
"self",
".",
"hasGraph",
"(",
"'ntp_peer_stratum'",
")",
":",
"self",
".",
"setGraphVal",... | Retrieve values for graphs. | [
"Retrieve",
"values",
"for",
"graphs",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/ntpstats.py#L84-L98 | train |
aouyar/PyMunin | pymunin/__init__.py | muninMain | def muninMain(pluginClass, argv=None, env=None, debug=False):
"""Main Block for Munin Plugins.
@param pluginClass: Child class of MuninPlugin that implements plugin.
@param argv: List of command line arguments to Munin Plugin.
@param env: Dictionary of environment variables passed to... | python | def muninMain(pluginClass, argv=None, env=None, debug=False):
"""Main Block for Munin Plugins.
@param pluginClass: Child class of MuninPlugin that implements plugin.
@param argv: List of command line arguments to Munin Plugin.
@param env: Dictionary of environment variables passed to... | [
"def",
"muninMain",
"(",
"pluginClass",
",",
"argv",
"=",
"None",
",",
"env",
"=",
"None",
",",
"debug",
"=",
"False",
")",
":",
"if",
"argv",
"is",
"None",
":",
"argv",
"=",
"sys",
".",
"argv",
"if",
"env",
"is",
"None",
":",
"env",
"=",
"os",
... | Main Block for Munin Plugins.
@param pluginClass: Child class of MuninPlugin that implements plugin.
@param argv: List of command line arguments to Munin Plugin.
@param env: Dictionary of environment variables passed to Munin Plugin.
@param debug: Print debugging messages if Tr... | [
"Main",
"Block",
"for",
"Munin",
"Plugins",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L938-L973 | train |
aouyar/PyMunin | pymunin/__init__.py | fixLabel | def fixLabel(label, maxlen, delim=None, repl='', truncend=True):
"""Truncate long graph and field labels.
@param label: Label text.
@param maxlen: Maximum field label length in characters.
No maximum field label length is enforced by default.
@param delim: ... | python | def fixLabel(label, maxlen, delim=None, repl='', truncend=True):
"""Truncate long graph and field labels.
@param label: Label text.
@param maxlen: Maximum field label length in characters.
No maximum field label length is enforced by default.
@param delim: ... | [
"def",
"fixLabel",
"(",
"label",
",",
"maxlen",
",",
"delim",
"=",
"None",
",",
"repl",
"=",
"''",
",",
"truncend",
"=",
"True",
")",
":",
"if",
"len",
"(",
"label",
")",
"<=",
"maxlen",
":",
"return",
"label",
"else",
":",
"maxlen",
"-=",
"len",
... | Truncate long graph and field labels.
@param label: Label text.
@param maxlen: Maximum field label length in characters.
No maximum field label length is enforced by default.
@param delim: Delimiter for field labels field labels longer than
... | [
"Truncate",
"long",
"graph",
"and",
"field",
"labels",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L975-L1004 | train |
aouyar/PyMunin | pymunin/__init__.py | MuninPlugin._parseEnv | def _parseEnv(self, env=None):
"""Private method for parsing through environment variables.
Parses for environment variables common to all Munin Plugins:
- MUNIN_STATEFILE
- MUNIN_CAP_DIRTY_CONFIG
- nested_graphs
@param env: Dictionary of env... | python | def _parseEnv(self, env=None):
"""Private method for parsing through environment variables.
Parses for environment variables common to all Munin Plugins:
- MUNIN_STATEFILE
- MUNIN_CAP_DIRTY_CONFIG
- nested_graphs
@param env: Dictionary of env... | [
"def",
"_parseEnv",
"(",
"self",
",",
"env",
"=",
"None",
")",
":",
"if",
"not",
"env",
":",
"env",
"=",
"self",
".",
"_env",
"if",
"env",
".",
"has_key",
"(",
"'MUNIN_STATEFILE'",
")",
":",
"self",
".",
"_stateFile",
"=",
"env",
".",
"get",
"(",
... | Private method for parsing through environment variables.
Parses for environment variables common to all Munin Plugins:
- MUNIN_STATEFILE
- MUNIN_CAP_DIRTY_CONFIG
- nested_graphs
@param env: Dictionary of environment variables.
(O... | [
"Private",
"method",
"for",
"parsing",
"through",
"environment",
"variables",
".",
"Parses",
"for",
"environment",
"variables",
"common",
"to",
"all",
"Munin",
"Plugins",
":",
"-",
"MUNIN_STATEFILE",
"-",
"MUNIN_CAP_DIRTY_CONFIG",
"-",
"nested_graphs"
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L149-L169 | train |
aouyar/PyMunin | pymunin/__init__.py | MuninPlugin._getGraph | def _getGraph(self, graph_name, fail_noexist=False):
"""Private method for returning graph object with name graph_name.
@param graph_name: Graph Name
@param fail_noexist: If true throw exception if there is no graph with
name graph_name.
@return: ... | python | def _getGraph(self, graph_name, fail_noexist=False):
"""Private method for returning graph object with name graph_name.
@param graph_name: Graph Name
@param fail_noexist: If true throw exception if there is no graph with
name graph_name.
@return: ... | [
"def",
"_getGraph",
"(",
"self",
",",
"graph_name",
",",
"fail_noexist",
"=",
"False",
")",
":",
"graph",
"=",
"self",
".",
"_graphDict",
".",
"get",
"(",
"graph_name",
")",
"if",
"fail_noexist",
"and",
"graph",
"is",
"None",
":",
"raise",
"AttributeError"... | Private method for returning graph object with name graph_name.
@param graph_name: Graph Name
@param fail_noexist: If true throw exception if there is no graph with
name graph_name.
@return: Graph Object or None | [
"Private",
"method",
"for",
"returning",
"graph",
"object",
"with",
"name",
"graph_name",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L171-L184 | train |
aouyar/PyMunin | pymunin/__init__.py | MuninPlugin._getSubGraph | def _getSubGraph(self, parent_name, graph_name, fail_noexist=False):
"""Private method for returning subgraph object with name graph_name
and parent graph with name parent_name.
@param parent_name: Root Graph Name
@param graph_name: Subgraph Name
@param fail_noexist... | python | def _getSubGraph(self, parent_name, graph_name, fail_noexist=False):
"""Private method for returning subgraph object with name graph_name
and parent graph with name parent_name.
@param parent_name: Root Graph Name
@param graph_name: Subgraph Name
@param fail_noexist... | [
"def",
"_getSubGraph",
"(",
"self",
",",
"parent_name",
",",
"graph_name",
",",
"fail_noexist",
"=",
"False",
")",
":",
"if",
"not",
"self",
".",
"isMultigraph",
":",
"raise",
"AttributeError",
"(",
"\"Simple Munin Plugins cannot have subgraphs.\"",
")",
"if",
"se... | Private method for returning subgraph object with name graph_name
and parent graph with name parent_name.
@param parent_name: Root Graph Name
@param graph_name: Subgraph Name
@param fail_noexist: If true throw exception if there is no subgraph
... | [
"Private",
"method",
"for",
"returning",
"subgraph",
"object",
"with",
"name",
"graph_name",
"and",
"parent",
"graph",
"with",
"name",
"parent_name",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L186-L214 | train |
aouyar/PyMunin | pymunin/__init__.py | MuninPlugin._getMultigraphID | def _getMultigraphID(self, graph_name, subgraph_name=None):
"""Private method for generating Multigraph ID from graph name and
subgraph name.
@param graph_name: Graph Name.
@param subgraph_name: Subgraph Name.
@return: Multigraph ID.
... | python | def _getMultigraphID(self, graph_name, subgraph_name=None):
"""Private method for generating Multigraph ID from graph name and
subgraph name.
@param graph_name: Graph Name.
@param subgraph_name: Subgraph Name.
@return: Multigraph ID.
... | [
"def",
"_getMultigraphID",
"(",
"self",
",",
"graph_name",
",",
"subgraph_name",
"=",
"None",
")",
":",
"if",
"self",
".",
"isMultiInstance",
"and",
"self",
".",
"_instanceName",
"is",
"not",
"None",
":",
"if",
"subgraph_name",
"is",
"None",
":",
"return",
... | Private method for generating Multigraph ID from graph name and
subgraph name.
@param graph_name: Graph Name.
@param subgraph_name: Subgraph Name.
@return: Multigraph ID. | [
"Private",
"method",
"for",
"generating",
"Multigraph",
"ID",
"from",
"graph",
"name",
"and",
"subgraph",
"name",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L216-L235 | train |
aouyar/PyMunin | pymunin/__init__.py | MuninPlugin._formatConfig | def _formatConfig(self, conf_dict):
"""Formats configuration directory from Munin Graph and returns
multi-line value entries for the plugin config cycle.
@param conf_dict: Configuration directory.
@return: Multi-line text.
"""
confs = []
... | python | def _formatConfig(self, conf_dict):
"""Formats configuration directory from Munin Graph and returns
multi-line value entries for the plugin config cycle.
@param conf_dict: Configuration directory.
@return: Multi-line text.
"""
confs = []
... | [
"def",
"_formatConfig",
"(",
"self",
",",
"conf_dict",
")",
":",
"confs",
"=",
"[",
"]",
"graph_dict",
"=",
"conf_dict",
"[",
"'graph'",
"]",
"field_list",
"=",
"conf_dict",
"[",
"'fields'",
"]",
"# Order and format Graph Attributes",
"title",
"=",
"graph_dict",... | Formats configuration directory from Munin Graph and returns
multi-line value entries for the plugin config cycle.
@param conf_dict: Configuration directory.
@return: Multi-line text. | [
"Formats",
"configuration",
"directory",
"from",
"Munin",
"Graph",
"and",
"returns",
"multi",
"-",
"line",
"value",
"entries",
"for",
"the",
"plugin",
"config",
"cycle",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L237-L287 | train |
aouyar/PyMunin | pymunin/__init__.py | MuninPlugin._formatVals | def _formatVals(self, val_list):
"""Formats value list from Munin Graph and returns multi-line value
entries for the plugin fetch cycle.
@param val_list: List of name-value pairs.
@return: Multi-line text.
"""
vals = []
for (name, val) i... | python | def _formatVals(self, val_list):
"""Formats value list from Munin Graph and returns multi-line value
entries for the plugin fetch cycle.
@param val_list: List of name-value pairs.
@return: Multi-line text.
"""
vals = []
for (name, val) i... | [
"def",
"_formatVals",
"(",
"self",
",",
"val_list",
")",
":",
"vals",
"=",
"[",
"]",
"for",
"(",
"name",
",",
"val",
")",
"in",
"val_list",
":",
"if",
"val",
"is",
"not",
"None",
":",
"if",
"isinstance",
"(",
"val",
",",
"float",
")",
":",
"vals"... | Formats value list from Munin Graph and returns multi-line value
entries for the plugin fetch cycle.
@param val_list: List of name-value pairs.
@return: Multi-line text. | [
"Formats",
"value",
"list",
"from",
"Munin",
"Graph",
"and",
"returns",
"multi",
"-",
"line",
"value",
"entries",
"for",
"the",
"plugin",
"fetch",
"cycle",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L289-L306 | train |
aouyar/PyMunin | pymunin/__init__.py | MuninPlugin.envGet | def envGet(self, name, default=None, conv=None):
"""Return value for environment variable or None.
@param name: Name of environment variable.
@param default: Default value if variable is undefined.
@param conv: Function for converting value to desired type.
@retu... | python | def envGet(self, name, default=None, conv=None):
"""Return value for environment variable or None.
@param name: Name of environment variable.
@param default: Default value if variable is undefined.
@param conv: Function for converting value to desired type.
@retu... | [
"def",
"envGet",
"(",
"self",
",",
"name",
",",
"default",
"=",
"None",
",",
"conv",
"=",
"None",
")",
":",
"if",
"self",
".",
"_env",
".",
"has_key",
"(",
"name",
")",
":",
"if",
"conv",
"is",
"not",
"None",
":",
"return",
"conv",
"(",
"self",
... | Return value for environment variable or None.
@param name: Name of environment variable.
@param default: Default value if variable is undefined.
@param conv: Function for converting value to desired type.
@return: Value of environment variable. | [
"Return",
"value",
"for",
"environment",
"variable",
"or",
"None",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L317-L332 | train |
aouyar/PyMunin | pymunin/__init__.py | MuninPlugin.envGetList | def envGetList(self, name, attr_regex = '^\w+$', conv=None):
"""Parse the plugin environment variables to return list from variable
with name list_<name>. The value of the variable must be a comma
separated list of items.
@param name: Name of list.
... | python | def envGetList(self, name, attr_regex = '^\w+$', conv=None):
"""Parse the plugin environment variables to return list from variable
with name list_<name>. The value of the variable must be a comma
separated list of items.
@param name: Name of list.
... | [
"def",
"envGetList",
"(",
"self",
",",
"name",
",",
"attr_regex",
"=",
"'^\\w+$'",
",",
"conv",
"=",
"None",
")",
":",
"key",
"=",
"\"list_%s\"",
"%",
"name",
"item_list",
"=",
"[",
"]",
"if",
"self",
".",
"_env",
".",
"has_key",
"(",
"key",
")",
"... | Parse the plugin environment variables to return list from variable
with name list_<name>. The value of the variable must be a comma
separated list of items.
@param name: Name of list.
(Also determines suffix for environment variable name.)
@par... | [
"Parse",
"the",
"plugin",
"environment",
"variables",
"to",
"return",
"list",
"from",
"variable",
"with",
"name",
"list_<name",
">",
".",
"The",
"value",
"of",
"the",
"variable",
"must",
"be",
"a",
"comma",
"separated",
"list",
"of",
"items",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L335-L364 | train |
aouyar/PyMunin | pymunin/__init__.py | MuninPlugin.envRegisterFilter | def envRegisterFilter(self, name, attr_regex = '^\w+$', default = True):
"""Register filter for including, excluding attributes in graphs through
the use of include_<name> and exclude_<name> environment variables.
The value of the variables must be a comma separated list of items.
... | python | def envRegisterFilter(self, name, attr_regex = '^\w+$', default = True):
"""Register filter for including, excluding attributes in graphs through
the use of include_<name> and exclude_<name> environment variables.
The value of the variables must be a comma separated list of items.
... | [
"def",
"envRegisterFilter",
"(",
"self",
",",
"name",
",",
"attr_regex",
"=",
"'^\\w+$'",
",",
"default",
"=",
"True",
")",
":",
"attrs",
"=",
"{",
"}",
"for",
"prefix",
"in",
"(",
"'include'",
",",
"'exclude'",
")",
":",
"key",
"=",
"\"%s_%s\"",
"%",
... | Register filter for including, excluding attributes in graphs through
the use of include_<name> and exclude_<name> environment variables.
The value of the variables must be a comma separated list of items.
@param name: Name of filter.
(Also determines ... | [
"Register",
"filter",
"for",
"including",
"excluding",
"attributes",
"in",
"graphs",
"through",
"the",
"use",
"of",
"include_<name",
">",
"and",
"exclude_<name",
">",
"environment",
"variables",
".",
"The",
"value",
"of",
"the",
"variables",
"must",
"be",
"a",
... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L366-L387 | train |
aouyar/PyMunin | pymunin/__init__.py | MuninPlugin.envCheckFilter | def envCheckFilter(self, name, attr):
"""Check if a specific graph attribute is enabled or disabled through
the use of a filter based on include_<name> and exclude_<name>
environment variables.
@param name: Name of the Filter.
@param attr: Name of the Attribute.
... | python | def envCheckFilter(self, name, attr):
"""Check if a specific graph attribute is enabled or disabled through
the use of a filter based on include_<name> and exclude_<name>
environment variables.
@param name: Name of the Filter.
@param attr: Name of the Attribute.
... | [
"def",
"envCheckFilter",
"(",
"self",
",",
"name",
",",
"attr",
")",
":",
"flt",
"=",
"self",
".",
"_filters",
".",
"get",
"(",
"name",
")",
"if",
"flt",
":",
"return",
"flt",
".",
"check",
"(",
"attr",
")",
"else",
":",
"raise",
"AttributeError",
... | Check if a specific graph attribute is enabled or disabled through
the use of a filter based on include_<name> and exclude_<name>
environment variables.
@param name: Name of the Filter.
@param attr: Name of the Attribute.
@return: Return True if the attribute is en... | [
"Check",
"if",
"a",
"specific",
"graph",
"attribute",
"is",
"enabled",
"or",
"disabled",
"through",
"the",
"use",
"of",
"a",
"filter",
"based",
"on",
"include_<name",
">",
"and",
"exclude_<name",
">",
"environment",
"variables",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L389-L403 | train |
aouyar/PyMunin | pymunin/__init__.py | MuninPlugin.envCheckFlag | def envCheckFlag(self, name, default = False):
"""Check graph flag for enabling / disabling attributes through
the use of <name> environment variable.
@param name: Name of flag.
(Also determines the environment variable name.)
@param default: Boolean (... | python | def envCheckFlag(self, name, default = False):
"""Check graph flag for enabling / disabling attributes through
the use of <name> environment variable.
@param name: Name of flag.
(Also determines the environment variable name.)
@param default: Boolean (... | [
"def",
"envCheckFlag",
"(",
"self",
",",
"name",
",",
"default",
"=",
"False",
")",
":",
"if",
"self",
".",
"_flags",
".",
"has_key",
"(",
"name",
")",
":",
"return",
"self",
".",
"_flags",
"[",
"name",
"]",
"else",
":",
"val",
"=",
"self",
".",
... | Check graph flag for enabling / disabling attributes through
the use of <name> environment variable.
@param name: Name of flag.
(Also determines the environment variable name.)
@param default: Boolean (True or False). Default value for flag.
@return: ... | [
"Check",
"graph",
"flag",
"for",
"enabling",
"/",
"disabling",
"attributes",
"through",
"the",
"use",
"of",
"<name",
">",
"environment",
"variable",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L405-L429 | train |
aouyar/PyMunin | pymunin/__init__.py | MuninPlugin.saveState | 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... | python | 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",
")",
":",
"try",
":",
"fp",
"=",
"open",
"(",
"self",
".",
"_stateFile",
",",
"'w'",
")",
"pickle",
".",
"dump",
"(",
"stateObj",
",",
"fp",
")",
"except",
":",
"raise",
"IOError",
"(",
"\"Failure in ... | 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... | [
"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",
... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L448-L464 | train |
aouyar/PyMunin | pymunin/__init__.py | MuninPlugin.restoreState | 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... | python | 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",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"_stateFile",
")",
":",
"try",
":",
"fp",
"=",
"open",
"(",
"self",
".",
"_stateFile",
",",
"'r'",
")",
"stateObj",
"=",
"pickle",
".",
"load",
... | Utility method to restore plugin state from persistent storage to
permit access to previous plugin state.
@return: Object that stores plugin state. | [
"Utility",
"method",
"to",
"restore",
"plugin",
"state",
"from",
"persistent",
"storage",
"to",
"permit",
"access",
"to",
"previous",
"plugin",
"state",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L466-L481 | train |
aouyar/PyMunin | pymunin/__init__.py | MuninPlugin.appendGraph | 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: ... | python | 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",
")",
":",
"self",
".",
"_graphDict",
"[",
"graph_name",
"]",
"=",
"graph",
"self",
".",
"_graphNames",
".",
"append",
"(",
"graph_name",
")",
"if",
"not",
"self",
".",
"isMultigraph",
"a... | 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 | [
"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",
".",
... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L483-L496 | train |
aouyar/PyMunin | pymunin/__init__.py | MuninPlugin.appendSubgraph | 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 ... | python | 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",
")",
":",
"if",
"not",
"self",
".",
"isMultigraph",
":",
"raise",
"AttributeError",
"(",
"\"Simple Munin Plugins cannot have subgraphs.\"",
")",
"if",
"self",
".",
"_graphDi... | 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... | [
"Utility",
"method",
"to",
"associate",
"Subgraph",
"Instance",
"to",
"Root",
"Graph",
"Instance",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L498-L519 | train |
aouyar/PyMunin | pymunin/__init__.py | MuninPlugin.setGraphVal | 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 ... | python | 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",
")",
":",
"graph",
"=",
"self",
".",
"_getGraph",
"(",
"graph_name",
",",
"True",
")",
"if",
"graph",
".",
"hasField",
"(",
"field_name",
")",
":",
"graph",
".",
"setV... | 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. | [
"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... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L521-L536 | train |
aouyar/PyMunin | pymunin/__init__.py | MuninPlugin.setSubgraphVal | 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_... | python | 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",
")",
":",
"subgraph",
"=",
"self",
".",
"_getSubGraph",
"(",
"parent_name",
",",
"graph_name",
",",
"True",
")",
"if",
"subgraph",
".",
"hasField",
... | 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. | [
"Set",
"Value",
"for",
"Field",
"in",
"Subgraph",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L538-L556 | train |
aouyar/PyMunin | pymunin/__init__.py | MuninPlugin.getSubgraphList | 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... | python | 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",
")",
":",
"if",
"not",
"self",
".",
"isMultigraph",
":",
"raise",
"AttributeError",
"(",
"\"Simple Munin Plugins cannot have subgraphs.\"",
")",
"if",
"self",
".",
"_graphDict",
".",
"has_key",
"(",
"paren... | 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. | [
"Returns",
"list",
"of",
"names",
"of",
"subgraphs",
"for",
"Root",
"Graph",
"with",
"name",
"parent_name",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L594-L607 | train |
aouyar/PyMunin | pymunin/__init__.py | MuninPlugin.graphHasField | 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... | python | 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",
")",
":",
"graph",
"=",
"self",
".",
"_graphDict",
".",
"get",
"(",
"graph_name",
",",
"True",
")",
"return",
"graph",
".",
"hasField",
"(",
"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 | [
"Return",
"true",
"if",
"graph",
"with",
"name",
"graph_name",
"has",
"field",
"with",
"name",
"field_name",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L618-L628 | train |
aouyar/PyMunin | pymunin/__init__.py | MuninPlugin.subGraphHasField | 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... | python | 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",
")",
":",
"subgraph",
"=",
"self",
".",
"_getSubGraph",
"(",
"parent_name",
",",
"graph_name",
",",
"True",
")",
"return",
"subgraph",
".",
"hasField",
"(",
"fi... | 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 | [
"Return",
"true",
"if",
"subgraph",
"with",
"name",
"graph_name",
"with",
"parent",
"graph",
"with",
"name",
"parent_name",
"has",
"field",
"with",
"name",
"field_name",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L630-L641 | train |
aouyar/PyMunin | pymunin/__init__.py | MuninPlugin.getGraphFieldList | 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... | python | 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",
")",
":",
"graph",
"=",
"self",
".",
"_getGraph",
"(",
"graph_name",
",",
"True",
")",
"return",
"graph",
".",
"getFieldList",
"(",
")"
] | Returns list of names of fields for graph with name graph_name.
@param graph_name: Graph Name
@return: List of field names for graph. | [
"Returns",
"list",
"of",
"names",
"of",
"fields",
"for",
"graph",
"with",
"name",
"graph_name",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L643-L651 | train |
aouyar/PyMunin | pymunin/__init__.py | MuninPlugin.getGraphFieldCount | 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() | python | 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",
")",
":",
"graph",
"=",
"self",
".",
"_getGraph",
"(",
"graph_name",
",",
"True",
")",
"return",
"graph",
".",
"getFieldCount",
"(",
")"
] | Returns number of fields for graph with name graph_name.
@param graph_name: Graph Name
@return: Number of fields for graph. | [
"Returns",
"number",
"of",
"fields",
"for",
"graph",
"with",
"name",
"graph_name",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L653-L661 | train |
aouyar/PyMunin | pymunin/__init__.py | MuninPlugin.getSubgraphFieldList | 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... | python | 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",
")",
":",
"graph",
"=",
"self",
".",
"_getSubGraph",
"(",
"parent_name",
",",
"graph_name",
",",
"True",
")",
"return",
"graph",
".",
"getFieldList",
"(",
")"
] | 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. | [
"Returns",
"list",
"of",
"names",
"of",
"fields",
"for",
"subgraph",
"with",
"name",
"graph_name",
"and",
"parent",
"graph",
"with",
"name",
"parent_name",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L663-L673 | train |
aouyar/PyMunin | pymunin/__init__.py | MuninPlugin.getSubgraphFieldCount | 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... | python | 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",
")",
":",
"graph",
"=",
"self",
".",
"_getSubGraph",
"(",
"parent_name",
",",
"graph_name",
",",
"True",
")",
"return",
"graph",
".",
"getFieldCount",
"(",
")"
] | 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. | [
"Returns",
"number",
"of",
"fields",
"for",
"subgraph",
"with",
"name",
"graph_name",
"and",
"parent",
"graph",
"with",
"name",
"parent_name",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L675-L685 | train |
aouyar/PyMunin | pymunin/__init__.py | MuninPlugin.config | 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.
"""
... | python | 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",
")",
":",
"for",
"parent_name",
"in",
"self",
".",
"_graphNames",
":",
"graph",
"=",
"self",
".",
"_graphDict",
"[",
"parent_name",
"]",
"if",
"self",
".",
"isMultigraph",
":",
"print",
"\"multigraph %s\"",
"%",
"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",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L708-L733 | train |
aouyar/PyMunin | pymunin/__init__.py | MuninPlugin.fetch | 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... | python | 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",
")",
":",
"self",
".",
"retrieveVals",
"(",
")",
"for",
"parent_name",
"in",
"self",
".",
"_graphNames",
":",
"graph",
"=",
"self",
".",
"_graphDict",
"[",
"parent_name",
"]",
"if",
"self",
".",
"isMultigraph",
":",
"print",
... | Implements Munin Plugin Fetch Option.
Prints out measured values. | [
"Implements",
"Munin",
"Plugin",
"Fetch",
"Option",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L744-L766 | train |
aouyar/PyMunin | pymunin/__init__.py | MuninPlugin.run | 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 = ... | python | 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",
")",
":",
"if",
"len",
"(",
"self",
".",
"_argv",
")",
">",
"1",
"and",
"len",
"(",
"self",
".",
"_argv",
"[",
"1",
"]",
")",
">",
"0",
":",
"oper",
"=",
"self",
".",
"_argv",
"[",
"1",
"]",
"else",
":",
"oper",
... | Implements main entry point for plugin execution. | [
"Implements",
"main",
"entry",
"point",
"for",
"plugin",
"execution",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L768-L791 | train |
aouyar/PyMunin | pymunin/__init__.py | MuninGraph.addField | 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... | python | 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",
",... | 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}'... | [
"Add",
"field",
"to",
"Munin",
"Graph"
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L836-L869 | train |
aouyar/PyMunin | pymunin/__init__.py | MuninGraph.hasField | 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) | python | 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",
")",
":",
"if",
"self",
".",
"_autoFixNames",
":",
"name",
"=",
"self",
".",
"_fixName",
"(",
"name",
")",
"return",
"self",
".",
"_fieldAttrDict",
".",
"has_key",
"(",
"name",
")"
] | Returns true if field with field_name exists.
@param name: Field Name
@return: Boolean | [
"Returns",
"true",
"if",
"field",
"with",
"field_name",
"exists",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L871-L880 | train |
aouyar/PyMunin | pymunin/__init__.py | MuninGraph.getConfig | 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... | python | 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",
")",
":",
"return",
"{",
"'graph'",
":",
"self",
".",
"_graphAttrDict",
",",
"'fields'",
":",
"[",
"(",
"field_name",
",",
"self",
".",
"_fieldAttrDict",
".",
"get",
"(",
"field_name",
")",
")",
"for",
"field_name",
"in",... | Returns dictionary of config entries for Munin Graph.
@return: Dictionary of config entries. | [
"Returns",
"dictionary",
"of",
"config",
"entries",
"for",
"Munin",
"Graph",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L898-L906 | train |
aouyar/PyMunin | pymunin/__init__.py | MuninGraph.setVal | 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 | python | 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",
")",
":",
"if",
"self",
".",
"_autoFixNames",
":",
"name",
"=",
"self",
".",
"_fixName",
"(",
"name",
")",
"self",
".",
"_fieldValDict",
"[",
"name",
"]",
"=",
"val"
] | Set value for field in graph.
@param name : Graph Name
@param value : Value for field. | [
"Set",
"value",
"for",
"field",
"in",
"graph",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L908-L917 | train |
aouyar/PyMunin | pymunin/__init__.py | MuninGraph.getVals | 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] | python | 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",
")",
":",
"return",
"[",
"(",
"name",
",",
"self",
".",
"_fieldValDict",
".",
"get",
"(",
"name",
")",
")",
"for",
"name",
"in",
"self",
".",
"_fieldNameList",
"]"
] | Returns value list for Munin Graph
@return: List of name-value pairs. | [
"Returns",
"value",
"list",
"for",
"Munin",
"Graph"
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/__init__.py#L919-L926 | train |
aouyar/PyMunin | pysysinfo/phpapc.py | APCinfo.initStats | 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:
... | python | 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",
")",
":",
"if",
"extras",
"is",
"not",
"None",
":",
"self",
".",
"_extras",
"=",
"extras",
"if",
"self",
".",
"_extras",
":",
"detail",
"=",
"1",
"else",
":",
"detail",
"=",
"0",
"url",
... | Query and parse Web Server Status Page.
@param extras: Include extra metrics, which can be computationally more
expensive. | [
"Query",
"and",
"parse",
"Web",
"Server",
"Status",
"Page",
"."
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/phpapc.py#L71-L92 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.