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/nginx.py
NginxInfo.initStats
def initStats(self): """Query and parse Nginx Web Server Status Page.""" url = "%s://%s:%d/%s" % (self._proto, self._host, self._port, self._statuspath) response = util.get_url(url, self._user, self._password) self._statusDict = {} for line in re...
python
def initStats(self): """Query and parse Nginx Web Server Status Page.""" url = "%s://%s:%d/%s" % (self._proto, self._host, self._port, self._statuspath) response = util.get_url(url, self._user, self._password) self._statusDict = {} for line in re...
[ "def", "initStats", "(", "self", ")", ":", "url", "=", "\"%s://%s:%d/%s\"", "%", "(", "self", ".", "_proto", ",", "self", ".", "_host", ",", "self", ".", "_port", ",", "self", ".", "_statuspath", ")", "response", "=", "util", ".", "get_url", "(", "ur...
Query and parse Nginx Web Server Status Page.
[ "Query", "and", "parse", "Nginx", "Web", "Server", "Status", "Page", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/nginx.py#L68-L83
train
aouyar/PyMunin
setup.py
read_file
def read_file(filename): """Read a file into a string""" path = os.path.abspath(os.path.dirname(__file__)) filepath = os.path.join(path, filename) try: return open(filepath).read() except IOError: return ''
python
def read_file(filename): """Read a file into a string""" path = os.path.abspath(os.path.dirname(__file__)) filepath = os.path.join(path, filename) try: return open(filepath).read() except IOError: return ''
[ "def", "read_file", "(", "filename", ")", ":", "path", "=", "os", ".", "path", ".", "abspath", "(", "os", ".", "path", ".", "dirname", "(", "__file__", ")", ")", "filepath", "=", "os", ".", "path", ".", "join", "(", "path", ",", "filename", ")", ...
Read a file into a string
[ "Read", "a", "file", "into", "a", "string" ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/setup.py#L16-L23
train
aouyar/PyMunin
pymunin/plugins/procstats.py
MuninProcStatsPlugin.retrieveVals
def retrieveVals(self): """Retrieve values for graphs.""" proc_info = ProcessInfo() stats = {} for (prefix, is_thread) in (('proc', False), ('thread', True)): graph_name = '%s_status' % prefix if self.hasGraph(graph_name): ...
python
def retrieveVals(self): """Retrieve values for graphs.""" proc_info = ProcessInfo() stats = {} for (prefix, is_thread) in (('proc', False), ('thread', True)): graph_name = '%s_status' % prefix if self.hasGraph(graph_name): ...
[ "def", "retrieveVals", "(", "self", ")", ":", "proc_info", "=", "ProcessInfo", "(", ")", "stats", "=", "{", "}", "for", "(", "prefix", ",", "is_thread", ")", "in", "(", "(", "'proc'", ",", "False", ")", ",", "(", "'thread'", ",", "True", ")", ")", ...
Retrieve values for graphs.
[ "Retrieve", "values", "for", "graphs", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/procstats.py#L105-L133
train
aouyar/PyMunin
pymunin/plugins/rackspacestats.py
MuninRackspacePlugin.retrieveVals
def retrieveVals(self): """Retrieve values for graphs.""" file_stats = self._fileInfo.getContainerStats() for contname in self._fileContList: stats = file_stats.get(contname) if stats is not None: if self.hasGraph('rackspace_cloudfiles_container_size'): ...
python
def retrieveVals(self): """Retrieve values for graphs.""" file_stats = self._fileInfo.getContainerStats() for contname in self._fileContList: stats = file_stats.get(contname) if stats is not None: if self.hasGraph('rackspace_cloudfiles_container_size'): ...
[ "def", "retrieveVals", "(", "self", ")", ":", "file_stats", "=", "self", ".", "_fileInfo", ".", "getContainerStats", "(", ")", "for", "contname", "in", "self", ".", "_fileContList", ":", "stats", "=", "file_stats", ".", "get", "(", "contname", ")", "if", ...
Retrieve values for graphs.
[ "Retrieve", "values", "for", "graphs", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/rackspacestats.py#L125-L136
train
ContextLab/quail
quail/plot.py
plot
def plot(results, subjgroup=None, subjname='Subject Group', listgroup=None, listname='List', subjconds=None, listconds=None, plot_type=None, plot_style=None, title=None, legend=True, xlim=None, ylim=None, save_path=None, show=True, ax=None, **kwargs): """ General plot function that gr...
python
def plot(results, subjgroup=None, subjname='Subject Group', listgroup=None, listname='List', subjconds=None, listconds=None, plot_type=None, plot_style=None, title=None, legend=True, xlim=None, ylim=None, save_path=None, show=True, ax=None, **kwargs): """ General plot function that gr...
[ "def", "plot", "(", "results", ",", "subjgroup", "=", "None", ",", "subjname", "=", "'Subject Group'", ",", "listgroup", "=", "None", ",", "listname", "=", "'List'", ",", "subjconds", "=", "None", ",", "listconds", "=", "None", ",", "plot_type", "=", "No...
General plot function that groups data by subject/list number and performs analysis. Parameters ---------- results : quail.FriedEgg Object containing results subjgroup : list of strings or ints String/int variables indicating how to group over subjects. Must be the length of t...
[ "General", "plot", "function", "that", "groups", "data", "by", "subject", "/", "list", "number", "and", "performs", "analysis", "." ]
71dd53c792dd915dc84879d8237e3582dd68b7a4
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/plot.py#L12-L288
train
aouyar/PyMunin
pysysinfo/netiface.py
NetIfaceInfo.getIfStats
def getIfStats(self): """Return dictionary of Traffic Stats for Network Interfaces. @return: Nested dictionary of statistics for each interface. """ info_dict = {} try: fp = open(ifaceStatsFile, 'r') data = fp.read() fp.close(...
python
def getIfStats(self): """Return dictionary of Traffic Stats for Network Interfaces. @return: Nested dictionary of statistics for each interface. """ info_dict = {} try: fp = open(ifaceStatsFile, 'r') data = fp.read() fp.close(...
[ "def", "getIfStats", "(", "self", ")", ":", "info_dict", "=", "{", "}", "try", ":", "fp", "=", "open", "(", "ifaceStatsFile", ",", "'r'", ")", "data", "=", "fp", ".", "read", "(", ")", "fp", ".", "close", "(", ")", "except", ":", "raise", "IOErro...
Return dictionary of Traffic Stats for Network Interfaces. @return: Nested dictionary of statistics for each interface.
[ "Return", "dictionary", "of", "Traffic", "Stats", "for", "Network", "Interfaces", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/netiface.py#L27-L53
train
aouyar/PyMunin
pysysinfo/netiface.py
NetIfaceInfo.getIfConfig
def getIfConfig(self): """Return dictionary of Interface Configuration (ifconfig). @return: Dictionary of if configurations keyed by if name. """ conf = {} try: out = subprocess.Popen([ipCmd, "addr", "show"], stdou...
python
def getIfConfig(self): """Return dictionary of Interface Configuration (ifconfig). @return: Dictionary of if configurations keyed by if name. """ conf = {} try: out = subprocess.Popen([ipCmd, "addr", "show"], stdou...
[ "def", "getIfConfig", "(", "self", ")", ":", "conf", "=", "{", "}", "try", ":", "out", "=", "subprocess", ".", "Popen", "(", "[", "ipCmd", ",", "\"addr\"", ",", "\"show\"", "]", ",", "stdout", "=", "subprocess", ".", "PIPE", ")", ".", "communicate", ...
Return dictionary of Interface Configuration (ifconfig). @return: Dictionary of if configurations keyed by if name.
[ "Return", "dictionary", "of", "Interface", "Configuration", "(", "ifconfig", ")", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/netiface.py#L55-L94
train
aouyar/PyMunin
pysysinfo/netiface.py
NetIfaceInfo.getRoutes
def getRoutes(self): """Get routing table. @return: List of routes. """ routes = [] try: out = subprocess.Popen([routeCmd, "-n"], stdout=subprocess.PIPE).communicate()[0] except: raise Exception...
python
def getRoutes(self): """Get routing table. @return: List of routes. """ routes = [] try: out = subprocess.Popen([routeCmd, "-n"], stdout=subprocess.PIPE).communicate()[0] except: raise Exception...
[ "def", "getRoutes", "(", "self", ")", ":", "routes", "=", "[", "]", "try", ":", "out", "=", "subprocess", ".", "Popen", "(", "[", "routeCmd", ",", "\"-n\"", "]", ",", "stdout", "=", "subprocess", ".", "PIPE", ")", ".", "communicate", "(", ")", "[",...
Get routing table. @return: List of routes.
[ "Get", "routing", "table", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/netiface.py#L96-L113
train
aouyar/PyMunin
pysysinfo/netstat.py
NetstatInfo.execNetstatCmd
def execNetstatCmd(self, *args): """Execute ps command with positional params args and return result as list of lines. @param *args: Positional params for netstat command. @return: List of output lines """ out = util.exec_command([netstatCmd,] + li...
python
def execNetstatCmd(self, *args): """Execute ps command with positional params args and return result as list of lines. @param *args: Positional params for netstat command. @return: List of output lines """ out = util.exec_command([netstatCmd,] + li...
[ "def", "execNetstatCmd", "(", "self", ",", "*", "args", ")", ":", "out", "=", "util", ".", "exec_command", "(", "[", "netstatCmd", ",", "]", "+", "list", "(", "args", ")", ")", "return", "out", ".", "splitlines", "(", ")" ]
Execute ps command with positional params args and return result as list of lines. @param *args: Positional params for netstat command. @return: List of output lines
[ "Execute", "ps", "command", "with", "positional", "params", "args", "and", "return", "result", "as", "list", "of", "lines", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/netstat.py#L30-L39
train
aouyar/PyMunin
pysysinfo/netstat.py
NetstatInfo.parseNetstatCmd
def parseNetstatCmd(self, tcp=True, udp=True, ipv4=True, ipv6=True, include_listen=True, only_listen=False, show_users=False, show_procs=False, resolve_hosts=False, resolve_ports=False, resolve_users=True): """Exec...
python
def parseNetstatCmd(self, tcp=True, udp=True, ipv4=True, ipv6=True, include_listen=True, only_listen=False, show_users=False, show_procs=False, resolve_hosts=False, resolve_ports=False, resolve_users=True): """Exec...
[ "def", "parseNetstatCmd", "(", "self", ",", "tcp", "=", "True", ",", "udp", "=", "True", ",", "ipv4", "=", "True", ",", "ipv6", "=", "True", ",", "include_listen", "=", "True", ",", "only_listen", "=", "False", ",", "show_users", "=", "False", ",", "...
Execute netstat command and return result as a nested dictionary. @param tcp: Include TCP ports in ouput if True. @param udp: Include UDP ports in ouput if True. @param ipv4: Include IPv4 ports in output if True. @param ipv6: Include IPv...
[ "Execute", "netstat", "command", "and", "return", "result", "as", "a", "nested", "dictionary", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/netstat.py#L41-L117
train
aouyar/PyMunin
pysysinfo/netstat.py
NetstatInfo.getStats
def getStats(self, tcp=True, udp=True, ipv4=True, ipv6=True, include_listen=True, only_listen=False, show_users=False, show_procs=False, resolve_hosts=False, resolve_ports=False, resolve_users=True, **kwargs): """Execute netstat command and ...
python
def getStats(self, tcp=True, udp=True, ipv4=True, ipv6=True, include_listen=True, only_listen=False, show_users=False, show_procs=False, resolve_hosts=False, resolve_ports=False, resolve_users=True, **kwargs): """Execute netstat command and ...
[ "def", "getStats", "(", "self", ",", "tcp", "=", "True", ",", "udp", "=", "True", ",", "ipv4", "=", "True", ",", "ipv6", "=", "True", ",", "include_listen", "=", "True", ",", "only_listen", "=", "False", ",", "show_users", "=", "False", ",", "show_pr...
Execute netstat command and return result as a nested dictionary. @param tcp: Include TCP ports in ouput if True. @param udp: Include UDP ports in ouput if True. @param ipv4: Include IPv4 ports in output if True. @param ipv6: Include IPv...
[ "Execute", "netstat", "command", "and", "return", "result", "as", "a", "nested", "dictionary", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/netstat.py#L119-L170
train
aouyar/PyMunin
pysysinfo/netstat.py
NetstatInfo.getTCPportConnStatus
def getTCPportConnStatus(self, ipv4=True, ipv6=True, include_listen=False, **kwargs): """Returns the number of TCP endpoints discriminated by status. @param ipv4: Include IPv4 ports in output if True. @param ipv6: Include IPv6 ports in ou...
python
def getTCPportConnStatus(self, ipv4=True, ipv6=True, include_listen=False, **kwargs): """Returns the number of TCP endpoints discriminated by status. @param ipv4: Include IPv4 ports in output if True. @param ipv6: Include IPv6 ports in ou...
[ "def", "getTCPportConnStatus", "(", "self", ",", "ipv4", "=", "True", ",", "ipv6", "=", "True", ",", "include_listen", "=", "False", ",", "*", "*", "kwargs", ")", ":", "status_dict", "=", "{", "}", "result", "=", "self", ".", "getStats", "(", "tcp", ...
Returns the number of TCP endpoints discriminated by status. @param ipv4: Include IPv4 ports in output if True. @param ipv6: Include IPv6 ports in output if True. @param include_listen: Include listening ports in output if True. @param **kwargs: Keyword...
[ "Returns", "the", "number", "of", "TCP", "endpoints", "discriminated", "by", "status", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/netstat.py#L172-L209
train
aouyar/PyMunin
pysysinfo/netstat.py
NetstatInfo.getTCPportConnCount
def getTCPportConnCount(self, ipv4=True, ipv6=True, resolve_ports=False, **kwargs): """Returns TCP connection counts for each local port. @param ipv4: Include IPv4 ports in output if True. @param ipv6: Include IPv6 ports in output if True. ...
python
def getTCPportConnCount(self, ipv4=True, ipv6=True, resolve_ports=False, **kwargs): """Returns TCP connection counts for each local port. @param ipv4: Include IPv4 ports in output if True. @param ipv6: Include IPv6 ports in output if True. ...
[ "def", "getTCPportConnCount", "(", "self", ",", "ipv4", "=", "True", ",", "ipv6", "=", "True", ",", "resolve_ports", "=", "False", ",", "*", "*", "kwargs", ")", ":", "port_dict", "=", "{", "}", "result", "=", "self", ".", "getStats", "(", "tcp", "=",...
Returns TCP connection counts for each local port. @param ipv4: Include IPv4 ports in output if True. @param ipv6: Include IPv6 ports in output if True. @param resolve_ports: Resolve numeric ports to names if True. @param **kwargs: Keyword variables are us...
[ "Returns", "TCP", "connection", "counts", "for", "each", "local", "port", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/netstat.py#L211-L247
train
ContextLab/quail
quail/analysis/accuracy.py
accuracy_helper
def accuracy_helper(egg, match='exact', distance='euclidean', features=None): """ Computes proportion of words recalled Parameters ---------- egg : quail.Egg Data to analyze match : str (exact, best or smooth) Matching approach to compute recall matrix. If ...
python
def accuracy_helper(egg, match='exact', distance='euclidean', features=None): """ Computes proportion of words recalled Parameters ---------- egg : quail.Egg Data to analyze match : str (exact, best or smooth) Matching approach to compute recall matrix. If ...
[ "def", "accuracy_helper", "(", "egg", ",", "match", "=", "'exact'", ",", "distance", "=", "'euclidean'", ",", "features", "=", "None", ")", ":", "def", "acc", "(", "lst", ")", ":", "return", "len", "(", "[", "i", "for", "i", "in", "np", ".", "uniqu...
Computes proportion of words recalled Parameters ---------- egg : quail.Egg Data to analyze match : str (exact, best or smooth) Matching approach to compute recall matrix. If exact, the presented and recalled items must be identical (default). If best, the recalled item ...
[ "Computes", "proportion", "of", "words", "recalled" ]
71dd53c792dd915dc84879d8237e3582dd68b7a4
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/analysis/accuracy.py#L5-L50
train
aouyar/PyMunin
pysysinfo/postgresql.py
PgInfo._connect
def _connect(self): """Establish connection to PostgreSQL Database.""" if self._connParams: self._conn = psycopg2.connect(**self._connParams) else: self._conn = psycopg2.connect('') try: ver_str = self._conn.get_parameter_status('server_version') ...
python
def _connect(self): """Establish connection to PostgreSQL Database.""" if self._connParams: self._conn = psycopg2.connect(**self._connParams) else: self._conn = psycopg2.connect('') try: ver_str = self._conn.get_parameter_status('server_version') ...
[ "def", "_connect", "(", "self", ")", ":", "if", "self", ".", "_connParams", ":", "self", ".", "_conn", "=", "psycopg2", ".", "connect", "(", "*", "*", "self", ".", "_connParams", ")", "else", ":", "self", ".", "_conn", "=", "psycopg2", ".", "connect"...
Establish connection to PostgreSQL Database.
[ "Establish", "connection", "to", "PostgreSQL", "Database", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/postgresql.py#L76-L86
train
aouyar/PyMunin
pysysinfo/postgresql.py
PgInfo._createStatsDict
def _createStatsDict(self, headers, rows): """Utility method that returns database stats as a nested dictionary. @param headers: List of columns in query result. @param rows: List of rows in query result. @return: Nested dictionary of values. Fi...
python
def _createStatsDict(self, headers, rows): """Utility method that returns database stats as a nested dictionary. @param headers: List of columns in query result. @param rows: List of rows in query result. @return: Nested dictionary of values. Fi...
[ "def", "_createStatsDict", "(", "self", ",", "headers", ",", "rows", ")", ":", "dbstats", "=", "{", "}", "for", "row", "in", "rows", ":", "dbstats", "[", "row", "[", "0", "]", "]", "=", "dict", "(", "zip", "(", "headers", "[", "1", ":", "]", ",...
Utility method that returns database stats as a nested dictionary. @param headers: List of columns in query result. @param rows: List of rows in query result. @return: Nested dictionary of values. First key is the database name and the second key is the...
[ "Utility", "method", "that", "returns", "database", "stats", "as", "a", "nested", "dictionary", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/postgresql.py#L88-L101
train
aouyar/PyMunin
pysysinfo/postgresql.py
PgInfo._createTotalsDict
def _createTotalsDict(self, headers, rows): """Utility method that returns totals for database statistics. @param headers: List of columns in query result. @param rows: List of rows in query result. @return: Dictionary of totals for each statistics column. ...
python
def _createTotalsDict(self, headers, rows): """Utility method that returns totals for database statistics. @param headers: List of columns in query result. @param rows: List of rows in query result. @return: Dictionary of totals for each statistics column. ...
[ "def", "_createTotalsDict", "(", "self", ",", "headers", ",", "rows", ")", ":", "totals", "=", "[", "sum", "(", "col", ")", "for", "col", "in", "zip", "(", "*", "rows", ")", "[", "1", ":", "]", "]", "return", "dict", "(", "zip", "(", "headers", ...
Utility method that returns totals for database statistics. @param headers: List of columns in query result. @param rows: List of rows in query result. @return: Dictionary of totals for each statistics column.
[ "Utility", "method", "that", "returns", "totals", "for", "database", "statistics", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/postgresql.py#L103-L112
train
aouyar/PyMunin
pysysinfo/postgresql.py
PgInfo._simpleQuery
def _simpleQuery(self, query): """Executes simple query which returns a single column. @param query: Query string. @return: Query result string. """ cur = self._conn.cursor() cur.execute(query) row = cur.fetchone() return util.parse_...
python
def _simpleQuery(self, query): """Executes simple query which returns a single column. @param query: Query string. @return: Query result string. """ cur = self._conn.cursor() cur.execute(query) row = cur.fetchone() return util.parse_...
[ "def", "_simpleQuery", "(", "self", ",", "query", ")", ":", "cur", "=", "self", ".", "_conn", ".", "cursor", "(", ")", "cur", ".", "execute", "(", "query", ")", "row", "=", "cur", ".", "fetchone", "(", ")", "return", "util", ".", "parse_value", "("...
Executes simple query which returns a single column. @param query: Query string. @return: Query result string.
[ "Executes", "simple", "query", "which", "returns", "a", "single", "column", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/postgresql.py#L114-L124
train
aouyar/PyMunin
pysysinfo/postgresql.py
PgInfo.getParam
def getParam(self, key): """Returns value of Run-time Database Parameter 'key'. @param key: Run-time parameter name. @return: Run-time parameter value. """ cur = self._conn.cursor() cur.execute("SHOW %s" % key) row = cur.fetchone() ret...
python
def getParam(self, key): """Returns value of Run-time Database Parameter 'key'. @param key: Run-time parameter name. @return: Run-time parameter value. """ cur = self._conn.cursor() cur.execute("SHOW %s" % key) row = cur.fetchone() ret...
[ "def", "getParam", "(", "self", ",", "key", ")", ":", "cur", "=", "self", ".", "_conn", ".", "cursor", "(", ")", "cur", ".", "execute", "(", "\"SHOW %s\"", "%", "key", ")", "row", "=", "cur", ".", "fetchone", "(", ")", "return", "util", ".", "par...
Returns value of Run-time Database Parameter 'key'. @param key: Run-time parameter name. @return: Run-time parameter value.
[ "Returns", "value", "of", "Run", "-", "time", "Database", "Parameter", "key", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/postgresql.py#L151-L161
train
aouyar/PyMunin
pysysinfo/postgresql.py
PgInfo.getConnectionStats
def getConnectionStats(self): """Returns dictionary with number of connections for each database. @return: Dictionary of database connection statistics. """ cur = self._conn.cursor() cur.execute("""SELECT datname,numbackends FROM pg_stat_database;""") ro...
python
def getConnectionStats(self): """Returns dictionary with number of connections for each database. @return: Dictionary of database connection statistics. """ cur = self._conn.cursor() cur.execute("""SELECT datname,numbackends FROM pg_stat_database;""") ro...
[ "def", "getConnectionStats", "(", "self", ")", ":", "cur", "=", "self", ".", "_conn", ".", "cursor", "(", ")", "cur", ".", "execute", "(", "\"\"\"SELECT datname,numbackends FROM pg_stat_database;\"\"\"", ")", "rows", "=", "cur", ".", "fetchall", "(", ")", "if"...
Returns dictionary with number of connections for each database. @return: Dictionary of database connection statistics.
[ "Returns", "dictionary", "with", "number", "of", "connections", "for", "each", "database", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/postgresql.py#L193-L205
train
aouyar/PyMunin
pysysinfo/postgresql.py
PgInfo.getDatabaseStats
def getDatabaseStats(self): """Returns database block read, transaction and tuple stats for each database. @return: Nested dictionary of stats. """ headers = ('datname', 'numbackends', 'xact_commit', 'xact_rollback', 'blks_read', 'blks_hit',...
python
def getDatabaseStats(self): """Returns database block read, transaction and tuple stats for each database. @return: Nested dictionary of stats. """ headers = ('datname', 'numbackends', 'xact_commit', 'xact_rollback', 'blks_read', 'blks_hit',...
[ "def", "getDatabaseStats", "(", "self", ")", ":", "headers", "=", "(", "'datname'", ",", "'numbackends'", ",", "'xact_commit'", ",", "'xact_rollback'", ",", "'blks_read'", ",", "'blks_hit'", ",", "'tup_returned'", ",", "'tup_fetched'", ",", "'tup_inserted'", ",", ...
Returns database block read, transaction and tuple stats for each database. @return: Nested dictionary of stats.
[ "Returns", "database", "block", "read", "transaction", "and", "tuple", "stats", "for", "each", "database", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/postgresql.py#L207-L223
train
aouyar/PyMunin
pysysinfo/postgresql.py
PgInfo.getLockStatsMode
def getLockStatsMode(self): """Returns the number of active lock discriminated by lock mode. @return: : Dictionary of stats. """ info_dict = {'all': dict(zip(self.lockModes, (0,) * len(self.lockModes))), 'wait': dict(zip(self.lockModes, (0,) * len(s...
python
def getLockStatsMode(self): """Returns the number of active lock discriminated by lock mode. @return: : Dictionary of stats. """ info_dict = {'all': dict(zip(self.lockModes, (0,) * len(self.lockModes))), 'wait': dict(zip(self.lockModes, (0,) * len(s...
[ "def", "getLockStatsMode", "(", "self", ")", ":", "info_dict", "=", "{", "'all'", ":", "dict", "(", "zip", "(", "self", ".", "lockModes", ",", "(", "0", ",", ")", "*", "len", "(", "self", ".", "lockModes", ")", ")", ")", ",", "'wait'", ":", "dict...
Returns the number of active lock discriminated by lock mode. @return: : Dictionary of stats.
[ "Returns", "the", "number", "of", "active", "lock", "discriminated", "by", "lock", "mode", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/postgresql.py#L225-L241
train
aouyar/PyMunin
pysysinfo/postgresql.py
PgInfo.getLockStatsDB
def getLockStatsDB(self): """Returns the number of active lock discriminated by database. @return: : Dictionary of stats. """ info_dict = {'all': {}, 'wait': {}} cur = self._conn.cursor() cur.execute("SELECT d.datname, l.granted, COU...
python
def getLockStatsDB(self): """Returns the number of active lock discriminated by database. @return: : Dictionary of stats. """ info_dict = {'all': {}, 'wait': {}} cur = self._conn.cursor() cur.execute("SELECT d.datname, l.granted, COU...
[ "def", "getLockStatsDB", "(", "self", ")", ":", "info_dict", "=", "{", "'all'", ":", "{", "}", ",", "'wait'", ":", "{", "}", "}", "cur", "=", "self", ".", "_conn", ".", "cursor", "(", ")", "cur", ".", "execute", "(", "\"SELECT d.datname, l.granted, COU...
Returns the number of active lock discriminated by database. @return: : Dictionary of stats.
[ "Returns", "the", "number", "of", "active", "lock", "discriminated", "by", "database", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/postgresql.py#L243-L260
train
aouyar/PyMunin
pysysinfo/postgresql.py
PgInfo.getBgWriterStats
def getBgWriterStats(self): """Returns Global Background Writer and Checkpoint Activity stats. @return: Nested dictionary of stats. """ info_dict = {} if self.checkVersion('8.3'): cur = self._conn.cursor(cursor_factory=psycopg2.extras.RealDictCursor)...
python
def getBgWriterStats(self): """Returns Global Background Writer and Checkpoint Activity stats. @return: Nested dictionary of stats. """ info_dict = {} if self.checkVersion('8.3'): cur = self._conn.cursor(cursor_factory=psycopg2.extras.RealDictCursor)...
[ "def", "getBgWriterStats", "(", "self", ")", ":", "info_dict", "=", "{", "}", "if", "self", ".", "checkVersion", "(", "'8.3'", ")", ":", "cur", "=", "self", ".", "_conn", ".", "cursor", "(", "cursor_factory", "=", "psycopg2", ".", "extras", ".", "RealD...
Returns Global Background Writer and Checkpoint Activity stats. @return: Nested dictionary of stats.
[ "Returns", "Global", "Background", "Writer", "and", "Checkpoint", "Activity", "stats", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/postgresql.py#L262-L273
train
aouyar/PyMunin
pysysinfo/postgresql.py
PgInfo.getXlogStatus
def getXlogStatus(self): """Returns Transaction Logging or Recovery Status. @return: Dictionary of status items. """ inRecovery = None if self.checkVersion('9.0'): inRecovery = self._simpleQuery("SELECT pg_is_in_recovery();") cur = self._conn...
python
def getXlogStatus(self): """Returns Transaction Logging or Recovery Status. @return: Dictionary of status items. """ inRecovery = None if self.checkVersion('9.0'): inRecovery = self._simpleQuery("SELECT pg_is_in_recovery();") cur = self._conn...
[ "def", "getXlogStatus", "(", "self", ")", ":", "inRecovery", "=", "None", "if", "self", ".", "checkVersion", "(", "'9.0'", ")", ":", "inRecovery", "=", "self", ".", "_simpleQuery", "(", "\"SELECT pg_is_in_recovery();\"", ")", "cur", "=", "self", ".", "_conn"...
Returns Transaction Logging or Recovery Status. @return: Dictionary of status items.
[ "Returns", "Transaction", "Logging", "or", "Recovery", "Status", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/postgresql.py#L275-L306
train
aouyar/PyMunin
pysysinfo/postgresql.py
PgInfo.getSlaveStatus
def getSlaveStatus(self): """Returns status of replication slaves. @return: Dictionary of status items. """ info_dict = {} if self.checkVersion('9.1'): cols = ['procpid', 'usename', 'application_name', 'client_addr', 'client_port...
python
def getSlaveStatus(self): """Returns status of replication slaves. @return: Dictionary of status items. """ info_dict = {} if self.checkVersion('9.1'): cols = ['procpid', 'usename', 'application_name', 'client_addr', 'client_port...
[ "def", "getSlaveStatus", "(", "self", ")", ":", "info_dict", "=", "{", "}", "if", "self", ".", "checkVersion", "(", "'9.1'", ")", ":", "cols", "=", "[", "'procpid'", ",", "'usename'", ",", "'application_name'", ",", "'client_addr'", ",", "'client_port'", "...
Returns status of replication slaves. @return: Dictionary of status items.
[ "Returns", "status", "of", "replication", "slaves", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/postgresql.py#L308-L328
train
aouyar/PyMunin
pysysinfo/mysql.py
MySQLinfo._connect
def _connect(self): """Establish connection to MySQL Database.""" if self._connParams: self._conn = MySQLdb.connect(**self._connParams) else: self._conn = MySQLdb.connect('')
python
def _connect(self): """Establish connection to MySQL Database.""" if self._connParams: self._conn = MySQLdb.connect(**self._connParams) else: self._conn = MySQLdb.connect('')
[ "def", "_connect", "(", "self", ")", ":", "if", "self", ".", "_connParams", ":", "self", ".", "_conn", "=", "MySQLdb", ".", "connect", "(", "*", "*", "self", ".", "_connParams", ")", "else", ":", "self", ".", "_conn", "=", "MySQLdb", ".", "connect", ...
Establish connection to MySQL Database.
[ "Establish", "connection", "to", "MySQL", "Database", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/mysql.py#L64-L69
train
aouyar/PyMunin
pysysinfo/mysql.py
MySQLinfo.getStorageEngines
def getStorageEngines(self): """Returns list of supported storage engines. @return: List of storage engine names. """ cur = self._conn.cursor() cur.execute("""SHOW STORAGE ENGINES;""") rows = cur.fetchall() if rows: return [row[0].low...
python
def getStorageEngines(self): """Returns list of supported storage engines. @return: List of storage engine names. """ cur = self._conn.cursor() cur.execute("""SHOW STORAGE ENGINES;""") rows = cur.fetchall() if rows: return [row[0].low...
[ "def", "getStorageEngines", "(", "self", ")", ":", "cur", "=", "self", ".", "_conn", ".", "cursor", "(", ")", "cur", ".", "execute", "(", "\"\"\"SHOW STORAGE ENGINES;\"\"\"", ")", "rows", "=", "cur", ".", "fetchall", "(", ")", "if", "rows", ":", "return"...
Returns list of supported storage engines. @return: List of storage engine names.
[ "Returns", "list", "of", "supported", "storage", "engines", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/mysql.py#L71-L83
train
aouyar/PyMunin
pysysinfo/mysql.py
MySQLinfo.getParam
def getParam(self, key): """Returns value of Run-time Database Parameter 'key'. @param key: Run-time parameter name. @return: Run-time parameter value. """ cur = self._conn.cursor() cur.execute("SHOW GLOBAL VARIABLES LIKE %s", key) row = cur.f...
python
def getParam(self, key): """Returns value of Run-time Database Parameter 'key'. @param key: Run-time parameter name. @return: Run-time parameter value. """ cur = self._conn.cursor() cur.execute("SHOW GLOBAL VARIABLES LIKE %s", key) row = cur.f...
[ "def", "getParam", "(", "self", ",", "key", ")", ":", "cur", "=", "self", ".", "_conn", ".", "cursor", "(", ")", "cur", ".", "execute", "(", "\"SHOW GLOBAL VARIABLES LIKE %s\"", ",", "key", ")", "row", "=", "cur", ".", "fetchone", "(", ")", "return", ...
Returns value of Run-time Database Parameter 'key'. @param key: Run-time parameter name. @return: Run-time parameter value.
[ "Returns", "value", "of", "Run", "-", "time", "Database", "Parameter", "key", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/mysql.py#L85-L95
train
aouyar/PyMunin
pysysinfo/mysql.py
MySQLinfo.getParams
def getParams(self): """Returns dictionary of all run-time parameters. @return: Dictionary of all Run-time parameters. """ cur = self._conn.cursor() cur.execute("SHOW GLOBAL VARIABLES") rows = cur.fetchall() info_dict = {} for row in rows...
python
def getParams(self): """Returns dictionary of all run-time parameters. @return: Dictionary of all Run-time parameters. """ cur = self._conn.cursor() cur.execute("SHOW GLOBAL VARIABLES") rows = cur.fetchall() info_dict = {} for row in rows...
[ "def", "getParams", "(", "self", ")", ":", "cur", "=", "self", ".", "_conn", ".", "cursor", "(", ")", "cur", ".", "execute", "(", "\"SHOW GLOBAL VARIABLES\"", ")", "rows", "=", "cur", ".", "fetchall", "(", ")", "info_dict", "=", "{", "}", "for", "row...
Returns dictionary of all run-time parameters. @return: Dictionary of all Run-time parameters.
[ "Returns", "dictionary", "of", "all", "run", "-", "time", "parameters", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/mysql.py#L97-L111
train
aouyar/PyMunin
pysysinfo/mysql.py
MySQLinfo.getProcessStatus
def getProcessStatus(self): """Returns number of processes discriminated by state. @return: Dictionary mapping process state to number of processes. """ info_dict = {} cur = self._conn.cursor() cur.execute("""SHOW FULL PROCESSLIST;""") rows = cur...
python
def getProcessStatus(self): """Returns number of processes discriminated by state. @return: Dictionary mapping process state to number of processes. """ info_dict = {} cur = self._conn.cursor() cur.execute("""SHOW FULL PROCESSLIST;""") rows = cur...
[ "def", "getProcessStatus", "(", "self", ")", ":", "info_dict", "=", "{", "}", "cur", "=", "self", ".", "_conn", ".", "cursor", "(", ")", "cur", ".", "execute", "(", "\"\"\"SHOW FULL PROCESSLIST;\"\"\"", ")", "rows", "=", "cur", ".", "fetchall", "(", ")",...
Returns number of processes discriminated by state. @return: Dictionary mapping process state to number of processes.
[ "Returns", "number", "of", "processes", "discriminated", "by", "state", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/mysql.py#L129-L148
train
aouyar/PyMunin
pysysinfo/mysql.py
MySQLinfo.getProcessDatabase
def getProcessDatabase(self): """Returns number of processes discriminated by database name. @return: Dictionary mapping database name to number of processes. """ info_dict = {} cur = self._conn.cursor() cur.execute("""SHOW FULL PROCESSLIST;""") ...
python
def getProcessDatabase(self): """Returns number of processes discriminated by database name. @return: Dictionary mapping database name to number of processes. """ info_dict = {} cur = self._conn.cursor() cur.execute("""SHOW FULL PROCESSLIST;""") ...
[ "def", "getProcessDatabase", "(", "self", ")", ":", "info_dict", "=", "{", "}", "cur", "=", "self", ".", "_conn", ".", "cursor", "(", ")", "cur", ".", "execute", "(", "\"\"\"SHOW FULL PROCESSLIST;\"\"\"", ")", "rows", "=", "cur", ".", "fetchall", "(", ")...
Returns number of processes discriminated by database name. @return: Dictionary mapping database name to number of processes.
[ "Returns", "number", "of", "processes", "discriminated", "by", "database", "name", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/mysql.py#L150-L164
train
aouyar/PyMunin
pysysinfo/mysql.py
MySQLinfo.getDatabases
def getDatabases(self): """Returns list of databases. @return: List of databases. """ cur = self._conn.cursor() cur.execute("""SHOW DATABASES;""") rows = cur.fetchall() if rows: return [row[0] for row in rows] else: ...
python
def getDatabases(self): """Returns list of databases. @return: List of databases. """ cur = self._conn.cursor() cur.execute("""SHOW DATABASES;""") rows = cur.fetchall() if rows: return [row[0] for row in rows] else: ...
[ "def", "getDatabases", "(", "self", ")", ":", "cur", "=", "self", ".", "_conn", ".", "cursor", "(", ")", "cur", ".", "execute", "(", "\"\"\"SHOW DATABASES;\"\"\"", ")", "rows", "=", "cur", ".", "fetchall", "(", ")", "if", "rows", ":", "return", "[", ...
Returns list of databases. @return: List of databases.
[ "Returns", "list", "of", "databases", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/mysql.py#L166-L178
train
ContextLab/quail
quail/analysis/spc.py
spc_helper
def spc_helper(egg, match='exact', distance='euclidean', features=None): """ Computes probability of a word being recalled (in the appropriate recall list), given its presentation position Parameters ---------- egg : quail.Egg Data to analyze match : str (exact, best or ...
python
def spc_helper(egg, match='exact', distance='euclidean', features=None): """ Computes probability of a word being recalled (in the appropriate recall list), given its presentation position Parameters ---------- egg : quail.Egg Data to analyze match : str (exact, best or ...
[ "def", "spc_helper", "(", "egg", ",", "match", "=", "'exact'", ",", "distance", "=", "'euclidean'", ",", "features", "=", "None", ")", ":", "def", "spc", "(", "lst", ")", ":", "d", "=", "np", ".", "zeros_like", "(", "egg", ".", "pres", ".", "values...
Computes probability of a word being recalled (in the appropriate recall list), given its presentation position Parameters ---------- egg : quail.Egg Data to analyze match : str (exact, best or smooth) Matching approach to compute recall matrix. If exact, the presented and rec...
[ "Computes", "probability", "of", "a", "word", "being", "recalled", "(", "in", "the", "appropriate", "recall", "list", ")", "given", "its", "presentation", "position" ]
71dd53c792dd915dc84879d8237e3582dd68b7a4
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/analysis/spc.py#L4-L51
train
aouyar/PyMunin
pysysinfo/tomcat.py
TomcatInfo._retrieve
def _retrieve(self): """Query Apache Tomcat Server Status Page in XML format and return the result as an ElementTree object. @return: ElementTree object of Status Page XML. """ url = "%s://%s:%d/manager/status" % (self._proto, self._host, self._port) pa...
python
def _retrieve(self): """Query Apache Tomcat Server Status Page in XML format and return the result as an ElementTree object. @return: ElementTree object of Status Page XML. """ url = "%s://%s:%d/manager/status" % (self._proto, self._host, self._port) pa...
[ "def", "_retrieve", "(", "self", ")", ":", "url", "=", "\"%s://%s:%d/manager/status\"", "%", "(", "self", ".", "_proto", ",", "self", ".", "_host", ",", "self", ".", "_port", ")", "params", "=", "{", "}", "params", "[", "'XML'", "]", "=", "'true'", "...
Query Apache Tomcat Server Status Page in XML format and return the result as an ElementTree object. @return: ElementTree object of Status Page XML.
[ "Query", "Apache", "Tomcat", "Server", "Status", "Page", "in", "XML", "format", "and", "return", "the", "result", "as", "an", "ElementTree", "object", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/tomcat.py#L67-L79
train
aouyar/PyMunin
pysysinfo/tomcat.py
TomcatInfo.getMemoryStats
def getMemoryStats(self): """Return JVM Memory Stats for Apache Tomcat Server. @return: Dictionary of memory utilization stats. """ if self._statusxml is None: self.initStats() node = self._statusxml.find('jvm/memory') memstats = {} i...
python
def getMemoryStats(self): """Return JVM Memory Stats for Apache Tomcat Server. @return: Dictionary of memory utilization stats. """ if self._statusxml is None: self.initStats() node = self._statusxml.find('jvm/memory') memstats = {} i...
[ "def", "getMemoryStats", "(", "self", ")", ":", "if", "self", ".", "_statusxml", "is", "None", ":", "self", ".", "initStats", "(", ")", "node", "=", "self", ".", "_statusxml", ".", "find", "(", "'jvm/memory'", ")", "memstats", "=", "{", "}", "if", "n...
Return JVM Memory Stats for Apache Tomcat Server. @return: Dictionary of memory utilization stats.
[ "Return", "JVM", "Memory", "Stats", "for", "Apache", "Tomcat", "Server", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/tomcat.py#L85-L98
train
aouyar/PyMunin
pysysinfo/tomcat.py
TomcatInfo.getConnectorStats
def getConnectorStats(self): """Return dictionary of Connector Stats for Apache Tomcat Server. @return: Nested dictionary of Connector Stats. """ if self._statusxml is None: self.initStats() connnodes = self._statusxml.findall('connector') co...
python
def getConnectorStats(self): """Return dictionary of Connector Stats for Apache Tomcat Server. @return: Nested dictionary of Connector Stats. """ if self._statusxml is None: self.initStats() connnodes = self._statusxml.findall('connector') co...
[ "def", "getConnectorStats", "(", "self", ")", ":", "if", "self", ".", "_statusxml", "is", "None", ":", "self", ".", "initStats", "(", ")", "connnodes", "=", "self", ".", "_statusxml", ".", "findall", "(", "'connector'", ")", "connstats", "=", "{", "}", ...
Return dictionary of Connector Stats for Apache Tomcat Server. @return: Nested dictionary of Connector Stats.
[ "Return", "dictionary", "of", "Connector", "Stats", "for", "Apache", "Tomcat", "Server", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/tomcat.py#L100-L130
train
ContextLab/quail
quail/load.py
load
def load(filepath, update=True): """ Loads eggs, fried eggs ands example data Parameters ---------- filepath : str Location of file update : bool If true, updates egg to latest format Returns ---------- data : quail.Egg or quail.FriedEgg Data loaded from di...
python
def load(filepath, update=True): """ Loads eggs, fried eggs ands example data Parameters ---------- filepath : str Location of file update : bool If true, updates egg to latest format Returns ---------- data : quail.Egg or quail.FriedEgg Data loaded from di...
[ "def", "load", "(", "filepath", ",", "update", "=", "True", ")", ":", "if", "filepath", "==", "'automatic'", "or", "filepath", "==", "'example'", ":", "fpath", "=", "os", ".", "path", ".", "dirname", "(", "os", ".", "path", ".", "abspath", "(", "__fi...
Loads eggs, fried eggs ands example data Parameters ---------- filepath : str Location of file update : bool If true, updates egg to latest format Returns ---------- data : quail.Egg or quail.FriedEgg Data loaded from disk
[ "Loads", "eggs", "fried", "eggs", "ands", "example", "data" ]
71dd53c792dd915dc84879d8237e3582dd68b7a4
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/load.py#L22-L54
train
ContextLab/quail
quail/load.py
load_fegg
def load_fegg(filepath, update=True): """ Loads pickled egg Parameters ---------- filepath : str Location of pickled egg update : bool If true, updates egg to latest format Returns ---------- egg : Egg data object A loaded unpickled egg """ try: ...
python
def load_fegg(filepath, update=True): """ Loads pickled egg Parameters ---------- filepath : str Location of pickled egg update : bool If true, updates egg to latest format Returns ---------- egg : Egg data object A loaded unpickled egg """ try: ...
[ "def", "load_fegg", "(", "filepath", ",", "update", "=", "True", ")", ":", "try", ":", "egg", "=", "FriedEgg", "(", "*", "*", "dd", ".", "io", ".", "load", "(", "filepath", ")", ")", "except", "ValueError", "as", "e", ":", "print", "(", "e", ")",...
Loads pickled egg Parameters ---------- filepath : str Location of pickled egg update : bool If true, updates egg to latest format Returns ---------- egg : Egg data object A loaded unpickled egg
[ "Loads", "pickled", "egg" ]
71dd53c792dd915dc84879d8237e3582dd68b7a4
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/load.py#L56-L85
train
ContextLab/quail
quail/load.py
load_egg
def load_egg(filepath, update=True): """ Loads pickled egg Parameters ---------- filepath : str Location of pickled egg update : bool If true, updates egg to latest format Returns ---------- egg : Egg data object A loaded unpickled egg """ try: ...
python
def load_egg(filepath, update=True): """ Loads pickled egg Parameters ---------- filepath : str Location of pickled egg update : bool If true, updates egg to latest format Returns ---------- egg : Egg data object A loaded unpickled egg """ try: ...
[ "def", "load_egg", "(", "filepath", ",", "update", "=", "True", ")", ":", "try", ":", "egg", "=", "Egg", "(", "*", "*", "dd", ".", "io", ".", "load", "(", "filepath", ")", ")", "except", ":", "# if error, try loading old format", "with", "open", "(", ...
Loads pickled egg Parameters ---------- filepath : str Location of pickled egg update : bool If true, updates egg to latest format Returns ---------- egg : Egg data object A loaded unpickled egg
[ "Loads", "pickled", "egg" ]
71dd53c792dd915dc84879d8237e3582dd68b7a4
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/load.py#L87-L121
train
ContextLab/quail
quail/load.py
loadEL
def loadEL(dbpath=None, recpath=None, remove_subs=None, wordpool=None, groupby=None, experiments=None, filters=None): ''' Function that loads sql files generated by autoFR Experiment ''' assert (dbpath is not None), "You must specify a db file or files." assert (recpath is not None), "You must ...
python
def loadEL(dbpath=None, recpath=None, remove_subs=None, wordpool=None, groupby=None, experiments=None, filters=None): ''' Function that loads sql files generated by autoFR Experiment ''' assert (dbpath is not None), "You must specify a db file or files." assert (recpath is not None), "You must ...
[ "def", "loadEL", "(", "dbpath", "=", "None", ",", "recpath", "=", "None", ",", "remove_subs", "=", "None", ",", "wordpool", "=", "None", ",", "groupby", "=", "None", ",", "experiments", "=", "None", ",", "filters", "=", "None", ")", ":", "assert", "(...
Function that loads sql files generated by autoFR Experiment
[ "Function", "that", "loads", "sql", "files", "generated", "by", "autoFR", "Experiment" ]
71dd53c792dd915dc84879d8237e3582dd68b7a4
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/load.py#L123-L514
train
ContextLab/quail
quail/load.py
load_example_data
def load_example_data(dataset='automatic'): """ Loads example data The automatic and manual example data are eggs containing 30 subjects who completed a free recall experiment as described here: https://psyarxiv.com/psh48/. The subjects studied 8 lists of 16 words each and then performed a free rec...
python
def load_example_data(dataset='automatic'): """ Loads example data The automatic and manual example data are eggs containing 30 subjects who completed a free recall experiment as described here: https://psyarxiv.com/psh48/. The subjects studied 8 lists of 16 words each and then performed a free rec...
[ "def", "load_example_data", "(", "dataset", "=", "'automatic'", ")", ":", "# can only be auto or manual", "assert", "dataset", "in", "[", "'automatic'", ",", "'manual'", ",", "'naturalistic'", "]", ",", "\"Dataset can only be automatic, manual, or naturalistic\"", "if", "...
Loads example data The automatic and manual example data are eggs containing 30 subjects who completed a free recall experiment as described here: https://psyarxiv.com/psh48/. The subjects studied 8 lists of 16 words each and then performed a free recall test. The naturalistic example data is is an eg...
[ "Loads", "example", "data" ]
71dd53c792dd915dc84879d8237e3582dd68b7a4
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/load.py#L516-L564
train
aouyar/PyMunin
pymunin/plugins/fsstats.py
MuninFreeswitchPlugin.retrieveVals
def retrieveVals(self): """Retrieve values for graphs.""" fs = FSinfo(self._fshost, self._fsport, self._fspass) if self.hasGraph('fs_calls'): count = fs.getCallCount() self.setGraphVal('fs_calls', 'calls', count) if self.hasGraph('fs_channels'): count ...
python
def retrieveVals(self): """Retrieve values for graphs.""" fs = FSinfo(self._fshost, self._fsport, self._fspass) if self.hasGraph('fs_calls'): count = fs.getCallCount() self.setGraphVal('fs_calls', 'calls', count) if self.hasGraph('fs_channels'): count ...
[ "def", "retrieveVals", "(", "self", ")", ":", "fs", "=", "FSinfo", "(", "self", ".", "_fshost", ",", "self", ".", "_fsport", ",", "self", ".", "_fspass", ")", "if", "self", ".", "hasGraph", "(", "'fs_calls'", ")", ":", "count", "=", "fs", ".", "get...
Retrieve values for graphs.
[ "Retrieve", "values", "for", "graphs", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/fsstats.py#L100-L108
train
aouyar/PyMunin
pymunin/plugins/fsstats.py
MuninFreeswitchPlugin.autoconf
def autoconf(self): """Implements Munin Plugin Auto-Configuration Option. @return: True if plugin can be auto-configured, False otherwise. """ fs = FSinfo(self._fshost, self._fsport, self._fspass) return fs is not None
python
def autoconf(self): """Implements Munin Plugin Auto-Configuration Option. @return: True if plugin can be auto-configured, False otherwise. """ fs = FSinfo(self._fshost, self._fsport, self._fspass) return fs is not None
[ "def", "autoconf", "(", "self", ")", ":", "fs", "=", "FSinfo", "(", "self", ".", "_fshost", ",", "self", ".", "_fsport", ",", "self", ".", "_fspass", ")", "return", "fs", "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/fsstats.py#L110-L117
train
scikit-umfpack/scikit-umfpack
scikits/umfpack/interface.py
spsolve
def spsolve(A, b): """Solve the sparse linear system Ax=b, where b may be a vector or a matrix. Parameters ---------- A : ndarray or sparse matrix The square matrix A will be converted into CSC or CSR form b : ndarray or sparse matrix The matrix or vector representing the right hand...
python
def spsolve(A, b): """Solve the sparse linear system Ax=b, where b may be a vector or a matrix. Parameters ---------- A : ndarray or sparse matrix The square matrix A will be converted into CSC or CSR form b : ndarray or sparse matrix The matrix or vector representing the right hand...
[ "def", "spsolve", "(", "A", ",", "b", ")", ":", "x", "=", "UmfpackLU", "(", "A", ")", ".", "solve", "(", "b", ")", "if", "b", ".", "ndim", "==", "2", "and", "b", ".", "shape", "[", "1", "]", "==", "1", ":", "# compatibility with scipy.sparse.spso...
Solve the sparse linear system Ax=b, where b may be a vector or a matrix. Parameters ---------- A : ndarray or sparse matrix The square matrix A will be converted into CSC or CSR form b : ndarray or sparse matrix The matrix or vector representing the right hand side of the equation. ...
[ "Solve", "the", "sparse", "linear", "system", "Ax", "=", "b", "where", "b", "may", "be", "a", "vector", "or", "a", "matrix", "." ]
a2102ef92f4dd060138e72bb5d7c444f8ec49cbc
https://github.com/scikit-umfpack/scikit-umfpack/blob/a2102ef92f4dd060138e72bb5d7c444f8ec49cbc/scikits/umfpack/interface.py#L44-L68
train
scikit-umfpack/scikit-umfpack
scikits/umfpack/interface.py
UmfpackLU.solve
def solve(self, b): """ Solve linear equation A x = b for x Parameters ---------- b : ndarray Right-hand side of the matrix equation. Can be vector or a matrix. Returns ------- x : ndarray Solution to the matrix equation ...
python
def solve(self, b): """ Solve linear equation A x = b for x Parameters ---------- b : ndarray Right-hand side of the matrix equation. Can be vector or a matrix. Returns ------- x : ndarray Solution to the matrix equation ...
[ "def", "solve", "(", "self", ",", "b", ")", ":", "if", "isspmatrix", "(", "b", ")", ":", "b", "=", "b", ".", "toarray", "(", ")", "if", "b", ".", "shape", "[", "0", "]", "!=", "self", ".", "_A", ".", "shape", "[", "1", "]", ":", "raise", ...
Solve linear equation A x = b for x Parameters ---------- b : ndarray Right-hand side of the matrix equation. Can be vector or a matrix. Returns ------- x : ndarray Solution to the matrix equation
[ "Solve", "linear", "equation", "A", "x", "=", "b", "for", "x" ]
a2102ef92f4dd060138e72bb5d7c444f8ec49cbc
https://github.com/scikit-umfpack/scikit-umfpack/blob/a2102ef92f4dd060138e72bb5d7c444f8ec49cbc/scikits/umfpack/interface.py#L215-L240
train
scikit-umfpack/scikit-umfpack
scikits/umfpack/interface.py
UmfpackLU.solve_sparse
def solve_sparse(self, B): """ Solve linear equation of the form A X = B. Where B and X are sparse matrices. Parameters ---------- B : any scipy.sparse matrix Right-hand side of the matrix equation. Note: it will be converted to csc_matrix via `.tocsc()`....
python
def solve_sparse(self, B): """ Solve linear equation of the form A X = B. Where B and X are sparse matrices. Parameters ---------- B : any scipy.sparse matrix Right-hand side of the matrix equation. Note: it will be converted to csc_matrix via `.tocsc()`....
[ "def", "solve_sparse", "(", "self", ",", "B", ")", ":", "B", "=", "B", ".", "tocsc", "(", ")", "cols", "=", "list", "(", ")", "for", "j", "in", "xrange", "(", "B", ".", "shape", "[", "1", "]", ")", ":", "col", "=", "self", ".", "solve", "("...
Solve linear equation of the form A X = B. Where B and X are sparse matrices. Parameters ---------- B : any scipy.sparse matrix Right-hand side of the matrix equation. Note: it will be converted to csc_matrix via `.tocsc()`. Returns ------- X : c...
[ "Solve", "linear", "equation", "of", "the", "form", "A", "X", "=", "B", ".", "Where", "B", "and", "X", "are", "sparse", "matrices", "." ]
a2102ef92f4dd060138e72bb5d7c444f8ec49cbc
https://github.com/scikit-umfpack/scikit-umfpack/blob/a2102ef92f4dd060138e72bb5d7c444f8ec49cbc/scikits/umfpack/interface.py#L242-L262
train
ContextLab/quail
quail/analysis/recmat.py
recall_matrix
def recall_matrix(egg, match='exact', distance='euclidean', features=None): """ Computes recall matrix given list of presented and list of recalled words Parameters ---------- egg : quail.Egg Data to analyze match : str (exact, best or smooth) Matching approach to compute recal...
python
def recall_matrix(egg, match='exact', distance='euclidean', features=None): """ Computes recall matrix given list of presented and list of recalled words Parameters ---------- egg : quail.Egg Data to analyze match : str (exact, best or smooth) Matching approach to compute recal...
[ "def", "recall_matrix", "(", "egg", ",", "match", "=", "'exact'", ",", "distance", "=", "'euclidean'", ",", "features", "=", "None", ")", ":", "if", "match", "in", "[", "'best'", ",", "'smooth'", "]", ":", "if", "not", "features", ":", "features", "=",...
Computes recall matrix given list of presented and list of recalled words Parameters ---------- egg : quail.Egg Data to analyze match : str (exact, best or smooth) Matching approach to compute recall matrix. If exact, the presented and recalled items must be identical (default...
[ "Computes", "recall", "matrix", "given", "list", "of", "presented", "and", "list", "of", "recalled", "words" ]
71dd53c792dd915dc84879d8237e3582dd68b7a4
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/analysis/recmat.py#L7-L51
train
aouyar/PyMunin
pymunin/plugins/netstats.py
MuninNetstatsPlugin.retrieveVals
def retrieveVals(self): """Retrieve values for graphs.""" net_info = NetstatInfo() if self.hasGraph('netstat_conn_status'): stats = net_info.getTCPportConnStatus(include_listen=True) for fname in ('listen', 'established', 'syn_sent', 'syn_recv', ...
python
def retrieveVals(self): """Retrieve values for graphs.""" net_info = NetstatInfo() if self.hasGraph('netstat_conn_status'): stats = net_info.getTCPportConnStatus(include_listen=True) for fname in ('listen', 'established', 'syn_sent', 'syn_recv', ...
[ "def", "retrieveVals", "(", "self", ")", ":", "net_info", "=", "NetstatInfo", "(", ")", "if", "self", ".", "hasGraph", "(", "'netstat_conn_status'", ")", ":", "stats", "=", "net_info", ".", "getTCPportConnStatus", "(", "include_listen", "=", "True", ")", "fo...
Retrieve values for graphs.
[ "Retrieve", "values", "for", "graphs", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/netstats.py#L122-L139
train
aouyar/PyMunin
pysysinfo/asterisk.py
AsteriskInfo._parseFreePBXconf
def _parseFreePBXconf(self): """Parses FreePBX configuration file /etc/amportal for user and password for Asterisk Manager Interface. @return: True if configuration file is found and parsed successfully. """ amiuser = None amipass = None if os.pa...
python
def _parseFreePBXconf(self): """Parses FreePBX configuration file /etc/amportal for user and password for Asterisk Manager Interface. @return: True if configuration file is found and parsed successfully. """ amiuser = None amipass = None if os.pa...
[ "def", "_parseFreePBXconf", "(", "self", ")", ":", "amiuser", "=", "None", "amipass", "=", "None", "if", "os", ".", "path", ".", "isfile", "(", "confFileFreePBX", ")", ":", "try", ":", "fp", "=", "open", "(", "confFileFreePBX", ",", "'r'", ")", "data",...
Parses FreePBX configuration file /etc/amportal for user and password for Asterisk Manager Interface. @return: True if configuration file is found and parsed successfully.
[ "Parses", "FreePBX", "configuration", "file", "/", "etc", "/", "amportal", "for", "user", "and", "password", "for", "Asterisk", "Manager", "Interface", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L85-L112
train
aouyar/PyMunin
pysysinfo/asterisk.py
AsteriskInfo._parseAsteriskConf
def _parseAsteriskConf(self): """Parses Asterisk configuration file /etc/asterisk/manager.conf for user and password for Manager Interface. Returns True on success. @return: True if configuration file is found and parsed successfully. """ if os.path.isfile(confF...
python
def _parseAsteriskConf(self): """Parses Asterisk configuration file /etc/asterisk/manager.conf for user and password for Manager Interface. Returns True on success. @return: True if configuration file is found and parsed successfully. """ if os.path.isfile(confF...
[ "def", "_parseAsteriskConf", "(", "self", ")", ":", "if", "os", ".", "path", ".", "isfile", "(", "confFileAMI", ")", ":", "try", ":", "fp", "=", "open", "(", "confFileAMI", ",", "'r'", ")", "data", "=", "fp", ".", "read", "(", ")", "fp", ".", "cl...
Parses Asterisk configuration file /etc/asterisk/manager.conf for user and password for Manager Interface. Returns True on success. @return: True if configuration file is found and parsed successfully.
[ "Parses", "Asterisk", "configuration", "file", "/", "etc", "/", "asterisk", "/", "manager", ".", "conf", "for", "user", "and", "password", "for", "Manager", "Interface", ".", "Returns", "True", "on", "success", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L114-L135
train
aouyar/PyMunin
pysysinfo/asterisk.py
AsteriskInfo._connect
def _connect(self): """Connect to Asterisk Manager Interface.""" try: if sys.version_info[:2] >= (2,6): self._conn = telnetlib.Telnet(self._amihost, self._amiport, connTimeout) else: self._conn = telne...
python
def _connect(self): """Connect to Asterisk Manager Interface.""" try: if sys.version_info[:2] >= (2,6): self._conn = telnetlib.Telnet(self._amihost, self._amiport, connTimeout) else: self._conn = telne...
[ "def", "_connect", "(", "self", ")", ":", "try", ":", "if", "sys", ".", "version_info", "[", ":", "2", "]", ">=", "(", "2", ",", "6", ")", ":", "self", ".", "_conn", "=", "telnetlib", ".", "Telnet", "(", "self", ".", "_amihost", ",", "self", "....
Connect to Asterisk Manager Interface.
[ "Connect", "to", "Asterisk", "Manager", "Interface", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L137-L150
train
aouyar/PyMunin
pysysinfo/asterisk.py
AsteriskInfo._sendAction
def _sendAction(self, action, attrs=None, chan_vars=None): """Send action to Asterisk Manager Interface. @param action: Action name @param attrs: Tuple of key-value pairs for action attributes. @param chan_vars: Tuple of key-value pairs for channel variables. """...
python
def _sendAction(self, action, attrs=None, chan_vars=None): """Send action to Asterisk Manager Interface. @param action: Action name @param attrs: Tuple of key-value pairs for action attributes. @param chan_vars: Tuple of key-value pairs for channel variables. """...
[ "def", "_sendAction", "(", "self", ",", "action", ",", "attrs", "=", "None", ",", "chan_vars", "=", "None", ")", ":", "self", ".", "_conn", ".", "write", "(", "\"Action: %s\\r\\n\"", "%", "action", ")", "if", "attrs", ":", "for", "(", "key", ",", "va...
Send action to Asterisk Manager Interface. @param action: Action name @param attrs: Tuple of key-value pairs for action attributes. @param chan_vars: Tuple of key-value pairs for channel variables.
[ "Send", "action", "to", "Asterisk", "Manager", "Interface", ".", "@param", "action", ":", "Action", "name", "@param", "attrs", ":", "Tuple", "of", "key", "-", "value", "pairs", "for", "action", "attributes", ".", "@param", "chan_vars", ":", "Tuple", "of", ...
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L152-L167
train
aouyar/PyMunin
pysysinfo/asterisk.py
AsteriskInfo._getResponse
def _getResponse(self): """Read and parse response from Asterisk Manager Interface. @return: Dictionary with response key-value pairs. """ resp_dict= dict() resp_str = self._conn.read_until("\r\n\r\n", connTimeout) for line in resp_str.split("\r\n"): ...
python
def _getResponse(self): """Read and parse response from Asterisk Manager Interface. @return: Dictionary with response key-value pairs. """ resp_dict= dict() resp_str = self._conn.read_until("\r\n\r\n", connTimeout) for line in resp_str.split("\r\n"): ...
[ "def", "_getResponse", "(", "self", ")", ":", "resp_dict", "=", "dict", "(", ")", "resp_str", "=", "self", ".", "_conn", ".", "read_until", "(", "\"\\r\\n\\r\\n\"", ",", "connTimeout", ")", "for", "line", "in", "resp_str", ".", "split", "(", "\"\\r\\n\"", ...
Read and parse response from Asterisk Manager Interface. @return: Dictionary with response key-value pairs.
[ "Read", "and", "parse", "response", "from", "Asterisk", "Manager", "Interface", ".", "@return", ":", "Dictionary", "with", "response", "key", "-", "value", "pairs", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L169-L185
train
aouyar/PyMunin
pysysinfo/asterisk.py
AsteriskInfo._getGreeting
def _getGreeting(self): """Read and parse Asterisk Manager Interface Greeting to determine and set Manager Interface version. """ greeting = self._conn.read_until("\r\n", connTimeout) mobj = re.match('Asterisk Call Manager\/([\d\.]+)\s*$', greeting) if mobj: ...
python
def _getGreeting(self): """Read and parse Asterisk Manager Interface Greeting to determine and set Manager Interface version. """ greeting = self._conn.read_until("\r\n", connTimeout) mobj = re.match('Asterisk Call Manager\/([\d\.]+)\s*$', greeting) if mobj: ...
[ "def", "_getGreeting", "(", "self", ")", ":", "greeting", "=", "self", ".", "_conn", ".", "read_until", "(", "\"\\r\\n\"", ",", "connTimeout", ")", "mobj", "=", "re", ".", "match", "(", "'Asterisk Call Manager\\/([\\d\\.]+)\\s*$'", ",", "greeting", ")", "if", ...
Read and parse Asterisk Manager Interface Greeting to determine and set Manager Interface version.
[ "Read", "and", "parse", "Asterisk", "Manager", "Interface", "Greeting", "to", "determine", "and", "set", "Manager", "Interface", "version", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L192-L202
train
aouyar/PyMunin
pysysinfo/asterisk.py
AsteriskInfo._initAsteriskVersion
def _initAsteriskVersion(self): """Query Asterisk Manager Interface for Asterisk Version to configure system for compatibility with multiple versions . CLI Command - core show version """ if self._ami_version > util.SoftwareVersion('1.0'): cmd = "core show ve...
python
def _initAsteriskVersion(self): """Query Asterisk Manager Interface for Asterisk Version to configure system for compatibility with multiple versions . CLI Command - core show version """ if self._ami_version > util.SoftwareVersion('1.0'): cmd = "core show ve...
[ "def", "_initAsteriskVersion", "(", "self", ")", ":", "if", "self", ".", "_ami_version", ">", "util", ".", "SoftwareVersion", "(", "'1.0'", ")", ":", "cmd", "=", "\"core show version\"", "else", ":", "cmd", "=", "\"show version\"", "cmdresp", "=", "self", "....
Query Asterisk Manager Interface for Asterisk Version to configure system for compatibility with multiple versions . CLI Command - core show version
[ "Query", "Asterisk", "Manager", "Interface", "for", "Asterisk", "Version", "to", "configure", "system", "for", "compatibility", "with", "multiple", "versions", ".", "CLI", "Command", "-", "core", "show", "version" ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L204-L220
train
aouyar/PyMunin
pysysinfo/asterisk.py
AsteriskInfo._login
def _login(self): """Login to Asterisk Manager Interface.""" self._sendAction("login", ( ("Username", self._amiuser), ("Secret", self._amipass), ("Events", "off"), )) resp = self._getResponse() if resp.get("Response") == "Success": ...
python
def _login(self): """Login to Asterisk Manager Interface.""" self._sendAction("login", ( ("Username", self._amiuser), ("Secret", self._amipass), ("Events", "off"), )) resp = self._getResponse() if resp.get("Response") == "Success": ...
[ "def", "_login", "(", "self", ")", ":", "self", ".", "_sendAction", "(", "\"login\"", ",", "(", "(", "\"Username\"", ",", "self", ".", "_amiuser", ")", ",", "(", "\"Secret\"", ",", "self", ".", "_amipass", ")", ",", "(", "\"Events\"", ",", "\"off\"", ...
Login to Asterisk Manager Interface.
[ "Login", "to", "Asterisk", "Manager", "Interface", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L222-L233
train
aouyar/PyMunin
pysysinfo/asterisk.py
AsteriskInfo.executeCommand
def executeCommand(self, command): """Send Action to Asterisk Manager Interface to execute CLI Command. @param command: CLI command to execute. @return: Command response string. """ self._sendAction("Command", ( ("Command", command), )) ...
python
def executeCommand(self, command): """Send Action to Asterisk Manager Interface to execute CLI Command. @param command: CLI command to execute. @return: Command response string. """ self._sendAction("Command", ( ("Command", command), )) ...
[ "def", "executeCommand", "(", "self", ",", "command", ")", ":", "self", ".", "_sendAction", "(", "\"Command\"", ",", "(", "(", "\"Command\"", ",", "command", ")", ",", ")", ")", "resp", "=", "self", ".", "_getResponse", "(", ")", "result", "=", "resp",...
Send Action to Asterisk Manager Interface to execute CLI Command. @param command: CLI command to execute. @return: Command response string.
[ "Send", "Action", "to", "Asterisk", "Manager", "Interface", "to", "execute", "CLI", "Command", ".", "@param", "command", ":", "CLI", "command", "to", "execute", ".", "@return", ":", "Command", "response", "string", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L235-L255
train
aouyar/PyMunin
pysysinfo/asterisk.py
AsteriskInfo._initModuleList
def _initModuleList(self): """Query Asterisk Manager Interface to initialize internal list of loaded modules. CLI Command - core show modules """ if self.checkVersion('1.4'): cmd = "module show" else: cmd = "show modules" ...
python
def _initModuleList(self): """Query Asterisk Manager Interface to initialize internal list of loaded modules. CLI Command - core show modules """ if self.checkVersion('1.4'): cmd = "module show" else: cmd = "show modules" ...
[ "def", "_initModuleList", "(", "self", ")", ":", "if", "self", ".", "checkVersion", "(", "'1.4'", ")", ":", "cmd", "=", "\"module show\"", "else", ":", "cmd", "=", "\"show modules\"", "cmdresp", "=", "self", ".", "executeCommand", "(", "cmd", ")", "self", ...
Query Asterisk Manager Interface to initialize internal list of loaded modules. CLI Command - core show modules
[ "Query", "Asterisk", "Manager", "Interface", "to", "initialize", "internal", "list", "of", "loaded", "modules", ".", "CLI", "Command", "-", "core", "show", "modules" ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L257-L273
train
aouyar/PyMunin
pysysinfo/asterisk.py
AsteriskInfo._initApplicationList
def _initApplicationList(self): """Query Asterisk Manager Interface to initialize internal list of available applications. CLI Command - core show applications """ if self.checkVersion('1.4'): cmd = "core show applications" else: ...
python
def _initApplicationList(self): """Query Asterisk Manager Interface to initialize internal list of available applications. CLI Command - core show applications """ if self.checkVersion('1.4'): cmd = "core show applications" else: ...
[ "def", "_initApplicationList", "(", "self", ")", ":", "if", "self", ".", "checkVersion", "(", "'1.4'", ")", ":", "cmd", "=", "\"core show applications\"", "else", ":", "cmd", "=", "\"show applications\"", "cmdresp", "=", "self", ".", "executeCommand", "(", "cm...
Query Asterisk Manager Interface to initialize internal list of available applications. CLI Command - core show applications
[ "Query", "Asterisk", "Manager", "Interface", "to", "initialize", "internal", "list", "of", "available", "applications", ".", "CLI", "Command", "-", "core", "show", "applications" ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L275-L291
train
aouyar/PyMunin
pysysinfo/asterisk.py
AsteriskInfo._initChannelTypesList
def _initChannelTypesList(self): """Query Asterisk Manager Interface to initialize internal list of supported channel types. CLI Command - core show applications """ if self.checkVersion('1.4'): cmd = "core show channeltypes" else: ...
python
def _initChannelTypesList(self): """Query Asterisk Manager Interface to initialize internal list of supported channel types. CLI Command - core show applications """ if self.checkVersion('1.4'): cmd = "core show channeltypes" else: ...
[ "def", "_initChannelTypesList", "(", "self", ")", ":", "if", "self", ".", "checkVersion", "(", "'1.4'", ")", ":", "cmd", "=", "\"core show channeltypes\"", "else", ":", "cmd", "=", "\"show channeltypes\"", "cmdresp", "=", "self", ".", "executeCommand", "(", "c...
Query Asterisk Manager Interface to initialize internal list of supported channel types. CLI Command - core show applications
[ "Query", "Asterisk", "Manager", "Interface", "to", "initialize", "internal", "list", "of", "supported", "channel", "types", ".", "CLI", "Command", "-", "core", "show", "applications" ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L293-L309
train
aouyar/PyMunin
pysysinfo/asterisk.py
AsteriskInfo.hasModule
def hasModule(self, mod): """Returns True if mod is among the loaded modules. @param mod: Module name. @return: Boolean """ if self._modules is None: self._initModuleList() return mod in self._modules
python
def hasModule(self, mod): """Returns True if mod is among the loaded modules. @param mod: Module name. @return: Boolean """ if self._modules is None: self._initModuleList() return mod in self._modules
[ "def", "hasModule", "(", "self", ",", "mod", ")", ":", "if", "self", ".", "_modules", "is", "None", ":", "self", ".", "_initModuleList", "(", ")", "return", "mod", "in", "self", ".", "_modules" ]
Returns True if mod is among the loaded modules. @param mod: Module name. @return: Boolean
[ "Returns", "True", "if", "mod", "is", "among", "the", "loaded", "modules", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L328-L337
train
aouyar/PyMunin
pysysinfo/asterisk.py
AsteriskInfo.hasApplication
def hasApplication(self, app): """Returns True if app is among the loaded modules. @param app: Module name. @return: Boolean """ if self._applications is None: self._initApplicationList() return app in self._applications
python
def hasApplication(self, app): """Returns True if app is among the loaded modules. @param app: Module name. @return: Boolean """ if self._applications is None: self._initApplicationList() return app in self._applications
[ "def", "hasApplication", "(", "self", ",", "app", ")", ":", "if", "self", ".", "_applications", "is", "None", ":", "self", ".", "_initApplicationList", "(", ")", "return", "app", "in", "self", ".", "_applications" ]
Returns True if app is among the loaded modules. @param app: Module name. @return: Boolean
[ "Returns", "True", "if", "app", "is", "among", "the", "loaded", "modules", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L339-L348
train
aouyar/PyMunin
pysysinfo/asterisk.py
AsteriskInfo.hasChannelType
def hasChannelType(self, chan): """Returns True if chan is among the supported channel types. @param app: Module name. @return: Boolean """ if self._chantypes is None: self._initChannelTypesList() return chan in self._chantypes
python
def hasChannelType(self, chan): """Returns True if chan is among the supported channel types. @param app: Module name. @return: Boolean """ if self._chantypes is None: self._initChannelTypesList() return chan in self._chantypes
[ "def", "hasChannelType", "(", "self", ",", "chan", ")", ":", "if", "self", ".", "_chantypes", "is", "None", ":", "self", ".", "_initChannelTypesList", "(", ")", "return", "chan", "in", "self", ".", "_chantypes" ]
Returns True if chan is among the supported channel types. @param app: Module name. @return: Boolean
[ "Returns", "True", "if", "chan", "is", "among", "the", "supported", "channel", "types", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L350-L359
train
aouyar/PyMunin
pysysinfo/asterisk.py
AsteriskInfo.getCodecList
def getCodecList(self): """Query Asterisk Manager Interface for defined codecs. CLI Command - core show codecs @return: Dictionary - Short Name -> (Type, Long Name) """ if self.checkVersion('1.4'): cmd = "core show codecs" else: ...
python
def getCodecList(self): """Query Asterisk Manager Interface for defined codecs. CLI Command - core show codecs @return: Dictionary - Short Name -> (Type, Long Name) """ if self.checkVersion('1.4'): cmd = "core show codecs" else: ...
[ "def", "getCodecList", "(", "self", ")", ":", "if", "self", ".", "checkVersion", "(", "'1.4'", ")", ":", "cmd", "=", "\"core show codecs\"", "else", ":", "cmd", "=", "\"show codecs\"", "cmdresp", "=", "self", ".", "executeCommand", "(", "cmd", ")", "info_d...
Query Asterisk Manager Interface for defined codecs. CLI Command - core show codecs @return: Dictionary - Short Name -> (Type, Long Name)
[ "Query", "Asterisk", "Manager", "Interface", "for", "defined", "codecs", ".", "CLI", "Command", "-", "core", "show", "codecs" ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L392-L411
train
aouyar/PyMunin
pysysinfo/asterisk.py
AsteriskInfo.getChannelStats
def getChannelStats(self, chantypes=('dahdi', 'zap', 'sip', 'iax2', 'local')): """Query Asterisk Manager Interface for Channel Stats. CLI Command - core show channels @return: Dictionary of statistics counters for channels. Number of active channels for each channel type. ...
python
def getChannelStats(self, chantypes=('dahdi', 'zap', 'sip', 'iax2', 'local')): """Query Asterisk Manager Interface for Channel Stats. CLI Command - core show channels @return: Dictionary of statistics counters for channels. Number of active channels for each channel type. ...
[ "def", "getChannelStats", "(", "self", ",", "chantypes", "=", "(", "'dahdi'", ",", "'zap'", ",", "'sip'", ",", "'iax2'", ",", "'local'", ")", ")", ":", "if", "self", ".", "checkVersion", "(", "'1.4'", ")", ":", "cmd", "=", "\"core show channels\"", "else...
Query Asterisk Manager Interface for Channel Stats. CLI Command - core show channels @return: Dictionary of statistics counters for channels. Number of active channels for each channel type.
[ "Query", "Asterisk", "Manager", "Interface", "for", "Channel", "Stats", ".", "CLI", "Command", "-", "core", "show", "channels" ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L413-L464
train
aouyar/PyMunin
pysysinfo/asterisk.py
AsteriskInfo.getPeerStats
def getPeerStats(self, chantype): """Query Asterisk Manager Interface for SIP / IAX2 Peer Stats. CLI Command - sip show peers iax2 show peers @param chantype: Must be 'sip' or 'iax2'. @return: Dictionary of statistics counters for VoIP Peer...
python
def getPeerStats(self, chantype): """Query Asterisk Manager Interface for SIP / IAX2 Peer Stats. CLI Command - sip show peers iax2 show peers @param chantype: Must be 'sip' or 'iax2'. @return: Dictionary of statistics counters for VoIP Peer...
[ "def", "getPeerStats", "(", "self", ",", "chantype", ")", ":", "chan", "=", "chantype", ".", "lower", "(", ")", "if", "not", "self", ".", "hasChannelType", "(", "chan", ")", ":", "return", "None", "if", "chan", "==", "'iax2'", ":", "cmd", "=", "\"iax...
Query Asterisk Manager Interface for SIP / IAX2 Peer Stats. CLI Command - sip show peers iax2 show peers @param chantype: Must be 'sip' or 'iax2'. @return: Dictionary of statistics counters for VoIP Peers.
[ "Query", "Asterisk", "Manager", "Interface", "for", "SIP", "/", "IAX2", "Peer", "Stats", ".", "CLI", "Command", "-", "sip", "show", "peers", "iax2", "show", "peers", "@param", "chantype", ":", "Must", "be", "sip", "or", "iax2", ".", "@return", ":", "Dict...
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L466-L499
train
aouyar/PyMunin
pysysinfo/asterisk.py
AsteriskInfo.getVoIPchanStats
def getVoIPchanStats(self, chantype, codec_list=('ulaw', 'alaw', 'gsm', 'g729')): """Query Asterisk Manager Interface for SIP / IAX2 Channel / Codec Stats. CLI Commands - sip show channels iax2 show channnels @param chantype: M...
python
def getVoIPchanStats(self, chantype, codec_list=('ulaw', 'alaw', 'gsm', 'g729')): """Query Asterisk Manager Interface for SIP / IAX2 Channel / Codec Stats. CLI Commands - sip show channels iax2 show channnels @param chantype: M...
[ "def", "getVoIPchanStats", "(", "self", ",", "chantype", ",", "codec_list", "=", "(", "'ulaw'", ",", "'alaw'", ",", "'gsm'", ",", "'g729'", ")", ")", ":", "chan", "=", "chantype", ".", "lower", "(", ")", "if", "not", "self", ".", "hasChannelType", "(",...
Query Asterisk Manager Interface for SIP / IAX2 Channel / Codec Stats. CLI Commands - sip show channels iax2 show channnels @param chantype: Must be 'sip' or 'iax2'. @param codec_list: List of codec names to parse. (Codecs not...
[ "Query", "Asterisk", "Manager", "Interface", "for", "SIP", "/", "IAX2", "Channel", "/", "Codec", "Stats", ".", "CLI", "Commands", "-", "sip", "show", "channels", "iax2", "show", "channnels", "@param", "chantype", ":", "Must", "be", "sip", "or", "iax2", "."...
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L501-L554
train
aouyar/PyMunin
pysysinfo/asterisk.py
AsteriskInfo.getConferenceStats
def getConferenceStats(self): """Query Asterisk Manager Interface for Conference Room Stats. CLI Command - meetme list @return: Dictionary of statistics counters for Conference Rooms. """ if not self.hasConference(): return None if self.checkVersion...
python
def getConferenceStats(self): """Query Asterisk Manager Interface for Conference Room Stats. CLI Command - meetme list @return: Dictionary of statistics counters for Conference Rooms. """ if not self.hasConference(): return None if self.checkVersion...
[ "def", "getConferenceStats", "(", "self", ")", ":", "if", "not", "self", ".", "hasConference", "(", ")", ":", "return", "None", "if", "self", ".", "checkVersion", "(", "'1.6'", ")", ":", "cmd", "=", "\"meetme list\"", "else", ":", "cmd", "=", "\"meetme\"...
Query Asterisk Manager Interface for Conference Room Stats. CLI Command - meetme list @return: Dictionary of statistics counters for Conference Rooms.
[ "Query", "Asterisk", "Manager", "Interface", "for", "Conference", "Room", "Stats", ".", "CLI", "Command", "-", "meetme", "list" ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L564-L587
train
aouyar/PyMunin
pysysinfo/asterisk.py
AsteriskInfo.getVoicemailStats
def getVoicemailStats(self): """Query Asterisk Manager Interface for Voicemail Stats. CLI Command - voicemail show users @return: Dictionary of statistics counters for Voicemail Accounts. """ if not self.hasVoicemail(): return None if self.checkVers...
python
def getVoicemailStats(self): """Query Asterisk Manager Interface for Voicemail Stats. CLI Command - voicemail show users @return: Dictionary of statistics counters for Voicemail Accounts. """ if not self.hasVoicemail(): return None if self.checkVers...
[ "def", "getVoicemailStats", "(", "self", ")", ":", "if", "not", "self", ".", "hasVoicemail", "(", ")", ":", "return", "None", "if", "self", ".", "checkVersion", "(", "'1.4'", ")", ":", "cmd", "=", "\"voicemail show users\"", "else", ":", "cmd", "=", "\"s...
Query Asterisk Manager Interface for Voicemail Stats. CLI Command - voicemail show users @return: Dictionary of statistics counters for Voicemail Accounts.
[ "Query", "Asterisk", "Manager", "Interface", "for", "Voicemail", "Stats", ".", "CLI", "Command", "-", "voicemail", "show", "users" ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L597-L627
train
aouyar/PyMunin
pysysinfo/asterisk.py
AsteriskInfo.getTrunkStats
def getTrunkStats(self, trunkList): """Query Asterisk Manager Interface for Trunk Stats. CLI Command - core show channels @param trunkList: List of tuples of one of the two following types: (Trunk Name, Regular Expression) (Trunk ...
python
def getTrunkStats(self, trunkList): """Query Asterisk Manager Interface for Trunk Stats. CLI Command - core show channels @param trunkList: List of tuples of one of the two following types: (Trunk Name, Regular Expression) (Trunk ...
[ "def", "getTrunkStats", "(", "self", ",", "trunkList", ")", ":", "re_list", "=", "[", "]", "info_dict", "=", "{", "}", "for", "filt", "in", "trunkList", ":", "info_dict", "[", "filt", "[", "0", "]", "]", "=", "0", "re_list", ".", "append", "(", "re...
Query Asterisk Manager Interface for Trunk Stats. CLI Command - core show channels @param trunkList: List of tuples of one of the two following types: (Trunk Name, Regular Expression) (Trunk Name, Regular Expression, MIN, MAX) @re...
[ "Query", "Asterisk", "Manager", "Interface", "for", "Trunk", "Stats", ".", "CLI", "Command", "-", "core", "show", "channels" ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L629-L668
train
aouyar/PyMunin
pysysinfo/asterisk.py
AsteriskInfo.getQueueStats
def getQueueStats(self): """Query Asterisk Manager Interface for Queue Stats. CLI Command: queue show @return: Dictionary of queue stats. """ if not self.hasQueue(): return None info_dict = {} if self.checkVersion('1.4'): ...
python
def getQueueStats(self): """Query Asterisk Manager Interface for Queue Stats. CLI Command: queue show @return: Dictionary of queue stats. """ if not self.hasQueue(): return None info_dict = {} if self.checkVersion('1.4'): ...
[ "def", "getQueueStats", "(", "self", ")", ":", "if", "not", "self", ".", "hasQueue", "(", ")", ":", "return", "None", "info_dict", "=", "{", "}", "if", "self", ".", "checkVersion", "(", "'1.4'", ")", ":", "cmd", "=", "\"queue show\"", "else", ":", "c...
Query Asterisk Manager Interface for Queue Stats. CLI Command: queue show @return: Dictionary of queue stats.
[ "Query", "Asterisk", "Manager", "Interface", "for", "Queue", "Stats", ".", "CLI", "Command", ":", "queue", "show" ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L678-L743
train
aouyar/PyMunin
pysysinfo/asterisk.py
AsteriskInfo.getFaxStatsCounters
def getFaxStatsCounters(self): """Query Asterisk Manager Interface for Fax Stats. CLI Command - fax show stats @return: Dictionary of fax stats. """ if not self.hasFax(): return None info_dict = {} cmdresp = self.executeComma...
python
def getFaxStatsCounters(self): """Query Asterisk Manager Interface for Fax Stats. CLI Command - fax show stats @return: Dictionary of fax stats. """ if not self.hasFax(): return None info_dict = {} cmdresp = self.executeComma...
[ "def", "getFaxStatsCounters", "(", "self", ")", ":", "if", "not", "self", ".", "hasFax", "(", ")", ":", "return", "None", "info_dict", "=", "{", "}", "cmdresp", "=", "self", ".", "executeCommand", "(", "'fax show stats'", ")", "ctxt", "=", "'general'", "...
Query Asterisk Manager Interface for Fax Stats. CLI Command - fax show stats @return: Dictionary of fax stats.
[ "Query", "Asterisk", "Manager", "Interface", "for", "Fax", "Stats", ".", "CLI", "Command", "-", "fax", "show", "stats" ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L753-L777
train
aouyar/PyMunin
pysysinfo/asterisk.py
AsteriskInfo.getFaxStatsSessions
def getFaxStatsSessions(self): """Query Asterisk Manager Interface for Fax Stats. CLI Command - fax show sessions @return: Dictionary of fax stats. """ if not self.hasFax(): return None info_dict = {} info_dict['total'] = 0 ...
python
def getFaxStatsSessions(self): """Query Asterisk Manager Interface for Fax Stats. CLI Command - fax show sessions @return: Dictionary of fax stats. """ if not self.hasFax(): return None info_dict = {} info_dict['total'] = 0 ...
[ "def", "getFaxStatsSessions", "(", "self", ")", ":", "if", "not", "self", ".", "hasFax", "(", ")", ":", "return", "None", "info_dict", "=", "{", "}", "info_dict", "[", "'total'", "]", "=", "0", "fax_types", "=", "(", "'g.711'", ",", "'t.38'", ")", "f...
Query Asterisk Manager Interface for Fax Stats. CLI Command - fax show sessions @return: Dictionary of fax stats.
[ "Query", "Asterisk", "Manager", "Interface", "for", "Fax", "Stats", ".", "CLI", "Command", "-", "fax", "show", "sessions" ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L779-L813
train
aouyar/PyMunin
pymunin/plugins/wanpipestats.py
MuninWanpipePlugin.retrieveVals
def retrieveVals(self): """Retrieve values for graphs.""" for iface in self._ifaceList: if self._reqIfaceList is None or iface in self._reqIfaceList: if (self.graphEnabled('wanpipe_traffic') or self.graphEnabled('wanpipe_errors')): sta...
python
def retrieveVals(self): """Retrieve values for graphs.""" for iface in self._ifaceList: if self._reqIfaceList is None or iface in self._reqIfaceList: if (self.graphEnabled('wanpipe_traffic') or self.graphEnabled('wanpipe_errors')): sta...
[ "def", "retrieveVals", "(", "self", ")", ":", "for", "iface", "in", "self", ".", "_ifaceList", ":", "if", "self", ".", "_reqIfaceList", "is", "None", "or", "iface", "in", "self", ".", "_reqIfaceList", ":", "if", "(", "self", ".", "graphEnabled", "(", "...
Retrieve values for graphs.
[ "Retrieve", "values", "for", "graphs", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/wanpipestats.py#L156-L191
train
ContextLab/quail
quail/simulate.py
simulate_list
def simulate_list(nwords=16, nrec=10, ncats=4): """A function to simulate a list""" # load wordpool wp = pd.read_csv('data/cut_wordpool.csv') # get one list wp = wp[wp['GROUP']==np.random.choice(list(range(16)), 1)[0]].sample(16) wp['COLOR'] = [[int(np.random.rand() * 255) for i in range(3)] ...
python
def simulate_list(nwords=16, nrec=10, ncats=4): """A function to simulate a list""" # load wordpool wp = pd.read_csv('data/cut_wordpool.csv') # get one list wp = wp[wp['GROUP']==np.random.choice(list(range(16)), 1)[0]].sample(16) wp['COLOR'] = [[int(np.random.rand() * 255) for i in range(3)] ...
[ "def", "simulate_list", "(", "nwords", "=", "16", ",", "nrec", "=", "10", ",", "ncats", "=", "4", ")", ":", "# load wordpool", "wp", "=", "pd", ".", "read_csv", "(", "'data/cut_wordpool.csv'", ")", "# get one list", "wp", "=", "wp", "[", "wp", "[", "'G...
A function to simulate a list
[ "A", "function", "to", "simulate", "a", "list" ]
71dd53c792dd915dc84879d8237e3582dd68b7a4
https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/simulate.py#L5-L14
train
aouyar/PyMunin
pymunin/plugins/mysqlstats.py
MuninMySQLplugin.retrieveVals
def retrieveVals(self): """Retrieve values for graphs.""" if self._genStats is None: self._genStats = self._dbconn.getStats() if self._genVars is None: self._genVars = self._dbconn.getParams() if self.hasGraph('mysql_connections'): self.setGraphVal('my...
python
def retrieveVals(self): """Retrieve values for graphs.""" if self._genStats is None: self._genStats = self._dbconn.getStats() if self._genVars is None: self._genVars = self._dbconn.getParams() if self.hasGraph('mysql_connections'): self.setGraphVal('my...
[ "def", "retrieveVals", "(", "self", ")", ":", "if", "self", ".", "_genStats", "is", "None", ":", "self", ".", "_genStats", "=", "self", ".", "_dbconn", ".", "getStats", "(", ")", "if", "self", ".", "_genVars", "is", "None", ":", "self", ".", "_genVar...
Retrieve values for graphs.
[ "Retrieve", "values", "for", "graphs", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/mysqlstats.py#L451-L610
train
aouyar/PyMunin
pymunin/plugins/mysqlstats.py
MuninMySQLplugin.engineIncluded
def engineIncluded(self, name): """Utility method to check if a storage engine is included in graphs. @param name: Name of storage engine. @return: Returns True if included in graphs, False otherwise. """ if self._engines is None: self._engin...
python
def engineIncluded(self, name): """Utility method to check if a storage engine is included in graphs. @param name: Name of storage engine. @return: Returns True if included in graphs, False otherwise. """ if self._engines is None: self._engin...
[ "def", "engineIncluded", "(", "self", ",", "name", ")", ":", "if", "self", ".", "_engines", "is", "None", ":", "self", ".", "_engines", "=", "self", ".", "_dbconn", ".", "getStorageEngines", "(", ")", "return", "self", ".", "envCheckFilter", "(", "'engin...
Utility method to check if a storage engine is included in graphs. @param name: Name of storage engine. @return: Returns True if included in graphs, False otherwise.
[ "Utility", "method", "to", "check", "if", "a", "storage", "engine", "is", "included", "in", "graphs", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/mysqlstats.py#L612-L621
train
aouyar/PyMunin
pysysinfo/filesystem.py
FilesystemInfo.getSpaceUse
def getSpaceUse(self): """Get disk space usage. @return: Dictionary of filesystem space utilization stats for filesystems. """ stats = {} try: out = subprocess.Popen([dfCmd, "-Pk"], stdout=subprocess.PIPE).communic...
python
def getSpaceUse(self): """Get disk space usage. @return: Dictionary of filesystem space utilization stats for filesystems. """ stats = {} try: out = subprocess.Popen([dfCmd, "-Pk"], stdout=subprocess.PIPE).communic...
[ "def", "getSpaceUse", "(", "self", ")", ":", "stats", "=", "{", "}", "try", ":", "out", "=", "subprocess", ".", "Popen", "(", "[", "dfCmd", ",", "\"-Pk\"", "]", ",", "stdout", "=", "subprocess", ".", "PIPE", ")", ".", "communicate", "(", ")", "[", ...
Get disk space usage. @return: Dictionary of filesystem space utilization stats for filesystems.
[ "Get", "disk", "space", "usage", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/filesystem.py#L67-L91
train
aouyar/PyMunin
pymunin/plugins/pgstats.py
MuninPgPlugin.retrieveVals
def retrieveVals(self): """Retrieve values for graphs.""" stats = self._dbconn.getDatabaseStats() databases = stats.get('databases') totals = stats.get('totals') if self.hasGraph('pg_connections'): limit = self._dbconn.getParam('max_connections') ...
python
def retrieveVals(self): """Retrieve values for graphs.""" stats = self._dbconn.getDatabaseStats() databases = stats.get('databases') totals = stats.get('totals') if self.hasGraph('pg_connections'): limit = self._dbconn.getParam('max_connections') ...
[ "def", "retrieveVals", "(", "self", ")", ":", "stats", "=", "self", ".", "_dbconn", ".", "getDatabaseStats", "(", ")", "databases", "=", "stats", ".", "get", "(", "'databases'", ")", "totals", "=", "stats", ".", "get", "(", "'totals'", ")", "if", "self...
Retrieve values for graphs.
[ "Retrieve", "values", "for", "graphs", "." ]
4f58a64b6b37c85a84cc7e1e07aafaa0321b249d
https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/pgstats.py#L389-L486
train
swilson/aqualogic
aqualogic/core.py
AquaLogic.connect
def connect(self, host, port): """Connects via a RS-485 to Ethernet adapter.""" sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((host, port)) self._reader = sock.makefile(mode='rb') self._writer = sock.makefile(mode='wb')
python
def connect(self, host, port): """Connects via a RS-485 to Ethernet adapter.""" sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect((host, port)) self._reader = sock.makefile(mode='rb') self._writer = sock.makefile(mode='wb')
[ "def", "connect", "(", "self", ",", "host", ",", "port", ")", ":", "sock", "=", "socket", ".", "socket", "(", "socket", ".", "AF_INET", ",", "socket", ".", "SOCK_STREAM", ")", "sock", ".", "connect", "(", "(", "host", ",", "port", ")", ")", "self",...
Connects via a RS-485 to Ethernet adapter.
[ "Connects", "via", "a", "RS", "-", "485", "to", "Ethernet", "adapter", "." ]
b6e904363efc4f64c70aae127d040079587ecbc6
https://github.com/swilson/aqualogic/blob/b6e904363efc4f64c70aae127d040079587ecbc6/aqualogic/core.py#L104-L109
train
swilson/aqualogic
aqualogic/core.py
AquaLogic.process
def process(self, data_changed_callback): """Process data; returns when the reader signals EOF. Callback is notified when any data changes.""" # pylint: disable=too-many-locals,too-many-branches,too-many-statements while True: byte = self._reader.read(1) while Tr...
python
def process(self, data_changed_callback): """Process data; returns when the reader signals EOF. Callback is notified when any data changes.""" # pylint: disable=too-many-locals,too-many-branches,too-many-statements while True: byte = self._reader.read(1) while Tr...
[ "def", "process", "(", "self", ",", "data_changed_callback", ")", ":", "# pylint: disable=too-many-locals,too-many-branches,too-many-statements", "while", "True", ":", "byte", "=", "self", ".", "_reader", ".", "read", "(", "1", ")", "while", "True", ":", "# Search f...
Process data; returns when the reader signals EOF. Callback is notified when any data changes.
[ "Process", "data", ";", "returns", "when", "the", "reader", "signals", "EOF", ".", "Callback", "is", "notified", "when", "any", "data", "changes", "." ]
b6e904363efc4f64c70aae127d040079587ecbc6
https://github.com/swilson/aqualogic/blob/b6e904363efc4f64c70aae127d040079587ecbc6/aqualogic/core.py#L125-L292
train
swilson/aqualogic
aqualogic/core.py
AquaLogic.send_key
def send_key(self, key): """Sends a key.""" _LOGGER.info('Queueing key %s', key) frame = self._get_key_event_frame(key) # Queue it to send immediately following the reception # of a keep-alive packet in an attempt to avoid bus collisions. self._send_queue.put({'frame': f...
python
def send_key(self, key): """Sends a key.""" _LOGGER.info('Queueing key %s', key) frame = self._get_key_event_frame(key) # Queue it to send immediately following the reception # of a keep-alive packet in an attempt to avoid bus collisions. self._send_queue.put({'frame': f...
[ "def", "send_key", "(", "self", ",", "key", ")", ":", "_LOGGER", ".", "info", "(", "'Queueing key %s'", ",", "key", ")", "frame", "=", "self", ".", "_get_key_event_frame", "(", "key", ")", "# Queue it to send immediately following the reception", "# of a keep-alive ...
Sends a key.
[ "Sends", "a", "key", "." ]
b6e904363efc4f64c70aae127d040079587ecbc6
https://github.com/swilson/aqualogic/blob/b6e904363efc4f64c70aae127d040079587ecbc6/aqualogic/core.py#L319-L326
train
swilson/aqualogic
aqualogic/core.py
AquaLogic.states
def states(self): """Returns a set containing the enabled states.""" state_list = [] for state in States: if state.value & self._states != 0: state_list.append(state) if (self._flashing_states & States.FILTER) != 0: state_list.append(States.FILTER...
python
def states(self): """Returns a set containing the enabled states.""" state_list = [] for state in States: if state.value & self._states != 0: state_list.append(state) if (self._flashing_states & States.FILTER) != 0: state_list.append(States.FILTER...
[ "def", "states", "(", "self", ")", ":", "state_list", "=", "[", "]", "for", "state", "in", "States", ":", "if", "state", ".", "value", "&", "self", ".", "_states", "!=", "0", ":", "state_list", ".", "append", "(", "state", ")", "if", "(", "self", ...
Returns a set containing the enabled states.
[ "Returns", "a", "set", "containing", "the", "enabled", "states", "." ]
b6e904363efc4f64c70aae127d040079587ecbc6
https://github.com/swilson/aqualogic/blob/b6e904363efc4f64c70aae127d040079587ecbc6/aqualogic/core.py#L392-L402
train
swilson/aqualogic
aqualogic/core.py
AquaLogic.get_state
def get_state(self, state): """Returns True if the specified state is enabled.""" # Check to see if we have a change request pending; if we do # return the value we expect it to change to. for data in list(self._send_queue.queue): desired_states = data['desired_states'] ...
python
def get_state(self, state): """Returns True if the specified state is enabled.""" # Check to see if we have a change request pending; if we do # return the value we expect it to change to. for data in list(self._send_queue.queue): desired_states = data['desired_states'] ...
[ "def", "get_state", "(", "self", ",", "state", ")", ":", "# Check to see if we have a change request pending; if we do", "# return the value we expect it to change to.", "for", "data", "in", "list", "(", "self", ".", "_send_queue", ".", "queue", ")", ":", "desired_states"...
Returns True if the specified state is enabled.
[ "Returns", "True", "if", "the", "specified", "state", "is", "enabled", "." ]
b6e904363efc4f64c70aae127d040079587ecbc6
https://github.com/swilson/aqualogic/blob/b6e904363efc4f64c70aae127d040079587ecbc6/aqualogic/core.py#L404-L415
train
swilson/aqualogic
aqualogic/core.py
AquaLogic.set_state
def set_state(self, state, enable): """Set the state.""" is_enabled = self.get_state(state) if is_enabled == enable: return True key = None desired_states = [{'state': state, 'enabled': not is_enabled}] if state == States.FILTER_LOW_SPEED: if no...
python
def set_state(self, state, enable): """Set the state.""" is_enabled = self.get_state(state) if is_enabled == enable: return True key = None desired_states = [{'state': state, 'enabled': not is_enabled}] if state == States.FILTER_LOW_SPEED: if no...
[ "def", "set_state", "(", "self", ",", "state", ",", "enable", ")", ":", "is_enabled", "=", "self", ".", "get_state", "(", "state", ")", "if", "is_enabled", "==", "enable", ":", "return", "True", "key", "=", "None", "desired_states", "=", "[", "{", "'st...
Set the state.
[ "Set", "the", "state", "." ]
b6e904363efc4f64c70aae127d040079587ecbc6
https://github.com/swilson/aqualogic/blob/b6e904363efc4f64c70aae127d040079587ecbc6/aqualogic/core.py#L417-L455
train
vokimon/python-qgmap
qgmap/__init__.py
trace
def trace(function, *args, **k) : """Decorates a function by tracing the begining and end of the function execution, if doTrace global is True""" if doTrace : print ("> "+function.__name__, args, k) result = function(*args, **k) if doTrace : print ("< "+function.__name__, args, k, "->", result) return result
python
def trace(function, *args, **k) : """Decorates a function by tracing the begining and end of the function execution, if doTrace global is True""" if doTrace : print ("> "+function.__name__, args, k) result = function(*args, **k) if doTrace : print ("< "+function.__name__, args, k, "->", result) return result
[ "def", "trace", "(", "function", ",", "*", "args", ",", "*", "*", "k", ")", ":", "if", "doTrace", ":", "print", "(", "\"> \"", "+", "function", ".", "__name__", ",", "args", ",", "k", ")", "result", "=", "function", "(", "*", "args", ",", "*", ...
Decorates a function by tracing the begining and end of the function execution, if doTrace global is True
[ "Decorates", "a", "function", "by", "tracing", "the", "begining", "and", "end", "of", "the", "function", "execution", "if", "doTrace", "global", "is", "True" ]
9b01b48c5a8f4726938d38326f89644e7fb95f51
https://github.com/vokimon/python-qgmap/blob/9b01b48c5a8f4726938d38326f89644e7fb95f51/qgmap/__init__.py#L18-L25
train
vokimon/python-qgmap
qgmap/__init__.py
GeoCoder.geocode
def geocode(self, location) : url = QtCore.QUrl("http://maps.googleapis.com/maps/api/geocode/xml") url.addQueryItem("address", location) url.addQueryItem("sensor", "false") """ url = QtCore.QUrl("http://maps.google.com/maps/geo/") url.addQueryItem("q", location) url.addQueryItem("output", "csv") url.add...
python
def geocode(self, location) : url = QtCore.QUrl("http://maps.googleapis.com/maps/api/geocode/xml") url.addQueryItem("address", location) url.addQueryItem("sensor", "false") """ url = QtCore.QUrl("http://maps.google.com/maps/geo/") url.addQueryItem("q", location) url.addQueryItem("output", "csv") url.add...
[ "def", "geocode", "(", "self", ",", "location", ")", ":", "url", "=", "QtCore", ".", "QUrl", "(", "\"http://maps.googleapis.com/maps/api/geocode/xml\"", ")", "url", ".", "addQueryItem", "(", "\"address\"", ",", "location", ")", "url", ".", "addQueryItem", "(", ...
url = QtCore.QUrl("http://maps.google.com/maps/geo/") url.addQueryItem("q", location) url.addQueryItem("output", "csv") url.addQueryItem("sensor", "false")
[ "url", "=", "QtCore", ".", "QUrl", "(", "http", ":", "//", "maps", ".", "google", ".", "com", "/", "maps", "/", "geo", "/", ")", "url", ".", "addQueryItem", "(", "q", "location", ")", "url", ".", "addQueryItem", "(", "output", "csv", ")", "url", ...
9b01b48c5a8f4726938d38326f89644e7fb95f51
https://github.com/vokimon/python-qgmap/blob/9b01b48c5a8f4726938d38326f89644e7fb95f51/qgmap/__init__.py#L40-L57
train
tisimst/mcerp
mcerp/correlate.py
correlate
def correlate(params, corrmat): """ Force a correlation matrix on a set of statistically distributed objects. This function works on objects in-place. Parameters ---------- params : array An array of of uv objects. corrmat : 2d-array The correlation matrix to b...
python
def correlate(params, corrmat): """ Force a correlation matrix on a set of statistically distributed objects. This function works on objects in-place. Parameters ---------- params : array An array of of uv objects. corrmat : 2d-array The correlation matrix to b...
[ "def", "correlate", "(", "params", ",", "corrmat", ")", ":", "# Make sure all inputs are compatible\r", "assert", "all", "(", "[", "isinstance", "(", "param", ",", "UncertainFunction", ")", "for", "param", "in", "params", "]", ")", ",", "'All inputs to \"correlate...
Force a correlation matrix on a set of statistically distributed objects. This function works on objects in-place. Parameters ---------- params : array An array of of uv objects. corrmat : 2d-array The correlation matrix to be imposed
[ "Force", "a", "correlation", "matrix", "on", "a", "set", "of", "statistically", "distributed", "objects", ".", "This", "function", "works", "on", "objects", "in", "-", "place", ".", "Parameters", "----------", "params", ":", "array", "An", "array", "of", "of...
2bb8260c9ad2d58a806847f1b627b6451e407de1
https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/correlate.py#L8-L34
train
tisimst/mcerp
mcerp/correlate.py
induce_correlations
def induce_correlations(data, corrmat): """ Induce a set of correlations on a column-wise dataset Parameters ---------- data : 2d-array An m-by-n array where m is the number of samples and n is the number of independent variables, each column of the array corresponding ...
python
def induce_correlations(data, corrmat): """ Induce a set of correlations on a column-wise dataset Parameters ---------- data : 2d-array An m-by-n array where m is the number of samples and n is the number of independent variables, each column of the array corresponding ...
[ "def", "induce_correlations", "(", "data", ",", "corrmat", ")", ":", "# Create an rank-matrix\r", "data_rank", "=", "np", ".", "vstack", "(", "[", "rankdata", "(", "datai", ")", "for", "datai", "in", "data", ".", "T", "]", ")", ".", "T", "# Generate van de...
Induce a set of correlations on a column-wise dataset Parameters ---------- data : 2d-array An m-by-n array where m is the number of samples and n is the number of independent variables, each column of the array corresponding to each variable corrmat : 2d-array ...
[ "Induce", "a", "set", "of", "correlations", "on", "a", "column", "-", "wise", "dataset", "Parameters", "----------", "data", ":", "2d", "-", "array", "An", "m", "-", "by", "-", "n", "array", "where", "m", "is", "the", "number", "of", "samples", "and", ...
2bb8260c9ad2d58a806847f1b627b6451e407de1
https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/correlate.py#L37-L95
train
tisimst/mcerp
mcerp/correlate.py
plotcorr
def plotcorr(X, plotargs=None, full=True, labels=None): """ Plots a scatterplot matrix of subplots. Usage: plotcorr(X) plotcorr(..., plotargs=...) # e.g., 'r*', 'bo', etc. plotcorr(..., full=...) # e.g., True or False plotc...
python
def plotcorr(X, plotargs=None, full=True, labels=None): """ Plots a scatterplot matrix of subplots. Usage: plotcorr(X) plotcorr(..., plotargs=...) # e.g., 'r*', 'bo', etc. plotcorr(..., full=...) # e.g., True or False plotc...
[ "def", "plotcorr", "(", "X", ",", "plotargs", "=", "None", ",", "full", "=", "True", ",", "labels", "=", "None", ")", ":", "import", "matplotlib", ".", "pyplot", "as", "plt", "X", "=", "[", "Xi", ".", "_mcpts", "if", "isinstance", "(", "Xi", ",", ...
Plots a scatterplot matrix of subplots. Usage: plotcorr(X) plotcorr(..., plotargs=...) # e.g., 'r*', 'bo', etc. plotcorr(..., full=...) # e.g., True or False plotcorr(..., labels=...) # e.g., ['label1', 'label2', ...] Each co...
[ "Plots", "a", "scatterplot", "matrix", "of", "subplots", ".", "Usage", ":", "plotcorr", "(", "X", ")", "plotcorr", "(", "...", "plotargs", "=", "...", ")", "#", "e", ".", "g", ".", "r", "*", "bo", "etc", ".", "plotcorr", "(", "...", "full", "=", ...
2bb8260c9ad2d58a806847f1b627b6451e407de1
https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/correlate.py#L98-L201
train
tisimst/mcerp
mcerp/correlate.py
chol
def chol(A): """ Calculate the lower triangular matrix of the Cholesky decomposition of a symmetric, positive-definite matrix. """ A = np.array(A) assert A.shape[0] == A.shape[1], "Input matrix must be square" L = [[0.0] * len(A) for _ in range(len(A))] for i in range(len(A)): ...
python
def chol(A): """ Calculate the lower triangular matrix of the Cholesky decomposition of a symmetric, positive-definite matrix. """ A = np.array(A) assert A.shape[0] == A.shape[1], "Input matrix must be square" L = [[0.0] * len(A) for _ in range(len(A))] for i in range(len(A)): ...
[ "def", "chol", "(", "A", ")", ":", "A", "=", "np", ".", "array", "(", "A", ")", "assert", "A", ".", "shape", "[", "0", "]", "==", "A", ".", "shape", "[", "1", "]", ",", "\"Input matrix must be square\"", "L", "=", "[", "[", "0.0", "]", "*", "...
Calculate the lower triangular matrix of the Cholesky decomposition of a symmetric, positive-definite matrix.
[ "Calculate", "the", "lower", "triangular", "matrix", "of", "the", "Cholesky", "decomposition", "of", "a", "symmetric", "positive", "-", "definite", "matrix", "." ]
2bb8260c9ad2d58a806847f1b627b6451e407de1
https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/correlate.py#L204-L220
train
opendns/pyinvestigate
investigate/investigate.py
Investigate.get
def get(self, uri, params={}): '''A generic method to make GET requests to the OpenDNS Investigate API on the given URI. ''' return self._session.get(urljoin(Investigate.BASE_URL, uri), params=params, headers=self._auth_header, proxies=self.proxies )
python
def get(self, uri, params={}): '''A generic method to make GET requests to the OpenDNS Investigate API on the given URI. ''' return self._session.get(urljoin(Investigate.BASE_URL, uri), params=params, headers=self._auth_header, proxies=self.proxies )
[ "def", "get", "(", "self", ",", "uri", ",", "params", "=", "{", "}", ")", ":", "return", "self", ".", "_session", ".", "get", "(", "urljoin", "(", "Investigate", ".", "BASE_URL", ",", "uri", ")", ",", "params", "=", "params", ",", "headers", "=", ...
A generic method to make GET requests to the OpenDNS Investigate API on the given URI.
[ "A", "generic", "method", "to", "make", "GET", "requests", "to", "the", "OpenDNS", "Investigate", "API", "on", "the", "given", "URI", "." ]
a182e73a750f03e906d9b25842d556db8d2fd54f
https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L62-L68
train
opendns/pyinvestigate
investigate/investigate.py
Investigate.post
def post(self, uri, params={}, data={}): '''A generic method to make POST requests to the OpenDNS Investigate API on the given URI. ''' return self._session.post( urljoin(Investigate.BASE_URL, uri), params=params, data=data, headers=self._auth_header, ...
python
def post(self, uri, params={}, data={}): '''A generic method to make POST requests to the OpenDNS Investigate API on the given URI. ''' return self._session.post( urljoin(Investigate.BASE_URL, uri), params=params, data=data, headers=self._auth_header, ...
[ "def", "post", "(", "self", ",", "uri", ",", "params", "=", "{", "}", ",", "data", "=", "{", "}", ")", ":", "return", "self", ".", "_session", ".", "post", "(", "urljoin", "(", "Investigate", ".", "BASE_URL", ",", "uri", ")", ",", "params", "=", ...
A generic method to make POST requests to the OpenDNS Investigate API on the given URI.
[ "A", "generic", "method", "to", "make", "POST", "requests", "to", "the", "OpenDNS", "Investigate", "API", "on", "the", "given", "URI", "." ]
a182e73a750f03e906d9b25842d556db8d2fd54f
https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L70-L78
train
opendns/pyinvestigate
investigate/investigate.py
Investigate.get_parse
def get_parse(self, uri, params={}): '''Convenience method to call get() on an arbitrary URI and parse the response into a JSON object. Raises an error on non-200 response status. ''' return self._request_parse(self.get, uri, params)
python
def get_parse(self, uri, params={}): '''Convenience method to call get() on an arbitrary URI and parse the response into a JSON object. Raises an error on non-200 response status. ''' return self._request_parse(self.get, uri, params)
[ "def", "get_parse", "(", "self", ",", "uri", ",", "params", "=", "{", "}", ")", ":", "return", "self", ".", "_request_parse", "(", "self", ".", "get", ",", "uri", ",", "params", ")" ]
Convenience method to call get() on an arbitrary URI and parse the response into a JSON object. Raises an error on non-200 response status.
[ "Convenience", "method", "to", "call", "get", "()", "on", "an", "arbitrary", "URI", "and", "parse", "the", "response", "into", "a", "JSON", "object", ".", "Raises", "an", "error", "on", "non", "-", "200", "response", "status", "." ]
a182e73a750f03e906d9b25842d556db8d2fd54f
https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L85-L89
train
opendns/pyinvestigate
investigate/investigate.py
Investigate.post_parse
def post_parse(self, uri, params={}, data={}): '''Convenience method to call post() on an arbitrary URI and parse the response into a JSON object. Raises an error on non-200 response status. ''' return self._request_parse(self.post, uri, params, data)
python
def post_parse(self, uri, params={}, data={}): '''Convenience method to call post() on an arbitrary URI and parse the response into a JSON object. Raises an error on non-200 response status. ''' return self._request_parse(self.post, uri, params, data)
[ "def", "post_parse", "(", "self", ",", "uri", ",", "params", "=", "{", "}", ",", "data", "=", "{", "}", ")", ":", "return", "self", ".", "_request_parse", "(", "self", ".", "post", ",", "uri", ",", "params", ",", "data", ")" ]
Convenience method to call post() on an arbitrary URI and parse the response into a JSON object. Raises an error on non-200 response status.
[ "Convenience", "method", "to", "call", "post", "()", "on", "an", "arbitrary", "URI", "and", "parse", "the", "response", "into", "a", "JSON", "object", ".", "Raises", "an", "error", "on", "non", "-", "200", "response", "status", "." ]
a182e73a750f03e906d9b25842d556db8d2fd54f
https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L91-L95
train
opendns/pyinvestigate
investigate/investigate.py
Investigate.categorization
def categorization(self, domains, labels=False): '''Get the domain status and categorization of a domain or list of domains. 'domains' can be either a single domain, or a list of domains. Setting 'labels' to True will give back categorizations in human-readable form. For more de...
python
def categorization(self, domains, labels=False): '''Get the domain status and categorization of a domain or list of domains. 'domains' can be either a single domain, or a list of domains. Setting 'labels' to True will give back categorizations in human-readable form. For more de...
[ "def", "categorization", "(", "self", ",", "domains", ",", "labels", "=", "False", ")", ":", "if", "type", "(", "domains", ")", "is", "str", ":", "return", "self", ".", "_get_categorization", "(", "domains", ",", "labels", ")", "elif", "type", "(", "do...
Get the domain status and categorization of a domain or list of domains. 'domains' can be either a single domain, or a list of domains. Setting 'labels' to True will give back categorizations in human-readable form. For more detail, see https://investigate.umbrella.com/docs/api#categori...
[ "Get", "the", "domain", "status", "and", "categorization", "of", "a", "domain", "or", "list", "of", "domains", ".", "domains", "can", "be", "either", "a", "single", "domain", "or", "a", "list", "of", "domains", ".", "Setting", "labels", "to", "True", "wi...
a182e73a750f03e906d9b25842d556db8d2fd54f
https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L108-L121
train
opendns/pyinvestigate
investigate/investigate.py
Investigate.cooccurrences
def cooccurrences(self, domain): '''Get the cooccurrences of the given domain. For details, see https://investigate.umbrella.com/docs/api#co-occurrences ''' uri = self._uris["cooccurrences"].format(domain) return self.get_parse(uri)
python
def cooccurrences(self, domain): '''Get the cooccurrences of the given domain. For details, see https://investigate.umbrella.com/docs/api#co-occurrences ''' uri = self._uris["cooccurrences"].format(domain) return self.get_parse(uri)
[ "def", "cooccurrences", "(", "self", ",", "domain", ")", ":", "uri", "=", "self", ".", "_uris", "[", "\"cooccurrences\"", "]", ".", "format", "(", "domain", ")", "return", "self", ".", "get_parse", "(", "uri", ")" ]
Get the cooccurrences of the given domain. For details, see https://investigate.umbrella.com/docs/api#co-occurrences
[ "Get", "the", "cooccurrences", "of", "the", "given", "domain", "." ]
a182e73a750f03e906d9b25842d556db8d2fd54f
https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L123-L129
train
opendns/pyinvestigate
investigate/investigate.py
Investigate.related
def related(self, domain): '''Get the related domains of the given domain. For details, see https://investigate.umbrella.com/docs/api#relatedDomains ''' uri = self._uris["related"].format(domain) return self.get_parse(uri)
python
def related(self, domain): '''Get the related domains of the given domain. For details, see https://investigate.umbrella.com/docs/api#relatedDomains ''' uri = self._uris["related"].format(domain) return self.get_parse(uri)
[ "def", "related", "(", "self", ",", "domain", ")", ":", "uri", "=", "self", ".", "_uris", "[", "\"related\"", "]", ".", "format", "(", "domain", ")", "return", "self", ".", "get_parse", "(", "uri", ")" ]
Get the related domains of the given domain. For details, see https://investigate.umbrella.com/docs/api#relatedDomains
[ "Get", "the", "related", "domains", "of", "the", "given", "domain", "." ]
a182e73a750f03e906d9b25842d556db8d2fd54f
https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L131-L137
train
opendns/pyinvestigate
investigate/investigate.py
Investigate.security
def security(self, domain): '''Get the Security Information for the given domain. For details, see https://investigate.umbrella.com/docs/api#securityInfo ''' uri = self._uris["security"].format(domain) return self.get_parse(uri)
python
def security(self, domain): '''Get the Security Information for the given domain. For details, see https://investigate.umbrella.com/docs/api#securityInfo ''' uri = self._uris["security"].format(domain) return self.get_parse(uri)
[ "def", "security", "(", "self", ",", "domain", ")", ":", "uri", "=", "self", ".", "_uris", "[", "\"security\"", "]", ".", "format", "(", "domain", ")", "return", "self", ".", "get_parse", "(", "uri", ")" ]
Get the Security Information for the given domain. For details, see https://investigate.umbrella.com/docs/api#securityInfo
[ "Get", "the", "Security", "Information", "for", "the", "given", "domain", "." ]
a182e73a750f03e906d9b25842d556db8d2fd54f
https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L139-L145
train