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/hw/auth/auth_provider.py | AuthProvider.DeriveReportKey | def DeriveReportKey(cls, root_key, report_id, sent_timestamp):
"""Derive a standard one time use report signing key.
The standard method is HMAC-SHA256(root_key, MAGIC_NUMBER || report_id || sent_timestamp)
where MAGIC_NUMBER is 0x00000002 and all integers are in little endian.
"""
... | python | def DeriveReportKey(cls, root_key, report_id, sent_timestamp):
"""Derive a standard one time use report signing key.
The standard method is HMAC-SHA256(root_key, MAGIC_NUMBER || report_id || sent_timestamp)
where MAGIC_NUMBER is 0x00000002 and all integers are in little endian.
"""
... | [
"def",
"DeriveReportKey",
"(",
"cls",
",",
"root_key",
",",
"report_id",
",",
"sent_timestamp",
")",
":",
"signed_data",
"=",
"struct",
".",
"pack",
"(",
"\"<LLL\"",
",",
"AuthProvider",
".",
"ReportKeyMagic",
",",
"report_id",
",",
"sent_timestamp",
")",
"hma... | Derive a standard one time use report signing key.
The standard method is HMAC-SHA256(root_key, MAGIC_NUMBER || report_id || sent_timestamp)
where MAGIC_NUMBER is 0x00000002 and all integers are in little endian. | [
"Derive",
"a",
"standard",
"one",
"time",
"use",
"report",
"signing",
"key",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/auth/auth_provider.py#L72-L82 | train |
iotile/coretools | iotilecore/iotile/core/utilities/async_tools/awaitable_dict.py | AwaitableDict.declare | def declare(self, name):
"""Declare that a key will be set in the future.
This will create a future for the key that is used to
hold its result and allow awaiting it.
Args:
name (str): The unique key that will be used.
"""
if name in self._data:
... | python | def declare(self, name):
"""Declare that a key will be set in the future.
This will create a future for the key that is used to
hold its result and allow awaiting it.
Args:
name (str): The unique key that will be used.
"""
if name in self._data:
... | [
"def",
"declare",
"(",
"self",
",",
"name",
")",
":",
"if",
"name",
"in",
"self",
".",
"_data",
":",
"raise",
"KeyError",
"(",
"\"Declared name {} that already existed\"",
".",
"format",
"(",
"name",
")",
")",
"self",
".",
"_data",
"[",
"name",
"]",
"=",... | Declare that a key will be set in the future.
This will create a future for the key that is used to
hold its result and allow awaiting it.
Args:
name (str): The unique key that will be used. | [
"Declare",
"that",
"a",
"key",
"will",
"be",
"set",
"in",
"the",
"future",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/utilities/async_tools/awaitable_dict.py#L39-L52 | train |
iotile/coretools | iotilecore/iotile/core/utilities/async_tools/awaitable_dict.py | AwaitableDict.get | async def get(self, name, timeout=None, autoremove=True):
"""Wait for a value to be set for a key.
This is the primary way to receive values from AwaitableDict.
You pass in the name of the key you want to wait for, the maximum
amount of time you want to wait and then you can await the r... | python | async def get(self, name, timeout=None, autoremove=True):
"""Wait for a value to be set for a key.
This is the primary way to receive values from AwaitableDict.
You pass in the name of the key you want to wait for, the maximum
amount of time you want to wait and then you can await the r... | [
"async",
"def",
"get",
"(",
"self",
",",
"name",
",",
"timeout",
"=",
"None",
",",
"autoremove",
"=",
"True",
")",
":",
"self",
".",
"_ensure_declared",
"(",
"name",
")",
"try",
":",
"await",
"asyncio",
".",
"wait_for",
"(",
"self",
".",
"_data",
"["... | Wait for a value to be set for a key.
This is the primary way to receive values from AwaitableDict.
You pass in the name of the key you want to wait for, the maximum
amount of time you want to wait and then you can await the result
and it will resolve to value from the call to set or an... | [
"Wait",
"for",
"a",
"value",
"to",
"be",
"set",
"for",
"a",
"key",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/utilities/async_tools/awaitable_dict.py#L54-L94 | train |
iotile/coretools | iotilecore/iotile/core/utilities/async_tools/awaitable_dict.py | AwaitableDict.get_nowait | def get_nowait(self, name, default=_MISSING, autoremove=False):
"""Get the value of a key if it is already set.
This method allows you to check if a key has already been set
without blocking. If the key has not been set you will get the
default value you pass in or KeyError() if no def... | python | def get_nowait(self, name, default=_MISSING, autoremove=False):
"""Get the value of a key if it is already set.
This method allows you to check if a key has already been set
without blocking. If the key has not been set you will get the
default value you pass in or KeyError() if no def... | [
"def",
"get_nowait",
"(",
"self",
",",
"name",
",",
"default",
"=",
"_MISSING",
",",
"autoremove",
"=",
"False",
")",
":",
"self",
".",
"_ensure_declared",
"(",
"name",
")",
"try",
":",
"future",
"=",
"self",
".",
"_data",
"[",
"name",
"]",
"if",
"fu... | Get the value of a key if it is already set.
This method allows you to check if a key has already been set
without blocking. If the key has not been set you will get the
default value you pass in or KeyError() if no default is passed.
When this method returns the key is automatically ... | [
"Get",
"the",
"value",
"of",
"a",
"key",
"if",
"it",
"is",
"already",
"set",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/utilities/async_tools/awaitable_dict.py#L96-L133 | train |
iotile/coretools | iotilecore/iotile/core/utilities/async_tools/awaitable_dict.py | AwaitableDict.set | def set(self, name, value, autodeclare=False):
"""Set the value of a key.
This method will cause anyone waiting on a key (and any future
waiters) to unblock and be returned the value you pass here.
If the key has not been declared previously, a KeyError() is
raised unless you p... | python | def set(self, name, value, autodeclare=False):
"""Set the value of a key.
This method will cause anyone waiting on a key (and any future
waiters) to unblock and be returned the value you pass here.
If the key has not been declared previously, a KeyError() is
raised unless you p... | [
"def",
"set",
"(",
"self",
",",
"name",
",",
"value",
",",
"autodeclare",
"=",
"False",
")",
":",
"if",
"not",
"autodeclare",
"and",
"name",
"not",
"in",
"self",
".",
"_data",
":",
"raise",
"KeyError",
"(",
"\"Key {} has not been declared and autodeclare=False... | Set the value of a key.
This method will cause anyone waiting on a key (and any future
waiters) to unblock and be returned the value you pass here.
If the key has not been declared previously, a KeyError() is
raised unless you pass ``autodeclare=True`` which will cause
the key ... | [
"Set",
"the",
"value",
"of",
"a",
"key",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/utilities/async_tools/awaitable_dict.py#L135-L159 | train |
iotile/coretools | iotilesensorgraph/iotile/sg/parser/parser_v1.py | SensorGraphFileParser.dump_tree | def dump_tree(self, statement=None, indent_level=0):
"""Dump the AST for this parsed file.
Args:
statement (SensorGraphStatement): the statement to print
if this function is called recursively.
indent_level (int): The number of spaces to indent this
... | python | def dump_tree(self, statement=None, indent_level=0):
"""Dump the AST for this parsed file.
Args:
statement (SensorGraphStatement): the statement to print
if this function is called recursively.
indent_level (int): The number of spaces to indent this
... | [
"def",
"dump_tree",
"(",
"self",
",",
"statement",
"=",
"None",
",",
"indent_level",
"=",
"0",
")",
":",
"out",
"=",
"u\"\"",
"indent",
"=",
"u\" \"",
"*",
"indent_level",
"if",
"statement",
"is",
"None",
":",
"for",
"root_statement",
"in",
"self",
".",
... | Dump the AST for this parsed file.
Args:
statement (SensorGraphStatement): the statement to print
if this function is called recursively.
indent_level (int): The number of spaces to indent this
statement. Used for recursively printing blocks of
... | [
"Dump",
"the",
"AST",
"for",
"this",
"parsed",
"file",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/parser/parser_v1.py#L23-L51 | train |
iotile/coretools | iotilesensorgraph/iotile/sg/parser/parser_v1.py | SensorGraphFileParser.parse_file | def parse_file(self, sg_file=None, data=None):
"""Parse a sensor graph file into an AST describing the file.
This function builds the statements list for this parser.
If you pass ``sg_file``, it will be interpreted as the path to a file
to parse. If you pass ``data`` it will be directl... | python | def parse_file(self, sg_file=None, data=None):
"""Parse a sensor graph file into an AST describing the file.
This function builds the statements list for this parser.
If you pass ``sg_file``, it will be interpreted as the path to a file
to parse. If you pass ``data`` it will be directl... | [
"def",
"parse_file",
"(",
"self",
",",
"sg_file",
"=",
"None",
",",
"data",
"=",
"None",
")",
":",
"if",
"sg_file",
"is",
"not",
"None",
"and",
"data",
"is",
"not",
"None",
":",
"raise",
"ArgumentError",
"(",
"\"You must pass either a path to an sgf file or th... | Parse a sensor graph file into an AST describing the file.
This function builds the statements list for this parser.
If you pass ``sg_file``, it will be interpreted as the path to a file
to parse. If you pass ``data`` it will be directly interpreted as the
string to parse. | [
"Parse",
"a",
"sensor",
"graph",
"file",
"into",
"an",
"AST",
"describing",
"the",
"file",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/parser/parser_v1.py#L53-L83 | train |
iotile/coretools | iotilesensorgraph/iotile/sg/parser/parser_v1.py | SensorGraphFileParser.compile | def compile(self, model):
"""Compile this file into a SensorGraph.
You must have preivously called parse_file to parse a
sensor graph file into statements that are then executed
by this command to build a sensor graph.
The results are stored in self.sensor_graph and can be
... | python | def compile(self, model):
"""Compile this file into a SensorGraph.
You must have preivously called parse_file to parse a
sensor graph file into statements that are then executed
by this command to build a sensor graph.
The results are stored in self.sensor_graph and can be
... | [
"def",
"compile",
"(",
"self",
",",
"model",
")",
":",
"log",
"=",
"SensorLog",
"(",
"InMemoryStorageEngine",
"(",
"model",
")",
",",
"model",
")",
"self",
".",
"sensor_graph",
"=",
"SensorGraph",
"(",
"log",
",",
"model",
")",
"allocator",
"=",
"StreamA... | Compile this file into a SensorGraph.
You must have preivously called parse_file to parse a
sensor graph file into statements that are then executed
by this command to build a sensor graph.
The results are stored in self.sensor_graph and can be
inspected before running optimiza... | [
"Compile",
"this",
"file",
"into",
"a",
"SensorGraph",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/parser/parser_v1.py#L85-L115 | train |
iotile/coretools | iotilesensorgraph/iotile/sg/parser/parser_v1.py | SensorGraphFileParser.parse_statement | def parse_statement(self, statement, orig_contents):
"""Parse a statement, possibly called recursively.
Args:
statement (int, ParseResult): The pyparsing parse result that
contains one statement prepended with the match location
orig_contents (str): The original ... | python | def parse_statement(self, statement, orig_contents):
"""Parse a statement, possibly called recursively.
Args:
statement (int, ParseResult): The pyparsing parse result that
contains one statement prepended with the match location
orig_contents (str): The original ... | [
"def",
"parse_statement",
"(",
"self",
",",
"statement",
",",
"orig_contents",
")",
":",
"children",
"=",
"[",
"]",
"is_block",
"=",
"False",
"name",
"=",
"statement",
".",
"getName",
"(",
")",
"if",
"name",
"==",
"'block'",
":",
"children_statements",
"="... | Parse a statement, possibly called recursively.
Args:
statement (int, ParseResult): The pyparsing parse result that
contains one statement prepended with the match location
orig_contents (str): The original contents of the file that we're
parsing in case ... | [
"Parse",
"a",
"statement",
"possibly",
"called",
"recursively",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilesensorgraph/iotile/sg/parser/parser_v1.py#L117-L182 | train |
iotile/coretools | iotilecore/iotile/core/hw/virtual/virtualdevice.py | VirtualIOTileDevice.stream | def stream(self, report, callback=None):
"""Stream a report asynchronously.
If no one is listening for the report, the report may be dropped,
otherwise it will be queued for sending
Args:
report (IOTileReport): The report that should be streamed
callback (callab... | python | def stream(self, report, callback=None):
"""Stream a report asynchronously.
If no one is listening for the report, the report may be dropped,
otherwise it will be queued for sending
Args:
report (IOTileReport): The report that should be streamed
callback (callab... | [
"def",
"stream",
"(",
"self",
",",
"report",
",",
"callback",
"=",
"None",
")",
":",
"if",
"self",
".",
"_push_channel",
"is",
"None",
":",
"return",
"self",
".",
"_push_channel",
".",
"stream",
"(",
"report",
",",
"callback",
"=",
"callback",
")"
] | Stream a report asynchronously.
If no one is listening for the report, the report may be dropped,
otherwise it will be queued for sending
Args:
report (IOTileReport): The report that should be streamed
callback (callable): Optional callback to get notified when
... | [
"Stream",
"a",
"report",
"asynchronously",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/virtual/virtualdevice.py#L121-L136 | train |
iotile/coretools | iotilecore/iotile/core/hw/virtual/virtualdevice.py | VirtualIOTileDevice.stream_realtime | def stream_realtime(self, stream, value):
"""Stream a realtime value as an IndividualReadingReport.
If the streaming interface of the VirtualInterface this
VirtualDevice is attached to is not opened, the realtime
reading may be dropped.
Args:
stream (int): The strea... | python | def stream_realtime(self, stream, value):
"""Stream a realtime value as an IndividualReadingReport.
If the streaming interface of the VirtualInterface this
VirtualDevice is attached to is not opened, the realtime
reading may be dropped.
Args:
stream (int): The strea... | [
"def",
"stream_realtime",
"(",
"self",
",",
"stream",
",",
"value",
")",
":",
"if",
"not",
"self",
".",
"stream_iface_open",
":",
"return",
"reading",
"=",
"IOTileReading",
"(",
"0",
",",
"stream",
",",
"value",
")",
"report",
"=",
"IndividualReadingReport",... | Stream a realtime value as an IndividualReadingReport.
If the streaming interface of the VirtualInterface this
VirtualDevice is attached to is not opened, the realtime
reading may be dropped.
Args:
stream (int): The stream id to send
value (int): The stream valu... | [
"Stream",
"a",
"realtime",
"value",
"as",
"an",
"IndividualReadingReport",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/virtual/virtualdevice.py#L138-L156 | train |
iotile/coretools | iotilecore/iotile/core/hw/virtual/virtualdevice.py | VirtualIOTileDevice.trace | def trace(self, data, callback=None):
"""Trace data asynchronously.
If no one is listening for traced data, it will be dropped
otherwise it will be queued for sending.
Args:
data (bytearray, string): Unstructured data to trace to any
connected client.
... | python | def trace(self, data, callback=None):
"""Trace data asynchronously.
If no one is listening for traced data, it will be dropped
otherwise it will be queued for sending.
Args:
data (bytearray, string): Unstructured data to trace to any
connected client.
... | [
"def",
"trace",
"(",
"self",
",",
"data",
",",
"callback",
"=",
"None",
")",
":",
"if",
"self",
".",
"_push_channel",
"is",
"None",
":",
"return",
"self",
".",
"_push_channel",
".",
"trace",
"(",
"data",
",",
"callback",
"=",
"callback",
")"
] | Trace data asynchronously.
If no one is listening for traced data, it will be dropped
otherwise it will be queued for sending.
Args:
data (bytearray, string): Unstructured data to trace to any
connected client.
callback (callable): Optional callback to g... | [
"Trace",
"data",
"asynchronously",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/virtual/virtualdevice.py#L158-L174 | train |
iotile/coretools | iotilecore/iotile/core/hw/virtual/virtualdevice.py | VirtualIOTileDevice.register_rpc | def register_rpc(self, address, rpc_id, func):
"""Register a single RPC handler with the given info.
This function can be used to directly register individual RPCs,
rather than delegating all RPCs at a given address to a virtual
Tile.
If calls to this function are mixed with ca... | python | def register_rpc(self, address, rpc_id, func):
"""Register a single RPC handler with the given info.
This function can be used to directly register individual RPCs,
rather than delegating all RPCs at a given address to a virtual
Tile.
If calls to this function are mixed with ca... | [
"def",
"register_rpc",
"(",
"self",
",",
"address",
",",
"rpc_id",
",",
"func",
")",
":",
"if",
"rpc_id",
"<",
"0",
"or",
"rpc_id",
">",
"0xFFFF",
":",
"raise",
"RPCInvalidIDError",
"(",
"\"Invalid RPC ID: {}\"",
".",
"format",
"(",
"rpc_id",
")",
")",
"... | Register a single RPC handler with the given info.
This function can be used to directly register individual RPCs,
rather than delegating all RPCs at a given address to a virtual
Tile.
If calls to this function are mixed with calls to add_tile for
the same address, these RPCs w... | [
"Register",
"a",
"single",
"RPC",
"handler",
"with",
"the",
"given",
"info",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/virtual/virtualdevice.py#L176-L201 | train |
iotile/coretools | iotilecore/iotile/core/hw/virtual/virtualdevice.py | VirtualIOTileDevice.add_tile | def add_tile(self, address, tile):
"""Add a tile to handle all RPCs at a given address.
Args:
address (int): The address of the tile
tile (RPCDispatcher): A tile object that inherits from RPCDispatcher
"""
if address in self._tiles:
raise ArgumentErr... | python | def add_tile(self, address, tile):
"""Add a tile to handle all RPCs at a given address.
Args:
address (int): The address of the tile
tile (RPCDispatcher): A tile object that inherits from RPCDispatcher
"""
if address in self._tiles:
raise ArgumentErr... | [
"def",
"add_tile",
"(",
"self",
",",
"address",
",",
"tile",
")",
":",
"if",
"address",
"in",
"self",
".",
"_tiles",
":",
"raise",
"ArgumentError",
"(",
"\"Tried to add two tiles at the same address\"",
",",
"address",
"=",
"address",
")",
"self",
".",
"_tiles... | Add a tile to handle all RPCs at a given address.
Args:
address (int): The address of the tile
tile (RPCDispatcher): A tile object that inherits from RPCDispatcher | [
"Add",
"a",
"tile",
"to",
"handle",
"all",
"RPCs",
"at",
"a",
"given",
"address",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/virtual/virtualdevice.py#L230-L241 | train |
iotile/coretools | iotileemulate/iotile/emulate/reference/reference_device.py | ReferenceDevice.iter_tiles | def iter_tiles(self, include_controller=True):
"""Iterate over all tiles in this device in order.
The ordering is by tile address which places the controller tile
first in the list.
Args:
include_controller (bool): Include the controller tile in the
results.... | python | def iter_tiles(self, include_controller=True):
"""Iterate over all tiles in this device in order.
The ordering is by tile address which places the controller tile
first in the list.
Args:
include_controller (bool): Include the controller tile in the
results.... | [
"def",
"iter_tiles",
"(",
"self",
",",
"include_controller",
"=",
"True",
")",
":",
"for",
"address",
",",
"tile",
"in",
"sorted",
"(",
"self",
".",
"_tiles",
".",
"items",
"(",
")",
")",
":",
"if",
"address",
"==",
"8",
"and",
"not",
"include_controll... | Iterate over all tiles in this device in order.
The ordering is by tile address which places the controller tile
first in the list.
Args:
include_controller (bool): Include the controller tile in the
results.
Yields:
int, EmulatedTile: A tuple w... | [
"Iterate",
"over",
"all",
"tiles",
"in",
"this",
"device",
"in",
"order",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/reference_device.py#L69-L87 | train |
iotile/coretools | iotileemulate/iotile/emulate/reference/reference_device.py | ReferenceDevice.open_streaming_interface | def open_streaming_interface(self):
"""Called when someone opens a streaming interface to the device.
This method will automatically notify sensor_graph that there is a
streaming interface opened.
Returns:
list: A list of IOTileReport objects that should be sent out
... | python | def open_streaming_interface(self):
"""Called when someone opens a streaming interface to the device.
This method will automatically notify sensor_graph that there is a
streaming interface opened.
Returns:
list: A list of IOTileReport objects that should be sent out
... | [
"def",
"open_streaming_interface",
"(",
"self",
")",
":",
"super",
"(",
"ReferenceDevice",
",",
"self",
")",
".",
"open_streaming_interface",
"(",
")",
"self",
".",
"rpc",
"(",
"8",
",",
"rpcs",
".",
"SG_GRAPH_INPUT",
",",
"8",
",",
"streams",
".",
"COMM_T... | Called when someone opens a streaming interface to the device.
This method will automatically notify sensor_graph that there is a
streaming interface opened.
Returns:
list: A list of IOTileReport objects that should be sent out
the streaming interface. | [
"Called",
"when",
"someone",
"opens",
"a",
"streaming",
"interface",
"to",
"the",
"device",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/reference_device.py#L144-L158 | train |
iotile/coretools | iotileemulate/iotile/emulate/reference/reference_device.py | ReferenceDevice.close_streaming_interface | def close_streaming_interface(self):
"""Called when someone closes the streaming interface to the device.
This method will automatically notify sensor_graph that there is a no
longer a streaming interface opened.
"""
super(ReferenceDevice, self).close_streaming_interface()
... | python | def close_streaming_interface(self):
"""Called when someone closes the streaming interface to the device.
This method will automatically notify sensor_graph that there is a no
longer a streaming interface opened.
"""
super(ReferenceDevice, self).close_streaming_interface()
... | [
"def",
"close_streaming_interface",
"(",
"self",
")",
":",
"super",
"(",
"ReferenceDevice",
",",
"self",
")",
".",
"close_streaming_interface",
"(",
")",
"self",
".",
"rpc",
"(",
"8",
",",
"rpcs",
".",
"SG_GRAPH_INPUT",
",",
"8",
",",
"streams",
".",
"COMM... | Called when someone closes the streaming interface to the device.
This method will automatically notify sensor_graph that there is a no
longer a streaming interface opened. | [
"Called",
"when",
"someone",
"closes",
"the",
"streaming",
"interface",
"to",
"the",
"device",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/reference_device.py#L160-L169 | train |
iotile/coretools | iotilegateway/iotilegateway/supervisor/main.py | build_parser | def build_parser():
"""Build the script's argument parser."""
parser = argparse.ArgumentParser(description="The IOTile task supervisor")
parser.add_argument('-c', '--config', help="config json with options")
parser.add_argument('-v', '--verbose', action="count", default=0, help="Increase logging verbos... | python | def build_parser():
"""Build the script's argument parser."""
parser = argparse.ArgumentParser(description="The IOTile task supervisor")
parser.add_argument('-c', '--config', help="config json with options")
parser.add_argument('-v', '--verbose', action="count", default=0, help="Increase logging verbos... | [
"def",
"build_parser",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"\"The IOTile task supervisor\"",
")",
"parser",
".",
"add_argument",
"(",
"'-c'",
",",
"'--config'",
",",
"help",
"=",
"\"config json with options\"",
... | Build the script's argument parser. | [
"Build",
"the",
"script",
"s",
"argument",
"parser",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilegateway/iotilegateway/supervisor/main.py#L20-L27 | train |
iotile/coretools | iotilegateway/iotilegateway/supervisor/main.py | configure_logging | def configure_logging(verbosity):
"""Set up the global logging level.
Args:
verbosity (int): The logging verbosity
"""
root = logging.getLogger()
formatter = logging.Formatter('%(asctime)s.%(msecs)03d %(levelname).3s %(name)s %(message)s',
'%y-%m-%d %H:%M... | python | def configure_logging(verbosity):
"""Set up the global logging level.
Args:
verbosity (int): The logging verbosity
"""
root = logging.getLogger()
formatter = logging.Formatter('%(asctime)s.%(msecs)03d %(levelname).3s %(name)s %(message)s',
'%y-%m-%d %H:%M... | [
"def",
"configure_logging",
"(",
"verbosity",
")",
":",
"root",
"=",
"logging",
".",
"getLogger",
"(",
")",
"formatter",
"=",
"logging",
".",
"Formatter",
"(",
"'%(asctime)s.%(msecs)03d %(levelname).3s %(name)s %(message)s'",
",",
"'%y-%m-%d %H:%M:%S'",
")",
"handler",
... | Set up the global logging level.
Args:
verbosity (int): The logging verbosity | [
"Set",
"up",
"the",
"global",
"logging",
"level",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilegateway/iotilegateway/supervisor/main.py#L30-L51 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/__init__.py | createProgBuilder | def createProgBuilder(env):
"""This is a utility function that creates the Program
Builder in an Environment if it is not there already.
If it is already there, we return the existing one.
"""
try:
program = env['BUILDERS']['Program']
except KeyError:
import SCons.Defaults
... | python | def createProgBuilder(env):
"""This is a utility function that creates the Program
Builder in an Environment if it is not there already.
If it is already there, we return the existing one.
"""
try:
program = env['BUILDERS']['Program']
except KeyError:
import SCons.Defaults
... | [
"def",
"createProgBuilder",
"(",
"env",
")",
":",
"try",
":",
"program",
"=",
"env",
"[",
"'BUILDERS'",
"]",
"[",
"'Program'",
"]",
"except",
"KeyError",
":",
"import",
"SCons",
".",
"Defaults",
"program",
"=",
"SCons",
".",
"Builder",
".",
"Builder",
"(... | This is a utility function that creates the Program
Builder in an Environment if it is not there already.
If it is already there, we return the existing one. | [
"This",
"is",
"a",
"utility",
"function",
"that",
"creates",
"the",
"Program",
"Builder",
"in",
"an",
"Environment",
"if",
"it",
"is",
"not",
"there",
"already",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/__init__.py#L306-L326 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/__init__.py | createStaticLibBuilder | def createStaticLibBuilder(env):
"""This is a utility function that creates the StaticLibrary
Builder in an Environment if it is not there already.
If it is already there, we return the existing one.
"""
try:
static_lib = env['BUILDERS']['StaticLibrary']
except KeyError:
action... | python | def createStaticLibBuilder(env):
"""This is a utility function that creates the StaticLibrary
Builder in an Environment if it is not there already.
If it is already there, we return the existing one.
"""
try:
static_lib = env['BUILDERS']['StaticLibrary']
except KeyError:
action... | [
"def",
"createStaticLibBuilder",
"(",
"env",
")",
":",
"try",
":",
"static_lib",
"=",
"env",
"[",
"'BUILDERS'",
"]",
"[",
"'StaticLibrary'",
"]",
"except",
"KeyError",
":",
"action_list",
"=",
"[",
"SCons",
".",
"Action",
".",
"Action",
"(",
"\"$ARCOM\"",
... | This is a utility function that creates the StaticLibrary
Builder in an Environment if it is not there already.
If it is already there, we return the existing one. | [
"This",
"is",
"a",
"utility",
"function",
"that",
"creates",
"the",
"StaticLibrary",
"Builder",
"in",
"an",
"Environment",
"if",
"it",
"is",
"not",
"there",
"already",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/__init__.py#L329-L353 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/__init__.py | createSharedLibBuilder | def createSharedLibBuilder(env):
"""This is a utility function that creates the SharedLibrary
Builder in an Environment if it is not there already.
If it is already there, we return the existing one.
"""
try:
shared_lib = env['BUILDERS']['SharedLibrary']
except KeyError:
import... | python | def createSharedLibBuilder(env):
"""This is a utility function that creates the SharedLibrary
Builder in an Environment if it is not there already.
If it is already there, we return the existing one.
"""
try:
shared_lib = env['BUILDERS']['SharedLibrary']
except KeyError:
import... | [
"def",
"createSharedLibBuilder",
"(",
"env",
")",
":",
"try",
":",
"shared_lib",
"=",
"env",
"[",
"'BUILDERS'",
"]",
"[",
"'SharedLibrary'",
"]",
"except",
"KeyError",
":",
"import",
"SCons",
".",
"Defaults",
"action_list",
"=",
"[",
"SCons",
".",
"Defaults"... | This is a utility function that creates the SharedLibrary
Builder in an Environment if it is not there already.
If it is already there, we return the existing one. | [
"This",
"is",
"a",
"utility",
"function",
"that",
"creates",
"the",
"SharedLibrary",
"Builder",
"in",
"an",
"Environment",
"if",
"it",
"is",
"not",
"there",
"already",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/__init__.py#L787-L810 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/__init__.py | createLoadableModuleBuilder | def createLoadableModuleBuilder(env):
"""This is a utility function that creates the LoadableModule
Builder in an Environment if it is not there already.
If it is already there, we return the existing one.
"""
try:
ld_module = env['BUILDERS']['LoadableModule']
except KeyError:
... | python | def createLoadableModuleBuilder(env):
"""This is a utility function that creates the LoadableModule
Builder in an Environment if it is not there already.
If it is already there, we return the existing one.
"""
try:
ld_module = env['BUILDERS']['LoadableModule']
except KeyError:
... | [
"def",
"createLoadableModuleBuilder",
"(",
"env",
")",
":",
"try",
":",
"ld_module",
"=",
"env",
"[",
"'BUILDERS'",
"]",
"[",
"'LoadableModule'",
"]",
"except",
"KeyError",
":",
"import",
"SCons",
".",
"Defaults",
"action_list",
"=",
"[",
"SCons",
".",
"Defa... | This is a utility function that creates the LoadableModule
Builder in an Environment if it is not there already.
If it is already there, we return the existing one. | [
"This",
"is",
"a",
"utility",
"function",
"that",
"creates",
"the",
"LoadableModule",
"Builder",
"in",
"an",
"Environment",
"if",
"it",
"is",
"not",
"there",
"already",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/__init__.py#L812-L835 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/__init__.py | createObjBuilders | def createObjBuilders(env):
"""This is a utility function that creates the StaticObject
and SharedObject Builders in an Environment if they
are not there already.
If they are there already, we return the existing ones.
This is a separate function because soooo many Tools
use this functionality... | python | def createObjBuilders(env):
"""This is a utility function that creates the StaticObject
and SharedObject Builders in an Environment if they
are not there already.
If they are there already, we return the existing ones.
This is a separate function because soooo many Tools
use this functionality... | [
"def",
"createObjBuilders",
"(",
"env",
")",
":",
"try",
":",
"static_obj",
"=",
"env",
"[",
"'BUILDERS'",
"]",
"[",
"'StaticObject'",
"]",
"except",
"KeyError",
":",
"static_obj",
"=",
"SCons",
".",
"Builder",
".",
"Builder",
"(",
"action",
"=",
"{",
"}... | This is a utility function that creates the StaticObject
and SharedObject Builders in an Environment if they
are not there already.
If they are there already, we return the existing ones.
This is a separate function because soooo many Tools
use this functionality.
The return is a 2-tuple of (... | [
"This",
"is",
"a",
"utility",
"function",
"that",
"creates",
"the",
"StaticObject",
"and",
"SharedObject",
"Builders",
"in",
"an",
"Environment",
"if",
"they",
"are",
"not",
"there",
"already",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/__init__.py#L837-L876 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/__init__.py | CreateJarBuilder | def CreateJarBuilder(env):
"""The Jar builder expects a list of class files
which it can package into a jar file.
The jar tool provides an interface for passing other types
of java files such as .java, directories or swig interfaces
and will build them to class files in which it can package
int... | python | def CreateJarBuilder(env):
"""The Jar builder expects a list of class files
which it can package into a jar file.
The jar tool provides an interface for passing other types
of java files such as .java, directories or swig interfaces
and will build them to class files in which it can package
int... | [
"def",
"CreateJarBuilder",
"(",
"env",
")",
":",
"try",
":",
"java_jar",
"=",
"env",
"[",
"'BUILDERS'",
"]",
"[",
"'JarFile'",
"]",
"except",
"KeyError",
":",
"fs",
"=",
"SCons",
".",
"Node",
".",
"FS",
".",
"get_default_fs",
"(",
")",
"jar_com",
"=",
... | The Jar builder expects a list of class files
which it can package into a jar file.
The jar tool provides an interface for passing other types
of java files such as .java, directories or swig interfaces
and will build them to class files in which it can package
into the jar. | [
"The",
"Jar",
"builder",
"expects",
"a",
"list",
"of",
"class",
"files",
"which",
"it",
"can",
"package",
"into",
"a",
"jar",
"file",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/__init__.py#L915-L935 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/__init__.py | ToolInitializerMethod.get_builder | def get_builder(self, env):
"""
Returns the appropriate real Builder for this method name
after having the associated ToolInitializer object apply
the appropriate Tool module.
"""
builder = getattr(env, self.__name__)
self.initializer.apply_tools(env)
bu... | python | def get_builder(self, env):
"""
Returns the appropriate real Builder for this method name
after having the associated ToolInitializer object apply
the appropriate Tool module.
"""
builder = getattr(env, self.__name__)
self.initializer.apply_tools(env)
bu... | [
"def",
"get_builder",
"(",
"self",
",",
"env",
")",
":",
"builder",
"=",
"getattr",
"(",
"env",
",",
"self",
".",
"__name__",
")",
"self",
".",
"initializer",
".",
"apply_tools",
"(",
"env",
")",
"builder",
"=",
"getattr",
"(",
"env",
",",
"self",
".... | Returns the appropriate real Builder for this method name
after having the associated ToolInitializer object apply
the appropriate Tool module. | [
"Returns",
"the",
"appropriate",
"real",
"Builder",
"for",
"this",
"method",
"name",
"after",
"having",
"the",
"associated",
"ToolInitializer",
"object",
"apply",
"the",
"appropriate",
"Tool",
"module",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/__init__.py#L1009-L1029 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/__init__.py | ToolInitializer.remove_methods | def remove_methods(self, env):
"""
Removes the methods that were added by the tool initialization
so we no longer copy and re-bind them when the construction
environment gets cloned.
"""
for method in list(self.methods.values()):
env.RemoveMethod(method) | python | def remove_methods(self, env):
"""
Removes the methods that were added by the tool initialization
so we no longer copy and re-bind them when the construction
environment gets cloned.
"""
for method in list(self.methods.values()):
env.RemoveMethod(method) | [
"def",
"remove_methods",
"(",
"self",
",",
"env",
")",
":",
"for",
"method",
"in",
"list",
"(",
"self",
".",
"methods",
".",
"values",
"(",
")",
")",
":",
"env",
".",
"RemoveMethod",
"(",
"method",
")"
] | Removes the methods that were added by the tool initialization
so we no longer copy and re-bind them when the construction
environment gets cloned. | [
"Removes",
"the",
"methods",
"that",
"were",
"added",
"by",
"the",
"tool",
"initialization",
"so",
"we",
"no",
"longer",
"copy",
"and",
"re",
"-",
"bind",
"them",
"when",
"the",
"construction",
"environment",
"gets",
"cloned",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/__init__.py#L1064-L1071 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/__init__.py | ToolInitializer.apply_tools | def apply_tools(self, env):
"""
Searches the list of associated Tool modules for one that
exists, and applies that to the construction environment.
"""
for t in self.tools:
tool = SCons.Tool.Tool(t)
if tool.exists(env):
env.Tool(tool)
... | python | def apply_tools(self, env):
"""
Searches the list of associated Tool modules for one that
exists, and applies that to the construction environment.
"""
for t in self.tools:
tool = SCons.Tool.Tool(t)
if tool.exists(env):
env.Tool(tool)
... | [
"def",
"apply_tools",
"(",
"self",
",",
"env",
")",
":",
"for",
"t",
"in",
"self",
".",
"tools",
":",
"tool",
"=",
"SCons",
".",
"Tool",
".",
"Tool",
"(",
"t",
")",
"if",
"tool",
".",
"exists",
"(",
"env",
")",
":",
"env",
".",
"Tool",
"(",
"... | Searches the list of associated Tool modules for one that
exists, and applies that to the construction environment. | [
"Searches",
"the",
"list",
"of",
"associated",
"Tool",
"modules",
"for",
"one",
"that",
"exists",
"and",
"applies",
"that",
"to",
"the",
"construction",
"environment",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/__init__.py#L1073-L1082 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py | get_contents_entry | def get_contents_entry(node):
"""Fetch the contents of the entry. Returns the exact binary
contents of the file."""
try:
node = node.disambiguate(must_exist=1)
except SCons.Errors.UserError:
# There was nothing on disk with which to disambiguate
# this entry. Leave it as an Ent... | python | def get_contents_entry(node):
"""Fetch the contents of the entry. Returns the exact binary
contents of the file."""
try:
node = node.disambiguate(must_exist=1)
except SCons.Errors.UserError:
# There was nothing on disk with which to disambiguate
# this entry. Leave it as an Ent... | [
"def",
"get_contents_entry",
"(",
"node",
")",
":",
"try",
":",
"node",
"=",
"node",
".",
"disambiguate",
"(",
"must_exist",
"=",
"1",
")",
"except",
"SCons",
".",
"Errors",
".",
"UserError",
":",
"return",
"''",
"else",
":",
"return",
"_get_contents_map",... | Fetch the contents of the entry. Returns the exact binary
contents of the file. | [
"Fetch",
"the",
"contents",
"of",
"the",
"entry",
".",
"Returns",
"the",
"exact",
"binary",
"contents",
"of",
"the",
"file",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py#L188-L201 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py | get_contents_dir | def get_contents_dir(node):
"""Return content signatures and names of all our children
separated by new-lines. Ensure that the nodes are sorted."""
contents = []
for n in sorted(node.children(), key=lambda t: t.name):
contents.append('%s %s\n' % (n.get_csig(), n.name))
return ''.join(content... | python | def get_contents_dir(node):
"""Return content signatures and names of all our children
separated by new-lines. Ensure that the nodes are sorted."""
contents = []
for n in sorted(node.children(), key=lambda t: t.name):
contents.append('%s %s\n' % (n.get_csig(), n.name))
return ''.join(content... | [
"def",
"get_contents_dir",
"(",
"node",
")",
":",
"contents",
"=",
"[",
"]",
"for",
"n",
"in",
"sorted",
"(",
"node",
".",
"children",
"(",
")",
",",
"key",
"=",
"lambda",
"t",
":",
"t",
".",
"name",
")",
":",
"contents",
".",
"append",
"(",
"'%s... | Return content signatures and names of all our children
separated by new-lines. Ensure that the nodes are sorted. | [
"Return",
"content",
"signatures",
"and",
"names",
"of",
"all",
"our",
"children",
"separated",
"by",
"new",
"-",
"lines",
".",
"Ensure",
"that",
"the",
"nodes",
"are",
"sorted",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py#L203-L209 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py | Node.get_build_env | def get_build_env(self):
"""Fetch the appropriate Environment to build this node.
"""
try:
return self._memo['get_build_env']
except KeyError:
pass
result = self.get_executor().get_build_env()
self._memo['get_build_env'] = result
return res... | python | def get_build_env(self):
"""Fetch the appropriate Environment to build this node.
"""
try:
return self._memo['get_build_env']
except KeyError:
pass
result = self.get_executor().get_build_env()
self._memo['get_build_env'] = result
return res... | [
"def",
"get_build_env",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"_memo",
"[",
"'get_build_env'",
"]",
"except",
"KeyError",
":",
"pass",
"result",
"=",
"self",
".",
"get_executor",
"(",
")",
".",
"get_build_env",
"(",
")",
"self",
".",
... | Fetch the appropriate Environment to build this node. | [
"Fetch",
"the",
"appropriate",
"Environment",
"to",
"build",
"this",
"node",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py#L616-L625 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py | Node.get_executor | def get_executor(self, create=1):
"""Fetch the action executor for this node. Create one if
there isn't already one, and requested to do so."""
try:
executor = self.executor
except AttributeError:
if not create:
raise
try:
... | python | def get_executor(self, create=1):
"""Fetch the action executor for this node. Create one if
there isn't already one, and requested to do so."""
try:
executor = self.executor
except AttributeError:
if not create:
raise
try:
... | [
"def",
"get_executor",
"(",
"self",
",",
"create",
"=",
"1",
")",
":",
"try",
":",
"executor",
"=",
"self",
".",
"executor",
"except",
"AttributeError",
":",
"if",
"not",
"create",
":",
"raise",
"try",
":",
"act",
"=",
"self",
".",
"builder",
".",
"a... | Fetch the action executor for this node. Create one if
there isn't already one, and requested to do so. | [
"Fetch",
"the",
"action",
"executor",
"for",
"this",
"node",
".",
"Create",
"one",
"if",
"there",
"isn",
"t",
"already",
"one",
"and",
"requested",
"to",
"do",
"so",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py#L635-L654 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py | Node.executor_cleanup | def executor_cleanup(self):
"""Let the executor clean up any cached information."""
try:
executor = self.get_executor(create=None)
except AttributeError:
pass
else:
if executor is not None:
executor.cleanup() | python | def executor_cleanup(self):
"""Let the executor clean up any cached information."""
try:
executor = self.get_executor(create=None)
except AttributeError:
pass
else:
if executor is not None:
executor.cleanup() | [
"def",
"executor_cleanup",
"(",
"self",
")",
":",
"try",
":",
"executor",
"=",
"self",
".",
"get_executor",
"(",
"create",
"=",
"None",
")",
"except",
"AttributeError",
":",
"pass",
"else",
":",
"if",
"executor",
"is",
"not",
"None",
":",
"executor",
"."... | Let the executor clean up any cached information. | [
"Let",
"the",
"executor",
"clean",
"up",
"any",
"cached",
"information",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py#L656-L664 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py | Node.prepare | def prepare(self):
"""Prepare for this Node to be built.
This is called after the Taskmaster has decided that the Node
is out-of-date and must be rebuilt, but before actually calling
the method to build the Node.
This default implementation checks that explicit or implicit
... | python | def prepare(self):
"""Prepare for this Node to be built.
This is called after the Taskmaster has decided that the Node
is out-of-date and must be rebuilt, but before actually calling
the method to build the Node.
This default implementation checks that explicit or implicit
... | [
"def",
"prepare",
"(",
"self",
")",
":",
"if",
"self",
".",
"depends",
"is",
"not",
"None",
":",
"for",
"d",
"in",
"self",
".",
"depends",
":",
"if",
"d",
".",
"missing",
"(",
")",
":",
"msg",
"=",
"\"Explicit dependency `%s' not found, needed by target `%... | Prepare for this Node to be built.
This is called after the Taskmaster has decided that the Node
is out-of-date and must be rebuilt, but before actually calling
the method to build the Node.
This default implementation checks that explicit or implicit
dependencies either exist ... | [
"Prepare",
"for",
"this",
"Node",
"to",
"be",
"built",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py#L703-L734 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py | Node.build | def build(self, **kw):
"""Actually build the node.
This is called by the Taskmaster after it's decided that the
Node is out-of-date and must be rebuilt, and after the prepare()
method has gotten everything, uh, prepared.
This method is called from multiple threads in a parallel... | python | def build(self, **kw):
"""Actually build the node.
This is called by the Taskmaster after it's decided that the
Node is out-of-date and must be rebuilt, and after the prepare()
method has gotten everything, uh, prepared.
This method is called from multiple threads in a parallel... | [
"def",
"build",
"(",
"self",
",",
"**",
"kw",
")",
":",
"try",
":",
"self",
".",
"get_executor",
"(",
")",
"(",
"self",
",",
"**",
"kw",
")",
"except",
"SCons",
".",
"Errors",
".",
"BuildError",
"as",
"e",
":",
"e",
".",
"node",
"=",
"self",
"r... | Actually build the node.
This is called by the Taskmaster after it's decided that the
Node is out-of-date and must be rebuilt, and after the prepare()
method has gotten everything, uh, prepared.
This method is called from multiple threads in a parallel build,
so only do thread ... | [
"Actually",
"build",
"the",
"node",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py#L736-L752 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py | Node.built | def built(self):
"""Called just after this node is successfully built."""
# Clear the implicit dependency caches of any Nodes
# waiting for this Node to be built.
for parent in self.waiting_parents:
parent.implicit = None
self.clear()
if self.pseudo:
... | python | def built(self):
"""Called just after this node is successfully built."""
# Clear the implicit dependency caches of any Nodes
# waiting for this Node to be built.
for parent in self.waiting_parents:
parent.implicit = None
self.clear()
if self.pseudo:
... | [
"def",
"built",
"(",
"self",
")",
":",
"for",
"parent",
"in",
"self",
".",
"waiting_parents",
":",
"parent",
".",
"implicit",
"=",
"None",
"self",
".",
"clear",
"(",
")",
"if",
"self",
".",
"pseudo",
":",
"if",
"self",
".",
"exists",
"(",
")",
":",... | Called just after this node is successfully built. | [
"Called",
"just",
"after",
"this",
"node",
"is",
"successfully",
"built",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py#L754-L771 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py | Node.has_builder | def has_builder(self):
"""Return whether this Node has a builder or not.
In Boolean tests, this turns out to be a *lot* more efficient
than simply examining the builder attribute directly ("if
node.builder: ..."). When the builder attribute is examined
directly, it ends up calli... | python | def has_builder(self):
"""Return whether this Node has a builder or not.
In Boolean tests, this turns out to be a *lot* more efficient
than simply examining the builder attribute directly ("if
node.builder: ..."). When the builder attribute is examined
directly, it ends up calli... | [
"def",
"has_builder",
"(",
"self",
")",
":",
"try",
":",
"b",
"=",
"self",
".",
"builder",
"except",
"AttributeError",
":",
"b",
"=",
"self",
".",
"builder",
"=",
"None",
"return",
"b",
"is",
"not",
"None"
] | Return whether this Node has a builder or not.
In Boolean tests, this turns out to be a *lot* more efficient
than simply examining the builder attribute directly ("if
node.builder: ..."). When the builder attribute is examined
directly, it ends up calling __getattr__ for both the __len_... | [
"Return",
"whether",
"this",
"Node",
"has",
"a",
"builder",
"or",
"not",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py#L858-L875 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py | Node.get_implicit_deps | def get_implicit_deps(self, env, initial_scanner, path_func, kw = {}):
"""Return a list of implicit dependencies for this node.
This method exists to handle recursive invocation of the scanner
on the implicit dependencies returned by the scanner, if the
scanner's recursive flag says tha... | python | def get_implicit_deps(self, env, initial_scanner, path_func, kw = {}):
"""Return a list of implicit dependencies for this node.
This method exists to handle recursive invocation of the scanner
on the implicit dependencies returned by the scanner, if the
scanner's recursive flag says tha... | [
"def",
"get_implicit_deps",
"(",
"self",
",",
"env",
",",
"initial_scanner",
",",
"path_func",
",",
"kw",
"=",
"{",
"}",
")",
":",
"nodes",
"=",
"[",
"self",
"]",
"seen",
"=",
"set",
"(",
"nodes",
")",
"dependencies",
"=",
"[",
"]",
"path_memo",
"=",... | Return a list of implicit dependencies for this node.
This method exists to handle recursive invocation of the scanner
on the implicit dependencies returned by the scanner, if the
scanner's recursive flag says that we should. | [
"Return",
"a",
"list",
"of",
"implicit",
"dependencies",
"for",
"this",
"node",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py#L929-L962 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py | Node.get_source_scanner | def get_source_scanner(self, node):
"""Fetch the source scanner for the specified node
NOTE: "self" is the target being built, "node" is
the source file for which we want to fetch the scanner.
Implies self.has_builder() is true; again, expect to only be
called from locations w... | python | def get_source_scanner(self, node):
"""Fetch the source scanner for the specified node
NOTE: "self" is the target being built, "node" is
the source file for which we want to fetch the scanner.
Implies self.has_builder() is true; again, expect to only be
called from locations w... | [
"def",
"get_source_scanner",
"(",
"self",
",",
"node",
")",
":",
"scanner",
"=",
"None",
"try",
":",
"scanner",
"=",
"self",
".",
"builder",
".",
"source_scanner",
"except",
"AttributeError",
":",
"pass",
"if",
"not",
"scanner",
":",
"scanner",
"=",
"self"... | Fetch the source scanner for the specified node
NOTE: "self" is the target being built, "node" is
the source file for which we want to fetch the scanner.
Implies self.has_builder() is true; again, expect to only be
called from locations where this is already verified.
This fu... | [
"Fetch",
"the",
"source",
"scanner",
"for",
"the",
"specified",
"node"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py#L987-L1011 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py | Node.scan | def scan(self):
"""Scan this node's dependents for implicit dependencies."""
# Don't bother scanning non-derived files, because we don't
# care what their dependencies are.
# Don't scan again, if we already have scanned.
if self.implicit is not None:
return
se... | python | def scan(self):
"""Scan this node's dependents for implicit dependencies."""
# Don't bother scanning non-derived files, because we don't
# care what their dependencies are.
# Don't scan again, if we already have scanned.
if self.implicit is not None:
return
se... | [
"def",
"scan",
"(",
"self",
")",
":",
"if",
"self",
".",
"implicit",
"is",
"not",
"None",
":",
"return",
"self",
".",
"implicit",
"=",
"[",
"]",
"self",
".",
"implicit_set",
"=",
"set",
"(",
")",
"self",
".",
"_children_reset",
"(",
")",
"if",
"not... | Scan this node's dependents for implicit dependencies. | [
"Scan",
"this",
"node",
"s",
"dependents",
"for",
"implicit",
"dependencies",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py#L1020-L1067 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py | Node.get_binfo | def get_binfo(self):
"""
Fetch a node's build information.
node - the node whose sources will be collected
cache - alternate node to use for the signature cache
returns - the build signature
This no longer handles the recursive descent of the
node's children's s... | python | def get_binfo(self):
"""
Fetch a node's build information.
node - the node whose sources will be collected
cache - alternate node to use for the signature cache
returns - the build signature
This no longer handles the recursive descent of the
node's children's s... | [
"def",
"get_binfo",
"(",
"self",
")",
":",
"try",
":",
"return",
"self",
".",
"binfo",
"except",
"AttributeError",
":",
"pass",
"binfo",
"=",
"self",
".",
"new_binfo",
"(",
")",
"self",
".",
"binfo",
"=",
"binfo",
"executor",
"=",
"self",
".",
"get_exe... | Fetch a node's build information.
node - the node whose sources will be collected
cache - alternate node to use for the signature cache
returns - the build signature
This no longer handles the recursive descent of the
node's children's signatures. We expect that they're
... | [
"Fetch",
"a",
"node",
"s",
"build",
"information",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py#L1109-L1155 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py | Node.add_dependency | def add_dependency(self, depend):
"""Adds dependencies."""
try:
self._add_child(self.depends, self.depends_set, depend)
except TypeError as e:
e = e.args[0]
if SCons.Util.is_List(e):
s = list(map(str, e))
else:
s = s... | python | def add_dependency(self, depend):
"""Adds dependencies."""
try:
self._add_child(self.depends, self.depends_set, depend)
except TypeError as e:
e = e.args[0]
if SCons.Util.is_List(e):
s = list(map(str, e))
else:
s = s... | [
"def",
"add_dependency",
"(",
"self",
",",
"depend",
")",
":",
"try",
":",
"self",
".",
"_add_child",
"(",
"self",
".",
"depends",
",",
"self",
".",
"depends_set",
",",
"depend",
")",
"except",
"TypeError",
"as",
"e",
":",
"e",
"=",
"e",
".",
"args",... | Adds dependencies. | [
"Adds",
"dependencies",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py#L1232-L1242 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py | Node.add_ignore | def add_ignore(self, depend):
"""Adds dependencies to ignore."""
try:
self._add_child(self.ignore, self.ignore_set, depend)
except TypeError as e:
e = e.args[0]
if SCons.Util.is_List(e):
s = list(map(str, e))
else:
s... | python | def add_ignore(self, depend):
"""Adds dependencies to ignore."""
try:
self._add_child(self.ignore, self.ignore_set, depend)
except TypeError as e:
e = e.args[0]
if SCons.Util.is_List(e):
s = list(map(str, e))
else:
s... | [
"def",
"add_ignore",
"(",
"self",
",",
"depend",
")",
":",
"try",
":",
"self",
".",
"_add_child",
"(",
"self",
".",
"ignore",
",",
"self",
".",
"ignore_set",
",",
"depend",
")",
"except",
"TypeError",
"as",
"e",
":",
"e",
"=",
"e",
".",
"args",
"["... | Adds dependencies to ignore. | [
"Adds",
"dependencies",
"to",
"ignore",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py#L1251-L1261 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py | Node.add_source | def add_source(self, source):
"""Adds sources."""
if self._specific_sources:
return
try:
self._add_child(self.sources, self.sources_set, source)
except TypeError as e:
e = e.args[0]
if SCons.Util.is_List(e):
s = list(map(str... | python | def add_source(self, source):
"""Adds sources."""
if self._specific_sources:
return
try:
self._add_child(self.sources, self.sources_set, source)
except TypeError as e:
e = e.args[0]
if SCons.Util.is_List(e):
s = list(map(str... | [
"def",
"add_source",
"(",
"self",
",",
"source",
")",
":",
"if",
"self",
".",
"_specific_sources",
":",
"return",
"try",
":",
"self",
".",
"_add_child",
"(",
"self",
".",
"sources",
",",
"self",
".",
"sources_set",
",",
"source",
")",
"except",
"TypeErro... | Adds sources. | [
"Adds",
"sources",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py#L1263-L1275 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py | Node._add_child | def _add_child(self, collection, set, child):
"""Adds 'child' to 'collection', first checking 'set' to see if it's
already present."""
added = None
for c in child:
if c not in set:
set.add(c)
collection.append(c)
added = 1
... | python | def _add_child(self, collection, set, child):
"""Adds 'child' to 'collection', first checking 'set' to see if it's
already present."""
added = None
for c in child:
if c not in set:
set.add(c)
collection.append(c)
added = 1
... | [
"def",
"_add_child",
"(",
"self",
",",
"collection",
",",
"set",
",",
"child",
")",
":",
"added",
"=",
"None",
"for",
"c",
"in",
"child",
":",
"if",
"c",
"not",
"in",
"set",
":",
"set",
".",
"add",
"(",
"c",
")",
"collection",
".",
"append",
"(",... | Adds 'child' to 'collection', first checking 'set' to see if it's
already present. | [
"Adds",
"child",
"to",
"collection",
"first",
"checking",
"set",
"to",
"see",
"if",
"it",
"s",
"already",
"present",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py#L1277-L1287 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py | Node.all_children | def all_children(self, scan=1):
"""Return a list of all the node's direct children."""
if scan:
self.scan()
# The return list may contain duplicate Nodes, especially in
# source trees where there are a lot of repeated #includes
# of a tangle of .h files. Profiling s... | python | def all_children(self, scan=1):
"""Return a list of all the node's direct children."""
if scan:
self.scan()
# The return list may contain duplicate Nodes, especially in
# source trees where there are a lot of repeated #includes
# of a tangle of .h files. Profiling s... | [
"def",
"all_children",
"(",
"self",
",",
"scan",
"=",
"1",
")",
":",
"if",
"scan",
":",
"self",
".",
"scan",
"(",
")",
"return",
"list",
"(",
"chain",
".",
"from_iterable",
"(",
"[",
"_f",
"for",
"_f",
"in",
"[",
"self",
".",
"sources",
",",
"sel... | Return a list of all the node's direct children. | [
"Return",
"a",
"list",
"of",
"all",
"the",
"node",
"s",
"direct",
"children",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py#L1341-L1363 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py | Node.Tag | def Tag(self, key, value):
""" Add a user-defined tag. """
if not self._tags:
self._tags = {}
self._tags[key] = value | python | def Tag(self, key, value):
""" Add a user-defined tag. """
if not self._tags:
self._tags = {}
self._tags[key] = value | [
"def",
"Tag",
"(",
"self",
",",
"key",
",",
"value",
")",
":",
"if",
"not",
"self",
".",
"_tags",
":",
"self",
".",
"_tags",
"=",
"{",
"}",
"self",
".",
"_tags",
"[",
"key",
"]",
"=",
"value"
] | Add a user-defined tag. | [
"Add",
"a",
"user",
"-",
"defined",
"tag",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py#L1396-L1400 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py | Node.render_include_tree | def render_include_tree(self):
"""
Return a text representation, suitable for displaying to the
user, of the include tree for the sources of this node.
"""
if self.is_derived():
env = self.get_build_env()
if env:
for s in self.sources:
... | python | def render_include_tree(self):
"""
Return a text representation, suitable for displaying to the
user, of the include tree for the sources of this node.
"""
if self.is_derived():
env = self.get_build_env()
if env:
for s in self.sources:
... | [
"def",
"render_include_tree",
"(",
"self",
")",
":",
"if",
"self",
".",
"is_derived",
"(",
")",
":",
"env",
"=",
"self",
".",
"get_build_env",
"(",
")",
"if",
"env",
":",
"for",
"s",
"in",
"self",
".",
"sources",
":",
"scanner",
"=",
"self",
".",
"... | Return a text representation, suitable for displaying to the
user, of the include tree for the sources of this node. | [
"Return",
"a",
"text",
"representation",
"suitable",
"for",
"displaying",
"to",
"the",
"user",
"of",
"the",
"include",
"tree",
"for",
"the",
"sources",
"of",
"this",
"node",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py#L1500-L1518 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py | Walker.get_next | def get_next(self):
"""Return the next node for this walk of the tree.
This function is intentionally iterative, not recursive,
to sidestep any issues of stack size limitations.
"""
while self.stack:
if self.stack[-1].wkids:
node = self.stack[-1].wki... | python | def get_next(self):
"""Return the next node for this walk of the tree.
This function is intentionally iterative, not recursive,
to sidestep any issues of stack size limitations.
"""
while self.stack:
if self.stack[-1].wkids:
node = self.stack[-1].wki... | [
"def",
"get_next",
"(",
"self",
")",
":",
"while",
"self",
".",
"stack",
":",
"if",
"self",
".",
"stack",
"[",
"-",
"1",
"]",
".",
"wkids",
":",
"node",
"=",
"self",
".",
"stack",
"[",
"-",
"1",
"]",
".",
"wkids",
".",
"pop",
"(",
"0",
")",
... | Return the next node for this walk of the tree.
This function is intentionally iterative, not recursive,
to sidestep any issues of stack size limitations. | [
"Return",
"the",
"next",
"node",
"for",
"this",
"walk",
"of",
"the",
"tree",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Node/__init__.py#L1693-L1721 | train |
iotile/coretools | iotilecore/iotile/core/scripts/iotile_script.py | timeout_thread_handler | def timeout_thread_handler(timeout, stop_event):
"""A background thread to kill the process if it takes too long.
Args:
timeout (float): The number of seconds to wait before killing
the process.
stop_event (Event): An optional event to cleanly stop the background
thread ... | python | def timeout_thread_handler(timeout, stop_event):
"""A background thread to kill the process if it takes too long.
Args:
timeout (float): The number of seconds to wait before killing
the process.
stop_event (Event): An optional event to cleanly stop the background
thread ... | [
"def",
"timeout_thread_handler",
"(",
"timeout",
",",
"stop_event",
")",
":",
"stop_happened",
"=",
"stop_event",
".",
"wait",
"(",
"timeout",
")",
"if",
"stop_happened",
"is",
"False",
":",
"print",
"(",
"\"Killing program due to %f second timeout\"",
"%",
"timeout... | A background thread to kill the process if it takes too long.
Args:
timeout (float): The number of seconds to wait before killing
the process.
stop_event (Event): An optional event to cleanly stop the background
thread if required during testing. | [
"A",
"background",
"thread",
"to",
"kill",
"the",
"process",
"if",
"it",
"takes",
"too",
"long",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/scripts/iotile_script.py#L39-L53 | train |
iotile/coretools | iotilecore/iotile/core/scripts/iotile_script.py | create_parser | def create_parser():
"""Create the argument parser for iotile."""
parser = argparse.ArgumentParser(description=DESCRIPTION, formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument('-v', '--verbose', action="count", default=0, help="Increase logging level (goes error, warn, info, debug)")
... | python | def create_parser():
"""Create the argument parser for iotile."""
parser = argparse.ArgumentParser(description=DESCRIPTION, formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument('-v', '--verbose', action="count", default=0, help="Increase logging level (goes error, warn, info, debug)")
... | [
"def",
"create_parser",
"(",
")",
":",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"description",
"=",
"DESCRIPTION",
",",
"formatter_class",
"=",
"argparse",
".",
"RawDescriptionHelpFormatter",
")",
"parser",
".",
"add_argument",
"(",
"'-v'",
",",
"'... | Create the argument parser for iotile. | [
"Create",
"the",
"argument",
"parser",
"for",
"iotile",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/scripts/iotile_script.py#L56-L68 | train |
iotile/coretools | iotilecore/iotile/core/scripts/iotile_script.py | parse_global_args | def parse_global_args(argv):
"""Parse all global iotile tool arguments.
Any flag based argument at the start of the command line is considered as
a global flag and parsed. The first non flag argument starts the commands
that are passed to the underlying hierarchical shell.
Args:
argv (lis... | python | def parse_global_args(argv):
"""Parse all global iotile tool arguments.
Any flag based argument at the start of the command line is considered as
a global flag and parsed. The first non flag argument starts the commands
that are passed to the underlying hierarchical shell.
Args:
argv (lis... | [
"def",
"parse_global_args",
"(",
"argv",
")",
":",
"parser",
"=",
"create_parser",
"(",
")",
"args",
"=",
"parser",
".",
"parse_args",
"(",
"argv",
")",
"should_log",
"=",
"args",
".",
"include",
"or",
"args",
".",
"exclude",
"or",
"(",
"args",
".",
"v... | Parse all global iotile tool arguments.
Any flag based argument at the start of the command line is considered as
a global flag and parsed. The first non flag argument starts the commands
that are passed to the underlying hierarchical shell.
Args:
argv (list): The command line for this comman... | [
"Parse",
"all",
"global",
"iotile",
"tool",
"arguments",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/scripts/iotile_script.py#L71-L132 | train |
iotile/coretools | iotilecore/iotile/core/scripts/iotile_script.py | setup_completion | def setup_completion(shell):
"""Setup readline to tab complete in a cross platform way."""
# Handle special case of importing pyreadline on Windows
# See: http://stackoverflow.com/questions/6024952/readline-functionality-on-windows-with-python-2-7
import glob
try:
import readline
except... | python | def setup_completion(shell):
"""Setup readline to tab complete in a cross platform way."""
# Handle special case of importing pyreadline on Windows
# See: http://stackoverflow.com/questions/6024952/readline-functionality-on-windows-with-python-2-7
import glob
try:
import readline
except... | [
"def",
"setup_completion",
"(",
"shell",
")",
":",
"import",
"glob",
"try",
":",
"import",
"readline",
"except",
"ImportError",
":",
"import",
"pyreadline",
"as",
"readline",
"def",
"_complete",
"(",
"text",
",",
"state",
")",
":",
"buf",
"=",
"readline",
... | Setup readline to tab complete in a cross platform way. | [
"Setup",
"readline",
"to",
"tab",
"complete",
"in",
"a",
"cross",
"platform",
"way",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/scripts/iotile_script.py#L135-L161 | train |
iotile/coretools | iotilecore/iotile/core/scripts/iotile_script.py | main | def main(argv=None):
"""Run the iotile shell tool.
You can optionally pass the arguments that should be run
in the argv parameter. If nothing is passed, the args
are pulled from sys.argv.
The return value of this function is the return value
of the shell command.
"""
if argv is None:... | python | def main(argv=None):
"""Run the iotile shell tool.
You can optionally pass the arguments that should be run
in the argv parameter. If nothing is passed, the args
are pulled from sys.argv.
The return value of this function is the return value
of the shell command.
"""
if argv is None:... | [
"def",
"main",
"(",
"argv",
"=",
"None",
")",
":",
"if",
"argv",
"is",
"None",
":",
"argv",
"=",
"sys",
".",
"argv",
"[",
"1",
":",
"]",
"args",
"=",
"parse_global_args",
"(",
"argv",
")",
"type_system",
".",
"interactive",
"=",
"True",
"line",
"="... | Run the iotile shell tool.
You can optionally pass the arguments that should be run
in the argv parameter. If nothing is passed, the args
are pulled from sys.argv.
The return value of this function is the return value
of the shell command. | [
"Run",
"the",
"iotile",
"shell",
"tool",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/scripts/iotile_script.py#L164-L271 | train |
iotile/coretools | iotilebuild/iotile/build/build/build.py | build | def build(args):
"""
Invoke the scons build system from the current directory, exactly as if
the scons tool had been invoked.
"""
# Do some sleuthing work to find scons if it's not installed into an importable
# place, as it is usually not.
scons_path = "Error"
try:
scons_path =... | python | def build(args):
"""
Invoke the scons build system from the current directory, exactly as if
the scons tool had been invoked.
"""
# Do some sleuthing work to find scons if it's not installed into an importable
# place, as it is usually not.
scons_path = "Error"
try:
scons_path =... | [
"def",
"build",
"(",
"args",
")",
":",
"scons_path",
"=",
"\"Error\"",
"try",
":",
"scons_path",
"=",
"resource_path",
"(",
"'scons-local-{}'",
".",
"format",
"(",
"SCONS_VERSION",
")",
",",
"expect",
"=",
"'folder'",
")",
"sys",
".",
"path",
".",
"insert"... | Invoke the scons build system from the current directory, exactly as if
the scons tool had been invoked. | [
"Invoke",
"the",
"scons",
"build",
"system",
"from",
"the",
"current",
"directory",
"exactly",
"as",
"if",
"the",
"scons",
"tool",
"had",
"been",
"invoked",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/build/build.py#L26-L47 | train |
iotile/coretools | iotilebuild/iotile/build/build/build.py | TargetSettings.archs | def archs(self, as_list=False):
"""Return all of the architectures for this target.
Args:
as_list (bool): Return a list instead of the default set object.
Returns:
set or list: All of the architectures used in this TargetSettings object.
"""
archs = sel... | python | def archs(self, as_list=False):
"""Return all of the architectures for this target.
Args:
as_list (bool): Return a list instead of the default set object.
Returns:
set or list: All of the architectures used in this TargetSettings object.
"""
archs = sel... | [
"def",
"archs",
"(",
"self",
",",
"as_list",
"=",
"False",
")",
":",
"archs",
"=",
"self",
".",
"arch_list",
"(",
")",
".",
"split",
"(",
"'/'",
")",
"if",
"as_list",
":",
"return",
"archs",
"return",
"set",
"(",
"archs",
")"
] | Return all of the architectures for this target.
Args:
as_list (bool): Return a list instead of the default set object.
Returns:
set or list: All of the architectures used in this TargetSettings object. | [
"Return",
"all",
"of",
"the",
"architectures",
"for",
"this",
"target",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/build/build.py#L92-L107 | train |
iotile/coretools | iotilebuild/iotile/build/build/build.py | TargetSettings.retarget | def retarget(self, remove=[], add=[]):
"""Return a TargetSettings object for the same module but with some of the architectures
removed and others added.
"""
archs = self.arch_list().split('/')
for r in remove:
if r in archs:
archs.remove(r)
... | python | def retarget(self, remove=[], add=[]):
"""Return a TargetSettings object for the same module but with some of the architectures
removed and others added.
"""
archs = self.arch_list().split('/')
for r in remove:
if r in archs:
archs.remove(r)
... | [
"def",
"retarget",
"(",
"self",
",",
"remove",
"=",
"[",
"]",
",",
"add",
"=",
"[",
"]",
")",
":",
"archs",
"=",
"self",
".",
"arch_list",
"(",
")",
".",
"split",
"(",
"'/'",
")",
"for",
"r",
"in",
"remove",
":",
"if",
"r",
"in",
"archs",
":"... | Return a TargetSettings object for the same module but with some of the architectures
removed and others added. | [
"Return",
"a",
"TargetSettings",
"object",
"for",
"the",
"same",
"module",
"but",
"with",
"some",
"of",
"the",
"architectures",
"removed",
"and",
"others",
"added",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/build/build.py#L115-L129 | train |
iotile/coretools | iotilebuild/iotile/build/build/build.py | TargetSettings.property | def property(self, name, default=MISSING):
"""Get the value of the given property for this chip, using the default
value if not found and one is provided. If not found and default is None,
raise an Exception.
"""
if name in self.settings:
return self.settings[name]
... | python | def property(self, name, default=MISSING):
"""Get the value of the given property for this chip, using the default
value if not found and one is provided. If not found and default is None,
raise an Exception.
"""
if name in self.settings:
return self.settings[name]
... | [
"def",
"property",
"(",
"self",
",",
"name",
",",
"default",
"=",
"MISSING",
")",
":",
"if",
"name",
"in",
"self",
".",
"settings",
":",
"return",
"self",
".",
"settings",
"[",
"name",
"]",
"if",
"default",
"is",
"not",
"MISSING",
":",
"return",
"def... | Get the value of the given property for this chip, using the default
value if not found and one is provided. If not found and default is None,
raise an Exception. | [
"Get",
"the",
"value",
"of",
"the",
"given",
"property",
"for",
"this",
"chip",
"using",
"the",
"default",
"value",
"if",
"not",
"found",
"and",
"one",
"is",
"provided",
".",
"If",
"not",
"found",
"and",
"default",
"is",
"None",
"raise",
"an",
"Exception... | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/build/build.py#L148-L160 | train |
iotile/coretools | iotilebuild/iotile/build/build/build.py | TargetSettings.combined_properties | def combined_properties(self, suffix):
"""Get the value of all properties whose name ends with suffix and join them
together into a list.
"""
props = [y for x, y in self.settings.items() if x.endswith(suffix)]
properties = itertools.chain(*props)
processed_props = [x fo... | python | def combined_properties(self, suffix):
"""Get the value of all properties whose name ends with suffix and join them
together into a list.
"""
props = [y for x, y in self.settings.items() if x.endswith(suffix)]
properties = itertools.chain(*props)
processed_props = [x fo... | [
"def",
"combined_properties",
"(",
"self",
",",
"suffix",
")",
":",
"props",
"=",
"[",
"y",
"for",
"x",
",",
"y",
"in",
"self",
".",
"settings",
".",
"items",
"(",
")",
"if",
"x",
".",
"endswith",
"(",
"suffix",
")",
"]",
"properties",
"=",
"iterto... | Get the value of all properties whose name ends with suffix and join them
together into a list. | [
"Get",
"the",
"value",
"of",
"all",
"properties",
"whose",
"name",
"ends",
"with",
"suffix",
"and",
"join",
"them",
"together",
"into",
"a",
"list",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/build/build.py#L162-L171 | train |
iotile/coretools | iotilebuild/iotile/build/build/build.py | TargetSettings.includes | def includes(self):
"""Return all of the include directories for this chip as a list."""
incs = self.combined_properties('includes')
processed_incs = []
for prop in incs:
if isinstance(prop, str):
processed_incs.append(prop)
else:
... | python | def includes(self):
"""Return all of the include directories for this chip as a list."""
incs = self.combined_properties('includes')
processed_incs = []
for prop in incs:
if isinstance(prop, str):
processed_incs.append(prop)
else:
... | [
"def",
"includes",
"(",
"self",
")",
":",
"incs",
"=",
"self",
".",
"combined_properties",
"(",
"'includes'",
")",
"processed_incs",
"=",
"[",
"]",
"for",
"prop",
"in",
"incs",
":",
"if",
"isinstance",
"(",
"prop",
",",
"str",
")",
":",
"processed_incs",... | Return all of the include directories for this chip as a list. | [
"Return",
"all",
"of",
"the",
"include",
"directories",
"for",
"this",
"chip",
"as",
"a",
"list",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/build/build.py#L173-L189 | train |
iotile/coretools | iotilebuild/iotile/build/build/build.py | TargetSettings.arch_prefixes | def arch_prefixes(self):
"""Return the initial 1, 2, ..., N architectures as a prefix list
For arch1/arch2/arch3, this returns
[arch1],[arch1/arch2],[arch1/arch2/arch3]
"""
archs = self.archs(as_list=True)
prefixes = []
for i in range(1, len(archs)+1):
... | python | def arch_prefixes(self):
"""Return the initial 1, 2, ..., N architectures as a prefix list
For arch1/arch2/arch3, this returns
[arch1],[arch1/arch2],[arch1/arch2/arch3]
"""
archs = self.archs(as_list=True)
prefixes = []
for i in range(1, len(archs)+1):
... | [
"def",
"arch_prefixes",
"(",
"self",
")",
":",
"archs",
"=",
"self",
".",
"archs",
"(",
"as_list",
"=",
"True",
")",
"prefixes",
"=",
"[",
"]",
"for",
"i",
"in",
"range",
"(",
"1",
",",
"len",
"(",
"archs",
")",
"+",
"1",
")",
":",
"prefixes",
... | Return the initial 1, 2, ..., N architectures as a prefix list
For arch1/arch2/arch3, this returns
[arch1],[arch1/arch2],[arch1/arch2/arch3] | [
"Return",
"the",
"initial",
"1",
"2",
"...",
"N",
"architectures",
"as",
"a",
"prefix",
"list"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/build/build.py#L199-L212 | train |
iotile/coretools | iotilebuild/iotile/build/build/build.py | ArchitectureGroup.targets | def targets(self, module):
"""Find the targets for a given module.
Returns:
list: A sequence of all of the targets for the specified module.
"""
if module not in self.module_targets:
raise BuildError("Could not find module in targets()", module=module)
... | python | def targets(self, module):
"""Find the targets for a given module.
Returns:
list: A sequence of all of the targets for the specified module.
"""
if module not in self.module_targets:
raise BuildError("Could not find module in targets()", module=module)
... | [
"def",
"targets",
"(",
"self",
",",
"module",
")",
":",
"if",
"module",
"not",
"in",
"self",
".",
"module_targets",
":",
"raise",
"BuildError",
"(",
"\"Could not find module in targets()\"",
",",
"module",
"=",
"module",
")",
"return",
"[",
"self",
".",
"fin... | Find the targets for a given module.
Returns:
list: A sequence of all of the targets for the specified module. | [
"Find",
"the",
"targets",
"for",
"a",
"given",
"module",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/build/build.py#L283-L293 | train |
iotile/coretools | iotilebuild/iotile/build/build/build.py | ArchitectureGroup.for_all_targets | def for_all_targets(self, module, func, filter_func=None):
"""Call func once for all of the targets of this module."""
for target in self.targets(module):
if filter_func is None or filter_func(target):
func(target) | python | def for_all_targets(self, module, func, filter_func=None):
"""Call func once for all of the targets of this module."""
for target in self.targets(module):
if filter_func is None or filter_func(target):
func(target) | [
"def",
"for_all_targets",
"(",
"self",
",",
"module",
",",
"func",
",",
"filter_func",
"=",
"None",
")",
":",
"for",
"target",
"in",
"self",
".",
"targets",
"(",
"module",
")",
":",
"if",
"filter_func",
"is",
"None",
"or",
"filter_func",
"(",
"target",
... | Call func once for all of the targets of this module. | [
"Call",
"func",
"once",
"for",
"all",
"of",
"the",
"targets",
"of",
"this",
"module",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/build/build.py#L304-L309 | train |
iotile/coretools | iotilebuild/iotile/build/build/build.py | ArchitectureGroup.validate_target | def validate_target(self, target):
"""Make sure that the specified target only contains architectures that we know about."""
archs = target.split('/')
for arch in archs:
if not arch in self.archs:
return False
return True | python | def validate_target(self, target):
"""Make sure that the specified target only contains architectures that we know about."""
archs = target.split('/')
for arch in archs:
if not arch in self.archs:
return False
return True | [
"def",
"validate_target",
"(",
"self",
",",
"target",
")",
":",
"archs",
"=",
"target",
".",
"split",
"(",
"'/'",
")",
"for",
"arch",
"in",
"archs",
":",
"if",
"not",
"arch",
"in",
"self",
".",
"archs",
":",
"return",
"False",
"return",
"True"
] | Make sure that the specified target only contains architectures that we know about. | [
"Make",
"sure",
"that",
"the",
"specified",
"target",
"only",
"contains",
"architectures",
"that",
"we",
"know",
"about",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/build/build.py#L311-L320 | train |
iotile/coretools | iotilebuild/iotile/build/build/build.py | ArchitectureGroup._load_architectures | def _load_architectures(self, family):
"""Load in all of the architectural overlays for this family. An architecture adds configuration
information that is used to build a common set of source code for a particular hardware and situation.
They are stackable so that you can specify a chip and a ... | python | def _load_architectures(self, family):
"""Load in all of the architectural overlays for this family. An architecture adds configuration
information that is used to build a common set of source code for a particular hardware and situation.
They are stackable so that you can specify a chip and a ... | [
"def",
"_load_architectures",
"(",
"self",
",",
"family",
")",
":",
"if",
"\"architectures\"",
"not",
"in",
"family",
":",
"raise",
"InternalError",
"(",
"\"required architectures key not in build_settings.json for desired family\"",
")",
"for",
"key",
",",
"val",
"in",... | Load in all of the architectural overlays for this family. An architecture adds configuration
information that is used to build a common set of source code for a particular hardware and situation.
They are stackable so that you can specify a chip and a configuration for that chip, for example. | [
"Load",
"in",
"all",
"of",
"the",
"architectural",
"overlays",
"for",
"this",
"family",
".",
"An",
"architecture",
"adds",
"configuration",
"information",
"that",
"is",
"used",
"to",
"build",
"a",
"common",
"set",
"of",
"source",
"code",
"for",
"a",
"particu... | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/build/build.py#L380-L393 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/lex.py | generate | def generate(env):
"""Add Builders and construction variables for lex to an Environment."""
c_file, cxx_file = SCons.Tool.createCFileBuilders(env)
# C
c_file.add_action(".l", LexAction)
c_file.add_emitter(".l", lexEmitter)
c_file.add_action(".lex", LexAction)
c_file.add_emitter(".lex", lex... | python | def generate(env):
"""Add Builders and construction variables for lex to an Environment."""
c_file, cxx_file = SCons.Tool.createCFileBuilders(env)
# C
c_file.add_action(".l", LexAction)
c_file.add_emitter(".l", lexEmitter)
c_file.add_action(".lex", LexAction)
c_file.add_emitter(".lex", lex... | [
"def",
"generate",
"(",
"env",
")",
":",
"c_file",
",",
"cxx_file",
"=",
"SCons",
".",
"Tool",
".",
"createCFileBuilders",
"(",
"env",
")",
"c_file",
".",
"add_action",
"(",
"\".l\"",
",",
"LexAction",
")",
"c_file",
".",
"add_emitter",
"(",
"\".l\"",
",... | Add Builders and construction variables for lex to an Environment. | [
"Add",
"Builders",
"and",
"construction",
"variables",
"for",
"lex",
"to",
"an",
"Environment",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/lex.py#L67-L88 | train |
iotile/coretools | iotileemulate/iotile/emulate/reference/controller_features/clock_manager.py | ClockManagerSubsystem.handle_tick | def handle_tick(self):
"""Internal callback every time 1 second has passed."""
self.uptime += 1
for name, interval in self.ticks.items():
if interval == 0:
continue
self.tick_counters[name] += 1
if self.tick_counters[name] == interval:
... | python | def handle_tick(self):
"""Internal callback every time 1 second has passed."""
self.uptime += 1
for name, interval in self.ticks.items():
if interval == 0:
continue
self.tick_counters[name] += 1
if self.tick_counters[name] == interval:
... | [
"def",
"handle_tick",
"(",
"self",
")",
":",
"self",
".",
"uptime",
"+=",
"1",
"for",
"name",
",",
"interval",
"in",
"self",
".",
"ticks",
".",
"items",
"(",
")",
":",
"if",
"interval",
"==",
"0",
":",
"continue",
"self",
".",
"tick_counters",
"[",
... | Internal callback every time 1 second has passed. | [
"Internal",
"callback",
"every",
"time",
"1",
"second",
"has",
"passed",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/controller_features/clock_manager.py#L143-L155 | train |
iotile/coretools | iotileemulate/iotile/emulate/reference/controller_features/clock_manager.py | ClockManagerSubsystem.set_tick | def set_tick(self, index, interval):
"""Update the a tick's interval.
Args:
index (int): The index of the tick that you want to fetch.
interval (int): The number of seconds between ticks.
Setting this to 0 will disable the tick.
Returns:
int:... | python | def set_tick(self, index, interval):
"""Update the a tick's interval.
Args:
index (int): The index of the tick that you want to fetch.
interval (int): The number of seconds between ticks.
Setting this to 0 will disable the tick.
Returns:
int:... | [
"def",
"set_tick",
"(",
"self",
",",
"index",
",",
"interval",
")",
":",
"name",
"=",
"self",
".",
"tick_name",
"(",
"index",
")",
"if",
"name",
"is",
"None",
":",
"return",
"pack_error",
"(",
"ControllerSubsystem",
".",
"SENSOR_GRAPH",
",",
"Error",
"."... | Update the a tick's interval.
Args:
index (int): The index of the tick that you want to fetch.
interval (int): The number of seconds between ticks.
Setting this to 0 will disable the tick.
Returns:
int: An error code. | [
"Update",
"the",
"a",
"tick",
"s",
"interval",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/controller_features/clock_manager.py#L157-L174 | train |
iotile/coretools | iotileemulate/iotile/emulate/reference/controller_features/clock_manager.py | ClockManagerSubsystem.get_tick | def get_tick(self, index):
"""Get a tick's interval.
Args:
index (int): The index of the tick that you want to fetch.
Returns:
int, int: Error code and The tick's interval in seconds.
A value of 0 means that the tick is disabled.
"""
name =... | python | def get_tick(self, index):
"""Get a tick's interval.
Args:
index (int): The index of the tick that you want to fetch.
Returns:
int, int: Error code and The tick's interval in seconds.
A value of 0 means that the tick is disabled.
"""
name =... | [
"def",
"get_tick",
"(",
"self",
",",
"index",
")",
":",
"name",
"=",
"self",
".",
"tick_name",
"(",
"index",
")",
"if",
"name",
"is",
"None",
":",
"return",
"[",
"pack_error",
"(",
"ControllerSubsystem",
".",
"SENSOR_GRAPH",
",",
"Error",
".",
"INVALID_A... | Get a tick's interval.
Args:
index (int): The index of the tick that you want to fetch.
Returns:
int, int: Error code and The tick's interval in seconds.
A value of 0 means that the tick is disabled. | [
"Get",
"a",
"tick",
"s",
"interval",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/controller_features/clock_manager.py#L176-L192 | train |
iotile/coretools | iotileemulate/iotile/emulate/reference/controller_features/clock_manager.py | ClockManagerSubsystem.get_time | def get_time(self, force_uptime=False):
"""Get the current UTC time or uptime.
By default, this method will return UTC time if possible and fall back
to uptime if not. If you specify, force_uptime=True, it will always
return uptime even if utc time is available.
Args:
... | python | def get_time(self, force_uptime=False):
"""Get the current UTC time or uptime.
By default, this method will return UTC time if possible and fall back
to uptime if not. If you specify, force_uptime=True, it will always
return uptime even if utc time is available.
Args:
... | [
"def",
"get_time",
"(",
"self",
",",
"force_uptime",
"=",
"False",
")",
":",
"if",
"force_uptime",
":",
"return",
"self",
".",
"uptime",
"time",
"=",
"self",
".",
"uptime",
"+",
"self",
".",
"time_offset",
"if",
"self",
".",
"is_utc",
":",
"time",
"|="... | Get the current UTC time or uptime.
By default, this method will return UTC time if possible and fall back
to uptime if not. If you specify, force_uptime=True, it will always
return uptime even if utc time is available.
Args:
force_uptime (bool): Always return uptime, defa... | [
"Get",
"the",
"current",
"UTC",
"time",
"or",
"uptime",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/controller_features/clock_manager.py#L194-L216 | train |
iotile/coretools | iotileemulate/iotile/emulate/reference/controller_features/clock_manager.py | ClockManagerSubsystem.synchronize_clock | def synchronize_clock(self, offset):
"""Persistently synchronize the clock to UTC time.
Args:
offset (int): The number of seconds since 1/1/2000 00:00Z
"""
self.time_offset = offset - self.uptime
self.is_utc = True
if self.has_rtc:
self.stored_o... | python | def synchronize_clock(self, offset):
"""Persistently synchronize the clock to UTC time.
Args:
offset (int): The number of seconds since 1/1/2000 00:00Z
"""
self.time_offset = offset - self.uptime
self.is_utc = True
if self.has_rtc:
self.stored_o... | [
"def",
"synchronize_clock",
"(",
"self",
",",
"offset",
")",
":",
"self",
".",
"time_offset",
"=",
"offset",
"-",
"self",
".",
"uptime",
"self",
".",
"is_utc",
"=",
"True",
"if",
"self",
".",
"has_rtc",
":",
"self",
".",
"stored_offset",
"=",
"self",
"... | Persistently synchronize the clock to UTC time.
Args:
offset (int): The number of seconds since 1/1/2000 00:00Z | [
"Persistently",
"synchronize",
"the",
"clock",
"to",
"UTC",
"time",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/controller_features/clock_manager.py#L218-L229 | train |
iotile/coretools | iotileemulate/iotile/emulate/reference/controller_features/clock_manager.py | ClockManagerMixin.get_user_timer | def get_user_timer(self, index):
"""Get the current value of a user timer."""
err, tick = self.clock_manager.get_tick(index)
return [err, tick] | python | def get_user_timer(self, index):
"""Get the current value of a user timer."""
err, tick = self.clock_manager.get_tick(index)
return [err, tick] | [
"def",
"get_user_timer",
"(",
"self",
",",
"index",
")",
":",
"err",
",",
"tick",
"=",
"self",
".",
"clock_manager",
".",
"get_tick",
"(",
"index",
")",
"return",
"[",
"err",
",",
"tick",
"]"
] | Get the current value of a user timer. | [
"Get",
"the",
"current",
"value",
"of",
"a",
"user",
"timer",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/controller_features/clock_manager.py#L245-L249 | train |
iotile/coretools | iotileemulate/iotile/emulate/reference/controller_features/clock_manager.py | ClockManagerMixin.set_user_timer | def set_user_timer(self, value, index):
"""Set the current value of a user timer."""
err = self.clock_manager.set_tick(index, value)
return [err] | python | def set_user_timer(self, value, index):
"""Set the current value of a user timer."""
err = self.clock_manager.set_tick(index, value)
return [err] | [
"def",
"set_user_timer",
"(",
"self",
",",
"value",
",",
"index",
")",
":",
"err",
"=",
"self",
".",
"clock_manager",
".",
"set_tick",
"(",
"index",
",",
"value",
")",
"return",
"[",
"err",
"]"
] | Set the current value of a user timer. | [
"Set",
"the",
"current",
"value",
"of",
"a",
"user",
"timer",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/controller_features/clock_manager.py#L252-L256 | train |
iotile/coretools | iotileemulate/iotile/emulate/reference/controller_features/clock_manager.py | ClockManagerMixin.set_time_offset | def set_time_offset(self, offset, is_utc):
"""Temporarily set the current time offset."""
is_utc = bool(is_utc)
self.clock_manager.time_offset = offset
self.clock_manager.is_utc = is_utc
return [Error.NO_ERROR] | python | def set_time_offset(self, offset, is_utc):
"""Temporarily set the current time offset."""
is_utc = bool(is_utc)
self.clock_manager.time_offset = offset
self.clock_manager.is_utc = is_utc
return [Error.NO_ERROR] | [
"def",
"set_time_offset",
"(",
"self",
",",
"offset",
",",
"is_utc",
")",
":",
"is_utc",
"=",
"bool",
"(",
"is_utc",
")",
"self",
".",
"clock_manager",
".",
"time_offset",
"=",
"offset",
"self",
".",
"clock_manager",
".",
"is_utc",
"=",
"is_utc",
"return",... | Temporarily set the current time offset. | [
"Temporarily",
"set",
"the",
"current",
"time",
"offset",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/controller_features/clock_manager.py#L281-L288 | train |
iotile/coretools | iotile_ext_cloud/iotile/cloud/utilities.py | device_id_to_slug | def device_id_to_slug(did):
""" Converts a device id into a correct device slug.
Args:
did (long) : A device id
did (string) : A device slug in the form of XXXX, XXXX-XXXX-XXXX, d--XXXX, d--XXXX-XXXX-XXXX-XXXX
Returns:
str: The device slug in the d--XXXX-XXXX-XXXX-XXXX format
Ra... | python | def device_id_to_slug(did):
""" Converts a device id into a correct device slug.
Args:
did (long) : A device id
did (string) : A device slug in the form of XXXX, XXXX-XXXX-XXXX, d--XXXX, d--XXXX-XXXX-XXXX-XXXX
Returns:
str: The device slug in the d--XXXX-XXXX-XXXX-XXXX format
Ra... | [
"def",
"device_id_to_slug",
"(",
"did",
")",
":",
"try",
":",
"device_slug",
"=",
"IOTileDeviceSlug",
"(",
"did",
",",
"allow_64bits",
"=",
"False",
")",
"except",
"ValueError",
":",
"raise",
"ArgumentError",
"(",
"\"Unable to recognize {} as a device id\"",
".",
... | Converts a device id into a correct device slug.
Args:
did (long) : A device id
did (string) : A device slug in the form of XXXX, XXXX-XXXX-XXXX, d--XXXX, d--XXXX-XXXX-XXXX-XXXX
Returns:
str: The device slug in the d--XXXX-XXXX-XXXX-XXXX format
Raises:
ArgumentError: if the ... | [
"Converts",
"a",
"device",
"id",
"into",
"a",
"correct",
"device",
"slug",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotile_ext_cloud/iotile/cloud/utilities.py#L31-L48 | train |
iotile/coretools | iotile_ext_cloud/iotile/cloud/utilities.py | fleet_id_to_slug | def fleet_id_to_slug(did):
""" Converts a fleet id into a correct fleet slug.
Args:
did (long) : A fleet id
did (string) : A device slug in the form of XXXX, XXXX-XXXX-XXXX, g--XXXX, g--XXXX-XXXX-XXXX
Returns:
str: The device slug in the g--XXXX-XXXX-XXX format
Raises:
A... | python | def fleet_id_to_slug(did):
""" Converts a fleet id into a correct fleet slug.
Args:
did (long) : A fleet id
did (string) : A device slug in the form of XXXX, XXXX-XXXX-XXXX, g--XXXX, g--XXXX-XXXX-XXXX
Returns:
str: The device slug in the g--XXXX-XXXX-XXX format
Raises:
A... | [
"def",
"fleet_id_to_slug",
"(",
"did",
")",
":",
"try",
":",
"fleet_slug",
"=",
"IOTileFleetSlug",
"(",
"did",
")",
"except",
"ValueError",
":",
"raise",
"ArgumentError",
"(",
"\"Unable to recognize {} as a fleet id\"",
".",
"format",
"(",
"did",
")",
")",
"retu... | Converts a fleet id into a correct fleet slug.
Args:
did (long) : A fleet id
did (string) : A device slug in the form of XXXX, XXXX-XXXX-XXXX, g--XXXX, g--XXXX-XXXX-XXXX
Returns:
str: The device slug in the g--XXXX-XXXX-XXX format
Raises:
ArgumentError: if the ID is not in t... | [
"Converts",
"a",
"fleet",
"id",
"into",
"a",
"correct",
"fleet",
"slug",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotile_ext_cloud/iotile/cloud/utilities.py#L51-L68 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Platform/win32.py | get_architecture | def get_architecture(arch=None):
"""Returns the definition for the specified architecture string.
If no string is specified, the system default is returned (as defined
by the PROCESSOR_ARCHITEW6432 or PROCESSOR_ARCHITECTURE environment
variables).
"""
if arch is None:
arch = os.environ.... | python | def get_architecture(arch=None):
"""Returns the definition for the specified architecture string.
If no string is specified, the system default is returned (as defined
by the PROCESSOR_ARCHITEW6432 or PROCESSOR_ARCHITECTURE environment
variables).
"""
if arch is None:
arch = os.environ.... | [
"def",
"get_architecture",
"(",
"arch",
"=",
"None",
")",
":",
"if",
"arch",
"is",
"None",
":",
"arch",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"'PROCESSOR_ARCHITEW6432'",
")",
"if",
"not",
"arch",
":",
"arch",
"=",
"os",
".",
"environ",
".",
"ge... | Returns the definition for the specified architecture string.
If no string is specified, the system default is returned (as defined
by the PROCESSOR_ARCHITEW6432 or PROCESSOR_ARCHITECTURE environment
variables). | [
"Returns",
"the",
"definition",
"for",
"the",
"specified",
"architecture",
"string",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Platform/win32.py#L358-L369 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/rpm.py | generate | def generate(env):
"""Add Builders and construction variables for rpm to an Environment."""
try:
bld = env['BUILDERS']['Rpm']
except KeyError:
bld = RpmBuilder
env['BUILDERS']['Rpm'] = bld
env.SetDefault(RPM = 'LC_ALL=C rpmbuild')
env.SetDefault(RPMFLAGS = SCons... | python | def generate(env):
"""Add Builders and construction variables for rpm to an Environment."""
try:
bld = env['BUILDERS']['Rpm']
except KeyError:
bld = RpmBuilder
env['BUILDERS']['Rpm'] = bld
env.SetDefault(RPM = 'LC_ALL=C rpmbuild')
env.SetDefault(RPMFLAGS = SCons... | [
"def",
"generate",
"(",
"env",
")",
":",
"try",
":",
"bld",
"=",
"env",
"[",
"'BUILDERS'",
"]",
"[",
"'Rpm'",
"]",
"except",
"KeyError",
":",
"bld",
"=",
"RpmBuilder",
"env",
"[",
"'BUILDERS'",
"]",
"[",
"'Rpm'",
"]",
"=",
"bld",
"env",
".",
"SetDe... | Add Builders and construction variables for rpm to an Environment. | [
"Add",
"Builders",
"and",
"construction",
"variables",
"for",
"rpm",
"to",
"an",
"Environment",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/rpm.py#L112-L123 | train |
iotile/coretools | transport_plugins/awsiot/iotile_transport_awsiot/topic_sequencer.py | TopicSequencer.next_id | def next_id(self, channel):
"""Get the next sequence number for a named channel or topic
If channel has not been sent to next_id before, 0 is returned
otherwise next_id returns the last id returned + 1.
Args:
channel (string): The name of the channel to get a sequential
... | python | def next_id(self, channel):
"""Get the next sequence number for a named channel or topic
If channel has not been sent to next_id before, 0 is returned
otherwise next_id returns the last id returned + 1.
Args:
channel (string): The name of the channel to get a sequential
... | [
"def",
"next_id",
"(",
"self",
",",
"channel",
")",
":",
"if",
"channel",
"not",
"in",
"self",
".",
"topics",
":",
"self",
".",
"topics",
"[",
"channel",
"]",
"=",
"0",
"return",
"0",
"self",
".",
"topics",
"[",
"channel",
"]",
"+=",
"1",
"return",... | Get the next sequence number for a named channel or topic
If channel has not been sent to next_id before, 0 is returned
otherwise next_id returns the last id returned + 1.
Args:
channel (string): The name of the channel to get a sequential
id for.
Returns:
... | [
"Get",
"the",
"next",
"sequence",
"number",
"for",
"a",
"named",
"channel",
"or",
"topic"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/transport_plugins/awsiot/iotile_transport_awsiot/topic_sequencer.py#L16-L35 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Platform/posix.py | escape | def escape(arg):
"escape shell special characters"
slash = '\\'
special = '"$'
arg = arg.replace(slash, slash+slash)
for c in special:
arg = arg.replace(c, slash+c)
# print("ESCAPE RESULT: %s" % arg)
return '"' + arg + '"' | python | def escape(arg):
"escape shell special characters"
slash = '\\'
special = '"$'
arg = arg.replace(slash, slash+slash)
for c in special:
arg = arg.replace(c, slash+c)
# print("ESCAPE RESULT: %s" % arg)
return '"' + arg + '"' | [
"def",
"escape",
"(",
"arg",
")",
":",
"\"escape shell special characters\"",
"slash",
"=",
"'\\\\'",
"special",
"=",
"'\"$'",
"arg",
"=",
"arg",
".",
"replace",
"(",
"slash",
",",
"slash",
"+",
"slash",
")",
"for",
"c",
"in",
"special",
":",
"arg",
"=",... | escape shell special characters | [
"escape",
"shell",
"special",
"characters"
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Platform/posix.py#L50-L60 | train |
iotile/coretools | iotileemulate/iotile/emulate/reference/controller_features/stream_manager.py | BasicStreamingSubsystem.process_streamer | def process_streamer(self, streamer, callback=None):
"""Start streaming a streamer.
Args:
streamer (DataStreamer): The streamer itself.
callback (callable): An optional callable that will be called as:
callable(index, success, highest_id_received_from_other_side)... | python | def process_streamer(self, streamer, callback=None):
"""Start streaming a streamer.
Args:
streamer (DataStreamer): The streamer itself.
callback (callable): An optional callable that will be called as:
callable(index, success, highest_id_received_from_other_side)... | [
"def",
"process_streamer",
"(",
"self",
",",
"streamer",
",",
"callback",
"=",
"None",
")",
":",
"index",
"=",
"streamer",
".",
"index",
"if",
"index",
"in",
"self",
".",
"_in_progress_streamers",
":",
"raise",
"InternalError",
"(",
"\"You cannot add a streamer ... | Start streaming a streamer.
Args:
streamer (DataStreamer): The streamer itself.
callback (callable): An optional callable that will be called as:
callable(index, success, highest_id_received_from_other_side) | [
"Start",
"streaming",
"a",
"streamer",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotileemulate/iotile/emulate/reference/controller_features/stream_manager.py#L107-L125 | train |
iotile/coretools | iotilecore/iotile/core/hw/virtual/common_types.py | pack_rpc_response | def pack_rpc_response(response=None, exception=None):
"""Convert a response payload or exception to a status code and payload.
This function will convert an Exception raised by an RPC implementation
to the corresponding status code.
"""
if response is None:
response = bytes()
if excep... | python | def pack_rpc_response(response=None, exception=None):
"""Convert a response payload or exception to a status code and payload.
This function will convert an Exception raised by an RPC implementation
to the corresponding status code.
"""
if response is None:
response = bytes()
if excep... | [
"def",
"pack_rpc_response",
"(",
"response",
"=",
"None",
",",
"exception",
"=",
"None",
")",
":",
"if",
"response",
"is",
"None",
":",
"response",
"=",
"bytes",
"(",
")",
"if",
"exception",
"is",
"None",
":",
"status",
"=",
"(",
"1",
"<<",
"6",
")",... | Convert a response payload or exception to a status code and payload.
This function will convert an Exception raised by an RPC implementation
to the corresponding status code. | [
"Convert",
"a",
"response",
"payload",
"or",
"exception",
"to",
"a",
"status",
"code",
"and",
"payload",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/virtual/common_types.py#L45-L70 | train |
iotile/coretools | iotilecore/iotile/core/hw/virtual/common_types.py | unpack_rpc_response | def unpack_rpc_response(status, response=None, rpc_id=0, address=0):
"""Unpack an RPC status back in to payload or exception."""
status_code = status & ((1 << 6) - 1)
if address == 8:
status_code &= ~(1 << 7)
if status == 0:
raise BusyRPCResponse()
elif status == 2:
raise ... | python | def unpack_rpc_response(status, response=None, rpc_id=0, address=0):
"""Unpack an RPC status back in to payload or exception."""
status_code = status & ((1 << 6) - 1)
if address == 8:
status_code &= ~(1 << 7)
if status == 0:
raise BusyRPCResponse()
elif status == 2:
raise ... | [
"def",
"unpack_rpc_response",
"(",
"status",
",",
"response",
"=",
"None",
",",
"rpc_id",
"=",
"0",
",",
"address",
"=",
"0",
")",
":",
"status_code",
"=",
"status",
"&",
"(",
"(",
"1",
"<<",
"6",
")",
"-",
"1",
")",
"if",
"address",
"==",
"8",
"... | Unpack an RPC status back in to payload or exception. | [
"Unpack",
"an",
"RPC",
"status",
"back",
"in",
"to",
"payload",
"or",
"exception",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/virtual/common_types.py#L73-L95 | train |
iotile/coretools | iotilecore/iotile/core/hw/virtual/common_types.py | pack_rpc_payload | def pack_rpc_payload(arg_format, args):
"""Pack an RPC payload according to arg_format.
Args:
arg_format (str): a struct format code (without the <) for the
parameter format for this RPC. This format code may include the final
character V, which means that it expects a variable... | python | def pack_rpc_payload(arg_format, args):
"""Pack an RPC payload according to arg_format.
Args:
arg_format (str): a struct format code (without the <) for the
parameter format for this RPC. This format code may include the final
character V, which means that it expects a variable... | [
"def",
"pack_rpc_payload",
"(",
"arg_format",
",",
"args",
")",
":",
"code",
"=",
"_create_respcode",
"(",
"arg_format",
",",
"args",
")",
"packed_result",
"=",
"struct",
".",
"pack",
"(",
"code",
",",
"*",
"args",
")",
"unpacked_validation",
"=",
"struct",
... | Pack an RPC payload according to arg_format.
Args:
arg_format (str): a struct format code (without the <) for the
parameter format for this RPC. This format code may include the final
character V, which means that it expects a variable length bytearray.
args (list): A list ... | [
"Pack",
"an",
"RPC",
"payload",
"according",
"to",
"arg_format",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/virtual/common_types.py#L98-L118 | train |
iotile/coretools | iotilecore/iotile/core/hw/virtual/common_types.py | unpack_rpc_payload | def unpack_rpc_payload(resp_format, payload):
"""Unpack an RPC payload according to resp_format.
Args:
resp_format (str): a struct format code (without the <) for the
parameter format for this RPC. This format code may include the final
character V, which means that it expects ... | python | def unpack_rpc_payload(resp_format, payload):
"""Unpack an RPC payload according to resp_format.
Args:
resp_format (str): a struct format code (without the <) for the
parameter format for this RPC. This format code may include the final
character V, which means that it expects ... | [
"def",
"unpack_rpc_payload",
"(",
"resp_format",
",",
"payload",
")",
":",
"code",
"=",
"_create_argcode",
"(",
"resp_format",
",",
"payload",
")",
"return",
"struct",
".",
"unpack",
"(",
"code",
",",
"payload",
")"
] | Unpack an RPC payload according to resp_format.
Args:
resp_format (str): a struct format code (without the <) for the
parameter format for this RPC. This format code may include the final
character V, which means that it expects a variable length bytearray.
payload (bytes):... | [
"Unpack",
"an",
"RPC",
"payload",
"according",
"to",
"resp_format",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilecore/iotile/core/hw/virtual/common_types.py#L121-L135 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/FortranCommon.py | isfortran | def isfortran(env, source):
"""Return 1 if any of code in source has fortran files in it, 0
otherwise."""
try:
fsuffixes = env['FORTRANSUFFIXES']
except KeyError:
# If no FORTRANSUFFIXES, no fortran tool, so there is no need to look
# for fortran sources.
return 0
if... | python | def isfortran(env, source):
"""Return 1 if any of code in source has fortran files in it, 0
otherwise."""
try:
fsuffixes = env['FORTRANSUFFIXES']
except KeyError:
# If no FORTRANSUFFIXES, no fortran tool, so there is no need to look
# for fortran sources.
return 0
if... | [
"def",
"isfortran",
"(",
"env",
",",
"source",
")",
":",
"try",
":",
"fsuffixes",
"=",
"env",
"[",
"'FORTRANSUFFIXES'",
"]",
"except",
"KeyError",
":",
"return",
"0",
"if",
"not",
"source",
":",
"return",
"0",
"for",
"s",
"in",
"source",
":",
"if",
"... | Return 1 if any of code in source has fortran files in it, 0
otherwise. | [
"Return",
"1",
"if",
"any",
"of",
"code",
"in",
"source",
"has",
"fortran",
"files",
"in",
"it",
"0",
"otherwise",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/FortranCommon.py#L41-L59 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/FortranCommon.py | ComputeFortranSuffixes | def ComputeFortranSuffixes(suffixes, ppsuffixes):
"""suffixes are fortran source files, and ppsuffixes the ones to be
pre-processed. Both should be sequences, not strings."""
assert len(suffixes) > 0
s = suffixes[0]
sup = s.upper()
upper_suffixes = [_.upper() for _ in suffixes]
if SCons.Util... | python | def ComputeFortranSuffixes(suffixes, ppsuffixes):
"""suffixes are fortran source files, and ppsuffixes the ones to be
pre-processed. Both should be sequences, not strings."""
assert len(suffixes) > 0
s = suffixes[0]
sup = s.upper()
upper_suffixes = [_.upper() for _ in suffixes]
if SCons.Util... | [
"def",
"ComputeFortranSuffixes",
"(",
"suffixes",
",",
"ppsuffixes",
")",
":",
"assert",
"len",
"(",
"suffixes",
")",
">",
"0",
"s",
"=",
"suffixes",
"[",
"0",
"]",
"sup",
"=",
"s",
".",
"upper",
"(",
")",
"upper_suffixes",
"=",
"[",
"_",
".",
"upper... | suffixes are fortran source files, and ppsuffixes the ones to be
pre-processed. Both should be sequences, not strings. | [
"suffixes",
"are",
"fortran",
"source",
"files",
"and",
"ppsuffixes",
"the",
"ones",
"to",
"be",
"pre",
"-",
"processed",
".",
"Both",
"should",
"be",
"sequences",
"not",
"strings",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/FortranCommon.py#L88-L98 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/FortranCommon.py | CreateDialectActions | def CreateDialectActions(dialect):
"""Create dialect specific actions."""
CompAction = SCons.Action.Action('$%sCOM ' % dialect, '$%sCOMSTR' % dialect)
CompPPAction = SCons.Action.Action('$%sPPCOM ' % dialect, '$%sPPCOMSTR' % dialect)
ShCompAction = SCons.Action.Action('$SH%sCOM ' % dialect, '$SH%sCOMSTR... | python | def CreateDialectActions(dialect):
"""Create dialect specific actions."""
CompAction = SCons.Action.Action('$%sCOM ' % dialect, '$%sCOMSTR' % dialect)
CompPPAction = SCons.Action.Action('$%sPPCOM ' % dialect, '$%sPPCOMSTR' % dialect)
ShCompAction = SCons.Action.Action('$SH%sCOM ' % dialect, '$SH%sCOMSTR... | [
"def",
"CreateDialectActions",
"(",
"dialect",
")",
":",
"CompAction",
"=",
"SCons",
".",
"Action",
".",
"Action",
"(",
"'$%sCOM '",
"%",
"dialect",
",",
"'$%sCOMSTR'",
"%",
"dialect",
")",
"CompPPAction",
"=",
"SCons",
".",
"Action",
".",
"Action",
"(",
"... | Create dialect specific actions. | [
"Create",
"dialect",
"specific",
"actions",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/FortranCommon.py#L100-L107 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/FortranCommon.py | DialectAddToEnv | def DialectAddToEnv(env, dialect, suffixes, ppsuffixes, support_module = 0):
"""Add dialect specific construction variables."""
ComputeFortranSuffixes(suffixes, ppsuffixes)
fscan = SCons.Scanner.Fortran.FortranScan("%sPATH" % dialect)
for suffix in suffixes + ppsuffixes:
SCons.Tool.SourceFileS... | python | def DialectAddToEnv(env, dialect, suffixes, ppsuffixes, support_module = 0):
"""Add dialect specific construction variables."""
ComputeFortranSuffixes(suffixes, ppsuffixes)
fscan = SCons.Scanner.Fortran.FortranScan("%sPATH" % dialect)
for suffix in suffixes + ppsuffixes:
SCons.Tool.SourceFileS... | [
"def",
"DialectAddToEnv",
"(",
"env",
",",
"dialect",
",",
"suffixes",
",",
"ppsuffixes",
",",
"support_module",
"=",
"0",
")",
":",
"ComputeFortranSuffixes",
"(",
"suffixes",
",",
"ppsuffixes",
")",
"fscan",
"=",
"SCons",
".",
"Scanner",
".",
"Fortran",
"."... | Add dialect specific construction variables. | [
"Add",
"dialect",
"specific",
"construction",
"variables",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/FortranCommon.py#L109-L161 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/FortranCommon.py | add_fortran_to_env | def add_fortran_to_env(env):
"""Add Builders and construction variables for Fortran to an Environment."""
try:
FortranSuffixes = env['FORTRANFILESUFFIXES']
except KeyError:
FortranSuffixes = ['.f', '.for', '.ftn']
#print("Adding %s to fortran suffixes" % FortranSuffixes)
try:
... | python | def add_fortran_to_env(env):
"""Add Builders and construction variables for Fortran to an Environment."""
try:
FortranSuffixes = env['FORTRANFILESUFFIXES']
except KeyError:
FortranSuffixes = ['.f', '.for', '.ftn']
#print("Adding %s to fortran suffixes" % FortranSuffixes)
try:
... | [
"def",
"add_fortran_to_env",
"(",
"env",
")",
":",
"try",
":",
"FortranSuffixes",
"=",
"env",
"[",
"'FORTRANFILESUFFIXES'",
"]",
"except",
"KeyError",
":",
"FortranSuffixes",
"=",
"[",
"'.f'",
",",
"'.for'",
",",
"'.ftn'",
"]",
"try",
":",
"FortranPPSuffixes",... | Add Builders and construction variables for Fortran to an Environment. | [
"Add",
"Builders",
"and",
"construction",
"variables",
"for",
"Fortran",
"to",
"an",
"Environment",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/FortranCommon.py#L163-L185 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/FortranCommon.py | add_f77_to_env | def add_f77_to_env(env):
"""Add Builders and construction variables for f77 to an Environment."""
try:
F77Suffixes = env['F77FILESUFFIXES']
except KeyError:
F77Suffixes = ['.f77']
#print("Adding %s to f77 suffixes" % F77Suffixes)
try:
F77PPSuffixes = env['F77PPFILESUFFIXES']... | python | def add_f77_to_env(env):
"""Add Builders and construction variables for f77 to an Environment."""
try:
F77Suffixes = env['F77FILESUFFIXES']
except KeyError:
F77Suffixes = ['.f77']
#print("Adding %s to f77 suffixes" % F77Suffixes)
try:
F77PPSuffixes = env['F77PPFILESUFFIXES']... | [
"def",
"add_f77_to_env",
"(",
"env",
")",
":",
"try",
":",
"F77Suffixes",
"=",
"env",
"[",
"'F77FILESUFFIXES'",
"]",
"except",
"KeyError",
":",
"F77Suffixes",
"=",
"[",
"'.f77'",
"]",
"try",
":",
"F77PPSuffixes",
"=",
"env",
"[",
"'F77PPFILESUFFIXES'",
"]",
... | Add Builders and construction variables for f77 to an Environment. | [
"Add",
"Builders",
"and",
"construction",
"variables",
"for",
"f77",
"to",
"an",
"Environment",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/FortranCommon.py#L187-L200 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/FortranCommon.py | add_f90_to_env | def add_f90_to_env(env):
"""Add Builders and construction variables for f90 to an Environment."""
try:
F90Suffixes = env['F90FILESUFFIXES']
except KeyError:
F90Suffixes = ['.f90']
#print("Adding %s to f90 suffixes" % F90Suffixes)
try:
F90PPSuffixes = env['F90PPFILESUFFIXES']... | python | def add_f90_to_env(env):
"""Add Builders and construction variables for f90 to an Environment."""
try:
F90Suffixes = env['F90FILESUFFIXES']
except KeyError:
F90Suffixes = ['.f90']
#print("Adding %s to f90 suffixes" % F90Suffixes)
try:
F90PPSuffixes = env['F90PPFILESUFFIXES']... | [
"def",
"add_f90_to_env",
"(",
"env",
")",
":",
"try",
":",
"F90Suffixes",
"=",
"env",
"[",
"'F90FILESUFFIXES'",
"]",
"except",
"KeyError",
":",
"F90Suffixes",
"=",
"[",
"'.f90'",
"]",
"try",
":",
"F90PPSuffixes",
"=",
"env",
"[",
"'F90PPFILESUFFIXES'",
"]",
... | Add Builders and construction variables for f90 to an Environment. | [
"Add",
"Builders",
"and",
"construction",
"variables",
"for",
"f90",
"to",
"an",
"Environment",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/FortranCommon.py#L202-L216 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/FortranCommon.py | add_f95_to_env | def add_f95_to_env(env):
"""Add Builders and construction variables for f95 to an Environment."""
try:
F95Suffixes = env['F95FILESUFFIXES']
except KeyError:
F95Suffixes = ['.f95']
#print("Adding %s to f95 suffixes" % F95Suffixes)
try:
F95PPSuffixes = env['F95PPFILESUFFIXES']... | python | def add_f95_to_env(env):
"""Add Builders and construction variables for f95 to an Environment."""
try:
F95Suffixes = env['F95FILESUFFIXES']
except KeyError:
F95Suffixes = ['.f95']
#print("Adding %s to f95 suffixes" % F95Suffixes)
try:
F95PPSuffixes = env['F95PPFILESUFFIXES']... | [
"def",
"add_f95_to_env",
"(",
"env",
")",
":",
"try",
":",
"F95Suffixes",
"=",
"env",
"[",
"'F95FILESUFFIXES'",
"]",
"except",
"KeyError",
":",
"F95Suffixes",
"=",
"[",
"'.f95'",
"]",
"try",
":",
"F95PPSuffixes",
"=",
"env",
"[",
"'F95PPFILESUFFIXES'",
"]",
... | Add Builders and construction variables for f95 to an Environment. | [
"Add",
"Builders",
"and",
"construction",
"variables",
"for",
"f95",
"to",
"an",
"Environment",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/FortranCommon.py#L218-L232 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/FortranCommon.py | add_f03_to_env | def add_f03_to_env(env):
"""Add Builders and construction variables for f03 to an Environment."""
try:
F03Suffixes = env['F03FILESUFFIXES']
except KeyError:
F03Suffixes = ['.f03']
#print("Adding %s to f95 suffixes" % F95Suffixes)
try:
F03PPSuffixes = env['F03PPFILESUFFIXES']... | python | def add_f03_to_env(env):
"""Add Builders and construction variables for f03 to an Environment."""
try:
F03Suffixes = env['F03FILESUFFIXES']
except KeyError:
F03Suffixes = ['.f03']
#print("Adding %s to f95 suffixes" % F95Suffixes)
try:
F03PPSuffixes = env['F03PPFILESUFFIXES']... | [
"def",
"add_f03_to_env",
"(",
"env",
")",
":",
"try",
":",
"F03Suffixes",
"=",
"env",
"[",
"'F03FILESUFFIXES'",
"]",
"except",
"KeyError",
":",
"F03Suffixes",
"=",
"[",
"'.f03'",
"]",
"try",
":",
"F03PPSuffixes",
"=",
"env",
"[",
"'F03PPFILESUFFIXES'",
"]",
... | Add Builders and construction variables for f03 to an Environment. | [
"Add",
"Builders",
"and",
"construction",
"variables",
"for",
"f03",
"to",
"an",
"Environment",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/FortranCommon.py#L234-L248 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/FortranCommon.py | add_f08_to_env | def add_f08_to_env(env):
"""Add Builders and construction variables for f08 to an Environment."""
try:
F08Suffixes = env['F08FILESUFFIXES']
except KeyError:
F08Suffixes = ['.f08']
try:
F08PPSuffixes = env['F08PPFILESUFFIXES']
except KeyError:
F08PPSuffixes = []
... | python | def add_f08_to_env(env):
"""Add Builders and construction variables for f08 to an Environment."""
try:
F08Suffixes = env['F08FILESUFFIXES']
except KeyError:
F08Suffixes = ['.f08']
try:
F08PPSuffixes = env['F08PPFILESUFFIXES']
except KeyError:
F08PPSuffixes = []
... | [
"def",
"add_f08_to_env",
"(",
"env",
")",
":",
"try",
":",
"F08Suffixes",
"=",
"env",
"[",
"'F08FILESUFFIXES'",
"]",
"except",
"KeyError",
":",
"F08Suffixes",
"=",
"[",
"'.f08'",
"]",
"try",
":",
"F08PPSuffixes",
"=",
"env",
"[",
"'F08PPFILESUFFIXES'",
"]",
... | Add Builders and construction variables for f08 to an Environment. | [
"Add",
"Builders",
"and",
"construction",
"variables",
"for",
"f08",
"to",
"an",
"Environment",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/FortranCommon.py#L250-L263 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/FortranCommon.py | add_all_to_env | def add_all_to_env(env):
"""Add builders and construction variables for all supported fortran
dialects."""
add_fortran_to_env(env)
add_f77_to_env(env)
add_f90_to_env(env)
add_f95_to_env(env)
add_f03_to_env(env)
add_f08_to_env(env) | python | def add_all_to_env(env):
"""Add builders and construction variables for all supported fortran
dialects."""
add_fortran_to_env(env)
add_f77_to_env(env)
add_f90_to_env(env)
add_f95_to_env(env)
add_f03_to_env(env)
add_f08_to_env(env) | [
"def",
"add_all_to_env",
"(",
"env",
")",
":",
"add_fortran_to_env",
"(",
"env",
")",
"add_f77_to_env",
"(",
"env",
")",
"add_f90_to_env",
"(",
"env",
")",
"add_f95_to_env",
"(",
"env",
")",
"add_f03_to_env",
"(",
"env",
")",
"add_f08_to_env",
"(",
"env",
")... | Add builders and construction variables for all supported fortran
dialects. | [
"Add",
"builders",
"and",
"construction",
"variables",
"for",
"all",
"supported",
"fortran",
"dialects",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Tool/FortranCommon.py#L265-L273 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Environment.py | _delete_duplicates | def _delete_duplicates(l, keep_last):
"""Delete duplicates from a sequence, keeping the first or last."""
seen=set()
result=[]
if keep_last: # reverse in & out, then keep first
l.reverse()
for i in l:
try:
if i not in seen:
result.append(i)
... | python | def _delete_duplicates(l, keep_last):
"""Delete duplicates from a sequence, keeping the first or last."""
seen=set()
result=[]
if keep_last: # reverse in & out, then keep first
l.reverse()
for i in l:
try:
if i not in seen:
result.append(i)
... | [
"def",
"_delete_duplicates",
"(",
"l",
",",
"keep_last",
")",
":",
"seen",
"=",
"set",
"(",
")",
"result",
"=",
"[",
"]",
"if",
"keep_last",
":",
"l",
".",
"reverse",
"(",
")",
"for",
"i",
"in",
"l",
":",
"try",
":",
"if",
"i",
"not",
"in",
"se... | Delete duplicates from a sequence, keeping the first or last. | [
"Delete",
"duplicates",
"from",
"a",
"sequence",
"keeping",
"the",
"first",
"or",
"last",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Environment.py#L168-L184 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Environment.py | MethodWrapper.clone | def clone(self, new_object):
"""
Returns an object that re-binds the underlying "method" to
the specified new object.
"""
return self.__class__(new_object, self.method, self.name) | python | def clone(self, new_object):
"""
Returns an object that re-binds the underlying "method" to
the specified new object.
"""
return self.__class__(new_object, self.method, self.name) | [
"def",
"clone",
"(",
"self",
",",
"new_object",
")",
":",
"return",
"self",
".",
"__class__",
"(",
"new_object",
",",
"self",
".",
"method",
",",
"self",
".",
"name",
")"
] | Returns an object that re-binds the underlying "method" to
the specified new object. | [
"Returns",
"an",
"object",
"that",
"re",
"-",
"binds",
"the",
"underlying",
"method",
"to",
"the",
"specified",
"new",
"object",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Environment.py#L226-L231 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Environment.py | SubstitutionEnvironment._init_special | def _init_special(self):
"""Initial the dispatch tables for special handling of
special construction variables."""
self._special_del = {}
self._special_del['SCANNERS'] = _del_SCANNERS
self._special_set = {}
for key in reserved_construction_var_names:
self._sp... | python | def _init_special(self):
"""Initial the dispatch tables for special handling of
special construction variables."""
self._special_del = {}
self._special_del['SCANNERS'] = _del_SCANNERS
self._special_set = {}
for key in reserved_construction_var_names:
self._sp... | [
"def",
"_init_special",
"(",
"self",
")",
":",
"self",
".",
"_special_del",
"=",
"{",
"}",
"self",
".",
"_special_del",
"[",
"'SCANNERS'",
"]",
"=",
"_del_SCANNERS",
"self",
".",
"_special_set",
"=",
"{",
"}",
"for",
"key",
"in",
"reserved_construction_var_n... | Initial the dispatch tables for special handling of
special construction variables. | [
"Initial",
"the",
"dispatch",
"tables",
"for",
"special",
"handling",
"of",
"special",
"construction",
"variables",
"."
] | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Environment.py#L380-L397 | train |
iotile/coretools | iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Environment.py | SubstitutionEnvironment.AddMethod | def AddMethod(self, function, name=None):
"""
Adds the specified function as a method of this construction
environment with the specified name. If the name is omitted,
the default name is the name of the function itself.
"""
method = MethodWrapper(self, function, name)
... | python | def AddMethod(self, function, name=None):
"""
Adds the specified function as a method of this construction
environment with the specified name. If the name is omitted,
the default name is the name of the function itself.
"""
method = MethodWrapper(self, function, name)
... | [
"def",
"AddMethod",
"(",
"self",
",",
"function",
",",
"name",
"=",
"None",
")",
":",
"method",
"=",
"MethodWrapper",
"(",
"self",
",",
"function",
",",
"name",
")",
"self",
".",
"added_methods",
".",
"append",
"(",
"method",
")"
] | Adds the specified function as a method of this construction
environment with the specified name. If the name is omitted,
the default name is the name of the function itself. | [
"Adds",
"the",
"specified",
"function",
"as",
"a",
"method",
"of",
"this",
"construction",
"environment",
"with",
"the",
"specified",
"name",
".",
"If",
"the",
"name",
"is",
"omitted",
"the",
"default",
"name",
"is",
"the",
"name",
"of",
"the",
"function",
... | 2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec | https://github.com/iotile/coretools/blob/2d794f5f1346b841b0dcd16c9d284e9bf2f3c6ec/iotilebuild/iotile/build/config/scons-local-3.0.1/SCons/Environment.py#L597-L604 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.