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
partition
stringclasses
1 value
iotile/coretools
iotilesensorgraph/iotile/sg/graph.py
SensorGraph.add_config
def add_config(self, slot, config_id, config_type, value): """Add a config variable assignment to this sensor graph. Args: slot (SlotIdentifier): The slot identifier that this config variable is assigned to. config_id (int): The 16-bit id of this config_id ...
python
def add_config(self, slot, config_id, config_type, value): """Add a config variable assignment to this sensor graph. Args: slot (SlotIdentifier): The slot identifier that this config variable is assigned to. config_id (int): The 16-bit id of this config_id ...
[ "def", "add_config", "(", "self", ",", "slot", ",", "config_id", ",", "config_type", ",", "value", ")", ":", "if", "slot", "not", "in", "self", ".", "config_database", ":", "self", ".", "config_database", "[", "slot", "]", "=", "{", "}", "self", ".", ...
Add a config variable assignment to this sensor graph. Args: slot (SlotIdentifier): The slot identifier that this config variable is assigned to. config_id (int): The 16-bit id of this config_id config_type (str): The type of the config variable, currently ...
[ "Add", "a", "config", "variable", "assignment", "to", "this", "sensor", "graph", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/graph.py#L129-L145
train
iotile/coretools
iotilesensorgraph/iotile/sg/graph.py
SensorGraph.add_streamer
def add_streamer(self, streamer): """Add a streamer to this sensor graph. Args: streamer (DataStreamer): The streamer we want to add """ if self._max_streamers is not None and len(self.streamers) >= self._max_streamers: raise ResourceUsageError("Maximum number o...
python
def add_streamer(self, streamer): """Add a streamer to this sensor graph. Args: streamer (DataStreamer): The streamer we want to add """ if self._max_streamers is not None and len(self.streamers) >= self._max_streamers: raise ResourceUsageError("Maximum number o...
[ "def", "add_streamer", "(", "self", ",", "streamer", ")", ":", "if", "self", ".", "_max_streamers", "is", "not", "None", "and", "len", "(", "self", ".", "streamers", ")", ">=", "self", ".", "_max_streamers", ":", "raise", "ResourceUsageError", "(", "\"Maxi...
Add a streamer to this sensor graph. Args: streamer (DataStreamer): The streamer we want to add
[ "Add", "a", "streamer", "to", "this", "sensor", "graph", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/graph.py#L147-L160
train
iotile/coretools
iotilesensorgraph/iotile/sg/graph.py
SensorGraph.add_constant
def add_constant(self, stream, value): """Store a constant value for use in this sensor graph. Constant assignments occur after all sensor graph nodes have been allocated since they must be propogated to all appropriate virtual stream walkers. Args: stream (DataStre...
python
def add_constant(self, stream, value): """Store a constant value for use in this sensor graph. Constant assignments occur after all sensor graph nodes have been allocated since they must be propogated to all appropriate virtual stream walkers. Args: stream (DataStre...
[ "def", "add_constant", "(", "self", ",", "stream", ",", "value", ")", ":", "if", "stream", "in", "self", ".", "constant_database", ":", "raise", "ArgumentError", "(", "\"Attempted to set the same constant twice\"", ",", "stream", "=", "stream", ",", "old_value", ...
Store a constant value for use in this sensor graph. Constant assignments occur after all sensor graph nodes have been allocated since they must be propogated to all appropriate virtual stream walkers. Args: stream (DataStream): The constant stream to assign the value to ...
[ "Store", "a", "constant", "value", "for", "use", "in", "this", "sensor", "graph", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/graph.py#L162-L177
train
iotile/coretools
iotilesensorgraph/iotile/sg/graph.py
SensorGraph.add_metadata
def add_metadata(self, name, value): """Attach a piece of metadata to this sensorgraph. Metadata is not used during the simulation of a sensorgraph but allows it to convey additional context that may be used during code generation. For example, associating an `app_tag` with a sensorgra...
python
def add_metadata(self, name, value): """Attach a piece of metadata to this sensorgraph. Metadata is not used during the simulation of a sensorgraph but allows it to convey additional context that may be used during code generation. For example, associating an `app_tag` with a sensorgra...
[ "def", "add_metadata", "(", "self", ",", "name", ",", "value", ")", ":", "if", "name", "in", "self", ".", "metadata_database", ":", "raise", "ArgumentError", "(", "\"Attempted to set the same metadata value twice\"", ",", "name", "=", "name", ",", "old_value", "...
Attach a piece of metadata to this sensorgraph. Metadata is not used during the simulation of a sensorgraph but allows it to convey additional context that may be used during code generation. For example, associating an `app_tag` with a sensorgraph allows the snippet code generator to ...
[ "Attach", "a", "piece", "of", "metadata", "to", "this", "sensorgraph", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/graph.py#L179-L197
train
iotile/coretools
iotilesensorgraph/iotile/sg/graph.py
SensorGraph.initialize_remaining_constants
def initialize_remaining_constants(self, value=0): """Ensure that all constant streams referenced in the sensor graph have a value. Constant streams that are automatically created by the compiler are initialized as part of the compilation process but it's possible that the user references ...
python
def initialize_remaining_constants(self, value=0): """Ensure that all constant streams referenced in the sensor graph have a value. Constant streams that are automatically created by the compiler are initialized as part of the compilation process but it's possible that the user references ...
[ "def", "initialize_remaining_constants", "(", "self", ",", "value", "=", "0", ")", ":", "remaining", "=", "[", "]", "for", "node", ",", "_inputs", ",", "_outputs", "in", "self", ".", "iterate_bfs", "(", ")", ":", "streams", "=", "node", ".", "input_strea...
Ensure that all constant streams referenced in the sensor graph have a value. Constant streams that are automatically created by the compiler are initialized as part of the compilation process but it's possible that the user references other constant streams but never assigns them an explicit i...
[ "Ensure", "that", "all", "constant", "streams", "referenced", "in", "the", "sensor", "graph", "have", "a", "value", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/graph.py#L199-L230
train
iotile/coretools
iotilesensorgraph/iotile/sg/graph.py
SensorGraph.load_constants
def load_constants(self): """Load all constants into their respective streams. All previous calls to add_constant stored a constant value that should be associated with virtual stream walkers. This function actually calls push_stream in order to push all of the constant values ...
python
def load_constants(self): """Load all constants into their respective streams. All previous calls to add_constant stored a constant value that should be associated with virtual stream walkers. This function actually calls push_stream in order to push all of the constant values ...
[ "def", "load_constants", "(", "self", ")", ":", "for", "stream", ",", "value", "in", "self", ".", "constant_database", ".", "items", "(", ")", ":", "self", ".", "sensor_log", ".", "push", "(", "stream", ",", "IOTileReading", "(", "0", ",", "stream", "....
Load all constants into their respective streams. All previous calls to add_constant stored a constant value that should be associated with virtual stream walkers. This function actually calls push_stream in order to push all of the constant values to their walkers.
[ "Load", "all", "constants", "into", "their", "respective", "streams", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/graph.py#L232-L242
train
iotile/coretools
iotilesensorgraph/iotile/sg/graph.py
SensorGraph.get_config
def get_config(self, slot, config_id): """Get a config variable assignment previously set on this sensor graph. Args: slot (SlotIdentifier): The slot that we are setting this config variable on. config_id (int): The 16-bit config variable identifier. Ret...
python
def get_config(self, slot, config_id): """Get a config variable assignment previously set on this sensor graph. Args: slot (SlotIdentifier): The slot that we are setting this config variable on. config_id (int): The 16-bit config variable identifier. Ret...
[ "def", "get_config", "(", "self", ",", "slot", ",", "config_id", ")", ":", "if", "slot", "not", "in", "self", ".", "config_database", ":", "raise", "ArgumentError", "(", "\"No config variables have been set on specified slot\"", ",", "slot", "=", "slot", ")", "i...
Get a config variable assignment previously set on this sensor graph. Args: slot (SlotIdentifier): The slot that we are setting this config variable on. config_id (int): The 16-bit config variable identifier. Returns: (str, str|int): Returns a tuple ...
[ "Get", "a", "config", "variable", "assignment", "previously", "set", "on", "this", "sensor", "graph", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/graph.py#L244-L267
train
iotile/coretools
iotilesensorgraph/iotile/sg/graph.py
SensorGraph.is_output
def is_output(self, stream): """Check if a stream is a sensor graph output. Return: bool """ for streamer in self.streamers: if streamer.selector.matches(stream): return True return False
python
def is_output(self, stream): """Check if a stream is a sensor graph output. Return: bool """ for streamer in self.streamers: if streamer.selector.matches(stream): return True return False
[ "def", "is_output", "(", "self", ",", "stream", ")", ":", "for", "streamer", "in", "self", ".", "streamers", ":", "if", "streamer", ".", "selector", ".", "matches", "(", "stream", ")", ":", "return", "True", "return", "False" ]
Check if a stream is a sensor graph output. Return: bool
[ "Check", "if", "a", "stream", "is", "a", "sensor", "graph", "output", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/graph.py#L269-L280
train
iotile/coretools
iotilesensorgraph/iotile/sg/graph.py
SensorGraph.get_tick
def get_tick(self, name): """Check the config variables to see if there is a configurable tick. Sensor Graph has a built-in 10 second tick that is sent every 10 seconds to allow for triggering timed events. There is a second 'user' tick that is generated internally by the sensorgraph c...
python
def get_tick(self, name): """Check the config variables to see if there is a configurable tick. Sensor Graph has a built-in 10 second tick that is sent every 10 seconds to allow for triggering timed events. There is a second 'user' tick that is generated internally by the sensorgraph c...
[ "def", "get_tick", "(", "self", ",", "name", ")", ":", "name_map", "=", "{", "'fast'", ":", "config_fast_tick_secs", ",", "'user1'", ":", "config_tick1_secs", ",", "'user2'", ":", "config_tick2_secs", "}", "config", "=", "name_map", ".", "get", "(", "name", ...
Check the config variables to see if there is a configurable tick. Sensor Graph has a built-in 10 second tick that is sent every 10 seconds to allow for triggering timed events. There is a second 'user' tick that is generated internally by the sensorgraph compiler and used for fast ope...
[ "Check", "the", "config", "variables", "to", "see", "if", "there", "is", "a", "configurable", "tick", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/graph.py#L282-L318
train
iotile/coretools
iotilesensorgraph/iotile/sg/graph.py
SensorGraph.mark_streamer
def mark_streamer(self, index): """Manually mark a streamer that should trigger. The next time check_streamers is called, the given streamer will be manually marked that it should trigger, which will cause it to trigger unless it has no data. Args: index (int): The ...
python
def mark_streamer(self, index): """Manually mark a streamer that should trigger. The next time check_streamers is called, the given streamer will be manually marked that it should trigger, which will cause it to trigger unless it has no data. Args: index (int): The ...
[ "def", "mark_streamer", "(", "self", ",", "index", ")", ":", "self", ".", "_logger", ".", "debug", "(", "\"Marking streamer %d manually\"", ",", "index", ")", "if", "index", ">=", "len", "(", "self", ".", "streamers", ")", ":", "raise", "ArgumentError", "(...
Manually mark a streamer that should trigger. The next time check_streamers is called, the given streamer will be manually marked that it should trigger, which will cause it to trigger unless it has no data. Args: index (int): The index of the streamer that we should mark a...
[ "Manually", "mark", "a", "streamer", "that", "should", "trigger", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/graph.py#L358-L377
train
iotile/coretools
iotilesensorgraph/iotile/sg/graph.py
SensorGraph.check_streamers
def check_streamers(self, blacklist=None): """Check if any streamers are ready to produce a report. You can limit what streamers are checked by passing a set-like object into blacklist. This method is the primary way to see when you should poll a given streamer for its next rep...
python
def check_streamers(self, blacklist=None): """Check if any streamers are ready to produce a report. You can limit what streamers are checked by passing a set-like object into blacklist. This method is the primary way to see when you should poll a given streamer for its next rep...
[ "def", "check_streamers", "(", "self", ",", "blacklist", "=", "None", ")", ":", "ready", "=", "[", "]", "selected", "=", "set", "(", ")", "for", "i", ",", "streamer", "in", "enumerate", "(", "self", ".", "streamers", ")", ":", "if", "blacklist", "is"...
Check if any streamers are ready to produce a report. You can limit what streamers are checked by passing a set-like object into blacklist. This method is the primary way to see when you should poll a given streamer for its next report. Note, this function is not idempotent. ...
[ "Check", "if", "any", "streamers", "are", "ready", "to", "produce", "a", "report", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/graph.py#L379-L429
train
iotile/coretools
iotilesensorgraph/iotile/sg/graph.py
SensorGraph.sort_nodes
def sort_nodes(self): """Topologically sort all of our nodes. Topologically sorting our nodes makes nodes that are inputs to other nodes come first in the list of nodes. This is important to do before programming a sensorgraph into an embedded device whose engine assumes a topo...
python
def sort_nodes(self): """Topologically sort all of our nodes. Topologically sorting our nodes makes nodes that are inputs to other nodes come first in the list of nodes. This is important to do before programming a sensorgraph into an embedded device whose engine assumes a topo...
[ "def", "sort_nodes", "(", "self", ")", ":", "node_map", "=", "{", "id", "(", "node", ")", ":", "i", "for", "i", ",", "node", "in", "enumerate", "(", "self", ".", "nodes", ")", "}", "node_deps", "=", "{", "}", "for", "node", ",", "inputs", ",", ...
Topologically sort all of our nodes. Topologically sorting our nodes makes nodes that are inputs to other nodes come first in the list of nodes. This is important to do before programming a sensorgraph into an embedded device whose engine assumes a topologically sorted graph. ...
[ "Topologically", "sort", "all", "of", "our", "nodes", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/graph.py#L461-L489
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/ipkg.py
generate
def generate(env): """Add Builders and construction variables for ipkg to an Environment.""" try: bld = env['BUILDERS']['Ipkg'] except KeyError: bld = SCons.Builder.Builder(action='$IPKGCOM', suffix='$IPKGSUFFIX', source...
python
def generate(env): """Add Builders and construction variables for ipkg to an Environment.""" try: bld = env['BUILDERS']['Ipkg'] except KeyError: bld = SCons.Builder.Builder(action='$IPKGCOM', suffix='$IPKGSUFFIX', source...
[ "def", "generate", "(", "env", ")", ":", "try", ":", "bld", "=", "env", "[", "'BUILDERS'", "]", "[", "'Ipkg'", "]", "except", "KeyError", ":", "bld", "=", "SCons", ".", "Builder", ".", "Builder", "(", "action", "=", "'$IPKGCOM'", ",", "suffix", "=", ...
Add Builders and construction variables for ipkg to an Environment.
[ "Add", "Builders", "and", "construction", "variables", "for", "ipkg", "to", "an", "Environment", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/ipkg.py#L42-L61
train
iotile/coretools
iotilesensorgraph/iotile/sg/node.py
InputTrigger.triggered
def triggered(self, walker): """Check if this input is triggered on the given stream walker. Args: walker (StreamWalker): The walker to check Returns: bool: Whether this trigger is triggered or not """ if self.use_count: comp_value = walker....
python
def triggered(self, walker): """Check if this input is triggered on the given stream walker. Args: walker (StreamWalker): The walker to check Returns: bool: Whether this trigger is triggered or not """ if self.use_count: comp_value = walker....
[ "def", "triggered", "(", "self", ",", "walker", ")", ":", "if", "self", ".", "use_count", ":", "comp_value", "=", "walker", ".", "count", "(", ")", "else", ":", "if", "walker", ".", "count", "(", ")", "==", "0", ":", "return", "False", "comp_value", ...
Check if this input is triggered on the given stream walker. Args: walker (StreamWalker): The walker to check Returns: bool: Whether this trigger is triggered or not
[ "Check", "if", "this", "input", "is", "triggered", "on", "the", "given", "stream", "walker", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/node.py#L75-L93
train
iotile/coretools
iotilesensorgraph/iotile/sg/node.py
SGNode.connect_input
def connect_input(self, index, walker, trigger=None): """Connect an input to a stream walker. If the input is already connected to something an exception is thrown. Otherwise the walker is used to read inputs for that input. A triggering condition can optionally be passed that will det...
python
def connect_input(self, index, walker, trigger=None): """Connect an input to a stream walker. If the input is already connected to something an exception is thrown. Otherwise the walker is used to read inputs for that input. A triggering condition can optionally be passed that will det...
[ "def", "connect_input", "(", "self", ",", "index", ",", "walker", ",", "trigger", "=", "None", ")", ":", "if", "trigger", "is", "None", ":", "trigger", "=", "TrueTrigger", "(", ")", "if", "index", ">=", "len", "(", "self", ".", "inputs", ")", ":", ...
Connect an input to a stream walker. If the input is already connected to something an exception is thrown. Otherwise the walker is used to read inputs for that input. A triggering condition can optionally be passed that will determine when this input will be considered as triggered. ...
[ "Connect", "an", "input", "to", "a", "stream", "walker", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/node.py#L177-L200
train
iotile/coretools
iotilesensorgraph/iotile/sg/node.py
SGNode.input_streams
def input_streams(self): """Return a list of DataStream objects for all singular input streams. This function only returns individual streams, not the streams that would be selected from a selector like 'all outputs' for example. Returns: list(DataStream): A list of all of ...
python
def input_streams(self): """Return a list of DataStream objects for all singular input streams. This function only returns individual streams, not the streams that would be selected from a selector like 'all outputs' for example. Returns: list(DataStream): A list of all of ...
[ "def", "input_streams", "(", "self", ")", ":", "streams", "=", "[", "]", "for", "walker", ",", "_trigger", "in", "self", ".", "inputs", ":", "if", "walker", ".", "selector", "is", "None", "or", "not", "walker", ".", "selector", ".", "singular", ":", ...
Return a list of DataStream objects for all singular input streams. This function only returns individual streams, not the streams that would be selected from a selector like 'all outputs' for example. Returns: list(DataStream): A list of all of the individual DataStreams that are ...
[ "Return", "a", "list", "of", "DataStream", "objects", "for", "all", "singular", "input", "streams", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/node.py#L202-L221
train
iotile/coretools
iotilesensorgraph/iotile/sg/node.py
SGNode.find_input
def find_input(self, stream): """Find the input that responds to this stream. Args: stream (DataStream): The stream to find Returns: (index, None): The index if found or None """ for i, input_x in enumerate(self.inputs): if input_x[0].matche...
python
def find_input(self, stream): """Find the input that responds to this stream. Args: stream (DataStream): The stream to find Returns: (index, None): The index if found or None """ for i, input_x in enumerate(self.inputs): if input_x[0].matche...
[ "def", "find_input", "(", "self", ",", "stream", ")", ":", "for", "i", ",", "input_x", "in", "enumerate", "(", "self", ".", "inputs", ")", ":", "if", "input_x", "[", "0", "]", ".", "matches", "(", "stream", ")", ":", "return", "i" ]
Find the input that responds to this stream. Args: stream (DataStream): The stream to find Returns: (index, None): The index if found or None
[ "Find", "the", "input", "that", "responds", "to", "this", "stream", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/node.py#L223-L235
train
iotile/coretools
iotilesensorgraph/iotile/sg/node.py
SGNode.num_inputs
def num_inputs(self): """Return the number of connected inputs. Returns: int: The number of connected inputs """ num = 0 for walker, _ in self.inputs: if not isinstance(walker, InvalidStreamWalker): num += 1 return num
python
def num_inputs(self): """Return the number of connected inputs. Returns: int: The number of connected inputs """ num = 0 for walker, _ in self.inputs: if not isinstance(walker, InvalidStreamWalker): num += 1 return num
[ "def", "num_inputs", "(", "self", ")", ":", "num", "=", "0", "for", "walker", ",", "_", "in", "self", ".", "inputs", ":", "if", "not", "isinstance", "(", "walker", ",", "InvalidStreamWalker", ")", ":", "num", "+=", "1", "return", "num" ]
Return the number of connected inputs. Returns: int: The number of connected inputs
[ "Return", "the", "number", "of", "connected", "inputs", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/node.py#L238-L251
train
iotile/coretools
iotilesensorgraph/iotile/sg/node.py
SGNode.connect_output
def connect_output(self, node): """Connect another node to our output. This downstream node will automatically be triggered when we update our output. Args: node (SGNode): The node that should receive our output """ if len(self.outputs) == self.max_outputs:...
python
def connect_output(self, node): """Connect another node to our output. This downstream node will automatically be triggered when we update our output. Args: node (SGNode): The node that should receive our output """ if len(self.outputs) == self.max_outputs:...
[ "def", "connect_output", "(", "self", ",", "node", ")", ":", "if", "len", "(", "self", ".", "outputs", ")", "==", "self", ".", "max_outputs", ":", "raise", "TooManyOutputsError", "(", "\"Attempted to connect too many nodes to the output of a node\"", ",", "max_outpu...
Connect another node to our output. This downstream node will automatically be triggered when we update our output. Args: node (SGNode): The node that should receive our output
[ "Connect", "another", "node", "to", "our", "output", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/node.py#L273-L286
train
iotile/coretools
iotilesensorgraph/iotile/sg/node.py
SGNode.triggered
def triggered(self): """Test if we should trigger our operation. We test the trigger condition on each of our inputs and then combine those triggers using our configured trigger combiner to get an overall result for whether this node is triggered. Returns: bool: Tru...
python
def triggered(self): """Test if we should trigger our operation. We test the trigger condition on each of our inputs and then combine those triggers using our configured trigger combiner to get an overall result for whether this node is triggered. Returns: bool: Tru...
[ "def", "triggered", "(", "self", ")", ":", "trigs", "=", "[", "x", "[", "1", "]", ".", "triggered", "(", "x", "[", "0", "]", ")", "for", "x", "in", "self", ".", "inputs", "]", "if", "self", ".", "trigger_combiner", "==", "self", ".", "OrTriggerCo...
Test if we should trigger our operation. We test the trigger condition on each of our inputs and then combine those triggers using our configured trigger combiner to get an overall result for whether this node is triggered. Returns: bool: True if we should trigger and False...
[ "Test", "if", "we", "should", "trigger", "our", "operation", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/node.py#L288-L304
train
iotile/coretools
iotilesensorgraph/iotile/sg/node.py
SGNode.set_func
def set_func(self, name, func): """Set the processing function to use for this node. Args: name (str): The name of the function to use. This is just stored for reference in case we need to serialize the node later. func (callable): A function tha...
python
def set_func(self, name, func): """Set the processing function to use for this node. Args: name (str): The name of the function to use. This is just stored for reference in case we need to serialize the node later. func (callable): A function tha...
[ "def", "set_func", "(", "self", ",", "name", ",", "func", ")", ":", "self", ".", "func_name", "=", "name", "self", ".", "func", "=", "func" ]
Set the processing function to use for this node. Args: name (str): The name of the function to use. This is just stored for reference in case we need to serialize the node later. func (callable): A function that is called to process inputs ...
[ "Set", "the", "processing", "function", "to", "use", "for", "this", "node", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/node.py#L306-L321
train
iotile/coretools
iotilesensorgraph/iotile/sg/node.py
SGNode.process
def process(self, rpc_executor, mark_streamer=None): """Run this node's processing function. Args: rpc_executor (RPCExecutor): An object capable of executing RPCs in case we need to do that. mark_streamer (callable): Function that can be called to manually ...
python
def process(self, rpc_executor, mark_streamer=None): """Run this node's processing function. Args: rpc_executor (RPCExecutor): An object capable of executing RPCs in case we need to do that. mark_streamer (callable): Function that can be called to manually ...
[ "def", "process", "(", "self", ",", "rpc_executor", ",", "mark_streamer", "=", "None", ")", ":", "if", "self", ".", "func", "is", "None", ":", "raise", "ProcessingFunctionError", "(", "'No processing function set for node'", ",", "stream", "=", "self", ".", "s...
Run this node's processing function. Args: rpc_executor (RPCExecutor): An object capable of executing RPCs in case we need to do that. mark_streamer (callable): Function that can be called to manually mark a streamer as triggered by index. Return...
[ "Run", "this", "node", "s", "processing", "function", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/node.py#L323-L345
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Scanner/Fortran.py
FortranScan
def FortranScan(path_variable="FORTRANPATH"): """Return a prototype Scanner instance for scanning source files for Fortran USE & INCLUDE statements""" # The USE statement regex matches the following: # # USE module_name # USE :: module_name # USE, INTRINSIC :: module_name # USE, NON_INTRINSIC :: modu...
python
def FortranScan(path_variable="FORTRANPATH"): """Return a prototype Scanner instance for scanning source files for Fortran USE & INCLUDE statements""" # The USE statement regex matches the following: # # USE module_name # USE :: module_name # USE, INTRINSIC :: module_name # USE, NON_INTRINSIC :: modu...
[ "def", "FortranScan", "(", "path_variable", "=", "\"FORTRANPATH\"", ")", ":", "use_regex", "=", "\"(?i)(?:^|;)\\s*USE(?:\\s+|(?:(?:\\s*,\\s*(?:NON_)?INTRINSIC)?\\s*::))\\s*(\\w+)\"", "include_regex", "=", "def_regex", "=", "scanner", "=", "F90Scanner", "(", "\"FortranScan\"", ...
Return a prototype Scanner instance for scanning source files for Fortran USE & INCLUDE statements
[ "Return", "a", "prototype", "Scanner", "instance", "for", "scanning", "source", "files", "for", "Fortran", "USE", "&", "INCLUDE", "statements" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Scanner/Fortran.py#L126-L310
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/cvf.py
generate
def generate(env): """Add Builders and construction variables for compaq visual fortran to an Environment.""" fortran.generate(env) env['FORTRAN'] = 'f90' env['FORTRANCOM'] = '$FORTRAN $FORTRANFLAGS $_FORTRANMODFLAG $_FORTRANINCFLAGS /compile_only ${SOURCES.windows} /object:${TARGET.windows...
python
def generate(env): """Add Builders and construction variables for compaq visual fortran to an Environment.""" fortran.generate(env) env['FORTRAN'] = 'f90' env['FORTRANCOM'] = '$FORTRAN $FORTRANFLAGS $_FORTRANMODFLAG $_FORTRANINCFLAGS /compile_only ${SOURCES.windows} /object:${TARGET.windows...
[ "def", "generate", "(", "env", ")", ":", "fortran", ".", "generate", "(", "env", ")", "env", "[", "'FORTRAN'", "]", "=", "'f90'", "env", "[", "'FORTRANCOM'", "]", "=", "'$FORTRAN $FORTRANFLAGS $_FORTRANMODFLAG $_FORTRANINCFLAGS /compile_only ${SOURCES.windows} /object:$...
Add Builders and construction variables for compaq visual fortran to an Environment.
[ "Add", "Builders", "and", "construction", "variables", "for", "compaq", "visual", "fortran", "to", "an", "Environment", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/cvf.py#L36-L49
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/Python.py
Value.read
def read(self): """Return the value. If necessary, the value is built.""" self.build() if not hasattr(self, 'built_value'): self.built_value = self.value return self.built_value
python
def read(self): """Return the value. If necessary, the value is built.""" self.build() if not hasattr(self, 'built_value'): self.built_value = self.value return self.built_value
[ "def", "read", "(", "self", ")", ":", "self", ".", "build", "(", ")", "if", "not", "hasattr", "(", "self", ",", "'built_value'", ")", ":", "self", ".", "built_value", "=", "self", ".", "value", "return", "self", ".", "built_value" ]
Return the value. If necessary, the value is built.
[ "Return", "the", "value", ".", "If", "necessary", "the", "value", "is", "built", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/Python.py#L120-L125
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/Python.py
Value.get_csig
def get_csig(self, calc=None): """Because we're a Python value node and don't have a real timestamp, we get to ignore the calculator and just use the value contents.""" try: return self.ninfo.csig except AttributeError: pass contents = self.get_con...
python
def get_csig(self, calc=None): """Because we're a Python value node and don't have a real timestamp, we get to ignore the calculator and just use the value contents.""" try: return self.ninfo.csig except AttributeError: pass contents = self.get_con...
[ "def", "get_csig", "(", "self", ",", "calc", "=", "None", ")", ":", "try", ":", "return", "self", ".", "ninfo", ".", "csig", "except", "AttributeError", ":", "pass", "contents", "=", "self", ".", "get_contents", "(", ")", "self", ".", "get_ninfo", "(",...
Because we're a Python value node and don't have a real timestamp, we get to ignore the calculator and just use the value contents.
[ "Because", "we", "re", "a", "Python", "value", "node", "and", "don", "t", "have", "a", "real", "timestamp", "we", "get", "to", "ignore", "the", "calculator", "and", "just", "use", "the", "value", "contents", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/Python.py#L155-L165
train
iotile/coretools
iotileemulate/iotile/emulate/virtual/simple_state.py
SerializableState.mark_complex
def mark_complex(self, name, serializer, deserializer): """Mark a property as complex with serializer and deserializer functions. Args: name (str): The name of the complex property. serializer (callable): The function to call to serialize the property's value to ...
python
def mark_complex(self, name, serializer, deserializer): """Mark a property as complex with serializer and deserializer functions. Args: name (str): The name of the complex property. serializer (callable): The function to call to serialize the property's value to ...
[ "def", "mark_complex", "(", "self", ",", "name", ",", "serializer", ",", "deserializer", ")", ":", "self", ".", "_complex_properties", "[", "name", "]", "=", "(", "serializer", ",", "deserializer", ")" ]
Mark a property as complex with serializer and deserializer functions. Args: name (str): The name of the complex property. serializer (callable): The function to call to serialize the property's value to something that can be saved in a json. deserializer (ca...
[ "Mark", "a", "property", "as", "complex", "with", "serializer", "and", "deserializer", "functions", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/virtual/simple_state.py#L63-L74
train
iotile/coretools
iotileemulate/iotile/emulate/virtual/simple_state.py
SerializableState.mark_typed_list
def mark_typed_list(self, name, type_object): """Mark a property as containing serializable objects of a given type. This convenience method allows you to avoid having to call ``mark_complex()`` whenever you need to serialize a list of objects. This method requires that all members of t...
python
def mark_typed_list(self, name, type_object): """Mark a property as containing serializable objects of a given type. This convenience method allows you to avoid having to call ``mark_complex()`` whenever you need to serialize a list of objects. This method requires that all members of t...
[ "def", "mark_typed_list", "(", "self", ",", "name", ",", "type_object", ")", ":", "if", "not", "hasattr", "(", "type_object", ",", "'dump'", ")", ":", "raise", "ArgumentError", "(", "\"The passed type object %s is missing required method: dump()\"", "%", "type_object"...
Mark a property as containing serializable objects of a given type. This convenience method allows you to avoid having to call ``mark_complex()`` whenever you need to serialize a list of objects. This method requires that all members of the given list be of a single class that contains ...
[ "Mark", "a", "property", "as", "containing", "serializable", "objects", "of", "a", "given", "type", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/virtual/simple_state.py#L76-L111
train
iotile/coretools
iotileemulate/iotile/emulate/virtual/simple_state.py
SerializableState.mark_typed_map
def mark_typed_map(self, name, type_object): """Mark a property as containing a map str to serializable object. This convenience method allows you to avoid having to call ``mark_complex()`` whenever you need to serialize a dict of objects. This method requires that all members of the gi...
python
def mark_typed_map(self, name, type_object): """Mark a property as containing a map str to serializable object. This convenience method allows you to avoid having to call ``mark_complex()`` whenever you need to serialize a dict of objects. This method requires that all members of the gi...
[ "def", "mark_typed_map", "(", "self", ",", "name", ",", "type_object", ")", ":", "if", "not", "hasattr", "(", "type_object", ",", "'dump'", ")", ":", "raise", "ArgumentError", "(", "\"The passed type object %s is missing required method: dump()\"", "%", "type_object",...
Mark a property as containing a map str to serializable object. This convenience method allows you to avoid having to call ``mark_complex()`` whenever you need to serialize a dict of objects. This method requires that all members of the given dict be of a single class that contains a du...
[ "Mark", "a", "property", "as", "containing", "a", "map", "str", "to", "serializable", "object", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/virtual/simple_state.py#L113-L148
train
iotile/coretools
iotileemulate/iotile/emulate/virtual/simple_state.py
SerializableState.mark_typed_object
def mark_typed_object(self, name, type_object): """Mark a property as containing a serializable object. This convenience method allows you to avoid having to call ``mark_complex()`` whenever you need to serialize a complex object. This method requires that property ``name`` be a single ...
python
def mark_typed_object(self, name, type_object): """Mark a property as containing a serializable object. This convenience method allows you to avoid having to call ``mark_complex()`` whenever you need to serialize a complex object. This method requires that property ``name`` be a single ...
[ "def", "mark_typed_object", "(", "self", ",", "name", ",", "type_object", ")", ":", "if", "not", "hasattr", "(", "type_object", ",", "'dump'", ")", ":", "raise", "ArgumentError", "(", "\"The passed type object %s is missing required method: dump()\"", "%", "type_objec...
Mark a property as containing a serializable object. This convenience method allows you to avoid having to call ``mark_complex()`` whenever you need to serialize a complex object. This method requires that property ``name`` be a single class that contains a dump() method and a Restore()...
[ "Mark", "a", "property", "as", "containing", "a", "serializable", "object", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/virtual/simple_state.py#L150-L182
train
iotile/coretools
iotileemulate/iotile/emulate/virtual/simple_state.py
SerializableState.dump_property
def dump_property(self, name): """Serialize a property of this class by name. Args: name (str): The name of the property to dump. Returns: object: The serialized value of the property. """ if not hasattr(self, name): raise ArgumentError("Unk...
python
def dump_property(self, name): """Serialize a property of this class by name. Args: name (str): The name of the property to dump. Returns: object: The serialized value of the property. """ if not hasattr(self, name): raise ArgumentError("Unk...
[ "def", "dump_property", "(", "self", ",", "name", ")", ":", "if", "not", "hasattr", "(", "self", ",", "name", ")", ":", "raise", "ArgumentError", "(", "\"Unknown property %s\"", "%", "name", ")", "value", "=", "getattr", "(", "self", ",", "name", ")", ...
Serialize a property of this class by name. Args: name (str): The name of the property to dump. Returns: object: The serialized value of the property.
[ "Serialize", "a", "property", "of", "this", "class", "by", "name", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/virtual/simple_state.py#L184-L201
train
iotile/coretools
iotileemulate/iotile/emulate/virtual/simple_state.py
SerializableState.get_properties
def get_properties(self): """Get a list of all of the public data properties of this class. Returns: list of str: A list of all of the public properties in this class. """ names = inspect.getmembers(self, predicate=lambda x: not inspect.ismethod(x)) return [x[0] for...
python
def get_properties(self): """Get a list of all of the public data properties of this class. Returns: list of str: A list of all of the public properties in this class. """ names = inspect.getmembers(self, predicate=lambda x: not inspect.ismethod(x)) return [x[0] for...
[ "def", "get_properties", "(", "self", ")", ":", "names", "=", "inspect", ".", "getmembers", "(", "self", ",", "predicate", "=", "lambda", "x", ":", "not", "inspect", ".", "ismethod", "(", "x", ")", ")", "return", "[", "x", "[", "0", "]", "for", "x"...
Get a list of all of the public data properties of this class. Returns: list of str: A list of all of the public properties in this class.
[ "Get", "a", "list", "of", "all", "of", "the", "public", "data", "properties", "of", "this", "class", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/virtual/simple_state.py#L203-L211
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/MSCommon/vs.py
get_default_version
def get_default_version(env): """Returns the default version string to use for MSVS. If no version was requested by the user through the MSVS environment variable, query all the available visual studios through get_installed_visual_studios, and take the highest one. Return ------ version: ...
python
def get_default_version(env): """Returns the default version string to use for MSVS. If no version was requested by the user through the MSVS environment variable, query all the available visual studios through get_installed_visual_studios, and take the highest one. Return ------ version: ...
[ "def", "get_default_version", "(", "env", ")", ":", "if", "'MSVS'", "not", "in", "env", "or", "not", "SCons", ".", "Util", ".", "is_Dict", "(", "env", "[", "'MSVS'", "]", ")", ":", "versions", "=", "[", "vs", ".", "version", "for", "vs", "in", "get...
Returns the default version string to use for MSVS. If no version was requested by the user through the MSVS environment variable, query all the available visual studios through get_installed_visual_studios, and take the highest one. Return ------ version: str the default version.
[ "Returns", "the", "default", "version", "string", "to", "use", "for", "MSVS", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/MSCommon/vs.py#L477-L506
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/MSCommon/vs.py
get_default_arch
def get_default_arch(env): """Return the default arch to use for MSVS if no version was requested by the user through the MSVS_ARCH environment variable, select x86 Return ------ arch: str """ arch = env.get('MSVS_ARCH', 'x86') msvs = InstalledVSMap.get(env['MSVS_VERSION']) i...
python
def get_default_arch(env): """Return the default arch to use for MSVS if no version was requested by the user through the MSVS_ARCH environment variable, select x86 Return ------ arch: str """ arch = env.get('MSVS_ARCH', 'x86') msvs = InstalledVSMap.get(env['MSVS_VERSION']) i...
[ "def", "get_default_arch", "(", "env", ")", ":", "arch", "=", "env", ".", "get", "(", "'MSVS_ARCH'", ",", "'x86'", ")", "msvs", "=", "InstalledVSMap", ".", "get", "(", "env", "[", "'MSVS_VERSION'", "]", ")", "if", "not", "msvs", ":", "arch", "=", "'x...
Return the default arch to use for MSVS if no version was requested by the user through the MSVS_ARCH environment variable, select x86 Return ------ arch: str
[ "Return", "the", "default", "arch", "to", "use", "for", "MSVS" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/MSCommon/vs.py#L508-L528
train
iotile/coretools
transport_plugins/jlink/iotile_transport_jlink/structures.py
ControlStructure.format_rpc
def format_rpc(self, address, rpc_id, payload): """Create a formated word list that encodes this rpc.""" addr_word = (rpc_id | (address << 16) | ((1 << 1) << 24)) send_length = len(payload) if len(payload) < 20: payload = payload + b'\0'*(20 - len(payload)) payload...
python
def format_rpc(self, address, rpc_id, payload): """Create a formated word list that encodes this rpc.""" addr_word = (rpc_id | (address << 16) | ((1 << 1) << 24)) send_length = len(payload) if len(payload) < 20: payload = payload + b'\0'*(20 - len(payload)) payload...
[ "def", "format_rpc", "(", "self", ",", "address", ",", "rpc_id", ",", "payload", ")", ":", "addr_word", "=", "(", "rpc_id", "|", "(", "address", "<<", "16", ")", "|", "(", "(", "1", "<<", "1", ")", "<<", "24", ")", ")", "send_length", "=", "len",...
Create a formated word list that encodes this rpc.
[ "Create", "a", "formated", "word", "list", "that", "encodes", "this", "rpc", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/jlink/iotile_transport_jlink/structures.py#L62-L73
train
iotile/coretools
transport_plugins/jlink/iotile_transport_jlink/structures.py
ControlStructure.format_response
def format_response(self, response_data): """Format an RPC response.""" _addr, length = self.response_info() if len(response_data) != length: raise HardwareError("Invalid response read length, should be the same as what response_info() returns", expected=length, actual=len(response_...
python
def format_response(self, response_data): """Format an RPC response.""" _addr, length = self.response_info() if len(response_data) != length: raise HardwareError("Invalid response read length, should be the same as what response_info() returns", expected=length, actual=len(response_...
[ "def", "format_response", "(", "self", ",", "response_data", ")", ":", "_addr", ",", "length", "=", "self", ".", "response_info", "(", ")", "if", "len", "(", "response_data", ")", "!=", "length", ":", "raise", "HardwareError", "(", "\"Invalid response read len...
Format an RPC response.
[ "Format", "an", "RPC", "response", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/jlink/iotile_transport_jlink/structures.py#L75-L95
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Scanner/Prog.py
ProgramScanner
def ProgramScanner(**kw): """Return a prototype Scanner instance for scanning executable files for static-lib dependencies""" kw['path_function'] = SCons.Scanner.FindPathDirs('LIBPATH') ps = SCons.Scanner.Base(scan, "ProgramScanner", **kw) return ps
python
def ProgramScanner(**kw): """Return a prototype Scanner instance for scanning executable files for static-lib dependencies""" kw['path_function'] = SCons.Scanner.FindPathDirs('LIBPATH') ps = SCons.Scanner.Base(scan, "ProgramScanner", **kw) return ps
[ "def", "ProgramScanner", "(", "**", "kw", ")", ":", "kw", "[", "'path_function'", "]", "=", "SCons", ".", "Scanner", ".", "FindPathDirs", "(", "'LIBPATH'", ")", "ps", "=", "SCons", ".", "Scanner", ".", "Base", "(", "scan", ",", "\"ProgramScanner\"", ",",...
Return a prototype Scanner instance for scanning executable files for static-lib dependencies
[ "Return", "a", "prototype", "Scanner", "instance", "for", "scanning", "executable", "files", "for", "static", "-", "lib", "dependencies" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Scanner/Prog.py#L34-L39
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Scanner/Prog.py
_subst_libs
def _subst_libs(env, libs): """ Substitute environment variables and split into list. """ if SCons.Util.is_String(libs): libs = env.subst(libs) if SCons.Util.is_String(libs): libs = libs.split() elif SCons.Util.is_Sequence(libs): _libs = [] for l in libs: ...
python
def _subst_libs(env, libs): """ Substitute environment variables and split into list. """ if SCons.Util.is_String(libs): libs = env.subst(libs) if SCons.Util.is_String(libs): libs = libs.split() elif SCons.Util.is_Sequence(libs): _libs = [] for l in libs: ...
[ "def", "_subst_libs", "(", "env", ",", "libs", ")", ":", "if", "SCons", ".", "Util", ".", "is_String", "(", "libs", ")", ":", "libs", "=", "env", ".", "subst", "(", "libs", ")", "if", "SCons", ".", "Util", ".", "is_String", "(", "libs", ")", ":",...
Substitute environment variables and split into list.
[ "Substitute", "environment", "variables", "and", "split", "into", "list", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Scanner/Prog.py#L41-L57
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Scanner/Prog.py
scan
def scan(node, env, libpath = ()): """ This scanner scans program files for static-library dependencies. It will search the LIBPATH environment variable for libraries specified in the LIBS variable, returning any files it finds as dependencies. """ try: libs = env['LIBS'] except...
python
def scan(node, env, libpath = ()): """ This scanner scans program files for static-library dependencies. It will search the LIBPATH environment variable for libraries specified in the LIBS variable, returning any files it finds as dependencies. """ try: libs = env['LIBS'] except...
[ "def", "scan", "(", "node", ",", "env", ",", "libpath", "=", "(", ")", ")", ":", "try", ":", "libs", "=", "env", "[", "'LIBS'", "]", "except", "KeyError", ":", "return", "[", "]", "libs", "=", "_subst_libs", "(", "env", ",", "libs", ")", "try", ...
This scanner scans program files for static-library dependencies. It will search the LIBPATH environment variable for libraries specified in the LIBS variable, returning any files it finds as dependencies.
[ "This", "scanner", "scans", "program", "files", "for", "static", "-", "library", "dependencies", ".", "It", "will", "search", "the", "LIBPATH", "environment", "variable", "for", "libraries", "specified", "in", "the", "LIBS", "variable", "returning", "any", "file...
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Scanner/Prog.py#L59-L110
train
iotile/coretools
iotileemulate/iotile/emulate/reference/controller_features/remote_bridge.py
RemoteBridgeState.clear_to_reset
def clear_to_reset(self, config_vars): """Clear the RemoteBridge subsystem to its reset state.""" super(RemoteBridgeState, self).clear_to_reset(config_vars) self.status = BRIDGE_STATUS.IDLE self.error = 0
python
def clear_to_reset(self, config_vars): """Clear the RemoteBridge subsystem to its reset state.""" super(RemoteBridgeState, self).clear_to_reset(config_vars) self.status = BRIDGE_STATUS.IDLE self.error = 0
[ "def", "clear_to_reset", "(", "self", ",", "config_vars", ")", ":", "super", "(", "RemoteBridgeState", ",", "self", ")", ".", "clear_to_reset", "(", "config_vars", ")", "self", ".", "status", "=", "BRIDGE_STATUS", ".", "IDLE", "self", ".", "error", "=", "0...
Clear the RemoteBridge subsystem to its reset state.
[ "Clear", "the", "RemoteBridge", "subsystem", "to", "its", "reset", "state", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/controller_features/remote_bridge.py#L42-L47
train
iotile/coretools
iotileemulate/iotile/emulate/reference/controller_features/remote_bridge.py
RemoteBridgeMixin.begin_script
def begin_script(self): """Indicate we are going to start loading a script.""" if self.remote_bridge.status in (BRIDGE_STATUS.RECEIVED, BRIDGE_STATUS.VALIDATED, BRIDGE_STATUS.EXECUTING): return [1] #FIXME: Return correct error here self.remote_bridge.status = BRIDGE_STATUS.WAITING...
python
def begin_script(self): """Indicate we are going to start loading a script.""" if self.remote_bridge.status in (BRIDGE_STATUS.RECEIVED, BRIDGE_STATUS.VALIDATED, BRIDGE_STATUS.EXECUTING): return [1] #FIXME: Return correct error here self.remote_bridge.status = BRIDGE_STATUS.WAITING...
[ "def", "begin_script", "(", "self", ")", ":", "if", "self", ".", "remote_bridge", ".", "status", "in", "(", "BRIDGE_STATUS", ".", "RECEIVED", ",", "BRIDGE_STATUS", ".", "VALIDATED", ",", "BRIDGE_STATUS", ".", "EXECUTING", ")", ":", "return", "[", "1", "]",...
Indicate we are going to start loading a script.
[ "Indicate", "we", "are", "going", "to", "start", "loading", "a", "script", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/controller_features/remote_bridge.py#L77-L90
train
iotile/coretools
iotileemulate/iotile/emulate/reference/controller_features/remote_bridge.py
RemoteBridgeMixin.end_script
def end_script(self): """Indicate that we have finished receiving a script.""" if self.remote_bridge.status not in (BRIDGE_STATUS.RECEIVED, BRIDGE_STATUS.WAITING): return [1] #FIXME: State change self.remote_bridge.status = BRIDGE_STATUS.RECEIVED return [0]
python
def end_script(self): """Indicate that we have finished receiving a script.""" if self.remote_bridge.status not in (BRIDGE_STATUS.RECEIVED, BRIDGE_STATUS.WAITING): return [1] #FIXME: State change self.remote_bridge.status = BRIDGE_STATUS.RECEIVED return [0]
[ "def", "end_script", "(", "self", ")", ":", "if", "self", ".", "remote_bridge", ".", "status", "not", "in", "(", "BRIDGE_STATUS", ".", "RECEIVED", ",", "BRIDGE_STATUS", ".", "WAITING", ")", ":", "return", "[", "1", "]", "self", ".", "remote_bridge", ".",...
Indicate that we have finished receiving a script.
[ "Indicate", "that", "we", "have", "finished", "receiving", "a", "script", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/controller_features/remote_bridge.py#L93-L100
train
iotile/coretools
iotileemulate/iotile/emulate/reference/controller_features/remote_bridge.py
RemoteBridgeMixin.trigger_script
def trigger_script(self): """Actually process a script.""" if self.remote_bridge.status not in (BRIDGE_STATUS.RECEIVED,): return [1] #FIXME: State change # This is asynchronous in real life so just cache the error try: self.remote_bridge.parsed_script = UpdateSc...
python
def trigger_script(self): """Actually process a script.""" if self.remote_bridge.status not in (BRIDGE_STATUS.RECEIVED,): return [1] #FIXME: State change # This is asynchronous in real life so just cache the error try: self.remote_bridge.parsed_script = UpdateSc...
[ "def", "trigger_script", "(", "self", ")", ":", "if", "self", ".", "remote_bridge", ".", "status", "not", "in", "(", "BRIDGE_STATUS", ".", "RECEIVED", ",", ")", ":", "return", "[", "1", "]", "try", ":", "self", ".", "remote_bridge", ".", "parsed_script",...
Actually process a script.
[ "Actually", "process", "a", "script", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/controller_features/remote_bridge.py#L103-L120
train
iotile/coretools
iotileemulate/iotile/emulate/reference/controller_features/remote_bridge.py
RemoteBridgeMixin.reset_script
def reset_script(self): """Clear any partially received script.""" self.remote_bridge.status = BRIDGE_STATUS.IDLE self.remote_bridge.error = 0 self.remote_bridge.parsed_script = None self._device.script = bytearray() return [0]
python
def reset_script(self): """Clear any partially received script.""" self.remote_bridge.status = BRIDGE_STATUS.IDLE self.remote_bridge.error = 0 self.remote_bridge.parsed_script = None self._device.script = bytearray() return [0]
[ "def", "reset_script", "(", "self", ")", ":", "self", ".", "remote_bridge", ".", "status", "=", "BRIDGE_STATUS", ".", "IDLE", "self", ".", "remote_bridge", ".", "error", "=", "0", "self", ".", "remote_bridge", ".", "parsed_script", "=", "None", "self", "."...
Clear any partially received script.
[ "Clear", "any", "partially", "received", "script", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/controller_features/remote_bridge.py#L129-L137
train
iotile/coretools
iotilebuild/iotile/build/utilities/template.py
render_template_inplace
def render_template_inplace(template_path, info, dry_run=False, extra_filters=None, resolver=None): """Render a template file in place. This function expects template path to be a path to a file that ends in .tpl. It will be rendered to a file in the same directory with the .tpl suffix removed. A...
python
def render_template_inplace(template_path, info, dry_run=False, extra_filters=None, resolver=None): """Render a template file in place. This function expects template path to be a path to a file that ends in .tpl. It will be rendered to a file in the same directory with the .tpl suffix removed. A...
[ "def", "render_template_inplace", "(", "template_path", ",", "info", ",", "dry_run", "=", "False", ",", "extra_filters", "=", "None", ",", "resolver", "=", "None", ")", ":", "filters", "=", "{", "}", "if", "resolver", "is", "not", "None", ":", "filters", ...
Render a template file in place. This function expects template path to be a path to a file that ends in .tpl. It will be rendered to a file in the same directory with the .tpl suffix removed. Args: template_path (str): The path to the template file that we want to render in place...
[ "Render", "a", "template", "file", "in", "place", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/utilities/template.py#L20-L76
train
iotile/coretools
iotilebuild/iotile/build/utilities/template.py
render_template
def render_template(template_name, info, out_path=None): """Render a template using the variables in info. You can optionally render to a file by passing out_path. Args: template_name (str): The name of the template to load. This must be a file in config/templates inside this package ...
python
def render_template(template_name, info, out_path=None): """Render a template using the variables in info. You can optionally render to a file by passing out_path. Args: template_name (str): The name of the template to load. This must be a file in config/templates inside this package ...
[ "def", "render_template", "(", "template_name", ",", "info", ",", "out_path", "=", "None", ")", ":", "env", "=", "Environment", "(", "loader", "=", "PackageLoader", "(", "'iotile.build'", ",", "'config/templates'", ")", ",", "trim_blocks", "=", "True", ",", ...
Render a template using the variables in info. You can optionally render to a file by passing out_path. Args: template_name (str): The name of the template to load. This must be a file in config/templates inside this package out_path (str): An optional path of where to save the ou...
[ "Render", "a", "template", "using", "the", "variables", "in", "info", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/utilities/template.py#L79-L106
train
iotile/coretools
iotilebuild/iotile/build/utilities/template.py
render_recursive_template
def render_recursive_template(template_folder, info, out_folder, preserve=None, dry_run=False): """Copy a directory tree rendering all templates found within. This function inspects all of the files in template_folder recursively. If any file ends .tpl, it is rendered using render_template and the .tpl ...
python
def render_recursive_template(template_folder, info, out_folder, preserve=None, dry_run=False): """Copy a directory tree rendering all templates found within. This function inspects all of the files in template_folder recursively. If any file ends .tpl, it is rendered using render_template and the .tpl ...
[ "def", "render_recursive_template", "(", "template_folder", ",", "info", ",", "out_folder", ",", "preserve", "=", "None", ",", "dry_run", "=", "False", ")", ":", "if", "isinstance", "(", "preserve", ",", "str", ")", ":", "raise", "ArgumentError", "(", "\"You...
Copy a directory tree rendering all templates found within. This function inspects all of the files in template_folder recursively. If any file ends .tpl, it is rendered using render_template and the .tpl suffix is removed. All other files are copied without modification. out_folder is not cleaned be...
[ "Copy", "a", "directory", "tree", "rendering", "all", "templates", "found", "within", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/utilities/template.py#L109-L201
train
iotile/coretools
iotilecore/iotile/core/hw/transport/adapter/mixin_notifications.py
_find_monitor
def _find_monitor(monitors, handle): """Find all devices and events with a given monitor installed.""" found_devs = set() found_events = set() for conn_string, device in monitors.items(): for event, handles in device.items(): if handle in handles: found_events.add(e...
python
def _find_monitor(monitors, handle): """Find all devices and events with a given monitor installed.""" found_devs = set() found_events = set() for conn_string, device in monitors.items(): for event, handles in device.items(): if handle in handles: found_events.add(e...
[ "def", "_find_monitor", "(", "monitors", ",", "handle", ")", ":", "found_devs", "=", "set", "(", ")", "found_events", "=", "set", "(", ")", "for", "conn_string", ",", "device", "in", "monitors", ".", "items", "(", ")", ":", "for", "event", ",", "handle...
Find all devices and events with a given monitor installed.
[ "Find", "all", "devices", "and", "events", "with", "a", "given", "monitor", "installed", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/adapter/mixin_notifications.py#L289-L301
train
iotile/coretools
iotilecore/iotile/core/hw/transport/adapter/mixin_notifications.py
_add_monitor
def _add_monitor(monitors, handle, callback, devices, events): """Add the given monitor to the listed devices and events.""" for conn_string in devices: data = monitors.get(conn_string) if data is None: data = dict() monitors[conn_string] = data for event in eve...
python
def _add_monitor(monitors, handle, callback, devices, events): """Add the given monitor to the listed devices and events.""" for conn_string in devices: data = monitors.get(conn_string) if data is None: data = dict() monitors[conn_string] = data for event in eve...
[ "def", "_add_monitor", "(", "monitors", ",", "handle", ",", "callback", ",", "devices", ",", "events", ")", ":", "for", "conn_string", "in", "devices", ":", "data", "=", "monitors", ".", "get", "(", "conn_string", ")", "if", "data", "is", "None", ":", ...
Add the given monitor to the listed devices and events.
[ "Add", "the", "given", "monitor", "to", "the", "listed", "devices", "and", "events", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/adapter/mixin_notifications.py#L304-L319
train
iotile/coretools
iotilecore/iotile/core/hw/transport/adapter/mixin_notifications.py
_remove_monitor
def _remove_monitor(monitors, handle, devices, events): """Remove the given monitor from the listed devices and events.""" empty_devices = [] for conn_string in devices: data = monitors.get(conn_string) if data is None: continue for event in events: event_d...
python
def _remove_monitor(monitors, handle, devices, events): """Remove the given monitor from the listed devices and events.""" empty_devices = [] for conn_string in devices: data = monitors.get(conn_string) if data is None: continue for event in events: event_d...
[ "def", "_remove_monitor", "(", "monitors", ",", "handle", ",", "devices", ",", "events", ")", ":", "empty_devices", "=", "[", "]", "for", "conn_string", "in", "devices", ":", "data", "=", "monitors", ".", "get", "(", "conn_string", ")", "if", "data", "is...
Remove the given monitor from the listed devices and events.
[ "Remove", "the", "given", "monitor", "from", "the", "listed", "devices", "and", "events", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/adapter/mixin_notifications.py#L322-L346
train
iotile/coretools
iotilecore/iotile/core/hw/transport/adapter/mixin_notifications.py
BasicNotificationMixin.register_monitor
def register_monitor(self, devices, events, callback): """Register a callback when events happen. If this method is called, it is guaranteed to take effect before the next call to ``_notify_event`` after this method returns. This method is safe to call from within a callback that is it...
python
def register_monitor(self, devices, events, callback): """Register a callback when events happen. If this method is called, it is guaranteed to take effect before the next call to ``_notify_event`` after this method returns. This method is safe to call from within a callback that is it...
[ "def", "register_monitor", "(", "self", ",", "devices", ",", "events", ",", "callback", ")", ":", "events", "=", "list", "(", "events", ")", "devices", "=", "list", "(", "devices", ")", "for", "event", "in", "events", ":", "if", "event", "not", "in", ...
Register a callback when events happen. If this method is called, it is guaranteed to take effect before the next call to ``_notify_event`` after this method returns. This method is safe to call from within a callback that is itself called by ``notify_event``. See :meth:`Abstr...
[ "Register", "a", "callback", "when", "events", "happen", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/adapter/mixin_notifications.py#L58-L87
train
iotile/coretools
iotilecore/iotile/core/hw/transport/adapter/mixin_notifications.py
BasicNotificationMixin.adjust_monitor
def adjust_monitor(self, handle, action, devices, events): """Adjust a previously registered callback. See :meth:`AbstractDeviceAdapter.adjust_monitor`. """ events = list(events) devices = list(devices) for event in events: if event not in self.SUPPORTED_EV...
python
def adjust_monitor(self, handle, action, devices, events): """Adjust a previously registered callback. See :meth:`AbstractDeviceAdapter.adjust_monitor`. """ events = list(events) devices = list(devices) for event in events: if event not in self.SUPPORTED_EV...
[ "def", "adjust_monitor", "(", "self", ",", "handle", ",", "action", ",", "devices", ",", "events", ")", ":", "events", "=", "list", "(", "events", ")", "devices", "=", "list", "(", "devices", ")", "for", "event", "in", "events", ":", "if", "event", "...
Adjust a previously registered callback. See :meth:`AbstractDeviceAdapter.adjust_monitor`.
[ "Adjust", "a", "previously", "registered", "callback", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/adapter/mixin_notifications.py#L118-L138
train
iotile/coretools
iotilecore/iotile/core/hw/transport/adapter/mixin_notifications.py
BasicNotificationMixin.remove_monitor
def remove_monitor(self, handle): """Remove a previously registered monitor. See :meth:`AbstractDeviceAdapter.adjust_monitor`. """ action = (handle, "delete", None, None) if self._currently_notifying: self._deferred_adjustments.append(action) else: ...
python
def remove_monitor(self, handle): """Remove a previously registered monitor. See :meth:`AbstractDeviceAdapter.adjust_monitor`. """ action = (handle, "delete", None, None) if self._currently_notifying: self._deferred_adjustments.append(action) else: ...
[ "def", "remove_monitor", "(", "self", ",", "handle", ")", ":", "action", "=", "(", "handle", ",", "\"delete\"", ",", "None", ",", "None", ")", "if", "self", ".", "_currently_notifying", ":", "self", ".", "_deferred_adjustments", ".", "append", "(", "action...
Remove a previously registered monitor. See :meth:`AbstractDeviceAdapter.adjust_monitor`.
[ "Remove", "a", "previously", "registered", "monitor", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/adapter/mixin_notifications.py#L140-L150
train
iotile/coretools
iotilecore/iotile/core/hw/transport/adapter/mixin_notifications.py
BasicNotificationMixin._notify_event_internal
async def _notify_event_internal(self, conn_string, name, event): """Notify that an event has occured. This method will send a notification and ensure that all callbacks registered for it have completed by the time it returns. In particular, if the callbacks are awaitable, this method ...
python
async def _notify_event_internal(self, conn_string, name, event): """Notify that an event has occured. This method will send a notification and ensure that all callbacks registered for it have completed by the time it returns. In particular, if the callbacks are awaitable, this method ...
[ "async", "def", "_notify_event_internal", "(", "self", ",", "conn_string", ",", "name", ",", "event", ")", ":", "try", ":", "self", ".", "_currently_notifying", "=", "True", "conn_id", "=", "self", ".", "_get_conn_id", "(", "conn_string", ")", "event_maps", ...
Notify that an event has occured. This method will send a notification and ensure that all callbacks registered for it have completed by the time it returns. In particular, if the callbacks are awaitable, this method will await them before returning. The order in which the callbacks a...
[ "Notify", "that", "an", "event", "has", "occured", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/adapter/mixin_notifications.py#L152-L196
train
iotile/coretools
iotilecore/iotile/core/hw/transport/adapter/mixin_notifications.py
BasicNotificationMixin.notify_progress
def notify_progress(self, conn_string, operation, finished, total, wait=True): """Send a progress event. Progress events can be sent for ``debug`` and ``script`` operations and notify the caller about the progress of these potentially long-running operations. They have two integer prop...
python
def notify_progress(self, conn_string, operation, finished, total, wait=True): """Send a progress event. Progress events can be sent for ``debug`` and ``script`` operations and notify the caller about the progress of these potentially long-running operations. They have two integer prop...
[ "def", "notify_progress", "(", "self", ",", "conn_string", ",", "operation", ",", "finished", ",", "total", ",", "wait", "=", "True", ")", ":", "if", "operation", "not", "in", "self", ".", "PROGRESS_OPERATIONS", ":", "raise", "ArgumentError", "(", "\"Invalid...
Send a progress event. Progress events can be sent for ``debug`` and ``script`` operations and notify the caller about the progress of these potentially long-running operations. They have two integer properties that specify what fraction of the operation has been completed. Ar...
[ "Send", "a", "progress", "event", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/adapter/mixin_notifications.py#L254-L286
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/sgicxx.py
generate
def generate(env): """Add Builders and construction variables for SGI MIPS C++ to an Environment.""" cplusplus.generate(env) env['CXX'] = 'CC' env['CXXFLAGS'] = SCons.Util.CLVar('-LANG:std') env['SHCXX'] = '$CXX' env['SHOBJSUFFIX'] = '.o' env['STATIC_AND_SHARED_OBJECTS_ARE...
python
def generate(env): """Add Builders and construction variables for SGI MIPS C++ to an Environment.""" cplusplus.generate(env) env['CXX'] = 'CC' env['CXXFLAGS'] = SCons.Util.CLVar('-LANG:std') env['SHCXX'] = '$CXX' env['SHOBJSUFFIX'] = '.o' env['STATIC_AND_SHARED_OBJECTS_ARE...
[ "def", "generate", "(", "env", ")", ":", "cplusplus", ".", "generate", "(", "env", ")", "env", "[", "'CXX'", "]", "=", "'CC'", "env", "[", "'CXXFLAGS'", "]", "=", "SCons", ".", "Util", ".", "CLVar", "(", "'-LANG:std'", ")", "env", "[", "'SHCXX'", "...
Add Builders and construction variables for SGI MIPS C++ to an Environment.
[ "Add", "Builders", "and", "construction", "variables", "for", "SGI", "MIPS", "C", "++", "to", "an", "Environment", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/sgicxx.py#L43-L52
train
iotile/coretools
transport_plugins/bled112/iotile_transport_bled112/async_packet.py
AsyncPacketBuffer.read_packet
def read_packet(self, timeout=3.0): """read one packet, timeout if one packet is not available in the timeout period""" try: return self.queue.get(timeout=timeout) except Empty: raise InternalTimeoutError("Timeout waiting for packet in AsyncPacketBuffer")
python
def read_packet(self, timeout=3.0): """read one packet, timeout if one packet is not available in the timeout period""" try: return self.queue.get(timeout=timeout) except Empty: raise InternalTimeoutError("Timeout waiting for packet in AsyncPacketBuffer")
[ "def", "read_packet", "(", "self", ",", "timeout", "=", "3.0", ")", ":", "try", ":", "return", "self", ".", "queue", ".", "get", "(", "timeout", "=", "timeout", ")", "except", "Empty", ":", "raise", "InternalTimeoutError", "(", "\"Timeout waiting for packet ...
read one packet, timeout if one packet is not available in the timeout period
[ "read", "one", "packet", "timeout", "if", "one", "packet", "is", "not", "available", "in", "the", "timeout", "period" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/bled112/iotile_transport_bled112/async_packet.py#L45-L51
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/javac.py
generate
def generate(env): """Add Builders and construction variables for javac to an Environment.""" java_file = SCons.Tool.CreateJavaFileBuilder(env) java_class = SCons.Tool.CreateJavaClassFileBuilder(env) java_class_dir = SCons.Tool.CreateJavaClassDirBuilder(env) java_class.add_emitter(None, emit_java_cl...
python
def generate(env): """Add Builders and construction variables for javac to an Environment.""" java_file = SCons.Tool.CreateJavaFileBuilder(env) java_class = SCons.Tool.CreateJavaClassFileBuilder(env) java_class_dir = SCons.Tool.CreateJavaClassDirBuilder(env) java_class.add_emitter(None, emit_java_cl...
[ "def", "generate", "(", "env", ")", ":", "java_file", "=", "SCons", ".", "Tool", ".", "CreateJavaFileBuilder", "(", "env", ")", "java_class", "=", "SCons", ".", "Tool", ".", "CreateJavaClassFileBuilder", "(", "env", ")", "java_class_dir", "=", "SCons", ".", ...
Add Builders and construction variables for javac to an Environment.
[ "Add", "Builders", "and", "construction", "variables", "for", "javac", "to", "an", "Environment", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/javac.py#L199-L223
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Variables/__init__.py
Variables.Add
def Add(self, key, help="", default=None, validator=None, converter=None, **kw): """ Add an option. @param key: the name of the variable, or a list or tuple of arguments @param help: optional help text for the options @param default: optional default value @param valida...
python
def Add(self, key, help="", default=None, validator=None, converter=None, **kw): """ Add an option. @param key: the name of the variable, or a list or tuple of arguments @param help: optional help text for the options @param default: optional default value @param valida...
[ "def", "Add", "(", "self", ",", "key", ",", "help", "=", "\"\"", ",", "default", "=", "None", ",", "validator", "=", "None", ",", "converter", "=", "None", ",", "**", "kw", ")", ":", "if", "SCons", ".", "Util", ".", "is_List", "(", "key", ")", ...
Add an option. @param key: the name of the variable, or a list or tuple of arguments @param help: optional help text for the options @param default: optional default value @param validator: optional function that is called to validate the option's value @type validator: Called ...
[ "Add", "an", "option", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Variables/__init__.py#L115-L136
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Variables/__init__.py
Variables.Update
def Update(self, env, args=None): """ Update an environment with the option variables. env - the environment to update. """ values = {} # first set the defaults: for option in self.options: if not option.default is None: values[optio...
python
def Update(self, env, args=None): """ Update an environment with the option variables. env - the environment to update. """ values = {} # first set the defaults: for option in self.options: if not option.default is None: values[optio...
[ "def", "Update", "(", "self", ",", "env", ",", "args", "=", "None", ")", ":", "values", "=", "{", "}", "for", "option", "in", "self", ".", "options", ":", "if", "not", "option", ".", "default", "is", "None", ":", "values", "[", "option", ".", "ke...
Update an environment with the option variables. env - the environment to update.
[ "Update", "an", "environment", "with", "the", "option", "variables", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Variables/__init__.py#L160-L227
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Variables/__init__.py
Variables.Save
def Save(self, filename, env): """ Saves all the options in the given file. This file can then be used to load the options next run. This can be used to create an option cache file. filename - Name of the file to save into env - the environment get the option values fr...
python
def Save(self, filename, env): """ Saves all the options in the given file. This file can then be used to load the options next run. This can be used to create an option cache file. filename - Name of the file to save into env - the environment get the option values fr...
[ "def", "Save", "(", "self", ",", "filename", ",", "env", ")", ":", "try", ":", "fh", "=", "open", "(", "filename", ",", "'w'", ")", "try", ":", "for", "option", "in", "self", ".", "options", ":", "try", ":", "value", "=", "env", "[", "option", ...
Saves all the options in the given file. This file can then be used to load the options next run. This can be used to create an option cache file. filename - Name of the file to save into env - the environment get the option values from
[ "Saves", "all", "the", "options", "in", "the", "given", "file", ".", "This", "file", "can", "then", "be", "used", "to", "load", "the", "options", "next", "run", ".", "This", "can", "be", "used", "to", "create", "an", "option", "cache", "file", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Variables/__init__.py#L236-L283
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Variables/__init__.py
Variables.GenerateHelpText
def GenerateHelpText(self, env, sort=None): """ Generate the help text for the options. env - an environment that is used to get the current values of the options. cmp - Either a function as follows: The specific sort function should take two arguments and return -1, 0 or ...
python
def GenerateHelpText(self, env, sort=None): """ Generate the help text for the options. env - an environment that is used to get the current values of the options. cmp - Either a function as follows: The specific sort function should take two arguments and return -1, 0 or ...
[ "def", "GenerateHelpText", "(", "self", ",", "env", ",", "sort", "=", "None", ")", ":", "if", "callable", "(", "sort", ")", ":", "options", "=", "sorted", "(", "self", ".", "options", ",", "key", "=", "cmp_to_key", "(", "lambda", "x", ",", "y", ":"...
Generate the help text for the options. env - an environment that is used to get the current values of the options. cmp - Either a function as follows: The specific sort function should take two arguments and return -1, 0 or 1 or a boolean to indicate if it should be sorted...
[ "Generate", "the", "help", "text", "for", "the", "options", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Variables/__init__.py#L285-L310
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Util.py
render_tree
def render_tree(root, child_func, prune=0, margin=[0], visited=None): """ Render a tree of nodes into an ASCII tree view. :Parameters: - `root`: the root node of the tree - `child_func`: the function called to get the children of a node - `prune`: don't visit the same nod...
python
def render_tree(root, child_func, prune=0, margin=[0], visited=None): """ Render a tree of nodes into an ASCII tree view. :Parameters: - `root`: the root node of the tree - `child_func`: the function called to get the children of a node - `prune`: don't visit the same nod...
[ "def", "render_tree", "(", "root", ",", "child_func", ",", "prune", "=", "0", ",", "margin", "=", "[", "0", "]", ",", "visited", "=", "None", ")", ":", "rname", "=", "str", "(", "root", ")", "if", "visited", "is", "None", ":", "visited", "=", "{"...
Render a tree of nodes into an ASCII tree view. :Parameters: - `root`: the root node of the tree - `child_func`: the function called to get the children of a node - `prune`: don't visit the same node twice - `margin`: the format of the left margin to use for children ...
[ "Render", "a", "tree", "of", "nodes", "into", "an", "ASCII", "tree", "view", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Util.py#L235-L274
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Util.py
print_tree
def print_tree(root, child_func, prune=0, showtags=0, margin=[0], visited=None): """ Print a tree of nodes. This is like render_tree, except it prints lines directly instead of creating a string representation in memory, so that huge trees can be printed. :Parameters: - `root` - the ...
python
def print_tree(root, child_func, prune=0, showtags=0, margin=[0], visited=None): """ Print a tree of nodes. This is like render_tree, except it prints lines directly instead of creating a string representation in memory, so that huge trees can be printed. :Parameters: - `root` - the ...
[ "def", "print_tree", "(", "root", ",", "child_func", ",", "prune", "=", "0", ",", "showtags", "=", "0", ",", "margin", "=", "[", "0", "]", ",", "visited", "=", "None", ")", ":", "rname", "=", "str", "(", "root", ")", "if", "visited", "is", "None"...
Print a tree of nodes. This is like render_tree, except it prints lines directly instead of creating a string representation in memory, so that huge trees can be printed. :Parameters: - `root` - the root node of the tree - `child_func` - the function called to get the children of a n...
[ "Print", "a", "tree", "of", "nodes", ".", "This", "is", "like", "render_tree", "except", "it", "prints", "lines", "directly", "instead", "of", "creating", "a", "string", "representation", "in", "memory", "so", "that", "huge", "trees", "can", "be", "printed",...
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Util.py#L279-L354
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Util.py
flatten
def flatten(obj, isinstance=isinstance, StringTypes=StringTypes, SequenceTypes=SequenceTypes, do_flatten=do_flatten): """Flatten a sequence to a non-nested list. Flatten() converts either a single scalar or a nested sequence to a non-nested list. Note that flatten() considers strings to be ...
python
def flatten(obj, isinstance=isinstance, StringTypes=StringTypes, SequenceTypes=SequenceTypes, do_flatten=do_flatten): """Flatten a sequence to a non-nested list. Flatten() converts either a single scalar or a nested sequence to a non-nested list. Note that flatten() considers strings to be ...
[ "def", "flatten", "(", "obj", ",", "isinstance", "=", "isinstance", ",", "StringTypes", "=", "StringTypes", ",", "SequenceTypes", "=", "SequenceTypes", ",", "do_flatten", "=", "do_flatten", ")", ":", "if", "isinstance", "(", "obj", ",", "StringTypes", ")", "...
Flatten a sequence to a non-nested list. Flatten() converts either a single scalar or a nested sequence to a non-nested list. Note that flatten() considers strings to be scalars instead of sequences like Python would.
[ "Flatten", "a", "sequence", "to", "a", "non", "-", "nested", "list", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Util.py#L423-L439
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Util.py
unique
def unique(s): """Return a list of the elements in s, but without duplicates. For example, unique([1,2,3,1,2,3]) is some permutation of [1,2,3], unique("abcabc") some permutation of ["a", "b", "c"], and unique(([1, 2], [2, 3], [1, 2])) some permutation of [[2, 3], [1, 2]]. For best speed, all ...
python
def unique(s): """Return a list of the elements in s, but without duplicates. For example, unique([1,2,3,1,2,3]) is some permutation of [1,2,3], unique("abcabc") some permutation of ["a", "b", "c"], and unique(([1, 2], [2, 3], [1, 2])) some permutation of [[2, 3], [1, 2]]. For best speed, all ...
[ "def", "unique", "(", "s", ")", ":", "n", "=", "len", "(", "s", ")", "if", "n", "==", "0", ":", "return", "[", "]", "u", "=", "{", "}", "try", ":", "for", "x", "in", "s", ":", "u", "[", "x", "]", "=", "1", "except", "TypeError", ":", "p...
Return a list of the elements in s, but without duplicates. For example, unique([1,2,3,1,2,3]) is some permutation of [1,2,3], unique("abcabc") some permutation of ["a", "b", "c"], and unique(([1, 2], [2, 3], [1, 2])) some permutation of [[2, 3], [1, 2]]. For best speed, all sequence elements shou...
[ "Return", "a", "list", "of", "the", "elements", "in", "s", "but", "without", "duplicates", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Util.py#L1155-L1222
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Util.py
make_path_relative
def make_path_relative(path): """ makes an absolute path name to a relative pathname. """ if os.path.isabs(path): drive_s,path = os.path.splitdrive(path) import re if not drive_s: path=re.compile("/*(.*)").findall(path)[0] else: path=path[1:] ass...
python
def make_path_relative(path): """ makes an absolute path name to a relative pathname. """ if os.path.isabs(path): drive_s,path = os.path.splitdrive(path) import re if not drive_s: path=re.compile("/*(.*)").findall(path)[0] else: path=path[1:] ass...
[ "def", "make_path_relative", "(", "path", ")", ":", "if", "os", ".", "path", ".", "isabs", "(", "path", ")", ":", "drive_s", ",", "path", "=", "os", ".", "path", ".", "splitdrive", "(", "path", ")", "import", "re", "if", "not", "drive_s", ":", "pat...
makes an absolute path name to a relative pathname.
[ "makes", "an", "absolute", "path", "name", "to", "a", "relative", "pathname", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Util.py#L1411-L1424
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Util.py
RenameFunction
def RenameFunction(function, name): """ Returns a function identical to the specified function, but with the specified name. """ return FunctionType(function.__code__, function.__globals__, name, function.__defaults__)
python
def RenameFunction(function, name): """ Returns a function identical to the specified function, but with the specified name. """ return FunctionType(function.__code__, function.__globals__, name, function.__defaults__)
[ "def", "RenameFunction", "(", "function", ",", "name", ")", ":", "return", "FunctionType", "(", "function", ".", "__code__", ",", "function", ".", "__globals__", ",", "name", ",", "function", ".", "__defaults__", ")" ]
Returns a function identical to the specified function, but with the specified name.
[ "Returns", "a", "function", "identical", "to", "the", "specified", "function", "but", "with", "the", "specified", "name", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Util.py#L1488-L1496
train
iotile/coretools
iotilecore/iotile/core/hw/proxy/proxy.py
_create_old_return_value
def _create_old_return_value(payload, num_ints, buff): """Parse the response of an RPC call into a dictionary with integer and buffer results""" parsed = {'ints': payload[:num_ints], 'buffer': None, 'error': 'No Error', 'is_error': False, 'return_value': 0} if buff: parsed['buffer'] ...
python
def _create_old_return_value(payload, num_ints, buff): """Parse the response of an RPC call into a dictionary with integer and buffer results""" parsed = {'ints': payload[:num_ints], 'buffer': None, 'error': 'No Error', 'is_error': False, 'return_value': 0} if buff: parsed['buffer'] ...
[ "def", "_create_old_return_value", "(", "payload", ",", "num_ints", ",", "buff", ")", ":", "parsed", "=", "{", "'ints'", ":", "payload", "[", ":", "num_ints", "]", ",", "'buffer'", ":", "None", ",", "'error'", ":", "'No Error'", ",", "'is_error'", ":", "...
Parse the response of an RPC call into a dictionary with integer and buffer results
[ "Parse", "the", "response", "of", "an", "RPC", "call", "into", "a", "dictionary", "with", "integer", "and", "buffer", "results" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/proxy/proxy.py#L382-L391
train
iotile/coretools
iotilecore/iotile/core/hw/proxy/proxy.py
TileBusProxyObject.hardware_version
def hardware_version(self): """Return the embedded hardware version string for this tile. The hardware version is an up to 10 byte user readable string that is meant to encode any necessary information about the specific hardware that this tile is running on. For example, if you have m...
python
def hardware_version(self): """Return the embedded hardware version string for this tile. The hardware version is an up to 10 byte user readable string that is meant to encode any necessary information about the specific hardware that this tile is running on. For example, if you have m...
[ "def", "hardware_version", "(", "self", ")", ":", "res", "=", "self", ".", "rpc", "(", "0x00", ",", "0x02", ",", "result_type", "=", "(", "0", ",", "True", ")", ")", "binary_version", "=", "res", "[", "'buffer'", "]", "ver", "=", "\"\"", "for", "x"...
Return the embedded hardware version string for this tile. The hardware version is an up to 10 byte user readable string that is meant to encode any necessary information about the specific hardware that this tile is running on. For example, if you have multiple assembly variants of a ...
[ "Return", "the", "embedded", "hardware", "version", "string", "for", "this", "tile", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/proxy/proxy.py#L102-L125
train
iotile/coretools
iotilecore/iotile/core/hw/proxy/proxy.py
TileBusProxyObject.check_hardware
def check_hardware(self, expected): """Make sure the hardware version is what we expect. This convenience function is meant for ensuring that we are talking to a tile that has the correct hardware version. Args: expected (str): The expected hardware string that is compared ...
python
def check_hardware(self, expected): """Make sure the hardware version is what we expect. This convenience function is meant for ensuring that we are talking to a tile that has the correct hardware version. Args: expected (str): The expected hardware string that is compared ...
[ "def", "check_hardware", "(", "self", ",", "expected", ")", ":", "if", "len", "(", "expected", ")", "<", "10", ":", "expected", "+=", "'\\0'", "*", "(", "10", "-", "len", "(", "expected", ")", ")", "err", ",", "=", "self", ".", "rpc", "(", "0x00"...
Make sure the hardware version is what we expect. This convenience function is meant for ensuring that we are talking to a tile that has the correct hardware version. Args: expected (str): The expected hardware string that is compared against what is reported by the...
[ "Make", "sure", "the", "hardware", "version", "is", "what", "we", "expect", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/proxy/proxy.py#L129-L150
train
iotile/coretools
iotilecore/iotile/core/hw/proxy/proxy.py
TileBusProxyObject.status
def status(self): """Query the status of an IOTile including its name and version""" hw_type, name, major, minor, patch, status = self.rpc(0x00, 0x04, result_format="H6sBBBB") status = { 'hw_type': hw_type, 'name': name.decode('utf-8'), 'version': (major, mi...
python
def status(self): """Query the status of an IOTile including its name and version""" hw_type, name, major, minor, patch, status = self.rpc(0x00, 0x04, result_format="H6sBBBB") status = { 'hw_type': hw_type, 'name': name.decode('utf-8'), 'version': (major, mi...
[ "def", "status", "(", "self", ")", ":", "hw_type", ",", "name", ",", "major", ",", "minor", ",", "patch", ",", "status", "=", "self", ".", "rpc", "(", "0x00", ",", "0x04", ",", "result_format", "=", "\"H6sBBBB\"", ")", "status", "=", "{", "'hw_type'"...
Query the status of an IOTile including its name and version
[ "Query", "the", "status", "of", "an", "IOTile", "including", "its", "name", "and", "version" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/proxy/proxy.py#L153-L165
train
iotile/coretools
iotilecore/iotile/core/hw/proxy/proxy.py
TileBusProxyObject.tile_status
def tile_status(self): """Get the current status of this tile""" stat = self.status() flags = stat['status'] # FIXME: This needs to stay in sync with lib_common: cdb_status.h status = {} status['debug_mode'] = bool(flags & (1 << 3)) status['configured'] = bool(f...
python
def tile_status(self): """Get the current status of this tile""" stat = self.status() flags = stat['status'] # FIXME: This needs to stay in sync with lib_common: cdb_status.h status = {} status['debug_mode'] = bool(flags & (1 << 3)) status['configured'] = bool(f...
[ "def", "tile_status", "(", "self", ")", ":", "stat", "=", "self", ".", "status", "(", ")", "flags", "=", "stat", "[", "'status'", "]", "status", "=", "{", "}", "status", "[", "'debug_mode'", "]", "=", "bool", "(", "flags", "&", "(", "1", "<<", "3...
Get the current status of this tile
[ "Get", "the", "current", "status", "of", "this", "tile" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/proxy/proxy.py#L190-L203
train
iotile/coretools
iotilecore/iotile/core/hw/transport/server/standard.py
StandardDeviceServer.client_event_handler
async def client_event_handler(self, client_id, event_tuple, user_data): """Method called to actually send an event to a client. Users of this class should override this method to actually forward device events to their clients. It is called with the client_id passed to (or returned fr...
python
async def client_event_handler(self, client_id, event_tuple, user_data): """Method called to actually send an event to a client. Users of this class should override this method to actually forward device events to their clients. It is called with the client_id passed to (or returned fr...
[ "async", "def", "client_event_handler", "(", "self", ",", "client_id", ",", "event_tuple", ",", "user_data", ")", ":", "conn_string", ",", "event_name", ",", "_event", "=", "event_tuple", "self", ".", "_logger", ".", "debug", "(", "\"Ignoring event %s from device ...
Method called to actually send an event to a client. Users of this class should override this method to actually forward device events to their clients. It is called with the client_id passed to (or returned from) :meth:`setup_client` as well as the user_data object that was included t...
[ "Method", "called", "to", "actually", "send", "an", "event", "to", "a", "client", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/server/standard.py#L91-L120
train
iotile/coretools
iotilecore/iotile/core/hw/transport/server/standard.py
StandardDeviceServer.setup_client
def setup_client(self, client_id=None, user_data=None, scan=True, broadcast=False): """Setup a newly connected client. ``client_id`` must be unique among all connected clients. If it is passed as None, a random client_id will be generated as a string and returned. This method ...
python
def setup_client(self, client_id=None, user_data=None, scan=True, broadcast=False): """Setup a newly connected client. ``client_id`` must be unique among all connected clients. If it is passed as None, a random client_id will be generated as a string and returned. This method ...
[ "def", "setup_client", "(", "self", ",", "client_id", "=", "None", ",", "user_data", "=", "None", ",", "scan", "=", "True", ",", "broadcast", "=", "False", ")", ":", "if", "client_id", "is", "None", ":", "client_id", "=", "str", "(", "uuid", ".", "uu...
Setup a newly connected client. ``client_id`` must be unique among all connected clients. If it is passed as None, a random client_id will be generated as a string and returned. This method reserves internal resources for tracking what devices this client has connected to and ...
[ "Setup", "a", "newly", "connected", "client", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/server/standard.py#L122-L174
train
iotile/coretools
iotilecore/iotile/core/hw/transport/server/standard.py
StandardDeviceServer.stop
async def stop(self): """Stop the server and teardown any remaining clients. If your subclass overrides this method, make sure to call super().stop() to ensure that all devices with open connections from thie server are properly closed. See :meth:`AbstractDeviceServer.stop`. ...
python
async def stop(self): """Stop the server and teardown any remaining clients. If your subclass overrides this method, make sure to call super().stop() to ensure that all devices with open connections from thie server are properly closed. See :meth:`AbstractDeviceServer.stop`. ...
[ "async", "def", "stop", "(", "self", ")", ":", "clients", "=", "list", "(", "self", ".", "_clients", ")", "for", "client", "in", "clients", ":", "self", ".", "_logger", ".", "info", "(", "\"Tearing down client %s at server stop()\"", ",", "client", ")", "a...
Stop the server and teardown any remaining clients. If your subclass overrides this method, make sure to call super().stop() to ensure that all devices with open connections from thie server are properly closed. See :meth:`AbstractDeviceServer.stop`.
[ "Stop", "the", "server", "and", "teardown", "any", "remaining", "clients", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/server/standard.py#L182-L196
train
iotile/coretools
iotilecore/iotile/core/hw/transport/server/standard.py
StandardDeviceServer.teardown_client
async def teardown_client(self, client_id): """Release all resources held by a client. This method must be called and awaited whenever a client is disconnected. It ensures that all of the client's resources are properly released and any devices they have connected to are discon...
python
async def teardown_client(self, client_id): """Release all resources held by a client. This method must be called and awaited whenever a client is disconnected. It ensures that all of the client's resources are properly released and any devices they have connected to are discon...
[ "async", "def", "teardown_client", "(", "self", ",", "client_id", ")", ":", "client_info", "=", "self", ".", "_client_info", "(", "client_id", ")", "self", ".", "adapter", ".", "remove_monitor", "(", "client_info", "[", "'monitor'", "]", ")", "conns", "=", ...
Release all resources held by a client. This method must be called and awaited whenever a client is disconnected. It ensures that all of the client's resources are properly released and any devices they have connected to are disconnected cleanly. Args: client_id (s...
[ "Release", "all", "resources", "held", "by", "a", "client", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/server/standard.py#L198-L225
train
iotile/coretools
iotilecore/iotile/core/hw/transport/server/standard.py
StandardDeviceServer.connect
async def connect(self, client_id, conn_string): """Connect to a device on behalf of a client. See :meth:`AbstractDeviceAdapter.connect`. Args: client_id (str): The client we are working for. conn_string (str): A connection string that will be passed to ...
python
async def connect(self, client_id, conn_string): """Connect to a device on behalf of a client. See :meth:`AbstractDeviceAdapter.connect`. Args: client_id (str): The client we are working for. conn_string (str): A connection string that will be passed to ...
[ "async", "def", "connect", "(", "self", ",", "client_id", ",", "conn_string", ")", ":", "conn_id", "=", "self", ".", "adapter", ".", "unique_conn_id", "(", ")", "self", ".", "_client_info", "(", "client_id", ")", "await", "self", ".", "adapter", ".", "co...
Connect to a device on behalf of a client. See :meth:`AbstractDeviceAdapter.connect`. Args: client_id (str): The client we are working for. conn_string (str): A connection string that will be passed to the underlying device adapter to connect. Raises: ...
[ "Connect", "to", "a", "device", "on", "behalf", "of", "a", "client", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/server/standard.py#L244-L263
train
iotile/coretools
iotilecore/iotile/core/hw/transport/server/standard.py
StandardDeviceServer.disconnect
async def disconnect(self, client_id, conn_string): """Disconnect from a device on behalf of a client. See :meth:`AbstractDeviceAdapter.disconnect`. Args: client_id (str): The client we are working for. conn_string (str): A connection string that will be ...
python
async def disconnect(self, client_id, conn_string): """Disconnect from a device on behalf of a client. See :meth:`AbstractDeviceAdapter.disconnect`. Args: client_id (str): The client we are working for. conn_string (str): A connection string that will be ...
[ "async", "def", "disconnect", "(", "self", ",", "client_id", ",", "conn_string", ")", ":", "conn_id", "=", "self", ".", "_client_connection", "(", "client_id", ",", "conn_string", ")", "try", ":", "await", "self", ".", "adapter", ".", "disconnect", "(", "c...
Disconnect from a device on behalf of a client. See :meth:`AbstractDeviceAdapter.disconnect`. Args: client_id (str): The client we are working for. conn_string (str): A connection string that will be passed to the underlying device adapter to connect. R...
[ "Disconnect", "from", "a", "device", "on", "behalf", "of", "a", "client", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/server/standard.py#L265-L286
train
iotile/coretools
iotilecore/iotile/core/hw/transport/server/standard.py
StandardDeviceServer.open_interface
async def open_interface(self, client_id, conn_string, interface): """Open a device interface on behalf of a client. See :meth:`AbstractDeviceAdapter.open_interface`. Args: client_id (str): The client we are working for. conn_string (str): A connection string that will ...
python
async def open_interface(self, client_id, conn_string, interface): """Open a device interface on behalf of a client. See :meth:`AbstractDeviceAdapter.open_interface`. Args: client_id (str): The client we are working for. conn_string (str): A connection string that will ...
[ "async", "def", "open_interface", "(", "self", ",", "client_id", ",", "conn_string", ",", "interface", ")", ":", "conn_id", "=", "self", ".", "_client_connection", "(", "client_id", ",", "conn_string", ")", "self", ".", "_hook_open_interface", "(", "conn_string"...
Open a device interface on behalf of a client. See :meth:`AbstractDeviceAdapter.open_interface`. Args: client_id (str): The client we are working for. conn_string (str): A connection string that will be passed to the underlying device adapter. interf...
[ "Open", "a", "device", "interface", "on", "behalf", "of", "a", "client", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/server/standard.py#L288-L309
train
iotile/coretools
iotilecore/iotile/core/hw/transport/server/standard.py
StandardDeviceServer.close_interface
async def close_interface(self, client_id, conn_string, interface): """Close a device interface on behalf of a client. See :meth:`AbstractDeviceAdapter.close_interface`. Args: client_id (str): The client we are working for. conn_string (str): A connection string that wi...
python
async def close_interface(self, client_id, conn_string, interface): """Close a device interface on behalf of a client. See :meth:`AbstractDeviceAdapter.close_interface`. Args: client_id (str): The client we are working for. conn_string (str): A connection string that wi...
[ "async", "def", "close_interface", "(", "self", ",", "client_id", ",", "conn_string", ",", "interface", ")", ":", "conn_id", "=", "self", ".", "_client_connection", "(", "client_id", ",", "conn_string", ")", "await", "self", ".", "adapter", ".", "close_interfa...
Close a device interface on behalf of a client. See :meth:`AbstractDeviceAdapter.close_interface`. Args: client_id (str): The client we are working for. conn_string (str): A connection string that will be passed to the underlying device adapter. inte...
[ "Close", "a", "device", "interface", "on", "behalf", "of", "a", "client", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/server/standard.py#L311-L331
train
iotile/coretools
iotilecore/iotile/core/hw/transport/server/standard.py
StandardDeviceServer.send_rpc
async def send_rpc(self, client_id, conn_string, address, rpc_id, payload, timeout): """Send an RPC on behalf of a client. See :meth:`AbstractDeviceAdapter.send_rpc`. Args: client_id (str): The client we are working for. conn_string (str): A connection string that will ...
python
async def send_rpc(self, client_id, conn_string, address, rpc_id, payload, timeout): """Send an RPC on behalf of a client. See :meth:`AbstractDeviceAdapter.send_rpc`. Args: client_id (str): The client we are working for. conn_string (str): A connection string that will ...
[ "async", "def", "send_rpc", "(", "self", ",", "client_id", ",", "conn_string", ",", "address", ",", "rpc_id", ",", "payload", ",", "timeout", ")", ":", "conn_id", "=", "self", ".", "_client_connection", "(", "client_id", ",", "conn_string", ")", "return", ...
Send an RPC on behalf of a client. See :meth:`AbstractDeviceAdapter.send_rpc`. Args: client_id (str): The client we are working for. conn_string (str): A connection string that will be passed to the underlying device adapter to connect. address (int)...
[ "Send", "an", "RPC", "on", "behalf", "of", "a", "client", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/server/standard.py#L334-L367
train
iotile/coretools
iotilecore/iotile/core/hw/transport/server/standard.py
StandardDeviceServer.send_script
async def send_script(self, client_id, conn_string, script): """Send a script to a device on behalf of a client. See :meth:`AbstractDeviceAdapter.send_script`. Args: client_id (str): The client we are working for. conn_string (str): A connection string that will be ...
python
async def send_script(self, client_id, conn_string, script): """Send a script to a device on behalf of a client. See :meth:`AbstractDeviceAdapter.send_script`. Args: client_id (str): The client we are working for. conn_string (str): A connection string that will be ...
[ "async", "def", "send_script", "(", "self", ",", "client_id", ",", "conn_string", ",", "script", ")", ":", "conn_id", "=", "self", ".", "_client_connection", "(", "client_id", ",", "conn_string", ")", "await", "self", ".", "adapter", ".", "send_script", "(",...
Send a script to a device on behalf of a client. See :meth:`AbstractDeviceAdapter.send_script`. Args: client_id (str): The client we are working for. conn_string (str): A connection string that will be passed to the underlying device adapter. script ...
[ "Send", "a", "script", "to", "a", "device", "on", "behalf", "of", "a", "client", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/server/standard.py#L369-L387
train
iotile/coretools
iotilecore/iotile/core/hw/transport/server/standard.py
StandardDeviceServer.debug
async def debug(self, client_id, conn_string, command, args): """Send a debug command to a device on behalf of a client. See :meth:`AbstractDeviceAdapter.send_script`. Args: client_id (str): The client we are working for. conn_string (str): A connection string that will...
python
async def debug(self, client_id, conn_string, command, args): """Send a debug command to a device on behalf of a client. See :meth:`AbstractDeviceAdapter.send_script`. Args: client_id (str): The client we are working for. conn_string (str): A connection string that will...
[ "async", "def", "debug", "(", "self", ",", "client_id", ",", "conn_string", ",", "command", ",", "args", ")", ":", "conn_id", "=", "self", ".", "_client_info", "(", "client_id", ",", "'connections'", ")", "[", "conn_string", "]", "return", "await", "self",...
Send a debug command to a device on behalf of a client. See :meth:`AbstractDeviceAdapter.send_script`. Args: client_id (str): The client we are working for. conn_string (str): A connection string that will be passed to the underlying device adapter. ...
[ "Send", "a", "debug", "command", "to", "a", "device", "on", "behalf", "of", "a", "client", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/server/standard.py#L389-L412
train
iotile/coretools
iotileemulate/iotile/emulate/reference/controller_features/tile_manager.py
TileInfo.registration_packet
def registration_packet(self): """Serialize this into a tuple suitable for returning from an RPC. Returns: tuple: The serialized values. """ return (self.hw_type, self.api_info[0], self.api_info[1], self.name, self.fw_info[0], self.fw_info[1], self.fw_info[2], ...
python
def registration_packet(self): """Serialize this into a tuple suitable for returning from an RPC. Returns: tuple: The serialized values. """ return (self.hw_type, self.api_info[0], self.api_info[1], self.name, self.fw_info[0], self.fw_info[1], self.fw_info[2], ...
[ "def", "registration_packet", "(", "self", ")", ":", "return", "(", "self", ".", "hw_type", ",", "self", ".", "api_info", "[", "0", "]", ",", "self", ".", "api_info", "[", "1", "]", ",", "self", ".", "name", ",", "self", ".", "fw_info", "[", "0", ...
Serialize this into a tuple suitable for returning from an RPC. Returns: tuple: The serialized values.
[ "Serialize", "this", "into", "a", "tuple", "suitable", "for", "returning", "from", "an", "RPC", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/controller_features/tile_manager.py#L33-L41
train
iotile/coretools
iotileemulate/iotile/emulate/reference/controller_features/tile_manager.py
TileManagerState.clear_to_reset
def clear_to_reset(self, config_vars): """Clear to the state immediately after a reset.""" super(TileManagerState, self).clear_to_reset(config_vars) self.registered_tiles = self.registered_tiles[:1] self.safe_mode = False self.debug_mode = False
python
def clear_to_reset(self, config_vars): """Clear to the state immediately after a reset.""" super(TileManagerState, self).clear_to_reset(config_vars) self.registered_tiles = self.registered_tiles[:1] self.safe_mode = False self.debug_mode = False
[ "def", "clear_to_reset", "(", "self", ",", "config_vars", ")", ":", "super", "(", "TileManagerState", ",", "self", ")", ".", "clear_to_reset", "(", "config_vars", ")", "self", ".", "registered_tiles", "=", "self", ".", "registered_tiles", "[", ":", "1", "]",...
Clear to the state immediately after a reset.
[ "Clear", "to", "the", "state", "immediately", "after", "a", "reset", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/controller_features/tile_manager.py#L86-L92
train
iotile/coretools
iotileemulate/iotile/emulate/reference/controller_features/tile_manager.py
TileManagerState.insert_tile
def insert_tile(self, tile_info): """Add or replace an entry in the tile cache. Args: tile_info (TileInfo): The newly registered tile. """ for i, tile in enumerate(self.registered_tiles): if tile.slot == tile_info.slot: self.registered_tiles[i] =...
python
def insert_tile(self, tile_info): """Add or replace an entry in the tile cache. Args: tile_info (TileInfo): The newly registered tile. """ for i, tile in enumerate(self.registered_tiles): if tile.slot == tile_info.slot: self.registered_tiles[i] =...
[ "def", "insert_tile", "(", "self", ",", "tile_info", ")", ":", "for", "i", ",", "tile", "in", "enumerate", "(", "self", ".", "registered_tiles", ")", ":", "if", "tile", ".", "slot", "==", "tile_info", ".", "slot", ":", "self", ".", "registered_tiles", ...
Add or replace an entry in the tile cache. Args: tile_info (TileInfo): The newly registered tile.
[ "Add", "or", "replace", "an", "entry", "in", "the", "tile", "cache", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/controller_features/tile_manager.py#L108-L120
train
iotile/coretools
iotileemulate/iotile/emulate/reference/controller_features/tile_manager.py
TileManagerMixin.register_tile
def register_tile(self, hw_type, api_major, api_minor, name, fw_major, fw_minor, fw_patch, exec_major, exec_minor, exec_patch, slot, unique_id): """Register a tile with this controller. This function adds the tile immediately to its internal cache of registered tiles and queues RPCs to send all...
python
def register_tile(self, hw_type, api_major, api_minor, name, fw_major, fw_minor, fw_patch, exec_major, exec_minor, exec_patch, slot, unique_id): """Register a tile with this controller. This function adds the tile immediately to its internal cache of registered tiles and queues RPCs to send all...
[ "def", "register_tile", "(", "self", ",", "hw_type", ",", "api_major", ",", "api_minor", ",", "name", ",", "fw_major", ",", "fw_minor", ",", "fw_patch", ",", "exec_major", ",", "exec_minor", ",", "exec_patch", ",", "slot", ",", "unique_id", ")", ":", "api_...
Register a tile with this controller. This function adds the tile immediately to its internal cache of registered tiles and queues RPCs to send all config variables and start tile rpcs back to the tile.
[ "Register", "a", "tile", "with", "this", "controller", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/controller_features/tile_manager.py#L140-L169
train
iotile/coretools
iotileemulate/iotile/emulate/reference/controller_features/tile_manager.py
TileManagerMixin.describe_tile
def describe_tile(self, index): """Get the registration information for the tile at the given index.""" if index >= len(self.tile_manager.registered_tiles): tile = TileInfo.CreateInvalid() else: tile = self.tile_manager.registered_tiles[index] return tile.regist...
python
def describe_tile(self, index): """Get the registration information for the tile at the given index.""" if index >= len(self.tile_manager.registered_tiles): tile = TileInfo.CreateInvalid() else: tile = self.tile_manager.registered_tiles[index] return tile.regist...
[ "def", "describe_tile", "(", "self", ",", "index", ")", ":", "if", "index", ">=", "len", "(", "self", ".", "tile_manager", ".", "registered_tiles", ")", ":", "tile", "=", "TileInfo", ".", "CreateInvalid", "(", ")", "else", ":", "tile", "=", "self", "."...
Get the registration information for the tile at the given index.
[ "Get", "the", "registration", "information", "for", "the", "tile", "at", "the", "given", "index", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/controller_features/tile_manager.py#L178-L186
train
iotile/coretools
iotilecore/iotile/core/hw/update/script.py
UpdateScript.ParseHeader
def ParseHeader(cls, script_data): """Parse a script integrity header. This function makes sure any integrity hashes are correctly parsed and returns a ScriptHeader structure containing the information that it was able to parse out. Args: script_data (bytearray): Th...
python
def ParseHeader(cls, script_data): """Parse a script integrity header. This function makes sure any integrity hashes are correctly parsed and returns a ScriptHeader structure containing the information that it was able to parse out. Args: script_data (bytearray): Th...
[ "def", "ParseHeader", "(", "cls", ",", "script_data", ")", ":", "if", "len", "(", "script_data", ")", "<", "UpdateScript", ".", "SCRIPT_HEADER_LENGTH", ":", "raise", "ArgumentError", "(", "\"Script is too short to contain a script header\"", ",", "length", "=", "len...
Parse a script integrity header. This function makes sure any integrity hashes are correctly parsed and returns a ScriptHeader structure containing the information that it was able to parse out. Args: script_data (bytearray): The script that we should parse. Raises...
[ "Parse", "a", "script", "integrity", "header", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/update/script.py#L32-L72
train
iotile/coretools
iotilecore/iotile/core/hw/update/script.py
UpdateScript.FromBinary
def FromBinary(cls, script_data, allow_unknown=True, show_rpcs=False): """Parse a binary update script. Args: script_data (bytearray): The binary data containing the script. allow_unknown (bool): Allow the script to contain unknown records so long as they have co...
python
def FromBinary(cls, script_data, allow_unknown=True, show_rpcs=False): """Parse a binary update script. Args: script_data (bytearray): The binary data containing the script. allow_unknown (bool): Allow the script to contain unknown records so long as they have co...
[ "def", "FromBinary", "(", "cls", ",", "script_data", ",", "allow_unknown", "=", "True", ",", "show_rpcs", "=", "False", ")", ":", "curr", "=", "0", "records", "=", "[", "]", "header", "=", "cls", ".", "ParseHeader", "(", "script_data", ")", "curr", "="...
Parse a binary update script. Args: script_data (bytearray): The binary data containing the script. allow_unknown (bool): Allow the script to contain unknown records so long as they have correct headers to allow us to skip them. show_rpcs (bool): Show SendRPC...
[ "Parse", "a", "binary", "update", "script", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/update/script.py#L75-L161
train
iotile/coretools
iotilecore/iotile/core/hw/update/script.py
UpdateScript.encode
def encode(self): """Encode this record into a binary blob. This binary blob could be parsed via a call to FromBinary(). Returns: bytearray: The binary encoded script. """ blob = bytearray() for record in self.records: blob += record.encode() ...
python
def encode(self): """Encode this record into a binary blob. This binary blob could be parsed via a call to FromBinary(). Returns: bytearray: The binary encoded script. """ blob = bytearray() for record in self.records: blob += record.encode() ...
[ "def", "encode", "(", "self", ")", ":", "blob", "=", "bytearray", "(", ")", "for", "record", "in", "self", ".", "records", ":", "blob", "+=", "record", ".", "encode", "(", ")", "header", "=", "struct", ".", "pack", "(", "\"<LL\"", ",", "self", ".",...
Encode this record into a binary blob. This binary blob could be parsed via a call to FromBinary(). Returns: bytearray: The binary encoded script.
[ "Encode", "this", "record", "into", "a", "binary", "blob", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/update/script.py#L163-L184
train
iotile/coretools
iotilecore/iotile/core/hw/virtual/base_runnable.py
BaseRunnable.create_worker
def create_worker(self, func, interval, *args, **kwargs): """Spawn a worker thread running func. The worker will be automatically be started when start() is called and terminated when stop() is called on this object. This must be called only from the main thread, not from a worker threa...
python
def create_worker(self, func, interval, *args, **kwargs): """Spawn a worker thread running func. The worker will be automatically be started when start() is called and terminated when stop() is called on this object. This must be called only from the main thread, not from a worker threa...
[ "def", "create_worker", "(", "self", ",", "func", ",", "interval", ",", "*", "args", ",", "**", "kwargs", ")", ":", "thread", "=", "StoppableWorkerThread", "(", "func", ",", "interval", ",", "args", ",", "kwargs", ")", "self", ".", "_workers", ".", "ap...
Spawn a worker thread running func. The worker will be automatically be started when start() is called and terminated when stop() is called on this object. This must be called only from the main thread, not from a worker thread. create_worker must not be called after stop() has been ca...
[ "Spawn", "a", "worker", "thread", "running", "func", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/virtual/base_runnable.py#L16-L45
train
iotile/coretools
iotilecore/iotile/core/hw/virtual/base_runnable.py
BaseRunnable.stop_workers
def stop_workers(self): """Synchronously stop any potential workers.""" self._started = False for worker in self._workers: worker.stop()
python
def stop_workers(self): """Synchronously stop any potential workers.""" self._started = False for worker in self._workers: worker.stop()
[ "def", "stop_workers", "(", "self", ")", ":", "self", ".", "_started", "=", "False", "for", "worker", "in", "self", ".", "_workers", ":", "worker", ".", "stop", "(", ")" ]
Synchronously stop any potential workers.
[ "Synchronously", "stop", "any", "potential", "workers", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/virtual/base_runnable.py#L58-L64
train
iotile/coretools
iotilecore/iotile/core/hw/virtual/base_runnable.py
BaseRunnable.stop_workers_async
def stop_workers_async(self): """Signal that all workers should stop without waiting.""" self._started = False for worker in self._workers: worker.signal_stop()
python
def stop_workers_async(self): """Signal that all workers should stop without waiting.""" self._started = False for worker in self._workers: worker.signal_stop()
[ "def", "stop_workers_async", "(", "self", ")", ":", "self", ".", "_started", "=", "False", "for", "worker", "in", "self", ".", "_workers", ":", "worker", ".", "signal_stop", "(", ")" ]
Signal that all workers should stop without waiting.
[ "Signal", "that", "all", "workers", "should", "stop", "without", "waiting", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/virtual/base_runnable.py#L66-L71
train
iotile/coretools
iotile_ext_cloud/iotile/cloud/apps/ota_updater.py
_download_ota_script
def _download_ota_script(script_url): """Download the script from the cloud service and store to temporary file location""" try: blob = requests.get(script_url, stream=True) return blob.content except Exception as e: iprint("Failed to download OTA script") iprint(e) ...
python
def _download_ota_script(script_url): """Download the script from the cloud service and store to temporary file location""" try: blob = requests.get(script_url, stream=True) return blob.content except Exception as e: iprint("Failed to download OTA script") iprint(e) ...
[ "def", "_download_ota_script", "(", "script_url", ")", ":", "try", ":", "blob", "=", "requests", ".", "get", "(", "script_url", ",", "stream", "=", "True", ")", "return", "blob", ".", "content", "except", "Exception", "as", "e", ":", "iprint", "(", "\"Fa...
Download the script from the cloud service and store to temporary file location
[ "Download", "the", "script", "from", "the", "cloud", "service", "and", "store", "to", "temporary", "file", "location" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotile_ext_cloud/iotile/cloud/apps/ota_updater.py#L27-L36
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/compat/__init__.py
rename_module
def rename_module(new, old): """ Attempts to import the old module and load it under the new name. Used for purely cosmetic name changes in Python 3.x. """ try: sys.modules[new] = imp.load_module(old, *imp.find_module(old)) return True except ImportError: return False
python
def rename_module(new, old): """ Attempts to import the old module and load it under the new name. Used for purely cosmetic name changes in Python 3.x. """ try: sys.modules[new] = imp.load_module(old, *imp.find_module(old)) return True except ImportError: return False
[ "def", "rename_module", "(", "new", ",", "old", ")", ":", "try", ":", "sys", ".", "modules", "[", "new", "]", "=", "imp", ".", "load_module", "(", "old", ",", "*", "imp", ".", "find_module", "(", "old", ")", ")", "return", "True", "except", "Import...
Attempts to import the old module and load it under the new name. Used for purely cosmetic name changes in Python 3.x.
[ "Attempts", "to", "import", "the", "old", "module", "and", "load", "it", "under", "the", "new", "name", ".", "Used", "for", "purely", "cosmetic", "name", "changes", "in", "Python", "3", ".", "x", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/compat/__init__.py#L78-L87
train
iotile/coretools
transport_plugins/jlink/iotile_transport_jlink/jlink.py
JLinkAdapter._parse_conn_string
def _parse_conn_string(self, conn_string): """Parse a connection string passed from 'debug -c' or 'connect_direct' Returns True if any settings changed in the debug port, which would require a jlink disconnection """ disconnection_required = False """If device not in con...
python
def _parse_conn_string(self, conn_string): """Parse a connection string passed from 'debug -c' or 'connect_direct' Returns True if any settings changed in the debug port, which would require a jlink disconnection """ disconnection_required = False """If device not in con...
[ "def", "_parse_conn_string", "(", "self", ",", "conn_string", ")", ":", "disconnection_required", "=", "False", "if", "conn_string", "is", "None", "or", "'device'", "not", "in", "conn_string", ":", "if", "self", ".", "_default_device_info", "is", "not", "None", ...
Parse a connection string passed from 'debug -c' or 'connect_direct' Returns True if any settings changed in the debug port, which would require a jlink disconnection
[ "Parse", "a", "connection", "string", "passed", "from", "debug", "-", "c", "or", "connect_direct", "Returns", "True", "if", "any", "settings", "changed", "in", "the", "debug", "port", "which", "would", "require", "a", "jlink", "disconnection" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/jlink/iotile_transport_jlink/jlink.py#L85-L131
train
iotile/coretools
transport_plugins/jlink/iotile_transport_jlink/jlink.py
JLinkAdapter._try_connect
def _try_connect(self, connection_string): """If the connecton string settings are different, try and connect to an attached device""" if self._parse_conn_string(connection_string): self._trigger_callback('on_disconnect', self.id, self._connection_id) self.stop_sync() ...
python
def _try_connect(self, connection_string): """If the connecton string settings are different, try and connect to an attached device""" if self._parse_conn_string(connection_string): self._trigger_callback('on_disconnect', self.id, self._connection_id) self.stop_sync() ...
[ "def", "_try_connect", "(", "self", ",", "connection_string", ")", ":", "if", "self", ".", "_parse_conn_string", "(", "connection_string", ")", ":", "self", ".", "_trigger_callback", "(", "'on_disconnect'", ",", "self", ".", "id", ",", "self", ".", "_connectio...
If the connecton string settings are different, try and connect to an attached device
[ "If", "the", "connecton", "string", "settings", "are", "different", "try", "and", "connect", "to", "an", "attached", "device" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/jlink/iotile_transport_jlink/jlink.py#L133-L167
train
iotile/coretools
transport_plugins/jlink/iotile_transport_jlink/jlink.py
JLinkAdapter.stop_sync
def stop_sync(self): """Synchronously stop this adapter and release all resources.""" if self._control_thread is not None and self._control_thread.is_alive(): self._control_thread.stop() self._control_thread.join() if self.jlink is not None: self.jlink.close...
python
def stop_sync(self): """Synchronously stop this adapter and release all resources.""" if self._control_thread is not None and self._control_thread.is_alive(): self._control_thread.stop() self._control_thread.join() if self.jlink is not None: self.jlink.close...
[ "def", "stop_sync", "(", "self", ")", ":", "if", "self", ".", "_control_thread", "is", "not", "None", "and", "self", ".", "_control_thread", ".", "is_alive", "(", ")", ":", "self", ".", "_control_thread", ".", "stop", "(", ")", "self", ".", "_control_thr...
Synchronously stop this adapter and release all resources.
[ "Synchronously", "stop", "this", "adapter", "and", "release", "all", "resources", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/jlink/iotile_transport_jlink/jlink.py#L169-L177
train