_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 75 19.8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q238100 | RecipeManager.get_recipe | train | def get_recipe(self, recipe_name):
"""Get a recipe by name.
Args:
recipe_name (str): The name of the recipe to fetch. Can be either the
yaml file name or the name of the recipe.
"""
if recipe_name.endswith('.yaml'):
recipe = self._recipes.get(Reci... | python | {
"resource": ""
} |
q238101 | TimeoutInterval._check_time_backwards | train | def _check_time_backwards(self):
"""Make sure a clock reset didn't cause time to go backwards
"""
now = time.time()
if now < self.start:
self.start = now
self.end = self.start + self.length | python | {
"resource": ""
} |
q238102 | TimeoutInterval.expired | train | def expired(self):
"""Boolean property if this timeout has expired
"""
if self._expired_latch:
return True
self._check_time_backwards()
if time.time() > self.end:
self._expired_latch = True
return True
return False | python | {
"resource": ""
} |
q238103 | JLinkControlThread.command | train | def command(self, cmd_name, callback, *args):
"""Run an asynchronous command.
Args:
cmd_name (int): The unique code for the command to execute.
callback (callable): The optional callback to run when the command finishes.
The signature should be callback(cmd_name,... | python | {
"resource": ""
} |
q238104 | JLinkControlThread._send_rpc | train | def _send_rpc(self, device_info, control_info, address, rpc_id, payload, poll_interval, timeout):
"""Write and trigger an RPC."""
write_address, write_data = control_info.format_rpc(address, rpc_id, payload)
self._jlink.memory_write32(write_address, write_data)
self._trigger_rpc(device... | python | {
"resource": ""
} |
q238105 | JLinkControlThread._send_script | train | def _send_script(self, device_info, control_info, script, progress_callback):
"""Send a script by repeatedly sending it as a bunch of RPCs.
This function doesn't do anything special, it just sends a bunch of RPCs
with each chunk of the script until it's finished.
"""
for i in r... | python | {
"resource": ""
} |
q238106 | JLinkControlThread._trigger_rpc | train | def _trigger_rpc(self, device_info):
"""Trigger an RPC in a device specific way."""
method = device_info.rpc_trigger
if isinstance(method, devices.RPCTriggerViaSWI):
self._jlink.memory_write32(method.register, [1 << method.bit])
else:
raise HardwareError("Unknown... | python | {
"resource": ""
} |
q238107 | JLinkControlThread._find_control_structure | train | def _find_control_structure(self, start_address, search_length):
"""Find the control structure in RAM for this device.
Returns:
ControlStructure: The decoded contents of the shared memory control structure
used for communication with this IOTile device.
"""
... | python | {
"resource": ""
} |
q238108 | JLinkControlThread._verify_control_structure | train | def _verify_control_structure(self, device_info, control_info=None):
"""Verify that a control structure is still valid or find one.
Returns:
ControlStructure: The verified or discovered control structure.
"""
if control_info is None:
control_info = self._find_co... | python | {
"resource": ""
} |
q238109 | SimulationTrace.save | train | def save(self, out_path):
"""Save an ascii representation of this simulation trace.
Args:
out_path (str): The output path to save this simulation trace.
"""
out = {
'selectors': [str(x) for x in self.selectors],
'trace': [{'stream': str(DataStream.Fr... | python | {
"resource": ""
} |
q238110 | SimulationTrace.FromFile | train | def FromFile(cls, in_path):
"""Load a previously saved ascii representation of this simulation trace.
Args:
in_path (str): The path of the input file that we should load.
Returns:
SimulationTrace: The loaded trace object.
"""
with open(in_path, "rb") as... | python | {
"resource": ""
} |
q238111 | _on_scan | train | def _on_scan(_loop, adapter, _adapter_id, info, expiration_time):
"""Callback when a new device is seen."""
info['validity_period'] = expiration_time
adapter.notify_event_nowait(info.get('connection_string'), 'device_seen', info) | python | {
"resource": ""
} |
q238112 | _on_report | train | def _on_report(_loop, adapter, conn_id, report):
"""Callback when a report is received."""
conn_string = None
if conn_id is not None:
conn_string = adapter._get_property(conn_id, 'connection_string')
if isinstance(report, BroadcastReport):
adapter.notify_event_nowait(conn_string, 'broa... | python | {
"resource": ""
} |
q238113 | _on_trace | train | def _on_trace(_loop, adapter, conn_id, trace):
"""Callback when tracing data is received."""
conn_string = adapter._get_property(conn_id, 'connection_string')
if conn_string is None:
adapter._logger.debug("Dropping trace data with unknown conn_id=%s", conn_id)
return
adapter.notify_eve... | python | {
"resource": ""
} |
q238114 | _on_disconnect | train | def _on_disconnect(_loop, adapter, _adapter_id, conn_id):
"""Callback when a device disconnects unexpectedly."""
conn_string = adapter._get_property(conn_id, 'connection_string')
if conn_string is None:
adapter._logger.debug("Dropping disconnect notification with unknown conn_id=%s", conn_id)
... | python | {
"resource": ""
} |
q238115 | _on_progress | train | def _on_progress(adapter, operation, conn_id, done, total):
"""Callback when progress is reported."""
conn_string = adapter._get_property(conn_id, 'connection_string')
if conn_string is None:
return
adapter.notify_progress(conn_string, operation, done, total) | python | {
"resource": ""
} |
q238116 | AsynchronousModernWrapper.start | train | async def start(self):
"""Start the device adapter.
See :meth:`AbstractDeviceAdapter.start`.
"""
self._loop.add_task(self._periodic_loop, name="periodic task for %s" % self._adapter.__class__.__name__,
parent=self._task)
self._adapter.add_callback('... | python | {
"resource": ""
} |
q238117 | AsynchronousModernWrapper.stop | train | async def stop(self, _task=None):
"""Stop the device adapter.
See :meth:`AbstractDeviceAdapter.stop`.
"""
self._logger.info("Stopping adapter wrapper")
if self._task.stopped:
return
for task in self._task.subtasks:
await task.stop()
se... | python | {
"resource": ""
} |
q238118 | AsynchronousModernWrapper.probe | train | async def probe(self):
"""Probe for devices connected to this adapter.
See :meth:`AbstractDeviceAdapter.probe`.
"""
resp = await self._execute(self._adapter.probe_sync)
_raise_error(None, 'probe', resp) | python | {
"resource": ""
} |
q238119 | AsynchronousModernWrapper.send_script | train | async def send_script(self, conn_id, data):
"""Send a a script to a device.
See :meth:`AbstractDeviceAdapter.send_script`.
"""
progress_callback = functools.partial(_on_progress, self, 'script', conn_id)
resp = await self._execute(self._adapter.send_script_sync, conn_id, data,... | python | {
"resource": ""
} |
q238120 | autobuild_shiparchive | train | def autobuild_shiparchive(src_file):
"""Create a ship file archive containing a yaml_file and its dependencies.
If yaml_file depends on any build products as external files, it must
be a jinja2 template that references the file using the find_product
filter so that we can figure out where those build p... | python | {
"resource": ""
} |
q238121 | create_shipfile | train | def create_shipfile(target, source, env):
"""Create a .ship file with all dependencies."""
source_dir = os.path.dirname(str(source[0]))
recipe_name = os.path.basename(str(source[0]))[:-5]
resman = RecipeManager()
resman.add_recipe_actions(env['CUSTOM_STEPS'])
resman.add_recipe_folder(source_d... | python | {
"resource": ""
} |
q238122 | SensorGraphSimulator.record_trace | train | def record_trace(self, selectors=None):
"""Record a trace of readings produced by this simulator.
This causes the property `self.trace` to be populated with a
SimulationTrace object that contains all of the readings that
are produced during the course of the simulation. Only readings
... | python | {
"resource": ""
} |
q238123 | SensorGraphSimulator.step | train | def step(self, input_stream, value):
"""Step the sensor graph through one since input.
The internal tick count is not advanced so this function may
be called as many times as desired to input specific conditions
without simulation time passing.
Args:
input_stream (D... | python | {
"resource": ""
} |
q238124 | SensorGraphSimulator.run | train | def run(self, include_reset=True, accelerated=True):
"""Run this sensor graph until a stop condition is hit.
Multiple calls to this function are useful only if
there has been some change in the stop conditions that would
cause the second call to not exit immediately.
Args:
... | python | {
"resource": ""
} |
q238125 | SensorGraphSimulator._check_stop_conditions | train | def _check_stop_conditions(self, sensor_graph):
"""Check if any of our stop conditions are met.
Args:
sensor_graph (SensorGraph): The sensor graph we are currently simulating
Returns:
bool: True if we should stop the simulation
"""
for stop in self.stop... | python | {
"resource": ""
} |
q238126 | SensorGraphSimulator.stimulus | train | def stimulus(self, stimulus):
"""Add a simulation stimulus at a given time.
A stimulus is a specific input given to the graph at a specific
time to a specific input stream. The format for specifying a
stimulus is:
[time: ][system ]input X = Y
where X and Y are integers.... | python | {
"resource": ""
} |
q238127 | SensorGraphSimulator.stop_condition | train | def stop_condition(self, condition):
"""Add a stop condition to this simulation.
Stop conditions are specified as strings and parsed into
the appropriate internal structures.
Args:
condition (str): a string description of the stop condition
"""
# Try to par... | python | {
"resource": ""
} |
q238128 | SensorLogSubsystem.dump | train | def dump(self):
"""Serialize the state of this subsystem into a dict.
Returns:
dict: The serialized state
"""
walker = self.dump_walker
if walker is not None:
walker = walker.dump()
state = {
'storage': self.storage.dump(),
... | python | {
"resource": ""
} |
q238129 | SensorLogSubsystem.clear | train | def clear(self, timestamp):
"""Clear all data from the RSL.
This pushes a single reading once we clear everything so that
we keep track of the highest ID that we have allocated to date.
This needs the current timestamp to be able to properly timestamp
the cleared storage readin... | python | {
"resource": ""
} |
q238130 | SensorLogSubsystem.push | train | def push(self, stream_id, timestamp, value):
"""Push a value to a stream.
Args:
stream_id (int): The stream we want to push to.
timestamp (int): The raw timestamp of the value we want to
store.
value (int): The 32-bit integer value we want to push.
... | python | {
"resource": ""
} |
q238131 | SensorLogSubsystem.inspect_virtual | train | def inspect_virtual(self, stream_id):
"""Inspect the last value written into a virtual stream.
Args:
stream_id (int): The virtual stream was want to inspect.
Returns:
(int, int): An error code and the stream value.
"""
stream = DataStream.FromEncoded(st... | python | {
"resource": ""
} |
q238132 | SensorLogSubsystem.dump_begin | train | def dump_begin(self, selector_id):
"""Start dumping a stream.
Args:
selector_id (int): The buffered stream we want to dump.
Returns:
(int, int, int): Error code, second error code, number of available readings
"""
if self.dump_walker is not None:
... | python | {
"resource": ""
} |
q238133 | SensorLogSubsystem.dump_seek | train | def dump_seek(self, reading_id):
"""Seek the dump streamer to a given ID.
Returns:
(int, int, int): Two error codes and the count of remaining readings.
The first error code covers the seeking process.
The second error code covers the stream counting process (cannot... | python | {
"resource": ""
} |
q238134 | SensorLogSubsystem.dump_next | train | def dump_next(self):
"""Dump the next reading from the stream.
Returns:
IOTileReading: The next reading or None if there isn't one
"""
if self.dump_walker is None:
return pack_error(ControllerSubsystem.SENSOR_LOG, SensorLogError.STREAM_WALKER_NOT_INITIALIZED)
... | python | {
"resource": ""
} |
q238135 | SensorLogSubsystem.highest_stored_id | train | def highest_stored_id(self):
"""Scan through the stored readings and report the highest stored id.
Returns:
int: The highest stored id.
"""
shared = [0]
def _keep_max(_i, reading):
if reading.reading_id > shared[0]:
shared[0] = reading.re... | python | {
"resource": ""
} |
q238136 | RawSensorLogMixin.rsl_push_reading | train | def rsl_push_reading(self, value, stream_id):
"""Push a reading to the RSL directly."""
#FIXME: Fix this with timestamp from clock manager task
err = self.sensor_log.push(stream_id, 0, value)
return [err] | python | {
"resource": ""
} |
q238137 | RawSensorLogMixin.rsl_push_many_readings | train | def rsl_push_many_readings(self, value, count, stream_id):
"""Push many copies of a reading to the RSL."""
#FIXME: Fix this with timestamp from clock manager task
for i in range(1, count+1):
err = self.sensor_log.push(stream_id, 0, value)
if err != Error.NO_ERROR:
... | python | {
"resource": ""
} |
q238138 | RawSensorLogMixin.rsl_count_readings | train | def rsl_count_readings(self):
"""Count how many readings are stored in the RSL."""
storage, output = self.sensor_log.count()
return [Error.NO_ERROR, storage, output] | python | {
"resource": ""
} |
q238139 | RawSensorLogMixin.rsl_dump_stream_begin | train | def rsl_dump_stream_begin(self, stream_id):
"""Begin dumping the contents of a stream."""
err, err2, count = self.sensor_log.dump_begin(stream_id)
#FIXME: Fix this with the uptime of the clock manager task
return [err, err2, count, 0] | python | {
"resource": ""
} |
q238140 | RawSensorLogMixin.rsl_dump_stream_next | train | def rsl_dump_stream_next(self, output_format):
"""Dump the next reading from the output stream."""
timestamp = 0
stream_id = 0
value = 0
reading_id = 0
error = Error.NO_ERROR
reading = self.sensor_log.dump_next()
if reading is not None:
times... | python | {
"resource": ""
} |
q238141 | parse_size_name | train | def parse_size_name(type_name):
"""Calculate size and encoding from a type name.
This method takes a C-style type string like uint8_t[10] and returns
- the total size in bytes
- the unit size of each member (if it's an array)
- the scruct.{pack,unpack} format code for decoding the base type
- w... | python | {
"resource": ""
} |
q238142 | ConfigDescriptor._validate_python_type | train | def _validate_python_type(self, python_type):
"""Validate the possible combinations of python_type and type_name."""
if python_type == 'bool':
if self.variable:
raise ArgumentError("You can only specify a bool python type on a scalar (non-array) type_name", type_name=self.ty... | python | {
"resource": ""
} |
q238143 | ConfigDescriptor._convert_default_value | train | def _convert_default_value(self, default):
"""Convert the passed default value to binary.
The default value (if passed) may be specified as either a `bytes`
object or a python int or list of ints. If an int or list of ints is
passed, it is converted to binary. Otherwise, the raw binar... | python | {
"resource": ""
} |
q238144 | ConfigDescriptor.clear | train | def clear(self):
"""Clear this config variable to its reset value."""
if self.default_value is None:
self.current_value = bytearray()
else:
self.current_value = bytearray(self.default_value) | python | {
"resource": ""
} |
q238145 | ConfigDescriptor.update_value | train | def update_value(self, offset, value):
"""Update the binary value currently stored for this config value.
Returns:
int: An opaque error code that can be returned from a set_config rpc
"""
if offset + len(value) > self.total_size:
return Error.INPUT_BUFFER_TOO_LO... | python | {
"resource": ""
} |
q238146 | ConfigDescriptor.latch | train | def latch(self):
"""Convert the current value inside this config descriptor to a python object.
The conversion proceeds by mapping the given type name to a native
python class and performing the conversion. You can override what
python object is used as the destination class by passing... | python | {
"resource": ""
} |
q238147 | EmulatedTile.declare_config_variable | train | def declare_config_variable(self, name, config_id, type_name, default=None, convert=None): #pylint:disable=too-many-arguments;These are all necessary with sane defaults.
"""Declare a config variable that this emulated tile accepts.
The default value (if passed) may be specified as either a `bytes`
... | python | {
"resource": ""
} |
q238148 | EmulatedTile.latch_config_variables | train | def latch_config_variables(self):
"""Latch the current value of all config variables as python objects.
This function will capture the current value of all config variables
at the time that this method is called. It must be called after
start() has been called so that any default value... | python | {
"resource": ""
} |
q238149 | EmulatedTile.reset | train | async def reset(self):
"""Synchronously reset a tile.
This method must be called from the emulation loop and will
synchronously shut down all background tasks running this tile, clear
it to reset state and then restart the initialization background task.
"""
await self.... | python | {
"resource": ""
} |
q238150 | EmulatedTile.list_config_variables | train | def list_config_variables(self, offset):
"""List defined config variables up to 9 at a time."""
names = sorted(self._config_variables)
names = names[offset:offset + 9]
count = len(names)
if len(names) < 9:
names += [0]*(9 - count)
return [count] + names | python | {
"resource": ""
} |
q238151 | EmulatedTile.describe_config_variable | train | def describe_config_variable(self, config_id):
"""Describe the config variable by its id."""
config = self._config_variables.get(config_id)
if config is None:
return [Error.INVALID_ARRAY_KEY, 0, 0, 0, 0]
packed_size = config.total_size
packed_size |= int(config.vari... | python | {
"resource": ""
} |
q238152 | EmulatedTile.set_config_variable | train | def set_config_variable(self, config_id, offset, value):
"""Set a chunk of the current config value's value."""
if self.initialized.is_set():
return [Error.STATE_CHANGE_AT_INVALID_TIME]
config = self._config_variables.get(config_id)
if config is None:
return [Er... | python | {
"resource": ""
} |
q238153 | EmulatedTile.get_config_variable | train | def get_config_variable(self, config_id, offset):
"""Get a chunk of a config variable's value."""
config = self._config_variables.get(config_id)
if config is None:
return [b""]
return [bytes(config.current_value[offset:offset + 20])] | python | {
"resource": ""
} |
q238154 | DeviceAdapter.add_callback | train | def add_callback(self, name, func):
"""Add a callback when Device events happen
Args:
name (str): currently support 'on_scan' and 'on_disconnect'
func (callable): the function that should be called
"""
if name not in self.callbacks:
raise ValueError(... | python | {
"resource": ""
} |
q238155 | DeviceAdapter.connect_sync | train | def connect_sync(self, connection_id, connection_string):
"""Synchronously connect to a device
Args:
connection_id (int): A unique identifier that will refer to this connection
connection_string (string): A DeviceAdapter specific string that can be used to connect to
... | python | {
"resource": ""
} |
q238156 | DeviceAdapter.disconnect_sync | train | def disconnect_sync(self, conn_id):
"""Synchronously disconnect from a connected device
Args:
conn_id (int): A unique identifier that will refer to this connection
Returns:
dict: A dictionary with two elements
'success': a bool with the result of the con... | python | {
"resource": ""
} |
q238157 | DeviceAdapter.probe_sync | train | def probe_sync(self):
"""Synchronously probe for devices on this adapter."""
done = threading.Event()
result = {}
def probe_done(adapter_id, status, reason):
result['success'] = status
result['failure_reason'] = reason
done.set()
self.probe_... | python | {
"resource": ""
} |
q238158 | DeviceAdapter.send_rpc_sync | train | def send_rpc_sync(self, conn_id, address, rpc_id, payload, timeout):
"""Synchronously send an RPC to this IOTile device
Args:
conn_id (int): A unique identifier that will refer to this connection
address (int): the address of the tile that we wish to send the RPC to
... | python | {
"resource": ""
} |
q238159 | AuthProvider.FindByName | train | def FindByName(cls, name):
"""Find a specific installed auth provider by name."""
reg = ComponentRegistry()
for _, entry in reg.load_extensions('iotile.auth_provider', name_filter=name):
return entry | python | {
"resource": ""
} |
q238160 | AuthProvider.DeriveReportKey | train | def DeriveReportKey(cls, root_key, report_id, sent_timestamp):
"""Derive a standard one time use report signing key.
The standard method is HMAC-SHA256(root_key, MAGIC_NUMBER || report_id || sent_timestamp)
where MAGIC_NUMBER is 0x00000002 and all integers are in little endian.
"""
... | python | {
"resource": ""
} |
q238161 | AwaitableDict.declare | train | def declare(self, name):
"""Declare that a key will be set in the future.
This will create a future for the key that is used to
hold its result and allow awaiting it.
Args:
name (str): The unique key that will be used.
"""
if name in self._data:
... | python | {
"resource": ""
} |
q238162 | AwaitableDict.get | train | async def get(self, name, timeout=None, autoremove=True):
"""Wait for a value to be set for a key.
This is the primary way to receive values from AwaitableDict.
You pass in the name of the key you want to wait for, the maximum
amount of time you want to wait and then you can await the r... | python | {
"resource": ""
} |
q238163 | AwaitableDict.get_nowait | train | def get_nowait(self, name, default=_MISSING, autoremove=False):
"""Get the value of a key if it is already set.
This method allows you to check if a key has already been set
without blocking. If the key has not been set you will get the
default value you pass in or KeyError() if no def... | python | {
"resource": ""
} |
q238164 | AwaitableDict.set | train | def set(self, name, value, autodeclare=False):
"""Set the value of a key.
This method will cause anyone waiting on a key (and any future
waiters) to unblock and be returned the value you pass here.
If the key has not been declared previously, a KeyError() is
raised unless you p... | python | {
"resource": ""
} |
q238165 | SensorGraphFileParser.dump_tree | train | def dump_tree(self, statement=None, indent_level=0):
"""Dump the AST for this parsed file.
Args:
statement (SensorGraphStatement): the statement to print
if this function is called recursively.
indent_level (int): The number of spaces to indent this
... | python | {
"resource": ""
} |
q238166 | SensorGraphFileParser.parse_file | train | def parse_file(self, sg_file=None, data=None):
"""Parse a sensor graph file into an AST describing the file.
This function builds the statements list for this parser.
If you pass ``sg_file``, it will be interpreted as the path to a file
to parse. If you pass ``data`` it will be directl... | python | {
"resource": ""
} |
q238167 | SensorGraphFileParser.compile | train | def compile(self, model):
"""Compile this file into a SensorGraph.
You must have preivously called parse_file to parse a
sensor graph file into statements that are then executed
by this command to build a sensor graph.
The results are stored in self.sensor_graph and can be
... | python | {
"resource": ""
} |
q238168 | SensorGraphFileParser.parse_statement | train | def parse_statement(self, statement, orig_contents):
"""Parse a statement, possibly called recursively.
Args:
statement (int, ParseResult): The pyparsing parse result that
contains one statement prepended with the match location
orig_contents (str): The original ... | python | {
"resource": ""
} |
q238169 | VirtualIOTileDevice.stream | train | def stream(self, report, callback=None):
"""Stream a report asynchronously.
If no one is listening for the report, the report may be dropped,
otherwise it will be queued for sending
Args:
report (IOTileReport): The report that should be streamed
callback (callab... | python | {
"resource": ""
} |
q238170 | VirtualIOTileDevice.stream_realtime | train | def stream_realtime(self, stream, value):
"""Stream a realtime value as an IndividualReadingReport.
If the streaming interface of the VirtualInterface this
VirtualDevice is attached to is not opened, the realtime
reading may be dropped.
Args:
stream (int): The strea... | python | {
"resource": ""
} |
q238171 | VirtualIOTileDevice.trace | train | def trace(self, data, callback=None):
"""Trace data asynchronously.
If no one is listening for traced data, it will be dropped
otherwise it will be queued for sending.
Args:
data (bytearray, string): Unstructured data to trace to any
connected client.
... | python | {
"resource": ""
} |
q238172 | VirtualIOTileDevice.register_rpc | train | def register_rpc(self, address, rpc_id, func):
"""Register a single RPC handler with the given info.
This function can be used to directly register individual RPCs,
rather than delegating all RPCs at a given address to a virtual
Tile.
If calls to this function are mixed with ca... | python | {
"resource": ""
} |
q238173 | VirtualIOTileDevice.add_tile | train | def add_tile(self, address, tile):
"""Add a tile to handle all RPCs at a given address.
Args:
address (int): The address of the tile
tile (RPCDispatcher): A tile object that inherits from RPCDispatcher
"""
if address in self._tiles:
raise ArgumentErr... | python | {
"resource": ""
} |
q238174 | ReferenceDevice.iter_tiles | train | def iter_tiles(self, include_controller=True):
"""Iterate over all tiles in this device in order.
The ordering is by tile address which places the controller tile
first in the list.
Args:
include_controller (bool): Include the controller tile in the
results.... | python | {
"resource": ""
} |
q238175 | ReferenceDevice.open_streaming_interface | train | def open_streaming_interface(self):
"""Called when someone opens a streaming interface to the device.
This method will automatically notify sensor_graph that there is a
streaming interface opened.
Returns:
list: A list of IOTileReport objects that should be sent out
... | python | {
"resource": ""
} |
q238176 | ReferenceDevice.close_streaming_interface | train | def close_streaming_interface(self):
"""Called when someone closes the streaming interface to the device.
This method will automatically notify sensor_graph that there is a no
longer a streaming interface opened.
"""
super(ReferenceDevice, self).close_streaming_interface()
... | python | {
"resource": ""
} |
q238177 | build_parser | train | def build_parser():
"""Build the script's argument parser."""
parser = argparse.ArgumentParser(description="The IOTile task supervisor")
parser.add_argument('-c', '--config', help="config json with options")
parser.add_argument('-v', '--verbose', action="count", default=0, help="Increase logging verbos... | python | {
"resource": ""
} |
q238178 | configure_logging | train | def configure_logging(verbosity):
"""Set up the global logging level.
Args:
verbosity (int): The logging verbosity
"""
root = logging.getLogger()
formatter = logging.Formatter('%(asctime)s.%(msecs)03d %(levelname).3s %(name)s %(message)s',
'%y-%m-%d %H:%M... | python | {
"resource": ""
} |
q238179 | createProgBuilder | train | def createProgBuilder(env):
"""This is a utility function that creates the Program
Builder in an Environment if it is not there already.
If it is already there, we return the existing one.
"""
try:
program = env['BUILDERS']['Program']
except KeyError:
import SCons.Defaults
... | python | {
"resource": ""
} |
q238180 | createStaticLibBuilder | train | def createStaticLibBuilder(env):
"""This is a utility function that creates the StaticLibrary
Builder in an Environment if it is not there already.
If it is already there, we return the existing one.
"""
try:
static_lib = env['BUILDERS']['StaticLibrary']
except KeyError:
action... | python | {
"resource": ""
} |
q238181 | createSharedLibBuilder | train | def createSharedLibBuilder(env):
"""This is a utility function that creates the SharedLibrary
Builder in an Environment if it is not there already.
If it is already there, we return the existing one.
"""
try:
shared_lib = env['BUILDERS']['SharedLibrary']
except KeyError:
import... | python | {
"resource": ""
} |
q238182 | createLoadableModuleBuilder | train | def createLoadableModuleBuilder(env):
"""This is a utility function that creates the LoadableModule
Builder in an Environment if it is not there already.
If it is already there, we return the existing one.
"""
try:
ld_module = env['BUILDERS']['LoadableModule']
except KeyError:
... | python | {
"resource": ""
} |
q238183 | createObjBuilders | train | def createObjBuilders(env):
"""This is a utility function that creates the StaticObject
and SharedObject Builders in an Environment if they
are not there already.
If they are there already, we return the existing ones.
This is a separate function because soooo many Tools
use this functionality... | python | {
"resource": ""
} |
q238184 | CreateJarBuilder | train | def CreateJarBuilder(env):
"""The Jar builder expects a list of class files
which it can package into a jar file.
The jar tool provides an interface for passing other types
of java files such as .java, directories or swig interfaces
and will build them to class files in which it can package
int... | python | {
"resource": ""
} |
q238185 | ToolInitializerMethod.get_builder | train | def get_builder(self, env):
"""
Returns the appropriate real Builder for this method name
after having the associated ToolInitializer object apply
the appropriate Tool module.
"""
builder = getattr(env, self.__name__)
self.initializer.apply_tools(env)
bu... | python | {
"resource": ""
} |
q238186 | ToolInitializer.remove_methods | train | def remove_methods(self, env):
"""
Removes the methods that were added by the tool initialization
so we no longer copy and re-bind them when the construction
environment gets cloned.
"""
for method in list(self.methods.values()):
env.RemoveMethod(method) | python | {
"resource": ""
} |
q238187 | ToolInitializer.apply_tools | train | def apply_tools(self, env):
"""
Searches the list of associated Tool modules for one that
exists, and applies that to the construction environment.
"""
for t in self.tools:
tool = SCons.Tool.Tool(t)
if tool.exists(env):
env.Tool(tool)
... | python | {
"resource": ""
} |
q238188 | get_contents_entry | train | def get_contents_entry(node):
"""Fetch the contents of the entry. Returns the exact binary
contents of the file."""
try:
node = node.disambiguate(must_exist=1)
except SCons.Errors.UserError:
# There was nothing on disk with which to disambiguate
# this entry. Leave it as an Ent... | python | {
"resource": ""
} |
q238189 | get_contents_dir | train | def get_contents_dir(node):
"""Return content signatures and names of all our children
separated by new-lines. Ensure that the nodes are sorted."""
contents = []
for n in sorted(node.children(), key=lambda t: t.name):
contents.append('%s %s\n' % (n.get_csig(), n.name))
return ''.join(content... | python | {
"resource": ""
} |
q238190 | Node.get_build_env | train | def get_build_env(self):
"""Fetch the appropriate Environment to build this node.
"""
try:
return self._memo['get_build_env']
except KeyError:
pass
result = self.get_executor().get_build_env()
self._memo['get_build_env'] = result
return res... | python | {
"resource": ""
} |
q238191 | Node.get_executor | train | def get_executor(self, create=1):
"""Fetch the action executor for this node. Create one if
there isn't already one, and requested to do so."""
try:
executor = self.executor
except AttributeError:
if not create:
raise
try:
... | python | {
"resource": ""
} |
q238192 | Node.executor_cleanup | train | def executor_cleanup(self):
"""Let the executor clean up any cached information."""
try:
executor = self.get_executor(create=None)
except AttributeError:
pass
else:
if executor is not None:
executor.cleanup() | python | {
"resource": ""
} |
q238193 | Node.prepare | train | def prepare(self):
"""Prepare for this Node to be built.
This is called after the Taskmaster has decided that the Node
is out-of-date and must be rebuilt, but before actually calling
the method to build the Node.
This default implementation checks that explicit or implicit
... | python | {
"resource": ""
} |
q238194 | Node.build | train | def build(self, **kw):
"""Actually build the node.
This is called by the Taskmaster after it's decided that the
Node is out-of-date and must be rebuilt, and after the prepare()
method has gotten everything, uh, prepared.
This method is called from multiple threads in a parallel... | python | {
"resource": ""
} |
q238195 | Node.built | train | def built(self):
"""Called just after this node is successfully built."""
# Clear the implicit dependency caches of any Nodes
# waiting for this Node to be built.
for parent in self.waiting_parents:
parent.implicit = None
self.clear()
if self.pseudo:
... | python | {
"resource": ""
} |
q238196 | Node.has_builder | train | def has_builder(self):
"""Return whether this Node has a builder or not.
In Boolean tests, this turns out to be a *lot* more efficient
than simply examining the builder attribute directly ("if
node.builder: ..."). When the builder attribute is examined
directly, it ends up calli... | python | {
"resource": ""
} |
q238197 | Node.get_implicit_deps | train | def get_implicit_deps(self, env, initial_scanner, path_func, kw = {}):
"""Return a list of implicit dependencies for this node.
This method exists to handle recursive invocation of the scanner
on the implicit dependencies returned by the scanner, if the
scanner's recursive flag says tha... | python | {
"resource": ""
} |
q238198 | Node.get_source_scanner | train | def get_source_scanner(self, node):
"""Fetch the source scanner for the specified node
NOTE: "self" is the target being built, "node" is
the source file for which we want to fetch the scanner.
Implies self.has_builder() is true; again, expect to only be
called from locations w... | python | {
"resource": ""
} |
q238199 | Node.scan | train | def scan(self):
"""Scan this node's dependents for implicit dependencies."""
# Don't bother scanning non-derived files, because we don't
# care what their dependencies are.
# Don't scan again, if we already have scanned.
if self.implicit is not None:
return
se... | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.