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
iotilegateway/iotilegateway/supervisor/states.py
ServiceState.get_message
def get_message(self, message_id): """Get a message by its persistent id. Args: message_id (int): The id of the message that we're looking for """ for message in self.messages: if message.id == message_id: return message raise ArgumentEr...
python
def get_message(self, message_id): """Get a message by its persistent id. Args: message_id (int): The id of the message that we're looking for """ for message in self.messages: if message.id == message_id: return message raise ArgumentEr...
[ "def", "get_message", "(", "self", ",", "message_id", ")", ":", "for", "message", "in", "self", ".", "messages", ":", "if", "message", ".", "id", "==", "message_id", ":", "return", "message", "raise", "ArgumentError", "(", "\"Message ID not found\"", ",", "m...
Get a message by its persistent id. Args: message_id (int): The id of the message that we're looking for
[ "Get", "a", "message", "by", "its", "persistent", "id", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilegateway/iotilegateway/supervisor/states.py#L164-L175
train
iotile/coretools
iotilegateway/iotilegateway/supervisor/states.py
ServiceState.post_message
def post_message(self, level, message, count=1, timestamp=None, now_reference=None): """Post a new message for service. Args: level (int): The level of the message (info, warning, error) message (string): The message contents count (int): The number of times the mess...
python
def post_message(self, level, message, count=1, timestamp=None, now_reference=None): """Post a new message for service. Args: level (int): The level of the message (info, warning, error) message (string): The message contents count (int): The number of times the mess...
[ "def", "post_message", "(", "self", ",", "level", ",", "message", ",", "count", "=", "1", ",", "timestamp", "=", "None", ",", "now_reference", "=", "None", ")", ":", "if", "len", "(", "self", ".", "messages", ")", ">", "0", "and", "self", ".", "mes...
Post a new message for service. Args: level (int): The level of the message (info, warning, error) message (string): The message contents count (int): The number of times the message has been repeated timestamp (float): An optional monotonic value in seconds for ...
[ "Post", "a", "new", "message", "for", "service", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilegateway/iotilegateway/supervisor/states.py#L177-L200
train
iotile/coretools
iotilegateway/iotilegateway/supervisor/states.py
ServiceState.set_headline
def set_headline(self, level, message, timestamp=None, now_reference=None): """Set the persistent headline message for this service. Args: level (int): The level of the message (info, warning, error) message (string): The message contents timestamp (float): An option...
python
def set_headline(self, level, message, timestamp=None, now_reference=None): """Set the persistent headline message for this service. Args: level (int): The level of the message (info, warning, error) message (string): The message contents timestamp (float): An option...
[ "def", "set_headline", "(", "self", ",", "level", ",", "message", ",", "timestamp", "=", "None", ",", "now_reference", "=", "None", ")", ":", "if", "self", ".", "headline", "is", "not", "None", "and", "self", ".", "headline", ".", "message", "==", "mes...
Set the persistent headline message for this service. Args: level (int): The level of the message (info, warning, error) message (string): The message contents timestamp (float): An optional monotonic value in seconds for when the message was created now_referenc...
[ "Set", "the", "persistent", "headline", "message", "for", "this", "service", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilegateway/iotilegateway/supervisor/states.py#L202-L220
train
iotile/coretools
iotilebuild/iotile/build/config/site_scons/docbuild.py
generate_doxygen_file
def generate_doxygen_file(output_path, iotile): """Fill in our default doxygen template file with info from an IOTile This populates things like name, version, etc. Arguments: output_path (str): a string path for where the filled template should go iotile (IOTile): An IOTile object that c...
python
def generate_doxygen_file(output_path, iotile): """Fill in our default doxygen template file with info from an IOTile This populates things like name, version, etc. Arguments: output_path (str): a string path for where the filled template should go iotile (IOTile): An IOTile object that c...
[ "def", "generate_doxygen_file", "(", "output_path", ",", "iotile", ")", ":", "mapping", "=", "{", "}", "mapping", "[", "'short_name'", "]", "=", "iotile", ".", "short_name", "mapping", "[", "'full_name'", "]", "=", "iotile", ".", "full_name", "mapping", "[",...
Fill in our default doxygen template file with info from an IOTile This populates things like name, version, etc. Arguments: output_path (str): a string path for where the filled template should go iotile (IOTile): An IOTile object that can be queried for information
[ "Fill", "in", "our", "default", "doxygen", "template", "file", "with", "info", "from", "an", "IOTile" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/site_scons/docbuild.py#L4-L21
train
iotile/coretools
iotilebuild/iotile/build/dev/pull_release.py
pull
def pull(name, version, force=False): """Pull a released IOTile component into the current working directory The component is found using whatever DependencyResolvers are installed and registered as part of the default DependencyResolverChain. This is the same mechanism used in iotile depends update, ...
python
def pull(name, version, force=False): """Pull a released IOTile component into the current working directory The component is found using whatever DependencyResolvers are installed and registered as part of the default DependencyResolverChain. This is the same mechanism used in iotile depends update, ...
[ "def", "pull", "(", "name", ",", "version", ",", "force", "=", "False", ")", ":", "chain", "=", "DependencyResolverChain", "(", ")", "ver", "=", "SemanticVersionRange", ".", "FromString", "(", "version", ")", "chain", ".", "pull_release", "(", "name", ",",...
Pull a released IOTile component into the current working directory The component is found using whatever DependencyResolvers are installed and registered as part of the default DependencyResolverChain. This is the same mechanism used in iotile depends update, so any component that can be updated using io...
[ "Pull", "a", "released", "IOTile", "component", "into", "the", "current", "working", "directory" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/dev/pull_release.py#L9-L21
train
iotile/coretools
iotilecore/iotile/core/hw/transport/adapter/sync_wrapper.py
SynchronousLegacyWrapper.add_callback
def add_callback(self, name, func): """Add a callback when device events happen. Args: name (str): currently support 'on_scan' and 'on_disconnect' func (callable): the function that should be called """ if name == 'on_scan': events = ['device_seen'] ...
python
def add_callback(self, name, func): """Add a callback when device events happen. Args: name (str): currently support 'on_scan' and 'on_disconnect' func (callable): the function that should be called """ if name == 'on_scan': events = ['device_seen'] ...
[ "def", "add_callback", "(", "self", ",", "name", ",", "func", ")", ":", "if", "name", "==", "'on_scan'", ":", "events", "=", "[", "'device_seen'", "]", "def", "callback", "(", "_conn_string", ",", "_conn_id", ",", "_name", ",", "event", ")", ":", "func...
Add a callback when device events happen. Args: name (str): currently support 'on_scan' and 'on_disconnect' func (callable): the function that should be called
[ "Add", "a", "callback", "when", "device", "events", "happen", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/adapter/sync_wrapper.py#L71-L98
train
iotile/coretools
iotilecore/iotile/core/hw/transport/adapter/sync_wrapper.py
SynchronousLegacyWrapper.disconnect_async
def disconnect_async(self, conn_id, callback): """Asynchronously disconnect from a device.""" future = self._loop.launch_coroutine(self._adapter.disconnect(conn_id)) future.add_done_callback(lambda x: self._callback_future(conn_id, x, callback))
python
def disconnect_async(self, conn_id, callback): """Asynchronously disconnect from a device.""" future = self._loop.launch_coroutine(self._adapter.disconnect(conn_id)) future.add_done_callback(lambda x: self._callback_future(conn_id, x, callback))
[ "def", "disconnect_async", "(", "self", ",", "conn_id", ",", "callback", ")", ":", "future", "=", "self", ".", "_loop", ".", "launch_coroutine", "(", "self", ".", "_adapter", ".", "disconnect", "(", "conn_id", ")", ")", "future", ".", "add_done_callback", ...
Asynchronously disconnect from a device.
[ "Asynchronously", "disconnect", "from", "a", "device", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/adapter/sync_wrapper.py#L120-L124
train
iotile/coretools
iotilecore/iotile/core/hw/transport/adapter/sync_wrapper.py
SynchronousLegacyWrapper.send_script_async
def send_script_async(self, conn_id, data, progress_callback, callback): """Asynchronously send a script to the device.""" def monitor_callback(_conn_string, _conn_id, _event_name, event): if event.get('operation') != 'script': return progress_callback(event.get...
python
def send_script_async(self, conn_id, data, progress_callback, callback): """Asynchronously send a script to the device.""" def monitor_callback(_conn_string, _conn_id, _event_name, event): if event.get('operation') != 'script': return progress_callback(event.get...
[ "def", "send_script_async", "(", "self", ",", "conn_id", ",", "data", ",", "progress_callback", ",", "callback", ")", ":", "def", "monitor_callback", "(", "_conn_string", ",", "_conn_id", ",", "_event_name", ",", "event", ")", ":", "if", "event", ".", "get",...
Asynchronously send a script to the device.
[ "Asynchronously", "send", "a", "script", "to", "the", "device", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/adapter/sync_wrapper.py#L218-L241
train
iotile/coretools
transport_plugins/awsiot/iotile_transport_awsiot/topic_validator.py
MQTTTopicValidator.lock
def lock(self, key, client): """Set the key that will be used to ensure messages come from one party Args: key (string): The key used to validate future messages client (string): A string that will be returned to indicate who locked this device. """ ...
python
def lock(self, key, client): """Set the key that will be used to ensure messages come from one party Args: key (string): The key used to validate future messages client (string): A string that will be returned to indicate who locked this device. """ ...
[ "def", "lock", "(", "self", ",", "key", ",", "client", ")", ":", "self", ".", "key", "=", "key", "self", ".", "client", "=", "client" ]
Set the key that will be used to ensure messages come from one party Args: key (string): The key used to validate future messages client (string): A string that will be returned to indicate who locked this device.
[ "Set", "the", "key", "that", "will", "be", "used", "to", "ensure", "messages", "come", "from", "one", "party" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/awsiot/iotile_transport_awsiot/topic_validator.py#L27-L37
train
iotile/coretools
iotileemulate/iotile/emulate/virtual/state_log.py
EmulationStateLog.track_change
def track_change(self, tile, property_name, value, formatter=None): """Record that a change happened on a given tile's property. This will as a StateChange object to our list of changes if we are recording changes, otherwise, it will drop the change. Args: tile (int): The a...
python
def track_change(self, tile, property_name, value, formatter=None): """Record that a change happened on a given tile's property. This will as a StateChange object to our list of changes if we are recording changes, otherwise, it will drop the change. Args: tile (int): The a...
[ "def", "track_change", "(", "self", ",", "tile", ",", "property_name", ",", "value", ",", "formatter", "=", "None", ")", ":", "if", "not", "self", ".", "tracking", ":", "return", "if", "len", "(", "self", ".", "_whitelist", ")", ">", "0", "and", "(",...
Record that a change happened on a given tile's property. This will as a StateChange object to our list of changes if we are recording changes, otherwise, it will drop the change. Args: tile (int): The address of the tile that the change happened on. property_name (str)...
[ "Record", "that", "a", "change", "happened", "on", "a", "given", "tile", "s", "property", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/virtual/state_log.py#L21-L50
train
iotile/coretools
iotileemulate/iotile/emulate/virtual/state_log.py
EmulationStateLog.dump
def dump(self, out_path, header=True): """Save this list of changes as a csv file at out_path. The format of the output file will be a CSV with 4 columns: timestamp, tile address, property, string_value There will be a single header row starting the CSV output unless header=Fal...
python
def dump(self, out_path, header=True): """Save this list of changes as a csv file at out_path. The format of the output file will be a CSV with 4 columns: timestamp, tile address, property, string_value There will be a single header row starting the CSV output unless header=Fal...
[ "def", "dump", "(", "self", ",", "out_path", ",", "header", "=", "True", ")", ":", "if", "sys", ".", "version_info", "[", "0", "]", "<", "3", ":", "mode", "=", "\"wb\"", "else", ":", "mode", "=", "\"w\"", "with", "open", "(", "out_path", ",", "mo...
Save this list of changes as a csv file at out_path. The format of the output file will be a CSV with 4 columns: timestamp, tile address, property, string_value There will be a single header row starting the CSV output unless header=False is passed. Args: out_path ...
[ "Save", "this", "list", "of", "changes", "as", "a", "csv", "file", "at", "out_path", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/virtual/state_log.py#L80-L108
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/pdftex.py
generate
def generate(env): """Add Builders and construction variables for pdftex to an Environment.""" global PDFTeXAction if PDFTeXAction is None: PDFTeXAction = SCons.Action.Action('$PDFTEXCOM', '$PDFTEXCOMSTR') global PDFLaTeXAction if PDFLaTeXAction is None: PDFLaTeXAction = SCons.Actio...
python
def generate(env): """Add Builders and construction variables for pdftex to an Environment.""" global PDFTeXAction if PDFTeXAction is None: PDFTeXAction = SCons.Action.Action('$PDFTEXCOM', '$PDFTEXCOMSTR') global PDFLaTeXAction if PDFLaTeXAction is None: PDFLaTeXAction = SCons.Actio...
[ "def", "generate", "(", "env", ")", ":", "global", "PDFTeXAction", "if", "PDFTeXAction", "is", "None", ":", "PDFTeXAction", "=", "SCons", ".", "Action", ".", "Action", "(", "'$PDFTEXCOM'", ",", "'$PDFTEXCOMSTR'", ")", "global", "PDFLaTeXAction", "if", "PDFLaTe...
Add Builders and construction variables for pdftex to an Environment.
[ "Add", "Builders", "and", "construction", "variables", "for", "pdftex", "to", "an", "Environment", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/pdftex.py#L71-L99
train
iotile/coretools
iotilecore/iotile/core/hw/virtual/tile_based_device.py
TileBasedVirtualDevice.stop
def stop(self): """Stop running this virtual device including any worker threads.""" for tile in self._tiles.values(): tile.signal_stop() for tile in self._tiles.values(): tile.wait_stopped() super(TileBasedVirtualDevice, self).stop()
python
def stop(self): """Stop running this virtual device including any worker threads.""" for tile in self._tiles.values(): tile.signal_stop() for tile in self._tiles.values(): tile.wait_stopped() super(TileBasedVirtualDevice, self).stop()
[ "def", "stop", "(", "self", ")", ":", "for", "tile", "in", "self", ".", "_tiles", ".", "values", "(", ")", ":", "tile", ".", "signal_stop", "(", ")", "for", "tile", "in", "self", ".", "_tiles", ".", "values", "(", ")", ":", "tile", ".", "wait_sto...
Stop running this virtual device including any worker threads.
[ "Stop", "running", "this", "virtual", "device", "including", "any", "worker", "threads", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/virtual/tile_based_device.py#L53-L62
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/SConf.py
SetCacheMode
def SetCacheMode(mode): """Set the Configure cache mode. mode must be one of "auto", "force", or "cache".""" global cache_mode if mode == "auto": cache_mode = AUTO elif mode == "force": cache_mode = FORCE elif mode == "cache": cache_mode = CACHE else: raise Va...
python
def SetCacheMode(mode): """Set the Configure cache mode. mode must be one of "auto", "force", or "cache".""" global cache_mode if mode == "auto": cache_mode = AUTO elif mode == "force": cache_mode = FORCE elif mode == "cache": cache_mode = CACHE else: raise Va...
[ "def", "SetCacheMode", "(", "mode", ")", ":", "global", "cache_mode", "if", "mode", "==", "\"auto\"", ":", "cache_mode", "=", "AUTO", "elif", "mode", "==", "\"force\"", ":", "cache_mode", "=", "FORCE", "elif", "mode", "==", "\"cache\"", ":", "cache_mode", ...
Set the Configure cache mode. mode must be one of "auto", "force", or "cache".
[ "Set", "the", "Configure", "cache", "mode", ".", "mode", "must", "be", "one", "of", "auto", "force", "or", "cache", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/SConf.py#L79-L90
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/SConf.py
CreateConfigHBuilder
def CreateConfigHBuilder(env): """Called if necessary just before the building targets phase begins.""" action = SCons.Action.Action(_createConfigH, _stringConfigH) sconfigHBld = SCons.Builder.Builder(action=action) env.Append( BUILDERS={'SConfigHBuilder':sconfigHBld} ) ...
python
def CreateConfigHBuilder(env): """Called if necessary just before the building targets phase begins.""" action = SCons.Action.Action(_createConfigH, _stringConfigH) sconfigHBld = SCons.Builder.Builder(action=action) env.Append( BUILDERS={'SConfigHBuilder':sconfigHBld} ) ...
[ "def", "CreateConfigHBuilder", "(", "env", ")", ":", "action", "=", "SCons", ".", "Action", ".", "Action", "(", "_createConfigH", ",", "_stringConfigH", ")", "sconfigHBld", "=", "SCons", ".", "Builder", ".", "Builder", "(", "action", "=", "action", ")", "e...
Called if necessary just before the building targets phase begins.
[ "Called", "if", "necessary", "just", "before", "the", "building", "targets", "phase", "begins", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/SConf.py#L128-L135
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/SConf.py
CheckHeader
def CheckHeader(context, header, include_quotes = '<>', language = None): """ A test for a C or C++ header file. """ prog_prefix, hdr_to_check = \ createIncludesFromHeaders(header, 1, include_quotes) res = SCons.Conftest.CheckHeader(context, hdr_to_check, prog_prefix, ...
python
def CheckHeader(context, header, include_quotes = '<>', language = None): """ A test for a C or C++ header file. """ prog_prefix, hdr_to_check = \ createIncludesFromHeaders(header, 1, include_quotes) res = SCons.Conftest.CheckHeader(context, hdr_to_check, prog_prefix, ...
[ "def", "CheckHeader", "(", "context", ",", "header", ",", "include_quotes", "=", "'<>'", ",", "language", "=", "None", ")", ":", "prog_prefix", ",", "hdr_to_check", "=", "createIncludesFromHeaders", "(", "header", ",", "1", ",", "include_quotes", ")", "res", ...
A test for a C or C++ header file.
[ "A", "test", "for", "a", "C", "or", "C", "++", "header", "file", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/SConf.py#L944-L954
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/SConf.py
CheckLib
def CheckLib(context, library = None, symbol = "main", header = None, language = None, autoadd = 1): """ A test for a library. See also CheckLibWithHeader. Note that library may also be None to test whether the given symbol compiles without flags. """ if library == []: libr...
python
def CheckLib(context, library = None, symbol = "main", header = None, language = None, autoadd = 1): """ A test for a library. See also CheckLibWithHeader. Note that library may also be None to test whether the given symbol compiles without flags. """ if library == []: libr...
[ "def", "CheckLib", "(", "context", ",", "library", "=", "None", ",", "symbol", "=", "\"main\"", ",", "header", "=", "None", ",", "language", "=", "None", ",", "autoadd", "=", "1", ")", ":", "if", "library", "==", "[", "]", ":", "library", "=", "[",...
A test for a library. See also CheckLibWithHeader. Note that library may also be None to test whether the given symbol compiles without flags.
[ "A", "test", "for", "a", "library", ".", "See", "also", "CheckLibWithHeader", ".", "Note", "that", "library", "may", "also", "be", "None", "to", "test", "whether", "the", "given", "symbol", "compiles", "without", "flags", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/SConf.py#L994-L1012
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/SConf.py
CheckProg
def CheckProg(context, prog_name): """Simple check if a program exists in the path. Returns the path for the application, or None if not found. """ res = SCons.Conftest.CheckProg(context, prog_name) context.did_show_result = 1 return res
python
def CheckProg(context, prog_name): """Simple check if a program exists in the path. Returns the path for the application, or None if not found. """ res = SCons.Conftest.CheckProg(context, prog_name) context.did_show_result = 1 return res
[ "def", "CheckProg", "(", "context", ",", "prog_name", ")", ":", "res", "=", "SCons", ".", "Conftest", ".", "CheckProg", "(", "context", ",", "prog_name", ")", "context", ".", "did_show_result", "=", "1", "return", "res" ]
Simple check if a program exists in the path. Returns the path for the application, or None if not found.
[ "Simple", "check", "if", "a", "program", "exists", "in", "the", "path", ".", "Returns", "the", "path", "for", "the", "application", "or", "None", "if", "not", "found", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/SConf.py#L1040-L1046
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/SConf.py
SConfBuildTask.display_cached_string
def display_cached_string(self, bi): """ Logs the original builder messages, given the SConfBuildInfo instance bi. """ if not isinstance(bi, SConfBuildInfo): SCons.Warnings.warn(SConfWarning, "The stored build information has an unexpected class: %s" % b...
python
def display_cached_string(self, bi): """ Logs the original builder messages, given the SConfBuildInfo instance bi. """ if not isinstance(bi, SConfBuildInfo): SCons.Warnings.warn(SConfWarning, "The stored build information has an unexpected class: %s" % b...
[ "def", "display_cached_string", "(", "self", ",", "bi", ")", ":", "if", "not", "isinstance", "(", "bi", ",", "SConfBuildInfo", ")", ":", "SCons", ".", "Warnings", ".", "warn", "(", "SConfWarning", ",", "\"The stored build information has an unexpected class: %s\"", ...
Logs the original builder messages, given the SConfBuildInfo instance bi.
[ "Logs", "the", "original", "builder", "messages", "given", "the", "SConfBuildInfo", "instance", "bi", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/SConf.py#L231-L241
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/SConf.py
SConfBase.Define
def Define(self, name, value = None, comment = None): """ Define a pre processor symbol name, with the optional given value in the current config header. If value is None (default), then #define name is written. If value is not none, then #define name value is written. ...
python
def Define(self, name, value = None, comment = None): """ Define a pre processor symbol name, with the optional given value in the current config header. If value is None (default), then #define name is written. If value is not none, then #define name value is written. ...
[ "def", "Define", "(", "self", ",", "name", ",", "value", "=", "None", ",", "comment", "=", "None", ")", ":", "lines", "=", "[", "]", "if", "comment", ":", "comment_str", "=", "\"/* %s */\"", "%", "comment", "lines", ".", "append", "(", "comment_str", ...
Define a pre processor symbol name, with the optional given value in the current config header. If value is None (default), then #define name is written. If value is not none, then #define name value is written. comment is a string which will be put as a C comment in the header, to exp...
[ "Define", "a", "pre", "processor", "symbol", "name", "with", "the", "optional", "given", "value", "in", "the", "current", "config", "header", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/SConf.py#L453-L476
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/SConf.py
SConfBase.BuildNodes
def BuildNodes(self, nodes): """ Tries to build the given nodes immediately. Returns 1 on success, 0 on error. """ if self.logstream is not None: # override stdout / stderr to write in log file oldStdout = sys.stdout sys.stdout = self.logstream...
python
def BuildNodes(self, nodes): """ Tries to build the given nodes immediately. Returns 1 on success, 0 on error. """ if self.logstream is not None: # override stdout / stderr to write in log file oldStdout = sys.stdout sys.stdout = self.logstream...
[ "def", "BuildNodes", "(", "self", ",", "nodes", ")", ":", "if", "self", ".", "logstream", "is", "not", "None", ":", "oldStdout", "=", "sys", ".", "stdout", "sys", ".", "stdout", "=", "self", ".", "logstream", "oldStderr", "=", "sys", ".", "stderr", "...
Tries to build the given nodes immediately. Returns 1 on success, 0 on error.
[ "Tries", "to", "build", "the", "given", "nodes", "immediately", ".", "Returns", "1", "on", "success", "0", "on", "error", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/SConf.py#L478-L529
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/SConf.py
SConfBase.pspawn_wrapper
def pspawn_wrapper(self, sh, escape, cmd, args, env): """Wrapper function for handling piped spawns. This looks to the calling interface (in Action.py) like a "normal" spawn, but associates the call with the PSPAWN variable from the construction environment and with the streams to which...
python
def pspawn_wrapper(self, sh, escape, cmd, args, env): """Wrapper function for handling piped spawns. This looks to the calling interface (in Action.py) like a "normal" spawn, but associates the call with the PSPAWN variable from the construction environment and with the streams to which...
[ "def", "pspawn_wrapper", "(", "self", ",", "sh", ",", "escape", ",", "cmd", ",", "args", ",", "env", ")", ":", "return", "self", ".", "pspawn", "(", "sh", ",", "escape", ",", "cmd", ",", "args", ",", "env", ",", "self", ".", "logstream", ",", "se...
Wrapper function for handling piped spawns. This looks to the calling interface (in Action.py) like a "normal" spawn, but associates the call with the PSPAWN variable from the construction environment and with the streams to which we want the output logged. This gets slid into the cons...
[ "Wrapper", "function", "for", "handling", "piped", "spawns", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/SConf.py#L531-L541
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/SConf.py
SConfBase._startup
def _startup(self): """Private method. Set up logstream, and set the environment variables necessary for a piped build """ global _ac_config_logs global sconf_global global SConfFS self.lastEnvFs = self.env.fs self.env.fs = SConfFS self._createDir...
python
def _startup(self): """Private method. Set up logstream, and set the environment variables necessary for a piped build """ global _ac_config_logs global sconf_global global SConfFS self.lastEnvFs = self.env.fs self.env.fs = SConfFS self._createDir...
[ "def", "_startup", "(", "self", ")", ":", "global", "_ac_config_logs", "global", "sconf_global", "global", "SConfFS", "self", ".", "lastEnvFs", "=", "self", ".", "env", ".", "fs", "self", ".", "env", ".", "fs", "=", "SConfFS", "self", ".", "_createDir", ...
Private method. Set up logstream, and set the environment variables necessary for a piped build
[ "Private", "method", ".", "Set", "up", "logstream", "and", "set", "the", "environment", "variables", "necessary", "for", "a", "piped", "build" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/SConf.py#L685-L729
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/SConf.py
SConfBase._shutdown
def _shutdown(self): """Private method. Reset to non-piped spawn""" global sconf_global, _ac_config_hs if not self.active: raise SCons.Errors.UserError("Finish may be called only once!") if self.logstream is not None and not dryrun: self.logstream.write("\n") ...
python
def _shutdown(self): """Private method. Reset to non-piped spawn""" global sconf_global, _ac_config_hs if not self.active: raise SCons.Errors.UserError("Finish may be called only once!") if self.logstream is not None and not dryrun: self.logstream.write("\n") ...
[ "def", "_shutdown", "(", "self", ")", ":", "global", "sconf_global", ",", "_ac_config_hs", "if", "not", "self", ".", "active", ":", "raise", "SCons", ".", "Errors", ".", "UserError", "(", "\"Finish may be called only once!\"", ")", "if", "self", ".", "logstrea...
Private method. Reset to non-piped spawn
[ "Private", "method", ".", "Reset", "to", "non", "-", "piped", "spawn" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/SConf.py#L731-L749
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/SConf.py
CheckContext.Result
def Result(self, res): """Inform about the result of the test. If res is not a string, displays 'yes' or 'no' depending on whether res is evaluated as true or false. The result is only displayed when self.did_show_result is not set. """ if isinstance(res, str): text =...
python
def Result(self, res): """Inform about the result of the test. If res is not a string, displays 'yes' or 'no' depending on whether res is evaluated as true or false. The result is only displayed when self.did_show_result is not set. """ if isinstance(res, str): text =...
[ "def", "Result", "(", "self", ",", "res", ")", ":", "if", "isinstance", "(", "res", ",", "str", ")", ":", "text", "=", "res", "elif", "res", ":", "text", "=", "\"yes\"", "else", ":", "text", "=", "\"no\"", "if", "self", ".", "did_show_result", "=="...
Inform about the result of the test. If res is not a string, displays 'yes' or 'no' depending on whether res is evaluated as true or false. The result is only displayed when self.did_show_result is not set.
[ "Inform", "about", "the", "result", "of", "the", "test", ".", "If", "res", "is", "not", "a", "string", "displays", "yes", "or", "no", "depending", "on", "whether", "res", "is", "evaluated", "as", "true", "or", "false", ".", "The", "result", "is", "only...
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/SConf.py#L795-L810
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/intelc.py
linux_ver_normalize
def linux_ver_normalize(vstr): """Normalize a Linux compiler version number. Intel changed from "80" to "9.0" in 2005, so we assume if the number is greater than 60 it's an old-style number and otherwise new-style. Always returns an old-style float like 80 or 90 for compatibility with Windows. Shade...
python
def linux_ver_normalize(vstr): """Normalize a Linux compiler version number. Intel changed from "80" to "9.0" in 2005, so we assume if the number is greater than 60 it's an old-style number and otherwise new-style. Always returns an old-style float like 80 or 90 for compatibility with Windows. Shade...
[ "def", "linux_ver_normalize", "(", "vstr", ")", ":", "m", "=", "re", ".", "match", "(", "r'([0-9]+)\\.([0-9]+)\\.([0-9]+)'", ",", "vstr", ")", "if", "m", ":", "vmaj", ",", "vmin", ",", "build", "=", "m", ".", "groups", "(", ")", "return", "float", "(",...
Normalize a Linux compiler version number. Intel changed from "80" to "9.0" in 2005, so we assume if the number is greater than 60 it's an old-style number and otherwise new-style. Always returns an old-style float like 80 or 90 for compatibility with Windows. Shades of Y2K!
[ "Normalize", "a", "Linux", "compiler", "version", "number", ".", "Intel", "changed", "from", "80", "to", "9", ".", "0", "in", "2005", "so", "we", "assume", "if", "the", "number", "is", "greater", "than", "60", "it", "s", "an", "old", "-", "style", "n...
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/intelc.py#L64-L82
train
iotile/coretools
iotilesensorgraph/iotile/sg/node_descriptor.py
parse_node_descriptor
def parse_node_descriptor(desc, model): """Parse a string node descriptor. The function creates an SGNode object without connecting its inputs and outputs and returns a 3-tuple: SGNode, [(input X, trigger X)], <processing function name> Args: desc (str): A description of the node to be cr...
python
def parse_node_descriptor(desc, model): """Parse a string node descriptor. The function creates an SGNode object without connecting its inputs and outputs and returns a 3-tuple: SGNode, [(input X, trigger X)], <processing function name> Args: desc (str): A description of the node to be cr...
[ "def", "parse_node_descriptor", "(", "desc", ",", "model", ")", ":", "try", ":", "data", "=", "graph_node", ".", "parseString", "(", "desc", ")", "except", "ParseException", ":", "raise", "stream_desc", "=", "u' '", ".", "join", "(", "data", "[", "'node'",...
Parse a string node descriptor. The function creates an SGNode object without connecting its inputs and outputs and returns a 3-tuple: SGNode, [(input X, trigger X)], <processing function name> Args: desc (str): A description of the node to be created. model (str): A device model for ...
[ "Parse", "a", "string", "node", "descriptor", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/node_descriptor.py#L32-L84
train
iotile/coretools
iotilesensorgraph/iotile/sg/node_descriptor.py
create_binary_descriptor
def create_binary_descriptor(descriptor): """Convert a string node descriptor into a 20-byte binary descriptor. This is the inverse operation of parse_binary_descriptor and composing the two operations is a noop. Args: descriptor (str): A string node descriptor Returns: bytes: A 2...
python
def create_binary_descriptor(descriptor): """Convert a string node descriptor into a 20-byte binary descriptor. This is the inverse operation of parse_binary_descriptor and composing the two operations is a noop. Args: descriptor (str): A string node descriptor Returns: bytes: A 2...
[ "def", "create_binary_descriptor", "(", "descriptor", ")", ":", "func_names", "=", "{", "0", ":", "'copy_latest_a'", ",", "1", ":", "'average_a'", ",", "2", ":", "'copy_all_a'", ",", "3", ":", "'sum_a'", ",", "4", ":", "'copy_count_a'", ",", "5", ":", "'...
Convert a string node descriptor into a 20-byte binary descriptor. This is the inverse operation of parse_binary_descriptor and composing the two operations is a noop. Args: descriptor (str): A string node descriptor Returns: bytes: A 20-byte binary node descriptor.
[ "Convert", "a", "string", "node", "descriptor", "into", "a", "20", "-", "byte", "binary", "descriptor", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/node_descriptor.py#L87-L142
train
iotile/coretools
iotilesensorgraph/iotile/sg/node_descriptor.py
parse_binary_descriptor
def parse_binary_descriptor(bindata): """Convert a binary node descriptor into a string descriptor. Binary node descriptor are 20-byte binary structures that encode all information needed to create a graph node. They are used to communicate that information to an embedded device in an efficent format....
python
def parse_binary_descriptor(bindata): """Convert a binary node descriptor into a string descriptor. Binary node descriptor are 20-byte binary structures that encode all information needed to create a graph node. They are used to communicate that information to an embedded device in an efficent format....
[ "def", "parse_binary_descriptor", "(", "bindata", ")", ":", "func_names", "=", "{", "0", ":", "'copy_latest_a'", ",", "1", ":", "'average_a'", ",", "2", ":", "'copy_all_a'", ",", "3", ":", "'sum_a'", ",", "4", ":", "'copy_count_a'", ",", "5", ":", "'trig...
Convert a binary node descriptor into a string descriptor. Binary node descriptor are 20-byte binary structures that encode all information needed to create a graph node. They are used to communicate that information to an embedded device in an efficent format. This function exists to turn such a com...
[ "Convert", "a", "binary", "node", "descriptor", "into", "a", "string", "descriptor", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/node_descriptor.py#L145-L204
train
iotile/coretools
iotilesensorgraph/iotile/sg/node_descriptor.py
_process_binary_trigger
def _process_binary_trigger(trigger_value, condition): """Create an InputTrigger object.""" ops = { 0: ">", 1: "<", 2: ">=", 3: "<=", 4: "==", 5: 'always' } sources = { 0: 'value', 1: 'count' } encoded_source = condition & 0b1 ...
python
def _process_binary_trigger(trigger_value, condition): """Create an InputTrigger object.""" ops = { 0: ">", 1: "<", 2: ">=", 3: "<=", 4: "==", 5: 'always' } sources = { 0: 'value', 1: 'count' } encoded_source = condition & 0b1 ...
[ "def", "_process_binary_trigger", "(", "trigger_value", ",", "condition", ")", ":", "ops", "=", "{", "0", ":", "\">\"", ",", "1", ":", "\"<\"", ",", "2", ":", "\">=\"", ",", "3", ":", "\"<=\"", ",", "4", ":", "\"==\"", ",", "5", ":", "'always'", "}...
Create an InputTrigger object.
[ "Create", "an", "InputTrigger", "object", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/node_descriptor.py#L207-L238
train
iotile/coretools
iotilesensorgraph/iotile/sg/node_descriptor.py
_create_binary_trigger
def _create_binary_trigger(trigger): """Create an 8-bit binary trigger from an InputTrigger, TrueTrigger, FalseTrigger.""" ops = { 0: ">", 1: "<", 2: ">=", 3: "<=", 4: "==", 5: 'always' } op_codes = {y: x for x, y in ops.items()} source = 0 if i...
python
def _create_binary_trigger(trigger): """Create an 8-bit binary trigger from an InputTrigger, TrueTrigger, FalseTrigger.""" ops = { 0: ">", 1: "<", 2: ">=", 3: "<=", 4: "==", 5: 'always' } op_codes = {y: x for x, y in ops.items()} source = 0 if i...
[ "def", "_create_binary_trigger", "(", "trigger", ")", ":", "ops", "=", "{", "0", ":", "\">\"", ",", "1", ":", "\"<\"", ",", "2", ":", "\">=\"", ",", "3", ":", "\"<=\"", ",", "4", ":", "\"==\"", ",", "5", ":", "'always'", "}", "op_codes", "=", "{"...
Create an 8-bit binary trigger from an InputTrigger, TrueTrigger, FalseTrigger.
[ "Create", "an", "8", "-", "bit", "binary", "trigger", "from", "an", "InputTrigger", "TrueTrigger", "FalseTrigger", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/node_descriptor.py#L241-L266
train
iotile/coretools
iotilecore/iotile/core/hw/reports/report.py
IOTileReading._try_assign_utc_time
def _try_assign_utc_time(self, raw_time, time_base): """Try to assign a UTC time to this reading.""" # Check if the raw time is encoded UTC since y2k or just uptime if raw_time != IOTileEvent.InvalidRawTime and (raw_time & (1 << 31)): y2k_offset = self.raw_time ^ (1 << 31) ...
python
def _try_assign_utc_time(self, raw_time, time_base): """Try to assign a UTC time to this reading.""" # Check if the raw time is encoded UTC since y2k or just uptime if raw_time != IOTileEvent.InvalidRawTime and (raw_time & (1 << 31)): y2k_offset = self.raw_time ^ (1 << 31) ...
[ "def", "_try_assign_utc_time", "(", "self", ",", "raw_time", ",", "time_base", ")", ":", "if", "raw_time", "!=", "IOTileEvent", ".", "InvalidRawTime", "and", "(", "raw_time", "&", "(", "1", "<<", "31", ")", ")", ":", "y2k_offset", "=", "self", ".", "raw_...
Try to assign a UTC time to this reading.
[ "Try", "to", "assign", "a", "UTC", "time", "to", "this", "reading", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/reports/report.py#L52-L63
train
iotile/coretools
iotilecore/iotile/core/hw/reports/report.py
IOTileReading.asdict
def asdict(self): """Encode the data in this reading into a dictionary. Returns: dict: A dictionary containing the information from this reading. """ timestamp_str = None if self.reading_time is not None: timestamp_str = self.reading_time.isoformat() ...
python
def asdict(self): """Encode the data in this reading into a dictionary. Returns: dict: A dictionary containing the information from this reading. """ timestamp_str = None if self.reading_time is not None: timestamp_str = self.reading_time.isoformat() ...
[ "def", "asdict", "(", "self", ")", ":", "timestamp_str", "=", "None", "if", "self", ".", "reading_time", "is", "not", "None", ":", "timestamp_str", "=", "self", ".", "reading_time", ".", "isoformat", "(", ")", "return", "{", "'stream'", ":", "self", ".",...
Encode the data in this reading into a dictionary. Returns: dict: A dictionary containing the information from this reading.
[ "Encode", "the", "data", "in", "this", "reading", "into", "a", "dictionary", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/reports/report.py#L65-L82
train
iotile/coretools
iotilecore/iotile/core/hw/reports/report.py
IOTileEvent.asdict
def asdict(self): """Encode the data in this event into a dictionary. The dictionary returned from this method is a reference to the data stored in the IOTileEvent, not a copy. It should be treated as read only. Returns: dict: A dictionary containing the informatio...
python
def asdict(self): """Encode the data in this event into a dictionary. The dictionary returned from this method is a reference to the data stored in the IOTileEvent, not a copy. It should be treated as read only. Returns: dict: A dictionary containing the informatio...
[ "def", "asdict", "(", "self", ")", ":", "return", "{", "'stream'", ":", "self", ".", "stream", ",", "'device_timestamp'", ":", "self", ".", "raw_time", ",", "'streamer_local_id'", ":", "self", ".", "reading_id", ",", "'timestamp'", ":", "self", ".", "readi...
Encode the data in this event into a dictionary. The dictionary returned from this method is a reference to the data stored in the IOTileEvent, not a copy. It should be treated as read only. Returns: dict: A dictionary containing the information from this event.
[ "Encode", "the", "data", "in", "this", "event", "into", "a", "dictionary", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/reports/report.py#L163-L181
train
iotile/coretools
iotilecore/iotile/core/hw/reports/report.py
IOTileReport.save
def save(self, path): """Save a binary copy of this report Args: path (string): The path where we should save the binary copy of the report """ data = self.encode() with open(path, "wb") as out: out.write(data)
python
def save(self, path): """Save a binary copy of this report Args: path (string): The path where we should save the binary copy of the report """ data = self.encode() with open(path, "wb") as out: out.write(data)
[ "def", "save", "(", "self", ",", "path", ")", ":", "data", "=", "self", ".", "encode", "(", ")", "with", "open", "(", "path", ",", "\"wb\"", ")", "as", "out", ":", "out", ".", "write", "(", "data", ")" ]
Save a binary copy of this report Args: path (string): The path where we should save the binary copy of the report
[ "Save", "a", "binary", "copy", "of", "this", "report" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/reports/report.py#L294-L304
train
iotile/coretools
iotilecore/iotile/core/hw/reports/report.py
IOTileReport.serialize
def serialize(self): """Turn this report into a dictionary that encodes all information including received timestamp""" info = {} info['received_time'] = self.received_time info['encoded_report'] = bytes(self.encode()) # Handle python 2 / python 3 differences report_for...
python
def serialize(self): """Turn this report into a dictionary that encodes all information including received timestamp""" info = {} info['received_time'] = self.received_time info['encoded_report'] = bytes(self.encode()) # Handle python 2 / python 3 differences report_for...
[ "def", "serialize", "(", "self", ")", ":", "info", "=", "{", "}", "info", "[", "'received_time'", "]", "=", "self", ".", "received_time", "info", "[", "'encoded_report'", "]", "=", "bytes", "(", "self", ".", "encode", "(", ")", ")", "report_format", "=...
Turn this report into a dictionary that encodes all information including received timestamp
[ "Turn", "this", "report", "into", "a", "dictionary", "that", "encodes", "all", "information", "including", "received", "timestamp" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/reports/report.py#L306-L320
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/Alias.py
Alias.get_contents
def get_contents(self): """The contents of an alias is the concatenation of the content signatures of all its sources.""" childsigs = [n.get_csig() for n in self.children()] return ''.join(childsigs)
python
def get_contents(self): """The contents of an alias is the concatenation of the content signatures of all its sources.""" childsigs = [n.get_csig() for n in self.children()] return ''.join(childsigs)
[ "def", "get_contents", "(", "self", ")", ":", "childsigs", "=", "[", "n", ".", "get_csig", "(", ")", "for", "n", "in", "self", ".", "children", "(", ")", "]", "return", "''", ".", "join", "(", "childsigs", ")" ]
The contents of an alias is the concatenation of the content signatures of all its sources.
[ "The", "contents", "of", "an", "alias", "is", "the", "concatenation", "of", "the", "content", "signatures", "of", "all", "its", "sources", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/Alias.py#L130-L134
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/cxx.py
generate
def generate(env): """ Add Builders and construction variables for Visual Age C++ compilers to an Environment. """ import SCons.Tool import SCons.Tool.cc static_obj, shared_obj = SCons.Tool.createObjBuilders(env) for suffix in CXXSuffixes: static_obj.add_action(suffix, SCons.Def...
python
def generate(env): """ Add Builders and construction variables for Visual Age C++ compilers to an Environment. """ import SCons.Tool import SCons.Tool.cc static_obj, shared_obj = SCons.Tool.createObjBuilders(env) for suffix in CXXSuffixes: static_obj.add_action(suffix, SCons.Def...
[ "def", "generate", "(", "env", ")", ":", "import", "SCons", ".", "Tool", "import", "SCons", ".", "Tool", ".", "cc", "static_obj", ",", "shared_obj", "=", "SCons", ".", "Tool", ".", "createObjBuilders", "(", "env", ")", "for", "suffix", "in", "CXXSuffixes...
Add Builders and construction variables for Visual Age C++ compilers to an Environment.
[ "Add", "Builders", "and", "construction", "variables", "for", "Visual", "Age", "C", "++", "compilers", "to", "an", "Environment", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/cxx.py#L58-L91
train
iotile/coretools
iotilesensorgraph/iotile/sg/streamer.py
DataStreamer.link_to_storage
def link_to_storage(self, sensor_log): """Attach this DataStreamer to an underlying SensorLog. Calling this method is required if you want to use this DataStreamer to generate reports from the underlying data in the SensorLog. You can call it multiple times and it will unlink itself fr...
python
def link_to_storage(self, sensor_log): """Attach this DataStreamer to an underlying SensorLog. Calling this method is required if you want to use this DataStreamer to generate reports from the underlying data in the SensorLog. You can call it multiple times and it will unlink itself fr...
[ "def", "link_to_storage", "(", "self", ",", "sensor_log", ")", ":", "if", "self", ".", "walker", "is", "not", "None", ":", "self", ".", "_sensor_log", ".", "destroy_walker", "(", "self", ".", "walker", ")", "self", ".", "walker", "=", "None", "self", "...
Attach this DataStreamer to an underlying SensorLog. Calling this method is required if you want to use this DataStreamer to generate reports from the underlying data in the SensorLog. You can call it multiple times and it will unlink itself from any previous SensorLog each time. ...
[ "Attach", "this", "DataStreamer", "to", "an", "underlying", "SensorLog", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/streamer.py#L63-L82
train
iotile/coretools
iotilesensorgraph/iotile/sg/streamer.py
DataStreamer.triggered
def triggered(self, manual=False): """Check if this streamer should generate a report. Streamers can be triggered automatically whenever they have data or they can be triggered manually. This method returns True if the streamer is currented triggered. A streamer is triggered if...
python
def triggered(self, manual=False): """Check if this streamer should generate a report. Streamers can be triggered automatically whenever they have data or they can be triggered manually. This method returns True if the streamer is currented triggered. A streamer is triggered if...
[ "def", "triggered", "(", "self", ",", "manual", "=", "False", ")", ":", "if", "self", ".", "walker", "is", "None", ":", "raise", "InternalError", "(", "\"You can only check if a streamer is triggered if you create it with a SensorLog\"", ")", "if", "not", "self", "....
Check if this streamer should generate a report. Streamers can be triggered automatically whenever they have data or they can be triggered manually. This method returns True if the streamer is currented triggered. A streamer is triggered if it: - (has data AND is automatic) O...
[ "Check", "if", "this", "streamer", "should", "generate", "a", "report", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/streamer.py#L96-L120
train
iotile/coretools
iotilesensorgraph/iotile/sg/streamer.py
DataStreamer.build_report
def build_report(self, device_id, max_size=None, device_uptime=0, report_id=None, auth_chain=None): """Build a report with all of the readings in this streamer. This method will produce an IOTileReport subclass and, if necessary, sign it using the passed authentication chain. Args: ...
python
def build_report(self, device_id, max_size=None, device_uptime=0, report_id=None, auth_chain=None): """Build a report with all of the readings in this streamer. This method will produce an IOTileReport subclass and, if necessary, sign it using the passed authentication chain. Args: ...
[ "def", "build_report", "(", "self", ",", "device_id", ",", "max_size", "=", "None", ",", "device_uptime", "=", "0", ",", "report_id", "=", "None", ",", "auth_chain", "=", "None", ")", ":", "if", "self", ".", "walker", "is", "None", "or", "self", ".", ...
Build a report with all of the readings in this streamer. This method will produce an IOTileReport subclass and, if necessary, sign it using the passed authentication chain. Args: device_id (int): The UUID of the device to generate a report for. max_size (int): Optional...
[ "Build", "a", "report", "with", "all", "of", "the", "readings", "in", "this", "streamer", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/streamer.py#L140-L209
train
iotile/coretools
iotilesensorgraph/iotile/sg/slot.py
SlotIdentifier.matches
def matches(self, address, name=None): """Check if this slot identifier matches the given tile. Matching can happen either by address or by module name (not currently implemented). Returns: bool: True if there is a match, otherwise False. """ if self.controller: ...
python
def matches(self, address, name=None): """Check if this slot identifier matches the given tile. Matching can happen either by address or by module name (not currently implemented). Returns: bool: True if there is a match, otherwise False. """ if self.controller: ...
[ "def", "matches", "(", "self", ",", "address", ",", "name", "=", "None", ")", ":", "if", "self", ".", "controller", ":", "return", "address", "==", "8", "return", "self", ".", "address", "==", "address" ]
Check if this slot identifier matches the given tile. Matching can happen either by address or by module name (not currently implemented). Returns: bool: True if there is a match, otherwise False.
[ "Check", "if", "this", "slot", "identifier", "matches", "the", "given", "tile", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/slot.py#L64-L76
train
iotile/coretools
iotilesensorgraph/iotile/sg/slot.py
SlotIdentifier.FromString
def FromString(cls, desc): """Create a slot identifier from a string description. The string needs to be either: controller OR slot <X> where X is an integer that can be converted with int(X, 0) Args: desc (str): The string description of the slot ...
python
def FromString(cls, desc): """Create a slot identifier from a string description. The string needs to be either: controller OR slot <X> where X is an integer that can be converted with int(X, 0) Args: desc (str): The string description of the slot ...
[ "def", "FromString", "(", "cls", ",", "desc", ")", ":", "desc", "=", "str", "(", "desc", ")", "if", "desc", "==", "u'controller'", ":", "return", "SlotIdentifier", "(", "controller", "=", "True", ")", "words", "=", "desc", ".", "split", "(", ")", "if...
Create a slot identifier from a string description. The string needs to be either: controller OR slot <X> where X is an integer that can be converted with int(X, 0) Args: desc (str): The string description of the slot Returns: SlotIdentifier
[ "Create", "a", "slot", "identifier", "from", "a", "string", "description", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/slot.py#L79-L109
train
iotile/coretools
iotilesensorgraph/iotile/sg/slot.py
SlotIdentifier.FromEncoded
def FromEncoded(cls, bindata): """Create a slot identifier from an encoded binary descriptor. These binary descriptors are used to communicate slot targeting to an embedded device. They are exactly 8 bytes in length. Args: bindata (bytes): The 8-byte binary descriptor. ...
python
def FromEncoded(cls, bindata): """Create a slot identifier from an encoded binary descriptor. These binary descriptors are used to communicate slot targeting to an embedded device. They are exactly 8 bytes in length. Args: bindata (bytes): The 8-byte binary descriptor. ...
[ "def", "FromEncoded", "(", "cls", ",", "bindata", ")", ":", "if", "len", "(", "bindata", ")", "!=", "8", ":", "raise", "ArgumentError", "(", "\"Invalid binary slot descriptor with invalid length\"", ",", "length", "=", "len", "(", "bindata", ")", ",", "expecte...
Create a slot identifier from an encoded binary descriptor. These binary descriptors are used to communicate slot targeting to an embedded device. They are exactly 8 bytes in length. Args: bindata (bytes): The 8-byte binary descriptor. Returns: SlotIdentifier
[ "Create", "a", "slot", "identifier", "from", "an", "encoded", "binary", "descriptor", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/slot.py#L112-L140
train
iotile/coretools
iotilesensorgraph/iotile/sg/slot.py
SlotIdentifier.encode
def encode(self): """Encode this slot identifier into a binary descriptor. Returns: bytes: The 8-byte encoded slot identifier """ slot = 0 match_op = self.KNOWN_MATCH_NAMES['match_controller'] if not self.controller: slot = self.slot ...
python
def encode(self): """Encode this slot identifier into a binary descriptor. Returns: bytes: The 8-byte encoded slot identifier """ slot = 0 match_op = self.KNOWN_MATCH_NAMES['match_controller'] if not self.controller: slot = self.slot ...
[ "def", "encode", "(", "self", ")", ":", "slot", "=", "0", "match_op", "=", "self", ".", "KNOWN_MATCH_NAMES", "[", "'match_controller'", "]", "if", "not", "self", ".", "controller", ":", "slot", "=", "self", ".", "slot", "match_op", "=", "self", ".", "K...
Encode this slot identifier into a binary descriptor. Returns: bytes: The 8-byte encoded slot identifier
[ "Encode", "this", "slot", "identifier", "into", "a", "binary", "descriptor", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/slot.py#L142-L156
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Script/Main.py
_scons_syntax_error
def _scons_syntax_error(e): """Handle syntax errors. Print out a message and show where the error occurred. """ etype, value, tb = sys.exc_info() lines = traceback.format_exception_only(etype, value) for line in lines: sys.stderr.write(line+'\n') sys.exit(2)
python
def _scons_syntax_error(e): """Handle syntax errors. Print out a message and show where the error occurred. """ etype, value, tb = sys.exc_info() lines = traceback.format_exception_only(etype, value) for line in lines: sys.stderr.write(line+'\n') sys.exit(2)
[ "def", "_scons_syntax_error", "(", "e", ")", ":", "etype", ",", "value", ",", "tb", "=", "sys", ".", "exc_info", "(", ")", "lines", "=", "traceback", ".", "format_exception_only", "(", "etype", ",", "value", ")", "for", "line", "in", "lines", ":", "sys...
Handle syntax errors. Print out a message and show where the error occurred.
[ "Handle", "syntax", "errors", ".", "Print", "out", "a", "message", "and", "show", "where", "the", "error", "occurred", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Script/Main.py#L548-L556
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Script/Main.py
find_deepest_user_frame
def find_deepest_user_frame(tb): """ Find the deepest stack frame that is not part of SCons. Input is a "pre-processed" stack trace in the form returned by traceback.extract_tb() or traceback.extract_stack() """ tb.reverse() # find the deepest traceback frame that is not part # of SCo...
python
def find_deepest_user_frame(tb): """ Find the deepest stack frame that is not part of SCons. Input is a "pre-processed" stack trace in the form returned by traceback.extract_tb() or traceback.extract_stack() """ tb.reverse() # find the deepest traceback frame that is not part # of SCo...
[ "def", "find_deepest_user_frame", "(", "tb", ")", ":", "tb", ".", "reverse", "(", ")", "for", "frame", "in", "tb", ":", "filename", "=", "frame", "[", "0", "]", "if", "filename", ".", "find", "(", "os", ".", "sep", "+", "'SCons'", "+", "os", ".", ...
Find the deepest stack frame that is not part of SCons. Input is a "pre-processed" stack trace in the form returned by traceback.extract_tb() or traceback.extract_stack()
[ "Find", "the", "deepest", "stack", "frame", "that", "is", "not", "part", "of", "SCons", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Script/Main.py#L558-L574
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Script/Main.py
_scons_user_error
def _scons_user_error(e): """Handle user errors. Print out a message and a description of the error, along with the line number and routine where it occured. The file and line number will be the deepest stack frame that is not part of SCons itself. """ global print_stacktrace etype, value, t...
python
def _scons_user_error(e): """Handle user errors. Print out a message and a description of the error, along with the line number and routine where it occured. The file and line number will be the deepest stack frame that is not part of SCons itself. """ global print_stacktrace etype, value, t...
[ "def", "_scons_user_error", "(", "e", ")", ":", "global", "print_stacktrace", "etype", ",", "value", ",", "tb", "=", "sys", ".", "exc_info", "(", ")", "if", "print_stacktrace", ":", "traceback", ".", "print_exception", "(", "etype", ",", "value", ",", "tb"...
Handle user errors. Print out a message and a description of the error, along with the line number and routine where it occured. The file and line number will be the deepest stack frame that is not part of SCons itself.
[ "Handle", "user", "errors", ".", "Print", "out", "a", "message", "and", "a", "description", "of", "the", "error", "along", "with", "the", "line", "number", "and", "routine", "where", "it", "occured", ".", "The", "file", "and", "line", "number", "will", "...
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Script/Main.py#L576-L589
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Script/Main.py
_scons_user_warning
def _scons_user_warning(e): """Handle user warnings. Print out a message and a description of the warning, along with the line number and routine where it occured. The file and line number will be the deepest stack frame that is not part of SCons itself. """ etype, value, tb = sys.exc_info() ...
python
def _scons_user_warning(e): """Handle user warnings. Print out a message and a description of the warning, along with the line number and routine where it occured. The file and line number will be the deepest stack frame that is not part of SCons itself. """ etype, value, tb = sys.exc_info() ...
[ "def", "_scons_user_warning", "(", "e", ")", ":", "etype", ",", "value", ",", "tb", "=", "sys", ".", "exc_info", "(", ")", "filename", ",", "lineno", ",", "routine", ",", "dummy", "=", "find_deepest_user_frame", "(", "traceback", ".", "extract_tb", "(", ...
Handle user warnings. Print out a message and a description of the warning, along with the line number and routine where it occured. The file and line number will be the deepest stack frame that is not part of SCons itself.
[ "Handle", "user", "warnings", ".", "Print", "out", "a", "message", "and", "a", "description", "of", "the", "warning", "along", "with", "the", "line", "number", "and", "routine", "where", "it", "occured", ".", "The", "file", "and", "line", "number", "will",...
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Script/Main.py#L591-L600
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Script/Main.py
_SConstruct_exists
def _SConstruct_exists(dirname='', repositories=[], filelist=None): """This function checks that an SConstruct file exists in a directory. If so, it returns the path of the file. By default, it checks the current directory. """ if not filelist: filelist = ['SConstruct', 'Sconstruct', 'sconst...
python
def _SConstruct_exists(dirname='', repositories=[], filelist=None): """This function checks that an SConstruct file exists in a directory. If so, it returns the path of the file. By default, it checks the current directory. """ if not filelist: filelist = ['SConstruct', 'Sconstruct', 'sconst...
[ "def", "_SConstruct_exists", "(", "dirname", "=", "''", ",", "repositories", "=", "[", "]", ",", "filelist", "=", "None", ")", ":", "if", "not", "filelist", ":", "filelist", "=", "[", "'SConstruct'", ",", "'Sconstruct'", ",", "'sconstruct'", "]", "for", ...
This function checks that an SConstruct file exists in a directory. If so, it returns the path of the file. By default, it checks the current directory.
[ "This", "function", "checks", "that", "an", "SConstruct", "file", "exists", "in", "a", "directory", ".", "If", "so", "it", "returns", "the", "path", "of", "the", "file", ".", "By", "default", "it", "checks", "the", "current", "directory", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Script/Main.py#L618-L633
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Script/Main.py
BuildTask.make_ready
def make_ready(self): """Make a task ready for execution""" SCons.Taskmaster.OutOfDateTask.make_ready(self) if self.out_of_date and self.options.debug_explain: explanation = self.out_of_date[0].explain() if explanation: sys.stdout.write("scons: " + explana...
python
def make_ready(self): """Make a task ready for execution""" SCons.Taskmaster.OutOfDateTask.make_ready(self) if self.out_of_date and self.options.debug_explain: explanation = self.out_of_date[0].explain() if explanation: sys.stdout.write("scons: " + explana...
[ "def", "make_ready", "(", "self", ")", ":", "SCons", ".", "Taskmaster", ".", "OutOfDateTask", ".", "make_ready", "(", "self", ")", "if", "self", ".", "out_of_date", "and", "self", ".", "options", ".", "debug_explain", ":", "explanation", "=", "self", ".", ...
Make a task ready for execution
[ "Make", "a", "task", "ready", "for", "execution" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Script/Main.py#L306-L312
train
iotile/coretools
iotileemulate/iotile/emulate/reference/reference_controller.py
_unpack_version
def _unpack_version(tag_data): """Parse a packed version info struct into tag and major.minor version. The tag and version are parsed out according to 20 bits for tag and 6 bits each for major and minor. The more interesting part is the blacklisting performed for tags that are known to be untrustworth...
python
def _unpack_version(tag_data): """Parse a packed version info struct into tag and major.minor version. The tag and version are parsed out according to 20 bits for tag and 6 bits each for major and minor. The more interesting part is the blacklisting performed for tags that are known to be untrustworth...
[ "def", "_unpack_version", "(", "tag_data", ")", ":", "tag", "=", "tag_data", "&", "(", "(", "1", "<<", "20", ")", "-", "1", ")", "version_data", "=", "tag_data", ">>", "20", "major", "=", "(", "version_data", ">>", "6", ")", "&", "(", "(", "1", "...
Parse a packed version info struct into tag and major.minor version. The tag and version are parsed out according to 20 bits for tag and 6 bits each for major and minor. The more interesting part is the blacklisting performed for tags that are known to be untrustworthy. In particular, the following a...
[ "Parse", "a", "packed", "version", "info", "struct", "into", "tag", "and", "major", ".", "minor", "version", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/reference_controller.py#L322-L348
train
iotile/coretools
iotileemulate/iotile/emulate/reference/reference_controller.py
ReferenceController._handle_reset
def _handle_reset(self): """Reset this controller tile. This process will call _handle_reset() for all of the controller subsystem mixins in order to make sure they all return to their proper reset state. It will then reset all of the peripheral tiles to emulate the behavior ...
python
def _handle_reset(self): """Reset this controller tile. This process will call _handle_reset() for all of the controller subsystem mixins in order to make sure they all return to their proper reset state. It will then reset all of the peripheral tiles to emulate the behavior ...
[ "def", "_handle_reset", "(", "self", ")", ":", "self", ".", "_logger", ".", "info", "(", "\"Resetting controller\"", ")", "self", ".", "_device", ".", "reset_count", "+=", "1", "super", "(", "ReferenceController", ",", "self", ")", ".", "_handle_reset", "(",...
Reset this controller tile. This process will call _handle_reset() for all of the controller subsystem mixins in order to make sure they all return to their proper reset state. It will then reset all of the peripheral tiles to emulate the behavior of a physical POD where the co...
[ "Reset", "this", "controller", "tile", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/reference_controller.py#L78-L109
train
iotile/coretools
iotileemulate/iotile/emulate/reference/reference_controller.py
ReferenceController._reset_vector
async def _reset_vector(self): """Initialize the controller's subsystems inside the emulation thread.""" # Send ourselves all of our config variable assignments config_rpcs = self.config_database.stream_matching(8, self.name) for rpc in config_rpcs: await self._device.emulat...
python
async def _reset_vector(self): """Initialize the controller's subsystems inside the emulation thread.""" # Send ourselves all of our config variable assignments config_rpcs = self.config_database.stream_matching(8, self.name) for rpc in config_rpcs: await self._device.emulat...
[ "async", "def", "_reset_vector", "(", "self", ")", ":", "config_rpcs", "=", "self", ".", "config_database", ".", "stream_matching", "(", "8", ",", "self", ".", "name", ")", "for", "rpc", "in", "config_rpcs", ":", "await", "self", ".", "_device", ".", "em...
Initialize the controller's subsystems inside the emulation thread.
[ "Initialize", "the", "controller", "s", "subsystems", "inside", "the", "emulation", "thread", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/reference_controller.py#L111-L144
train
iotile/coretools
iotileemulate/iotile/emulate/reference/reference_controller.py
ReferenceController.hardware_version
def hardware_version(self): """Get a hardware identification string.""" hardware_string = self.hardware_string if not isinstance(hardware_string, bytes): hardware_string = self.hardware_string.encode('utf-8') if len(hardware_string) > 10: self._logger.warn("Tru...
python
def hardware_version(self): """Get a hardware identification string.""" hardware_string = self.hardware_string if not isinstance(hardware_string, bytes): hardware_string = self.hardware_string.encode('utf-8') if len(hardware_string) > 10: self._logger.warn("Tru...
[ "def", "hardware_version", "(", "self", ")", ":", "hardware_string", "=", "self", ".", "hardware_string", "if", "not", "isinstance", "(", "hardware_string", ",", "bytes", ")", ":", "hardware_string", "=", "self", ".", "hardware_string", ".", "encode", "(", "'u...
Get a hardware identification string.
[ "Get", "a", "hardware", "identification", "string", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/reference_controller.py#L199-L213
train
iotile/coretools
iotileemulate/iotile/emulate/reference/reference_controller.py
ReferenceController.controller_info
def controller_info(self): """Get the controller UUID, app tag and os tag.""" return [self._device.iotile_id, _pack_version(*self.os_info), _pack_version(*self.app_info)]
python
def controller_info(self): """Get the controller UUID, app tag and os tag.""" return [self._device.iotile_id, _pack_version(*self.os_info), _pack_version(*self.app_info)]
[ "def", "controller_info", "(", "self", ")", ":", "return", "[", "self", ".", "_device", ".", "iotile_id", ",", "_pack_version", "(", "*", "self", ".", "os_info", ")", ",", "_pack_version", "(", "*", "self", ".", "app_info", ")", "]" ]
Get the controller UUID, app tag and os tag.
[ "Get", "the", "controller", "UUID", "app", "tag", "and", "os", "tag", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/reference_controller.py#L216-L219
train
iotile/coretools
iotileemulate/iotile/emulate/reference/reference_controller.py
ReferenceController.load_sgf
def load_sgf(self, sgf_data): """Load, persist a sensor_graph file. The data passed in `sgf_data` can either be a path or the already loaded sgf lines as a string. It is determined to be sgf lines if there is a '\n' character in the data, otherwise it is interpreted as a path. ...
python
def load_sgf(self, sgf_data): """Load, persist a sensor_graph file. The data passed in `sgf_data` can either be a path or the already loaded sgf lines as a string. It is determined to be sgf lines if there is a '\n' character in the data, otherwise it is interpreted as a path. ...
[ "def", "load_sgf", "(", "self", ",", "sgf_data", ")", ":", "if", "'\\n'", "not", "in", "sgf_data", ":", "with", "open", "(", "sgf_data", ",", "\"r\"", ")", "as", "infile", ":", "sgf_data", "=", "infile", ".", "read", "(", ")", "model", "=", "DeviceMo...
Load, persist a sensor_graph file. The data passed in `sgf_data` can either be a path or the already loaded sgf lines as a string. It is determined to be sgf lines if there is a '\n' character in the data, otherwise it is interpreted as a path. Note that this scenario just loa...
[ "Load", "persist", "a", "sensor_graph", "file", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/reference_controller.py#L237-L297
train
iotile/coretools
iotilebuild/iotile/build/config/site_scons/cfileparser.py
ParsedCFile._parse_file
def _parse_file(self): """Preprocess and parse C file into an AST""" # We need to set the CPU type to pull in the right register definitions # only preprocess the file (-E) and get rid of gcc extensions that aren't # supported in ISO C. args = utilities.build_includes(self.arch....
python
def _parse_file(self): """Preprocess and parse C file into an AST""" # We need to set the CPU type to pull in the right register definitions # only preprocess the file (-E) and get rid of gcc extensions that aren't # supported in ISO C. args = utilities.build_includes(self.arch....
[ "def", "_parse_file", "(", "self", ")", ":", "args", "=", "utilities", ".", "build_includes", "(", "self", ".", "arch", ".", "includes", "(", ")", ")", "args", ".", "append", "(", "'-E'", ")", "args", ".", "append", "(", "'-D__attribute__(x)='", ")", "...
Preprocess and parse C file into an AST
[ "Preprocess", "and", "parse", "C", "file", "into", "an", "AST" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/site_scons/cfileparser.py#L35-L47
train
iotile/coretools
iotilecore/iotile/core/hw/transport/adapterstream.py
_clear_queue
def _clear_queue(to_clear): """Clear all items from a queue safely.""" while not to_clear.empty(): try: to_clear.get(False) to_clear.task_done() except queue.Empty: continue
python
def _clear_queue(to_clear): """Clear all items from a queue safely.""" while not to_clear.empty(): try: to_clear.get(False) to_clear.task_done() except queue.Empty: continue
[ "def", "_clear_queue", "(", "to_clear", ")", ":", "while", "not", "to_clear", ".", "empty", "(", ")", ":", "try", ":", "to_clear", ".", "get", "(", "False", ")", "to_clear", ".", "task_done", "(", ")", "except", "queue", ".", "Empty", ":", "continue" ]
Clear all items from a queue safely.
[ "Clear", "all", "items", "from", "a", "queue", "safely", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/adapterstream.py#L562-L570
train
iotile/coretools
iotilecore/iotile/core/hw/transport/adapterstream.py
_RecordedRPC.finish
def finish(self, status, response): """Mark the end of a recorded RPC.""" self.response = binascii.hexlify(response).decode('utf-8') self.status = status self.runtime = monotonic() - self._start_time
python
def finish(self, status, response): """Mark the end of a recorded RPC.""" self.response = binascii.hexlify(response).decode('utf-8') self.status = status self.runtime = monotonic() - self._start_time
[ "def", "finish", "(", "self", ",", "status", ",", "response", ")", ":", "self", ".", "response", "=", "binascii", ".", "hexlify", "(", "response", ")", ".", "decode", "(", "'utf-8'", ")", "self", ".", "status", "=", "status", "self", ".", "runtime", ...
Mark the end of a recorded RPC.
[ "Mark", "the", "end", "of", "a", "recorded", "RPC", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/adapterstream.py#L43-L48
train
iotile/coretools
iotilecore/iotile/core/hw/transport/adapterstream.py
_RecordedRPC.serialize
def serialize(self): """Convert this recorded RPC into a string.""" return "{},{: <26},{:2d},{:#06x},{:#04x},{:5.0f},{: <40},{: <40},{}".\ format(self.connection, self.start_stamp.isoformat(), self.address, self.rpc_id, self.status, self.runtime * 1000, self.call, self.re...
python
def serialize(self): """Convert this recorded RPC into a string.""" return "{},{: <26},{:2d},{:#06x},{:#04x},{:5.0f},{: <40},{: <40},{}".\ format(self.connection, self.start_stamp.isoformat(), self.address, self.rpc_id, self.status, self.runtime * 1000, self.call, self.re...
[ "def", "serialize", "(", "self", ")", ":", "return", "\"{},{: <26},{:2d},{:#06x},{:#04x},{:5.0f},{: <40},{: <40},{}\"", ".", "format", "(", "self", ".", "connection", ",", "self", ".", "start_stamp", ".", "isoformat", "(", ")", ",", "self", ".", "address", ",", ...
Convert this recorded RPC into a string.
[ "Convert", "this", "recorded", "RPC", "into", "a", "string", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/adapterstream.py#L50-L55
train
iotile/coretools
iotilecore/iotile/core/hw/transport/adapterstream.py
AdapterStream.scan
def scan(self, wait=None): """Return the devices that have been found for this device adapter. If the adapter indicates that we need to explicitly tell it to probe for devices, probe now. By default we return the list of seen devices immediately, however there are two cases where we wil...
python
def scan(self, wait=None): """Return the devices that have been found for this device adapter. If the adapter indicates that we need to explicitly tell it to probe for devices, probe now. By default we return the list of seen devices immediately, however there are two cases where we wil...
[ "def", "scan", "(", "self", ",", "wait", "=", "None", ")", ":", "min_scan", "=", "self", ".", "adapter", ".", "get_config", "(", "'minimum_scan_time'", ",", "0.0", ")", "probe_required", "=", "self", ".", "adapter", ".", "get_config", "(", "'probe_required...
Return the devices that have been found for this device adapter. If the adapter indicates that we need to explicitly tell it to probe for devices, probe now. By default we return the list of seen devices immediately, however there are two cases where we will sleep here for a fixed period of tim...
[ "Return", "the", "devices", "that", "have", "been", "found", "for", "this", "device", "adapter", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/adapterstream.py#L113-L160
train
iotile/coretools
iotilecore/iotile/core/hw/transport/adapterstream.py
AdapterStream.connect
def connect(self, uuid_value, wait=None): """Connect to a specific device by its uuid Attempt to connect to a device that we have previously scanned using its UUID. If wait is not None, then it is used in the same was a scan(wait) to override default wait times with an explicit value. ...
python
def connect(self, uuid_value, wait=None): """Connect to a specific device by its uuid Attempt to connect to a device that we have previously scanned using its UUID. If wait is not None, then it is used in the same was a scan(wait) to override default wait times with an explicit value. ...
[ "def", "connect", "(", "self", ",", "uuid_value", ",", "wait", "=", "None", ")", ":", "if", "self", ".", "connected", ":", "raise", "HardwareError", "(", "\"Cannot connect when we are already connected\"", ")", "if", "uuid_value", "not", "in", "self", ".", "_s...
Connect to a specific device by its uuid Attempt to connect to a device that we have previously scanned using its UUID. If wait is not None, then it is used in the same was a scan(wait) to override default wait times with an explicit value. Args: uuid_value (int): The uniqu...
[ "Connect", "to", "a", "specific", "device", "by", "its", "uuid" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/adapterstream.py#L162-L187
train
iotile/coretools
iotilecore/iotile/core/hw/transport/adapterstream.py
AdapterStream.connect_direct
def connect_direct(self, connection_string, no_rpc=False, force=False): """Directly connect to a device using its stream specific connection string. Normally, all connections to a device include opening the RPC interface to send RPCs. However, there are certain, very specific, circumst...
python
def connect_direct(self, connection_string, no_rpc=False, force=False): """Directly connect to a device using its stream specific connection string. Normally, all connections to a device include opening the RPC interface to send RPCs. However, there are certain, very specific, circumst...
[ "def", "connect_direct", "(", "self", ",", "connection_string", ",", "no_rpc", "=", "False", ",", "force", "=", "False", ")", ":", "if", "not", "force", "and", "self", ".", "connected", ":", "raise", "HardwareError", "(", "\"Cannot connect when we are already co...
Directly connect to a device using its stream specific connection string. Normally, all connections to a device include opening the RPC interface to send RPCs. However, there are certain, very specific, circumstances when you would not want to or be able to open the RPC interface (such...
[ "Directly", "connect", "to", "a", "device", "using", "its", "stream", "specific", "connection", "string", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/adapterstream.py#L189-L230
train
iotile/coretools
iotilecore/iotile/core/hw/transport/adapterstream.py
AdapterStream.disconnect
def disconnect(self): """Disconnect from the device that we are currently connected to.""" if not self.connected: raise HardwareError("Cannot disconnect when we are not connected") # Close the streaming and tracing interfaces when we disconnect self._reports = None ...
python
def disconnect(self): """Disconnect from the device that we are currently connected to.""" if not self.connected: raise HardwareError("Cannot disconnect when we are not connected") # Close the streaming and tracing interfaces when we disconnect self._reports = None ...
[ "def", "disconnect", "(", "self", ")", ":", "if", "not", "self", ".", "connected", ":", "raise", "HardwareError", "(", "\"Cannot disconnect when we are not connected\"", ")", "self", ".", "_reports", "=", "None", "self", ".", "_traces", "=", "None", "self", "....
Disconnect from the device that we are currently connected to.
[ "Disconnect", "from", "the", "device", "that", "we", "are", "currently", "connected", "to", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/adapterstream.py#L232-L245
train
iotile/coretools
iotilecore/iotile/core/hw/transport/adapterstream.py
AdapterStream._try_reconnect
def _try_reconnect(self): """Try to recover an interrupted connection.""" try: if self.connection_interrupted: self.connect_direct(self.connection_string, force=True) self.connection_interrupted = False self.connected = True #...
python
def _try_reconnect(self): """Try to recover an interrupted connection.""" try: if self.connection_interrupted: self.connect_direct(self.connection_string, force=True) self.connection_interrupted = False self.connected = True #...
[ "def", "_try_reconnect", "(", "self", ")", ":", "try", ":", "if", "self", ".", "connection_interrupted", ":", "self", ".", "connect_direct", "(", "self", ".", "connection_string", ",", "force", "=", "True", ")", "self", ".", "connection_interrupted", "=", "F...
Try to recover an interrupted connection.
[ "Try", "to", "recover", "an", "interrupted", "connection", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/adapterstream.py#L247-L265
train
iotile/coretools
iotilecore/iotile/core/hw/transport/adapterstream.py
AdapterStream.send_rpc
def send_rpc(self, address, rpc_id, call_payload, timeout=3.0): """Send an rpc to our connected device. The device must already be connected and the rpc interface open. This method will synchronously send an RPC and wait for the response. Any RPC errors will be raised as exceptions an...
python
def send_rpc(self, address, rpc_id, call_payload, timeout=3.0): """Send an rpc to our connected device. The device must already be connected and the rpc interface open. This method will synchronously send an RPC and wait for the response. Any RPC errors will be raised as exceptions an...
[ "def", "send_rpc", "(", "self", ",", "address", ",", "rpc_id", ",", "call_payload", ",", "timeout", "=", "3.0", ")", ":", "if", "not", "self", ".", "connected", ":", "raise", "HardwareError", "(", "\"Cannot send an RPC if we are not in a connected state\"", ")", ...
Send an rpc to our connected device. The device must already be connected and the rpc interface open. This method will synchronously send an RPC and wait for the response. Any RPC errors will be raised as exceptions and if there were no errors, the RPC's response payload will be retur...
[ "Send", "an", "rpc", "to", "our", "connected", "device", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/adapterstream.py#L267-L320
train
iotile/coretools
iotilecore/iotile/core/hw/transport/adapterstream.py
AdapterStream.send_highspeed
def send_highspeed(self, data, progress_callback): """Send a script to a device at highspeed, reporting progress. This method takes a binary blob and downloads it to the device as fast as possible, calling the passed progress_callback periodically with updates on how far it has gotten. ...
python
def send_highspeed(self, data, progress_callback): """Send a script to a device at highspeed, reporting progress. This method takes a binary blob and downloads it to the device as fast as possible, calling the passed progress_callback periodically with updates on how far it has gotten. ...
[ "def", "send_highspeed", "(", "self", ",", "data", ",", "progress_callback", ")", ":", "if", "not", "self", ".", "connected", ":", "raise", "HardwareError", "(", "\"Cannot send a script if we are not in a connected state\"", ")", "if", "isinstance", "(", "data", ","...
Send a script to a device at highspeed, reporting progress. This method takes a binary blob and downloads it to the device as fast as possible, calling the passed progress_callback periodically with updates on how far it has gotten. Args: data (bytes): The binary blob that ...
[ "Send", "a", "script", "to", "a", "device", "at", "highspeed", "reporting", "progress", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/adapterstream.py#L322-L349
train
iotile/coretools
iotilecore/iotile/core/hw/transport/adapterstream.py
AdapterStream.enable_streaming
def enable_streaming(self): """Open the streaming interface and accumute reports in a queue. This method is safe to call multiple times in a single device connection. There is no way to check if the streaming interface is opened or to close it once it is opened (apart from disconnecting...
python
def enable_streaming(self): """Open the streaming interface and accumute reports in a queue. This method is safe to call multiple times in a single device connection. There is no way to check if the streaming interface is opened or to close it once it is opened (apart from disconnecting...
[ "def", "enable_streaming", "(", "self", ")", ":", "if", "not", "self", ".", "connected", ":", "raise", "HardwareError", "(", "\"Cannot enable streaming if we are not in a connected state\"", ")", "if", "self", ".", "_reports", "is", "not", "None", ":", "_clear_queue...
Open the streaming interface and accumute reports in a queue. This method is safe to call multiple times in a single device connection. There is no way to check if the streaming interface is opened or to close it once it is opened (apart from disconnecting from the device). The...
[ "Open", "the", "streaming", "interface", "and", "accumute", "reports", "in", "a", "queue", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/adapterstream.py#L351-L379
train
iotile/coretools
iotilecore/iotile/core/hw/transport/adapterstream.py
AdapterStream.enable_tracing
def enable_tracing(self): """Open the tracing interface and accumulate traces in a queue. This method is safe to call multiple times in a single device connection. There is no way to check if the tracing interface is opened or to close it once it is opened (apart from disconnecting from...
python
def enable_tracing(self): """Open the tracing interface and accumulate traces in a queue. This method is safe to call multiple times in a single device connection. There is no way to check if the tracing interface is opened or to close it once it is opened (apart from disconnecting from...
[ "def", "enable_tracing", "(", "self", ")", ":", "if", "not", "self", ".", "connected", ":", "raise", "HardwareError", "(", "\"Cannot enable tracing if we are not in a connected state\"", ")", "if", "self", ".", "_traces", "is", "not", "None", ":", "_clear_queue", ...
Open the tracing interface and accumulate traces in a queue. This method is safe to call multiple times in a single device connection. There is no way to check if the tracing interface is opened or to close it once it is opened (apart from disconnecting from the device). The fi...
[ "Open", "the", "tracing", "interface", "and", "accumulate", "traces", "in", "a", "queue", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/adapterstream.py#L381-L411
train
iotile/coretools
iotilecore/iotile/core/hw/transport/adapterstream.py
AdapterStream.enable_broadcasting
def enable_broadcasting(self): """Begin accumulating broadcast reports received from all devices. This method will allocate a queue to receive broadcast reports that will be filled asynchronously as broadcast reports are received. Returns: queue.Queue: A queue that will be ...
python
def enable_broadcasting(self): """Begin accumulating broadcast reports received from all devices. This method will allocate a queue to receive broadcast reports that will be filled asynchronously as broadcast reports are received. Returns: queue.Queue: A queue that will be ...
[ "def", "enable_broadcasting", "(", "self", ")", ":", "if", "self", ".", "_broadcast_reports", "is", "not", "None", ":", "_clear_queue", "(", "self", ".", "_broadcast_reports", ")", "return", "self", ".", "_broadcast_reports", "self", ".", "_broadcast_reports", "...
Begin accumulating broadcast reports received from all devices. This method will allocate a queue to receive broadcast reports that will be filled asynchronously as broadcast reports are received. Returns: queue.Queue: A queue that will be filled with braodcast reports.
[ "Begin", "accumulating", "broadcast", "reports", "received", "from", "all", "devices", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/adapterstream.py#L413-L428
train
iotile/coretools
iotilecore/iotile/core/hw/transport/adapterstream.py
AdapterStream.enable_debug
def enable_debug(self): """Open the debug interface on the connected device.""" if not self.connected: raise HardwareError("Cannot enable debug if we are not in a connected state") self._loop.run_coroutine(self.adapter.open_interface(0, 'debug'))
python
def enable_debug(self): """Open the debug interface on the connected device.""" if not self.connected: raise HardwareError("Cannot enable debug if we are not in a connected state") self._loop.run_coroutine(self.adapter.open_interface(0, 'debug'))
[ "def", "enable_debug", "(", "self", ")", ":", "if", "not", "self", ".", "connected", ":", "raise", "HardwareError", "(", "\"Cannot enable debug if we are not in a connected state\"", ")", "self", ".", "_loop", ".", "run_coroutine", "(", "self", ".", "adapter", "."...
Open the debug interface on the connected device.
[ "Open", "the", "debug", "interface", "on", "the", "connected", "device", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/adapterstream.py#L430-L436
train
iotile/coretools
iotilecore/iotile/core/hw/transport/adapterstream.py
AdapterStream.debug_command
def debug_command(self, cmd, args=None, progress_callback=None): """Send a debug command to the connected device. This generic method will send a named debug command with the given arguments to the connected device. Debug commands are typically used for things like forcible reflashing ...
python
def debug_command(self, cmd, args=None, progress_callback=None): """Send a debug command to the connected device. This generic method will send a named debug command with the given arguments to the connected device. Debug commands are typically used for things like forcible reflashing ...
[ "def", "debug_command", "(", "self", ",", "cmd", ",", "args", "=", "None", ",", "progress_callback", "=", "None", ")", ":", "if", "args", "is", "None", ":", "args", "=", "{", "}", "try", ":", "self", ".", "_on_progress", "=", "progress_callback", "retu...
Send a debug command to the connected device. This generic method will send a named debug command with the given arguments to the connected device. Debug commands are typically used for things like forcible reflashing of firmware or other, debug-style, operations. Not all transport pr...
[ "Send", "a", "debug", "command", "to", "the", "connected", "device", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/adapterstream.py#L438-L465
train
iotile/coretools
iotilecore/iotile/core/hw/transport/adapterstream.py
AdapterStream.close
def close(self): """Close this adapter stream. This method may only be called once in the lifetime of an AdapterStream and it will shutdown the underlying device adapter, disconnect all devices and stop all background activity. If this stream is configured to save a record of a...
python
def close(self): """Close this adapter stream. This method may only be called once in the lifetime of an AdapterStream and it will shutdown the underlying device adapter, disconnect all devices and stop all background activity. If this stream is configured to save a record of a...
[ "def", "close", "(", "self", ")", ":", "try", ":", "self", ".", "_loop", ".", "run_coroutine", "(", "self", ".", "adapter", ".", "stop", "(", ")", ")", "finally", ":", "self", ".", "_save_recording", "(", ")" ]
Close this adapter stream. This method may only be called once in the lifetime of an AdapterStream and it will shutdown the underlying device adapter, disconnect all devices and stop all background activity. If this stream is configured to save a record of all RPCs, the RPCs wi...
[ "Close", "this", "adapter", "stream", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/adapterstream.py#L467-L481
train
iotile/coretools
iotilecore/iotile/core/hw/transport/adapterstream.py
AdapterStream._on_scan
def _on_scan(self, info): """Callback called when a new device is discovered on this CMDStream Args: info (dict): Information about the scanned device """ device_id = info['uuid'] expiration_time = info.get('validity_period', 60) infocopy = deepcopy(info) ...
python
def _on_scan(self, info): """Callback called when a new device is discovered on this CMDStream Args: info (dict): Information about the scanned device """ device_id = info['uuid'] expiration_time = info.get('validity_period', 60) infocopy = deepcopy(info) ...
[ "def", "_on_scan", "(", "self", ",", "info", ")", ":", "device_id", "=", "info", "[", "'uuid'", "]", "expiration_time", "=", "info", ".", "get", "(", "'validity_period'", ",", "60", ")", "infocopy", "=", "deepcopy", "(", "info", ")", "infocopy", "[", "...
Callback called when a new device is discovered on this CMDStream Args: info (dict): Information about the scanned device
[ "Callback", "called", "when", "a", "new", "device", "is", "discovered", "on", "this", "CMDStream" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/adapterstream.py#L518-L532
train
iotile/coretools
iotilecore/iotile/core/hw/transport/adapterstream.py
AdapterStream._on_disconnect
def _on_disconnect(self): """Callback when a device is disconnected unexpectedly. Args: adapter_id (int): An ID for the adapter that was connected to the device connection_id (int): An ID for the connection that has become disconnected """ self._logger.info("Con...
python
def _on_disconnect(self): """Callback when a device is disconnected unexpectedly. Args: adapter_id (int): An ID for the adapter that was connected to the device connection_id (int): An ID for the connection that has become disconnected """ self._logger.info("Con...
[ "def", "_on_disconnect", "(", "self", ")", ":", "self", ".", "_logger", ".", "info", "(", "\"Connection to device %s was interrupted\"", ",", "self", ".", "connection_string", ")", "self", ".", "connection_interrupted", "=", "True" ]
Callback when a device is disconnected unexpectedly. Args: adapter_id (int): An ID for the adapter that was connected to the device connection_id (int): An ID for the connection that has become disconnected
[ "Callback", "when", "a", "device", "is", "disconnected", "unexpectedly", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/transport/adapterstream.py#L534-L543
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/midl.py
midl_emitter
def midl_emitter(target, source, env): """Produces a list of outputs from the MIDL compiler""" base, _ = SCons.Util.splitext(str(target[0])) tlb = target[0] incl = base + '.h' interface = base + '_i.c' targets = [tlb, incl, interface] midlcom = env['MIDLCOM'] if midlcom.find('/proxy') ...
python
def midl_emitter(target, source, env): """Produces a list of outputs from the MIDL compiler""" base, _ = SCons.Util.splitext(str(target[0])) tlb = target[0] incl = base + '.h' interface = base + '_i.c' targets = [tlb, incl, interface] midlcom = env['MIDLCOM'] if midlcom.find('/proxy') ...
[ "def", "midl_emitter", "(", "target", ",", "source", ",", "env", ")", ":", "base", ",", "_", "=", "SCons", ".", "Util", ".", "splitext", "(", "str", "(", "target", "[", "0", "]", ")", ")", "tlb", "=", "target", "[", "0", "]", "incl", "=", "base...
Produces a list of outputs from the MIDL compiler
[ "Produces", "a", "list", "of", "outputs", "from", "the", "MIDL", "compiler" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/midl.py#L44-L61
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/midl.py
generate
def generate(env): """Add Builders and construction variables for midl to an Environment.""" env['MIDL'] = 'MIDL.EXE' env['MIDLFLAGS'] = SCons.Util.CLVar('/nologo') env['MIDLCOM'] = '$MIDL $MIDLFLAGS /tlb ${TARGETS[0]} /h ${TARGETS[1]} /iid ${TARGETS[2]} /proxy ${TARGETS[3]} /dlldata...
python
def generate(env): """Add Builders and construction variables for midl to an Environment.""" env['MIDL'] = 'MIDL.EXE' env['MIDLFLAGS'] = SCons.Util.CLVar('/nologo') env['MIDLCOM'] = '$MIDL $MIDLFLAGS /tlb ${TARGETS[0]} /h ${TARGETS[1]} /iid ${TARGETS[2]} /proxy ${TARGETS[3]} /dlldata...
[ "def", "generate", "(", "env", ")", ":", "env", "[", "'MIDL'", "]", "=", "'MIDL.EXE'", "env", "[", "'MIDLFLAGS'", "]", "=", "SCons", ".", "Util", ".", "CLVar", "(", "'/nologo'", ")", "env", "[", "'MIDLCOM'", "]", "=", "'$MIDL $MIDLFLAGS /tlb ${TARGETS[0]} ...
Add Builders and construction variables for midl to an Environment.
[ "Add", "Builders", "and", "construction", "variables", "for", "midl", "to", "an", "Environment", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/midl.py#L73-L79
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/SConsign.py
Base.set_entry
def set_entry(self, filename, obj): """ Set the entry. """ self.entries[filename] = obj self.dirty = True
python
def set_entry(self, filename, obj): """ Set the entry. """ self.entries[filename] = obj self.dirty = True
[ "def", "set_entry", "(", "self", ",", "filename", ",", "obj", ")", ":", "self", ".", "entries", "[", "filename", "]", "=", "obj", "self", ".", "dirty", "=", "True" ]
Set the entry.
[ "Set", "the", "entry", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/SConsign.py#L187-L192
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/SConsign.py
DirFile.write
def write(self, sync=1): """ Write the .sconsign file to disk. Try to write to a temporary file first, and rename it if we succeed. If we can't write to the temporary file, it's probably because the directory isn't writable (and if so, how did we build anything in this ...
python
def write(self, sync=1): """ Write the .sconsign file to disk. Try to write to a temporary file first, and rename it if we succeed. If we can't write to the temporary file, it's probably because the directory isn't writable (and if so, how did we build anything in this ...
[ "def", "write", "(", "self", ",", "sync", "=", "1", ")", ":", "if", "not", "self", ".", "dirty", ":", "return", "self", ".", "merge", "(", ")", "temp", "=", "os", ".", "path", ".", "join", "(", "self", ".", "dir", ".", "get_internal_path", "(", ...
Write the .sconsign file to disk. Try to write to a temporary file first, and rename it if we succeed. If we can't write to the temporary file, it's probably because the directory isn't writable (and if so, how did we build anything in this directory, anyway?), so try to write ...
[ "Write", "the", ".", "sconsign", "file", "to", "disk", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/SConsign.py#L343-L401
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/sgilink.py
generate
def generate(env): """Add Builders and construction variables for MIPSPro to an Environment.""" link.generate(env) env['LINK'] = env.Detect(linkers) or 'cc' env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -shared') # __RPATH is set to $_RPATH in the platform specification if that # platf...
python
def generate(env): """Add Builders and construction variables for MIPSPro to an Environment.""" link.generate(env) env['LINK'] = env.Detect(linkers) or 'cc' env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -shared') # __RPATH is set to $_RPATH in the platform specification if that # platf...
[ "def", "generate", "(", "env", ")", ":", "link", ".", "generate", "(", "env", ")", "env", "[", "'LINK'", "]", "=", "env", ".", "Detect", "(", "linkers", ")", "or", "'cc'", "env", "[", "'SHLINKFLAGS'", "]", "=", "SCons", ".", "Util", ".", "CLVar", ...
Add Builders and construction variables for MIPSPro to an Environment.
[ "Add", "Builders", "and", "construction", "variables", "for", "MIPSPro", "to", "an", "Environment", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/sgilink.py#L42-L53
train
iotile/coretools
iotilegateway/iotilegateway/supervisor/server.py
IOTileSupervisor.start
async def start(self): """Start the supervisor server.""" await self.server.start() self.port = self.server.port
python
async def start(self): """Start the supervisor server.""" await self.server.start() self.port = self.server.port
[ "async", "def", "start", "(", "self", ")", ":", "await", "self", ".", "server", ".", "start", "(", ")", "self", ".", "port", "=", "self", ".", "server", ".", "port" ]
Start the supervisor server.
[ "Start", "the", "supervisor", "server", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilegateway/iotilegateway/supervisor/server.py#L86-L90
train
iotile/coretools
iotilegateway/iotilegateway/supervisor/server.py
IOTileSupervisor.prepare_conn
async def prepare_conn(self, conn): """Setup a new connection from a client.""" client_id = str(uuid.uuid4()) monitor = functools.partial(self.send_event, client_id) self._logger.info("New client connection: %s", client_id) self.service_manager.add_monitor(monitor) se...
python
async def prepare_conn(self, conn): """Setup a new connection from a client.""" client_id = str(uuid.uuid4()) monitor = functools.partial(self.send_event, client_id) self._logger.info("New client connection: %s", client_id) self.service_manager.add_monitor(monitor) se...
[ "async", "def", "prepare_conn", "(", "self", ",", "conn", ")", ":", "client_id", "=", "str", "(", "uuid", ".", "uuid4", "(", ")", ")", "monitor", "=", "functools", ".", "partial", "(", "self", ".", "send_event", ",", "client_id", ")", "self", ".", "_...
Setup a new connection from a client.
[ "Setup", "a", "new", "connection", "from", "a", "client", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilegateway/iotilegateway/supervisor/server.py#L97-L108
train
iotile/coretools
iotilegateway/iotilegateway/supervisor/server.py
IOTileSupervisor.teardown_conn
async def teardown_conn(self, context): """Teardown a connection from a client.""" client_id = context.user_data self._logger.info("Tearing down client connection: %s", client_id) if client_id not in self.clients: self._logger.warning("client_id %s did not exist in teardown...
python
async def teardown_conn(self, context): """Teardown a connection from a client.""" client_id = context.user_data self._logger.info("Tearing down client connection: %s", client_id) if client_id not in self.clients: self._logger.warning("client_id %s did not exist in teardown...
[ "async", "def", "teardown_conn", "(", "self", ",", "context", ")", ":", "client_id", "=", "context", ".", "user_data", "self", ".", "_logger", ".", "info", "(", "\"Tearing down client connection: %s\"", ",", "client_id", ")", "if", "client_id", "not", "in", "s...
Teardown a connection from a client.
[ "Teardown", "a", "connection", "from", "a", "client", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilegateway/iotilegateway/supervisor/server.py#L110-L119
train
iotile/coretools
iotilegateway/iotilegateway/supervisor/server.py
IOTileSupervisor.send_event
async def send_event(self, client_id, service_name, event_name, event_info, directed_client=None): """Send an event to a client.""" if directed_client is not None and directed_client != client_id: return client_info = self.clients.get(client_id) if client_info is None: ...
python
async def send_event(self, client_id, service_name, event_name, event_info, directed_client=None): """Send an event to a client.""" if directed_client is not None and directed_client != client_id: return client_info = self.clients.get(client_id) if client_info is None: ...
[ "async", "def", "send_event", "(", "self", ",", "client_id", ",", "service_name", ",", "event_name", ",", "event_info", ",", "directed_client", "=", "None", ")", ":", "if", "directed_client", "is", "not", "None", "and", "directed_client", "!=", "client_id", ":...
Send an event to a client.
[ "Send", "an", "event", "to", "a", "client", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilegateway/iotilegateway/supervisor/server.py#L121-L140
train
iotile/coretools
iotilegateway/iotilegateway/supervisor/server.py
IOTileSupervisor.send_rpc
async def send_rpc(self, msg, _context): """Send an RPC to a service on behalf of a client.""" service = msg.get('name') rpc_id = msg.get('rpc_id') payload = msg.get('payload') timeout = msg.get('timeout') response_id = await self.service_manager.send_rpc_command(servic...
python
async def send_rpc(self, msg, _context): """Send an RPC to a service on behalf of a client.""" service = msg.get('name') rpc_id = msg.get('rpc_id') payload = msg.get('payload') timeout = msg.get('timeout') response_id = await self.service_manager.send_rpc_command(servic...
[ "async", "def", "send_rpc", "(", "self", ",", "msg", ",", "_context", ")", ":", "service", "=", "msg", ".", "get", "(", "'name'", ")", "rpc_id", "=", "msg", ".", "get", "(", "'rpc_id'", ")", "payload", "=", "msg", ".", "get", "(", "'payload'", ")",...
Send an RPC to a service on behalf of a client.
[ "Send", "an", "RPC", "to", "a", "service", "on", "behalf", "of", "a", "client", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilegateway/iotilegateway/supervisor/server.py#L142-L160
train
iotile/coretools
iotilegateway/iotilegateway/supervisor/server.py
IOTileSupervisor.respond_rpc
async def respond_rpc(self, msg, _context): """Respond to an RPC previously sent to a service.""" rpc_id = msg.get('response_uuid') result = msg.get('result') payload = msg.get('response') self.service_manager.send_rpc_response(rpc_id, result, payload)
python
async def respond_rpc(self, msg, _context): """Respond to an RPC previously sent to a service.""" rpc_id = msg.get('response_uuid') result = msg.get('result') payload = msg.get('response') self.service_manager.send_rpc_response(rpc_id, result, payload)
[ "async", "def", "respond_rpc", "(", "self", ",", "msg", ",", "_context", ")", ":", "rpc_id", "=", "msg", ".", "get", "(", "'response_uuid'", ")", "result", "=", "msg", ".", "get", "(", "'result'", ")", "payload", "=", "msg", ".", "get", "(", "'respon...
Respond to an RPC previously sent to a service.
[ "Respond", "to", "an", "RPC", "previously", "sent", "to", "a", "service", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilegateway/iotilegateway/supervisor/server.py#L162-L169
train
iotile/coretools
iotilegateway/iotilegateway/supervisor/server.py
IOTileSupervisor.set_agent
async def set_agent(self, msg, context): """Mark a client as the RPC agent for a service.""" service = msg.get('name') client = context.user_data self.service_manager.set_agent(service, client)
python
async def set_agent(self, msg, context): """Mark a client as the RPC agent for a service.""" service = msg.get('name') client = context.user_data self.service_manager.set_agent(service, client)
[ "async", "def", "set_agent", "(", "self", ",", "msg", ",", "context", ")", ":", "service", "=", "msg", ".", "get", "(", "'name'", ")", "client", "=", "context", ".", "user_data", "self", ".", "service_manager", ".", "set_agent", "(", "service", ",", "c...
Mark a client as the RPC agent for a service.
[ "Mark", "a", "client", "as", "the", "RPC", "agent", "for", "a", "service", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilegateway/iotilegateway/supervisor/server.py#L176-L182
train
iotile/coretools
iotilegateway/iotilegateway/supervisor/server.py
IOTileSupervisor.service_messages
async def service_messages(self, msg, _context): """Get all messages for a service.""" msgs = self.service_manager.service_messages(msg.get('name')) return [x.to_dict() for x in msgs]
python
async def service_messages(self, msg, _context): """Get all messages for a service.""" msgs = self.service_manager.service_messages(msg.get('name')) return [x.to_dict() for x in msgs]
[ "async", "def", "service_messages", "(", "self", ",", "msg", ",", "_context", ")", ":", "msgs", "=", "self", ".", "service_manager", ".", "service_messages", "(", "msg", ".", "get", "(", "'name'", ")", ")", "return", "[", "x", ".", "to_dict", "(", ")",...
Get all messages for a service.
[ "Get", "all", "messages", "for", "a", "service", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilegateway/iotilegateway/supervisor/server.py#L219-L223
train
iotile/coretools
iotilegateway/iotilegateway/supervisor/server.py
IOTileSupervisor.service_headline
async def service_headline(self, msg, _context): """Get the headline for a service.""" headline = self.service_manager.service_headline(msg.get('name')) if headline is not None: headline = headline.to_dict() return headline
python
async def service_headline(self, msg, _context): """Get the headline for a service.""" headline = self.service_manager.service_headline(msg.get('name')) if headline is not None: headline = headline.to_dict() return headline
[ "async", "def", "service_headline", "(", "self", ",", "msg", ",", "_context", ")", ":", "headline", "=", "self", ".", "service_manager", ".", "service_headline", "(", "msg", ".", "get", "(", "'name'", ")", ")", "if", "headline", "is", "not", "None", ":",...
Get the headline for a service.
[ "Get", "the", "headline", "for", "a", "service", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilegateway/iotilegateway/supervisor/server.py#L225-L232
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/nasm.py
generate
def generate(env): """Add Builders and construction variables for nasm to an Environment.""" static_obj, shared_obj = SCons.Tool.createObjBuilders(env) for suffix in ASSuffixes: static_obj.add_action(suffix, SCons.Defaults.ASAction) static_obj.add_emitter(suffix, SCons.Defaults.StaticObject...
python
def generate(env): """Add Builders and construction variables for nasm to an Environment.""" static_obj, shared_obj = SCons.Tool.createObjBuilders(env) for suffix in ASSuffixes: static_obj.add_action(suffix, SCons.Defaults.ASAction) static_obj.add_emitter(suffix, SCons.Defaults.StaticObject...
[ "def", "generate", "(", "env", ")", ":", "static_obj", ",", "shared_obj", "=", "SCons", ".", "Tool", ".", "createObjBuilders", "(", "env", ")", "for", "suffix", "in", "ASSuffixes", ":", "static_obj", ".", "add_action", "(", "suffix", ",", "SCons", ".", "...
Add Builders and construction variables for nasm to an Environment.
[ "Add", "Builders", "and", "construction", "variables", "for", "nasm", "to", "an", "Environment", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/nasm.py#L47-L63
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/sunlink.py
generate
def generate(env): """Add Builders and construction variables for Forte to an Environment.""" link.generate(env) env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -G') env['RPATHPREFIX'] = '-R' env['RPATHSUFFIX'] = '' env['_RPATH'] = '${_concat(RPATHPREFIX, RPATH, RPATHSUFFIX, __env__)}' ...
python
def generate(env): """Add Builders and construction variables for Forte to an Environment.""" link.generate(env) env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -G') env['RPATHPREFIX'] = '-R' env['RPATHSUFFIX'] = '' env['_RPATH'] = '${_concat(RPATHPREFIX, RPATH, RPATHSUFFIX, __env__)}' ...
[ "def", "generate", "(", "env", ")", ":", "link", ".", "generate", "(", "env", ")", "env", "[", "'SHLINKFLAGS'", "]", "=", "SCons", ".", "Util", ".", "CLVar", "(", "'$LINKFLAGS -G'", ")", "env", "[", "'RPATHPREFIX'", "]", "=", "'-R'", "env", "[", "'RP...
Add Builders and construction variables for Forte to an Environment.
[ "Add", "Builders", "and", "construction", "variables", "for", "Forte", "to", "an", "Environment", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/sunlink.py#L59-L71
train
iotile/coretools
iotilecore/iotile/core/utilities/schema_verify/verifier.py
Verifier._get_short_description
def _get_short_description(self): """Return the first line of a multiline description Returns: string: The short description, otherwise None """ if self.description is None: return None lines = [x for x in self.description.split('\n')] if len(li...
python
def _get_short_description(self): """Return the first line of a multiline description Returns: string: The short description, otherwise None """ if self.description is None: return None lines = [x for x in self.description.split('\n')] if len(li...
[ "def", "_get_short_description", "(", "self", ")", ":", "if", "self", ".", "description", "is", "None", ":", "return", "None", "lines", "=", "[", "x", "for", "x", "in", "self", ".", "description", ".", "split", "(", "'\\n'", ")", "]", "if", "len", "(...
Return the first line of a multiline description Returns: string: The short description, otherwise None
[ "Return", "the", "first", "line", "of", "a", "multiline", "description" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/utilities/schema_verify/verifier.py#L70-L86
train
iotile/coretools
iotilecore/iotile/core/utilities/schema_verify/verifier.py
Verifier._get_long_description
def _get_long_description(self): """Return the subsequent lines of a multiline description Returns: string: The long description, otherwise None """ if self.description is None: return None lines = [x for x in self.description.split('\n')] if le...
python
def _get_long_description(self): """Return the subsequent lines of a multiline description Returns: string: The long description, otherwise None """ if self.description is None: return None lines = [x for x in self.description.split('\n')] if le...
[ "def", "_get_long_description", "(", "self", ")", ":", "if", "self", ".", "description", "is", "None", ":", "return", "None", "lines", "=", "[", "x", "for", "x", "in", "self", ".", "description", ".", "split", "(", "'\\n'", ")", "]", "if", "len", "("...
Return the subsequent lines of a multiline description Returns: string: The long description, otherwise None
[ "Return", "the", "subsequent", "lines", "of", "a", "multiline", "description" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/utilities/schema_verify/verifier.py#L88-L105
train
iotile/coretools
iotilecore/iotile/core/utilities/schema_verify/verifier.py
Verifier.wrap_lines
def wrap_lines(self, text, indent_level, indent_size=4): """Indent a multiline string Args: text (string): The string to indent indent_level (int): The number of indent_size spaces to prepend to each line indent_size (int): The number of spaces to pre...
python
def wrap_lines(self, text, indent_level, indent_size=4): """Indent a multiline string Args: text (string): The string to indent indent_level (int): The number of indent_size spaces to prepend to each line indent_size (int): The number of spaces to pre...
[ "def", "wrap_lines", "(", "self", ",", "text", ",", "indent_level", ",", "indent_size", "=", "4", ")", ":", "indent", "=", "' '", "*", "indent_size", "*", "indent_level", "lines", "=", "text", ".", "split", "(", "'\\n'", ")", "wrapped_lines", "=", "[", ...
Indent a multiline string Args: text (string): The string to indent indent_level (int): The number of indent_size spaces to prepend to each line indent_size (int): The number of spaces to prepend for each indent level Returns: ...
[ "Indent", "a", "multiline", "string" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/utilities/schema_verify/verifier.py#L107-L132
train
iotile/coretools
iotilecore/iotile/core/utilities/schema_verify/verifier.py
Verifier.format_name
def format_name(self, name, indent_size=4): """Format the name of this verifier The name will be formatted as: <name>: <short description> long description if one is given followed by \n otherwise no long description Args: name (string): ...
python
def format_name(self, name, indent_size=4): """Format the name of this verifier The name will be formatted as: <name>: <short description> long description if one is given followed by \n otherwise no long description Args: name (string): ...
[ "def", "format_name", "(", "self", ",", "name", ",", "indent_size", "=", "4", ")", ":", "name_block", "=", "''", "if", "self", ".", "short_desc", "is", "None", ":", "name_block", "+=", "name", "+", "'\\n'", "else", ":", "name_block", "+=", "name", "+",...
Format the name of this verifier The name will be formatted as: <name>: <short description> long description if one is given followed by \n otherwise no long description Args: name (string): A name for this validator indent_size (int)...
[ "Format", "the", "name", "of", "this", "verifier" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/utilities/schema_verify/verifier.py#L134-L162
train
iotile/coretools
iotilecore/iotile/core/utilities/schema_verify/verifier.py
Verifier.trim_whitespace
def trim_whitespace(self, text): """Remove leading whitespace from each line of a multiline string Args: text (string): The text to be unindented Returns: string: The unindented block of text """ lines = text.split('\n') new_lines = [x.lstrip() ...
python
def trim_whitespace(self, text): """Remove leading whitespace from each line of a multiline string Args: text (string): The text to be unindented Returns: string: The unindented block of text """ lines = text.split('\n') new_lines = [x.lstrip() ...
[ "def", "trim_whitespace", "(", "self", ",", "text", ")", ":", "lines", "=", "text", ".", "split", "(", "'\\n'", ")", "new_lines", "=", "[", "x", ".", "lstrip", "(", ")", "for", "x", "in", "lines", "]", "return", "'\\n'", ".", "join", "(", "new_line...
Remove leading whitespace from each line of a multiline string Args: text (string): The text to be unindented Returns: string: The unindented block of text
[ "Remove", "leading", "whitespace", "from", "each", "line", "of", "a", "multiline", "string" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/utilities/schema_verify/verifier.py#L164-L177
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/docbook/__init__.py
__extend_targets_sources
def __extend_targets_sources(target, source): """ Prepare the lists of target and source files. """ if not SCons.Util.is_List(target): target = [target] if not source: source = target[:] elif not SCons.Util.is_List(source): source = [source] if len(target) < len(source): ...
python
def __extend_targets_sources(target, source): """ Prepare the lists of target and source files. """ if not SCons.Util.is_List(target): target = [target] if not source: source = target[:] elif not SCons.Util.is_List(source): source = [source] if len(target) < len(source): ...
[ "def", "__extend_targets_sources", "(", "target", ",", "source", ")", ":", "if", "not", "SCons", ".", "Util", ".", "is_List", "(", "target", ")", ":", "target", "=", "[", "target", "]", "if", "not", "source", ":", "source", "=", "target", "[", ":", "...
Prepare the lists of target and source files.
[ "Prepare", "the", "lists", "of", "target", "and", "source", "files", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/docbook/__init__.py#L77-L88
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/docbook/__init__.py
__select_builder
def __select_builder(lxml_builder, libxml2_builder, cmdline_builder): """ Selects a builder, based on which Python modules are present. """ if prefer_xsltproc: return cmdline_builder if not has_libxml2: # At the moment we prefer libxml2 over lxml, the latter can lead # to confli...
python
def __select_builder(lxml_builder, libxml2_builder, cmdline_builder): """ Selects a builder, based on which Python modules are present. """ if prefer_xsltproc: return cmdline_builder if not has_libxml2: # At the moment we prefer libxml2 over lxml, the latter can lead # to confli...
[ "def", "__select_builder", "(", "lxml_builder", ",", "libxml2_builder", ",", "cmdline_builder", ")", ":", "if", "prefer_xsltproc", ":", "return", "cmdline_builder", "if", "not", "has_libxml2", ":", "if", "has_lxml", ":", "return", "lxml_builder", "else", ":", "ret...
Selects a builder, based on which Python modules are present.
[ "Selects", "a", "builder", "based", "on", "which", "Python", "modules", "are", "present", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/docbook/__init__.py#L98-L111
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/docbook/__init__.py
__ensure_suffix
def __ensure_suffix(t, suffix): """ Ensure that the target t has the given suffix. """ tpath = str(t) if not tpath.endswith(suffix): return tpath+suffix return t
python
def __ensure_suffix(t, suffix): """ Ensure that the target t has the given suffix. """ tpath = str(t) if not tpath.endswith(suffix): return tpath+suffix return t
[ "def", "__ensure_suffix", "(", "t", ",", "suffix", ")", ":", "tpath", "=", "str", "(", "t", ")", "if", "not", "tpath", ".", "endswith", "(", "suffix", ")", ":", "return", "tpath", "+", "suffix", "return", "t" ]
Ensure that the target t has the given suffix.
[ "Ensure", "that", "the", "target", "t", "has", "the", "given", "suffix", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/docbook/__init__.py#L113-L119
train