id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
48,900
saeschdivara/ArangoPy
arangodb/query/simple.py
SimpleIndexQuery.get_by_example_skiplist
def get_by_example_skiplist(cls, collection, index_id, example_data, allow_multiple=True, skip=None, limit=None): """ This will find all documents matching a given example, using the specified skiplist index. :param collection Collection instance :param index_id ID of the in...
python
def get_by_example_skiplist(cls, collection, index_id, example_data, allow_multiple=True, skip=None, limit=None): """ This will find all documents matching a given example, using the specified skiplist index. :param collection Collection instance :param index_id ID of the in...
[ "def", "get_by_example_skiplist", "(", "cls", ",", "collection", ",", "index_id", ",", "example_data", ",", "allow_multiple", "=", "True", ",", "skip", "=", "None", ",", "limit", "=", "None", ")", ":", "kwargs", "=", "{", "'index'", ":", "index_id", ",", ...
This will find all documents matching a given example, using the specified skiplist index. :param collection Collection instance :param index_id ID of the index which should be used for the query :param example_data The example document :param allow_multiple If the query...
[ "This", "will", "find", "all", "documents", "matching", "a", "given", "example", "using", "the", "specified", "skiplist", "index", "." ]
b924cc57bed71520fc2ef528b917daeb98e10eca
https://github.com/saeschdivara/ArangoPy/blob/b924cc57bed71520fc2ef528b917daeb98e10eca/arangodb/query/simple.py#L256-L278
48,901
saeschdivara/ArangoPy
arangodb/query/simple.py
SimpleIndexQuery.range
def range(cls, collection, attribute, left, right, closed, index_id, skip=None, limit=None): """ This will find all documents within a given range. In order to execute a range query, a skip-list index on the queried attribute must be present. :param collection Collection ins...
python
def range(cls, collection, attribute, left, right, closed, index_id, skip=None, limit=None): """ This will find all documents within a given range. In order to execute a range query, a skip-list index on the queried attribute must be present. :param collection Collection ins...
[ "def", "range", "(", "cls", ",", "collection", ",", "attribute", ",", "left", ",", "right", ",", "closed", ",", "index_id", ",", "skip", "=", "None", ",", "limit", "=", "None", ")", ":", "kwargs", "=", "{", "'index'", ":", "index_id", ",", "'attribut...
This will find all documents within a given range. In order to execute a range query, a skip-list index on the queried attribute must be present. :param collection Collection instance :param attribute The attribute path to check :param left The lower bound :p...
[ "This", "will", "find", "all", "documents", "within", "a", "given", "range", ".", "In", "order", "to", "execute", "a", "range", "query", "a", "skip", "-", "list", "index", "on", "the", "queried", "attribute", "must", "be", "present", "." ]
b924cc57bed71520fc2ef528b917daeb98e10eca
https://github.com/saeschdivara/ArangoPy/blob/b924cc57bed71520fc2ef528b917daeb98e10eca/arangodb/query/simple.py#L281-L310
48,902
saeschdivara/ArangoPy
arangodb/query/simple.py
SimpleIndexQuery.fulltext
def fulltext(cls, collection, attribute, example_text, index_id, skip=None, limit=None): """ This will find all documents from the collection that match the fulltext query specified in query. In order to use the fulltext operator, a fulltext index must be defined for the collection ...
python
def fulltext(cls, collection, attribute, example_text, index_id, skip=None, limit=None): """ This will find all documents from the collection that match the fulltext query specified in query. In order to use the fulltext operator, a fulltext index must be defined for the collection ...
[ "def", "fulltext", "(", "cls", ",", "collection", ",", "attribute", ",", "example_text", ",", "index_id", ",", "skip", "=", "None", ",", "limit", "=", "None", ")", ":", "kwargs", "=", "{", "'index'", ":", "index_id", ",", "'attribute'", ":", "attribute",...
This will find all documents from the collection that match the fulltext query specified in query. In order to use the fulltext operator, a fulltext index must be defined for the collection and the specified attribute. :param collection Collection instance :param attrib...
[ "This", "will", "find", "all", "documents", "from", "the", "collection", "that", "match", "the", "fulltext", "query", "specified", "in", "query", "." ]
b924cc57bed71520fc2ef528b917daeb98e10eca
https://github.com/saeschdivara/ArangoPy/blob/b924cc57bed71520fc2ef528b917daeb98e10eca/arangodb/query/simple.py#L313-L340
48,903
saeschdivara/ArangoPy
arangodb/query/simple.py
SimpleIndexQuery.near
def near(cls, collection, latitude, longitude, index_id, distance=None, skip=None, limit=None): """ The default will find at most 100 documents near the given coordinate. The returned list is sorted according to the distance, with the nearest document being first in the list. ...
python
def near(cls, collection, latitude, longitude, index_id, distance=None, skip=None, limit=None): """ The default will find at most 100 documents near the given coordinate. The returned list is sorted according to the distance, with the nearest document being first in the list. ...
[ "def", "near", "(", "cls", ",", "collection", ",", "latitude", ",", "longitude", ",", "index_id", ",", "distance", "=", "None", ",", "skip", "=", "None", ",", "limit", "=", "None", ")", ":", "kwargs", "=", "{", "'geo'", ":", "index_id", ",", "'latitu...
The default will find at most 100 documents near the given coordinate. The returned list is sorted according to the distance, with the nearest document being first in the list. If there are near documents of equal distance, documents are chosen randomly from this set until the limit ...
[ "The", "default", "will", "find", "at", "most", "100", "documents", "near", "the", "given", "coordinate", ".", "The", "returned", "list", "is", "sorted", "according", "to", "the", "distance", "with", "the", "nearest", "document", "being", "first", "in", "the...
b924cc57bed71520fc2ef528b917daeb98e10eca
https://github.com/saeschdivara/ArangoPy/blob/b924cc57bed71520fc2ef528b917daeb98e10eca/arangodb/query/simple.py#L343-L379
48,904
soldag/python-pwmled
pwmled/led/rgbw.py
RgbwLed._get_pwm_values
def _get_pwm_values(self, brightness=None, color=None): """ Get the pwm values for a specific state of the led. If a state argument is omitted, current value is used. :param brightness: The brightness of the state. :param color: The color of the state. :return: The pwm ...
python
def _get_pwm_values(self, brightness=None, color=None): """ Get the pwm values for a specific state of the led. If a state argument is omitted, current value is used. :param brightness: The brightness of the state. :param color: The color of the state. :return: The pwm ...
[ "def", "_get_pwm_values", "(", "self", ",", "brightness", "=", "None", ",", "color", "=", "None", ")", ":", "if", "brightness", "is", "None", ":", "brightness", "=", "self", ".", "brightness", "if", "color", "is", "None", ":", "color", "=", "self", "."...
Get the pwm values for a specific state of the led. If a state argument is omitted, current value is used. :param brightness: The brightness of the state. :param color: The color of the state. :return: The pwm values.
[ "Get", "the", "pwm", "values", "for", "a", "specific", "state", "of", "the", "led", "." ]
09cde36ecc0153fa81dc2a1b9bb07d1c0e418c8c
https://github.com/soldag/python-pwmled/blob/09cde36ecc0153fa81dc2a1b9bb07d1c0e418c8c/pwmled/led/rgbw.py#L10-L25
48,905
soldag/python-pwmled
pwmled/led/rgbw.py
RgbwLed._rgb_to_rgbw
def _rgb_to_rgbw(color): """ Convert a RGB color to a RGBW color. :param color: The RGB color. :return: The RGBW color. """ # Get the maximum between R, G, and B max_value = max(color) # If the maximum value is 0, immediately return pure black. i...
python
def _rgb_to_rgbw(color): """ Convert a RGB color to a RGBW color. :param color: The RGB color. :return: The RGBW color. """ # Get the maximum between R, G, and B max_value = max(color) # If the maximum value is 0, immediately return pure black. i...
[ "def", "_rgb_to_rgbw", "(", "color", ")", ":", "# Get the maximum between R, G, and B", "max_value", "=", "max", "(", "color", ")", "# If the maximum value is 0, immediately return pure black.", "if", "max_value", "==", "0", ":", "return", "[", "0", "]", "*", "4", "...
Convert a RGB color to a RGBW color. :param color: The RGB color. :return: The RGBW color.
[ "Convert", "a", "RGB", "color", "to", "a", "RGBW", "color", "." ]
09cde36ecc0153fa81dc2a1b9bb07d1c0e418c8c
https://github.com/soldag/python-pwmled/blob/09cde36ecc0153fa81dc2a1b9bb07d1c0e418c8c/pwmled/led/rgbw.py#L28-L59
48,906
txamqp/txamqp
src/txamqp/endpoint.py
AMQEndpoint.from_uri
def from_uri(cls, reactor, uri): """Return an AMQEndpoint instance configured with the given AMQP uri. @see: https://www.rabbitmq.com/uri-spec.html """ uri = URI.fromBytes(uri.encode(), defaultPort=5672) kwargs = {} host = uri.host.decode() if "@" in host: ...
python
def from_uri(cls, reactor, uri): """Return an AMQEndpoint instance configured with the given AMQP uri. @see: https://www.rabbitmq.com/uri-spec.html """ uri = URI.fromBytes(uri.encode(), defaultPort=5672) kwargs = {} host = uri.host.decode() if "@" in host: ...
[ "def", "from_uri", "(", "cls", ",", "reactor", ",", "uri", ")", ":", "uri", "=", "URI", ".", "fromBytes", "(", "uri", ".", "encode", "(", ")", ",", "defaultPort", "=", "5672", ")", "kwargs", "=", "{", "}", "host", "=", "uri", ".", "host", ".", ...
Return an AMQEndpoint instance configured with the given AMQP uri. @see: https://www.rabbitmq.com/uri-spec.html
[ "Return", "an", "AMQEndpoint", "instance", "configured", "with", "the", "given", "AMQP", "uri", "." ]
10caf998dd8c05a7321cd10c24a83832bf58bd0c
https://github.com/txamqp/txamqp/blob/10caf998dd8c05a7321cd10c24a83832bf58bd0c/src/txamqp/endpoint.py#L78-L101
48,907
txamqp/txamqp
src/txamqp/endpoint.py
AMQEndpoint._authenticate
def _authenticate(self, client): """Perform AMQP authentication.""" yield client.authenticate( self._username, self._password, mechanism=self._auth_mechanism) returnValue(client)
python
def _authenticate(self, client): """Perform AMQP authentication.""" yield client.authenticate( self._username, self._password, mechanism=self._auth_mechanism) returnValue(client)
[ "def", "_authenticate", "(", "self", ",", "client", ")", ":", "yield", "client", ".", "authenticate", "(", "self", ".", "_username", ",", "self", ".", "_password", ",", "mechanism", "=", "self", ".", "_auth_mechanism", ")", "returnValue", "(", "client", ")...
Perform AMQP authentication.
[ "Perform", "AMQP", "authentication", "." ]
10caf998dd8c05a7321cd10c24a83832bf58bd0c
https://github.com/txamqp/txamqp/blob/10caf998dd8c05a7321cd10c24a83832bf58bd0c/src/txamqp/endpoint.py#L126-L130
48,908
transceptor-technology/trender
trender/block.py
Block._reset_plain
def _reset_plain(self): '''Create a BlockText from the captured lines and clear _text.''' if self._text: self._blocks.append(BlockText('\n'.join(self._text))) self._text.clear()
python
def _reset_plain(self): '''Create a BlockText from the captured lines and clear _text.''' if self._text: self._blocks.append(BlockText('\n'.join(self._text))) self._text.clear()
[ "def", "_reset_plain", "(", "self", ")", ":", "if", "self", ".", "_text", ":", "self", ".", "_blocks", ".", "append", "(", "BlockText", "(", "'\\n'", ".", "join", "(", "self", ".", "_text", ")", ")", ")", "self", ".", "_text", ".", "clear", "(", ...
Create a BlockText from the captured lines and clear _text.
[ "Create", "a", "BlockText", "from", "the", "captured", "lines", "and", "clear", "_text", "." ]
ef2b7374ea2ecc83dceb139b358ec4ad8ce7033b
https://github.com/transceptor-technology/trender/blob/ef2b7374ea2ecc83dceb139b358ec4ad8ce7033b/trender/block.py#L121-L125
48,909
soldag/python-pwmled
pwmled/transitions/transition.py
Transition.step
def step(self): """Apply the current stage of the transition based on current time.""" if self.cancelled or self.finished: return if not self.pwm_stages: self._finish() return if self.duration == 0: progress = 1 else: ...
python
def step(self): """Apply the current stage of the transition based on current time.""" if self.cancelled or self.finished: return if not self.pwm_stages: self._finish() return if self.duration == 0: progress = 1 else: ...
[ "def", "step", "(", "self", ")", ":", "if", "self", ".", "cancelled", "or", "self", ".", "finished", ":", "return", "if", "not", "self", ".", "pwm_stages", ":", "self", ".", "_finish", "(", ")", "return", "if", "self", ".", "duration", "==", "0", "...
Apply the current stage of the transition based on current time.
[ "Apply", "the", "current", "stage", "of", "the", "transition", "based", "on", "current", "time", "." ]
09cde36ecc0153fa81dc2a1b9bb07d1c0e418c8c
https://github.com/soldag/python-pwmled/blob/09cde36ecc0153fa81dc2a1b9bb07d1c0e418c8c/pwmled/transitions/transition.py#L33-L52
48,910
soldag/python-pwmled
pwmled/transitions/transition.py
Transition._finish
def _finish(self): """Mark transition as finished and execute callback.""" self.finished = True if self._callback: self._callback(self) self._finish_event.set()
python
def _finish(self): """Mark transition as finished and execute callback.""" self.finished = True if self._callback: self._callback(self) self._finish_event.set()
[ "def", "_finish", "(", "self", ")", ":", "self", ".", "finished", "=", "True", "if", "self", ".", "_callback", ":", "self", ".", "_callback", "(", "self", ")", "self", ".", "_finish_event", ".", "set", "(", ")" ]
Mark transition as finished and execute callback.
[ "Mark", "transition", "as", "finished", "and", "execute", "callback", "." ]
09cde36ecc0153fa81dc2a1b9bb07d1c0e418c8c
https://github.com/soldag/python-pwmled/blob/09cde36ecc0153fa81dc2a1b9bb07d1c0e418c8c/pwmled/transitions/transition.py#L54-L59
48,911
kamushadenes/cefevent
cefevent/syslog.py
Syslog.send
def send(self, message, level=Level.NOTICE): "Send a syslog message to remote host using UDP or TCP" data = "<%d>%s" % (level + self.facility*8, message) if self.protocol == 'UDP': self.socket.sendto(data.encode('utf-8'), (self.host, self.port)) else: self.socket.send(data.encode('utf-8'...
python
def send(self, message, level=Level.NOTICE): "Send a syslog message to remote host using UDP or TCP" data = "<%d>%s" % (level + self.facility*8, message) if self.protocol == 'UDP': self.socket.sendto(data.encode('utf-8'), (self.host, self.port)) else: self.socket.send(data.encode('utf-8'...
[ "def", "send", "(", "self", ",", "message", ",", "level", "=", "Level", ".", "NOTICE", ")", ":", "data", "=", "\"<%d>%s\"", "%", "(", "level", "+", "self", ".", "facility", "*", "8", ",", "message", ")", "if", "self", ".", "protocol", "==", "'UDP'"...
Send a syslog message to remote host using UDP or TCP
[ "Send", "a", "syslog", "message", "to", "remote", "host", "using", "UDP", "or", "TCP" ]
d6c60f0a626d923c96d04329ba5a1435a940e0bc
https://github.com/kamushadenes/cefevent/blob/d6c60f0a626d923c96d04329ba5a1435a940e0bc/cefevent/syslog.py#L52-L58
48,912
graphcommons/graphcommons-python
graphcommons.py
Graph.sync
def sync(self, graph_commons): """Synchronize local and remote representations.""" if self['id'] is None: return remote_graph = graph_commons.graphs(self['id']) # TODO: less forceful, more elegant self.edges = remote_graph.edges self.nodes = remote_graph.nod...
python
def sync(self, graph_commons): """Synchronize local and remote representations.""" if self['id'] is None: return remote_graph = graph_commons.graphs(self['id']) # TODO: less forceful, more elegant self.edges = remote_graph.edges self.nodes = remote_graph.nod...
[ "def", "sync", "(", "self", ",", "graph_commons", ")", ":", "if", "self", "[", "'id'", "]", "is", "None", ":", "return", "remote_graph", "=", "graph_commons", ".", "graphs", "(", "self", "[", "'id'", "]", ")", "# TODO: less forceful, more elegant", "self", ...
Synchronize local and remote representations.
[ "Synchronize", "local", "and", "remote", "representations", "." ]
ebfa5bb2c800e17e6cffae83ece574f6d3a05428
https://github.com/graphcommons/graphcommons-python/blob/ebfa5bb2c800e17e6cffae83ece574f6d3a05428/graphcommons.py#L119-L134
48,913
soldag/python-pwmled
pwmled/transitions/transition_manager.py
TransitionManager.execute
def execute(self, transition): """ Queue a transition for execution. :param transition: The transition """ self._transitions.append(transition) if self._thread is None or not self._thread.isAlive(): self._thread = threading.Thread(target=self._transition_loop...
python
def execute(self, transition): """ Queue a transition for execution. :param transition: The transition """ self._transitions.append(transition) if self._thread is None or not self._thread.isAlive(): self._thread = threading.Thread(target=self._transition_loop...
[ "def", "execute", "(", "self", ",", "transition", ")", ":", "self", ".", "_transitions", ".", "append", "(", "transition", ")", "if", "self", ".", "_thread", "is", "None", "or", "not", "self", ".", "_thread", ".", "isAlive", "(", ")", ":", "self", "....
Queue a transition for execution. :param transition: The transition
[ "Queue", "a", "transition", "for", "execution", "." ]
09cde36ecc0153fa81dc2a1b9bb07d1c0e418c8c
https://github.com/soldag/python-pwmled/blob/09cde36ecc0153fa81dc2a1b9bb07d1c0e418c8c/pwmled/transitions/transition_manager.py#L17-L27
48,914
soldag/python-pwmled
pwmled/transitions/transition_manager.py
TransitionManager._transition_loop
def _transition_loop(self): """Execute all queued transitions step by step.""" while self._transitions: start = time.time() for transition in self._transitions: transition.step() if transition.finished: self._transitions.remove(...
python
def _transition_loop(self): """Execute all queued transitions step by step.""" while self._transitions: start = time.time() for transition in self._transitions: transition.step() if transition.finished: self._transitions.remove(...
[ "def", "_transition_loop", "(", "self", ")", ":", "while", "self", ".", "_transitions", ":", "start", "=", "time", ".", "time", "(", ")", "for", "transition", "in", "self", ".", "_transitions", ":", "transition", ".", "step", "(", ")", "if", "transition"...
Execute all queued transitions step by step.
[ "Execute", "all", "queued", "transitions", "step", "by", "step", "." ]
09cde36ecc0153fa81dc2a1b9bb07d1c0e418c8c
https://github.com/soldag/python-pwmled/blob/09cde36ecc0153fa81dc2a1b9bb07d1c0e418c8c/pwmled/transitions/transition_manager.py#L29-L40
48,915
soldag/python-pwmled
pwmled/led/__init__.py
SimpleLed._update_pwm
def _update_pwm(self): """Update the pwm values of the driver regarding the current state.""" if self._is_on: values = self._get_pwm_values() else: values = [0] * len(self._driver.pins) self._driver.set_pwm(values)
python
def _update_pwm(self): """Update the pwm values of the driver regarding the current state.""" if self._is_on: values = self._get_pwm_values() else: values = [0] * len(self._driver.pins) self._driver.set_pwm(values)
[ "def", "_update_pwm", "(", "self", ")", ":", "if", "self", ".", "_is_on", ":", "values", "=", "self", ".", "_get_pwm_values", "(", ")", "else", ":", "values", "=", "[", "0", "]", "*", "len", "(", "self", ".", "_driver", ".", "pins", ")", "self", ...
Update the pwm values of the driver regarding the current state.
[ "Update", "the", "pwm", "values", "of", "the", "driver", "regarding", "the", "current", "state", "." ]
09cde36ecc0153fa81dc2a1b9bb07d1c0e418c8c
https://github.com/soldag/python-pwmled/blob/09cde36ecc0153fa81dc2a1b9bb07d1c0e418c8c/pwmled/led/__init__.py#L78-L85
48,916
soldag/python-pwmled
pwmled/led/__init__.py
SimpleLed.transition
def transition(self, duration, is_on=None, **kwargs): """ Transition to the specified state of the led. If another transition is already running, it is aborted. :param duration: The duration of the transition. :param is_on: The on-off state to transition to. :param kwar...
python
def transition(self, duration, is_on=None, **kwargs): """ Transition to the specified state of the led. If another transition is already running, it is aborted. :param duration: The duration of the transition. :param is_on: The on-off state to transition to. :param kwar...
[ "def", "transition", "(", "self", ",", "duration", ",", "is_on", "=", "None", ",", "*", "*", "kwargs", ")", ":", "self", ".", "_cancel_active_transition", "(", ")", "dest_state", "=", "self", ".", "_prepare_transition", "(", "is_on", ",", "*", "*", "kwar...
Transition to the specified state of the led. If another transition is already running, it is aborted. :param duration: The duration of the transition. :param is_on: The on-off state to transition to. :param kwargs: The state to transition to.
[ "Transition", "to", "the", "specified", "state", "of", "the", "led", "." ]
09cde36ecc0153fa81dc2a1b9bb07d1c0e418c8c
https://github.com/soldag/python-pwmled/blob/09cde36ecc0153fa81dc2a1b9bb07d1c0e418c8c/pwmled/led/__init__.py#L101-L126
48,917
soldag/python-pwmled
pwmled/led/__init__.py
SimpleLed._transition_callback
def _transition_callback(self, is_on, transition): """ Callback that is called when a transition has ended. :param is_on: The on-off state to transition to. :param transition: The transition that has ended. """ # Update state properties if transition.state_stages...
python
def _transition_callback(self, is_on, transition): """ Callback that is called when a transition has ended. :param is_on: The on-off state to transition to. :param transition: The transition that has ended. """ # Update state properties if transition.state_stages...
[ "def", "_transition_callback", "(", "self", ",", "is_on", ",", "transition", ")", ":", "# Update state properties", "if", "transition", ".", "state_stages", ":", "state", "=", "transition", ".", "state_stages", "[", "transition", ".", "stage_index", "]", "if", "...
Callback that is called when a transition has ended. :param is_on: The on-off state to transition to. :param transition: The transition that has ended.
[ "Callback", "that", "is", "called", "when", "a", "transition", "has", "ended", "." ]
09cde36ecc0153fa81dc2a1b9bb07d1c0e418c8c
https://github.com/soldag/python-pwmled/blob/09cde36ecc0153fa81dc2a1b9bb07d1c0e418c8c/pwmled/led/__init__.py#L133-L149
48,918
soldag/python-pwmled
pwmled/led/__init__.py
SimpleLed._interpolate
def _interpolate(start, end, step, total_steps): """ Interpolate a value from start to end at a given progress. :param start: The start value. :param end: The end value. :param step: The current step. :param total_steps: The total number of steps. :return: The in...
python
def _interpolate(start, end, step, total_steps): """ Interpolate a value from start to end at a given progress. :param start: The start value. :param end: The end value. :param step: The current step. :param total_steps: The total number of steps. :return: The in...
[ "def", "_interpolate", "(", "start", ",", "end", ",", "step", ",", "total_steps", ")", ":", "diff", "=", "end", "-", "start", "progress", "=", "step", "/", "(", "total_steps", "-", "1", ")", "return", "start", "+", "progress", "*", "diff" ]
Interpolate a value from start to end at a given progress. :param start: The start value. :param end: The end value. :param step: The current step. :param total_steps: The total number of steps. :return: The interpolated value at the given progress.
[ "Interpolate", "a", "value", "from", "start", "to", "end", "at", "a", "given", "progress", "." ]
09cde36ecc0153fa81dc2a1b9bb07d1c0e418c8c
https://github.com/soldag/python-pwmled/blob/09cde36ecc0153fa81dc2a1b9bb07d1c0e418c8c/pwmled/led/__init__.py#L201-L213
48,919
saeschdivara/ArangoPy
arangodb/api.py
Client.instance
def instance(cls, hostname=None, auth=None, protocol=None, port=None, database=None): """ This method is called from everywhere in the code which accesses the database. If one of the parameters is set, these variables are overwritten for all others. """ if cls.class_ins...
python
def instance(cls, hostname=None, auth=None, protocol=None, port=None, database=None): """ This method is called from everywhere in the code which accesses the database. If one of the parameters is set, these variables are overwritten for all others. """ if cls.class_ins...
[ "def", "instance", "(", "cls", ",", "hostname", "=", "None", ",", "auth", "=", "None", ",", "protocol", "=", "None", ",", "port", "=", "None", ",", "database", "=", "None", ")", ":", "if", "cls", ".", "class_instance", "is", "None", ":", "if", "hos...
This method is called from everywhere in the code which accesses the database. If one of the parameters is set, these variables are overwritten for all others.
[ "This", "method", "is", "called", "from", "everywhere", "in", "the", "code", "which", "accesses", "the", "database", "." ]
b924cc57bed71520fc2ef528b917daeb98e10eca
https://github.com/saeschdivara/ArangoPy/blob/b924cc57bed71520fc2ef528b917daeb98e10eca/arangodb/api.py#L41-L71
48,920
saeschdivara/ArangoPy
arangodb/api.py
Client.collection
def collection(self, name): """ Returns a collection with the given name :param name Collection name :returns Collection """ return Collection( name=name, api_resource=self.api.collection(name), api=self.api, )
python
def collection(self, name): """ Returns a collection with the given name :param name Collection name :returns Collection """ return Collection( name=name, api_resource=self.api.collection(name), api=self.api, )
[ "def", "collection", "(", "self", ",", "name", ")", ":", "return", "Collection", "(", "name", "=", "name", ",", "api_resource", "=", "self", ".", "api", ".", "collection", "(", "name", ")", ",", "api", "=", "self", ".", "api", ",", ")" ]
Returns a collection with the given name :param name Collection name :returns Collection
[ "Returns", "a", "collection", "with", "the", "given", "name" ]
b924cc57bed71520fc2ef528b917daeb98e10eca
https://github.com/saeschdivara/ArangoPy/blob/b924cc57bed71520fc2ef528b917daeb98e10eca/arangodb/api.py#L73-L86
48,921
saeschdivara/ArangoPy
arangodb/api.py
Database.create
def create(cls, name, users=None): """ Creates database and sets itself as the active database. :param name Database name :returns Database """ api = Client.instance().api database_data = { 'name': name, 'active': True, ...
python
def create(cls, name, users=None): """ Creates database and sets itself as the active database. :param name Database name :returns Database """ api = Client.instance().api database_data = { 'name': name, 'active': True, ...
[ "def", "create", "(", "cls", ",", "name", ",", "users", "=", "None", ")", ":", "api", "=", "Client", ".", "instance", "(", ")", ".", "api", "database_data", "=", "{", "'name'", ":", "name", ",", "'active'", ":", "True", ",", "}", "if", "isinstance"...
Creates database and sets itself as the active database. :param name Database name :returns Database
[ "Creates", "database", "and", "sets", "itself", "as", "the", "active", "database", "." ]
b924cc57bed71520fc2ef528b917daeb98e10eca
https://github.com/saeschdivara/ArangoPy/blob/b924cc57bed71520fc2ef528b917daeb98e10eca/arangodb/api.py#L91-L120
48,922
saeschdivara/ArangoPy
arangodb/api.py
Database.get_all
def get_all(cls): """ Returns an array with all databases :returns Database list """ api = Client.instance().api data = api.database.get() database_names = data['result'] databases = [] for name in database_names: db = Data...
python
def get_all(cls): """ Returns an array with all databases :returns Database list """ api = Client.instance().api data = api.database.get() database_names = data['result'] databases = [] for name in database_names: db = Data...
[ "def", "get_all", "(", "cls", ")", ":", "api", "=", "Client", ".", "instance", "(", ")", ".", "api", "data", "=", "api", ".", "database", ".", "get", "(", ")", "database_names", "=", "data", "[", "'result'", "]", "databases", "=", "[", "]", "for", ...
Returns an array with all databases :returns Database list
[ "Returns", "an", "array", "with", "all", "databases" ]
b924cc57bed71520fc2ef528b917daeb98e10eca
https://github.com/saeschdivara/ArangoPy/blob/b924cc57bed71520fc2ef528b917daeb98e10eca/arangodb/api.py#L123-L141
48,923
saeschdivara/ArangoPy
arangodb/api.py
Database.remove
def remove(cls, name): """ Destroys the database. """ client = Client.instance() new_current_database = None if client.database != name: new_current_database = name # Deletions are only possible from the system database client.set_datab...
python
def remove(cls, name): """ Destroys the database. """ client = Client.instance() new_current_database = None if client.database != name: new_current_database = name # Deletions are only possible from the system database client.set_datab...
[ "def", "remove", "(", "cls", ",", "name", ")", ":", "client", "=", "Client", ".", "instance", "(", ")", "new_current_database", "=", "None", "if", "client", ".", "database", "!=", "name", ":", "new_current_database", "=", "name", "# Deletions are only possible...
Destroys the database.
[ "Destroys", "the", "database", "." ]
b924cc57bed71520fc2ef528b917daeb98e10eca
https://github.com/saeschdivara/ArangoPy/blob/b924cc57bed71520fc2ef528b917daeb98e10eca/arangodb/api.py#L145-L164
48,924
saeschdivara/ArangoPy
arangodb/api.py
Database.create_collection
def create_collection(self, name, type=2): """ Shortcut to create a collection :param name Collection name :param type Collection type (2 = document / 3 = edge) :returns Collection """ return Collection.create(name=name, database=self.name, type...
python
def create_collection(self, name, type=2): """ Shortcut to create a collection :param name Collection name :param type Collection type (2 = document / 3 = edge) :returns Collection """ return Collection.create(name=name, database=self.name, type...
[ "def", "create_collection", "(", "self", ",", "name", ",", "type", "=", "2", ")", ":", "return", "Collection", ".", "create", "(", "name", "=", "name", ",", "database", "=", "self", ".", "name", ",", "type", "=", "type", ")" ]
Shortcut to create a collection :param name Collection name :param type Collection type (2 = document / 3 = edge) :returns Collection
[ "Shortcut", "to", "create", "a", "collection" ]
b924cc57bed71520fc2ef528b917daeb98e10eca
https://github.com/saeschdivara/ArangoPy/blob/b924cc57bed71520fc2ef528b917daeb98e10eca/arangodb/api.py#L174-L184
48,925
saeschdivara/ArangoPy
arangodb/api.py
Collection.remove
def remove(cls, name): """ Destroys collection. :param name Collection name """ api = Client.instance().api api.collection(name).delete()
python
def remove(cls, name): """ Destroys collection. :param name Collection name """ api = Client.instance().api api.collection(name).delete()
[ "def", "remove", "(", "cls", ",", "name", ")", ":", "api", "=", "Client", ".", "instance", "(", ")", ".", "api", "api", ".", "collection", "(", "name", ")", ".", "delete", "(", ")" ]
Destroys collection. :param name Collection name
[ "Destroys", "collection", "." ]
b924cc57bed71520fc2ef528b917daeb98e10eca
https://github.com/saeschdivara/ArangoPy/blob/b924cc57bed71520fc2ef528b917daeb98e10eca/arangodb/api.py#L244-L253
48,926
saeschdivara/ArangoPy
arangodb/api.py
Collection.save
def save(self): """ Updates only waitForSync and journalSize """ data = { 'waitForSync': self.waitForSync, 'journalSize': self.journalSize, } self.resource(self.name).properties.put(data)
python
def save(self): """ Updates only waitForSync and journalSize """ data = { 'waitForSync': self.waitForSync, 'journalSize': self.journalSize, } self.resource(self.name).properties.put(data)
[ "def", "save", "(", "self", ")", ":", "data", "=", "{", "'waitForSync'", ":", "self", ".", "waitForSync", ",", "'journalSize'", ":", "self", ".", "journalSize", ",", "}", "self", ".", "resource", "(", "self", ".", "name", ")", ".", "properties", ".", ...
Updates only waitForSync and journalSize
[ "Updates", "only", "waitForSync", "and", "journalSize" ]
b924cc57bed71520fc2ef528b917daeb98e10eca
https://github.com/saeschdivara/ArangoPy/blob/b924cc57bed71520fc2ef528b917daeb98e10eca/arangodb/api.py#L321-L331
48,927
saeschdivara/ArangoPy
arangodb/api.py
Collection.get
def get(self): """ Retrieves all properties again for the collection and sets the attributes. """ data = self.resource(self.name).properties.get() self.set_data(**data) return data
python
def get(self): """ Retrieves all properties again for the collection and sets the attributes. """ data = self.resource(self.name).properties.get() self.set_data(**data) return data
[ "def", "get", "(", "self", ")", ":", "data", "=", "self", ".", "resource", "(", "self", ".", "name", ")", ".", "properties", ".", "get", "(", ")", "self", ".", "set_data", "(", "*", "*", "data", ")", "return", "data" ]
Retrieves all properties again for the collection and sets the attributes.
[ "Retrieves", "all", "properties", "again", "for", "the", "collection", "and", "sets", "the", "attributes", "." ]
b924cc57bed71520fc2ef528b917daeb98e10eca
https://github.com/saeschdivara/ArangoPy/blob/b924cc57bed71520fc2ef528b917daeb98e10eca/arangodb/api.py#L333-L343
48,928
saeschdivara/ArangoPy
arangodb/api.py
Collection.get_figures
def get_figures(self): """ Returns figures about the collection. """ data = self.resource(self.name).figures.get() return data['figures']
python
def get_figures(self): """ Returns figures about the collection. """ data = self.resource(self.name).figures.get() return data['figures']
[ "def", "get_figures", "(", "self", ")", ":", "data", "=", "self", ".", "resource", "(", "self", ".", "name", ")", ".", "figures", ".", "get", "(", ")", "return", "data", "[", "'figures'", "]" ]
Returns figures about the collection.
[ "Returns", "figures", "about", "the", "collection", "." ]
b924cc57bed71520fc2ef528b917daeb98e10eca
https://github.com/saeschdivara/ArangoPy/blob/b924cc57bed71520fc2ef528b917daeb98e10eca/arangodb/api.py#L345-L351
48,929
saeschdivara/ArangoPy
arangodb/api.py
Collection.create_edge
def create_edge(self, from_doc, to_doc, edge_data={}): """ Creates edge document. :param from_doc Document from which the edge comes :param to_doc Document to which the edge goes :param edge_data Extra data for the edge :returns Document """ ...
python
def create_edge(self, from_doc, to_doc, edge_data={}): """ Creates edge document. :param from_doc Document from which the edge comes :param to_doc Document to which the edge goes :param edge_data Extra data for the edge :returns Document """ ...
[ "def", "create_edge", "(", "self", ",", "from_doc", ",", "to_doc", ",", "edge_data", "=", "{", "}", ")", ":", "return", "Edge", ".", "create", "(", "collection", "=", "self", ",", "from_doc", "=", "from_doc", ",", "to_doc", "=", "to_doc", ",", "edge_da...
Creates edge document. :param from_doc Document from which the edge comes :param to_doc Document to which the edge goes :param edge_data Extra data for the edge :returns Document
[ "Creates", "edge", "document", "." ]
b924cc57bed71520fc2ef528b917daeb98e10eca
https://github.com/saeschdivara/ArangoPy/blob/b924cc57bed71520fc2ef528b917daeb98e10eca/arangodb/api.py#L362-L378
48,930
saeschdivara/ArangoPy
arangodb/api.py
Collection.documents
def documents(self): """ Returns all documents of this collection. :returns Document list """ document_list = [] document_uri_list = self.api.document.get(collection=self.name)['documents'] for document_uri in document_uri_list: splitted_uri ...
python
def documents(self): """ Returns all documents of this collection. :returns Document list """ document_list = [] document_uri_list = self.api.document.get(collection=self.name)['documents'] for document_uri in document_uri_list: splitted_uri ...
[ "def", "documents", "(", "self", ")", ":", "document_list", "=", "[", "]", "document_uri_list", "=", "self", ".", "api", ".", "document", ".", "get", "(", "collection", "=", "self", ".", "name", ")", "[", "'documents'", "]", "for", "document_uri", "in", ...
Returns all documents of this collection. :returns Document list
[ "Returns", "all", "documents", "of", "this", "collection", "." ]
b924cc57bed71520fc2ef528b917daeb98e10eca
https://github.com/saeschdivara/ArangoPy/blob/b924cc57bed71520fc2ef528b917daeb98e10eca/arangodb/api.py#L380-L403
48,931
saeschdivara/ArangoPy
arangodb/api.py
Document.create
def create(cls, collection): """ Creates document object without really creating it in the collection. :param collection Collection instance :returns Document """ api = Client.instance().api doc = Document( id='', key='', ...
python
def create(cls, collection): """ Creates document object without really creating it in the collection. :param collection Collection instance :returns Document """ api = Client.instance().api doc = Document( id='', key='', ...
[ "def", "create", "(", "cls", ",", "collection", ")", ":", "api", "=", "Client", ".", "instance", "(", ")", ".", "api", "doc", "=", "Document", "(", "id", "=", "''", ",", "key", "=", "''", ",", "collection", "=", "collection", ".", "name", ",", "a...
Creates document object without really creating it in the collection. :param collection Collection instance :returns Document
[ "Creates", "document", "object", "without", "really", "creating", "it", "in", "the", "collection", "." ]
b924cc57bed71520fc2ef528b917daeb98e10eca
https://github.com/saeschdivara/ArangoPy/blob/b924cc57bed71520fc2ef528b917daeb98e10eca/arangodb/api.py#L408-L426
48,932
saeschdivara/ArangoPy
arangodb/api.py
Document.retrieve
def retrieve(self): """ Retrieves all data for this document and saves it. """ data = self.resource(self.id).get() self.data = data return data
python
def retrieve(self): """ Retrieves all data for this document and saves it. """ data = self.resource(self.id).get() self.data = data return data
[ "def", "retrieve", "(", "self", ")", ":", "data", "=", "self", ".", "resource", "(", "self", ".", "id", ")", ".", "get", "(", ")", "self", ".", "data", "=", "data", "return", "data" ]
Retrieves all data for this document and saves it.
[ "Retrieves", "all", "data", "for", "this", "document", "and", "saves", "it", "." ]
b924cc57bed71520fc2ef528b917daeb98e10eca
https://github.com/saeschdivara/ArangoPy/blob/b924cc57bed71520fc2ef528b917daeb98e10eca/arangodb/api.py#L449-L457
48,933
saeschdivara/ArangoPy
arangodb/api.py
Document.save
def save(self): """ If its internal state is loaded than it will only updated the set properties but otherwise it will create a new document. """ # TODO: Add option force_insert if not self.is_loaded and self.id is None or self.id == '': data = self....
python
def save(self): """ If its internal state is loaded than it will only updated the set properties but otherwise it will create a new document. """ # TODO: Add option force_insert if not self.is_loaded and self.id is None or self.id == '': data = self....
[ "def", "save", "(", "self", ")", ":", "# TODO: Add option force_insert", "if", "not", "self", ".", "is_loaded", "and", "self", ".", "id", "is", "None", "or", "self", ".", "id", "==", "''", ":", "data", "=", "self", ".", "resource", ".", "post", "(", ...
If its internal state is loaded than it will only updated the set properties but otherwise it will create a new document.
[ "If", "its", "internal", "state", "is", "loaded", "than", "it", "will", "only", "updated", "the", "set", "properties", "but", "otherwise", "it", "will", "create", "a", "new", "document", "." ]
b924cc57bed71520fc2ef528b917daeb98e10eca
https://github.com/saeschdivara/ArangoPy/blob/b924cc57bed71520fc2ef528b917daeb98e10eca/arangodb/api.py#L466-L482
48,934
saeschdivara/ArangoPy
arangodb/api.py
Document.get
def get(self, key): """ Returns attribute value. :param key :returns value """ if not self.is_loaded: self.retrieve() self.is_loaded = True if self.has(key=key): return self.data[key] else: r...
python
def get(self, key): """ Returns attribute value. :param key :returns value """ if not self.is_loaded: self.retrieve() self.is_loaded = True if self.has(key=key): return self.data[key] else: r...
[ "def", "get", "(", "self", ",", "key", ")", ":", "if", "not", "self", ".", "is_loaded", ":", "self", ".", "retrieve", "(", ")", "self", ".", "is_loaded", "=", "True", "if", "self", ".", "has", "(", "key", "=", "key", ")", ":", "return", "self", ...
Returns attribute value. :param key :returns value
[ "Returns", "attribute", "value", "." ]
b924cc57bed71520fc2ef528b917daeb98e10eca
https://github.com/saeschdivara/ArangoPy/blob/b924cc57bed71520fc2ef528b917daeb98e10eca/arangodb/api.py#L484-L501
48,935
soldag/python-pwmled
pwmled/driver/__init__.py
Driver._to_raw_pwm
def _to_raw_pwm(self, values): """ Convert uniform pwm values to raw, driver-specific values. :param values: The uniform pwm values (0.0-1.0). :return: Converted, driver-specific pwm values. """ return [self._to_single_raw_pwm(values[i]) for i in range(le...
python
def _to_raw_pwm(self, values): """ Convert uniform pwm values to raw, driver-specific values. :param values: The uniform pwm values (0.0-1.0). :return: Converted, driver-specific pwm values. """ return [self._to_single_raw_pwm(values[i]) for i in range(le...
[ "def", "_to_raw_pwm", "(", "self", ",", "values", ")", ":", "return", "[", "self", ".", "_to_single_raw_pwm", "(", "values", "[", "i", "]", ")", "for", "i", "in", "range", "(", "len", "(", "self", ".", "_pins", ")", ")", "]" ]
Convert uniform pwm values to raw, driver-specific values. :param values: The uniform pwm values (0.0-1.0). :return: Converted, driver-specific pwm values.
[ "Convert", "uniform", "pwm", "values", "to", "raw", "driver", "-", "specific", "values", "." ]
09cde36ecc0153fa81dc2a1b9bb07d1c0e418c8c
https://github.com/soldag/python-pwmled/blob/09cde36ecc0153fa81dc2a1b9bb07d1c0e418c8c/pwmled/driver/__init__.py#L68-L76
48,936
soldag/python-pwmled
pwmled/driver/__init__.py
Driver._to_uniform_pwm
def _to_uniform_pwm(self, values): """ Convert raw pwm values to uniform values. :param values: The raw pwm values. :return: Converted, uniform pwm values (0.0-1.0). """ return [self._to_single_uniform_pwm(values[i]) for i in range(len(self._pins))]
python
def _to_uniform_pwm(self, values): """ Convert raw pwm values to uniform values. :param values: The raw pwm values. :return: Converted, uniform pwm values (0.0-1.0). """ return [self._to_single_uniform_pwm(values[i]) for i in range(len(self._pins))]
[ "def", "_to_uniform_pwm", "(", "self", ",", "values", ")", ":", "return", "[", "self", ".", "_to_single_uniform_pwm", "(", "values", "[", "i", "]", ")", "for", "i", "in", "range", "(", "len", "(", "self", ".", "_pins", ")", ")", "]" ]
Convert raw pwm values to uniform values. :param values: The raw pwm values. :return: Converted, uniform pwm values (0.0-1.0).
[ "Convert", "raw", "pwm", "values", "to", "uniform", "values", "." ]
09cde36ecc0153fa81dc2a1b9bb07d1c0e418c8c
https://github.com/soldag/python-pwmled/blob/09cde36ecc0153fa81dc2a1b9bb07d1c0e418c8c/pwmled/driver/__init__.py#L87-L95
48,937
soldag/python-pwmled
pwmled/driver/__init__.py
Driver.steps
def steps(self, start, end): """ Get the maximum number of steps the driver needs for a transition. :param start: The start value as uniform pwm value (0.0-1.0). :param end: The end value as uniform pwm value (0.0-1.0). :return: The maximum number of steps. """ i...
python
def steps(self, start, end): """ Get the maximum number of steps the driver needs for a transition. :param start: The start value as uniform pwm value (0.0-1.0). :param end: The end value as uniform pwm value (0.0-1.0). :return: The maximum number of steps. """ i...
[ "def", "steps", "(", "self", ",", "start", ",", "end", ")", ":", "if", "not", "0", "<=", "start", "<=", "1", ":", "raise", "ValueError", "(", "'Values must be between 0 and 1.'", ")", "if", "not", "0", "<=", "end", "<=", "1", ":", "raise", "ValueError"...
Get the maximum number of steps the driver needs for a transition. :param start: The start value as uniform pwm value (0.0-1.0). :param end: The end value as uniform pwm value (0.0-1.0). :return: The maximum number of steps.
[ "Get", "the", "maximum", "number", "of", "steps", "the", "driver", "needs", "for", "a", "transition", "." ]
09cde36ecc0153fa81dc2a1b9bb07d1c0e418c8c
https://github.com/soldag/python-pwmled/blob/09cde36ecc0153fa81dc2a1b9bb07d1c0e418c8c/pwmled/driver/__init__.py#L106-L121
48,938
smira/py-numa
numa.py
numa_nodemask_to_set
def numa_nodemask_to_set(mask): """ Convert NUMA nodemask to Python set. """ result = set() for i in range(0, get_max_node() + 1): if __nodemask_isset(mask, i): result.add(i) return result
python
def numa_nodemask_to_set(mask): """ Convert NUMA nodemask to Python set. """ result = set() for i in range(0, get_max_node() + 1): if __nodemask_isset(mask, i): result.add(i) return result
[ "def", "numa_nodemask_to_set", "(", "mask", ")", ":", "result", "=", "set", "(", ")", "for", "i", "in", "range", "(", "0", ",", "get_max_node", "(", ")", "+", "1", ")", ":", "if", "__nodemask_isset", "(", "mask", ",", "i", ")", ":", "result", ".", ...
Convert NUMA nodemask to Python set.
[ "Convert", "NUMA", "nodemask", "to", "Python", "set", "." ]
eb38979c61028eb9422a4ad1eda0387cd93ea390
https://github.com/smira/py-numa/blob/eb38979c61028eb9422a4ad1eda0387cd93ea390/numa.py#L196-L206
48,939
smira/py-numa
numa.py
set_to_numa_nodemask
def set_to_numa_nodemask(mask): """ Conver Python set to NUMA nodemask. """ result = nodemask_t() __nodemask_zero(result) for i in range(0, get_max_node() + 1): if i in mask: __nodemask_set(result, i) return result
python
def set_to_numa_nodemask(mask): """ Conver Python set to NUMA nodemask. """ result = nodemask_t() __nodemask_zero(result) for i in range(0, get_max_node() + 1): if i in mask: __nodemask_set(result, i) return result
[ "def", "set_to_numa_nodemask", "(", "mask", ")", ":", "result", "=", "nodemask_t", "(", ")", "__nodemask_zero", "(", "result", ")", "for", "i", "in", "range", "(", "0", ",", "get_max_node", "(", ")", "+", "1", ")", ":", "if", "i", "in", "mask", ":", ...
Conver Python set to NUMA nodemask.
[ "Conver", "Python", "set", "to", "NUMA", "nodemask", "." ]
eb38979c61028eb9422a4ad1eda0387cd93ea390
https://github.com/smira/py-numa/blob/eb38979c61028eb9422a4ad1eda0387cd93ea390/numa.py#L216-L227
48,940
smira/py-numa
numa.py
get_interleave_mask
def get_interleave_mask(): """ Get interleave mask for current thread. @return: node mask @rtype: C{set} """ nodemask = nodemask_t() bitmask = libnuma.numa_get_interleave_mask() libnuma.copy_bitmask_to_nodemask(bitmask, byref(nodemask)) libnuma.numa_bitmask_free(bitmask) retur...
python
def get_interleave_mask(): """ Get interleave mask for current thread. @return: node mask @rtype: C{set} """ nodemask = nodemask_t() bitmask = libnuma.numa_get_interleave_mask() libnuma.copy_bitmask_to_nodemask(bitmask, byref(nodemask)) libnuma.numa_bitmask_free(bitmask) retur...
[ "def", "get_interleave_mask", "(", ")", ":", "nodemask", "=", "nodemask_t", "(", ")", "bitmask", "=", "libnuma", ".", "numa_get_interleave_mask", "(", ")", "libnuma", ".", "copy_bitmask_to_nodemask", "(", "bitmask", ",", "byref", "(", "nodemask", ")", ")", "li...
Get interleave mask for current thread. @return: node mask @rtype: C{set}
[ "Get", "interleave", "mask", "for", "current", "thread", "." ]
eb38979c61028eb9422a4ad1eda0387cd93ea390
https://github.com/smira/py-numa/blob/eb38979c61028eb9422a4ad1eda0387cd93ea390/numa.py#L246-L259
48,941
smira/py-numa
numa.py
bind
def bind(nodemask): """ Binds the current thread and its children to the nodes specified in nodemask. They will only run on the CPUs of the specified nodes and only be able to allocate memory from them. @param nodemask: node mask @type nodemask: C{set} """ mask = set_to_numa_nodemask(nodema...
python
def bind(nodemask): """ Binds the current thread and its children to the nodes specified in nodemask. They will only run on the CPUs of the specified nodes and only be able to allocate memory from them. @param nodemask: node mask @type nodemask: C{set} """ mask = set_to_numa_nodemask(nodema...
[ "def", "bind", "(", "nodemask", ")", ":", "mask", "=", "set_to_numa_nodemask", "(", "nodemask", ")", "bitmask", "=", "libnuma", ".", "numa_allocate_nodemask", "(", ")", "libnuma", ".", "copy_nodemask_to_bitmask", "(", "byref", "(", "mask", ")", ",", "bitmask",...
Binds the current thread and its children to the nodes specified in nodemask. They will only run on the CPUs of the specified nodes and only be able to allocate memory from them. @param nodemask: node mask @type nodemask: C{set}
[ "Binds", "the", "current", "thread", "and", "its", "children", "to", "the", "nodes", "specified", "in", "nodemask", ".", "They", "will", "only", "run", "on", "the", "CPUs", "of", "the", "specified", "nodes", "and", "only", "be", "able", "to", "allocate", ...
eb38979c61028eb9422a4ad1eda0387cd93ea390
https://github.com/smira/py-numa/blob/eb38979c61028eb9422a4ad1eda0387cd93ea390/numa.py#L262-L274
48,942
smira/py-numa
numa.py
set_preferred
def set_preferred(node): """ Sets the preferred node for the current thread to node. The preferred node is the node on which memory is preferably allocated before falling back to other nodes. The default is to use the node on which the process is currently running (local policy). @param node: nod...
python
def set_preferred(node): """ Sets the preferred node for the current thread to node. The preferred node is the node on which memory is preferably allocated before falling back to other nodes. The default is to use the node on which the process is currently running (local policy). @param node: nod...
[ "def", "set_preferred", "(", "node", ")", ":", "if", "node", "<", "0", "or", "node", ">", "get_max_node", "(", ")", ":", "raise", "ValueError", "(", "node", ")", "libnuma", ".", "numa_set_preferred", "(", "node", ")" ]
Sets the preferred node for the current thread to node. The preferred node is the node on which memory is preferably allocated before falling back to other nodes. The default is to use the node on which the process is currently running (local policy). @param node: node idx @type node: C{int}
[ "Sets", "the", "preferred", "node", "for", "the", "current", "thread", "to", "node", "." ]
eb38979c61028eb9422a4ad1eda0387cd93ea390
https://github.com/smira/py-numa/blob/eb38979c61028eb9422a4ad1eda0387cd93ea390/numa.py#L277-L290
48,943
smira/py-numa
numa.py
set_membind
def set_membind(nodemask): """ Sets the memory allocation mask. The thread will only allocate memory from the nodes set in nodemask. @param nodemask: node mask @type nodemask: C{set} """ mask = set_to_numa_nodemask(nodemask) tmp = bitmask_t() tmp.maskp = cast(byref(mask), POINTER(...
python
def set_membind(nodemask): """ Sets the memory allocation mask. The thread will only allocate memory from the nodes set in nodemask. @param nodemask: node mask @type nodemask: C{set} """ mask = set_to_numa_nodemask(nodemask) tmp = bitmask_t() tmp.maskp = cast(byref(mask), POINTER(...
[ "def", "set_membind", "(", "nodemask", ")", ":", "mask", "=", "set_to_numa_nodemask", "(", "nodemask", ")", "tmp", "=", "bitmask_t", "(", ")", "tmp", ".", "maskp", "=", "cast", "(", "byref", "(", "mask", ")", ",", "POINTER", "(", "c_ulong", ")", ")", ...
Sets the memory allocation mask. The thread will only allocate memory from the nodes set in nodemask. @param nodemask: node mask @type nodemask: C{set}
[ "Sets", "the", "memory", "allocation", "mask", "." ]
eb38979c61028eb9422a4ad1eda0387cd93ea390
https://github.com/smira/py-numa/blob/eb38979c61028eb9422a4ad1eda0387cd93ea390/numa.py#L302-L317
48,944
smira/py-numa
numa.py
get_membind
def get_membind(): """ Returns the mask of nodes from which memory can currently be allocated. @return: node mask @rtype: C{set} """ bitmask = libnuma.numa_get_membind() nodemask = nodemask_t() libnuma.copy_bitmask_to_nodemask(bitmask, byref(nodemask)) libnuma.numa_bitmask_free(bi...
python
def get_membind(): """ Returns the mask of nodes from which memory can currently be allocated. @return: node mask @rtype: C{set} """ bitmask = libnuma.numa_get_membind() nodemask = nodemask_t() libnuma.copy_bitmask_to_nodemask(bitmask, byref(nodemask)) libnuma.numa_bitmask_free(bi...
[ "def", "get_membind", "(", ")", ":", "bitmask", "=", "libnuma", ".", "numa_get_membind", "(", ")", "nodemask", "=", "nodemask_t", "(", ")", "libnuma", ".", "copy_bitmask_to_nodemask", "(", "bitmask", ",", "byref", "(", "nodemask", ")", ")", "libnuma", ".", ...
Returns the mask of nodes from which memory can currently be allocated. @return: node mask @rtype: C{set}
[ "Returns", "the", "mask", "of", "nodes", "from", "which", "memory", "can", "currently", "be", "allocated", "." ]
eb38979c61028eb9422a4ad1eda0387cd93ea390
https://github.com/smira/py-numa/blob/eb38979c61028eb9422a4ad1eda0387cd93ea390/numa.py#L320-L331
48,945
smira/py-numa
numa.py
set_run_on_node_mask
def set_run_on_node_mask(nodemask): """ Runs the current thread and its children only on nodes specified in nodemask. They will not migrate to CPUs of other nodes until the node affinity is reset with a new call to L{set_run_on_node_mask}. @param nodemask: node mask @type nodemask: C{set} ...
python
def set_run_on_node_mask(nodemask): """ Runs the current thread and its children only on nodes specified in nodemask. They will not migrate to CPUs of other nodes until the node affinity is reset with a new call to L{set_run_on_node_mask}. @param nodemask: node mask @type nodemask: C{set} ...
[ "def", "set_run_on_node_mask", "(", "nodemask", ")", ":", "mask", "=", "set_to_numa_nodemask", "(", "nodemask", ")", "tmp", "=", "bitmask_t", "(", ")", "tmp", ".", "maskp", "=", "cast", "(", "byref", "(", "mask", ")", ",", "POINTER", "(", "c_ulong", ")",...
Runs the current thread and its children only on nodes specified in nodemask. They will not migrate to CPUs of other nodes until the node affinity is reset with a new call to L{set_run_on_node_mask}. @param nodemask: node mask @type nodemask: C{set}
[ "Runs", "the", "current", "thread", "and", "its", "children", "only", "on", "nodes", "specified", "in", "nodemask", "." ]
eb38979c61028eb9422a4ad1eda0387cd93ea390
https://github.com/smira/py-numa/blob/eb38979c61028eb9422a4ad1eda0387cd93ea390/numa.py#L334-L351
48,946
smira/py-numa
numa.py
get_run_on_node_mask
def get_run_on_node_mask(): """ Returns the mask of nodes that the current thread is allowed to run on. @return: node mask @rtype: C{set} """ bitmask = libnuma.numa_get_run_node_mask() nodemask = nodemask_t() libnuma.copy_bitmask_to_nodemask(bitmask, byref(nodemask)) libnuma.numa_bi...
python
def get_run_on_node_mask(): """ Returns the mask of nodes that the current thread is allowed to run on. @return: node mask @rtype: C{set} """ bitmask = libnuma.numa_get_run_node_mask() nodemask = nodemask_t() libnuma.copy_bitmask_to_nodemask(bitmask, byref(nodemask)) libnuma.numa_bi...
[ "def", "get_run_on_node_mask", "(", ")", ":", "bitmask", "=", "libnuma", ".", "numa_get_run_node_mask", "(", ")", "nodemask", "=", "nodemask_t", "(", ")", "libnuma", ".", "copy_bitmask_to_nodemask", "(", "bitmask", ",", "byref", "(", "nodemask", ")", ")", "lib...
Returns the mask of nodes that the current thread is allowed to run on. @return: node mask @rtype: C{set}
[ "Returns", "the", "mask", "of", "nodes", "that", "the", "current", "thread", "is", "allowed", "to", "run", "on", "." ]
eb38979c61028eb9422a4ad1eda0387cd93ea390
https://github.com/smira/py-numa/blob/eb38979c61028eb9422a4ad1eda0387cd93ea390/numa.py#L354-L366
48,947
smira/py-numa
numa.py
get_distance
def get_distance(node1, node2): """ Reports the distance in the machine topology between two nodes. The factors are a multiple of 10. It returns 0 when the distance cannot be determined. A node has distance 10 to itself. Reporting the distance requires a Linux kernel version of 2.6.10 or newer. ...
python
def get_distance(node1, node2): """ Reports the distance in the machine topology between two nodes. The factors are a multiple of 10. It returns 0 when the distance cannot be determined. A node has distance 10 to itself. Reporting the distance requires a Linux kernel version of 2.6.10 or newer. ...
[ "def", "get_distance", "(", "node1", ",", "node2", ")", ":", "if", "node1", "<", "0", "or", "node1", ">", "get_max_node", "(", ")", ":", "raise", "ValueError", "(", "node1", ")", "if", "node2", "<", "0", "or", "node2", ">", "get_max_node", "(", ")", ...
Reports the distance in the machine topology between two nodes. The factors are a multiple of 10. It returns 0 when the distance cannot be determined. A node has distance 10 to itself. Reporting the distance requires a Linux kernel version of 2.6.10 or newer. @param node1: node idx @type node1: C{in...
[ "Reports", "the", "distance", "in", "the", "machine", "topology", "between", "two", "nodes", "." ]
eb38979c61028eb9422a4ad1eda0387cd93ea390
https://github.com/smira/py-numa/blob/eb38979c61028eb9422a4ad1eda0387cd93ea390/numa.py#L369-L387
48,948
smira/py-numa
numa.py
get_affinity
def get_affinity(pid): """ Returns the affinity mask of the process whose ID is pid. @param pid: process PID (0 == current process) @type pid: C{int} @return: set of CPU ids @rtype: C{set} """ cpuset = cpu_set_t() result = set() libnuma.sched_getaffinity(pid, sizeof(cpu_set_t)...
python
def get_affinity(pid): """ Returns the affinity mask of the process whose ID is pid. @param pid: process PID (0 == current process) @type pid: C{int} @return: set of CPU ids @rtype: C{set} """ cpuset = cpu_set_t() result = set() libnuma.sched_getaffinity(pid, sizeof(cpu_set_t)...
[ "def", "get_affinity", "(", "pid", ")", ":", "cpuset", "=", "cpu_set_t", "(", ")", "result", "=", "set", "(", ")", "libnuma", ".", "sched_getaffinity", "(", "pid", ",", "sizeof", "(", "cpu_set_t", ")", ",", "byref", "(", "cpuset", ")", ")", "for", "i...
Returns the affinity mask of the process whose ID is pid. @param pid: process PID (0 == current process) @type pid: C{int} @return: set of CPU ids @rtype: C{set}
[ "Returns", "the", "affinity", "mask", "of", "the", "process", "whose", "ID", "is", "pid", "." ]
eb38979c61028eb9422a4ad1eda0387cd93ea390
https://github.com/smira/py-numa/blob/eb38979c61028eb9422a4ad1eda0387cd93ea390/numa.py#L390-L409
48,949
smira/py-numa
numa.py
set_affinity
def set_affinity(pid, cpuset): """ Sets the CPU affinity mask of the process whose ID is pid to the value specified by mask. If pid is zero, then the calling process is used. @param pid: process PID (0 == current process) @type pid: C{int} @param cpuset: set of CPU ids @type cpuset: C{...
python
def set_affinity(pid, cpuset): """ Sets the CPU affinity mask of the process whose ID is pid to the value specified by mask. If pid is zero, then the calling process is used. @param pid: process PID (0 == current process) @type pid: C{int} @param cpuset: set of CPU ids @type cpuset: C{...
[ "def", "set_affinity", "(", "pid", ",", "cpuset", ")", ":", "_cpuset", "=", "cpu_set_t", "(", ")", "__CPU_ZERO", "(", "_cpuset", ")", "for", "i", "in", "cpuset", ":", "if", "i", "in", "range", "(", "0", ",", "sizeof", "(", "cpu_set_t", ")", "*", "8...
Sets the CPU affinity mask of the process whose ID is pid to the value specified by mask. If pid is zero, then the calling process is used. @param pid: process PID (0 == current process) @type pid: C{int} @param cpuset: set of CPU ids @type cpuset: C{set}
[ "Sets", "the", "CPU", "affinity", "mask", "of", "the", "process", "whose", "ID", "is", "pid", "to", "the", "value", "specified", "by", "mask", "." ]
eb38979c61028eb9422a4ad1eda0387cd93ea390
https://github.com/smira/py-numa/blob/eb38979c61028eb9422a4ad1eda0387cd93ea390/numa.py#L428-L447
48,950
transceptor-technology/trender
trender/block_text.py
BlockText.render
def render(self, namespace): '''Render template lines. Note: we only need to parse the namespace if we used variables in this part of the template. ''' return self._text.format_map(namespace.dictionary) \ if self._need_format else self._text
python
def render(self, namespace): '''Render template lines. Note: we only need to parse the namespace if we used variables in this part of the template. ''' return self._text.format_map(namespace.dictionary) \ if self._need_format else self._text
[ "def", "render", "(", "self", ",", "namespace", ")", ":", "return", "self", ".", "_text", ".", "format_map", "(", "namespace", ".", "dictionary", ")", "if", "self", ".", "_need_format", "else", "self", ".", "_text" ]
Render template lines. Note: we only need to parse the namespace if we used variables in this part of the template.
[ "Render", "template", "lines", "." ]
ef2b7374ea2ecc83dceb139b358ec4ad8ce7033b
https://github.com/transceptor-technology/trender/blob/ef2b7374ea2ecc83dceb139b358ec4ad8ce7033b/trender/block_text.py#L20-L27
48,951
soldag/python-pwmled
pwmled/led/rgb.py
RgbLed._assert_is_color
def _assert_is_color(value): """ Assert that the given value is a valid brightness. :param value: The value to check. """ if not isinstance(value, tuple) or len(value) != 3: raise ValueError("Color must be a RGB tuple.") if not all(0 <= x <= 255 for x in val...
python
def _assert_is_color(value): """ Assert that the given value is a valid brightness. :param value: The value to check. """ if not isinstance(value, tuple) or len(value) != 3: raise ValueError("Color must be a RGB tuple.") if not all(0 <= x <= 255 for x in val...
[ "def", "_assert_is_color", "(", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "tuple", ")", "or", "len", "(", "value", ")", "!=", "3", ":", "raise", "ValueError", "(", "\"Color must be a RGB tuple.\"", ")", "if", "not", "all", "(", "0"...
Assert that the given value is a valid brightness. :param value: The value to check.
[ "Assert", "that", "the", "given", "value", "is", "a", "valid", "brightness", "." ]
09cde36ecc0153fa81dc2a1b9bb07d1c0e418c8c
https://github.com/soldag/python-pwmled/blob/09cde36ecc0153fa81dc2a1b9bb07d1c0e418c8c/pwmled/led/rgb.py#L140-L150
48,952
saeschdivara/ArangoPy
arangodb/index/api.py
Index.remove
def remove(cls, id): """ Deletes an index with id :param id string/document-handle """ api = Client.instance().api api.index(id).delete()
python
def remove(cls, id): """ Deletes an index with id :param id string/document-handle """ api = Client.instance().api api.index(id).delete()
[ "def", "remove", "(", "cls", ",", "id", ")", ":", "api", "=", "Client", ".", "instance", "(", ")", ".", "api", "api", ".", "index", "(", "id", ")", ".", "delete", "(", ")" ]
Deletes an index with id :param id string/document-handle
[ "Deletes", "an", "index", "with", "id" ]
b924cc57bed71520fc2ef528b917daeb98e10eca
https://github.com/saeschdivara/ArangoPy/blob/b924cc57bed71520fc2ef528b917daeb98e10eca/arangodb/index/api.py#L9-L17
48,953
saeschdivara/ArangoPy
arangodb/index/api.py
Index.save
def save(self): """ Creates this index in the collection if it hasn't been already created """ api = Client.instance().api index_details = { 'type': self.index_type_obj.type_name } extra_index_attributes = self.index_type_obj.get_extra_attribute...
python
def save(self): """ Creates this index in the collection if it hasn't been already created """ api = Client.instance().api index_details = { 'type': self.index_type_obj.type_name } extra_index_attributes = self.index_type_obj.get_extra_attribute...
[ "def", "save", "(", "self", ")", ":", "api", "=", "Client", ".", "instance", "(", ")", ".", "api", "index_details", "=", "{", "'type'", ":", "self", ".", "index_type_obj", ".", "type_name", "}", "extra_index_attributes", "=", "self", ".", "index_type_obj",...
Creates this index in the collection if it hasn't been already created
[ "Creates", "this", "index", "in", "the", "collection", "if", "it", "hasn", "t", "been", "already", "created" ]
b924cc57bed71520fc2ef528b917daeb98e10eca
https://github.com/saeschdivara/ArangoPy/blob/b924cc57bed71520fc2ef528b917daeb98e10eca/arangodb/index/api.py#L30-L54
48,954
transceptor-technology/trender
trender/block_paste.py
BlockPaste._compile
def _compile(cls, lines): '''Return macro or block name from the current line.''' m = cls.RE_PASTE.match(lines.current) if m is None: raise MacroBlockUsageError( 'Incorrect macro or block usage at line {}, {}\nShould be ' 'something like: #my_macro'.fo...
python
def _compile(cls, lines): '''Return macro or block name from the current line.''' m = cls.RE_PASTE.match(lines.current) if m is None: raise MacroBlockUsageError( 'Incorrect macro or block usage at line {}, {}\nShould be ' 'something like: #my_macro'.fo...
[ "def", "_compile", "(", "cls", ",", "lines", ")", ":", "m", "=", "cls", ".", "RE_PASTE", ".", "match", "(", "lines", ".", "current", ")", "if", "m", "is", "None", ":", "raise", "MacroBlockUsageError", "(", "'Incorrect macro or block usage at line {}, {}\\nShou...
Return macro or block name from the current line.
[ "Return", "macro", "or", "block", "name", "from", "the", "current", "line", "." ]
ef2b7374ea2ecc83dceb139b358ec4ad8ce7033b
https://github.com/transceptor-technology/trender/blob/ef2b7374ea2ecc83dceb139b358ec4ad8ce7033b/trender/block_paste.py#L28-L35
48,955
freeman-lab/showit
showit/showit.py
image
def image(img, cmap='gray', bar=False, nans=True, clim=None, size=7, ax=None): """ Streamlined display of images using matplotlib. Parameters ---------- img : ndarray, 2D or 3D The image to display cmap : str or Colormap, optional, default = 'gray' A colormap to use, for non RG...
python
def image(img, cmap='gray', bar=False, nans=True, clim=None, size=7, ax=None): """ Streamlined display of images using matplotlib. Parameters ---------- img : ndarray, 2D or 3D The image to display cmap : str or Colormap, optional, default = 'gray' A colormap to use, for non RG...
[ "def", "image", "(", "img", ",", "cmap", "=", "'gray'", ",", "bar", "=", "False", ",", "nans", "=", "True", ",", "clim", "=", "None", ",", "size", "=", "7", ",", "ax", "=", "None", ")", ":", "from", "matplotlib", ".", "pyplot", "import", "axis", ...
Streamlined display of images using matplotlib. Parameters ---------- img : ndarray, 2D or 3D The image to display cmap : str or Colormap, optional, default = 'gray' A colormap to use, for non RGB images bar : boolean, optional, default = False Whether to append a colorbar...
[ "Streamlined", "display", "of", "images", "using", "matplotlib", "." ]
ef76425797c71fbe3795b4302c49ab5be6b0bacb
https://github.com/freeman-lab/showit/blob/ef76425797c71fbe3795b4302c49ab5be6b0bacb/showit/showit.py#L118-L177
48,956
saeschdivara/ArangoPy
arangodb/server/endpoint.py
Endpoint.all
def all(cls): """ Returns a list of all configured endpoints the server is listening on. For each endpoint, the list of allowed databases is returned too if set. The result is a JSON hash which has the endpoints as keys, and the list of mapped database names as v...
python
def all(cls): """ Returns a list of all configured endpoints the server is listening on. For each endpoint, the list of allowed databases is returned too if set. The result is a JSON hash which has the endpoints as keys, and the list of mapped database names as v...
[ "def", "all", "(", "cls", ")", ":", "api", "=", "Client", ".", "instance", "(", ")", ".", "api", "endpoint_list", "=", "api", ".", "endpoint", ".", "get", "(", ")", "return", "endpoint_list" ]
Returns a list of all configured endpoints the server is listening on. For each endpoint, the list of allowed databases is returned too if set. The result is a JSON hash which has the endpoints as keys, and the list of mapped database names as values for each endpoint. ...
[ "Returns", "a", "list", "of", "all", "configured", "endpoints", "the", "server", "is", "listening", "on", ".", "For", "each", "endpoint", "the", "list", "of", "allowed", "databases", "is", "returned", "too", "if", "set", "." ]
b924cc57bed71520fc2ef528b917daeb98e10eca
https://github.com/saeschdivara/ArangoPy/blob/b924cc57bed71520fc2ef528b917daeb98e10eca/arangodb/server/endpoint.py#L10-L32
48,957
saeschdivara/ArangoPy
arangodb/server/endpoint.py
Endpoint.create
def create(cls, url, databases): """ If databases is an empty list, all databases present in the server will become accessible via the endpoint, with the _system database being the default database. If databases is non-empty, only the specified databases will become availabl...
python
def create(cls, url, databases): """ If databases is an empty list, all databases present in the server will become accessible via the endpoint, with the _system database being the default database. If databases is non-empty, only the specified databases will become availabl...
[ "def", "create", "(", "cls", ",", "url", ",", "databases", ")", ":", "api", "=", "Client", ".", "instance", "(", ")", ".", "api", "result", "=", "api", ".", "endpoint", ".", "post", "(", "data", "=", "{", "'endpoint'", ":", "url", ",", "'databases'...
If databases is an empty list, all databases present in the server will become accessible via the endpoint, with the _system database being the default database. If databases is non-empty, only the specified databases will become available via the endpoint. The first database name i...
[ "If", "databases", "is", "an", "empty", "list", "all", "databases", "present", "in", "the", "server", "will", "become", "accessible", "via", "the", "endpoint", "with", "the", "_system", "database", "being", "the", "default", "database", "." ]
b924cc57bed71520fc2ef528b917daeb98e10eca
https://github.com/saeschdivara/ArangoPy/blob/b924cc57bed71520fc2ef528b917daeb98e10eca/arangodb/server/endpoint.py#L35-L62
48,958
saeschdivara/ArangoPy
arangodb/server/endpoint.py
Endpoint.destroy
def destroy(cls, url): """ This operation deletes an existing endpoint from the list of all endpoints, and makes the server stop listening on the endpoint. *Note*: deleting and disconnecting an endpoint is allowed in the system database only. Calling this action ...
python
def destroy(cls, url): """ This operation deletes an existing endpoint from the list of all endpoints, and makes the server stop listening on the endpoint. *Note*: deleting and disconnecting an endpoint is allowed in the system database only. Calling this action ...
[ "def", "destroy", "(", "cls", ",", "url", ")", ":", "api", "=", "Client", ".", "instance", "(", ")", ".", "api", "api", ".", "endpoint", "(", "url", ")", ".", "delete", "(", ")" ]
This operation deletes an existing endpoint from the list of all endpoints, and makes the server stop listening on the endpoint. *Note*: deleting and disconnecting an endpoint is allowed in the system database only. Calling this action in any other database will make the server retu...
[ "This", "operation", "deletes", "an", "existing", "endpoint", "from", "the", "list", "of", "all", "endpoints", "and", "makes", "the", "server", "stop", "listening", "on", "the", "endpoint", "." ]
b924cc57bed71520fc2ef528b917daeb98e10eca
https://github.com/saeschdivara/ArangoPy/blob/b924cc57bed71520fc2ef528b917daeb98e10eca/arangodb/server/endpoint.py#L65-L80
48,959
txamqp/txamqp
src/txamqp/client.py
TwistedEvent.wait
def wait(self): """ Return a deferred that will be fired when the event is fired. """ d = defer.Deferred() if self._result is None: self._waiters.append(d) else: self._fire_deferred(d) return d
python
def wait(self): """ Return a deferred that will be fired when the event is fired. """ d = defer.Deferred() if self._result is None: self._waiters.append(d) else: self._fire_deferred(d) return d
[ "def", "wait", "(", "self", ")", ":", "d", "=", "defer", ".", "Deferred", "(", ")", "if", "self", ".", "_result", "is", "None", ":", "self", ".", "_waiters", ".", "append", "(", "d", ")", "else", ":", "self", ".", "_fire_deferred", "(", "d", ")",...
Return a deferred that will be fired when the event is fired.
[ "Return", "a", "deferred", "that", "will", "be", "fired", "when", "the", "event", "is", "fired", "." ]
10caf998dd8c05a7321cd10c24a83832bf58bd0c
https://github.com/txamqp/txamqp/blob/10caf998dd8c05a7321cd10c24a83832bf58bd0c/src/txamqp/client.py#L75-L84
48,960
txamqp/txamqp
src/txamqp/protocol.py
AMQChannel.close
def close(self, reason): """Explicitly close a channel""" self._closing = True self.do_close(reason) self._closing = False
python
def close(self, reason): """Explicitly close a channel""" self._closing = True self.do_close(reason) self._closing = False
[ "def", "close", "(", "self", ",", "reason", ")", ":", "self", ".", "_closing", "=", "True", "self", ".", "do_close", "(", "reason", ")", "self", ".", "_closing", "=", "False" ]
Explicitly close a channel
[ "Explicitly", "close", "a", "channel" ]
10caf998dd8c05a7321cd10c24a83832bf58bd0c
https://github.com/txamqp/txamqp/blob/10caf998dd8c05a7321cd10c24a83832bf58bd0c/src/txamqp/protocol.py#L43-L47
48,961
txamqp/txamqp
src/txamqp/protocol.py
AMQChannel._raise_closed
def _raise_closed(reason): """Raise the appropriate Closed-based error for the given reason.""" if isinstance(reason, Message): if reason.method.klass.name == "channel": raise ChannelClosed(reason) elif reason.method.klass.name == "connection": rai...
python
def _raise_closed(reason): """Raise the appropriate Closed-based error for the given reason.""" if isinstance(reason, Message): if reason.method.klass.name == "channel": raise ChannelClosed(reason) elif reason.method.klass.name == "connection": rai...
[ "def", "_raise_closed", "(", "reason", ")", ":", "if", "isinstance", "(", "reason", ",", "Message", ")", ":", "if", "reason", ".", "method", ".", "klass", ".", "name", "==", "\"channel\"", ":", "raise", "ChannelClosed", "(", "reason", ")", "elif", "reaso...
Raise the appropriate Closed-based error for the given reason.
[ "Raise", "the", "appropriate", "Closed", "-", "based", "error", "for", "the", "given", "reason", "." ]
10caf998dd8c05a7321cd10c24a83832bf58bd0c
https://github.com/txamqp/txamqp/blob/10caf998dd8c05a7321cd10c24a83832bf58bd0c/src/txamqp/protocol.py#L120-L127
48,962
txamqp/txamqp
src/txamqp/protocol.py
AMQClient.close
def close(self, reason=None, within=0): """Explicitely close the connection. @param reason: Optional closing reason. If not given, ConnectionDone will be used. @param within: Shutdown the client within this amount of seconds. If zero (the default), all channels and queue...
python
def close(self, reason=None, within=0): """Explicitely close the connection. @param reason: Optional closing reason. If not given, ConnectionDone will be used. @param within: Shutdown the client within this amount of seconds. If zero (the default), all channels and queue...
[ "def", "close", "(", "self", ",", "reason", "=", "None", ",", "within", "=", "0", ")", ":", "if", "self", ".", "closed", ":", "return", "if", "reason", "is", "None", ":", "reason", "=", "ConnectionDone", "(", ")", "if", "within", ">", "0", ":", "...
Explicitely close the connection. @param reason: Optional closing reason. If not given, ConnectionDone will be used. @param within: Shutdown the client within this amount of seconds. If zero (the default), all channels and queues will be closed immediately. If greate...
[ "Explicitely", "close", "the", "connection", "." ]
10caf998dd8c05a7321cd10c24a83832bf58bd0c
https://github.com/txamqp/txamqp/blob/10caf998dd8c05a7321cd10c24a83832bf58bd0c/src/txamqp/protocol.py#L333-L362
48,963
transceptor-technology/trender
trender/namespace.py
Namespace.copy
def copy(self): '''Returns a copy of this namespace. Note: we truly create a copy of the dictionary but keep _macros and _blocks. ''' return Namespace(self.dictionary.copy(), self._macros, self._blocks)
python
def copy(self): '''Returns a copy of this namespace. Note: we truly create a copy of the dictionary but keep _macros and _blocks. ''' return Namespace(self.dictionary.copy(), self._macros, self._blocks)
[ "def", "copy", "(", "self", ")", ":", "return", "Namespace", "(", "self", ".", "dictionary", ".", "copy", "(", ")", ",", "self", ".", "_macros", ",", "self", ".", "_blocks", ")" ]
Returns a copy of this namespace. Note: we truly create a copy of the dictionary but keep _macros and _blocks.
[ "Returns", "a", "copy", "of", "this", "namespace", "." ]
ef2b7374ea2ecc83dceb139b358ec4ad8ce7033b
https://github.com/transceptor-technology/trender/blob/ef2b7374ea2ecc83dceb139b358ec4ad8ce7033b/trender/namespace.py#L47-L53
48,964
romana/vpc-router
vpcrouter/monitor/plugins/tcp.py
Tcp._do_tcp_check
def _do_tcp_check(self, ip, results): """ Attempt to establish a TCP connection. If not successful, record the IP in the results dict. Always closes the connection at the end. """ try: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) soc...
python
def _do_tcp_check(self, ip, results): """ Attempt to establish a TCP connection. If not successful, record the IP in the results dict. Always closes the connection at the end. """ try: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) soc...
[ "def", "_do_tcp_check", "(", "self", ",", "ip", ",", "results", ")", ":", "try", ":", "sock", "=", "socket", ".", "socket", "(", "socket", ".", "AF_INET", ",", "socket", ".", "SOCK_STREAM", ")", "sock", ".", "settimeout", "(", "1", ")", "sock", ".", ...
Attempt to establish a TCP connection. If not successful, record the IP in the results dict. Always closes the connection at the end.
[ "Attempt", "to", "establish", "a", "TCP", "connection", "." ]
d696c2e023f1111ceb61f9c6fbabfafed8e14040
https://github.com/romana/vpc-router/blob/d696c2e023f1111ceb61f9c6fbabfafed8e14040/vpcrouter/monitor/plugins/tcp.py#L40-L58
48,965
romana/vpc-router
vpcrouter/monitor/plugins/tcp.py
Tcp.do_health_checks
def do_health_checks(self, list_of_ips): """ Perform a health check on a list of IP addresses. Each check (we use a TCP connection attempt) is run in its own thread. Gather up the results and return the list of those addresses that failed the test and the list of questionable I...
python
def do_health_checks(self, list_of_ips): """ Perform a health check on a list of IP addresses. Each check (we use a TCP connection attempt) is run in its own thread. Gather up the results and return the list of those addresses that failed the test and the list of questionable I...
[ "def", "do_health_checks", "(", "self", ",", "list_of_ips", ")", ":", "threads", "=", "[", "]", "results", "=", "[", "]", "# Start the thread for each IP we wish to check.", "for", "count", ",", "ip", "in", "enumerate", "(", "list_of_ips", ")", ":", "thread", ...
Perform a health check on a list of IP addresses. Each check (we use a TCP connection attempt) is run in its own thread. Gather up the results and return the list of those addresses that failed the test and the list of questionable IPs. TODO: Currently, this starts a thread for every ...
[ "Perform", "a", "health", "check", "on", "a", "list", "of", "IP", "addresses", "." ]
d696c2e023f1111ceb61f9c6fbabfafed8e14040
https://github.com/romana/vpc-router/blob/d696c2e023f1111ceb61f9c6fbabfafed8e14040/vpcrouter/monitor/plugins/tcp.py#L67-L99
48,966
romana/vpc-router
vpcrouter/monitor/plugins/tcp.py
Tcp.start
def start(self): """ Start the monitoring thread of the plugin. """ logging.info("TCP health monitor plugin: Starting to watch " "instances.") self.monitor_thread = threading.Thread(target = self.start_monitoring, ...
python
def start(self): """ Start the monitoring thread of the plugin. """ logging.info("TCP health monitor plugin: Starting to watch " "instances.") self.monitor_thread = threading.Thread(target = self.start_monitoring, ...
[ "def", "start", "(", "self", ")", ":", "logging", ".", "info", "(", "\"TCP health monitor plugin: Starting to watch \"", "\"instances.\"", ")", "self", ".", "monitor_thread", "=", "threading", ".", "Thread", "(", "target", "=", "self", ".", "start_monitoring", ","...
Start the monitoring thread of the plugin.
[ "Start", "the", "monitoring", "thread", "of", "the", "plugin", "." ]
d696c2e023f1111ceb61f9c6fbabfafed8e14040
https://github.com/romana/vpc-router/blob/d696c2e023f1111ceb61f9c6fbabfafed8e14040/vpcrouter/monitor/plugins/tcp.py#L101-L112
48,967
romana/vpc-router
vpcrouter/monitor/plugins/tcp.py
Tcp.add_arguments
def add_arguments(cls, parser, sys_arg_list=None): """ Arguments for the TCP health monitor plugin. """ parser.add_argument('--tcp_check_interval', dest='tcp_check_interval', required=False, default=2, type=float, ...
python
def add_arguments(cls, parser, sys_arg_list=None): """ Arguments for the TCP health monitor plugin. """ parser.add_argument('--tcp_check_interval', dest='tcp_check_interval', required=False, default=2, type=float, ...
[ "def", "add_arguments", "(", "cls", ",", "parser", ",", "sys_arg_list", "=", "None", ")", ":", "parser", ".", "add_argument", "(", "'--tcp_check_interval'", ",", "dest", "=", "'tcp_check_interval'", ",", "required", "=", "False", ",", "default", "=", "2", ",...
Arguments for the TCP health monitor plugin.
[ "Arguments", "for", "the", "TCP", "health", "monitor", "plugin", "." ]
d696c2e023f1111ceb61f9c6fbabfafed8e14040
https://github.com/romana/vpc-router/blob/d696c2e023f1111ceb61f9c6fbabfafed8e14040/vpcrouter/monitor/plugins/tcp.py#L142-L158
48,968
deeplook/sparklines
sparklines/sparklines.py
_check_negatives
def _check_negatives(numbers): "Raise warning for negative numbers." negatives = filter(lambda x: x < 0, filter(None, numbers)) if any(negatives): neg_values = ', '.join(map(str, negatives)) msg = 'Found negative value(s): {0!s}. '.format(neg_values) msg += 'While not forbidden, the...
python
def _check_negatives(numbers): "Raise warning for negative numbers." negatives = filter(lambda x: x < 0, filter(None, numbers)) if any(negatives): neg_values = ', '.join(map(str, negatives)) msg = 'Found negative value(s): {0!s}. '.format(neg_values) msg += 'While not forbidden, the...
[ "def", "_check_negatives", "(", "numbers", ")", ":", "negatives", "=", "filter", "(", "lambda", "x", ":", "x", "<", "0", ",", "filter", "(", "None", ",", "numbers", ")", ")", "if", "any", "(", "negatives", ")", ":", "neg_values", "=", "', '", ".", ...
Raise warning for negative numbers.
[ "Raise", "warning", "for", "negative", "numbers", "." ]
dd2525b0358dce1a5aa7088e706201440d39657e
https://github.com/deeplook/sparklines/blob/dd2525b0358dce1a5aa7088e706201440d39657e/sparklines/sparklines.py#L37-L45
48,969
deeplook/sparklines
sparklines/sparklines.py
_check_emphasis
def _check_emphasis(numbers, emph): "Find index postions in list of numbers to be emphasized according to emph." pat = '(\w+)\:(eq|gt|ge|lt|le)\:(.+)' # find values to be highlighted emphasized = {} # index: color for (i, n) in enumerate(numbers): if n is None: continue ...
python
def _check_emphasis(numbers, emph): "Find index postions in list of numbers to be emphasized according to emph." pat = '(\w+)\:(eq|gt|ge|lt|le)\:(.+)' # find values to be highlighted emphasized = {} # index: color for (i, n) in enumerate(numbers): if n is None: continue ...
[ "def", "_check_emphasis", "(", "numbers", ",", "emph", ")", ":", "pat", "=", "'(\\w+)\\:(eq|gt|ge|lt|le)\\:(.+)'", "# find values to be highlighted", "emphasized", "=", "{", "}", "# index: color", "for", "(", "i", ",", "n", ")", "in", "enumerate", "(", "numbers", ...
Find index postions in list of numbers to be emphasized according to emph.
[ "Find", "index", "postions", "in", "list", "of", "numbers", "to", "be", "emphasized", "according", "to", "emph", "." ]
dd2525b0358dce1a5aa7088e706201440d39657e
https://github.com/deeplook/sparklines/blob/dd2525b0358dce1a5aa7088e706201440d39657e/sparklines/sparklines.py#L48-L70
48,970
deeplook/sparklines
sparklines/sparklines.py
scale_values
def scale_values(numbers, num_lines=1, minimum=None, maximum=None): "Scale input numbers to appropriate range." # find min/max values, ignoring Nones filtered = [n for n in numbers if n is not None] min_ = min(filtered) if minimum is None else minimum max_ = max(filtered) if maximum is None else ma...
python
def scale_values(numbers, num_lines=1, minimum=None, maximum=None): "Scale input numbers to appropriate range." # find min/max values, ignoring Nones filtered = [n for n in numbers if n is not None] min_ = min(filtered) if minimum is None else minimum max_ = max(filtered) if maximum is None else ma...
[ "def", "scale_values", "(", "numbers", ",", "num_lines", "=", "1", ",", "minimum", "=", "None", ",", "maximum", "=", "None", ")", ":", "# find min/max values, ignoring Nones", "filtered", "=", "[", "n", "for", "n", "in", "numbers", "if", "n", "is", "not", ...
Scale input numbers to appropriate range.
[ "Scale", "input", "numbers", "to", "appropriate", "range", "." ]
dd2525b0358dce1a5aa7088e706201440d39657e
https://github.com/deeplook/sparklines/blob/dd2525b0358dce1a5aa7088e706201440d39657e/sparklines/sparklines.py#L73-L99
48,971
deeplook/sparklines
sparklines/sparklines.py
sparklines
def sparklines(numbers=[], num_lines=1, emph=None, verbose=False, minimum=None, maximum=None, wrap=None): """ Return a list of 'sparkline' strings for a given list of input numbers. The list of input numbers may contain None values, too, for which the resulting sparkline will contain a blank ch...
python
def sparklines(numbers=[], num_lines=1, emph=None, verbose=False, minimum=None, maximum=None, wrap=None): """ Return a list of 'sparkline' strings for a given list of input numbers. The list of input numbers may contain None values, too, for which the resulting sparkline will contain a blank ch...
[ "def", "sparklines", "(", "numbers", "=", "[", "]", ",", "num_lines", "=", "1", ",", "emph", "=", "None", ",", "verbose", "=", "False", ",", "minimum", "=", "None", ",", "maximum", "=", "None", ",", "wrap", "=", "None", ")", ":", "assert", "num_lin...
Return a list of 'sparkline' strings for a given list of input numbers. The list of input numbers may contain None values, too, for which the resulting sparkline will contain a blank character (a space). Examples: sparklines([3, 1, 4, 1, 5, 9, 2, 6]) -> ['▃▁▄▁▄█▂▅'] sparklines([3,...
[ "Return", "a", "list", "of", "sparkline", "strings", "for", "a", "given", "list", "of", "input", "numbers", "." ]
dd2525b0358dce1a5aa7088e706201440d39657e
https://github.com/deeplook/sparklines/blob/dd2525b0358dce1a5aa7088e706201440d39657e/sparklines/sparklines.py#L102-L156
48,972
deeplook/sparklines
sparklines/sparklines.py
batch
def batch(batch_size, items): "Batch items into groups of batch_size" items = list(items) if batch_size is None: return [items] MISSING = object() padded_items = items + [MISSING] * (batch_size - 1) groups = zip(*[padded_items[i::batch_size] for i in range(batch_size)]) return [[item...
python
def batch(batch_size, items): "Batch items into groups of batch_size" items = list(items) if batch_size is None: return [items] MISSING = object() padded_items = items + [MISSING] * (batch_size - 1) groups = zip(*[padded_items[i::batch_size] for i in range(batch_size)]) return [[item...
[ "def", "batch", "(", "batch_size", ",", "items", ")", ":", "items", "=", "list", "(", "items", ")", "if", "batch_size", "is", "None", ":", "return", "[", "items", "]", "MISSING", "=", "object", "(", ")", "padded_items", "=", "items", "+", "[", "MISSI...
Batch items into groups of batch_size
[ "Batch", "items", "into", "groups", "of", "batch_size" ]
dd2525b0358dce1a5aa7088e706201440d39657e
https://github.com/deeplook/sparklines/blob/dd2525b0358dce1a5aa7088e706201440d39657e/sparklines/sparklines.py#L160-L168
48,973
deeplook/sparklines
sparklines/sparklines.py
demo
def demo(nums=[]): "Print a few usage examples on stdout." nums = nums or [3, 1, 4, 1, 5, 9, 2, 6] fmt = lambda num: '{0:g}'.format(num) if isinstance(num, (float, int)) else 'None' nums1 = list(map(fmt, nums)) if __name__ == '__main__': prog = sys.argv[0] else: prog = 'sparkli...
python
def demo(nums=[]): "Print a few usage examples on stdout." nums = nums or [3, 1, 4, 1, 5, 9, 2, 6] fmt = lambda num: '{0:g}'.format(num) if isinstance(num, (float, int)) else 'None' nums1 = list(map(fmt, nums)) if __name__ == '__main__': prog = sys.argv[0] else: prog = 'sparkli...
[ "def", "demo", "(", "nums", "=", "[", "]", ")", ":", "nums", "=", "nums", "or", "[", "3", ",", "1", ",", "4", ",", "1", ",", "5", ",", "9", ",", "2", ",", "6", "]", "fmt", "=", "lambda", "num", ":", "'{0:g}'", ".", "format", "(", "num", ...
Print a few usage examples on stdout.
[ "Print", "a", "few", "usage", "examples", "on", "stdout", "." ]
dd2525b0358dce1a5aa7088e706201440d39657e
https://github.com/deeplook/sparklines/blob/dd2525b0358dce1a5aa7088e706201440d39657e/sparklines/sparklines.py#L182-L225
48,974
romana/vpc-router
vpcrouter/monitor/plugins/multi.py
ExpireSet._expire_data
def _expire_data(self): """ Remove all expired entries. """ expire_time_stamp = time.time() - self.expire_time self.timed_data = {d: t for d, t in self.timed_data.items() if t > expire_time_stamp}
python
def _expire_data(self): """ Remove all expired entries. """ expire_time_stamp = time.time() - self.expire_time self.timed_data = {d: t for d, t in self.timed_data.items() if t > expire_time_stamp}
[ "def", "_expire_data", "(", "self", ")", ":", "expire_time_stamp", "=", "time", ".", "time", "(", ")", "-", "self", ".", "expire_time", "self", ".", "timed_data", "=", "{", "d", ":", "t", "for", "d", ",", "t", "in", "self", ".", "timed_data", ".", ...
Remove all expired entries.
[ "Remove", "all", "expired", "entries", "." ]
d696c2e023f1111ceb61f9c6fbabfafed8e14040
https://github.com/romana/vpc-router/blob/d696c2e023f1111ceb61f9c6fbabfafed8e14040/vpcrouter/monitor/plugins/multi.py#L58-L65
48,975
romana/vpc-router
vpcrouter/monitor/plugins/multi.py
ExpireSet.update
def update(self, data_set): """ Refresh the time of all specified elements in the supplied data set. """ now = time.time() for d in data_set: self.timed_data[d] = now self._expire_data()
python
def update(self, data_set): """ Refresh the time of all specified elements in the supplied data set. """ now = time.time() for d in data_set: self.timed_data[d] = now self._expire_data()
[ "def", "update", "(", "self", ",", "data_set", ")", ":", "now", "=", "time", ".", "time", "(", ")", "for", "d", "in", "data_set", ":", "self", ".", "timed_data", "[", "d", "]", "=", "now", "self", ".", "_expire_data", "(", ")" ]
Refresh the time of all specified elements in the supplied data set.
[ "Refresh", "the", "time", "of", "all", "specified", "elements", "in", "the", "supplied", "data", "set", "." ]
d696c2e023f1111ceb61f9c6fbabfafed8e14040
https://github.com/romana/vpc-router/blob/d696c2e023f1111ceb61f9c6fbabfafed8e14040/vpcrouter/monitor/plugins/multi.py#L67-L75
48,976
romana/vpc-router
vpcrouter/monitor/plugins/multi.py
Multi._accumulate_ips_from_plugins
def _accumulate_ips_from_plugins(self, ip_type_name, plugin_queue_lookup, ip_accumulator): """ Retrieve all IPs of a given type from all sub-plugins. ip_type_name: A name of the type of IP we are working with. Used for nic...
python
def _accumulate_ips_from_plugins(self, ip_type_name, plugin_queue_lookup, ip_accumulator): """ Retrieve all IPs of a given type from all sub-plugins. ip_type_name: A name of the type of IP we are working with. Used for nic...
[ "def", "_accumulate_ips_from_plugins", "(", "self", ",", "ip_type_name", ",", "plugin_queue_lookup", ",", "ip_accumulator", ")", ":", "all_reported_ips", "=", "set", "(", ")", "for", "pname", ",", "q", "in", "plugin_queue_lookup", ".", "items", "(", ")", ":", ...
Retrieve all IPs of a given type from all sub-plugins. ip_type_name: A name of the type of IP we are working with. Used for nice log messages. Example 'failed', 'questionable'. plugin_queue_lookup: Dictionary to lookup the queues (of a gi...
[ "Retrieve", "all", "IPs", "of", "a", "given", "type", "from", "all", "sub", "-", "plugins", "." ]
d696c2e023f1111ceb61f9c6fbabfafed8e14040
https://github.com/romana/vpc-router/blob/d696c2e023f1111ceb61f9c6fbabfafed8e14040/vpcrouter/monitor/plugins/multi.py#L205-L263
48,977
romana/vpc-router
vpcrouter/monitor/plugins/multi.py
Multi.start_monitoring
def start_monitoring(self): """ Pass IP lists to monitor sub-plugins and get results from them. Override the common definition of this function, since in the multi plugin it's a little different: Instead of monitoring ourselves, we just use a number of other plugins to gather re...
python
def start_monitoring(self): """ Pass IP lists to monitor sub-plugins and get results from them. Override the common definition of this function, since in the multi plugin it's a little different: Instead of monitoring ourselves, we just use a number of other plugins to gather re...
[ "def", "start_monitoring", "(", "self", ")", ":", "logging", ".", "info", "(", "\"Multi-plugin health monitor: Started in thread.\"", ")", "try", ":", "while", "True", ":", "# Get new IP addresses and pass them on to the sub-plugins", "new_ips", "=", "self", ".", "get_new...
Pass IP lists to monitor sub-plugins and get results from them. Override the common definition of this function, since in the multi plugin it's a little different: Instead of monitoring ourselves, we just use a number of other plugins to gather results. The multi plugin just serves as a...
[ "Pass", "IP", "lists", "to", "monitor", "sub", "-", "plugins", "and", "get", "results", "from", "them", "." ]
d696c2e023f1111ceb61f9c6fbabfafed8e14040
https://github.com/romana/vpc-router/blob/d696c2e023f1111ceb61f9c6fbabfafed8e14040/vpcrouter/monitor/plugins/multi.py#L265-L310
48,978
romana/vpc-router
vpcrouter/monitor/plugins/multi.py
Multi.load_sub_plugins_from_str
def load_sub_plugins_from_str(cls, plugins_str): """ Load plugin classes based on column separated list of plugin names. Returns dict with plugin name as key and class as value. """ plugin_classes = {} if plugins_str: for plugin_name in plugins_str.split(":"...
python
def load_sub_plugins_from_str(cls, plugins_str): """ Load plugin classes based on column separated list of plugin names. Returns dict with plugin name as key and class as value. """ plugin_classes = {} if plugins_str: for plugin_name in plugins_str.split(":"...
[ "def", "load_sub_plugins_from_str", "(", "cls", ",", "plugins_str", ")", ":", "plugin_classes", "=", "{", "}", "if", "plugins_str", ":", "for", "plugin_name", "in", "plugins_str", ".", "split", "(", "\":\"", ")", ":", "pc", "=", "load_plugin", "(", "plugin_n...
Load plugin classes based on column separated list of plugin names. Returns dict with plugin name as key and class as value.
[ "Load", "plugin", "classes", "based", "on", "column", "separated", "list", "of", "plugin", "names", "." ]
d696c2e023f1111ceb61f9c6fbabfafed8e14040
https://github.com/romana/vpc-router/blob/d696c2e023f1111ceb61f9c6fbabfafed8e14040/vpcrouter/monitor/plugins/multi.py#L345-L357
48,979
romana/vpc-router
vpcrouter/monitor/plugins/multi.py
Multi.add_arguments
def add_arguments(cls, parser, sys_arg_list=None): """ Arguments for the Multi health monitor plugin. """ parser.add_argument('--multi_plugins', dest='multi_plugins', required=True, help="Column seperated list of health monitor " ...
python
def add_arguments(cls, parser, sys_arg_list=None): """ Arguments for the Multi health monitor plugin. """ parser.add_argument('--multi_plugins', dest='multi_plugins', required=True, help="Column seperated list of health monitor " ...
[ "def", "add_arguments", "(", "cls", ",", "parser", ",", "sys_arg_list", "=", "None", ")", ":", "parser", ".", "add_argument", "(", "'--multi_plugins'", ",", "dest", "=", "'multi_plugins'", ",", "required", "=", "True", ",", "help", "=", "\"Column seperated lis...
Arguments for the Multi health monitor plugin.
[ "Arguments", "for", "the", "Multi", "health", "monitor", "plugin", "." ]
d696c2e023f1111ceb61f9c6fbabfafed8e14040
https://github.com/romana/vpc-router/blob/d696c2e023f1111ceb61f9c6fbabfafed8e14040/vpcrouter/monitor/plugins/multi.py#L360-L388
48,980
romana/vpc-router
vpcrouter/watcher/plugins/configfile.py
read_route_spec_config
def read_route_spec_config(fname): """ Read, parse and sanity check the route spec config file. The config file needs to be in this format: { "<CIDR-1>" : [ "host-1-ip", "host-2-ip", "host-3-ip" ], "<CIDR-2>" : [ "host-4-ip", "host-5-ip" ], "<CIDR-3>" : [ "host-6-ip", "host-7-i...
python
def read_route_spec_config(fname): """ Read, parse and sanity check the route spec config file. The config file needs to be in this format: { "<CIDR-1>" : [ "host-1-ip", "host-2-ip", "host-3-ip" ], "<CIDR-2>" : [ "host-4-ip", "host-5-ip" ], "<CIDR-3>" : [ "host-6-ip", "host-7-i...
[ "def", "read_route_spec_config", "(", "fname", ")", ":", "try", ":", "try", ":", "f", "=", "open", "(", "fname", ",", "\"r\"", ")", "except", "IOError", "as", "e", ":", "# Cannot open file? Doesn't exist?", "raise", "ValueError", "(", "\"Cannot open file: \"", ...
Read, parse and sanity check the route spec config file. The config file needs to be in this format: { "<CIDR-1>" : [ "host-1-ip", "host-2-ip", "host-3-ip" ], "<CIDR-2>" : [ "host-4-ip", "host-5-ip" ], "<CIDR-3>" : [ "host-6-ip", "host-7-ip", "host-8-ip", "host-9-ip" ] } Retur...
[ "Read", "parse", "and", "sanity", "check", "the", "route", "spec", "config", "file", "." ]
d696c2e023f1111ceb61f9c6fbabfafed8e14040
https://github.com/romana/vpc-router/blob/d696c2e023f1111ceb61f9c6fbabfafed8e14040/vpcrouter/watcher/plugins/configfile.py#L71-L101
48,981
romana/vpc-router
vpcrouter/watcher/plugins/configfile.py
Configfile.start
def start(self): """ Start the configfile change monitoring thread. """ fname = self.conf['file'] logging.info("Configfile watcher plugin: Starting to watch route spec " "file '%s' for changes..." % fname) # Initial content of file needs to be proce...
python
def start(self): """ Start the configfile change monitoring thread. """ fname = self.conf['file'] logging.info("Configfile watcher plugin: Starting to watch route spec " "file '%s' for changes..." % fname) # Initial content of file needs to be proce...
[ "def", "start", "(", "self", ")", ":", "fname", "=", "self", ".", "conf", "[", "'file'", "]", "logging", ".", "info", "(", "\"Configfile watcher plugin: Starting to watch route spec \"", "\"file '%s' for changes...\"", "%", "fname", ")", "# Initial content of file needs...
Start the configfile change monitoring thread.
[ "Start", "the", "configfile", "change", "monitoring", "thread", "." ]
d696c2e023f1111ceb61f9c6fbabfafed8e14040
https://github.com/romana/vpc-router/blob/d696c2e023f1111ceb61f9c6fbabfafed8e14040/vpcrouter/watcher/plugins/configfile.py#L120-L156
48,982
romana/vpc-router
vpcrouter/watcher/plugins/configfile.py
Configfile.stop
def stop(self): """ Stop the config change monitoring thread. """ self.observer_thread.stop() self.observer_thread.join() logging.info("Configfile watcher plugin: Stopped")
python
def stop(self): """ Stop the config change monitoring thread. """ self.observer_thread.stop() self.observer_thread.join() logging.info("Configfile watcher plugin: Stopped")
[ "def", "stop", "(", "self", ")", ":", "self", ".", "observer_thread", ".", "stop", "(", ")", "self", ".", "observer_thread", ".", "join", "(", ")", "logging", ".", "info", "(", "\"Configfile watcher plugin: Stopped\"", ")" ]
Stop the config change monitoring thread.
[ "Stop", "the", "config", "change", "monitoring", "thread", "." ]
d696c2e023f1111ceb61f9c6fbabfafed8e14040
https://github.com/romana/vpc-router/blob/d696c2e023f1111ceb61f9c6fbabfafed8e14040/vpcrouter/watcher/plugins/configfile.py#L158-L165
48,983
romana/vpc-router
vpcrouter/watcher/plugins/configfile.py
Configfile.add_arguments
def add_arguments(cls, parser, sys_arg_list=None): """ Arguments for the configfile mode. """ parser.add_argument('-f', '--file', dest='file', required=True, help="config file for routing groups " "(only in configfile mode)") ...
python
def add_arguments(cls, parser, sys_arg_list=None): """ Arguments for the configfile mode. """ parser.add_argument('-f', '--file', dest='file', required=True, help="config file for routing groups " "(only in configfile mode)") ...
[ "def", "add_arguments", "(", "cls", ",", "parser", ",", "sys_arg_list", "=", "None", ")", ":", "parser", ".", "add_argument", "(", "'-f'", ",", "'--file'", ",", "dest", "=", "'file'", ",", "required", "=", "True", ",", "help", "=", "\"config file for routi...
Arguments for the configfile mode.
[ "Arguments", "for", "the", "configfile", "mode", "." ]
d696c2e023f1111ceb61f9c6fbabfafed8e14040
https://github.com/romana/vpc-router/blob/d696c2e023f1111ceb61f9c6fbabfafed8e14040/vpcrouter/watcher/plugins/configfile.py#L187-L195
48,984
romana/vpc-router
vpcrouter/watcher/plugins/configfile.py
Configfile.check_arguments
def check_arguments(cls, conf): """ Sanity checks for options needed for configfile mode. """ try: # Check we have access to the config file f = open(conf['file'], "r") f.close() except IOError as e: raise ArgsError("Cannot open co...
python
def check_arguments(cls, conf): """ Sanity checks for options needed for configfile mode. """ try: # Check we have access to the config file f = open(conf['file'], "r") f.close() except IOError as e: raise ArgsError("Cannot open co...
[ "def", "check_arguments", "(", "cls", ",", "conf", ")", ":", "try", ":", "# Check we have access to the config file", "f", "=", "open", "(", "conf", "[", "'file'", "]", ",", "\"r\"", ")", "f", ".", "close", "(", ")", "except", "IOError", "as", "e", ":", ...
Sanity checks for options needed for configfile mode.
[ "Sanity", "checks", "for", "options", "needed", "for", "configfile", "mode", "." ]
d696c2e023f1111ceb61f9c6fbabfafed8e14040
https://github.com/romana/vpc-router/blob/d696c2e023f1111ceb61f9c6fbabfafed8e14040/vpcrouter/watcher/plugins/configfile.py#L198-L209
48,985
romana/vpc-router
vpcrouter/plugin_framework/__init__.py
load_plugin
def load_plugin(plugin_name, default_plugin_module): """ Load a plugin plugin. Supports loading of plugins that are part of the vpcrouter, as well as external plugins: If the plugin name has a dotted notation then it assumes it's an external plugin and the dotted notation is the complete import...
python
def load_plugin(plugin_name, default_plugin_module): """ Load a plugin plugin. Supports loading of plugins that are part of the vpcrouter, as well as external plugins: If the plugin name has a dotted notation then it assumes it's an external plugin and the dotted notation is the complete import...
[ "def", "load_plugin", "(", "plugin_name", ",", "default_plugin_module", ")", ":", "try", ":", "if", "\".\"", "in", "plugin_name", ":", "# Assume external plugin, full path", "plugin_mod_name", "=", "plugin_name", "plugin_class_name", "=", "plugin_name", ".", "split", ...
Load a plugin plugin. Supports loading of plugins that are part of the vpcrouter, as well as external plugins: If the plugin name has a dotted notation then it assumes it's an external plugin and the dotted notation is the complete import path. If it's just a single word then it looks for the plugin in...
[ "Load", "a", "plugin", "plugin", "." ]
d696c2e023f1111ceb61f9c6fbabfafed8e14040
https://github.com/romana/vpc-router/blob/d696c2e023f1111ceb61f9c6fbabfafed8e14040/vpcrouter/plugin_framework/__init__.py#L29-L63
48,986
liamw9534/pyconnman
pyconnman/interface.py
ConnInterface.remove_signal_receiver
def remove_signal_receiver(self, signal): """ Remove an installed signal receiver by signal name. See also :py:meth:`add_signal_receiver` :py:exc:`exceptions.ConnSignalNameNotRecognisedException` :param str signal: Signal name to uninstall e.g., :py:attr:`SIGNAL_PRO...
python
def remove_signal_receiver(self, signal): """ Remove an installed signal receiver by signal name. See also :py:meth:`add_signal_receiver` :py:exc:`exceptions.ConnSignalNameNotRecognisedException` :param str signal: Signal name to uninstall e.g., :py:attr:`SIGNAL_PRO...
[ "def", "remove_signal_receiver", "(", "self", ",", "signal", ")", ":", "if", "(", "signal", "in", "self", ".", "_signal_names", ")", ":", "s", "=", "self", ".", "_signals", ".", "get", "(", "signal", ")", "if", "(", "s", ")", ":", "self", ".", "_bu...
Remove an installed signal receiver by signal name. See also :py:meth:`add_signal_receiver` :py:exc:`exceptions.ConnSignalNameNotRecognisedException` :param str signal: Signal name to uninstall e.g., :py:attr:`SIGNAL_PROPERTY_CHANGED` :return: :raises ConnSignalName...
[ "Remove", "an", "installed", "signal", "receiver", "by", "signal", "name", "." ]
8876f3dbf3a25a2a65d2d81e7b0bdd8068839173
https://github.com/liamw9534/pyconnman/blob/8876f3dbf3a25a2a65d2d81e7b0bdd8068839173/pyconnman/interface.py#L149-L170
48,987
smartfile/client-python
smartfile/__init__.py
Client._do_request
def _do_request(self, request, url, **kwargs): "Actually makes the HTTP request." try: response = request(url, stream=True, **kwargs) except RequestException as e: raise RequestError(e) else: if response.status_code >= 400: raise Respon...
python
def _do_request(self, request, url, **kwargs): "Actually makes the HTTP request." try: response = request(url, stream=True, **kwargs) except RequestException as e: raise RequestError(e) else: if response.status_code >= 400: raise Respon...
[ "def", "_do_request", "(", "self", ",", "request", ",", "url", ",", "*", "*", "kwargs", ")", ":", "try", ":", "response", "=", "request", "(", "url", ",", "stream", "=", "True", ",", "*", "*", "kwargs", ")", "except", "RequestException", "as", "e", ...
Actually makes the HTTP request.
[ "Actually", "makes", "the", "HTTP", "request", "." ]
f9ccc40a2870df447c65b53dc0747e37cab62d63
https://github.com/smartfile/client-python/blob/f9ccc40a2870df447c65b53dc0747e37cab62d63/smartfile/__init__.py#L50-L73
48,988
smartfile/client-python
smartfile/__init__.py
Client._request
def _request(self, method, endpoint, id=None, **kwargs): "Handles retrying failed requests and error handling." request = getattr(requests, method, None) if not callable(request): raise RequestError('Invalid method %s' % method) # Find files, separate them out to correct kwar...
python
def _request(self, method, endpoint, id=None, **kwargs): "Handles retrying failed requests and error handling." request = getattr(requests, method, None) if not callable(request): raise RequestError('Invalid method %s' % method) # Find files, separate them out to correct kwar...
[ "def", "_request", "(", "self", ",", "method", ",", "endpoint", ",", "id", "=", "None", ",", "*", "*", "kwargs", ")", ":", "request", "=", "getattr", "(", "requests", ",", "method", ",", "None", ")", "if", "not", "callable", "(", "request", ")", ":...
Handles retrying failed requests and error handling.
[ "Handles", "retrying", "failed", "requests", "and", "error", "handling", "." ]
f9ccc40a2870df447c65b53dc0747e37cab62d63
https://github.com/smartfile/client-python/blob/f9ccc40a2870df447c65b53dc0747e37cab62d63/smartfile/__init__.py#L75-L122
48,989
smartfile/client-python
smartfile/__init__.py
Client.download
def download(self, file_to_be_downloaded, perform_download=True, download_to_path=None): """ file_to_be_downloaded is a file-like object that has already been uploaded, you cannot download folders """ response = self.get( '/path/data/', file_to_be_downloaded, raw=False) if no...
python
def download(self, file_to_be_downloaded, perform_download=True, download_to_path=None): """ file_to_be_downloaded is a file-like object that has already been uploaded, you cannot download folders """ response = self.get( '/path/data/', file_to_be_downloaded, raw=False) if no...
[ "def", "download", "(", "self", ",", "file_to_be_downloaded", ",", "perform_download", "=", "True", ",", "download_to_path", "=", "None", ")", ":", "response", "=", "self", ".", "get", "(", "'/path/data/'", ",", "file_to_be_downloaded", ",", "raw", "=", "False...
file_to_be_downloaded is a file-like object that has already been uploaded, you cannot download folders
[ "file_to_be_downloaded", "is", "a", "file", "-", "like", "object", "that", "has", "already", "been", "uploaded", "you", "cannot", "download", "folders" ]
f9ccc40a2870df447c65b53dc0747e37cab62d63
https://github.com/smartfile/client-python/blob/f9ccc40a2870df447c65b53dc0747e37cab62d63/smartfile/__init__.py#L151-L164
48,990
mozilla/python-zeppelin
zeppelin/executors/notebook_executor.py
NotebookExecutor.create_notebook
def create_notebook(self, data): """Create notebook under notebook directory.""" r = requests.post('http://{0}/api/notebook'.format(self.zeppelin_url), json=data) self.notebook_id = r.json()['body']
python
def create_notebook(self, data): """Create notebook under notebook directory.""" r = requests.post('http://{0}/api/notebook'.format(self.zeppelin_url), json=data) self.notebook_id = r.json()['body']
[ "def", "create_notebook", "(", "self", ",", "data", ")", ":", "r", "=", "requests", ".", "post", "(", "'http://{0}/api/notebook'", ".", "format", "(", "self", ".", "zeppelin_url", ")", ",", "json", "=", "data", ")", "self", ".", "notebook_id", "=", "r", ...
Create notebook under notebook directory.
[ "Create", "notebook", "under", "notebook", "directory", "." ]
76ce6b7608ef6cf7b807bd5d850a58ea6a59ef07
https://github.com/mozilla/python-zeppelin/blob/76ce6b7608ef6cf7b807bd5d850a58ea6a59ef07/zeppelin/executors/notebook_executor.py#L22-L26
48,991
mozilla/python-zeppelin
zeppelin/executors/notebook_executor.py
NotebookExecutor.wait_for_notebook_to_execute
def wait_for_notebook_to_execute(self): """Wait for notebook to finish executing before continuing.""" while True: r = requests.get('http://{0}/api/notebook/job/{1}'.format( self.zeppelin_url, self.notebook_id)) if r.status_code == 200: ...
python
def wait_for_notebook_to_execute(self): """Wait for notebook to finish executing before continuing.""" while True: r = requests.get('http://{0}/api/notebook/job/{1}'.format( self.zeppelin_url, self.notebook_id)) if r.status_code == 200: ...
[ "def", "wait_for_notebook_to_execute", "(", "self", ")", ":", "while", "True", ":", "r", "=", "requests", ".", "get", "(", "'http://{0}/api/notebook/job/{1}'", ".", "format", "(", "self", ".", "zeppelin_url", ",", "self", ".", "notebook_id", ")", ")", "if", ...
Wait for notebook to finish executing before continuing.
[ "Wait", "for", "notebook", "to", "finish", "executing", "before", "continuing", "." ]
76ce6b7608ef6cf7b807bd5d850a58ea6a59ef07
https://github.com/mozilla/python-zeppelin/blob/76ce6b7608ef6cf7b807bd5d850a58ea6a59ef07/zeppelin/executors/notebook_executor.py#L33-L57
48,992
mozilla/python-zeppelin
zeppelin/executors/notebook_executor.py
NotebookExecutor.get_executed_notebook
def get_executed_notebook(self): """Return the executed notebook.""" r = requests.get('http://{0}/api/notebook/{1}'.format( self.zeppelin_url, self.notebook_id)) if r.status_code == 200: return r.json()['body'] else: print('ERROR: Could no...
python
def get_executed_notebook(self): """Return the executed notebook.""" r = requests.get('http://{0}/api/notebook/{1}'.format( self.zeppelin_url, self.notebook_id)) if r.status_code == 200: return r.json()['body'] else: print('ERROR: Could no...
[ "def", "get_executed_notebook", "(", "self", ")", ":", "r", "=", "requests", ".", "get", "(", "'http://{0}/api/notebook/{1}'", ".", "format", "(", "self", ".", "zeppelin_url", ",", "self", ".", "notebook_id", ")", ")", "if", "r", ".", "status_code", "==", ...
Return the executed notebook.
[ "Return", "the", "executed", "notebook", "." ]
76ce6b7608ef6cf7b807bd5d850a58ea6a59ef07
https://github.com/mozilla/python-zeppelin/blob/76ce6b7608ef6cf7b807bd5d850a58ea6a59ef07/zeppelin/executors/notebook_executor.py#L59-L67
48,993
mozilla/python-zeppelin
zeppelin/executors/notebook_executor.py
NotebookExecutor.save_notebook
def save_notebook(self, body): """Save notebook depending on user provided output path.""" directory = os.path.dirname(self.output_path) full_path = os.path.join(directory, self.notebook_name) try: with open(full_path, 'w') as fh: fh.write(json.dumps(body, ind...
python
def save_notebook(self, body): """Save notebook depending on user provided output path.""" directory = os.path.dirname(self.output_path) full_path = os.path.join(directory, self.notebook_name) try: with open(full_path, 'w') as fh: fh.write(json.dumps(body, ind...
[ "def", "save_notebook", "(", "self", ",", "body", ")", ":", "directory", "=", "os", ".", "path", ".", "dirname", "(", "self", ".", "output_path", ")", "full_path", "=", "os", ".", "path", ".", "join", "(", "directory", ",", "self", ".", "notebook_name"...
Save notebook depending on user provided output path.
[ "Save", "notebook", "depending", "on", "user", "provided", "output", "path", "." ]
76ce6b7608ef6cf7b807bd5d850a58ea6a59ef07
https://github.com/mozilla/python-zeppelin/blob/76ce6b7608ef6cf7b807bd5d850a58ea6a59ef07/zeppelin/executors/notebook_executor.py#L69-L79
48,994
mozilla/python-zeppelin
zeppelin/executors/notebook_executor.py
NotebookExecutor.execute_notebook
def execute_notebook(self, data): """Execute input notebook and save it to file. If no output path given, the output will be printed to stdout. If any errors occur from executing the notebook's paragraphs, they will be displayed in stderr. """ self.create_notebook(data)...
python
def execute_notebook(self, data): """Execute input notebook and save it to file. If no output path given, the output will be printed to stdout. If any errors occur from executing the notebook's paragraphs, they will be displayed in stderr. """ self.create_notebook(data)...
[ "def", "execute_notebook", "(", "self", ",", "data", ")", ":", "self", ".", "create_notebook", "(", "data", ")", "self", ".", "run_notebook", "(", ")", "self", ".", "wait_for_notebook_to_execute", "(", ")", "body", "=", "self", ".", "get_executed_notebook", ...
Execute input notebook and save it to file. If no output path given, the output will be printed to stdout. If any errors occur from executing the notebook's paragraphs, they will be displayed in stderr.
[ "Execute", "input", "notebook", "and", "save", "it", "to", "file", "." ]
76ce6b7608ef6cf7b807bd5d850a58ea6a59ef07
https://github.com/mozilla/python-zeppelin/blob/76ce6b7608ef6cf7b807bd5d850a58ea6a59ef07/zeppelin/executors/notebook_executor.py#L81-L113
48,995
romana/vpc-router
vpcrouter/main/__init__.py
_setup_arg_parser
def _setup_arg_parser(args_list, watcher_plugin_class, health_plugin_class): """ Configure and return the argument parser for the command line options. If a watcher and/or health-monitor plugin_class is provided then call the add_arguments() callback of the plugin class(es), in order to add plugin ...
python
def _setup_arg_parser(args_list, watcher_plugin_class, health_plugin_class): """ Configure and return the argument parser for the command line options. If a watcher and/or health-monitor plugin_class is provided then call the add_arguments() callback of the plugin class(es), in order to add plugin ...
[ "def", "_setup_arg_parser", "(", "args_list", ",", "watcher_plugin_class", ",", "health_plugin_class", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "\"VPC router: Manage routes in VPC route table\"", ")", "# General arguments", "parse...
Configure and return the argument parser for the command line options. If a watcher and/or health-monitor plugin_class is provided then call the add_arguments() callback of the plugin class(es), in order to add plugin specific options. Some parameters are required (vpc and region, for example), but we...
[ "Configure", "and", "return", "the", "argument", "parser", "for", "the", "command", "line", "options", "." ]
d696c2e023f1111ceb61f9c6fbabfafed8e14040
https://github.com/romana/vpc-router/blob/d696c2e023f1111ceb61f9c6fbabfafed8e14040/vpcrouter/main/__init__.py#L37-L109
48,996
romana/vpc-router
vpcrouter/main/__init__.py
_parse_args
def _parse_args(args_list, watcher_plugin_class, health_plugin_class): """ Parse command line arguments and return relevant values in a dict. Also perform basic sanity checking on some arguments. If plugin classes have been provided then a callback into those classes is used to extend the argument...
python
def _parse_args(args_list, watcher_plugin_class, health_plugin_class): """ Parse command line arguments and return relevant values in a dict. Also perform basic sanity checking on some arguments. If plugin classes have been provided then a callback into those classes is used to extend the argument...
[ "def", "_parse_args", "(", "args_list", ",", "watcher_plugin_class", ",", "health_plugin_class", ")", ":", "conf", "=", "{", "}", "# Setting up the command line argument parser. Note that we pass the", "# complete list of all plugins, so that their parameter can be added to the", "# ...
Parse command line arguments and return relevant values in a dict. Also perform basic sanity checking on some arguments. If plugin classes have been provided then a callback into those classes is used to extend the arguments with plugin-specific options. Likewise, the sanity checking will then also i...
[ "Parse", "command", "line", "arguments", "and", "return", "relevant", "values", "in", "a", "dict", "." ]
d696c2e023f1111ceb61f9c6fbabfafed8e14040
https://github.com/romana/vpc-router/blob/d696c2e023f1111ceb61f9c6fbabfafed8e14040/vpcrouter/main/__init__.py#L112-L174
48,997
romana/vpc-router
vpcrouter/main/__init__.py
main
def main(): """ Starting point of the executable. """ try: # A bit of a hack: We want to load the plugins (specified via the mode # and health parameter) in order to add their arguments to the argument # parser. But this means we first need to look into the CLI arguments ...
python
def main(): """ Starting point of the executable. """ try: # A bit of a hack: We want to load the plugins (specified via the mode # and health parameter) in order to add their arguments to the argument # parser. But this means we first need to look into the CLI arguments ...
[ "def", "main", "(", ")", ":", "try", ":", "# A bit of a hack: We want to load the plugins (specified via the mode", "# and health parameter) in order to add their arguments to the argument", "# parser. But this means we first need to look into the CLI arguments", "# to find them ... before looki...
Starting point of the executable.
[ "Starting", "point", "of", "the", "executable", "." ]
d696c2e023f1111ceb61f9c6fbabfafed8e14040
https://github.com/romana/vpc-router/blob/d696c2e023f1111ceb61f9c6fbabfafed8e14040/vpcrouter/main/__init__.py#L201-L282
48,998
romana/vpc-router
vpcrouter/currentstate/__init__.py
_CurrentState.get_plugins_info
def get_plugins_info(self): """ Collect the current live info from all the registered plugins. Return a dictionary, keyed on the plugin name. """ d = {} for p in self.plugins: d.update(p.get_info()) return d
python
def get_plugins_info(self): """ Collect the current live info from all the registered plugins. Return a dictionary, keyed on the plugin name. """ d = {} for p in self.plugins: d.update(p.get_info()) return d
[ "def", "get_plugins_info", "(", "self", ")", ":", "d", "=", "{", "}", "for", "p", "in", "self", ".", "plugins", ":", "d", ".", "update", "(", "p", ".", "get_info", "(", ")", ")", "return", "d" ]
Collect the current live info from all the registered plugins. Return a dictionary, keyed on the plugin name.
[ "Collect", "the", "current", "live", "info", "from", "all", "the", "registered", "plugins", "." ]
d696c2e023f1111ceb61f9c6fbabfafed8e14040
https://github.com/romana/vpc-router/blob/d696c2e023f1111ceb61f9c6fbabfafed8e14040/vpcrouter/currentstate/__init__.py#L67-L77
48,999
romana/vpc-router
vpcrouter/currentstate/__init__.py
_CurrentState.get_state_repr
def get_state_repr(self, path): """ Returns the current state, or sub-state, depending on the path. """ if path == "ips": return { "failed_ips" : self.failed_ips, "questionable_ips" : self.questionable_ips, "working_set" ...
python
def get_state_repr(self, path): """ Returns the current state, or sub-state, depending on the path. """ if path == "ips": return { "failed_ips" : self.failed_ips, "questionable_ips" : self.questionable_ips, "working_set" ...
[ "def", "get_state_repr", "(", "self", ",", "path", ")", ":", "if", "path", "==", "\"ips\"", ":", "return", "{", "\"failed_ips\"", ":", "self", ".", "failed_ips", ",", "\"questionable_ips\"", ":", "self", ".", "questionable_ips", ",", "\"working_set\"", ":", ...
Returns the current state, or sub-state, depending on the path.
[ "Returns", "the", "current", "state", "or", "sub", "-", "state", "depending", "on", "the", "path", "." ]
d696c2e023f1111ceb61f9c6fbabfafed8e14040
https://github.com/romana/vpc-router/blob/d696c2e023f1111ceb61f9c6fbabfafed8e14040/vpcrouter/currentstate/__init__.py#L87-L124