signature
stringlengths
8
3.44k
body
stringlengths
0
1.41M
docstring
stringlengths
1
122k
id
stringlengths
5
17
def EU27as(self, to='<STR_LIT>'):
if isinstance(to, str):<EOL><INDENT>to = [to]<EOL><DEDENT>return self.data[self.data.EU < <NUM_LIT>][to]<EOL>
Return EU27 countries in the specified classification Parameters ---------- to : str, optional Output classification (valid str for an index of country_data file), default: name_short Returns ------- Pandas DataFrame
f5198:c0:m4
def OECDas(self, to='<STR_LIT>'):
if isinstance(to, str):<EOL><INDENT>to = [to]<EOL><DEDENT>return self.data[self.data.OECD > <NUM_LIT:0>][to]<EOL>
Return OECD member states in the specified classification Parameters ---------- to : str, optional Output classification (valid str for an index of country_data file), default: name_short Returns ------- Pandas DataFrame
f5198:c0:m5
def UNas(self, to='<STR_LIT>'):
if isinstance(to, str):<EOL><INDENT>to = [to]<EOL><DEDENT>return self.data[self.data.UNmember > <NUM_LIT:0>][to]<EOL>
Return UN member states in the specified classification Parameters ---------- to : str, optional Output classification (valid str for an index of country_data file), default: name_short Returns ------- Pandas DataFrame
f5198:c0:m6
def obsoleteas(self, to='<STR_LIT>'):
if isinstance(to, str):<EOL><INDENT>to = [to]<EOL><DEDENT>return self.data[self.data.obsolete > <NUM_LIT:0>][to]<EOL>
Return obsolete countries in the specified classification Parameters ---------- to : str, optional Output classification (valid str for an index of country_data file), default: name_short Returns ------- Pandas DataFrame
f5198:c0:m7
@property<EOL><INDENT>def EU28(self):<DEDENT>
return self.EU28as(to='<STR_LIT>')<EOL>
EU28 member states (standard name_short) - use EU28as() for any other classification
f5198:c0:m8
@property<EOL><INDENT>def EU27(self):<DEDENT>
return self.EU27as(to='<STR_LIT>')<EOL>
EU27 member states (standard name_short) - use EU27as() for any other classification
f5198:c0:m9
@property<EOL><INDENT>def OECD(self):<DEDENT>
return self.OECDas(to='<STR_LIT>')<EOL>
OECD member states (standard name_short) - use OECDas() for any other classification
f5198:c0:m10
@property<EOL><INDENT>def UN(self):<DEDENT>
return self.UNas(to='<STR_LIT>')<EOL>
UN member states (standard name_short) - use UNas() for any other classification
f5198:c0:m11
@property<EOL><INDENT>def valid_class(self):<DEDENT>
return list(self.data.columns)<EOL>
Valid strings for the converter
f5198:c0:m12
def get_correspondance_dict(self, classA, classB,<EOL>restrict=None,<EOL>replace_numeric=True):
result = {nn: None for nn in self.data[classA].values}<EOL>if restrict is None:<EOL><INDENT>df = self.data.copy()<EOL><DEDENT>else:<EOL><INDENT>df = self.data[restrict].copy()<EOL><DEDENT>if replace_numeric and df[classB].dtype.kind in '<STR_LIT>':<EOL><INDENT>df.loc[~df[classB].isnull(), classB] = classB<EOL>df.loc[df...
Returns a correspondance between classification A and B as dict Parameters ---------- classA: str Valid classification (column name of data) classB: str Valid classification (column name of data). restrict: boolean vector of size cc.data, optional ...
f5198:c0:m13
def _validate_input_para(self, para, column_names):
lower_case_valid_class = [et.lower() for et in self.valid_class]<EOL>alt_valid_names = {<EOL>'<STR_LIT>': ['<STR_LIT>', '<STR_LIT>', '<STR_LIT:name>', '<STR_LIT>'],<EOL>'<STR_LIT>': ['<STR_LIT>', '<STR_LIT>', '<STR_LIT>'],<EOL>'<STR_LIT>': ['<STR_LIT>', '<STR_LIT>'],<EOL>'<STR_LIT>': ['<STR_LIT>'],<EOL>}<EOL>for item i...
Convert the input classificaton para to the correct df column name Parameters ---------- para : string column_names : list of strings Returns ------- validated_para : string Converted to the case used in the country file
f5198:c0:m14
def _get_input_format_from_name(self, name):
try:<EOL><INDENT>int(name)<EOL>src_format = '<STR_LIT>'<EOL><DEDENT>except ValueError:<EOL><INDENT>if len(name) == <NUM_LIT:2>:<EOL><INDENT>src_format = '<STR_LIT>'<EOL><DEDENT>elif len(name) == <NUM_LIT:3>:<EOL><INDENT>src_format = '<STR_LIT>'<EOL><DEDENT>else:<EOL><INDENT>src_format = '<STR_LIT>'<EOL><DEDENT><DEDENT>...
Determines the input format based on the given country name Parameters ---------- name : string Returns ------- string : valid input format
f5198:c0:m15
def __init__(self, port=<NUM_LIT:0>, timeout=<NUM_LIT>, mode='<STR_LIT>'):
self.logger = self._init_logger()<EOL>self.timeout = float(timeout)<EOL>self.port = None<EOL>self.remote = None<EOL>self.mode = mode.upper().strip()<EOL>if mode == '<STR_LIT>':<EOL><INDENT>self.start_sikuli_process(port)<EOL><DEDENT>if mode.upper().strip() == '<STR_LIT>':<EOL><INDENT>self.start_sikuli_process()<EOL>sel...
@port: sikuli java process socket port @timeout: Timeout of waiting java process started @mode: if set as 'DOC', will stop java process automatically, if set as 'PYTHON', means library is running out of robot environment if set as 'CREATE', it is only for mvn package usage, will create keywords.py file ...
f5203:c0:m0
def start_sikuli_process(self, port=None):
if port is None or int(port) == <NUM_LIT:0>:<EOL><INDENT>port = self._get_free_tcp_port()<EOL><DEDENT>self.port = port<EOL>start_retries = <NUM_LIT:0><EOL>started = False<EOL>while start_retries < <NUM_LIT:5>:<EOL><INDENT>try:<EOL><INDENT>self._start_sikuli_java_process()<EOL><DEDENT>except RuntimeError as err:<EOL><IN...
This keyword is used to start sikuli java process. If library is inited with mode "OLD", sikuli java process is started automatically. If library is inited with mode "NEW", this keyword should be used. :param port: port of sikuli java process, if value is None or 0, a random free port will be used :return: None
f5203:c0:m1
def nickmask(prefix: str, kwargs: Dict[str, Any]) -> None:
if "<STR_LIT:!>" in prefix and "<STR_LIT:@>" in prefix:<EOL><INDENT>kwargs["<STR_LIT>"], remainder = prefix.split("<STR_LIT:!>", <NUM_LIT:1>)<EOL>kwargs["<STR_LIT:user>"], kwargs["<STR_LIT:host>"] = remainder.split("<STR_LIT:@>", <NUM_LIT:1>)<EOL><DEDENT>else:<EOL><INDENT>kwargs["<STR_LIT:host>"] = prefix<EOL><DEDENT>
store nick, user, host in kwargs if prefix is correct format
f5205:m1
def split_line(msg: str) -> Tuple[str, str, List[str]]:
match = RE_IRCLINE.match(msg)<EOL>if not match:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>prefix = match.group("<STR_LIT>") or "<STR_LIT>"<EOL>command = match.group("<STR_LIT>")<EOL>params = (match.group("<STR_LIT>") or "<STR_LIT>").split()<EOL>message = match.group("<STR_LIT:message>") or "<STR_LIT>"<EOL>i...
Parse message according to rfc 2812 for routing
f5205:m3
@property<EOL><INDENT>def loop(self) -> asyncio.AbstractEventLoop:<DEDENT>
return self._loop<EOL>
Do not change the event loop for a client
f5206:c0:m1
async def connect(self) -> None:
def protocol_factory() -> Protocol:<EOL><INDENT>return Protocol(client=self)<EOL><DEDENT>_, protocol = await self.loop.create_connection(<EOL>protocol_factory,<EOL>host=self.host,<EOL>port=self.port,<EOL>ssl=self.ssl<EOL>) <EOL>if self.protocol:<EOL><INDENT>self.protocol.close()<EOL><DEDENT>self.protocol = protocol<EO...
Open a connection to the defined server.
f5206:c0:m4
async def disconnect(self) -> None:
if self.protocol:<EOL><INDENT>self.protocol.close()<EOL><DEDENT>
Close the connection to the defined server.
f5206:c0:m5
def trigger(self, event: str, **kwargs: Any) -> None:
event = event.upper()<EOL>for func in self._event_handlers[event]:<EOL><INDENT>self.loop.create_task(func(**kwargs))<EOL><DEDENT>async_event = self._events[event]<EOL>async_event.set()<EOL>async_event.clear()<EOL>
Trigger all handlers for an event to (asynchronously) execute
f5206:c0:m6
def on(self, event: str, func: Optional[Callable] = None) -> Callable:
if func is None:<EOL><INDENT>return functools.partial(self.on, event) <EOL><DEDENT>wrapped = func<EOL>if not asyncio.iscoroutinefunction(wrapped):<EOL><INDENT>wrapped = asyncio.coroutine(wrapped)<EOL><DEDENT>self._event_handlers[event.upper()].append(wrapped)<EOL>return func<EOL>
Decorate a function to be invoked when the given event occurs. The function may be a coroutine. Your function should accept **kwargs in case an event is triggered with unexpected kwargs. Example ------- import asyncio import bottom client = bottom.Client(...) @client.on("test") async def func(one, two, **kwargs): ...
f5206:c0:m8
def __init__(self, host: str, port: int, *,<EOL>encoding: str = "<STR_LIT:utf-8>", ssl: bool = True,<EOL>loop: Optional[asyncio.AbstractEventLoop] = None) -> None:
super().__init__(host, port, encoding=encoding, ssl=ssl, loop=loop)<EOL>self.raw_handlers.append(rfc2812_handler(self))<EOL>
:param host: The IRC server address to connect to. :param port: The port of the IRC server. :param encoding: The character encoding to use. Default is utf-8. :param ssl: Whether SSL should be used while connecting. Default is True. :param loop: The even loop to use. Defaults is ``asyncio.get_event_loop...
f5206:c1:m0
def send(self, command: str, **kwargs: Any) -> None:
packed_command = pack_command(command, **kwargs).strip()<EOL>self.send_raw(packed_command)<EOL>
Send a message to the server. .. code-block:: python client.send("nick", nick="weatherbot") client.send("privmsg", target="#python", message="Hello, World!")
f5206:c1:m1
def b(field: str, kwargs: Dict[str, Any],<EOL>present: Optional[Any] = None, missing: Any = '<STR_LIT>') -> str:
if kwargs.get(field):<EOL><INDENT>return field if present is None else str(present)<EOL><DEDENT>return str(missing)<EOL>
Return `present` value (default to `field`) if `field` in `kwargs` and Truthy, otherwise return `missing` value
f5208:m0
def f(field: str, kwargs: Dict[str, Any],<EOL>default: Optional[Any] = None) -> str:
if default is not None:<EOL><INDENT>return str(kwargs.get(field, default))<EOL><DEDENT>return str(kwargs[field])<EOL>
Alias for more readable command construction
f5208:m1
def pack(field: str, kwargs: Dict[str, Any],<EOL>default: Optional[Any] = None, sep: str='<STR_LIT:U+002C>') -> str:
if default is not None:<EOL><INDENT>value = kwargs.get(field, default)<EOL><DEDENT>else:<EOL><INDENT>value = kwargs[field]<EOL><DEDENT>if isinstance(value, str):<EOL><INDENT>return value<EOL><DEDENT>elif isinstance(value, collections.abc.Iterable):<EOL><INDENT>return sep.join(str(f) for f in value)<EOL><DEDENT>else:<EO...
Util for joining multiple fields with commas
f5208:m2
def pack_command(command: str, **kwargs: Any) -> str:
if not command:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if not isinstance(command, str):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>command = command.upper()<EOL>if command == "<STR_LIT>":<EOL><INDENT>return "<STR_LIT>" + f("<STR_LIT:password>", kwargs)<EOL><DEDENT>elif command == "<STR_LIT>":<...
Pack a command to send to an IRC server
f5208:m3
def validate(command, message, expected_kwargs):
assert (command, expected_kwargs) == unpack_command(message)<EOL>assert set(expected_kwargs) == set(parameters(command))<EOL>
Basic case - expected_kwargs expects all parameters of the command
f5211:m5
def like(pattern, value):
<EOL>pattern = re.escape(pattern)<EOL>index = pattern.rfind('<STR_LIT::>')<EOL>if index >= <NUM_LIT:0>:<EOL><INDENT>pattern = SPACES.sub(r'<STR_LIT>', pattern[:index]) + pattern[index:]<EOL><DEDENT>else:<EOL><INDENT>pattern = SPACES.sub(r'<STR_LIT>', pattern)<EOL><DEDENT>pattern += r"<STR_LIT>"<EOL>return bool(re.match...
helper for ignoring extra spaces between arguments
f5213:m0
def _handle(self, nick, target, message, **kwargs):
for regex, (func, pattern) in self.routes.items():<EOL><INDENT>match = regex.match(message)<EOL>if match:<EOL><INDENT>self.client.loop.create_task(<EOL>func(nick, target, message, match, **kwargs))<EOL><DEDENT><DEDENT>
client callback entrance
f5219:c0:m1
def generate_tmp_file():
global tmp_file<EOL>if not tmp_file:<EOL><INDENT>tmp_file = tempfile.NamedTemporaryFile(delete=True)<EOL>print('<STR_LIT>' + tmp_file.name)<EOL><DEDENT>adb.push(tmp_file.name, DEST_FOLDER_TARGET)<EOL>global tmp_file_on_target<EOL>tmp_file_on_target = (DEST_FOLDER_TARGET + os.path.basename(tmp_file.name))<EOL>print('<ST...
Generates temp file and pushes it to target
f5222:m1
@classmethod<EOL><INDENT>def setUp(self):<DEDENT>
global VALID_PACKAGE_NAME<EOL>result = adb.shell('<STR_LIT>' + VALID_PACKAGE_NAME)<EOL>if re.search(exp_install_cmd_output, result[<NUM_LIT:1>]):<EOL><INDENT>print('<STR_LIT>' + VALID_PACKAGE_NAME)<EOL>adb.uninstall(VALID_PACKAGE_NAME, [])<EOL><DEDENT>else:<EOL><INDENT>print('<STR_LIT>' + VALID_PACKAGE_NAME + '<STR_LIT...
Deletes *.apk if it already installed
f5222:c6:m0
@classmethod<EOL><INDENT>def setUp(self):<DEDENT>
global VALID_PACKAGE_NAME<EOL>global PATH_TO_VALID_APK<EOL>result = adb.shell('<STR_LIT>' + VALID_PACKAGE_NAME)<EOL>if not re.search(exp_install_cmd_output, result[<NUM_LIT:1>]):<EOL><INDENT>print('<STR_LIT>' + VALID_PACKAGE_NAME)<EOL>adb.install(PATH_TO_VALID_APK)<EOL><DEDENT>else:<EOL><INDENT>print('<STR_LIT>' + VALI...
Installs apk before test execution
f5222:c7:m0
def _isDeviceAvailable():
result = getserialno()<EOL>if result[<NUM_LIT:1>].strip() == "<STR_LIT>":<EOL><INDENT>return False<EOL><DEDENT>else:<EOL><INDENT>return True<EOL><DEDENT>
Private Function to check if device is available; To be used by only functions inside module :return: True or False
f5223:m0
def version():
adb_full_cmd = [v.ADB_COMMAND_PREFIX, v.ADB_COMMAND_VERSION]<EOL>return _exec_command(adb_full_cmd)<EOL>
Display the version of adb :return: result of _exec_command() execution
f5223:m1
def bugreport(dest_file="<STR_LIT>"):
adb_full_cmd = [v.ADB_COMMAND_PREFIX, v.ADB_COMMAND_BUGREPORT]<EOL>try:<EOL><INDENT>dest_file_handler = open(dest_file, "<STR_LIT:w>")<EOL><DEDENT>except IOError:<EOL><INDENT>print("<STR_LIT>")<EOL><DEDENT>if _isDeviceAvailable():<EOL><INDENT>result = _exec_command_to_file(adb_full_cmd, dest_file_handler)<EOL>return (r...
Prints dumpsys, dumpstate, and logcat data to the screen, for the purposes of bug reporting :return: result of _exec_command() execution
f5223:m2
def push(src, dest):
adb_full_cmd = [v.ADB_COMMAND_PREFIX, v.ADB_COMMAND_PUSH, src, dest]<EOL>return _exec_command(adb_full_cmd)<EOL>
Push object from host to target :param src: string path to source object on host :param dest: string destination path on target :return: result of _exec_command() execution
f5223:m3
def pull(src, dest):
adb_full_cmd = [v.ADB_COMMAND_PREFIX, v.ADB_COMMAND_PULL, src, dest]<EOL>return _exec_command(adb_full_cmd)<EOL>
Pull object from target to host :param src: string path of object on target :param dest: string destination path on host :return: result of _exec_command() execution
f5223:m4
def devices(opts=[]):
adb_full_cmd = [v.ADB_COMMAND_PREFIX, v.ADB_COMMAND_DEVICES, _convert_opts(opts)]<EOL>return _exec_command(adb_full_cmd)<EOL>
Get list of all available devices including emulators :param opts: list command options (e.g. ["-r", "-a"]) :return: result of _exec_command() execution
f5223:m5
def shell(cmd):
adb_full_cmd = [v.ADB_COMMAND_PREFIX, v.ADB_COMMAND_SHELL, cmd]<EOL>return _exec_command(adb_full_cmd)<EOL>
Execute shell command on target :param cmd: string shell command to execute :return: result of _exec_command() execution
f5223:m6
def install(apk, opts=[]):
adb_full_cmd = [v.ADB_COMMAND_PREFIX, v.ADB_COMMAND_INSTALL, _convert_opts(opts), apk]<EOL>return _exec_command(adb_full_cmd)<EOL>
Install *.apk on target :param apk: string path to apk on host to install :param opts: list command options (e.g. ["-r", "-a"]) :return: result of _exec_command() execution
f5223:m7
def uninstall(app, opts=[]):
adb_full_cmd = [v.ADB_COMMAND_PREFIX, v.ADB_COMMAND_UNINSTALL, _convert_opts(opts), app]<EOL>return _exec_command(adb_full_cmd)<EOL>
Uninstall app from target :param app: app name to uninstall from target (e.g. "com.example.android.valid") :param opts: list command options (e.g. ["-r", "-a"]) :return: result of _exec_command() execution
f5223:m8
def getserialno():
adb_full_cmd = [v.ADB_COMMAND_PREFIX, v.ADB_COMMAND_GETSERIALNO]<EOL>return _exec_command(adb_full_cmd)<EOL>
Get serial number for all available target devices :return: result of _exec_command() execution
f5223:m9
def wait_for_device():
adb_full_cmd = [v.ADB_COMMAND_PREFIX, v.ADB_COMMAND_WAITFORDEVICE]<EOL>return _exec_command(adb_full_cmd)<EOL>
Block execution until the device is online :return: result of _exec_command() execution
f5223:m10
def sync():
adb_full_cmd = [v.ADB_COMMAND_PREFIX, v.ADB_COMMAND_SHELL ,v.ADB_COMMAND_SYNC]<EOL>return _exec_command(adb_full_cmd)<EOL>
Copy host->device only if changed :return: result of _exec_command() execution
f5223:m11
def start_server():
adb_full_cmd = [v.ADB_COMMAND_PREFIX, v.ADB_COMMAND_START_SERVER]<EOL>return _exec_command(adb_full_cmd)<EOL>
Startd adb server daemon on host :return: result of _exec_command() execution
f5223:m12
def kill_server():
adb_full_cmd = [v.ADB_COMMAND_PREFIX, v.ADB_COMMAND_KILL_SERVER]<EOL>return _exec_command(adb_full_cmd)<EOL>
Kill adb server daemon on host :return: result of _exec_command() execution
f5223:m13
def get_state():
adb_full_cmd = [v.ADB_COMMAND_PREFIX, v.ADB_COMMAND_GET_STATE]<EOL>return _exec_command(adb_full_cmd)<EOL>
Get state of device connected per adb :return: result of _exec_command() execution
f5223:m14
def _convert_opts(opts):
return '<STR_LIT:U+0020>'.join(opts)<EOL>
Convert list with command options to single string value with 'space' delimeter :param opts: list with space-delimeted values :return: string with space-delimeted values
f5223:m15
def _exec_command(adb_cmd):
t = tempfile.TemporaryFile()<EOL>final_adb_cmd = []<EOL>for e in adb_cmd:<EOL><INDENT>if e != '<STR_LIT>': <EOL><INDENT>final_adb_cmd.append(e) <EOL><DEDENT><DEDENT>print('<STR_LIT>' + '<STR_LIT:U+0020>'.join(adb_cmd) + '<STR_LIT:U+0020>' + '<STR_LIT>')<EOL>try:<EOL><INDENT>output = check_output(final_adb_cmd, stderr...
Format adb command and execute it in shell :param adb_cmd: list adb command to execute :return: string '0' and shell command output if successful, otherwise raise CalledProcessError exception and return error code
f5223:m16
def _exec_command_to_file(adb_cmd, dest_file_handler):
t = tempfile.TemporaryFile()<EOL>final_adb_cmd = []<EOL>for e in adb_cmd:<EOL><INDENT>if e != '<STR_LIT>': <EOL><INDENT>final_adb_cmd.append(e) <EOL><DEDENT><DEDENT>print('<STR_LIT>' + '<STR_LIT:U+0020>'.join(adb_cmd) + '<STR_LIT:U+0020>' + '<STR_LIT>')<EOL>try:<EOL><INDENT>output = call(final_adb_cmd, stdout=dest_fi...
Format adb command and execute it in shell and redirects to a file :param adb_cmd: list adb command to execute :param dest_file_handler: file handler to which output will be redirected :return: string '0' and writes shell command output to file if successful, otherwise raise CalledProcessError exception and return erro...
f5223:m17
def __init__(self, connector_id='<STR_LIT>', name='<STR_LIT>', data_type='<STR_LIT>',<EOL>interface_type='<STR_LIT>', data_flow_type='<STR_LIT>', subscription_type='<STR_LIT>',<EOL>push_interval=<NUM_LIT:0.0>, source_data_port=TargetPort(),<EOL>target_data_port=TargetPort(), comment='<STR_LIT>', visible=True):
validate_attribute(connector_id, '<STR_LIT>',<EOL>expected_type=string_types(), required=False)<EOL>self._connector_id = connector_id<EOL>validate_attribute(name, '<STR_LIT>',<EOL>expected_type=string_types(), required=False)<EOL>self._name = name<EOL>validate_attribute(data_type, '<STR_LIT>',<EOL>expected_type=string_...
Constructor. @param connector_id ID of the connector. @type connector_id str @param name Name of the connector. @type name str @param data_type Data type that this connector transports. @type data_type str @param interface_type Interface type of the connected por...
f5227:c0:m0
@property<EOL><INDENT>def connector_id(self):<DEDENT>
return self._connector_id<EOL>
The ID of the connector used to distinguish it in the RT system. Example: >>> c = DataPortConnector() >>> c.connector_id = "test" Invalid assignment should throw exception: >>> c.connector_id = 1 Traceback (most recent call last): ... InvalidTypeError: (...
f5227:c0:m2
@property<EOL><INDENT>def name(self):<DEDENT>
return self._name<EOL>
The name of the connector. Example: >>> c = DataPortConnector() >>> c.name = "test" Invalid assignment should throw exception: >>> c.name = 1 Traceback (most recent call last): ... InvalidTypeError: ('dataport_connector.name', <type 'int'>, [<type 'str'>...
f5227:c0:m4
@property<EOL><INDENT>def data_type(self):<DEDENT>
return self._data_type<EOL>
Data type that this connector transports. Example: >>> c = DataPortConnector() >>> c.data_type = "MyData" Invalid assignment should throw exception: >>> c.data_type = 1 Traceback (most recent call last): ... InvalidTypeError: ('dataport_connector.dataTyp...
f5227:c0:m6
@property<EOL><INDENT>def interface_type(self):<DEDENT>
return self._interface_type<EOL>
Interface type of the connection. As specified when the RT system is created. Dependent on what the RT Middleware used to execute the RT system supports. Example: >>> c = DataPortConnector() >>> c.interface_type = "corba" Invalid assignment should throw exception: ...
f5227:c0:m8
@property<EOL><INDENT>def data_flow_type(self):<DEDENT>
return self._data_flow_type<EOL>
Type of data flow between the ports. As specified when the RT system is created. Dependent on what the RT Middleware used to execute the RT system supports. Example: >>> c = DataPortConnector() >>> c.data_flow_type = "test" Invalid assignment should throw exception: ...
f5227:c0:m10
@property<EOL><INDENT>def subscription_type(self):<DEDENT>
return self._subscription_type<EOL>
Type of the subscription between the ports. As specified when the RT system is created. Only used when @ref data_flow_type is set to PUSH. Dependent on what the RT Middleware used to execute the RT system supports. Example: >>> c = DataPortConnector() >>> c.subscription...
f5227:c0:m12
@property<EOL><INDENT>def push_interval(self):<DEDENT>
return self._push_interval<EOL>
Rate at which data is sent between ports. As specified when the RT system is created. Example: >>> c = DataPortConnector() >>> c.push_interval = 10.0 Invalid assignment should throw exception: >>> c.push_interval = "test" Traceback (most recent call last): ...
f5227:c0:m14
@property<EOL><INDENT>def source_data_port(self):<DEDENT>
return self._source_data_port<EOL>
The source port in the connection. Example: >>> import rtsprofile.targets >>> c = DataPortConnector() >>> c.source_data_port = rtsprofile.targets.TargetPort() Invalid assignment should throw exception: >>> c.source_data_port = 1 Traceback (most recent call last)...
f5227:c0:m16
@property<EOL><INDENT>def target_data_port(self):<DEDENT>
return self._target_data_port<EOL>
The target port in the connection. Example: >>> import rtsprofile.targets >>> c = DataPortConnector() >>> c.target_data_port = rtsprofile.targets.TargetPort() Invalid assignment should throw exception: >>> c.target_data_port = 1 Traceback (most recent call last)...
f5227:c0:m18
@property<EOL><INDENT>def comment(self):<DEDENT>
return self._comment<EOL>
Comment about the connector. A brief comment about the connector. May or may not be displayed in other tools. May be empty. Part of the extended profile. Example: >>> c = DataPortConnector() >>> c.comment = "test" Invalid assignment should throw exception: ...
f5227:c0:m20
@property<EOL><INDENT>def visible(self):<DEDENT>
return self._visible<EOL>
Display the connector in graphical tools. This value controls whether graphical tools will display this connector or not. Part of the extended profile. Example: >>> c = DataPortConnector() >>> c.visible = True Invalid assignment should throw exception: ...
f5227:c0:m22
@property<EOL><INDENT>def properties(self):<DEDENT>
return self._properties<EOL>
Miscellaneous properties. Stores key/value pair properties. Part of the extended profile. Example: >>> c = DataPortConnector() >>> c.properties = {"key": "value"} Invalid assignment should throw exception: >>> c.properties = 1 Traceback (most recent ca...
f5227:c0:m24
def parse_xml_node(self, node):
self.connector_id = node.getAttributeNS(RTS_NS, '<STR_LIT>')<EOL>self.name = node.getAttributeNS(RTS_NS, '<STR_LIT:name>')<EOL>self.data_type = node.getAttributeNS(RTS_NS, '<STR_LIT>')<EOL>self.interface_type = node.getAttributeNS(RTS_NS, '<STR_LIT>')<EOL>self.data_flow_type = node.getAttributeNS(RTS_NS, '<STR_LIT>')<E...
Parse an xml.dom Node object representing a data connector into this object.
f5227:c0:m26
def parse_yaml(self, y):
self.connector_id = y['<STR_LIT>']<EOL>self.name = y['<STR_LIT:name>']<EOL>self.data_type = y['<STR_LIT>']<EOL>self.interface_type = y['<STR_LIT>']<EOL>self.data_flow_type = y['<STR_LIT>']<EOL>if '<STR_LIT>' in y:<EOL><INDENT>self.subscription_type = y['<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>self.subscription_type =...
Parse a YAML specification of a data port connector into this object.
f5227:c0:m27
def save_xml(self, doc, element):
element.setAttributeNS(XSI_NS, XSI_NS_S + '<STR_LIT:type>', '<STR_LIT>')<EOL>element.setAttributeNS(RTS_NS, RTS_NS_S + '<STR_LIT>',<EOL>self.connector_id)<EOL>element.setAttributeNS(RTS_NS, RTS_NS_S + '<STR_LIT:name>', self.name)<EOL>element.setAttributeNS(RTS_NS, RTS_NS_S + '<STR_LIT>', self.data_type)<EOL>element.set...
Save this data port into an xml.dom.Element object.
f5227:c0:m28
def to_dict(self):
d = {'<STR_LIT>': self.connector_id,<EOL>'<STR_LIT:name>': self.name,<EOL>'<STR_LIT>': self.data_type,<EOL>'<STR_LIT>': self.interface_type,<EOL>'<STR_LIT>': self.data_flow_type,<EOL>'<STR_LIT>': self.source_data_port.to_dict(),<EOL>'<STR_LIT>': self.target_data_port.to_dict()}<EOL>if self.visible != True:<EOL><INDENT>...
Save this data port connector into a dictionary.
f5227:c0:m29
def __init__(self, connector_id='<STR_LIT>', name='<STR_LIT>', trans_method='<STR_LIT>',<EOL>source_service_port=TargetPort(),<EOL>target_service_port=TargetPort(), comment='<STR_LIT>', visible=True):
validate_attribute(connector_id, '<STR_LIT>',<EOL>expected_type=string_types(), required=False)<EOL>self._connector_id = connector_id<EOL>validate_attribute(name, '<STR_LIT>',<EOL>expected_type=string_types(), required=False)<EOL>self._name = name<EOL>validate_attribute(trans_method, '<STR_LIT>',<EOL>expected_type=stri...
Constructor. @param connector_id ID of the connector. @type connector_id str @param name Name of the connector. @type name str @param trans_method Transport method used by the ports. @type trans_method str @param source_service_port The source port in the connect...
f5227:c1:m0
@property<EOL><INDENT>def connector_id(self):<DEDENT>
return self._connector_id<EOL>
The ID of the connector used to distinguish it in the RT system. Example: >>> c = ServicePortConnector() >>> c.connector_id = "test" Invalid assignment should throw exception: >>> c.connector_id = 1 Traceback (most recent call last): ... InvalidTypeError...
f5227:c1:m2
@property<EOL><INDENT>def name(self):<DEDENT>
return self._name<EOL>
The name of the connector. Example: >>> c = ServicePortConnector() >>> c.name = "test" Invalid assignment should throw exception: >>> c.name = 1 Traceback (most recent call last): ... InvalidTypeError: ('serviceport_connector.name', <type 'int'>, [<type ...
f5227:c1:m4
@property<EOL><INDENT>def trans_method(self):<DEDENT>
return self._trans_method<EOL>
Transport method used by the ports. As specified when the RT system is created. Dependent on what the RT Middleware used to execute the RT system supports. Example: >>> c = ServicePortConnector() >>> c.trans_method = "corba" Invalid assignment should throw exception: ...
f5227:c1:m6
@property<EOL><INDENT>def source_service_port(self):<DEDENT>
return self._source_service_port<EOL>
The source port in the connection. Example: >>> import rtsprofile.targets >>> c = ServicePortConnector() >>> c.source_service_port = rtsprofile.targets.TargetPort() Invalid assignment should throw exception: >>> c.source_service_port = 1 Traceback (most recent c...
f5227:c1:m8
@property<EOL><INDENT>def target_service_port(self):<DEDENT>
return self._target_service_port<EOL>
The target port in the connection. Example: >>> import rtsprofile.targets >>> c = ServicePortConnector() >>> c.target_service_port = rtsprofile.targets.TargetPort() Invalid assignment should throw exception: >>> c.target_service_port = 1 Traceback (most recent c...
f5227:c1:m10
@property<EOL><INDENT>def comment(self):<DEDENT>
return self._comment<EOL>
Comment about the connector. A brief comment about the connector. May or may not be displayed in other tools. May be empty. Part of the extended profile. Example: >>> c = ServicePortConnector() >>> c.comment = "test" Invalid assignment should throw exception: ...
f5227:c1:m12
@property<EOL><INDENT>def visible(self):<DEDENT>
return self._visible<EOL>
Display the connector in graphical tools. This value controls whether graphical tools will display this connector or not. Part of the extended profile. Example: >>> c = ServicePortConnector() >>> c.visible = True Invalid assignment should throw exception: ...
f5227:c1:m14
@property<EOL><INDENT>def properties(self):<DEDENT>
return self._properties<EOL>
Miscellaneous properties. Stores key/value pair properties. Part of the extended profile. Example: >>> c = ServicePortConnector() >>> c.properties = {"key": "value"} Invalid assignment should throw exception: >>> c.properties = 1 Traceback (most recent...
f5227:c1:m16
def parse_xml_node(self, node):
self.connector_id = node.getAttributeNS(RTS_NS, '<STR_LIT>')<EOL>self.name = node.getAttributeNS(RTS_NS, '<STR_LIT:name>')<EOL>if node.hasAttributeNS(RTS_NS, '<STR_LIT>'):<EOL><INDENT>self.trans_method = node.getAttributeNS(RTS_NS,<EOL>'<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>self.trans_method = '<STR_LIT>'<EOL><DEDE...
Parse an xml.dom Node object representing a service port connector into this object.
f5227:c1:m18
def parse_yaml(self, y):
self.connector_id = y['<STR_LIT>']<EOL>self.name = y['<STR_LIT:name>']<EOL>if '<STR_LIT>' in y:<EOL><INDENT>self.trans_method = y['<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>self.trans_method = '<STR_LIT>'<EOL><DEDENT>if RTS_EXT_NS_YAML + '<STR_LIT>' in y:<EOL><INDENT>self.comment = y[RTS_EXT_NS_YAML + '<STR_LIT>']<EOL>...
Parse a YAML specification of a service port connector into this object.
f5227:c1:m19
def save_xml(self, doc, element):
element.setAttributeNS(XSI_NS, XSI_NS_S + '<STR_LIT:type>', '<STR_LIT>')<EOL>element.setAttributeNS(RTS_NS, RTS_NS_S + '<STR_LIT>',<EOL>self.connector_id)<EOL>element.setAttributeNS(RTS_NS, RTS_NS_S + '<STR_LIT:name>', self.name)<EOL>if self.trans_method:<EOL><INDENT>element.setAttributeNS(RTS_NS, RTS_NS_S + '<STR_LIT>...
Save this service port into an xml.dom.Element object.
f5227:c1:m20
def to_dict(self):
d = {'<STR_LIT>': self.connector_id,<EOL>'<STR_LIT:name>': self.name,<EOL>'<STR_LIT>': self.source_service_port.to_dict(),<EOL>'<STR_LIT>': self.target_service_port.to_dict()}<EOL>if self.visible != True:<EOL><INDENT>d[RTS_EXT_NS_YAML + '<STR_LIT>'] = self.visible<EOL><DEDENT>if self.trans_method:<EOL><INDENT>d['<STR_L...
Save this service port connector into a dictionary.
f5227:c1:m21
def __init__(self, xml_spec=None, yaml_spec=None):
if xml_spec:<EOL><INDENT>if yaml_spec:<EOL><INDENT>raise MultipleSourcesError('XML and YAML specifications both \self.parse_from_xml(xml_spec)<EOL>elif yaml_spec:<EOL>if xml_spec:<EOL>raise MultipleSourcesError('XML and YAML specifications both \self.parse_from_yaml(yaml_spec)<EOL>else:<EOL>self._reset()<EOL>
Constructor. Pass in an RTSProfile specification either in a string or a file object, and the RtsProfile will be loaded from that. If no specification is provided, the RtsProfile will be constructed from the default values. Use the properties to set the values you need. @param...
f5228:c0:m0
@property<EOL><INDENT>def id(self):<DEDENT>
return self._id<EOL>
ID used to distinguish the RT system. Typically in the format '[vendor name].[system name].[version]'. Example: >>> s = RtsProfile() >>> s.id = "aist.rtsprofile.1" Invalid assignment should throw exception: >>> s.id = 1 Traceback (most recent call last): ...
f5228:c0:m2
@property<EOL><INDENT>def abstract(self):<DEDENT>
return self._abstract<EOL>
Description of this RT system. May be empty. Example: >>> s = RtsProfile() >>> s.abstract = "test description" Invalid assignment should throw exception: >>> s.abstract = 1 Traceback (most recent call last): ... InvalidTypeError: ('rts_profile.a...
f5228:c0:m4
@property<EOL><INDENT>def creation_date(self):<DEDENT>
return self._creation_date<EOL>
The date this RT system was first created. Usually set automatically by the tool that created the system. Example: >>> s = RtsProfile() >>> s.creation_date = "2016/01/01" Invalid assignment should throw exception: >>> s.creation_date = 1 Traceback (most recent ...
f5228:c0:m6
@property<EOL><INDENT>def update_date(self):<DEDENT>
return self._update_date<EOL>
The date this RT system was most recently updated. Usually set automatically by the tool that created the system. Example: >>> s = RtsProfile() >>> s.update_date = "2016/01/01" Invalid assignment should throw exception: >>> s.update_date = 1 Traceback (most rec...
f5228:c0:m8
@property<EOL><INDENT>def version(self):<DEDENT>
return self._version<EOL>
Version of the RTSProfile specification this is in. Example: >>> s = RtsProfile() >>> s.version = "1.0.0" Invalid assignment should throw exception: >>> s.version = 1 Traceback (most recent call last): ... InvalidTypeError: ('rts_profile.version', <type ...
f5228:c0:m10
@property<EOL><INDENT>def components(self):<DEDENT>
return self._components<EOL>
Information about the components that make up the RT system. May be an empty list if there are no components. Members are of type @ref Component. Example: >>> s = RtsProfile() >>> s.components = [] Invalid assignment should throw exception: >>> s.components = 1...
f5228:c0:m12
@property<EOL><INDENT>def groups(self):<DEDENT>
return self._groups<EOL>
Information about the component groups in the RT system. May be an empty list if there are no groups. Members are of type @ref ComponentGroup. Example: >>> s = RtsProfile() >>> s.groups = [] Invalid assignment should throw exception: >>> s.groups = 1 Tr...
f5228:c0:m14
@property<EOL><INDENT>def data_port_connectors(self):<DEDENT>
return self._data_port_connectors<EOL>
Connections between data ports in the RT system. Members are of type @ref DataPortConnector. Example: >>> s = RtsProfile() >>> s.data_port_connectors = [] Invalid assignment should throw exception: >>> s.data_port_connectors = 1 Traceback (most recent call last...
f5228:c0:m16
@property<EOL><INDENT>def service_port_connectors(self):<DEDENT>
return self._service_port_connectors<EOL>
Connections between service ports in the RT system. Members are of type @ref ServicePortConnector. Example: >>> s = RtsProfile() >>> s.service_port_connectors = [] Invalid assignment should throw exception: >>> s.service_port_connectors = 1 Traceback (most rece...
f5228:c0:m18
@property<EOL><INDENT>def startup(self):<DEDENT>
return self._startup<EOL>
Ordering and conditions for when the RT system is started. Example: >>> import message_sending >>> s = RtsProfile() >>> s.startup = message_sending.StartUp() Invalid assignment should throw exception: >>> s.startup = 1 Traceback (most recent call last): ...
f5228:c0:m20
@property<EOL><INDENT>def shutdown(self):<DEDENT>
return self._shutdown<EOL>
Ordering and conditions for when the RT system is shut down. Example: >>> import message_sending >>> s = RtsProfile() >>> s.shutdown = message_sending.ShutDown() Invalid assignment should throw exception: >>> s.shutdown = 1 Traceback (most recent call last): ...
f5228:c0:m22
@property<EOL><INDENT>def activation(self):<DEDENT>
return self._activation<EOL>
Ordering and conditions for when the RT system is activated. Example: >>> import message_sending >>> s = RtsProfile() >>> s.activation = message_sending.Activation() Invalid assignment should throw exception: >>> s.activation = 1 Traceback (most recent call last...
f5228:c0:m24
@property<EOL><INDENT>def deactivation(self):<DEDENT>
return self._deactivation<EOL>
Ordering and conditions for when the RT system is deactivated. Example: >>> import message_sending >>> s = RtsProfile() >>> s.deactivation = message_sending.Deactivation() Invalid assignment should throw exception: >>> s.deactivation = 1 Traceback (most recent c...
f5228:c0:m26
@property<EOL><INDENT>def resetting(self):<DEDENT>
return self._resetting<EOL>
Ordering and conditions for when the RT system is reset. Example: >>> import message_sending >>> s = RtsProfile() >>> s.resetting = message_sending.Resetting() Invalid assignment should throw exception: >>> s.resetting = 1 Traceback (most recent call last): ...
f5228:c0:m28
@property<EOL><INDENT>def initializing(self):<DEDENT>
return self._initializing<EOL>
Ordering and conditions for when the RT system is initialized. Example: >>> import message_sending >>> s = RtsProfile() >>> s.initializing = message_sending.Initialize() Invalid assignment should throw exception: >>> s.initializing = 1 Traceback (most recent cal...
f5228:c0:m30
@property<EOL><INDENT>def finalizing(self):<DEDENT>
return self._finalizing<EOL>
Ordering and conditions for when the RT system is finalized. Example: >>> import message_sending >>> s = RtsProfile() >>> s.finalizing = message_sending.Finalize() Invalid assignment should throw exception: >>> s.finalizing = 1 Traceback (most recent call last):...
f5228:c0:m32
@property<EOL><INDENT>def comment(self):<DEDENT>
return self._comment<EOL>
Comment about the system. A brief comment about the system. May or may not be displayed in other tools. May be empty. Part of the extended profile. Example: >>> s = RtsProfile() >>> s.comment = "test comment" Invalid assignment should throw exception: ...
f5228:c0:m34
@property<EOL><INDENT>def version_up_log(self):<DEDENT>
return self._version_up_log<EOL>
Log entries for new versions. When an update to a system is made, the log entry describing changes is stored in this value. Part of the extended profile. Example: >>> s = RtsProfile() >>> s.version_up_log = ["test version_up_log"] Invalid assignment should thr...
f5228:c0:m36