Code stringlengths 103 85.9k | Summary listlengths 0 94 |
|---|---|
Please provide a description of the function:def get_all_children(self):
result = SCons.Util.UniqueList([])
for target in self.get_all_targets():
result.extend(target.children())
return result | [
"Returns all unique children (dependencies) for all batches\n of this Executor.\n\n The Taskmaster can recognize when it's already evaluated a\n Node, so we don't have to make this list unique for its intended\n canonical use case, but we expect there to be a lot of redundancy\n (... |
Please provide a description of the function:def get_all_prerequisites(self):
result = SCons.Util.UniqueList([])
for target in self.get_all_targets():
if target.prerequisites is not None:
result.extend(target.prerequisites)
return result | [
"Returns all unique (order-only) prerequisites for all batches\n of this Executor.\n "
] |
Please provide a description of the function:def get_action_side_effects(self):
result = SCons.Util.UniqueList([])
for target in self.get_action_targets():
result.extend(target.side_effects)
return result | [
"Returns all side effects for all batches of this\n Executor used by the underlying Action.\n "
] |
Please provide a description of the function:def get_build_env(self):
try:
return self._memo['get_build_env']
except KeyError:
pass
# Create the build environment instance with appropriate
# overrides. These get evaluated against the current
# e... | [
"Fetch or create the appropriate build Environment\n for this Executor.\n "
] |
Please provide a description of the function:def get_build_scanner_path(self, scanner):
env = self.get_build_env()
try:
cwd = self.batches[0].targets[0].cwd
except (IndexError, AttributeError):
cwd = None
return scanner.path(env, cwd,
... | [
"Fetch the scanner path for this executor's targets and sources.\n "
] |
Please provide a description of the function:def add_sources(self, sources):
# TODO(batch): extend to multiple batches
assert (len(self.batches) == 1)
# TODO(batch): remove duplicates?
sources = [x for x in sources if x not in self.batches[0].sources]
self.batches[0].s... | [
"Add source files to this Executor's list. This is necessary\n for \"multi\" Builders that can be called repeatedly to build up\n a source file list for a given target."
] |
Please provide a description of the function:def add_batch(self, targets, sources):
self.batches.append(Batch(targets, sources)) | [
"Add pair of associated target and source to this Executor's list.\n This is necessary for \"batch\" Builders that can be called repeatedly\n to build up a list of matching target and source files that will be\n used in order to update multiple target files at once from multiple\n corres... |
Please provide a description of the function:def prepare(self):
for s in self.get_all_sources():
if s.missing():
msg = "Source `%s' not found, needed by target `%s'."
raise SCons.Errors.StopError(msg % (s, self.batches[0].targets[0])) | [
"\n Preparatory checks for whether this Executor can go ahead\n and (try to) build its targets.\n "
] |
Please provide a description of the function:def get_contents(self):
try:
return self._memo['get_contents']
except KeyError:
pass
env = self.get_build_env()
action_list = self.get_action_list()
all_targets = self.get_all_targets()
all_sou... | [
"Fetch the signature contents. This is the main reason this\n class exists, so we can compute this once and cache it regardless\n of how many target or source Nodes there are.\n "
] |
Please provide a description of the function:def scan(self, scanner, node_list):
env = self.get_build_env()
path = self.get_build_scanner_path
kw = self.get_kw()
# TODO(batch): scan by batches)
deps = []
for node in node_list:
node.disambiguate()
... | [
"Scan a list of this Executor's files (targets or sources) for\n implicit dependencies and update all of the targets with them.\n This essentially short-circuits an N*M scan of the sources for\n each individual target, which is a hell of a lot more efficient.\n "
] |
Please provide a description of the function:def get_implicit_deps(self):
result = []
build_env = self.get_build_env()
for act in self.get_action_list():
deps = act.get_implicit_deps(self.get_all_targets(),
self.get_all_sources(),
... | [
"Return the executor's implicit dependencies, i.e. the nodes of\n the commands to be executed."
] |
Please provide a description of the function:def _morph(self):
batches = self.batches
self.__class__ = Executor
self.__init__([])
self.batches = batches | [
"Morph this Null executor to a real Executor object."
] |
Please provide a description of the function:def encode(self):
contents = self.encode_contents()
record_type = self.MatchType()
header = struct.pack("<LB3x", len(contents) + UpdateRecord.HEADER_LENGTH, record_type)
return bytearray(header) + contents | [
"Encode this record into binary, suitable for embedded into an update script.\n\n This function just adds the required record header and delegates all\n work to the subclass implementation of encode_contents().\n\n Returns:\n bytearary: The binary version of the record that could be ... |
Please provide a description of the function:def LoadPlugins(cls):
if cls.PLUGINS_LOADED:
return
reg = ComponentRegistry()
for _, record in reg.load_extensions('iotile.update_record'):
cls.RegisterRecordType(record)
cls.PLUGINS_LOADED = True | [
"Load all registered iotile.update_record plugins."
] |
Please provide a description of the function:def RegisterRecordType(cls, record_class):
record_type = record_class.MatchType()
if record_type not in UpdateRecord.KNOWN_CLASSES:
UpdateRecord.KNOWN_CLASSES[record_type] = []
UpdateRecord.KNOWN_CLASSES[record_type].append(reco... | [
"Register a known record type in KNOWN_CLASSES.\n\n Args:\n record_class (UpdateRecord): An update record subclass.\n "
] |
Please provide a description of the function:def FromBinary(cls, record_data, record_count=1):
# Make sure any external record types are registered
cls.LoadPlugins()
if len(record_data) < UpdateRecord.HEADER_LENGTH:
raise ArgumentError("Record data is too short to contain ... | [
"Create an UpdateRecord subclass from binary record data.\n\n This should be called with a binary record blob (including the record\n type header) and it will return the best record class match that it\n can find for that record.\n\n Args:\n record_data (bytearray): The raw re... |
Please provide a description of the function:def _setup(self):
# Create a root system ticks and user configurable ticks
systick = self.allocator.allocate_stream(DataStream.CounterType, attach=True)
fasttick = self.allocator.allocate_stream(DataStream.CounterType, attach=True)
u... | [
"Prepare for code generation by setting up root clock nodes.\n\n These nodes are subsequently used as the basis for all clock operations.\n "
] |
Please provide a description of the function:def clock(self, interval, basis="system"):
if basis == "system":
if (interval % 10) == 0:
tick = self.allocator.attach_stream(self.system_tick)
count = interval // 10
else:
tick = self.... | [
"Return a NodeInput tuple for triggering an event every interval.\n\n Args:\n interval (int): The interval at which this input should\n trigger. If basis == system (the default), this interval must\n be in seconds. Otherwise it will be in units of whatever the\n ... |
Please provide a description of the function:def generate(env):
static_obj, shared_obj = SCons.Tool.createObjBuilders(env)
if 'CXX' not in env:
env['CXX'] = env.Detect(compilers) or compilers[0]
cxx.generate(env)
# platform specific settings
if env['PLATFORM'] == 'aix':
en... | [
"Add Builders and construction variables for g++ to an Environment."
] |
Please provide a description of the function:def find_proxy_plugin(component, plugin_name):
reg = ComponentRegistry()
plugins = reg.load_extensions('iotile.proxy_plugin', comp_filter=component, class_filter=TileBusProxyPlugin,
product_name='proxy_plugin')
for _name,... | [
" Attempt to find a proxy plugin provided by a specific component\n\n Args:\n component (string): The name of the component that provides the plugin\n plugin_name (string): The name of the plugin to load\n\n Returns:\n TileBuxProxyPlugin: The plugin, if found, otherwise raises DataError\n... |
Please provide a description of the function:def verify(self, obj):
if not isinstance(obj, bool):
raise ValidationError("Object is not a bool", reason='object is not a bool', object=obj)
if self._require_value is not None and obj != self._require_value:
raise Validatio... | [
"Verify that the object conforms to this verifier's schema\n\n Args:\n obj (object): A python object to verify\n\n Raises:\n ValidationError: If there is a problem verifying the dictionary, a\n ValidationError is thrown with at least the reason key set indicating\n... |
Please provide a description of the function:def format(self, indent_level, indent_size=4):
name = self.format_name('Boolean', indent_size)
if self._require_value is not None:
if self.long_desc is not None:
name += '\n'
name += self.wrap_lines('must be... | [
"Format this verifier\n\n Returns:\n string: A formatted string\n "
] |
Please provide a description of the function:def FromBinary(cls, record_data, record_count=1):
_cmd, address, _resp_length, payload = cls._parse_rpc_info(record_data)
descriptor = parse_binary_descriptor(payload)
return AddNodeRecord(descriptor, address=address) | [
"Create an UpdateRecord subclass from binary record data.\n\n This should be called with a binary record blob (NOT including the\n record type header) and it will decode it into a AddNodeRecord.\n\n Args:\n record_data (bytearray): The raw record data that we wish to parse\n ... |
Please provide a description of the function:def _convert_trigger(self, trigger_def, parent):
if trigger_def.explicit_stream is None:
stream = parent.resolve_identifier(trigger_def.named_event, DataStream)
trigger = TrueTrigger()
else:
stream = trigger_def.e... | [
"Convert a TriggerDefinition into a stream, trigger pair."
] |
Please provide a description of the function:def _parse_trigger(self, trigger_clause):
cond = trigger_clause[0]
named_event = None
explicit_stream = None
explicit_trigger = None
# Identifier parse tree is Group(Identifier)
if cond.getName() == 'identifier':
... | [
"Parse a named event or explicit stream trigger into a TriggerDefinition."
] |
Please provide a description of the function:def execute_before(self, sensor_graph, scope_stack):
parent = scope_stack[-1]
alloc = parent.allocator
stream_a, trigger_a = self._convert_trigger(self.trigger_a, parent)
if self.trigger_b is None:
new_scope = TriggerSc... | [
"Execute statement before children are executed.\n\n Args:\n sensor_graph (SensorGraph): The sensor graph that we are building or\n modifying\n scope_stack (list(Scope)): A stack of nested scopes that may influence\n how this statement allocates clocks or o... |
Please provide a description of the function:def platform_default():
osname = os.name
if osname == 'java':
osname = os._osType
if osname == 'posix':
if sys.platform == 'cygwin':
return 'cygwin'
elif sys.platform.find('irix') != -1:
return 'irix'
e... | [
"Return the platform string for our execution environment.\n\n The returned value should map to one of the SCons/Platform/*.py\n files. Since we're architecture independent, though, we don't\n care about the machine architecture.\n "
] |
Please provide a description of the function:def platform_module(name = platform_default()):
full_name = 'SCons.Platform.' + name
if full_name not in sys.modules:
if os.name == 'java':
eval(full_name)
else:
try:
file, path, desc = imp.find_module(name... | [
"Return the imported module for the platform.\n\n This looks for a module name that matches the specified argument.\n If the name is unspecified, we fetch the appropriate default for\n our execution environment.\n "
] |
Please provide a description of the function:def Platform(name = platform_default()):
module = platform_module(name)
spec = PlatformSpec(name, module.generate)
return spec | [
"Select a canned Platform specification.\n "
] |
Please provide a description of the function:def jarSources(target, source, env, for_signature):
try:
env['JARCHDIR']
except KeyError:
jarchdir_set = False
else:
jarchdir_set = True
jarchdir = env.subst('$JARCHDIR', target=target, source=source)
if jarchdir:
... | [
"Only include sources that are not a manifest file."
] |
Please provide a description of the function:def jarManifest(target, source, env, for_signature):
for src in source:
contents = src.get_text_contents()
if contents[:16] == "Manifest-Version":
return src
return '' | [
"Look in sources for a manifest file, if any."
] |
Please provide a description of the function:def jarFlags(target, source, env, for_signature):
jarflags = env.subst('$JARFLAGS', target=target, source=source)
for src in source:
contents = src.get_text_contents()
if contents[:16] == "Manifest-Version":
if not 'm' in jarflags:
... | [
"If we have a manifest, make sure that the 'm'\n flag is specified."
] |
Please provide a description of the function:def Jar(env, target = None, source = [], *args, **kw):
# jar target should not be a list so assume they passed
# no target and want implicit target to be made and the arg
# was actaully the list of sources
if SCons.Util.is_List(target) and source == []:... | [
"\n A pseudo-Builder wrapper around the separate Jar sources{File,Dir}\n Builders.\n "
] |
Please provide a description of the function:def generate(env):
SCons.Tool.CreateJarBuilder(env)
SCons.Tool.CreateJavaFileBuilder(env)
SCons.Tool.CreateJavaClassFileBuilder(env)
SCons.Tool.CreateJavaClassDirBuilder(env)
env.AddMethod(Jar)
env['JAR'] = 'jar'
env['JARFLAGS'] =... | [
"Add Builders and construction variables for jar to an Environment."
] |
Please provide a description of the function:def mock(self, slot, rpc_id, value):
address = slot.address
if address not in self.mock_rpcs:
self.mock_rpcs[address] = {}
self.mock_rpcs[address][rpc_id] = value | [
"Store a mock return value for an RPC\n\n Args:\n slot (SlotIdentifier): The slot we are mocking\n rpc_id (int): The rpc we are mocking\n value (int): The value that should be returned\n when the RPC is called.\n "
] |
Please provide a description of the function:def rpc(self, address, rpc_id):
# Always allow mocking an RPC to override whatever the defaul behavior is
if address in self.mock_rpcs and rpc_id in self.mock_rpcs[address]:
value = self.mock_rpcs[address][rpc_id]
return valu... | [
"Call an RPC and receive the result as an integer.\n\n If the RPC does not properly return a 32 bit integer, raise a warning\n unless it cannot be converted into an integer at all, in which case\n a HardwareError is thrown.\n\n Args:\n address (int): The address of the tile we... |
Please provide a description of the function:def _find_modules(src):
directors = 0
mnames = []
try:
matches = _reModule.findall(open(src).read())
except IOError:
# If the file's not yet generated, guess the module name from the file stem
matches = []
mnames.append(os... | [
"Find all modules referenced by %module lines in `src`, a SWIG .i file.\n Returns a list of all modules, and a flag set if SWIG directors have\n been requested (SWIG will generate an additional header file in this\n case.)"
] |
Please provide a description of the function:def _get_swig_version(env, swig):
swig = env.subst(swig)
pipe = SCons.Action._subproc(env, SCons.Util.CLVar(swig) + ['-version'],
stdin = 'devnull',
stderr = 'devnull',
... | [
"Run the SWIG command line tool to get and return the version number"
] |
Please provide a description of the function:def generate(env):
c_file, cxx_file = SCons.Tool.createCFileBuilders(env)
c_file.suffix['.i'] = swigSuffixEmitter
cxx_file.suffix['.i'] = swigSuffixEmitter
c_file.add_action('.i', SwigAction)
c_file.add_emitter('.i', _swigEmitter)
cxx_file.add_... | [
"Add Builders and construction variables for swig to an Environment."
] |
Please provide a description of the function:def _select_ftdi_channel(channel):
if channel < 0 or channel > 8:
raise ArgumentError("FTDI-selected multiplexer only has channels 0-7 valid, "
"make sure you specify channel with -c channel=number", channel=channel)
from pyli... | [
"Select multiplexer channel. Currently uses a FTDI chip via pylibftdi"
] |
Please provide a description of the function:def parse_binary_descriptor(bindata, sensor_log=None):
if len(bindata) != 14:
raise ArgumentError("Invalid length of binary data in streamer descriptor", length=len(bindata), expected=14, data=bindata)
dest_tile, stream_id, trigger, format_code, type_c... | [
"Convert a binary streamer descriptor into a string descriptor.\n\n Binary streamer descriptors are 20-byte binary structures that encode all\n information needed to create a streamer. They are used to communicate\n that information to an embedded device in an efficent format. This\n function exists t... |
Please provide a description of the function:def create_binary_descriptor(streamer):
trigger = 0
if streamer.automatic:
trigger = 1
elif streamer.with_other is not None:
trigger = (1 << 7) | streamer.with_other
return struct.pack("<8sHBBBx", streamer.dest.encode(), streamer.select... | [
"Create a packed binary descriptor of a DataStreamer object.\n\n Args:\n streamer (DataStreamer): The streamer to create a packed descriptor for\n\n Returns:\n bytes: A packed 14-byte streamer descriptor.\n "
] |
Please provide a description of the function:def parse_string_descriptor(string_desc):
if not isinstance(string_desc, str):
string_desc = str(string_desc)
if not string_desc.endswith(';'):
string_desc += ';'
parsed = get_streamer_parser().parseString(string_desc)[0]
realtime = '... | [
"Parse a string descriptor of a streamer into a DataStreamer object.\n\n Args:\n string_desc (str): The string descriptor that we wish to parse.\n\n Returns:\n DataStreamer: A DataStreamer object representing the streamer.\n "
] |
Please provide a description of the function:def verify(self, obj):
if not isinstance(obj, float):
raise ValidationError("Object is not a float", reason='object is not a float', object=obj)
return obj | [
"Verify that the object conforms to this verifier's schema.\n\n Args:\n obj (object): A python object to verify\n\n Raises:\n ValidationError: If there is a problem verifying the dictionary, a\n ValidationError is thrown with at least the reason key set indicating\... |
Please provide a description of the function:def execute_before(self, sensor_graph, scope_stack):
parent = scope_stack[-1]
alloc = parent.allocator
# We want to create a gated clock that only fires when there is a connection
# to a communication tile. So we create a latching ... | [
"Execute statement before children are executed.\n\n Args:\n sensor_graph (SensorGraph): The sensor graph that we are building or\n modifying\n scope_stack (list(Scope)): A stack of nested scopes that may influence\n how this statement allocates clocks or o... |
Please provide a description of the function:def generate(env):
link.generate(env)
env['FRAMEWORKPATHPREFIX'] = '-F'
env['_FRAMEWORKPATH'] = '${_concat(FRAMEWORKPATHPREFIX, FRAMEWORKPATH, "", __env__)}'
env['_FRAMEWORKS'] = '${_concat("-framework ", FRAMEWORKS, "", __env__)}'
env['LINKCOM'] = ... | [
"Add Builders and construction variables for applelink to an\n Environment."
] |
Please provide a description of the function:def _generateGUID(slnfile, name):
m = hashlib.md5()
# Normalize the slnfile path to a Windows path (\ separators) so
# the generated file has a consistent GUID even if we generate
# it on a non-Windows platform.
m.update(bytearray(ntpath.normpath(str... | [
"This generates a dummy GUID for the sln file to use. It is\n based on the MD5 signatures of the sln filename plus the name of\n the project. It basically just needs to be unique, and not\n change with each invocation."
] |
Please provide a description of the function:def msvs_parse_version(s):
num, suite = version_re.match(s).groups()
return float(num), suite | [
"\n Split a Visual Studio version, which may in fact be something like\n '7.0Exp', into is version number (returned as a float) and trailing\n \"suite\" portion.\n "
] |
Please provide a description of the function:def makeHierarchy(sources):
'''Break a list of files into a hierarchy; for each value, if it is a string,
then it is a file. If it is a dictionary, it is a folder. The string is
the original path of the file.'''
hierarchy = {}
for file in sources... | [] |
Please provide a description of the function:def GenerateDSP(dspfile, source, env):
version_num = 6.0
if 'MSVS_VERSION' in env:
version_num, suite = msvs_parse_version(env['MSVS_VERSION'])
if version_num >= 10.0:
g = _GenerateV10DSP(dspfile, source, env)
g.Build()
elif vers... | [
"Generates a Project file based on the version of MSVS that is being used"
] |
Please provide a description of the function:def GenerateDSW(dswfile, source, env):
version_num = 6.0
if 'MSVS_VERSION' in env:
version_num, suite = msvs_parse_version(env['MSVS_VERSION'])
if version_num >= 7.0:
g = _GenerateV7DSW(dswfile, source, env)
g.Build()
else:
... | [
"Generates a Solution/Workspace file based on the version of MSVS that is being used"
] |
Please provide a description of the function:def projectEmitter(target, source, env):
# todo: Not sure what sets source to what user has passed as target,
# but this is what happens. When that is fixed, we also won't have
# to make the user always append env['MSVSPROJECTSUFFIX'] to target.
if sour... | [
"Sets up the DSP dependencies."
] |
Please provide a description of the function:def solutionEmitter(target, source, env):
# todo: Not sure what sets source to what user has passed as target,
# but this is what happens. When that is fixed, we also won't have
# to make the user always append env['MSVSSOLUTIONSUFFIX'] to target.
if so... | [
"Sets up the DSW dependencies."
] |
Please provide a description of the function:def generate(env):
try:
env['BUILDERS']['MSVSProject']
except KeyError:
env['BUILDERS']['MSVSProject'] = projectBuilder
try:
env['BUILDERS']['MSVSSolution']
except KeyError:
env['BUILDERS']['MSVSSolution'] = solutionBuild... | [
"Add Builders and construction variables for Microsoft Visual\n Studio project files to an Environment."
] |
Please provide a description of the function:def PrintSolution(self):
self.file.write('Microsoft Visual Studio Solution File, Format Version %s\n' % self.versionstr)
if self.version_num >= 12.0:
self.file.write('# Visual Studio 14\n')
elif self.version_num >= 11.0:
... | [
"Writes a solution file"
] |
Please provide a description of the function:def PrintWorkspace(self):
name = self.name
dspfile = os.path.relpath(self.dspfiles[0], self.dsw_folder_path)
self.file.write(V6DSWHeader % locals()) | [
" writes a DSW file "
] |
Please provide a description of the function:def waiters(self, path=None):
context = self._waiters
if path is None:
path = []
for key in path:
context = context[key]
if self._LEAF in context:
for future in context[self._LEAF]:
... | [
"Iterate over all waiters.\n\n This method will return the waiters in unspecified order\n including the future or callback object that will be invoked\n and a list containing the keys/value that are being matched.\n\n Yields:\n list, future or callable\n "
] |
Please provide a description of the function:def every_match(self, callback, **kwargs):
if len(kwargs) == 0:
raise ArgumentError("You must specify at least one message field to wait on")
spec = MessageSpec(**kwargs)
responder = self._add_waiter(spec, callback)
ret... | [
"Invoke callback every time a matching message is received.\n\n The callback will be invoked directly inside process_message so that\n you can guarantee that it has been called by the time process_message\n has returned.\n\n The callback can be removed by a call to remove_waiter(), passi... |
Please provide a description of the function:def remove_waiter(self, waiter_handle):
spec, waiter = waiter_handle
self._remove_waiter(spec, waiter) | [
"Remove a message callback.\n\n This call will remove a callback previously registered using\n every_match.\n\n Args:\n waiter_handle (object): The opaque handle returned by the\n previous call to every_match().\n "
] |
Please provide a description of the function:def clear(self):
for _, waiter in self.waiters():
if isinstance(waiter, asyncio.Future) and not waiter.done():
waiter.set_exception(asyncio.CancelledError())
self._waiters = {} | [
"Clear all waiters.\n\n This method will remove any current scheduled waiter with an\n asyncio.CancelledError exception.\n "
] |
Please provide a description of the function:def wait_for(self, timeout=None, **kwargs):
if len(kwargs) == 0:
raise ArgumentError("You must specify at least one message field to wait on")
spec = MessageSpec(**kwargs)
future = self._add_waiter(spec)
future.add_done_... | [
"Wait for a specific matching message or timeout.\n\n You specify the message by passing name=value keyword arguments to\n this method. The first message received after this function has been\n called that has all of the given keys with the given values will be\n returned when this func... |
Please provide a description of the function:async def process_message(self, message, wait=True):
to_check = deque([self._waiters])
ignored = True
while len(to_check) > 0:
context = to_check.popleft()
waiters = context.get(OperationManager._LEAF, [])
... | [
"Process a message to see if it wakes any waiters.\n\n This will check waiters registered to see if they match the given\n message. If so, they are awoken and passed the message. All matching\n waiters will be woken.\n\n This method returns False if the message matched no waiters so it... |
Please provide a description of the function:def generate(env):
try:
bld = env['BUILDERS']['Zip']
except KeyError:
bld = ZipBuilder
env['BUILDERS']['Zip'] = bld
env['ZIP'] = 'zip'
env['ZIPFLAGS'] = SCons.Util.CLVar('')
env['ZIPCOM'] = zipAction
env['ZIP... | [
"Add Builders and construction variables for zip to an Environment."
] |
Please provide a description of the function:def FromBinary(cls, record_data, record_count=1):
_cmd, address, _resp_length, _payload = cls._parse_rpc_info(record_data)
if address != 8:
raise ArgumentError("Clear config variables sent to non-controller tile")
return ClearC... | [
"Create an UpdateRecord subclass from binary record data.\n\n This should be called with a binary record blob (NOT including the\n record type header) and it will decode it into a ClearConfigVariablesRecord.\n\n Args:\n record_data (bytearray): The raw record data that we wish to par... |
Please provide a description of the function:async def send_rpc(self, conn_id, address, rpc_id, payload, timeout):
try:
return await super(EmulatedDeviceAdapter, self).send_rpc(conn_id, address, rpc_id, payload, timeout)
finally:
for dev in self.devices.values():
... | [
"Asynchronously send an RPC to this IOTile device\n\n Args:\n conn_id (int): A unique identifier that will refer to this connection\n address (int): the address of the tile that we wish to send the RPC to\n rpc_id (int): the 16-bit id of the RPC we want to call\n p... |
Please provide a description of the function:async def debug(self, conn_id, name, cmd_args):
device = self._get_property(conn_id, 'device')
retval = None
try:
if name == 'dump_state':
retval = device.dump_state()
elif name == 'restore_state':
... | [
"Asynchronously complete a named debug command.\n\n The command name and arguments are passed to the underlying device adapter\n and interpreted there.\n\n Args:\n conn_id (int): A unique identifer that will refer to this connection\n name (string): the name of the debug c... |
Please provide a description of the function:def verify(self, obj):
if obj not in self.options:
raise ValidationError("Object is not in list of enumerated options",
reason='not in list of enumerated options', object=obj, options=self.options)
retu... | [
"Verify that the object conforms to this verifier's schema.\n\n Args:\n obj (object): A python object to verify\n\n Raises:\n ValidationError: If there is a problem verifying the object, a\n ValidationError is thrown with at least the reason key set indicating\n ... |
Please provide a description of the function:def one_line_desc(obj):
logger = logging.getLogger(__name__)
try:
doc = ParsedDocstring(obj.__doc__)
return doc.short_desc
except: # pylint:disable=bare-except; We don't want a misbehaving exception to break the program
logger.warn... | [
"Get a one line description of a class."
] |
Please provide a description of the function:def main(argv=None, loop=SharedLoop):
if argv is None:
argv = sys.argv[1:]
list_parser = argparse.ArgumentParser(add_help=False)
list_parser.add_argument('-l', '--list', action='store_true', help="List all known installed interfaces and devices and... | [
"Serve access to a virtual IOTile device using a virtual iotile interface."
] |
Please provide a description of the function:def instantiate_device(virtual_dev, config, loop):
conf = {}
if 'device' in config:
conf = config['device']
# If we're given a path to a script, try to load and use that rather than search for an installed module
try:
reg = ComponentRegi... | [
"Find a virtual device by name and instantiate it\n\n Args:\n virtual_dev (string): The name of the pkg_resources entry point corresponding to\n the device. It should be in group iotile.virtual_device. If virtual_dev ends\n in .py, it is interpreted as a python script and loaded di... |
Please provide a description of the function:def instantiate_interface(virtual_iface, config, loop):
# Allow the null virtual interface for testing
if virtual_iface == 'null':
return StandardDeviceServer(None, {}, loop=loop)
conf = {}
if 'interface' in config:
conf = config['inter... | [
"Find a virtual interface by name and instantiate it\n\n Args:\n virtual_iface (string): The name of the pkg_resources entry point corresponding to\n the interface. It should be in group iotile.virtual_interface\n config (dict): A dictionary with a 'interface' key with the config info f... |
Please provide a description of the function:def generate(env):
try:
bld = env['BUILDERS']['Tar']
except KeyError:
bld = TarBuilder
env['BUILDERS']['Tar'] = bld
env['TAR'] = env.Detect(tars) or 'gtar'
env['TARFLAGS'] = SCons.Util.CLVar('-c')
env['TARCOM'] =... | [
"Add Builders and construction variables for tar to an Environment."
] |
Please provide a description of the function:def register_command(self, name, handler, validator):
self._commands[name] = (handler, validator) | [
"Register a coroutine command handler.\n\n This handler will be called whenever a command message is received\n from the client, whose operation key matches ``name``. The handler\n will be called as::\n\n response_payload = await handler(cmd_payload, context)\n\n If the corou... |
Please provide a description of the function:async def start(self):
if self._server_task is not None:
self._logger.debug("AsyncValidatingWSServer.start() called twice, ignoring")
return
started_signal = self._loop.create_future()
self._server_task = self._loop.... | [
"Start the websocket server.\n\n When this method returns, the websocket server will be running and\n the port property of this class will have its assigned port number.\n\n This method should be called only once in the lifetime of the server\n and must be paired with a call to stop() to... |
Please provide a description of the function:async def _run_server_task(self, started_signal):
try:
server = await websockets.serve(self._manage_connection, self.host, self.port)
port = server.sockets[0].getsockname()[1]
started_signal.set_result(port)
excep... | [
"Create a BackgroundTask to manage the server.\n\n This allows subclasess to attach their server related tasks as\n subtasks that are properly cleaned up when this parent task is\n stopped and not require them all to overload start() and stop()\n to perform this action.\n "
] |
Please provide a description of the function:async def send_event(self, con, name, payload):
message = dict(type="event", name=name, payload=payload)
encoded = pack(message)
await con.send(encoded) | [
"Send an event to a client connection.\n\n This method will push an event message to the client with the given\n name and payload. You need to have access to the the ``connection``\n object for the client, which is only available once the client has\n connected and passed to self.prepar... |
Please provide a description of the function:def encode(self):
header = struct.pack("<LB3x", len(self.record_contents) + UpdateRecord.HEADER_LENGTH, self.record_type)
return bytearray(header) + self.record_contents | [
"Encode this record into binary, suitable for embedded into an update script.\n\n This function just adds the required record header and copies the raw data\n we were passed in verbatim since we don't know what it means\n\n Returns:\n bytearary: The binary version of the record that ... |
Please provide a description of the function:def DviPdfPsFunction(XXXDviAction, target = None, source= None, env=None):
try:
abspath = source[0].attributes.path
except AttributeError :
abspath = ''
saved_env = SCons.Scanner.LaTeX.modify_env_var(env, 'TEXPICTS', abspath)
result =... | [
"A builder for DVI files that sets the TEXPICTS environment\n variable before running dvi2ps or dvipdf."
] |
Please provide a description of the function:def DviPdfStrFunction(target = None, source= None, env=None):
if env.GetOption("no_exec"):
result = env.subst('$DVIPDFCOM',0,target,source)
else:
result = ''
return result | [
"A strfunction for dvipdf that returns the appropriate\n command string for the no_exec options."
] |
Please provide a description of the function:def PDFEmitter(target, source, env):
def strip_suffixes(n):
return not SCons.Util.splitext(str(n))[1] in ['.aux', '.log']
source = [src for src in source if strip_suffixes(src)]
return (target, source) | [
"Strips any .aux or .log files from the input source list.\n These are created by the TeX Builder that in all likelihood was\n used to generate the .dvi file we're using as input, and we only\n care about the .dvi file.\n "
] |
Please provide a description of the function:def generate(env):
global PDFAction
if PDFAction is None:
PDFAction = SCons.Action.Action('$DVIPDFCOM', '$DVIPDFCOMSTR')
global DVIPDFAction
if DVIPDFAction is None:
DVIPDFAction = SCons.Action.Action(DviPdfFunction, strfunction = DviPdf... | [
"Add Builders and construction variables for dvipdf to an Environment."
] |
Please provide a description of the function:def FromString(cls, desc):
parse_exp = Literal(u'run_time').suppress() + time_interval(u'interval')
try:
data = parse_exp.parseString(desc)
return TimeBasedStopCondition(data[u'interval'][0])
except ParseException:
... | [
"Parse this stop condition from a string representation.\n\n The string needs to match:\n run_time number [seconds|minutes|hours|days|months|years]\n\n Args:\n desc (str): The description\n\n Returns:\n TimeBasedStopCondition\n "
] |
Please provide a description of the function:def generate(env):
SCons.Tool.createStaticLibBuilder(env)
SCons.Tool.createSharedLibBuilder(env)
SCons.Tool.createProgBuilder(env)
env['AR'] = 'mwld'
env['ARCOM'] = '$AR $ARFLAGS -library -o $TARGET $SOURCES'
env['LIBDIRPREFIX'] = '-L'
env[... | [
"Add Builders and construction variables for lib to an Environment."
] |
Please provide a description of the function:def collectintargz(target, source, env):
# the rpm tool depends on a source package, until this is changed
# this hack needs to be here that tries to pack all sources in.
sources = env.FindSourceFiles()
# filter out the target we are building the source... | [
" Puts all source files into a tar.gz file. "
] |
Please provide a description of the function:def build_specfile(target, source, env):
file = open(target[0].get_abspath(), 'w')
try:
file.write( build_specfile_header(env) )
file.write( build_specfile_sections(env) )
file.write( build_specfile_filesection(env, source) )
fil... | [
" Builds a RPM specfile from a dictionary with string metadata and\n by analyzing a tree of nodes.\n "
] |
Please provide a description of the function:def build_specfile_sections(spec):
str = ""
mandatory_sections = {
'DESCRIPTION' : '\n%%description\n%s\n\n', }
str = str + SimpleTagCompiler(mandatory_sections).compile( spec )
optional_sections = {
'DESCRIPTION_' : '%%descrip... | [
" Builds the sections of a rpm specfile.\n "
] |
Please provide a description of the function:def build_specfile_header(spec):
str = ""
# first the mandatory sections
mandatory_header_fields = {
'NAME' : '%%define name %s\nName: %%{name}\n',
'VERSION' : '%%define version %s\nVersion: %%{version}\n',
'PACKAGEV... | [
" Builds all sections but the %file of a rpm specfile\n "
] |
Please provide a description of the function:def build_specfile_filesection(spec, files):
str = '%files\n'
if 'X_RPM_DEFATTR' not in spec:
spec['X_RPM_DEFATTR'] = '(-,root,root)'
str = str + '%%defattr %s\n' % spec['X_RPM_DEFATTR']
supported_tags = {
'PACKAGING_CONFIG' ... | [
" builds the %file section of the specfile\n "
] |
Please provide a description of the function:def compile(self, values):
def is_international(tag):
return tag.endswith('_')
def get_country_code(tag):
return tag[-2:]
def strip_country_code(tag):
return tag[:-2]
replacements = list(self.tag... | [
" Compiles the tagset and returns a str containing the result\n "
] |
Please provide a description of the function:def generate(env):
fscan = FortranScan("FORTRANPATH")
SCons.Tool.SourceFileScanner.add_scanner('.i', fscan)
SCons.Tool.SourceFileScanner.add_scanner('.i90', fscan)
if 'FORTRANFILESUFFIXES' not in env:
env['FORTRANFILESUFFIXES'] = ['.i']
else... | [
"Add Builders and construction variables for ifl to an Environment."
] |
Please provide a description of the function:def generate(env):
findIt('bcc32', env)
static_obj, shared_obj = SCons.Tool.createObjBuilders(env)
for suffix in ['.c', '.cpp']:
static_obj.add_action(suffix, SCons.Defaults.CAction)
shared_obj.add_action(suffix, SCons.Defaults.ShCAction)
... | [
"Add Builders and construction variables for bcc to an\n Environment."
] |
Please provide a description of the function:def require(builder_name):
reg = ComponentRegistry()
for _name, autobuild_func in reg.load_extensions('iotile.autobuild', name_filter=builder_name):
return autobuild_func
raise BuildError('Cannot find required autobuilder, make sure the distributio... | [
"Find an advertised autobuilder and return it\n\n This function searches through all installed distributions to find\n if any advertise an entry point with group 'iotile.autobuild' and\n name equal to builder_name. The first one that is found is returned.\n\n This function raises a BuildError if it can... |
Please provide a description of the function:def autobuild_onlycopy():
try:
# Build only release information
family = utilities.get_family('module_settings.json')
autobuild_release(family)
Alias('release', os.path.join('build', 'output'))
Default(['release'])
except... | [
"Autobuild a project that does not require building firmware, pcb or documentation\n "
] |
Please provide a description of the function:def autobuild_docproject():
try:
#Build only release information
family = utilities.get_family('module_settings.json')
autobuild_release(family)
autobuild_documentation(family.tile)
except unit_test.IOTileException as e:
... | [
"Autobuild a project that only contains documentation"
] |
Please provide a description of the function:def autobuild_release(family=None):
if family is None:
family = utilities.get_family('module_settings.json')
env = Environment(tools=[])
env['TILE'] = family.tile
target = env.Command(['#build/output/module_settings.json'], ['#module_settings.... | [
"Copy necessary files into build/output so that this component can be used by others\n\n Args:\n family (ArchitectureGroup): The architecture group that we are targeting. If not\n provided, it is assumed that we are building in the current directory and the\n module_settings.json fi... |
Please provide a description of the function:def autobuild_arm_program(elfname, test_dir=os.path.join('firmware', 'test'), patch=True):
try:
#Build for all targets
family = utilities.get_family('module_settings.json')
family.for_all_targets(family.tile.short_name, lambda x: arm.build_p... | [
"\n Build the an ARM module for all targets and build all unit tests. If pcb files are given, also build those.\n "
] |
Please provide a description of the function:def autobuild_doxygen(tile):
iotile = IOTile('.')
doxydir = os.path.join('build', 'doc')
doxyfile = os.path.join(doxydir, 'doxygen.txt')
outfile = os.path.join(doxydir, '%s.timestamp' % tile.unique_id)
env = Environment(ENV=os.environ, tools=[])
... | [
"Generate documentation for firmware in this module using doxygen"
] |
Please provide a description of the function:def autobuild_documentation(tile):
docdir = os.path.join('#doc')
docfile = os.path.join(docdir, 'conf.py')
outdir = os.path.join('build', 'output', 'doc', tile.unique_id)
outfile = os.path.join(outdir, '%s.timestamp' % tile.unique_id)
env = Environ... | [
"Generate documentation for this module using a combination of sphinx and breathe"
] |
Please provide a description of the function:def autobuild_trub_script(file_name, slot_assignments=None, os_info=None, sensor_graph=None,
app_info=None, use_safeupdate=False):
build_update_script(file_name, slot_assignments, os_info, sensor_graph, app_info, use_safeupdate) | [
"Build a trub script that loads given firmware into the given slots.\n\n slot_assignments should be a list of tuples in the following form:\n (\"slot X\" or \"controller\", firmware_image_name)\n\n The output of this autobuild action will be a trub script in\n build/output/<file_name> that assigns the g... |
Please provide a description of the function:def autobuild_bootstrap_file(file_name, image_list):
family = utilities.get_family('module_settings.json')
target = family.platform_independent_target()
resolver = ProductResolver.Create()
env = Environment(tools=[])
output_dir = target.build_dirs... | [
"Combine multiple firmware images into a single bootstrap hex file.\n\n The files listed in image_list must be products of either this tile or any\n dependency tile and should correspond exactly with the base name listed on\n the products section of the module_settings.json file of the corresponding\n t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.