repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Taskmaster.py | Task._exception_raise | def _exception_raise(self):
"""
Raises a pending exception that was recorded while getting a
Task ready for execution.
"""
exc = self.exc_info()[:]
try:
exc_type, exc_value, exc_traceback = exc
except ValueError:
exc_type, exc_value = exc
... | python | def _exception_raise(self):
"""
Raises a pending exception that was recorded while getting a
Task ready for execution.
"""
exc = self.exc_info()[:]
try:
exc_type, exc_value, exc_traceback = exc
except ValueError:
exc_type, exc_value = exc
... | [
"def",
"_exception_raise",
"(",
"self",
")",
":",
"exc",
"=",
"self",
".",
"exc_info",
"(",
")",
"[",
":",
"]",
"try",
":",
"exc_type",
",",
"exc_value",
",",
"exc_traceback",
"=",
"exc",
"except",
"ValueError",
":",
"exc_type",
",",
"exc_value",
"=",
... | Raises a pending exception that was recorded while getting a
Task ready for execution. | [
"Raises",
"a",
"pending",
"exception",
"that",
"was",
"recorded",
"while",
"getting",
"a",
"Task",
"ready",
"for",
"execution",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Taskmaster.py#L535-L556 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Taskmaster.py | Taskmaster.no_next_candidate | def no_next_candidate(self):
"""
Stops Taskmaster processing by not returning a next candidate.
Note that we have to clean-up the Taskmaster candidate list
because the cycle detection depends on the fact all nodes have
been processed somehow.
"""
while self.candi... | python | def no_next_candidate(self):
"""
Stops Taskmaster processing by not returning a next candidate.
Note that we have to clean-up the Taskmaster candidate list
because the cycle detection depends on the fact all nodes have
been processed somehow.
"""
while self.candi... | [
"def",
"no_next_candidate",
"(",
"self",
")",
":",
"while",
"self",
".",
"candidates",
":",
"candidates",
"=",
"self",
".",
"candidates",
"self",
".",
"candidates",
"=",
"[",
"]",
"self",
".",
"will_not_build",
"(",
"candidates",
")",
"return",
"None"
] | Stops Taskmaster processing by not returning a next candidate.
Note that we have to clean-up the Taskmaster candidate list
because the cycle detection depends on the fact all nodes have
been processed somehow. | [
"Stops",
"Taskmaster",
"processing",
"by",
"not",
"returning",
"a",
"next",
"candidate",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Taskmaster.py#L660-L672 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Taskmaster.py | Taskmaster._validate_pending_children | def _validate_pending_children(self):
"""
Validate the content of the pending_children set. Assert if an
internal error is found.
This function is used strictly for debugging the taskmaster by
checking that no invariants are violated. It is not used in
normal operation.
... | python | def _validate_pending_children(self):
"""
Validate the content of the pending_children set. Assert if an
internal error is found.
This function is used strictly for debugging the taskmaster by
checking that no invariants are violated. It is not used in
normal operation.
... | [
"def",
"_validate_pending_children",
"(",
"self",
")",
":",
"for",
"n",
"in",
"self",
".",
"pending_children",
":",
"assert",
"n",
".",
"state",
"in",
"(",
"NODE_PENDING",
",",
"NODE_EXECUTING",
")",
",",
"(",
"str",
"(",
"n",
")",
",",
"StateString",
"[... | Validate the content of the pending_children set. Assert if an
internal error is found.
This function is used strictly for debugging the taskmaster by
checking that no invariants are violated. It is not used in
normal operation.
The pending_children set is used to detect cycles... | [
"Validate",
"the",
"content",
"of",
"the",
"pending_children",
"set",
".",
"Assert",
"if",
"an",
"internal",
"error",
"is",
"found",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Taskmaster.py#L674-L749 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Taskmaster.py | Taskmaster.next_task | def next_task(self):
"""
Returns the next task to be executed.
This simply asks for the next Node to be evaluated, and then wraps
it in the specific Task subclass with which we were initialized.
"""
node = self._find_next_ready_node()
if node is None:
... | python | def next_task(self):
"""
Returns the next task to be executed.
This simply asks for the next Node to be evaluated, and then wraps
it in the specific Task subclass with which we were initialized.
"""
node = self._find_next_ready_node()
if node is None:
... | [
"def",
"next_task",
"(",
"self",
")",
":",
"node",
"=",
"self",
".",
"_find_next_ready_node",
"(",
")",
"if",
"node",
"is",
"None",
":",
"return",
"None",
"executor",
"=",
"node",
".",
"get_executor",
"(",
")",
"if",
"executor",
"is",
"None",
":",
"ret... | Returns the next task to be executed.
This simply asks for the next Node to be evaluated, and then wraps
it in the specific Task subclass with which we were initialized. | [
"Returns",
"the",
"next",
"task",
"to",
"be",
"executed",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Taskmaster.py#L952-L985 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Taskmaster.py | Taskmaster.cleanup | def cleanup(self):
"""
Check for dependency cycles.
"""
if not self.pending_children:
return
nclist = [(n, find_cycle([n], set())) for n in self.pending_children]
genuine_cycles = [
node for node,cycle in nclist
if cycle or n... | python | def cleanup(self):
"""
Check for dependency cycles.
"""
if not self.pending_children:
return
nclist = [(n, find_cycle([n], set())) for n in self.pending_children]
genuine_cycles = [
node for node,cycle in nclist
if cycle or n... | [
"def",
"cleanup",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"pending_children",
":",
"return",
"nclist",
"=",
"[",
"(",
"n",
",",
"find_cycle",
"(",
"[",
"n",
"]",
",",
"set",
"(",
")",
")",
")",
"for",
"n",
"in",
"self",
".",
"pending_chi... | Check for dependency cycles. | [
"Check",
"for",
"dependency",
"cycles",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Taskmaster.py#L1037-L1064 | train |
iotile/coretools | iotilebuild/iotile/build/dev/resolverchain.py | DependencyResolverChain.instantiate_resolver | def instantiate_resolver(self, name, args):
"""Directly instantiate a dependency resolver by name with the given arguments
Args:
name (string): The name of the class that we want to instantiate
args (dict): The arguments to pass to the resolver factory
Returns:
... | python | def instantiate_resolver(self, name, args):
"""Directly instantiate a dependency resolver by name with the given arguments
Args:
name (string): The name of the class that we want to instantiate
args (dict): The arguments to pass to the resolver factory
Returns:
... | [
"def",
"instantiate_resolver",
"(",
"self",
",",
"name",
",",
"args",
")",
":",
"if",
"name",
"not",
"in",
"self",
".",
"_known_resolvers",
":",
"raise",
"ArgumentError",
"(",
"\"Attempting to instantiate unknown dependency resolver\"",
",",
"name",
"=",
"name",
"... | Directly instantiate a dependency resolver by name with the given arguments
Args:
name (string): The name of the class that we want to instantiate
args (dict): The arguments to pass to the resolver factory
Returns:
DependencyResolver | [
"Directly",
"instantiate",
"a",
"dependency",
"resolver",
"by",
"name",
"with",
"the",
"given",
"arguments"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/dev/resolverchain.py#L53-L66 | train |
iotile/coretools | iotilebuild/iotile/build/dev/resolverchain.py | DependencyResolverChain.pull_release | def pull_release(self, name, version, destfolder=".", force=False):
"""Download and unpack a released iotile component by name and version range
If the folder that would be created already exists, this command fails unless
you pass force=True
Args:
name (string): The name o... | python | def pull_release(self, name, version, destfolder=".", force=False):
"""Download and unpack a released iotile component by name and version range
If the folder that would be created already exists, this command fails unless
you pass force=True
Args:
name (string): The name o... | [
"def",
"pull_release",
"(",
"self",
",",
"name",
",",
"version",
",",
"destfolder",
"=",
"\".\"",
",",
"force",
"=",
"False",
")",
":",
"unique_id",
"=",
"name",
".",
"replace",
"(",
"'/'",
",",
"'_'",
")",
"depdict",
"=",
"{",
"'name'",
":",
"name",... | Download and unpack a released iotile component by name and version range
If the folder that would be created already exists, this command fails unless
you pass force=True
Args:
name (string): The name of the component to download
version (SemanticVersionRange): The val... | [
"Download",
"and",
"unpack",
"a",
"released",
"iotile",
"component",
"by",
"name",
"and",
"version",
"range"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/dev/resolverchain.py#L68-L106 | train |
iotile/coretools | iotilebuild/iotile/build/dev/resolverchain.py | DependencyResolverChain.update_dependency | def update_dependency(self, tile, depinfo, destdir=None):
"""Attempt to install or update a dependency to the latest version.
Args:
tile (IOTile): An IOTile object describing the tile that has the dependency
depinfo (dict): a dictionary from tile.dependencies specifying the depe... | python | def update_dependency(self, tile, depinfo, destdir=None):
"""Attempt to install or update a dependency to the latest version.
Args:
tile (IOTile): An IOTile object describing the tile that has the dependency
depinfo (dict): a dictionary from tile.dependencies specifying the depe... | [
"def",
"update_dependency",
"(",
"self",
",",
"tile",
",",
"depinfo",
",",
"destdir",
"=",
"None",
")",
":",
"if",
"destdir",
"is",
"None",
":",
"destdir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"tile",
".",
"folder",
",",
"'build'",
",",
"'deps'"... | Attempt to install or update a dependency to the latest version.
Args:
tile (IOTile): An IOTile object describing the tile that has the dependency
depinfo (dict): a dictionary from tile.dependencies specifying the dependency
destdir (string): An optional folder into which to... | [
"Attempt",
"to",
"install",
"or",
"update",
"a",
"dependency",
"to",
"the",
"latest",
"version",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/dev/resolverchain.py#L108-L176 | train |
iotile/coretools | iotilebuild/iotile/build/dev/resolverchain.py | DependencyResolverChain._check_dep | def _check_dep(self, depinfo, deptile, resolver):
"""Check if a dependency tile is up to date
Returns:
bool: True if it is up to date, False if it not and None if this resolver
cannot assess whether or not it is up to date.
"""
try:
settings = se... | python | def _check_dep(self, depinfo, deptile, resolver):
"""Check if a dependency tile is up to date
Returns:
bool: True if it is up to date, False if it not and None if this resolver
cannot assess whether or not it is up to date.
"""
try:
settings = se... | [
"def",
"_check_dep",
"(",
"self",
",",
"depinfo",
",",
"deptile",
",",
"resolver",
")",
":",
"try",
":",
"settings",
"=",
"self",
".",
"_load_depsettings",
"(",
"deptile",
")",
"except",
"IOError",
":",
"return",
"False",
"if",
"settings",
"[",
"'resolver'... | Check if a dependency tile is up to date
Returns:
bool: True if it is up to date, False if it not and None if this resolver
cannot assess whether or not it is up to date. | [
"Check",
"if",
"a",
"dependency",
"tile",
"is",
"up",
"to",
"date"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/dev/resolverchain.py#L192-L214 | train |
iotile/coretools | iotilecore/iotile/core/utilities/async_tools/event_loop.py | _log_future_exception | def _log_future_exception(future, logger):
"""Log any exception raised by future."""
if not future.done():
return
try:
future.result()
except: #pylint:disable=bare-except;This is a background logging helper
logger.warning("Exception in ignored future: %s", future, exc_info=Tru... | python | def _log_future_exception(future, logger):
"""Log any exception raised by future."""
if not future.done():
return
try:
future.result()
except: #pylint:disable=bare-except;This is a background logging helper
logger.warning("Exception in ignored future: %s", future, exc_info=Tru... | [
"def",
"_log_future_exception",
"(",
"future",
",",
"logger",
")",
":",
"if",
"not",
"future",
".",
"done",
"(",
")",
":",
"return",
"try",
":",
"future",
".",
"result",
"(",
")",
"except",
":",
"logger",
".",
"warning",
"(",
"\"Exception in ignored future... | Log any exception raised by future. | [
"Log",
"any",
"exception",
"raised",
"by",
"future",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/utilities/async_tools/event_loop.py#L647-L656 | train |
iotile/coretools | iotilecore/iotile/core/utilities/async_tools/event_loop.py | BackgroundTask.create_subtask | def create_subtask(self, cor, name=None, stop_timeout=1.0):
"""Create and add a subtask from a coroutine.
This function will create a BackgroundTask and then
call self.add_subtask() on it.
Args:
cor (coroutine): The coroutine that should be wrapped
in a back... | python | def create_subtask(self, cor, name=None, stop_timeout=1.0):
"""Create and add a subtask from a coroutine.
This function will create a BackgroundTask and then
call self.add_subtask() on it.
Args:
cor (coroutine): The coroutine that should be wrapped
in a back... | [
"def",
"create_subtask",
"(",
"self",
",",
"cor",
",",
"name",
"=",
"None",
",",
"stop_timeout",
"=",
"1.0",
")",
":",
"if",
"self",
".",
"stopped",
":",
"raise",
"InternalError",
"(",
"\"Cannot add a subtask to a parent that is already stopped\"",
")",
"subtask",... | Create and add a subtask from a coroutine.
This function will create a BackgroundTask and then
call self.add_subtask() on it.
Args:
cor (coroutine): The coroutine that should be wrapped
in a background task.
name (str): An optional name for the task.
... | [
"Create",
"and",
"add",
"a",
"subtask",
"from",
"a",
"coroutine",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/utilities/async_tools/event_loop.py#L113-L135 | train |
iotile/coretools | iotilecore/iotile/core/utilities/async_tools/event_loop.py | BackgroundTask.add_subtask | def add_subtask(self, subtask):
"""Link a subtask to this parent task.
This will cause stop() to block until the subtask has also
finished. Calling stop will not directly cancel the subtask.
It is expected that your finalizer for this parent task will
cancel or otherwise stop t... | python | def add_subtask(self, subtask):
"""Link a subtask to this parent task.
This will cause stop() to block until the subtask has also
finished. Calling stop will not directly cancel the subtask.
It is expected that your finalizer for this parent task will
cancel or otherwise stop t... | [
"def",
"add_subtask",
"(",
"self",
",",
"subtask",
")",
":",
"if",
"self",
".",
"stopped",
":",
"raise",
"InternalError",
"(",
"\"Cannot add a subtask to a parent that is already stopped\"",
")",
"if",
"not",
"isinstance",
"(",
"subtask",
",",
"BackgroundTask",
")",... | Link a subtask to this parent task.
This will cause stop() to block until the subtask has also
finished. Calling stop will not directly cancel the subtask.
It is expected that your finalizer for this parent task will
cancel or otherwise stop the subtask.
Args:
subt... | [
"Link",
"a",
"subtask",
"to",
"this",
"parent",
"task",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/utilities/async_tools/event_loop.py#L137-L161 | train |
iotile/coretools | iotilecore/iotile/core/utilities/async_tools/event_loop.py | BackgroundTask.stop | async def stop(self):
"""Stop this task and wait until it and all its subtasks end.
This function will finalize this task either by using the finalizer
function passed during creation or by calling task.cancel() if no
finalizer was passed.
It will then call join() on this task ... | python | async def stop(self):
"""Stop this task and wait until it and all its subtasks end.
This function will finalize this task either by using the finalizer
function passed during creation or by calling task.cancel() if no
finalizer was passed.
It will then call join() on this task ... | [
"async",
"def",
"stop",
"(",
"self",
")",
":",
"if",
"self",
".",
"stopped",
":",
"return",
"self",
".",
"_logger",
".",
"debug",
"(",
"\"Stopping task %s\"",
",",
"self",
".",
"name",
")",
"if",
"self",
".",
"_finalizer",
"is",
"not",
"None",
":",
"... | Stop this task and wait until it and all its subtasks end.
This function will finalize this task either by using the finalizer
function passed during creation or by calling task.cancel() if no
finalizer was passed.
It will then call join() on this task and any registered subtasks
... | [
"Stop",
"this",
"task",
"and",
"wait",
"until",
"it",
"and",
"all",
"its",
"subtasks",
"end",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/utilities/async_tools/event_loop.py#L163-L227 | train |
iotile/coretools | iotilecore/iotile/core/utilities/async_tools/event_loop.py | BackgroundTask.stop_threadsafe | def stop_threadsafe(self):
"""Stop this task from another thread and wait for it to finish.
This method must not be called from within the BackgroundEventLoop but
will inject self.stop() into the event loop and block until it
returns.
Raises:
TimeoutExpiredError: If... | python | def stop_threadsafe(self):
"""Stop this task from another thread and wait for it to finish.
This method must not be called from within the BackgroundEventLoop but
will inject self.stop() into the event loop and block until it
returns.
Raises:
TimeoutExpiredError: If... | [
"def",
"stop_threadsafe",
"(",
"self",
")",
":",
"if",
"self",
".",
"stopped",
":",
"return",
"try",
":",
"self",
".",
"_loop",
".",
"run_coroutine",
"(",
"self",
".",
"stop",
"(",
")",
")",
"except",
"asyncio",
".",
"TimeoutError",
":",
"raise",
"Time... | Stop this task from another thread and wait for it to finish.
This method must not be called from within the BackgroundEventLoop but
will inject self.stop() into the event loop and block until it
returns.
Raises:
TimeoutExpiredError: If the task does not stop in the given
... | [
"Stop",
"this",
"task",
"from",
"another",
"thread",
"and",
"wait",
"for",
"it",
"to",
"finish",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/utilities/async_tools/event_loop.py#L229-L247 | train |
iotile/coretools | iotilecore/iotile/core/utilities/async_tools/event_loop.py | BackgroundEventLoop.start | def start(self, aug='EventLoopThread'):
"""Ensure the background loop is running.
This method is safe to call multiple times. If the loop is already
running, it will not do anything.
"""
if self.stopping:
raise LoopStoppingError("Cannot perform action while loop is... | python | def start(self, aug='EventLoopThread'):
"""Ensure the background loop is running.
This method is safe to call multiple times. If the loop is already
running, it will not do anything.
"""
if self.stopping:
raise LoopStoppingError("Cannot perform action while loop is... | [
"def",
"start",
"(",
"self",
",",
"aug",
"=",
"'EventLoopThread'",
")",
":",
"if",
"self",
".",
"stopping",
":",
"raise",
"LoopStoppingError",
"(",
"\"Cannot perform action while loop is stopping.\"",
")",
"if",
"not",
"self",
".",
"loop",
":",
"self",
".",
"_... | Ensure the background loop is running.
This method is safe to call multiple times. If the loop is already
running, it will not do anything. | [
"Ensure",
"the",
"background",
"loop",
"is",
"running",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/utilities/async_tools/event_loop.py#L281-L295 | train |
iotile/coretools | iotilecore/iotile/core/utilities/async_tools/event_loop.py | BackgroundEventLoop.wait_for_interrupt | def wait_for_interrupt(self, check_interval=1.0, max_time=None):
"""Run the event loop until we receive a ctrl-c interrupt or max_time passes.
This method will wake up every 1 second by default to check for any
interrupt signals or if the maximum runtime has expired. This can be
set lo... | python | def wait_for_interrupt(self, check_interval=1.0, max_time=None):
"""Run the event loop until we receive a ctrl-c interrupt or max_time passes.
This method will wake up every 1 second by default to check for any
interrupt signals or if the maximum runtime has expired. This can be
set lo... | [
"def",
"wait_for_interrupt",
"(",
"self",
",",
"check_interval",
"=",
"1.0",
",",
"max_time",
"=",
"None",
")",
":",
"self",
".",
"start",
"(",
")",
"wait",
"=",
"max",
"(",
"check_interval",
",",
"0.01",
")",
"accum",
"=",
"0",
"try",
":",
"while",
... | Run the event loop until we receive a ctrl-c interrupt or max_time passes.
This method will wake up every 1 second by default to check for any
interrupt signals or if the maximum runtime has expired. This can be
set lower for testing purpose to reduce latency but in production
settings... | [
"Run",
"the",
"event",
"loop",
"until",
"we",
"receive",
"a",
"ctrl",
"-",
"c",
"interrupt",
"or",
"max_time",
"passes",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/utilities/async_tools/event_loop.py#L297-L329 | train |
iotile/coretools | iotilecore/iotile/core/utilities/async_tools/event_loop.py | BackgroundEventLoop.stop | def stop(self):
"""Synchronously stop the background loop from outside.
This method will block until the background loop is completely stopped
so it cannot be called from inside the loop itself.
This method is safe to call multiple times. If the loop is not
currently running i... | python | def stop(self):
"""Synchronously stop the background loop from outside.
This method will block until the background loop is completely stopped
so it cannot be called from inside the loop itself.
This method is safe to call multiple times. If the loop is not
currently running i... | [
"def",
"stop",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"loop",
":",
"return",
"if",
"self",
".",
"inside_loop",
"(",
")",
":",
"raise",
"InternalError",
"(",
"\"BackgroundEventLoop.stop() called from inside event loop; \"",
"\"would have deadlocked.\"",
")"... | Synchronously stop the background loop from outside.
This method will block until the background loop is completely stopped
so it cannot be called from inside the loop itself.
This method is safe to call multiple times. If the loop is not
currently running it will return without doing... | [
"Synchronously",
"stop",
"the",
"background",
"loop",
"from",
"outside",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/utilities/async_tools/event_loop.py#L331-L357 | train |
iotile/coretools | iotilecore/iotile/core/utilities/async_tools/event_loop.py | BackgroundEventLoop._stop_internal | async def _stop_internal(self):
"""Cleanly stop the event loop after shutting down all tasks."""
# Make sure we only try to stop once
if self.stopping is True:
return
self.stopping = True
awaitables = [task.stop() for task in self.tasks]
results = await asy... | python | async def _stop_internal(self):
"""Cleanly stop the event loop after shutting down all tasks."""
# Make sure we only try to stop once
if self.stopping is True:
return
self.stopping = True
awaitables = [task.stop() for task in self.tasks]
results = await asy... | [
"async",
"def",
"_stop_internal",
"(",
"self",
")",
":",
"if",
"self",
".",
"stopping",
"is",
"True",
":",
"return",
"self",
".",
"stopping",
"=",
"True",
"awaitables",
"=",
"[",
"task",
".",
"stop",
"(",
")",
"for",
"task",
"in",
"self",
".",
"tasks... | Cleanly stop the event loop after shutting down all tasks. | [
"Cleanly",
"stop",
"the",
"event",
"loop",
"after",
"shutting",
"down",
"all",
"tasks",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/utilities/async_tools/event_loop.py#L388-L406 | train |
iotile/coretools | iotilecore/iotile/core/utilities/async_tools/event_loop.py | BackgroundEventLoop._loop_thread_main | def _loop_thread_main(self):
"""Main background thread running the event loop."""
asyncio.set_event_loop(self.loop)
self._loop_check.inside_loop = True
try:
self._logger.debug("Starting loop in background thread")
self.loop.run_forever()
self._logger... | python | def _loop_thread_main(self):
"""Main background thread running the event loop."""
asyncio.set_event_loop(self.loop)
self._loop_check.inside_loop = True
try:
self._logger.debug("Starting loop in background thread")
self.loop.run_forever()
self._logger... | [
"def",
"_loop_thread_main",
"(",
"self",
")",
":",
"asyncio",
".",
"set_event_loop",
"(",
"self",
".",
"loop",
")",
"self",
".",
"_loop_check",
".",
"inside_loop",
"=",
"True",
"try",
":",
"self",
".",
"_logger",
".",
"debug",
"(",
"\"Starting loop in backgr... | Main background thread running the event loop. | [
"Main",
"background",
"thread",
"running",
"the",
"event",
"loop",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/utilities/async_tools/event_loop.py#L408-L421 | train |
iotile/coretools | iotilecore/iotile/core/utilities/async_tools/event_loop.py | BackgroundEventLoop.add_task | def add_task(self, cor, name=None, finalizer=None, stop_timeout=1.0, parent=None):
"""Schedule a task to run on the background event loop.
This method will start the given coroutine as a task and keep track
of it so that it can be properly shutdown which the event loop is
stopped.
... | python | def add_task(self, cor, name=None, finalizer=None, stop_timeout=1.0, parent=None):
"""Schedule a task to run on the background event loop.
This method will start the given coroutine as a task and keep track
of it so that it can be properly shutdown which the event loop is
stopped.
... | [
"def",
"add_task",
"(",
"self",
",",
"cor",
",",
"name",
"=",
"None",
",",
"finalizer",
"=",
"None",
",",
"stop_timeout",
"=",
"1.0",
",",
"parent",
"=",
"None",
")",
":",
"if",
"self",
".",
"stopping",
":",
"raise",
"LoopStoppingError",
"(",
"\"Cannot... | Schedule a task to run on the background event loop.
This method will start the given coroutine as a task and keep track
of it so that it can be properly shutdown which the event loop is
stopped.
If parent is None, the task will be stopped by calling finalizer()
inside the eve... | [
"Schedule",
"a",
"task",
"to",
"run",
"on",
"the",
"background",
"event",
"loop",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/utilities/async_tools/event_loop.py#L424-L487 | train |
iotile/coretools | iotilecore/iotile/core/utilities/async_tools/event_loop.py | BackgroundEventLoop.run_coroutine | def run_coroutine(self, cor, *args, **kwargs):
"""Run a coroutine to completion and return its result.
This method may only be called outside of the event loop.
Attempting to call it from inside the event loop would deadlock
and will raise InternalError instead.
Args:
... | python | def run_coroutine(self, cor, *args, **kwargs):
"""Run a coroutine to completion and return its result.
This method may only be called outside of the event loop.
Attempting to call it from inside the event loop would deadlock
and will raise InternalError instead.
Args:
... | [
"def",
"run_coroutine",
"(",
"self",
",",
"cor",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"if",
"self",
".",
"stopping",
":",
"raise",
"LoopStoppingError",
"(",
"\"Could not launch coroutine because loop is shutting down: %s\"",
"%",
"cor",
")",
"self",
... | Run a coroutine to completion and return its result.
This method may only be called outside of the event loop.
Attempting to call it from inside the event loop would deadlock
and will raise InternalError instead.
Args:
cor (coroutine): The coroutine that we wish to run in t... | [
"Run",
"a",
"coroutine",
"to",
"completion",
"and",
"return",
"its",
"result",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/utilities/async_tools/event_loop.py#L489-L516 | train |
iotile/coretools | iotilecore/iotile/core/utilities/async_tools/event_loop.py | BackgroundEventLoop.log_coroutine | def log_coroutine(self, cor, *args, **kwargs):
"""Run a coroutine logging any exception raised.
This routine will not block until the coroutine is finished
nor will it return any result. It will just log if any
exception is raised by the coroutine during operation.
It is safe ... | python | def log_coroutine(self, cor, *args, **kwargs):
"""Run a coroutine logging any exception raised.
This routine will not block until the coroutine is finished
nor will it return any result. It will just log if any
exception is raised by the coroutine during operation.
It is safe ... | [
"def",
"log_coroutine",
"(",
"self",
",",
"cor",
",",
"*",
"args",
",",
"**",
"kwargs",
")",
":",
"if",
"self",
".",
"stopping",
":",
"raise",
"LoopStoppingError",
"(",
"\"Could not launch coroutine because loop is shutting down: %s\"",
"%",
"cor",
")",
"self",
... | Run a coroutine logging any exception raised.
This routine will not block until the coroutine is finished
nor will it return any result. It will just log if any
exception is raised by the coroutine during operation.
It is safe to call from both inside and outside the event loop.
... | [
"Run",
"a",
"coroutine",
"logging",
"any",
"exception",
"raised",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/utilities/async_tools/event_loop.py#L552-L582 | train |
iotile/coretools | iotile_ext_cloud/iotile/cloud/config.py | link_cloud | def link_cloud(self, username=None, password=None, device_id=None):
"""Create and store a token for interacting with the IOTile Cloud API.
You will need to call link_cloud once for each virtualenv that
you create and want to use with any api calls that touch iotile cloud.
Note that this method is call... | python | def link_cloud(self, username=None, password=None, device_id=None):
"""Create and store a token for interacting with the IOTile Cloud API.
You will need to call link_cloud once for each virtualenv that
you create and want to use with any api calls that touch iotile cloud.
Note that this method is call... | [
"def",
"link_cloud",
"(",
"self",
",",
"username",
"=",
"None",
",",
"password",
"=",
"None",
",",
"device_id",
"=",
"None",
")",
":",
"reg",
"=",
"ComponentRegistry",
"(",
")",
"domain",
"=",
"self",
".",
"get",
"(",
"'cloud:server'",
")",
"if",
"user... | Create and store a token for interacting with the IOTile Cloud API.
You will need to call link_cloud once for each virtualenv that
you create and want to use with any api calls that touch iotile cloud.
Note that this method is called on a ConfigManager instance
If you do not pass your username or pas... | [
"Create",
"and",
"store",
"a",
"token",
"for",
"interacting",
"with",
"the",
"IOTile",
"Cloud",
"API",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotile_ext_cloud/iotile/cloud/config.py#L14-L65 | train |
iotile/coretools | iotilecore/iotile/core/utilities/kvstore_json.py | JSONKVStore._load_file | def _load_file(self):
"""Load all entries from json backing file
"""
if not os.path.exists(self.file):
return {}
with open(self.file, "r") as infile:
data = json.load(infile)
return data | python | def _load_file(self):
"""Load all entries from json backing file
"""
if not os.path.exists(self.file):
return {}
with open(self.file, "r") as infile:
data = json.load(infile)
return data | [
"def",
"_load_file",
"(",
"self",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"self",
".",
"file",
")",
":",
"return",
"{",
"}",
"with",
"open",
"(",
"self",
".",
"file",
",",
"\"r\"",
")",
"as",
"infile",
":",
"data",
"=",
"j... | Load all entries from json backing file | [
"Load",
"all",
"entries",
"from",
"json",
"backing",
"file"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/utilities/kvstore_json.py#L48-L58 | train |
iotile/coretools | iotilecore/iotile/core/utilities/kvstore_json.py | JSONKVStore._save_file | def _save_file(self, data):
"""Attempt to atomically save file by saving and then moving into position
The goal is to make it difficult for a crash to corrupt our data file since
the move operation can be made atomic if needed on mission critical filesystems.
"""
if platform.sy... | python | def _save_file(self, data):
"""Attempt to atomically save file by saving and then moving into position
The goal is to make it difficult for a crash to corrupt our data file since
the move operation can be made atomic if needed on mission critical filesystems.
"""
if platform.sy... | [
"def",
"_save_file",
"(",
"self",
",",
"data",
")",
":",
"if",
"platform",
".",
"system",
"(",
")",
"==",
"'Windows'",
":",
"with",
"open",
"(",
"self",
".",
"file",
",",
"\"w\"",
")",
"as",
"outfile",
":",
"json",
".",
"dump",
"(",
"data",
",",
... | Attempt to atomically save file by saving and then moving into position
The goal is to make it difficult for a crash to corrupt our data file since
the move operation can be made atomic if needed on mission critical filesystems. | [
"Attempt",
"to",
"atomically",
"save",
"file",
"by",
"saving",
"and",
"then",
"moving",
"into",
"position"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/utilities/kvstore_json.py#L60-L79 | train |
iotile/coretools | iotilecore/iotile/core/utilities/kvstore_json.py | JSONKVStore.remove | def remove(self, key):
"""Remove a key from the data store
Args:
key (string): The key to remove
Raises:
KeyError: if the key was not found
"""
data = self._load_file()
del data[key]
self._save_file(data) | python | def remove(self, key):
"""Remove a key from the data store
Args:
key (string): The key to remove
Raises:
KeyError: if the key was not found
"""
data = self._load_file()
del data[key]
self._save_file(data) | [
"def",
"remove",
"(",
"self",
",",
"key",
")",
":",
"data",
"=",
"self",
".",
"_load_file",
"(",
")",
"del",
"data",
"[",
"key",
"]",
"self",
".",
"_save_file",
"(",
"data",
")"
] | Remove a key from the data store
Args:
key (string): The key to remove
Raises:
KeyError: if the key was not found | [
"Remove",
"a",
"key",
"from",
"the",
"data",
"store"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/utilities/kvstore_json.py#L107-L119 | train |
iotile/coretools | iotilecore/iotile/core/utilities/kvstore_json.py | JSONKVStore.set | def set(self, key, value):
"""Set the value of a key
Args:
key (string): The key used to store this value
value (string): The value to store
"""
data = self._load_file()
data[key] = value
self._save_file(data) | python | def set(self, key, value):
"""Set the value of a key
Args:
key (string): The key used to store this value
value (string): The value to store
"""
data = self._load_file()
data[key] = value
self._save_file(data) | [
"def",
"set",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"data",
"=",
"self",
".",
"_load_file",
"(",
")",
"data",
"[",
"key",
"]",
"=",
"value",
"self",
".",
"_save_file",
"(",
"data",
")"
] | Set the value of a key
Args:
key (string): The key used to store this value
value (string): The value to store | [
"Set",
"the",
"value",
"of",
"a",
"key"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/utilities/kvstore_json.py#L134-L144 | train |
iotile/coretools | iotilesensorgraph/iotile/sg/parser/scopes/trigger_scope.py | TriggerScope.trigger_chain | def trigger_chain(self):
"""Return a NodeInput tuple for creating a node.
Returns:
(StreamIdentifier, InputTrigger)
"""
trigger_stream = self.allocator.attach_stream(self.trigger_stream)
return (trigger_stream, self.trigger_cond) | python | def trigger_chain(self):
"""Return a NodeInput tuple for creating a node.
Returns:
(StreamIdentifier, InputTrigger)
"""
trigger_stream = self.allocator.attach_stream(self.trigger_stream)
return (trigger_stream, self.trigger_cond) | [
"def",
"trigger_chain",
"(",
"self",
")",
":",
"trigger_stream",
"=",
"self",
".",
"allocator",
".",
"attach_stream",
"(",
"self",
".",
"trigger_stream",
")",
"return",
"(",
"trigger_stream",
",",
"self",
".",
"trigger_cond",
")"
] | Return a NodeInput tuple for creating a node.
Returns:
(StreamIdentifier, InputTrigger) | [
"Return",
"a",
"NodeInput",
"tuple",
"for",
"creating",
"a",
"node",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/parser/scopes/trigger_scope.py#L36-L44 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/cc.py | generate | def generate(env):
"""
Add Builders and construction variables for C compilers to an Environment.
"""
static_obj, shared_obj = SCons.Tool.createObjBuilders(env)
for suffix in CSuffixes:
static_obj.add_action(suffix, SCons.Defaults.CAction)
shared_obj.add_action(suffix, SCons.Default... | python | def generate(env):
"""
Add Builders and construction variables for C compilers to an Environment.
"""
static_obj, shared_obj = SCons.Tool.createObjBuilders(env)
for suffix in CSuffixes:
static_obj.add_action(suffix, SCons.Defaults.CAction)
shared_obj.add_action(suffix, SCons.Default... | [
"def",
"generate",
"(",
"env",
")",
":",
"static_obj",
",",
"shared_obj",
"=",
"SCons",
".",
"Tool",
".",
"createObjBuilders",
"(",
"env",
")",
"for",
"suffix",
"in",
"CSuffixes",
":",
"static_obj",
".",
"add_action",
"(",
"suffix",
",",
"SCons",
".",
"D... | Add Builders and construction variables for C compilers to an Environment. | [
"Add",
"Builders",
"and",
"construction",
"variables",
"for",
"C",
"compilers",
"to",
"an",
"Environment",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/cc.py#L67-L96 | train |
iotile/coretools | iotilesensorgraph/iotile/sg/scripts/iotile_sgrun.py | process_mock_rpc | def process_mock_rpc(input_string):
"""Process a mock RPC argument.
Args:
input_string (str): The input string that should be in the format
<slot id>:<rpc id> = value
"""
spec, equals, value = input_string.partition(u'=')
if len(equals) == 0:
print("Could not parse moc... | python | def process_mock_rpc(input_string):
"""Process a mock RPC argument.
Args:
input_string (str): The input string that should be in the format
<slot id>:<rpc id> = value
"""
spec, equals, value = input_string.partition(u'=')
if len(equals) == 0:
print("Could not parse moc... | [
"def",
"process_mock_rpc",
"(",
"input_string",
")",
":",
"spec",
",",
"equals",
",",
"value",
"=",
"input_string",
".",
"partition",
"(",
"u'='",
")",
"if",
"len",
"(",
"equals",
")",
"==",
"0",
":",
"print",
"(",
"\"Could not parse mock RPC argument: {}\"",
... | Process a mock RPC argument.
Args:
input_string (str): The input string that should be in the format
<slot id>:<rpc id> = value | [
"Process",
"a",
"mock",
"RPC",
"argument",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/scripts/iotile_sgrun.py#L77-L114 | train |
iotile/coretools | iotilesensorgraph/iotile/sg/scripts/iotile_sgrun.py | watch_printer | def watch_printer(watch, value):
"""Print a watched value.
Args:
watch (DataStream): The stream that was watched
value (IOTileReading): The value to was seen
"""
print("({: 8} s) {}: {}".format(value.raw_time, watch, value.value)) | python | def watch_printer(watch, value):
"""Print a watched value.
Args:
watch (DataStream): The stream that was watched
value (IOTileReading): The value to was seen
"""
print("({: 8} s) {}: {}".format(value.raw_time, watch, value.value)) | [
"def",
"watch_printer",
"(",
"watch",
",",
"value",
")",
":",
"print",
"(",
"\"({: 8} s) {}: {}\"",
".",
"format",
"(",
"value",
".",
"raw_time",
",",
"watch",
",",
"value",
".",
"value",
")",
")"
] | Print a watched value.
Args:
watch (DataStream): The stream that was watched
value (IOTileReading): The value to was seen | [
"Print",
"a",
"watched",
"value",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/scripts/iotile_sgrun.py#L116-L124 | train |
iotile/coretools | iotilesensorgraph/iotile/sg/scripts/iotile_sgrun.py | main | def main(argv=None):
"""Main entry point for iotile sensorgraph simulator.
This is the iotile-sgrun command line program. It takes
an optional set of command line parameters to allow for
testing.
Args:
argv (list of str): An optional set of command line
parameters. If not pas... | python | def main(argv=None):
"""Main entry point for iotile sensorgraph simulator.
This is the iotile-sgrun command line program. It takes
an optional set of command line parameters to allow for
testing.
Args:
argv (list of str): An optional set of command line
parameters. If not pas... | [
"def",
"main",
"(",
"argv",
"=",
"None",
")",
":",
"if",
"argv",
"is",
"None",
":",
"argv",
"=",
"sys",
".",
"argv",
"[",
"1",
":",
"]",
"try",
":",
"executor",
"=",
"None",
"parser",
"=",
"build_args",
"(",
")",
"args",
"=",
"parser",
".",
"pa... | Main entry point for iotile sensorgraph simulator.
This is the iotile-sgrun command line program. It takes
an optional set of command line parameters to allow for
testing.
Args:
argv (list of str): An optional set of command line
parameters. If not passed, these are taken from
... | [
"Main",
"entry",
"point",
"for",
"iotile",
"sensorgraph",
"simulator",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/scripts/iotile_sgrun.py#L127-L199 | train |
iotile/coretools | iotileship/iotile/ship/actions/verify_device_step.py | VerifyDeviceStep._verify_tile_versions | def _verify_tile_versions(self, hw):
"""Verify that the tiles have the correct versions
"""
for tile, expected_tile_version in self._tile_versions.items():
actual_tile_version = str(hw.get(tile).tile_version())
if expected_tile_version != actual_tile_version:
... | python | def _verify_tile_versions(self, hw):
"""Verify that the tiles have the correct versions
"""
for tile, expected_tile_version in self._tile_versions.items():
actual_tile_version = str(hw.get(tile).tile_version())
if expected_tile_version != actual_tile_version:
... | [
"def",
"_verify_tile_versions",
"(",
"self",
",",
"hw",
")",
":",
"for",
"tile",
",",
"expected_tile_version",
"in",
"self",
".",
"_tile_versions",
".",
"items",
"(",
")",
":",
"actual_tile_version",
"=",
"str",
"(",
"hw",
".",
"get",
"(",
"tile",
")",
"... | Verify that the tiles have the correct versions | [
"Verify",
"that",
"the",
"tiles",
"have",
"the",
"correct",
"versions"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileship/iotile/ship/actions/verify_device_step.py#L33-L40 | train |
iotile/coretools | iotileship/iotile/ship/actions/verify_device_step.py | VerifyDeviceStep._verify_realtime_streams | def _verify_realtime_streams(self, hw):
"""Check that the realtime streams are being produced
"""
print("--> Testing realtime data (takes 2 seconds)")
time.sleep(2.1)
reports = [x for x in hw.iter_reports()]
reports_seen = {key: 0 for key in self._realtime_streams}
... | python | def _verify_realtime_streams(self, hw):
"""Check that the realtime streams are being produced
"""
print("--> Testing realtime data (takes 2 seconds)")
time.sleep(2.1)
reports = [x for x in hw.iter_reports()]
reports_seen = {key: 0 for key in self._realtime_streams}
... | [
"def",
"_verify_realtime_streams",
"(",
"self",
",",
"hw",
")",
":",
"print",
"(",
"\"",
")",
"time",
".",
"sleep",
"(",
"2.1",
")",
"reports",
"=",
"[",
"x",
"for",
"x",
"in",
"hw",
".",
"iter_reports",
"(",
")",
"]",
"reports_seen",
"=",
"{",
"ke... | Check that the realtime streams are being produced | [
"Check",
"that",
"the",
"realtime",
"streams",
"are",
"being",
"produced"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileship/iotile/ship/actions/verify_device_step.py#L64-L80 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/xgettext.py | _update_pot_file | def _update_pot_file(target, source, env):
""" Action function for `POTUpdate` builder """
import re
import os
import SCons.Action
nop = lambda target, source, env: 0
# Save scons cwd and os cwd (NOTE: they may be different. After the job, we
# revert each one to its original state).
sa... | python | def _update_pot_file(target, source, env):
""" Action function for `POTUpdate` builder """
import re
import os
import SCons.Action
nop = lambda target, source, env: 0
# Save scons cwd and os cwd (NOTE: they may be different. After the job, we
# revert each one to its original state).
sa... | [
"def",
"_update_pot_file",
"(",
"target",
",",
"source",
",",
"env",
")",
":",
"import",
"re",
"import",
"os",
"import",
"SCons",
".",
"Action",
"nop",
"=",
"lambda",
"target",
",",
"source",
",",
"env",
":",
"0",
"save_cwd",
"=",
"env",
".",
"fs",
"... | Action function for `POTUpdate` builder | [
"Action",
"function",
"for",
"POTUpdate",
"builder"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/xgettext.py#L75-L151 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/xgettext.py | _scan_xgettext_from_files | def _scan_xgettext_from_files(target, source, env, files=None, path=None):
""" Parses `POTFILES.in`-like file and returns list of extracted file names.
"""
import re
import SCons.Util
import SCons.Node.FS
if files is None:
return 0
if not SCons.Util.is_List(files):
files = [... | python | def _scan_xgettext_from_files(target, source, env, files=None, path=None):
""" Parses `POTFILES.in`-like file and returns list of extracted file names.
"""
import re
import SCons.Util
import SCons.Node.FS
if files is None:
return 0
if not SCons.Util.is_List(files):
files = [... | [
"def",
"_scan_xgettext_from_files",
"(",
"target",
",",
"source",
",",
"env",
",",
"files",
"=",
"None",
",",
"path",
"=",
"None",
")",
":",
"import",
"re",
"import",
"SCons",
".",
"Util",
"import",
"SCons",
".",
"Node",
".",
"FS",
"if",
"files",
"is",... | Parses `POTFILES.in`-like file and returns list of extracted file names. | [
"Parses",
"POTFILES",
".",
"in",
"-",
"like",
"file",
"and",
"returns",
"list",
"of",
"extracted",
"file",
"names",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/xgettext.py#L175-L225 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/xgettext.py | _pot_update_emitter | def _pot_update_emitter(target, source, env):
""" Emitter function for `POTUpdate` builder """
from SCons.Tool.GettextCommon import _POTargetFactory
import SCons.Util
import SCons.Node.FS
if 'XGETTEXTFROM' in env:
xfrom = env['XGETTEXTFROM']
else:
return target, source
if no... | python | def _pot_update_emitter(target, source, env):
""" Emitter function for `POTUpdate` builder """
from SCons.Tool.GettextCommon import _POTargetFactory
import SCons.Util
import SCons.Node.FS
if 'XGETTEXTFROM' in env:
xfrom = env['XGETTEXTFROM']
else:
return target, source
if no... | [
"def",
"_pot_update_emitter",
"(",
"target",
",",
"source",
",",
"env",
")",
":",
"from",
"SCons",
".",
"Tool",
".",
"GettextCommon",
"import",
"_POTargetFactory",
"import",
"SCons",
".",
"Util",
"import",
"SCons",
".",
"Node",
".",
"FS",
"if",
"'XGETTEXTFRO... | Emitter function for `POTUpdate` builder | [
"Emitter",
"function",
"for",
"POTUpdate",
"builder"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/xgettext.py#L231-L258 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/xgettext.py | _POTUpdateBuilder | def _POTUpdateBuilder(env, **kw):
""" Creates `POTUpdate` builder object """
import SCons.Action
from SCons.Tool.GettextCommon import _POTargetFactory
kw['action'] = SCons.Action.Action(_update_pot_file, None)
kw['suffix'] = '$POTSUFFIX'
kw['target_factory'] = _POTargetFactory(env, alias='$POTUP... | python | def _POTUpdateBuilder(env, **kw):
""" Creates `POTUpdate` builder object """
import SCons.Action
from SCons.Tool.GettextCommon import _POTargetFactory
kw['action'] = SCons.Action.Action(_update_pot_file, None)
kw['suffix'] = '$POTSUFFIX'
kw['target_factory'] = _POTargetFactory(env, alias='$POTUP... | [
"def",
"_POTUpdateBuilder",
"(",
"env",
",",
"**",
"kw",
")",
":",
"import",
"SCons",
".",
"Action",
"from",
"SCons",
".",
"Tool",
".",
"GettextCommon",
"import",
"_POTargetFactory",
"kw",
"[",
"'action'",
"]",
"=",
"SCons",
".",
"Action",
".",
"Action",
... | Creates `POTUpdate` builder object | [
"Creates",
"POTUpdate",
"builder",
"object"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/xgettext.py#L275-L283 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/xgettext.py | generate | def generate(env, **kw):
""" Generate `xgettext` tool """
import SCons.Util
from SCons.Tool.GettextCommon import RPaths, _detect_xgettext
try:
env['XGETTEXT'] = _detect_xgettext(env)
except:
env['XGETTEXT'] = 'xgettext'
# NOTE: sources="$SOURCES" would work as well. However, we ... | python | def generate(env, **kw):
""" Generate `xgettext` tool """
import SCons.Util
from SCons.Tool.GettextCommon import RPaths, _detect_xgettext
try:
env['XGETTEXT'] = _detect_xgettext(env)
except:
env['XGETTEXT'] = 'xgettext'
# NOTE: sources="$SOURCES" would work as well. However, we ... | [
"def",
"generate",
"(",
"env",
",",
"**",
"kw",
")",
":",
"import",
"SCons",
".",
"Util",
"from",
"SCons",
".",
"Tool",
".",
"GettextCommon",
"import",
"RPaths",
",",
"_detect_xgettext",
"try",
":",
"env",
"[",
"'XGETTEXT'",
"]",
"=",
"_detect_xgettext",
... | Generate `xgettext` tool | [
"Generate",
"xgettext",
"tool"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/xgettext.py#L289-L342 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/gcc.py | generate | def generate(env):
"""Add Builders and construction variables for gcc to an Environment."""
if 'CC' not in env:
env['CC'] = env.Detect(compilers) or compilers[0]
cc.generate(env)
if env['PLATFORM'] in ['cygwin', 'win32']:
env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS')
else:
... | python | def generate(env):
"""Add Builders and construction variables for gcc to an Environment."""
if 'CC' not in env:
env['CC'] = env.Detect(compilers) or compilers[0]
cc.generate(env)
if env['PLATFORM'] in ['cygwin', 'win32']:
env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS')
else:
... | [
"def",
"generate",
"(",
"env",
")",
":",
"if",
"'CC'",
"not",
"in",
"env",
":",
"env",
"[",
"'CC'",
"]",
"=",
"env",
".",
"Detect",
"(",
"compilers",
")",
"or",
"compilers",
"[",
"0",
"]",
"cc",
".",
"generate",
"(",
"env",
")",
"if",
"env",
"[... | Add Builders and construction variables for gcc to an Environment. | [
"Add",
"Builders",
"and",
"construction",
"variables",
"for",
"gcc",
"to",
"an",
"Environment",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/gcc.py#L45-L60 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/gcc.py | detect_version | 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 | 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... | [
"def",
"detect_version",
"(",
"env",
",",
"cc",
")",
":",
"cc",
"=",
"env",
".",
"subst",
"(",
"cc",
")",
"if",
"not",
"cc",
":",
"return",
"None",
"version",
"=",
"None",
"pipe",
"=",
"SCons",
".",
"Action",
".",
"_subproc",
"(",
"env",
",",
"SC... | Return the version of the GNU compiler, or None if it is not a GNU compiler. | [
"Return",
"the",
"version",
"of",
"the",
"GNU",
"compiler",
"or",
"None",
"if",
"it",
"is",
"not",
"a",
"GNU",
"compiler",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/gcc.py#L66-L94 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/packaging/msi.py | is_dos_short_file_name | 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 | 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 | [
"def",
"is_dos_short_file_name",
"(",
"file",
")",
":",
"fname",
",",
"ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"file",
")",
"proper_ext",
"=",
"len",
"(",
"ext",
")",
"==",
"0",
"or",
"(",
"2",
"<=",
"len",
"(",
"ext",
")",
"<=",
"4",... | Examine if the given file is in the 8.3 form. | [
"Examine",
"if",
"the",
"given",
"file",
"is",
"in",
"the",
"8",
".",
"3",
"form",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/packaging/msi.py#L81-L88 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/packaging/msi.py | create_feature_dict | 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 | 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 ]
... | [
"def",
"create_feature_dict",
"(",
"files",
")",
":",
"dict",
"=",
"{",
"}",
"def",
"add_to_dict",
"(",
"feature",
",",
"file",
")",
":",
"if",
"not",
"SCons",
".",
"Util",
".",
"is_List",
"(",
"feature",
")",
":",
"feature",
"=",
"[",
"feature",
"]"... | X_MSI_FEATURE and doc FileTag's can be used to collect files in a
hierarchy. This function collects the files into this hierarchy. | [
"X_MSI_FEATURE",
"and",
"doc",
"FileTag",
"s",
"can",
"be",
"used",
"to",
"collect",
"files",
"in",
"a",
"hierarchy",
".",
"This",
"function",
"collects",
"the",
"files",
"into",
"this",
"hierarchy",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/packaging/msi.py#L128-L152 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/packaging/msi.py | generate_guids | 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 | 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... | [
"def",
"generate_guids",
"(",
"root",
")",
":",
"from",
"hashlib",
"import",
"md5",
"needs_id",
"=",
"{",
"'Product'",
":",
"'Id'",
",",
"'Package'",
":",
"'Id'",
",",
"'Component'",
":",
"'Guid'",
",",
"}",
"for",
"(",
"key",
",",
"value",
")",
"in",
... | 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 handle this requirement, the uuid i... | [
"generates",
"globally",
"unique",
"identifiers",
"for",
"parts",
"of",
"the",
"xml",
"which",
"need",
"them",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/packaging/msi.py#L154-L181 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/packaging/msi.py | create_default_directory_layout | 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 | 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... | [
"def",
"create_default_directory_layout",
"(",
"root",
",",
"NAME",
",",
"VERSION",
",",
"VENDOR",
",",
"filename_set",
")",
":",
"doc",
"=",
"Document",
"(",
")",
"d1",
"=",
"doc",
".",
"createElement",
"(",
"'Directory'",
")",
"d1",
".",
"attributes",
"[... | 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 directory property defined by WiX.
After that a directory with the 'VENDOR' tag is pla... | [
"Create",
"the",
"wix",
"default",
"target",
"directory",
"layout",
"and",
"return",
"the",
"innermost",
"directory",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/packaging/msi.py#L225-L265 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/packaging/msi.py | build_wxsfile_file_section | 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 | 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... | [
"def",
"build_wxsfile_file_section",
"(",
"root",
",",
"files",
",",
"NAME",
",",
"VERSION",
",",
"VENDOR",
",",
"filename_set",
",",
"id_set",
")",
":",
"root",
"=",
"create_default_directory_layout",
"(",
"root",
",",
"NAME",
",",
"VERSION",
",",
"VENDOR",
... | 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 specficied with the 'X_MSI_FEATURE' or 'DOC' FileTag. | [
"Builds",
"the",
"Component",
"sections",
"of",
"the",
"wxs",
"file",
"with",
"their",
"included",
"files",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/packaging/msi.py#L270-L357 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/packaging/msi.py | build_wxsfile_default_gui | 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 | 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 ... | [
"def",
"build_wxsfile_default_gui",
"(",
"root",
")",
":",
"factory",
"=",
"Document",
"(",
")",
"Product",
"=",
"root",
".",
"getElementsByTagName",
"(",
"'Product'",
")",
"[",
"0",
"]",
"UIRef",
"=",
"factory",
".",
"createElement",
"(",
"'UIRef'",
")",
... | This function adds a default GUI to the wxs file | [
"This",
"function",
"adds",
"a",
"default",
"GUI",
"to",
"the",
"wxs",
"file"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/packaging/msi.py#L417-L429 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/packaging/msi.py | build_license_file | 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 | 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... | [
"def",
"build_license_file",
"(",
"directory",
",",
"spec",
")",
":",
"name",
",",
"text",
"=",
"''",
",",
"''",
"try",
":",
"name",
"=",
"spec",
"[",
"'LICENSE'",
"]",
"text",
"=",
"spec",
"[",
"'X_MSI_LICENSE_TEXT'",
"]",
"except",
"KeyError",
":",
"... | Creates a License.rtf file with the content of "X_MSI_LICENSE_TEXT"
in the given directory | [
"Creates",
"a",
"License",
".",
"rtf",
"file",
"with",
"the",
"content",
"of",
"X_MSI_LICENSE_TEXT",
"in",
"the",
"given",
"directory"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/packaging/msi.py#L431-L451 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/packaging/msi.py | build_wxsfile_header_section | 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 | 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... | [
"def",
"build_wxsfile_header_section",
"(",
"root",
",",
"spec",
")",
":",
"factory",
"=",
"Document",
"(",
")",
"Product",
"=",
"factory",
".",
"createElement",
"(",
"'Product'",
")",
"Package",
"=",
"factory",
".",
"createElement",
"(",
"'Package'",
")",
"... | Adds the xml file node which define the package meta-data. | [
"Adds",
"the",
"xml",
"file",
"node",
"which",
"define",
"the",
"package",
"meta",
"-",
"data",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/packaging/msi.py#L456-L490 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/suncxx.py | generate | 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 | 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'... | [
"def",
"generate",
"(",
"env",
")",
":",
"path",
",",
"cxx",
",",
"shcxx",
",",
"version",
"=",
"get_cppc",
"(",
"env",
")",
"if",
"path",
":",
"cxx",
"=",
"os",
".",
"path",
".",
"join",
"(",
"path",
",",
"cxx",
")",
"shcxx",
"=",
"os",
".",
... | Add Builders and construction variables for SunPRO C++. | [
"Add",
"Builders",
"and",
"construction",
"variables",
"for",
"SunPRO",
"C",
"++",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/suncxx.py#L116-L130 | train |
iotile/coretools | iotilecore/iotile/core/hw/reports/flexible_dictionary.py | FlexibleDictionaryReport.FromReadings | 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 | 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... | [
"def",
"FromReadings",
"(",
"cls",
",",
"uuid",
",",
"readings",
",",
"events",
",",
"report_id",
"=",
"IOTileReading",
".",
"InvalidReadingID",
",",
"selector",
"=",
"0xFFFF",
",",
"streamer",
"=",
"0x100",
",",
"sent_timestamp",
"=",
"0",
",",
"received_ti... | Create a flexible dictionary report from a list of readings and events.
Args:
uuid (int): The uuid of the device that this report came from
readings (list of IOTileReading): A list of IOTileReading objects containing the data in the report
events (list of IOTileEvent): A lis... | [
"Create",
"a",
"flexible",
"dictionary",
"report",
"from",
"a",
"list",
"of",
"readings",
"and",
"events",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/reports/flexible_dictionary.py#L28-L80 | train |
iotile/coretools | iotilecore/iotile/core/hw/reports/flexible_dictionary.py | FlexibleDictionaryReport.decode | 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 | 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', [])]... | [
"def",
"decode",
"(",
"self",
")",
":",
"report_dict",
"=",
"msgpack",
".",
"unpackb",
"(",
"self",
".",
"raw_report",
",",
"raw",
"=",
"False",
")",
"events",
"=",
"[",
"IOTileEvent",
".",
"FromDict",
"(",
"x",
")",
"for",
"x",
"in",
"report_dict",
... | Decode this report from a msgpack encoded binary blob. | [
"Decode",
"this",
"report",
"from",
"a",
"msgpack",
"encoded",
"binary",
"blob",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/reports/flexible_dictionary.py#L82-L102 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Action.py | _callable_contents | 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 | 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... | [
"def",
"_callable_contents",
"(",
"obj",
")",
":",
"try",
":",
"return",
"_function_contents",
"(",
"obj",
".",
"__func__",
")",
"except",
"AttributeError",
":",
"try",
":",
"return",
"_function_contents",
"(",
"obj",
".",
"__call__",
".",
"__func__",
")",
"... | Return the signature contents of a callable Python object. | [
"Return",
"the",
"signature",
"contents",
"of",
"a",
"callable",
"Python",
"object",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Action.py#L150-L169 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Action.py | _object_contents | 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 | 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:
... | [
"def",
"_object_contents",
"(",
"obj",
")",
":",
"try",
":",
"return",
"_function_contents",
"(",
"obj",
".",
"__func__",
")",
"except",
"AttributeError",
":",
"try",
":",
"return",
"_function_contents",
"(",
"obj",
".",
"__call__",
".",
"__func__",
")",
"ex... | 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. | [
"Return",
"the",
"signature",
"contents",
"of",
"any",
"Python",
"object",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Action.py#L172-L210 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Action.py | _code_contents | 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 | 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. ... | [
"def",
"_code_contents",
"(",
"code",
",",
"docstring",
"=",
"None",
")",
":",
"contents",
"=",
"bytearray",
"(",
"\"{}, {}\"",
".",
"format",
"(",
"code",
".",
"co_argcount",
",",
"len",
"(",
"code",
".",
"co_varnames",
")",
")",
",",
"'utf-8'",
")",
... | 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. Boo!
So we remove the line number byte codes... | [
"Return",
"the",
"signature",
"contents",
"of",
"a",
"code",
"object",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Action.py#L213-L281 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Action.py | _object_instance_content | 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 | 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.
"""
... | [
"def",
"_object_instance_content",
"(",
"obj",
")",
":",
"retval",
"=",
"bytearray",
"(",
")",
"if",
"obj",
"is",
"None",
":",
"return",
"b'N.'",
"if",
"isinstance",
"(",
"obj",
",",
"SCons",
".",
"Util",
".",
"BaseStringTypes",
")",
":",
"return",
"SCon... | 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. | [
"Returns",
"consistant",
"content",
"for",
"a",
"action",
"class",
"or",
"an",
"instance",
"thereof"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Action.py#L332-L382 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Action.py | _do_create_keywords | 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 | 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']... | [
"def",
"_do_create_keywords",
"(",
"args",
",",
"kw",
")",
":",
"v",
"=",
"kw",
".",
"get",
"(",
"'varlist'",
",",
"(",
")",
")",
"if",
"is_String",
"(",
"v",
")",
":",
"v",
"=",
"(",
"v",
",",
")",
"kw",
"[",
"'varlist'",
"]",
"=",
"tuple",
... | This converts any arguments after the action argument into
their equivalent keywords and adds them to the kw argument. | [
"This",
"converts",
"any",
"arguments",
"after",
"the",
"action",
"argument",
"into",
"their",
"equivalent",
"keywords",
"and",
"adds",
"them",
"to",
"the",
"kw",
"argument",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Action.py#L413-L438 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Action.py | _do_create_list_action | 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 | 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... | [
"def",
"_do_create_list_action",
"(",
"act",
",",
"kw",
")",
":",
"acts",
"=",
"[",
"]",
"for",
"a",
"in",
"act",
":",
"aa",
"=",
"_do_create_action",
"(",
"a",
",",
"kw",
")",
"if",
"aa",
"is",
"not",
"None",
":",
"acts",
".",
"append",
"(",
"aa... | A factory for list actions. Convert the input list into Actions
and then wrap them in a ListAction. | [
"A",
"factory",
"for",
"list",
"actions",
".",
"Convert",
"the",
"input",
"list",
"into",
"Actions",
"and",
"then",
"wrap",
"them",
"in",
"a",
"ListAction",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Action.py#L494-L506 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Action.py | Action | 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 | 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) | [
"def",
"Action",
"(",
"act",
",",
"*",
"args",
",",
"**",
"kw",
")",
":",
"_do_create_keywords",
"(",
"args",
",",
"kw",
")",
"if",
"is_List",
"(",
"act",
")",
":",
"return",
"_do_create_list_action",
"(",
"act",
",",
"kw",
")",
"return",
"_do_create_a... | A factory for action objects. | [
"A",
"factory",
"for",
"action",
"objects",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Action.py#L509-L515 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Action.py | _string_from_cmd_list | 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 | 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) | [
"def",
"_string_from_cmd_list",
"(",
"cmd_list",
")",
":",
"cl",
"=",
"[",
"]",
"for",
"arg",
"in",
"map",
"(",
"str",
",",
"cmd_list",
")",
":",
"if",
"' '",
"in",
"arg",
"or",
"'\\t'",
"in",
"arg",
":",
"arg",
"=",
"'\"'",
"+",
"arg",
"+",
"'\"... | Takes a list of command line arguments and returns a pretty
representation for printing. | [
"Takes",
"a",
"list",
"of",
"command",
"line",
"arguments",
"and",
"returns",
"a",
"pretty",
"representation",
"for",
"printing",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Action.py#L727-L735 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Action.py | get_default_ENV | 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 | 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... | [
"def",
"get_default_ENV",
"(",
"env",
")",
":",
"global",
"default_ENV",
"try",
":",
"return",
"env",
"[",
"'ENV'",
"]",
"except",
"KeyError",
":",
"if",
"not",
"default_ENV",
":",
"import",
"SCons",
".",
"Environment",
"default_ENV",
"=",
"SCons",
".",
"E... | 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 complaints about local
variables bein... | [
"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"... | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Action.py#L740-L760 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Action.py | CommandAction.execute | 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 | 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... | [
"def",
"execute",
"(",
"self",
",",
"target",
",",
"source",
",",
"env",
",",
"executor",
"=",
"None",
")",
":",
"escape_list",
"=",
"SCons",
".",
"Subst",
".",
"escape_list",
"flatten_sequence",
"=",
"SCons",
".",
"Util",
".",
"flatten_sequence",
"try",
... | 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
handle lists of commands, even though that's not how we use it
... | [
"Execute",
"a",
"command",
"action",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Action.py#L886-L947 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Action.py | FunctionAction.get_presig | 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 | 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 | [
"def",
"get_presig",
"(",
"self",
",",
"target",
",",
"source",
",",
"env",
")",
":",
"try",
":",
"return",
"self",
".",
"gc",
"(",
"target",
",",
"source",
",",
"env",
")",
"except",
"AttributeError",
":",
"return",
"self",
".",
"funccontents"
] | Return the signature contents of this callable action. | [
"Return",
"the",
"signature",
"contents",
"of",
"this",
"callable",
"action",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Action.py#L1232-L1237 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Action.py | ListAction.get_presig | 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 | 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]) | [
"def",
"get_presig",
"(",
"self",
",",
"target",
",",
"source",
",",
"env",
")",
":",
"return",
"b\"\"",
".",
"join",
"(",
"[",
"bytes",
"(",
"x",
".",
"get_contents",
"(",
"target",
",",
"source",
",",
"env",
")",
")",
"for",
"x",
"in",
"self",
... | Return the signature contents of this action list.
Simple concatenation of the signatures of the elements. | [
"Return",
"the",
"signature",
"contents",
"of",
"this",
"action",
"list",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Action.py#L1266-L1271 | train |
iotile/coretools | iotilegateway/iotilegateway/supervisor/service_manager.py | ServiceManager._notify_update | 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 | 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)
... | [
"async",
"def",
"_notify_update",
"(",
"self",
",",
"name",
",",
"change_type",
",",
"change_info",
"=",
"None",
",",
"directed_client",
"=",
"None",
")",
":",
"for",
"monitor",
"in",
"self",
".",
"_monitors",
":",
"try",
":",
"result",
"=",
"monitor",
"... | Notify updates on a service to anyone who cares. | [
"Notify",
"updates",
"on",
"a",
"service",
"to",
"anyone",
"who",
"cares",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilegateway/iotilegateway/supervisor/service_manager.py#L61-L71 | train |
iotile/coretools | iotilegateway/iotilegateway/supervisor/service_manager.py | ServiceManager.update_state | 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 | 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... | [
"async",
"def",
"update_state",
"(",
"self",
",",
"short_name",
",",
"state",
")",
":",
"if",
"short_name",
"not",
"in",
"self",
".",
"services",
":",
"raise",
"ArgumentError",
"(",
"\"Service name is unknown\"",
",",
"short_name",
"=",
"short_name",
")",
"if"... | 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 service | [
"Set",
"the",
"current",
"state",
"of",
"a",
"service",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilegateway/iotilegateway/supervisor/service_manager.py#L73-L101 | train |
iotile/coretools | iotilegateway/iotilegateway/supervisor/service_manager.py | ServiceManager.add_service | 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 | 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... | [
"def",
"add_service",
"(",
"self",
",",
"name",
",",
"long_name",
",",
"preregistered",
"=",
"False",
",",
"notify",
"=",
"True",
")",
":",
"if",
"name",
"in",
"self",
".",
"services",
":",
"raise",
"ArgumentError",
"(",
"\"Could not add service because the lo... | 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 (bool): Whether this service is an expected preregistered
service.
... | [
"Add",
"a",
"service",
"to",
"the",
"list",
"of",
"tracked",
"services",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilegateway/iotilegateway/supervisor/service_manager.py#L103-L134 | train |
iotile/coretools | iotilegateway/iotilegateway/supervisor/service_manager.py | ServiceManager.service_info | 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 | 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... | [
"def",
"service_info",
"(",
"self",
",",
"short_name",
")",
":",
"if",
"short_name",
"not",
"in",
"self",
".",
"services",
":",
"raise",
"ArgumentError",
"(",
"\"Unknown service name\"",
",",
"short_name",
"=",
"short_name",
")",
"info",
"=",
"{",
"}",
"info... | 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. | [
"Get",
"static",
"information",
"about",
"a",
"service",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilegateway/iotilegateway/supervisor/service_manager.py#L136-L155 | train |
iotile/coretools | iotilegateway/iotilegateway/supervisor/service_manager.py | ServiceManager.service_messages | 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 | 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... | [
"def",
"service_messages",
"(",
"self",
",",
"short_name",
")",
":",
"if",
"short_name",
"not",
"in",
"self",
".",
"services",
":",
"raise",
"ArgumentError",
"(",
"\"Unknown service name\"",
",",
"short_name",
"=",
"short_name",
")",
"return",
"list",
"(",
"se... | 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 | [
"Get",
"the",
"messages",
"stored",
"for",
"a",
"service",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilegateway/iotilegateway/supervisor/service_manager.py#L157-L170 | train |
iotile/coretools | iotilegateway/iotilegateway/supervisor/service_manager.py | ServiceManager.service_headline | 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 | 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... | [
"def",
"service_headline",
"(",
"self",
",",
"short_name",
")",
":",
"if",
"short_name",
"not",
"in",
"self",
".",
"services",
":",
"raise",
"ArgumentError",
"(",
"\"Unknown service name\"",
",",
"short_name",
"=",
"short_name",
")",
"return",
"self",
".",
"se... | 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 | [
"Get",
"the",
"headline",
"stored",
"for",
"a",
"service",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilegateway/iotilegateway/supervisor/service_manager.py#L172-L185 | train |
iotile/coretools | iotilegateway/iotilegateway/supervisor/service_manager.py | ServiceManager.service_status | 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 | 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... | [
"def",
"service_status",
"(",
"self",
",",
"short_name",
")",
":",
"if",
"short_name",
"not",
"in",
"self",
".",
"services",
":",
"raise",
"ArgumentError",
"(",
"\"Unknown service name\"",
",",
"short_name",
"=",
"short_name",
")",
"info",
"=",
"{",
"}",
"se... | 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.
Args:
short_name (string):... | [
"Get",
"the",
"current",
"status",
"of",
"a",
"service",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilegateway/iotilegateway/supervisor/service_manager.py#L187-L212 | train |
iotile/coretools | iotilegateway/iotilegateway/supervisor/service_manager.py | ServiceManager.send_message | 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 | 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... | [
"async",
"def",
"send_message",
"(",
"self",
",",
"name",
",",
"level",
",",
"message",
")",
":",
"if",
"name",
"not",
"in",
"self",
".",
"services",
":",
"raise",
"ArgumentError",
"(",
"\"Unknown service name\"",
",",
"short_name",
"=",
"name",
")",
"msg"... | 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 | [
"Post",
"a",
"message",
"for",
"a",
"service",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilegateway/iotilegateway/supervisor/service_manager.py#L214-L227 | train |
iotile/coretools | iotilegateway/iotilegateway/supervisor/service_manager.py | ServiceManager.set_headline | 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 | 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
"""
... | [
"async",
"def",
"set_headline",
"(",
"self",
",",
"name",
",",
"level",
",",
"message",
")",
":",
"if",
"name",
"not",
"in",
"self",
".",
"services",
":",
"raise",
"ArgumentError",
"(",
"\"Unknown service name\"",
",",
"short_name",
"=",
"name",
")",
"self... | 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 | [
"Set",
"the",
"sticky",
"headline",
"for",
"a",
"service",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilegateway/iotilegateway/supervisor/service_manager.py#L229-L244 | train |
iotile/coretools | iotilegateway/iotilegateway/supervisor/service_manager.py | ServiceManager.send_heartbeat | 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 | 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... | [
"async",
"def",
"send_heartbeat",
"(",
"self",
",",
"short_name",
")",
":",
"if",
"short_name",
"not",
"in",
"self",
".",
"services",
":",
"raise",
"ArgumentError",
"(",
"\"Unknown service name\"",
",",
"short_name",
"=",
"short_name",
")",
"self",
".",
"servi... | Post a heartbeat for a service.
Args:
short_name (string): The short name of the service to query | [
"Post",
"a",
"heartbeat",
"for",
"a",
"service",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilegateway/iotilegateway/supervisor/service_manager.py#L246-L257 | train |
iotile/coretools | iotilegateway/iotilegateway/supervisor/service_manager.py | ServiceManager.set_agent | 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 | 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... | [
"def",
"set_agent",
"(",
"self",
",",
"short_name",
",",
"client_id",
")",
":",
"if",
"short_name",
"not",
"in",
"self",
".",
"services",
":",
"raise",
"ArgumentError",
"(",
"\"Unknown service name\"",
",",
"short_name",
"=",
"short_name",
")",
"self",
".",
... | 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 commands for this service. | [
"Register",
"a",
"client",
"id",
"that",
"handlers",
"commands",
"for",
"a",
"service",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilegateway/iotilegateway/supervisor/service_manager.py#L268-L281 | train |
iotile/coretools | iotilegateway/iotilegateway/supervisor/service_manager.py | ServiceManager.clear_agent | 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 | 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... | [
"def",
"clear_agent",
"(",
"self",
",",
"short_name",
",",
"client_id",
")",
":",
"if",
"short_name",
"not",
"in",
"self",
".",
"services",
":",
"raise",
"ArgumentError",
"(",
"\"Unknown service name\"",
",",
"short_name",
"=",
"short_name",
")",
"if",
"short_... | 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 no longer receive commands for this service. | [
"Remove",
"a",
"client",
"id",
"from",
"being",
"the",
"command",
"handler",
"for",
"a",
"service",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilegateway/iotilegateway/supervisor/service_manager.py#L283-L303 | train |
iotile/coretools | iotilegateway/iotilegateway/supervisor/service_manager.py | ServiceManager.send_rpc_command | 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 | 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... | [
"async",
"def",
"send_rpc_command",
"(",
"self",
",",
"short_name",
",",
"rpc_id",
",",
"payload",
",",
"sender_client",
",",
"timeout",
"=",
"1.0",
")",
":",
"rpc_tag",
"=",
"str",
"(",
"uuid",
".",
"uuid4",
"(",
")",
")",
"self",
".",
"rpc_results",
... | 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 would like to call
payload (bytes): The raw bytes that we would like to send as an
... | [
"Send",
"an",
"RPC",
"to",
"a",
"service",
"using",
"its",
"registered",
"agent",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilegateway/iotilegateway/supervisor/service_manager.py#L305-L343 | train |
iotile/coretools | iotilegateway/iotilegateway/supervisor/service_manager.py | ServiceManager.send_rpc_response | 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 | 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... | [
"def",
"send_rpc_response",
"(",
"self",
",",
"rpc_tag",
",",
"result",
",",
"response",
")",
":",
"if",
"rpc_tag",
"not",
"in",
"self",
".",
"in_flight_rpcs",
":",
"raise",
"ArgumentError",
"(",
"\"In flight RPC could not be found, it may have timed out\"",
",",
"r... | 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_found, rpc_not_found, timeout, success, invalid_response,
... | [
"Send",
"a",
"response",
"to",
"an",
"RPC",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilegateway/iotilegateway/supervisor/service_manager.py#L345-L369 | train |
iotile/coretools | iotilegateway/iotilegateway/supervisor/service_manager.py | ServiceManager.periodic_service_rpcs | 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 | 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... | [
"def",
"periodic_service_rpcs",
"(",
"self",
")",
":",
"to_remove",
"=",
"[",
"]",
"now",
"=",
"monotonic",
"(",
")",
"for",
"rpc_tag",
",",
"rpc",
"in",
"self",
".",
"in_flight_rpcs",
".",
"items",
"(",
")",
":",
"expiry",
"=",
"rpc",
".",
"sent_times... | 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. | [
"Check",
"if",
"any",
"RPC",
"has",
"expired",
"and",
"remove",
"it",
"from",
"the",
"in",
"flight",
"list",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilegateway/iotilegateway/supervisor/service_manager.py#L371-L386 | train |
iotile/coretools | iotilecore/iotile/core/utilities/paths.py | settings_directory | 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 | 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... | [
"def",
"settings_directory",
"(",
")",
":",
"system",
"=",
"platform",
".",
"system",
"(",
")",
"basedir",
"=",
"None",
"if",
"system",
"==",
"'Windows'",
":",
"if",
"'APPDATA'",
"in",
"os",
".",
"environ",
":",
"basedir",
"=",
"os",
".",
"environ",
"[... | Find a per user settings directory that is appropriate for each
type of system that we are installed on. | [
"Find",
"a",
"per",
"user",
"settings",
"directory",
"that",
"is",
"appropriate",
"for",
"each",
"type",
"of",
"system",
"that",
"we",
"are",
"installed",
"on",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/utilities/paths.py#L14-L35 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/gs.py | generate | 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 | 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()
... | [
"def",
"generate",
"(",
"env",
")",
":",
"global",
"GhostscriptAction",
"try",
":",
"if",
"GhostscriptAction",
"is",
"None",
":",
"GhostscriptAction",
"=",
"SCons",
".",
"Action",
".",
"Action",
"(",
"'$GSCOM'",
",",
"'$GSCOMSTR'",
")",
"from",
"SCons",
".",... | Add Builders and construction variables for Ghostscript to an
Environment. | [
"Add",
"Builders",
"and",
"construction",
"variables",
"for",
"Ghostscript",
"to",
"an",
"Environment",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/gs.py#L53-L78 | train |
iotile/coretools | iotilebuild/iotile/build/utilities/bundled_data.py | resource_path | 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 | 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... | [
"def",
"resource_path",
"(",
"relative_path",
"=",
"None",
",",
"expect",
"=",
"None",
")",
":",
"if",
"expect",
"not",
"in",
"(",
"None",
",",
"'file'",
",",
"'folder'",
")",
":",
"raise",
"ArgumentError",
"(",
"\"Invalid expect parameter, must be None, 'file' ... | 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 expect=(None, 'file', or 'folder') for
what you expect to ... | [
"Return",
"the",
"absolute",
"path",
"to",
"a",
"resource",
"in",
"iotile",
"-",
"build",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/utilities/bundled_data.py#L22-L65 | train |
iotile/coretools | iotilecore/iotile/core/utilities/packed.py | unpack | 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 | 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) | [
"def",
"unpack",
"(",
"fmt",
",",
"arg",
")",
":",
"if",
"isinstance",
"(",
"arg",
",",
"bytearray",
")",
"and",
"not",
"(",
"sys",
".",
"version_info",
">=",
"(",
"2",
",",
"7",
",",
"5",
")",
")",
":",
"return",
"struct",
".",
"unpack",
"(",
... | A shim around struct.unpack to allow it to work on python 2.7.3. | [
"A",
"shim",
"around",
"struct",
".",
"unpack",
"to",
"allow",
"it",
"to",
"work",
"on",
"python",
"2",
".",
"7",
".",
"3",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/utilities/packed.py#L5-L11 | train |
iotile/coretools | iotileemulate/iotile/emulate/reference/controller_features/controller_system.py | ControllerSubsystemBase.initialize | 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 | 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... | [
"async",
"def",
"initialize",
"(",
"self",
",",
"timeout",
"=",
"2.0",
")",
":",
"if",
"self",
".",
"initialized",
".",
"is_set",
"(",
")",
":",
"raise",
"InternalError",
"(",
"\"initialize called when already initialized\"",
")",
"self",
".",
"_emulator",
"."... | 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. | [
"Launch",
"any",
"background",
"tasks",
"associated",
"with",
"this",
"subsystem",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/controller_features/controller_system.py#L45-L57 | train |
iotile/coretools | iotilecore/iotile/core/dev/registry.py | _check_registry_type | 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 | 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... | [
"def",
"_check_registry_type",
"(",
"folder",
"=",
"None",
")",
":",
"folder",
"=",
"_registry_folder",
"(",
"folder",
")",
"default_file",
"=",
"os",
".",
"path",
".",
"join",
"(",
"folder",
",",
"'registry_type.txt'",
")",
"try",
":",
"with",
"open",
"("... | 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 (string): The folder that we should check for a defa... | [
"Check",
"if",
"the",
"user",
"has",
"placed",
"a",
"registry_type",
".",
"txt",
"file",
"to",
"choose",
"the",
"registry",
"type"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/dev/registry.py#L582-L603 | train |
iotile/coretools | iotilecore/iotile/core/dev/registry.py | _ensure_package_loaded | 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 | 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:
... | [
"def",
"_ensure_package_loaded",
"(",
"path",
",",
"component",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"packages",
"=",
"component",
".",
"find_products",
"(",
"'support_package'",
")",
"if",
"len",
"(",
"packages",
")",
... | Ensure that the given module is loaded as a submodule.
Returns:
str: The name that the module should be imported as. | [
"Ensure",
"that",
"the",
"given",
"module",
"is",
"loaded",
"as",
"a",
"submodule",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/dev/registry.py#L606-L644 | train |
iotile/coretools | iotilecore/iotile/core/dev/registry.py | _try_load_module | 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 | 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... | [
"def",
"_try_load_module",
"(",
"path",
",",
"import_name",
"=",
"None",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"obj_name",
"=",
"None",
"if",
"len",
"(",
"path",
")",
">",
"2",
"and",
"':'",
"in",
"path",
"[",
"2... | 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 itself.
Args:
path (str): The path of the ... | [
"Try",
"to",
"programmatically",
"load",
"a",
"python",
"module",
"by",
"path",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/dev/registry.py#L647-L707 | train |
iotile/coretools | iotilecore/iotile/core/dev/registry.py | ComponentRegistry.frozen | 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 | 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) | [
"def",
"frozen",
"(",
"self",
")",
":",
"frozen_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"_registry_folder",
"(",
")",
",",
"'frozen_extensions.json'",
")",
"return",
"os",
".",
"path",
".",
"isfile",
"(",
"frozen_path",
")"
] | Return whether we have a cached list of all installed entry_points. | [
"Return",
"whether",
"we",
"have",
"a",
"cached",
"list",
"of",
"all",
"installed",
"entry_points",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/dev/registry.py#L45-L49 | train |
iotile/coretools | iotilecore/iotile/core/dev/registry.py | ComponentRegistry.kvstore | 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 | 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 | [
"def",
"kvstore",
"(",
"self",
")",
":",
"if",
"self",
".",
"_kvstore",
"is",
"None",
":",
"self",
".",
"_kvstore",
"=",
"self",
".",
"BackingType",
"(",
"self",
".",
"BackingFileName",
",",
"respect_venv",
"=",
"True",
")",
"return",
"self",
".",
"_kv... | Lazily load the underlying key-value store backing this registry. | [
"Lazily",
"load",
"the",
"underlying",
"key",
"-",
"value",
"store",
"backing",
"this",
"registry",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/dev/registry.py#L52-L58 | train |
iotile/coretools | iotilecore/iotile/core/dev/registry.py | ComponentRegistry.plugins | 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 | 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 = {}
... | [
"def",
"plugins",
"(",
"self",
")",
":",
"if",
"self",
".",
"_plugins",
"is",
"None",
":",
"self",
".",
"_plugins",
"=",
"{",
"}",
"for",
"_",
",",
"plugin",
"in",
"self",
".",
"load_extensions",
"(",
"'iotile.plugin'",
")",
":",
"links",
"=",
"plugi... | 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. | [
"Lazily",
"load",
"iotile",
"plugins",
"only",
"on",
"demand",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/dev/registry.py#L61-L77 | train |
iotile/coretools | iotilecore/iotile/core/dev/registry.py | ComponentRegistry.load_extensions | 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 | 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... | [
"def",
"load_extensions",
"(",
"self",
",",
"group",
",",
"name_filter",
"=",
"None",
",",
"comp_filter",
"=",
"None",
",",
"class_filter",
"=",
"None",
",",
"product_name",
"=",
"None",
",",
"unique",
"=",
"False",
")",
":",
"found_extensions",
"=",
"[",
... | 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 needed, this method should be called
to load it. Examples of plugins are proxy modules, emulated tiles,
iotile-build aut... | [
"Dynamically",
"load",
"and",
"return",
"extension",
"objects",
"of",
"a",
"given",
"type",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/dev/registry.py#L79-L190 | train |
iotile/coretools | iotilecore/iotile/core/dev/registry.py | ComponentRegistry.register_extension | 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 | 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... | [
"def",
"register_extension",
"(",
"self",
",",
"group",
",",
"name",
",",
"extension",
")",
":",
"if",
"isinstance",
"(",
"extension",
",",
"str",
")",
":",
"name",
",",
"extension",
"=",
"self",
".",
"load_extension",
"(",
"extension",
")",
"[",
"0",
... | 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 import and load. Otherwise it
will be treated as ... | [
"Register",
"an",
"extension",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/dev/registry.py#L192-L209 | train |
iotile/coretools | iotilecore/iotile/core/dev/registry.py | ComponentRegistry.clear_extensions | 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 | 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] = [] | [
"def",
"clear_extensions",
"(",
"self",
",",
"group",
"=",
"None",
")",
":",
"if",
"group",
"is",
"None",
":",
"ComponentRegistry",
".",
"_registered_extensions",
"=",
"{",
"}",
"return",
"if",
"group",
"in",
"self",
".",
"_registered_extensions",
":",
"self... | Clear all previously registered extensions. | [
"Clear",
"all",
"previously",
"registered",
"extensions",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/dev/registry.py#L211-L219 | train |
iotile/coretools | iotilecore/iotile/core/dev/registry.py | ComponentRegistry.freeze_extensions | 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 | 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 ... | [
"def",
"freeze_extensions",
"(",
"self",
")",
":",
"output_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"_registry_folder",
"(",
")",
",",
"'frozen_extensions.json'",
")",
"with",
"open",
"(",
"output_path",
",",
"\"w\"",
")",
"as",
"outfile",
":",
"js... | 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 a file into the current virtual
... | [
"Freeze",
"the",
"set",
"of",
"extensions",
"into",
"a",
"single",
"file",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/dev/registry.py#L221-L238 | train |
iotile/coretools | iotilecore/iotile/core/dev/registry.py | ComponentRegistry.unfreeze_extensions | 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 | 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)
... | [
"def",
"unfreeze_extensions",
"(",
"self",
")",
":",
"output_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"_registry_folder",
"(",
")",
",",
"'frozen_extensions.json'",
")",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"output_path",
")",
":",
... | Remove a previously frozen list of extensions. | [
"Remove",
"a",
"previously",
"frozen",
"list",
"of",
"extensions",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/dev/registry.py#L240-L248 | train |
iotile/coretools | iotilecore/iotile/core/dev/registry.py | ComponentRegistry.load_extension | 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 | 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... | [
"def",
"load_extension",
"(",
"self",
",",
"path",
",",
"name_filter",
"=",
"None",
",",
"class_filter",
"=",
"None",
",",
"unique",
"=",
"False",
",",
"component",
"=",
"None",
")",
":",
"import_name",
"=",
"None",
"if",
"component",
"is",
"not",
"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 class.
Args:
path (str): The path to the python file to load
name_filter (str):... | [
"Load",
"a",
"single",
"python",
"module",
"extension",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/dev/registry.py#L250-L296 | train |
iotile/coretools | iotilecore/iotile/core/dev/registry.py | ComponentRegistry._filter_nonextensions | 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 | 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
... | [
"def",
"_filter_nonextensions",
"(",
"cls",
",",
"obj",
")",
":",
"if",
"hasattr",
"(",
"obj",
",",
"'__dict__'",
")",
"and",
"obj",
".",
"__dict__",
".",
"get",
"(",
"'__NO_EXTENSION__'",
",",
"False",
")",
"is",
"True",
":",
"return",
"False",
"return"... | 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
That class will never be returned as an exten... | [
"Remove",
"all",
"classes",
"marked",
"as",
"not",
"extensions",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/dev/registry.py#L331-L351 | train |
iotile/coretools | iotilecore/iotile/core/dev/registry.py | ComponentRegistry.SetBackingStore | 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 | 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... | [
"def",
"SetBackingStore",
"(",
"cls",
",",
"backing",
")",
":",
"if",
"backing",
"not",
"in",
"[",
"'json'",
",",
"'sqlite'",
",",
"'memory'",
"]",
":",
"raise",
"ArgumentError",
"(",
"\"Unknown backing store type that is not json or sqlite\"",
",",
"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 data | [
"Set",
"the",
"global",
"backing",
"type",
"used",
"by",
"the",
"ComponentRegistry",
"from",
"this",
"point",
"forward"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/dev/registry.py#L390-L408 | train |
iotile/coretools | iotilecore/iotile/core/dev/registry.py | ComponentRegistry.add_component | 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 | 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... | [
"def",
"add_component",
"(",
"self",
",",
"component",
",",
"temporary",
"=",
"False",
")",
":",
"tile",
"=",
"IOTile",
"(",
"component",
")",
"value",
"=",
"os",
".",
"path",
".",
"normpath",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"component",
... | 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 registry associated
with this environment and will remain r... | [
"Register",
"a",
"component",
"with",
"ComponentRegistry",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/dev/registry.py#L410-L436 | train |
iotile/coretools | iotilecore/iotile/core/dev/registry.py | ComponentRegistry.list_plugins | 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 | 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} | [
"def",
"list_plugins",
"(",
"self",
")",
":",
"vals",
"=",
"self",
".",
"plugins",
".",
"items",
"(",
")",
"return",
"{",
"x",
":",
"y",
"for",
"x",
",",
"y",
"in",
"vals",
"}"
] | List all of the plugins that have been registerd for the iotile program on this computer | [
"List",
"all",
"of",
"the",
"plugins",
"that",
"have",
"been",
"registerd",
"for",
"the",
"iotile",
"program",
"on",
"this",
"computer"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/dev/registry.py#L449-L456 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.