repo stringlengths 7 54 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 20 28.4k | docstring stringlengths 1 46.3k | docstring_tokens listlengths 1 1.66k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value | summary stringlengths 4 350 | obf_code stringlengths 7.85k 764k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
nicolargo/glances | glances/snmp.py | GlancesSNMPClient.getbulk_by_oid | def getbulk_by_oid(self, non_repeaters, max_repetitions, *oid):
"""SNMP getbulk request.
In contrast to snmpwalk, this information will typically be gathered in
a single transaction with the agent, rather than one transaction per
variable found.
* non_repeaters: This specifies ... | python | def getbulk_by_oid(self, non_repeaters, max_repetitions, *oid):
"""SNMP getbulk request.
In contrast to snmpwalk, this information will typically be gathered in
a single transaction with the agent, rather than one transaction per
variable found.
* non_repeaters: This specifies ... | [
"def",
"getbulk_by_oid",
"(",
"self",
",",
"non_repeaters",
",",
"max_repetitions",
",",
"*",
"oid",
")",
":",
"if",
"self",
".",
"version",
".",
"startswith",
"(",
"'3'",
")",
":",
"errorIndication",
",",
"errorStatus",
",",
"errorIndex",
",",
"varBinds",
... | SNMP getbulk request.
In contrast to snmpwalk, this information will typically be gathered in
a single transaction with the agent, rather than one transaction per
variable found.
* non_repeaters: This specifies the number of supplied variables that
should not be iterated over... | [
"SNMP",
"getbulk",
"request",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/snmp.py#L100-L133 | train | This method returns a list of dicts that are available for SNMP. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/static_list.py | GlancesStaticServer.load | def load(self, config):
"""Load the server list from the configuration file."""
server_list = []
if config is None:
logger.debug("No configuration file available. Cannot load server list.")
elif not config.has_section(self._section):
logger.warning("No [%s] secti... | python | def load(self, config):
"""Load the server list from the configuration file."""
server_list = []
if config is None:
logger.debug("No configuration file available. Cannot load server list.")
elif not config.has_section(self._section):
logger.warning("No [%s] secti... | [
"def",
"load",
"(",
"self",
",",
"config",
")",
":",
"server_list",
"=",
"[",
"]",
"if",
"config",
"is",
"None",
":",
"logger",
".",
"debug",
"(",
"\"No configuration file available. Cannot load server list.\"",
")",
"elif",
"not",
"config",
".",
"has_section",
... | Load the server list from the configuration file. | [
"Load",
"the",
"server",
"list",
"from",
"the",
"configuration",
"file",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/static_list.py#L40-L84 | train | Load the server list from the configuration file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/static_list.py | GlancesStaticServer.set_server | def set_server(self, server_pos, key, value):
"""Set the key to the value for the server_pos (position in the list)."""
self._server_list[server_pos][key] = value | python | def set_server(self, server_pos, key, value):
"""Set the key to the value for the server_pos (position in the list)."""
self._server_list[server_pos][key] = value | [
"def",
"set_server",
"(",
"self",
",",
"server_pos",
",",
"key",
",",
"value",
")",
":",
"self",
".",
"_server_list",
"[",
"server_pos",
"]",
"[",
"key",
"]",
"=",
"value"
] | Set the key to the value for the server_pos (position in the list). | [
"Set",
"the",
"key",
"to",
"the",
"value",
"for",
"the",
"server_pos",
"(",
"position",
"in",
"the",
"list",
")",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/static_list.py#L90-L92 | train | Set the key to the value for the server_pos. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/autodiscover.py | AutoDiscovered.add_server | def add_server(self, name, ip, port):
"""Add a new server to the list."""
new_server = {
'key': name, # Zeroconf name with both hostname and port
'name': name.split(':')[0], # Short name
'ip': ip, # IP address seen by the client
'port': port, # TCP por... | python | def add_server(self, name, ip, port):
"""Add a new server to the list."""
new_server = {
'key': name, # Zeroconf name with both hostname and port
'name': name.split(':')[0], # Short name
'ip': ip, # IP address seen by the client
'port': port, # TCP por... | [
"def",
"add_server",
"(",
"self",
",",
"name",
",",
"ip",
",",
"port",
")",
":",
"new_server",
"=",
"{",
"'key'",
":",
"name",
",",
"# Zeroconf name with both hostname and port",
"'name'",
":",
"name",
".",
"split",
"(",
"':'",
")",
"[",
"0",
"]",
",",
... | Add a new server to the list. | [
"Add",
"a",
"new",
"server",
"to",
"the",
"list",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/autodiscover.py#L71-L84 | train | Add a new server to the list. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/autodiscover.py | AutoDiscovered.remove_server | def remove_server(self, name):
"""Remove a server from the dict."""
for i in self._server_list:
if i['key'] == name:
try:
self._server_list.remove(i)
logger.debug("Remove server %s from the list" % name)
logger.debug... | python | def remove_server(self, name):
"""Remove a server from the dict."""
for i in self._server_list:
if i['key'] == name:
try:
self._server_list.remove(i)
logger.debug("Remove server %s from the list" % name)
logger.debug... | [
"def",
"remove_server",
"(",
"self",
",",
"name",
")",
":",
"for",
"i",
"in",
"self",
".",
"_server_list",
":",
"if",
"i",
"[",
"'key'",
"]",
"==",
"name",
":",
"try",
":",
"self",
".",
"_server_list",
".",
"remove",
"(",
"i",
")",
"logger",
".",
... | Remove a server from the dict. | [
"Remove",
"a",
"server",
"from",
"the",
"dict",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/autodiscover.py#L86-L97 | train | Removes a server from the dict. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/autodiscover.py | GlancesAutoDiscoverListener.set_server | def set_server(self, server_pos, key, value):
"""Set the key to the value for the server_pos (position in the list)."""
self.servers.set_server(server_pos, key, value) | python | def set_server(self, server_pos, key, value):
"""Set the key to the value for the server_pos (position in the list)."""
self.servers.set_server(server_pos, key, value) | [
"def",
"set_server",
"(",
"self",
",",
"server_pos",
",",
"key",
",",
"value",
")",
":",
"self",
".",
"servers",
".",
"set_server",
"(",
"server_pos",
",",
"key",
",",
"value",
")"
] | Set the key to the value for the server_pos (position in the list). | [
"Set",
"the",
"key",
"to",
"the",
"value",
"for",
"the",
"server_pos",
"(",
"position",
"in",
"the",
"list",
")",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/autodiscover.py#L112-L114 | train | Set the key to the value for the server_pos. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/autodiscover.py | GlancesAutoDiscoverListener.add_service | def add_service(self, zeroconf, srv_type, srv_name):
"""Method called when a new Zeroconf client is detected.
Return True if the zeroconf client is a Glances server
Note: the return code will never be used
"""
if srv_type != zeroconf_type:
return False
logger... | python | def add_service(self, zeroconf, srv_type, srv_name):
"""Method called when a new Zeroconf client is detected.
Return True if the zeroconf client is a Glances server
Note: the return code will never be used
"""
if srv_type != zeroconf_type:
return False
logger... | [
"def",
"add_service",
"(",
"self",
",",
"zeroconf",
",",
"srv_type",
",",
"srv_name",
")",
":",
"if",
"srv_type",
"!=",
"zeroconf_type",
":",
"return",
"False",
"logger",
".",
"debug",
"(",
"\"Check new Zeroconf server: %s / %s\"",
"%",
"(",
"srv_type",
",",
"... | Method called when a new Zeroconf client is detected.
Return True if the zeroconf client is a Glances server
Note: the return code will never be used | [
"Method",
"called",
"when",
"a",
"new",
"Zeroconf",
"client",
"is",
"detected",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/autodiscover.py#L116-L138 | train | Method called when a new Zeroconf client is detected. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/autodiscover.py | GlancesAutoDiscoverListener.remove_service | def remove_service(self, zeroconf, srv_type, srv_name):
"""Remove the server from the list."""
self.servers.remove_server(srv_name)
logger.info(
"Glances server %s removed from the autodetect list" % srv_name) | python | def remove_service(self, zeroconf, srv_type, srv_name):
"""Remove the server from the list."""
self.servers.remove_server(srv_name)
logger.info(
"Glances server %s removed from the autodetect list" % srv_name) | [
"def",
"remove_service",
"(",
"self",
",",
"zeroconf",
",",
"srv_type",
",",
"srv_name",
")",
":",
"self",
".",
"servers",
".",
"remove_server",
"(",
"srv_name",
")",
"logger",
".",
"info",
"(",
"\"Glances server %s removed from the autodetect list\"",
"%",
"srv_n... | Remove the server from the list. | [
"Remove",
"the",
"server",
"from",
"the",
"list",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/autodiscover.py#L140-L144 | train | Remove the server from the list. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/autodiscover.py | GlancesAutoDiscoverServer.set_server | def set_server(self, server_pos, key, value):
"""Set the key to the value for the server_pos (position in the list)."""
if zeroconf_tag and self.zeroconf_enable_tag:
self.listener.set_server(server_pos, key, value) | python | def set_server(self, server_pos, key, value):
"""Set the key to the value for the server_pos (position in the list)."""
if zeroconf_tag and self.zeroconf_enable_tag:
self.listener.set_server(server_pos, key, value) | [
"def",
"set_server",
"(",
"self",
",",
"server_pos",
",",
"key",
",",
"value",
")",
":",
"if",
"zeroconf_tag",
"and",
"self",
".",
"zeroconf_enable_tag",
":",
"self",
".",
"listener",
".",
"set_server",
"(",
"server_pos",
",",
"key",
",",
"value",
")"
] | Set the key to the value for the server_pos (position in the list). | [
"Set",
"the",
"key",
"to",
"the",
"value",
"for",
"the",
"server_pos",
"(",
"position",
"in",
"the",
"list",
")",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/autodiscover.py#L175-L178 | train | Set the key to the value for the server_pos. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/autodiscover.py | GlancesAutoDiscoverClient.find_active_ip_address | def find_active_ip_address():
"""Try to find the active IP addresses."""
import netifaces
# Interface of the default gateway
gateway_itf = netifaces.gateways()['default'][netifaces.AF_INET][1]
# IP address for the interface
return netifaces.ifaddresses(gateway_itf)[netifa... | python | def find_active_ip_address():
"""Try to find the active IP addresses."""
import netifaces
# Interface of the default gateway
gateway_itf = netifaces.gateways()['default'][netifaces.AF_INET][1]
# IP address for the interface
return netifaces.ifaddresses(gateway_itf)[netifa... | [
"def",
"find_active_ip_address",
"(",
")",
":",
"import",
"netifaces",
"# Interface of the default gateway",
"gateway_itf",
"=",
"netifaces",
".",
"gateways",
"(",
")",
"[",
"'default'",
"]",
"[",
"netifaces",
".",
"AF_INET",
"]",
"[",
"1",
"]",
"# IP address for ... | Try to find the active IP addresses. | [
"Try",
"to",
"find",
"the",
"active",
"IP",
"addresses",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/autodiscover.py#L226-L232 | train | Try to find the active IP addresses. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/outputs/glances_bottle.py | compress | def compress(func):
"""Compress result with deflate algorithm if the client ask for it."""
def wrapper(*args, **kwargs):
"""Wrapper that take one function and return the compressed result."""
ret = func(*args, **kwargs)
logger.debug('Receive {} {} request with header: {}'.format(
... | python | def compress(func):
"""Compress result with deflate algorithm if the client ask for it."""
def wrapper(*args, **kwargs):
"""Wrapper that take one function and return the compressed result."""
ret = func(*args, **kwargs)
logger.debug('Receive {} {} request with header: {}'.format(
... | [
"def",
"compress",
"(",
"func",
")",
":",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"\"\"\"Wrapper that take one function and return the compressed result.\"\"\"",
"ret",
"=",
"func",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",... | Compress result with deflate algorithm if the client ask for it. | [
"Compress",
"result",
"with",
"deflate",
"algorithm",
"if",
"the",
"client",
"ask",
"for",
"it",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/outputs/glances_bottle.py#L41-L70 | train | Compress a function and return the compressed result. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/outputs/glances_bottle.py | GlancesBottle.load_config | def load_config(self, config):
"""Load the outputs section of the configuration file."""
# Limit the number of processes to display in the WebUI
if config is not None and config.has_section('outputs'):
logger.debug('Read number of processes to display in the WebUI')
n = c... | python | def load_config(self, config):
"""Load the outputs section of the configuration file."""
# Limit the number of processes to display in the WebUI
if config is not None and config.has_section('outputs'):
logger.debug('Read number of processes to display in the WebUI')
n = c... | [
"def",
"load_config",
"(",
"self",
",",
"config",
")",
":",
"# Limit the number of processes to display in the WebUI",
"if",
"config",
"is",
"not",
"None",
"and",
"config",
".",
"has_section",
"(",
"'outputs'",
")",
":",
"logger",
".",
"debug",
"(",
"'Read number ... | Load the outputs section of the configuration file. | [
"Load",
"the",
"outputs",
"section",
"of",
"the",
"configuration",
"file",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/outputs/glances_bottle.py#L117-L123 | train | Load the outputs section of the configuration file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/outputs/glances_bottle.py | GlancesBottle.check_auth | def check_auth(self, username, password):
"""Check if a username/password combination is valid."""
if username == self.args.username:
from glances.password import GlancesPassword
pwd = GlancesPassword()
return pwd.check_password(self.args.password, pwd.sha256_hash(pas... | python | def check_auth(self, username, password):
"""Check if a username/password combination is valid."""
if username == self.args.username:
from glances.password import GlancesPassword
pwd = GlancesPassword()
return pwd.check_password(self.args.password, pwd.sha256_hash(pas... | [
"def",
"check_auth",
"(",
"self",
",",
"username",
",",
"password",
")",
":",
"if",
"username",
"==",
"self",
".",
"args",
".",
"username",
":",
"from",
"glances",
".",
"password",
"import",
"GlancesPassword",
"pwd",
"=",
"GlancesPassword",
"(",
")",
"retu... | Check if a username/password combination is valid. | [
"Check",
"if",
"a",
"username",
"/",
"password",
"combination",
"is",
"valid",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/outputs/glances_bottle.py#L134-L141 | train | Check if a username and password combination is valid. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/outputs/glances_bottle.py | GlancesBottle._route | def _route(self):
"""Define route."""
# REST API
self._app.route('/api/%s/config' % self.API_VERSION, method="GET",
callback=self._api_config)
self._app.route('/api/%s/config/<item>' % self.API_VERSION, method="GET",
callback=self._api_conf... | python | def _route(self):
"""Define route."""
# REST API
self._app.route('/api/%s/config' % self.API_VERSION, method="GET",
callback=self._api_config)
self._app.route('/api/%s/config/<item>' % self.API_VERSION, method="GET",
callback=self._api_conf... | [
"def",
"_route",
"(",
"self",
")",
":",
"# REST API",
"self",
".",
"_app",
".",
"route",
"(",
"'/api/%s/config'",
"%",
"self",
".",
"API_VERSION",
",",
"method",
"=",
"\"GET\"",
",",
"callback",
"=",
"self",
".",
"_api_config",
")",
"self",
".",
"_app",
... | Define route. | [
"Define",
"route",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/outputs/glances_bottle.py#L143-L196 | train | Define route. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/outputs/glances_bottle.py | GlancesBottle.start | def start(self, stats):
"""Start the bottle."""
# Init stats
self.stats = stats
# Init plugin list
self.plugins_list = self.stats.getPluginsList()
# Bind the Bottle TCP address/port
if self.args.open_web_browser:
# Implementation of the issue #946
... | python | def start(self, stats):
"""Start the bottle."""
# Init stats
self.stats = stats
# Init plugin list
self.plugins_list = self.stats.getPluginsList()
# Bind the Bottle TCP address/port
if self.args.open_web_browser:
# Implementation of the issue #946
... | [
"def",
"start",
"(",
"self",
",",
"stats",
")",
":",
"# Init stats",
"self",
".",
"stats",
"=",
"stats",
"# Init plugin list",
"self",
".",
"plugins_list",
"=",
"self",
".",
"stats",
".",
"getPluginsList",
"(",
")",
"# Bind the Bottle TCP address/port",
"if",
... | Start the bottle. | [
"Start",
"the",
"bottle",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/outputs/glances_bottle.py#L198-L218 | train | Start the bottle. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/outputs/glances_bottle.py | GlancesBottle._index | def _index(self, refresh_time=None):
"""Bottle callback for index.html (/) file."""
if refresh_time is None or refresh_time < 1:
refresh_time = self.args.time
# Update the stat
self.__update__()
# Display
return template("index.html", refresh_time=refresh_t... | python | def _index(self, refresh_time=None):
"""Bottle callback for index.html (/) file."""
if refresh_time is None or refresh_time < 1:
refresh_time = self.args.time
# Update the stat
self.__update__()
# Display
return template("index.html", refresh_time=refresh_t... | [
"def",
"_index",
"(",
"self",
",",
"refresh_time",
"=",
"None",
")",
":",
"if",
"refresh_time",
"is",
"None",
"or",
"refresh_time",
"<",
"1",
":",
"refresh_time",
"=",
"self",
".",
"args",
".",
"time",
"# Update the stat",
"self",
".",
"__update__",
"(",
... | Bottle callback for index.html (/) file. | [
"Bottle",
"callback",
"for",
"index",
".",
"html",
"(",
"/",
")",
"file",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/outputs/glances_bottle.py#L224-L234 | train | Bottle callback for index. html ( / ) file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/outputs/glances_bottle.py | GlancesBottle._api_help | def _api_help(self):
"""Glances API RESTful implementation.
Return the help data or 404 error.
"""
response.content_type = 'application/json; charset=utf-8'
# Update the stat
view_data = self.stats.get_plugin("help").get_view_data()
try:
plist = json... | python | def _api_help(self):
"""Glances API RESTful implementation.
Return the help data or 404 error.
"""
response.content_type = 'application/json; charset=utf-8'
# Update the stat
view_data = self.stats.get_plugin("help").get_view_data()
try:
plist = json... | [
"def",
"_api_help",
"(",
"self",
")",
":",
"response",
".",
"content_type",
"=",
"'application/json; charset=utf-8'",
"# Update the stat",
"view_data",
"=",
"self",
".",
"stats",
".",
"get_plugin",
"(",
"\"help\"",
")",
".",
"get_view_data",
"(",
")",
"try",
":"... | Glances API RESTful implementation.
Return the help data or 404 error. | [
"Glances",
"API",
"RESTful",
"implementation",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/outputs/glances_bottle.py#L242-L255 | train | Glances API RESTful implementation. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/outputs/glances_bottle.py | GlancesBottle._api_plugins | def _api_plugins(self):
"""Glances API RESTFul implementation.
@api {get} /api/%s/pluginslist Get plugins list
@apiVersion 2.0
@apiName pluginslist
@apiGroup plugin
@apiSuccess {String[]} Plugins list.
@apiSuccessExample Success-Response:
HTTP/1.1 2... | python | def _api_plugins(self):
"""Glances API RESTFul implementation.
@api {get} /api/%s/pluginslist Get plugins list
@apiVersion 2.0
@apiName pluginslist
@apiGroup plugin
@apiSuccess {String[]} Plugins list.
@apiSuccessExample Success-Response:
HTTP/1.1 2... | [
"def",
"_api_plugins",
"(",
"self",
")",
":",
"response",
".",
"content_type",
"=",
"'application/json; charset=utf-8'",
"# Update the stat",
"self",
".",
"__update__",
"(",
")",
"try",
":",
"plist",
"=",
"json",
".",
"dumps",
"(",
"self",
".",
"plugins_list",
... | Glances API RESTFul implementation.
@api {get} /api/%s/pluginslist Get plugins list
@apiVersion 2.0
@apiName pluginslist
@apiGroup plugin
@apiSuccess {String[]} Plugins list.
@apiSuccessExample Success-Response:
HTTP/1.1 200 OK
[
... | [
"Glances",
"API",
"RESTFul",
"implementation",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/outputs/glances_bottle.py#L258-L293 | train | Glances API RESTFul implementation. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/outputs/glances_bottle.py | GlancesBottle._api_all | def _api_all(self):
"""Glances API RESTful implementation.
Return the JSON representation of all the plugins
HTTP/200 if OK
HTTP/400 if plugin is not found
HTTP/404 if others error
"""
response.content_type = 'application/json; charset=utf-8'
if self.arg... | python | def _api_all(self):
"""Glances API RESTful implementation.
Return the JSON representation of all the plugins
HTTP/200 if OK
HTTP/400 if plugin is not found
HTTP/404 if others error
"""
response.content_type = 'application/json; charset=utf-8'
if self.arg... | [
"def",
"_api_all",
"(",
"self",
")",
":",
"response",
".",
"content_type",
"=",
"'application/json; charset=utf-8'",
"if",
"self",
".",
"args",
".",
"debug",
":",
"fname",
"=",
"os",
".",
"path",
".",
"join",
"(",
"tempfile",
".",
"gettempdir",
"(",
")",
... | Glances API RESTful implementation.
Return the JSON representation of all the plugins
HTTP/200 if OK
HTTP/400 if plugin is not found
HTTP/404 if others error | [
"Glances",
"API",
"RESTful",
"implementation",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/outputs/glances_bottle.py#L296-L323 | train | Glances API RESTful implementation. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/outputs/glances_bottle.py | GlancesBottle._api_all_limits | def _api_all_limits(self):
"""Glances API RESTful implementation.
Return the JSON representation of all the plugins limits
HTTP/200 if OK
HTTP/400 if plugin is not found
HTTP/404 if others error
"""
response.content_type = 'application/json; charset=utf-8'
... | python | def _api_all_limits(self):
"""Glances API RESTful implementation.
Return the JSON representation of all the plugins limits
HTTP/200 if OK
HTTP/400 if plugin is not found
HTTP/404 if others error
"""
response.content_type = 'application/json; charset=utf-8'
... | [
"def",
"_api_all_limits",
"(",
"self",
")",
":",
"response",
".",
"content_type",
"=",
"'application/json; charset=utf-8'",
"try",
":",
"# Get the JSON value of the stat limits",
"limits",
"=",
"json",
".",
"dumps",
"(",
"self",
".",
"stats",
".",
"getAllLimitsAsDict"... | Glances API RESTful implementation.
Return the JSON representation of all the plugins limits
HTTP/200 if OK
HTTP/400 if plugin is not found
HTTP/404 if others error | [
"Glances",
"API",
"RESTful",
"implementation",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/outputs/glances_bottle.py#L326-L341 | train | Glances API RESTful implementation. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/outputs/glances_bottle.py | GlancesBottle._api_all_views | def _api_all_views(self):
"""Glances API RESTful implementation.
Return the JSON representation of all the plugins views
HTTP/200 if OK
HTTP/400 if plugin is not found
HTTP/404 if others error
"""
response.content_type = 'application/json; charset=utf-8'
... | python | def _api_all_views(self):
"""Glances API RESTful implementation.
Return the JSON representation of all the plugins views
HTTP/200 if OK
HTTP/400 if plugin is not found
HTTP/404 if others error
"""
response.content_type = 'application/json; charset=utf-8'
... | [
"def",
"_api_all_views",
"(",
"self",
")",
":",
"response",
".",
"content_type",
"=",
"'application/json; charset=utf-8'",
"try",
":",
"# Get the JSON value of the stat view",
"limits",
"=",
"json",
".",
"dumps",
"(",
"self",
".",
"stats",
".",
"getAllViewsAsDict",
... | Glances API RESTful implementation.
Return the JSON representation of all the plugins views
HTTP/200 if OK
HTTP/400 if plugin is not found
HTTP/404 if others error | [
"Glances",
"API",
"RESTful",
"implementation",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/outputs/glances_bottle.py#L344-L359 | train | Glances API RESTful implementation. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/outputs/glances_bottle.py | GlancesBottle._api | def _api(self, plugin):
"""Glances API RESTful implementation.
Return the JSON representation of a given plugin
HTTP/200 if OK
HTTP/400 if plugin is not found
HTTP/404 if others error
"""
response.content_type = 'application/json; charset=utf-8'
if plugi... | python | def _api(self, plugin):
"""Glances API RESTful implementation.
Return the JSON representation of a given plugin
HTTP/200 if OK
HTTP/400 if plugin is not found
HTTP/404 if others error
"""
response.content_type = 'application/json; charset=utf-8'
if plugi... | [
"def",
"_api",
"(",
"self",
",",
"plugin",
")",
":",
"response",
".",
"content_type",
"=",
"'application/json; charset=utf-8'",
"if",
"plugin",
"not",
"in",
"self",
".",
"plugins_list",
":",
"abort",
"(",
"400",
",",
"\"Unknown plugin %s (available plugins: %s)\"",
... | Glances API RESTful implementation.
Return the JSON representation of a given plugin
HTTP/200 if OK
HTTP/400 if plugin is not found
HTTP/404 if others error | [
"Glances",
"API",
"RESTful",
"implementation",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/outputs/glances_bottle.py#L362-L383 | train | Glances API RESTful implementation. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/outputs/glances_bottle.py | GlancesBottle._api_history | def _api_history(self, plugin, nb=0):
"""Glances API RESTful implementation.
Return the JSON representation of a given plugin history
Limit to the last nb items (all if nb=0)
HTTP/200 if OK
HTTP/400 if plugin is not found
HTTP/404 if others error
"""
resp... | python | def _api_history(self, plugin, nb=0):
"""Glances API RESTful implementation.
Return the JSON representation of a given plugin history
Limit to the last nb items (all if nb=0)
HTTP/200 if OK
HTTP/400 if plugin is not found
HTTP/404 if others error
"""
resp... | [
"def",
"_api_history",
"(",
"self",
",",
"plugin",
",",
"nb",
"=",
"0",
")",
":",
"response",
".",
"content_type",
"=",
"'application/json; charset=utf-8'",
"if",
"plugin",
"not",
"in",
"self",
".",
"plugins_list",
":",
"abort",
"(",
"400",
",",
"\"Unknown p... | Glances API RESTful implementation.
Return the JSON representation of a given plugin history
Limit to the last nb items (all if nb=0)
HTTP/200 if OK
HTTP/400 if plugin is not found
HTTP/404 if others error | [
"Glances",
"API",
"RESTful",
"implementation",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/outputs/glances_bottle.py#L386-L408 | train | Glances API RESTful implementation. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/outputs/glances_bottle.py | GlancesBottle._api_limits | def _api_limits(self, plugin):
"""Glances API RESTful implementation.
Return the JSON limits of a given plugin
HTTP/200 if OK
HTTP/400 if plugin is not found
HTTP/404 if others error
"""
response.content_type = 'application/json; charset=utf-8'
if plugin... | python | def _api_limits(self, plugin):
"""Glances API RESTful implementation.
Return the JSON limits of a given plugin
HTTP/200 if OK
HTTP/400 if plugin is not found
HTTP/404 if others error
"""
response.content_type = 'application/json; charset=utf-8'
if plugin... | [
"def",
"_api_limits",
"(",
"self",
",",
"plugin",
")",
":",
"response",
".",
"content_type",
"=",
"'application/json; charset=utf-8'",
"if",
"plugin",
"not",
"in",
"self",
".",
"plugins_list",
":",
"abort",
"(",
"400",
",",
"\"Unknown plugin %s (available plugins: %... | Glances API RESTful implementation.
Return the JSON limits of a given plugin
HTTP/200 if OK
HTTP/400 if plugin is not found
HTTP/404 if others error | [
"Glances",
"API",
"RESTful",
"implementation",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/outputs/glances_bottle.py#L411-L432 | train | Glances API RESTful implementation. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/outputs/glances_bottle.py | GlancesBottle._api_views | def _api_views(self, plugin):
"""Glances API RESTful implementation.
Return the JSON views of a given plugin
HTTP/200 if OK
HTTP/400 if plugin is not found
HTTP/404 if others error
"""
response.content_type = 'application/json; charset=utf-8'
if plugin n... | python | def _api_views(self, plugin):
"""Glances API RESTful implementation.
Return the JSON views of a given plugin
HTTP/200 if OK
HTTP/400 if plugin is not found
HTTP/404 if others error
"""
response.content_type = 'application/json; charset=utf-8'
if plugin n... | [
"def",
"_api_views",
"(",
"self",
",",
"plugin",
")",
":",
"response",
".",
"content_type",
"=",
"'application/json; charset=utf-8'",
"if",
"plugin",
"not",
"in",
"self",
".",
"plugins_list",
":",
"abort",
"(",
"400",
",",
"\"Unknown plugin %s (available plugins: %s... | Glances API RESTful implementation.
Return the JSON views of a given plugin
HTTP/200 if OK
HTTP/400 if plugin is not found
HTTP/404 if others error | [
"Glances",
"API",
"RESTful",
"implementation",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/outputs/glances_bottle.py#L435-L456 | train | Glances API RESTful implementation. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/outputs/glances_bottle.py | GlancesBottle._api_itemvalue | def _api_itemvalue(self, plugin, item, value=None, history=False, nb=0):
"""Father method for _api_item and _api_value."""
response.content_type = 'application/json; charset=utf-8'
if plugin not in self.plugins_list:
abort(400, "Unknown plugin %s (available plugins: %s)" % (plugin, ... | python | def _api_itemvalue(self, plugin, item, value=None, history=False, nb=0):
"""Father method for _api_item and _api_value."""
response.content_type = 'application/json; charset=utf-8'
if plugin not in self.plugins_list:
abort(400, "Unknown plugin %s (available plugins: %s)" % (plugin, ... | [
"def",
"_api_itemvalue",
"(",
"self",
",",
"plugin",
",",
"item",
",",
"value",
"=",
"None",
",",
"history",
"=",
"False",
",",
"nb",
"=",
"0",
")",
":",
"response",
".",
"content_type",
"=",
"'application/json; charset=utf-8'",
"if",
"plugin",
"not",
"in"... | Father method for _api_item and _api_value. | [
"Father",
"method",
"for",
"_api_item",
"and",
"_api_value",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/outputs/glances_bottle.py#L459-L487 | train | Father method for _api_item and _api_value. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/outputs/glances_bottle.py | GlancesBottle._api_item_history | def _api_item_history(self, plugin, item, nb=0):
"""Glances API RESTful implementation.
Return the JSON representation of the couple plugin/history of item
HTTP/200 if OK
HTTP/400 if plugin is not found
HTTP/404 if others error
"""
return self._api_itemvalue(plu... | python | def _api_item_history(self, plugin, item, nb=0):
"""Glances API RESTful implementation.
Return the JSON representation of the couple plugin/history of item
HTTP/200 if OK
HTTP/400 if plugin is not found
HTTP/404 if others error
"""
return self._api_itemvalue(plu... | [
"def",
"_api_item_history",
"(",
"self",
",",
"plugin",
",",
"item",
",",
"nb",
"=",
"0",
")",
":",
"return",
"self",
".",
"_api_itemvalue",
"(",
"plugin",
",",
"item",
",",
"history",
"=",
"True",
",",
"nb",
"=",
"int",
"(",
"nb",
")",
")"
] | Glances API RESTful implementation.
Return the JSON representation of the couple plugin/history of item
HTTP/200 if OK
HTTP/400 if plugin is not found
HTTP/404 if others error | [
"Glances",
"API",
"RESTful",
"implementation",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/outputs/glances_bottle.py#L502-L511 | train | Glances API RESTful implementation. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/outputs/glances_bottle.py | GlancesBottle._api_value | def _api_value(self, plugin, item, value):
"""Glances API RESTful implementation.
Return the process stats (dict) for the given item=value
HTTP/200 if OK
HTTP/400 if plugin is not found
HTTP/404 if others error
"""
return self._api_itemvalue(plugin, item, value) | python | def _api_value(self, plugin, item, value):
"""Glances API RESTful implementation.
Return the process stats (dict) for the given item=value
HTTP/200 if OK
HTTP/400 if plugin is not found
HTTP/404 if others error
"""
return self._api_itemvalue(plugin, item, value) | [
"def",
"_api_value",
"(",
"self",
",",
"plugin",
",",
"item",
",",
"value",
")",
":",
"return",
"self",
".",
"_api_itemvalue",
"(",
"plugin",
",",
"item",
",",
"value",
")"
] | Glances API RESTful implementation.
Return the process stats (dict) for the given item=value
HTTP/200 if OK
HTTP/400 if plugin is not found
HTTP/404 if others error | [
"Glances",
"API",
"RESTful",
"implementation",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/outputs/glances_bottle.py#L514-L522 | train | Glances API RESTful implementation. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/outputs/glances_bottle.py | GlancesBottle._api_config | def _api_config(self):
"""Glances API RESTful implementation.
Return the JSON representation of the Glances configuration file
HTTP/200 if OK
HTTP/404 if others error
"""
response.content_type = 'application/json; charset=utf-8'
try:
# Get the JSON v... | python | def _api_config(self):
"""Glances API RESTful implementation.
Return the JSON representation of the Glances configuration file
HTTP/200 if OK
HTTP/404 if others error
"""
response.content_type = 'application/json; charset=utf-8'
try:
# Get the JSON v... | [
"def",
"_api_config",
"(",
"self",
")",
":",
"response",
".",
"content_type",
"=",
"'application/json; charset=utf-8'",
"try",
":",
"# Get the JSON value of the config' dict",
"args_json",
"=",
"json",
".",
"dumps",
"(",
"self",
".",
"config",
".",
"as_dict",
"(",
... | Glances API RESTful implementation.
Return the JSON representation of the Glances configuration file
HTTP/200 if OK
HTTP/404 if others error | [
"Glances",
"API",
"RESTful",
"implementation",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/outputs/glances_bottle.py#L525-L539 | train | Glances API RESTful implementation. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/outputs/glances_bottle.py | GlancesBottle._api_config_item | def _api_config_item(self, item):
"""Glances API RESTful implementation.
Return the JSON representation of the Glances configuration item
HTTP/200 if OK
HTTP/400 if item is not found
HTTP/404 if others error
"""
response.content_type = 'application/json; charset=... | python | def _api_config_item(self, item):
"""Glances API RESTful implementation.
Return the JSON representation of the Glances configuration item
HTTP/200 if OK
HTTP/400 if item is not found
HTTP/404 if others error
"""
response.content_type = 'application/json; charset=... | [
"def",
"_api_config_item",
"(",
"self",
",",
"item",
")",
":",
"response",
".",
"content_type",
"=",
"'application/json; charset=utf-8'",
"config_dict",
"=",
"self",
".",
"config",
".",
"as_dict",
"(",
")",
"if",
"item",
"not",
"in",
"config_dict",
":",
"abort... | Glances API RESTful implementation.
Return the JSON representation of the Glances configuration item
HTTP/200 if OK
HTTP/400 if item is not found
HTTP/404 if others error | [
"Glances",
"API",
"RESTful",
"implementation",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/outputs/glances_bottle.py#L542-L561 | train | Glances API RESTful implementation. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/outputs/glances_bottle.py | GlancesBottle._api_args | def _api_args(self):
"""Glances API RESTful implementation.
Return the JSON representation of the Glances command line arguments
HTTP/200 if OK
HTTP/404 if others error
"""
response.content_type = 'application/json; charset=utf-8'
try:
# Get the JSON... | python | def _api_args(self):
"""Glances API RESTful implementation.
Return the JSON representation of the Glances command line arguments
HTTP/200 if OK
HTTP/404 if others error
"""
response.content_type = 'application/json; charset=utf-8'
try:
# Get the JSON... | [
"def",
"_api_args",
"(",
"self",
")",
":",
"response",
".",
"content_type",
"=",
"'application/json; charset=utf-8'",
"try",
":",
"# Get the JSON value of the args' dict",
"# Use vars to convert namespace to dict",
"# Source: https://docs.python.org/%s/library/functions.html#vars",
"... | Glances API RESTful implementation.
Return the JSON representation of the Glances command line arguments
HTTP/200 if OK
HTTP/404 if others error | [
"Glances",
"API",
"RESTful",
"implementation",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/outputs/glances_bottle.py#L564-L580 | train | Returns the JSON representation of the Glances command line arguments | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/outputs/glances_bottle.py | GlancesBottle._api_args_item | def _api_args_item(self, item):
"""Glances API RESTful implementation.
Return the JSON representation of the Glances command line arguments item
HTTP/200 if OK
HTTP/400 if item is not found
HTTP/404 if others error
"""
response.content_type = 'application/json; c... | python | def _api_args_item(self, item):
"""Glances API RESTful implementation.
Return the JSON representation of the Glances command line arguments item
HTTP/200 if OK
HTTP/400 if item is not found
HTTP/404 if others error
"""
response.content_type = 'application/json; c... | [
"def",
"_api_args_item",
"(",
"self",
",",
"item",
")",
":",
"response",
".",
"content_type",
"=",
"'application/json; charset=utf-8'",
"if",
"item",
"not",
"in",
"self",
".",
"args",
":",
"abort",
"(",
"400",
",",
"\"Unknown argument item %s\"",
"%",
"item",
... | Glances API RESTful implementation.
Return the JSON representation of the Glances command line arguments item
HTTP/200 if OK
HTTP/400 if item is not found
HTTP/404 if others error | [
"Glances",
"API",
"RESTful",
"implementation",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/outputs/glances_bottle.py#L583-L603 | train | Glances API RESTful implementation. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_diskio.py | Plugin.update | def update(self):
"""Update disk I/O stats using the input method."""
# Init new stats
stats = self.get_init_value()
if self.input_method == 'local':
# Update stats using the standard system lib
# Grab the stat using the psutil disk_io_counters method
... | python | def update(self):
"""Update disk I/O stats using the input method."""
# Init new stats
stats = self.get_init_value()
if self.input_method == 'local':
# Update stats using the standard system lib
# Grab the stat using the psutil disk_io_counters method
... | [
"def",
"update",
"(",
"self",
")",
":",
"# Init new stats",
"stats",
"=",
"self",
".",
"get_init_value",
"(",
")",
"if",
"self",
".",
"input_method",
"==",
"'local'",
":",
"# Update stats using the standard system lib",
"# Grab the stat using the psutil disk_io_counters m... | Update disk I/O stats using the input method. | [
"Update",
"disk",
"I",
"/",
"O",
"stats",
"using",
"the",
"input",
"method",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_diskio.py#L60-L138 | train | Update the disk I/O stats using the input method. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_diskio.py | Plugin.msg_curse | def msg_curse(self, args=None, max_width=None):
"""Return the dict to display in the curse interface."""
# Init the return message
ret = []
# Only process if stats exist and display plugin enable...
if not self.stats or self.is_disable():
return ret
# Max si... | python | def msg_curse(self, args=None, max_width=None):
"""Return the dict to display in the curse interface."""
# Init the return message
ret = []
# Only process if stats exist and display plugin enable...
if not self.stats or self.is_disable():
return ret
# Max si... | [
"def",
"msg_curse",
"(",
"self",
",",
"args",
"=",
"None",
",",
"max_width",
"=",
"None",
")",
":",
"# Init the return message",
"ret",
"=",
"[",
"]",
"# Only process if stats exist and display plugin enable...",
"if",
"not",
"self",
".",
"stats",
"or",
"self",
... | Return the dict to display in the curse interface. | [
"Return",
"the",
"dict",
"to",
"display",
"in",
"the",
"curse",
"interface",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_diskio.py#L154-L227 | train | Return the dict to display in the curse interface. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/__init__.py | start | def start(config, args):
"""Start Glances."""
# Load mode
global mode
if core.is_standalone():
from glances.standalone import GlancesStandalone as GlancesMode
elif core.is_client():
if core.is_client_browser():
from glances.client_browser import GlancesClientBrowser as ... | python | def start(config, args):
"""Start Glances."""
# Load mode
global mode
if core.is_standalone():
from glances.standalone import GlancesStandalone as GlancesMode
elif core.is_client():
if core.is_client_browser():
from glances.client_browser import GlancesClientBrowser as ... | [
"def",
"start",
"(",
"config",
",",
"args",
")",
":",
"# Load mode",
"global",
"mode",
"if",
"core",
".",
"is_standalone",
"(",
")",
":",
"from",
"glances",
".",
"standalone",
"import",
"GlancesStandalone",
"as",
"GlancesMode",
"elif",
"core",
".",
"is_clien... | Start Glances. | [
"Start",
"Glances",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/__init__.py#L86-L112 | train | Start Glances. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/__init__.py | main | def main():
"""Main entry point for Glances.
Select the mode (standalone, client or server)
Run it...
"""
# Catch the CTRL-C signal
signal.signal(signal.SIGINT, __signal_handler)
# Log Glances and psutil version
logger.info('Start Glances {}'.format(__version__))
logger.info('{} {}... | python | def main():
"""Main entry point for Glances.
Select the mode (standalone, client or server)
Run it...
"""
# Catch the CTRL-C signal
signal.signal(signal.SIGINT, __signal_handler)
# Log Glances and psutil version
logger.info('Start Glances {}'.format(__version__))
logger.info('{} {}... | [
"def",
"main",
"(",
")",
":",
"# Catch the CTRL-C signal",
"signal",
".",
"signal",
"(",
"signal",
".",
"SIGINT",
",",
"__signal_handler",
")",
"# Log Glances and psutil version",
"logger",
".",
"info",
"(",
"'Start Glances {}'",
".",
"format",
"(",
"__version__",
... | Main entry point for Glances.
Select the mode (standalone, client or server)
Run it... | [
"Main",
"entry",
"point",
"for",
"Glances",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/__init__.py#L115-L140 | train | Entry point for Glances.
Runs it... | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/config.py | user_config_dir | def user_config_dir():
r"""Return the per-user config dir (full path).
- Linux, *BSD, SunOS: ~/.config/glances
- macOS: ~/Library/Application Support/glances
- Windows: %APPDATA%\glances
"""
if WINDOWS:
path = os.environ.get('APPDATA')
elif MACOS:
path = os.path.expanduser('... | python | def user_config_dir():
r"""Return the per-user config dir (full path).
- Linux, *BSD, SunOS: ~/.config/glances
- macOS: ~/Library/Application Support/glances
- Windows: %APPDATA%\glances
"""
if WINDOWS:
path = os.environ.get('APPDATA')
elif MACOS:
path = os.path.expanduser('... | [
"def",
"user_config_dir",
"(",
")",
":",
"if",
"WINDOWS",
":",
"path",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"'APPDATA'",
")",
"elif",
"MACOS",
":",
"path",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"'~/Library/Application Support'",
")",
"el... | r"""Return the per-user config dir (full path).
- Linux, *BSD, SunOS: ~/.config/glances
- macOS: ~/Library/Application Support/glances
- Windows: %APPDATA%\glances | [
"r",
"Return",
"the",
"per",
"-",
"user",
"config",
"dir",
"(",
"full",
"path",
")",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/config.py#L33-L51 | train | Return the path to the per - user config dir. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/config.py | user_cache_dir | def user_cache_dir():
r"""Return the per-user cache dir (full path).
- Linux, *BSD, SunOS: ~/.cache/glances
- macOS: ~/Library/Caches/glances
- Windows: {%LOCALAPPDATA%,%APPDATA%}\glances\cache
"""
if WINDOWS:
path = os.path.join(os.environ.get('LOCALAPPDATA') or os.environ.get('APPDATA... | python | def user_cache_dir():
r"""Return the per-user cache dir (full path).
- Linux, *BSD, SunOS: ~/.cache/glances
- macOS: ~/Library/Caches/glances
- Windows: {%LOCALAPPDATA%,%APPDATA%}\glances\cache
"""
if WINDOWS:
path = os.path.join(os.environ.get('LOCALAPPDATA') or os.environ.get('APPDATA... | [
"def",
"user_cache_dir",
"(",
")",
":",
"if",
"WINDOWS",
":",
"path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"environ",
".",
"get",
"(",
"'LOCALAPPDATA'",
")",
"or",
"os",
".",
"environ",
".",
"get",
"(",
"'APPDATA'",
")",
",",
"'glan... | r"""Return the per-user cache dir (full path).
- Linux, *BSD, SunOS: ~/.cache/glances
- macOS: ~/Library/Caches/glances
- Windows: {%LOCALAPPDATA%,%APPDATA%}\glances\cache | [
"r",
"Return",
"the",
"per",
"-",
"user",
"cache",
"dir",
"(",
"full",
"path",
")",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/config.py#L54-L70 | train | Return the path to the cache directory for the current user. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/config.py | system_config_dir | def system_config_dir():
r"""Return the system-wide config dir (full path).
- Linux, SunOS: /etc/glances
- *BSD, macOS: /usr/local/etc/glances
- Windows: %APPDATA%\glances
"""
if LINUX or SUNOS:
path = '/etc'
elif BSD or MACOS:
path = '/usr/local/etc'
else:
path ... | python | def system_config_dir():
r"""Return the system-wide config dir (full path).
- Linux, SunOS: /etc/glances
- *BSD, macOS: /usr/local/etc/glances
- Windows: %APPDATA%\glances
"""
if LINUX or SUNOS:
path = '/etc'
elif BSD or MACOS:
path = '/usr/local/etc'
else:
path ... | [
"def",
"system_config_dir",
"(",
")",
":",
"if",
"LINUX",
"or",
"SUNOS",
":",
"path",
"=",
"'/etc'",
"elif",
"BSD",
"or",
"MACOS",
":",
"path",
"=",
"'/usr/local/etc'",
"else",
":",
"path",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"'APPDATA'",
")",
... | r"""Return the system-wide config dir (full path).
- Linux, SunOS: /etc/glances
- *BSD, macOS: /usr/local/etc/glances
- Windows: %APPDATA%\glances | [
"r",
"Return",
"the",
"system",
"-",
"wide",
"config",
"dir",
"(",
"full",
"path",
")",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/config.py#L73-L91 | train | Return the system - wide config dir. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/config.py | Config.config_file_paths | def config_file_paths(self):
r"""Get a list of config file paths.
The list is built taking into account of the OS, priority and location.
* custom path: /path/to/glances
* Linux, SunOS: ~/.config/glances, /etc/glances
* *BSD: ~/.config/glances, /usr/local/etc/glances
* ... | python | def config_file_paths(self):
r"""Get a list of config file paths.
The list is built taking into account of the OS, priority and location.
* custom path: /path/to/glances
* Linux, SunOS: ~/.config/glances, /etc/glances
* *BSD: ~/.config/glances, /usr/local/etc/glances
* ... | [
"def",
"config_file_paths",
"(",
"self",
")",
":",
"paths",
"=",
"[",
"]",
"if",
"self",
".",
"config_dir",
":",
"paths",
".",
"append",
"(",
"self",
".",
"config_dir",
")",
"paths",
".",
"append",
"(",
"os",
".",
"path",
".",
"join",
"(",
"user_conf... | r"""Get a list of config file paths.
The list is built taking into account of the OS, priority and location.
* custom path: /path/to/glances
* Linux, SunOS: ~/.config/glances, /etc/glances
* *BSD: ~/.config/glances, /usr/local/etc/glances
* macOS: ~/Library/Application Support/... | [
"r",
"Get",
"a",
"list",
"of",
"config",
"file",
"paths",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/config.py#L113-L137 | train | r Get a list of config file paths. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/config.py | Config.read | def read(self):
"""Read the config file, if it exists. Using defaults otherwise."""
for config_file in self.config_file_paths():
logger.info('Search glances.conf file in {}'.format(config_file))
if os.path.exists(config_file):
try:
with open(co... | python | def read(self):
"""Read the config file, if it exists. Using defaults otherwise."""
for config_file in self.config_file_paths():
logger.info('Search glances.conf file in {}'.format(config_file))
if os.path.exists(config_file):
try:
with open(co... | [
"def",
"read",
"(",
"self",
")",
":",
"for",
"config_file",
"in",
"self",
".",
"config_file_paths",
"(",
")",
":",
"logger",
".",
"info",
"(",
"'Search glances.conf file in {}'",
".",
"format",
"(",
"config_file",
")",
")",
"if",
"os",
".",
"path",
".",
... | Read the config file, if it exists. Using defaults otherwise. | [
"Read",
"the",
"config",
"file",
"if",
"it",
"exists",
".",
"Using",
"defaults",
"otherwise",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/config.py#L139-L225 | train | Read the config file if it exists. Using defaults otherwise. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/config.py | Config.as_dict | def as_dict(self):
"""Return the configuration as a dict"""
dictionary = {}
for section in self.parser.sections():
dictionary[section] = {}
for option in self.parser.options(section):
dictionary[section][option] = self.parser.get(section, option)
r... | python | def as_dict(self):
"""Return the configuration as a dict"""
dictionary = {}
for section in self.parser.sections():
dictionary[section] = {}
for option in self.parser.options(section):
dictionary[section][option] = self.parser.get(section, option)
r... | [
"def",
"as_dict",
"(",
"self",
")",
":",
"dictionary",
"=",
"{",
"}",
"for",
"section",
"in",
"self",
".",
"parser",
".",
"sections",
"(",
")",
":",
"dictionary",
"[",
"section",
"]",
"=",
"{",
"}",
"for",
"option",
"in",
"self",
".",
"parser",
"."... | Return the configuration as a dict | [
"Return",
"the",
"configuration",
"as",
"a",
"dict"
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/config.py#L232-L239 | train | Return the configuration as a dict | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/config.py | Config.set_default_cwc | def set_default_cwc(self, section,
option_header=None,
cwc=['50', '70', '90']):
"""Set default values for careful, warning and critical."""
if option_header is None:
header = ''
else:
header = option_header + '_'
sel... | python | def set_default_cwc(self, section,
option_header=None,
cwc=['50', '70', '90']):
"""Set default values for careful, warning and critical."""
if option_header is None:
header = ''
else:
header = option_header + '_'
sel... | [
"def",
"set_default_cwc",
"(",
"self",
",",
"section",
",",
"option_header",
"=",
"None",
",",
"cwc",
"=",
"[",
"'50'",
",",
"'70'",
",",
"'90'",
"]",
")",
":",
"if",
"option_header",
"is",
"None",
":",
"header",
"=",
"''",
"else",
":",
"header",
"="... | Set default values for careful, warning and critical. | [
"Set",
"default",
"values",
"for",
"careful",
"warning",
"and",
"critical",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/config.py#L253-L263 | train | Set default values for careful warning and critical. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/config.py | Config.set_default | def set_default(self, section, option,
default):
"""If the option did not exist, create a default value."""
if not self.parser.has_option(section, option):
self.parser.set(section, option, default) | python | def set_default(self, section, option,
default):
"""If the option did not exist, create a default value."""
if not self.parser.has_option(section, option):
self.parser.set(section, option, default) | [
"def",
"set_default",
"(",
"self",
",",
"section",
",",
"option",
",",
"default",
")",
":",
"if",
"not",
"self",
".",
"parser",
".",
"has_option",
"(",
"section",
",",
"option",
")",
":",
"self",
".",
"parser",
".",
"set",
"(",
"section",
",",
"optio... | If the option did not exist, create a default value. | [
"If",
"the",
"option",
"did",
"not",
"exist",
"create",
"a",
"default",
"value",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/config.py#L265-L269 | train | Set the default value for the option. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/config.py | Config.get_value | def get_value(self, section, option,
default=None):
"""Get the value of an option, if it exists.
If it did not exist, then return the default value.
It allows user to define dynamic configuration key (see issue#1204)
Dynamic vlaue should starts and end with the ` char... | python | def get_value(self, section, option,
default=None):
"""Get the value of an option, if it exists.
If it did not exist, then return the default value.
It allows user to define dynamic configuration key (see issue#1204)
Dynamic vlaue should starts and end with the ` char... | [
"def",
"get_value",
"(",
"self",
",",
"section",
",",
"option",
",",
"default",
"=",
"None",
")",
":",
"ret",
"=",
"default",
"try",
":",
"ret",
"=",
"self",
".",
"parser",
".",
"get",
"(",
"section",
",",
"option",
")",
"except",
"NoOptionError",
":... | Get the value of an option, if it exists.
If it did not exist, then return the default value.
It allows user to define dynamic configuration key (see issue#1204)
Dynamic vlaue should starts and end with the ` char
Example: prefix=`hostname` | [
"Get",
"the",
"value",
"of",
"an",
"option",
"if",
"it",
"exists",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/config.py#L271-L295 | train | Get the value of an option in a section. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/config.py | Config.get_int_value | def get_int_value(self, section, option, default=0):
"""Get the int value of an option, if it exists."""
try:
return self.parser.getint(section, option)
except NoOptionError:
return int(default) | python | def get_int_value(self, section, option, default=0):
"""Get the int value of an option, if it exists."""
try:
return self.parser.getint(section, option)
except NoOptionError:
return int(default) | [
"def",
"get_int_value",
"(",
"self",
",",
"section",
",",
"option",
",",
"default",
"=",
"0",
")",
":",
"try",
":",
"return",
"self",
".",
"parser",
".",
"getint",
"(",
"section",
",",
"option",
")",
"except",
"NoOptionError",
":",
"return",
"int",
"("... | Get the int value of an option, if it exists. | [
"Get",
"the",
"int",
"value",
"of",
"an",
"option",
"if",
"it",
"exists",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/config.py#L297-L302 | train | Get the int value of an option. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/config.py | Config.get_float_value | def get_float_value(self, section, option, default=0.0):
"""Get the float value of an option, if it exists."""
try:
return self.parser.getfloat(section, option)
except NoOptionError:
return float(default) | python | def get_float_value(self, section, option, default=0.0):
"""Get the float value of an option, if it exists."""
try:
return self.parser.getfloat(section, option)
except NoOptionError:
return float(default) | [
"def",
"get_float_value",
"(",
"self",
",",
"section",
",",
"option",
",",
"default",
"=",
"0.0",
")",
":",
"try",
":",
"return",
"self",
".",
"parser",
".",
"getfloat",
"(",
"section",
",",
"option",
")",
"except",
"NoOptionError",
":",
"return",
"float... | Get the float value of an option, if it exists. | [
"Get",
"the",
"float",
"value",
"of",
"an",
"option",
"if",
"it",
"exists",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/config.py#L304-L309 | train | Get the float value of an option. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/config.py | Config.get_bool_value | def get_bool_value(self, section, option, default=True):
"""Get the bool value of an option, if it exists."""
try:
return self.parser.getboolean(section, option)
except NoOptionError:
return bool(default) | python | def get_bool_value(self, section, option, default=True):
"""Get the bool value of an option, if it exists."""
try:
return self.parser.getboolean(section, option)
except NoOptionError:
return bool(default) | [
"def",
"get_bool_value",
"(",
"self",
",",
"section",
",",
"option",
",",
"default",
"=",
"True",
")",
":",
"try",
":",
"return",
"self",
".",
"parser",
".",
"getboolean",
"(",
"section",
",",
"option",
")",
"except",
"NoOptionError",
":",
"return",
"boo... | Get the bool value of an option, if it exists. | [
"Get",
"the",
"bool",
"value",
"of",
"an",
"option",
"if",
"it",
"exists",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/config.py#L311-L316 | train | Get the bool value of an option. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/events.py | GlancesEvents.__event_exist | def __event_exist(self, event_type):
"""Return the event position, if it exists.
An event exist if:
* end is < 0
* event_type is matching
Return -1 if the item is not found.
"""
for i in range(self.len()):
if self.events_list[i][1] < 0 and self.events... | python | def __event_exist(self, event_type):
"""Return the event position, if it exists.
An event exist if:
* end is < 0
* event_type is matching
Return -1 if the item is not found.
"""
for i in range(self.len()):
if self.events_list[i][1] < 0 and self.events... | [
"def",
"__event_exist",
"(",
"self",
",",
"event_type",
")",
":",
"for",
"i",
"in",
"range",
"(",
"self",
".",
"len",
"(",
")",
")",
":",
"if",
"self",
".",
"events_list",
"[",
"i",
"]",
"[",
"1",
"]",
"<",
"0",
"and",
"self",
".",
"events_list",... | Return the event position, if it exists.
An event exist if:
* end is < 0
* event_type is matching
Return -1 if the item is not found. | [
"Return",
"the",
"event",
"position",
"if",
"it",
"exists",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/events.py#L65-L76 | train | Return the event position if it exists. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/events.py | GlancesEvents.get_event_sort_key | def get_event_sort_key(self, event_type):
"""Return the process sort key"""
# Process sort depending on alert type
if event_type.startswith("MEM"):
# Sort TOP process by memory_percent
ret = 'memory_percent'
elif event_type.startswith("CPU_IOWAIT"):
# ... | python | def get_event_sort_key(self, event_type):
"""Return the process sort key"""
# Process sort depending on alert type
if event_type.startswith("MEM"):
# Sort TOP process by memory_percent
ret = 'memory_percent'
elif event_type.startswith("CPU_IOWAIT"):
# ... | [
"def",
"get_event_sort_key",
"(",
"self",
",",
"event_type",
")",
":",
"# Process sort depending on alert type",
"if",
"event_type",
".",
"startswith",
"(",
"\"MEM\"",
")",
":",
"# Sort TOP process by memory_percent",
"ret",
"=",
"'memory_percent'",
"elif",
"event_type",
... | Return the process sort key | [
"Return",
"the",
"process",
"sort",
"key"
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/events.py#L78-L90 | train | Return the process sort key based on the event type | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/events.py | GlancesEvents.set_process_sort | def set_process_sort(self, event_type):
"""Define the process auto sort key from the alert type."""
if glances_processes.auto_sort:
glances_processes.sort_key = self.get_event_sort_key(event_type) | python | def set_process_sort(self, event_type):
"""Define the process auto sort key from the alert type."""
if glances_processes.auto_sort:
glances_processes.sort_key = self.get_event_sort_key(event_type) | [
"def",
"set_process_sort",
"(",
"self",
",",
"event_type",
")",
":",
"if",
"glances_processes",
".",
"auto_sort",
":",
"glances_processes",
".",
"sort_key",
"=",
"self",
".",
"get_event_sort_key",
"(",
"event_type",
")"
] | Define the process auto sort key from the alert type. | [
"Define",
"the",
"process",
"auto",
"sort",
"key",
"from",
"the",
"alert",
"type",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/events.py#L92-L95 | train | Define the process auto sort key from the alert type. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/events.py | GlancesEvents.add | def add(self, event_state, event_type, event_value,
proc_list=None, proc_desc="", peak_time=6):
"""Add a new item to the logs list.
If 'event' is a 'new one', add it at the beginning of the list.
If 'event' is not a 'new one', update the list .
If event < peak_time then the ... | python | def add(self, event_state, event_type, event_value,
proc_list=None, proc_desc="", peak_time=6):
"""Add a new item to the logs list.
If 'event' is a 'new one', add it at the beginning of the list.
If 'event' is not a 'new one', update the list .
If event < peak_time then the ... | [
"def",
"add",
"(",
"self",
",",
"event_state",
",",
"event_type",
",",
"event_value",
",",
"proc_list",
"=",
"None",
",",
"proc_desc",
"=",
"\"\"",
",",
"peak_time",
"=",
"6",
")",
":",
"proc_list",
"=",
"proc_list",
"or",
"glances_processes",
".",
"getlis... | Add a new item to the logs list.
If 'event' is a 'new one', add it at the beginning of the list.
If 'event' is not a 'new one', update the list .
If event < peak_time then the alert is not set. | [
"Add",
"a",
"new",
"item",
"to",
"the",
"logs",
"list",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/events.py#L102-L123 | train | Add a new entry to the logs list. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/events.py | GlancesEvents._create_event | def _create_event(self, event_state, event_type, event_value,
proc_list, proc_desc, peak_time):
"""Add a new item in the log list.
Item is added only if the criticity (event_state) is WARNING or CRITICAL.
"""
if event_state == "WARNING" or event_state == "CRITICAL"... | python | def _create_event(self, event_state, event_type, event_value,
proc_list, proc_desc, peak_time):
"""Add a new item in the log list.
Item is added only if the criticity (event_state) is WARNING or CRITICAL.
"""
if event_state == "WARNING" or event_state == "CRITICAL"... | [
"def",
"_create_event",
"(",
"self",
",",
"event_state",
",",
"event_type",
",",
"event_value",
",",
"proc_list",
",",
"proc_desc",
",",
"peak_time",
")",
":",
"if",
"event_state",
"==",
"\"WARNING\"",
"or",
"event_state",
"==",
"\"CRITICAL\"",
":",
"# Define th... | Add a new item in the log list.
Item is added only if the criticity (event_state) is WARNING or CRITICAL. | [
"Add",
"a",
"new",
"item",
"in",
"the",
"log",
"list",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/events.py#L125-L161 | train | Create a new event in the log list. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/events.py | GlancesEvents._update_event | def _update_event(self, event_index, event_state, event_type, event_value,
proc_list, proc_desc, peak_time):
"""Update an event in the list"""
if event_state == "OK" or event_state == "CAREFUL":
# Reset the automatic process sort key
self.reset_process_sort(... | python | def _update_event(self, event_index, event_state, event_type, event_value,
proc_list, proc_desc, peak_time):
"""Update an event in the list"""
if event_state == "OK" or event_state == "CAREFUL":
# Reset the automatic process sort key
self.reset_process_sort(... | [
"def",
"_update_event",
"(",
"self",
",",
"event_index",
",",
"event_state",
",",
"event_type",
",",
"event_value",
",",
"proc_list",
",",
"proc_desc",
",",
"peak_time",
")",
":",
"if",
"event_state",
"==",
"\"OK\"",
"or",
"event_state",
"==",
"\"CAREFUL\"",
"... | Update an event in the list | [
"Update",
"an",
"event",
"in",
"the",
"list"
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/events.py#L163-L208 | train | Update an event in the list | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/events.py | GlancesEvents.clean | def clean(self, critical=False):
"""Clean the logs list by deleting finished items.
By default, only delete WARNING message.
If critical = True, also delete CRITICAL message.
"""
# Create a new clean list
clean_events_list = []
while self.len() > 0:
i... | python | def clean(self, critical=False):
"""Clean the logs list by deleting finished items.
By default, only delete WARNING message.
If critical = True, also delete CRITICAL message.
"""
# Create a new clean list
clean_events_list = []
while self.len() > 0:
i... | [
"def",
"clean",
"(",
"self",
",",
"critical",
"=",
"False",
")",
":",
"# Create a new clean list",
"clean_events_list",
"=",
"[",
"]",
"while",
"self",
".",
"len",
"(",
")",
">",
"0",
":",
"item",
"=",
"self",
".",
"events_list",
".",
"pop",
"(",
")",
... | Clean the logs list by deleting finished items.
By default, only delete WARNING message.
If critical = True, also delete CRITICAL message. | [
"Clean",
"the",
"logs",
"list",
"by",
"deleting",
"finished",
"items",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/events.py#L210-L224 | train | Clean the logs list by deleting finished items. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/stats_client_snmp.py | GlancesStatsClientSNMP.check_snmp | def check_snmp(self):
"""Chek if SNMP is available on the server."""
# Import the SNMP client class
from glances.snmp import GlancesSNMPClient
# Create an instance of the SNMP client
clientsnmp = GlancesSNMPClient(host=self.args.client,
por... | python | def check_snmp(self):
"""Chek if SNMP is available on the server."""
# Import the SNMP client class
from glances.snmp import GlancesSNMPClient
# Create an instance of the SNMP client
clientsnmp = GlancesSNMPClient(host=self.args.client,
por... | [
"def",
"check_snmp",
"(",
"self",
")",
":",
"# Import the SNMP client class",
"from",
"glances",
".",
"snmp",
"import",
"GlancesSNMPClient",
"# Create an instance of the SNMP client",
"clientsnmp",
"=",
"GlancesSNMPClient",
"(",
"host",
"=",
"self",
".",
"args",
".",
... | Chek if SNMP is available on the server. | [
"Chek",
"if",
"SNMP",
"is",
"available",
"on",
"the",
"server",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/stats_client_snmp.py#L57-L82 | train | Check if SNMP is available on the server. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/stats_client_snmp.py | GlancesStatsClientSNMP.get_system_name | def get_system_name(self, oid_system_name):
"""Get the short os name from the OS name OID string."""
short_system_name = None
if oid_system_name == '':
return short_system_name
# Find the short name in the oid_to_short_os_name dict
for r, v in iteritems(oid_to_short... | python | def get_system_name(self, oid_system_name):
"""Get the short os name from the OS name OID string."""
short_system_name = None
if oid_system_name == '':
return short_system_name
# Find the short name in the oid_to_short_os_name dict
for r, v in iteritems(oid_to_short... | [
"def",
"get_system_name",
"(",
"self",
",",
"oid_system_name",
")",
":",
"short_system_name",
"=",
"None",
"if",
"oid_system_name",
"==",
"''",
":",
"return",
"short_system_name",
"# Find the short name in the oid_to_short_os_name dict",
"for",
"r",
",",
"v",
"in",
"i... | Get the short os name from the OS name OID string. | [
"Get",
"the",
"short",
"os",
"name",
"from",
"the",
"OS",
"name",
"OID",
"string",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/stats_client_snmp.py#L84-L97 | train | Get the short os name from the OS name OID string. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/stats_client_snmp.py | GlancesStatsClientSNMP.update | def update(self):
"""Update the stats using SNMP."""
# For each plugins, call the update method
for p in self._plugins:
if self._plugins[p].is_disable():
# If current plugin is disable
# then continue to next plugin
continue
... | python | def update(self):
"""Update the stats using SNMP."""
# For each plugins, call the update method
for p in self._plugins:
if self._plugins[p].is_disable():
# If current plugin is disable
# then continue to next plugin
continue
... | [
"def",
"update",
"(",
"self",
")",
":",
"# For each plugins, call the update method",
"for",
"p",
"in",
"self",
".",
"_plugins",
":",
"if",
"self",
".",
"_plugins",
"[",
"p",
"]",
".",
"is_disable",
"(",
")",
":",
"# If current plugin is disable",
"# then contin... | Update the stats using SNMP. | [
"Update",
"the",
"stats",
"using",
"SNMP",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/stats_client_snmp.py#L99-L121 | train | Update the stats using SNMP. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_raid.py | Plugin.update | def update(self):
"""Update RAID stats using the input method."""
# Init new stats
stats = self.get_init_value()
if import_error_tag:
return self.stats
if self.input_method == 'local':
# Update stats using the PyMDstat lib (https://github.com/nicolargo/p... | python | def update(self):
"""Update RAID stats using the input method."""
# Init new stats
stats = self.get_init_value()
if import_error_tag:
return self.stats
if self.input_method == 'local':
# Update stats using the PyMDstat lib (https://github.com/nicolargo/p... | [
"def",
"update",
"(",
"self",
")",
":",
"# Init new stats",
"stats",
"=",
"self",
".",
"get_init_value",
"(",
")",
"if",
"import_error_tag",
":",
"return",
"self",
".",
"stats",
"if",
"self",
".",
"input_method",
"==",
"'local'",
":",
"# Update stats using the... | Update RAID stats using the input method. | [
"Update",
"RAID",
"stats",
"using",
"the",
"input",
"method",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_raid.py#L51-L78 | train | Update the stats of the RAID with the current values. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_raid.py | Plugin.msg_curse | def msg_curse(self, args=None, max_width=None):
"""Return the dict to display in the curse interface."""
# Init the return message
ret = []
# Only process if stats exist...
if not self.stats:
return ret
# Max size for the interface name
name_max_widt... | python | def msg_curse(self, args=None, max_width=None):
"""Return the dict to display in the curse interface."""
# Init the return message
ret = []
# Only process if stats exist...
if not self.stats:
return ret
# Max size for the interface name
name_max_widt... | [
"def",
"msg_curse",
"(",
"self",
",",
"args",
"=",
"None",
",",
"max_width",
"=",
"None",
")",
":",
"# Init the return message",
"ret",
"=",
"[",
"]",
"# Only process if stats exist...",
"if",
"not",
"self",
".",
"stats",
":",
"return",
"ret",
"# Max size for ... | Return the dict to display in the curse interface. | [
"Return",
"the",
"dict",
"to",
"display",
"in",
"the",
"curse",
"interface",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_raid.py#L80-L152 | train | Return the dict to display in the curse interface. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_raid.py | Plugin.raid_alert | def raid_alert(self, status, used, available, type):
"""RAID alert messages.
[available/used] means that ideally the array may have _available_
devices however, _used_ devices are in use.
Obviously when used >= available then things are good.
"""
if type == 'raid0':
... | python | def raid_alert(self, status, used, available, type):
"""RAID alert messages.
[available/used] means that ideally the array may have _available_
devices however, _used_ devices are in use.
Obviously when used >= available then things are good.
"""
if type == 'raid0':
... | [
"def",
"raid_alert",
"(",
"self",
",",
"status",
",",
"used",
",",
"available",
",",
"type",
")",
":",
"if",
"type",
"==",
"'raid0'",
":",
"return",
"'OK'",
"if",
"status",
"==",
"'inactive'",
":",
"return",
"'CRITICAL'",
"if",
"used",
"is",
"None",
"o... | RAID alert messages.
[available/used] means that ideally the array may have _available_
devices however, _used_ devices are in use.
Obviously when used >= available then things are good. | [
"RAID",
"alert",
"messages",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_raid.py#L154-L169 | train | RAID alert messages. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_uptime.py | Plugin.update | def update(self):
"""Update uptime stat using the input method."""
# Init new stats
stats = self.get_init_value()
if self.input_method == 'local':
# Update stats using the standard system lib
self.uptime = datetime.now() - datetime.fromtimestamp(psutil.boot_time(... | python | def update(self):
"""Update uptime stat using the input method."""
# Init new stats
stats = self.get_init_value()
if self.input_method == 'local':
# Update stats using the standard system lib
self.uptime = datetime.now() - datetime.fromtimestamp(psutil.boot_time(... | [
"def",
"update",
"(",
"self",
")",
":",
"# Init new stats",
"stats",
"=",
"self",
".",
"get_init_value",
"(",
")",
"if",
"self",
".",
"input_method",
"==",
"'local'",
":",
"# Update stats using the standard system lib",
"self",
".",
"uptime",
"=",
"datetime",
".... | Update uptime stat using the input method. | [
"Update",
"uptime",
"stat",
"using",
"the",
"input",
"method",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_uptime.py#L62-L85 | train | Update uptime stat using the input method. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_cloud.py | Plugin.update | def update(self):
"""Update the cloud stats.
Return the stats (dict)
"""
# Init new stats
stats = self.get_init_value()
# Requests lib is needed to get stats from the Cloud API
if import_error_tag:
return stats
# Update the stats
if ... | python | def update(self):
"""Update the cloud stats.
Return the stats (dict)
"""
# Init new stats
stats = self.get_init_value()
# Requests lib is needed to get stats from the Cloud API
if import_error_tag:
return stats
# Update the stats
if ... | [
"def",
"update",
"(",
"self",
")",
":",
"# Init new stats",
"stats",
"=",
"self",
".",
"get_init_value",
"(",
")",
"# Requests lib is needed to get stats from the Cloud API",
"if",
"import_error_tag",
":",
"return",
"stats",
"# Update the stats",
"if",
"self",
".",
"i... | Update the cloud stats.
Return the stats (dict) | [
"Update",
"the",
"cloud",
"stats",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_cloud.py#L78-L103 | train | Update the cloud stats.
Return the stats dict | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_cloud.py | Plugin.msg_curse | def msg_curse(self, args=None, max_width=None):
"""Return the string to display in the curse interface."""
# Init the return message
ret = []
if not self.stats or self.stats == {} or self.is_disable():
return ret
# Generate the output
if 'instance-type' in s... | python | def msg_curse(self, args=None, max_width=None):
"""Return the string to display in the curse interface."""
# Init the return message
ret = []
if not self.stats or self.stats == {} or self.is_disable():
return ret
# Generate the output
if 'instance-type' in s... | [
"def",
"msg_curse",
"(",
"self",
",",
"args",
"=",
"None",
",",
"max_width",
"=",
"None",
")",
":",
"# Init the return message",
"ret",
"=",
"[",
"]",
"if",
"not",
"self",
".",
"stats",
"or",
"self",
".",
"stats",
"==",
"{",
"}",
"or",
"self",
".",
... | Return the string to display in the curse interface. | [
"Return",
"the",
"string",
"to",
"display",
"in",
"the",
"curse",
"interface",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_cloud.py#L105-L126 | train | Return the string to display in the curse interface. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_cloud.py | ThreadOpenStack.run | def run(self):
"""Grab plugin's stats.
Infinite loop, should be stopped by calling the stop() method
"""
if import_error_tag:
self.stop()
return False
for k, v in iteritems(self.OPENSTACK_API_METADATA):
r_url = '{}/{}'.format(self.OPENSTACK_A... | python | def run(self):
"""Grab plugin's stats.
Infinite loop, should be stopped by calling the stop() method
"""
if import_error_tag:
self.stop()
return False
for k, v in iteritems(self.OPENSTACK_API_METADATA):
r_url = '{}/{}'.format(self.OPENSTACK_A... | [
"def",
"run",
"(",
"self",
")",
":",
"if",
"import_error_tag",
":",
"self",
".",
"stop",
"(",
")",
"return",
"False",
"for",
"k",
",",
"v",
"in",
"iteritems",
"(",
"self",
".",
"OPENSTACK_API_METADATA",
")",
":",
"r_url",
"=",
"'{}/{}'",
".",
"format",... | Grab plugin's stats.
Infinite loop, should be stopped by calling the stop() method | [
"Grab",
"plugin",
"s",
"stats",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_cloud.py#L152-L173 | train | Grab plugin s stats.
Infinite loop | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_help.py | Plugin.generate_view_data | def generate_view_data(self):
"""Generate the views."""
self.view_data['version'] = '{} {}'.format('Glances', __version__)
self.view_data['psutil_version'] = ' with psutil {}'.format(psutil_version)
try:
self.view_data['configuration_file'] = 'Configuration file: {}'.format(... | python | def generate_view_data(self):
"""Generate the views."""
self.view_data['version'] = '{} {}'.format('Glances', __version__)
self.view_data['psutil_version'] = ' with psutil {}'.format(psutil_version)
try:
self.view_data['configuration_file'] = 'Configuration file: {}'.format(... | [
"def",
"generate_view_data",
"(",
"self",
")",
":",
"self",
".",
"view_data",
"[",
"'version'",
"]",
"=",
"'{} {}'",
".",
"format",
"(",
"'Glances'",
",",
"__version__",
")",
"self",
".",
"view_data",
"[",
"'psutil_version'",
"]",
"=",
"' with psutil {}'",
"... | Generate the views. | [
"Generate",
"the",
"views",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_help.py#L55-L103 | train | Generate the views data. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_help.py | Plugin.msg_curse | def msg_curse(self, args=None, max_width=None):
"""Return the list to display in the curse interface."""
# Init the return message
ret = []
# Build the string message
# Header
ret.append(self.curse_add_line(self.view_data['version'], 'TITLE'))
ret.append(self.cur... | python | def msg_curse(self, args=None, max_width=None):
"""Return the list to display in the curse interface."""
# Init the return message
ret = []
# Build the string message
# Header
ret.append(self.curse_add_line(self.view_data['version'], 'TITLE'))
ret.append(self.cur... | [
"def",
"msg_curse",
"(",
"self",
",",
"args",
"=",
"None",
",",
"max_width",
"=",
"None",
")",
":",
"# Init the return message",
"ret",
"=",
"[",
"]",
"# Build the string message",
"# Header",
"ret",
".",
"append",
"(",
"self",
".",
"curse_add_line",
"(",
"s... | Return the list to display in the curse interface. | [
"Return",
"the",
"list",
"to",
"display",
"in",
"the",
"curse",
"interface",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_help.py#L109-L189 | train | Return the list to display in the curse interface. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/attribute.py | GlancesAttribute.value | def value(self, new_value):
"""Set a value.
Value is a tuple: (<timestamp>, <new_value>)
"""
self._value = (datetime.now(), new_value)
self.history_add(self._value) | python | def value(self, new_value):
"""Set a value.
Value is a tuple: (<timestamp>, <new_value>)
"""
self._value = (datetime.now(), new_value)
self.history_add(self._value) | [
"def",
"value",
"(",
"self",
",",
"new_value",
")",
":",
"self",
".",
"_value",
"=",
"(",
"datetime",
".",
"now",
"(",
")",
",",
"new_value",
")",
"self",
".",
"history_add",
"(",
"self",
".",
"_value",
")"
] | Set a value.
Value is a tuple: (<timestamp>, <new_value>) | [
"Set",
"a",
"value",
".",
"Value",
"is",
"a",
"tuple",
":",
"(",
"<timestamp",
">",
"<new_value",
">",
")"
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/attribute.py#L80-L85 | train | Set a value. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/attribute.py | GlancesAttribute.history_add | def history_add(self, value):
"""Add a value in the history
"""
if self._history_max_size is None or self.history_len() < self._history_max_size:
self._history.append(value)
else:
self._history = self._history[1:] + [value] | python | def history_add(self, value):
"""Add a value in the history
"""
if self._history_max_size is None or self.history_len() < self._history_max_size:
self._history.append(value)
else:
self._history = self._history[1:] + [value] | [
"def",
"history_add",
"(",
"self",
",",
"value",
")",
":",
"if",
"self",
".",
"_history_max_size",
"is",
"None",
"or",
"self",
".",
"history_len",
"(",
")",
"<",
"self",
".",
"_history_max_size",
":",
"self",
".",
"_history",
".",
"append",
"(",
"value",... | Add a value in the history | [
"Add",
"a",
"value",
"in",
"the",
"history"
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/attribute.py#L105-L111 | train | Add a value to the history. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/attribute.py | GlancesAttribute.history_json | def history_json(self, nb=0):
"""Return the history in ISO JSON format"""
return [(i[0].isoformat(), i[1]) for i in self._history[-nb:]] | python | def history_json(self, nb=0):
"""Return the history in ISO JSON format"""
return [(i[0].isoformat(), i[1]) for i in self._history[-nb:]] | [
"def",
"history_json",
"(",
"self",
",",
"nb",
"=",
"0",
")",
":",
"return",
"[",
"(",
"i",
"[",
"0",
"]",
".",
"isoformat",
"(",
")",
",",
"i",
"[",
"1",
"]",
")",
"for",
"i",
"in",
"self",
".",
"_history",
"[",
"-",
"nb",
":",
"]",
"]"
] | Return the history in ISO JSON format | [
"Return",
"the",
"history",
"in",
"ISO",
"JSON",
"format"
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/attribute.py#L133-L135 | train | Return the history in ISO JSON format | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/attribute.py | GlancesAttribute.history_mean | def history_mean(self, nb=5):
"""Return the mean on the <nb> values in the history.
"""
_, v = zip(*self._history)
return sum(v[-nb:]) / float(v[-1] - v[-nb]) | python | def history_mean(self, nb=5):
"""Return the mean on the <nb> values in the history.
"""
_, v = zip(*self._history)
return sum(v[-nb:]) / float(v[-1] - v[-nb]) | [
"def",
"history_mean",
"(",
"self",
",",
"nb",
"=",
"5",
")",
":",
"_",
",",
"v",
"=",
"zip",
"(",
"*",
"self",
".",
"_history",
")",
"return",
"sum",
"(",
"v",
"[",
"-",
"nb",
":",
"]",
")",
"/",
"float",
"(",
"v",
"[",
"-",
"1",
"]",
"-... | Return the mean on the <nb> values in the history. | [
"Return",
"the",
"mean",
"on",
"the",
"<nb",
">",
"values",
"in",
"the",
"history",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/attribute.py#L137-L141 | train | Return the mean on the nb values in the history. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/amps_list.py | AmpsList.load_configs | def load_configs(self):
"""Load the AMP configuration files."""
if self.config is None:
return False
# Display a warning (deprecated) message if the monitor section exist
if "monitor" in self.config.sections():
logger.warning("A deprecated [monitor] section exist... | python | def load_configs(self):
"""Load the AMP configuration files."""
if self.config is None:
return False
# Display a warning (deprecated) message if the monitor section exist
if "monitor" in self.config.sections():
logger.warning("A deprecated [monitor] section exist... | [
"def",
"load_configs",
"(",
"self",
")",
":",
"if",
"self",
".",
"config",
"is",
"None",
":",
"return",
"False",
"# Display a warning (deprecated) message if the monitor section exist",
"if",
"\"monitor\"",
"in",
"self",
".",
"config",
".",
"sections",
"(",
")",
"... | Load the AMP configuration files. | [
"Load",
"the",
"AMP",
"configuration",
"files",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/amps_list.py#L54-L91 | train | Load the AMP configuration files. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/amps_list.py | AmpsList.update | def update(self):
"""Update the command result attributed."""
# Get the current processes list (once)
processlist = glances_processes.getlist()
# Iter upon the AMPs dict
for k, v in iteritems(self.get()):
if not v.enable():
# Do not update if the enab... | python | def update(self):
"""Update the command result attributed."""
# Get the current processes list (once)
processlist = glances_processes.getlist()
# Iter upon the AMPs dict
for k, v in iteritems(self.get()):
if not v.enable():
# Do not update if the enab... | [
"def",
"update",
"(",
"self",
")",
":",
"# Get the current processes list (once)",
"processlist",
"=",
"glances_processes",
".",
"getlist",
"(",
")",
"# Iter upon the AMPs dict",
"for",
"k",
",",
"v",
"in",
"iteritems",
"(",
"self",
".",
"get",
"(",
")",
")",
... | Update the command result attributed. | [
"Update",
"the",
"command",
"result",
"attributed",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/amps_list.py#L105-L133 | train | Update the command result attributed. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/amps_list.py | AmpsList._build_amps_list | def _build_amps_list(self, amp_value, processlist):
"""Return the AMPS process list according to the amp_value
Search application monitored processes by a regular expression
"""
ret = []
try:
# Search in both cmdline and name (for kernel thread, see #1261)
... | python | def _build_amps_list(self, amp_value, processlist):
"""Return the AMPS process list according to the amp_value
Search application monitored processes by a regular expression
"""
ret = []
try:
# Search in both cmdline and name (for kernel thread, see #1261)
... | [
"def",
"_build_amps_list",
"(",
"self",
",",
"amp_value",
",",
"processlist",
")",
":",
"ret",
"=",
"[",
"]",
"try",
":",
"# Search in both cmdline and name (for kernel thread, see #1261)",
"for",
"p",
"in",
"processlist",
":",
"add_it",
"=",
"False",
"if",
"(",
... | Return the AMPS process list according to the amp_value
Search application monitored processes by a regular expression | [
"Return",
"the",
"AMPS",
"process",
"list",
"according",
"to",
"the",
"amp_value"
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/amps_list.py#L135-L160 | train | Build the AMPS process list according to the amp_value | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/exports/glances_csv.py | Export.update | def update(self, stats):
"""Update stats in the CSV output file."""
# Get the stats
all_stats = stats.getAllExportsAsDict(plugin_list=self.plugins_to_export())
# Init data with timestamp (issue#708)
if self.first_line:
csv_header = ['timestamp']
csv_data = [t... | python | def update(self, stats):
"""Update stats in the CSV output file."""
# Get the stats
all_stats = stats.getAllExportsAsDict(plugin_list=self.plugins_to_export())
# Init data with timestamp (issue#708)
if self.first_line:
csv_header = ['timestamp']
csv_data = [t... | [
"def",
"update",
"(",
"self",
",",
"stats",
")",
":",
"# Get the stats",
"all_stats",
"=",
"stats",
".",
"getAllExportsAsDict",
"(",
"plugin_list",
"=",
"self",
".",
"plugins_to_export",
"(",
")",
")",
"# Init data with timestamp (issue#708)",
"if",
"self",
".",
... | Update stats in the CSV output file. | [
"Update",
"stats",
"in",
"the",
"CSV",
"output",
"file",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/exports/glances_csv.py#L64-L98 | train | Update the stats in the CSV output file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/cpu_percent.py | CpuPercent.__get_cpu | def __get_cpu(self):
"""Update and/or return the CPU using the psutil library."""
# Never update more than 1 time per cached_time
if self.timer_cpu.finished():
self.cpu_percent = psutil.cpu_percent(interval=0.0)
# Reset timer for cache
self.timer_cpu = Timer(s... | python | def __get_cpu(self):
"""Update and/or return the CPU using the psutil library."""
# Never update more than 1 time per cached_time
if self.timer_cpu.finished():
self.cpu_percent = psutil.cpu_percent(interval=0.0)
# Reset timer for cache
self.timer_cpu = Timer(s... | [
"def",
"__get_cpu",
"(",
"self",
")",
":",
"# Never update more than 1 time per cached_time",
"if",
"self",
".",
"timer_cpu",
".",
"finished",
"(",
")",
":",
"self",
".",
"cpu_percent",
"=",
"psutil",
".",
"cpu_percent",
"(",
"interval",
"=",
"0.0",
")",
"# Re... | Update and/or return the CPU using the psutil library. | [
"Update",
"and",
"/",
"or",
"return",
"the",
"CPU",
"using",
"the",
"psutil",
"library",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/cpu_percent.py#L53-L60 | train | Update and return the CPU using the psutil library. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/cpu_percent.py | CpuPercent.__get_percpu | def __get_percpu(self):
"""Update and/or return the per CPU list using the psutil library."""
# Never update more than 1 time per cached_time
if self.timer_percpu.finished():
self.percpu_percent = []
for cpu_number, cputimes in enumerate(psutil.cpu_times_percent(interval=... | python | def __get_percpu(self):
"""Update and/or return the per CPU list using the psutil library."""
# Never update more than 1 time per cached_time
if self.timer_percpu.finished():
self.percpu_percent = []
for cpu_number, cputimes in enumerate(psutil.cpu_times_percent(interval=... | [
"def",
"__get_percpu",
"(",
"self",
")",
":",
"# Never update more than 1 time per cached_time",
"if",
"self",
".",
"timer_percpu",
".",
"finished",
"(",
")",
":",
"self",
".",
"percpu_percent",
"=",
"[",
"]",
"for",
"cpu_number",
",",
"cputimes",
"in",
"enumera... | Update and/or return the per CPU list using the psutil library. | [
"Update",
"and",
"/",
"or",
"return",
"the",
"per",
"CPU",
"list",
"using",
"the",
"psutil",
"library",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/cpu_percent.py#L62-L93 | train | Update and return the per CPU list using the psutil library. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/standalone.py | GlancesStandalone.display_modules_list | def display_modules_list(self):
"""Display modules list"""
print("Plugins list: {}".format(
', '.join(sorted(self.stats.getPluginsList(enable=False)))))
print("Exporters list: {}".format(
', '.join(sorted(self.stats.getExportsList(enable=False))))) | python | def display_modules_list(self):
"""Display modules list"""
print("Plugins list: {}".format(
', '.join(sorted(self.stats.getPluginsList(enable=False)))))
print("Exporters list: {}".format(
', '.join(sorted(self.stats.getExportsList(enable=False))))) | [
"def",
"display_modules_list",
"(",
"self",
")",
":",
"print",
"(",
"\"Plugins list: {}\"",
".",
"format",
"(",
"', '",
".",
"join",
"(",
"sorted",
"(",
"self",
".",
"stats",
".",
"getPluginsList",
"(",
"enable",
"=",
"False",
")",
")",
")",
")",
")",
... | Display modules list | [
"Display",
"modules",
"list"
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/standalone.py#L102-L107 | train | Display modules list | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/standalone.py | GlancesStandalone.__serve_forever | def __serve_forever(self):
"""Main loop for the CLI.
return True if we should continue (no exit key has been pressed)
"""
# Start a counter used to compute the time needed for
# update and export the stats
counter = Counter()
# Update stats
self.stats.up... | python | def __serve_forever(self):
"""Main loop for the CLI.
return True if we should continue (no exit key has been pressed)
"""
# Start a counter used to compute the time needed for
# update and export the stats
counter = Counter()
# Update stats
self.stats.up... | [
"def",
"__serve_forever",
"(",
"self",
")",
":",
"# Start a counter used to compute the time needed for",
"# update and export the stats",
"counter",
"=",
"Counter",
"(",
")",
"# Update stats",
"self",
".",
"stats",
".",
"update",
"(",
")",
"logger",
".",
"debug",
"("... | Main loop for the CLI.
return True if we should continue (no exit key has been pressed) | [
"Main",
"loop",
"for",
"the",
"CLI",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/standalone.py#L109-L143 | train | Main loop for the CLI. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/standalone.py | GlancesStandalone.serve_forever | def serve_forever(self):
"""Wrapper to the serve_forever function."""
loop = True
while loop:
loop = self.__serve_forever()
self.end() | python | def serve_forever(self):
"""Wrapper to the serve_forever function."""
loop = True
while loop:
loop = self.__serve_forever()
self.end() | [
"def",
"serve_forever",
"(",
"self",
")",
":",
"loop",
"=",
"True",
"while",
"loop",
":",
"loop",
"=",
"self",
".",
"__serve_forever",
"(",
")",
"self",
".",
"end",
"(",
")"
] | Wrapper to the serve_forever function. | [
"Wrapper",
"to",
"the",
"serve_forever",
"function",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/standalone.py#L145-L150 | train | Wrapper to the serve_forever function. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/standalone.py | GlancesStandalone.end | def end(self):
"""End of the standalone CLI."""
if not self.quiet:
self.screen.end()
# Exit from export modules
self.stats.end()
# Check Glances version versus PyPI one
if self.outdated.is_outdated():
print("You are using Glances version {}, howe... | python | def end(self):
"""End of the standalone CLI."""
if not self.quiet:
self.screen.end()
# Exit from export modules
self.stats.end()
# Check Glances version versus PyPI one
if self.outdated.is_outdated():
print("You are using Glances version {}, howe... | [
"def",
"end",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"quiet",
":",
"self",
".",
"screen",
".",
"end",
"(",
")",
"# Exit from export modules",
"self",
".",
"stats",
".",
"end",
"(",
")",
"# Check Glances version versus PyPI one",
"if",
"self",
"."... | End of the standalone CLI. | [
"End",
"of",
"the",
"standalone",
"CLI",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/standalone.py#L152-L164 | train | End of the standalone CLI. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/password.py | GlancesPassword.get_hash | def get_hash(self, salt, plain_password):
"""Return the hashed password, salt + SHA-256."""
return hashlib.sha256(salt.encode() + plain_password.encode()).hexdigest() | python | def get_hash(self, salt, plain_password):
"""Return the hashed password, salt + SHA-256."""
return hashlib.sha256(salt.encode() + plain_password.encode()).hexdigest() | [
"def",
"get_hash",
"(",
"self",
",",
"salt",
",",
"plain_password",
")",
":",
"return",
"hashlib",
".",
"sha256",
"(",
"salt",
".",
"encode",
"(",
")",
"+",
"plain_password",
".",
"encode",
"(",
")",
")",
".",
"hexdigest",
"(",
")"
] | Return the hashed password, salt + SHA-256. | [
"Return",
"the",
"hashed",
"password",
"salt",
"+",
"SHA",
"-",
"256",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/password.py#L49-L51 | train | Return the hashed password salt + SHA - 256. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/password.py | GlancesPassword.hash_password | def hash_password(self, plain_password):
"""Hash password with a salt based on UUID (universally unique identifier)."""
salt = uuid.uuid4().hex
encrypted_password = self.get_hash(salt, plain_password)
return salt + '$' + encrypted_password | python | def hash_password(self, plain_password):
"""Hash password with a salt based on UUID (universally unique identifier)."""
salt = uuid.uuid4().hex
encrypted_password = self.get_hash(salt, plain_password)
return salt + '$' + encrypted_password | [
"def",
"hash_password",
"(",
"self",
",",
"plain_password",
")",
":",
"salt",
"=",
"uuid",
".",
"uuid4",
"(",
")",
".",
"hex",
"encrypted_password",
"=",
"self",
".",
"get_hash",
"(",
"salt",
",",
"plain_password",
")",
"return",
"salt",
"+",
"'$'",
"+",... | Hash password with a salt based on UUID (universally unique identifier). | [
"Hash",
"password",
"with",
"a",
"salt",
"based",
"on",
"UUID",
"(",
"universally",
"unique",
"identifier",
")",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/password.py#L53-L57 | train | Hash a plain password with a salt based on UUID | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/password.py | GlancesPassword.check_password | def check_password(self, hashed_password, plain_password):
"""Encode the plain_password with the salt of the hashed_password.
Return the comparison with the encrypted_password.
"""
salt, encrypted_password = hashed_password.split('$')
re_encrypted_password = self.get_hash(salt, ... | python | def check_password(self, hashed_password, plain_password):
"""Encode the plain_password with the salt of the hashed_password.
Return the comparison with the encrypted_password.
"""
salt, encrypted_password = hashed_password.split('$')
re_encrypted_password = self.get_hash(salt, ... | [
"def",
"check_password",
"(",
"self",
",",
"hashed_password",
",",
"plain_password",
")",
":",
"salt",
",",
"encrypted_password",
"=",
"hashed_password",
".",
"split",
"(",
"'$'",
")",
"re_encrypted_password",
"=",
"self",
".",
"get_hash",
"(",
"salt",
",",
"p... | Encode the plain_password with the salt of the hashed_password.
Return the comparison with the encrypted_password. | [
"Encode",
"the",
"plain_password",
"with",
"the",
"salt",
"of",
"the",
"hashed_password",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/password.py#L59-L66 | train | Encode the plain_password with the salt of the hashed_password. Return the comparison with the encrypted_password. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/password.py | GlancesPassword.get_password | def get_password(self, description='', confirm=False, clear=False):
"""Get the password from a Glances client or server.
For Glances server, get the password (confirm=True, clear=False):
1) from the password file (if it exists)
2) from the CLI
Optionally: save the passwo... | python | def get_password(self, description='', confirm=False, clear=False):
"""Get the password from a Glances client or server.
For Glances server, get the password (confirm=True, clear=False):
1) from the password file (if it exists)
2) from the CLI
Optionally: save the passwo... | [
"def",
"get_password",
"(",
"self",
",",
"description",
"=",
"''",
",",
"confirm",
"=",
"False",
",",
"clear",
"=",
"False",
")",
":",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"password_file",
")",
"and",
"not",
"clear",
":",
"# If t... | Get the password from a Glances client or server.
For Glances server, get the password (confirm=True, clear=False):
1) from the password file (if it exists)
2) from the CLI
Optionally: save the password to a file (hashed with salt + SHA-256)
For Glances client, get the ... | [
"Get",
"the",
"password",
"from",
"a",
"Glances",
"client",
"or",
"server",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/password.py#L68-L110 | train | Get the password from a Glances server or client. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/password.py | GlancesPassword.save_password | def save_password(self, hashed_password):
"""Save the hashed password to the Glances folder."""
# Create the glances directory
safe_makedirs(self.password_dir)
# Create/overwrite the password file
with open(self.password_file, 'wb') as file_pwd:
file_pwd.write(b(hash... | python | def save_password(self, hashed_password):
"""Save the hashed password to the Glances folder."""
# Create the glances directory
safe_makedirs(self.password_dir)
# Create/overwrite the password file
with open(self.password_file, 'wb') as file_pwd:
file_pwd.write(b(hash... | [
"def",
"save_password",
"(",
"self",
",",
"hashed_password",
")",
":",
"# Create the glances directory",
"safe_makedirs",
"(",
"self",
".",
"password_dir",
")",
"# Create/overwrite the password file",
"with",
"open",
"(",
"self",
".",
"password_file",
",",
"'wb'",
")"... | Save the hashed password to the Glances folder. | [
"Save",
"the",
"hashed",
"password",
"to",
"the",
"Glances",
"folder",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/password.py#L112-L119 | train | Save the hashed password to the Glances folder. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/password.py | GlancesPassword.load_password | def load_password(self):
"""Load the hashed password from the Glances folder."""
# Read the password file, if it exists
with open(self.password_file, 'r') as file_pwd:
hashed_password = file_pwd.read()
return hashed_password | python | def load_password(self):
"""Load the hashed password from the Glances folder."""
# Read the password file, if it exists
with open(self.password_file, 'r') as file_pwd:
hashed_password = file_pwd.read()
return hashed_password | [
"def",
"load_password",
"(",
"self",
")",
":",
"# Read the password file, if it exists",
"with",
"open",
"(",
"self",
".",
"password_file",
",",
"'r'",
")",
"as",
"file_pwd",
":",
"hashed_password",
"=",
"file_pwd",
".",
"read",
"(",
")",
"return",
"hashed_passw... | Load the hashed password from the Glances folder. | [
"Load",
"the",
"hashed",
"password",
"from",
"the",
"Glances",
"folder",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/password.py#L121-L127 | train | Load the hashed password from the Glances folder. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/outputs/glances_sparklines.py | Sparkline.get | def get(self):
"""Return the sparkline."""
ret = sparklines(self.percents)[0]
if self.__with_text:
percents_without_none = [x for x in self.percents if x is not None]
if len(percents_without_none) > 0:
ret = '{}{:5.1f}%'.format(ret, percents_without_none[-... | python | def get(self):
"""Return the sparkline."""
ret = sparklines(self.percents)[0]
if self.__with_text:
percents_without_none = [x for x in self.percents if x is not None]
if len(percents_without_none) > 0:
ret = '{}{:5.1f}%'.format(ret, percents_without_none[-... | [
"def",
"get",
"(",
"self",
")",
":",
"ret",
"=",
"sparklines",
"(",
"self",
".",
"percents",
")",
"[",
"0",
"]",
"if",
"self",
".",
"__with_text",
":",
"percents_without_none",
"=",
"[",
"x",
"for",
"x",
"in",
"self",
".",
"percents",
"if",
"x",
"i... | Return the sparkline. | [
"Return",
"the",
"sparkline",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/outputs/glances_sparklines.py#L89-L96 | train | Return the sparkline. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_cpu.py | Plugin.update | def update(self):
"""Update CPU stats using the input method."""
# Grab stats into self.stats
if self.input_method == 'local':
stats = self.update_local()
elif self.input_method == 'snmp':
stats = self.update_snmp()
else:
stats = self.get_init... | python | def update(self):
"""Update CPU stats using the input method."""
# Grab stats into self.stats
if self.input_method == 'local':
stats = self.update_local()
elif self.input_method == 'snmp':
stats = self.update_snmp()
else:
stats = self.get_init... | [
"def",
"update",
"(",
"self",
")",
":",
"# Grab stats into self.stats",
"if",
"self",
".",
"input_method",
"==",
"'local'",
":",
"stats",
"=",
"self",
".",
"update_local",
"(",
")",
"elif",
"self",
".",
"input_method",
"==",
"'snmp'",
":",
"stats",
"=",
"s... | Update CPU stats using the input method. | [
"Update",
"CPU",
"stats",
"using",
"the",
"input",
"method",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_cpu.py#L77-L91 | train | Update CPU stats using the input method. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_cpu.py | Plugin.update_local | def update_local(self):
"""Update CPU stats using psutil."""
# Grab CPU stats using psutil's cpu_percent and cpu_times_percent
# Get all possible values for CPU stats: user, system, idle,
# nice (UNIX), iowait (Linux), irq (Linux, FreeBSD), steal (Linux 2.6.11+)
# The following s... | python | def update_local(self):
"""Update CPU stats using psutil."""
# Grab CPU stats using psutil's cpu_percent and cpu_times_percent
# Get all possible values for CPU stats: user, system, idle,
# nice (UNIX), iowait (Linux), irq (Linux, FreeBSD), steal (Linux 2.6.11+)
# The following s... | [
"def",
"update_local",
"(",
"self",
")",
":",
"# Grab CPU stats using psutil's cpu_percent and cpu_times_percent",
"# Get all possible values for CPU stats: user, system, idle,",
"# nice (UNIX), iowait (Linux), irq (Linux, FreeBSD), steal (Linux 2.6.11+)",
"# The following stats are returned by th... | Update CPU stats using psutil. | [
"Update",
"CPU",
"stats",
"using",
"psutil",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_cpu.py#L93-L139 | train | Update the CPU stats using the local API. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_cpu.py | Plugin.update_snmp | def update_snmp(self):
"""Update CPU stats using SNMP."""
# Init new stats
stats = self.get_init_value()
# Update stats using SNMP
if self.short_system_name in ('windows', 'esxi'):
# Windows or VMWare ESXi
# You can find the CPU utilization of windows sy... | python | def update_snmp(self):
"""Update CPU stats using SNMP."""
# Init new stats
stats = self.get_init_value()
# Update stats using SNMP
if self.short_system_name in ('windows', 'esxi'):
# Windows or VMWare ESXi
# You can find the CPU utilization of windows sy... | [
"def",
"update_snmp",
"(",
"self",
")",
":",
"# Init new stats",
"stats",
"=",
"self",
".",
"get_init_value",
"(",
")",
"# Update stats using SNMP",
"if",
"self",
".",
"short_system_name",
"in",
"(",
"'windows'",
",",
"'esxi'",
")",
":",
"# Windows or VMWare ESXi"... | Update CPU stats using SNMP. | [
"Update",
"CPU",
"stats",
"using",
"SNMP",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_cpu.py#L141-L188 | train | Update CPU stats using SNMP. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_cpu.py | Plugin.update_views | def update_views(self):
"""Update stats views."""
# Call the father's method
super(Plugin, self).update_views()
# Add specifics informations
# Alert and log
for key in ['user', 'system', 'iowait']:
if key in self.stats:
self.views[key]['decora... | python | def update_views(self):
"""Update stats views."""
# Call the father's method
super(Plugin, self).update_views()
# Add specifics informations
# Alert and log
for key in ['user', 'system', 'iowait']:
if key in self.stats:
self.views[key]['decora... | [
"def",
"update_views",
"(",
"self",
")",
":",
"# Call the father's method",
"super",
"(",
"Plugin",
",",
"self",
")",
".",
"update_views",
"(",
")",
"# Add specifics informations",
"# Alert and log",
"for",
"key",
"in",
"[",
"'user'",
",",
"'system'",
",",
"'iow... | Update stats views. | [
"Update",
"stats",
"views",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_cpu.py#L190-L211 | train | Update stats views. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_cpu.py | Plugin.msg_curse | def msg_curse(self, args=None, max_width=None):
"""Return the list to display in the UI."""
# Init the return message
ret = []
# Only process if stats exist and plugin not disable
if not self.stats or self.args.percpu or self.is_disable():
return ret
# Build... | python | def msg_curse(self, args=None, max_width=None):
"""Return the list to display in the UI."""
# Init the return message
ret = []
# Only process if stats exist and plugin not disable
if not self.stats or self.args.percpu or self.is_disable():
return ret
# Build... | [
"def",
"msg_curse",
"(",
"self",
",",
"args",
"=",
"None",
",",
"max_width",
"=",
"None",
")",
":",
"# Init the return message",
"ret",
"=",
"[",
"]",
"# Only process if stats exist and plugin not disable",
"if",
"not",
"self",
".",
"stats",
"or",
"self",
".",
... | Return the list to display in the UI. | [
"Return",
"the",
"list",
"to",
"display",
"in",
"the",
"UI",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_cpu.py#L213-L342 | train | Return the list of messages to display in the UI. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_wifi.py | Plugin.update | def update(self):
"""Update Wifi stats using the input method.
Stats is a list of dict (one dict per hotspot)
:returns: list -- Stats is a list of dict (hotspot)
"""
# Init new stats
stats = self.get_init_value()
# Exist if we can not grab the stats
if ... | python | def update(self):
"""Update Wifi stats using the input method.
Stats is a list of dict (one dict per hotspot)
:returns: list -- Stats is a list of dict (hotspot)
"""
# Init new stats
stats = self.get_init_value()
# Exist if we can not grab the stats
if ... | [
"def",
"update",
"(",
"self",
")",
":",
"# Init new stats",
"stats",
"=",
"self",
".",
"get_init_value",
"(",
")",
"# Exist if we can not grab the stats",
"if",
"import_error_tag",
":",
"return",
"stats",
"if",
"self",
".",
"input_method",
"==",
"'local'",
":",
... | Update Wifi stats using the input method.
Stats is a list of dict (one dict per hotspot)
:returns: list -- Stats is a list of dict (hotspot) | [
"Update",
"Wifi",
"stats",
"using",
"the",
"input",
"method",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_wifi.py#L69-L130 | train | Update Wifi stats using the input method. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_wifi.py | Plugin.get_alert | def get_alert(self, value):
"""Overwrite the default get_alert method.
Alert is on signal quality where lower is better...
:returns: string -- Signal alert
"""
ret = 'OK'
try:
if value <= self.get_limit('critical', stat_name=self.plugin_name):
... | python | def get_alert(self, value):
"""Overwrite the default get_alert method.
Alert is on signal quality where lower is better...
:returns: string -- Signal alert
"""
ret = 'OK'
try:
if value <= self.get_limit('critical', stat_name=self.plugin_name):
... | [
"def",
"get_alert",
"(",
"self",
",",
"value",
")",
":",
"ret",
"=",
"'OK'",
"try",
":",
"if",
"value",
"<=",
"self",
".",
"get_limit",
"(",
"'critical'",
",",
"stat_name",
"=",
"self",
".",
"plugin_name",
")",
":",
"ret",
"=",
"'CRITICAL'",
"elif",
... | Overwrite the default get_alert method.
Alert is on signal quality where lower is better...
:returns: string -- Signal alert | [
"Overwrite",
"the",
"default",
"get_alert",
"method",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_wifi.py#L132-L151 | train | Overwrite the default get_alert method to provide a specific alert. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_wifi.py | Plugin.update_views | def update_views(self):
"""Update stats views."""
# Call the father's method
super(Plugin, self).update_views()
# Add specifics informations
# Alert on signal thresholds
for i in self.stats:
self.views[i[self.get_key()]]['signal']['decoration'] = self.get_ale... | python | def update_views(self):
"""Update stats views."""
# Call the father's method
super(Plugin, self).update_views()
# Add specifics informations
# Alert on signal thresholds
for i in self.stats:
self.views[i[self.get_key()]]['signal']['decoration'] = self.get_ale... | [
"def",
"update_views",
"(",
"self",
")",
":",
"# Call the father's method",
"super",
"(",
"Plugin",
",",
"self",
")",
".",
"update_views",
"(",
")",
"# Add specifics informations",
"# Alert on signal thresholds",
"for",
"i",
"in",
"self",
".",
"stats",
":",
"self"... | Update stats views. | [
"Update",
"stats",
"views",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_wifi.py#L153-L162 | train | Update stats views. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_wifi.py | Plugin.msg_curse | def msg_curse(self, args=None, max_width=None):
"""Return the dict to display in the curse interface."""
# Init the return message
ret = []
# Only process if stats exist and display plugin enable...
if not self.stats or import_error_tag or self.is_disable():
return r... | python | def msg_curse(self, args=None, max_width=None):
"""Return the dict to display in the curse interface."""
# Init the return message
ret = []
# Only process if stats exist and display plugin enable...
if not self.stats or import_error_tag or self.is_disable():
return r... | [
"def",
"msg_curse",
"(",
"self",
",",
"args",
"=",
"None",
",",
"max_width",
"=",
"None",
")",
":",
"# Init the return message",
"ret",
"=",
"[",
"]",
"# Only process if stats exist and display plugin enable...",
"if",
"not",
"self",
".",
"stats",
"or",
"import_er... | Return the dict to display in the curse interface. | [
"Return",
"the",
"dict",
"to",
"display",
"in",
"the",
"curse",
"interface",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_wifi.py#L164-L208 | train | Return the dict to display in the curse interface. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_fs.py | Plugin.update | def update(self):
"""Update the FS stats using the input method."""
# Init new stats
stats = self.get_init_value()
if self.input_method == 'local':
# Update stats using the standard system lib
# Grab the stats using the psutil disk_partitions
# If 'a... | python | def update(self):
"""Update the FS stats using the input method."""
# Init new stats
stats = self.get_init_value()
if self.input_method == 'local':
# Update stats using the standard system lib
# Grab the stats using the psutil disk_partitions
# If 'a... | [
"def",
"update",
"(",
"self",
")",
":",
"# Init new stats",
"stats",
"=",
"self",
".",
"get_init_value",
"(",
")",
"if",
"self",
".",
"input_method",
"==",
"'local'",
":",
"# Update stats using the standard system lib",
"# Grab the stats using the psutil disk_partitions",... | Update the FS stats using the input method. | [
"Update",
"the",
"FS",
"stats",
"using",
"the",
"input",
"method",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_fs.py#L88-L181 | train | Update the FS stats using the input method. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_fs.py | Plugin.update_views | def update_views(self):
"""Update stats views."""
# Call the father's method
super(Plugin, self).update_views()
# Add specifics informations
# Alert
for i in self.stats:
self.views[i[self.get_key()]]['used']['decoration'] = self.get_alert(
i['... | python | def update_views(self):
"""Update stats views."""
# Call the father's method
super(Plugin, self).update_views()
# Add specifics informations
# Alert
for i in self.stats:
self.views[i[self.get_key()]]['used']['decoration'] = self.get_alert(
i['... | [
"def",
"update_views",
"(",
"self",
")",
":",
"# Call the father's method",
"super",
"(",
"Plugin",
",",
"self",
")",
".",
"update_views",
"(",
")",
"# Add specifics informations",
"# Alert",
"for",
"i",
"in",
"self",
".",
"stats",
":",
"self",
".",
"views",
... | Update stats views. | [
"Update",
"stats",
"views",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_fs.py#L183-L192 | train | Update stats views. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
nicolargo/glances | glances/plugins/glances_fs.py | Plugin.msg_curse | def msg_curse(self, args=None, max_width=None):
"""Return the dict to display in the curse interface."""
# Init the return message
ret = []
# Only process if stats exist and display plugin enable...
if not self.stats or self.is_disable():
return ret
# Max si... | python | def msg_curse(self, args=None, max_width=None):
"""Return the dict to display in the curse interface."""
# Init the return message
ret = []
# Only process if stats exist and display plugin enable...
if not self.stats or self.is_disable():
return ret
# Max si... | [
"def",
"msg_curse",
"(",
"self",
",",
"args",
"=",
"None",
",",
"max_width",
"=",
"None",
")",
":",
"# Init the return message",
"ret",
"=",
"[",
"]",
"# Only process if stats exist and display plugin enable...",
"if",
"not",
"self",
".",
"stats",
"or",
"self",
... | Return the dict to display in the curse interface. | [
"Return",
"the",
"dict",
"to",
"display",
"in",
"the",
"curse",
"interface",
"."
] | 5bd4d587a736e0d2b03170b56926841d2a3eb7ee | https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_fs.py#L194-L245 | train | Return the dict to display in the curse interface. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.