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 | iotilecore/iotile/core/dev/registry.py | ComponentRegistry.clear_components | def clear_components(self):
"""Clear all of the registered components
"""
ComponentRegistry._component_overlays = {}
for key in self.list_components():
self.remove_component(key) | python | def clear_components(self):
"""Clear all of the registered components
"""
ComponentRegistry._component_overlays = {}
for key in self.list_components():
self.remove_component(key) | [
"def",
"clear_components",
"(",
"self",
")",
":",
"ComponentRegistry",
".",
"_component_overlays",
"=",
"{",
"}",
"for",
"key",
"in",
"self",
".",
"list_components",
"(",
")",
":",
"self",
".",
"remove_component",
"(",
"key",
")"
] | Clear all of the registered components | [
"Clear",
"all",
"of",
"the",
"registered",
"components"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/dev/registry.py#L473-L480 | train |
iotile/coretools | iotilecore/iotile/core/dev/registry.py | ComponentRegistry.list_components | def list_components(self):
"""List all of the registered component names.
This list will include all of the permanently stored components as
well as any temporary components that were added with a temporary=True
flag in this session.
Returns:
list of str: The list o... | python | def list_components(self):
"""List all of the registered component names.
This list will include all of the permanently stored components as
well as any temporary components that were added with a temporary=True
flag in this session.
Returns:
list of str: The list o... | [
"def",
"list_components",
"(",
"self",
")",
":",
"overlays",
"=",
"list",
"(",
"self",
".",
"_component_overlays",
")",
"items",
"=",
"self",
".",
"kvstore",
".",
"get_all",
"(",
")",
"return",
"overlays",
"+",
"[",
"x",
"[",
"0",
"]",
"for",
"x",
"i... | List all of the registered component names.
This list will include all of the permanently stored components as
well as any temporary components that were added with a temporary=True
flag in this session.
Returns:
list of str: The list of component names.
Any of... | [
"List",
"all",
"of",
"the",
"registered",
"component",
"names",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/dev/registry.py#L488-L505 | train |
iotile/coretools | iotilecore/iotile/core/dev/registry.py | ComponentRegistry.iter_components | def iter_components(self):
"""Iterate over all defined components yielding IOTile objects."""
names = self.list_components()
for name in names:
yield self.get_component(name) | python | def iter_components(self):
"""Iterate over all defined components yielding IOTile objects."""
names = self.list_components()
for name in names:
yield self.get_component(name) | [
"def",
"iter_components",
"(",
"self",
")",
":",
"names",
"=",
"self",
".",
"list_components",
"(",
")",
"for",
"name",
"in",
"names",
":",
"yield",
"self",
".",
"get_component",
"(",
"name",
")"
] | Iterate over all defined components yielding IOTile objects. | [
"Iterate",
"over",
"all",
"defined",
"components",
"yielding",
"IOTile",
"objects",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/dev/registry.py#L507-L513 | train |
iotile/coretools | iotilecore/iotile/core/dev/registry.py | ComponentRegistry.list_config | def list_config(self):
"""List all of the configuration variables
"""
items = self.kvstore.get_all()
return ["{0}={1}".format(x[0][len('config:'):], x[1])
for x in items if x[0].startswith('config:')] | python | def list_config(self):
"""List all of the configuration variables
"""
items = self.kvstore.get_all()
return ["{0}={1}".format(x[0][len('config:'):], x[1])
for x in items if x[0].startswith('config:')] | [
"def",
"list_config",
"(",
"self",
")",
":",
"items",
"=",
"self",
".",
"kvstore",
".",
"get_all",
"(",
")",
"return",
"[",
"\"{0}={1}\"",
".",
"format",
"(",
"x",
"[",
"0",
"]",
"[",
"len",
"(",
"'config:'",
")",
":",
"]",
",",
"x",
"[",
"1",
... | List all of the configuration variables | [
"List",
"all",
"of",
"the",
"configuration",
"variables"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/dev/registry.py#L515-L520 | train |
iotile/coretools | iotilecore/iotile/core/dev/registry.py | ComponentRegistry.set_config | def set_config(self, key, value):
"""Set a persistent config key to a value, stored in the registry
Args:
key (string): The key name
value (string): The key value
"""
keyname = "config:" + key
self.kvstore.set(keyname, value) | python | def set_config(self, key, value):
"""Set a persistent config key to a value, stored in the registry
Args:
key (string): The key name
value (string): The key value
"""
keyname = "config:" + key
self.kvstore.set(keyname, value) | [
"def",
"set_config",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"keyname",
"=",
"\"config:\"",
"+",
"key",
"self",
".",
"kvstore",
".",
"set",
"(",
"keyname",
",",
"value",
")"
] | Set a persistent config key to a value, stored in the registry
Args:
key (string): The key name
value (string): The key value | [
"Set",
"a",
"persistent",
"config",
"key",
"to",
"a",
"value",
"stored",
"in",
"the",
"registry"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/dev/registry.py#L522-L532 | train |
iotile/coretools | iotilecore/iotile/core/dev/registry.py | ComponentRegistry.get_config | def get_config(self, key, default=MISSING):
"""Get the value of a persistent config key from the registry
If no default is specified and the key is not found ArgumentError is raised.
Args:
key (string): The key name to fetch
default (string): an optional value to be ret... | python | def get_config(self, key, default=MISSING):
"""Get the value of a persistent config key from the registry
If no default is specified and the key is not found ArgumentError is raised.
Args:
key (string): The key name to fetch
default (string): an optional value to be ret... | [
"def",
"get_config",
"(",
"self",
",",
"key",
",",
"default",
"=",
"MISSING",
")",
":",
"keyname",
"=",
"\"config:\"",
"+",
"key",
"try",
":",
"return",
"self",
".",
"kvstore",
".",
"get",
"(",
"keyname",
")",
"except",
"KeyError",
":",
"if",
"default"... | Get the value of a persistent config key from the registry
If no default is specified and the key is not found ArgumentError is raised.
Args:
key (string): The key name to fetch
default (string): an optional value to be returned if key cannot be found
Returns:
... | [
"Get",
"the",
"value",
"of",
"a",
"persistent",
"config",
"key",
"from",
"the",
"registry"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/dev/registry.py#L534-L555 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Executor.py | execute_action_list | def execute_action_list(obj, target, kw):
"""Actually execute the action list."""
env = obj.get_build_env()
kw = obj.get_kw(kw)
status = 0
for act in obj.get_action_list():
args = ([], [], env)
status = act(*args, **kw)
if isinstance(status, SCons.Errors.BuildError):
... | python | def execute_action_list(obj, target, kw):
"""Actually execute the action list."""
env = obj.get_build_env()
kw = obj.get_kw(kw)
status = 0
for act in obj.get_action_list():
args = ([], [], env)
status = act(*args, **kw)
if isinstance(status, SCons.Errors.BuildError):
... | [
"def",
"execute_action_list",
"(",
"obj",
",",
"target",
",",
"kw",
")",
":",
"env",
"=",
"obj",
".",
"get_build_env",
"(",
")",
"kw",
"=",
"obj",
".",
"get_kw",
"(",
"kw",
")",
"status",
"=",
"0",
"for",
"act",
"in",
"obj",
".",
"get_action_list",
... | Actually execute the action list. | [
"Actually",
"execute",
"the",
"action",
"list",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Executor.py#L119-L137 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Executor.py | Executor.get_all_targets | def get_all_targets(self):
"""Returns all targets for all batches of this Executor."""
result = []
for batch in self.batches:
result.extend(batch.targets)
return result | python | def get_all_targets(self):
"""Returns all targets for all batches of this Executor."""
result = []
for batch in self.batches:
result.extend(batch.targets)
return result | [
"def",
"get_all_targets",
"(",
"self",
")",
":",
"result",
"=",
"[",
"]",
"for",
"batch",
"in",
"self",
".",
"batches",
":",
"result",
".",
"extend",
"(",
"batch",
".",
"targets",
")",
"return",
"result"
] | Returns all targets for all batches of this Executor. | [
"Returns",
"all",
"targets",
"for",
"all",
"batches",
"of",
"this",
"Executor",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Executor.py#L295-L300 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Executor.py | Executor.get_all_sources | def get_all_sources(self):
"""Returns all sources for all batches of this Executor."""
result = []
for batch in self.batches:
result.extend(batch.sources)
return result | python | def get_all_sources(self):
"""Returns all sources for all batches of this Executor."""
result = []
for batch in self.batches:
result.extend(batch.sources)
return result | [
"def",
"get_all_sources",
"(",
"self",
")",
":",
"result",
"=",
"[",
"]",
"for",
"batch",
"in",
"self",
".",
"batches",
":",
"result",
".",
"extend",
"(",
"batch",
".",
"sources",
")",
"return",
"result"
] | Returns all sources for all batches of this Executor. | [
"Returns",
"all",
"sources",
"for",
"all",
"batches",
"of",
"this",
"Executor",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Executor.py#L302-L307 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Executor.py | Executor.get_action_side_effects | def get_action_side_effects(self):
"""Returns all side effects for all batches of this
Executor used by the underlying Action.
"""
result = SCons.Util.UniqueList([])
for target in self.get_action_targets():
result.extend(target.side_effects)
return result | python | def get_action_side_effects(self):
"""Returns all side effects for all batches of this
Executor used by the underlying Action.
"""
result = SCons.Util.UniqueList([])
for target in self.get_action_targets():
result.extend(target.side_effects)
return result | [
"def",
"get_action_side_effects",
"(",
"self",
")",
":",
"result",
"=",
"SCons",
".",
"Util",
".",
"UniqueList",
"(",
"[",
"]",
")",
"for",
"target",
"in",
"self",
".",
"get_action_targets",
"(",
")",
":",
"result",
".",
"extend",
"(",
"target",
".",
"... | Returns all side effects for all batches of this
Executor used by the underlying Action. | [
"Returns",
"all",
"side",
"effects",
"for",
"all",
"batches",
"of",
"this",
"Executor",
"used",
"by",
"the",
"underlying",
"Action",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Executor.py#L335-L343 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Executor.py | Executor.get_build_env | def get_build_env(self):
"""Fetch or create the appropriate build Environment
for this Executor.
"""
try:
return self._memo['get_build_env']
except KeyError:
pass
# Create the build environment instance with appropriate
# overrides. These... | python | def get_build_env(self):
"""Fetch or create the appropriate build Environment
for this Executor.
"""
try:
return self._memo['get_build_env']
except KeyError:
pass
# Create the build environment instance with appropriate
# overrides. These... | [
"def",
"get_build_env",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"_memo",
"[",
"'get_build_env'",
"]",
"except",
"KeyError",
":",
"pass",
"overrides",
"=",
"{",
"}",
"for",
"odict",
"in",
"self",
".",
"overridelist",
":",
"overrides",
".... | Fetch or create the appropriate build Environment
for this Executor. | [
"Fetch",
"or",
"create",
"the",
"appropriate",
"build",
"Environment",
"for",
"this",
"Executor",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Executor.py#L346-L370 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Executor.py | Executor.get_build_scanner_path | def get_build_scanner_path(self, scanner):
"""Fetch the scanner path for this executor's targets and sources.
"""
env = self.get_build_env()
try:
cwd = self.batches[0].targets[0].cwd
except (IndexError, AttributeError):
cwd = None
return scanner.pa... | python | def get_build_scanner_path(self, scanner):
"""Fetch the scanner path for this executor's targets and sources.
"""
env = self.get_build_env()
try:
cwd = self.batches[0].targets[0].cwd
except (IndexError, AttributeError):
cwd = None
return scanner.pa... | [
"def",
"get_build_scanner_path",
"(",
"self",
",",
"scanner",
")",
":",
"env",
"=",
"self",
".",
"get_build_env",
"(",
")",
"try",
":",
"cwd",
"=",
"self",
".",
"batches",
"[",
"0",
"]",
".",
"targets",
"[",
"0",
"]",
".",
"cwd",
"except",
"(",
"In... | Fetch the scanner path for this executor's targets and sources. | [
"Fetch",
"the",
"scanner",
"path",
"for",
"this",
"executor",
"s",
"targets",
"and",
"sources",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Executor.py#L372-L382 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Executor.py | Executor.add_sources | def add_sources(self, sources):
"""Add source files to this Executor's list. This is necessary
for "multi" Builders that can be called repeatedly to build up
a source file list for a given target."""
# TODO(batch): extend to multiple batches
assert (len(self.batches) == 1)
... | python | def add_sources(self, sources):
"""Add source files to this Executor's list. This is necessary
for "multi" Builders that can be called repeatedly to build up
a source file list for a given target."""
# TODO(batch): extend to multiple batches
assert (len(self.batches) == 1)
... | [
"def",
"add_sources",
"(",
"self",
",",
"sources",
")",
":",
"assert",
"(",
"len",
"(",
"self",
".",
"batches",
")",
"==",
"1",
")",
"sources",
"=",
"[",
"x",
"for",
"x",
"in",
"sources",
"if",
"x",
"not",
"in",
"self",
".",
"batches",
"[",
"0",
... | Add source files to this Executor's list. This is necessary
for "multi" Builders that can be called repeatedly to build up
a source file list for a given target. | [
"Add",
"source",
"files",
"to",
"this",
"Executor",
"s",
"list",
".",
"This",
"is",
"necessary",
"for",
"multi",
"Builders",
"that",
"can",
"be",
"called",
"repeatedly",
"to",
"build",
"up",
"a",
"source",
"file",
"list",
"for",
"a",
"given",
"target",
"... | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Executor.py#L400-L408 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Executor.py | Executor.add_batch | def add_batch(self, targets, sources):
"""Add pair of associated target and source to this Executor's list.
This is necessary for "batch" Builders that can be called repeatedly
to build up a list of matching target and source files that will be
used in order to update multiple target fil... | python | def add_batch(self, targets, sources):
"""Add pair of associated target and source to this Executor's list.
This is necessary for "batch" Builders that can be called repeatedly
to build up a list of matching target and source files that will be
used in order to update multiple target fil... | [
"def",
"add_batch",
"(",
"self",
",",
"targets",
",",
"sources",
")",
":",
"self",
".",
"batches",
".",
"append",
"(",
"Batch",
"(",
"targets",
",",
"sources",
")",
")"
] | Add pair of associated target and source to this Executor's list.
This is necessary for "batch" Builders that can be called repeatedly
to build up a list of matching target and source files that will be
used in order to update multiple target files at once from multiple
corresponding sou... | [
"Add",
"pair",
"of",
"associated",
"target",
"and",
"source",
"to",
"this",
"Executor",
"s",
"list",
".",
"This",
"is",
"necessary",
"for",
"batch",
"Builders",
"that",
"can",
"be",
"called",
"repeatedly",
"to",
"build",
"up",
"a",
"list",
"of",
"matching"... | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Executor.py#L413-L419 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Executor.py | Executor.get_contents | def get_contents(self):
"""Fetch the signature contents. This is the main reason this
class exists, so we can compute this once and cache it regardless
of how many target or source Nodes there are.
"""
try:
return self._memo['get_contents']
except KeyError:
... | python | def get_contents(self):
"""Fetch the signature contents. This is the main reason this
class exists, so we can compute this once and cache it regardless
of how many target or source Nodes there are.
"""
try:
return self._memo['get_contents']
except KeyError:
... | [
"def",
"get_contents",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"_memo",
"[",
"'get_contents'",
"]",
"except",
"KeyError",
":",
"pass",
"env",
"=",
"self",
".",
"get_build_env",
"(",
")",
"action_list",
"=",
"self",
".",
"get_action_list",... | Fetch the signature contents. This is the main reason this
class exists, so we can compute this once and cache it regardless
of how many target or source Nodes there are. | [
"Fetch",
"the",
"signature",
"contents",
".",
"This",
"is",
"the",
"main",
"reason",
"this",
"class",
"exists",
"so",
"we",
"can",
"compute",
"this",
"once",
"and",
"cache",
"it",
"regardless",
"of",
"how",
"many",
"target",
"or",
"source",
"Nodes",
"there... | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Executor.py#L448-L469 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Executor.py | Executor.get_implicit_deps | def get_implicit_deps(self):
"""Return the executor's implicit dependencies, i.e. the nodes of
the commands to be executed."""
result = []
build_env = self.get_build_env()
for act in self.get_action_list():
deps = act.get_implicit_deps(self.get_all_targets(),
... | python | def get_implicit_deps(self):
"""Return the executor's implicit dependencies, i.e. the nodes of
the commands to be executed."""
result = []
build_env = self.get_build_env()
for act in self.get_action_list():
deps = act.get_implicit_deps(self.get_all_targets(),
... | [
"def",
"get_implicit_deps",
"(",
"self",
")",
":",
"result",
"=",
"[",
"]",
"build_env",
"=",
"self",
".",
"get_build_env",
"(",
")",
"for",
"act",
"in",
"self",
".",
"get_action_list",
"(",
")",
":",
"deps",
"=",
"act",
".",
"get_implicit_deps",
"(",
... | Return the executor's implicit dependencies, i.e. the nodes of
the commands to be executed. | [
"Return",
"the",
"executor",
"s",
"implicit",
"dependencies",
"i",
".",
"e",
".",
"the",
"nodes",
"of",
"the",
"commands",
"to",
"be",
"executed",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Executor.py#L546-L556 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Executor.py | Null._morph | def _morph(self):
"""Morph this Null executor to a real Executor object."""
batches = self.batches
self.__class__ = Executor
self.__init__([])
self.batches = batches | python | def _morph(self):
"""Morph this Null executor to a real Executor object."""
batches = self.batches
self.__class__ = Executor
self.__init__([])
self.batches = batches | [
"def",
"_morph",
"(",
"self",
")",
":",
"batches",
"=",
"self",
".",
"batches",
"self",
".",
"__class__",
"=",
"Executor",
"self",
".",
"__init__",
"(",
"[",
"]",
")",
"self",
".",
"batches",
"=",
"batches"
] | Morph this Null executor to a real Executor object. | [
"Morph",
"this",
"Null",
"executor",
"to",
"a",
"real",
"Executor",
"object",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Executor.py#L645-L650 | train |
iotile/coretools | iotilecore/iotile/core/hw/update/record.py | UpdateRecord.LoadPlugins | def LoadPlugins(cls):
"""Load all registered iotile.update_record plugins."""
if cls.PLUGINS_LOADED:
return
reg = ComponentRegistry()
for _, record in reg.load_extensions('iotile.update_record'):
cls.RegisterRecordType(record)
cls.PLUGINS_LOADED = True | python | def LoadPlugins(cls):
"""Load all registered iotile.update_record plugins."""
if cls.PLUGINS_LOADED:
return
reg = ComponentRegistry()
for _, record in reg.load_extensions('iotile.update_record'):
cls.RegisterRecordType(record)
cls.PLUGINS_LOADED = True | [
"def",
"LoadPlugins",
"(",
"cls",
")",
":",
"if",
"cls",
".",
"PLUGINS_LOADED",
":",
"return",
"reg",
"=",
"ComponentRegistry",
"(",
")",
"for",
"_",
",",
"record",
"in",
"reg",
".",
"load_extensions",
"(",
"'iotile.update_record'",
")",
":",
"cls",
".",
... | Load all registered iotile.update_record plugins. | [
"Load",
"all",
"registered",
"iotile",
".",
"update_record",
"plugins",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/update/record.py#L82-L92 | train |
iotile/coretools | iotilecore/iotile/core/hw/update/record.py | UpdateRecord.RegisterRecordType | def RegisterRecordType(cls, record_class):
"""Register a known record type in KNOWN_CLASSES.
Args:
record_class (UpdateRecord): An update record subclass.
"""
record_type = record_class.MatchType()
if record_type not in UpdateRecord.KNOWN_CLASSES:
Update... | python | def RegisterRecordType(cls, record_class):
"""Register a known record type in KNOWN_CLASSES.
Args:
record_class (UpdateRecord): An update record subclass.
"""
record_type = record_class.MatchType()
if record_type not in UpdateRecord.KNOWN_CLASSES:
Update... | [
"def",
"RegisterRecordType",
"(",
"cls",
",",
"record_class",
")",
":",
"record_type",
"=",
"record_class",
".",
"MatchType",
"(",
")",
"if",
"record_type",
"not",
"in",
"UpdateRecord",
".",
"KNOWN_CLASSES",
":",
"UpdateRecord",
".",
"KNOWN_CLASSES",
"[",
"recor... | Register a known record type in KNOWN_CLASSES.
Args:
record_class (UpdateRecord): An update record subclass. | [
"Register",
"a",
"known",
"record",
"type",
"in",
"KNOWN_CLASSES",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/update/record.py#L131-L142 | train |
iotile/coretools | iotilesensorgraph/iotile/sg/parser/scopes/root_scope.py | RootScope._setup | def _setup(self):
"""Prepare for code generation by setting up root clock nodes.
These nodes are subsequently used as the basis for all clock operations.
"""
# Create a root system ticks and user configurable ticks
systick = self.allocator.allocate_stream(DataStream.CounterType... | python | def _setup(self):
"""Prepare for code generation by setting up root clock nodes.
These nodes are subsequently used as the basis for all clock operations.
"""
# Create a root system ticks and user configurable ticks
systick = self.allocator.allocate_stream(DataStream.CounterType... | [
"def",
"_setup",
"(",
"self",
")",
":",
"systick",
"=",
"self",
".",
"allocator",
".",
"allocate_stream",
"(",
"DataStream",
".",
"CounterType",
",",
"attach",
"=",
"True",
")",
"fasttick",
"=",
"self",
".",
"allocator",
".",
"allocate_stream",
"(",
"DataS... | Prepare for code generation by setting up root clock nodes.
These nodes are subsequently used as the basis for all clock operations. | [
"Prepare",
"for",
"code",
"generation",
"by",
"setting",
"up",
"root",
"clock",
"nodes",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/parser/scopes/root_scope.py#L30-L51 | train |
iotile/coretools | iotilecore/iotile/core/hw/proxy/external_proxy.py | find_proxy_plugin | def find_proxy_plugin(component, plugin_name):
""" Attempt to find a proxy plugin provided by a specific component
Args:
component (string): The name of the component that provides the plugin
plugin_name (string): The name of the plugin to load
Returns:
TileBuxProxyPlugin: The plug... | python | def find_proxy_plugin(component, plugin_name):
""" Attempt to find a proxy plugin provided by a specific component
Args:
component (string): The name of the component that provides the plugin
plugin_name (string): The name of the plugin to load
Returns:
TileBuxProxyPlugin: The plug... | [
"def",
"find_proxy_plugin",
"(",
"component",
",",
"plugin_name",
")",
":",
"reg",
"=",
"ComponentRegistry",
"(",
")",
"plugins",
"=",
"reg",
".",
"load_extensions",
"(",
"'iotile.proxy_plugin'",
",",
"comp_filter",
"=",
"component",
",",
"class_filter",
"=",
"T... | Attempt to find a proxy plugin provided by a specific component
Args:
component (string): The name of the component that provides the plugin
plugin_name (string): The name of the plugin to load
Returns:
TileBuxProxyPlugin: The plugin, if found, otherwise raises DataError | [
"Attempt",
"to",
"find",
"a",
"proxy",
"plugin",
"provided",
"by",
"a",
"specific",
"component"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/proxy/external_proxy.py#L12-L33 | train |
iotile/coretools | iotilesensorgraph/iotile/sg/parser/statements/on_block.py | OnBlock._convert_trigger | def _convert_trigger(self, trigger_def, parent):
"""Convert a TriggerDefinition into a stream, trigger pair."""
if trigger_def.explicit_stream is None:
stream = parent.resolve_identifier(trigger_def.named_event, DataStream)
trigger = TrueTrigger()
else:
strea... | python | def _convert_trigger(self, trigger_def, parent):
"""Convert a TriggerDefinition into a stream, trigger pair."""
if trigger_def.explicit_stream is None:
stream = parent.resolve_identifier(trigger_def.named_event, DataStream)
trigger = TrueTrigger()
else:
strea... | [
"def",
"_convert_trigger",
"(",
"self",
",",
"trigger_def",
",",
"parent",
")",
":",
"if",
"trigger_def",
".",
"explicit_stream",
"is",
"None",
":",
"stream",
"=",
"parent",
".",
"resolve_identifier",
"(",
"trigger_def",
".",
"named_event",
",",
"DataStream",
... | Convert a TriggerDefinition into a stream, trigger pair. | [
"Convert",
"a",
"TriggerDefinition",
"into",
"a",
"stream",
"trigger",
"pair",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/parser/statements/on_block.py#L46-L56 | train |
iotile/coretools | iotilesensorgraph/iotile/sg/parser/statements/on_block.py | OnBlock._parse_trigger | def _parse_trigger(self, trigger_clause):
"""Parse a named event or explicit stream trigger into a TriggerDefinition."""
cond = trigger_clause[0]
named_event = None
explicit_stream = None
explicit_trigger = None
# Identifier parse tree is Group(Identifier)
if c... | python | def _parse_trigger(self, trigger_clause):
"""Parse a named event or explicit stream trigger into a TriggerDefinition."""
cond = trigger_clause[0]
named_event = None
explicit_stream = None
explicit_trigger = None
# Identifier parse tree is Group(Identifier)
if c... | [
"def",
"_parse_trigger",
"(",
"self",
",",
"trigger_clause",
")",
":",
"cond",
"=",
"trigger_clause",
"[",
"0",
"]",
"named_event",
"=",
"None",
"explicit_stream",
"=",
"None",
"explicit_trigger",
"=",
"None",
"if",
"cond",
".",
"getName",
"(",
")",
"==",
... | Parse a named event or explicit stream trigger into a TriggerDefinition. | [
"Parse",
"a",
"named",
"event",
"or",
"explicit",
"stream",
"trigger",
"into",
"a",
"TriggerDefinition",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/parser/statements/on_block.py#L58-L87 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Platform/__init__.py | platform_default | def platform_default():
"""Return the platform string for our execution environment.
The returned value should map to one of the SCons/Platform/*.py
files. Since we're architecture independent, though, we don't
care about the machine architecture.
"""
osname = os.name
if osname == 'java':
... | python | def platform_default():
"""Return the platform string for our execution environment.
The returned value should map to one of the SCons/Platform/*.py
files. Since we're architecture independent, though, we don't
care about the machine architecture.
"""
osname = os.name
if osname == 'java':
... | [
"def",
"platform_default",
"(",
")",
":",
"osname",
"=",
"os",
".",
"name",
"if",
"osname",
"==",
"'java'",
":",
"osname",
"=",
"os",
".",
"_osType",
"if",
"osname",
"==",
"'posix'",
":",
"if",
"sys",
".",
"platform",
"==",
"'cygwin'",
":",
"return",
... | Return the platform string for our execution environment.
The returned value should map to one of the SCons/Platform/*.py
files. Since we're architecture independent, though, we don't
care about the machine architecture. | [
"Return",
"the",
"platform",
"string",
"for",
"our",
"execution",
"environment",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Platform/__init__.py#L59-L87 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Platform/__init__.py | platform_module | def platform_module(name = platform_default()):
"""Return the imported module for the platform.
This looks for a module name that matches the specified argument.
If the name is unspecified, we fetch the appropriate default for
our execution environment.
"""
full_name = 'SCons.Platform.' + name
... | python | def platform_module(name = platform_default()):
"""Return the imported module for the platform.
This looks for a module name that matches the specified argument.
If the name is unspecified, we fetch the appropriate default for
our execution environment.
"""
full_name = 'SCons.Platform.' + name
... | [
"def",
"platform_module",
"(",
"name",
"=",
"platform_default",
"(",
")",
")",
":",
"full_name",
"=",
"'SCons.Platform.'",
"+",
"name",
"if",
"full_name",
"not",
"in",
"sys",
".",
"modules",
":",
"if",
"os",
".",
"name",
"==",
"'java'",
":",
"eval",
"(",... | Return the imported module for the platform.
This looks for a module name that matches the specified argument.
If the name is unspecified, we fetch the appropriate default for
our execution environment. | [
"Return",
"the",
"imported",
"module",
"for",
"the",
"platform",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Platform/__init__.py#L89-L117 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Platform/__init__.py | Platform | def Platform(name = platform_default()):
"""Select a canned Platform specification.
"""
module = platform_module(name)
spec = PlatformSpec(name, module.generate)
return spec | python | def Platform(name = platform_default()):
"""Select a canned Platform specification.
"""
module = platform_module(name)
spec = PlatformSpec(name, module.generate)
return spec | [
"def",
"Platform",
"(",
"name",
"=",
"platform_default",
"(",
")",
")",
":",
"module",
"=",
"platform_module",
"(",
"name",
")",
"spec",
"=",
"PlatformSpec",
"(",
"name",
",",
"module",
".",
"generate",
")",
"return",
"spec"
] | Select a canned Platform specification. | [
"Select",
"a",
"canned",
"Platform",
"specification",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Platform/__init__.py#L255-L260 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/jar.py | jarSources | def jarSources(target, source, env, for_signature):
"""Only include sources that are not a manifest file."""
try:
env['JARCHDIR']
except KeyError:
jarchdir_set = False
else:
jarchdir_set = True
jarchdir = env.subst('$JARCHDIR', target=target, source=source)
if jar... | python | def jarSources(target, source, env, for_signature):
"""Only include sources that are not a manifest file."""
try:
env['JARCHDIR']
except KeyError:
jarchdir_set = False
else:
jarchdir_set = True
jarchdir = env.subst('$JARCHDIR', target=target, source=source)
if jar... | [
"def",
"jarSources",
"(",
"target",
",",
"source",
",",
"env",
",",
"for_signature",
")",
":",
"try",
":",
"env",
"[",
"'JARCHDIR'",
"]",
"except",
"KeyError",
":",
"jarchdir_set",
"=",
"False",
"else",
":",
"jarchdir_set",
"=",
"True",
"jarchdir",
"=",
... | Only include sources that are not a manifest file. | [
"Only",
"include",
"sources",
"that",
"are",
"not",
"a",
"manifest",
"file",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/jar.py#L41-L70 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/jar.py | jarManifest | def jarManifest(target, source, env, for_signature):
"""Look in sources for a manifest file, if any."""
for src in source:
contents = src.get_text_contents()
if contents[:16] == "Manifest-Version":
return src
return '' | python | def jarManifest(target, source, env, for_signature):
"""Look in sources for a manifest file, if any."""
for src in source:
contents = src.get_text_contents()
if contents[:16] == "Manifest-Version":
return src
return '' | [
"def",
"jarManifest",
"(",
"target",
",",
"source",
",",
"env",
",",
"for_signature",
")",
":",
"for",
"src",
"in",
"source",
":",
"contents",
"=",
"src",
".",
"get_text_contents",
"(",
")",
"if",
"contents",
"[",
":",
"16",
"]",
"==",
"\"Manifest-Versio... | Look in sources for a manifest file, if any. | [
"Look",
"in",
"sources",
"for",
"a",
"manifest",
"file",
"if",
"any",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/jar.py#L72-L78 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/jar.py | jarFlags | def jarFlags(target, source, env, for_signature):
"""If we have a manifest, make sure that the 'm'
flag is specified."""
jarflags = env.subst('$JARFLAGS', target=target, source=source)
for src in source:
contents = src.get_text_contents()
if contents[:16] == "Manifest-Version":
... | python | def jarFlags(target, source, env, for_signature):
"""If we have a manifest, make sure that the 'm'
flag is specified."""
jarflags = env.subst('$JARFLAGS', target=target, source=source)
for src in source:
contents = src.get_text_contents()
if contents[:16] == "Manifest-Version":
... | [
"def",
"jarFlags",
"(",
"target",
",",
"source",
",",
"env",
",",
"for_signature",
")",
":",
"jarflags",
"=",
"env",
".",
"subst",
"(",
"'$JARFLAGS'",
",",
"target",
"=",
"target",
",",
"source",
"=",
"source",
")",
"for",
"src",
"in",
"source",
":",
... | If we have a manifest, make sure that the 'm'
flag is specified. | [
"If",
"we",
"have",
"a",
"manifest",
"make",
"sure",
"that",
"the",
"m",
"flag",
"is",
"specified",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/jar.py#L80-L90 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/jar.py | generate | def generate(env):
"""Add Builders and construction variables for jar to an Environment."""
SCons.Tool.CreateJarBuilder(env)
SCons.Tool.CreateJavaFileBuilder(env)
SCons.Tool.CreateJavaClassFileBuilder(env)
SCons.Tool.CreateJavaClassDirBuilder(env)
env.AddMethod(Jar)
env['JAR'] = 'j... | python | def generate(env):
"""Add Builders and construction variables for jar to an Environment."""
SCons.Tool.CreateJarBuilder(env)
SCons.Tool.CreateJavaFileBuilder(env)
SCons.Tool.CreateJavaClassFileBuilder(env)
SCons.Tool.CreateJavaClassDirBuilder(env)
env.AddMethod(Jar)
env['JAR'] = 'j... | [
"def",
"generate",
"(",
"env",
")",
":",
"SCons",
".",
"Tool",
".",
"CreateJarBuilder",
"(",
"env",
")",
"SCons",
".",
"Tool",
".",
"CreateJavaFileBuilder",
"(",
"env",
")",
"SCons",
".",
"Tool",
".",
"CreateJavaClassFileBuilder",
"(",
"env",
")",
"SCons",... | Add Builders and construction variables for jar to an Environment. | [
"Add",
"Builders",
"and",
"construction",
"variables",
"for",
"jar",
"to",
"an",
"Environment",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/jar.py#L199-L216 | train |
iotile/coretools | iotilesensorgraph/iotile/sg/sim/executor.py | RPCExecutor.mock | def mock(self, slot, rpc_id, value):
"""Store a mock return value for an RPC
Args:
slot (SlotIdentifier): The slot we are mocking
rpc_id (int): The rpc we are mocking
value (int): The value that should be returned
when the RPC is called.
"""
... | python | def mock(self, slot, rpc_id, value):
"""Store a mock return value for an RPC
Args:
slot (SlotIdentifier): The slot we are mocking
rpc_id (int): The rpc we are mocking
value (int): The value that should be returned
when the RPC is called.
"""
... | [
"def",
"mock",
"(",
"self",
",",
"slot",
",",
"rpc_id",
",",
"value",
")",
":",
"address",
"=",
"slot",
".",
"address",
"if",
"address",
"not",
"in",
"self",
".",
"mock_rpcs",
":",
"self",
".",
"mock_rpcs",
"[",
"address",
"]",
"=",
"{",
"}",
"self... | Store a mock return value for an RPC
Args:
slot (SlotIdentifier): The slot we are mocking
rpc_id (int): The rpc we are mocking
value (int): The value that should be returned
when the RPC is called. | [
"Store",
"a",
"mock",
"return",
"value",
"for",
"an",
"RPC"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/sim/executor.py#L21-L36 | train |
iotile/coretools | iotilesensorgraph/iotile/sg/sim/executor.py | RPCExecutor.rpc | def rpc(self, address, rpc_id):
"""Call an RPC and receive the result as an integer.
If the RPC does not properly return a 32 bit integer, raise a warning
unless it cannot be converted into an integer at all, in which case
a HardwareError is thrown.
Args:
address (i... | python | def rpc(self, address, rpc_id):
"""Call an RPC and receive the result as an integer.
If the RPC does not properly return a 32 bit integer, raise a warning
unless it cannot be converted into an integer at all, in which case
a HardwareError is thrown.
Args:
address (i... | [
"def",
"rpc",
"(",
"self",
",",
"address",
",",
"rpc_id",
")",
":",
"if",
"address",
"in",
"self",
".",
"mock_rpcs",
"and",
"rpc_id",
"in",
"self",
".",
"mock_rpcs",
"[",
"address",
"]",
":",
"value",
"=",
"self",
".",
"mock_rpcs",
"[",
"address",
"]... | Call an RPC and receive the result as an integer.
If the RPC does not properly return a 32 bit integer, raise a warning
unless it cannot be converted into an integer at all, in which case
a HardwareError is thrown.
Args:
address (int): The address of the tile we want to cal... | [
"Call",
"an",
"RPC",
"and",
"receive",
"the",
"result",
"as",
"an",
"integer",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/sim/executor.py#L49-L83 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/swig.py | _get_swig_version | def _get_swig_version(env, swig):
"""Run the SWIG command line tool to get and return the version number"""
swig = env.subst(swig)
pipe = SCons.Action._subproc(env, SCons.Util.CLVar(swig) + ['-version'],
stdin = 'devnull',
stderr = 'devnull',... | python | def _get_swig_version(env, swig):
"""Run the SWIG command line tool to get and return the version number"""
swig = env.subst(swig)
pipe = SCons.Action._subproc(env, SCons.Util.CLVar(swig) + ['-version'],
stdin = 'devnull',
stderr = 'devnull',... | [
"def",
"_get_swig_version",
"(",
"env",
",",
"swig",
")",
":",
"swig",
"=",
"env",
".",
"subst",
"(",
"swig",
")",
"pipe",
"=",
"SCons",
".",
"Action",
".",
"_subproc",
"(",
"env",
",",
"SCons",
".",
"Util",
".",
"CLVar",
"(",
"swig",
")",
"+",
"... | Run the SWIG command line tool to get and return the version number | [
"Run",
"the",
"SWIG",
"command",
"line",
"tool",
"to",
"get",
"and",
"return",
"the",
"version",
"number"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/swig.py#L134-L150 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/swig.py | generate | def generate(env):
"""Add Builders and construction variables for swig to an Environment."""
c_file, cxx_file = SCons.Tool.createCFileBuilders(env)
c_file.suffix['.i'] = swigSuffixEmitter
cxx_file.suffix['.i'] = swigSuffixEmitter
c_file.add_action('.i', SwigAction)
c_file.add_emitter('.i', _sw... | python | def generate(env):
"""Add Builders and construction variables for swig to an Environment."""
c_file, cxx_file = SCons.Tool.createCFileBuilders(env)
c_file.suffix['.i'] = swigSuffixEmitter
cxx_file.suffix['.i'] = swigSuffixEmitter
c_file.add_action('.i', SwigAction)
c_file.add_emitter('.i', _sw... | [
"def",
"generate",
"(",
"env",
")",
":",
"c_file",
",",
"cxx_file",
"=",
"SCons",
".",
"Tool",
".",
"createCFileBuilders",
"(",
"env",
")",
"c_file",
".",
"suffix",
"[",
"'.i'",
"]",
"=",
"swigSuffixEmitter",
"cxx_file",
".",
"suffix",
"[",
"'.i'",
"]",
... | Add Builders and construction variables for swig to an Environment. | [
"Add",
"Builders",
"and",
"construction",
"variables",
"for",
"swig",
"to",
"an",
"Environment",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/swig.py#L152-L183 | train |
iotile/coretools | transport_plugins/jlink/iotile_transport_jlink/multiplexers.py | _select_ftdi_channel | def _select_ftdi_channel(channel):
"""Select multiplexer channel. Currently uses a FTDI chip via pylibftdi"""
if channel < 0 or channel > 8:
raise ArgumentError("FTDI-selected multiplexer only has channels 0-7 valid, "
"make sure you specify channel with -c channel=number", c... | python | def _select_ftdi_channel(channel):
"""Select multiplexer channel. Currently uses a FTDI chip via pylibftdi"""
if channel < 0 or channel > 8:
raise ArgumentError("FTDI-selected multiplexer only has channels 0-7 valid, "
"make sure you specify channel with -c channel=number", c... | [
"def",
"_select_ftdi_channel",
"(",
"channel",
")",
":",
"if",
"channel",
"<",
"0",
"or",
"channel",
">",
"8",
":",
"raise",
"ArgumentError",
"(",
"\"FTDI-selected multiplexer only has channels 0-7 valid, \"",
"\"make sure you specify channel with -c channel=number\"",
",",
... | Select multiplexer channel. Currently uses a FTDI chip via pylibftdi | [
"Select",
"multiplexer",
"channel",
".",
"Currently",
"uses",
"a",
"FTDI",
"chip",
"via",
"pylibftdi"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/jlink/iotile_transport_jlink/multiplexers.py#L5-L13 | train |
iotile/coretools | iotilesensorgraph/iotile/sg/streamer_descriptor.py | parse_binary_descriptor | def parse_binary_descriptor(bindata, sensor_log=None):
"""Convert a binary streamer descriptor into a string descriptor.
Binary streamer descriptors are 20-byte binary structures that encode all
information needed to create a streamer. They are used to communicate
that information to an embedded devic... | python | def parse_binary_descriptor(bindata, sensor_log=None):
"""Convert a binary streamer descriptor into a string descriptor.
Binary streamer descriptors are 20-byte binary structures that encode all
information needed to create a streamer. They are used to communicate
that information to an embedded devic... | [
"def",
"parse_binary_descriptor",
"(",
"bindata",
",",
"sensor_log",
"=",
"None",
")",
":",
"if",
"len",
"(",
"bindata",
")",
"!=",
"14",
":",
"raise",
"ArgumentError",
"(",
"\"Invalid length of binary data in streamer descriptor\"",
",",
"length",
"=",
"len",
"("... | Convert a binary streamer descriptor into a string descriptor.
Binary streamer descriptors are 20-byte binary structures that encode all
information needed to create a streamer. They are used to communicate
that information to an embedded device in an efficent format. This
function exists to turn suc... | [
"Convert",
"a",
"binary",
"streamer",
"descriptor",
"into",
"a",
"string",
"descriptor",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/streamer_descriptor.py#L16-L65 | train |
iotile/coretools | iotilesensorgraph/iotile/sg/streamer_descriptor.py | create_binary_descriptor | def create_binary_descriptor(streamer):
"""Create a packed binary descriptor of a DataStreamer object.
Args:
streamer (DataStreamer): The streamer to create a packed descriptor for
Returns:
bytes: A packed 14-byte streamer descriptor.
"""
trigger = 0
if streamer.automatic:
... | python | def create_binary_descriptor(streamer):
"""Create a packed binary descriptor of a DataStreamer object.
Args:
streamer (DataStreamer): The streamer to create a packed descriptor for
Returns:
bytes: A packed 14-byte streamer descriptor.
"""
trigger = 0
if streamer.automatic:
... | [
"def",
"create_binary_descriptor",
"(",
"streamer",
")",
":",
"trigger",
"=",
"0",
"if",
"streamer",
".",
"automatic",
":",
"trigger",
"=",
"1",
"elif",
"streamer",
".",
"with_other",
"is",
"not",
"None",
":",
"trigger",
"=",
"(",
"1",
"<<",
"7",
")",
... | Create a packed binary descriptor of a DataStreamer object.
Args:
streamer (DataStreamer): The streamer to create a packed descriptor for
Returns:
bytes: A packed 14-byte streamer descriptor. | [
"Create",
"a",
"packed",
"binary",
"descriptor",
"of",
"a",
"DataStreamer",
"object",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/streamer_descriptor.py#L68-L84 | train |
iotile/coretools | iotilesensorgraph/iotile/sg/streamer_descriptor.py | parse_string_descriptor | def parse_string_descriptor(string_desc):
"""Parse a string descriptor of a streamer into a DataStreamer object.
Args:
string_desc (str): The string descriptor that we wish to parse.
Returns:
DataStreamer: A DataStreamer object representing the streamer.
"""
if not isinstance(stri... | python | def parse_string_descriptor(string_desc):
"""Parse a string descriptor of a streamer into a DataStreamer object.
Args:
string_desc (str): The string descriptor that we wish to parse.
Returns:
DataStreamer: A DataStreamer object representing the streamer.
"""
if not isinstance(stri... | [
"def",
"parse_string_descriptor",
"(",
"string_desc",
")",
":",
"if",
"not",
"isinstance",
"(",
"string_desc",
",",
"str",
")",
":",
"string_desc",
"=",
"str",
"(",
"string_desc",
")",
"if",
"not",
"string_desc",
".",
"endswith",
"(",
"';'",
")",
":",
"str... | Parse a string descriptor of a streamer into a DataStreamer object.
Args:
string_desc (str): The string descriptor that we wish to parse.
Returns:
DataStreamer: A DataStreamer object representing the streamer. | [
"Parse",
"a",
"string",
"descriptor",
"of",
"a",
"streamer",
"into",
"a",
"DataStreamer",
"object",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/streamer_descriptor.py#L87-L142 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/applelink.py | generate | def generate(env):
"""Add Builders and construction variables for applelink to an
Environment."""
link.generate(env)
env['FRAMEWORKPATHPREFIX'] = '-F'
env['_FRAMEWORKPATH'] = '${_concat(FRAMEWORKPATHPREFIX, FRAMEWORKPATH, "", __env__)}'
env['_FRAMEWORKS'] = '${_concat("-framework ", FRAMEWORKS,... | python | def generate(env):
"""Add Builders and construction variables for applelink to an
Environment."""
link.generate(env)
env['FRAMEWORKPATHPREFIX'] = '-F'
env['_FRAMEWORKPATH'] = '${_concat(FRAMEWORKPATHPREFIX, FRAMEWORKPATH, "", __env__)}'
env['_FRAMEWORKS'] = '${_concat("-framework ", FRAMEWORKS,... | [
"def",
"generate",
"(",
"env",
")",
":",
"link",
".",
"generate",
"(",
"env",
")",
"env",
"[",
"'FRAMEWORKPATHPREFIX'",
"]",
"=",
"'-F'",
"env",
"[",
"'_FRAMEWORKPATH'",
"]",
"=",
"'${_concat(FRAMEWORKPATHPREFIX, FRAMEWORKPATH, \"\", __env__)}'",
"env",
"[",
"'_FR... | Add Builders and construction variables for applelink to an
Environment. | [
"Add",
"Builders",
"and",
"construction",
"variables",
"for",
"applelink",
"to",
"an",
"Environment",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/applelink.py#L42-L68 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/msvs.py | _generateGUID | def _generateGUID(slnfile, name):
"""This generates a dummy GUID for the sln file to use. It is
based on the MD5 signatures of the sln filename plus the name of
the project. It basically just needs to be unique, and not
change with each invocation."""
m = hashlib.md5()
# Normalize the slnfile ... | python | def _generateGUID(slnfile, name):
"""This generates a dummy GUID for the sln file to use. It is
based on the MD5 signatures of the sln filename plus the name of
the project. It basically just needs to be unique, and not
change with each invocation."""
m = hashlib.md5()
# Normalize the slnfile ... | [
"def",
"_generateGUID",
"(",
"slnfile",
",",
"name",
")",
":",
"m",
"=",
"hashlib",
".",
"md5",
"(",
")",
"m",
".",
"update",
"(",
"bytearray",
"(",
"ntpath",
".",
"normpath",
"(",
"str",
"(",
"slnfile",
")",
")",
"+",
"str",
"(",
"name",
")",
",... | This generates a dummy GUID for the sln file to use. It is
based on the MD5 signatures of the sln filename plus the name of
the project. It basically just needs to be unique, and not
change with each invocation. | [
"This",
"generates",
"a",
"dummy",
"GUID",
"for",
"the",
"sln",
"file",
"to",
"use",
".",
"It",
"is",
"based",
"on",
"the",
"MD5",
"signatures",
"of",
"the",
"sln",
"filename",
"plus",
"the",
"name",
"of",
"the",
"project",
".",
"It",
"basically",
"jus... | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/msvs.py#L80-L93 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/msvs.py | makeHierarchy | def makeHierarchy(sources):
'''Break a list of files into a hierarchy; for each value, if it is a string,
then it is a file. If it is a dictionary, it is a folder. The string is
the original path of the file.'''
hierarchy = {}
for file in sources:
path = splitFully(file)
if ... | python | def makeHierarchy(sources):
'''Break a list of files into a hierarchy; for each value, if it is a string,
then it is a file. If it is a dictionary, it is a folder. The string is
the original path of the file.'''
hierarchy = {}
for file in sources:
path = splitFully(file)
if ... | [
"def",
"makeHierarchy",
"(",
"sources",
")",
":",
"hierarchy",
"=",
"{",
"}",
"for",
"file",
"in",
"sources",
":",
"path",
"=",
"splitFully",
"(",
"file",
")",
"if",
"len",
"(",
"path",
")",
":",
"dict",
"=",
"hierarchy",
"for",
"part",
"in",
"path",... | Break a list of files into a hierarchy; for each value, if it is a string,
then it is a file. If it is a dictionary, it is a folder. The string is
the original path of the file. | [
"Break",
"a",
"list",
"of",
"files",
"into",
"a",
"hierarchy",
";",
"for",
"each",
"value",
"if",
"it",
"is",
"a",
"string",
"then",
"it",
"is",
"a",
"file",
".",
"If",
"it",
"is",
"a",
"dictionary",
"it",
"is",
"a",
"folder",
".",
"The",
"string",... | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/msvs.py#L150-L167 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/msvs.py | GenerateDSP | def GenerateDSP(dspfile, source, env):
"""Generates a Project file based on the version of MSVS that is being used"""
version_num = 6.0
if 'MSVS_VERSION' in env:
version_num, suite = msvs_parse_version(env['MSVS_VERSION'])
if version_num >= 10.0:
g = _GenerateV10DSP(dspfile, source, env... | python | def GenerateDSP(dspfile, source, env):
"""Generates a Project file based on the version of MSVS that is being used"""
version_num = 6.0
if 'MSVS_VERSION' in env:
version_num, suite = msvs_parse_version(env['MSVS_VERSION'])
if version_num >= 10.0:
g = _GenerateV10DSP(dspfile, source, env... | [
"def",
"GenerateDSP",
"(",
"dspfile",
",",
"source",
",",
"env",
")",
":",
"version_num",
"=",
"6.0",
"if",
"'MSVS_VERSION'",
"in",
"env",
":",
"version_num",
",",
"suite",
"=",
"msvs_parse_version",
"(",
"env",
"[",
"'MSVS_VERSION'",
"]",
")",
"if",
"vers... | Generates a Project file based on the version of MSVS that is being used | [
"Generates",
"a",
"Project",
"file",
"based",
"on",
"the",
"version",
"of",
"MSVS",
"that",
"is",
"being",
"used"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/msvs.py#L1675-L1689 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/msvs.py | solutionEmitter | def solutionEmitter(target, source, env):
"""Sets up the DSW dependencies."""
# todo: Not sure what sets source to what user has passed as target,
# but this is what happens. When that is fixed, we also won't have
# to make the user always append env['MSVSSOLUTIONSUFFIX'] to target.
if source[0] ==... | python | def solutionEmitter(target, source, env):
"""Sets up the DSW dependencies."""
# todo: Not sure what sets source to what user has passed as target,
# but this is what happens. When that is fixed, we also won't have
# to make the user always append env['MSVSSOLUTIONSUFFIX'] to target.
if source[0] ==... | [
"def",
"solutionEmitter",
"(",
"target",
",",
"source",
",",
"env",
")",
":",
"if",
"source",
"[",
"0",
"]",
"==",
"target",
"[",
"0",
"]",
":",
"source",
"=",
"[",
"]",
"(",
"base",
",",
"suff",
")",
"=",
"SCons",
".",
"Util",
".",
"splitext",
... | Sets up the DSW dependencies. | [
"Sets",
"up",
"the",
"DSW",
"dependencies",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/msvs.py#L1858-L1912 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/msvs.py | generate | def generate(env):
"""Add Builders and construction variables for Microsoft Visual
Studio project files to an Environment."""
try:
env['BUILDERS']['MSVSProject']
except KeyError:
env['BUILDERS']['MSVSProject'] = projectBuilder
try:
env['BUILDERS']['MSVSSolution']
except ... | python | def generate(env):
"""Add Builders and construction variables for Microsoft Visual
Studio project files to an Environment."""
try:
env['BUILDERS']['MSVSProject']
except KeyError:
env['BUILDERS']['MSVSProject'] = projectBuilder
try:
env['BUILDERS']['MSVSSolution']
except ... | [
"def",
"generate",
"(",
"env",
")",
":",
"try",
":",
"env",
"[",
"'BUILDERS'",
"]",
"[",
"'MSVSProject'",
"]",
"except",
"KeyError",
":",
"env",
"[",
"'BUILDERS'",
"]",
"[",
"'MSVSProject'",
"]",
"=",
"projectBuilder",
"try",
":",
"env",
"[",
"'BUILDERS'... | Add Builders and construction variables for Microsoft Visual
Studio project files to an Environment. | [
"Add",
"Builders",
"and",
"construction",
"variables",
"for",
"Microsoft",
"Visual",
"Studio",
"project",
"files",
"to",
"an",
"Environment",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/msvs.py#L1928-L1989 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/msvs.py | _GenerateV6DSW.PrintWorkspace | def PrintWorkspace(self):
""" writes a DSW file """
name = self.name
dspfile = os.path.relpath(self.dspfiles[0], self.dsw_folder_path)
self.file.write(V6DSWHeader % locals()) | python | def PrintWorkspace(self):
""" writes a DSW file """
name = self.name
dspfile = os.path.relpath(self.dspfiles[0], self.dsw_folder_path)
self.file.write(V6DSWHeader % locals()) | [
"def",
"PrintWorkspace",
"(",
"self",
")",
":",
"name",
"=",
"self",
".",
"name",
"dspfile",
"=",
"os",
".",
"path",
".",
"relpath",
"(",
"self",
".",
"dspfiles",
"[",
"0",
"]",
",",
"self",
".",
"dsw_folder_path",
")",
"self",
".",
"file",
".",
"w... | writes a DSW file | [
"writes",
"a",
"DSW",
"file"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/msvs.py#L1659-L1663 | train |
iotile/coretools | iotilecore/iotile/core/utilities/async_tools/operation_manager.py | OperationManager.waiters | def waiters(self, path=None):
"""Iterate over all waiters.
This method will return the waiters in unspecified order
including the future or callback object that will be invoked
and a list containing the keys/value that are being matched.
Yields:
list, future or call... | python | def waiters(self, path=None):
"""Iterate over all waiters.
This method will return the waiters in unspecified order
including the future or callback object that will be invoked
and a list containing the keys/value that are being matched.
Yields:
list, future or call... | [
"def",
"waiters",
"(",
"self",
",",
"path",
"=",
"None",
")",
":",
"context",
"=",
"self",
".",
"_waiters",
"if",
"path",
"is",
"None",
":",
"path",
"=",
"[",
"]",
"for",
"key",
"in",
"path",
":",
"context",
"=",
"context",
"[",
"key",
"]",
"if",... | Iterate over all waiters.
This method will return the waiters in unspecified order
including the future or callback object that will be invoked
and a list containing the keys/value that are being matched.
Yields:
list, future or callable | [
"Iterate",
"over",
"all",
"waiters",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/utilities/async_tools/operation_manager.py#L138-L165 | train |
iotile/coretools | iotilecore/iotile/core/utilities/async_tools/operation_manager.py | OperationManager.every_match | def every_match(self, callback, **kwargs):
"""Invoke callback every time a matching message is received.
The callback will be invoked directly inside process_message so that
you can guarantee that it has been called by the time process_message
has returned.
The callback can be ... | python | def every_match(self, callback, **kwargs):
"""Invoke callback every time a matching message is received.
The callback will be invoked directly inside process_message so that
you can guarantee that it has been called by the time process_message
has returned.
The callback can be ... | [
"def",
"every_match",
"(",
"self",
",",
"callback",
",",
"**",
"kwargs",
")",
":",
"if",
"len",
"(",
"kwargs",
")",
"==",
"0",
":",
"raise",
"ArgumentError",
"(",
"\"You must specify at least one message field to wait on\"",
")",
"spec",
"=",
"MessageSpec",
"(",... | Invoke callback every time a matching message is received.
The callback will be invoked directly inside process_message so that
you can guarantee that it has been called by the time process_message
has returned.
The callback can be removed by a call to remove_waiter(), passing the
... | [
"Invoke",
"callback",
"every",
"time",
"a",
"matching",
"message",
"is",
"received",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/utilities/async_tools/operation_manager.py#L167-L194 | train |
iotile/coretools | iotilecore/iotile/core/utilities/async_tools/operation_manager.py | OperationManager.remove_waiter | def remove_waiter(self, waiter_handle):
"""Remove a message callback.
This call will remove a callback previously registered using
every_match.
Args:
waiter_handle (object): The opaque handle returned by the
previous call to every_match().
"""
... | python | def remove_waiter(self, waiter_handle):
"""Remove a message callback.
This call will remove a callback previously registered using
every_match.
Args:
waiter_handle (object): The opaque handle returned by the
previous call to every_match().
"""
... | [
"def",
"remove_waiter",
"(",
"self",
",",
"waiter_handle",
")",
":",
"spec",
",",
"waiter",
"=",
"waiter_handle",
"self",
".",
"_remove_waiter",
"(",
"spec",
",",
"waiter",
")"
] | Remove a message callback.
This call will remove a callback previously registered using
every_match.
Args:
waiter_handle (object): The opaque handle returned by the
previous call to every_match(). | [
"Remove",
"a",
"message",
"callback",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/utilities/async_tools/operation_manager.py#L202-L214 | train |
iotile/coretools | iotilecore/iotile/core/utilities/async_tools/operation_manager.py | OperationManager.clear | def clear(self):
"""Clear all waiters.
This method will remove any current scheduled waiter with an
asyncio.CancelledError exception.
"""
for _, waiter in self.waiters():
if isinstance(waiter, asyncio.Future) and not waiter.done():
waiter.set_excepti... | python | def clear(self):
"""Clear all waiters.
This method will remove any current scheduled waiter with an
asyncio.CancelledError exception.
"""
for _, waiter in self.waiters():
if isinstance(waiter, asyncio.Future) and not waiter.done():
waiter.set_excepti... | [
"def",
"clear",
"(",
"self",
")",
":",
"for",
"_",
",",
"waiter",
"in",
"self",
".",
"waiters",
"(",
")",
":",
"if",
"isinstance",
"(",
"waiter",
",",
"asyncio",
".",
"Future",
")",
"and",
"not",
"waiter",
".",
"done",
"(",
")",
":",
"waiter",
".... | Clear all waiters.
This method will remove any current scheduled waiter with an
asyncio.CancelledError exception. | [
"Clear",
"all",
"waiters",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/utilities/async_tools/operation_manager.py#L216-L227 | train |
iotile/coretools | iotilecore/iotile/core/utilities/async_tools/operation_manager.py | OperationManager.wait_for | def wait_for(self, timeout=None, **kwargs):
"""Wait for a specific matching message or timeout.
You specify the message by passing name=value keyword arguments to
this method. The first message received after this function has been
called that has all of the given keys with the given v... | python | def wait_for(self, timeout=None, **kwargs):
"""Wait for a specific matching message or timeout.
You specify the message by passing name=value keyword arguments to
this method. The first message received after this function has been
called that has all of the given keys with the given v... | [
"def",
"wait_for",
"(",
"self",
",",
"timeout",
"=",
"None",
",",
"**",
"kwargs",
")",
":",
"if",
"len",
"(",
"kwargs",
")",
"==",
"0",
":",
"raise",
"ArgumentError",
"(",
"\"You must specify at least one message field to wait on\"",
")",
"spec",
"=",
"Message... | Wait for a specific matching message or timeout.
You specify the message by passing name=value keyword arguments to
this method. The first message received after this function has been
called that has all of the given keys with the given values will be
returned when this function is aw... | [
"Wait",
"for",
"a",
"specific",
"matching",
"message",
"or",
"timeout",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/utilities/async_tools/operation_manager.py#L229-L260 | train |
iotile/coretools | iotilecore/iotile/core/utilities/async_tools/operation_manager.py | OperationManager.process_message | async def process_message(self, message, wait=True):
"""Process a message to see if it wakes any waiters.
This will check waiters registered to see if they match the given
message. If so, they are awoken and passed the message. All matching
waiters will be woken.
This method ... | python | async def process_message(self, message, wait=True):
"""Process a message to see if it wakes any waiters.
This will check waiters registered to see if they match the given
message. If so, they are awoken and passed the message. All matching
waiters will be woken.
This method ... | [
"async",
"def",
"process_message",
"(",
"self",
",",
"message",
",",
"wait",
"=",
"True",
")",
":",
"to_check",
"=",
"deque",
"(",
"[",
"self",
".",
"_waiters",
"]",
")",
"ignored",
"=",
"True",
"while",
"len",
"(",
"to_check",
")",
">",
"0",
":",
... | Process a message to see if it wakes any waiters.
This will check waiters registered to see if they match the given
message. If so, they are awoken and passed the message. All matching
waiters will be woken.
This method returns False if the message matched no waiters so it was
... | [
"Process",
"a",
"message",
"to",
"see",
"if",
"it",
"wakes",
"any",
"waiters",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/utilities/async_tools/operation_manager.py#L262-L319 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/zip.py | generate | def generate(env):
"""Add Builders and construction variables for zip to an Environment."""
try:
bld = env['BUILDERS']['Zip']
except KeyError:
bld = ZipBuilder
env['BUILDERS']['Zip'] = bld
env['ZIP'] = 'zip'
env['ZIPFLAGS'] = SCons.Util.CLVar('')
env['ZIPCOM'] ... | python | def generate(env):
"""Add Builders and construction variables for zip to an Environment."""
try:
bld = env['BUILDERS']['Zip']
except KeyError:
bld = ZipBuilder
env['BUILDERS']['Zip'] = bld
env['ZIP'] = 'zip'
env['ZIPFLAGS'] = SCons.Util.CLVar('')
env['ZIPCOM'] ... | [
"def",
"generate",
"(",
"env",
")",
":",
"try",
":",
"bld",
"=",
"env",
"[",
"'BUILDERS'",
"]",
"[",
"'Zip'",
"]",
"except",
"KeyError",
":",
"bld",
"=",
"ZipBuilder",
"env",
"[",
"'BUILDERS'",
"]",
"[",
"'Zip'",
"]",
"=",
"bld",
"env",
"[",
"'ZIP'... | Add Builders and construction variables for zip to an Environment. | [
"Add",
"Builders",
"and",
"construction",
"variables",
"for",
"zip",
"to",
"an",
"Environment",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/zip.py#L70-L83 | train |
iotile/coretools | iotilecore/iotile/core/scripts/virtualdev_script.py | one_line_desc | def one_line_desc(obj):
"""Get a one line description of a class."""
logger = logging.getLogger(__name__)
try:
doc = ParsedDocstring(obj.__doc__)
return doc.short_desc
except: # pylint:disable=bare-except; We don't want a misbehaving exception to break the program
logger.warni... | python | def one_line_desc(obj):
"""Get a one line description of a class."""
logger = logging.getLogger(__name__)
try:
doc = ParsedDocstring(obj.__doc__)
return doc.short_desc
except: # pylint:disable=bare-except; We don't want a misbehaving exception to break the program
logger.warni... | [
"def",
"one_line_desc",
"(",
"obj",
")",
":",
"logger",
"=",
"logging",
".",
"getLogger",
"(",
"__name__",
")",
"try",
":",
"doc",
"=",
"ParsedDocstring",
"(",
"obj",
".",
"__doc__",
")",
"return",
"doc",
".",
"short_desc",
"except",
":",
"logger",
".",
... | Get a one line description of a class. | [
"Get",
"a",
"one",
"line",
"description",
"of",
"a",
"class",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/scripts/virtualdev_script.py#L16-L26 | train |
iotile/coretools | iotilecore/iotile/core/scripts/virtualdev_script.py | instantiate_device | def instantiate_device(virtual_dev, config, loop):
"""Find a virtual device by name and instantiate it
Args:
virtual_dev (string): The name of the pkg_resources entry point corresponding to
the device. It should be in group iotile.virtual_device. If virtual_dev ends
in .py, it... | python | def instantiate_device(virtual_dev, config, loop):
"""Find a virtual device by name and instantiate it
Args:
virtual_dev (string): The name of the pkg_resources entry point corresponding to
the device. It should be in group iotile.virtual_device. If virtual_dev ends
in .py, it... | [
"def",
"instantiate_device",
"(",
"virtual_dev",
",",
"config",
",",
"loop",
")",
":",
"conf",
"=",
"{",
"}",
"if",
"'device'",
"in",
"config",
":",
"conf",
"=",
"config",
"[",
"'device'",
"]",
"try",
":",
"reg",
"=",
"ComponentRegistry",
"(",
")",
"if... | Find a virtual device by name and instantiate it
Args:
virtual_dev (string): The name of the pkg_resources entry point corresponding to
the device. It should be in group iotile.virtual_device. If virtual_dev ends
in .py, it is interpreted as a python script and loaded directly fro... | [
"Find",
"a",
"virtual",
"device",
"by",
"name",
"and",
"instantiate",
"it"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/scripts/virtualdev_script.py#L165-L196 | train |
iotile/coretools | iotilecore/iotile/core/scripts/virtualdev_script.py | instantiate_interface | def instantiate_interface(virtual_iface, config, loop):
"""Find a virtual interface by name and instantiate it
Args:
virtual_iface (string): The name of the pkg_resources entry point corresponding to
the interface. It should be in group iotile.virtual_interface
config (dict): A dic... | python | def instantiate_interface(virtual_iface, config, loop):
"""Find a virtual interface by name and instantiate it
Args:
virtual_iface (string): The name of the pkg_resources entry point corresponding to
the interface. It should be in group iotile.virtual_interface
config (dict): A dic... | [
"def",
"instantiate_interface",
"(",
"virtual_iface",
",",
"config",
",",
"loop",
")",
":",
"if",
"virtual_iface",
"==",
"'null'",
":",
"return",
"StandardDeviceServer",
"(",
"None",
",",
"{",
"}",
",",
"loop",
"=",
"loop",
")",
"conf",
"=",
"{",
"}",
"i... | Find a virtual interface by name and instantiate it
Args:
virtual_iface (string): The name of the pkg_resources entry point corresponding to
the interface. It should be in group iotile.virtual_interface
config (dict): A dictionary with a 'interface' key with the config info for configu... | [
"Find",
"a",
"virtual",
"interface",
"by",
"name",
"and",
"instantiate",
"it"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/scripts/virtualdev_script.py#L199-L231 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/tar.py | generate | def generate(env):
"""Add Builders and construction variables for tar to an Environment."""
try:
bld = env['BUILDERS']['Tar']
except KeyError:
bld = TarBuilder
env['BUILDERS']['Tar'] = bld
env['TAR'] = env.Detect(tars) or 'gtar'
env['TARFLAGS'] = SCons.Util.CLVar('-... | python | def generate(env):
"""Add Builders and construction variables for tar to an Environment."""
try:
bld = env['BUILDERS']['Tar']
except KeyError:
bld = TarBuilder
env['BUILDERS']['Tar'] = bld
env['TAR'] = env.Detect(tars) or 'gtar'
env['TARFLAGS'] = SCons.Util.CLVar('-... | [
"def",
"generate",
"(",
"env",
")",
":",
"try",
":",
"bld",
"=",
"env",
"[",
"'BUILDERS'",
"]",
"[",
"'Tar'",
"]",
"except",
"KeyError",
":",
"bld",
"=",
"TarBuilder",
"env",
"[",
"'BUILDERS'",
"]",
"[",
"'Tar'",
"]",
"=",
"bld",
"env",
"[",
"'TAR'... | Add Builders and construction variables for tar to an Environment. | [
"Add",
"Builders",
"and",
"construction",
"variables",
"for",
"tar",
"to",
"an",
"Environment",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/tar.py#L53-L64 | train |
iotile/coretools | transport_plugins/websocket/iotile_transport_websocket/generic/async_server.py | AsyncValidatingWSServer.register_command | def register_command(self, name, handler, validator):
"""Register a coroutine command handler.
This handler will be called whenever a command message is received
from the client, whose operation key matches ``name``. The handler
will be called as::
response_payload = await... | python | def register_command(self, name, handler, validator):
"""Register a coroutine command handler.
This handler will be called whenever a command message is received
from the client, whose operation key matches ``name``. The handler
will be called as::
response_payload = await... | [
"def",
"register_command",
"(",
"self",
",",
"name",
",",
"handler",
",",
"validator",
")",
":",
"self",
".",
"_commands",
"[",
"name",
"]",
"=",
"(",
"handler",
",",
"validator",
")"
] | Register a coroutine command handler.
This handler will be called whenever a command message is received
from the client, whose operation key matches ``name``. The handler
will be called as::
response_payload = await handler(cmd_payload, context)
If the coroutine returns,... | [
"Register",
"a",
"coroutine",
"command",
"handler",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/websocket/iotile_transport_websocket/generic/async_server.py#L95-L125 | train |
iotile/coretools | transport_plugins/websocket/iotile_transport_websocket/generic/async_server.py | AsyncValidatingWSServer.start | async def start(self):
"""Start the websocket server.
When this method returns, the websocket server will be running and
the port property of this class will have its assigned port number.
This method should be called only once in the lifetime of the server
and must be paired w... | python | async def start(self):
"""Start the websocket server.
When this method returns, the websocket server will be running and
the port property of this class will have its assigned port number.
This method should be called only once in the lifetime of the server
and must be paired w... | [
"async",
"def",
"start",
"(",
"self",
")",
":",
"if",
"self",
".",
"_server_task",
"is",
"not",
"None",
":",
"self",
".",
"_logger",
".",
"debug",
"(",
"\"AsyncValidatingWSServer.start() called twice, ignoring\"",
")",
"return",
"started_signal",
"=",
"self",
".... | Start the websocket server.
When this method returns, the websocket server will be running and
the port property of this class will have its assigned port number.
This method should be called only once in the lifetime of the server
and must be paired with a call to stop() to cleanly re... | [
"Start",
"the",
"websocket",
"server",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/websocket/iotile_transport_websocket/generic/async_server.py#L127-L148 | train |
iotile/coretools | transport_plugins/websocket/iotile_transport_websocket/generic/async_server.py | AsyncValidatingWSServer._run_server_task | async def _run_server_task(self, started_signal):
"""Create a BackgroundTask to manage the server.
This allows subclasess to attach their server related tasks as
subtasks that are properly cleaned up when this parent task is
stopped and not require them all to overload start() and stop(... | python | async def _run_server_task(self, started_signal):
"""Create a BackgroundTask to manage the server.
This allows subclasess to attach their server related tasks as
subtasks that are properly cleaned up when this parent task is
stopped and not require them all to overload start() and stop(... | [
"async",
"def",
"_run_server_task",
"(",
"self",
",",
"started_signal",
")",
":",
"try",
":",
"server",
"=",
"await",
"websockets",
".",
"serve",
"(",
"self",
".",
"_manage_connection",
",",
"self",
".",
"host",
",",
"self",
".",
"port",
")",
"port",
"="... | Create a BackgroundTask to manage the server.
This allows subclasess to attach their server related tasks as
subtasks that are properly cleaned up when this parent task is
stopped and not require them all to overload start() and stop()
to perform this action. | [
"Create",
"a",
"BackgroundTask",
"to",
"manage",
"the",
"server",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/websocket/iotile_transport_websocket/generic/async_server.py#L150-L177 | train |
iotile/coretools | transport_plugins/websocket/iotile_transport_websocket/generic/async_server.py | AsyncValidatingWSServer.send_event | async def send_event(self, con, name, payload):
"""Send an event to a client connection.
This method will push an event message to the client with the given
name and payload. You need to have access to the the ``connection``
object for the client, which is only available once the clien... | python | async def send_event(self, con, name, payload):
"""Send an event to a client connection.
This method will push an event message to the client with the given
name and payload. You need to have access to the the ``connection``
object for the client, which is only available once the clien... | [
"async",
"def",
"send_event",
"(",
"self",
",",
"con",
",",
"name",
",",
"payload",
")",
":",
"message",
"=",
"dict",
"(",
"type",
"=",
"\"event\"",
",",
"name",
"=",
"name",
",",
"payload",
"=",
"payload",
")",
"encoded",
"=",
"pack",
"(",
"message"... | Send an event to a client connection.
This method will push an event message to the client with the given
name and payload. You need to have access to the the ``connection``
object for the client, which is only available once the client has
connected and passed to self.prepare_conn(con... | [
"Send",
"an",
"event",
"to",
"a",
"client",
"connection",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/websocket/iotile_transport_websocket/generic/async_server.py#L191-L209 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/dvipdf.py | DviPdfPsFunction | def DviPdfPsFunction(XXXDviAction, target = None, source= None, env=None):
"""A builder for DVI files that sets the TEXPICTS environment
variable before running dvi2ps or dvipdf."""
try:
abspath = source[0].attributes.path
except AttributeError :
abspath = ''
saved_env = SCons.... | python | def DviPdfPsFunction(XXXDviAction, target = None, source= None, env=None):
"""A builder for DVI files that sets the TEXPICTS environment
variable before running dvi2ps or dvipdf."""
try:
abspath = source[0].attributes.path
except AttributeError :
abspath = ''
saved_env = SCons.... | [
"def",
"DviPdfPsFunction",
"(",
"XXXDviAction",
",",
"target",
"=",
"None",
",",
"source",
"=",
"None",
",",
"env",
"=",
"None",
")",
":",
"try",
":",
"abspath",
"=",
"source",
"[",
"0",
"]",
".",
"attributes",
".",
"path",
"except",
"AttributeError",
... | A builder for DVI files that sets the TEXPICTS environment
variable before running dvi2ps or dvipdf. | [
"A",
"builder",
"for",
"DVI",
"files",
"that",
"sets",
"the",
"TEXPICTS",
"environment",
"variable",
"before",
"running",
"dvi2ps",
"or",
"dvipdf",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/dvipdf.py#L43-L64 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/dvipdf.py | PDFEmitter | def PDFEmitter(target, source, env):
"""Strips any .aux or .log files from the input source list.
These are created by the TeX Builder that in all likelihood was
used to generate the .dvi file we're using as input, and we only
care about the .dvi file.
"""
def strip_suffixes(n):
return n... | python | def PDFEmitter(target, source, env):
"""Strips any .aux or .log files from the input source list.
These are created by the TeX Builder that in all likelihood was
used to generate the .dvi file we're using as input, and we only
care about the .dvi file.
"""
def strip_suffixes(n):
return n... | [
"def",
"PDFEmitter",
"(",
"target",
",",
"source",
",",
"env",
")",
":",
"def",
"strip_suffixes",
"(",
"n",
")",
":",
"return",
"not",
"SCons",
".",
"Util",
".",
"splitext",
"(",
"str",
"(",
"n",
")",
")",
"[",
"1",
"]",
"in",
"[",
"'.aux'",
",",... | Strips any .aux or .log files from the input source list.
These are created by the TeX Builder that in all likelihood was
used to generate the .dvi file we're using as input, and we only
care about the .dvi file. | [
"Strips",
"any",
".",
"aux",
"or",
".",
"log",
"files",
"from",
"the",
"input",
"source",
"list",
".",
"These",
"are",
"created",
"by",
"the",
"TeX",
"Builder",
"that",
"in",
"all",
"likelihood",
"was",
"used",
"to",
"generate",
"the",
".",
"dvi",
"fil... | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/dvipdf.py#L82-L91 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/dvipdf.py | generate | def generate(env):
"""Add Builders and construction variables for dvipdf to an Environment."""
global PDFAction
if PDFAction is None:
PDFAction = SCons.Action.Action('$DVIPDFCOM', '$DVIPDFCOMSTR')
global DVIPDFAction
if DVIPDFAction is None:
DVIPDFAction = SCons.Action.Action(DviPdf... | python | def generate(env):
"""Add Builders and construction variables for dvipdf to an Environment."""
global PDFAction
if PDFAction is None:
PDFAction = SCons.Action.Action('$DVIPDFCOM', '$DVIPDFCOMSTR')
global DVIPDFAction
if DVIPDFAction is None:
DVIPDFAction = SCons.Action.Action(DviPdf... | [
"def",
"generate",
"(",
"env",
")",
":",
"global",
"PDFAction",
"if",
"PDFAction",
"is",
"None",
":",
"PDFAction",
"=",
"SCons",
".",
"Action",
".",
"Action",
"(",
"'$DVIPDFCOM'",
",",
"'$DVIPDFCOMSTR'",
")",
"global",
"DVIPDFAction",
"if",
"DVIPDFAction",
"... | Add Builders and construction variables for dvipdf to an Environment. | [
"Add",
"Builders",
"and",
"construction",
"variables",
"for",
"dvipdf",
"to",
"an",
"Environment",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/dvipdf.py#L93-L115 | train |
iotile/coretools | iotilesensorgraph/iotile/sg/sim/stop_conditions.py | TimeBasedStopCondition.FromString | def FromString(cls, desc):
"""Parse this stop condition from a string representation.
The string needs to match:
run_time number [seconds|minutes|hours|days|months|years]
Args:
desc (str): The description
Returns:
TimeBasedStopCondition
"""
... | python | def FromString(cls, desc):
"""Parse this stop condition from a string representation.
The string needs to match:
run_time number [seconds|minutes|hours|days|months|years]
Args:
desc (str): The description
Returns:
TimeBasedStopCondition
"""
... | [
"def",
"FromString",
"(",
"cls",
",",
"desc",
")",
":",
"parse_exp",
"=",
"Literal",
"(",
"u'run_time'",
")",
".",
"suppress",
"(",
")",
"+",
"time_interval",
"(",
"u'interval'",
")",
"try",
":",
"data",
"=",
"parse_exp",
".",
"parseString",
"(",
"desc",... | Parse this stop condition from a string representation.
The string needs to match:
run_time number [seconds|minutes|hours|days|months|years]
Args:
desc (str): The description
Returns:
TimeBasedStopCondition | [
"Parse",
"this",
"stop",
"condition",
"from",
"a",
"string",
"representation",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/sim/stop_conditions.py#L95-L114 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/packaging/rpm.py | collectintargz | def collectintargz(target, source, env):
""" Puts all source files into a tar.gz file. """
# the rpm tool depends on a source package, until this is changed
# this hack needs to be here that tries to pack all sources in.
sources = env.FindSourceFiles()
# filter out the target we are building the so... | python | def collectintargz(target, source, env):
""" Puts all source files into a tar.gz file. """
# the rpm tool depends on a source package, until this is changed
# this hack needs to be here that tries to pack all sources in.
sources = env.FindSourceFiles()
# filter out the target we are building the so... | [
"def",
"collectintargz",
"(",
"target",
",",
"source",
",",
"env",
")",
":",
"sources",
"=",
"env",
".",
"FindSourceFiles",
"(",
")",
"sources",
"=",
"[",
"s",
"for",
"s",
"in",
"sources",
"if",
"s",
"not",
"in",
"target",
"]",
"sources",
".",
"exten... | Puts all source files into a tar.gz file. | [
"Puts",
"all",
"source",
"files",
"into",
"a",
"tar",
".",
"gz",
"file",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/packaging/rpm.py#L86-L112 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/packaging/rpm.py | build_specfile | def build_specfile(target, source, env):
""" Builds a RPM specfile from a dictionary with string metadata and
by analyzing a tree of nodes.
"""
file = open(target[0].get_abspath(), 'w')
try:
file.write( build_specfile_header(env) )
file.write( build_specfile_sections(env) )
... | python | def build_specfile(target, source, env):
""" Builds a RPM specfile from a dictionary with string metadata and
by analyzing a tree of nodes.
"""
file = open(target[0].get_abspath(), 'w')
try:
file.write( build_specfile_header(env) )
file.write( build_specfile_sections(env) )
... | [
"def",
"build_specfile",
"(",
"target",
",",
"source",
",",
"env",
")",
":",
"file",
"=",
"open",
"(",
"target",
"[",
"0",
"]",
".",
"get_abspath",
"(",
")",
",",
"'w'",
")",
"try",
":",
"file",
".",
"write",
"(",
"build_specfile_header",
"(",
"env",... | Builds a RPM specfile from a dictionary with string metadata and
by analyzing a tree of nodes. | [
"Builds",
"a",
"RPM",
"specfile",
"from",
"a",
"dictionary",
"with",
"string",
"metadata",
"and",
"by",
"analyzing",
"a",
"tree",
"of",
"nodes",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/packaging/rpm.py#L125-L142 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/packaging/rpm.py | build_specfile_sections | def build_specfile_sections(spec):
""" Builds the sections of a rpm specfile.
"""
str = ""
mandatory_sections = {
'DESCRIPTION' : '\n%%description\n%s\n\n', }
str = str + SimpleTagCompiler(mandatory_sections).compile( spec )
optional_sections = {
'DESCRIPTION_' : '%%de... | python | def build_specfile_sections(spec):
""" Builds the sections of a rpm specfile.
"""
str = ""
mandatory_sections = {
'DESCRIPTION' : '\n%%description\n%s\n\n', }
str = str + SimpleTagCompiler(mandatory_sections).compile( spec )
optional_sections = {
'DESCRIPTION_' : '%%de... | [
"def",
"build_specfile_sections",
"(",
"spec",
")",
":",
"str",
"=",
"\"\"",
"mandatory_sections",
"=",
"{",
"'DESCRIPTION'",
":",
"'\\n%%description\\n%s\\n\\n'",
",",
"}",
"str",
"=",
"str",
"+",
"SimpleTagCompiler",
"(",
"mandatory_sections",
")",
".",
"compile... | Builds the sections of a rpm specfile. | [
"Builds",
"the",
"sections",
"of",
"a",
"rpm",
"specfile",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/packaging/rpm.py#L148-L190 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/packaging/rpm.py | build_specfile_header | def build_specfile_header(spec):
""" Builds all sections but the %file of a rpm specfile
"""
str = ""
# first the mandatory sections
mandatory_header_fields = {
'NAME' : '%%define name %s\nName: %%{name}\n',
'VERSION' : '%%define version %s\nVersion: %%{version}\n',... | python | def build_specfile_header(spec):
""" Builds all sections but the %file of a rpm specfile
"""
str = ""
# first the mandatory sections
mandatory_header_fields = {
'NAME' : '%%define name %s\nName: %%{name}\n',
'VERSION' : '%%define version %s\nVersion: %%{version}\n',... | [
"def",
"build_specfile_header",
"(",
"spec",
")",
":",
"str",
"=",
"\"\"",
"mandatory_header_fields",
"=",
"{",
"'NAME'",
":",
"'%%define name %s\\nName: %%{name}\\n'",
",",
"'VERSION'",
":",
"'%%define version %s\\nVersion: %%{version}\\n'",
",",
"'PACKAGEVERSION'",
":",
... | Builds all sections but the %file of a rpm specfile | [
"Builds",
"all",
"sections",
"but",
"the",
"%file",
"of",
"a",
"rpm",
"specfile"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/packaging/rpm.py#L192-L245 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/packaging/rpm.py | build_specfile_filesection | def build_specfile_filesection(spec, files):
""" builds the %file section of the specfile
"""
str = '%files\n'
if 'X_RPM_DEFATTR' not in spec:
spec['X_RPM_DEFATTR'] = '(-,root,root)'
str = str + '%%defattr %s\n' % spec['X_RPM_DEFATTR']
supported_tags = {
'PACKAGING_CONFIG' ... | python | def build_specfile_filesection(spec, files):
""" builds the %file section of the specfile
"""
str = '%files\n'
if 'X_RPM_DEFATTR' not in spec:
spec['X_RPM_DEFATTR'] = '(-,root,root)'
str = str + '%%defattr %s\n' % spec['X_RPM_DEFATTR']
supported_tags = {
'PACKAGING_CONFIG' ... | [
"def",
"build_specfile_filesection",
"(",
"spec",
",",
"files",
")",
":",
"str",
"=",
"'%files\\n'",
"if",
"'X_RPM_DEFATTR'",
"not",
"in",
"spec",
":",
"spec",
"[",
"'X_RPM_DEFATTR'",
"]",
"=",
"'(-,root,root)'",
"str",
"=",
"str",
"+",
"'%%defattr %s\\n'",
"%... | builds the %file section of the specfile | [
"builds",
"the",
"%file",
"section",
"of",
"the",
"specfile"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/packaging/rpm.py#L250-L289 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/packaging/rpm.py | SimpleTagCompiler.compile | def compile(self, values):
""" Compiles the tagset and returns a str containing the result
"""
def is_international(tag):
return tag.endswith('_')
def get_country_code(tag):
return tag[-2:]
def strip_country_code(tag):
return tag[:-2]
... | python | def compile(self, values):
""" Compiles the tagset and returns a str containing the result
"""
def is_international(tag):
return tag.endswith('_')
def get_country_code(tag):
return tag[-2:]
def strip_country_code(tag):
return tag[:-2]
... | [
"def",
"compile",
"(",
"self",
",",
"values",
")",
":",
"def",
"is_international",
"(",
"tag",
")",
":",
"return",
"tag",
".",
"endswith",
"(",
"'_'",
")",
"def",
"get_country_code",
"(",
"tag",
")",
":",
"return",
"tag",
"[",
"-",
"2",
":",
"]",
"... | Compiles the tagset and returns a str containing the result | [
"Compiles",
"the",
"tagset",
"and",
"returns",
"a",
"str",
"containing",
"the",
"result"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/packaging/rpm.py#L309-L343 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/ifl.py | generate | def generate(env):
"""Add Builders and construction variables for ifl to an Environment."""
fscan = FortranScan("FORTRANPATH")
SCons.Tool.SourceFileScanner.add_scanner('.i', fscan)
SCons.Tool.SourceFileScanner.add_scanner('.i90', fscan)
if 'FORTRANFILESUFFIXES' not in env:
env['FORTRANFILES... | python | def generate(env):
"""Add Builders and construction variables for ifl to an Environment."""
fscan = FortranScan("FORTRANPATH")
SCons.Tool.SourceFileScanner.add_scanner('.i', fscan)
SCons.Tool.SourceFileScanner.add_scanner('.i90', fscan)
if 'FORTRANFILESUFFIXES' not in env:
env['FORTRANFILES... | [
"def",
"generate",
"(",
"env",
")",
":",
"fscan",
"=",
"FortranScan",
"(",
"\"FORTRANPATH\"",
")",
"SCons",
".",
"Tool",
".",
"SourceFileScanner",
".",
"add_scanner",
"(",
"'.i'",
",",
"fscan",
")",
"SCons",
".",
"Tool",
".",
"SourceFileScanner",
".",
"add... | Add Builders and construction variables for ifl to an Environment. | [
"Add",
"Builders",
"and",
"construction",
"variables",
"for",
"ifl",
"to",
"an",
"Environment",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/ifl.py#L40-L63 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/bcc32.py | generate | def generate(env):
findIt('bcc32', env)
"""Add Builders and construction variables for bcc to an
Environment."""
static_obj, shared_obj = SCons.Tool.createObjBuilders(env)
for suffix in ['.c', '.cpp']:
static_obj.add_action(suffix, SCons.Defaults.CAction)
shared_obj.add_action(suffix... | python | def generate(env):
findIt('bcc32', env)
"""Add Builders and construction variables for bcc to an
Environment."""
static_obj, shared_obj = SCons.Tool.createObjBuilders(env)
for suffix in ['.c', '.cpp']:
static_obj.add_action(suffix, SCons.Defaults.CAction)
shared_obj.add_action(suffix... | [
"def",
"generate",
"(",
"env",
")",
":",
"findIt",
"(",
"'bcc32'",
",",
"env",
")",
"static_obj",
",",
"shared_obj",
"=",
"SCons",
".",
"Tool",
".",
"createObjBuilders",
"(",
"env",
")",
"for",
"suffix",
"in",
"[",
"'.c'",
",",
"'.cpp'",
"]",
":",
"s... | Add Builders and construction variables for bcc to an
Environment. | [
"Add",
"Builders",
"and",
"construction",
"variables",
"for",
"bcc",
"to",
"an",
"Environment",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/bcc32.py#L47-L72 | train |
iotile/coretools | iotilebuild/iotile/build/config/site_scons/autobuild.py | require | def require(builder_name):
"""Find an advertised autobuilder and return it
This function searches through all installed distributions to find
if any advertise an entry point with group 'iotile.autobuild' and
name equal to builder_name. The first one that is found is returned.
This function raises... | python | def require(builder_name):
"""Find an advertised autobuilder and return it
This function searches through all installed distributions to find
if any advertise an entry point with group 'iotile.autobuild' and
name equal to builder_name. The first one that is found is returned.
This function raises... | [
"def",
"require",
"(",
"builder_name",
")",
":",
"reg",
"=",
"ComponentRegistry",
"(",
")",
"for",
"_name",
",",
"autobuild_func",
"in",
"reg",
".",
"load_extensions",
"(",
"'iotile.autobuild'",
",",
"name_filter",
"=",
"builder_name",
")",
":",
"return",
"aut... | Find an advertised autobuilder and return it
This function searches through all installed distributions to find
if any advertise an entry point with group 'iotile.autobuild' and
name equal to builder_name. The first one that is found is returned.
This function raises a BuildError if it cannot find th... | [
"Find",
"an",
"advertised",
"autobuilder",
"and",
"return",
"it"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/site_scons/autobuild.py#L32-L54 | train |
iotile/coretools | iotilebuild/iotile/build/config/site_scons/autobuild.py | autobuild_onlycopy | def autobuild_onlycopy():
"""Autobuild a project that does not require building firmware, pcb or documentation
"""
try:
# Build only release information
family = utilities.get_family('module_settings.json')
autobuild_release(family)
Alias('release', os.path.join('build', 'ou... | python | def autobuild_onlycopy():
"""Autobuild a project that does not require building firmware, pcb or documentation
"""
try:
# Build only release information
family = utilities.get_family('module_settings.json')
autobuild_release(family)
Alias('release', os.path.join('build', 'ou... | [
"def",
"autobuild_onlycopy",
"(",
")",
":",
"try",
":",
"family",
"=",
"utilities",
".",
"get_family",
"(",
"'module_settings.json'",
")",
"autobuild_release",
"(",
"family",
")",
"Alias",
"(",
"'release'",
",",
"os",
".",
"path",
".",
"join",
"(",
"'build'"... | Autobuild a project that does not require building firmware, pcb or documentation | [
"Autobuild",
"a",
"project",
"that",
"does",
"not",
"require",
"building",
"firmware",
"pcb",
"or",
"documentation"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/site_scons/autobuild.py#L89-L101 | train |
iotile/coretools | iotilebuild/iotile/build/config/site_scons/autobuild.py | autobuild_docproject | def autobuild_docproject():
"""Autobuild a project that only contains documentation"""
try:
#Build only release information
family = utilities.get_family('module_settings.json')
autobuild_release(family)
autobuild_documentation(family.tile)
except unit_test.IOTileException a... | python | def autobuild_docproject():
"""Autobuild a project that only contains documentation"""
try:
#Build only release information
family = utilities.get_family('module_settings.json')
autobuild_release(family)
autobuild_documentation(family.tile)
except unit_test.IOTileException a... | [
"def",
"autobuild_docproject",
"(",
")",
":",
"try",
":",
"family",
"=",
"utilities",
".",
"get_family",
"(",
"'module_settings.json'",
")",
"autobuild_release",
"(",
"family",
")",
"autobuild_documentation",
"(",
"family",
".",
"tile",
")",
"except",
"unit_test",... | Autobuild a project that only contains documentation | [
"Autobuild",
"a",
"project",
"that",
"only",
"contains",
"documentation"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/site_scons/autobuild.py#L104-L114 | train |
iotile/coretools | iotilebuild/iotile/build/config/site_scons/autobuild.py | autobuild_arm_program | def autobuild_arm_program(elfname, test_dir=os.path.join('firmware', 'test'), patch=True):
"""
Build the an ARM module for all targets and build all unit tests. If pcb files are given, also build those.
"""
try:
#Build for all targets
family = utilities.get_family('module_settings.json'... | python | def autobuild_arm_program(elfname, test_dir=os.path.join('firmware', 'test'), patch=True):
"""
Build the an ARM module for all targets and build all unit tests. If pcb files are given, also build those.
"""
try:
#Build for all targets
family = utilities.get_family('module_settings.json'... | [
"def",
"autobuild_arm_program",
"(",
"elfname",
",",
"test_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"'firmware'",
",",
"'test'",
")",
",",
"patch",
"=",
"True",
")",
":",
"try",
":",
"family",
"=",
"utilities",
".",
"get_family",
"(",
"'module_set... | Build the an ARM module for all targets and build all unit tests. If pcb files are given, also build those. | [
"Build",
"the",
"an",
"ARM",
"module",
"for",
"all",
"targets",
"and",
"build",
"all",
"unit",
"tests",
".",
"If",
"pcb",
"files",
"are",
"given",
"also",
"build",
"those",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/site_scons/autobuild.py#L152-L176 | train |
iotile/coretools | iotilebuild/iotile/build/config/site_scons/autobuild.py | autobuild_doxygen | def autobuild_doxygen(tile):
"""Generate documentation for firmware in this module using doxygen"""
iotile = IOTile('.')
doxydir = os.path.join('build', 'doc')
doxyfile = os.path.join(doxydir, 'doxygen.txt')
outfile = os.path.join(doxydir, '%s.timestamp' % tile.unique_id)
env = Environment(EN... | python | def autobuild_doxygen(tile):
"""Generate documentation for firmware in this module using doxygen"""
iotile = IOTile('.')
doxydir = os.path.join('build', 'doc')
doxyfile = os.path.join(doxydir, 'doxygen.txt')
outfile = os.path.join(doxydir, '%s.timestamp' % tile.unique_id)
env = Environment(EN... | [
"def",
"autobuild_doxygen",
"(",
"tile",
")",
":",
"iotile",
"=",
"IOTile",
"(",
"'.'",
")",
"doxydir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"'build'",
",",
"'doc'",
")",
"doxyfile",
"=",
"os",
".",
"path",
".",
"join",
"(",
"doxydir",
",",
"'... | Generate documentation for firmware in this module using doxygen | [
"Generate",
"documentation",
"for",
"firmware",
"in",
"this",
"module",
"using",
"doxygen"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/site_scons/autobuild.py#L178-L202 | train |
iotile/coretools | iotilebuild/iotile/build/config/site_scons/autobuild.py | autobuild_documentation | def autobuild_documentation(tile):
"""Generate documentation for this module using a combination of sphinx and breathe"""
docdir = os.path.join('#doc')
docfile = os.path.join(docdir, 'conf.py')
outdir = os.path.join('build', 'output', 'doc', tile.unique_id)
outfile = os.path.join(outdir, '%s.timest... | python | def autobuild_documentation(tile):
"""Generate documentation for this module using a combination of sphinx and breathe"""
docdir = os.path.join('#doc')
docfile = os.path.join(docdir, 'conf.py')
outdir = os.path.join('build', 'output', 'doc', tile.unique_id)
outfile = os.path.join(outdir, '%s.timest... | [
"def",
"autobuild_documentation",
"(",
"tile",
")",
":",
"docdir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"'#doc'",
")",
"docfile",
"=",
"os",
".",
"path",
".",
"join",
"(",
"docdir",
",",
"'conf.py'",
")",
"outdir",
"=",
"os",
".",
"path",
".",
... | Generate documentation for this module using a combination of sphinx and breathe | [
"Generate",
"documentation",
"for",
"this",
"module",
"using",
"a",
"combination",
"of",
"sphinx",
"and",
"breathe"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/site_scons/autobuild.py#L205-L230 | train |
iotile/coretools | iotilebuild/iotile/build/config/site_scons/autobuild.py | autobuild_bootstrap_file | def autobuild_bootstrap_file(file_name, image_list):
"""Combine multiple firmware images into a single bootstrap hex file.
The files listed in image_list must be products of either this tile or any
dependency tile and should correspond exactly with the base name listed on
the products section of the mo... | python | def autobuild_bootstrap_file(file_name, image_list):
"""Combine multiple firmware images into a single bootstrap hex file.
The files listed in image_list must be products of either this tile or any
dependency tile and should correspond exactly with the base name listed on
the products section of the mo... | [
"def",
"autobuild_bootstrap_file",
"(",
"file_name",
",",
"image_list",
")",
":",
"family",
"=",
"utilities",
".",
"get_family",
"(",
"'module_settings.json'",
")",
"target",
"=",
"family",
".",
"platform_independent_target",
"(",
")",
"resolver",
"=",
"ProductResol... | Combine multiple firmware images into a single bootstrap hex file.
The files listed in image_list must be products of either this tile or any
dependency tile and should correspond exactly with the base name listed on
the products section of the module_settings.json file of the corresponding
tile. They... | [
"Combine",
"multiple",
"firmware",
"images",
"into",
"a",
"single",
"bootstrap",
"hex",
"file",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/site_scons/autobuild.py#L262-L303 | train |
iotile/coretools | iotilesensorgraph/iotile/sg/parser/scopes/scope.py | Scope.add_identifier | def add_identifier(self, name, obj):
"""Add a known identifier resolution.
Args:
name (str): The name of the identifier
obj (object): The object that is should resolve to
"""
name = str(name)
self._known_identifiers[name] = obj | python | def add_identifier(self, name, obj):
"""Add a known identifier resolution.
Args:
name (str): The name of the identifier
obj (object): The object that is should resolve to
"""
name = str(name)
self._known_identifiers[name] = obj | [
"def",
"add_identifier",
"(",
"self",
",",
"name",
",",
"obj",
")",
":",
"name",
"=",
"str",
"(",
"name",
")",
"self",
".",
"_known_identifiers",
"[",
"name",
"]",
"=",
"obj"
] | Add a known identifier resolution.
Args:
name (str): The name of the identifier
obj (object): The object that is should resolve to | [
"Add",
"a",
"known",
"identifier",
"resolution",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/parser/scopes/scope.py#L47-L56 | train |
iotile/coretools | iotilesensorgraph/iotile/sg/parser/scopes/scope.py | Scope.resolve_identifier | def resolve_identifier(self, name, expected_type=None):
"""Resolve an identifier to an object.
There is a single namespace for identifiers so the user also should
pass an expected type that will be checked against what the identifier
actually resolves to so that there are no surprises.
... | python | def resolve_identifier(self, name, expected_type=None):
"""Resolve an identifier to an object.
There is a single namespace for identifiers so the user also should
pass an expected type that will be checked against what the identifier
actually resolves to so that there are no surprises.
... | [
"def",
"resolve_identifier",
"(",
"self",
",",
"name",
",",
"expected_type",
"=",
"None",
")",
":",
"name",
"=",
"str",
"(",
"name",
")",
"if",
"name",
"in",
"self",
".",
"_known_identifiers",
":",
"obj",
"=",
"self",
".",
"_known_identifiers",
"[",
"nam... | Resolve an identifier to an object.
There is a single namespace for identifiers so the user also should
pass an expected type that will be checked against what the identifier
actually resolves to so that there are no surprises.
Args:
name (str): The name that we want to res... | [
"Resolve",
"an",
"identifier",
"to",
"an",
"object",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/parser/scopes/scope.py#L58-L90 | train |
iotile/coretools | iotilecore/iotile/core/hw/reports/signed_list_format.py | SignedListReport.FromReadings | def FromReadings(cls, uuid, readings, root_key=AuthProvider.NoKey, signer=None,
report_id=IOTileReading.InvalidReadingID, selector=0xFFFF, streamer=0, sent_timestamp=0):
"""Generate an instance of the report format from a list of readings and a uuid.
The signed list report is creat... | python | def FromReadings(cls, uuid, readings, root_key=AuthProvider.NoKey, signer=None,
report_id=IOTileReading.InvalidReadingID, selector=0xFFFF, streamer=0, sent_timestamp=0):
"""Generate an instance of the report format from a list of readings and a uuid.
The signed list report is creat... | [
"def",
"FromReadings",
"(",
"cls",
",",
"uuid",
",",
"readings",
",",
"root_key",
"=",
"AuthProvider",
".",
"NoKey",
",",
"signer",
"=",
"None",
",",
"report_id",
"=",
"IOTileReading",
".",
"InvalidReadingID",
",",
"selector",
"=",
"0xFFFF",
",",
"streamer",... | Generate an instance of the report format from a list of readings and a uuid.
The signed list report is created using the passed readings and signed using the specified method
and AuthProvider. If no auth provider is specified, the report is signed using the default authorization
chain.
... | [
"Generate",
"an",
"instance",
"of",
"the",
"report",
"format",
"from",
"a",
"list",
"of",
"readings",
"and",
"a",
"uuid",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/reports/signed_list_format.py#L44-L124 | train |
iotile/coretools | iotilecore/iotile/core/hw/reports/signed_list_format.py | SignedListReport.decode | def decode(self):
"""Decode this report into a list of readings
"""
fmt, len_low, len_high, device_id, report_id, sent_timestamp, signature_flags, \
origin_streamer, streamer_selector = unpack("<BBHLLLBBH", self.raw_report[:20])
assert fmt == 1
length = (len_high << 8) ... | python | def decode(self):
"""Decode this report into a list of readings
"""
fmt, len_low, len_high, device_id, report_id, sent_timestamp, signature_flags, \
origin_streamer, streamer_selector = unpack("<BBHLLLBBH", self.raw_report[:20])
assert fmt == 1
length = (len_high << 8) ... | [
"def",
"decode",
"(",
"self",
")",
":",
"fmt",
",",
"len_low",
",",
"len_high",
",",
"device_id",
",",
"report_id",
",",
"sent_timestamp",
",",
"signature_flags",
",",
"origin_streamer",
",",
"streamer_selector",
"=",
"unpack",
"(",
"\"<BBHLLLBBH\"",
",",
"sel... | Decode this report into a list of readings | [
"Decode",
"this",
"report",
"into",
"a",
"list",
"of",
"readings"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/reports/signed_list_format.py#L126-L200 | train |
iotile/coretools | iotilesensorgraph/iotile/sg/model.py | DeviceModel._add_property | def _add_property(self, name, default_value):
"""Add a device property with a given default value.
Args:
name (str): The name of the property to add
default_value (int, bool): The value of the property
"""
name = str(name)
self._properties[name] = defaul... | python | def _add_property(self, name, default_value):
"""Add a device property with a given default value.
Args:
name (str): The name of the property to add
default_value (int, bool): The value of the property
"""
name = str(name)
self._properties[name] = defaul... | [
"def",
"_add_property",
"(",
"self",
",",
"name",
",",
"default_value",
")",
":",
"name",
"=",
"str",
"(",
"name",
")",
"self",
".",
"_properties",
"[",
"name",
"]",
"=",
"default_value"
] | Add a device property with a given default value.
Args:
name (str): The name of the property to add
default_value (int, bool): The value of the property | [
"Add",
"a",
"device",
"property",
"with",
"a",
"given",
"default",
"value",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/model.py#L28-L37 | train |
iotile/coretools | iotilesensorgraph/iotile/sg/model.py | DeviceModel.set | def set(self, name, value):
"""Set a device model property.
Args:
name (str): The name of the property to set
value (int, bool): The value of the property to set
"""
name = str(name)
if name not in self._properties:
raise ArgumentError("Unkno... | python | def set(self, name, value):
"""Set a device model property.
Args:
name (str): The name of the property to set
value (int, bool): The value of the property to set
"""
name = str(name)
if name not in self._properties:
raise ArgumentError("Unkno... | [
"def",
"set",
"(",
"self",
",",
"name",
",",
"value",
")",
":",
"name",
"=",
"str",
"(",
"name",
")",
"if",
"name",
"not",
"in",
"self",
".",
"_properties",
":",
"raise",
"ArgumentError",
"(",
"\"Unknown property in DeviceModel\"",
",",
"name",
"=",
"nam... | Set a device model property.
Args:
name (str): The name of the property to set
value (int, bool): The value of the property to set | [
"Set",
"a",
"device",
"model",
"property",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/model.py#L39-L51 | train |
iotile/coretools | iotilesensorgraph/iotile/sg/model.py | DeviceModel.get | def get(self, name):
"""Get a device model property.
Args:
name (str): The name of the property to get
"""
name = str(name)
if name not in self._properties:
raise ArgumentError("Unknown property in DeviceModel", name=name)
return self._propertie... | python | def get(self, name):
"""Get a device model property.
Args:
name (str): The name of the property to get
"""
name = str(name)
if name not in self._properties:
raise ArgumentError("Unknown property in DeviceModel", name=name)
return self._propertie... | [
"def",
"get",
"(",
"self",
",",
"name",
")",
":",
"name",
"=",
"str",
"(",
"name",
")",
"if",
"name",
"not",
"in",
"self",
".",
"_properties",
":",
"raise",
"ArgumentError",
"(",
"\"Unknown property in DeviceModel\"",
",",
"name",
"=",
"name",
")",
"retu... | Get a device model property.
Args:
name (str): The name of the property to get | [
"Get",
"a",
"device",
"model",
"property",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/model.py#L53-L64 | train |
iotile/coretools | iotileemulate/iotile/emulate/reference/controller_features/config_database.py | _convert_to_bytes | def _convert_to_bytes(type_name, value):
"""Convert a typed value to a binary array"""
int_types = {'uint8_t': 'B', 'int8_t': 'b', 'uint16_t': 'H', 'int16_t': 'h', 'uint32_t': 'L', 'int32_t': 'l'}
type_name = type_name.lower()
if type_name not in int_types and type_name not in ['string', 'binary']:
... | python | def _convert_to_bytes(type_name, value):
"""Convert a typed value to a binary array"""
int_types = {'uint8_t': 'B', 'int8_t': 'b', 'uint16_t': 'H', 'int16_t': 'h', 'uint32_t': 'L', 'int32_t': 'l'}
type_name = type_name.lower()
if type_name not in int_types and type_name not in ['string', 'binary']:
... | [
"def",
"_convert_to_bytes",
"(",
"type_name",
",",
"value",
")",
":",
"int_types",
"=",
"{",
"'uint8_t'",
":",
"'B'",
",",
"'int8_t'",
":",
"'b'",
",",
"'uint16_t'",
":",
"'H'",
",",
"'int16_t'",
":",
"'h'",
",",
"'uint32_t'",
":",
"'L'",
",",
"'int32_t'... | Convert a typed value to a binary array | [
"Convert",
"a",
"typed",
"value",
"to",
"a",
"binary",
"array"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/controller_features/config_database.py#L378-L396 | train |
iotile/coretools | iotileemulate/iotile/emulate/reference/controller_features/config_database.py | ConfigEntry.dump | def dump(self):
"""Serialize this object."""
return {
'target': str(self.target),
'data': base64.b64encode(self.data).decode('utf-8'),
'var_id': self.var_id,
'valid': self.valid
} | python | def dump(self):
"""Serialize this object."""
return {
'target': str(self.target),
'data': base64.b64encode(self.data).decode('utf-8'),
'var_id': self.var_id,
'valid': self.valid
} | [
"def",
"dump",
"(",
"self",
")",
":",
"return",
"{",
"'target'",
":",
"str",
"(",
"self",
".",
"target",
")",
",",
"'data'",
":",
"base64",
".",
"b64encode",
"(",
"self",
".",
"data",
")",
".",
"decode",
"(",
"'utf-8'",
")",
",",
"'var_id'",
":",
... | Serialize this object. | [
"Serialize",
"this",
"object",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/controller_features/config_database.py#L39-L47 | train |
iotile/coretools | iotileemulate/iotile/emulate/reference/controller_features/config_database.py | ConfigEntry.generate_rpcs | def generate_rpcs(self, address):
"""Generate the RPCs needed to stream this config variable to a tile.
Args:
address (int): The address of the tile that we should stream to.
Returns:
list of tuples: A list of argument tuples for each RPC.
These tuples can ... | python | def generate_rpcs(self, address):
"""Generate the RPCs needed to stream this config variable to a tile.
Args:
address (int): The address of the tile that we should stream to.
Returns:
list of tuples: A list of argument tuples for each RPC.
These tuples can ... | [
"def",
"generate_rpcs",
"(",
"self",
",",
"address",
")",
":",
"rpc_list",
"=",
"[",
"]",
"for",
"offset",
"in",
"range",
"(",
"2",
",",
"len",
"(",
"self",
".",
"data",
")",
",",
"16",
")",
":",
"rpc",
"=",
"(",
"address",
",",
"rpcs",
".",
"S... | Generate the RPCs needed to stream this config variable to a tile.
Args:
address (int): The address of the tile that we should stream to.
Returns:
list of tuples: A list of argument tuples for each RPC.
These tuples can be passed to EmulatedDevice.rpc to actually m... | [
"Generate",
"the",
"RPCs",
"needed",
"to",
"stream",
"this",
"config",
"variable",
"to",
"a",
"tile",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/controller_features/config_database.py#L49-L68 | train |
iotile/coretools | iotileemulate/iotile/emulate/reference/controller_features/config_database.py | ConfigEntry.Restore | def Restore(cls, state):
"""Unserialize this object."""
target = SlotIdentifier.FromString(state.get('target'))
data = base64.b64decode(state.get('data'))
var_id = state.get('var_id')
valid = state.get('valid')
return ConfigEntry(target, var_id, data, valid) | python | def Restore(cls, state):
"""Unserialize this object."""
target = SlotIdentifier.FromString(state.get('target'))
data = base64.b64decode(state.get('data'))
var_id = state.get('var_id')
valid = state.get('valid')
return ConfigEntry(target, var_id, data, valid) | [
"def",
"Restore",
"(",
"cls",
",",
"state",
")",
":",
"target",
"=",
"SlotIdentifier",
".",
"FromString",
"(",
"state",
".",
"get",
"(",
"'target'",
")",
")",
"data",
"=",
"base64",
".",
"b64decode",
"(",
"state",
".",
"get",
"(",
"'data'",
")",
")",... | Unserialize this object. | [
"Unserialize",
"this",
"object",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/controller_features/config_database.py#L71-L79 | train |
iotile/coretools | iotileemulate/iotile/emulate/reference/controller_features/config_database.py | ConfigDatabase.compact | def compact(self):
"""Remove all invalid config entries."""
saved_length = 0
to_remove = []
for i, entry in enumerate(self.entries):
if not entry.valid:
to_remove.append(i)
saved_length += entry.data_space()
for i in reversed(to_remov... | python | def compact(self):
"""Remove all invalid config entries."""
saved_length = 0
to_remove = []
for i, entry in enumerate(self.entries):
if not entry.valid:
to_remove.append(i)
saved_length += entry.data_space()
for i in reversed(to_remov... | [
"def",
"compact",
"(",
"self",
")",
":",
"saved_length",
"=",
"0",
"to_remove",
"=",
"[",
"]",
"for",
"i",
",",
"entry",
"in",
"enumerate",
"(",
"self",
".",
"entries",
")",
":",
"if",
"not",
"entry",
".",
"valid",
":",
"to_remove",
".",
"append",
... | Remove all invalid config entries. | [
"Remove",
"all",
"invalid",
"config",
"entries",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/controller_features/config_database.py#L109-L122 | train |
iotile/coretools | iotileemulate/iotile/emulate/reference/controller_features/config_database.py | ConfigDatabase.start_entry | def start_entry(self, target, var_id):
"""Begin a new config database entry.
If there is a current entry in progress, it is aborted but the
data was already committed to persistent storage so that space
is wasted.
Args:
target (SlotIdentifer): The target slot for th... | python | def start_entry(self, target, var_id):
"""Begin a new config database entry.
If there is a current entry in progress, it is aborted but the
data was already committed to persistent storage so that space
is wasted.
Args:
target (SlotIdentifer): The target slot for th... | [
"def",
"start_entry",
"(",
"self",
",",
"target",
",",
"var_id",
")",
":",
"self",
".",
"in_progress",
"=",
"ConfigEntry",
"(",
"target",
",",
"var_id",
",",
"b''",
")",
"if",
"self",
".",
"data_size",
"-",
"self",
".",
"data_index",
"<",
"self",
".",
... | Begin a new config database entry.
If there is a current entry in progress, it is aborted but the
data was already committed to persistent storage so that space
is wasted.
Args:
target (SlotIdentifer): The target slot for this config variable.
var_id (int): The ... | [
"Begin",
"a",
"new",
"config",
"database",
"entry",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/controller_features/config_database.py#L131-L154 | train |
iotile/coretools | iotileemulate/iotile/emulate/reference/controller_features/config_database.py | ConfigDatabase.add_data | def add_data(self, data):
"""Add data to the currently in progress entry.
Args:
data (bytes): The data that we want to add.
Returns:
int: An error code
"""
if self.data_size - self.data_index < len(data):
return Error.DESTINATION_BUFFER_TOO_... | python | def add_data(self, data):
"""Add data to the currently in progress entry.
Args:
data (bytes): The data that we want to add.
Returns:
int: An error code
"""
if self.data_size - self.data_index < len(data):
return Error.DESTINATION_BUFFER_TOO_... | [
"def",
"add_data",
"(",
"self",
",",
"data",
")",
":",
"if",
"self",
".",
"data_size",
"-",
"self",
".",
"data_index",
"<",
"len",
"(",
"data",
")",
":",
"return",
"Error",
".",
"DESTINATION_BUFFER_TOO_SMALL",
"if",
"self",
".",
"in_progress",
"is",
"not... | Add data to the currently in progress entry.
Args:
data (bytes): The data that we want to add.
Returns:
int: An error code | [
"Add",
"data",
"to",
"the",
"currently",
"in",
"progress",
"entry",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/controller_features/config_database.py#L156-L172 | train |
iotile/coretools | iotileemulate/iotile/emulate/reference/controller_features/config_database.py | ConfigDatabase.end_entry | def end_entry(self):
"""Finish a previously started config database entry.
This commits the currently in progress entry. The expected flow is
that start_entry() is called followed by 1 or more calls to add_data()
followed by a single call to end_entry().
Returns:
i... | python | def end_entry(self):
"""Finish a previously started config database entry.
This commits the currently in progress entry. The expected flow is
that start_entry() is called followed by 1 or more calls to add_data()
followed by a single call to end_entry().
Returns:
i... | [
"def",
"end_entry",
"(",
"self",
")",
":",
"if",
"self",
".",
"in_progress",
"is",
"None",
":",
"return",
"Error",
".",
"NO_ERROR",
"if",
"self",
".",
"in_progress",
".",
"data_space",
"(",
")",
"==",
"2",
":",
"return",
"Error",
".",
"INPUT_BUFFER_WRONG... | Finish a previously started config database entry.
This commits the currently in progress entry. The expected flow is
that start_entry() is called followed by 1 or more calls to add_data()
followed by a single call to end_entry().
Returns:
int: An error code | [
"Finish",
"a",
"previously",
"started",
"config",
"database",
"entry",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/controller_features/config_database.py#L174-L203 | train |
iotile/coretools | iotileemulate/iotile/emulate/reference/controller_features/config_database.py | ConfigDatabase.stream_matching | def stream_matching(self, address, name):
"""Return the RPCs needed to stream matching config variables to the given tile.
This function will return a list of tuples suitable for passing to
EmulatedDevice.deferred_rpc.
Args:
address (int): The address of the tile that we wi... | python | def stream_matching(self, address, name):
"""Return the RPCs needed to stream matching config variables to the given tile.
This function will return a list of tuples suitable for passing to
EmulatedDevice.deferred_rpc.
Args:
address (int): The address of the tile that we wi... | [
"def",
"stream_matching",
"(",
"self",
",",
"address",
",",
"name",
")",
":",
"matching",
"=",
"[",
"x",
"for",
"x",
"in",
"self",
".",
"entries",
"if",
"x",
".",
"valid",
"and",
"x",
".",
"target",
".",
"matches",
"(",
"address",
",",
"name",
")",... | Return the RPCs needed to stream matching config variables to the given tile.
This function will return a list of tuples suitable for passing to
EmulatedDevice.deferred_rpc.
Args:
address (int): The address of the tile that we wish to stream to
name (str or bytes): The ... | [
"Return",
"the",
"RPCs",
"needed",
"to",
"stream",
"matching",
"config",
"variables",
"to",
"the",
"given",
"tile",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/controller_features/config_database.py#L205-L225 | train |
iotile/coretools | iotileemulate/iotile/emulate/reference/controller_features/config_database.py | ConfigDatabase.add_direct | def add_direct(self, target, var_id, var_type, data):
"""Directly add a config variable.
This method is meant to be called from emulation scenarios that
want to directly set config database entries from python.
Args:
target (SlotIdentifer): The target slot for this config v... | python | def add_direct(self, target, var_id, var_type, data):
"""Directly add a config variable.
This method is meant to be called from emulation scenarios that
want to directly set config database entries from python.
Args:
target (SlotIdentifer): The target slot for this config v... | [
"def",
"add_direct",
"(",
"self",
",",
"target",
",",
"var_id",
",",
"var_type",
",",
"data",
")",
":",
"data",
"=",
"struct",
".",
"pack",
"(",
"\"<H\"",
",",
"var_id",
")",
"+",
"_convert_to_bytes",
"(",
"var_type",
",",
"data",
")",
"if",
"self",
... | Directly add a config variable.
This method is meant to be called from emulation scenarios that
want to directly set config database entries from python.
Args:
target (SlotIdentifer): The target slot for this config variable.
var_id (int): The config variable ID
... | [
"Directly",
"add",
"a",
"config",
"variable",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/controller_features/config_database.py#L227-L253 | train |
iotile/coretools | iotileemulate/iotile/emulate/reference/controller_features/config_database.py | ConfigDatabaseMixin.start_config_var_entry | def start_config_var_entry(self, var_id, encoded_selector):
"""Start a new config variable entry."""
selector = SlotIdentifier.FromEncoded(encoded_selector)
err = self.config_database.start_entry(selector, var_id)
return [err] | python | def start_config_var_entry(self, var_id, encoded_selector):
"""Start a new config variable entry."""
selector = SlotIdentifier.FromEncoded(encoded_selector)
err = self.config_database.start_entry(selector, var_id)
return [err] | [
"def",
"start_config_var_entry",
"(",
"self",
",",
"var_id",
",",
"encoded_selector",
")",
":",
"selector",
"=",
"SlotIdentifier",
".",
"FromEncoded",
"(",
"encoded_selector",
")",
"err",
"=",
"self",
".",
"config_database",
".",
"start_entry",
"(",
"selector",
... | Start a new config variable entry. | [
"Start",
"a",
"new",
"config",
"variable",
"entry",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/controller_features/config_database.py#L277-L283 | train |
iotile/coretools | iotileemulate/iotile/emulate/reference/controller_features/config_database.py | ConfigDatabaseMixin.get_config_var_entry | def get_config_var_entry(self, index):
"""Get the metadata from the selected config variable entry."""
if index == 0 or index > len(self.config_database.entries):
return [Error.INVALID_ARRAY_KEY, 0, 0, 0, b'\0'*8, 0, 0]
entry = self.config_database.entries[index - 1]
if not... | python | def get_config_var_entry(self, index):
"""Get the metadata from the selected config variable entry."""
if index == 0 or index > len(self.config_database.entries):
return [Error.INVALID_ARRAY_KEY, 0, 0, 0, b'\0'*8, 0, 0]
entry = self.config_database.entries[index - 1]
if not... | [
"def",
"get_config_var_entry",
"(",
"self",
",",
"index",
")",
":",
"if",
"index",
"==",
"0",
"or",
"index",
">",
"len",
"(",
"self",
".",
"config_database",
".",
"entries",
")",
":",
"return",
"[",
"Error",
".",
"INVALID_ARRAY_KEY",
",",
"0",
",",
"0"... | Get the metadata from the selected config variable entry. | [
"Get",
"the",
"metadata",
"from",
"the",
"selected",
"config",
"variable",
"entry",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/controller_features/config_database.py#L300-L311 | train |
iotile/coretools | iotileemulate/iotile/emulate/reference/controller_features/config_database.py | ConfigDatabaseMixin.get_config_var_data | def get_config_var_data(self, index, offset):
"""Get a chunk of data for a config variable."""
if index == 0 or index > len(self.config_database.entries):
return [Error.INVALID_ARRAY_KEY, b'']
entry = self.config_database.entries[index - 1]
if not entry.valid:
r... | python | def get_config_var_data(self, index, offset):
"""Get a chunk of data for a config variable."""
if index == 0 or index > len(self.config_database.entries):
return [Error.INVALID_ARRAY_KEY, b'']
entry = self.config_database.entries[index - 1]
if not entry.valid:
r... | [
"def",
"get_config_var_data",
"(",
"self",
",",
"index",
",",
"offset",
")",
":",
"if",
"index",
"==",
"0",
"or",
"index",
">",
"len",
"(",
"self",
".",
"config_database",
".",
"entries",
")",
":",
"return",
"[",
"Error",
".",
"INVALID_ARRAY_KEY",
",",
... | Get a chunk of data for a config variable. | [
"Get",
"a",
"chunk",
"of",
"data",
"for",
"a",
"config",
"variable",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/controller_features/config_database.py#L327-L341 | train |
iotile/coretools | iotileemulate/iotile/emulate/reference/controller_features/config_database.py | ConfigDatabaseMixin.invalidate_config_var_entry | def invalidate_config_var_entry(self, index):
"""Mark a config variable as invalid."""
if index == 0 or index > len(self.config_database.entries):
return [Error.INVALID_ARRAY_KEY, b'']
entry = self.config_database.entries[index - 1]
if not entry.valid:
return [C... | python | def invalidate_config_var_entry(self, index):
"""Mark a config variable as invalid."""
if index == 0 or index > len(self.config_database.entries):
return [Error.INVALID_ARRAY_KEY, b'']
entry = self.config_database.entries[index - 1]
if not entry.valid:
return [C... | [
"def",
"invalidate_config_var_entry",
"(",
"self",
",",
"index",
")",
":",
"if",
"index",
"==",
"0",
"or",
"index",
">",
"len",
"(",
"self",
".",
"config_database",
".",
"entries",
")",
":",
"return",
"[",
"Error",
".",
"INVALID_ARRAY_KEY",
",",
"b''",
"... | Mark a config variable as invalid. | [
"Mark",
"a",
"config",
"variable",
"as",
"invalid",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/controller_features/config_database.py#L344-L355 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.