Code stringlengths 103 85.9k | Summary listlengths 0 94 |
|---|---|
Please provide a description of the function:def get_binfo(self):
try:
return self.binfo
except AttributeError:
pass
binfo = self.new_binfo()
self.binfo = binfo
executor = self.get_executor()
ignore_set = self.ignore_set
if self... | [
"\n Fetch a node's build information.\n\n node - the node whose sources will be collected\n cache - alternate node to use for the signature cache\n returns - the build signature\n\n This no longer handles the recursive descent of the\n node's children's signatures. We expe... |
Please provide a description of the function:def add_dependency(self, depend):
try:
self._add_child(self.depends, self.depends_set, depend)
except TypeError as e:
e = e.args[0]
if SCons.Util.is_List(e):
s = list(map(str, e))
else:
... | [
"Adds dependencies."
] |
Please provide a description of the function:def add_prerequisite(self, prerequisite):
if self.prerequisites is None:
self.prerequisites = SCons.Util.UniqueList()
self.prerequisites.extend(prerequisite)
self._children_reset() | [
"Adds prerequisites"
] |
Please provide a description of the function:def add_ignore(self, depend):
try:
self._add_child(self.ignore, self.ignore_set, depend)
except TypeError as e:
e = e.args[0]
if SCons.Util.is_List(e):
s = list(map(str, e))
else:
... | [
"Adds dependencies to ignore."
] |
Please provide a description of the function:def add_source(self, source):
if self._specific_sources:
return
try:
self._add_child(self.sources, self.sources_set, source)
except TypeError as e:
e = e.args[0]
if SCons.Util.is_List(e):
... | [
"Adds sources."
] |
Please provide a description of the function:def _add_child(self, collection, set, child):
added = None
for c in child:
if c not in set:
set.add(c)
collection.append(c)
added = 1
if added:
self._children_reset() | [
"Adds 'child' to 'collection', first checking 'set' to see if it's\n already present."
] |
Please provide a description of the function:def all_children(self, scan=1):
if scan:
self.scan()
# The return list may contain duplicate Nodes, especially in
# source trees where there are a lot of repeated #includes
# of a tangle of .h files. Profiling shows, how... | [
"Return a list of all the node's direct children."
] |
Please provide a description of the function:def Tag(self, key, value):
if not self._tags:
self._tags = {}
self._tags[key] = value | [
" Add a user-defined tag. "
] |
Please provide a description of the function:def changed(self, node=None, allowcache=False):
t = 0
if t: Trace('changed(%s [%s], %s)' % (self, classname(self), node))
if node is None:
node = self
result = False
bi = node.get_stored_info().binfo
then... | [
"\n Returns if the node is up-to-date with respect to the BuildInfo\n stored last time it was built. The default behavior is to compare\n it against our own previously stored BuildInfo, but the stored\n BuildInfo from another Node (typically one in a Repository)\n can be used ins... |
Please provide a description of the function:def children_are_up_to_date(self):
# Allow the children to calculate their signatures.
self.binfo = self.get_binfo()
if self.always_build:
return None
state = 0
for kid in self.children(None):
s = kid.g... | [
"Alternate check for whether the Node is current: If all of\n our children were up-to-date, then this Node was up-to-date, too.\n\n The SCons.Node.Alias and SCons.Node.Python.Value subclasses\n rebind their current() method to this method."
] |
Please provide a description of the function:def render_include_tree(self):
if self.is_derived():
env = self.get_build_env()
if env:
for s in self.sources:
scanner = self.get_source_scanner(s)
if scanner:
... | [
"\n Return a text representation, suitable for displaying to the\n user, of the include tree for the sources of this node.\n "
] |
Please provide a description of the function:def get_next(self):
while self.stack:
if self.stack[-1].wkids:
node = self.stack[-1].wkids.pop(0)
if not self.stack[-1].wkids:
self.stack[-1].wkids = None
if node in self.histor... | [
"Return the next node for this walk of the tree.\n\n This function is intentionally iterative, not recursive,\n to sidestep any issues of stack size limitations.\n "
] |
Please provide a description of the function:def sign_report(self, device_id, root, data, **kwargs):
AuthProvider.VerifyRoot(root)
if root != AuthProvider.NoKey:
raise NotFoundError('unsupported root key in BasicAuthProvider', root_key=root)
result = bytearray(hashlib.sha... | [
"Sign a buffer of report data on behalf of a device.\n\n Args:\n device_id (int): The id of the device that we should encrypt for\n root (int): The root key type that should be used to generate the report\n data (bytearray): The data that we should sign\n **kwargs:... |
Please provide a description of the function:def verify_report(self, device_id, root, data, signature, **kwargs):
AuthProvider.VerifyRoot(root)
if root != AuthProvider.NoKey:
raise NotFoundError('unsupported root key in BasicAuthProvider', root_key=root)
result = bytearra... | [
"Verify a buffer of report data on behalf of a device.\n\n Args:\n device_id (int): The id of the device that we should encrypt for\n root (int): The root key type that should be used to generate the report\n data (bytearray): The data that we should verify\n signa... |
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()
rpc_const = alloc.allocate_stream(DataStream.ConstantType, attach=True)
rp... | [
"Execute this statement on the sensor_graph given the current scope tree.\n\n This adds a single node to the sensor graph with the call_rpc function\n as is processing function.\n\n Args:\n sensor_graph (SensorGraph): The sensor graph that we are building or\n modifyin... |
Please provide a description of the function:def timeout_thread_handler(timeout, stop_event):
stop_happened = stop_event.wait(timeout)
if stop_happened is False:
print("Killing program due to %f second timeout" % timeout)
os._exit(2) | [
"A background thread to kill the process if it takes too long.\n\n Args:\n timeout (float): The number of seconds to wait before killing\n the process.\n stop_event (Event): An optional event to cleanly stop the background\n thread if required during testing.\n "
] |
Please provide a description of the function:def create_parser():
parser = argparse.ArgumentParser(description=DESCRIPTION, formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument('-v', '--verbose', action="count", default=0, help="Increase logging level (goes error, warn, info, debug)")... | [
"Create the argument parser for iotile."
] |
Please provide a description of the function:def parse_global_args(argv):
parser = create_parser()
args = parser.parse_args(argv)
should_log = args.include or args.exclude or (args.verbose > 0)
verbosity = args.verbose
root = logging.getLogger()
if should_log:
formatter = loggin... | [
"Parse all global iotile tool arguments.\n\n Any flag based argument at the start of the command line is considered as\n a global flag and parsed. The first non flag argument starts the commands\n that are passed to the underlying hierarchical shell.\n\n Args:\n argv (list): The command line for... |
Please provide a description of the function:def setup_completion(shell):
# Handle special case of importing pyreadline on Windows
# See: http://stackoverflow.com/questions/6024952/readline-functionality-on-windows-with-python-2-7
import glob
try:
import readline
except ImportError:
... | [
"Setup readline to tab complete in a cross platform way."
] |
Please provide a description of the function:def main(argv=None):
if argv is None:
argv = sys.argv[1:]
args = parse_global_args(argv)
type_system.interactive = True
line = args.commands
timeout_thread = None
timeout_stop_event = threading.Event()
if args.timeout:
ti... | [
"Run the iotile shell tool.\n\n You can optionally pass the arguments that should be run\n in the argv parameter. If nothing is passed, the args\n are pulled from sys.argv.\n\n The return value of this function is the return value\n of the shell command.\n "
] |
Please provide a description of the function:def do_build(self, argv):
import SCons.Node
import SCons.SConsign
import SCons.Script.Main
options = copy.deepcopy(self.options)
options, targets = self.parser.parse_args(argv[1:], values=options)
SCons.Script.COMMA... | [
"\\\n build [TARGETS] Build the specified TARGETS and their\n dependencies. 'b' is a synonym.\n "
] |
Please provide a description of the function:def do_help(self, argv):
if argv[1:]:
for arg in argv[1:]:
if self._do_one_help(arg):
break
else:
# If bare 'help' is called, print this class's doc
# string (if it has one).
... | [
"\\\n help [COMMAND] Prints help for the specified COMMAND. 'h'\n and '?' are synonyms.\n "
] |
Please provide a description of the function:def do_shell(self, argv):
import subprocess
argv = argv[1:]
if not argv:
argv = os.environ[self.shell_variable]
try:
# Per "[Python-Dev] subprocess insufficiently platform-independent?"
# http://mai... | [
"\\\n shell [COMMANDLINE] Execute COMMANDLINE in a subshell. 'sh' and\n '!' are synonyms.\n "
] |
Please provide a description of the function:def build(args):
# Do some sleuthing work to find scons if it's not installed into an importable
# place, as it is usually not.
scons_path = "Error"
try:
scons_path = resource_path('scons-local-{}'.format(SCONS_VERSION), expect='folder')
... | [
"\n Invoke the scons build system from the current directory, exactly as if\n the scons tool had been invoked.\n "
] |
Please provide a description of the function:def merge_dicts(a, b):
for key in b:
if key in a:
if isinstance(a[key], dict) and isinstance(b[key], dict):
merge_dicts(a[key], b[key])
else:
a[key] = b[key]
else:
a[key] = b[key]
... | [
"\"merges b into a"
] |
Please provide a description of the function:def archs(self, as_list=False):
archs = self.arch_list().split('/')
if as_list:
return archs
return set(archs) | [
"Return all of the architectures for this target.\n\n Args:\n as_list (bool): Return a list instead of the default set object.\n\n Returns:\n set or list: All of the architectures used in this TargetSettings object.\n "
] |
Please provide a description of the function:def retarget(self, remove=[], add=[]):
archs = self.arch_list().split('/')
for r in remove:
if r in archs:
archs.remove(r)
archs.extend(add)
archstr = "/".join(archs)
return self.family.find(arc... | [
"Return a TargetSettings object for the same module but with some of the architectures\n removed and others added.\n "
] |
Please provide a description of the function:def build_dirs(self):
arch = self.arch_name()
build_path = os.path.join('build', arch)
output = os.path.join('build', 'output')
test = os.path.join('build', 'test', arch)
return {'build': build_path, 'output': output, 'test... | [
"Return the build directory hierarchy:\n Defines:\n - build: build/chip\n - output: build/output\n - test: build/test/chip\n where chip is the canonical name for the chip passed in\n "
] |
Please provide a description of the function:def property(self, name, default=MISSING):
if name in self.settings:
return self.settings[name]
if default is not MISSING:
return default
raise ArgumentError("property %s not found for target '%s' and no default giv... | [
"Get the value of the given property for this chip, using the default\n value if not found and one is provided. If not found and default is None,\n raise an Exception.\n "
] |
Please provide a description of the function:def combined_properties(self, suffix):
props = [y for x, y in self.settings.items() if x.endswith(suffix)]
properties = itertools.chain(*props)
processed_props = [x for x in properties]
return processed_props | [
"Get the value of all properties whose name ends with suffix and join them\n together into a list.\n "
] |
Please provide a description of the function:def includes(self):
incs = self.combined_properties('includes')
processed_incs = []
for prop in incs:
if isinstance(prop, str):
processed_incs.append(prop)
else:
processed_incs.append(... | [
"Return all of the include directories for this chip as a list."
] |
Please provide a description of the function:def arch_prefixes(self):
archs = self.archs(as_list=True)
prefixes = []
for i in range(1, len(archs)+1):
prefixes.append(archs[:i])
return prefixes | [
"Return the initial 1, 2, ..., N architectures as a prefix list\n\n For arch1/arch2/arch3, this returns\n [arch1],[arch1/arch2],[arch1/arch2/arch3]\n "
] |
Please provide a description of the function:def _load_dependency(cls, tile, dep, family):
depname = dep['unique_id']
depdir = os.path.join(tile.folder, 'build', 'deps', depname)
deppath = os.path.join(depdir, 'module_settings.json')
if not os.path.exists(deppath):
... | [
"Load a dependency from build/deps/<unique_id>."
] |
Please provide a description of the function:def targets(self, module):
if module not in self.module_targets:
raise BuildError("Could not find module in targets()", module=module)
return [self.find(x, module) for x in self.module_targets[module]] | [
"Find the targets for a given module.\n\n Returns:\n list: A sequence of all of the targets for the specified module.\n "
] |
Please provide a description of the function:def for_all_targets(self, module, func, filter_func=None):
for target in self.targets(module):
if filter_func is None or filter_func(target):
func(target) | [
"Call func once for all of the targets of this module."
] |
Please provide a description of the function:def validate_target(self, target):
archs = target.split('/')
for arch in archs:
if not arch in self.archs:
return False
return True | [
"Make sure that the specified target only contains architectures that we know about."
] |
Please provide a description of the function:def _load_target(self, target, module=None):
mod = ModuleSettings({}, {})
if not self.validate_target(target):
raise ArgumentError("Target %s is invalid, check to make sure every architecture in it is defined" % target)
if modul... | [
"Given a string specifying a series of architectural overlays as:\n <arch 1>/<arch 2>/... and optionally a module name to pull in\n module specific settings, return a TargetSettings object that\n encapsulates all of the settings for this target.\n "
] |
Please provide a description of the function:def _load_architectures(self, family):
if "architectures" not in family:
raise InternalError("required architectures key not in build_settings.json for desired family")
for key, val in family['architectures'].items():
if not... | [
"Load in all of the architectural overlays for this family. An architecture adds configuration\n information that is used to build a common set of source code for a particular hardware and situation.\n They are stackable so that you can specify a chip and a configuration for that chip, for example.\n... |
Please provide a description of the function:def generate(env):
c_file, cxx_file = SCons.Tool.createCFileBuilders(env)
# C
c_file.add_action(".l", LexAction)
c_file.add_emitter(".l", lexEmitter)
c_file.add_action(".lex", LexAction)
c_file.add_emitter(".lex", lexEmitter)
# Objective-C... | [
"Add Builders and construction variables for lex to an Environment."
] |
Please provide a description of the function:def clear_to_reset(self, config_vars):
super(ClockManagerSubsystem, self).clear_to_reset(config_vars)
self.tick_counters = dict(fast=0, user1=0, user2=0, normal=0)
self.is_utc = False
self.time_offset = 0
if self.has_rtc a... | [
"Clear all volatile information across a reset.\n\n The reset behavior is that:\n - uptime is reset to 0\n - is `has_rtc` is True, the utc_offset is preserved\n - otherwise the utc_offset is cleared to none\n "
] |
Please provide a description of the function:def handle_tick(self):
self.uptime += 1
for name, interval in self.ticks.items():
if interval == 0:
continue
self.tick_counters[name] += 1
if self.tick_counters[name] == interval:
... | [
"Internal callback every time 1 second has passed."
] |
Please provide a description of the function:def set_tick(self, index, interval):
name = self.tick_name(index)
if name is None:
return pack_error(ControllerSubsystem.SENSOR_GRAPH, Error.INVALID_ARRAY_KEY)
self.ticks[name] = interval
return Error.NO_ERROR | [
"Update the a tick's interval.\n\n Args:\n index (int): The index of the tick that you want to fetch.\n interval (int): The number of seconds between ticks.\n Setting this to 0 will disable the tick.\n\n Returns:\n int: An error code.\n "
] |
Please provide a description of the function:def get_tick(self, index):
name = self.tick_name(index)
if name is None:
return [pack_error(ControllerSubsystem.SENSOR_GRAPH, Error.INVALID_ARRAY_KEY), 0]
return [Error.NO_ERROR, self.ticks[name]] | [
"Get a tick's interval.\n\n Args:\n index (int): The index of the tick that you want to fetch.\n\n Returns:\n int, int: Error code and The tick's interval in seconds.\n\n A value of 0 means that the tick is disabled.\n "
] |
Please provide a description of the function:def get_time(self, force_uptime=False):
if force_uptime:
return self.uptime
time = self.uptime + self.time_offset
if self.is_utc:
time |= (1 << 31)
return time | [
"Get the current UTC time or uptime.\n\n By default, this method will return UTC time if possible and fall back\n to uptime if not. If you specify, force_uptime=True, it will always\n return uptime even if utc time is available.\n\n Args:\n force_uptime (bool): Always return ... |
Please provide a description of the function:def synchronize_clock(self, offset):
self.time_offset = offset - self.uptime
self.is_utc = True
if self.has_rtc:
self.stored_offset = self.time_offset | [
"Persistently synchronize the clock to UTC time.\n\n Args:\n offset (int): The number of seconds since 1/1/2000 00:00Z\n "
] |
Please provide a description of the function:def get_user_timer(self, index):
err, tick = self.clock_manager.get_tick(index)
return [err, tick] | [
"Get the current value of a user timer."
] |
Please provide a description of the function:def set_user_timer(self, value, index):
err = self.clock_manager.set_tick(index, value)
return [err] | [
"Set the current value of a user timer."
] |
Please provide a description of the function:def set_time_offset(self, offset, is_utc):
is_utc = bool(is_utc)
self.clock_manager.time_offset = offset
self.clock_manager.is_utc = is_utc
return [Error.NO_ERROR] | [
"Temporarily set the current time offset."
] |
Please provide a description of the function:def device_slug_to_id(slug):
if not isinstance(slug, str):
raise ArgumentError("Invalid device slug that is not a string", slug=slug)
try:
device_slug = IOTileDeviceSlug(slug, allow_64bits=False)
except ValueError:
raise ArgumentErr... | [
"Convert a d-- device slug to an integer.\n\n Args:\n slug (str): A slug in the format d--XXXX-XXXX-XXXX-XXXX\n\n Returns:\n int: The device id as an integer\n\n Raises:\n ArgumentError: if there is a malformed slug\n "
] |
Please provide a description of the function:def device_id_to_slug(did):
try:
device_slug = IOTileDeviceSlug(did, allow_64bits=False)
except ValueError:
raise ArgumentError("Unable to recognize {} as a device id".format(did))
return str(device_slug) | [
" Converts a device id into a correct device slug.\n\n Args:\n did (long) : A device id\n did (string) : A device slug in the form of XXXX, XXXX-XXXX-XXXX, d--XXXX, d--XXXX-XXXX-XXXX-XXXX\n Returns:\n str: The device slug in the d--XXXX-XXXX-XXXX-XXXX format\n Raises:\n Argument... |
Please provide a description of the function:def fleet_id_to_slug(did):
try:
fleet_slug = IOTileFleetSlug(did)
except ValueError:
raise ArgumentError("Unable to recognize {} as a fleet id".format(did))
return str(fleet_slug) | [
" Converts a fleet id into a correct fleet slug.\n\n Args:\n did (long) : A fleet id\n did (string) : A device slug in the form of XXXX, XXXX-XXXX-XXXX, g--XXXX, g--XXXX-XXXX-XXXX\n Returns:\n str: The device slug in the g--XXXX-XXXX-XXX format\n Raises:\n ArgumentError: if the ... |
Please provide a description of the function:def get_program_files_dir():
# Now see if we can look in the registry...
val = ''
if SCons.Util.can_read_reg:
try:
# Look for Windows Program Files directory
k=SCons.Util.RegOpenKeyEx(SCons.Util.hkey_mod.HKEY_LOCAL_MACHINE,
... | [
"\n Get the location of the program files directory\n Returns\n -------\n\n "
] |
Please provide a description of the function:def get_architecture(arch=None):
if arch is None:
arch = os.environ.get('PROCESSOR_ARCHITEW6432')
if not arch:
arch = os.environ.get('PROCESSOR_ARCHITECTURE')
return SupportedArchitectureMap.get(arch, ArchDefinition('', [''])) | [
"Returns the definition for the specified architecture string.\n\n If no string is specified, the system default is returned (as defined\n by the PROCESSOR_ARCHITEW6432 or PROCESSOR_ARCHITECTURE environment\n variables).\n "
] |
Please provide a description of the function:def generate(env):
try:
bld = env['BUILDERS']['Rpm']
except KeyError:
bld = RpmBuilder
env['BUILDERS']['Rpm'] = bld
env.SetDefault(RPM = 'LC_ALL=C rpmbuild')
env.SetDefault(RPMFLAGS = SCons.Util.CLVar('-ta'))
env... | [
"Add Builders and construction variables for rpm to an Environment."
] |
Please provide a description of the function:def next_id(self, channel):
if channel not in self.topics:
self.topics[channel] = 0
return 0
self.topics[channel] += 1
return self.topics[channel] | [
"Get the next sequence number for a named channel or topic\n\n If channel has not been sent to next_id before, 0 is returned\n otherwise next_id returns the last id returned + 1.\n\n Args:\n channel (string): The name of the channel to get a sequential\n id for.\n\n ... |
Please provide a description of the function:def escape(arg):
"escape shell special characters"
slash = '\\'
special = '"$'
arg = arg.replace(slash, slash+slash)
for c in special:
arg = arg.replace(c, slash+c)
# print("ESCAPE RESULT: %s" % arg)
return '"' + arg + '"' | [] |
Please provide a description of the function:def MatchQuality(cls, record_data, record_count=1):
if record_count > 1:
return MatchQuality.NoMatch
cmd, _address, _resp_length, payload = cls._parse_rpc_info(record_data)
if cmd == cls.RPC_ID:
try:
... | [
"Check how well this record matches the given binary data.\n\n This function will only be called if the record matches the type code\n given by calling MatchType() and this function should check how well\n this record matches and return a quality score between 0 and 100, with\n higher qu... |
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:
os_info, app_info, update_os, update_app = struct.unpack("<LLBB", payload)
update_os = bool(upda... | [
"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 SetDeviceTagRecord.\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 verify(self, obj):
if not isinstance(obj, str):
raise ValidationError("Object is not a string", reason='object is not a string',
object=obj, type=type(obj), str_type=str)
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\n... |
Please provide a description of the function:def format(self, indent_level, indent_size=4):
desc = self.format_name('String')
return self.wrap_lines(desc, indent_level, indent_size=indent_size) | [
"Format this verifier\n\n Returns:\n string: A formatted string\n "
] |
Please provide a description of the function:def clear_to_reset(self, config_vars):
super(BasicStreamingSubsystem, self).clear_to_reset(config_vars)
self._in_progress_streamers = set() | [
"Clear all volatile information across a reset."
] |
Please provide a description of the function:def process_streamer(self, streamer, callback=None):
index = streamer.index
if index in self._in_progress_streamers:
raise InternalError("You cannot add a streamer again until it has finished streaming.")
queue_item = QueuedStr... | [
"Start streaming a streamer.\n\n Args:\n streamer (DataStreamer): The streamer itself.\n callback (callable): An optional callable that will be called as:\n callable(index, success, highest_id_received_from_other_side)\n "
] |
Please provide a description of the function:def pack_rpc_response(response=None, exception=None):
if response is None:
response = bytes()
if exception is None:
status = (1 << 6)
if len(response) > 0:
status |= (1 << 7)
elif isinstance(exception, (RPCInvalidIDError... | [
"Convert a response payload or exception to a status code and payload.\n\n This function will convert an Exception raised by an RPC implementation\n to the corresponding status code.\n "
] |
Please provide a description of the function:def unpack_rpc_response(status, response=None, rpc_id=0, address=0):
status_code = status & ((1 << 6) - 1)
if address == 8:
status_code &= ~(1 << 7)
if status == 0:
raise BusyRPCResponse()
elif status == 2:
raise RPCNotFoundErr... | [
"Unpack an RPC status back in to payload or exception."
] |
Please provide a description of the function:def pack_rpc_payload(arg_format, args):
code = _create_respcode(arg_format, args)
packed_result = struct.pack(code, *args)
unpacked_validation = struct.unpack(code, packed_result)
if tuple(args) != unpacked_validation:
raise RPCInvalidArguments... | [
"Pack an RPC payload according to arg_format.\n\n Args:\n arg_format (str): a struct format code (without the <) for the\n parameter format for this RPC. This format code may include the final\n character V, which means that it expects a variable length bytearray.\n args (lis... |
Please provide a description of the function:def unpack_rpc_payload(resp_format, payload):
code = _create_argcode(resp_format, payload)
return struct.unpack(code, payload) | [
"Unpack an RPC payload according to resp_format.\n\n Args:\n resp_format (str): a struct format code (without the <) for the\n parameter format for this RPC. This format code may include the final\n character V, which means that it expects a variable length bytearray.\n paylo... |
Please provide a description of the function:def rpc(address, rpc_id, arg_format, resp_format=None):
if rpc_id < 0 or rpc_id > 0xFFFF:
raise RPCInvalidIDError("Invalid RPC ID: {}".format(rpc_id))
def _rpc_wrapper(func):
if inspect.iscoroutinefunction(func):
async def _rpc_exec... | [
"Decorator to denote that a function implements an RPC with the given ID and address.\n\n The underlying function should be a member function that will take\n individual parameters after the RPC payload has been decoded according\n to arg_format.\n\n Arguments to the function are decoded from the 20 byt... |
Please provide a description of the function:def call_rpc(self, rpc_id, payload=bytes()):
if rpc_id < 0 or rpc_id > 0xFFFF:
raise RPCInvalidIDError("Invalid RPC ID: {}".format(rpc_id))
if rpc_id not in self._rpcs:
raise RPCNotFoundError("rpc_id: {}".format(rpc_id))
... | [
"Call an RPC by its ID.\n\n Args:\n rpc_id (int): The number of the RPC\n payload (bytes): A byte string of payload parameters up to 20 bytes\n\n Returns:\n bytes: The response payload from the RPC\n "
] |
Please provide a description of the function:def isfortran(env, source):
try:
fsuffixes = env['FORTRANSUFFIXES']
except KeyError:
# If no FORTRANSUFFIXES, no fortran tool, so there is no need to look
# for fortran sources.
return 0
if not source:
# Source might ... | [
"Return 1 if any of code in source has fortran files in it, 0\n otherwise."
] |
Please provide a description of the function:def ComputeFortranSuffixes(suffixes, ppsuffixes):
assert len(suffixes) > 0
s = suffixes[0]
sup = s.upper()
upper_suffixes = [_.upper() for _ in suffixes]
if SCons.Util.case_sensitive_suffixes(s, sup):
ppsuffixes.extend(upper_suffixes)
els... | [
"suffixes are fortran source files, and ppsuffixes the ones to be\n pre-processed. Both should be sequences, not strings."
] |
Please provide a description of the function:def CreateDialectActions(dialect):
CompAction = SCons.Action.Action('$%sCOM ' % dialect, '$%sCOMSTR' % dialect)
CompPPAction = SCons.Action.Action('$%sPPCOM ' % dialect, '$%sPPCOMSTR' % dialect)
ShCompAction = SCons.Action.Action('$SH%sCOM ' % dialect, '$SH%... | [
"Create dialect specific actions."
] |
Please provide a description of the function:def DialectAddToEnv(env, dialect, suffixes, ppsuffixes, support_module = 0):
ComputeFortranSuffixes(suffixes, ppsuffixes)
fscan = SCons.Scanner.Fortran.FortranScan("%sPATH" % dialect)
for suffix in suffixes + ppsuffixes:
SCons.Tool.SourceFileScanne... | [
"Add dialect specific construction variables."
] |
Please provide a description of the function:def add_fortran_to_env(env):
try:
FortranSuffixes = env['FORTRANFILESUFFIXES']
except KeyError:
FortranSuffixes = ['.f', '.for', '.ftn']
#print("Adding %s to fortran suffixes" % FortranSuffixes)
try:
FortranPPSuffixes = env['FORT... | [
"Add Builders and construction variables for Fortran to an Environment."
] |
Please provide a description of the function:def add_f77_to_env(env):
try:
F77Suffixes = env['F77FILESUFFIXES']
except KeyError:
F77Suffixes = ['.f77']
#print("Adding %s to f77 suffixes" % F77Suffixes)
try:
F77PPSuffixes = env['F77PPFILESUFFIXES']
except KeyError:
... | [
"Add Builders and construction variables for f77 to an Environment."
] |
Please provide a description of the function:def add_f90_to_env(env):
try:
F90Suffixes = env['F90FILESUFFIXES']
except KeyError:
F90Suffixes = ['.f90']
#print("Adding %s to f90 suffixes" % F90Suffixes)
try:
F90PPSuffixes = env['F90PPFILESUFFIXES']
except KeyError:
... | [
"Add Builders and construction variables for f90 to an Environment."
] |
Please provide a description of the function:def add_f95_to_env(env):
try:
F95Suffixes = env['F95FILESUFFIXES']
except KeyError:
F95Suffixes = ['.f95']
#print("Adding %s to f95 suffixes" % F95Suffixes)
try:
F95PPSuffixes = env['F95PPFILESUFFIXES']
except KeyError:
... | [
"Add Builders and construction variables for f95 to an Environment."
] |
Please provide a description of the function:def add_f03_to_env(env):
try:
F03Suffixes = env['F03FILESUFFIXES']
except KeyError:
F03Suffixes = ['.f03']
#print("Adding %s to f95 suffixes" % F95Suffixes)
try:
F03PPSuffixes = env['F03PPFILESUFFIXES']
except KeyError:
... | [
"Add Builders and construction variables for f03 to an Environment."
] |
Please provide a description of the function:def add_f08_to_env(env):
try:
F08Suffixes = env['F08FILESUFFIXES']
except KeyError:
F08Suffixes = ['.f08']
try:
F08PPSuffixes = env['F08PPFILESUFFIXES']
except KeyError:
F08PPSuffixes = []
DialectAddToEnv(env, "F08",... | [
"Add Builders and construction variables for f08 to an Environment."
] |
Please provide a description of the function:def add_all_to_env(env):
add_fortran_to_env(env)
add_f77_to_env(env)
add_f90_to_env(env)
add_f95_to_env(env)
add_f03_to_env(env)
add_f08_to_env(env) | [
"Add builders and construction variables for all supported fortran\n dialects."
] |
Please provide a description of the function:def _delete_duplicates(l, keep_last):
seen=set()
result=[]
if keep_last: # reverse in & out, then keep first
l.reverse()
for i in l:
try:
if i not in seen:
result.append(i)
seen.add(i)... | [
"Delete duplicates from a sequence, keeping the first or last."
] |
Please provide a description of the function:def NoSubstitutionProxy(subject):
class _NoSubstitutionProxy(Environment):
def __init__(self, subject):
self.__dict__['__subject'] = subject
def __getattr__(self, name):
return getattr(self.__dict__['__subject'], name)
... | [
"\n An entry point for returning a proxy subclass instance that overrides\n the subst*() methods so they don't actually perform construction\n variable substitution. This is specifically intended to be the shim\n layer in between global function calls (which don't want construction\n variable substi... |
Please provide a description of the function:def clone(self, new_object):
return self.__class__(new_object, self.method, self.name) | [
"\n Returns an object that re-binds the underlying \"method\" to\n the specified new object.\n "
] |
Please provide a description of the function:def _init_special(self):
self._special_del = {}
self._special_del['SCANNERS'] = _del_SCANNERS
self._special_set = {}
for key in reserved_construction_var_names:
self._special_set[key] = _set_reserved
for key in fu... | [
"Initial the dispatch tables for special handling of\n special construction variables."
] |
Please provide a description of the function:def subst(self, string, raw=0, target=None, source=None, conv=None, executor=None):
gvars = self.gvars()
lvars = self.lvars()
lvars['__env__'] = self
if executor:
lvars.update(executor.get_lvars())
return SCons.Sub... | [
"Recursively interpolates construction variables from the\n Environment into the specified string, returning the expanded\n result. Construction variables are specified by a $ prefix\n in the string and begin with an initial underscore or\n alphabetic character followed by any number of... |
Please provide a description of the function:def subst_list(self, string, raw=0, target=None, source=None, conv=None, executor=None):
gvars = self.gvars()
lvars = self.lvars()
lvars['__env__'] = self
if executor:
lvars.update(executor.get_lvars())
return SCon... | [
"Calls through to SCons.Subst.scons_subst_list(). See\n the documentation for that function."
] |
Please provide a description of the function:def subst_path(self, path, target=None, source=None):
if not SCons.Util.is_List(path):
path = [path]
def s(obj):
try:
get = obj.get
except AttributeError:
obj = SCons.... | [
"Substitute a path list, turning EntryProxies into Nodes\n and leaving Nodes (and other objects) as-is.",
"This is the \"string conversion\" routine that we have our\n substitutions use to return Nodes, not strings. This relies\n on the fact that an EntryProxy object has a get() meth... |
Please provide a description of the function:def AddMethod(self, function, name=None):
method = MethodWrapper(self, function, name)
self.added_methods.append(method) | [
"\n Adds the specified function as a method of this construction\n environment with the specified name. If the name is omitted,\n the default name is the name of the function itself.\n "
] |
Please provide a description of the function:def RemoveMethod(self, function):
self.added_methods = [dm for dm in self.added_methods if not dm.method is function] | [
"\n Removes the specified function's MethodWrapper from the\n added_methods list, so we don't re-bind it when making a clone.\n "
] |
Please provide a description of the function:def Override(self, overrides):
if not overrides: return self
o = copy_non_reserved_keywords(overrides)
if not o: return self
overrides = {}
merges = None
for key, value in o.items():
if key == 'parse_flags'... | [
"\n Produce a modified environment whose variables are overridden by\n the overrides dictionaries. \"overrides\" is a dictionary that\n will override the variables of this environment.\n\n This function is much more efficient than Clone() or creating\n a new Environment because i... |
Please provide a description of the function:def ParseFlags(self, *flags):
dict = {
'ASFLAGS' : SCons.Util.CLVar(''),
'CFLAGS' : SCons.Util.CLVar(''),
'CCFLAGS' : SCons.Util.CLVar(''),
'CXXFLAGS' : SCons.Util.CLVar(''),
... | [
"\n Parse the set of flags and return a dict with the flags placed\n in the appropriate entry. The flags are treated as a typical\n set of command-line flags for a GNU-like toolchain and used to\n populate the entries in the dict immediately below. If one of\n the flag strings b... |
Please provide a description of the function:def MergeFlags(self, args, unique=1, dict=None):
if dict is None:
dict = self
if not SCons.Util.is_Dict(args):
args = self.ParseFlags(args)
if not unique:
self.Append(**args)
return self
... | [
"\n Merge the dict in args into the construction variables of this\n env, or the passed-in dict. If args is not a dict, it is\n converted into a dict using ParseFlags. If unique is not set,\n the flags are appended rather than merged.\n "
] |
Please provide a description of the function:def get_factory(self, factory, default='File'):
name = default
try:
is_node = issubclass(factory, SCons.Node.FS.Base)
except TypeError:
# The specified factory isn't a Node itself--it's
# most likely None, ... | [
"Return a factory function for creating Nodes for this\n construction environment.\n "
] |
Please provide a description of the function:def get_scanner(self, skey):
if skey and self['PLATFORM'] == 'win32':
skey = skey.lower()
return self._gsm().get(skey) | [
"Find the appropriate scanner given a key (usually a file suffix).\n "
] |
Please provide a description of the function:def Append(self, **kw):
kw = copy_non_reserved_keywords(kw)
for key, val in kw.items():
# It would be easier on the eyes to write this using
# "continue" statements whenever we finish processing an item,
# but Pyth... | [
"Append values to existing construction variables\n in an Environment.\n "
] |
Please provide a description of the function:def AppendENVPath(self, name, newpath, envname = 'ENV',
sep = os.pathsep, delete_existing=1):
orig = ''
if envname in self._dict and name in self._dict[envname]:
orig = self._dict[envname][name]
nv = SCons.... | [
"Append path elements to the path 'name' in the 'ENV'\n dictionary for this environment. Will only add any particular\n path once, and will normpath and normcase all paths to help\n assure this. This can also handle the case where the env\n variable is a list instead of a string.\n\n ... |
Please provide a description of the function:def AppendUnique(self, delete_existing=0, **kw):
kw = copy_non_reserved_keywords(kw)
for key, val in kw.items():
if SCons.Util.is_List(val):
val = _delete_duplicates(val, delete_existing)
if key not in self._di... | [
"Append values to existing construction variables\n in an Environment, if they're not already there.\n If delete_existing is 1, removes existing values first, so\n values move to end.\n "
] |
Please provide a description of the function:def Clone(self, tools=[], toolpath=None, parse_flags = None, **kw):
builders = self._dict.get('BUILDERS', {})
clone = copy.copy(self)
# BUILDERS is not safe to do a simple copy
clone._dict = semi_deepcopy_dict(self._dict, ['BUILDERS... | [
"Return a copy of a construction Environment. The\n copy is like a Python \"deep copy\"--that is, independent\n copies are made recursively of each objects--except that\n a reference is copied when an object is not deep-copyable\n (like a function). There are no references to any mutab... |
Please provide a description of the function:def Detect(self, progs):
if not SCons.Util.is_List(progs):
progs = [ progs ]
for prog in progs:
path = self.WhereIs(prog)
if path: return prog
return None | [
"Return the first available program in progs.\n "
] |
Please provide a description of the function:def Dump(self, key = None):
import pprint
pp = pprint.PrettyPrinter(indent=2)
if key:
dict = self.Dictionary(key)
else:
dict = self.Dictionary()
return pp.pformat(dict) | [
"\n Using the standard Python pretty printer, return the contents of the\n scons build environment as a string.\n\n If the key passed in is anything other than None, then that will\n be used as an index into the build environment dictionary and\n whatever is found there will be fe... |
Please provide a description of the function:def FindIxes(self, paths, prefix, suffix):
suffix = self.subst('$'+suffix)
prefix = self.subst('$'+prefix)
for path in paths:
dir,name = os.path.split(str(path))
if name[:len(prefix)] == prefix and name[-len(suffix):... | [
"\n Search a list of paths for something that matches the prefix and suffix.\n\n paths - the list of paths or nodes.\n prefix - construction variable for the prefix.\n suffix - construction variable for the suffix.\n "
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.