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
iotileemulate/iotile/emulate/reference/controller_features/config_database.py
ConfigDatabaseMixin.get_config_database_info
def get_config_database_info(self): """Get memory usage and space statistics on the config database.""" max_size = self.config_database.data_size max_entries = self.config_database.max_entries() used_size = self.config_database.data_index used_entries = len(self.config_database....
python
def get_config_database_info(self): """Get memory usage and space statistics on the config database.""" max_size = self.config_database.data_size max_entries = self.config_database.max_entries() used_size = self.config_database.data_index used_entries = len(self.config_database....
[ "def", "get_config_database_info", "(", "self", ")", ":", "max_size", "=", "self", ".", "config_database", ".", "data_size", "max_entries", "=", "self", ".", "config_database", ".", "max_entries", "(", ")", "used_size", "=", "self", ".", "config_database", ".", ...
Get memory usage and space statistics on the config database.
[ "Get", "memory", "usage", "and", "space", "statistics", "on", "the", "config", "database", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/controller_features/config_database.py#L365-L375
train
iotile/coretools
iotilecore/iotile/core/hw/virtual/virtualtile.py
VirtualTile.FindByName
def FindByName(cls, name): """Find an installed VirtualTile by name. This function searches for installed virtual tiles using the pkg_resources entry_point `iotile.virtual_tile`. If name is a path ending in .py, it is assumed to point to a module on disk and loaded directly rat...
python
def FindByName(cls, name): """Find an installed VirtualTile by name. This function searches for installed virtual tiles using the pkg_resources entry_point `iotile.virtual_tile`. If name is a path ending in .py, it is assumed to point to a module on disk and loaded directly rat...
[ "def", "FindByName", "(", "cls", ",", "name", ")", ":", "if", "name", ".", "endswith", "(", "'.py'", ")", ":", "return", "cls", ".", "LoadFromFile", "(", "name", ")", "reg", "=", "ComponentRegistry", "(", ")", "for", "_name", ",", "tile", "in", "reg"...
Find an installed VirtualTile by name. This function searches for installed virtual tiles using the pkg_resources entry_point `iotile.virtual_tile`. If name is a path ending in .py, it is assumed to point to a module on disk and loaded directly rather than using pkg_resources. ...
[ "Find", "an", "installed", "VirtualTile", "by", "name", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/virtual/virtualtile.py#L58-L84
train
iotile/coretools
iotilecore/iotile/core/hw/virtual/virtualtile.py
VirtualTile.LoadFromFile
def LoadFromFile(cls, script_path): """Import a virtual tile from a file rather than an installed module script_path must point to a python file ending in .py that contains exactly one VirtualTile class definition. That class is loaded and executed as if it were installed. To ...
python
def LoadFromFile(cls, script_path): """Import a virtual tile from a file rather than an installed module script_path must point to a python file ending in .py that contains exactly one VirtualTile class definition. That class is loaded and executed as if it were installed. To ...
[ "def", "LoadFromFile", "(", "cls", ",", "script_path", ")", ":", "_name", ",", "dev", "=", "ComponentRegistry", "(", ")", ".", "load_extension", "(", "script_path", ",", "class_filter", "=", "VirtualTile", ",", "unique", "=", "True", ")", "return", "dev" ]
Import a virtual tile from a file rather than an installed module script_path must point to a python file ending in .py that contains exactly one VirtualTile class definition. That class is loaded and executed as if it were installed. To facilitate development, if there is a proxy obj...
[ "Import", "a", "virtual", "tile", "from", "a", "file", "rather", "than", "an", "installed", "module" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/virtual/virtualtile.py#L87-L106
train
iotile/coretools
iotilebuild/iotile/build/release/pypi_provider.py
PyPIReleaseProvider.stage
def stage(self): """Stage python packages for release, verifying everything we can about them.""" if 'PYPI_USER' not in os.environ or 'PYPI_PASS' not in os.environ: raise BuildError("You must set the PYPI_USER and PYPI_PASS environment variables") try: import twine ...
python
def stage(self): """Stage python packages for release, verifying everything we can about them.""" if 'PYPI_USER' not in os.environ or 'PYPI_PASS' not in os.environ: raise BuildError("You must set the PYPI_USER and PYPI_PASS environment variables") try: import twine ...
[ "def", "stage", "(", "self", ")", ":", "if", "'PYPI_USER'", "not", "in", "os", ".", "environ", "or", "'PYPI_PASS'", "not", "in", "os", ".", "environ", ":", "raise", "BuildError", "(", "\"You must set the PYPI_USER and PYPI_PASS environment variables\"", ")", "try"...
Stage python packages for release, verifying everything we can about them.
[ "Stage", "python", "packages", "for", "release", "verifying", "everything", "we", "can", "about", "them", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/release/pypi_provider.py#L32-L58
train
iotile/coretools
iotilecore/iotile/core/hw/reports/parser.py
IOTileReportParser.add_data
def add_data(self, data): """Add data to our stream, emitting reports as each new one is seen Args: data (bytearray): A chunk of new data to add """ if self.state == self.ErrorState: return self.raw_data += bytearray(data) still_processing = Tr...
python
def add_data(self, data): """Add data to our stream, emitting reports as each new one is seen Args: data (bytearray): A chunk of new data to add """ if self.state == self.ErrorState: return self.raw_data += bytearray(data) still_processing = Tr...
[ "def", "add_data", "(", "self", ",", "data", ")", ":", "if", "self", ".", "state", "==", "self", ".", "ErrorState", ":", "return", "self", ".", "raw_data", "+=", "bytearray", "(", "data", ")", "still_processing", "=", "True", "while", "still_processing", ...
Add data to our stream, emitting reports as each new one is seen Args: data (bytearray): A chunk of new data to add
[ "Add", "data", "to", "our", "stream", "emitting", "reports", "as", "each", "new", "one", "is", "seen" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/reports/parser.py#L51-L65
train
iotile/coretools
iotilecore/iotile/core/hw/reports/parser.py
IOTileReportParser.process_data
def process_data(self): """Attempt to extract a report from the current data stream contents Returns: bool: True if further processing is required and process_data should be called again. """ further_processing = False if self.state == self.WaitingF...
python
def process_data(self): """Attempt to extract a report from the current data stream contents Returns: bool: True if further processing is required and process_data should be called again. """ further_processing = False if self.state == self.WaitingF...
[ "def", "process_data", "(", "self", ")", ":", "further_processing", "=", "False", "if", "self", ".", "state", "==", "self", ".", "WaitingForReportType", "and", "len", "(", "self", ".", "raw_data", ")", ">", "0", ":", "self", ".", "current_type", "=", "se...
Attempt to extract a report from the current data stream contents Returns: bool: True if further processing is required and process_data should be called again.
[ "Attempt", "to", "extract", "a", "report", "from", "the", "current", "data", "stream", "contents" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/reports/parser.py#L67-L123
train
iotile/coretools
iotilecore/iotile/core/hw/reports/parser.py
IOTileReportParser.calculate_report_size
def calculate_report_size(self, current_type, report_header): """Determine the size of a report given its type and header""" fmt = self.known_formats[current_type] return fmt.ReportLength(report_header)
python
def calculate_report_size(self, current_type, report_header): """Determine the size of a report given its type and header""" fmt = self.known_formats[current_type] return fmt.ReportLength(report_header)
[ "def", "calculate_report_size", "(", "self", ",", "current_type", ",", "report_header", ")", ":", "fmt", "=", "self", ".", "known_formats", "[", "current_type", "]", "return", "fmt", ".", "ReportLength", "(", "report_header", ")" ]
Determine the size of a report given its type and header
[ "Determine", "the", "size", "of", "a", "report", "given", "its", "type", "and", "header" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/reports/parser.py#L131-L135
train
iotile/coretools
iotilecore/iotile/core/hw/reports/parser.py
IOTileReportParser.parse_report
def parse_report(self, current_type, report_data): """Parse a report into an IOTileReport subclass""" fmt = self.known_formats[current_type] return fmt(report_data)
python
def parse_report(self, current_type, report_data): """Parse a report into an IOTileReport subclass""" fmt = self.known_formats[current_type] return fmt(report_data)
[ "def", "parse_report", "(", "self", ",", "current_type", ",", "report_data", ")", ":", "fmt", "=", "self", ".", "known_formats", "[", "current_type", "]", "return", "fmt", "(", "report_data", ")" ]
Parse a report into an IOTileReport subclass
[ "Parse", "a", "report", "into", "an", "IOTileReport", "subclass" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/reports/parser.py#L137-L141
train
iotile/coretools
iotilecore/iotile/core/hw/reports/parser.py
IOTileReportParser._handle_report
def _handle_report(self, report): """Try to emit a report and possibly keep a copy of it""" keep_report = True if self.report_callback is not None: keep_report = self.report_callback(report, self.context) if keep_report: self.reports.append(report)
python
def _handle_report(self, report): """Try to emit a report and possibly keep a copy of it""" keep_report = True if self.report_callback is not None: keep_report = self.report_callback(report, self.context) if keep_report: self.reports.append(report)
[ "def", "_handle_report", "(", "self", ",", "report", ")", ":", "keep_report", "=", "True", "if", "self", ".", "report_callback", "is", "not", "None", ":", "keep_report", "=", "self", ".", "report_callback", "(", "report", ",", "self", ".", "context", ")", ...
Try to emit a report and possibly keep a copy of it
[ "Try", "to", "emit", "a", "report", "and", "possibly", "keep", "a", "copy", "of", "it" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/reports/parser.py#L160-L169
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/msginit.py
_POInitBuilder
def _POInitBuilder(env, **kw): """ Create builder object for `POInit` builder. """ import SCons.Action from SCons.Tool.GettextCommon import _init_po_files, _POFileBuilder action = SCons.Action.Action(_init_po_files, None) return _POFileBuilder(env, action=action, target_alias='$POCREATE_ALIAS')
python
def _POInitBuilder(env, **kw): """ Create builder object for `POInit` builder. """ import SCons.Action from SCons.Tool.GettextCommon import _init_po_files, _POFileBuilder action = SCons.Action.Action(_init_po_files, None) return _POFileBuilder(env, action=action, target_alias='$POCREATE_ALIAS')
[ "def", "_POInitBuilder", "(", "env", ",", "**", "kw", ")", ":", "import", "SCons", ".", "Action", "from", "SCons", ".", "Tool", ".", "GettextCommon", "import", "_init_po_files", ",", "_POFileBuilder", "action", "=", "SCons", ".", "Action", ".", "Action", "...
Create builder object for `POInit` builder.
[ "Create", "builder", "object", "for", "POInit", "builder", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/msginit.py#L49-L54
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/msginit.py
generate
def generate(env,**kw): """ Generate the `msginit` tool """ import SCons.Util from SCons.Tool.GettextCommon import _detect_msginit try: env['MSGINIT'] = _detect_msginit(env) except: env['MSGINIT'] = 'msginit' msginitcom = '$MSGINIT ${_MSGNoTranslator(__env__)} -l ${_MSGINITLOCALE}' \ + ...
python
def generate(env,**kw): """ Generate the `msginit` tool """ import SCons.Util from SCons.Tool.GettextCommon import _detect_msginit try: env['MSGINIT'] = _detect_msginit(env) except: env['MSGINIT'] = 'msginit' msginitcom = '$MSGINIT ${_MSGNoTranslator(__env__)} -l ${_MSGINITLOCALE}' \ + ...
[ "def", "generate", "(", "env", ",", "**", "kw", ")", ":", "import", "SCons", ".", "Util", "from", "SCons", ".", "Tool", ".", "GettextCommon", "import", "_detect_msginit", "try", ":", "env", "[", "'MSGINIT'", "]", "=", "_detect_msginit", "(", "env", ")", ...
Generate the `msginit` tool
[ "Generate", "the", "msginit", "tool" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/msginit.py#L78-L103
train
iotile/coretools
transport_plugins/bled112/iotile_transport_bled112/utilities.py
open_bled112
def open_bled112(port, logger): """Open a BLED112 adapter either by name or the first available.""" if port is not None and port != '<auto>': logger.info("Using BLED112 adapter at %s", port) return serial.Serial(port, _BAUD_RATE, timeout=0.01, rtscts=True, exclusive=True) return _find_avai...
python
def open_bled112(port, logger): """Open a BLED112 adapter either by name or the first available.""" if port is not None and port != '<auto>': logger.info("Using BLED112 adapter at %s", port) return serial.Serial(port, _BAUD_RATE, timeout=0.01, rtscts=True, exclusive=True) return _find_avai...
[ "def", "open_bled112", "(", "port", ",", "logger", ")", ":", "if", "port", "is", "not", "None", "and", "port", "!=", "'<auto>'", ":", "logger", ".", "info", "(", "\"Using BLED112 adapter at %s\"", ",", "port", ")", "return", "serial", ".", "Serial", "(", ...
Open a BLED112 adapter either by name or the first available.
[ "Open", "a", "BLED112", "adapter", "either", "by", "name", "or", "the", "first", "available", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/bled112/iotile_transport_bled112/utilities.py#L41-L48
train
iotile/coretools
transport_plugins/native_ble/iotile_transport_native_ble/device_adapter.py
NativeBLEDeviceAdapter._find_ble_controllers
def _find_ble_controllers(self): """Get a list of the available and powered BLE controllers""" controllers = self.bable.list_controllers() return [ctrl for ctrl in controllers if ctrl.powered and ctrl.low_energy]
python
def _find_ble_controllers(self): """Get a list of the available and powered BLE controllers""" controllers = self.bable.list_controllers() return [ctrl for ctrl in controllers if ctrl.powered and ctrl.low_energy]
[ "def", "_find_ble_controllers", "(", "self", ")", ":", "controllers", "=", "self", ".", "bable", ".", "list_controllers", "(", ")", "return", "[", "ctrl", "for", "ctrl", "in", "controllers", "if", "ctrl", ".", "powered", "and", "ctrl", ".", "low_energy", "...
Get a list of the available and powered BLE controllers
[ "Get", "a", "list", "of", "the", "available", "and", "powered", "BLE", "controllers" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/native_ble/iotile_transport_native_ble/device_adapter.py#L92-L95
train
iotile/coretools
transport_plugins/native_ble/iotile_transport_native_ble/device_adapter.py
NativeBLEDeviceAdapter.stop_scan
def stop_scan(self): """Stop to scan.""" try: self.bable.stop_scan(sync=True) except bable_interface.BaBLEException: # If we errored our it is because we were not currently scanning pass self.scanning = False
python
def stop_scan(self): """Stop to scan.""" try: self.bable.stop_scan(sync=True) except bable_interface.BaBLEException: # If we errored our it is because we were not currently scanning pass self.scanning = False
[ "def", "stop_scan", "(", "self", ")", ":", "try", ":", "self", ".", "bable", ".", "stop_scan", "(", "sync", "=", "True", ")", "except", "bable_interface", ".", "BaBLEException", ":", "pass", "self", ".", "scanning", "=", "False" ]
Stop to scan.
[ "Stop", "to", "scan", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/native_ble/iotile_transport_native_ble/device_adapter.py#L218-L226
train
iotile/coretools
transport_plugins/native_ble/iotile_transport_native_ble/device_adapter.py
NativeBLEDeviceAdapter._open_rpc_interface
def _open_rpc_interface(self, connection_id, callback): """Enable RPC interface for this IOTile device Args: connection_id (int): The unique identifier for the connection callback (callback): Callback to be called when this command finishes callback(conn_id, adap...
python
def _open_rpc_interface(self, connection_id, callback): """Enable RPC interface for this IOTile device Args: connection_id (int): The unique identifier for the connection callback (callback): Callback to be called when this command finishes callback(conn_id, adap...
[ "def", "_open_rpc_interface", "(", "self", ",", "connection_id", ",", "callback", ")", ":", "try", ":", "context", "=", "self", ".", "connections", ".", "get_context", "(", "connection_id", ")", "except", "ArgumentError", ":", "callback", "(", "connection_id", ...
Enable RPC interface for this IOTile device Args: connection_id (int): The unique identifier for the connection callback (callback): Callback to be called when this command finishes callback(conn_id, adapter_id, success, failure_reason)
[ "Enable", "RPC", "interface", "for", "this", "IOTile", "device" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/native_ble/iotile_transport_native_ble/device_adapter.py#L494-L527
train
iotile/coretools
transport_plugins/native_ble/iotile_transport_native_ble/device_adapter.py
NativeBLEDeviceAdapter._open_streaming_interface
def _open_streaming_interface(self, connection_id, callback): """Enable streaming interface for this IOTile device Args: connection_id (int): The unique identifier for the connection callback (callback): Callback to be called when this command finishes callback(c...
python
def _open_streaming_interface(self, connection_id, callback): """Enable streaming interface for this IOTile device Args: connection_id (int): The unique identifier for the connection callback (callback): Callback to be called when this command finishes callback(c...
[ "def", "_open_streaming_interface", "(", "self", ",", "connection_id", ",", "callback", ")", ":", "try", ":", "context", "=", "self", ".", "connections", ".", "get_context", "(", "connection_id", ")", "except", "ArgumentError", ":", "callback", "(", "connection_...
Enable streaming interface for this IOTile device Args: connection_id (int): The unique identifier for the connection callback (callback): Callback to be called when this command finishes callback(conn_id, adapter_id, success, failure_reason)
[ "Enable", "streaming", "interface", "for", "this", "IOTile", "device" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/native_ble/iotile_transport_native_ble/device_adapter.py#L551-L601
train
iotile/coretools
transport_plugins/native_ble/iotile_transport_native_ble/device_adapter.py
NativeBLEDeviceAdapter._open_tracing_interface
def _open_tracing_interface(self, connection_id, callback): """Enable the tracing interface for this IOTile device Args: connection_id (int): The unique identifier for the connection callback (callback): Callback to be called when this command finishes callback(c...
python
def _open_tracing_interface(self, connection_id, callback): """Enable the tracing interface for this IOTile device Args: connection_id (int): The unique identifier for the connection callback (callback): Callback to be called when this command finishes callback(c...
[ "def", "_open_tracing_interface", "(", "self", ",", "connection_id", ",", "callback", ")", ":", "try", ":", "context", "=", "self", ".", "connections", ".", "get_context", "(", "connection_id", ")", "except", "ArgumentError", ":", "callback", "(", "connection_id...
Enable the tracing interface for this IOTile device Args: connection_id (int): The unique identifier for the connection callback (callback): Callback to be called when this command finishes callback(conn_id, adapter_id, success, failure_reason)
[ "Enable", "the", "tracing", "interface", "for", "this", "IOTile", "device" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/native_ble/iotile_transport_native_ble/device_adapter.py#L603-L647
train
iotile/coretools
transport_plugins/native_ble/iotile_transport_native_ble/device_adapter.py
NativeBLEDeviceAdapter._close_rpc_interface
def _close_rpc_interface(self, connection_id, callback): """Disable RPC interface for this IOTile device Args: connection_id (int): The unique identifier for the connection callback (callback): Callback to be called when this command finishes callback(conn_id, ad...
python
def _close_rpc_interface(self, connection_id, callback): """Disable RPC interface for this IOTile device Args: connection_id (int): The unique identifier for the connection callback (callback): Callback to be called when this command finishes callback(conn_id, ad...
[ "def", "_close_rpc_interface", "(", "self", ",", "connection_id", ",", "callback", ")", ":", "try", ":", "context", "=", "self", ".", "connections", ".", "get_context", "(", "connection_id", ")", "except", "ArgumentError", ":", "callback", "(", "connection_id", ...
Disable RPC interface for this IOTile device Args: connection_id (int): The unique identifier for the connection callback (callback): Callback to be called when this command finishes callback(conn_id, adapter_id, success, failure_reason)
[ "Disable", "RPC", "interface", "for", "this", "IOTile", "device" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/native_ble/iotile_transport_native_ble/device_adapter.py#L677-L708
train
iotile/coretools
transport_plugins/native_ble/iotile_transport_native_ble/device_adapter.py
NativeBLEDeviceAdapter._on_report
def _on_report(self, report, connection_id): """Callback function called when a report has been processed. Args: report (IOTileReport): The report object connection_id (int): The connection id related to this report Returns: - True to indicate that IOTileRep...
python
def _on_report(self, report, connection_id): """Callback function called when a report has been processed. Args: report (IOTileReport): The report object connection_id (int): The connection id related to this report Returns: - True to indicate that IOTileRep...
[ "def", "_on_report", "(", "self", ",", "report", ",", "connection_id", ")", ":", "self", ".", "_logger", ".", "info", "(", "'Received report: %s'", ",", "str", "(", "report", ")", ")", "self", ".", "_trigger_callback", "(", "'on_report'", ",", "connection_id...
Callback function called when a report has been processed. Args: report (IOTileReport): The report object connection_id (int): The connection id related to this report Returns: - True to indicate that IOTileReportParser should also keep a copy of the report ...
[ "Callback", "function", "called", "when", "a", "report", "has", "been", "processed", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/native_ble/iotile_transport_native_ble/device_adapter.py#L738-L752
train
iotile/coretools
transport_plugins/native_ble/iotile_transport_native_ble/device_adapter.py
NativeBLEDeviceAdapter._on_report_error
def _on_report_error(self, code, message, connection_id): """Callback function called if an error occured while parsing a report""" self._logger.critical( "Error receiving reports, no more reports will be processed on this adapter, code=%d, msg=%s", code, message )
python
def _on_report_error(self, code, message, connection_id): """Callback function called if an error occured while parsing a report""" self._logger.critical( "Error receiving reports, no more reports will be processed on this adapter, code=%d, msg=%s", code, message )
[ "def", "_on_report_error", "(", "self", ",", "code", ",", "message", ",", "connection_id", ")", ":", "self", ".", "_logger", ".", "critical", "(", "\"Error receiving reports, no more reports will be processed on this adapter, code=%d, msg=%s\"", ",", "code", ",", "message...
Callback function called if an error occured while parsing a report
[ "Callback", "function", "called", "if", "an", "error", "occured", "while", "parsing", "a", "report" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/native_ble/iotile_transport_native_ble/device_adapter.py#L754-L758
train
iotile/coretools
transport_plugins/native_ble/iotile_transport_native_ble/device_adapter.py
NativeBLEDeviceAdapter._register_notification_callback
def _register_notification_callback(self, connection_handle, attribute_handle, callback, once=False): """Register a callback as a notification callback. It will be called if a notification with the matching connection_handle and attribute_handle is received. Args: connection_handle ...
python
def _register_notification_callback(self, connection_handle, attribute_handle, callback, once=False): """Register a callback as a notification callback. It will be called if a notification with the matching connection_handle and attribute_handle is received. Args: connection_handle ...
[ "def", "_register_notification_callback", "(", "self", ",", "connection_handle", ",", "attribute_handle", ",", "callback", ",", "once", "=", "False", ")", ":", "notification_id", "=", "(", "connection_handle", ",", "attribute_handle", ")", "with", "self", ".", "no...
Register a callback as a notification callback. It will be called if a notification with the matching connection_handle and attribute_handle is received. Args: connection_handle (int): The connection handle to watch attribute_handle (int): The attribute handle to watch ...
[ "Register", "a", "callback", "as", "a", "notification", "callback", ".", "It", "will", "be", "called", "if", "a", "notification", "with", "the", "matching", "connection_handle", "and", "attribute_handle", "is", "received", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/native_ble/iotile_transport_native_ble/device_adapter.py#L927-L939
train
iotile/coretools
transport_plugins/native_ble/iotile_transport_native_ble/device_adapter.py
NativeBLEDeviceAdapter.periodic_callback
def periodic_callback(self): """Periodic cleanup tasks to maintain this adapter, should be called every second. """ if self.stopped: return # Check if we should start scanning again if not self.scanning and len(self.connections.get_connections()) == 0: self._log...
python
def periodic_callback(self): """Periodic cleanup tasks to maintain this adapter, should be called every second. """ if self.stopped: return # Check if we should start scanning again if not self.scanning and len(self.connections.get_connections()) == 0: self._log...
[ "def", "periodic_callback", "(", "self", ")", ":", "if", "self", ".", "stopped", ":", "return", "if", "not", "self", ".", "scanning", "and", "len", "(", "self", ".", "connections", ".", "get_connections", "(", ")", ")", "==", "0", ":", "self", ".", "...
Periodic cleanup tasks to maintain this adapter, should be called every second.
[ "Periodic", "cleanup", "tasks", "to", "maintain", "this", "adapter", "should", "be", "called", "every", "second", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/native_ble/iotile_transport_native_ble/device_adapter.py#L984-L994
train
iotile/coretools
iotilesensorgraph/iotile/sg/output_formats/snippet.py
format_snippet
def format_snippet(sensor_graph): """Format this sensor graph as iotile command snippets. This includes commands to reset and clear previously stored sensor graphs. Args: sensor_graph (SensorGraph): the sensor graph that we want to format """ output = [] # Clear any old sensor gr...
python
def format_snippet(sensor_graph): """Format this sensor graph as iotile command snippets. This includes commands to reset and clear previously stored sensor graphs. Args: sensor_graph (SensorGraph): the sensor graph that we want to format """ output = [] # Clear any old sensor gr...
[ "def", "format_snippet", "(", "sensor_graph", ")", ":", "output", "=", "[", "]", "output", ".", "append", "(", "\"disable\"", ")", "output", ".", "append", "(", "\"clear\"", ")", "output", ".", "append", "(", "\"reset\"", ")", "for", "node", "in", "senso...
Format this sensor graph as iotile command snippets. This includes commands to reset and clear previously stored sensor graphs. Args: sensor_graph (SensorGraph): the sensor graph that we want to format
[ "Format", "this", "sensor", "graph", "as", "iotile", "command", "snippets", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/output_formats/snippet.py#L6-L76
train
iotile/coretools
transport_plugins/bled112/iotile_transport_bled112/bled112.py
BLED112Adapter.find_bled112_devices
def find_bled112_devices(cls): """Look for BLED112 dongles on this computer and start an instance on each one""" found_devs = [] ports = serial.tools.list_ports.comports() for port in ports: if not hasattr(port, 'pid') or not hasattr(port, 'vid'): continue ...
python
def find_bled112_devices(cls): """Look for BLED112 dongles on this computer and start an instance on each one""" found_devs = [] ports = serial.tools.list_ports.comports() for port in ports: if not hasattr(port, 'pid') or not hasattr(port, 'vid'): continue ...
[ "def", "find_bled112_devices", "(", "cls", ")", ":", "found_devs", "=", "[", "]", "ports", "=", "serial", ".", "tools", ".", "list_ports", ".", "comports", "(", ")", "for", "port", "in", "ports", ":", "if", "not", "hasattr", "(", "port", ",", "'pid'", ...
Look for BLED112 dongles on this computer and start an instance on each one
[ "Look", "for", "BLED112", "dongles", "on", "this", "computer", "and", "start", "an", "instance", "on", "each", "one" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/bled112/iotile_transport_bled112/bled112.py#L109-L122
train
iotile/coretools
transport_plugins/bled112/iotile_transport_bled112/bled112.py
BLED112Adapter.get_scan_stats
def get_scan_stats(self): """Return the scan event statistics for this adapter Returns: int : total scan events int : total v1 scan count int : total v1 scan response count int : total v2 scan count dict : device-specific scan counts ...
python
def get_scan_stats(self): """Return the scan event statistics for this adapter Returns: int : total scan events int : total v1 scan count int : total v1 scan response count int : total v2 scan count dict : device-specific scan counts ...
[ "def", "get_scan_stats", "(", "self", ")", ":", "time_spent", "=", "time", ".", "time", "(", ")", "return", "self", ".", "_scan_event_count", ",", "self", ".", "_v1_scan_count", ",", "self", ".", "_v1_scan_response_count", ",", "self", ".", "_v2_scan_count", ...
Return the scan event statistics for this adapter Returns: int : total scan events int : total v1 scan count int : total v1 scan response count int : total v2 scan count dict : device-specific scan counts float : seconds since last reset
[ "Return", "the", "scan", "event", "statistics", "for", "this", "adapter" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/bled112/iotile_transport_bled112/bled112.py#L124-L138
train
iotile/coretools
transport_plugins/bled112/iotile_transport_bled112/bled112.py
BLED112Adapter.reset_scan_stats
def reset_scan_stats(self): """Clears the scan event statistics and updates the last reset time""" self._scan_event_count = 0 self._v1_scan_count = 0 self._v1_scan_response_count = 0 self._v2_scan_count = 0 self._device_scan_counts = {} self._last_reset_time = tim...
python
def reset_scan_stats(self): """Clears the scan event statistics and updates the last reset time""" self._scan_event_count = 0 self._v1_scan_count = 0 self._v1_scan_response_count = 0 self._v2_scan_count = 0 self._device_scan_counts = {} self._last_reset_time = tim...
[ "def", "reset_scan_stats", "(", "self", ")", ":", "self", ".", "_scan_event_count", "=", "0", "self", ".", "_v1_scan_count", "=", "0", "self", ".", "_v1_scan_response_count", "=", "0", "self", ".", "_v2_scan_count", "=", "0", "self", ".", "_device_scan_counts"...
Clears the scan event statistics and updates the last reset time
[ "Clears", "the", "scan", "event", "statistics", "and", "updates", "the", "last", "reset", "time" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/bled112/iotile_transport_bled112/bled112.py#L140-L147
train
iotile/coretools
transport_plugins/bled112/iotile_transport_bled112/bled112.py
BLED112Adapter.start_scan
def start_scan(self, active): """Start the scanning task""" self._command_task.sync_command(['_start_scan', active]) self.scanning = True
python
def start_scan(self, active): """Start the scanning task""" self._command_task.sync_command(['_start_scan', active]) self.scanning = True
[ "def", "start_scan", "(", "self", ",", "active", ")", ":", "self", ".", "_command_task", ".", "sync_command", "(", "[", "'_start_scan'", ",", "active", "]", ")", "self", ".", "scanning", "=", "True" ]
Start the scanning task
[ "Start", "the", "scanning", "task" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/bled112/iotile_transport_bled112/bled112.py#L181-L184
train
iotile/coretools
transport_plugins/bled112/iotile_transport_bled112/bled112.py
BLED112Adapter._open_tracing_interface
def _open_tracing_interface(self, conn_id, callback): """Enable the debug tracing interface for this IOTile device Args: conn_id (int): the unique identifier for the connection callback (callback): Callback to be called when this command finishes callback(conn_id...
python
def _open_tracing_interface(self, conn_id, callback): """Enable the debug tracing interface for this IOTile device Args: conn_id (int): the unique identifier for the connection callback (callback): Callback to be called when this command finishes callback(conn_id...
[ "def", "_open_tracing_interface", "(", "self", ",", "conn_id", ",", "callback", ")", ":", "try", ":", "handle", "=", "self", ".", "_find_handle", "(", "conn_id", ")", "services", "=", "self", ".", "_connections", "[", "handle", "]", "[", "'services'", "]",...
Enable the debug tracing interface for this IOTile device Args: conn_id (int): the unique identifier for the connection callback (callback): Callback to be called when this command finishes callback(conn_id, adapter_id, success, failure_reason)
[ "Enable", "the", "debug", "tracing", "interface", "for", "this", "IOTile", "device" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/bled112/iotile_transport_bled112/bled112.py#L421-L438
train
iotile/coretools
transport_plugins/bled112/iotile_transport_bled112/bled112.py
BLED112Adapter._process_scan_event
def _process_scan_event(self, response): """Parse the BLE advertisement packet. If it's an IOTile device, parse and add to the scanned devices. Then, parse advertisement and determine if it matches V1 or V2. There are two supported type of advertisements: v1: There is both an ...
python
def _process_scan_event(self, response): """Parse the BLE advertisement packet. If it's an IOTile device, parse and add to the scanned devices. Then, parse advertisement and determine if it matches V1 or V2. There are two supported type of advertisements: v1: There is both an ...
[ "def", "_process_scan_event", "(", "self", ",", "response", ")", ":", "payload", "=", "response", ".", "payload", "length", "=", "len", "(", "payload", ")", "-", "10", "if", "length", "<", "0", ":", "return", "rssi", ",", "packet_type", ",", "sender", ...
Parse the BLE advertisement packet. If it's an IOTile device, parse and add to the scanned devices. Then, parse advertisement and determine if it matches V1 or V2. There are two supported type of advertisements: v1: There is both an advertisement and a scan response (if active scannin...
[ "Parse", "the", "BLE", "advertisement", "packet", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/bled112/iotile_transport_bled112/bled112.py#L535-L580
train
iotile/coretools
transport_plugins/bled112/iotile_transport_bled112/bled112.py
BLED112Adapter._parse_v2_advertisement
def _parse_v2_advertisement(self, rssi, sender, data): """ Parse the IOTile Specific advertisement packet""" if len(data) != 31: return # We have already verified that the device is an IOTile device # by checking its service data uuid in _process_scan_event so # her...
python
def _parse_v2_advertisement(self, rssi, sender, data): """ Parse the IOTile Specific advertisement packet""" if len(data) != 31: return # We have already verified that the device is an IOTile device # by checking its service data uuid in _process_scan_event so # her...
[ "def", "_parse_v2_advertisement", "(", "self", ",", "rssi", ",", "sender", ",", "data", ")", ":", "if", "len", "(", "data", ")", "!=", "31", ":", "return", "device_id", ",", "reboot_low", ",", "reboot_high_packed", ",", "flags", ",", "timestamp", ",", "b...
Parse the IOTile Specific advertisement packet
[ "Parse", "the", "IOTile", "Specific", "advertisement", "packet" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/bled112/iotile_transport_bled112/bled112.py#L582-L638
train
iotile/coretools
transport_plugins/bled112/iotile_transport_bled112/bled112.py
BLED112Adapter.probe_services
def probe_services(self, handle, conn_id, callback): """Given a connected device, probe for its GATT services and characteristics Args: handle (int): a handle to the connection on the BLED112 dongle conn_id (int): a unique identifier for this connection on the DeviceManager ...
python
def probe_services(self, handle, conn_id, callback): """Given a connected device, probe for its GATT services and characteristics Args: handle (int): a handle to the connection on the BLED112 dongle conn_id (int): a unique identifier for this connection on the DeviceManager ...
[ "def", "probe_services", "(", "self", ",", "handle", ",", "conn_id", ",", "callback", ")", ":", "self", ".", "_command_task", ".", "async_command", "(", "[", "'_probe_services'", ",", "handle", "]", ",", "callback", ",", "{", "'connection_id'", ":", "conn_id...
Given a connected device, probe for its GATT services and characteristics Args: handle (int): a handle to the connection on the BLED112 dongle conn_id (int): a unique identifier for this connection on the DeviceManager that owns this adapter. callback (callab...
[ "Given", "a", "connected", "device", "probe", "for", "its", "GATT", "services", "and", "characteristics" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/bled112/iotile_transport_bled112/bled112.py#L721-L732
train
iotile/coretools
transport_plugins/bled112/iotile_transport_bled112/bled112.py
BLED112Adapter.probe_characteristics
def probe_characteristics(self, conn_id, handle, services): """Probe a device for all characteristics defined in its GATT table This routine must be called after probe_services and passed the services dictionary produced by that method. Args: handle (int): a handle to the c...
python
def probe_characteristics(self, conn_id, handle, services): """Probe a device for all characteristics defined in its GATT table This routine must be called after probe_services and passed the services dictionary produced by that method. Args: handle (int): a handle to the c...
[ "def", "probe_characteristics", "(", "self", ",", "conn_id", ",", "handle", ",", "services", ")", ":", "self", ".", "_command_task", ".", "async_command", "(", "[", "'_probe_characteristics'", ",", "handle", ",", "services", "]", ",", "self", ".", "_probe_char...
Probe a device for all characteristics defined in its GATT table This routine must be called after probe_services and passed the services dictionary produced by that method. Args: handle (int): a handle to the connection on the BLED112 dongle conn_id (int): a unique ide...
[ "Probe", "a", "device", "for", "all", "characteristics", "defined", "in", "its", "GATT", "table" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/bled112/iotile_transport_bled112/bled112.py#L734-L749
train
iotile/coretools
transport_plugins/bled112/iotile_transport_bled112/bled112.py
BLED112Adapter._on_disconnect
def _on_disconnect(self, result): """Callback called when disconnection command finishes Args: result (dict): result returned from diconnection command """ success, _, context = self._parse_return(result) callback = context['callback'] connection_id = conte...
python
def _on_disconnect(self, result): """Callback called when disconnection command finishes Args: result (dict): result returned from diconnection command """ success, _, context = self._parse_return(result) callback = context['callback'] connection_id = conte...
[ "def", "_on_disconnect", "(", "self", ",", "result", ")", ":", "success", ",", "_", ",", "context", "=", "self", ".", "_parse_return", "(", "result", ")", "callback", "=", "context", "[", "'callback'", "]", "connection_id", "=", "context", "[", "'connectio...
Callback called when disconnection command finishes Args: result (dict): result returned from diconnection command
[ "Callback", "called", "when", "disconnection", "command", "finishes" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/bled112/iotile_transport_bled112/bled112.py#L778-L792
train
iotile/coretools
transport_plugins/bled112/iotile_transport_bled112/bled112.py
BLED112Adapter._parse_return
def _parse_return(cls, result): """Extract the result, return value and context from a result object """ return_value = None success = result['result'] context = result['context'] if 'return_value' in result: return_value = result['return_value'] re...
python
def _parse_return(cls, result): """Extract the result, return value and context from a result object """ return_value = None success = result['result'] context = result['context'] if 'return_value' in result: return_value = result['return_value'] re...
[ "def", "_parse_return", "(", "cls", ",", "result", ")", ":", "return_value", "=", "None", "success", "=", "result", "[", "'result'", "]", "context", "=", "result", "[", "'context'", "]", "if", "'return_value'", "in", "result", ":", "return_value", "=", "re...
Extract the result, return value and context from a result object
[ "Extract", "the", "result", "return", "value", "and", "context", "from", "a", "result", "object" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/bled112/iotile_transport_bled112/bled112.py#L795-L806
train
iotile/coretools
transport_plugins/bled112/iotile_transport_bled112/bled112.py
BLED112Adapter._get_connection
def _get_connection(self, handle, expect_state=None): """Get a connection object, logging an error if its in an unexpected state """ conndata = self._connections.get(handle) if conndata and expect_state is not None and conndata['state'] != expect_state: self._logger.error("...
python
def _get_connection(self, handle, expect_state=None): """Get a connection object, logging an error if its in an unexpected state """ conndata = self._connections.get(handle) if conndata and expect_state is not None and conndata['state'] != expect_state: self._logger.error("...
[ "def", "_get_connection", "(", "self", ",", "handle", ",", "expect_state", "=", "None", ")", ":", "conndata", "=", "self", ".", "_connections", ".", "get", "(", "handle", ")", "if", "conndata", "and", "expect_state", "is", "not", "None", "and", "conndata",...
Get a connection object, logging an error if its in an unexpected state
[ "Get", "a", "connection", "object", "logging", "an", "error", "if", "its", "in", "an", "unexpected", "state" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/bled112/iotile_transport_bled112/bled112.py#L815-L824
train
iotile/coretools
transport_plugins/bled112/iotile_transport_bled112/bled112.py
BLED112Adapter._on_connection_finished
def _on_connection_finished(self, result): """Callback when the connection attempt to a BLE device has finished This function if called when a new connection is successfully completed Args: event (BGAPIPacket): Connection event """ success, retval, context = self._...
python
def _on_connection_finished(self, result): """Callback when the connection attempt to a BLE device has finished This function if called when a new connection is successfully completed Args: event (BGAPIPacket): Connection event """ success, retval, context = self._...
[ "def", "_on_connection_finished", "(", "self", ",", "result", ")", ":", "success", ",", "retval", ",", "context", "=", "self", ".", "_parse_return", "(", "result", ")", "conn_id", "=", "context", "[", "'connection_id'", "]", "callback", "=", "context", "[", ...
Callback when the connection attempt to a BLE device has finished This function if called when a new connection is successfully completed Args: event (BGAPIPacket): Connection event
[ "Callback", "when", "the", "connection", "attempt", "to", "a", "BLE", "device", "has", "finished" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/bled112/iotile_transport_bled112/bled112.py#L829-L855
train
iotile/coretools
transport_plugins/bled112/iotile_transport_bled112/bled112.py
BLED112Adapter._on_connection_failed
def _on_connection_failed(self, conn_id, handle, clean, reason): """Callback called from another thread when a connection attempt has failed. """ with self.count_lock: self.connecting_count -= 1 self._logger.info("_on_connection_failed conn_id=%d, reason=%s", conn_id, str(r...
python
def _on_connection_failed(self, conn_id, handle, clean, reason): """Callback called from another thread when a connection attempt has failed. """ with self.count_lock: self.connecting_count -= 1 self._logger.info("_on_connection_failed conn_id=%d, reason=%s", conn_id, str(r...
[ "def", "_on_connection_failed", "(", "self", ",", "conn_id", ",", "handle", ",", "clean", ",", "reason", ")", ":", "with", "self", ".", "count_lock", ":", "self", ".", "connecting_count", "-=", "1", "self", ".", "_logger", ".", "info", "(", "\"_on_connecti...
Callback called from another thread when a connection attempt has failed.
[ "Callback", "called", "from", "another", "thread", "when", "a", "connection", "attempt", "has", "failed", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/bled112/iotile_transport_bled112/bled112.py#L857-L882
train
iotile/coretools
transport_plugins/bled112/iotile_transport_bled112/bled112.py
BLED112Adapter._probe_services_finished
def _probe_services_finished(self, result): """Callback called after a BLE device has had its GATT table completely probed Args: result (dict): Parameters determined by the probe and context passed to the call to probe_device() """ #If we were disconnected b...
python
def _probe_services_finished(self, result): """Callback called after a BLE device has had its GATT table completely probed Args: result (dict): Parameters determined by the probe and context passed to the call to probe_device() """ #If we were disconnected b...
[ "def", "_probe_services_finished", "(", "self", ",", "result", ")", ":", "handle", "=", "result", "[", "'context'", "]", "[", "'handle'", "]", "conn_id", "=", "result", "[", "'context'", "]", "[", "'connection_id'", "]", "conndata", "=", "self", ".", "_get...
Callback called after a BLE device has had its GATT table completely probed Args: result (dict): Parameters determined by the probe and context passed to the call to probe_device()
[ "Callback", "called", "after", "a", "BLE", "device", "has", "had", "its", "GATT", "table", "completely", "probed" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/bled112/iotile_transport_bled112/bled112.py#L884-L909
train
iotile/coretools
transport_plugins/bled112/iotile_transport_bled112/bled112.py
BLED112Adapter._probe_characteristics_finished
def _probe_characteristics_finished(self, result): """Callback when BLE adapter has finished probing services and characteristics for a device Args: result (dict): Result from the probe_characteristics command """ handle = result['context']['handle'] conn_id = resul...
python
def _probe_characteristics_finished(self, result): """Callback when BLE adapter has finished probing services and characteristics for a device Args: result (dict): Result from the probe_characteristics command """ handle = result['context']['handle'] conn_id = resul...
[ "def", "_probe_characteristics_finished", "(", "self", ",", "result", ")", ":", "handle", "=", "result", "[", "'context'", "]", "[", "'handle'", "]", "conn_id", "=", "result", "[", "'context'", "]", "[", "'connection_id'", "]", "conndata", "=", "self", ".", ...
Callback when BLE adapter has finished probing services and characteristics for a device Args: result (dict): Result from the probe_characteristics command
[ "Callback", "when", "BLE", "adapter", "has", "finished", "probing", "services", "and", "characteristics", "for", "a", "device" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/bled112/iotile_transport_bled112/bled112.py#L911-L961
train
iotile/coretools
transport_plugins/bled112/iotile_transport_bled112/bled112.py
BLED112Adapter.periodic_callback
def periodic_callback(self): """Periodic cleanup tasks to maintain this adapter, should be called every second """ if self.stopped: return # Check if we should start scanning again if not self.scanning and len(self._connections) == 0 and self.connecting_count == 0: ...
python
def periodic_callback(self): """Periodic cleanup tasks to maintain this adapter, should be called every second """ if self.stopped: return # Check if we should start scanning again if not self.scanning and len(self._connections) == 0 and self.connecting_count == 0: ...
[ "def", "periodic_callback", "(", "self", ")", ":", "if", "self", ".", "stopped", ":", "return", "if", "not", "self", ".", "scanning", "and", "len", "(", "self", ".", "_connections", ")", "==", "0", "and", "self", ".", "connecting_count", "==", "0", ":"...
Periodic cleanup tasks to maintain this adapter, should be called every second
[ "Periodic", "cleanup", "tasks", "to", "maintain", "this", "adapter", "should", "be", "called", "every", "second" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/bled112/iotile_transport_bled112/bled112.py#L973-L984
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Errors.py
convert_to_BuildError
def convert_to_BuildError(status, exc_info=None): """ Convert any return code a BuildError Exception. :Parameters: - `status`: can either be a return code or an Exception. The buildError.status we set here will normally be used as the exit status of the "scons" process. """ if not e...
python
def convert_to_BuildError(status, exc_info=None): """ Convert any return code a BuildError Exception. :Parameters: - `status`: can either be a return code or an Exception. The buildError.status we set here will normally be used as the exit status of the "scons" process. """ if not e...
[ "def", "convert_to_BuildError", "(", "status", ",", "exc_info", "=", "None", ")", ":", "if", "not", "exc_info", "and", "isinstance", "(", "status", ",", "Exception", ")", ":", "exc_info", "=", "(", "status", ".", "__class__", ",", "status", ",", "None", ...
Convert any return code a BuildError Exception. :Parameters: - `status`: can either be a return code or an Exception. The buildError.status we set here will normally be used as the exit status of the "scons" process.
[ "Convert", "any", "return", "code", "a", "BuildError", "Exception", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Errors.py#L140-L223
train
iotile/coretools
iotilesensorgraph/iotile/sg/output_formats/config.py
format_config
def format_config(sensor_graph): """Extract the config variables from this sensor graph in ASCII format. Args: sensor_graph (SensorGraph): the sensor graph that we want to format Returns: str: The ascii output lines concatenated as a single string """ cmdfile = CommandFile("Config...
python
def format_config(sensor_graph): """Extract the config variables from this sensor graph in ASCII format. Args: sensor_graph (SensorGraph): the sensor graph that we want to format Returns: str: The ascii output lines concatenated as a single string """ cmdfile = CommandFile("Config...
[ "def", "format_config", "(", "sensor_graph", ")", ":", "cmdfile", "=", "CommandFile", "(", "\"Config Variables\"", ",", "\"1.0\"", ")", "for", "slot", "in", "sorted", "(", "sensor_graph", ".", "config_database", ",", "key", "=", "lambda", "x", ":", "x", ".",...
Extract the config variables from this sensor graph in ASCII format. Args: sensor_graph (SensorGraph): the sensor graph that we want to format Returns: str: The ascii output lines concatenated as a single string
[ "Extract", "the", "config", "variables", "from", "this", "sensor", "graph", "in", "ASCII", "format", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/output_formats/config.py#L12-L33
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/aixf77.py
generate
def generate(env): """ Add Builders and construction variables for the Visual Age FORTRAN compiler to an Environment. """ path, _f77, _shf77, version = get_xlf77(env) if path: _f77 = os.path.join(path, _f77) _shf77 = os.path.join(path, _shf77) f77.generate(env) env['F77...
python
def generate(env): """ Add Builders and construction variables for the Visual Age FORTRAN compiler to an Environment. """ path, _f77, _shf77, version = get_xlf77(env) if path: _f77 = os.path.join(path, _f77) _shf77 = os.path.join(path, _shf77) f77.generate(env) env['F77...
[ "def", "generate", "(", "env", ")", ":", "path", ",", "_f77", ",", "_shf77", ",", "version", "=", "get_xlf77", "(", "env", ")", "if", "path", ":", "_f77", "=", "os", ".", "path", ".", "join", "(", "path", ",", "_f77", ")", "_shf77", "=", "os", ...
Add Builders and construction variables for the Visual Age FORTRAN compiler to an Environment.
[ "Add", "Builders", "and", "construction", "variables", "for", "the", "Visual", "Age", "FORTRAN", "compiler", "to", "an", "Environment", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/aixf77.py#L53-L66
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Scanner/Dir.py
DirScanner
def DirScanner(**kw): """Return a prototype Scanner instance for scanning directories for on-disk files""" kw['node_factory'] = SCons.Node.FS.Entry kw['recursive'] = only_dirs return SCons.Scanner.Base(scan_on_disk, "DirScanner", **kw)
python
def DirScanner(**kw): """Return a prototype Scanner instance for scanning directories for on-disk files""" kw['node_factory'] = SCons.Node.FS.Entry kw['recursive'] = only_dirs return SCons.Scanner.Base(scan_on_disk, "DirScanner", **kw)
[ "def", "DirScanner", "(", "**", "kw", ")", ":", "kw", "[", "'node_factory'", "]", "=", "SCons", ".", "Node", ".", "FS", ".", "Entry", "kw", "[", "'recursive'", "]", "=", "only_dirs", "return", "SCons", ".", "Scanner", ".", "Base", "(", "scan_on_disk", ...
Return a prototype Scanner instance for scanning directories for on-disk files
[ "Return", "a", "prototype", "Scanner", "instance", "for", "scanning", "directories", "for", "on", "-", "disk", "files" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Scanner/Dir.py#L32-L37
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Scanner/Dir.py
DirEntryScanner
def DirEntryScanner(**kw): """Return a prototype Scanner instance for "scanning" directory Nodes for their in-memory entries""" kw['node_factory'] = SCons.Node.FS.Entry kw['recursive'] = None return SCons.Scanner.Base(scan_in_memory, "DirEntryScanner", **kw)
python
def DirEntryScanner(**kw): """Return a prototype Scanner instance for "scanning" directory Nodes for their in-memory entries""" kw['node_factory'] = SCons.Node.FS.Entry kw['recursive'] = None return SCons.Scanner.Base(scan_in_memory, "DirEntryScanner", **kw)
[ "def", "DirEntryScanner", "(", "**", "kw", ")", ":", "kw", "[", "'node_factory'", "]", "=", "SCons", ".", "Node", ".", "FS", ".", "Entry", "kw", "[", "'recursive'", "]", "=", "None", "return", "SCons", ".", "Scanner", ".", "Base", "(", "scan_in_memory"...
Return a prototype Scanner instance for "scanning" directory Nodes for their in-memory entries
[ "Return", "a", "prototype", "Scanner", "instance", "for", "scanning", "directory", "Nodes", "for", "their", "in", "-", "memory", "entries" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Scanner/Dir.py#L39-L44
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Scanner/Dir.py
scan_on_disk
def scan_on_disk(node, env, path=()): """ Scans a directory for on-disk files and directories therein. Looking up the entries will add these to the in-memory Node tree representation of the file system, so all we have to do is just that and then call the in-memory scanning function. """ try...
python
def scan_on_disk(node, env, path=()): """ Scans a directory for on-disk files and directories therein. Looking up the entries will add these to the in-memory Node tree representation of the file system, so all we have to do is just that and then call the in-memory scanning function. """ try...
[ "def", "scan_on_disk", "(", "node", ",", "env", ",", "path", "=", "(", ")", ")", ":", "try", ":", "flist", "=", "node", ".", "fs", ".", "listdir", "(", "node", ".", "get_abspath", "(", ")", ")", "except", "(", "IOError", ",", "OSError", ")", ":",...
Scans a directory for on-disk files and directories therein. Looking up the entries will add these to the in-memory Node tree representation of the file system, so all we have to do is just that and then call the in-memory scanning function.
[ "Scans", "a", "directory", "for", "on", "-", "disk", "files", "and", "directories", "therein", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Scanner/Dir.py#L71-L88
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Scanner/Dir.py
scan_in_memory
def scan_in_memory(node, env, path=()): """ "Scans" a Node.FS.Dir for its in-memory entries. """ try: entries = node.entries except AttributeError: # It's not a Node.FS.Dir (or doesn't look enough like one for # our purposes), which can happen if a target list containing ...
python
def scan_in_memory(node, env, path=()): """ "Scans" a Node.FS.Dir for its in-memory entries. """ try: entries = node.entries except AttributeError: # It's not a Node.FS.Dir (or doesn't look enough like one for # our purposes), which can happen if a target list containing ...
[ "def", "scan_in_memory", "(", "node", ",", "env", ",", "path", "=", "(", ")", ")", ":", "try", ":", "entries", "=", "node", ".", "entries", "except", "AttributeError", ":", "return", "[", "]", "entry_list", "=", "sorted", "(", "filter", "(", "do_not_sc...
"Scans" a Node.FS.Dir for its in-memory entries.
[ "Scans", "a", "Node", ".", "FS", ".", "Dir", "for", "its", "in", "-", "memory", "entries", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Scanner/Dir.py#L90-L103
train
iotile/coretools
iotileemulate/iotile/emulate/internal/response.py
GenericResponse.set_result
def set_result(self, result): """Finish this response and set the result.""" if self.is_finished(): raise InternalError("set_result called on finished AsynchronousResponse", result=self._result, exception=self._exception) self._result = result ...
python
def set_result(self, result): """Finish this response and set the result.""" if self.is_finished(): raise InternalError("set_result called on finished AsynchronousResponse", result=self._result, exception=self._exception) self._result = result ...
[ "def", "set_result", "(", "self", ",", "result", ")", ":", "if", "self", ".", "is_finished", "(", ")", ":", "raise", "InternalError", "(", "\"set_result called on finished AsynchronousResponse\"", ",", "result", "=", "self", ".", "_result", ",", "exception", "="...
Finish this response and set the result.
[ "Finish", "this", "response", "and", "set", "the", "result", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/internal/response.py#L23-L31
train
iotile/coretools
iotileemulate/iotile/emulate/internal/response.py
GenericResponse.set_exception
def set_exception(self, exc_class, exc_info, exc_stack): """Set an exception as the result of this operation. Args: exc_class (object): The exception type """ if self.is_finished(): raise InternalError("set_exception called on finished AsynchronousResponse", ...
python
def set_exception(self, exc_class, exc_info, exc_stack): """Set an exception as the result of this operation. Args: exc_class (object): The exception type """ if self.is_finished(): raise InternalError("set_exception called on finished AsynchronousResponse", ...
[ "def", "set_exception", "(", "self", ",", "exc_class", ",", "exc_info", ",", "exc_stack", ")", ":", "if", "self", ".", "is_finished", "(", ")", ":", "raise", "InternalError", "(", "\"set_exception called on finished AsynchronousResponse\"", ",", "result", "=", "se...
Set an exception as the result of this operation. Args: exc_class (object): The exception type
[ "Set", "an", "exception", "as", "the", "result", "of", "this", "operation", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/internal/response.py#L33-L44
train
iotile/coretools
scripts/status.py
get_released_versions
def get_released_versions(component): """Get all released versions of the given component ordered newest to oldest """ releases = get_tags() releases = sorted([(x[0], [int(y) for y in x[1].split('.')]) for x in releases], key=lambda x: x[1])[::-1] return [(x[0], ".".join(map(str, x[1]))) for x in ...
python
def get_released_versions(component): """Get all released versions of the given component ordered newest to oldest """ releases = get_tags() releases = sorted([(x[0], [int(y) for y in x[1].split('.')]) for x in releases], key=lambda x: x[1])[::-1] return [(x[0], ".".join(map(str, x[1]))) for x in ...
[ "def", "get_released_versions", "(", "component", ")", ":", "releases", "=", "get_tags", "(", ")", "releases", "=", "sorted", "(", "[", "(", "x", "[", "0", "]", ",", "[", "int", "(", "y", ")", "for", "y", "in", "x", "[", "1", "]", ".", "split", ...
Get all released versions of the given component ordered newest to oldest
[ "Get", "all", "released", "versions", "of", "the", "given", "component", "ordered", "newest", "to", "oldest" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/scripts/status.py#L22-L29
train
iotile/coretools
iotilebuild/iotile/build/config/site_scons/dependencies.py
load_dependencies
def load_dependencies(orig_tile, build_env): """Load all tile dependencies and filter only the products from each that we use build_env must define the architecture that we are targeting so that we get the correct dependency list and products per dependency since that may change when building for diffe...
python
def load_dependencies(orig_tile, build_env): """Load all tile dependencies and filter only the products from each that we use build_env must define the architecture that we are targeting so that we get the correct dependency list and products per dependency since that may change when building for diffe...
[ "def", "load_dependencies", "(", "orig_tile", ",", "build_env", ")", ":", "if", "'DEPENDENCIES'", "not", "in", "build_env", ":", "build_env", "[", "'DEPENDENCIES'", "]", "=", "[", "]", "dep_targets", "=", "[", "]", "chip", "=", "build_env", "[", "'ARCH'", ...
Load all tile dependencies and filter only the products from each that we use build_env must define the architecture that we are targeting so that we get the correct dependency list and products per dependency since that may change when building for different architectures
[ "Load", "all", "tile", "dependencies", "and", "filter", "only", "the", "products", "from", "each", "that", "we", "use" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/site_scons/dependencies.py#L9-L49
train
iotile/coretools
iotilebuild/iotile/build/config/site_scons/dependencies.py
find_dependency_wheels
def find_dependency_wheels(tile): """Return a list of all python wheel objects created by dependencies of this tile Args: tile (IOTile): Tile that we should scan for dependencies Returns: list: A list of paths to dependency wheels """ return [os.path.join(x.folder, 'python', x.sup...
python
def find_dependency_wheels(tile): """Return a list of all python wheel objects created by dependencies of this tile Args: tile (IOTile): Tile that we should scan for dependencies Returns: list: A list of paths to dependency wheels """ return [os.path.join(x.folder, 'python', x.sup...
[ "def", "find_dependency_wheels", "(", "tile", ")", ":", "return", "[", "os", ".", "path", ".", "join", "(", "x", ".", "folder", ",", "'python'", ",", "x", ".", "support_wheel", ")", "for", "x", "in", "_iter_dependencies", "(", "tile", ")", "if", "x", ...
Return a list of all python wheel objects created by dependencies of this tile Args: tile (IOTile): Tile that we should scan for dependencies Returns: list: A list of paths to dependency wheels
[ "Return", "a", "list", "of", "all", "python", "wheel", "objects", "created", "by", "dependencies", "of", "this", "tile" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/site_scons/dependencies.py#L60-L70
train
iotile/coretools
iotilecore/iotile/core/dev/semver.py
SemanticVersionRange._check_ver_range
def _check_ver_range(self, version, ver_range): """Check if version is included in ver_range """ lower, upper, lower_inc, upper_inc = ver_range #If the range extends over everything, we automatically match if lower is None and upper is None: return True if ...
python
def _check_ver_range(self, version, ver_range): """Check if version is included in ver_range """ lower, upper, lower_inc, upper_inc = ver_range #If the range extends over everything, we automatically match if lower is None and upper is None: return True if ...
[ "def", "_check_ver_range", "(", "self", ",", "version", ",", "ver_range", ")", ":", "lower", ",", "upper", ",", "lower_inc", ",", "upper_inc", "=", "ver_range", "if", "lower", "is", "None", "and", "upper", "is", "None", ":", "return", "True", "if", "lowe...
Check if version is included in ver_range
[ "Check", "if", "version", "is", "included", "in", "ver_range" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/dev/semver.py#L298-L331
train
iotile/coretools
iotilecore/iotile/core/dev/semver.py
SemanticVersionRange._check_insersection
def _check_insersection(self, version, ranges): """Check that a version is inside all of a list of ranges""" for ver_range in ranges: if not self._check_ver_range(version, ver_range): return False return True
python
def _check_insersection(self, version, ranges): """Check that a version is inside all of a list of ranges""" for ver_range in ranges: if not self._check_ver_range(version, ver_range): return False return True
[ "def", "_check_insersection", "(", "self", ",", "version", ",", "ranges", ")", ":", "for", "ver_range", "in", "ranges", ":", "if", "not", "self", ".", "_check_ver_range", "(", "version", ",", "ver_range", ")", ":", "return", "False", "return", "True" ]
Check that a version is inside all of a list of ranges
[ "Check", "that", "a", "version", "is", "inside", "all", "of", "a", "list", "of", "ranges" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/dev/semver.py#L333-L340
train
iotile/coretools
iotilecore/iotile/core/dev/semver.py
SemanticVersionRange.check
def check(self, version): """Check that a version is inside this SemanticVersionRange Args: version (SemanticVersion): The version to check Returns: bool: True if the version is included in the range, False if not """ for disjunct in self._disjuncts: ...
python
def check(self, version): """Check that a version is inside this SemanticVersionRange Args: version (SemanticVersion): The version to check Returns: bool: True if the version is included in the range, False if not """ for disjunct in self._disjuncts: ...
[ "def", "check", "(", "self", ",", "version", ")", ":", "for", "disjunct", "in", "self", ".", "_disjuncts", ":", "if", "self", ".", "_check_insersection", "(", "version", ",", "disjunct", ")", ":", "return", "True", "return", "False" ]
Check that a version is inside this SemanticVersionRange Args: version (SemanticVersion): The version to check Returns: bool: True if the version is included in the range, False if not
[ "Check", "that", "a", "version", "is", "inside", "this", "SemanticVersionRange" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/dev/semver.py#L342-L356
train
iotile/coretools
iotilecore/iotile/core/dev/semver.py
SemanticVersionRange.filter
def filter(self, versions, key=lambda x: x): """Filter all of the versions in an iterable that match this version range Args: versions (iterable): An iterable of SemanticVersion objects Returns: list: A list of the SemanticVersion objects that matched this range ...
python
def filter(self, versions, key=lambda x: x): """Filter all of the versions in an iterable that match this version range Args: versions (iterable): An iterable of SemanticVersion objects Returns: list: A list of the SemanticVersion objects that matched this range ...
[ "def", "filter", "(", "self", ",", "versions", ",", "key", "=", "lambda", "x", ":", "x", ")", ":", "return", "[", "x", "for", "x", "in", "versions", "if", "self", ".", "check", "(", "key", "(", "x", ")", ")", "]" ]
Filter all of the versions in an iterable that match this version range Args: versions (iterable): An iterable of SemanticVersion objects Returns: list: A list of the SemanticVersion objects that matched this range
[ "Filter", "all", "of", "the", "versions", "in", "an", "iterable", "that", "match", "this", "version", "range" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/dev/semver.py#L358-L368
train
iotile/coretools
iotilecore/iotile/core/dev/semver.py
SemanticVersionRange.FromString
def FromString(cls, range_string): """Parse a version range string into a SemanticVersionRange Currently, the only possible range strings are: ^X.Y.Z - matches all versions with the same leading nonzero digit greater than or equal the given range. * - matches everything ...
python
def FromString(cls, range_string): """Parse a version range string into a SemanticVersionRange Currently, the only possible range strings are: ^X.Y.Z - matches all versions with the same leading nonzero digit greater than or equal the given range. * - matches everything ...
[ "def", "FromString", "(", "cls", ",", "range_string", ")", ":", "disjuncts", "=", "None", "range_string", "=", "range_string", ".", "strip", "(", ")", "if", "len", "(", "range_string", ")", "==", "0", ":", "raise", "ArgumentError", "(", "\"You must pass a fi...
Parse a version range string into a SemanticVersionRange Currently, the only possible range strings are: ^X.Y.Z - matches all versions with the same leading nonzero digit greater than or equal the given range. * - matches everything =X.Y.Z - matches only the exact version g...
[ "Parse", "a", "version", "range", "string", "into", "a", "SemanticVersionRange" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/dev/semver.py#L371-L433
train
iotile/coretools
iotilesensorgraph/iotile/sg/sim/hosted_executor.py
SemihostedRPCExecutor._call_rpc
def _call_rpc(self, address, rpc_id, payload): """Call an RPC with the given information and return its response. Must raise a hardware error of the appropriate kind if the RPC can not be executed correctly. Otherwise it should return the binary response payload received from the RPC. ...
python
def _call_rpc(self, address, rpc_id, payload): """Call an RPC with the given information and return its response. Must raise a hardware error of the appropriate kind if the RPC can not be executed correctly. Otherwise it should return the binary response payload received from the RPC. ...
[ "def", "_call_rpc", "(", "self", ",", "address", ",", "rpc_id", ",", "payload", ")", ":", "status", ",", "response", "=", "self", ".", "hw", ".", "stream", ".", "send_rpc", "(", "address", ",", "rpc_id", ",", "payload", ",", "timeout", "=", "1.1", ")...
Call an RPC with the given information and return its response. Must raise a hardware error of the appropriate kind if the RPC can not be executed correctly. Otherwise it should return the binary response payload received from the RPC. Args: address (int): The address of t...
[ "Call", "an", "RPC", "with", "the", "given", "information", "and", "return", "its", "response", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/sim/hosted_executor.py#L38-L56
train
iotile/coretools
iotilecore/iotile/core/hw/reports/individual_format.py
IndividualReadingReport.FromReadings
def FromReadings(cls, uuid, readings): """Generate an instance of the report format from a list of readings and a uuid """ if len(readings) != 1: raise ArgumentError("IndividualReading reports must be created with exactly one reading", num_readings=le...
python
def FromReadings(cls, uuid, readings): """Generate an instance of the report format from a list of readings and a uuid """ if len(readings) != 1: raise ArgumentError("IndividualReading reports must be created with exactly one reading", num_readings=le...
[ "def", "FromReadings", "(", "cls", ",", "uuid", ",", "readings", ")", ":", "if", "len", "(", "readings", ")", "!=", "1", ":", "raise", "ArgumentError", "(", "\"IndividualReading reports must be created with exactly one reading\"", ",", "num_readings", "=", "len", ...
Generate an instance of the report format from a list of readings and a uuid
[ "Generate", "an", "instance", "of", "the", "report", "format", "from", "a", "list", "of", "readings", "and", "a", "uuid" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/reports/individual_format.py#L39-L49
train
iotile/coretools
iotilecore/iotile/core/hw/reports/individual_format.py
IndividualReadingReport.decode
def decode(self): """Decode this report into a single reading """ fmt, _, stream, uuid, sent_timestamp, reading_timestamp, reading_value = unpack("<BBHLLLL", self.raw_report) assert fmt == 0 # Estimate the UTC time when this device was turned on time_base = self.receive...
python
def decode(self): """Decode this report into a single reading """ fmt, _, stream, uuid, sent_timestamp, reading_timestamp, reading_value = unpack("<BBHLLLL", self.raw_report) assert fmt == 0 # Estimate the UTC time when this device was turned on time_base = self.receive...
[ "def", "decode", "(", "self", ")", ":", "fmt", ",", "_", ",", "stream", ",", "uuid", ",", "sent_timestamp", ",", "reading_timestamp", ",", "reading_value", "=", "unpack", "(", "\"<BBHLLLL\"", ",", "self", ".", "raw_report", ")", "assert", "fmt", "==", "0...
Decode this report into a single reading
[ "Decode", "this", "report", "into", "a", "single", "reading" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/reports/individual_format.py#L51-L65
train
iotile/coretools
iotilecore/iotile/core/hw/reports/individual_format.py
IndividualReadingReport.encode
def encode(self): """Turn this report into a serialized bytearray that could be decoded with a call to decode""" reading = self.visible_readings[0] data = struct.pack("<BBHLLLL", 0, 0, reading.stream, self.origin, self.sent_timestamp, reading.raw_time, reading.value) ...
python
def encode(self): """Turn this report into a serialized bytearray that could be decoded with a call to decode""" reading = self.visible_readings[0] data = struct.pack("<BBHLLLL", 0, 0, reading.stream, self.origin, self.sent_timestamp, reading.raw_time, reading.value) ...
[ "def", "encode", "(", "self", ")", ":", "reading", "=", "self", ".", "visible_readings", "[", "0", "]", "data", "=", "struct", ".", "pack", "(", "\"<BBHLLLL\"", ",", "0", ",", "0", ",", "reading", ".", "stream", ",", "self", ".", "origin", ",", "se...
Turn this report into a serialized bytearray that could be decoded with a call to decode
[ "Turn", "this", "report", "into", "a", "serialized", "bytearray", "that", "could", "be", "decoded", "with", "a", "call", "to", "decode" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/reports/individual_format.py#L67-L74
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/tex.py
is_LaTeX
def is_LaTeX(flist,env,abspath): """Scan a file list to decide if it's TeX- or LaTeX-flavored.""" # We need to scan files that are included in case the # \documentclass command is in them. # get path list from both env['TEXINPUTS'] and env['ENV']['TEXINPUTS'] savedpath = modify_env_var(env, 'TEXIN...
python
def is_LaTeX(flist,env,abspath): """Scan a file list to decide if it's TeX- or LaTeX-flavored.""" # We need to scan files that are included in case the # \documentclass command is in them. # get path list from both env['TEXINPUTS'] and env['ENV']['TEXINPUTS'] savedpath = modify_env_var(env, 'TEXIN...
[ "def", "is_LaTeX", "(", "flist", ",", "env", ",", "abspath", ")", ":", "savedpath", "=", "modify_env_var", "(", "env", ",", "'TEXINPUTS'", ",", "abspath", ")", "paths", "=", "env", "[", "'ENV'", "]", "[", "'TEXINPUTS'", "]", "if", "SCons", ".", "Util",...
Scan a file list to decide if it's TeX- or LaTeX-flavored.
[ "Scan", "a", "file", "list", "to", "decide", "if", "it", "s", "TeX", "-", "or", "LaTeX", "-", "flavored", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/tex.py#L495-L560
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/tex.py
TeXLaTeXStrFunction
def TeXLaTeXStrFunction(target = None, source= None, env=None): """A strfunction for TeX and LaTeX that scans the source file to decide the "flavor" of the source and then returns the appropriate command string.""" if env.GetOption("no_exec"): # find these paths for use in is_LaTeX to search fo...
python
def TeXLaTeXStrFunction(target = None, source= None, env=None): """A strfunction for TeX and LaTeX that scans the source file to decide the "flavor" of the source and then returns the appropriate command string.""" if env.GetOption("no_exec"): # find these paths for use in is_LaTeX to search fo...
[ "def", "TeXLaTeXStrFunction", "(", "target", "=", "None", ",", "source", "=", "None", ",", "env", "=", "None", ")", ":", "if", "env", ".", "GetOption", "(", "\"no_exec\"", ")", ":", "basedir", "=", "os", ".", "path", ".", "split", "(", "str", "(", ...
A strfunction for TeX and LaTeX that scans the source file to decide the "flavor" of the source and then returns the appropriate command string.
[ "A", "strfunction", "for", "TeX", "and", "LaTeX", "that", "scans", "the", "source", "file", "to", "decide", "the", "flavor", "of", "the", "source", "and", "then", "returns", "the", "appropriate", "command", "string", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/tex.py#L581-L597
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/tex.py
tex_eps_emitter
def tex_eps_emitter(target, source, env): """An emitter for TeX and LaTeX sources when executing tex or latex. It will accept .ps and .eps graphics files """ (target, source) = tex_emitter_core(target, source, env, TexGraphics) return (target, source)
python
def tex_eps_emitter(target, source, env): """An emitter for TeX and LaTeX sources when executing tex or latex. It will accept .ps and .eps graphics files """ (target, source) = tex_emitter_core(target, source, env, TexGraphics) return (target, source)
[ "def", "tex_eps_emitter", "(", "target", ",", "source", ",", "env", ")", ":", "(", "target", ",", "source", ")", "=", "tex_emitter_core", "(", "target", ",", "source", ",", "env", ",", "TexGraphics", ")", "return", "(", "target", ",", "source", ")" ]
An emitter for TeX and LaTeX sources when executing tex or latex. It will accept .ps and .eps graphics files
[ "An", "emitter", "for", "TeX", "and", "LaTeX", "sources", "when", "executing", "tex", "or", "latex", ".", "It", "will", "accept", ".", "ps", "and", ".", "eps", "graphics", "files" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/tex.py#L599-L606
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/tex.py
tex_pdf_emitter
def tex_pdf_emitter(target, source, env): """An emitter for TeX and LaTeX sources when executing pdftex or pdflatex. It will accept graphics files of types .pdf, .jpg, .png, .gif, and .tif """ (target, source) = tex_emitter_core(target, source, env, LatexGraphics) return (target, source)
python
def tex_pdf_emitter(target, source, env): """An emitter for TeX and LaTeX sources when executing pdftex or pdflatex. It will accept graphics files of types .pdf, .jpg, .png, .gif, and .tif """ (target, source) = tex_emitter_core(target, source, env, LatexGraphics) return (target, source)
[ "def", "tex_pdf_emitter", "(", "target", ",", "source", ",", "env", ")", ":", "(", "target", ",", "source", ")", "=", "tex_emitter_core", "(", "target", ",", "source", ",", "env", ",", "LatexGraphics", ")", "return", "(", "target", ",", "source", ")" ]
An emitter for TeX and LaTeX sources when executing pdftex or pdflatex. It will accept graphics files of types .pdf, .jpg, .png, .gif, and .tif
[ "An", "emitter", "for", "TeX", "and", "LaTeX", "sources", "when", "executing", "pdftex", "or", "pdflatex", ".", "It", "will", "accept", "graphics", "files", "of", "types", ".", "pdf", ".", "jpg", ".", "png", ".", "gif", "and", ".", "tif" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/tex.py#L608-L615
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/tex.py
generate
def generate(env): """Add Builders and construction variables for TeX to an Environment.""" global TeXLaTeXAction if TeXLaTeXAction is None: TeXLaTeXAction = SCons.Action.Action(TeXLaTeXFunction, strfunction=TeXLaTeXStrFunction) env.AppendUnique(LATEXSUFFIXES=SCon...
python
def generate(env): """Add Builders and construction variables for TeX to an Environment.""" global TeXLaTeXAction if TeXLaTeXAction is None: TeXLaTeXAction = SCons.Action.Action(TeXLaTeXFunction, strfunction=TeXLaTeXStrFunction) env.AppendUnique(LATEXSUFFIXES=SCon...
[ "def", "generate", "(", "env", ")", ":", "global", "TeXLaTeXAction", "if", "TeXLaTeXAction", "is", "None", ":", "TeXLaTeXAction", "=", "SCons", ".", "Action", ".", "Action", "(", "TeXLaTeXFunction", ",", "strfunction", "=", "TeXLaTeXStrFunction", ")", "env", "...
Add Builders and construction variables for TeX to an Environment.
[ "Add", "Builders", "and", "construction", "variables", "for", "TeX", "to", "an", "Environment", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/tex.py#L831-L848
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/MSCommon/common.py
is_win64
def is_win64(): """Return true if running on windows 64 bits. Works whether python itself runs in 64 bits or 32 bits.""" # Unfortunately, python does not provide a useful way to determine # if the underlying Windows OS is 32-bit or 64-bit. Worse, whether # the Python itself is 32-bit or 64-bit aff...
python
def is_win64(): """Return true if running on windows 64 bits. Works whether python itself runs in 64 bits or 32 bits.""" # Unfortunately, python does not provide a useful way to determine # if the underlying Windows OS is 32-bit or 64-bit. Worse, whether # the Python itself is 32-bit or 64-bit aff...
[ "def", "is_win64", "(", ")", ":", "global", "_is_win64", "if", "_is_win64", "is", "None", ":", "_is_win64", "=", "False", "if", "os", ".", "environ", ".", "get", "(", "'PROCESSOR_ARCHITECTURE'", ",", "'x86'", ")", "!=", "'x86'", ":", "_is_win64", "=", "T...
Return true if running on windows 64 bits. Works whether python itself runs in 64 bits or 32 bits.
[ "Return", "true", "if", "running", "on", "windows", "64", "bits", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/MSCommon/common.py#L55-L83
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/MSCommon/common.py
has_reg
def has_reg(value): """Return True if the given key exists in HKEY_LOCAL_MACHINE, False otherwise.""" try: SCons.Util.RegOpenKeyEx(SCons.Util.HKEY_LOCAL_MACHINE, value) ret = True except SCons.Util.WinError: ret = False return ret
python
def has_reg(value): """Return True if the given key exists in HKEY_LOCAL_MACHINE, False otherwise.""" try: SCons.Util.RegOpenKeyEx(SCons.Util.HKEY_LOCAL_MACHINE, value) ret = True except SCons.Util.WinError: ret = False return ret
[ "def", "has_reg", "(", "value", ")", ":", "try", ":", "SCons", ".", "Util", ".", "RegOpenKeyEx", "(", "SCons", ".", "Util", ".", "HKEY_LOCAL_MACHINE", ",", "value", ")", "ret", "=", "True", "except", "SCons", ".", "Util", ".", "WinError", ":", "ret", ...
Return True if the given key exists in HKEY_LOCAL_MACHINE, False otherwise.
[ "Return", "True", "if", "the", "given", "key", "exists", "in", "HKEY_LOCAL_MACHINE", "False", "otherwise", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/MSCommon/common.py#L89-L97
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/MSCommon/common.py
normalize_env
def normalize_env(env, keys, force=False): """Given a dictionary representing a shell environment, add the variables from os.environ needed for the processing of .bat files; the keys are controlled by the keys argument. It also makes sure the environment values are correctly encoded. If force=True...
python
def normalize_env(env, keys, force=False): """Given a dictionary representing a shell environment, add the variables from os.environ needed for the processing of .bat files; the keys are controlled by the keys argument. It also makes sure the environment values are correctly encoded. If force=True...
[ "def", "normalize_env", "(", "env", ",", "keys", ",", "force", "=", "False", ")", ":", "normenv", "=", "{", "}", "if", "env", ":", "for", "k", "in", "list", "(", "env", ".", "keys", "(", ")", ")", ":", "normenv", "[", "k", "]", "=", "copy", "...
Given a dictionary representing a shell environment, add the variables from os.environ needed for the processing of .bat files; the keys are controlled by the keys argument. It also makes sure the environment values are correctly encoded. If force=True, then all of the key values that exist are copied...
[ "Given", "a", "dictionary", "representing", "a", "shell", "environment", "add", "the", "variables", "from", "os", ".", "environ", "needed", "for", "the", "processing", "of", ".", "bat", "files", ";", "the", "keys", "are", "controlled", "by", "the", "keys", ...
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/MSCommon/common.py#L101-L141
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/MSCommon/common.py
get_output
def get_output(vcbat, args = None, env = None): """Parse the output of given bat file, with given args.""" if env is None: # Create a blank environment, for use in launching the tools env = SCons.Environment.Environment(tools=[]) # TODO: This is a hard-coded list of the variables that (ma...
python
def get_output(vcbat, args = None, env = None): """Parse the output of given bat file, with given args.""" if env is None: # Create a blank environment, for use in launching the tools env = SCons.Environment.Environment(tools=[]) # TODO: This is a hard-coded list of the variables that (ma...
[ "def", "get_output", "(", "vcbat", ",", "args", "=", "None", ",", "env", "=", "None", ")", ":", "if", "env", "is", "None", ":", "env", "=", "SCons", ".", "Environment", ".", "Environment", "(", "tools", "=", "[", "]", ")", "vs_vc_vars", "=", "[", ...
Parse the output of given bat file, with given args.
[ "Parse", "the", "output", "of", "given", "bat", "file", "with", "given", "args", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/MSCommon/common.py#L143-L206
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/default.py
generate
def generate(env): """Add default tools.""" for t in SCons.Tool.tool_list(env['PLATFORM'], env): SCons.Tool.Tool(t)(env)
python
def generate(env): """Add default tools.""" for t in SCons.Tool.tool_list(env['PLATFORM'], env): SCons.Tool.Tool(t)(env)
[ "def", "generate", "(", "env", ")", ":", "for", "t", "in", "SCons", ".", "Tool", ".", "tool_list", "(", "env", "[", "'PLATFORM'", "]", ",", "env", ")", ":", "SCons", ".", "Tool", ".", "Tool", "(", "t", ")", "(", "env", ")" ]
Add default tools.
[ "Add", "default", "tools", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/default.py#L38-L41
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/PathList.py
_PathList.subst_path
def subst_path(self, env, target, source): """ Performs construction variable substitution on a pre-digested PathList for a specific target and source. """ result = [] for type, value in self.pathlist: if type == TYPE_STRING_SUBST: value = env....
python
def subst_path(self, env, target, source): """ Performs construction variable substitution on a pre-digested PathList for a specific target and source. """ result = [] for type, value in self.pathlist: if type == TYPE_STRING_SUBST: value = env....
[ "def", "subst_path", "(", "self", ",", "env", ",", "target", ",", "source", ")", ":", "result", "=", "[", "]", "for", "type", ",", "value", "in", "self", ".", "pathlist", ":", "if", "type", "==", "TYPE_STRING_SUBST", ":", "value", "=", "env", ".", ...
Performs construction variable substitution on a pre-digested PathList for a specific target and source.
[ "Performs", "construction", "variable", "substitution", "on", "a", "pre", "-", "digested", "PathList", "for", "a", "specific", "target", "and", "source", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/PathList.py#L123-L143
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/PathList.py
PathListCache._PathList_key
def _PathList_key(self, pathlist): """ Returns the key for memoization of PathLists. Note that we want this to be pretty quick, so we don't completely canonicalize all forms of the same list. For example, 'dir1:$ROOT/dir2' and ['$ROOT/dir1', 'dir'] may logically represe...
python
def _PathList_key(self, pathlist): """ Returns the key for memoization of PathLists. Note that we want this to be pretty quick, so we don't completely canonicalize all forms of the same list. For example, 'dir1:$ROOT/dir2' and ['$ROOT/dir1', 'dir'] may logically represe...
[ "def", "_PathList_key", "(", "self", ",", "pathlist", ")", ":", "if", "SCons", ".", "Util", ".", "is_Sequence", "(", "pathlist", ")", ":", "pathlist", "=", "tuple", "(", "SCons", ".", "Util", ".", "flatten", "(", "pathlist", ")", ")", "return", "pathli...
Returns the key for memoization of PathLists. Note that we want this to be pretty quick, so we don't completely canonicalize all forms of the same list. For example, 'dir1:$ROOT/dir2' and ['$ROOT/dir1', 'dir'] may logically represent the same list if you're executing from $ROOT, but ...
[ "Returns", "the", "key", "for", "memoization", "of", "PathLists", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/PathList.py#L177-L192
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/PathList.py
PathListCache.PathList
def PathList(self, pathlist): """ Returns the cached _PathList object for the specified pathlist, creating and caching a new object as necessary. """ pathlist = self._PathList_key(pathlist) try: memo_dict = self._memo['PathList'] except KeyError: ...
python
def PathList(self, pathlist): """ Returns the cached _PathList object for the specified pathlist, creating and caching a new object as necessary. """ pathlist = self._PathList_key(pathlist) try: memo_dict = self._memo['PathList'] except KeyError: ...
[ "def", "PathList", "(", "self", ",", "pathlist", ")", ":", "pathlist", "=", "self", ".", "_PathList_key", "(", "pathlist", ")", "try", ":", "memo_dict", "=", "self", ".", "_memo", "[", "'PathList'", "]", "except", "KeyError", ":", "memo_dict", "=", "{", ...
Returns the cached _PathList object for the specified pathlist, creating and caching a new object as necessary.
[ "Returns", "the", "cached", "_PathList", "object", "for", "the", "specified", "pathlist", "creating", "and", "caching", "a", "new", "object", "as", "necessary", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/PathList.py#L195-L216
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Defaults.py
DefaultEnvironment
def DefaultEnvironment(*args, **kw): """ Initial public entry point for creating the default construction Environment. After creating the environment, we overwrite our name (DefaultEnvironment) with the _fetch_DefaultEnvironment() function, which more efficiently returns the initialized default...
python
def DefaultEnvironment(*args, **kw): """ Initial public entry point for creating the default construction Environment. After creating the environment, we overwrite our name (DefaultEnvironment) with the _fetch_DefaultEnvironment() function, which more efficiently returns the initialized default...
[ "def", "DefaultEnvironment", "(", "*", "args", ",", "**", "kw", ")", ":", "global", "_default_env", "if", "not", "_default_env", ":", "import", "SCons", ".", "Util", "_default_env", "=", "SCons", ".", "Environment", ".", "Environment", "(", "*", "args", ",...
Initial public entry point for creating the default construction Environment. After creating the environment, we overwrite our name (DefaultEnvironment) with the _fetch_DefaultEnvironment() function, which more efficiently returns the initialized default construction environment without checking fo...
[ "Initial", "public", "entry", "point", "for", "creating", "the", "default", "construction", "Environment", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Defaults.py#L68-L95
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Defaults.py
_concat
def _concat(prefix, list, suffix, env, f=lambda x: x, target=None, source=None): """ Creates a new list from 'list' by first interpolating each element in the list using the 'env' dictionary and then calling f on the list, and finally calling _concat_ixes to concatenate 'prefix' and 'suffix' onto ea...
python
def _concat(prefix, list, suffix, env, f=lambda x: x, target=None, source=None): """ Creates a new list from 'list' by first interpolating each element in the list using the 'env' dictionary and then calling f on the list, and finally calling _concat_ixes to concatenate 'prefix' and 'suffix' onto ea...
[ "def", "_concat", "(", "prefix", ",", "list", ",", "suffix", ",", "env", ",", "f", "=", "lambda", "x", ":", "x", ",", "target", "=", "None", ",", "source", "=", "None", ")", ":", "if", "not", "list", ":", "return", "list", "l", "=", "f", "(", ...
Creates a new list from 'list' by first interpolating each element in the list using the 'env' dictionary and then calling f on the list, and finally calling _concat_ixes to concatenate 'prefix' and 'suffix' onto each element of the list.
[ "Creates", "a", "new", "list", "from", "list", "by", "first", "interpolating", "each", "element", "in", "the", "list", "using", "the", "env", "dictionary", "and", "then", "calling", "f", "on", "the", "list", "and", "finally", "calling", "_concat_ixes", "to",...
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Defaults.py#L344-L358
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Defaults.py
_concat_ixes
def _concat_ixes(prefix, list, suffix, env): """ Creates a new list from 'list' by concatenating the 'prefix' and 'suffix' arguments onto each element of the list. A trailing space on 'prefix' or leading space on 'suffix' will cause them to be put into separate list elements rather than being conca...
python
def _concat_ixes(prefix, list, suffix, env): """ Creates a new list from 'list' by concatenating the 'prefix' and 'suffix' arguments onto each element of the list. A trailing space on 'prefix' or leading space on 'suffix' will cause them to be put into separate list elements rather than being conca...
[ "def", "_concat_ixes", "(", "prefix", ",", "list", ",", "suffix", ",", "env", ")", ":", "result", "=", "[", "]", "prefix", "=", "str", "(", "env", ".", "subst", "(", "prefix", ",", "SCons", ".", "Subst", ".", "SUBST_RAW", ")", ")", "suffix", "=", ...
Creates a new list from 'list' by concatenating the 'prefix' and 'suffix' arguments onto each element of the list. A trailing space on 'prefix' or leading space on 'suffix' will cause them to be put into separate list elements rather than being concatenated.
[ "Creates", "a", "new", "list", "from", "list", "by", "concatenating", "the", "prefix", "and", "suffix", "arguments", "onto", "each", "element", "of", "the", "list", ".", "A", "trailing", "space", "on", "prefix", "or", "leading", "space", "on", "suffix", "w...
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Defaults.py#L360-L395
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Defaults.py
processDefines
def processDefines(defs): """process defines, resolving strings, lists, dictionaries, into a list of strings """ if SCons.Util.is_List(defs): l = [] for d in defs: if d is None: continue elif SCons.Util.is_List(d) or isinstance(d, tuple): ...
python
def processDefines(defs): """process defines, resolving strings, lists, dictionaries, into a list of strings """ if SCons.Util.is_List(defs): l = [] for d in defs: if d is None: continue elif SCons.Util.is_List(d) or isinstance(d, tuple): ...
[ "def", "processDefines", "(", "defs", ")", ":", "if", "SCons", ".", "Util", ".", "is_List", "(", "defs", ")", ":", "l", "=", "[", "]", "for", "d", "in", "defs", ":", "if", "d", "is", "None", ":", "continue", "elif", "SCons", ".", "Util", ".", "...
process defines, resolving strings, lists, dictionaries, into a list of strings
[ "process", "defines", "resolving", "strings", "lists", "dictionaries", "into", "a", "list", "of", "strings" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Defaults.py#L449-L488
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Defaults.py
_defines
def _defines(prefix, defs, suffix, env, c=_concat_ixes): """A wrapper around _concat_ixes that turns a list or string into a list of C preprocessor command-line definitions. """ return c(prefix, env.subst_path(processDefines(defs)), suffix, env)
python
def _defines(prefix, defs, suffix, env, c=_concat_ixes): """A wrapper around _concat_ixes that turns a list or string into a list of C preprocessor command-line definitions. """ return c(prefix, env.subst_path(processDefines(defs)), suffix, env)
[ "def", "_defines", "(", "prefix", ",", "defs", ",", "suffix", ",", "env", ",", "c", "=", "_concat_ixes", ")", ":", "return", "c", "(", "prefix", ",", "env", ".", "subst_path", "(", "processDefines", "(", "defs", ")", ")", ",", "suffix", ",", "env", ...
A wrapper around _concat_ixes that turns a list or string into a list of C preprocessor command-line definitions.
[ "A", "wrapper", "around", "_concat_ixes", "that", "turns", "a", "list", "or", "string", "into", "a", "list", "of", "C", "preprocessor", "command", "-", "line", "definitions", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Defaults.py#L491-L496
train
iotile/coretools
iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Scanner/__init__.py
Scanner
def Scanner(function, *args, **kw): """ Public interface factory function for creating different types of Scanners based on the different types of "functions" that may be supplied. TODO: Deprecate this some day. We've moved the functionality inside the Base class and really don't need this fa...
python
def Scanner(function, *args, **kw): """ Public interface factory function for creating different types of Scanners based on the different types of "functions" that may be supplied. TODO: Deprecate this some day. We've moved the functionality inside the Base class and really don't need this fa...
[ "def", "Scanner", "(", "function", ",", "*", "args", ",", "**", "kw", ")", ":", "if", "SCons", ".", "Util", ".", "is_Dict", "(", "function", ")", ":", "return", "Selector", "(", "function", ",", "*", "args", ",", "**", "kw", ")", "else", ":", "re...
Public interface factory function for creating different types of Scanners based on the different types of "functions" that may be supplied. TODO: Deprecate this some day. We've moved the functionality inside the Base class and really don't need this factory function any more. It was, however, u...
[ "Public", "interface", "factory", "function", "for", "creating", "different", "types", "of", "Scanners", "based", "on", "the", "different", "types", "of", "functions", "that", "may", "be", "supplied", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Scanner/__init__.py#L45-L60
train
iotile/coretools
iotilecore/iotile/core/hw/reports/broadcast.py
BroadcastReport.ReportLength
def ReportLength(cls, header): """Given a header of HeaderLength bytes, calculate the size of this report. Returns: int: The total length of the report including the header that we are passed. """ parsed_header = cls._parse_header(header) auth_size = cls._AUTH_BLOC...
python
def ReportLength(cls, header): """Given a header of HeaderLength bytes, calculate the size of this report. Returns: int: The total length of the report including the header that we are passed. """ parsed_header = cls._parse_header(header) auth_size = cls._AUTH_BLOC...
[ "def", "ReportLength", "(", "cls", ",", "header", ")", ":", "parsed_header", "=", "cls", ".", "_parse_header", "(", "header", ")", "auth_size", "=", "cls", ".", "_AUTH_BLOCK_LENGTHS", ".", "get", "(", "parsed_header", ".", "auth_type", ")", "if", "auth_size"...
Given a header of HeaderLength bytes, calculate the size of this report. Returns: int: The total length of the report including the header that we are passed.
[ "Given", "a", "header", "of", "HeaderLength", "bytes", "calculate", "the", "size", "of", "this", "report", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/reports/broadcast.py#L68-L81
train
iotile/coretools
iotilecore/iotile/core/hw/reports/broadcast.py
BroadcastReport.FromReadings
def FromReadings(cls, uuid, readings, sent_timestamp=0): """Generate a broadcast report from a list of readings and a uuid.""" header = struct.pack("<BBHLLL", cls.ReportType, 0, len(readings)*16, uuid, sent_timestamp, 0) packed_readings = bytearray() for reading in readings: ...
python
def FromReadings(cls, uuid, readings, sent_timestamp=0): """Generate a broadcast report from a list of readings and a uuid.""" header = struct.pack("<BBHLLL", cls.ReportType, 0, len(readings)*16, uuid, sent_timestamp, 0) packed_readings = bytearray() for reading in readings: ...
[ "def", "FromReadings", "(", "cls", ",", "uuid", ",", "readings", ",", "sent_timestamp", "=", "0", ")", ":", "header", "=", "struct", ".", "pack", "(", "\"<BBHLLL\"", ",", "cls", ".", "ReportType", ",", "0", ",", "len", "(", "readings", ")", "*", "16"...
Generate a broadcast report from a list of readings and a uuid.
[ "Generate", "a", "broadcast", "report", "from", "a", "list", "of", "readings", "and", "a", "uuid", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/reports/broadcast.py#L84-L96
train
iotile/coretools
iotilecore/iotile/core/hw/reports/broadcast.py
BroadcastReport.decode
def decode(self): """Decode this report into a list of visible readings.""" parsed_header = self._parse_header(self.raw_report[:self._HEADER_LENGTH]) auth_size = self._AUTH_BLOCK_LENGTHS.get(parsed_header.auth_type) assert auth_size is not None assert parsed_header.reading_leng...
python
def decode(self): """Decode this report into a list of visible readings.""" parsed_header = self._parse_header(self.raw_report[:self._HEADER_LENGTH]) auth_size = self._AUTH_BLOCK_LENGTHS.get(parsed_header.auth_type) assert auth_size is not None assert parsed_header.reading_leng...
[ "def", "decode", "(", "self", ")", ":", "parsed_header", "=", "self", ".", "_parse_header", "(", "self", ".", "raw_report", "[", ":", "self", ".", "_HEADER_LENGTH", "]", ")", "auth_size", "=", "self", ".", "_AUTH_BLOCK_LENGTHS", ".", "get", "(", "parsed_he...
Decode this report into a list of visible readings.
[ "Decode", "this", "report", "into", "a", "list", "of", "visible", "readings", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/reports/broadcast.py#L98-L122
train
iotile/coretools
transport_plugins/native_ble/iotile_transport_native_ble/virtual_ble.py
NativeBLEVirtualInterface.start
def start(self, device): """Start serving access to this VirtualIOTileDevice Args: device (VirtualIOTileDevice): The device we will be providing access to """ super(NativeBLEVirtualInterface, self).start(device) self.set_advertising(True)
python
def start(self, device): """Start serving access to this VirtualIOTileDevice Args: device (VirtualIOTileDevice): The device we will be providing access to """ super(NativeBLEVirtualInterface, self).start(device) self.set_advertising(True)
[ "def", "start", "(", "self", ",", "device", ")", ":", "super", "(", "NativeBLEVirtualInterface", ",", "self", ")", ".", "start", "(", "device", ")", "self", ".", "set_advertising", "(", "True", ")" ]
Start serving access to this VirtualIOTileDevice Args: device (VirtualIOTileDevice): The device we will be providing access to
[ "Start", "serving", "access", "to", "this", "VirtualIOTileDevice" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/native_ble/iotile_transport_native_ble/virtual_ble.py#L116-L124
train
iotile/coretools
transport_plugins/native_ble/iotile_transport_native_ble/virtual_ble.py
NativeBLEVirtualInterface.register_gatt_table
def register_gatt_table(self): """Register the GATT table into baBLE.""" services = [BLEService, TileBusService] characteristics = [ NameChar, AppearanceChar, ReceiveHeaderChar, ReceivePayloadChar, SendHeaderChar, SendPaylo...
python
def register_gatt_table(self): """Register the GATT table into baBLE.""" services = [BLEService, TileBusService] characteristics = [ NameChar, AppearanceChar, ReceiveHeaderChar, ReceivePayloadChar, SendHeaderChar, SendPaylo...
[ "def", "register_gatt_table", "(", "self", ")", ":", "services", "=", "[", "BLEService", ",", "TileBusService", "]", "characteristics", "=", "[", "NameChar", ",", "AppearanceChar", ",", "ReceiveHeaderChar", ",", "ReceivePayloadChar", ",", "SendHeaderChar", ",", "S...
Register the GATT table into baBLE.
[ "Register", "the", "GATT", "table", "into", "baBLE", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/native_ble/iotile_transport_native_ble/virtual_ble.py#L134-L150
train
iotile/coretools
transport_plugins/native_ble/iotile_transport_native_ble/virtual_ble.py
NativeBLEVirtualInterface.set_advertising
def set_advertising(self, enabled): """Toggle advertising.""" if enabled: self.bable.set_advertising( enabled=True, uuids=[TileBusService.uuid], name="V_IOTile ", company_id=ArchManuID, advertising_data=self._adv...
python
def set_advertising(self, enabled): """Toggle advertising.""" if enabled: self.bable.set_advertising( enabled=True, uuids=[TileBusService.uuid], name="V_IOTile ", company_id=ArchManuID, advertising_data=self._adv...
[ "def", "set_advertising", "(", "self", ",", "enabled", ")", ":", "if", "enabled", ":", "self", ".", "bable", ".", "set_advertising", "(", "enabled", "=", "True", ",", "uuids", "=", "[", "TileBusService", ".", "uuid", "]", ",", "name", "=", "\"V_IOTile \"...
Toggle advertising.
[ "Toggle", "advertising", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/native_ble/iotile_transport_native_ble/virtual_ble.py#L160-L177
train
iotile/coretools
transport_plugins/native_ble/iotile_transport_native_ble/virtual_ble.py
NativeBLEVirtualInterface._advertisement
def _advertisement(self): """Create advertisement data.""" # Flags are # bit 0: whether we have pending data # bit 1: whether we are in a low voltage state # bit 2: whether another user is connected # bit 3: whether we support robust reports # bit 4: whether we al...
python
def _advertisement(self): """Create advertisement data.""" # Flags are # bit 0: whether we have pending data # bit 1: whether we are in a low voltage state # bit 2: whether another user is connected # bit 3: whether we support robust reports # bit 4: whether we al...
[ "def", "_advertisement", "(", "self", ")", ":", "flags", "=", "int", "(", "self", ".", "device", ".", "pending_data", ")", "|", "(", "0", "<<", "1", ")", "|", "(", "0", "<<", "2", ")", "|", "(", "1", "<<", "3", ")", "|", "(", "1", "<<", "4"...
Create advertisement data.
[ "Create", "advertisement", "data", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/native_ble/iotile_transport_native_ble/virtual_ble.py#L179-L189
train
iotile/coretools
transport_plugins/native_ble/iotile_transport_native_ble/virtual_ble.py
NativeBLEVirtualInterface._scan_response
def _scan_response(self): """Create scan response data.""" voltage = struct.pack("<H", int(self.voltage*256)) reading = struct.pack("<HLLL", 0xFFFF, 0, 0, 0) response = voltage + reading return response
python
def _scan_response(self): """Create scan response data.""" voltage = struct.pack("<H", int(self.voltage*256)) reading = struct.pack("<HLLL", 0xFFFF, 0, 0, 0) response = voltage + reading return response
[ "def", "_scan_response", "(", "self", ")", ":", "voltage", "=", "struct", ".", "pack", "(", "\"<H\"", ",", "int", "(", "self", ".", "voltage", "*", "256", ")", ")", "reading", "=", "struct", ".", "pack", "(", "\"<HLLL\"", ",", "0xFFFF", ",", "0", "...
Create scan response data.
[ "Create", "scan", "response", "data", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/native_ble/iotile_transport_native_ble/virtual_ble.py#L191-L198
train
iotile/coretools
transport_plugins/native_ble/iotile_transport_native_ble/virtual_ble.py
NativeBLEVirtualInterface.stop_sync
def stop_sync(self): """Safely stop this BLED112 instance without leaving it in a weird state.""" # Disconnect connected device if self.connected: self.disconnect_sync(self._connection_handle) # Disable advertising self.set_advertising(False) # Stop the baBL...
python
def stop_sync(self): """Safely stop this BLED112 instance without leaving it in a weird state.""" # Disconnect connected device if self.connected: self.disconnect_sync(self._connection_handle) # Disable advertising self.set_advertising(False) # Stop the baBL...
[ "def", "stop_sync", "(", "self", ")", ":", "if", "self", ".", "connected", ":", "self", ".", "disconnect_sync", "(", "self", ".", "_connection_handle", ")", "self", ".", "set_advertising", "(", "False", ")", "self", ".", "bable", ".", "stop", "(", ")", ...
Safely stop this BLED112 instance without leaving it in a weird state.
[ "Safely", "stop", "this", "BLED112", "instance", "without", "leaving", "it", "in", "a", "weird", "state", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/native_ble/iotile_transport_native_ble/virtual_ble.py#L200-L212
train
iotile/coretools
transport_plugins/native_ble/iotile_transport_native_ble/virtual_ble.py
NativeBLEVirtualInterface.disconnect_sync
def disconnect_sync(self, connection_handle): """Synchronously disconnect from whoever has connected to us Args: connection_handle (int): The handle of the connection we wish to disconnect. """ self.bable.disconnect(connection_handle=connection_handle, sync=True)
python
def disconnect_sync(self, connection_handle): """Synchronously disconnect from whoever has connected to us Args: connection_handle (int): The handle of the connection we wish to disconnect. """ self.bable.disconnect(connection_handle=connection_handle, sync=True)
[ "def", "disconnect_sync", "(", "self", ",", "connection_handle", ")", ":", "self", ".", "bable", ".", "disconnect", "(", "connection_handle", "=", "connection_handle", ",", "sync", "=", "True", ")" ]
Synchronously disconnect from whoever has connected to us Args: connection_handle (int): The handle of the connection we wish to disconnect.
[ "Synchronously", "disconnect", "from", "whoever", "has", "connected", "to", "us" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/native_ble/iotile_transport_native_ble/virtual_ble.py#L214-L221
train
iotile/coretools
transport_plugins/native_ble/iotile_transport_native_ble/virtual_ble.py
NativeBLEVirtualInterface._stream_data
def _stream_data(self, chunk=None): """Stream reports to the ble client in 20 byte chunks Args: chunk (bytearray): A chunk that should be sent instead of requesting a new chunk from the pending reports. """ # If we failed to transmit a chunk, we will be requ...
python
def _stream_data(self, chunk=None): """Stream reports to the ble client in 20 byte chunks Args: chunk (bytearray): A chunk that should be sent instead of requesting a new chunk from the pending reports. """ # If we failed to transmit a chunk, we will be requ...
[ "def", "_stream_data", "(", "self", ",", "chunk", "=", "None", ")", ":", "self", ".", "_stream_sm_running", "=", "True", "if", "chunk", "is", "None", ":", "chunk", "=", "self", ".", "_next_streaming_chunk", "(", "20", ")", "if", "chunk", "is", "None", ...
Stream reports to the ble client in 20 byte chunks Args: chunk (bytearray): A chunk that should be sent instead of requesting a new chunk from the pending reports.
[ "Stream", "reports", "to", "the", "ble", "client", "in", "20", "byte", "chunks" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/native_ble/iotile_transport_native_ble/virtual_ble.py#L446-L473
train
iotile/coretools
transport_plugins/native_ble/iotile_transport_native_ble/virtual_ble.py
NativeBLEVirtualInterface._send_trace
def _send_trace(self, chunk=None): """Stream tracing data to the ble client in 20 byte chunks Args: chunk (bytearray): A chunk that should be sent instead of requesting a new chunk from the pending reports. """ self._trace_sm_running = True # If we f...
python
def _send_trace(self, chunk=None): """Stream tracing data to the ble client in 20 byte chunks Args: chunk (bytearray): A chunk that should be sent instead of requesting a new chunk from the pending reports. """ self._trace_sm_running = True # If we f...
[ "def", "_send_trace", "(", "self", ",", "chunk", "=", "None", ")", ":", "self", ".", "_trace_sm_running", "=", "True", "if", "chunk", "is", "None", ":", "chunk", "=", "self", ".", "_next_tracing_chunk", "(", "20", ")", "if", "chunk", "is", "None", "or"...
Stream tracing data to the ble client in 20 byte chunks Args: chunk (bytearray): A chunk that should be sent instead of requesting a new chunk from the pending reports.
[ "Stream", "tracing", "data", "to", "the", "ble", "client", "in", "20", "byte", "chunks" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/native_ble/iotile_transport_native_ble/virtual_ble.py#L475-L501
train
iotile/coretools
transport_plugins/native_ble/iotile_transport_native_ble/virtual_ble.py
NativeBLEVirtualInterface.process
def process(self): """Periodic nonblocking processes""" super(NativeBLEVirtualInterface, self).process() if (not self._stream_sm_running) and (not self.reports.empty()): self._stream_data() if (not self._trace_sm_running) and (not self.traces.empty()): self._se...
python
def process(self): """Periodic nonblocking processes""" super(NativeBLEVirtualInterface, self).process() if (not self._stream_sm_running) and (not self.reports.empty()): self._stream_data() if (not self._trace_sm_running) and (not self.traces.empty()): self._se...
[ "def", "process", "(", "self", ")", ":", "super", "(", "NativeBLEVirtualInterface", ",", "self", ")", ".", "process", "(", ")", "if", "(", "not", "self", ".", "_stream_sm_running", ")", "and", "(", "not", "self", ".", "reports", ".", "empty", "(", ")",...
Periodic nonblocking processes
[ "Periodic", "nonblocking", "processes" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/native_ble/iotile_transport_native_ble/virtual_ble.py#L503-L512
train
iotile/coretools
iotilegateway/iotilegateway/supervisor/client.py
AsyncSupervisorClient._populate_name_map
async def _populate_name_map(self): """Populate the name map of services as reported by the supervisor""" services = await self.sync_services() with self._state_lock: self.services = services for i, name in enumerate(self.services.keys()): self._name_ma...
python
async def _populate_name_map(self): """Populate the name map of services as reported by the supervisor""" services = await self.sync_services() with self._state_lock: self.services = services for i, name in enumerate(self.services.keys()): self._name_ma...
[ "async", "def", "_populate_name_map", "(", "self", ")", ":", "services", "=", "await", "self", ".", "sync_services", "(", ")", "with", "self", ".", "_state_lock", ":", "self", ".", "services", "=", "services", "for", "i", ",", "name", "in", "enumerate", ...
Populate the name map of services as reported by the supervisor
[ "Populate", "the", "name", "map", "of", "services", "as", "reported", "by", "the", "supervisor" ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilegateway/iotilegateway/supervisor/client.py#L87-L96
train
iotile/coretools
iotilegateway/iotilegateway/supervisor/client.py
AsyncSupervisorClient.local_service
def local_service(self, name_or_id): """Get the locally synced information for a service. This method is safe to call outside of the background event loop without any race condition. Internally it uses a thread-safe mutex to protect the local copies of supervisor data and ensure that i...
python
def local_service(self, name_or_id): """Get the locally synced information for a service. This method is safe to call outside of the background event loop without any race condition. Internally it uses a thread-safe mutex to protect the local copies of supervisor data and ensure that i...
[ "def", "local_service", "(", "self", ",", "name_or_id", ")", ":", "if", "not", "self", ".", "_loop", ".", "inside_loop", "(", ")", ":", "self", ".", "_state_lock", ".", "acquire", "(", ")", "try", ":", "if", "isinstance", "(", "name_or_id", ",", "int",...
Get the locally synced information for a service. This method is safe to call outside of the background event loop without any race condition. Internally it uses a thread-safe mutex to protect the local copies of supervisor data and ensure that it cannot change while this method is ite...
[ "Get", "the", "locally", "synced", "information", "for", "a", "service", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilegateway/iotilegateway/supervisor/client.py#L108-L141
train
iotile/coretools
iotilegateway/iotilegateway/supervisor/client.py
AsyncSupervisorClient.local_services
def local_services(self): """Get a list of id, name pairs for all of the known synced services. This method is safe to call outside of the background event loop without any race condition. Internally it uses a thread-safe mutex to protect the local copies of supervisor data and ensure ...
python
def local_services(self): """Get a list of id, name pairs for all of the known synced services. This method is safe to call outside of the background event loop without any race condition. Internally it uses a thread-safe mutex to protect the local copies of supervisor data and ensure ...
[ "def", "local_services", "(", "self", ")", ":", "if", "not", "self", ".", "_loop", ".", "inside_loop", "(", ")", ":", "self", ".", "_state_lock", ".", "acquire", "(", ")", "try", ":", "return", "sorted", "(", "[", "(", "index", ",", "name", ")", "f...
Get a list of id, name pairs for all of the known synced services. This method is safe to call outside of the background event loop without any race condition. Internally it uses a thread-safe mutex to protect the local copies of supervisor data and ensure that it cannot change while t...
[ "Get", "a", "list", "of", "id", "name", "pairs", "for", "all", "of", "the", "known", "synced", "services", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilegateway/iotilegateway/supervisor/client.py#L143-L163
train
iotile/coretools
iotilegateway/iotilegateway/supervisor/client.py
AsyncSupervisorClient.sync_services
async def sync_services(self): """Poll the current state of all services. Returns: dict: A dictionary mapping service name to service status """ services = {} servs = await self.list_services() for i, serv in enumerate(servs): info = await self....
python
async def sync_services(self): """Poll the current state of all services. Returns: dict: A dictionary mapping service name to service status """ services = {} servs = await self.list_services() for i, serv in enumerate(servs): info = await self....
[ "async", "def", "sync_services", "(", "self", ")", ":", "services", "=", "{", "}", "servs", "=", "await", "self", ".", "list_services", "(", ")", "for", "i", ",", "serv", "in", "enumerate", "(", "servs", ")", ":", "info", "=", "await", "self", ".", ...
Poll the current state of all services. Returns: dict: A dictionary mapping service name to service status
[ "Poll", "the", "current", "state", "of", "all", "services", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilegateway/iotilegateway/supervisor/client.py#L165-L189
train
iotile/coretools
iotilegateway/iotilegateway/supervisor/client.py
AsyncSupervisorClient.post_state
def post_state(self, name, state): """Asynchronously try to update the state for a service. If the update fails, nothing is reported because we don't wait for a response from the server. This function will return immmediately and not block. Args: name (string): The...
python
def post_state(self, name, state): """Asynchronously try to update the state for a service. If the update fails, nothing is reported because we don't wait for a response from the server. This function will return immmediately and not block. Args: name (string): The...
[ "def", "post_state", "(", "self", ",", "name", ",", "state", ")", ":", "self", ".", "post_command", "(", "OPERATIONS", ".", "CMD_UPDATE_STATE", ",", "{", "'name'", ":", "name", ",", "'new_status'", ":", "state", "}", ")" ]
Asynchronously try to update the state for a service. If the update fails, nothing is reported because we don't wait for a response from the server. This function will return immmediately and not block. Args: name (string): The name of the service state (int): ...
[ "Asynchronously", "try", "to", "update", "the", "state", "for", "a", "service", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilegateway/iotilegateway/supervisor/client.py#L287-L300
train
iotile/coretools
iotilegateway/iotilegateway/supervisor/client.py
AsyncSupervisorClient.post_error
def post_error(self, name, message): """Asynchronously post a user facing error message about a service. Args: name (string): The name of the service message (string): The user facing error message that will be stored for the service and can be queried later. ...
python
def post_error(self, name, message): """Asynchronously post a user facing error message about a service. Args: name (string): The name of the service message (string): The user facing error message that will be stored for the service and can be queried later. ...
[ "def", "post_error", "(", "self", ",", "name", ",", "message", ")", ":", "self", ".", "post_command", "(", "OPERATIONS", ".", "CMD_POST_MESSAGE", ",", "_create_message", "(", "name", ",", "states", ".", "ERROR_LEVEL", ",", "message", ")", ")" ]
Asynchronously post a user facing error message about a service. Args: name (string): The name of the service message (string): The user facing error message that will be stored for the service and can be queried later.
[ "Asynchronously", "post", "a", "user", "facing", "error", "message", "about", "a", "service", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilegateway/iotilegateway/supervisor/client.py#L302-L312
train
iotile/coretools
iotilegateway/iotilegateway/supervisor/client.py
AsyncSupervisorClient.post_warning
def post_warning(self, name, message): """Asynchronously post a user facing warning message about a service. Args: name (string): The name of the service message (string): The user facing warning message that will be stored for the service and can be queried late...
python
def post_warning(self, name, message): """Asynchronously post a user facing warning message about a service. Args: name (string): The name of the service message (string): The user facing warning message that will be stored for the service and can be queried late...
[ "def", "post_warning", "(", "self", ",", "name", ",", "message", ")", ":", "self", ".", "post_command", "(", "OPERATIONS", ".", "CMD_POST_MESSAGE", ",", "_create_message", "(", "name", ",", "states", ".", "WARNING_LEVEL", ",", "message", ")", ")" ]
Asynchronously post a user facing warning message about a service. Args: name (string): The name of the service message (string): The user facing warning message that will be stored for the service and can be queried later.
[ "Asynchronously", "post", "a", "user", "facing", "warning", "message", "about", "a", "service", "." ]
2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec
https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilegateway/iotilegateway/supervisor/client.py#L314-L324
train