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/plugins/glances_mem.py
Plugin.update
def update(self): """Update RAM memory 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 MEM using the psutil virtual_memory method vm_s...
python
def update(self): """Update RAM memory 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 MEM using the psutil virtual_memory method vm_s...
[ "def", "update", "(", "self", ")", ":", "# Init new stats", "stats", "=", "self", ".", "get_init_value", "(", ")", "if", "self", ".", "input_method", "==", "'local'", ":", "# Update stats using the standard system lib", "# Grab MEM using the psutil virtual_memory method",...
Update RAM memory stats using the input method.
[ "Update", "RAM", "memory", "stats", "using", "the", "input", "method", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_mem.py#L72-L154
train
Update RAM memory 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_mem.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 self.views['used']['decoration'] = self.get_alert_log(self.stats['used'], maximum=self.stats['total']) # O...
python
def update_views(self): """Update stats views.""" # Call the father's method super(Plugin, self).update_views() # Add specifics informations # Alert and log self.views['used']['decoration'] = self.get_alert_log(self.stats['used'], maximum=self.stats['total']) # O...
[ "def", "update_views", "(", "self", ")", ":", "# Call the father's method", "super", "(", "Plugin", ",", "self", ")", ".", "update_views", "(", ")", "# Add specifics informations", "# Alert and log", "self", ".", "views", "[", "'used'", "]", "[", "'decoration'", ...
Update stats views.
[ "Update", "stats", "views", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_mem.py#L156-L167
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_mem.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 plugin not disabled if not self.stats or self.is_disable(): return ret # Build the s...
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 plugin not disabled if not self.stats or self.is_disable(): return ret # Build the s...
[ "def", "msg_curse", "(", "self", ",", "args", "=", "None", ",", "max_width", "=", "None", ")", ":", "# Init the return message", "ret", "=", "[", "]", "# Only process if stats exist and plugin not disabled", "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_mem.py#L169-L234
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/history.py
GlancesHistory.add
def add(self, key, value, description='', history_max_size=None): """Add an new item (key, value) to the current history.""" if key not in self.stats_history: self.stats_history[key] = GlancesAttribute(key, descri...
python
def add(self, key, value, description='', history_max_size=None): """Add an new item (key, value) to the current history.""" if key not in self.stats_history: self.stats_history[key] = GlancesAttribute(key, descri...
[ "def", "add", "(", "self", ",", "key", ",", "value", ",", "description", "=", "''", ",", "history_max_size", "=", "None", ")", ":", "if", "key", "not", "in", "self", ".", "stats_history", ":", "self", ".", "stats_history", "[", "key", "]", "=", "Glan...
Add an new item (key, value) to the current history.
[ "Add", "an", "new", "item", "(", "key", "value", ")", "to", "the", "current", "history", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/history.py#L37-L45
train
Add an item to the current 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/history.py
GlancesHistory.get
def get(self, nb=0): """Get the history as a dict of list""" return {i: self.stats_history[i].history_raw(nb=nb) for i in self.stats_history}
python
def get(self, nb=0): """Get the history as a dict of list""" return {i: self.stats_history[i].history_raw(nb=nb) for i in self.stats_history}
[ "def", "get", "(", "self", ",", "nb", "=", "0", ")", ":", "return", "{", "i", ":", "self", ".", "stats_history", "[", "i", "]", ".", "history_raw", "(", "nb", "=", "nb", ")", "for", "i", "in", "self", ".", "stats_history", "}" ]
Get the history as a dict of list
[ "Get", "the", "history", "as", "a", "dict", "of", "list" ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/history.py#L52-L54
train
Get the history as a dict of 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/history.py
GlancesHistory.get_json
def get_json(self, nb=0): """Get the history as a dict of list (with list JSON compliant)""" return {i: self.stats_history[i].history_json(nb=nb) for i in self.stats_history}
python
def get_json(self, nb=0): """Get the history as a dict of list (with list JSON compliant)""" return {i: self.stats_history[i].history_json(nb=nb) for i in self.stats_history}
[ "def", "get_json", "(", "self", ",", "nb", "=", "0", ")", ":", "return", "{", "i", ":", "self", ".", "stats_history", "[", "i", "]", ".", "history_json", "(", "nb", "=", "nb", ")", "for", "i", "in", "self", ".", "stats_history", "}" ]
Get the history as a dict of list (with list JSON compliant)
[ "Get", "the", "history", "as", "a", "dict", "of", "list", "(", "with", "list", "JSON", "compliant", ")" ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/history.py#L56-L58
train
Get the history as a dict of list JSON compliant
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/glances_amp.py
GlancesAmp.load_config
def load_config(self, config): """Load AMP parameters from the configuration file.""" # Read AMP confifuration. # For ex, the AMP foo should have the following section: # # [foo] # enable=true # regex=\/usr\/bin\/nginx # refresh=60 # # and...
python
def load_config(self, config): """Load AMP parameters from the configuration file.""" # Read AMP confifuration. # For ex, the AMP foo should have the following section: # # [foo] # enable=true # regex=\/usr\/bin\/nginx # refresh=60 # # and...
[ "def", "load_config", "(", "self", ",", "config", ")", ":", "# Read AMP confifuration.", "# For ex, the AMP foo should have the following section:", "#", "# [foo]", "# enable=true", "# regex=\\/usr\\/bin\\/nginx", "# refresh=60", "#", "# and optionnaly:", "#", "# one_line=false",...
Load AMP parameters from the configuration file.
[ "Load", "AMP", "parameters", "from", "the", "configuration", "file", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/amps/glances_amp.py#L69-L115
train
Load the AMP parameters 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/amps/glances_amp.py
GlancesAmp.enable
def enable(self): """Return True|False if the AMP is enabled in the configuration file (enable=true|false).""" ret = self.get('enable') if ret is None: return False else: return ret.lower().startswith('true')
python
def enable(self): """Return True|False if the AMP is enabled in the configuration file (enable=true|false).""" ret = self.get('enable') if ret is None: return False else: return ret.lower().startswith('true')
[ "def", "enable", "(", "self", ")", ":", "ret", "=", "self", ".", "get", "(", "'enable'", ")", "if", "ret", "is", "None", ":", "return", "False", "else", ":", "return", "ret", ".", "lower", "(", ")", ".", "startswith", "(", "'true'", ")" ]
Return True|False if the AMP is enabled in the configuration file (enable=true|false).
[ "Return", "True|False", "if", "the", "AMP", "is", "enabled", "in", "the", "configuration", "file", "(", "enable", "=", "true|false", ")", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/amps/glances_amp.py#L124-L130
train
Return True|False if the AMP is enabled in the configuration file ( enable = true|false.
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/glances_amp.py
GlancesAmp.one_line
def one_line(self): """Return True|False if the AMP shoukd be displayed in oneline (one_lineline=true|false).""" ret = self.get('one_line') if ret is None: return False else: return ret.lower().startswith('true')
python
def one_line(self): """Return True|False if the AMP shoukd be displayed in oneline (one_lineline=true|false).""" ret = self.get('one_line') if ret is None: return False else: return ret.lower().startswith('true')
[ "def", "one_line", "(", "self", ")", ":", "ret", "=", "self", ".", "get", "(", "'one_line'", ")", "if", "ret", "is", "None", ":", "return", "False", "else", ":", "return", "ret", ".", "lower", "(", ")", ".", "startswith", "(", "'true'", ")" ]
Return True|False if the AMP shoukd be displayed in oneline (one_lineline=true|false).
[ "Return", "True|False", "if", "the", "AMP", "shoukd", "be", "displayed", "in", "oneline", "(", "one_lineline", "=", "true|false", ")", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/amps/glances_amp.py#L140-L146
train
Return True|False if the AMP shoukd be displayed in oneline ( one_lineline = true|false.
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/glances_amp.py
GlancesAmp.should_update
def should_update(self): """Return True is the AMP should be updated: - AMP is enable - only update every 'refresh' seconds """ if self.timer.finished(): self.timer.set(self.refresh()) self.timer.reset() return self.enable() return Fals...
python
def should_update(self): """Return True is the AMP should be updated: - AMP is enable - only update every 'refresh' seconds """ if self.timer.finished(): self.timer.set(self.refresh()) self.timer.reset() return self.enable() return Fals...
[ "def", "should_update", "(", "self", ")", ":", "if", "self", ".", "timer", ".", "finished", "(", ")", ":", "self", ".", "timer", ".", "set", "(", "self", ".", "refresh", "(", ")", ")", "self", ".", "timer", ".", "reset", "(", ")", "return", "self...
Return True is the AMP should be updated: - AMP is enable - only update every 'refresh' seconds
[ "Return", "True", "is", "the", "AMP", "should", "be", "updated", ":", "-", "AMP", "is", "enable", "-", "only", "update", "every", "refresh", "seconds" ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/amps/glances_amp.py#L152-L161
train
Return True is the AMP should be updated
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/glances_amp.py
GlancesAmp.set_result
def set_result(self, result, separator=''): """Store the result (string) into the result key of the AMP if one_line is true then replace \n by separator """ if self.one_line(): self.configs['result'] = str(result).replace('\n', separator) else: self.config...
python
def set_result(self, result, separator=''): """Store the result (string) into the result key of the AMP if one_line is true then replace \n by separator """ if self.one_line(): self.configs['result'] = str(result).replace('\n', separator) else: self.config...
[ "def", "set_result", "(", "self", ",", "result", ",", "separator", "=", "''", ")", ":", "if", "self", ".", "one_line", "(", ")", ":", "self", ".", "configs", "[", "'result'", "]", "=", "str", "(", "result", ")", ".", "replace", "(", "'\\n'", ",", ...
Store the result (string) into the result key of the AMP if one_line is true then replace \n by separator
[ "Store", "the", "result", "(", "string", ")", "into", "the", "result", "key", "of", "the", "AMP", "if", "one_line", "is", "true", "then", "replace", "\\", "n", "by", "separator" ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/amps/glances_amp.py#L179-L186
train
Store the result into the result key of the AMP
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/glances_amp.py
GlancesAmp.result
def result(self): """ Return the result of the AMP (as a string)""" ret = self.get('result') if ret is not None: ret = u(ret) return ret
python
def result(self): """ Return the result of the AMP (as a string)""" ret = self.get('result') if ret is not None: ret = u(ret) return ret
[ "def", "result", "(", "self", ")", ":", "ret", "=", "self", ".", "get", "(", "'result'", ")", "if", "ret", "is", "not", "None", ":", "ret", "=", "u", "(", "ret", ")", "return", "ret" ]
Return the result of the AMP (as a string)
[ "Return", "the", "result", "of", "the", "AMP", "(", "as", "a", "string", ")" ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/amps/glances_amp.py#L188-L193
train
Return the result of the AMP as a 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/amps/glances_amp.py
GlancesAmp.update_wrapper
def update_wrapper(self, process_list): """Wrapper for the children update""" # Set the number of running process self.set_count(len(process_list)) # Call the children update method if self.should_update(): return self.update(process_list) else: re...
python
def update_wrapper(self, process_list): """Wrapper for the children update""" # Set the number of running process self.set_count(len(process_list)) # Call the children update method if self.should_update(): return self.update(process_list) else: re...
[ "def", "update_wrapper", "(", "self", ",", "process_list", ")", ":", "# Set the number of running process", "self", ".", "set_count", "(", "len", "(", "process_list", ")", ")", "# Call the children update method", "if", "self", ".", "should_update", "(", ")", ":", ...
Wrapper for the children update
[ "Wrapper", "for", "the", "children", "update" ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/amps/glances_amp.py#L195-L203
train
Wrapper for the children update 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_processcount.py
Plugin.update
def update(self): """Update processes 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 # Here, update is call for processcount AND processlist ...
python
def update(self): """Update processes 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 # Here, update is call for processcount AND processlist ...
[ "def", "update", "(", "self", ")", ":", "# Init new stats", "stats", "=", "self", ".", "get_init_value", "(", ")", "if", "self", ".", "input_method", "==", "'local'", ":", "# Update stats using the standard system lib", "# Here, update is call for processcount AND process...
Update processes stats using the input method.
[ "Update", "processes", "stats", "using", "the", "input", "method", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_processcount.py#L63-L83
train
Update processes 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_processcount.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 args.disable_process: msg = "PROCESSES DISABLED (press 'z' to dis...
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 args.disable_process: msg = "PROCESSES DISABLED (press 'z' to dis...
[ "def", "msg_curse", "(", "self", ",", "args", "=", "None", ",", "max_width", "=", "None", ")", ":", "# Init the return message", "ret", "=", "[", "]", "# Only process if stats exist and display plugin enable...", "if", "args", ".", "disable_process", ":", "msg", "...
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_processcount.py#L85-L151
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_alert.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 display plugin enable... if not self.stats or self.is_disable(): return ret # Build the string messa...
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 display plugin enable... if not self.stats or self.is_disable(): return ret # Build the string messa...
[ "def", "msg_curse", "(", "self", ",", "args", "=", "None", ",", "max_width", "=", "None", ")", ":", "# Init the return message", "ret", "=", "[", "]", "# Only process if display plugin enable...", "if", "not", "self", ".", "stats", "or", "self", ".", "is_disab...
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_alert.py#L111-L160
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_alert.py
Plugin.approx_equal
def approx_equal(self, a, b, tolerance=0.0): """Compare a with b using the tolerance (if numerical).""" if str(int(a)).isdigit() and str(int(b)).isdigit(): return abs(a - b) <= max(abs(a), abs(b)) * tolerance else: return a == b
python
def approx_equal(self, a, b, tolerance=0.0): """Compare a with b using the tolerance (if numerical).""" if str(int(a)).isdigit() and str(int(b)).isdigit(): return abs(a - b) <= max(abs(a), abs(b)) * tolerance else: return a == b
[ "def", "approx_equal", "(", "self", ",", "a", ",", "b", ",", "tolerance", "=", "0.0", ")", ":", "if", "str", "(", "int", "(", "a", ")", ")", ".", "isdigit", "(", ")", "and", "str", "(", "int", "(", "b", ")", ")", ".", "isdigit", "(", ")", "...
Compare a with b using the tolerance (if numerical).
[ "Compare", "a", "with", "b", "using", "the", "tolerance", "(", "if", "numerical", ")", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_alert.py#L162-L167
train
Compare a with b using the tolerance ( if numerical ).
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_json.py
Export.export
def export(self, name, columns, points): """Export the stats to the JSON file.""" # Check for completion of loop for all exports if name == self.plugins_to_export()[0] and self.buffer != {}: # One whole loop has been completed # Flush stats to file logger.deb...
python
def export(self, name, columns, points): """Export the stats to the JSON file.""" # Check for completion of loop for all exports if name == self.plugins_to_export()[0] and self.buffer != {}: # One whole loop has been completed # Flush stats to file logger.deb...
[ "def", "export", "(", "self", ",", "name", ",", "columns", ",", "points", ")", ":", "# Check for completion of loop for all exports", "if", "name", "==", "self", ".", "plugins_to_export", "(", ")", "[", "0", "]", "and", "self", ".", "buffer", "!=", "{", "}...
Export the stats to the JSON file.
[ "Export", "the", "stats", "to", "the", "JSON", "file", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/exports/glances_json.py#L44-L64
train
Export the stats to the JSON 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/plugins/glances_docker.py
Plugin.exit
def exit(self): """Overwrite the exit method to close threads.""" for t in itervalues(self.thread_list): t.stop() # Call the father class super(Plugin, self).exit()
python
def exit(self): """Overwrite the exit method to close threads.""" for t in itervalues(self.thread_list): t.stop() # Call the father class super(Plugin, self).exit()
[ "def", "exit", "(", "self", ")", ":", "for", "t", "in", "itervalues", "(", "self", ".", "thread_list", ")", ":", "t", ".", "stop", "(", ")", "# Call the father class", "super", "(", "Plugin", ",", "self", ")", ".", "exit", "(", ")" ]
Overwrite the exit method to close threads.
[ "Overwrite", "the", "exit", "method", "to", "close", "threads", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_docker.py#L94-L99
train
Overwrite the exit method to close threads.
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_docker.py
Plugin.get_export
def get_export(self): """Overwrite the default export method. - Only exports containers - The key is the first container name """ ret = [] try: ret = self.stats['containers'] except KeyError as e: logger.debug("docker plugin - Docker expor...
python
def get_export(self): """Overwrite the default export method. - Only exports containers - The key is the first container name """ ret = [] try: ret = self.stats['containers'] except KeyError as e: logger.debug("docker plugin - Docker expor...
[ "def", "get_export", "(", "self", ")", ":", "ret", "=", "[", "]", "try", ":", "ret", "=", "self", ".", "stats", "[", "'containers'", "]", "except", "KeyError", "as", "e", ":", "logger", ".", "debug", "(", "\"docker plugin - Docker export error {}\"", ".", ...
Overwrite the default export method. - Only exports containers - The key is the first container name
[ "Overwrite", "the", "default", "export", "method", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_docker.py#L105-L116
train
Overwrite the default export 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_docker.py
Plugin.connect
def connect(self): """Connect to the Docker server.""" try: ret = docker.from_env() except Exception as e: logger.error("docker plugin - Can not connect to Docker ({})".format(e)) ret = None return ret
python
def connect(self): """Connect to the Docker server.""" try: ret = docker.from_env() except Exception as e: logger.error("docker plugin - Can not connect to Docker ({})".format(e)) ret = None return ret
[ "def", "connect", "(", "self", ")", ":", "try", ":", "ret", "=", "docker", ".", "from_env", "(", ")", "except", "Exception", "as", "e", ":", "logger", ".", "error", "(", "\"docker plugin - Can not connect to Docker ({})\"", ".", "format", "(", "e", ")", ")...
Connect to the Docker server.
[ "Connect", "to", "the", "Docker", "server", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_docker.py#L118-L126
train
Connect to the Docker 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/plugins/glances_docker.py
Plugin._all_tag
def _all_tag(self): """Return the all tag of the Glances/Docker configuration file. # By default, Glances only display running containers # Set the following key to True to display all containers all=True """ all_tag = self.get_conf_value('all') if len(all_tag) =...
python
def _all_tag(self): """Return the all tag of the Glances/Docker configuration file. # By default, Glances only display running containers # Set the following key to True to display all containers all=True """ all_tag = self.get_conf_value('all') if len(all_tag) =...
[ "def", "_all_tag", "(", "self", ")", ":", "all_tag", "=", "self", ".", "get_conf_value", "(", "'all'", ")", "if", "len", "(", "all_tag", ")", "==", "0", ":", "return", "False", "else", ":", "return", "all_tag", "[", "0", "]", ".", "lower", "(", ")"...
Return the all tag of the Glances/Docker configuration file. # By default, Glances only display running containers # Set the following key to True to display all containers all=True
[ "Return", "the", "all", "tag", "of", "the", "Glances", "/", "Docker", "configuration", "file", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_docker.py#L128-L139
train
Return the all tag of the Glances or Docker 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/plugins/glances_docker.py
Plugin.update
def update(self): """Update Docker stats using the input method.""" # Init new stats stats = self.get_init_value() # The Docker-py lib is mandatory if import_error_tag: return self.stats if self.input_method == 'local': # Update stats ...
python
def update(self): """Update Docker stats using the input method.""" # Init new stats stats = self.get_init_value() # The Docker-py lib is mandatory if import_error_tag: return self.stats if self.input_method == 'local': # Update stats ...
[ "def", "update", "(", "self", ")", ":", "# Init new stats", "stats", "=", "self", ".", "get_init_value", "(", ")", "# The Docker-py lib is mandatory", "if", "import_error_tag", ":", "return", "self", ".", "stats", "if", "self", ".", "input_method", "==", "'local...
Update Docker stats using the input method.
[ "Update", "Docker", "stats", "using", "the", "input", "method", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_docker.py#L143-L252
train
Update the internal dict with the current 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_docker.py
Plugin.get_docker_cpu
def get_docker_cpu(self, container_id, all_stats): """Return the container CPU usage. Input: id is the full container id all_stats is the output of the stats method of the Docker API Output: a dict {'total': 1.49} """ cpu_new = {} ret = {'total': 0.0} ...
python
def get_docker_cpu(self, container_id, all_stats): """Return the container CPU usage. Input: id is the full container id all_stats is the output of the stats method of the Docker API Output: a dict {'total': 1.49} """ cpu_new = {} ret = {'total': 0.0} ...
[ "def", "get_docker_cpu", "(", "self", ",", "container_id", ",", "all_stats", ")", ":", "cpu_new", "=", "{", "}", "ret", "=", "{", "'total'", ":", "0.0", "}", "# Read the stats", "# For each container, you will find a pseudo-file cpuacct.stat,", "# containing the CPU usa...
Return the container CPU usage. Input: id is the full container id all_stats is the output of the stats method of the Docker API Output: a dict {'total': 1.49}
[ "Return", "the", "container", "CPU", "usage", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_docker.py#L254-L303
train
Return the CPU usage of a container.
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_docker.py
Plugin.get_docker_memory
def get_docker_memory(self, container_id, all_stats): """Return the container MEMORY. Input: id is the full container id all_stats is the output of the stats method of the Docker API Output: a dict {'rss': 1015808, 'cache': 356352, 'usage': ..., 'max_usage': ...} """ ...
python
def get_docker_memory(self, container_id, all_stats): """Return the container MEMORY. Input: id is the full container id all_stats is the output of the stats method of the Docker API Output: a dict {'rss': 1015808, 'cache': 356352, 'usage': ..., 'max_usage': ...} """ ...
[ "def", "get_docker_memory", "(", "self", ",", "container_id", ",", "all_stats", ")", ":", "ret", "=", "{", "}", "# Read the stats", "try", ":", "# Do not exist anymore with Docker 1.11 (issue #848)", "# ret['rss'] = all_stats['memory_stats']['stats']['rss']", "# ret['cache'] = ...
Return the container MEMORY. Input: id is the full container id all_stats is the output of the stats method of the Docker API Output: a dict {'rss': 1015808, 'cache': 356352, 'usage': ..., 'max_usage': ...}
[ "Return", "the", "container", "MEMORY", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_docker.py#L305-L326
train
Return the container MEMORY.
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_docker.py
Plugin.get_docker_network
def get_docker_network(self, container_id, all_stats): """Return the container network usage using the Docker API (v1.0 or higher). Input: id is the full container id Output: a dict {'time_since_update': 3000, 'rx': 10, 'tx': 65}. with: time_since_update: number of seconds e...
python
def get_docker_network(self, container_id, all_stats): """Return the container network usage using the Docker API (v1.0 or higher). Input: id is the full container id Output: a dict {'time_since_update': 3000, 'rx': 10, 'tx': 65}. with: time_since_update: number of seconds e...
[ "def", "get_docker_network", "(", "self", ",", "container_id", ",", "all_stats", ")", ":", "# Init the returned dict", "network_new", "=", "{", "}", "# Read the rx/tx stats (in bytes)", "try", ":", "netcounters", "=", "all_stats", "[", "\"networks\"", "]", "except", ...
Return the container network usage using the Docker API (v1.0 or higher). Input: id is the full container id Output: a dict {'time_since_update': 3000, 'rx': 10, 'tx': 65}. with: time_since_update: number of seconds elapsed between the latest grab rx: Number of byte rece...
[ "Return", "the", "container", "network", "usage", "using", "the", "Docker", "API", "(", "v1", ".", "0", "or", "higher", ")", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_docker.py#L328-L384
train
Get the container network usage using the Docker 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_docker.py
Plugin.get_docker_io
def get_docker_io(self, container_id, all_stats): """Return the container IO usage using the Docker API (v1.0 or higher). Input: id is the full container id Output: a dict {'time_since_update': 3000, 'ior': 10, 'iow': 65}. with: time_since_update: number of seconds elapsed b...
python
def get_docker_io(self, container_id, all_stats): """Return the container IO usage using the Docker API (v1.0 or higher). Input: id is the full container id Output: a dict {'time_since_update': 3000, 'ior': 10, 'iow': 65}. with: time_since_update: number of seconds elapsed b...
[ "def", "get_docker_io", "(", "self", ",", "container_id", ",", "all_stats", ")", ":", "# Init the returned dict", "io_new", "=", "{", "}", "# Read the ior/iow stats (in bytes)", "try", ":", "iocounters", "=", "all_stats", "[", "\"blkio_stats\"", "]", "except", "KeyE...
Return the container IO usage using the Docker API (v1.0 or higher). Input: id is the full container id Output: a dict {'time_since_update': 3000, 'ior': 10, 'iow': 65}. with: time_since_update: number of seconds elapsed between the latest grab ior: Number of byte readed...
[ "Return", "the", "container", "IO", "usage", "using", "the", "Docker", "API", "(", "v1", ".", "0", "or", "higher", ")", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_docker.py#L386-L447
train
Get the container IO usage using the Docker 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_docker.py
Plugin.update_views
def update_views(self): """Update stats views.""" # Call the father's method super(Plugin, self).update_views() if 'containers' not in self.stats: return False # Add specifics informations # Alert for i in self.stats['containers']: # Init...
python
def update_views(self): """Update stats views.""" # Call the father's method super(Plugin, self).update_views() if 'containers' not in self.stats: return False # Add specifics informations # Alert for i in self.stats['containers']: # Init...
[ "def", "update_views", "(", "self", ")", ":", "# Call the father's method", "super", "(", "Plugin", ",", "self", ")", ".", "update_views", "(", ")", "if", "'containers'", "not", "in", "self", ".", "stats", ":", "return", "False", "# Add specifics informations", ...
Update stats views.
[ "Update", "stats", "views", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_docker.py#L460-L497
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_docker.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 non null) and display plugin enable... if not self.stats \ or 'containers' not in self.stats ...
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 non null) and display plugin enable... if not self.stats \ or 'containers' not in self.stats ...
[ "def", "msg_curse", "(", "self", ",", "args", "=", "None", ",", "max_width", "=", "None", ")", ":", "# Init the return message", "ret", "=", "[", "]", "# Only process if stats exist (and non null) and display plugin enable...", "if", "not", "self", ".", "stats", "or...
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_docker.py#L499-L606
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_docker.py
Plugin._msg_name
def _msg_name(self, container, max_width): """Build the container name.""" name = container['name'] if len(name) > max_width: name = '_' + name[-max_width + 1:] else: name = name[:max_width] return ' {:{width}}'.format(name, width=max_width)
python
def _msg_name(self, container, max_width): """Build the container name.""" name = container['name'] if len(name) > max_width: name = '_' + name[-max_width + 1:] else: name = name[:max_width] return ' {:{width}}'.format(name, width=max_width)
[ "def", "_msg_name", "(", "self", ",", "container", ",", "max_width", ")", ":", "name", "=", "container", "[", "'name'", "]", "if", "len", "(", "name", ")", ">", "max_width", ":", "name", "=", "'_'", "+", "name", "[", "-", "max_width", "+", "1", ":"...
Build the container name.
[ "Build", "the", "container", "name", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_docker.py#L608-L615
train
Build the container name.
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_docker.py
ThreadDockerGrabber.run
def run(self): """Grab the stats. Infinite loop, should be stopped by calling the stop() method """ for i in self._stats_stream: self._stats = i time.sleep(0.1) if self.stopped(): break
python
def run(self): """Grab the stats. Infinite loop, should be stopped by calling the stop() method """ for i in self._stats_stream: self._stats = i time.sleep(0.1) if self.stopped(): break
[ "def", "run", "(", "self", ")", ":", "for", "i", "in", "self", ".", "_stats_stream", ":", "self", ".", "_stats", "=", "i", "time", ".", "sleep", "(", "0.1", ")", "if", "self", ".", "stopped", "(", ")", ":", "break" ]
Grab the stats. Infinite loop, should be stopped by calling the stop() method
[ "Grab", "the", "stats", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_docker.py#L651-L660
train
Grab the stats. Infinite loop should be stopped by calling the stop 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_docker.py
ThreadDockerGrabber.stop
def stop(self, timeout=None): """Stop the thread.""" logger.debug("docker plugin - Close thread for container {}".format(self._container.name)) self._stopper.set()
python
def stop(self, timeout=None): """Stop the thread.""" logger.debug("docker plugin - Close thread for container {}".format(self._container.name)) self._stopper.set()
[ "def", "stop", "(", "self", ",", "timeout", "=", "None", ")", ":", "logger", ".", "debug", "(", "\"docker plugin - Close thread for container {}\"", ".", "format", "(", "self", ".", "_container", ".", "name", ")", ")", "self", ".", "_stopper", ".", "set", ...
Stop the thread.
[ "Stop", "the", "thread", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_docker.py#L672-L675
train
Stop the thread.
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_plugin.py
GlancesPlugin.is_enable
def is_enable(self, plugin_name=None): """Return true if plugin is enabled.""" if not plugin_name: plugin_name = self.plugin_name try: d = getattr(self.args, 'disable_' + plugin_name) except AttributeError: return True else: return ...
python
def is_enable(self, plugin_name=None): """Return true if plugin is enabled.""" if not plugin_name: plugin_name = self.plugin_name try: d = getattr(self.args, 'disable_' + plugin_name) except AttributeError: return True else: return ...
[ "def", "is_enable", "(", "self", ",", "plugin_name", "=", "None", ")", ":", "if", "not", "plugin_name", ":", "plugin_name", "=", "self", ".", "plugin_name", "try", ":", "d", "=", "getattr", "(", "self", ".", "args", ",", "'disable_'", "+", "plugin_name",...
Return true if plugin is enabled.
[ "Return", "true", "if", "plugin", "is", "enabled", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_plugin.py#L127-L136
train
Return true if plugin is enabled.
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_plugin.py
GlancesPlugin._json_dumps
def _json_dumps(self, d): """Return the object 'd' in a JSON format. Manage the issue #815 for Windows OS """ try: return json.dumps(d) except UnicodeDecodeError: return json.dumps(d, ensure_ascii=False)
python
def _json_dumps(self, d): """Return the object 'd' in a JSON format. Manage the issue #815 for Windows OS """ try: return json.dumps(d) except UnicodeDecodeError: return json.dumps(d, ensure_ascii=False)
[ "def", "_json_dumps", "(", "self", ",", "d", ")", ":", "try", ":", "return", "json", ".", "dumps", "(", "d", ")", "except", "UnicodeDecodeError", ":", "return", "json", ".", "dumps", "(", "d", ",", "ensure_ascii", "=", "False", ")" ]
Return the object 'd' in a JSON format. Manage the issue #815 for Windows OS
[ "Return", "the", "object", "d", "in", "a", "JSON", "format", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_plugin.py#L142-L150
train
Return the object d in a 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/plugins/glances_plugin.py
GlancesPlugin.init_stats_history
def init_stats_history(self): """Init the stats history (dict of GlancesAttribute).""" if self.history_enable(): init_list = [a['name'] for a in self.get_items_history_list()] logger.debug("Stats history activated for plugin {} (items: {})".format(self.plugin_name, init_list)) ...
python
def init_stats_history(self): """Init the stats history (dict of GlancesAttribute).""" if self.history_enable(): init_list = [a['name'] for a in self.get_items_history_list()] logger.debug("Stats history activated for plugin {} (items: {})".format(self.plugin_name, init_list)) ...
[ "def", "init_stats_history", "(", "self", ")", ":", "if", "self", ".", "history_enable", "(", ")", ":", "init_list", "=", "[", "a", "[", "'name'", "]", "for", "a", "in", "self", ".", "get_items_history_list", "(", ")", "]", "logger", ".", "debug", "(",...
Init the stats history (dict of GlancesAttribute).
[ "Init", "the", "stats", "history", "(", "dict", "of", "GlancesAttribute", ")", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_plugin.py#L155-L160
train
Init the stats 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/plugins/glances_plugin.py
GlancesPlugin.reset_stats_history
def reset_stats_history(self): """Reset the stats history (dict of GlancesAttribute).""" if self.history_enable(): reset_list = [a['name'] for a in self.get_items_history_list()] logger.debug("Reset history for plugin {} (items: {})".format(self.plugin_name, reset_list)) ...
python
def reset_stats_history(self): """Reset the stats history (dict of GlancesAttribute).""" if self.history_enable(): reset_list = [a['name'] for a in self.get_items_history_list()] logger.debug("Reset history for plugin {} (items: {})".format(self.plugin_name, reset_list)) ...
[ "def", "reset_stats_history", "(", "self", ")", ":", "if", "self", ".", "history_enable", "(", ")", ":", "reset_list", "=", "[", "a", "[", "'name'", "]", "for", "a", "in", "self", ".", "get_items_history_list", "(", ")", "]", "logger", ".", "debug", "(...
Reset the stats history (dict of GlancesAttribute).
[ "Reset", "the", "stats", "history", "(", "dict", "of", "GlancesAttribute", ")", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_plugin.py#L162-L167
train
Reset the stats 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/plugins/glances_plugin.py
GlancesPlugin.update_stats_history
def update_stats_history(self): """Update stats history.""" # If the plugin data is a dict, the dict's key should be used if self.get_key() is None: item_name = '' else: item_name = self.get_key() # Build the history if self.get_export() and self.h...
python
def update_stats_history(self): """Update stats history.""" # If the plugin data is a dict, the dict's key should be used if self.get_key() is None: item_name = '' else: item_name = self.get_key() # Build the history if self.get_export() and self.h...
[ "def", "update_stats_history", "(", "self", ")", ":", "# If the plugin data is a dict, the dict's key should be used", "if", "self", ".", "get_key", "(", ")", "is", "None", ":", "item_name", "=", "''", "else", ":", "item_name", "=", "self", ".", "get_key", "(", ...
Update stats history.
[ "Update", "stats", "history", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_plugin.py#L169-L195
train
Update the stats 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/plugins/glances_plugin.py
GlancesPlugin.get_raw_history
def get_raw_history(self, item=None, nb=0): """Return the history (RAW format). - the stats history (dict of list) if item is None - the stats history for the given item (list) instead - None if item did not exist in the history """ s = self.stats_history.get(nb=nb) ...
python
def get_raw_history(self, item=None, nb=0): """Return the history (RAW format). - the stats history (dict of list) if item is None - the stats history for the given item (list) instead - None if item did not exist in the history """ s = self.stats_history.get(nb=nb) ...
[ "def", "get_raw_history", "(", "self", ",", "item", "=", "None", ",", "nb", "=", "0", ")", ":", "s", "=", "self", ".", "stats_history", ".", "get", "(", "nb", "=", "nb", ")", "if", "item", "is", "None", ":", "return", "s", "else", ":", "if", "i...
Return the history (RAW format). - the stats history (dict of list) if item is None - the stats history for the given item (list) instead - None if item did not exist in the history
[ "Return", "the", "history", "(", "RAW", "format", ")", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_plugin.py#L201-L215
train
Return the history for the given item
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_plugin.py
GlancesPlugin.get_json_history
def get_json_history(self, item=None, nb=0): """Return the history (JSON format). - the stats history (dict of list) if item is None - the stats history for the given item (list) instead - None if item did not exist in the history Limit to lasts nb items (all if nb=0) ""...
python
def get_json_history(self, item=None, nb=0): """Return the history (JSON format). - the stats history (dict of list) if item is None - the stats history for the given item (list) instead - None if item did not exist in the history Limit to lasts nb items (all if nb=0) ""...
[ "def", "get_json_history", "(", "self", ",", "item", "=", "None", ",", "nb", "=", "0", ")", ":", "s", "=", "self", ".", "stats_history", ".", "get_json", "(", "nb", "=", "nb", ")", "if", "item", "is", "None", ":", "return", "s", "else", ":", "if"...
Return the history (JSON format). - the stats history (dict of list) if item is None - the stats history for the given item (list) instead - None if item did not exist in the history Limit to lasts nb items (all if nb=0)
[ "Return", "the", "history", "(", "JSON", "format", ")", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_plugin.py#L217-L232
train
Return the history for the given item
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_plugin.py
GlancesPlugin.get_stats_history
def get_stats_history(self, item=None, nb=0): """Return the stats history (JSON format).""" s = self.get_json_history(nb=nb) if item is None: return self._json_dumps(s) if isinstance(s, dict): try: return self._json_dumps({item: s[item]}) ...
python
def get_stats_history(self, item=None, nb=0): """Return the stats history (JSON format).""" s = self.get_json_history(nb=nb) if item is None: return self._json_dumps(s) if isinstance(s, dict): try: return self._json_dumps({item: s[item]}) ...
[ "def", "get_stats_history", "(", "self", ",", "item", "=", "None", ",", "nb", "=", "0", ")", ":", "s", "=", "self", ".", "get_json_history", "(", "nb", "=", "nb", ")", "if", "item", "is", "None", ":", "return", "self", ".", "_json_dumps", "(", "s",...
Return the stats history (JSON format).
[ "Return", "the", "stats", "history", "(", "JSON", "format", ")", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_plugin.py#L238-L260
train
Return the stats history ( 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/plugins/glances_plugin.py
GlancesPlugin.get_trend
def get_trend(self, item, nb=6): """Get the trend regarding to the last nb values. The trend is the diff between the mean of the last nb values and the current one. """ raw_history = self.get_raw_history(item=item, nb=nb) if raw_history is None or len(raw_history) < nb: ...
python
def get_trend(self, item, nb=6): """Get the trend regarding to the last nb values. The trend is the diff between the mean of the last nb values and the current one. """ raw_history = self.get_raw_history(item=item, nb=nb) if raw_history is None or len(raw_history) < nb: ...
[ "def", "get_trend", "(", "self", ",", "item", ",", "nb", "=", "6", ")", ":", "raw_history", "=", "self", ".", "get_raw_history", "(", "item", "=", "item", ",", "nb", "=", "nb", ")", "if", "raw_history", "is", "None", "or", "len", "(", "raw_history", ...
Get the trend regarding to the last nb values. The trend is the diff between the mean of the last nb values and the current one.
[ "Get", "the", "trend", "regarding", "to", "the", "last", "nb", "values", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_plugin.py#L262-L272
train
Get the trend regarding to the last nb 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_plugin.py
GlancesPlugin.sorted_stats
def sorted_stats(self): """Get the stats sorted by an alias (if present) or key.""" key = self.get_key() return sorted(self.stats, key=lambda stat: tuple(map( lambda part: int(part) if part.isdigit() else part.lower(), re.split(r"(\d+|\D+)", self.has_alias(stat[key]) or s...
python
def sorted_stats(self): """Get the stats sorted by an alias (if present) or key.""" key = self.get_key() return sorted(self.stats, key=lambda stat: tuple(map( lambda part: int(part) if part.isdigit() else part.lower(), re.split(r"(\d+|\D+)", self.has_alias(stat[key]) or s...
[ "def", "sorted_stats", "(", "self", ")", ":", "key", "=", "self", ".", "get_key", "(", ")", "return", "sorted", "(", "self", ".", "stats", ",", "key", "=", "lambda", "stat", ":", "tuple", "(", "map", "(", "lambda", "part", ":", "int", "(", "part", ...
Get the stats sorted by an alias (if present) or key.
[ "Get", "the", "stats", "sorted", "by", "an", "alias", "(", "if", "present", ")", "or", "key", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_plugin.py#L294-L300
train
Get the stats sorted by an alias or key.
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_plugin.py
GlancesPlugin.get_stats_snmp
def get_stats_snmp(self, bulk=False, snmp_oid=None): """Update stats using SNMP. If bulk=True, use a bulk request instead of a get request. """ snmp_oid = snmp_oid or {} from glances.snmp import GlancesSNMPClient # Init the SNMP request clientsnmp = GlancesSNMP...
python
def get_stats_snmp(self, bulk=False, snmp_oid=None): """Update stats using SNMP. If bulk=True, use a bulk request instead of a get request. """ snmp_oid = snmp_oid or {} from glances.snmp import GlancesSNMPClient # Init the SNMP request clientsnmp = GlancesSNMP...
[ "def", "get_stats_snmp", "(", "self", ",", "bulk", "=", "False", ",", "snmp_oid", "=", "None", ")", ":", "snmp_oid", "=", "snmp_oid", "or", "{", "}", "from", "glances", ".", "snmp", "import", "GlancesSNMPClient", "# Init the SNMP request", "clientsnmp", "=", ...
Update stats using SNMP. If bulk=True, use a bulk request instead of a get request.
[ "Update", "stats", "using", "SNMP", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_plugin.py#L311-L364
train
Update 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_plugin.py
GlancesPlugin.get_stats_item
def get_stats_item(self, item): """Return the stats object for a specific item in JSON format. Stats should be a list of dict (processlist, network...) """ if isinstance(self.stats, dict): try: return self._json_dumps({item: self.stats[item]}) exc...
python
def get_stats_item(self, item): """Return the stats object for a specific item in JSON format. Stats should be a list of dict (processlist, network...) """ if isinstance(self.stats, dict): try: return self._json_dumps({item: self.stats[item]}) exc...
[ "def", "get_stats_item", "(", "self", ",", "item", ")", ":", "if", "isinstance", "(", "self", ".", "stats", ",", "dict", ")", ":", "try", ":", "return", "self", ".", "_json_dumps", "(", "{", "item", ":", "self", ".", "stats", "[", "item", "]", "}",...
Return the stats object for a specific item in JSON format. Stats should be a list of dict (processlist, network...)
[ "Return", "the", "stats", "object", "for", "a", "specific", "item", "in", "JSON", "format", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_plugin.py#L378-L399
train
Return the stats object for a specific item in 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/plugins/glances_plugin.py
GlancesPlugin.get_stats_value
def get_stats_value(self, item, value): """Return the stats object for a specific item=value in JSON format. Stats should be a list of dict (processlist, network...) """ if not isinstance(self.stats, list): return None else: if value.isdigit(): ...
python
def get_stats_value(self, item, value): """Return the stats object for a specific item=value in JSON format. Stats should be a list of dict (processlist, network...) """ if not isinstance(self.stats, list): return None else: if value.isdigit(): ...
[ "def", "get_stats_value", "(", "self", ",", "item", ",", "value", ")", ":", "if", "not", "isinstance", "(", "self", ".", "stats", ",", "list", ")", ":", "return", "None", "else", ":", "if", "value", ".", "isdigit", "(", ")", ":", "value", "=", "int...
Return the stats object for a specific item=value in JSON format. Stats should be a list of dict (processlist, network...)
[ "Return", "the", "stats", "object", "for", "a", "specific", "item", "=", "value", "in", "JSON", "format", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_plugin.py#L401-L416
train
Return the stats object for a specific item = value in 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/plugins/glances_plugin.py
GlancesPlugin.update_views
def update_views(self): """Update the stats views. The V of MVC A dict of dict with the needed information to display the stats. Example for the stat xxx: 'xxx': {'decoration': 'DEFAULT', 'optional': False, 'additional': False, 'sp...
python
def update_views(self): """Update the stats views. The V of MVC A dict of dict with the needed information to display the stats. Example for the stat xxx: 'xxx': {'decoration': 'DEFAULT', 'optional': False, 'additional': False, 'sp...
[ "def", "update_views", "(", "self", ")", ":", "ret", "=", "{", "}", "if", "(", "isinstance", "(", "self", ".", "get_raw", "(", ")", ",", "list", ")", "and", "self", ".", "get_raw", "(", ")", "is", "not", "None", "and", "self", ".", "get_key", "("...
Update the stats views. The V of MVC A dict of dict with the needed information to display the stats. Example for the stat xxx: 'xxx': {'decoration': 'DEFAULT', 'optional': False, 'additional': False, 'splittable': False}
[ "Update", "the", "stats", "views", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_plugin.py#L418-L454
train
Update the 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_plugin.py
GlancesPlugin.get_views
def get_views(self, item=None, key=None, option=None): """Return the views object. If key is None, return all the view for the current plugin else if option is None return the view for the specific key (all option) else return the view fo the specific key/option Specify item if...
python
def get_views(self, item=None, key=None, option=None): """Return the views object. If key is None, return all the view for the current plugin else if option is None return the view for the specific key (all option) else return the view fo the specific key/option Specify item if...
[ "def", "get_views", "(", "self", ",", "item", "=", "None", ",", "key", "=", "None", ",", "option", "=", "None", ")", ":", "if", "item", "is", "None", ":", "item_views", "=", "self", ".", "views", "else", ":", "item_views", "=", "self", ".", "views"...
Return the views object. If key is None, return all the view for the current plugin else if option is None return the view for the specific key (all option) else return the view fo the specific key/option Specify item if the stats are stored in a dict of dict (ex: NETWORK, FS...)
[ "Return", "the", "views", "object", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_plugin.py#L460-L483
train
Return the views object.
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_plugin.py
GlancesPlugin.get_json_views
def get_json_views(self, item=None, key=None, option=None): """Return the views (in JSON).""" return self._json_dumps(self.get_views(item, key, option))
python
def get_json_views(self, item=None, key=None, option=None): """Return the views (in JSON).""" return self._json_dumps(self.get_views(item, key, option))
[ "def", "get_json_views", "(", "self", ",", "item", "=", "None", ",", "key", "=", "None", ",", "option", "=", "None", ")", ":", "return", "self", ".", "_json_dumps", "(", "self", ".", "get_views", "(", "item", ",", "key", ",", "option", ")", ")" ]
Return the views (in JSON).
[ "Return", "the", "views", "(", "in", "JSON", ")", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_plugin.py#L485-L487
train
Return the views in 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/plugins/glances_plugin.py
GlancesPlugin.load_limits
def load_limits(self, config): """Load limits from the configuration file, if it exists.""" # By default set the history length to 3 points per second during one day self._limits['history_size'] = 28800 if not hasattr(config, 'has_section'): return False # Read the ...
python
def load_limits(self, config): """Load limits from the configuration file, if it exists.""" # By default set the history length to 3 points per second during one day self._limits['history_size'] = 28800 if not hasattr(config, 'has_section'): return False # Read the ...
[ "def", "load_limits", "(", "self", ",", "config", ")", ":", "# By default set the history length to 3 points per second during one day", "self", ".", "_limits", "[", "'history_size'", "]", "=", "28800", "if", "not", "hasattr", "(", "config", ",", "'has_section'", ")",...
Load limits from the configuration file, if it exists.
[ "Load", "limits", "from", "the", "configuration", "file", "if", "it", "exists", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_plugin.py#L489-L513
train
Load limits from the configuration file 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/plugins/glances_plugin.py
GlancesPlugin.get_stat_name
def get_stat_name(self, header=""): """"Return the stat name with an optional header""" ret = self.plugin_name if header != "": ret += '_' + header return ret
python
def get_stat_name(self, header=""): """"Return the stat name with an optional header""" ret = self.plugin_name if header != "": ret += '_' + header return ret
[ "def", "get_stat_name", "(", "self", ",", "header", "=", "\"\"", ")", ":", "ret", "=", "self", ".", "plugin_name", "if", "header", "!=", "\"\"", ":", "ret", "+=", "'_'", "+", "header", "return", "ret" ]
Return the stat name with an optional header
[ "Return", "the", "stat", "name", "with", "an", "optional", "header" ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_plugin.py#L534-L539
train
Return the stat name with an optional header
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_plugin.py
GlancesPlugin.get_alert
def get_alert(self, current=0, minimum=0, maximum=100, highlight_zero=True, is_max=False, header="", action_key=None, log=False): """Return the alert status relative to...
python
def get_alert(self, current=0, minimum=0, maximum=100, highlight_zero=True, is_max=False, header="", action_key=None, log=False): """Return the alert status relative to...
[ "def", "get_alert", "(", "self", ",", "current", "=", "0", ",", "minimum", "=", "0", ",", "maximum", "=", "100", ",", "highlight_zero", "=", "True", ",", "is_max", "=", "False", ",", "header", "=", "\"\"", ",", "action_key", "=", "None", ",", "log", ...
Return the alert status relative to a current value. Use this function for minor stats. If current < CAREFUL of max then alert = OK If current > CAREFUL of max then alert = CAREFUL If current > WARNING of max then alert = WARNING If current > CRITICAL of max then alert = CRITIC...
[ "Return", "the", "alert", "status", "relative", "to", "a", "current", "value", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_plugin.py#L541-L617
train
Return the alert status relative to a current 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/plugins/glances_plugin.py
GlancesPlugin.manage_action
def manage_action(self, stat_name, trigger, header, action_key): """Manage the action for the current stat.""" # Here is a command line for the current trigger ? try: command, repeat = self.get_li...
python
def manage_action(self, stat_name, trigger, header, action_key): """Manage the action for the current stat.""" # Here is a command line for the current trigger ? try: command, repeat = self.get_li...
[ "def", "manage_action", "(", "self", ",", "stat_name", ",", "trigger", ",", "header", ",", "action_key", ")", ":", "# Here is a command line for the current trigger ?", "try", ":", "command", ",", "repeat", "=", "self", ".", "get_limit_action", "(", "trigger", ","...
Manage the action for the current stat.
[ "Manage", "the", "action", "for", "the", "current", "stat", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_plugin.py#L625-L659
train
Manage the action for the current 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_plugin.py
GlancesPlugin.get_alert_log
def get_alert_log(self, current=0, minimum=0, maximum=100, header="", action_key=None): """Get the alert log.""" return self.get_alert(current=current, minimum=mini...
python
def get_alert_log(self, current=0, minimum=0, maximum=100, header="", action_key=None): """Get the alert log.""" return self.get_alert(current=current, minimum=mini...
[ "def", "get_alert_log", "(", "self", ",", "current", "=", "0", ",", "minimum", "=", "0", ",", "maximum", "=", "100", ",", "header", "=", "\"\"", ",", "action_key", "=", "None", ")", ":", "return", "self", ".", "get_alert", "(", "current", "=", "curre...
Get the alert log.
[ "Get", "the", "alert", "log", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_plugin.py#L661-L673
train
Get the alert log.
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_plugin.py
GlancesPlugin.get_limit
def get_limit(self, criticity, stat_name=""): """Return the limit value for the alert.""" # Get the limit for stat + header # Exemple: network_wlan0_rx_careful try: limit = self._limits[stat_name + '_' + criticity] except KeyError: # Try fallback to plugin...
python
def get_limit(self, criticity, stat_name=""): """Return the limit value for the alert.""" # Get the limit for stat + header # Exemple: network_wlan0_rx_careful try: limit = self._limits[stat_name + '_' + criticity] except KeyError: # Try fallback to plugin...
[ "def", "get_limit", "(", "self", ",", "criticity", ",", "stat_name", "=", "\"\"", ")", ":", "# Get the limit for stat + header", "# Exemple: network_wlan0_rx_careful", "try", ":", "limit", "=", "self", ".", "_limits", "[", "stat_name", "+", "'_'", "+", "criticity"...
Return the limit value for the alert.
[ "Return", "the", "limit", "value", "for", "the", "alert", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_plugin.py#L675-L689
train
Return the limit value for the 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_plugin.py
GlancesPlugin.get_limit_action
def get_limit_action(self, criticity, stat_name=""): """Return the tuple (action, repeat) for the alert. - action is a command line - repeat is a bool """ # Get the action for stat + header # Exemple: network_wlan0_rx_careful_action # Action key available ? ...
python
def get_limit_action(self, criticity, stat_name=""): """Return the tuple (action, repeat) for the alert. - action is a command line - repeat is a bool """ # Get the action for stat + header # Exemple: network_wlan0_rx_careful_action # Action key available ? ...
[ "def", "get_limit_action", "(", "self", ",", "criticity", ",", "stat_name", "=", "\"\"", ")", ":", "# Get the action for stat + header", "# Exemple: network_wlan0_rx_careful_action", "# Action key available ?", "ret", "=", "[", "(", "stat_name", "+", "'_'", "+", "critic...
Return the tuple (action, repeat) for the alert. - action is a command line - repeat is a bool
[ "Return", "the", "tuple", "(", "action", "repeat", ")", "for", "the", "alert", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_plugin.py#L691-L709
train
Get the action for the 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_plugin.py
GlancesPlugin.get_limit_log
def get_limit_log(self, stat_name, default_action=False): """Return the log tag for the alert.""" # Get the log tag for stat + header # Exemple: network_wlan0_rx_log try: log_tag = self._limits[stat_name + '_log'] except KeyError: # Try fallback to plugin ...
python
def get_limit_log(self, stat_name, default_action=False): """Return the log tag for the alert.""" # Get the log tag for stat + header # Exemple: network_wlan0_rx_log try: log_tag = self._limits[stat_name + '_log'] except KeyError: # Try fallback to plugin ...
[ "def", "get_limit_log", "(", "self", ",", "stat_name", ",", "default_action", "=", "False", ")", ":", "# Get the log tag for stat + header", "# Exemple: network_wlan0_rx_log", "try", ":", "log_tag", "=", "self", ".", "_limits", "[", "stat_name", "+", "'_log'", "]", ...
Return the log tag for the alert.
[ "Return", "the", "log", "tag", "for", "the", "alert", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_plugin.py#L711-L727
train
Return the log tag for the 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_plugin.py
GlancesPlugin.get_conf_value
def get_conf_value(self, value, header="", plugin_name=None): """Return the configuration (header_) value for the current plugin. ...or the one given by the plugin_name var. """ if plugin_name is None: # If not default use the current plugin name plugin_name = se...
python
def get_conf_value(self, value, header="", plugin_name=None): """Return the configuration (header_) value for the current plugin. ...or the one given by the plugin_name var. """ if plugin_name is None: # If not default use the current plugin name plugin_name = se...
[ "def", "get_conf_value", "(", "self", ",", "value", ",", "header", "=", "\"\"", ",", "plugin_name", "=", "None", ")", ":", "if", "plugin_name", "is", "None", ":", "# If not default use the current plugin name", "plugin_name", "=", "self", ".", "plugin_name", "if...
Return the configuration (header_) value for the current plugin. ...or the one given by the plugin_name var.
[ "Return", "the", "configuration", "(", "header_", ")", "value", "for", "the", "current", "plugin", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_plugin.py#L729-L745
train
Return the configuration value for the current plugin.
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_plugin.py
GlancesPlugin.is_hide
def is_hide(self, value, header=""): """Return True if the value is in the hide configuration list. The hide configuration list is defined in the glances.conf file. It is a comma separed list of regexp. Example for diskio: hide=sda2,sda5,loop.* """ # TODO: possib...
python
def is_hide(self, value, header=""): """Return True if the value is in the hide configuration list. The hide configuration list is defined in the glances.conf file. It is a comma separed list of regexp. Example for diskio: hide=sda2,sda5,loop.* """ # TODO: possib...
[ "def", "is_hide", "(", "self", ",", "value", ",", "header", "=", "\"\"", ")", ":", "# TODO: possible optimisation: create a re.compile list", "return", "not", "all", "(", "j", "is", "None", "for", "j", "in", "[", "re", ".", "match", "(", "i", ",", "value",...
Return True if the value is in the hide configuration list. The hide configuration list is defined in the glances.conf file. It is a comma separed list of regexp. Example for diskio: hide=sda2,sda5,loop.*
[ "Return", "True", "if", "the", "value", "is", "in", "the", "hide", "configuration", "list", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_plugin.py#L747-L756
train
Return True if the value is in the hide configuration 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/plugins/glances_plugin.py
GlancesPlugin.has_alias
def has_alias(self, header): """Return the alias name for the relative header or None if nonexist.""" try: # Force to lower case (issue #1126) return self._limits[self.plugin_name + '_' + header.lower() + '_' + 'alias'][0] except (KeyError, IndexError): # logg...
python
def has_alias(self, header): """Return the alias name for the relative header or None if nonexist.""" try: # Force to lower case (issue #1126) return self._limits[self.plugin_name + '_' + header.lower() + '_' + 'alias'][0] except (KeyError, IndexError): # logg...
[ "def", "has_alias", "(", "self", ",", "header", ")", ":", "try", ":", "# Force to lower case (issue #1126)", "return", "self", ".", "_limits", "[", "self", ".", "plugin_name", "+", "'_'", "+", "header", ".", "lower", "(", ")", "+", "'_'", "+", "'alias'", ...
Return the alias name for the relative header or None if nonexist.
[ "Return", "the", "alias", "name", "for", "the", "relative", "header", "or", "None", "if", "nonexist", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_plugin.py#L758-L765
train
Return the alias name for the relative header or None if nonexist.
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_plugin.py
GlancesPlugin.get_stats_display
def get_stats_display(self, args=None, max_width=None): """Return a dict with all the information needed to display the stat. key | description ---------------------------- display | Display the stat (True or False) msgdict | Message to display (list of dict [{ 'msg': msg, '...
python
def get_stats_display(self, args=None, max_width=None): """Return a dict with all the information needed to display the stat. key | description ---------------------------- display | Display the stat (True or False) msgdict | Message to display (list of dict [{ 'msg': msg, '...
[ "def", "get_stats_display", "(", "self", ",", "args", "=", "None", ",", "max_width", "=", "None", ")", ":", "display_curse", "=", "False", "if", "hasattr", "(", "self", ",", "'display_curse'", ")", ":", "display_curse", "=", "self", ".", "display_curse", "...
Return a dict with all the information needed to display the stat. key | description ---------------------------- display | Display the stat (True or False) msgdict | Message to display (list of dict [{ 'msg': msg, 'decoration': decoration } ... ]) align | Message position
[ "Return", "a", "dict", "with", "all", "the", "information", "needed", "to", "display", "the", "stat", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_plugin.py#L771-L796
train
Return a dict with all the information needed to display the stat.
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_plugin.py
GlancesPlugin.curse_add_line
def curse_add_line(self, msg, decoration="DEFAULT", optional=False, additional=False, splittable=False): """Return a dict with. Where: msg: string decoration: DEFAULT: no decoration UNDERLINE: underlin...
python
def curse_add_line(self, msg, decoration="DEFAULT", optional=False, additional=False, splittable=False): """Return a dict with. Where: msg: string decoration: DEFAULT: no decoration UNDERLINE: underlin...
[ "def", "curse_add_line", "(", "self", ",", "msg", ",", "decoration", "=", "\"DEFAULT\"", ",", "optional", "=", "False", ",", "additional", "=", "False", ",", "splittable", "=", "False", ")", ":", "return", "{", "'msg'", ":", "msg", ",", "'decoration'", "...
Return a dict with. Where: msg: string decoration: DEFAULT: no decoration UNDERLINE: underline BOLD: bold TITLE: for stat title PROCESS: for process name STATUS: for process status ...
[ "Return", "a", "dict", "with", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_plugin.py#L798-L826
train
Return a dict with. curse_add_line Where. curse_add_line is a function that returns a dict with. curse_add_line where. curse_add_line is a function that returns a dict with. curse_add_line where. curse_add_line is a function that returns a dict with. curse_add_line where. curse_add_line is a function that returns a dic...
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_plugin.py
GlancesPlugin.auto_unit
def auto_unit(self, number, low_precision=False, min_symbol='K' ): """Make a nice human-readable string out of number. Number of decimal places increases as quantity approaches 1. CASE: 613421788 RESULT: 585M low_precision: ...
python
def auto_unit(self, number, low_precision=False, min_symbol='K' ): """Make a nice human-readable string out of number. Number of decimal places increases as quantity approaches 1. CASE: 613421788 RESULT: 585M low_precision: ...
[ "def", "auto_unit", "(", "self", ",", "number", ",", "low_precision", "=", "False", ",", "min_symbol", "=", "'K'", ")", ":", "symbols", "=", "(", "'K'", ",", "'M'", ",", "'G'", ",", "'T'", ",", "'P'", ",", "'E'", ",", "'Z'", ",", "'Y'", ")", "if"...
Make a nice human-readable string out of number. Number of decimal places increases as quantity approaches 1. CASE: 613421788 RESULT: 585M low_precision: 585M CASE: 5307033647 RESULT: 4.94G low_precision: 4.9G CASE: 44968414685 RESULT: 41.9G...
[ "Make", "a", "nice", "human", "-", "readable", "string", "out", "of", "number", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_plugin.py#L845-L895
train
Auto unit the number.
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_plugin.py
GlancesPlugin.trend_msg
def trend_msg(self, trend, significant=1): """Return the trend message. Do not take into account if trend < significant """ ret = '-' if trend is None: ret = ' ' elif trend > significant: ret = '/' elif trend < -significant: re...
python
def trend_msg(self, trend, significant=1): """Return the trend message. Do not take into account if trend < significant """ ret = '-' if trend is None: ret = ' ' elif trend > significant: ret = '/' elif trend < -significant: re...
[ "def", "trend_msg", "(", "self", ",", "trend", ",", "significant", "=", "1", ")", ":", "ret", "=", "'-'", "if", "trend", "is", "None", ":", "ret", "=", "' '", "elif", "trend", ">", "significant", ":", "ret", "=", "'/'", "elif", "trend", "<", "-", ...
Return the trend message. Do not take into account if trend < significant
[ "Return", "the", "trend", "message", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_plugin.py#L897-L909
train
Return the trend message.
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_plugin.py
GlancesPlugin._check_decorator
def _check_decorator(fct): """Check if the plugin is enabled.""" def wrapper(self, *args, **kw): if self.is_enable(): ret = fct(self, *args, **kw) else: ret = self.stats return ret return wrapper
python
def _check_decorator(fct): """Check if the plugin is enabled.""" def wrapper(self, *args, **kw): if self.is_enable(): ret = fct(self, *args, **kw) else: ret = self.stats return ret return wrapper
[ "def", "_check_decorator", "(", "fct", ")", ":", "def", "wrapper", "(", "self", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "if", "self", ".", "is_enable", "(", ")", ":", "ret", "=", "fct", "(", "self", ",", "*", "args", ",", "*", "*", "...
Check if the plugin is enabled.
[ "Check", "if", "the", "plugin", "is", "enabled", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_plugin.py#L911-L919
train
Decorator to check if the plugin is enabled.
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_plugin.py
GlancesPlugin._log_result_decorator
def _log_result_decorator(fct): """Log (DEBUG) the result of the function fct.""" def wrapper(*args, **kw): ret = fct(*args, **kw) logger.debug("%s %s %s return %s" % ( args[0].__class__.__name__, args[0].__class__.__module__[len('glances_'):], ...
python
def _log_result_decorator(fct): """Log (DEBUG) the result of the function fct.""" def wrapper(*args, **kw): ret = fct(*args, **kw) logger.debug("%s %s %s return %s" % ( args[0].__class__.__name__, args[0].__class__.__module__[len('glances_'):], ...
[ "def", "_log_result_decorator", "(", "fct", ")", ":", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kw", ")", ":", "ret", "=", "fct", "(", "*", "args", ",", "*", "*", "kw", ")", "logger", ".", "debug", "(", "\"%s %s %s return %s\"", "%", "(",...
Log (DEBUG) the result of the function fct.
[ "Log", "(", "DEBUG", ")", "the", "result", "of", "the", "function", "fct", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_plugin.py#L921-L930
train
Log the result of the function fct.
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_hddtemp.py
Plugin.update
def update(self): """Update HDD 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 stats = self.glancesgrabhddtemp.get() else: # Update...
python
def update(self): """Update HDD 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 stats = self.glancesgrabhddtemp.get() else: # Update...
[ "def", "update", "(", "self", ")", ":", "# Init new stats", "stats", "=", "self", ".", "get_init_value", "(", ")", "if", "self", ".", "input_method", "==", "'local'", ":", "# Update stats using the standard system lib", "stats", "=", "self", ".", "glancesgrabhddte...
Update HDD stats using the input method.
[ "Update", "HDD", "stats", "using", "the", "input", "method", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_hddtemp.py#L50-L67
train
Update the HDD 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_hddtemp.py
GlancesGrabHDDTemp.fetch
def fetch(self): """Fetch the data from hddtemp daemon.""" # Taking care of sudden deaths/stops of hddtemp daemon try: sck = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sck.connect((self.host, self.port)) data = b'' while True: ...
python
def fetch(self): """Fetch the data from hddtemp daemon.""" # Taking care of sudden deaths/stops of hddtemp daemon try: sck = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sck.connect((self.host, self.port)) data = b'' while True: ...
[ "def", "fetch", "(", "self", ")", ":", "# Taking care of sudden deaths/stops of hddtemp daemon", "try", ":", "sck", "=", "socket", ".", "socket", "(", "socket", ".", "AF_INET", ",", "socket", ".", "SOCK_STREAM", ")", "sck", ".", "connect", "(", "(", "self", ...
Fetch the data from hddtemp daemon.
[ "Fetch", "the", "data", "from", "hddtemp", "daemon", "." ]
5bd4d587a736e0d2b03170b56926841d2a3eb7ee
https://github.com/nicolargo/glances/blob/5bd4d587a736e0d2b03170b56926841d2a3eb7ee/glances/plugins/glances_hddtemp.py#L132-L155
train
Fetch the data from the HDDtemp daemon.
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...
tgalal/yowsup
yowsup/axolotl/manager.py
AxolotlManager.set_prekeys_as_sent
def set_prekeys_as_sent(self, prekeyIds): """ :param prekeyIds: :type prekeyIds: list :return: :rtype: """ logger.debug("set_prekeys_as_sent(prekeyIds=[%d prekeyIds])" % len(prekeyIds)) self._store.preKeyStore.setAsSent([prekey.getId() for prekey in prekey...
python
def set_prekeys_as_sent(self, prekeyIds): """ :param prekeyIds: :type prekeyIds: list :return: :rtype: """ logger.debug("set_prekeys_as_sent(prekeyIds=[%d prekeyIds])" % len(prekeyIds)) self._store.preKeyStore.setAsSent([prekey.getId() for prekey in prekey...
[ "def", "set_prekeys_as_sent", "(", "self", ",", "prekeyIds", ")", ":", "logger", ".", "debug", "(", "\"set_prekeys_as_sent(prekeyIds=[%d prekeyIds])\"", "%", "len", "(", "prekeyIds", ")", ")", "self", ".", "_store", ".", "preKeyStore", ".", "setAsSent", "(", "["...
:param prekeyIds: :type prekeyIds: list :return: :rtype:
[ ":", "param", "prekeyIds", ":", ":", "type", "prekeyIds", ":", "list", ":", "return", ":", ":", "rtype", ":" ]
b0739461ba962bf221fc76047d9d60d8ce61bc3e
https://github.com/tgalal/yowsup/blob/b0739461ba962bf221fc76047d9d60d8ce61bc3e/yowsup/axolotl/manager.py#L86-L94
train
Sets the prekeys as sent to the store.
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...
tgalal/yowsup
yowsup/axolotl/manager.py
AxolotlManager.encrypt
def encrypt(self, recipient_id, message): logger.debug("encrypt(recipientid=%s, message=%s)" % (recipient_id, message)) """ :param recipient_id: :type recipient_id: str :param data: :type data: bytes :return: :rtype: """ cipher = self._get_...
python
def encrypt(self, recipient_id, message): logger.debug("encrypt(recipientid=%s, message=%s)" % (recipient_id, message)) """ :param recipient_id: :type recipient_id: str :param data: :type data: bytes :return: :rtype: """ cipher = self._get_...
[ "def", "encrypt", "(", "self", ",", "recipient_id", ",", "message", ")", ":", "logger", ".", "debug", "(", "\"encrypt(recipientid=%s, message=%s)\"", "%", "(", "recipient_id", ",", "message", ")", ")", "cipher", "=", "self", ".", "_get_session_cipher", "(", "r...
:param recipient_id: :type recipient_id: str :param data: :type data: bytes :return: :rtype:
[ ":", "param", "recipient_id", ":", ":", "type", "recipient_id", ":", "str", ":", "param", "data", ":", ":", "type", "data", ":", "bytes", ":", "return", ":", ":", "rtype", ":" ]
b0739461ba962bf221fc76047d9d60d8ce61bc3e
https://github.com/tgalal/yowsup/blob/b0739461ba962bf221fc76047d9d60d8ce61bc3e/yowsup/axolotl/manager.py#L147-L158
train
encrypt the message with the recipient_id
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...
tgalal/yowsup
yowsup/axolotl/manager.py
AxolotlManager.group_encrypt
def group_encrypt(self, groupid, message): """ :param groupid: :type groupid: str :param message: :type message: bytes :return: :rtype: """ logger.debug("group_encrypt(groupid=%s, message=%s)" % (groupid, message)) group_cipher = self._get_...
python
def group_encrypt(self, groupid, message): """ :param groupid: :type groupid: str :param message: :type message: bytes :return: :rtype: """ logger.debug("group_encrypt(groupid=%s, message=%s)" % (groupid, message)) group_cipher = self._get_...
[ "def", "group_encrypt", "(", "self", ",", "groupid", ",", "message", ")", ":", "logger", ".", "debug", "(", "\"group_encrypt(groupid=%s, message=%s)\"", "%", "(", "groupid", ",", "message", ")", ")", "group_cipher", "=", "self", ".", "_get_group_cipher", "(", ...
:param groupid: :type groupid: str :param message: :type message: bytes :return: :rtype:
[ ":", "param", "groupid", ":", ":", "type", "groupid", ":", "str", ":", "param", "message", ":", ":", "type", "message", ":", "bytes", ":", "return", ":", ":", "rtype", ":" ]
b0739461ba962bf221fc76047d9d60d8ce61bc3e
https://github.com/tgalal/yowsup/blob/b0739461ba962bf221fc76047d9d60d8ce61bc3e/yowsup/axolotl/manager.py#L192-L203
train
encrypt a message with a group
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...
tgalal/yowsup
yowsup/axolotl/manager.py
AxolotlManager.group_create_session
def group_create_session(self, groupid, participantid, skmsgdata): """ :param groupid: :type groupid: str :param participantid: :type participantid: str :param skmsgdata: :type skmsgdata: bytearray :return: :rtype: """ logger.debug(...
python
def group_create_session(self, groupid, participantid, skmsgdata): """ :param groupid: :type groupid: str :param participantid: :type participantid: str :param skmsgdata: :type skmsgdata: bytearray :return: :rtype: """ logger.debug(...
[ "def", "group_create_session", "(", "self", ",", "groupid", ",", "participantid", ",", "skmsgdata", ")", ":", "logger", ".", "debug", "(", "\"group_create_session(groupid=%s, participantid=%s, skmsgdata=[omitted])\"", "%", "(", "groupid", ",", "participantid", ")", ")",...
:param groupid: :type groupid: str :param participantid: :type participantid: str :param skmsgdata: :type skmsgdata: bytearray :return: :rtype:
[ ":", "param", "groupid", ":", ":", "type", "groupid", ":", "str", ":", "param", "participantid", ":", ":", "type", "participantid", ":", "str", ":", "param", "skmsgdata", ":", ":", "type", "skmsgdata", ":", "bytearray", ":", "return", ":", ":", "rtype", ...
b0739461ba962bf221fc76047d9d60d8ce61bc3e
https://github.com/tgalal/yowsup/blob/b0739461ba962bf221fc76047d9d60d8ce61bc3e/yowsup/axolotl/manager.py#L220-L235
train
Process a new group session.
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...
tgalal/yowsup
yowsup/axolotl/manager.py
AxolotlManager.create_session
def create_session(self, username, prekeybundle, autotrust=False): """ :param username: :type username: str :param prekeybundle: :type prekeybundle: PreKeyBundle :return: :rtype: """ logger.debug("create_session(username=%s, prekeybunder=[omitted],...
python
def create_session(self, username, prekeybundle, autotrust=False): """ :param username: :type username: str :param prekeybundle: :type prekeybundle: PreKeyBundle :return: :rtype: """ logger.debug("create_session(username=%s, prekeybunder=[omitted],...
[ "def", "create_session", "(", "self", ",", "username", ",", "prekeybundle", ",", "autotrust", "=", "False", ")", ":", "logger", ".", "debug", "(", "\"create_session(username=%s, prekeybunder=[omitted], autotrust=%s)\"", "%", "(", "username", ",", "autotrust", ")", "...
:param username: :type username: str :param prekeybundle: :type prekeybundle: PreKeyBundle :return: :rtype:
[ ":", "param", "username", ":", ":", "type", "username", ":", "str", ":", "param", "prekeybundle", ":", ":", "type", "prekeybundle", ":", "PreKeyBundle", ":", "return", ":", ":", "rtype", ":" ]
b0739461ba962bf221fc76047d9d60d8ce61bc3e
https://github.com/tgalal/yowsup/blob/b0739461ba962bf221fc76047d9d60d8ce61bc3e/yowsup/axolotl/manager.py#L237-L254
train
Create a new session for the 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...
tgalal/yowsup
yowsup/axolotl/manager.py
AxolotlManager.session_exists
def session_exists(self, username): """ :param username: :type username: str :return: :rtype: """ logger.debug("session_exists(%s)?" % username) return self._store.containsSession(username, 1)
python
def session_exists(self, username): """ :param username: :type username: str :return: :rtype: """ logger.debug("session_exists(%s)?" % username) return self._store.containsSession(username, 1)
[ "def", "session_exists", "(", "self", ",", "username", ")", ":", "logger", ".", "debug", "(", "\"session_exists(%s)?\"", "%", "username", ")", "return", "self", ".", "_store", ".", "containsSession", "(", "username", ",", "1", ")" ]
:param username: :type username: str :return: :rtype:
[ ":", "param", "username", ":", ":", "type", "username", ":", "str", ":", "return", ":", ":", "rtype", ":" ]
b0739461ba962bf221fc76047d9d60d8ce61bc3e
https://github.com/tgalal/yowsup/blob/b0739461ba962bf221fc76047d9d60d8ce61bc3e/yowsup/axolotl/manager.py#L256-L264
train
Check if a session exists in the cache.
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...
tgalal/yowsup
yowsup/config/transforms/props.py
PropsTransform.transform
def transform(self, data): """ :param data: :type data: dict :return: :rtype: dict """ out = {} for key, val in data.items(): if key in self._transform_map: target = self._transform_map[key] key, val = target(key...
python
def transform(self, data): """ :param data: :type data: dict :return: :rtype: dict """ out = {} for key, val in data.items(): if key in self._transform_map: target = self._transform_map[key] key, val = target(key...
[ "def", "transform", "(", "self", ",", "data", ")", ":", "out", "=", "{", "}", "for", "key", ",", "val", "in", "data", ".", "items", "(", ")", ":", "if", "key", "in", "self", ".", "_transform_map", ":", "target", "=", "self", ".", "_transform_map", ...
:param data: :type data: dict :return: :rtype: dict
[ ":", "param", "data", ":", ":", "type", "data", ":", "dict", ":", "return", ":", ":", "rtype", ":", "dict" ]
b0739461ba962bf221fc76047d9d60d8ce61bc3e
https://github.com/tgalal/yowsup/blob/b0739461ba962bf221fc76047d9d60d8ce61bc3e/yowsup/config/transforms/props.py#L10-L26
train
Transforms the data dictionary into a dictionary with the keys in the transform_map.
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...
tgalal/yowsup
yowsup/config/manager.py
ConfigManager.load
def load(self, username): """ :param username: :type username: :return: :rtype: """ config_dir = StorageTools.getStorageForPhone(username) logger.debug("Detecting config for username=%s, dir=%s" % (username, config_dir)) exhausted = [] for ...
python
def load(self, username): """ :param username: :type username: :return: :rtype: """ config_dir = StorageTools.getStorageForPhone(username) logger.debug("Detecting config for username=%s, dir=%s" % (username, config_dir)) exhausted = [] for ...
[ "def", "load", "(", "self", ",", "username", ")", ":", "config_dir", "=", "StorageTools", ".", "getStorageForPhone", "(", "username", ")", "logger", ".", "debug", "(", "\"Detecting config for username=%s, dir=%s\"", "%", "(", "username", ",", "config_dir", ")", ...
:param username: :type username: :return: :rtype:
[ ":", "param", "username", ":", ":", "type", "username", ":", ":", "return", ":", ":", "rtype", ":" ]
b0739461ba962bf221fc76047d9d60d8ce61bc3e
https://github.com/tgalal/yowsup/blob/b0739461ba962bf221fc76047d9d60d8ce61bc3e/yowsup/config/manager.py#L33-L56
train
Load the config for a 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...
tgalal/yowsup
yowsup/config/manager.py
ConfigManager._type_to_str
def _type_to_str(self, type): """ :param type: :type type: int :return: :rtype: """ for key, val in self.TYPE_NAMES.items(): if key == type: return val
python
def _type_to_str(self, type): """ :param type: :type type: int :return: :rtype: """ for key, val in self.TYPE_NAMES.items(): if key == type: return val
[ "def", "_type_to_str", "(", "self", ",", "type", ")", ":", "for", "key", ",", "val", "in", "self", ".", "TYPE_NAMES", ".", "items", "(", ")", ":", "if", "key", "==", "type", ":", "return", "val" ]
:param type: :type type: int :return: :rtype:
[ ":", "param", "type", ":", ":", "type", "type", ":", "int", ":", "return", ":", ":", "rtype", ":" ]
b0739461ba962bf221fc76047d9d60d8ce61bc3e
https://github.com/tgalal/yowsup/blob/b0739461ba962bf221fc76047d9d60d8ce61bc3e/yowsup/config/manager.py#L58-L67
train
Convert type to 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...
tgalal/yowsup
yowsup/config/manager.py
ConfigManager.load_path
def load_path(self, path): """ :param path: :type path: :return: :rtype: """ logger.debug("load_path(path=%s)" % path) if os.path.isfile(path): configtype = self.guess_type(path) logger.debug("Detected config type: %s" % self._type_...
python
def load_path(self, path): """ :param path: :type path: :return: :rtype: """ logger.debug("load_path(path=%s)" % path) if os.path.isfile(path): configtype = self.guess_type(path) logger.debug("Detected config type: %s" % self._type_...
[ "def", "load_path", "(", "self", ",", "path", ")", ":", "logger", ".", "debug", "(", "\"load_path(path=%s)\"", "%", "path", ")", "if", "os", ".", "path", ".", "isfile", "(", "path", ")", ":", "configtype", "=", "self", ".", "guess_type", "(", "path", ...
:param path: :type path: :return: :rtype:
[ ":", "param", "path", ":", ":", "type", "path", ":", ":", "return", ":", ":", "rtype", ":" ]
b0739461ba962bf221fc76047d9d60d8ce61bc3e
https://github.com/tgalal/yowsup/blob/b0739461ba962bf221fc76047d9d60d8ce61bc3e/yowsup/config/manager.py#L69-L89
train
Load the data from a file or directory.
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...
tgalal/yowsup
yowsup/layers/axolotl/layer_control.py
AxolotlControlLayer.receive
def receive(self, protocolTreeNode): """ :type protocolTreeNode: ProtocolTreeNode """ if not self.processIqRegistry(protocolTreeNode): if protocolTreeNode.tag == "notification" and protocolTreeNode["type"] == "encrypt": self.onEncryptNotification(protocolTreeN...
python
def receive(self, protocolTreeNode): """ :type protocolTreeNode: ProtocolTreeNode """ if not self.processIqRegistry(protocolTreeNode): if protocolTreeNode.tag == "notification" and protocolTreeNode["type"] == "encrypt": self.onEncryptNotification(protocolTreeN...
[ "def", "receive", "(", "self", ",", "protocolTreeNode", ")", ":", "if", "not", "self", ".", "processIqRegistry", "(", "protocolTreeNode", ")", ":", "if", "protocolTreeNode", ".", "tag", "==", "\"notification\"", "and", "protocolTreeNode", "[", "\"type\"", "]", ...
:type protocolTreeNode: ProtocolTreeNode
[ ":", "type", "protocolTreeNode", ":", "ProtocolTreeNode" ]
b0739461ba962bf221fc76047d9d60d8ce61bc3e
https://github.com/tgalal/yowsup/blob/b0739461ba962bf221fc76047d9d60d8ce61bc3e/yowsup/layers/axolotl/layer_control.py#L24-L32
train
This method is called when a node is received from the iQ Registry.
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...
tgalal/yowsup
yowsup/layers/axolotl/layer_control.py
AxolotlControlLayer.flush_keys
def flush_keys(self, signed_prekey, prekeys, reboot_connection=False): """ sends prekeys :return: :rtype: """ preKeysDict = {} for prekey in prekeys: keyPair = prekey.getKeyPair() preKeysDict[self.adjustId(prekey.getId())] = self.adjustArra...
python
def flush_keys(self, signed_prekey, prekeys, reboot_connection=False): """ sends prekeys :return: :rtype: """ preKeysDict = {} for prekey in prekeys: keyPair = prekey.getKeyPair() preKeysDict[self.adjustId(prekey.getId())] = self.adjustArra...
[ "def", "flush_keys", "(", "self", ",", "signed_prekey", ",", "prekeys", ",", "reboot_connection", "=", "False", ")", ":", "preKeysDict", "=", "{", "}", "for", "prekey", "in", "prekeys", ":", "keyPair", "=", "prekey", ".", "getKeyPair", "(", ")", "preKeysDi...
sends prekeys :return: :rtype:
[ "sends", "prekeys", ":", "return", ":", ":", "rtype", ":" ]
b0739461ba962bf221fc76047d9d60d8ce61bc3e
https://github.com/tgalal/yowsup/blob/b0739461ba962bf221fc76047d9d60d8ce61bc3e/yowsup/layers/axolotl/layer_control.py#L72-L98
train
Sends a SetKeysIqProtocolEntity to the server to flush the keys in the specified list of prekeys.
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...
tgalal/yowsup
yowsup/stacks/yowstack.py
YowStackBuilder.getDefaultStack
def getDefaultStack(layer = None, axolotl = False, groups = True, media = True, privacy = True, profiles = True): """ :param layer: An optional layer to put on top of default stack :param axolotl: E2E encryption enabled/ disabled :return: YowStack """ allLayers = YowStac...
python
def getDefaultStack(layer = None, axolotl = False, groups = True, media = True, privacy = True, profiles = True): """ :param layer: An optional layer to put on top of default stack :param axolotl: E2E encryption enabled/ disabled :return: YowStack """ allLayers = YowStac...
[ "def", "getDefaultStack", "(", "layer", "=", "None", ",", "axolotl", "=", "False", ",", "groups", "=", "True", ",", "media", "=", "True", ",", "privacy", "=", "True", ",", "profiles", "=", "True", ")", ":", "allLayers", "=", "YowStackBuilder", ".", "ge...
:param layer: An optional layer to put on top of default stack :param axolotl: E2E encryption enabled/ disabled :return: YowStack
[ ":", "param", "layer", ":", "An", "optional", "layer", "to", "put", "on", "top", "of", "default", "stack", ":", "param", "axolotl", ":", "E2E", "encryption", "enabled", "/", "disabled", ":", "return", ":", "YowStack" ]
b0739461ba962bf221fc76047d9d60d8ce61bc3e
https://github.com/tgalal/yowsup/blob/b0739461ba962bf221fc76047d9d60d8ce61bc3e/yowsup/stacks/yowstack.py#L82-L94
train
Returns a new YowStack instance with the default layers added.
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...
tgalal/yowsup
yowsup/layers/interface/interface.py
YowInterfaceLayer.processIqRegistry
def processIqRegistry(self, entity): """ :type entity: IqProtocolEntity """ if entity.getTag() == "iq": iq_id = entity.getId() if iq_id in self.iqRegistry: originalIq, successClbk, errorClbk = self.iqRegistry[iq_id] del self.iqRegis...
python
def processIqRegistry(self, entity): """ :type entity: IqProtocolEntity """ if entity.getTag() == "iq": iq_id = entity.getId() if iq_id in self.iqRegistry: originalIq, successClbk, errorClbk = self.iqRegistry[iq_id] del self.iqRegis...
[ "def", "processIqRegistry", "(", "self", ",", "entity", ")", ":", "if", "entity", ".", "getTag", "(", ")", "==", "\"iq\"", ":", "iq_id", "=", "entity", ".", "getId", "(", ")", "if", "iq_id", "in", "self", ".", "iqRegistry", ":", "originalIq", ",", "s...
:type entity: IqProtocolEntity
[ ":", "type", "entity", ":", "IqProtocolEntity" ]
b0739461ba962bf221fc76047d9d60d8ce61bc3e
https://github.com/tgalal/yowsup/blob/b0739461ba962bf221fc76047d9d60d8ce61bc3e/yowsup/layers/interface/interface.py#L45-L61
train
Process the IqRegistry.
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...
tgalal/yowsup
yowsup/config/transforms/dict_keyval.py
DictKeyValTransform.transform
def transform(self, data): """ :param data: :type data: dict :return: :rtype: """ out=[] keys = sorted(data.keys()) for k in keys: out.append("%s=%s" % (k, data[k])) return "\n".join(out)
python
def transform(self, data): """ :param data: :type data: dict :return: :rtype: """ out=[] keys = sorted(data.keys()) for k in keys: out.append("%s=%s" % (k, data[k])) return "\n".join(out)
[ "def", "transform", "(", "self", ",", "data", ")", ":", "out", "=", "[", "]", "keys", "=", "sorted", "(", "data", ".", "keys", "(", ")", ")", "for", "k", "in", "keys", ":", "out", ".", "append", "(", "\"%s=%s\"", "%", "(", "k", ",", "data", "...
:param data: :type data: dict :return: :rtype:
[ ":", "param", "data", ":", ":", "type", "data", ":", "dict", ":", "return", ":", ":", "rtype", ":" ]
b0739461ba962bf221fc76047d9d60d8ce61bc3e
https://github.com/tgalal/yowsup/blob/b0739461ba962bf221fc76047d9d60d8ce61bc3e/yowsup/config/transforms/dict_keyval.py#L5-L16
train
Transform a dictionary of key = value pairs into a 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...
tgalal/yowsup
yowsup/config/base/serialize.py
ConfigSerialize.serialize
def serialize(self, config): """ :param config: :type config: yowsup.config.base.config.Config :return: :rtype: bytes """ for transform in self._transforms: config = transform.transform(config) return config
python
def serialize(self, config): """ :param config: :type config: yowsup.config.base.config.Config :return: :rtype: bytes """ for transform in self._transforms: config = transform.transform(config) return config
[ "def", "serialize", "(", "self", ",", "config", ")", ":", "for", "transform", "in", "self", ".", "_transforms", ":", "config", "=", "transform", ".", "transform", "(", "config", ")", "return", "config" ]
:param config: :type config: yowsup.config.base.config.Config :return: :rtype: bytes
[ ":", "param", "config", ":", ":", "type", "config", ":", "yowsup", ".", "config", ".", "base", ".", "config", ".", "Config", ":", "return", ":", ":", "rtype", ":", "bytes" ]
b0739461ba962bf221fc76047d9d60d8ce61bc3e
https://github.com/tgalal/yowsup/blob/b0739461ba962bf221fc76047d9d60d8ce61bc3e/yowsup/config/base/serialize.py#L6-L15
train
Serialize a config object to bytes.
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...
tgalal/yowsup
yowsup/config/base/serialize.py
ConfigSerialize.deserialize
def deserialize(self, data): """ :type cls: type :param data: :type data: bytes :return: :rtype: yowsup.config.base.config.Config """ for transform in self._transforms[::-1]: data = transform.reverse(data) return data
python
def deserialize(self, data): """ :type cls: type :param data: :type data: bytes :return: :rtype: yowsup.config.base.config.Config """ for transform in self._transforms[::-1]: data = transform.reverse(data) return data
[ "def", "deserialize", "(", "self", ",", "data", ")", ":", "for", "transform", "in", "self", ".", "_transforms", "[", ":", ":", "-", "1", "]", ":", "data", "=", "transform", ".", "reverse", "(", "data", ")", "return", "data" ]
:type cls: type :param data: :type data: bytes :return: :rtype: yowsup.config.base.config.Config
[ ":", "type", "cls", ":", "type", ":", "param", "data", ":", ":", "type", "data", ":", "bytes", ":", "return", ":", ":", "rtype", ":", "yowsup", ".", "config", ".", "base", ".", "config", ".", "Config" ]
b0739461ba962bf221fc76047d9d60d8ce61bc3e
https://github.com/tgalal/yowsup/blob/b0739461ba962bf221fc76047d9d60d8ce61bc3e/yowsup/config/base/serialize.py#L17-L27
train
Deserialize a set of items from bytes.
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...
tgalal/yowsup
yowsup/axolotl/store/sqlite/litesenderkeystore.py
LiteSenderKeyStore.storeSenderKey
def storeSenderKey(self, senderKeyName, senderKeyRecord): """ :type senderKeyName: SenderKeName :type senderKeyRecord: SenderKeyRecord """ q = "INSERT INTO sender_keys (group_id, sender_id, record) VALUES(?,?, ?)" cursor = self.dbConn.cursor() serialized = senderK...
python
def storeSenderKey(self, senderKeyName, senderKeyRecord): """ :type senderKeyName: SenderKeName :type senderKeyRecord: SenderKeyRecord """ q = "INSERT INTO sender_keys (group_id, sender_id, record) VALUES(?,?, ?)" cursor = self.dbConn.cursor() serialized = senderK...
[ "def", "storeSenderKey", "(", "self", ",", "senderKeyName", ",", "senderKeyRecord", ")", ":", "q", "=", "\"INSERT INTO sender_keys (group_id, sender_id, record) VALUES(?,?, ?)\"", "cursor", "=", "self", ".", "dbConn", ".", "cursor", "(", ")", "serialized", "=", "sende...
:type senderKeyName: SenderKeName :type senderKeyRecord: SenderKeyRecord
[ ":", "type", "senderKeyName", ":", "SenderKeName", ":", "type", "senderKeyRecord", ":", "SenderKeyRecord" ]
b0739461ba962bf221fc76047d9d60d8ce61bc3e
https://github.com/tgalal/yowsup/blob/b0739461ba962bf221fc76047d9d60d8ce61bc3e/yowsup/axolotl/store/sqlite/litesenderkeystore.py#L17-L34
train
Store the given sender key in the database.
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...
tgalal/yowsup
yowsup/axolotl/store/sqlite/litesenderkeystore.py
LiteSenderKeyStore.loadSenderKey
def loadSenderKey(self, senderKeyName): """ :type senderKeyName: SenderKeyName """ q = "SELECT record FROM sender_keys WHERE group_id = ? and sender_id = ?" cursor = self.dbConn.cursor() cursor.execute(q, (senderKeyName.getGroupId(), senderKeyName.getSender().getName())) ...
python
def loadSenderKey(self, senderKeyName): """ :type senderKeyName: SenderKeyName """ q = "SELECT record FROM sender_keys WHERE group_id = ? and sender_id = ?" cursor = self.dbConn.cursor() cursor.execute(q, (senderKeyName.getGroupId(), senderKeyName.getSender().getName())) ...
[ "def", "loadSenderKey", "(", "self", ",", "senderKeyName", ")", ":", "q", "=", "\"SELECT record FROM sender_keys WHERE group_id = ? and sender_id = ?\"", "cursor", "=", "self", ".", "dbConn", ".", "cursor", "(", ")", "cursor", ".", "execute", "(", "q", ",", "(", ...
:type senderKeyName: SenderKeyName
[ ":", "type", "senderKeyName", ":", "SenderKeyName" ]
b0739461ba962bf221fc76047d9d60d8ce61bc3e
https://github.com/tgalal/yowsup/blob/b0739461ba962bf221fc76047d9d60d8ce61bc3e/yowsup/axolotl/store/sqlite/litesenderkeystore.py#L36-L47
train
Load the sender key record for the given senderKeyName.
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...
tgalal/yowsup
yowsup/layers/protocol_media/layer.py
YowMediaProtocolLayer.sendIq
def sendIq(self, entity): """ :type entity: IqProtocolEntity """ if entity.getType() == IqProtocolEntity.TYPE_SET and entity.getXmlns() == "w:m": #media upload! self._sendIq(entity, self.onRequestUploadSuccess, self.onRequestUploadError)
python
def sendIq(self, entity): """ :type entity: IqProtocolEntity """ if entity.getType() == IqProtocolEntity.TYPE_SET and entity.getXmlns() == "w:m": #media upload! self._sendIq(entity, self.onRequestUploadSuccess, self.onRequestUploadError)
[ "def", "sendIq", "(", "self", ",", "entity", ")", ":", "if", "entity", ".", "getType", "(", ")", "==", "IqProtocolEntity", ".", "TYPE_SET", "and", "entity", ".", "getXmlns", "(", ")", "==", "\"w:m\"", ":", "#media upload!", "self", ".", "_sendIq", "(", ...
:type entity: IqProtocolEntity
[ ":", "type", "entity", ":", "IqProtocolEntity" ]
b0739461ba962bf221fc76047d9d60d8ce61bc3e
https://github.com/tgalal/yowsup/blob/b0739461ba962bf221fc76047d9d60d8ce61bc3e/yowsup/layers/protocol_media/layer.py#L56-L62
train
Sends an IQ to 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...
tgalal/yowsup
yowsup/layers/axolotl/layer_receive.py
AxolotlReceivelayer.receive
def receive(self, protocolTreeNode): """ :type protocolTreeNode: ProtocolTreeNode """ if not self.processIqRegistry(protocolTreeNode): if protocolTreeNode.tag == "message": self.onMessage(protocolTreeNode) elif not protocolTreeNode.tag == "receipt"...
python
def receive(self, protocolTreeNode): """ :type protocolTreeNode: ProtocolTreeNode """ if not self.processIqRegistry(protocolTreeNode): if protocolTreeNode.tag == "message": self.onMessage(protocolTreeNode) elif not protocolTreeNode.tag == "receipt"...
[ "def", "receive", "(", "self", ",", "protocolTreeNode", ")", ":", "if", "not", "self", ".", "processIqRegistry", "(", "protocolTreeNode", ")", ":", "if", "protocolTreeNode", ".", "tag", "==", "\"message\"", ":", "self", ".", "onMessage", "(", "protocolTreeNode...
:type protocolTreeNode: ProtocolTreeNode
[ ":", "type", "protocolTreeNode", ":", "ProtocolTreeNode" ]
b0739461ba962bf221fc76047d9d60d8ce61bc3e
https://github.com/tgalal/yowsup/blob/b0739461ba962bf221fc76047d9d60d8ce61bc3e/yowsup/layers/axolotl/layer_receive.py#L25-L34
train
Process a node and process 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...
tgalal/yowsup
yowsup/layers/noise/layer.py
YowNoiseLayer.send
def send(self, data): """ :param data: :type data: bytearray | bytes :return: :rtype: """ data = bytes(data) if type(data) is not bytes else data self._wa_noiseprotocol.send(data)
python
def send(self, data): """ :param data: :type data: bytearray | bytes :return: :rtype: """ data = bytes(data) if type(data) is not bytes else data self._wa_noiseprotocol.send(data)
[ "def", "send", "(", "self", ",", "data", ")", ":", "data", "=", "bytes", "(", "data", ")", "if", "type", "(", "data", ")", "is", "not", "bytes", "else", "data", "self", ".", "_wa_noiseprotocol", ".", "send", "(", "data", ")" ]
:param data: :type data: bytearray | bytes :return: :rtype:
[ ":", "param", "data", ":", ":", "type", "data", ":", "bytearray", "|", "bytes", ":", "return", ":", ":", "rtype", ":" ]
b0739461ba962bf221fc76047d9d60d8ce61bc3e
https://github.com/tgalal/yowsup/blob/b0739461ba962bf221fc76047d9d60d8ce61bc3e/yowsup/layers/noise/layer.py#L131-L139
train
Send data to the WA noise 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...
tgalal/yowsup
yowsup/layers/noise/layer.py
YowNoiseLayer.receive
def receive(self, data): """ :param data: :type data: bytes :return: :rtype: """ self._incoming_segments_queue.put(data) if not self._in_handshake(): self._flush_incoming_buffer()
python
def receive(self, data): """ :param data: :type data: bytes :return: :rtype: """ self._incoming_segments_queue.put(data) if not self._in_handshake(): self._flush_incoming_buffer()
[ "def", "receive", "(", "self", ",", "data", ")", ":", "self", ".", "_incoming_segments_queue", ".", "put", "(", "data", ")", "if", "not", "self", ".", "_in_handshake", "(", ")", ":", "self", ".", "_flush_incoming_buffer", "(", ")" ]
:param data: :type data: bytes :return: :rtype:
[ ":", "param", "data", ":", ":", "type", "data", ":", "bytes", ":", "return", ":", ":", "rtype", ":" ]
b0739461ba962bf221fc76047d9d60d8ce61bc3e
https://github.com/tgalal/yowsup/blob/b0739461ba962bf221fc76047d9d60d8ce61bc3e/yowsup/layers/noise/layer.py#L147-L156
train
Receives data from the broker.
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...
tgalal/yowsup
yowsup/env/env.py
YowsupEnv.getCurrent
def getCurrent(cls): """ :rtype: YowsupEnv """ if cls.__CURR is None: env = DEFAULT envs = cls.getRegisteredEnvs() if env not in envs: env = envs[0] logger.debug("Env not set, setting it to %s" % env) cls.setEnv(...
python
def getCurrent(cls): """ :rtype: YowsupEnv """ if cls.__CURR is None: env = DEFAULT envs = cls.getRegisteredEnvs() if env not in envs: env = envs[0] logger.debug("Env not set, setting it to %s" % env) cls.setEnv(...
[ "def", "getCurrent", "(", "cls", ")", ":", "if", "cls", ".", "__CURR", "is", "None", ":", "env", "=", "DEFAULT", "envs", "=", "cls", ".", "getRegisteredEnvs", "(", ")", "if", "env", "not", "in", "envs", ":", "env", "=", "envs", "[", "0", "]", "lo...
:rtype: YowsupEnv
[ ":", "rtype", ":", "YowsupEnv" ]
b0739461ba962bf221fc76047d9d60d8ce61bc3e
https://github.com/tgalal/yowsup/blob/b0739461ba962bf221fc76047d9d60d8ce61bc3e/yowsup/env/env.py#L49-L60
train
Returns the current YowsupEnv instance.
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...
tgalal/yowsup
yowsup/common/http/warequest.py
WARequest.encryptParams
def encryptParams(self, params, key): """ :param params: :type params: list :param key: :type key: ECPublicKey :return: :rtype: list """ keypair = Curve.generateKeyPair() encodedparams = self.urlencodeParams(params) cipher = AESGCM...
python
def encryptParams(self, params, key): """ :param params: :type params: list :param key: :type key: ECPublicKey :return: :rtype: list """ keypair = Curve.generateKeyPair() encodedparams = self.urlencodeParams(params) cipher = AESGCM...
[ "def", "encryptParams", "(", "self", ",", "params", ",", "key", ")", ":", "keypair", "=", "Curve", ".", "generateKeyPair", "(", ")", "encodedparams", "=", "self", ".", "urlencodeParams", "(", "params", ")", "cipher", "=", "AESGCM", "(", "Curve", ".", "ca...
:param params: :type params: list :param key: :type key: ECPublicKey :return: :rtype: list
[ ":", "param", "params", ":", ":", "type", "params", ":", "list", ":", "param", "key", ":", ":", "type", "key", ":", "ECPublicKey", ":", "return", ":", ":", "rtype", ":", "list" ]
b0739461ba962bf221fc76047d9d60d8ce61bc3e
https://github.com/tgalal/yowsup/blob/b0739461ba962bf221fc76047d9d60d8ce61bc3e/yowsup/common/http/warequest.py#L159-L175
train
This method encrypts the params and returns the ciphertext.
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...
tgalal/yowsup
yowsup/axolotl/store/sqlite/liteprekeystore.py
LitePreKeyStore.setAsSent
def setAsSent(self, prekeyIds): """ :param preKeyIds: :type preKeyIds: list :return: :rtype: """ for prekeyId in prekeyIds: q = "UPDATE prekeys SET sent_to_server = ? WHERE prekey_id = ?" cursor = self.dbConn.cursor() cursor.exe...
python
def setAsSent(self, prekeyIds): """ :param preKeyIds: :type preKeyIds: list :return: :rtype: """ for prekeyId in prekeyIds: q = "UPDATE prekeys SET sent_to_server = ? WHERE prekey_id = ?" cursor = self.dbConn.cursor() cursor.exe...
[ "def", "setAsSent", "(", "self", ",", "prekeyIds", ")", ":", "for", "prekeyId", "in", "prekeyIds", ":", "q", "=", "\"UPDATE prekeys SET sent_to_server = ? WHERE prekey_id = ?\"", "cursor", "=", "self", ".", "dbConn", ".", "cursor", "(", ")", "cursor", ".", "exec...
:param preKeyIds: :type preKeyIds: list :return: :rtype:
[ ":", "param", "preKeyIds", ":", ":", "type", "preKeyIds", ":", "list", ":", "return", ":", ":", "rtype", ":" ]
b0739461ba962bf221fc76047d9d60d8ce61bc3e
https://github.com/tgalal/yowsup/blob/b0739461ba962bf221fc76047d9d60d8ce61bc3e/yowsup/axolotl/store/sqlite/liteprekeystore.py#L35-L46
train
Set the prekey ids as sent to 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...
tgalal/yowsup
yowsup/config/transforms/config_dict.py
ConfigDictTransform.transform
def transform(self, config): """ :param config: :type config: dict :return: :rtype: yowsup.config.config.Config """ out = {} for prop in vars(config): out[prop] = getattr(config, prop) return out
python
def transform(self, config): """ :param config: :type config: dict :return: :rtype: yowsup.config.config.Config """ out = {} for prop in vars(config): out[prop] = getattr(config, prop) return out
[ "def", "transform", "(", "self", ",", "config", ")", ":", "out", "=", "{", "}", "for", "prop", "in", "vars", "(", "config", ")", ":", "out", "[", "prop", "]", "=", "getattr", "(", "config", ",", "prop", ")", "return", "out" ]
:param config: :type config: dict :return: :rtype: yowsup.config.config.Config
[ ":", "param", "config", ":", ":", "type", "config", ":", "dict", ":", "return", ":", ":", "rtype", ":", "yowsup", ".", "config", ".", "config", ".", "Config" ]
b0739461ba962bf221fc76047d9d60d8ce61bc3e
https://github.com/tgalal/yowsup/blob/b0739461ba962bf221fc76047d9d60d8ce61bc3e/yowsup/config/transforms/config_dict.py#L8-L18
train
Transform the configuration dictionary into a dictionary of key - value pairs.
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...
darknessomi/musicbox
NEMbox/utils.py
notify
def notify(msg, msg_type=0, t=None): msg = msg.replace('"', '\\"') "Show system notification with duration t (ms)" if platform.system() == "Darwin": command = notify_command_osx(msg, msg_type, t) else: command = notify_command_linux(msg, t) try: subprocess.call(command) ...
python
def notify(msg, msg_type=0, t=None): msg = msg.replace('"', '\\"') "Show system notification with duration t (ms)" if platform.system() == "Darwin": command = notify_command_osx(msg, msg_type, t) else: command = notify_command_linux(msg, t) try: subprocess.call(command) ...
[ "def", "notify", "(", "msg", ",", "msg_type", "=", "0", ",", "t", "=", "None", ")", ":", "msg", "=", "msg", ".", "replace", "(", "'\"'", ",", "'\\\\\"'", ")", "if", "platform", ".", "system", "(", ")", "==", "\"Darwin\"", ":", "command", "=", "no...
Show system notification with duration t (ms)
[ "Show", "system", "notification", "with", "duration", "t", "(", "ms", ")" ]
9d58201fa2fefcee99d34d2c7fcc7a57d1e45937
https://github.com/darknessomi/musicbox/blob/9d58201fa2fefcee99d34d2c7fcc7a57d1e45937/NEMbox/utils.py#L71-L83
train
Show system notification with duration t ( ms
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...
darknessomi/musicbox
NEMbox/player.py
Player.start_playing
def start_playing(self, on_exit, args): """ Runs the given args in subprocess.Popen, and then calls the function on_exit when the subprocess completes. on_exit is a callable object, and args is a lists/tuple of args that would give to subprocess.Popen. """ # log.d...
python
def start_playing(self, on_exit, args): """ Runs the given args in subprocess.Popen, and then calls the function on_exit when the subprocess completes. on_exit is a callable object, and args is a lists/tuple of args that would give to subprocess.Popen. """ # log.d...
[ "def", "start_playing", "(", "self", ",", "on_exit", ",", "args", ")", ":", "# log.debug(\"%s,%s,%s\" % (args['song_id'], args['song_name'], args['mp3_url']))", "if", "\"cache\"", "in", "args", ".", "keys", "(", ")", "and", "os", ".", "path", ".", "isfile", "(", "...
Runs the given args in subprocess.Popen, and then calls the function on_exit when the subprocess completes. on_exit is a callable object, and args is a lists/tuple of args that would give to subprocess.Popen.
[ "Runs", "the", "given", "args", "in", "subprocess", ".", "Popen", "and", "then", "calls", "the", "function", "on_exit", "when", "the", "subprocess", "completes", ".", "on_exit", "is", "a", "callable", "object", "and", "args", "is", "a", "lists", "/", "tupl...
9d58201fa2fefcee99d34d2c7fcc7a57d1e45937
https://github.com/darknessomi/musicbox/blob/9d58201fa2fefcee99d34d2c7fcc7a57d1e45937/NEMbox/player.py#L309-L348
train
Starts the main thread that downloads the song and lyrics from the mp3.
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...
ninja-build/ninja
misc/ninja_syntax.py
expand
def expand(string, vars, local_vars={}): """Expand a string containing $vars as Ninja would. Note: doesn't handle the full Ninja variable syntax, but it's enough to make configure.py's use of it work. """ def exp(m): var = m.group(1) if var == '$': return '$' ret...
python
def expand(string, vars, local_vars={}): """Expand a string containing $vars as Ninja would. Note: doesn't handle the full Ninja variable syntax, but it's enough to make configure.py's use of it work. """ def exp(m): var = m.group(1) if var == '$': return '$' ret...
[ "def", "expand", "(", "string", ",", "vars", ",", "local_vars", "=", "{", "}", ")", ":", "def", "exp", "(", "m", ")", ":", "var", "=", "m", ".", "group", "(", "1", ")", "if", "var", "==", "'$'", ":", "return", "'$'", "return", "local_vars", "."...
Expand a string containing $vars as Ninja would. Note: doesn't handle the full Ninja variable syntax, but it's enough to make configure.py's use of it work.
[ "Expand", "a", "string", "containing", "$vars", "as", "Ninja", "would", "." ]
2e64645749ff91eff2f999f03f55da360ae5913d
https://github.com/ninja-build/ninja/blob/2e64645749ff91eff2f999f03f55da360ae5913d/misc/ninja_syntax.py#L172-L183
train
Expand a string containing a set of variables as Ninja would.
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...
ninja-build/ninja
misc/ninja_syntax.py
Writer._count_dollars_before_index
def _count_dollars_before_index(self, s, i): """Returns the number of '$' characters right in front of s[i].""" dollar_count = 0 dollar_index = i - 1 while dollar_index > 0 and s[dollar_index] == '$': dollar_count += 1 dollar_index -= 1 return dollar_count
python
def _count_dollars_before_index(self, s, i): """Returns the number of '$' characters right in front of s[i].""" dollar_count = 0 dollar_index = i - 1 while dollar_index > 0 and s[dollar_index] == '$': dollar_count += 1 dollar_index -= 1 return dollar_count
[ "def", "_count_dollars_before_index", "(", "self", ",", "s", ",", "i", ")", ":", "dollar_count", "=", "0", "dollar_index", "=", "i", "-", "1", "while", "dollar_index", ">", "0", "and", "s", "[", "dollar_index", "]", "==", "'$'", ":", "dollar_count", "+="...
Returns the number of '$' characters right in front of s[i].
[ "Returns", "the", "number", "of", "$", "characters", "right", "in", "front", "of", "s", "[", "i", "]", "." ]
2e64645749ff91eff2f999f03f55da360ae5913d
https://github.com/ninja-build/ninja/blob/2e64645749ff91eff2f999f03f55da360ae5913d/misc/ninja_syntax.py#L107-L114
train
Returns the number of dollar characters right in front of s [ i.
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...
ninja-build/ninja
misc/ninja_syntax.py
Writer._line
def _line(self, text, indent=0): """Write 'text' word-wrapped at self.width characters.""" leading_space = ' ' * indent while len(leading_space) + len(text) > self.width: # The text is too wide; wrap if possible. # Find the rightmost space that would obey our width cons...
python
def _line(self, text, indent=0): """Write 'text' word-wrapped at self.width characters.""" leading_space = ' ' * indent while len(leading_space) + len(text) > self.width: # The text is too wide; wrap if possible. # Find the rightmost space that would obey our width cons...
[ "def", "_line", "(", "self", ",", "text", ",", "indent", "=", "0", ")", ":", "leading_space", "=", "' '", "*", "indent", "while", "len", "(", "leading_space", ")", "+", "len", "(", "text", ")", ">", "self", ".", "width", ":", "# The text is too wide; ...
Write 'text' word-wrapped at self.width characters.
[ "Write", "text", "word", "-", "wrapped", "at", "self", ".", "width", "characters", "." ]
2e64645749ff91eff2f999f03f55da360ae5913d
https://github.com/ninja-build/ninja/blob/2e64645749ff91eff2f999f03f55da360ae5913d/misc/ninja_syntax.py#L116-L150
train
Write text word - wrapped at self. width characters.
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...
ninja-build/ninja
configure.py
Bootstrap._expand_paths
def _expand_paths(self, paths): """Expand $vars in an array of paths, e.g. from a 'build' block.""" paths = ninja_syntax.as_list(paths) return ' '.join(map(self._shell_escape, (map(self._expand, paths))))
python
def _expand_paths(self, paths): """Expand $vars in an array of paths, e.g. from a 'build' block.""" paths = ninja_syntax.as_list(paths) return ' '.join(map(self._shell_escape, (map(self._expand, paths))))
[ "def", "_expand_paths", "(", "self", ",", "paths", ")", ":", "paths", "=", "ninja_syntax", ".", "as_list", "(", "paths", ")", "return", "' '", ".", "join", "(", "map", "(", "self", ".", "_shell_escape", ",", "(", "map", "(", "self", ".", "_expand", "...
Expand $vars in an array of paths, e.g. from a 'build' block.
[ "Expand", "$vars", "in", "an", "array", "of", "paths", "e", ".", "g", ".", "from", "a", "build", "block", "." ]
2e64645749ff91eff2f999f03f55da360ae5913d
https://github.com/ninja-build/ninja/blob/2e64645749ff91eff2f999f03f55da360ae5913d/configure.py#L171-L174
train
Expand the paths in an array of paths e. g. from a build block.
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...