partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | PgInfo.getXlogStatus | Returns Transaction Logging or Recovery Status.
@return: Dictionary of status items. | pysysinfo/postgresql.py | 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):
"""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... | [
"Returns",
"Transaction",
"Logging",
"or",
"Recovery",
"Status",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/postgresql.py#L275-L306 | [
"def",
"getXlogStatus",
"(",
"self",
")",
":",
"inRecovery",
"=",
"None",
"if",
"self",
".",
"checkVersion",
"(",
"'9.0'",
")",
":",
"inRecovery",
"=",
"self",
".",
"_simpleQuery",
"(",
"\"SELECT pg_is_in_recovery();\"",
")",
"cur",
"=",
"self",
".",
"_conn"... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | PgInfo.getSlaveStatus | Returns status of replication slaves.
@return: Dictionary of status items. | pysysinfo/postgresql.py | 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):
"""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... | [
"Returns",
"status",
"of",
"replication",
"slaves",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/postgresql.py#L308-L328 | [
"def",
"getSlaveStatus",
"(",
"self",
")",
":",
"info_dict",
"=",
"{",
"}",
"if",
"self",
".",
"checkVersion",
"(",
"'9.1'",
")",
":",
"cols",
"=",
"[",
"'procpid'",
",",
"'usename'",
",",
"'application_name'",
",",
"'client_addr'",
",",
"'client_port'",
"... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MySQLinfo._connect | Establish connection to MySQL Database. | pysysinfo/mysql.py | 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):
"""Establish connection to MySQL Database."""
if self._connParams:
self._conn = MySQLdb.connect(**self._connParams)
else:
self._conn = MySQLdb.connect('') | [
"Establish",
"connection",
"to",
"MySQL",
"Database",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/mysql.py#L64-L69 | [
"def",
"_connect",
"(",
"self",
")",
":",
"if",
"self",
".",
"_connParams",
":",
"self",
".",
"_conn",
"=",
"MySQLdb",
".",
"connect",
"(",
"*",
"*",
"self",
".",
"_connParams",
")",
"else",
":",
"self",
".",
"_conn",
"=",
"MySQLdb",
".",
"connect",
... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MySQLinfo.getStorageEngines | Returns list of supported storage engines.
@return: List of storage engine names. | pysysinfo/mysql.py | 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):
"""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... | [
"Returns",
"list",
"of",
"supported",
"storage",
"engines",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/mysql.py#L71-L83 | [
"def",
"getStorageEngines",
"(",
"self",
")",
":",
"cur",
"=",
"self",
".",
"_conn",
".",
"cursor",
"(",
")",
"cur",
".",
"execute",
"(",
"\"\"\"SHOW STORAGE ENGINES;\"\"\"",
")",
"rows",
"=",
"cur",
".",
"fetchall",
"(",
")",
"if",
"rows",
":",
"return"... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MySQLinfo.getParam | Returns value of Run-time Database Parameter 'key'.
@param key: Run-time parameter name.
@return: Run-time parameter value. | pysysinfo/mysql.py | def getParam(self, key):
"""Returns value of Run-time Database Parameter 'key'.
@param key: Run-time parameter name.
@return: Run-time parameter value.
"""
cur = self._conn.cursor()
cur.execute("SHOW GLOBAL VARIABLES LIKE %s", key)
row = cur.f... | 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... | [
"Returns",
"value",
"of",
"Run",
"-",
"time",
"Database",
"Parameter",
"key",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/mysql.py#L85-L95 | [
"def",
"getParam",
"(",
"self",
",",
"key",
")",
":",
"cur",
"=",
"self",
".",
"_conn",
".",
"cursor",
"(",
")",
"cur",
".",
"execute",
"(",
"\"SHOW GLOBAL VARIABLES LIKE %s\"",
",",
"key",
")",
"row",
"=",
"cur",
".",
"fetchone",
"(",
")",
"return",
... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MySQLinfo.getParams | Returns dictionary of all run-time parameters.
@return: Dictionary of all Run-time parameters. | pysysinfo/mysql.py | 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):
"""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... | [
"Returns",
"dictionary",
"of",
"all",
"run",
"-",
"time",
"parameters",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/mysql.py#L97-L111 | [
"def",
"getParams",
"(",
"self",
")",
":",
"cur",
"=",
"self",
".",
"_conn",
".",
"cursor",
"(",
")",
"cur",
".",
"execute",
"(",
"\"SHOW GLOBAL VARIABLES\"",
")",
"rows",
"=",
"cur",
".",
"fetchall",
"(",
")",
"info_dict",
"=",
"{",
"}",
"for",
"row... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MySQLinfo.getProcessStatus | Returns number of processes discriminated by state.
@return: Dictionary mapping process state to number of processes. | pysysinfo/mysql.py | 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):
"""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... | [
"Returns",
"number",
"of",
"processes",
"discriminated",
"by",
"state",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/mysql.py#L129-L148 | [
"def",
"getProcessStatus",
"(",
"self",
")",
":",
"info_dict",
"=",
"{",
"}",
"cur",
"=",
"self",
".",
"_conn",
".",
"cursor",
"(",
")",
"cur",
".",
"execute",
"(",
"\"\"\"SHOW FULL PROCESSLIST;\"\"\"",
")",
"rows",
"=",
"cur",
".",
"fetchall",
"(",
")",... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MySQLinfo.getProcessDatabase | Returns number of processes discriminated by database name.
@return: Dictionary mapping database name to number of processes. | pysysinfo/mysql.py | 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):
"""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;""")
... | [
"Returns",
"number",
"of",
"processes",
"discriminated",
"by",
"database",
"name",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/mysql.py#L150-L164 | [
"def",
"getProcessDatabase",
"(",
"self",
")",
":",
"info_dict",
"=",
"{",
"}",
"cur",
"=",
"self",
".",
"_conn",
".",
"cursor",
"(",
")",
"cur",
".",
"execute",
"(",
"\"\"\"SHOW FULL PROCESSLIST;\"\"\"",
")",
"rows",
"=",
"cur",
".",
"fetchall",
"(",
")... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MySQLinfo.getDatabases | Returns list of databases.
@return: List of databases. | pysysinfo/mysql.py | 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):
"""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:
... | [
"Returns",
"list",
"of",
"databases",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/mysql.py#L166-L178 | [
"def",
"getDatabases",
"(",
"self",
")",
":",
"cur",
"=",
"self",
".",
"_conn",
".",
"cursor",
"(",
")",
"cur",
".",
"execute",
"(",
"\"\"\"SHOW DATABASES;\"\"\"",
")",
"rows",
"=",
"cur",
".",
"fetchall",
"(",
")",
"if",
"rows",
":",
"return",
"[",
... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | spc_helper | 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... | quail/analysis/spc.py | 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):
"""
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 ... | [
"Computes",
"probability",
"of",
"a",
"word",
"being",
"recalled",
"(",
"in",
"the",
"appropriate",
"recall",
"list",
")",
"given",
"its",
"presentation",
"position"
] | ContextLab/quail | python | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/analysis/spc.py#L4-L51 | [
"def",
"spc_helper",
"(",
"egg",
",",
"match",
"=",
"'exact'",
",",
"distance",
"=",
"'euclidean'",
",",
"features",
"=",
"None",
")",
":",
"def",
"spc",
"(",
"lst",
")",
":",
"d",
"=",
"np",
".",
"zeros_like",
"(",
"egg",
".",
"pres",
".",
"values... | 71dd53c792dd915dc84879d8237e3582dd68b7a4 |
train | TomcatInfo._retrieve | Query Apache Tomcat Server Status Page in XML format and return
the result as an ElementTree object.
@return: ElementTree object of Status Page XML. | pysysinfo/tomcat.py | 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):
"""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... | [
"Query",
"Apache",
"Tomcat",
"Server",
"Status",
"Page",
"in",
"XML",
"format",
"and",
"return",
"the",
"result",
"as",
"an",
"ElementTree",
"object",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/tomcat.py#L67-L79 | [
"def",
"_retrieve",
"(",
"self",
")",
":",
"url",
"=",
"\"%s://%s:%d/manager/status\"",
"%",
"(",
"self",
".",
"_proto",
",",
"self",
".",
"_host",
",",
"self",
".",
"_port",
")",
"params",
"=",
"{",
"}",
"params",
"[",
"'XML'",
"]",
"=",
"'true'",
"... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | TomcatInfo.getMemoryStats | Return JVM Memory Stats for Apache Tomcat Server.
@return: Dictionary of memory utilization stats. | pysysinfo/tomcat.py | 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):
"""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... | [
"Return",
"JVM",
"Memory",
"Stats",
"for",
"Apache",
"Tomcat",
"Server",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/tomcat.py#L85-L98 | [
"def",
"getMemoryStats",
"(",
"self",
")",
":",
"if",
"self",
".",
"_statusxml",
"is",
"None",
":",
"self",
".",
"initStats",
"(",
")",
"node",
"=",
"self",
".",
"_statusxml",
".",
"find",
"(",
"'jvm/memory'",
")",
"memstats",
"=",
"{",
"}",
"if",
"n... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | TomcatInfo.getConnectorStats | Return dictionary of Connector Stats for Apache Tomcat Server.
@return: Nested dictionary of Connector Stats. | pysysinfo/tomcat.py | 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):
"""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... | [
"Return",
"dictionary",
"of",
"Connector",
"Stats",
"for",
"Apache",
"Tomcat",
"Server",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/tomcat.py#L100-L130 | [
"def",
"getConnectorStats",
"(",
"self",
")",
":",
"if",
"self",
".",
"_statusxml",
"is",
"None",
":",
"self",
".",
"initStats",
"(",
")",
"connnodes",
"=",
"self",
".",
"_statusxml",
".",
"findall",
"(",
"'connector'",
")",
"connstats",
"=",
"{",
"}",
... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | load | 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 | quail/load.py | 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):
"""
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... | [
"Loads",
"eggs",
"fried",
"eggs",
"ands",
"example",
"data"
] | ContextLab/quail | python | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/load.py#L22-L54 | [
"def",
"load",
"(",
"filepath",
",",
"update",
"=",
"True",
")",
":",
"if",
"filepath",
"==",
"'automatic'",
"or",
"filepath",
"==",
"'example'",
":",
"fpath",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"__fi... | 71dd53c792dd915dc84879d8237e3582dd68b7a4 |
train | load_fegg | 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 | quail/load.py | 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):
"""
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:
... | [
"Loads",
"pickled",
"egg"
] | ContextLab/quail | python | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/load.py#L56-L85 | [
"def",
"load_fegg",
"(",
"filepath",
",",
"update",
"=",
"True",
")",
":",
"try",
":",
"egg",
"=",
"FriedEgg",
"(",
"*",
"*",
"dd",
".",
"io",
".",
"load",
"(",
"filepath",
")",
")",
"except",
"ValueError",
"as",
"e",
":",
"print",
"(",
"e",
")",... | 71dd53c792dd915dc84879d8237e3582dd68b7a4 |
train | load_egg | 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 | quail/load.py | 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):
"""
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:
... | [
"Loads",
"pickled",
"egg"
] | ContextLab/quail | python | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/load.py#L87-L121 | [
"def",
"load_egg",
"(",
"filepath",
",",
"update",
"=",
"True",
")",
":",
"try",
":",
"egg",
"=",
"Egg",
"(",
"*",
"*",
"dd",
".",
"io",
".",
"load",
"(",
"filepath",
")",
")",
"except",
":",
"# if error, try loading old format",
"with",
"open",
"(",
... | 71dd53c792dd915dc84879d8237e3582dd68b7a4 |
train | loadEL | Function that loads sql files generated by autoFR Experiment | quail/load.py | 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):
'''
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 ... | [
"Function",
"that",
"loads",
"sql",
"files",
"generated",
"by",
"autoFR",
"Experiment"
] | ContextLab/quail | python | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/load.py#L123-L514 | [
"def",
"loadEL",
"(",
"dbpath",
"=",
"None",
",",
"recpath",
"=",
"None",
",",
"remove_subs",
"=",
"None",
",",
"wordpool",
"=",
"None",
",",
"groupby",
"=",
"None",
",",
"experiments",
"=",
"None",
",",
"filters",
"=",
"None",
")",
":",
"assert",
"(... | 71dd53c792dd915dc84879d8237e3582dd68b7a4 |
train | load_example_data | 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... | quail/load.py | 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'):
"""
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... | [
"Loads",
"example",
"data"
] | ContextLab/quail | python | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/load.py#L516-L564 | [
"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",
"... | 71dd53c792dd915dc84879d8237e3582dd68b7a4 |
train | MuninFreeswitchPlugin.retrieveVals | Retrieve values for graphs. | pymunin/plugins/fsstats.py | 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):
"""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 ... | [
"Retrieve",
"values",
"for",
"graphs",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/fsstats.py#L100-L108 | [
"def",
"retrieveVals",
"(",
"self",
")",
":",
"fs",
"=",
"FSinfo",
"(",
"self",
".",
"_fshost",
",",
"self",
".",
"_fsport",
",",
"self",
".",
"_fspass",
")",
"if",
"self",
".",
"hasGraph",
"(",
"'fs_calls'",
")",
":",
"count",
"=",
"fs",
".",
"get... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninFreeswitchPlugin.autoconf | Implements Munin Plugin Auto-Configuration Option.
@return: True if plugin can be auto-configured, False otherwise. | pymunin/plugins/fsstats.py | 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):
"""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 | [
"Implements",
"Munin",
"Plugin",
"Auto",
"-",
"Configuration",
"Option",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/fsstats.py#L110-L117 | [
"def",
"autoconf",
"(",
"self",
")",
":",
"fs",
"=",
"FSinfo",
"(",
"self",
".",
"_fshost",
",",
"self",
".",
"_fsport",
",",
"self",
".",
"_fspass",
")",
"return",
"fs",
"is",
"not",
"None"
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | spsolve | 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.
... | scikits/umfpack/interface.py | 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):
"""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... | [
"Solve",
"the",
"sparse",
"linear",
"system",
"Ax",
"=",
"b",
"where",
"b",
"may",
"be",
"a",
"vector",
"or",
"a",
"matrix",
"."
] | scikit-umfpack/scikit-umfpack | python | https://github.com/scikit-umfpack/scikit-umfpack/blob/a2102ef92f4dd060138e72bb5d7c444f8ec49cbc/scikits/umfpack/interface.py#L44-L68 | [
"def",
"spsolve",
"(",
"A",
",",
"b",
")",
":",
"x",
"=",
"UmfpackLU",
"(",
"A",
")",
".",
"solve",
"(",
"b",
")",
"if",
"b",
".",
"ndim",
"==",
"2",
"and",
"b",
".",
"shape",
"[",
"1",
"]",
"==",
"1",
":",
"# compatibility with scipy.sparse.spso... | a2102ef92f4dd060138e72bb5d7c444f8ec49cbc |
train | UmfpackLU.solve | 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 | scikits/umfpack/interface.py | 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):
"""
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"
] | scikit-umfpack/scikit-umfpack | python | https://github.com/scikit-umfpack/scikit-umfpack/blob/a2102ef92f4dd060138e72bb5d7c444f8ec49cbc/scikits/umfpack/interface.py#L215-L240 | [
"def",
"solve",
"(",
"self",
",",
"b",
")",
":",
"if",
"isspmatrix",
"(",
"b",
")",
":",
"b",
"=",
"b",
".",
"toarray",
"(",
")",
"if",
"b",
".",
"shape",
"[",
"0",
"]",
"!=",
"self",
".",
"_A",
".",
"shape",
"[",
"1",
"]",
":",
"raise",
... | a2102ef92f4dd060138e72bb5d7c444f8ec49cbc |
train | UmfpackLU.solve_sparse | 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... | scikits/umfpack/interface.py | 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):
"""
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()`.... | [
"Solve",
"linear",
"equation",
"of",
"the",
"form",
"A",
"X",
"=",
"B",
".",
"Where",
"B",
"and",
"X",
"are",
"sparse",
"matrices",
"."
] | scikit-umfpack/scikit-umfpack | python | https://github.com/scikit-umfpack/scikit-umfpack/blob/a2102ef92f4dd060138e72bb5d7c444f8ec49cbc/scikits/umfpack/interface.py#L242-L262 | [
"def",
"solve_sparse",
"(",
"self",
",",
"B",
")",
":",
"B",
"=",
"B",
".",
"tocsc",
"(",
")",
"cols",
"=",
"list",
"(",
")",
"for",
"j",
"in",
"xrange",
"(",
"B",
".",
"shape",
"[",
"1",
"]",
")",
":",
"col",
"=",
"self",
".",
"solve",
"("... | a2102ef92f4dd060138e72bb5d7c444f8ec49cbc |
train | recall_matrix | 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... | quail/analysis/recmat.py | 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):
"""
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... | [
"Computes",
"recall",
"matrix",
"given",
"list",
"of",
"presented",
"and",
"list",
"of",
"recalled",
"words"
] | ContextLab/quail | python | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/analysis/recmat.py#L7-L51 | [
"def",
"recall_matrix",
"(",
"egg",
",",
"match",
"=",
"'exact'",
",",
"distance",
"=",
"'euclidean'",
",",
"features",
"=",
"None",
")",
":",
"if",
"match",
"in",
"[",
"'best'",
",",
"'smooth'",
"]",
":",
"if",
"not",
"features",
":",
"features",
"=",... | 71dd53c792dd915dc84879d8237e3582dd68b7a4 |
train | MuninNetstatsPlugin.retrieveVals | Retrieve values for graphs. | pymunin/plugins/netstats.py | 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):
"""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',
... | [
"Retrieve",
"values",
"for",
"graphs",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/netstats.py#L122-L139 | [
"def",
"retrieveVals",
"(",
"self",
")",
":",
"net_info",
"=",
"NetstatInfo",
"(",
")",
"if",
"self",
".",
"hasGraph",
"(",
"'netstat_conn_status'",
")",
":",
"stats",
"=",
"net_info",
".",
"getTCPportConnStatus",
"(",
"include_listen",
"=",
"True",
")",
"fo... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | AsteriskInfo._parseFreePBXconf | Parses FreePBX configuration file /etc/amportal for user and password
for Asterisk Manager Interface.
@return: True if configuration file is found and parsed successfully. | pysysinfo/asterisk.py | 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):
"""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... | [
"Parses",
"FreePBX",
"configuration",
"file",
"/",
"etc",
"/",
"amportal",
"for",
"user",
"and",
"password",
"for",
"Asterisk",
"Manager",
"Interface",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L85-L112 | [
"def",
"_parseFreePBXconf",
"(",
"self",
")",
":",
"amiuser",
"=",
"None",
"amipass",
"=",
"None",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"confFileFreePBX",
")",
":",
"try",
":",
"fp",
"=",
"open",
"(",
"confFileFreePBX",
",",
"'r'",
")",
"data",... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | AsteriskInfo._parseAsteriskConf | 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. | pysysinfo/asterisk.py | 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):
"""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... | [
"Parses",
"Asterisk",
"configuration",
"file",
"/",
"etc",
"/",
"asterisk",
"/",
"manager",
".",
"conf",
"for",
"user",
"and",
"password",
"for",
"Manager",
"Interface",
".",
"Returns",
"True",
"on",
"success",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L114-L135 | [
"def",
"_parseAsteriskConf",
"(",
"self",
")",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"confFileAMI",
")",
":",
"try",
":",
"fp",
"=",
"open",
"(",
"confFileAMI",
",",
"'r'",
")",
"data",
"=",
"fp",
".",
"read",
"(",
")",
"fp",
".",
"cl... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | AsteriskInfo._connect | Connect to Asterisk Manager Interface. | pysysinfo/asterisk.py | 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):
"""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... | [
"Connect",
"to",
"Asterisk",
"Manager",
"Interface",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L137-L150 | [
"def",
"_connect",
"(",
"self",
")",
":",
"try",
":",
"if",
"sys",
".",
"version_info",
"[",
":",
"2",
"]",
">=",
"(",
"2",
",",
"6",
")",
":",
"self",
".",
"_conn",
"=",
"telnetlib",
".",
"Telnet",
"(",
"self",
".",
"_amihost",
",",
"self",
".... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | AsteriskInfo._sendAction | 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. | pysysinfo/asterisk.py | 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):
"""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",
... | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L152-L167 | [
"def",
"_sendAction",
"(",
"self",
",",
"action",
",",
"attrs",
"=",
"None",
",",
"chan_vars",
"=",
"None",
")",
":",
"self",
".",
"_conn",
".",
"write",
"(",
"\"Action: %s\\r\\n\"",
"%",
"action",
")",
"if",
"attrs",
":",
"for",
"(",
"key",
",",
"va... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | AsteriskInfo._getResponse | Read and parse response from Asterisk Manager Interface.
@return: Dictionary with response key-value pairs. | pysysinfo/asterisk.py | 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):
"""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"):
... | [
"Read",
"and",
"parse",
"response",
"from",
"Asterisk",
"Manager",
"Interface",
".",
"@return",
":",
"Dictionary",
"with",
"response",
"key",
"-",
"value",
"pairs",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L169-L185 | [
"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\"",
... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | AsteriskInfo._getGreeting | Read and parse Asterisk Manager Interface Greeting to determine and
set Manager Interface version. | pysysinfo/asterisk.py | 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):
"""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:
... | [
"Read",
"and",
"parse",
"Asterisk",
"Manager",
"Interface",
"Greeting",
"to",
"determine",
"and",
"set",
"Manager",
"Interface",
"version",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L192-L202 | [
"def",
"_getGreeting",
"(",
"self",
")",
":",
"greeting",
"=",
"self",
".",
"_conn",
".",
"read_until",
"(",
"\"\\r\\n\"",
",",
"connTimeout",
")",
"mobj",
"=",
"re",
".",
"match",
"(",
"'Asterisk Call Manager\\/([\\d\\.]+)\\s*$'",
",",
"greeting",
")",
"if",
... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | AsteriskInfo._initAsteriskVersion | Query Asterisk Manager Interface for Asterisk Version to configure
system for compatibility with multiple versions
.
CLI Command - core show version | pysysinfo/asterisk.py | 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):
"""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... | [
"Query",
"Asterisk",
"Manager",
"Interface",
"for",
"Asterisk",
"Version",
"to",
"configure",
"system",
"for",
"compatibility",
"with",
"multiple",
"versions",
".",
"CLI",
"Command",
"-",
"core",
"show",
"version"
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L204-L220 | [
"def",
"_initAsteriskVersion",
"(",
"self",
")",
":",
"if",
"self",
".",
"_ami_version",
">",
"util",
".",
"SoftwareVersion",
"(",
"'1.0'",
")",
":",
"cmd",
"=",
"\"core show version\"",
"else",
":",
"cmd",
"=",
"\"show version\"",
"cmdresp",
"=",
"self",
".... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | AsteriskInfo._login | Login to Asterisk Manager Interface. | pysysinfo/asterisk.py | 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):
"""Login to Asterisk Manager Interface."""
self._sendAction("login", (
("Username", self._amiuser),
("Secret", self._amipass),
("Events", "off"),
))
resp = self._getResponse()
if resp.get("Response") == "Success":
... | [
"Login",
"to",
"Asterisk",
"Manager",
"Interface",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L222-L233 | [
"def",
"_login",
"(",
"self",
")",
":",
"self",
".",
"_sendAction",
"(",
"\"login\"",
",",
"(",
"(",
"\"Username\"",
",",
"self",
".",
"_amiuser",
")",
",",
"(",
"\"Secret\"",
",",
"self",
".",
"_amipass",
")",
",",
"(",
"\"Events\"",
",",
"\"off\"",
... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | AsteriskInfo.executeCommand | Send Action to Asterisk Manager Interface to execute CLI Command.
@param command: CLI command to execute.
@return: Command response string. | pysysinfo/asterisk.py | 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):
"""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),
))
... | [
"Send",
"Action",
"to",
"Asterisk",
"Manager",
"Interface",
"to",
"execute",
"CLI",
"Command",
".",
"@param",
"command",
":",
"CLI",
"command",
"to",
"execute",
".",
"@return",
":",
"Command",
"response",
"string",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L235-L255 | [
"def",
"executeCommand",
"(",
"self",
",",
"command",
")",
":",
"self",
".",
"_sendAction",
"(",
"\"Command\"",
",",
"(",
"(",
"\"Command\"",
",",
"command",
")",
",",
")",
")",
"resp",
"=",
"self",
".",
"_getResponse",
"(",
")",
"result",
"=",
"resp",... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | AsteriskInfo._initModuleList | Query Asterisk Manager Interface to initialize internal list of
loaded modules.
CLI Command - core show modules | pysysinfo/asterisk.py | 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):
"""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"
... | [
"Query",
"Asterisk",
"Manager",
"Interface",
"to",
"initialize",
"internal",
"list",
"of",
"loaded",
"modules",
".",
"CLI",
"Command",
"-",
"core",
"show",
"modules"
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L257-L273 | [
"def",
"_initModuleList",
"(",
"self",
")",
":",
"if",
"self",
".",
"checkVersion",
"(",
"'1.4'",
")",
":",
"cmd",
"=",
"\"module show\"",
"else",
":",
"cmd",
"=",
"\"show modules\"",
"cmdresp",
"=",
"self",
".",
"executeCommand",
"(",
"cmd",
")",
"self",
... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | AsteriskInfo._initApplicationList | Query Asterisk Manager Interface to initialize internal list of
available applications.
CLI Command - core show applications | pysysinfo/asterisk.py | 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):
"""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:
... | [
"Query",
"Asterisk",
"Manager",
"Interface",
"to",
"initialize",
"internal",
"list",
"of",
"available",
"applications",
".",
"CLI",
"Command",
"-",
"core",
"show",
"applications"
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L275-L291 | [
"def",
"_initApplicationList",
"(",
"self",
")",
":",
"if",
"self",
".",
"checkVersion",
"(",
"'1.4'",
")",
":",
"cmd",
"=",
"\"core show applications\"",
"else",
":",
"cmd",
"=",
"\"show applications\"",
"cmdresp",
"=",
"self",
".",
"executeCommand",
"(",
"cm... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | AsteriskInfo._initChannelTypesList | Query Asterisk Manager Interface to initialize internal list of
supported channel types.
CLI Command - core show applications | pysysinfo/asterisk.py | 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):
"""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:
... | [
"Query",
"Asterisk",
"Manager",
"Interface",
"to",
"initialize",
"internal",
"list",
"of",
"supported",
"channel",
"types",
".",
"CLI",
"Command",
"-",
"core",
"show",
"applications"
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L293-L309 | [
"def",
"_initChannelTypesList",
"(",
"self",
")",
":",
"if",
"self",
".",
"checkVersion",
"(",
"'1.4'",
")",
":",
"cmd",
"=",
"\"core show channeltypes\"",
"else",
":",
"cmd",
"=",
"\"show channeltypes\"",
"cmdresp",
"=",
"self",
".",
"executeCommand",
"(",
"c... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | AsteriskInfo.hasModule | Returns True if mod is among the loaded modules.
@param mod: Module name.
@return: Boolean | pysysinfo/asterisk.py | 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):
"""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 | [
"Returns",
"True",
"if",
"mod",
"is",
"among",
"the",
"loaded",
"modules",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L328-L337 | [
"def",
"hasModule",
"(",
"self",
",",
"mod",
")",
":",
"if",
"self",
".",
"_modules",
"is",
"None",
":",
"self",
".",
"_initModuleList",
"(",
")",
"return",
"mod",
"in",
"self",
".",
"_modules"
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | AsteriskInfo.hasApplication | Returns True if app is among the loaded modules.
@param app: Module name.
@return: Boolean | pysysinfo/asterisk.py | 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):
"""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 | [
"Returns",
"True",
"if",
"app",
"is",
"among",
"the",
"loaded",
"modules",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L339-L348 | [
"def",
"hasApplication",
"(",
"self",
",",
"app",
")",
":",
"if",
"self",
".",
"_applications",
"is",
"None",
":",
"self",
".",
"_initApplicationList",
"(",
")",
"return",
"app",
"in",
"self",
".",
"_applications"
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | AsteriskInfo.hasChannelType | Returns True if chan is among the supported channel types.
@param app: Module name.
@return: Boolean | pysysinfo/asterisk.py | 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):
"""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 | [
"Returns",
"True",
"if",
"chan",
"is",
"among",
"the",
"supported",
"channel",
"types",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L350-L359 | [
"def",
"hasChannelType",
"(",
"self",
",",
"chan",
")",
":",
"if",
"self",
".",
"_chantypes",
"is",
"None",
":",
"self",
".",
"_initChannelTypesList",
"(",
")",
"return",
"chan",
"in",
"self",
".",
"_chantypes"
] | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | AsteriskInfo.getCodecList | Query Asterisk Manager Interface for defined codecs.
CLI Command - core show codecs
@return: Dictionary - Short Name -> (Type, Long Name) | pysysinfo/asterisk.py | 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):
"""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:
... | [
"Query",
"Asterisk",
"Manager",
"Interface",
"for",
"defined",
"codecs",
".",
"CLI",
"Command",
"-",
"core",
"show",
"codecs"
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L392-L411 | [
"def",
"getCodecList",
"(",
"self",
")",
":",
"if",
"self",
".",
"checkVersion",
"(",
"'1.4'",
")",
":",
"cmd",
"=",
"\"core show codecs\"",
"else",
":",
"cmd",
"=",
"\"show codecs\"",
"cmdresp",
"=",
"self",
".",
"executeCommand",
"(",
"cmd",
")",
"info_d... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | AsteriskInfo.getChannelStats | 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. | pysysinfo/asterisk.py | 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')):
"""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"
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L413-L464 | [
"def",
"getChannelStats",
"(",
"self",
",",
"chantypes",
"=",
"(",
"'dahdi'",
",",
"'zap'",
",",
"'sip'",
",",
"'iax2'",
",",
"'local'",
")",
")",
":",
"if",
"self",
".",
"checkVersion",
"(",
"'1.4'",
")",
":",
"cmd",
"=",
"\"core show channels\"",
"else... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | AsteriskInfo.getPeerStats | 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. | pysysinfo/asterisk.py | 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):
"""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... | [
"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... | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L466-L499 | [
"def",
"getPeerStats",
"(",
"self",
",",
"chantype",
")",
":",
"chan",
"=",
"chantype",
".",
"lower",
"(",
")",
"if",
"not",
"self",
".",
"hasChannelType",
"(",
"chan",
")",
":",
"return",
"None",
"if",
"chan",
"==",
"'iax2'",
":",
"cmd",
"=",
"\"iax... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | AsteriskInfo.getVoIPchanStats | 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... | pysysinfo/asterisk.py | 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')):
"""Query Asterisk Manager Interface for SIP / IAX2 Channel / Codec Stats.
CLI Commands - sip show channels
iax2 show channnels
@param chantype: M... | [
"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",
"."... | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L501-L554 | [
"def",
"getVoIPchanStats",
"(",
"self",
",",
"chantype",
",",
"codec_list",
"=",
"(",
"'ulaw'",
",",
"'alaw'",
",",
"'gsm'",
",",
"'g729'",
")",
")",
":",
"chan",
"=",
"chantype",
".",
"lower",
"(",
")",
"if",
"not",
"self",
".",
"hasChannelType",
"(",... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | AsteriskInfo.getConferenceStats | Query Asterisk Manager Interface for Conference Room Stats.
CLI Command - meetme list
@return: Dictionary of statistics counters for Conference Rooms. | pysysinfo/asterisk.py | 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):
"""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... | [
"Query",
"Asterisk",
"Manager",
"Interface",
"for",
"Conference",
"Room",
"Stats",
".",
"CLI",
"Command",
"-",
"meetme",
"list"
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L564-L587 | [
"def",
"getConferenceStats",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"hasConference",
"(",
")",
":",
"return",
"None",
"if",
"self",
".",
"checkVersion",
"(",
"'1.6'",
")",
":",
"cmd",
"=",
"\"meetme list\"",
"else",
":",
"cmd",
"=",
"\"meetme\"... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | AsteriskInfo.getVoicemailStats | Query Asterisk Manager Interface for Voicemail Stats.
CLI Command - voicemail show users
@return: Dictionary of statistics counters for Voicemail Accounts. | pysysinfo/asterisk.py | 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):
"""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... | [
"Query",
"Asterisk",
"Manager",
"Interface",
"for",
"Voicemail",
"Stats",
".",
"CLI",
"Command",
"-",
"voicemail",
"show",
"users"
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L597-L627 | [
"def",
"getVoicemailStats",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"hasVoicemail",
"(",
")",
":",
"return",
"None",
"if",
"self",
".",
"checkVersion",
"(",
"'1.4'",
")",
":",
"cmd",
"=",
"\"voicemail show users\"",
"else",
":",
"cmd",
"=",
"\"s... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | AsteriskInfo.getTrunkStats | 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... | pysysinfo/asterisk.py | 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):
"""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 ... | [
"Query",
"Asterisk",
"Manager",
"Interface",
"for",
"Trunk",
"Stats",
".",
"CLI",
"Command",
"-",
"core",
"show",
"channels"
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L629-L668 | [
"def",
"getTrunkStats",
"(",
"self",
",",
"trunkList",
")",
":",
"re_list",
"=",
"[",
"]",
"info_dict",
"=",
"{",
"}",
"for",
"filt",
"in",
"trunkList",
":",
"info_dict",
"[",
"filt",
"[",
"0",
"]",
"]",
"=",
"0",
"re_list",
".",
"append",
"(",
"re... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | AsteriskInfo.getQueueStats | Query Asterisk Manager Interface for Queue Stats.
CLI Command: queue show
@return: Dictionary of queue stats. | pysysinfo/asterisk.py | 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):
"""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'):
... | [
"Query",
"Asterisk",
"Manager",
"Interface",
"for",
"Queue",
"Stats",
".",
"CLI",
"Command",
":",
"queue",
"show"
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L678-L743 | [
"def",
"getQueueStats",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"hasQueue",
"(",
")",
":",
"return",
"None",
"info_dict",
"=",
"{",
"}",
"if",
"self",
".",
"checkVersion",
"(",
"'1.4'",
")",
":",
"cmd",
"=",
"\"queue show\"",
"else",
":",
"c... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | AsteriskInfo.getFaxStatsCounters | Query Asterisk Manager Interface for Fax Stats.
CLI Command - fax show stats
@return: Dictionary of fax stats. | pysysinfo/asterisk.py | 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):
"""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... | [
"Query",
"Asterisk",
"Manager",
"Interface",
"for",
"Fax",
"Stats",
".",
"CLI",
"Command",
"-",
"fax",
"show",
"stats"
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L753-L777 | [
"def",
"getFaxStatsCounters",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"hasFax",
"(",
")",
":",
"return",
"None",
"info_dict",
"=",
"{",
"}",
"cmdresp",
"=",
"self",
".",
"executeCommand",
"(",
"'fax show stats'",
")",
"ctxt",
"=",
"'general'",
"... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | AsteriskInfo.getFaxStatsSessions | Query Asterisk Manager Interface for Fax Stats.
CLI Command - fax show sessions
@return: Dictionary of fax stats. | pysysinfo/asterisk.py | 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):
"""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
... | [
"Query",
"Asterisk",
"Manager",
"Interface",
"for",
"Fax",
"Stats",
".",
"CLI",
"Command",
"-",
"fax",
"show",
"sessions"
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/asterisk.py#L779-L813 | [
"def",
"getFaxStatsSessions",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"hasFax",
"(",
")",
":",
"return",
"None",
"info_dict",
"=",
"{",
"}",
"info_dict",
"[",
"'total'",
"]",
"=",
"0",
"fax_types",
"=",
"(",
"'g.711'",
",",
"'t.38'",
")",
"f... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninWanpipePlugin.retrieveVals | Retrieve values for graphs. | pymunin/plugins/wanpipestats.py | 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):
"""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... | [
"Retrieve",
"values",
"for",
"graphs",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/wanpipestats.py#L156-L191 | [
"def",
"retrieveVals",
"(",
"self",
")",
":",
"for",
"iface",
"in",
"self",
".",
"_ifaceList",
":",
"if",
"self",
".",
"_reqIfaceList",
"is",
"None",
"or",
"iface",
"in",
"self",
".",
"_reqIfaceList",
":",
"if",
"(",
"self",
".",
"graphEnabled",
"(",
"... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | simulate_list | A function to simulate a list | quail/simulate.py | 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):
"""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)] ... | [
"A",
"function",
"to",
"simulate",
"a",
"list"
] | ContextLab/quail | python | https://github.com/ContextLab/quail/blob/71dd53c792dd915dc84879d8237e3582dd68b7a4/quail/simulate.py#L5-L14 | [
"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... | 71dd53c792dd915dc84879d8237e3582dd68b7a4 |
train | MuninMySQLplugin.retrieveVals | Retrieve values for graphs. | pymunin/plugins/mysqlstats.py | 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):
"""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... | [
"Retrieve",
"values",
"for",
"graphs",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/mysqlstats.py#L451-L610 | [
"def",
"retrieveVals",
"(",
"self",
")",
":",
"if",
"self",
".",
"_genStats",
"is",
"None",
":",
"self",
".",
"_genStats",
"=",
"self",
".",
"_dbconn",
".",
"getStats",
"(",
")",
"if",
"self",
".",
"_genVars",
"is",
"None",
":",
"self",
".",
"_genVar... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninMySQLplugin.engineIncluded | 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. | pymunin/plugins/mysqlstats.py | 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):
"""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... | [
"Utility",
"method",
"to",
"check",
"if",
"a",
"storage",
"engine",
"is",
"included",
"in",
"graphs",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/mysqlstats.py#L612-L621 | [
"def",
"engineIncluded",
"(",
"self",
",",
"name",
")",
":",
"if",
"self",
".",
"_engines",
"is",
"None",
":",
"self",
".",
"_engines",
"=",
"self",
".",
"_dbconn",
".",
"getStorageEngines",
"(",
")",
"return",
"self",
".",
"envCheckFilter",
"(",
"'engin... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | FilesystemInfo.getSpaceUse | Get disk space usage.
@return: Dictionary of filesystem space utilization stats for filesystems. | pysysinfo/filesystem.py | 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):
"""Get disk space usage.
@return: Dictionary of filesystem space utilization stats for filesystems.
"""
stats = {}
try:
out = subprocess.Popen([dfCmd, "-Pk"],
stdout=subprocess.PIPE).communic... | [
"Get",
"disk",
"space",
"usage",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pysysinfo/filesystem.py#L67-L91 | [
"def",
"getSpaceUse",
"(",
"self",
")",
":",
"stats",
"=",
"{",
"}",
"try",
":",
"out",
"=",
"subprocess",
".",
"Popen",
"(",
"[",
"dfCmd",
",",
"\"-Pk\"",
"]",
",",
"stdout",
"=",
"subprocess",
".",
"PIPE",
")",
".",
"communicate",
"(",
")",
"[",
... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | MuninPgPlugin.retrieveVals | Retrieve values for graphs. | pymunin/plugins/pgstats.py | 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):
"""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')
... | [
"Retrieve",
"values",
"for",
"graphs",
"."
] | aouyar/PyMunin | python | https://github.com/aouyar/PyMunin/blob/4f58a64b6b37c85a84cc7e1e07aafaa0321b249d/pymunin/plugins/pgstats.py#L389-L486 | [
"def",
"retrieveVals",
"(",
"self",
")",
":",
"stats",
"=",
"self",
".",
"_dbconn",
".",
"getDatabaseStats",
"(",
")",
"databases",
"=",
"stats",
".",
"get",
"(",
"'databases'",
")",
"totals",
"=",
"stats",
".",
"get",
"(",
"'totals'",
")",
"if",
"self... | 4f58a64b6b37c85a84cc7e1e07aafaa0321b249d |
train | AquaLogic.connect | Connects via a RS-485 to Ethernet adapter. | aqualogic/core.py | 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):
"""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') | [
"Connects",
"via",
"a",
"RS",
"-",
"485",
"to",
"Ethernet",
"adapter",
"."
] | swilson/aqualogic | python | https://github.com/swilson/aqualogic/blob/b6e904363efc4f64c70aae127d040079587ecbc6/aqualogic/core.py#L104-L109 | [
"def",
"connect",
"(",
"self",
",",
"host",
",",
"port",
")",
":",
"sock",
"=",
"socket",
".",
"socket",
"(",
"socket",
".",
"AF_INET",
",",
"socket",
".",
"SOCK_STREAM",
")",
"sock",
".",
"connect",
"(",
"(",
"host",
",",
"port",
")",
")",
"self",... | b6e904363efc4f64c70aae127d040079587ecbc6 |
train | AquaLogic.process | Process data; returns when the reader signals EOF.
Callback is notified when any data changes. | aqualogic/core.py | 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):
"""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... | [
"Process",
"data",
";",
"returns",
"when",
"the",
"reader",
"signals",
"EOF",
".",
"Callback",
"is",
"notified",
"when",
"any",
"data",
"changes",
"."
] | swilson/aqualogic | python | https://github.com/swilson/aqualogic/blob/b6e904363efc4f64c70aae127d040079587ecbc6/aqualogic/core.py#L125-L292 | [
"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... | b6e904363efc4f64c70aae127d040079587ecbc6 |
train | AquaLogic.send_key | Sends a key. | aqualogic/core.py | 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):
"""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... | [
"Sends",
"a",
"key",
"."
] | swilson/aqualogic | python | https://github.com/swilson/aqualogic/blob/b6e904363efc4f64c70aae127d040079587ecbc6/aqualogic/core.py#L319-L326 | [
"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 ... | b6e904363efc4f64c70aae127d040079587ecbc6 |
train | AquaLogic.states | Returns a set containing the enabled states. | aqualogic/core.py | 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):
"""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... | [
"Returns",
"a",
"set",
"containing",
"the",
"enabled",
"states",
"."
] | swilson/aqualogic | python | https://github.com/swilson/aqualogic/blob/b6e904363efc4f64c70aae127d040079587ecbc6/aqualogic/core.py#L392-L402 | [
"def",
"states",
"(",
"self",
")",
":",
"state_list",
"=",
"[",
"]",
"for",
"state",
"in",
"States",
":",
"if",
"state",
".",
"value",
"&",
"self",
".",
"_states",
"!=",
"0",
":",
"state_list",
".",
"append",
"(",
"state",
")",
"if",
"(",
"self",
... | b6e904363efc4f64c70aae127d040079587ecbc6 |
train | AquaLogic.get_state | Returns True if the specified state is enabled. | aqualogic/core.py | 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):
"""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']
... | [
"Returns",
"True",
"if",
"the",
"specified",
"state",
"is",
"enabled",
"."
] | swilson/aqualogic | python | https://github.com/swilson/aqualogic/blob/b6e904363efc4f64c70aae127d040079587ecbc6/aqualogic/core.py#L404-L415 | [
"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"... | b6e904363efc4f64c70aae127d040079587ecbc6 |
train | AquaLogic.set_state | Set the state. | aqualogic/core.py | 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):
"""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... | [
"Set",
"the",
"state",
"."
] | swilson/aqualogic | python | https://github.com/swilson/aqualogic/blob/b6e904363efc4f64c70aae127d040079587ecbc6/aqualogic/core.py#L417-L455 | [
"def",
"set_state",
"(",
"self",
",",
"state",
",",
"enable",
")",
":",
"is_enabled",
"=",
"self",
".",
"get_state",
"(",
"state",
")",
"if",
"is_enabled",
"==",
"enable",
":",
"return",
"True",
"key",
"=",
"None",
"desired_states",
"=",
"[",
"{",
"'st... | b6e904363efc4f64c70aae127d040079587ecbc6 |
train | trace | Decorates a function by tracing the begining and
end of the function execution, if doTrace global is True | qgmap/__init__.py | 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) :
"""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 | [
"Decorates",
"a",
"function",
"by",
"tracing",
"the",
"begining",
"and",
"end",
"of",
"the",
"function",
"execution",
"if",
"doTrace",
"global",
"is",
"True"
] | vokimon/python-qgmap | python | https://github.com/vokimon/python-qgmap/blob/9b01b48c5a8f4726938d38326f89644e7fb95f51/qgmap/__init__.py#L18-L25 | [
"def",
"trace",
"(",
"function",
",",
"*",
"args",
",",
"*",
"*",
"k",
")",
":",
"if",
"doTrace",
":",
"print",
"(",
"\"> \"",
"+",
"function",
".",
"__name__",
",",
"args",
",",
"k",
")",
"result",
"=",
"function",
"(",
"*",
"args",
",",
"*",
... | 9b01b48c5a8f4726938d38326f89644e7fb95f51 |
train | GeoCoder.geocode | url = QtCore.QUrl("http://maps.google.com/maps/geo/")
url.addQueryItem("q", location)
url.addQueryItem("output", "csv")
url.addQueryItem("sensor", "false") | qgmap/__init__.py | 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("sensor", "false")
"""
url = QtCore.QUrl("http://maps.google.com/maps/geo/")
url.addQueryItem("q", location)
url.addQueryItem("output", "csv")
url.add... | [
"url",
"=",
"QtCore",
".",
"QUrl",
"(",
"http",
":",
"//",
"maps",
".",
"google",
".",
"com",
"/",
"maps",
"/",
"geo",
"/",
")",
"url",
".",
"addQueryItem",
"(",
"q",
"location",
")",
"url",
".",
"addQueryItem",
"(",
"output",
"csv",
")",
"url",
... | vokimon/python-qgmap | python | https://github.com/vokimon/python-qgmap/blob/9b01b48c5a8f4726938d38326f89644e7fb95f51/qgmap/__init__.py#L40-L57 | [
"def",
"geocode",
"(",
"self",
",",
"location",
")",
":",
"url",
"=",
"QtCore",
".",
"QUrl",
"(",
"\"http://maps.googleapis.com/maps/api/geocode/xml\"",
")",
"url",
".",
"addQueryItem",
"(",
"\"address\"",
",",
"location",
")",
"url",
".",
"addQueryItem",
"(",
... | 9b01b48c5a8f4726938d38326f89644e7fb95f51 |
train | 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 | mcerp/correlate.py | 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):
"""
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... | [
"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... | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/correlate.py#L8-L34 | [
"def",
"correlate",
"(",
"params",
",",
"corrmat",
")",
":",
"# Make sure all inputs are compatible\r",
"assert",
"all",
"(",
"[",
"isinstance",
"(",
"param",
",",
"UncertainFunction",
")",
"for",
"param",
"in",
"params",
"]",
")",
",",
"'All inputs to \"correlate... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | induce_correlations | 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
... | mcerp/correlate.py | 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):
"""
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
... | [
"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",
... | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/correlate.py#L37-L95 | [
"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... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | plotcorr | 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... | mcerp/correlate.py | 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):
"""
Plots a scatterplot matrix of subplots.
Usage:
plotcorr(X)
plotcorr(..., plotargs=...) # e.g., 'r*', 'bo', etc.
plotcorr(..., full=...) # e.g., True or False
plotc... | [
"Plots",
"a",
"scatterplot",
"matrix",
"of",
"subplots",
".",
"Usage",
":",
"plotcorr",
"(",
"X",
")",
"plotcorr",
"(",
"...",
"plotargs",
"=",
"...",
")",
"#",
"e",
".",
"g",
".",
"r",
"*",
"bo",
"etc",
".",
"plotcorr",
"(",
"...",
"full",
"=",
... | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/correlate.py#L98-L201 | [
"def",
"plotcorr",
"(",
"X",
",",
"plotargs",
"=",
"None",
",",
"full",
"=",
"True",
",",
"labels",
"=",
"None",
")",
":",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"X",
"=",
"[",
"Xi",
".",
"_mcpts",
"if",
"isinstance",
"(",
"Xi",
",",
... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | chol | Calculate the lower triangular matrix of the Cholesky decomposition of
a symmetric, positive-definite matrix. | mcerp/correlate.py | 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):
"""
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)):
... | [
"Calculate",
"the",
"lower",
"triangular",
"matrix",
"of",
"the",
"Cholesky",
"decomposition",
"of",
"a",
"symmetric",
"positive",
"-",
"definite",
"matrix",
"."
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/correlate.py#L204-L220 | [
"def",
"chol",
"(",
"A",
")",
":",
"A",
"=",
"np",
".",
"array",
"(",
"A",
")",
"assert",
"A",
".",
"shape",
"[",
"0",
"]",
"==",
"A",
".",
"shape",
"[",
"1",
"]",
",",
"\"Input matrix must be square\"",
"L",
"=",
"[",
"[",
"0.0",
"]",
"*",
"... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | Investigate.get | A generic method to make GET requests to the OpenDNS Investigate API
on the given URI. | investigate/investigate.py | 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={}):
'''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
) | [
"A",
"generic",
"method",
"to",
"make",
"GET",
"requests",
"to",
"the",
"OpenDNS",
"Investigate",
"API",
"on",
"the",
"given",
"URI",
"."
] | opendns/pyinvestigate | python | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L62-L68 | [
"def",
"get",
"(",
"self",
",",
"uri",
",",
"params",
"=",
"{",
"}",
")",
":",
"return",
"self",
".",
"_session",
".",
"get",
"(",
"urljoin",
"(",
"Investigate",
".",
"BASE_URL",
",",
"uri",
")",
",",
"params",
"=",
"params",
",",
"headers",
"=",
... | a182e73a750f03e906d9b25842d556db8d2fd54f |
train | Investigate.post | A generic method to make POST requests to the OpenDNS Investigate API
on the given URI. | investigate/investigate.py | 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={}):
'''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,
... | [
"A",
"generic",
"method",
"to",
"make",
"POST",
"requests",
"to",
"the",
"OpenDNS",
"Investigate",
"API",
"on",
"the",
"given",
"URI",
"."
] | opendns/pyinvestigate | python | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L70-L78 | [
"def",
"post",
"(",
"self",
",",
"uri",
",",
"params",
"=",
"{",
"}",
",",
"data",
"=",
"{",
"}",
")",
":",
"return",
"self",
".",
"_session",
".",
"post",
"(",
"urljoin",
"(",
"Investigate",
".",
"BASE_URL",
",",
"uri",
")",
",",
"params",
"=",
... | a182e73a750f03e906d9b25842d556db8d2fd54f |
train | Investigate.get_parse | 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. | investigate/investigate.py | 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={}):
'''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) | [
"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",
"."
] | opendns/pyinvestigate | python | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L85-L89 | [
"def",
"get_parse",
"(",
"self",
",",
"uri",
",",
"params",
"=",
"{",
"}",
")",
":",
"return",
"self",
".",
"_request_parse",
"(",
"self",
".",
"get",
",",
"uri",
",",
"params",
")"
] | a182e73a750f03e906d9b25842d556db8d2fd54f |
train | Investigate.post_parse | 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. | investigate/investigate.py | 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={}):
'''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) | [
"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",
"."
] | opendns/pyinvestigate | python | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L91-L95 | [
"def",
"post_parse",
"(",
"self",
",",
"uri",
",",
"params",
"=",
"{",
"}",
",",
"data",
"=",
"{",
"}",
")",
":",
"return",
"self",
".",
"_request_parse",
"(",
"self",
".",
"post",
",",
"uri",
",",
"params",
",",
"data",
")"
] | a182e73a750f03e906d9b25842d556db8d2fd54f |
train | Investigate.categorization | 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... | investigate/investigate.py | 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):
'''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... | [
"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... | opendns/pyinvestigate | python | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L108-L121 | [
"def",
"categorization",
"(",
"self",
",",
"domains",
",",
"labels",
"=",
"False",
")",
":",
"if",
"type",
"(",
"domains",
")",
"is",
"str",
":",
"return",
"self",
".",
"_get_categorization",
"(",
"domains",
",",
"labels",
")",
"elif",
"type",
"(",
"do... | a182e73a750f03e906d9b25842d556db8d2fd54f |
train | Investigate.cooccurrences | Get the cooccurrences of the given domain.
For details, see https://investigate.umbrella.com/docs/api#co-occurrences | investigate/investigate.py | 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):
'''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) | [
"Get",
"the",
"cooccurrences",
"of",
"the",
"given",
"domain",
"."
] | opendns/pyinvestigate | python | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L123-L129 | [
"def",
"cooccurrences",
"(",
"self",
",",
"domain",
")",
":",
"uri",
"=",
"self",
".",
"_uris",
"[",
"\"cooccurrences\"",
"]",
".",
"format",
"(",
"domain",
")",
"return",
"self",
".",
"get_parse",
"(",
"uri",
")"
] | a182e73a750f03e906d9b25842d556db8d2fd54f |
train | Investigate.related | Get the related domains of the given domain.
For details, see https://investigate.umbrella.com/docs/api#relatedDomains | investigate/investigate.py | 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):
'''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) | [
"Get",
"the",
"related",
"domains",
"of",
"the",
"given",
"domain",
"."
] | opendns/pyinvestigate | python | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L131-L137 | [
"def",
"related",
"(",
"self",
",",
"domain",
")",
":",
"uri",
"=",
"self",
".",
"_uris",
"[",
"\"related\"",
"]",
".",
"format",
"(",
"domain",
")",
"return",
"self",
".",
"get_parse",
"(",
"uri",
")"
] | a182e73a750f03e906d9b25842d556db8d2fd54f |
train | Investigate.security | Get the Security Information for the given domain.
For details, see https://investigate.umbrella.com/docs/api#securityInfo | investigate/investigate.py | 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):
'''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) | [
"Get",
"the",
"Security",
"Information",
"for",
"the",
"given",
"domain",
"."
] | opendns/pyinvestigate | python | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L139-L145 | [
"def",
"security",
"(",
"self",
",",
"domain",
")",
":",
"uri",
"=",
"self",
".",
"_uris",
"[",
"\"security\"",
"]",
".",
"format",
"(",
"domain",
")",
"return",
"self",
".",
"get_parse",
"(",
"uri",
")"
] | a182e73a750f03e906d9b25842d556db8d2fd54f |
train | Investigate.rr_history | Get the RR (Resource Record) History of the given domain or IP.
The default query type is for 'A' records, but the following query types
are supported:
A, NS, MX, TXT, CNAME
For details, see https://investigate.umbrella.com/docs/api#dnsrr_domain | investigate/investigate.py | def rr_history(self, query, query_type="A"):
'''Get the RR (Resource Record) History of the given domain or IP.
The default query type is for 'A' records, but the following query types
are supported:
A, NS, MX, TXT, CNAME
For details, see https://investigate.umbrella.com/docs/a... | def rr_history(self, query, query_type="A"):
'''Get the RR (Resource Record) History of the given domain or IP.
The default query type is for 'A' records, but the following query types
are supported:
A, NS, MX, TXT, CNAME
For details, see https://investigate.umbrella.com/docs/a... | [
"Get",
"the",
"RR",
"(",
"Resource",
"Record",
")",
"History",
"of",
"the",
"given",
"domain",
"or",
"IP",
".",
"The",
"default",
"query",
"type",
"is",
"for",
"A",
"records",
"but",
"the",
"following",
"query",
"types",
"are",
"supported",
":"
] | opendns/pyinvestigate | python | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L155-L172 | [
"def",
"rr_history",
"(",
"self",
",",
"query",
",",
"query_type",
"=",
"\"A\"",
")",
":",
"if",
"query_type",
"not",
"in",
"Investigate",
".",
"SUPPORTED_DNS_TYPES",
":",
"raise",
"Investigate",
".",
"UNSUPPORTED_DNS_QUERY",
"# if this is an IP address, query the IP"... | a182e73a750f03e906d9b25842d556db8d2fd54f |
train | Investigate.domain_whois | Gets whois information for a domain | investigate/investigate.py | def domain_whois(self, domain):
'''Gets whois information for a domain'''
uri = self._uris["whois_domain"].format(domain)
resp_json = self.get_parse(uri)
return resp_json | def domain_whois(self, domain):
'''Gets whois information for a domain'''
uri = self._uris["whois_domain"].format(domain)
resp_json = self.get_parse(uri)
return resp_json | [
"Gets",
"whois",
"information",
"for",
"a",
"domain"
] | opendns/pyinvestigate | python | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L187-L191 | [
"def",
"domain_whois",
"(",
"self",
",",
"domain",
")",
":",
"uri",
"=",
"self",
".",
"_uris",
"[",
"\"whois_domain\"",
"]",
".",
"format",
"(",
"domain",
")",
"resp_json",
"=",
"self",
".",
"get_parse",
"(",
"uri",
")",
"return",
"resp_json"
] | a182e73a750f03e906d9b25842d556db8d2fd54f |
train | Investigate.domain_whois_history | Gets whois history for a domain | investigate/investigate.py | def domain_whois_history(self, domain, limit=None):
'''Gets whois history for a domain'''
params = dict()
if limit is not None:
params['limit'] = limit
uri = self._uris["whois_domain_history"].format(domain)
resp_json = self.get_parse(uri, params)
return res... | def domain_whois_history(self, domain, limit=None):
'''Gets whois history for a domain'''
params = dict()
if limit is not None:
params['limit'] = limit
uri = self._uris["whois_domain_history"].format(domain)
resp_json = self.get_parse(uri, params)
return res... | [
"Gets",
"whois",
"history",
"for",
"a",
"domain"
] | opendns/pyinvestigate | python | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L193-L202 | [
"def",
"domain_whois_history",
"(",
"self",
",",
"domain",
",",
"limit",
"=",
"None",
")",
":",
"params",
"=",
"dict",
"(",
")",
"if",
"limit",
"is",
"not",
"None",
":",
"params",
"[",
"'limit'",
"]",
"=",
"limit",
"uri",
"=",
"self",
".",
"_uris",
... | a182e73a750f03e906d9b25842d556db8d2fd54f |
train | Investigate.ns_whois | Gets the domains that have been registered with a nameserver or
nameservers | investigate/investigate.py | def ns_whois(self, nameservers, limit=DEFAULT_LIMIT, offset=DEFAULT_OFFSET, sort_field=DEFAULT_SORT):
'''Gets the domains that have been registered with a nameserver or
nameservers'''
if not isinstance(nameservers, list):
uri = self._uris["whois_ns"].format(nameservers)
p... | def ns_whois(self, nameservers, limit=DEFAULT_LIMIT, offset=DEFAULT_OFFSET, sort_field=DEFAULT_SORT):
'''Gets the domains that have been registered with a nameserver or
nameservers'''
if not isinstance(nameservers, list):
uri = self._uris["whois_ns"].format(nameservers)
p... | [
"Gets",
"the",
"domains",
"that",
"have",
"been",
"registered",
"with",
"a",
"nameserver",
"or",
"nameservers"
] | opendns/pyinvestigate | python | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L204-L215 | [
"def",
"ns_whois",
"(",
"self",
",",
"nameservers",
",",
"limit",
"=",
"DEFAULT_LIMIT",
",",
"offset",
"=",
"DEFAULT_OFFSET",
",",
"sort_field",
"=",
"DEFAULT_SORT",
")",
":",
"if",
"not",
"isinstance",
"(",
"nameservers",
",",
"list",
")",
":",
"uri",
"="... | a182e73a750f03e906d9b25842d556db8d2fd54f |
train | Investigate.search | Searches for domains that match a given pattern | investigate/investigate.py | def search(self, pattern, start=None, limit=None, include_category=None):
'''Searches for domains that match a given pattern'''
params = dict()
if start is None:
start = datetime.timedelta(days=30)
if isinstance(start, datetime.timedelta):
params['start'] = int... | def search(self, pattern, start=None, limit=None, include_category=None):
'''Searches for domains that match a given pattern'''
params = dict()
if start is None:
start = datetime.timedelta(days=30)
if isinstance(start, datetime.timedelta):
params['start'] = int... | [
"Searches",
"for",
"domains",
"that",
"match",
"a",
"given",
"pattern"
] | opendns/pyinvestigate | python | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L231-L253 | [
"def",
"search",
"(",
"self",
",",
"pattern",
",",
"start",
"=",
"None",
",",
"limit",
"=",
"None",
",",
"include_category",
"=",
"None",
")",
":",
"params",
"=",
"dict",
"(",
")",
"if",
"start",
"is",
"None",
":",
"start",
"=",
"datetime",
".",
"t... | a182e73a750f03e906d9b25842d556db8d2fd54f |
train | Investigate.samples | Return an object representing the samples identified by the input domain, IP, or URL | investigate/investigate.py | def samples(self, anystring, limit=None, offset=None, sortby=None):
'''Return an object representing the samples identified by the input domain, IP, or URL'''
uri = self._uris['samples'].format(anystring)
params = {'limit': limit, 'offset': offset, 'sortby': sortby}
return self.get_par... | def samples(self, anystring, limit=None, offset=None, sortby=None):
'''Return an object representing the samples identified by the input domain, IP, or URL'''
uri = self._uris['samples'].format(anystring)
params = {'limit': limit, 'offset': offset, 'sortby': sortby}
return self.get_par... | [
"Return",
"an",
"object",
"representing",
"the",
"samples",
"identified",
"by",
"the",
"input",
"domain",
"IP",
"or",
"URL"
] | opendns/pyinvestigate | python | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L255-L261 | [
"def",
"samples",
"(",
"self",
",",
"anystring",
",",
"limit",
"=",
"None",
",",
"offset",
"=",
"None",
",",
"sortby",
"=",
"None",
")",
":",
"uri",
"=",
"self",
".",
"_uris",
"[",
"'samples'",
"]",
".",
"format",
"(",
"anystring",
")",
"params",
"... | a182e73a750f03e906d9b25842d556db8d2fd54f |
train | Investigate.sample | Return an object representing the sample identified by the input hash, or an empty object if that sample is not found | investigate/investigate.py | def sample(self, hash, limit=None, offset=None):
'''Return an object representing the sample identified by the input hash, or an empty object if that sample is not found'''
uri = self._uris['sample'].format(hash)
params = {'limit': limit, 'offset': offset}
return self.get_parse(uri, pa... | def sample(self, hash, limit=None, offset=None):
'''Return an object representing the sample identified by the input hash, or an empty object if that sample is not found'''
uri = self._uris['sample'].format(hash)
params = {'limit': limit, 'offset': offset}
return self.get_parse(uri, pa... | [
"Return",
"an",
"object",
"representing",
"the",
"sample",
"identified",
"by",
"the",
"input",
"hash",
"or",
"an",
"empty",
"object",
"if",
"that",
"sample",
"is",
"not",
"found"
] | opendns/pyinvestigate | python | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L263-L269 | [
"def",
"sample",
"(",
"self",
",",
"hash",
",",
"limit",
"=",
"None",
",",
"offset",
"=",
"None",
")",
":",
"uri",
"=",
"self",
".",
"_uris",
"[",
"'sample'",
"]",
".",
"format",
"(",
"hash",
")",
"params",
"=",
"{",
"'limit'",
":",
"limit",
",",... | a182e73a750f03e906d9b25842d556db8d2fd54f |
train | Investigate.as_for_ip | Gets the AS information for a given IP address. | investigate/investigate.py | def as_for_ip(self, ip):
'''Gets the AS information for a given IP address.'''
if not Investigate.IP_PATTERN.match(ip):
raise Investigate.IP_ERR
uri = self._uris["as_for_ip"].format(ip)
resp_json = self.get_parse(uri)
return resp_json | def as_for_ip(self, ip):
'''Gets the AS information for a given IP address.'''
if not Investigate.IP_PATTERN.match(ip):
raise Investigate.IP_ERR
uri = self._uris["as_for_ip"].format(ip)
resp_json = self.get_parse(uri)
return resp_json | [
"Gets",
"the",
"AS",
"information",
"for",
"a",
"given",
"IP",
"address",
"."
] | opendns/pyinvestigate | python | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L298-L306 | [
"def",
"as_for_ip",
"(",
"self",
",",
"ip",
")",
":",
"if",
"not",
"Investigate",
".",
"IP_PATTERN",
".",
"match",
"(",
"ip",
")",
":",
"raise",
"Investigate",
".",
"IP_ERR",
"uri",
"=",
"self",
".",
"_uris",
"[",
"\"as_for_ip\"",
"]",
".",
"format",
... | a182e73a750f03e906d9b25842d556db8d2fd54f |
train | Investigate.prefixes_for_asn | Gets the AS information for a given ASN. Return the CIDR and geolocation associated with the AS. | investigate/investigate.py | def prefixes_for_asn(self, asn):
'''Gets the AS information for a given ASN. Return the CIDR and geolocation associated with the AS.'''
uri = self._uris["prefixes_for_asn"].format(asn)
resp_json = self.get_parse(uri)
return resp_json | def prefixes_for_asn(self, asn):
'''Gets the AS information for a given ASN. Return the CIDR and geolocation associated with the AS.'''
uri = self._uris["prefixes_for_asn"].format(asn)
resp_json = self.get_parse(uri)
return resp_json | [
"Gets",
"the",
"AS",
"information",
"for",
"a",
"given",
"ASN",
".",
"Return",
"the",
"CIDR",
"and",
"geolocation",
"associated",
"with",
"the",
"AS",
"."
] | opendns/pyinvestigate | python | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L308-L314 | [
"def",
"prefixes_for_asn",
"(",
"self",
",",
"asn",
")",
":",
"uri",
"=",
"self",
".",
"_uris",
"[",
"\"prefixes_for_asn\"",
"]",
".",
"format",
"(",
"asn",
")",
"resp_json",
"=",
"self",
".",
"get_parse",
"(",
"uri",
")",
"return",
"resp_json"
] | a182e73a750f03e906d9b25842d556db8d2fd54f |
train | Investigate.timeline | Get the domain tagging timeline for a given uri.
Could be a domain, ip, or url.
For details, see https://docs.umbrella.com/investigate-api/docs/timeline | investigate/investigate.py | def timeline(self, uri):
'''Get the domain tagging timeline for a given uri.
Could be a domain, ip, or url.
For details, see https://docs.umbrella.com/investigate-api/docs/timeline
'''
uri = self._uris["timeline"].format(uri)
resp_json = self.get_parse(uri)
retu... | def timeline(self, uri):
'''Get the domain tagging timeline for a given uri.
Could be a domain, ip, or url.
For details, see https://docs.umbrella.com/investigate-api/docs/timeline
'''
uri = self._uris["timeline"].format(uri)
resp_json = self.get_parse(uri)
retu... | [
"Get",
"the",
"domain",
"tagging",
"timeline",
"for",
"a",
"given",
"uri",
".",
"Could",
"be",
"a",
"domain",
"ip",
"or",
"url",
".",
"For",
"details",
"see",
"https",
":",
"//",
"docs",
".",
"umbrella",
".",
"com",
"/",
"investigate",
"-",
"api",
"/... | opendns/pyinvestigate | python | https://github.com/opendns/pyinvestigate/blob/a182e73a750f03e906d9b25842d556db8d2fd54f/investigate/investigate.py#L316-L324 | [
"def",
"timeline",
"(",
"self",
",",
"uri",
")",
":",
"uri",
"=",
"self",
".",
"_uris",
"[",
"\"timeline\"",
"]",
".",
"format",
"(",
"uri",
")",
"resp_json",
"=",
"self",
".",
"get_parse",
"(",
"uri",
")",
"return",
"resp_json"
] | a182e73a750f03e906d9b25842d556db8d2fd54f |
train | abs | Absolute value | mcerp/umath.py | def abs(x):
"""
Absolute value
"""
if isinstance(x, UncertainFunction):
mcpts = np.abs(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.abs(x) | def abs(x):
"""
Absolute value
"""
if isinstance(x, UncertainFunction):
mcpts = np.abs(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.abs(x) | [
"Absolute",
"value"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L18-L26 | [
"def",
"abs",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"abs",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
"a... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | acos | Inverse cosine | mcerp/umath.py | def acos(x):
"""
Inverse cosine
"""
if isinstance(x, UncertainFunction):
mcpts = np.arccos(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.arccos(x) | def acos(x):
"""
Inverse cosine
"""
if isinstance(x, UncertainFunction):
mcpts = np.arccos(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.arccos(x) | [
"Inverse",
"cosine"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L29-L37 | [
"def",
"acos",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"arccos",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | acosh | Inverse hyperbolic cosine | mcerp/umath.py | def acosh(x):
"""
Inverse hyperbolic cosine
"""
if isinstance(x, UncertainFunction):
mcpts = np.arccosh(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.arccosh(x) | def acosh(x):
"""
Inverse hyperbolic cosine
"""
if isinstance(x, UncertainFunction):
mcpts = np.arccosh(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.arccosh(x) | [
"Inverse",
"hyperbolic",
"cosine"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L40-L48 | [
"def",
"acosh",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"arccosh",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
"."... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | asin | Inverse sine | mcerp/umath.py | def asin(x):
"""
Inverse sine
"""
if isinstance(x, UncertainFunction):
mcpts = np.arcsin(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.arcsin(x) | def asin(x):
"""
Inverse sine
"""
if isinstance(x, UncertainFunction):
mcpts = np.arcsin(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.arcsin(x) | [
"Inverse",
"sine"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L51-L59 | [
"def",
"asin",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"arcsin",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | asinh | Inverse hyperbolic sine | mcerp/umath.py | def asinh(x):
"""
Inverse hyperbolic sine
"""
if isinstance(x, UncertainFunction):
mcpts = np.arcsinh(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.arcsinh(x) | def asinh(x):
"""
Inverse hyperbolic sine
"""
if isinstance(x, UncertainFunction):
mcpts = np.arcsinh(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.arcsinh(x) | [
"Inverse",
"hyperbolic",
"sine"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L62-L70 | [
"def",
"asinh",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"arcsinh",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
"."... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | atan | Inverse tangent | mcerp/umath.py | def atan(x):
"""
Inverse tangent
"""
if isinstance(x, UncertainFunction):
mcpts = np.arctan(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.arctan(x) | def atan(x):
"""
Inverse tangent
"""
if isinstance(x, UncertainFunction):
mcpts = np.arctan(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.arctan(x) | [
"Inverse",
"tangent"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L73-L81 | [
"def",
"atan",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"arctan",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | atanh | Inverse hyperbolic tangent | mcerp/umath.py | def atanh(x):
"""
Inverse hyperbolic tangent
"""
if isinstance(x, UncertainFunction):
mcpts = np.arctanh(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.arctanh(x) | def atanh(x):
"""
Inverse hyperbolic tangent
"""
if isinstance(x, UncertainFunction):
mcpts = np.arctanh(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.arctanh(x) | [
"Inverse",
"hyperbolic",
"tangent"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L84-L92 | [
"def",
"atanh",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"arctanh",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
"."... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | ceil | Ceiling function (round towards positive infinity) | mcerp/umath.py | def ceil(x):
"""
Ceiling function (round towards positive infinity)
"""
if isinstance(x, UncertainFunction):
mcpts = np.ceil(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.ceil(x) | def ceil(x):
"""
Ceiling function (round towards positive infinity)
"""
if isinstance(x, UncertainFunction):
mcpts = np.ceil(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.ceil(x) | [
"Ceiling",
"function",
"(",
"round",
"towards",
"positive",
"infinity",
")"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L95-L103 | [
"def",
"ceil",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"ceil",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | cos | Cosine | mcerp/umath.py | def cos(x):
"""
Cosine
"""
if isinstance(x, UncertainFunction):
mcpts = np.cos(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.cos(x) | def cos(x):
"""
Cosine
"""
if isinstance(x, UncertainFunction):
mcpts = np.cos(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.cos(x) | [
"Cosine"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L106-L114 | [
"def",
"cos",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"cos",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
"c... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | cosh | Hyperbolic cosine | mcerp/umath.py | def cosh(x):
"""
Hyperbolic cosine
"""
if isinstance(x, UncertainFunction):
mcpts = np.cosh(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.cosh(x) | def cosh(x):
"""
Hyperbolic cosine
"""
if isinstance(x, UncertainFunction):
mcpts = np.cosh(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.cosh(x) | [
"Hyperbolic",
"cosine"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L117-L125 | [
"def",
"cosh",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"cosh",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | degrees | Convert radians to degrees | mcerp/umath.py | def degrees(x):
"""
Convert radians to degrees
"""
if isinstance(x, UncertainFunction):
mcpts = np.degrees(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.degrees(x) | def degrees(x):
"""
Convert radians to degrees
"""
if isinstance(x, UncertainFunction):
mcpts = np.degrees(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.degrees(x) | [
"Convert",
"radians",
"to",
"degrees"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L128-L136 | [
"def",
"degrees",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"degrees",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
"... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | exp | Exponential function | mcerp/umath.py | def exp(x):
"""
Exponential function
"""
if isinstance(x, UncertainFunction):
mcpts = np.exp(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.exp(x) | def exp(x):
"""
Exponential function
"""
if isinstance(x, UncertainFunction):
mcpts = np.exp(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.exp(x) | [
"Exponential",
"function"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L139-L147 | [
"def",
"exp",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"exp",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
"e... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | expm1 | Calculate exp(x) - 1 | mcerp/umath.py | def expm1(x):
"""
Calculate exp(x) - 1
"""
if isinstance(x, UncertainFunction):
mcpts = np.expm1(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.expm1(x) | def expm1(x):
"""
Calculate exp(x) - 1
"""
if isinstance(x, UncertainFunction):
mcpts = np.expm1(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.expm1(x) | [
"Calculate",
"exp",
"(",
"x",
")",
"-",
"1"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L150-L158 | [
"def",
"expm1",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"expm1",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
train | fabs | Absolute value function | mcerp/umath.py | def fabs(x):
"""
Absolute value function
"""
if isinstance(x, UncertainFunction):
mcpts = np.fabs(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.fabs(x) | def fabs(x):
"""
Absolute value function
"""
if isinstance(x, UncertainFunction):
mcpts = np.fabs(x._mcpts)
return UncertainFunction(mcpts)
else:
return np.fabs(x) | [
"Absolute",
"value",
"function"
] | tisimst/mcerp | python | https://github.com/tisimst/mcerp/blob/2bb8260c9ad2d58a806847f1b627b6451e407de1/mcerp/umath.py#L161-L169 | [
"def",
"fabs",
"(",
"x",
")",
":",
"if",
"isinstance",
"(",
"x",
",",
"UncertainFunction",
")",
":",
"mcpts",
"=",
"np",
".",
"fabs",
"(",
"x",
".",
"_mcpts",
")",
"return",
"UncertainFunction",
"(",
"mcpts",
")",
"else",
":",
"return",
"np",
".",
... | 2bb8260c9ad2d58a806847f1b627b6451e407de1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.