Code
stringlengths
103
85.9k
Summary
listlengths
0
94
Please provide a description of the function:def enable_streaming(self): if not self.connected: raise HardwareError("Cannot enable streaming if we are not in a connected state") if self._reports is not None: _clear_queue(self._reports) return self._reports ...
[ "Open the streaming interface and accumute reports in a queue.\n\n This method is safe to call multiple times in a single device\n connection. There is no way to check if the streaming interface is\n opened or to close it once it is opened (apart from disconnecting from\n the device).\n\...
Please provide a description of the function:def enable_tracing(self): if not self.connected: raise HardwareError("Cannot enable tracing if we are not in a connected state") if self._traces is not None: _clear_queue(self._traces) return self._traces ...
[ "Open the tracing interface and accumulate traces in a queue.\n\n This method is safe to call multiple times in a single device\n connection. There is no way to check if the tracing interface is\n opened or to close it once it is opened (apart from disconnecting from\n the device).\n\n ...
Please provide a description of the function:def enable_broadcasting(self): if self._broadcast_reports is not None: _clear_queue(self._broadcast_reports) return self._broadcast_reports self._broadcast_reports = queue.Queue() return self._broadcast_reports
[ "Begin accumulating broadcast reports received from all devices.\n\n This method will allocate a queue to receive broadcast reports that\n will be filled asynchronously as broadcast reports are received.\n\n Returns:\n queue.Queue: A queue that will be filled with braodcast reports.\...
Please provide a description of the function:def enable_debug(self): if not self.connected: raise HardwareError("Cannot enable debug if we are not in a connected state") self._loop.run_coroutine(self.adapter.open_interface(0, 'debug'))
[ "Open the debug interface on the connected device." ]
Please provide a description of the function:def debug_command(self, cmd, args=None, progress_callback=None): if args is None: args = {} try: self._on_progress = progress_callback return self._loop.run_coroutine(self.adapter.debug(0, cmd, args)) fin...
[ "Send a debug command to the connected device.\n\n This generic method will send a named debug command with the given\n arguments to the connected device. Debug commands are typically used\n for things like forcible reflashing of firmware or other, debug-style,\n operations. Not all tr...
Please provide a description of the function:def close(self): try: self._loop.run_coroutine(self.adapter.stop()) finally: self._save_recording()
[ "Close this adapter stream.\n\n This method may only be called once in the lifetime of an\n AdapterStream and it will shutdown the underlying device adapter,\n disconnect all devices and stop all background activity.\n\n If this stream is configured to save a record of all RPCs, the RPCs...
Please provide a description of the function:def _on_scan(self, info): device_id = info['uuid'] expiration_time = info.get('validity_period', 60) infocopy = deepcopy(info) infocopy['expiration_time'] = monotonic() + expiration_time with self._scan_lock: se...
[ "Callback called when a new device is discovered on this CMDStream\n\n Args:\n info (dict): Information about the scanned device\n " ]
Please provide a description of the function:def _on_disconnect(self): self._logger.info("Connection to device %s was interrupted", self.connection_string) self.connection_interrupted = True
[ "Callback when a device is disconnected unexpectedly.\n\n Args:\n adapter_id (int): An ID for the adapter that was connected to the device\n connection_id (int): An ID for the connection that has become disconnected\n " ]
Please provide a description of the function:def midl_emitter(target, source, env): base, _ = SCons.Util.splitext(str(target[0])) tlb = target[0] incl = base + '.h' interface = base + '_i.c' targets = [tlb, incl, interface] midlcom = env['MIDLCOM'] if midlcom.find('/proxy') != -1: ...
[ "Produces a list of outputs from the MIDL compiler" ]
Please provide a description of the function:def generate(env): env['MIDL'] = 'MIDL.EXE' env['MIDLFLAGS'] = SCons.Util.CLVar('/nologo') env['MIDLCOM'] = '$MIDL $MIDLFLAGS /tlb ${TARGETS[0]} /h ${TARGETS[1]} /iid ${TARGETS[2]} /proxy ${TARGETS[3]} /dlldata ${TARGETS[4]} $SOURCE 2> NU...
[ "Add Builders and construction variables for midl to an Environment." ]
Please provide a description of the function:def generate(env): SCons.Tool.bcc32.findIt('tlib', env) SCons.Tool.createStaticLibBuilder(env) env['AR'] = 'tlib' env['ARFLAGS'] = SCons.Util.CLVar('') env['ARCOM'] = '$AR $TARGET $ARFLAGS /a $SOURCES' env['LIBPREFIX'] = '' ...
[ "Add Builders and construction variables for ar to an Environment." ]
Please provide a description of the function:def File(name, dbm_module=None): global ForDirectory, DB_Name, DB_Module if name is None: ForDirectory = DirFile DB_Module = None else: ForDirectory = DB DB_Name = name if not dbm_module is None: DB_Module ...
[ "\n Arrange for all signatures to be stored in a global .sconsign.db*\n file.\n " ]
Please provide a description of the function:def set_entry(self, filename, obj): self.entries[filename] = obj self.dirty = True
[ "\n Set the entry.\n " ]
Please provide a description of the function:def write(self, sync=1): if not self.dirty: return self.merge() temp = os.path.join(self.dir.get_internal_path(), '.scons%d' % os.getpid()) try: file = open(temp, 'wb') fname = temp except...
[ "\n Write the .sconsign file to disk.\n\n Try to write to a temporary file first, and rename it if we\n succeed. If we can't write to the temporary file, it's\n probably because the directory isn't writable (and if so,\n how did we build anything in this directory, anyway?), so\n...
Please provide a description of the function:def generate(env): link.generate(env) env['LINK'] = env.Detect(linkers) or 'cc' env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -shared') # __RPATH is set to $_RPATH in the platform specification if that # platform supports it. env['RPATH...
[ "Add Builders and construction variables for MIPSPro to an Environment." ]
Please provide a description of the function:def Dump(title=None): if title: print(title) for counter in sorted(CounterList): CounterList[counter].display()
[ " Dump the hit/miss count for all the counters\n collected so far.\n " ]
Please provide a description of the function:def CountMethodCall(fn): if use_memoizer: def wrapper(self, *args, **kwargs): global CounterList key = self.__class__.__name__+'.'+fn.__name__ if key not in CounterList: CounterList[key] = CountValue(self._...
[ " Decorator for counting memoizer hits/misses while retrieving\n a simple value in a class method. It wraps the given method\n fn and uses a CountValue object to keep track of the\n caching statistics.\n Wrapping gets enabled by calling EnableMemoization().\n " ]
Please provide a description of the function:def CountDictCall(keyfunc): def decorator(fn): if use_memoizer: def wrapper(self, *args, **kwargs): global CounterList key = self.__class__.__name__+'.'+fn.__name__ if key not in CounterList: ...
[ " Decorator for counting memoizer hits/misses while accessing\n dictionary values with a key-generating function. Like\n CountMethodCall above, it wraps the given method\n fn and uses a CountDict object to keep track of the\n caching statistics. The dict-key function keyfunc has to\n ...
Please provide a description of the function:def count(self, *args, **kw): obj = args[0] if self.method_name in obj._memo: self.hit = self.hit + 1 else: self.miss = self.miss + 1
[ " Counts whether the memoized value has already been\n set (a hit) or not (a miss).\n " ]
Please provide a description of the function:def count(self, *args, **kw): obj = args[0] try: memo_dict = obj._memo[self.method_name] except KeyError: self.miss = self.miss + 1 else: key = self.keymaker(*args, **kw) if key in memo_...
[ " Counts whether the computed key value is already present\n in the memoization dictionary (a hit) or not (a miss).\n " ]
Please provide a description of the function:async def start(self): await self.server.start() self.port = self.server.port
[ "Start the supervisor server." ]
Please provide a description of the function:async def prepare_conn(self, conn): client_id = str(uuid.uuid4()) monitor = functools.partial(self.send_event, client_id) self._logger.info("New client connection: %s", client_id) self.service_manager.add_monitor(monitor) ...
[ "Setup a new connection from a client." ]
Please provide a description of the function:async def teardown_conn(self, context): client_id = context.user_data self._logger.info("Tearing down client connection: %s", client_id) if client_id not in self.clients: self._logger.warning("client_id %s did not exist in teard...
[ "Teardown a connection from a client." ]
Please provide a description of the function:async def send_event(self, client_id, service_name, event_name, event_info, directed_client=None): if directed_client is not None and directed_client != client_id: return client_info = self.clients.get(client_id) if client_info ...
[ "Send an event to a client." ]
Please provide a description of the function:async def send_rpc(self, msg, _context): service = msg.get('name') rpc_id = msg.get('rpc_id') payload = msg.get('payload') timeout = msg.get('timeout') response_id = await self.service_manager.send_rpc_command(service, rpc_i...
[ "Send an RPC to a service on behalf of a client." ]
Please provide a description of the function:async def respond_rpc(self, msg, _context): rpc_id = msg.get('response_uuid') result = msg.get('result') payload = msg.get('response') self.service_manager.send_rpc_response(rpc_id, result, payload)
[ "Respond to an RPC previously sent to a service." ]
Please provide a description of the function:async def set_agent(self, msg, context): service = msg.get('name') client = context.user_data self.service_manager.set_agent(service, client)
[ "Mark a client as the RPC agent for a service." ]
Please provide a description of the function:async def post_heartbeat(self, msg, _context): name = msg.get('name') await self.service_manager.send_heartbeat(name)
[ "Update the status of a service." ]
Please provide a description of the function:async def update_state(self, msg, _context): name = msg.get('name') status = msg.get('new_status') await self.service_manager.update_state(name, status)
[ "Update the status of a service." ]
Please provide a description of the function:async def service_messages(self, msg, _context): msgs = self.service_manager.service_messages(msg.get('name')) return [x.to_dict() for x in msgs]
[ "Get all messages for a service." ]
Please provide a description of the function:async def service_headline(self, msg, _context): headline = self.service_manager.service_headline(msg.get('name')) if headline is not None: headline = headline.to_dict() return headline
[ "Get the headline for a service." ]
Please provide a description of the function:def generate(env): static_obj, shared_obj = SCons.Tool.createObjBuilders(env) for suffix in ASSuffixes: static_obj.add_action(suffix, SCons.Defaults.ASAction) static_obj.add_emitter(suffix, SCons.Defaults.StaticObjectEmitter) for suffix in ...
[ "Add Builders and construction variables for nasm to an Environment." ]
Please provide a description of the function:def generate(env): link.generate(env) env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -G') env['RPATHPREFIX'] = '-R' env['RPATHSUFFIX'] = '' env['_RPATH'] = '${_concat(RPATHPREFIX, RPATH, RPATHSUFFIX, __env__)}' # Support for versioned l...
[ "Add Builders and construction variables for Forte to an Environment." ]
Please provide a description of the function:def _get_short_description(self): if self.description is None: return None lines = [x for x in self.description.split('\n')] if len(lines) == 1: return lines[0] elif len(lines) >= 3 and lines[1] == '': ...
[ "Return the first line of a multiline description\n\n Returns:\n string: The short description, otherwise None\n " ]
Please provide a description of the function:def _get_long_description(self): if self.description is None: return None lines = [x for x in self.description.split('\n')] if len(lines) == 1: return None elif len(lines) >= 3 and lines[1] == '': ...
[ "Return the subsequent lines of a multiline description\n\n Returns:\n string: The long description, otherwise None\n " ]
Please provide a description of the function:def wrap_lines(self, text, indent_level, indent_size=4): indent = ' '*indent_size*indent_level lines = text.split('\n') wrapped_lines = [] for line in lines: if line == '': wrapped_lines.append(line) ...
[ "Indent a multiline string\n\n Args:\n text (string): The string to indent\n indent_level (int): The number of indent_size spaces to prepend\n to each line\n indent_size (int): The number of spaces to prepend for each indent\n level\n\n Re...
Please provide a description of the function:def format_name(self, name, indent_size=4): name_block = '' if self.short_desc is None: name_block += name + '\n' else: name_block += name + ': ' + self.short_desc + '\n' if self.long_desc is not None: ...
[ "Format the name of this verifier\n\n The name will be formatted as:\n <name>: <short description>\n long description if one is given followed by \\n\n otherwise no long description\n\n Args:\n name (string): A name for this validator\n in...
Please provide a description of the function:def trim_whitespace(self, text): lines = text.split('\n') new_lines = [x.lstrip() for x in lines] return '\n'.join(new_lines)
[ "Remove leading whitespace from each line of a multiline string\n\n Args:\n text (string): The text to be unindented\n\n Returns:\n string: The unindented block of text\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) try: online, = struct.unpack("<H", payload) online = bool(online) except ValueError: ...
[ "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 SetGraphOnlineRecord.\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 __extend_targets_sources(target, source): if not SCons.Util.is_List(target): target = [target] if not source: source = target[:] elif not SCons.Util.is_List(source): source = [source] if len(target) < len(source): targ...
[ " Prepare the lists of target and source files. " ]
Please provide a description of the function:def __select_builder(lxml_builder, libxml2_builder, cmdline_builder): if prefer_xsltproc: return cmdline_builder if not has_libxml2: # At the moment we prefer libxml2 over lxml, the latter can lead # to conflicts when installed toget...
[ " Selects a builder, based on which Python modules are present. " ]
Please provide a description of the function:def __ensure_suffix(t, suffix): tpath = str(t) if not tpath.endswith(suffix): return tpath+suffix return t
[ " Ensure that the target t has the given suffix. " ]
Please provide a description of the function:def __ensure_suffix_stem(t, suffix): tpath = str(t) if not tpath.endswith(suffix): stem = tpath tpath += suffix return tpath, stem else: stem, ext = os.path.splitext(tpath) return t, stem
[ " Ensure that the target t has the given suffix, and return the file's stem. " ]
Please provide a description of the function:def __get_xml_text(root): txt = "" for e in root.childNodes: if (e.nodeType == e.TEXT_NODE): txt += e.data return txt
[ " Return the text for the given root node (xml.dom.minidom). " ]
Please provide a description of the function:def __create_output_dir(base_dir): root, tail = os.path.split(base_dir) dir = None if tail: if base_dir.endswith('/'): dir = base_dir else: dir = root else: if base_dir.endswith('/'): dir = base...
[ " Ensure that the output directory base_dir exists. " ]
Please provide a description of the function:def __detect_cl_tool(env, chainkey, cdict, cpriority=None): if env.get(chainkey,'') == '': clpath = '' if cpriority is None: cpriority = cdict.keys() for cltool in cpriority: if __debug_tool_location: ...
[ "\n Helper function, picks a command line tool from the list\n and initializes its environment variables.\n " ]
Please provide a description of the function:def _detect(env): global prefer_xsltproc if env.get('DOCBOOK_PREFER_XSLTPROC',''): prefer_xsltproc = True if ((not has_libxml2 and not has_lxml) or (prefer_xsltproc)): # Try to find the XSLT processors __detect_cl_tool(e...
[ "\n Detect all the command line tools that we might need for creating\n the requested output formats.\n " ]
Please provide a description of the function:def __xml_scan(node, env, path, arg): # Does the node exist yet? if not os.path.isfile(str(node)): return [] if env.get('DOCBOOK_SCANENT',''): # Use simple pattern matching for system entities..., no support # for recursion yet....
[ " Simple XML file scanner, detecting local images and XIncludes as implicit dependencies. " ]
Please provide a description of the function:def __build_libxml2(target, source, env): xsl_style = env.subst('$DOCBOOK_XSL') styledoc = libxml2.parseFile(xsl_style) style = libxslt.parseStylesheetDoc(styledoc) doc = libxml2.readFile(str(source[0]),None,libxml2.XML_PARSE_NOENT) # Support for add...
[ "\n General XSLT builder (HTML/FO), using the libxml2 module.\n " ]
Please provide a description of the function:def __build_lxml(target, source, env): from lxml import etree xslt_ac = etree.XSLTAccessControl(read_file=True, write_file=True, create_dir=True, ...
[ "\n General XSLT builder (HTML/FO), using the lxml module.\n " ]
Please provide a description of the function:def __xinclude_libxml2(target, source, env): doc = libxml2.readFile(str(source[0]), None, libxml2.XML_PARSE_NOENT) doc.xincludeProcessFlags(libxml2.XML_PARSE_NOENT) doc.saveFile(str(target[0])) doc.freeDoc() return None
[ "\n Resolving XIncludes, using the libxml2 module.\n " ]
Please provide a description of the function:def __xinclude_lxml(target, source, env): from lxml import etree doc = etree.parse(str(source[0])) doc.xinclude() try: doc.write(str(target[0]), xml_declaration=True, encoding="UTF-8", pretty_print=True) except: ...
[ "\n Resolving XIncludes, using the lxml module.\n " ]
Please provide a description of the function:def DocbookEpub(env, target, source=None, *args, **kw): import zipfile import shutil def build_open_container(target, source, env): zf = zipfile.ZipFile(str(target[0]), 'w') mime_file = open('mimetype', 'w') mime_file.wr...
[ "\n A pseudo-Builder, providing a Docbook toolchain for ePub output.\n ", "Generate the *.epub file from intermediate outputs\n\n Constructs the epub file according to the Open Container Format. This \n function could be replaced by a call to the SCons Zip builder if support\n was added...
Please provide a description of the function:def DocbookHtml(env, target, source=None, *args, **kw): # Init list of targets/sources target, source = __extend_targets_sources(target, source) # Init XSL stylesheet __init_xsl_stylesheet(kw, env, '$DOCBOOK_DEFAULT_XSL_HTML', ['html','docbook.xsl']...
[ "\n A pseudo-Builder, providing a Docbook toolchain for HTML output.\n " ]
Please provide a description of the function:def DocbookMan(env, target, source=None, *args, **kw): # Init list of targets/sources target, source = __extend_targets_sources(target, source) # Init XSL stylesheet __init_xsl_stylesheet(kw, env, '$DOCBOOK_DEFAULT_XSL_MAN', ['manpages','docbook.xsl']) ...
[ "\n A pseudo-Builder, providing a Docbook toolchain for Man page output.\n " ]
Please provide a description of the function:def DocbookSlidesPdf(env, target, source=None, *args, **kw): # Init list of targets/sources target, source = __extend_targets_sources(target, source) # Init XSL stylesheet __init_xsl_stylesheet(kw, env, '$DOCBOOK_DEFAULT_XSL_SLIDESPDF', ['slides','fo','...
[ "\n A pseudo-Builder, providing a Docbook toolchain for PDF slides output.\n " ]
Please provide a description of the function:def DocbookSlidesHtml(env, target, source=None, *args, **kw): # Init list of targets/sources if not SCons.Util.is_List(target): target = [target] if not source: source = target target = ['index.html'] elif not SCons.Util.is_List(s...
[ "\n A pseudo-Builder, providing a Docbook toolchain for HTML slides output.\n " ]
Please provide a description of the function:def DocbookXInclude(env, target, source, *args, **kw): # Init list of targets/sources target, source = __extend_targets_sources(target, source) # Setup builder __builder = __select_builder(__xinclude_lxml_builder,__xinclude_libxml2_builder,__xmllint_bui...
[ "\n A pseudo-Builder, for resolving XIncludes in a separate processing step.\n " ]
Please provide a description of the function:def DocbookXslt(env, target, source=None, *args, **kw): # Init list of targets/sources target, source = __extend_targets_sources(target, source) # Init XSL stylesheet kw['DOCBOOK_XSL'] = kw.get('xsl', 'transform.xsl') # Setup builder __buil...
[ "\n A pseudo-Builder, applying a simple XSL transformation to the input file.\n " ]
Please provide a description of the function:def generate(env): env.SetDefault( # Default names for customized XSL stylesheets DOCBOOK_DEFAULT_XSL_EPUB = '', DOCBOOK_DEFAULT_XSL_HTML = '', DOCBOOK_DEFAULT_XSL_HTMLCHUNKED = '', DOCBOOK_DEFAULT_XSL_HTMLHELP = '', ...
[ "Add Builders and construction variables for docbook to an Environment." ]
Please provide a description of the function:def execute(self, sensor_graph, scope_stack): parent = scope_stack[-1] alloc = parent.allocator trigger_stream, trigger_cond = parent.trigger_chain() op = 'copy_latest_a' if self.all: op = 'copy_all_a' e...
[ "Execute this statement on the sensor_graph given the current scope tree.\n\n This adds a single node to the sensor graph with either the\n copy_latest_a, copy_all_a or average_a function as is processing function.\n\n If there is an explicit stream passed, that is used as input a with the\n ...
Please provide a description of the function:def verify(self, obj): if self.encoding == 'none' and not isinstance(obj, (bytes, bytearray)): raise ValidationError('Byte object was not either bytes or a bytearray', type=obj.__class__.__name__) elif self.encoding == 'base64': ...
[ "Verify that the object conforms to this verifier's schema\n\n Args:\n obj (object): A python object to verify\n\n Returns:\n bytes or byterray: The decoded byte buffer\n\n Raises:\n ValidationError: If there is a problem verifying the object, a\n ...
Please provide a description of the function:def format(self, indent_level, indent_size=4): name = self.format_name('Bytes', indent_size) return self.wrap_lines(name, indent_level, indent_size)
[ "Format this verifier\n\n Returns:\n string: A formatted string\n " ]
Please provide a description of the function:def save(self): try: with open(self.path, "w") as f: f.writelines(self.contents) except IOError as e: raise InternalError("Could not write RCFile contents", name=self.name, path=self.path, error_message=str(e)...
[ "Update the configuration file on disk with the current contents of self.contents.\n Previous contents are overwritten.\n " ]
Please provide a description of the function:async def probe_message(self, _message, context): client_id = context.user_data await self.probe(client_id)
[ "Handle a probe message.\n\n See :meth:`AbstractDeviceAdapter.probe`.\n " ]
Please provide a description of the function:async def connect_message(self, message, context): conn_string = message.get('connection_string') client_id = context.user_data await self.connect(client_id, conn_string)
[ "Handle a connect message.\n\n See :meth:`AbstractDeviceAdapter.connect`.\n " ]
Please provide a description of the function:async def disconnect_message(self, message, context): conn_string = message.get('connection_string') client_id = context.user_data await self.disconnect(client_id, conn_string)
[ "Handle a disconnect message.\n\n See :meth:`AbstractDeviceAdapter.disconnect`.\n " ]
Please provide a description of the function:async def open_interface_message(self, message, context): conn_string = message.get('connection_string') interface = message.get('interface') client_id = context.user_data await self.open_interface(client_id, conn_string, interface)
[ "Handle an open_interface message.\n\n See :meth:`AbstractDeviceAdapter.open_interface`.\n " ]
Please provide a description of the function:async def close_interface_message(self, message, context): conn_string = message.get('connection_string') interface = message.get('interface') client_id = context.user_data await self.close_interface(client_id, conn_string, interfac...
[ "Handle a close_interface message.\n\n See :meth:`AbstractDeviceAdapter.close_interface`.\n " ]
Please provide a description of the function:async def send_rpc_message(self, message, context): conn_string = message.get('connection_string') rpc_id = message.get('rpc_id') address = message.get('address') timeout = message.get('timeout') payload = message.get('payloa...
[ "Handle a send_rpc message.\n\n See :meth:`AbstractDeviceAdapter.send_rpc`.\n " ]
Please provide a description of the function:async def send_script_message(self, message, context): script = message.get('script') conn_string = message.get('connection_string') client_id = context.user_data if message.get('fragment_count') != 1: raise DeviceServer...
[ "Handle a send_script message.\n\n See :meth:`AbstractDeviceAdapter.send_script`.\n " ]
Please provide a description of the function:async def debug_command_message(self, message, context): conn_string = message.get('connection_string') command = message.get('command') args = message.get('args') client_id = context.user_data result = await self.debug(clie...
[ "Handle a debug message.\n\n See :meth:`AbstractDeviceAdapter.debug`.\n " ]
Please provide a description of the function:async def client_event_handler(self, client_id, event_tuple, user_data): #TODO: Support sending disconnection events conn_string, event_name, event = event_tuple if event_name == 'report': report = event.serialize() ...
[ "Forward an event on behalf of a client.\n\n This method is called by StandardDeviceServer when it has an event that\n should be sent to a client.\n\n Args:\n client_id (str): The client that we should send this event to\n event_tuple (tuple): The conn_string, event_name a...
Please provide a description of the function:def generate(env): add_all_to_env(env) fcomp = env.Detect(compilers) or 'f90' env['FORTRAN'] = fcomp env['F90'] = fcomp env['SHFORTRAN'] = '$FORTRAN' env['SHF90'] = '$F90' env['SHFORTRANFLAGS'] = SCons.Util.CLVar('$FORTRANFLAGS...
[ "Add Builders and construction variables for sun f90 compiler to an\n Environment." ]
Please provide a description of the function:def Builder(**kw): composite = None if 'generator' in kw: if 'action' in kw: raise UserError("You must not specify both an action and a generator.") kw['action'] = SCons.Action.CommandGeneratorAction(kw['generator'], {}) del k...
[ "A factory for builder objects." ]
Please provide a description of the function:def _node_errors(builder, env, tlist, slist): # First, figure out if there are any errors in the way the targets # were specified. for t in tlist: if t.side_effect: raise UserError("Multiple ways to build the same target were specified f...
[ "Validate that the lists of target and source nodes are\n legal for this builder and environment. Raise errors or\n issue warnings as appropriate.\n " ]
Please provide a description of the function:def is_a_Builder(obj): return (isinstance(obj, BuilderBase) or isinstance(obj, CompositeBuilder) or callable(obj))
[ "\"Returns True if the specified obj is one of our Builder classes.\n\n The test is complicated a bit by the fact that CompositeBuilder\n is a proxy, not a subclass of BuilderBase.\n " ]
Please provide a description of the function:def get_name(self, env): try: index = list(env['BUILDERS'].values()).index(self) return list(env['BUILDERS'].keys())[index] except (AttributeError, KeyError, TypeError, ValueError): try: return sel...
[ "Attempts to get the name of the Builder.\n\n Look at the BUILDERS variable of env, expecting it to be a\n dictionary containing this Builder, and return the key of the\n dictionary. If there's no key, then return a directly-configured\n name (if there is one) or the name of the class (...
Please provide a description of the function:def _create_nodes(self, env, target = None, source = None): src_suf = self.get_src_suffix(env) target_factory = env.get_factory(self.target_factory) source_factory = env.get_factory(self.source_factory) source = self._adjustixes(sou...
[ "Create and return lists of target and source nodes.\n " ]
Please provide a description of the function:def _get_sdict(self, env): sdict = {} for bld in self.get_src_builders(env): for suf in bld.src_suffixes(env): sdict[suf] = bld return sdict
[ "\n Returns a dictionary mapping all of the source suffixes of all\n src_builders of this Builder to the underlying Builder that\n should be called first.\n\n This dictionary is used for each target specified, so we save a\n lot of extra computation by memoizing it for each constr...
Please provide a description of the function:def get_src_builders(self, env): memo_key = id(env) try: memo_dict = self._memo['get_src_builders'] except KeyError: memo_dict = {} self._memo['get_src_builders'] = memo_dict else: try: ...
[ "\n Returns the list of source Builders for this Builder.\n\n This exists mainly to look up Builders referenced as\n strings in the 'BUILDER' variable of the construction\n environment and cache the result.\n " ]
Please provide a description of the function:def subst_src_suffixes(self, env): memo_key = id(env) try: memo_dict = self._memo['subst_src_suffixes'] except KeyError: memo_dict = {} self._memo['subst_src_suffixes'] = memo_dict else: ...
[ "\n The suffix list may contain construction variable expansions,\n so we have to evaluate the individual strings. To avoid doing\n this over and over, we memoize the results for each construction\n environment.\n " ]
Please provide a description of the function:def src_suffixes(self, env): sdict = {} suffixes = self.subst_src_suffixes(env) for s in suffixes: sdict[s] = 1 for builder in self.get_src_builders(env): for s in builder.src_suffixes(env): if ...
[ "\n Returns the list of source suffixes for all src_builders of this\n Builder.\n\n This is essentially a recursive descent of the src_builder \"tree.\"\n (This value isn't cached because there may be changes in a\n src_builder many levels deep that we can't see.)\n " ]
Please provide a description of the function:def generate(env): link.generate(env) env['SMARTLINKFLAGS'] = smart_linkflags env['LINKFLAGS'] = SCons.Util.CLVar('$SMARTLINKFLAGS') env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -qmkshrobj -qsuppress=1501-218') env['SHLIBSUFFIX'] = '...
[ "\n Add Builders and construction variables for Visual Age linker to\n an Environment.\n " ]
Please provide a description of the function:def retrieve(self, node): if not self.is_enabled(): return False env = node.get_build_env() if cache_show: if CacheRetrieveSilent(node, [], env, execute=1) == 0: node.build(presub=0, execute=0) ...
[ "\n This method is called from multiple threads in a parallel build,\n so only do thread safe stuff here. Do thread unsafe stuff in\n built().\n\n Note that there's a special trick here with the execute flag\n (one that's not normally done for other actions). Basically\n i...
Please provide a description of the function:def generate(env): as_module.generate(env) env['AS'] = '386asm' env['ASFLAGS'] = SCons.Util.CLVar('') env['ASPPFLAGS'] = '$ASFLAGS' env['ASCOM'] = '$AS $ASFLAGS $SOURCES -o $TARGET' env['ASPPCOM'] = '$CC $ASPPFLAGS $CPPFLAGS $_CPP...
[ "Add Builders and construction variables for ar to an Environment." ]
Please provide a description of the function:def _parse_target(target): if len(target) != 8: raise ArgumentError("Invalid targeting data length", expected=8, length=len(target)) slot, match_op = struct.unpack("<B6xB", target) if match_op == _MATCH_CONTROLLER: return {'controller': Tru...
[ "Parse a binary targeting information structure.\n\n This function only supports extracting the slot number or controller from\n the target and will raise an ArgumentError if more complicated targeting\n is desired.\n\n Args:\n target (bytes): The binary targeting data blob.\n\n Returns:\n ...
Please provide a description of the function:def encode_contents(self): header = struct.pack("<LL8sBxxx", self.offset, len(self.raw_data), _create_target(slot=self.slot), self.hardware_type) return bytearray(header) + self.raw_data
[ "Encode the contents of this update record without including a record header.\n\n Returns:\n bytearary: The encoded contents.\n " ]
Please provide a description of the function:def FromBinary(cls, record_data, record_count=1): if len(record_data) < ReflashTileRecord.RecordHeaderLength: raise ArgumentError("Record was too short to contain a full reflash record header", length=len(record_d...
[ "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 ReflashTileRecord.\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 put_task(self, func, args, response): self._rpc_queue.put_nowait((func, args, response))
[ "Place a task onto the RPC queue.\n\n This temporary functionality will go away but it lets you run a\n task synchronously with RPC dispatch by placing it onto the\n RCP queue.\n\n Args:\n func (callable): The function to execute\n args (iterable): The function argu...
Please provide a description of the function:def put_rpc(self, address, rpc_id, arg_payload, response): self._rpc_queue.put_nowait((address, rpc_id, arg_payload, response))
[ "Place an RPC onto the RPC queue.\n\n The rpc will be dispatched asynchronously by the background dispatch\n task. This method must be called from the event loop. This method\n does not block.\n\n Args:\n address (int): The address of the tile with the RPC\n rpc_i...
Please provide a description of the function:def finish_async_rpc(self, address, rpc_id, response): pending = self._pending_rpcs.get(address) if pending is None: raise ArgumentError("No asynchronously RPC currently in progress on tile %d" % address) responder = pending.ge...
[ "Finish a previous asynchronous RPC.\n\n This method should be called by a peripheral tile that previously\n had an RPC called on it and chose to response asynchronously by\n raising ``AsynchronousRPCResponse`` in the RPC handler itself.\n\n The response passed to this function will be r...
Please provide a description of the function:async def stop(self): if self._rpc_task is not None: self._rpc_task.cancel() try: await self._rpc_task except asyncio.CancelledError: pass self._rpc_task = None
[ "Stop the rpc queue from inside the event loop." ]
Please provide a description of the function:def add_segment(self, address, data, overwrite=False): seg_type = self._classify_segment(address, len(data)) if not isinstance(seg_type, DisjointSegment): raise ArgumentError("Unsupported segment type") segment = MemorySegment(a...
[ "Add a contiguous segment of data to this memory map\n\n If the segment overlaps with a segment already added , an\n ArgumentError is raised unless the overwrite flag is True.\n\n Params:\n address (int): The starting address for this segment\n data (bytearray): The data t...
Please provide a description of the function:def _create_slice(self, key): if isinstance(key, slice): step = key.step if step is None: step = 1 if step != 1: raise ArgumentError("You cannot slice with a step that is not equal to 1", ...
[ "Create a slice in a memory segment corresponding to a key." ]
Please provide a description of the function:def _classify_segment(self, address, length): end_address = address + length - 1 _, start_seg = self._find_address(address) _, end_seg = self._find_address(end_address) if start_seg is not None or end_seg is not None: r...
[ "Determine how a new data segment fits into our existing world\n\n Params:\n address (int): The address we wish to classify\n length (int): The length of the segment\n\n Returns:\n int: One of SparseMemoryMap.prepended\n " ]
Please provide a description of the function:def generate(env): SCons.Tool.createSharedLibBuilder(env) SCons.Tool.createProgBuilder(env) env['SUBST_CMD_FILE'] = LinklocGenerator env['SHLINK'] = '$LINK' env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS') env['SHLINKCOM'] = '${SUBST_C...
[ "Add Builders and construction variables for ar to an Environment." ]
Please provide a description of the function:def generate(env): # ifort supports Fortran 90 and Fortran 95 # Additionally, ifort recognizes more file extensions. fscan = FortranScan("FORTRANPATH") SCons.Tool.SourceFileScanner.add_scanner('.i', fscan) SCons.Tool.SourceFileScanner.add_scanner('.i...
[ "Add Builders and construction variables for ifort to an Environment." ]
Please provide a description of the function:def run(self, postfunc=lambda: None): self._setup_sig_handler() try: self.job.start() finally: postfunc() self._reset_sig_handler()
[ "Run the jobs.\n\n postfunc() will be invoked after the jobs has run. It will be\n invoked even if the jobs are interrupted by a keyboard\n interrupt (well, in fact by a signal such as either SIGINT,\n SIGTERM or SIGHUP). The execution of postfunc() is protected\n against keyboard...
Please provide a description of the function:def _setup_sig_handler(self): def handler(signum, stack, self=self, parentpid=os.getpid()): if os.getpid() == parentpid: self.job.taskmaster.stop() self.job.interrupted.set() else: os._e...
[ "Setup an interrupt handler so that SCons can shutdown cleanly in\n various conditions:\n\n a) SIGINT: Keyboard interrupt\n b) SIGTERM: kill or system shutdown\n c) SIGHUP: Controlling shell exiting\n\n We handle all of these cases by stopping the taskmaster. It\n tur...