_id stringlengths 2 7 | title stringlengths 1 88 | partition stringclasses 3
values | text stringlengths 75 19.8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q238800 | detect_version | train | def detect_version(env, cc):
"""Return the version of the GNU compiler, or None if it is not a GNU compiler."""
cc = env.subst(cc)
if not cc:
return None
version = None
#pipe = SCons.Action._subproc(env, SCons.Util.CLVar(cc) + ['-dumpversion'],
pipe = SCons.Action._subproc(env, SCons.Uti... | python | {
"resource": ""
} |
q238801 | is_dos_short_file_name | train | def is_dos_short_file_name(file):
""" Examine if the given file is in the 8.3 form.
"""
fname, ext = os.path.splitext(file)
proper_ext = len(ext) == 0 or (2 <= len(ext) <= 4) # the ext contains the dot
proper_fname = file.isupper() and len(fname) <= 8
return proper_ext and proper_fname | python | {
"resource": ""
} |
q238802 | create_feature_dict | train | def create_feature_dict(files):
""" X_MSI_FEATURE and doc FileTag's can be used to collect files in a
hierarchy. This function collects the files into this hierarchy.
"""
dict = {}
def add_to_dict( feature, file ):
if not SCons.Util.is_List( feature ):
feature = [ feature ]
... | python | {
"resource": ""
} |
q238803 | generate_guids | train | def generate_guids(root):
""" generates globally unique identifiers for parts of the xml which need
them.
Component tags have a special requirement. Their UUID is only allowed to
change if the list of their contained resources has changed. This allows
for clean removal and proper updates.
To h... | python | {
"resource": ""
} |
q238804 | create_default_directory_layout | train | def create_default_directory_layout(root, NAME, VERSION, VENDOR, filename_set):
""" Create the wix default target directory layout and return the innermost
directory.
We assume that the XML tree delivered in the root argument already contains
the Product tag.
Everything is put under the PFiles dir... | python | {
"resource": ""
} |
q238805 | build_wxsfile_file_section | train | def build_wxsfile_file_section(root, files, NAME, VERSION, VENDOR, filename_set, id_set):
""" Builds the Component sections of the wxs file with their included files.
Files need to be specified in 8.3 format and in the long name format, long
filenames will be converted automatically.
Features are spec... | python | {
"resource": ""
} |
q238806 | build_wxsfile_default_gui | train | def build_wxsfile_default_gui(root):
""" This function adds a default GUI to the wxs file
"""
factory = Document()
Product = root.getElementsByTagName('Product')[0]
UIRef = factory.createElement('UIRef')
UIRef.attributes['Id'] = 'WixUI_Mondo'
Product.childNodes.append(UIRef)
UIRef ... | python | {
"resource": ""
} |
q238807 | build_license_file | train | def build_license_file(directory, spec):
""" Creates a License.rtf file with the content of "X_MSI_LICENSE_TEXT"
in the given directory
"""
name, text = '', ''
try:
name = spec['LICENSE']
text = spec['X_MSI_LICENSE_TEXT']
except KeyError:
pass # ignore this as X_MSI_LICE... | python | {
"resource": ""
} |
q238808 | build_wxsfile_header_section | train | def build_wxsfile_header_section(root, spec):
""" Adds the xml file node which define the package meta-data.
"""
# Create the needed DOM nodes and add them at the correct position in the tree.
factory = Document()
Product = factory.createElement( 'Product' )
Package = factory.createElement( 'Pac... | python | {
"resource": ""
} |
q238809 | generate | train | def generate(env):
"""Add Builders and construction variables for SunPRO C++."""
path, cxx, shcxx, version = get_cppc(env)
if path:
cxx = os.path.join(path, cxx)
shcxx = os.path.join(path, shcxx)
cplusplus.generate(env)
env['CXX'] = cxx
env['SHCXX'] = shcxx
env['CXXVERSION'... | python | {
"resource": ""
} |
q238810 | FlexibleDictionaryReport.FromReadings | train | def FromReadings(cls, uuid, readings, events, report_id=IOTileReading.InvalidReadingID,
selector=0xFFFF, streamer=0x100, sent_timestamp=0, received_time=None):
"""Create a flexible dictionary report from a list of readings and events.
Args:
uuid (int): The uuid of the d... | python | {
"resource": ""
} |
q238811 | FlexibleDictionaryReport.decode | train | def decode(self):
"""Decode this report from a msgpack encoded binary blob."""
report_dict = msgpack.unpackb(self.raw_report, raw=False)
events = [IOTileEvent.FromDict(x) for x in report_dict.get('events', [])]
readings = [IOTileReading.FromDict(x) for x in report_dict.get('data', [])]... | python | {
"resource": ""
} |
q238812 | _callable_contents | train | def _callable_contents(obj):
"""Return the signature contents of a callable Python object.
"""
try:
# Test if obj is a method.
return _function_contents(obj.__func__)
except AttributeError:
try:
# Test if obj is a callable object.
return _function_content... | python | {
"resource": ""
} |
q238813 | _object_contents | train | def _object_contents(obj):
"""Return the signature contents of any Python object.
We have to handle the case where object contains a code object
since it can be pickled directly.
"""
try:
# Test if obj is a method.
return _function_contents(obj.__func__)
except AttributeError:
... | python | {
"resource": ""
} |
q238814 | _code_contents | train | def _code_contents(code, docstring=None):
"""Return the signature contents of a code object.
By providing direct access to the code object of the
function, Python makes this extremely easy. Hooray!
Unfortunately, older versions of Python include line
number indications in the compiled byte code. ... | python | {
"resource": ""
} |
q238815 | _object_instance_content | train | def _object_instance_content(obj):
"""
Returns consistant content for a action class or an instance thereof
:Parameters:
- `obj` Should be either and action class or an instance thereof
:Returns:
bytearray or bytes representing the obj suitable for generating a signature from.
"""
... | python | {
"resource": ""
} |
q238816 | _do_create_keywords | train | def _do_create_keywords(args, kw):
"""This converts any arguments after the action argument into
their equivalent keywords and adds them to the kw argument.
"""
v = kw.get('varlist', ())
# prevent varlist="FOO" from being interpreted as ['F', 'O', 'O']
if is_String(v): v = (v,)
kw['varlist']... | python | {
"resource": ""
} |
q238817 | _do_create_list_action | train | def _do_create_list_action(act, kw):
"""A factory for list actions. Convert the input list into Actions
and then wrap them in a ListAction."""
acts = []
for a in act:
aa = _do_create_action(a, kw)
if aa is not None: acts.append(aa)
if not acts:
return ListAction([])
elif... | python | {
"resource": ""
} |
q238818 | Action | train | def Action(act, *args, **kw):
"""A factory for action objects."""
# Really simple: the _do_create_* routines do the heavy lifting.
_do_create_keywords(args, kw)
if is_List(act):
return _do_create_list_action(act, kw)
return _do_create_action(act, kw) | python | {
"resource": ""
} |
q238819 | _string_from_cmd_list | train | def _string_from_cmd_list(cmd_list):
"""Takes a list of command line arguments and returns a pretty
representation for printing."""
cl = []
for arg in map(str, cmd_list):
if ' ' in arg or '\t' in arg:
arg = '"' + arg + '"'
cl.append(arg)
return ' '.join(cl) | python | {
"resource": ""
} |
q238820 | get_default_ENV | train | def get_default_ENV(env):
"""
A fiddlin' little function that has an 'import SCons.Environment' which
can't be moved to the top level without creating an import loop. Since
this import creates a local variable named 'SCons', it blocks access to
the global variable, so we move it here to prevent com... | python | {
"resource": ""
} |
q238821 | CommandAction.execute | train | def execute(self, target, source, env, executor=None):
"""Execute a command action.
This will handle lists of commands as well as individual commands,
because construction variable substitution may turn a single
"command" into a list. This means that this class can actually
han... | python | {
"resource": ""
} |
q238822 | FunctionAction.get_presig | train | def get_presig(self, target, source, env):
"""Return the signature contents of this callable action."""
try:
return self.gc(target, source, env)
except AttributeError:
return self.funccontents | python | {
"resource": ""
} |
q238823 | ListAction.get_presig | train | def get_presig(self, target, source, env):
"""Return the signature contents of this action list.
Simple concatenation of the signatures of the elements.
"""
return b"".join([bytes(x.get_contents(target, source, env)) for x in self.list]) | python | {
"resource": ""
} |
q238824 | ServiceManager._notify_update | train | async def _notify_update(self, name, change_type, change_info=None, directed_client=None):
"""Notify updates on a service to anyone who cares."""
for monitor in self._monitors:
try:
result = monitor(name, change_type, change_info, directed_client=directed_client)
... | python | {
"resource": ""
} |
q238825 | ServiceManager.update_state | train | async def update_state(self, short_name, state):
"""Set the current state of a service.
If the state is unchanged from a previous attempt, this routine does
nothing.
Args:
short_name (string): The short name of the service
state (int): The new stae of the servic... | python | {
"resource": ""
} |
q238826 | ServiceManager.add_service | train | def add_service(self, name, long_name, preregistered=False, notify=True):
"""Add a service to the list of tracked services.
Args:
name (string): A unique short service name for the service
long_name (string): A longer, user friendly name for the service
preregistered... | python | {
"resource": ""
} |
q238827 | ServiceManager.service_info | train | def service_info(self, short_name):
"""Get static information about a service.
Args:
short_name (string): The short name of the service to query
Returns:
dict: A dictionary with the long_name and preregistered info
on this service.
"""
i... | python | {
"resource": ""
} |
q238828 | ServiceManager.service_messages | train | def service_messages(self, short_name):
"""Get the messages stored for a service.
Args:
short_name (string): The short name of the service to get messages for
Returns:
list(ServiceMessage): A list of the ServiceMessages stored for this service
"""
if sh... | python | {
"resource": ""
} |
q238829 | ServiceManager.service_headline | train | def service_headline(self, short_name):
"""Get the headline stored for a service.
Args:
short_name (string): The short name of the service to get messages for
Returns:
ServiceMessage: the headline or None if there is no headline
"""
if short_name not in... | python | {
"resource": ""
} |
q238830 | ServiceManager.service_status | train | def service_status(self, short_name):
"""Get the current status of a service.
Returns information about the service such as the length since the last
heartbeat, any status messages that have been posted about the service
and whether the heartbeat should be considered out of the ordinary... | python | {
"resource": ""
} |
q238831 | ServiceManager.send_message | train | async def send_message(self, name, level, message):
"""Post a message for a service.
Args:
name (string): The short name of the service to query
level (int): The level of the message (info, warning, error)
message (string): The message contents
"""
i... | python | {
"resource": ""
} |
q238832 | ServiceManager.set_headline | train | async def set_headline(self, name, level, message):
"""Set the sticky headline for a service.
Args:
name (string): The short name of the service to query
level (int): The level of the message (info, warning, error)
message (string): The message contents
"""
... | python | {
"resource": ""
} |
q238833 | ServiceManager.send_heartbeat | train | async def send_heartbeat(self, short_name):
"""Post a heartbeat for a service.
Args:
short_name (string): The short name of the service to query
"""
if short_name not in self.services:
raise ArgumentError("Unknown service name", short_name=short_name)
s... | python | {
"resource": ""
} |
q238834 | ServiceManager.set_agent | train | def set_agent(self, short_name, client_id):
"""Register a client id that handlers commands for a service.
Args:
short_name (str): The name of the service to set an agent
for.
client_id (str): A globally unique id for the client that
should receive... | python | {
"resource": ""
} |
q238835 | ServiceManager.clear_agent | train | def clear_agent(self, short_name, client_id):
"""Remove a client id from being the command handler for a service.
Args:
short_name (str): The name of the service to set an agent
for.
client_id (str): A globally unique id for the client that
should... | python | {
"resource": ""
} |
q238836 | ServiceManager.send_rpc_command | train | async def send_rpc_command(self, short_name, rpc_id, payload, sender_client, timeout=1.0):
"""Send an RPC to a service using its registered agent.
Args:
short_name (str): The name of the service we would like to send
and RPC to
rpc_id (int): The rpc id that we wo... | python | {
"resource": ""
} |
q238837 | ServiceManager.send_rpc_response | train | def send_rpc_response(self, rpc_tag, result, response):
"""Send a response to an RPC.
Args:
rpc_tag (str): The exact string given in a previous call to send_rpc_command
result (str): The result of the operation. The possible values of response are:
service_not_f... | python | {
"resource": ""
} |
q238838 | ServiceManager.periodic_service_rpcs | train | def periodic_service_rpcs(self):
"""Check if any RPC has expired and remove it from the in flight list.
This function should be called periodically to expire any RPCs that never complete.
"""
to_remove = []
now = monotonic()
for rpc_tag, rpc in self.in_flight_rpcs.item... | python | {
"resource": ""
} |
q238839 | settings_directory | train | def settings_directory():
"""Find a per user settings directory that is appropriate for each
type of system that we are installed on.
"""
system = platform.system()
basedir = None
if system == 'Windows':
if 'APPDATA' in os.environ:
basedir = os.environ['APPDATA']
# If... | python | {
"resource": ""
} |
q238840 | generate | train | def generate(env):
"""Add Builders and construction variables for Ghostscript to an
Environment."""
global GhostscriptAction
# The following try-except block enables us to use the Tool
# in standalone mode (without the accompanying pdf.py),
# whenever we need an explicit call of gs via the Gs()
... | python | {
"resource": ""
} |
q238841 | resource_path | train | def resource_path(relative_path=None, expect=None):
"""Return the absolute path to a resource in iotile-build.
This method finds the path to the `config` folder inside
iotile-build, appends `relative_path` to it and then
checks to make sure the desired file or directory exists.
You can specify exp... | python | {
"resource": ""
} |
q238842 | unpack | train | def unpack(fmt, arg):
"""A shim around struct.unpack to allow it to work on python 2.7.3."""
if isinstance(arg, bytearray) and not (sys.version_info >= (2, 7, 5)):
return struct.unpack(fmt, str(arg))
return struct.unpack(fmt, arg) | python | {
"resource": ""
} |
q238843 | ControllerSubsystemBase.initialize | train | async def initialize(self, timeout=2.0):
"""Launch any background tasks associated with this subsystem.
This method will synchronously await self.initialized() which makes
sure that the background tasks start up correctly.
"""
if self.initialized.is_set():
raise Int... | python | {
"resource": ""
} |
q238844 | _check_registry_type | train | def _check_registry_type(folder=None):
"""Check if the user has placed a registry_type.txt file to choose the registry type
If a default registry type file is found, the DefaultBackingType and DefaultBackingFile
class parameters in ComponentRegistry are updated accordingly.
Args:
folder (strin... | python | {
"resource": ""
} |
q238845 | _ensure_package_loaded | train | def _ensure_package_loaded(path, component):
"""Ensure that the given module is loaded as a submodule.
Returns:
str: The name that the module should be imported as.
"""
logger = logging.getLogger(__name__)
packages = component.find_products('support_package')
if len(packages) == 0:
... | python | {
"resource": ""
} |
q238846 | _try_load_module | train | def _try_load_module(path, import_name=None):
"""Try to programmatically load a python module by path.
Path should point to a python file (optionally without the .py) at the
end. If it ends in a :<name> then name must point to an object defined in
the module, which is returned instead of the module it... | python | {
"resource": ""
} |
q238847 | ComponentRegistry.frozen | train | def frozen(self):
"""Return whether we have a cached list of all installed entry_points."""
frozen_path = os.path.join(_registry_folder(), 'frozen_extensions.json')
return os.path.isfile(frozen_path) | python | {
"resource": ""
} |
q238848 | ComponentRegistry.kvstore | train | def kvstore(self):
"""Lazily load the underlying key-value store backing this registry."""
if self._kvstore is None:
self._kvstore = self.BackingType(self.BackingFileName, respect_venv=True)
return self._kvstore | python | {
"resource": ""
} |
q238849 | ComponentRegistry.plugins | train | def plugins(self):
"""Lazily load iotile plugins only on demand.
This is a slow operation on computers with a slow FS and is rarely
accessed information, so only compute it when it is actually asked
for.
"""
if self._plugins is None:
self._plugins = {}
... | python | {
"resource": ""
} |
q238850 | ComponentRegistry.load_extensions | train | def load_extensions(self, group, name_filter=None, comp_filter=None, class_filter=None, product_name=None, unique=False):
"""Dynamically load and return extension objects of a given type.
This is the centralized way for all parts of CoreTools to allow plugin
behavior. Whenever a plugin is need... | python | {
"resource": ""
} |
q238851 | ComponentRegistry.register_extension | train | def register_extension(self, group, name, extension):
"""Register an extension.
Args:
group (str): The type of the extension
name (str): A name for the extension
extension (str or class): If this is a string, then it will be
interpreted as a path to i... | python | {
"resource": ""
} |
q238852 | ComponentRegistry.clear_extensions | train | def clear_extensions(self, group=None):
"""Clear all previously registered extensions."""
if group is None:
ComponentRegistry._registered_extensions = {}
return
if group in self._registered_extensions:
self._registered_extensions[group] = [] | python | {
"resource": ""
} |
q238853 | ComponentRegistry.freeze_extensions | train | def freeze_extensions(self):
"""Freeze the set of extensions into a single file.
Freezing extensions can speed up the extension loading process on
machines with slow file systems since it requires only a single file
to store all of the extensions.
Calling this method will save ... | python | {
"resource": ""
} |
q238854 | ComponentRegistry.unfreeze_extensions | train | def unfreeze_extensions(self):
"""Remove a previously frozen list of extensions."""
output_path = os.path.join(_registry_folder(), 'frozen_extensions.json')
if not os.path.isfile(output_path):
raise ExternalError("There is no frozen extension list")
os.remove(output_path)
... | python | {
"resource": ""
} |
q238855 | ComponentRegistry.load_extension | train | def load_extension(self, path, name_filter=None, class_filter=None, unique=False, component=None):
"""Load a single python module extension.
This function is similar to using the imp module directly to load a
module and potentially inspecting the objects it declares to filter
them by cl... | python | {
"resource": ""
} |
q238856 | ComponentRegistry._filter_nonextensions | train | def _filter_nonextensions(cls, obj):
"""Remove all classes marked as not extensions.
This allows us to have a deeper hierarchy of classes than just
one base class that is filtered by _filter_subclasses. Any
class can define a class propery named:
__NO_EXTENSION__ = True
... | python | {
"resource": ""
} |
q238857 | ComponentRegistry.SetBackingStore | train | def SetBackingStore(cls, backing):
"""Set the global backing type used by the ComponentRegistry from this point forward
This function must be called before any operations that use the registry are initiated
otherwise they will work from different registries that will likely contain different da... | python | {
"resource": ""
} |
q238858 | ComponentRegistry.add_component | train | def add_component(self, component, temporary=False):
"""Register a component with ComponentRegistry.
Component must be a buildable object with a module_settings.json file
that describes its name and the domain that it is part of. By
default, this component is saved in the permanent reg... | python | {
"resource": ""
} |
q238859 | ComponentRegistry.list_plugins | train | def list_plugins(self):
"""
List all of the plugins that have been registerd for the iotile program on this computer
"""
vals = self.plugins.items()
return {x: y for x, y in vals} | python | {
"resource": ""
} |
q238860 | ComponentRegistry.clear_components | train | def clear_components(self):
"""Clear all of the registered components
"""
ComponentRegistry._component_overlays = {}
for key in self.list_components():
self.remove_component(key) | python | {
"resource": ""
} |
q238861 | ComponentRegistry.list_components | train | def list_components(self):
"""List all of the registered component names.
This list will include all of the permanently stored components as
well as any temporary components that were added with a temporary=True
flag in this session.
Returns:
list of str: The list o... | python | {
"resource": ""
} |
q238862 | ComponentRegistry.iter_components | train | def iter_components(self):
"""Iterate over all defined components yielding IOTile objects."""
names = self.list_components()
for name in names:
yield self.get_component(name) | python | {
"resource": ""
} |
q238863 | ComponentRegistry.list_config | train | def list_config(self):
"""List all of the configuration variables
"""
items = self.kvstore.get_all()
return ["{0}={1}".format(x[0][len('config:'):], x[1])
for x in items if x[0].startswith('config:')] | python | {
"resource": ""
} |
q238864 | ComponentRegistry.set_config | train | def set_config(self, key, value):
"""Set a persistent config key to a value, stored in the registry
Args:
key (string): The key name
value (string): The key value
"""
keyname = "config:" + key
self.kvstore.set(keyname, value) | python | {
"resource": ""
} |
q238865 | ComponentRegistry.get_config | train | def get_config(self, key, default=MISSING):
"""Get the value of a persistent config key from the registry
If no default is specified and the key is not found ArgumentError is raised.
Args:
key (string): The key name to fetch
default (string): an optional value to be ret... | python | {
"resource": ""
} |
q238866 | execute_action_list | train | def execute_action_list(obj, target, kw):
"""Actually execute the action list."""
env = obj.get_build_env()
kw = obj.get_kw(kw)
status = 0
for act in obj.get_action_list():
args = ([], [], env)
status = act(*args, **kw)
if isinstance(status, SCons.Errors.BuildError):
... | python | {
"resource": ""
} |
q238867 | Executor.get_all_targets | train | def get_all_targets(self):
"""Returns all targets for all batches of this Executor."""
result = []
for batch in self.batches:
result.extend(batch.targets)
return result | python | {
"resource": ""
} |
q238868 | Executor.get_all_sources | train | def get_all_sources(self):
"""Returns all sources for all batches of this Executor."""
result = []
for batch in self.batches:
result.extend(batch.sources)
return result | python | {
"resource": ""
} |
q238869 | Executor.get_action_side_effects | train | def get_action_side_effects(self):
"""Returns all side effects for all batches of this
Executor used by the underlying Action.
"""
result = SCons.Util.UniqueList([])
for target in self.get_action_targets():
result.extend(target.side_effects)
return result | python | {
"resource": ""
} |
q238870 | Executor.get_build_env | train | def get_build_env(self):
"""Fetch or create the appropriate build Environment
for this Executor.
"""
try:
return self._memo['get_build_env']
except KeyError:
pass
# Create the build environment instance with appropriate
# overrides. These... | python | {
"resource": ""
} |
q238871 | Executor.get_build_scanner_path | train | def get_build_scanner_path(self, scanner):
"""Fetch the scanner path for this executor's targets and sources.
"""
env = self.get_build_env()
try:
cwd = self.batches[0].targets[0].cwd
except (IndexError, AttributeError):
cwd = None
return scanner.pa... | python | {
"resource": ""
} |
q238872 | Executor.add_sources | train | def add_sources(self, sources):
"""Add source files to this Executor's list. This is necessary
for "multi" Builders that can be called repeatedly to build up
a source file list for a given target."""
# TODO(batch): extend to multiple batches
assert (len(self.batches) == 1)
... | python | {
"resource": ""
} |
q238873 | Executor.add_batch | train | def add_batch(self, targets, sources):
"""Add pair of associated target and source to this Executor's list.
This is necessary for "batch" Builders that can be called repeatedly
to build up a list of matching target and source files that will be
used in order to update multiple target fil... | python | {
"resource": ""
} |
q238874 | Executor.get_contents | train | def get_contents(self):
"""Fetch the signature contents. This is the main reason this
class exists, so we can compute this once and cache it regardless
of how many target or source Nodes there are.
"""
try:
return self._memo['get_contents']
except KeyError:
... | python | {
"resource": ""
} |
q238875 | Executor.get_implicit_deps | train | def get_implicit_deps(self):
"""Return the executor's implicit dependencies, i.e. the nodes of
the commands to be executed."""
result = []
build_env = self.get_build_env()
for act in self.get_action_list():
deps = act.get_implicit_deps(self.get_all_targets(),
... | python | {
"resource": ""
} |
q238876 | Null._morph | train | def _morph(self):
"""Morph this Null executor to a real Executor object."""
batches = self.batches
self.__class__ = Executor
self.__init__([])
self.batches = batches | python | {
"resource": ""
} |
q238877 | UpdateRecord.LoadPlugins | train | def LoadPlugins(cls):
"""Load all registered iotile.update_record plugins."""
if cls.PLUGINS_LOADED:
return
reg = ComponentRegistry()
for _, record in reg.load_extensions('iotile.update_record'):
cls.RegisterRecordType(record)
cls.PLUGINS_LOADED = True | python | {
"resource": ""
} |
q238878 | UpdateRecord.RegisterRecordType | train | def RegisterRecordType(cls, record_class):
"""Register a known record type in KNOWN_CLASSES.
Args:
record_class (UpdateRecord): An update record subclass.
"""
record_type = record_class.MatchType()
if record_type not in UpdateRecord.KNOWN_CLASSES:
Update... | python | {
"resource": ""
} |
q238879 | RootScope._setup | train | def _setup(self):
"""Prepare for code generation by setting up root clock nodes.
These nodes are subsequently used as the basis for all clock operations.
"""
# Create a root system ticks and user configurable ticks
systick = self.allocator.allocate_stream(DataStream.CounterType... | python | {
"resource": ""
} |
q238880 | find_proxy_plugin | train | def find_proxy_plugin(component, plugin_name):
""" Attempt to find a proxy plugin provided by a specific component
Args:
component (string): The name of the component that provides the plugin
plugin_name (string): The name of the plugin to load
Returns:
TileBuxProxyPlugin: The plug... | python | {
"resource": ""
} |
q238881 | OnBlock._convert_trigger | train | def _convert_trigger(self, trigger_def, parent):
"""Convert a TriggerDefinition into a stream, trigger pair."""
if trigger_def.explicit_stream is None:
stream = parent.resolve_identifier(trigger_def.named_event, DataStream)
trigger = TrueTrigger()
else:
strea... | python | {
"resource": ""
} |
q238882 | OnBlock._parse_trigger | train | def _parse_trigger(self, trigger_clause):
"""Parse a named event or explicit stream trigger into a TriggerDefinition."""
cond = trigger_clause[0]
named_event = None
explicit_stream = None
explicit_trigger = None
# Identifier parse tree is Group(Identifier)
if c... | python | {
"resource": ""
} |
q238883 | platform_default | train | def platform_default():
"""Return the platform string for our execution environment.
The returned value should map to one of the SCons/Platform/*.py
files. Since we're architecture independent, though, we don't
care about the machine architecture.
"""
osname = os.name
if osname == 'java':
... | python | {
"resource": ""
} |
q238884 | platform_module | train | def platform_module(name = platform_default()):
"""Return the imported module for the platform.
This looks for a module name that matches the specified argument.
If the name is unspecified, we fetch the appropriate default for
our execution environment.
"""
full_name = 'SCons.Platform.' + name
... | python | {
"resource": ""
} |
q238885 | Platform | train | def Platform(name = platform_default()):
"""Select a canned Platform specification.
"""
module = platform_module(name)
spec = PlatformSpec(name, module.generate)
return spec | python | {
"resource": ""
} |
q238886 | jarSources | train | def jarSources(target, source, env, for_signature):
"""Only include sources that are not a manifest file."""
try:
env['JARCHDIR']
except KeyError:
jarchdir_set = False
else:
jarchdir_set = True
jarchdir = env.subst('$JARCHDIR', target=target, source=source)
if jar... | python | {
"resource": ""
} |
q238887 | jarManifest | train | def jarManifest(target, source, env, for_signature):
"""Look in sources for a manifest file, if any."""
for src in source:
contents = src.get_text_contents()
if contents[:16] == "Manifest-Version":
return src
return '' | python | {
"resource": ""
} |
q238888 | jarFlags | train | def jarFlags(target, source, env, for_signature):
"""If we have a manifest, make sure that the 'm'
flag is specified."""
jarflags = env.subst('$JARFLAGS', target=target, source=source)
for src in source:
contents = src.get_text_contents()
if contents[:16] == "Manifest-Version":
... | python | {
"resource": ""
} |
q238889 | generate | train | def generate(env):
"""Add Builders and construction variables for jar to an Environment."""
SCons.Tool.CreateJarBuilder(env)
SCons.Tool.CreateJavaFileBuilder(env)
SCons.Tool.CreateJavaClassFileBuilder(env)
SCons.Tool.CreateJavaClassDirBuilder(env)
env.AddMethod(Jar)
env['JAR'] = 'j... | python | {
"resource": ""
} |
q238890 | RPCExecutor.mock | train | def mock(self, slot, rpc_id, value):
"""Store a mock return value for an RPC
Args:
slot (SlotIdentifier): The slot we are mocking
rpc_id (int): The rpc we are mocking
value (int): The value that should be returned
when the RPC is called.
"""
... | python | {
"resource": ""
} |
q238891 | RPCExecutor.rpc | train | def rpc(self, address, rpc_id):
"""Call an RPC and receive the result as an integer.
If the RPC does not properly return a 32 bit integer, raise a warning
unless it cannot be converted into an integer at all, in which case
a HardwareError is thrown.
Args:
address (i... | python | {
"resource": ""
} |
q238892 | _get_swig_version | train | def _get_swig_version(env, swig):
"""Run the SWIG command line tool to get and return the version number"""
swig = env.subst(swig)
pipe = SCons.Action._subproc(env, SCons.Util.CLVar(swig) + ['-version'],
stdin = 'devnull',
stderr = 'devnull',... | python | {
"resource": ""
} |
q238893 | generate | train | def generate(env):
"""Add Builders and construction variables for swig to an Environment."""
c_file, cxx_file = SCons.Tool.createCFileBuilders(env)
c_file.suffix['.i'] = swigSuffixEmitter
cxx_file.suffix['.i'] = swigSuffixEmitter
c_file.add_action('.i', SwigAction)
c_file.add_emitter('.i', _sw... | python | {
"resource": ""
} |
q238894 | _select_ftdi_channel | train | def _select_ftdi_channel(channel):
"""Select multiplexer channel. Currently uses a FTDI chip via pylibftdi"""
if channel < 0 or channel > 8:
raise ArgumentError("FTDI-selected multiplexer only has channels 0-7 valid, "
"make sure you specify channel with -c channel=number", c... | python | {
"resource": ""
} |
q238895 | parse_binary_descriptor | train | def parse_binary_descriptor(bindata, sensor_log=None):
"""Convert a binary streamer descriptor into a string descriptor.
Binary streamer descriptors are 20-byte binary structures that encode all
information needed to create a streamer. They are used to communicate
that information to an embedded devic... | python | {
"resource": ""
} |
q238896 | create_binary_descriptor | train | def create_binary_descriptor(streamer):
"""Create a packed binary descriptor of a DataStreamer object.
Args:
streamer (DataStreamer): The streamer to create a packed descriptor for
Returns:
bytes: A packed 14-byte streamer descriptor.
"""
trigger = 0
if streamer.automatic:
... | python | {
"resource": ""
} |
q238897 | parse_string_descriptor | train | def parse_string_descriptor(string_desc):
"""Parse a string descriptor of a streamer into a DataStreamer object.
Args:
string_desc (str): The string descriptor that we wish to parse.
Returns:
DataStreamer: A DataStreamer object representing the streamer.
"""
if not isinstance(stri... | python | {
"resource": ""
} |
q238898 | generate | train | def generate(env):
"""Add Builders and construction variables for applelink to an
Environment."""
link.generate(env)
env['FRAMEWORKPATHPREFIX'] = '-F'
env['_FRAMEWORKPATH'] = '${_concat(FRAMEWORKPATHPREFIX, FRAMEWORKPATH, "", __env__)}'
env['_FRAMEWORKS'] = '${_concat("-framework ", FRAMEWORKS,... | python | {
"resource": ""
} |
q238899 | _generateGUID | train | def _generateGUID(slnfile, name):
"""This generates a dummy GUID for the sln file to use. It is
based on the MD5 signatures of the sln filename plus the name of
the project. It basically just needs to be unique, and not
change with each invocation."""
m = hashlib.md5()
# Normalize the slnfile ... | python | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.