_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 75 19.8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q238200 | Node.get_binfo | train | def get_binfo(self):
"""
Fetch a node's build information.
node - the node whose sources will be collected
cache - alternate node to use for the signature cache
returns - the build signature
This no longer handles the recursive descent of the
node's children's s... | python | {
"resource": ""
} |
q238201 | Node.add_dependency | train | def add_dependency(self, depend):
"""Adds dependencies."""
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:
s = s... | python | {
"resource": ""
} |
q238202 | Node.add_ignore | train | def add_ignore(self, depend):
"""Adds dependencies to ignore."""
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:
s... | python | {
"resource": ""
} |
q238203 | Node.add_source | train | def add_source(self, source):
"""Adds sources."""
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):
s = list(map(str... | python | {
"resource": ""
} |
q238204 | Node._add_child | train | def _add_child(self, collection, set, child):
"""Adds 'child' to 'collection', first checking 'set' to see if it's
already present."""
added = None
for c in child:
if c not in set:
set.add(c)
collection.append(c)
added = 1
... | python | {
"resource": ""
} |
q238205 | Node.all_children | train | def all_children(self, scan=1):
"""Return a list of all the node's direct children."""
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 s... | python | {
"resource": ""
} |
q238206 | Node.Tag | train | def Tag(self, key, value):
""" Add a user-defined tag. """
if not self._tags:
self._tags = {}
self._tags[key] = value | python | {
"resource": ""
} |
q238207 | Node.render_include_tree | train | def render_include_tree(self):
"""
Return a text representation, suitable for displaying to the
user, of the include tree for the sources of this node.
"""
if self.is_derived():
env = self.get_build_env()
if env:
for s in self.sources:
... | python | {
"resource": ""
} |
q238208 | Walker.get_next | train | def get_next(self):
"""Return the next node for this walk of the tree.
This function is intentionally iterative, not recursive,
to sidestep any issues of stack size limitations.
"""
while self.stack:
if self.stack[-1].wkids:
node = self.stack[-1].wki... | python | {
"resource": ""
} |
q238209 | timeout_thread_handler | train | def timeout_thread_handler(timeout, stop_event):
"""A background thread to kill the process if it takes too long.
Args:
timeout (float): The number of seconds to wait before killing
the process.
stop_event (Event): An optional event to cleanly stop the background
thread ... | python | {
"resource": ""
} |
q238210 | create_parser | train | def create_parser():
"""Create the argument parser for iotile."""
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)")
... | python | {
"resource": ""
} |
q238211 | parse_global_args | train | def parse_global_args(argv):
"""Parse all global iotile tool arguments.
Any flag based argument at the start of the command line is considered as
a global flag and parsed. The first non flag argument starts the commands
that are passed to the underlying hierarchical shell.
Args:
argv (lis... | python | {
"resource": ""
} |
q238212 | setup_completion | train | def setup_completion(shell):
"""Setup readline to tab complete in a cross platform way."""
# 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... | python | {
"resource": ""
} |
q238213 | main | train | def main(argv=None):
"""Run the iotile shell tool.
You can optionally pass the arguments that should be run
in the argv parameter. If nothing is passed, the args
are pulled from sys.argv.
The return value of this function is the return value
of the shell command.
"""
if argv is None:... | python | {
"resource": ""
} |
q238214 | build | train | def build(args):
"""
Invoke the scons build system from the current directory, exactly as if
the scons tool had been invoked.
"""
# 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 =... | python | {
"resource": ""
} |
q238215 | TargetSettings.archs | train | def archs(self, as_list=False):
"""Return all of the architectures for this target.
Args:
as_list (bool): Return a list instead of the default set object.
Returns:
set or list: All of the architectures used in this TargetSettings object.
"""
archs = sel... | python | {
"resource": ""
} |
q238216 | TargetSettings.retarget | train | def retarget(self, remove=[], add=[]):
"""Return a TargetSettings object for the same module but with some of the architectures
removed and others added.
"""
archs = self.arch_list().split('/')
for r in remove:
if r in archs:
archs.remove(r)
... | python | {
"resource": ""
} |
q238217 | TargetSettings.property | train | def property(self, name, default=MISSING):
"""Get the value of the given property for this chip, using the default
value if not found and one is provided. If not found and default is None,
raise an Exception.
"""
if name in self.settings:
return self.settings[name]
... | python | {
"resource": ""
} |
q238218 | TargetSettings.combined_properties | train | def combined_properties(self, suffix):
"""Get the value of all properties whose name ends with suffix and join them
together into a list.
"""
props = [y for x, y in self.settings.items() if x.endswith(suffix)]
properties = itertools.chain(*props)
processed_props = [x fo... | python | {
"resource": ""
} |
q238219 | TargetSettings.includes | train | def includes(self):
"""Return all of the include directories for this chip as a list."""
incs = self.combined_properties('includes')
processed_incs = []
for prop in incs:
if isinstance(prop, str):
processed_incs.append(prop)
else:
... | python | {
"resource": ""
} |
q238220 | TargetSettings.arch_prefixes | train | def arch_prefixes(self):
"""Return the initial 1, 2, ..., N architectures as a prefix list
For arch1/arch2/arch3, this returns
[arch1],[arch1/arch2],[arch1/arch2/arch3]
"""
archs = self.archs(as_list=True)
prefixes = []
for i in range(1, len(archs)+1):
... | python | {
"resource": ""
} |
q238221 | ArchitectureGroup.targets | train | def targets(self, module):
"""Find the targets for a given module.
Returns:
list: A sequence of all of the targets for the specified module.
"""
if module not in self.module_targets:
raise BuildError("Could not find module in targets()", module=module)
... | python | {
"resource": ""
} |
q238222 | ArchitectureGroup.for_all_targets | train | def for_all_targets(self, module, func, filter_func=None):
"""Call func once for all of the targets of this module."""
for target in self.targets(module):
if filter_func is None or filter_func(target):
func(target) | python | {
"resource": ""
} |
q238223 | ArchitectureGroup.validate_target | train | def validate_target(self, target):
"""Make sure that the specified target only contains architectures that we know about."""
archs = target.split('/')
for arch in archs:
if not arch in self.archs:
return False
return True | python | {
"resource": ""
} |
q238224 | ArchitectureGroup._load_architectures | train | def _load_architectures(self, family):
"""Load in all of the architectural overlays for this family. An architecture adds configuration
information that is used to build a common set of source code for a particular hardware and situation.
They are stackable so that you can specify a chip and a ... | python | {
"resource": ""
} |
q238225 | generate | train | def generate(env):
"""Add Builders and construction variables for lex to an Environment."""
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", lex... | python | {
"resource": ""
} |
q238226 | ClockManagerSubsystem.handle_tick | train | def handle_tick(self):
"""Internal callback every time 1 second has passed."""
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:
... | python | {
"resource": ""
} |
q238227 | ClockManagerSubsystem.set_tick | train | def set_tick(self, index, interval):
"""Update the a tick's interval.
Args:
index (int): The index of the tick that you want to fetch.
interval (int): The number of seconds between ticks.
Setting this to 0 will disable the tick.
Returns:
int:... | python | {
"resource": ""
} |
q238228 | ClockManagerSubsystem.get_tick | train | def get_tick(self, index):
"""Get a tick's interval.
Args:
index (int): The index of the tick that you want to fetch.
Returns:
int, int: Error code and The tick's interval in seconds.
A value of 0 means that the tick is disabled.
"""
name =... | python | {
"resource": ""
} |
q238229 | ClockManagerSubsystem.get_time | train | def get_time(self, force_uptime=False):
"""Get the current UTC time or uptime.
By default, this method will return UTC time if possible and fall back
to uptime if not. If you specify, force_uptime=True, it will always
return uptime even if utc time is available.
Args:
... | python | {
"resource": ""
} |
q238230 | ClockManagerSubsystem.synchronize_clock | train | def synchronize_clock(self, offset):
"""Persistently synchronize the clock to UTC time.
Args:
offset (int): The number of seconds since 1/1/2000 00:00Z
"""
self.time_offset = offset - self.uptime
self.is_utc = True
if self.has_rtc:
self.stored_o... | python | {
"resource": ""
} |
q238231 | ClockManagerMixin.get_user_timer | train | def get_user_timer(self, index):
"""Get the current value of a user timer."""
err, tick = self.clock_manager.get_tick(index)
return [err, tick] | python | {
"resource": ""
} |
q238232 | ClockManagerMixin.set_user_timer | train | def set_user_timer(self, value, index):
"""Set the current value of a user timer."""
err = self.clock_manager.set_tick(index, value)
return [err] | python | {
"resource": ""
} |
q238233 | ClockManagerMixin.set_time_offset | train | def set_time_offset(self, offset, is_utc):
"""Temporarily set the current time offset."""
is_utc = bool(is_utc)
self.clock_manager.time_offset = offset
self.clock_manager.is_utc = is_utc
return [Error.NO_ERROR] | python | {
"resource": ""
} |
q238234 | device_id_to_slug | train | def device_id_to_slug(did):
""" Converts a device id into a correct device slug.
Args:
did (long) : A device id
did (string) : A device slug in the form of XXXX, XXXX-XXXX-XXXX, d--XXXX, d--XXXX-XXXX-XXXX-XXXX
Returns:
str: The device slug in the d--XXXX-XXXX-XXXX-XXXX format
Ra... | python | {
"resource": ""
} |
q238235 | fleet_id_to_slug | train | def fleet_id_to_slug(did):
""" Converts a fleet id into a correct fleet slug.
Args:
did (long) : A fleet id
did (string) : A device slug in the form of XXXX, XXXX-XXXX-XXXX, g--XXXX, g--XXXX-XXXX-XXXX
Returns:
str: The device slug in the g--XXXX-XXXX-XXX format
Raises:
A... | python | {
"resource": ""
} |
q238236 | get_architecture | train | def get_architecture(arch=None):
"""Returns the definition for the specified architecture string.
If no string is specified, the system default is returned (as defined
by the PROCESSOR_ARCHITEW6432 or PROCESSOR_ARCHITECTURE environment
variables).
"""
if arch is None:
arch = os.environ.... | python | {
"resource": ""
} |
q238237 | generate | train | def generate(env):
"""Add Builders and construction variables for rpm to an Environment."""
try:
bld = env['BUILDERS']['Rpm']
except KeyError:
bld = RpmBuilder
env['BUILDERS']['Rpm'] = bld
env.SetDefault(RPM = 'LC_ALL=C rpmbuild')
env.SetDefault(RPMFLAGS = SCons... | python | {
"resource": ""
} |
q238238 | TopicSequencer.next_id | train | def next_id(self, channel):
"""Get the next sequence number for a named channel or topic
If channel has not been sent to next_id before, 0 is returned
otherwise next_id returns the last id returned + 1.
Args:
channel (string): The name of the channel to get a sequential
... | python | {
"resource": ""
} |
q238239 | escape | train | 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 + '"' | python | {
"resource": ""
} |
q238240 | BasicStreamingSubsystem.process_streamer | train | def process_streamer(self, streamer, callback=None):
"""Start streaming a streamer.
Args:
streamer (DataStreamer): The streamer itself.
callback (callable): An optional callable that will be called as:
callable(index, success, highest_id_received_from_other_side)... | python | {
"resource": ""
} |
q238241 | pack_rpc_response | train | def pack_rpc_response(response=None, exception=None):
"""Convert a response payload or exception to a status code and payload.
This function will convert an Exception raised by an RPC implementation
to the corresponding status code.
"""
if response is None:
response = bytes()
if excep... | python | {
"resource": ""
} |
q238242 | unpack_rpc_response | train | def unpack_rpc_response(status, response=None, rpc_id=0, address=0):
"""Unpack an RPC status back in to payload or exception."""
status_code = status & ((1 << 6) - 1)
if address == 8:
status_code &= ~(1 << 7)
if status == 0:
raise BusyRPCResponse()
elif status == 2:
raise ... | python | {
"resource": ""
} |
q238243 | pack_rpc_payload | train | def pack_rpc_payload(arg_format, args):
"""Pack an RPC payload according to arg_format.
Args:
arg_format (str): a struct format code (without the <) for the
parameter format for this RPC. This format code may include the final
character V, which means that it expects a variable... | python | {
"resource": ""
} |
q238244 | unpack_rpc_payload | train | def unpack_rpc_payload(resp_format, payload):
"""Unpack an RPC payload according to resp_format.
Args:
resp_format (str): a struct format code (without the <) for the
parameter format for this RPC. This format code may include the final
character V, which means that it expects ... | python | {
"resource": ""
} |
q238245 | isfortran | train | def isfortran(env, source):
"""Return 1 if any of code in source has fortran files in it, 0
otherwise."""
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... | python | {
"resource": ""
} |
q238246 | ComputeFortranSuffixes | train | def ComputeFortranSuffixes(suffixes, ppsuffixes):
"""suffixes are fortran source files, and ppsuffixes the ones to be
pre-processed. Both should be sequences, not strings."""
assert len(suffixes) > 0
s = suffixes[0]
sup = s.upper()
upper_suffixes = [_.upper() for _ in suffixes]
if SCons.Util... | python | {
"resource": ""
} |
q238247 | CreateDialectActions | train | def CreateDialectActions(dialect):
"""Create dialect specific actions."""
CompAction = SCons.Action.Action('$%sCOM ' % dialect, '$%sCOMSTR' % dialect)
CompPPAction = SCons.Action.Action('$%sPPCOM ' % dialect, '$%sPPCOMSTR' % dialect)
ShCompAction = SCons.Action.Action('$SH%sCOM ' % dialect, '$SH%sCOMSTR... | python | {
"resource": ""
} |
q238248 | DialectAddToEnv | train | def DialectAddToEnv(env, dialect, suffixes, ppsuffixes, support_module = 0):
"""Add dialect specific construction variables."""
ComputeFortranSuffixes(suffixes, ppsuffixes)
fscan = SCons.Scanner.Fortran.FortranScan("%sPATH" % dialect)
for suffix in suffixes + ppsuffixes:
SCons.Tool.SourceFileS... | python | {
"resource": ""
} |
q238249 | add_fortran_to_env | train | def add_fortran_to_env(env):
"""Add Builders and construction variables for Fortran to an Environment."""
try:
FortranSuffixes = env['FORTRANFILESUFFIXES']
except KeyError:
FortranSuffixes = ['.f', '.for', '.ftn']
#print("Adding %s to fortran suffixes" % FortranSuffixes)
try:
... | python | {
"resource": ""
} |
q238250 | add_f77_to_env | train | def add_f77_to_env(env):
"""Add Builders and construction variables for f77 to an Environment."""
try:
F77Suffixes = env['F77FILESUFFIXES']
except KeyError:
F77Suffixes = ['.f77']
#print("Adding %s to f77 suffixes" % F77Suffixes)
try:
F77PPSuffixes = env['F77PPFILESUFFIXES']... | python | {
"resource": ""
} |
q238251 | add_f90_to_env | train | def add_f90_to_env(env):
"""Add Builders and construction variables for f90 to an Environment."""
try:
F90Suffixes = env['F90FILESUFFIXES']
except KeyError:
F90Suffixes = ['.f90']
#print("Adding %s to f90 suffixes" % F90Suffixes)
try:
F90PPSuffixes = env['F90PPFILESUFFIXES']... | python | {
"resource": ""
} |
q238252 | add_f95_to_env | train | def add_f95_to_env(env):
"""Add Builders and construction variables for f95 to an Environment."""
try:
F95Suffixes = env['F95FILESUFFIXES']
except KeyError:
F95Suffixes = ['.f95']
#print("Adding %s to f95 suffixes" % F95Suffixes)
try:
F95PPSuffixes = env['F95PPFILESUFFIXES']... | python | {
"resource": ""
} |
q238253 | add_f03_to_env | train | def add_f03_to_env(env):
"""Add Builders and construction variables for f03 to an Environment."""
try:
F03Suffixes = env['F03FILESUFFIXES']
except KeyError:
F03Suffixes = ['.f03']
#print("Adding %s to f95 suffixes" % F95Suffixes)
try:
F03PPSuffixes = env['F03PPFILESUFFIXES']... | python | {
"resource": ""
} |
q238254 | add_f08_to_env | train | def add_f08_to_env(env):
"""Add Builders and construction variables for f08 to an Environment."""
try:
F08Suffixes = env['F08FILESUFFIXES']
except KeyError:
F08Suffixes = ['.f08']
try:
F08PPSuffixes = env['F08PPFILESUFFIXES']
except KeyError:
F08PPSuffixes = []
... | python | {
"resource": ""
} |
q238255 | add_all_to_env | train | def add_all_to_env(env):
"""Add builders and construction variables for all supported fortran
dialects."""
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) | python | {
"resource": ""
} |
q238256 | _delete_duplicates | train | def _delete_duplicates(l, keep_last):
"""Delete duplicates from a sequence, keeping the first or 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)
... | python | {
"resource": ""
} |
q238257 | MethodWrapper.clone | train | def clone(self, new_object):
"""
Returns an object that re-binds the underlying "method" to
the specified new object.
"""
return self.__class__(new_object, self.method, self.name) | python | {
"resource": ""
} |
q238258 | SubstitutionEnvironment._init_special | train | def _init_special(self):
"""Initial the dispatch tables for special handling of
special construction variables."""
self._special_del = {}
self._special_del['SCANNERS'] = _del_SCANNERS
self._special_set = {}
for key in reserved_construction_var_names:
self._sp... | python | {
"resource": ""
} |
q238259 | SubstitutionEnvironment.AddMethod | train | def AddMethod(self, function, name=None):
"""
Adds the specified function as a method of this construction
environment with the specified name. If the name is omitted,
the default name is the name of the function itself.
"""
method = MethodWrapper(self, function, name)
... | python | {
"resource": ""
} |
q238260 | SubstitutionEnvironment.RemoveMethod | train | def RemoveMethod(self, function):
"""
Removes the specified function's MethodWrapper from the
added_methods list, so we don't re-bind it when making a clone.
"""
self.added_methods = [dm for dm in self.added_methods if not dm.method is function] | python | {
"resource": ""
} |
q238261 | SubstitutionEnvironment.Override | train | def Override(self, overrides):
"""
Produce a modified environment whose variables are overridden by
the overrides dictionaries. "overrides" is a dictionary that
will override the variables of this environment.
This function is much more efficient than Clone() or creating
... | python | {
"resource": ""
} |
q238262 | SubstitutionEnvironment.MergeFlags | train | def MergeFlags(self, args, unique=1, dict=None):
"""
Merge the dict in args into the construction variables of this
env, or the passed-in dict. If args is not a dict, it is
converted into a dict using ParseFlags. If unique is not set,
the flags are appended rather than merged.
... | python | {
"resource": ""
} |
q238263 | Base.get_factory | train | def get_factory(self, factory, default='File'):
"""Return a factory function for creating Nodes for this
construction environment.
"""
name = default
try:
is_node = issubclass(factory, SCons.Node.FS.Base)
except TypeError:
# The specified factory i... | python | {
"resource": ""
} |
q238264 | Base.Append | train | def Append(self, **kw):
"""Append values to existing construction variables
in an Environment.
"""
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 fini... | python | {
"resource": ""
} |
q238265 | Base.AppendENVPath | train | def AppendENVPath(self, name, newpath, envname = 'ENV',
sep = os.pathsep, delete_existing=1):
"""Append path elements to the path 'name' in the 'ENV'
dictionary for this environment. Will only add any particular
path once, and will normpath and normcase all paths to help
... | python | {
"resource": ""
} |
q238266 | Base.Detect | train | def Detect(self, progs):
"""Return the first available program in progs.
"""
if not SCons.Util.is_List(progs):
progs = [ progs ]
for prog in progs:
path = self.WhereIs(prog)
if path: return prog
return None | python | {
"resource": ""
} |
q238267 | Base.Dump | train | def Dump(self, key = None):
"""
Using the standard Python pretty printer, return the contents of the
scons build environment as a string.
If the key passed in is anything other than None, then that will
be used as an index into the build environment dictionary and
whatev... | python | {
"resource": ""
} |
q238268 | Base.FindIxes | train | def FindIxes(self, paths, prefix, suffix):
"""
Search a list of paths for something that matches the prefix and suffix.
paths - the list of paths or nodes.
prefix - construction variable for the prefix.
suffix - construction variable for the suffix.
"""
suffix =... | python | {
"resource": ""
} |
q238269 | Base.ParseDepends | train | def ParseDepends(self, filename, must_exist=None, only_one=0):
"""
Parse a mkdep-style file for explicit dependencies. This is
completely abusable, and should be unnecessary in the "normal"
case of proper SCons configuration, but it may help make
the transition from a Make hiera... | python | {
"resource": ""
} |
q238270 | Base.Prepend | train | def Prepend(self, **kw):
"""Prepend values to existing construction variables
in an Environment.
"""
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 fi... | python | {
"resource": ""
} |
q238271 | Base.PrependENVPath | train | def PrependENVPath(self, name, newpath, envname = 'ENV', sep = os.pathsep,
delete_existing=1):
"""Prepend path elements to the path 'name' in the 'ENV'
dictionary for this environment. Will only add any particular
path once, and will normpath and normcase all paths to hel... | python | {
"resource": ""
} |
q238272 | Base.PrependUnique | train | def PrependUnique(self, delete_existing=0, **kw):
"""Prepend values to existing construction variables
in an Environment, if they're not already there.
If delete_existing is 1, removes existing values first, so
values move to front.
"""
kw = copy_non_reserved_keywords(kw)... | python | {
"resource": ""
} |
q238273 | Base.ReplaceIxes | train | def ReplaceIxes(self, path, old_prefix, old_suffix, new_prefix, new_suffix):
"""
Replace old_prefix with new_prefix and old_suffix with new_suffix.
env - Environment used to interpolate variables.
path - the path that will be modified.
old_prefix - construction variable for the ... | python | {
"resource": ""
} |
q238274 | Base.WhereIs | train | def WhereIs(self, prog, path=None, pathext=None, reject=[]):
"""Find prog in the path.
"""
if path is None:
try:
path = self['ENV']['PATH']
except KeyError:
pass
elif SCons.Util.is_String(path):
path = self.subst(path)
... | python | {
"resource": ""
} |
q238275 | Base.Command | train | def Command(self, target, source, action, **kw):
"""Builds the supplied target files from the supplied
source files using the supplied action. Action may
be any type that the Builder constructor will accept
for an action."""
bkw = {
'action' : action,
'ta... | python | {
"resource": ""
} |
q238276 | Base.Depends | train | def Depends(self, target, dependency):
"""Explicity specify that 'target's depend on 'dependency'."""
tlist = self.arg2nodes(target, self.fs.Entry)
dlist = self.arg2nodes(dependency, self.fs.Entry)
for t in tlist:
t.add_dependency(dlist)
return tlist | python | {
"resource": ""
} |
q238277 | Base.NoClean | train | def NoClean(self, *targets):
"""Tags a target so that it will not be cleaned by -c"""
tlist = []
for t in targets:
tlist.extend(self.arg2nodes(t, self.fs.Entry))
for t in tlist:
t.set_noclean()
return tlist | python | {
"resource": ""
} |
q238278 | Base.NoCache | train | def NoCache(self, *targets):
"""Tags a target so that it will not be cached"""
tlist = []
for t in targets:
tlist.extend(self.arg2nodes(t, self.fs.Entry))
for t in tlist:
t.set_nocache()
return tlist | python | {
"resource": ""
} |
q238279 | Base.Execute | train | def Execute(self, action, *args, **kw):
"""Directly execute an action through an Environment
"""
action = self.Action(action, *args, **kw)
result = action([], [], self)
if isinstance(result, SCons.Errors.BuildError):
errstr = result.errstr
if result.filena... | python | {
"resource": ""
} |
q238280 | Base.Ignore | train | def Ignore(self, target, dependency):
"""Ignore a dependency."""
tlist = self.arg2nodes(target, self.fs.Entry)
dlist = self.arg2nodes(dependency, self.fs.Entry)
for t in tlist:
t.add_ignore(dlist)
return tlist | python | {
"resource": ""
} |
q238281 | Base.SideEffect | train | def SideEffect(self, side_effect, target):
"""Tell scons that side_effects are built as side
effects of building targets."""
side_effects = self.arg2nodes(side_effect, self.fs.Entry)
targets = self.arg2nodes(target, self.fs.Entry)
for side_effect in side_effects:
if ... | python | {
"resource": ""
} |
q238282 | Base.Split | train | def Split(self, arg):
"""This function converts a string or list into a list of strings
or Nodes. This makes things easier for users by allowing files to
be specified as a white-space separated list to be split.
The input rules are:
- A single string containing names separa... | python | {
"resource": ""
} |
q238283 | Base.FindSourceFiles | train | def FindSourceFiles(self, node='.'):
""" returns a list of all source files.
"""
node = self.arg2nodes(node, self.fs.Entry)[0]
sources = []
def build_source(ss):
for s in ss:
if isinstance(s, SCons.Node.FS.Dir):
build_source(s.all_... | python | {
"resource": ""
} |
q238284 | Base.FindInstalledFiles | train | def FindInstalledFiles(self):
""" returns the list of all targets of the Install and InstallAs Builder.
"""
from SCons.Tool import install
if install._UNIQUE_INSTALLED_FILES is None:
install._UNIQUE_INSTALLED_FILES = SCons.Util.uniquer_hashables(install._INSTALLED_FILES)
... | python | {
"resource": ""
} |
q238285 | generate | train | def generate(env):
"""Add Builders and construction variables for pdflatex to an Environment."""
global PDFLaTeXAction
if PDFLaTeXAction is None:
PDFLaTeXAction = SCons.Action.Action('$PDFLATEXCOM', '$PDFLATEXCOMSTR')
global PDFLaTeXAuxAction
if PDFLaTeXAuxAction is None:
PDFLaTeXAu... | python | {
"resource": ""
} |
q238286 | installShlibLinks | train | def installShlibLinks(dest, source, env):
"""If we are installing a versioned shared library create the required links."""
Verbose = False
symlinks = listShlibLinksToInstall(dest, source, env)
if Verbose:
print('installShlibLinks: symlinks={:r}'.format(SCons.Tool.StringizeLibSymlinks(symlinks)))... | python | {
"resource": ""
} |
q238287 | installFunc | train | def installFunc(target, source, env):
"""Install a source file into a target using the function specified
as the INSTALL construction variable."""
try:
install = env['INSTALL']
except KeyError:
raise SCons.Errors.UserError('Missing INSTALL construction variable.')
assert len(target)... | python | {
"resource": ""
} |
q238288 | installFuncVersionedLib | train | def installFuncVersionedLib(target, source, env):
"""Install a versioned library into a target using the function specified
as the INSTALLVERSIONEDLIB construction variable."""
try:
install = env['INSTALLVERSIONEDLIB']
except KeyError:
raise SCons.Errors.UserError('Missing INSTALLVERSION... | python | {
"resource": ""
} |
q238289 | SendErrorCheckingRPCRecord.parse_multiple_rpcs | train | def parse_multiple_rpcs(cls, record_data):
"""Parse record_data into multiple error checking rpcs."""
rpcs = []
while len(record_data) > 0:
total_length, record_type = struct.unpack_from("<LB3x", record_data)
if record_type != SendErrorCheckingRPCRecord.RecordType:
... | python | {
"resource": ""
} |
q238290 | generate | train | def generate(env):
"""Add Builders and construction variables for clang to an Environment."""
SCons.Tool.cc.generate(env)
env['CC'] = env.Detect(compilers) or 'clang'
if env['PLATFORM'] in ['cygwin', 'win32']:
env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS')
else:
env['SHCCFLAGS'] = ... | python | {
"resource": ""
} |
q238291 | StoppableWorkerThread.wait_running | train | def wait_running(self, timeout=None):
"""Wait for the thread to pass control to its routine.
Args:
timeout (float): The maximum amount of time to wait
"""
flag = self._running.wait(timeout)
if flag is False:
raise TimeoutExpiredError("Timeout waiting fo... | python | {
"resource": ""
} |
q238292 | EmulationLoop.create_event | train | def create_event(self, register=False):
"""Create an asyncio.Event inside the emulation loop.
This method exists as a convenience to create an Event object that is
associated with the correct EventLoop(). If you pass register=True,
then the event will be registered as an event that mus... | python | {
"resource": ""
} |
q238293 | EmulationLoop.create_queue | train | def create_queue(self, register=False):
"""Create a new work queue and optionally register it.
This will make sure the queue is attached to the correct event loop.
You can optionally choose to automatically register it so that
wait_idle() will block until the queue is empty.
Ar... | python | {
"resource": ""
} |
q238294 | EmulationLoop.start | train | def start(self):
"""Start the background emulation loop."""
if self._started is True:
raise ArgumentError("EmulationLoop.start() called multiple times")
self._thread = threading.Thread(target=self._loop_thread_main)
self._thread.start()
self._started = True | python | {
"resource": ""
} |
q238295 | EmulationLoop.stop | train | def stop(self):
"""Stop the background emulation loop."""
if self._started is False:
raise ArgumentError("EmulationLoop.stop() called without calling start()")
self.verify_calling_thread(False, "Cannot call EmulationLoop.stop() from inside the event loop")
if self._thread.... | python | {
"resource": ""
} |
q238296 | EmulationLoop.wait_idle | train | def wait_idle(self, timeout=1.0):
"""Wait until the rpc queue is empty.
This method may be called either from within the event loop or from
outside of it. If it is called outside of the event loop it will
block the calling thread until the rpc queue is temporarily empty.
If it... | python | {
"resource": ""
} |
q238297 | EmulationLoop.run_task_external | train | def run_task_external(self, coroutine):
"""Inject a task into the emulation loop and wait for it to finish.
The coroutine parameter is run as a Task inside the EmulationLoop
until it completes and the return value (or any raised Exception) is
pased back into the caller's thread.
... | python | {
"resource": ""
} |
q238298 | EmulationLoop.call_rpc_external | train | def call_rpc_external(self, address, rpc_id, arg_payload, timeout=10.0):
"""Call an RPC from outside of the event loop and block until it finishes.
This is the main method by which a caller outside of the EmulationLoop
can inject an RPC into the EmulationLoop and wait for it to complete.
... | python | {
"resource": ""
} |
q238299 | EmulationLoop.await_rpc | train | async def await_rpc(self, address, rpc_id, *args, **kwargs):
"""Send an RPC from inside the EmulationLoop.
This is the primary method by which tasks running inside the
EmulationLoop dispatch RPCs. The RPC is added to the queue of waiting
RPCs to be drained by the RPC dispatch task and ... | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.