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[classB].isnull(), classB] = None<EOL><DEDENT>result.update(df.groupby(classA)<EOL>.aggregate(lambda x: list(x.unique()))<EOL>.to_dict()[classB])<EOL>return result<EOL>
|
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
where cc is the name of the CountryConverter instance. Used to
restrict the data sheet if necessary. E.g. to convert to countries
which were OECD members before 1970 use
cc.get_correspondance_dict('ISO3', 'OECD', restrict=cc.data.OECD <
1970)
replace_numeric: boolean, optional
If True (default) replace numeric values with the column header.
This can be used if get a correspondance to, for example, 'OECD'
instead of to the OECD membership years. Set to False if the actual
numbers are required (as for UNcode).
Returns
-------
dict with
keys: based on classA
items: list of correspoding entries in classB or None
|
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 in alt_valid_names.items():<EOL><INDENT>if para.lower() in item[<NUM_LIT:1>]:<EOL><INDENT>para = item[<NUM_LIT:0>]<EOL><DEDENT><DEDENT>try:<EOL><INDENT>validated_para = self.valid_class[<EOL>lower_case_valid_class.index(para.lower())]<EOL><DEDENT>except ValueError:<EOL><INDENT>raise KeyError(<EOL>'<STR_LIT>'.format(para))<EOL><DEDENT>return validated_para<EOL>
|
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>return src_format<EOL>
|
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>self._stop_thread(<NUM_LIT:4>)<EOL><DEDENT>elif mode.upper().strip() == '<STR_LIT>':<EOL><INDENT>self.connect_sikuli_process(port)<EOL><DEDENT>elif mode.upper().strip() == '<STR_LIT>':<EOL><INDENT>self._create_keywords_file()<EOL><DEDENT>elif mode.upper().strip() != '<STR_LIT>':<EOL><INDENT>self._check_robot_running()<EOL><DEDENT>
|
@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
if set as 'OLD'(default), sikuli java process will be started when library is inited
if set as 'NEW', user should use 'start_sikuli_process' to start java process
|
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><INDENT>print('<STR_LIT>' % err)<EOL>if self.process:<EOL><INDENT>self.process.terminate_process()<EOL><DEDENT>self.port = self._get_free_tcp_port()<EOL>start_retries += <NUM_LIT:1><EOL>continue<EOL><DEDENT>started = True<EOL>break<EOL><DEDENT>if not started:<EOL><INDENT>raise RuntimeError('<STR_LIT>')<EOL><DEDENT>self.remote = self._connect_remote_library()<EOL>
|
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>if message:<EOL><INDENT>params.append(message)<EOL><DEDENT>return prefix, command, params<EOL>
|
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<EOL>protocol.client = self<EOL>self.trigger("<STR_LIT>")<EOL>
|
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):
print(one)
print(two)
print(kwargs)
events.trigger("test", **{"one": 1, "two": 2, "extra": "foo"})
loop = asyncio.get_event_loop()
# Run all queued events
loop.stop()
loop.run_forever()
|
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:<EOL><INDENT>return str(value)<EOL><DEDENT>
|
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>":<EOL><INDENT>return "<STR_LIT>" + f("<STR_LIT>", kwargs)<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>return "<STR_LIT>".format(<EOL>f("<STR_LIT:user>", kwargs),<EOL>f("<STR_LIT>", kwargs, <NUM_LIT:0>),<EOL>f("<STR_LIT>", kwargs))<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>return "<STR_LIT>".format(f("<STR_LIT:user>", kwargs), f("<STR_LIT:password>", kwargs))<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>return "<STR_LIT>".format(f("<STR_LIT>", kwargs), f("<STR_LIT>", kwargs, '<STR_LIT>'))<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>return "<STR_LIT>".format(<EOL>f("<STR_LIT>", kwargs),<EOL>f("<STR_LIT>", kwargs),<EOL>f("<STR_LIT:type>", kwargs),<EOL>f("<STR_LIT:info>", kwargs))<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>if "<STR_LIT:message>" in kwargs:<EOL><INDENT>return "<STR_LIT>" + f("<STR_LIT:message>", kwargs)<EOL><DEDENT>return "<STR_LIT>"<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>base = "<STR_LIT>" + f("<STR_LIT>", kwargs)<EOL>if "<STR_LIT:message>" in kwargs:<EOL><INDENT>return base + "<STR_LIT>" + f("<STR_LIT:message>", kwargs)<EOL><DEDENT>return base<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>return "<STR_LIT>".format(pack("<STR_LIT>", kwargs),<EOL>pack("<STR_LIT:key>", kwargs, '<STR_LIT>'))<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>base = "<STR_LIT>" + pack("<STR_LIT>", kwargs)<EOL>if "<STR_LIT:message>" in kwargs:<EOL><INDENT>return base + "<STR_LIT>" + f("<STR_LIT:message>", kwargs)<EOL><DEDENT>return base<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>return "<STR_LIT>".format(f("<STR_LIT>", kwargs),<EOL>f("<STR_LIT>", kwargs),<EOL>f("<STR_LIT>", kwargs, '<STR_LIT>'))<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>base = "<STR_LIT>" + f("<STR_LIT>", kwargs)<EOL>if "<STR_LIT:message>" in kwargs:<EOL><INDENT>return base + "<STR_LIT>" + f("<STR_LIT:message>", kwargs)<EOL><DEDENT>return base<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>if "<STR_LIT>" in kwargs:<EOL><INDENT>return "<STR_LIT>".format(pack("<STR_LIT>", kwargs),<EOL>f("<STR_LIT:target>", kwargs, '<STR_LIT>'))<EOL><DEDENT>return "<STR_LIT>"<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>if "<STR_LIT>" in kwargs:<EOL><INDENT>return "<STR_LIT>".format(pack("<STR_LIT>", kwargs),<EOL>f("<STR_LIT:target>", kwargs, '<STR_LIT>'))<EOL><DEDENT>return "<STR_LIT>"<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>return "<STR_LIT>".format(f("<STR_LIT>", kwargs),<EOL>f("<STR_LIT>", kwargs))<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>base = "<STR_LIT>".format(pack("<STR_LIT>", kwargs),<EOL>pack("<STR_LIT>", kwargs))<EOL>if "<STR_LIT:message>" in kwargs:<EOL><INDENT>return base + "<STR_LIT>" + pack("<STR_LIT:message>", kwargs)<EOL><DEDENT>return base<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>return "<STR_LIT>".format(f("<STR_LIT:target>", kwargs),<EOL>f("<STR_LIT:message>", kwargs))<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>return "<STR_LIT>".format(f("<STR_LIT:target>", kwargs),<EOL>f("<STR_LIT:message>", kwargs))<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>return "<STR_LIT>" + f("<STR_LIT:target>", kwargs, '<STR_LIT>')<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>if "<STR_LIT>" in kwargs:<EOL><INDENT>return "<STR_LIT>".format(f("<STR_LIT>", kwargs),<EOL>f("<STR_LIT:target>", kwargs, '<STR_LIT>'))<EOL><DEDENT>return "<STR_LIT>"<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>return "<STR_LIT>" + f("<STR_LIT:target>", kwargs, '<STR_LIT>')<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>if "<STR_LIT>" in kwargs:<EOL><INDENT>return "<STR_LIT>".format(f("<STR_LIT>", kwargs),<EOL>f("<STR_LIT:target>", kwargs, '<STR_LIT>'))<EOL><DEDENT>return "<STR_LIT>"<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>if "<STR_LIT>" in kwargs:<EOL><INDENT>return "<STR_LIT>".format(f("<STR_LIT>", kwargs), f("<STR_LIT>", kwargs))<EOL><DEDENT>elif "<STR_LIT>" in kwargs:<EOL><INDENT>return "<STR_LIT>" + f("<STR_LIT>", kwargs)<EOL><DEDENT>return "<STR_LIT>"<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>return "<STR_LIT>" + f("<STR_LIT:target>", kwargs, '<STR_LIT>')<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>return "<STR_LIT>".format(f("<STR_LIT:target>", kwargs),<EOL>f("<STR_LIT:port>", kwargs),<EOL>f("<STR_LIT>", kwargs, '<STR_LIT>'))<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>return "<STR_LIT>" + f("<STR_LIT:target>", kwargs, '<STR_LIT>')<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>return "<STR_LIT>" + f("<STR_LIT:target>", kwargs, '<STR_LIT>')<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>return "<STR_LIT>" + f("<STR_LIT:target>", kwargs, '<STR_LIT>')<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>return "<STR_LIT>".format(f("<STR_LIT>", kwargs, '<STR_LIT>'),<EOL>f("<STR_LIT:type>", kwargs, '<STR_LIT>'))<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>return "<STR_LIT>".format(f("<STR_LIT:target>", kwargs),<EOL>f("<STR_LIT:message>", kwargs))<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>return "<STR_LIT>".format(f("<STR_LIT>", kwargs, '<STR_LIT>'), b("<STR_LIT:o>", kwargs))<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>return "<STR_LIT>".format(pack("<STR_LIT>", kwargs),<EOL>f("<STR_LIT:target>", kwargs, '<STR_LIT>'))<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>if "<STR_LIT:count>" in kwargs:<EOL><INDENT>return "<STR_LIT>".format(pack("<STR_LIT>", kwargs),<EOL>f("<STR_LIT:count>", kwargs),<EOL>f("<STR_LIT:target>", kwargs, '<STR_LIT>'))<EOL><DEDENT>return "<STR_LIT>" + pack("<STR_LIT>", kwargs)<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>return "<STR_LIT>".format(f("<STR_LIT>", kwargs), f("<STR_LIT:message>", kwargs))<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>if "<STR_LIT:message>" in kwargs:<EOL><INDENT>return "<STR_LIT>".format(f("<STR_LIT:message>", kwargs))<EOL><DEDENT>else:<EOL><INDENT>return "<STR_LIT>"<EOL><DEDENT><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>if "<STR_LIT:message>" in kwargs:<EOL><INDENT>return "<STR_LIT>".format(f("<STR_LIT:message>", kwargs))<EOL><DEDENT>else:<EOL><INDENT>return "<STR_LIT>"<EOL><DEDENT><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>if "<STR_LIT:message>" in kwargs:<EOL><INDENT>return "<STR_LIT>" + f("<STR_LIT:message>", kwargs)<EOL><DEDENT>return "<STR_LIT>"<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>return "<STR_LIT>"<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>return "<STR_LIT>"<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>return "<STR_LIT>"<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>if "<STR_LIT:target>" in kwargs:<EOL><INDENT>return "<STR_LIT>".format(f("<STR_LIT>", kwargs),<EOL>f("<STR_LIT:target>", kwargs),<EOL>f("<STR_LIT>", kwargs, '<STR_LIT>'))<EOL><DEDENT>return "<STR_LIT>" + f("<STR_LIT>", kwargs)<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>return "<STR_LIT>" + f("<STR_LIT:target>", kwargs, '<STR_LIT>')<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>return "<STR_LIT>" + f("<STR_LIT:message>", kwargs)<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>return "<STR_LIT>" + pack("<STR_LIT>", kwargs, sep="<STR_LIT:U+0020>")<EOL><DEDENT>elif command == "<STR_LIT>":<EOL><INDENT>return "<STR_LIT>" + pack("<STR_LIT>", kwargs, sep="<STR_LIT:U+0020>")<EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>".format(command))<EOL><DEDENT>
|
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(pattern, value))<EOL>
|
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('<STR_LIT>' + str(tmp_file.name))<EOL>global tmp_file<EOL>global dest_folder_host<EOL>dest_folder_host = os.path.dirname(tmp_file.name)<EOL>print('<STR_LIT>' + dest_folder_host)<EOL>
|
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>')<EOL><DEDENT>
|
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>' + VALID_PACKAGE_NAME + '<STR_LIT>')<EOL><DEDENT>
|
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 (result, "<STR_LIT>" + dest_file)<EOL><DEDENT>else:<EOL><INDENT>return (<NUM_LIT:0>, "<STR_LIT>")<EOL><DEDENT>
|
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=t)<EOL><DEDENT>except CalledProcessError as e:<EOL><INDENT>t.seek(<NUM_LIT:0>)<EOL>result = e.returncode, t.read()<EOL><DEDENT>else:<EOL><INDENT>result = <NUM_LIT:0>, output<EOL>print('<STR_LIT:\n>' + result[<NUM_LIT:1>])<EOL><DEDENT>return result<EOL>
|
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_file_handler, stderr=t)<EOL><DEDENT>except CalledProcessError as e:<EOL><INDENT>t.seek(<NUM_LIT:0>)<EOL>result = e.returncode, t.read()<EOL><DEDENT>else:<EOL><INDENT>result = output<EOL>dest_file_handler.close()<EOL><DEDENT>return result<EOL>
|
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 error code
|
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_types(), required=False)<EOL>self._data_type = data_type<EOL>validate_attribute(interface_type, '<STR_LIT>',<EOL>expected_type=string_types(), required=False)<EOL>self._interface_type = interface_type<EOL>validate_attribute(data_flow_type, '<STR_LIT>',<EOL>expected_type=string_types(), required=False)<EOL>self._data_flow_type = data_flow_type<EOL>validate_attribute(subscription_type,<EOL>'<STR_LIT>',<EOL>expected_type=string_types(), required=False)<EOL>self._subscription_type = subscription_type<EOL>validate_attribute(push_interval, '<STR_LIT>',<EOL>expected_type=[int, float], required=False)<EOL>self._push_interval = push_interval<EOL>validate_attribute(source_data_port,<EOL>'<STR_LIT>',<EOL>expected_type=TargetPort, required=False)<EOL>self._source_data_port = source_data_port<EOL>validate_attribute(target_data_port,<EOL>'<STR_LIT>',<EOL>expected_type=TargetPort, required=False)<EOL>self._target_data_port = target_data_port<EOL>validate_attribute(comment, '<STR_LIT>',<EOL>expected_type=string_types(), required=False)<EOL>self._comment = comment<EOL>validate_attribute(visible, '<STR_LIT>',<EOL>expected_type=bool, required=False)<EOL>self._visible = visible<EOL>self._properties = {}<EOL>
|
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 ports.
@type interface_type str
@param data_flow_type Type of data flow between the ports.
@type data_flow_type str
@param subscription_type Type of subscription between the ports.
@type subscription_type str
@param push_interval Rate at which data is sent between the ports.
@type push_interval float
@param source_data_port The source port in the connection.
@type source_data_port TargetPort
@param target_data_port The target port in the connection.
@type target_data_port TargetPort
@param comment A comment about the port connector.
@type comment str
@param visible If this connector is visible in graphical displays.
@type visible bool
|
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: ('dataport_connector.connectorID', <type 'int'>, [<type 'str'>, <type 'unicode'>])
|
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'>, <type 'unicode'>])
|
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.dataType', <type 'int'>, [<type 'str'>, <type 'unicode'>])
|
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:
>>> c.interface_type = 1
Traceback (most recent call last):
...
InvalidTypeError: ('dataport_connector.interfaceType', <type 'int'>, [<type 'str'>, <type 'unicode'>])
|
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:
>>> c.data_flow_type = 1
Traceback (most recent call last):
...
InvalidTypeError: ('dataport_connector.dataflowType', <type 'int'>, [<type 'str'>, <type 'unicode'>])
|
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_type = "PUSH"
Invalid assignment should throw exception:
>>> c.subscription_type = 1
Traceback (most recent call last):
...
InvalidTypeError: ('dataport_connector.subscriptionType', <type 'int'>, [<type 'str'>, <type 'unicode'>])
|
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):
...
InvalidTypeError: ('dataport_connector.pushInterval', <type 'str'>, [<type 'int'>, <type 'float'>])
|
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):
...
InvalidTypeError: ('dataport_connector.sourceDataPort', <type 'int'>, <class 'rtsprofile.targets.TargetPort'>)
|
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):
...
InvalidTypeError: ('dataport_connector.targetDataPort', <type 'int'>, <class 'rtsprofile.targets.TargetPort'>)
|
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:
>>> c.comment = 1
Traceback (most recent call last):
...
InvalidTypeError: ('dataport_connector.ext.comment', <type 'int'>, [<type 'str'>, <type 'unicode'>])
|
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:
>>> c.visible = 1
Traceback (most recent call last):
...
InvalidTypeError: ('dataport_connector.ext.visible', <type 'int'>, <type 'bool'>)
|
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 call last):
...
InvalidTypeError: ('dataport_connector.ext.Properties', <type 'int'>, <type 'dict'>)
|
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>')<EOL>if node.hasAttributeNS(RTS_NS, '<STR_LIT>'):<EOL><INDENT>self.subscription_type = node.getAttributeNS(RTS_NS,<EOL>'<STR_LIT>')<EOL><DEDENT>else:<EOL><INDENT>self.subscription_type = '<STR_LIT>'<EOL><DEDENT>if node.hasAttributeNS(RTS_NS, '<STR_LIT>'):<EOL><INDENT>self.push_interval = float(node.getAttributeNS(RTS_NS,<EOL>'<STR_LIT>'))<EOL><DEDENT>else:<EOL><INDENT>self.push_interval = <NUM_LIT:0.0><EOL><DEDENT>self.comment = node.getAttributeNS(RTS_EXT_NS, '<STR_LIT>')<EOL>if node.hasAttributeNS(RTS_EXT_NS, '<STR_LIT>'):<EOL><INDENT>visible = node.getAttributeNS(RTS_EXT_NS, '<STR_LIT>')<EOL>if visible == '<STR_LIT:true>' or visible == '<STR_LIT:1>':<EOL><INDENT>self.visible = True<EOL><DEDENT>else:<EOL><INDENT>self.visible = False<EOL><DEDENT><DEDENT>if node.getElementsByTagNameNS(RTS_NS, '<STR_LIT>').length != <NUM_LIT:1>:<EOL><INDENT>raise InvalidDataPortConnectorNodeError<EOL><DEDENT>self.source_data_port = TargetPort().parse_xml_node(node.getElementsByTagNameNS(RTS_NS, '<STR_LIT>')[<NUM_LIT:0>])<EOL>if node.getElementsByTagNameNS(RTS_NS, '<STR_LIT>').length != <NUM_LIT:1>:<EOL><INDENT>raise InvalidDataPortConnectorNodeError<EOL><DEDENT>self.target_data_port = TargetPort().parse_xml_node(node.getElementsByTagNameNS(RTS_NS, '<STR_LIT>')[<NUM_LIT:0>])<EOL>for c in get_direct_child_elements_xml(node, prefix=RTS_EXT_NS,<EOL>local_name='<STR_LIT>'):<EOL><INDENT>name, value = parse_properties_xml(c)<EOL>self._properties[name] = value<EOL><DEDENT>return self<EOL>
|
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 = '<STR_LIT>'<EOL><DEDENT>if '<STR_LIT>' in y:<EOL><INDENT>self.push_interval = float(y['<STR_LIT>'])<EOL><DEDENT>else:<EOL><INDENT>self.push_interval = <NUM_LIT:0.0><EOL><DEDENT>if RTS_EXT_NS_YAML + '<STR_LIT>' in y:<EOL><INDENT>self.comment = y[RTS_EXT_NS_YAML + '<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>self.comment = '<STR_LIT>'<EOL><DEDENT>if RTS_EXT_NS_YAML + '<STR_LIT>' in y:<EOL><INDENT>visible = y[RTS_EXT_NS_YAML + '<STR_LIT>']<EOL>if visible == True or visible == '<STR_LIT:true>' or visible == '<STR_LIT:1>':<EOL><INDENT>self.visible = True<EOL><DEDENT>else:<EOL><INDENT>self.visible = False<EOL><DEDENT><DEDENT>if not '<STR_LIT>' in y:<EOL><INDENT>raise InvalidDataPortConnectorNodeError<EOL><DEDENT>self.source_data_port =TargetPort().parse_yaml(y['<STR_LIT>'])<EOL>if not '<STR_LIT>' in y:<EOL><INDENT>raise InvalidDataPortConnectorNodeError<EOL><DEDENT>self.target_data_port =TargetPort().parse_yaml(y['<STR_LIT>'])<EOL>if RTS_EXT_NS_YAML + '<STR_LIT>' in y:<EOL><INDENT>for p in y[RTS_EXT_NS_YAML + '<STR_LIT>']:<EOL><INDENT>if '<STR_LIT:value>' in p:<EOL><INDENT>value = p['<STR_LIT:value>']<EOL><DEDENT>else:<EOL><INDENT>value = None<EOL><DEDENT>self._properties[p['<STR_LIT:name>']] = value<EOL><DEDENT><DEDENT>return self<EOL>
|
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.setAttributeNS(RTS_NS, RTS_NS_S + '<STR_LIT>',<EOL>self.interface_type)<EOL>element.setAttributeNS(RTS_NS, RTS_NS_S + '<STR_LIT>',<EOL>self.data_flow_type)<EOL>if self.subscription_type:<EOL><INDENT>element.setAttributeNS(RTS_NS, RTS_NS_S + '<STR_LIT>',<EOL>self.subscription_type)<EOL><DEDENT>if self.push_interval != <NUM_LIT:0.0>:<EOL><INDENT>element.setAttributeNS(RTS_NS, RTS_NS_S + '<STR_LIT>',<EOL>str(self.push_interval))<EOL><DEDENT>if self.comment:<EOL><INDENT>element.setAttributeNS(RTS_EXT_NS, RTS_EXT_NS_S + '<STR_LIT>',<EOL>self.comment)<EOL><DEDENT>if self.visible != True:<EOL><INDENT>element.setAttributeNS(RTS_EXT_NS, RTS_EXT_NS_S + '<STR_LIT>',<EOL>str(self.visible).lower())<EOL><DEDENT>new_element = doc.createElementNS(RTS_NS, RTS_NS_S + '<STR_LIT>')<EOL>self.source_data_port.save_xml(doc, new_element)<EOL>element.appendChild(new_element)<EOL>new_element = doc.createElementNS(RTS_NS, RTS_NS_S + '<STR_LIT>')<EOL>self.target_data_port.save_xml(doc, new_element)<EOL>element.appendChild(new_element)<EOL>for p in self.properties:<EOL><INDENT>new_prop_element = doc.createElementNS(RTS_EXT_NS,<EOL>RTS_EXT_NS_S + '<STR_LIT>')<EOL>properties_to_xml(new_prop_element, p, self.properties[p])<EOL>element.appendChild(new_prop_element)<EOL><DEDENT>
|
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>d[RTS_EXT_NS_YAML + '<STR_LIT>'] = self.visible<EOL><DEDENT>if self.subscription_type:<EOL><INDENT>d['<STR_LIT>'] = self.subscription_type<EOL><DEDENT>if self.push_interval:<EOL><INDENT>d['<STR_LIT>'] = self.push_interval<EOL><DEDENT>if self.comment:<EOL><INDENT>d[RTS_EXT_NS_YAML + '<STR_LIT>'] = self.comment<EOL><DEDENT>props = []<EOL>for name in self.properties:<EOL><INDENT>p = {'<STR_LIT:name>': name}<EOL>if self.properties[name]:<EOL><INDENT>p['<STR_LIT:value>'] = str(self.properties[name])<EOL><DEDENT>props.append(p)<EOL><DEDENT>if props:<EOL><INDENT>d[RTS_EXT_NS_YAML + '<STR_LIT>'] = props<EOL><DEDENT>return d<EOL>
|
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=string_types(), required=False)<EOL>self._trans_method = trans_method<EOL>validate_attribute(source_service_port,<EOL>'<STR_LIT>',<EOL>expected_type=TargetPort, required=True)<EOL>self._source_service_port = source_service_port<EOL>validate_attribute(target_service_port,<EOL>'<STR_LIT>',<EOL>expected_type=TargetPort, required=True)<EOL>self._target_service_port = target_service_port<EOL>validate_attribute(comment, '<STR_LIT>',<EOL>expected_type=string_types(), required=False)<EOL>self._comment = comment<EOL>validate_attribute(visible, '<STR_LIT>',<EOL>expected_type=bool, required=False)<EOL>self._visible = visible<EOL>self._properties = {}<EOL>
|
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 connection.
@type source_service_port TargetPort
@param target_service_port The target port in the connection.
@type target_service_port TargetPort
@param comment A comment about the port connector.
@type comment str
@param visible If this connector is visible in graphical displays.
@type visible bool
|
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: ('serviceport_connector.connectorID', <type 'int'>, [<type 'str'>, <type 'unicode'>])
|
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 'str'>, <type 'unicode'>])
|
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:
>>> c.trans_method = 1
Traceback (most recent call last):
...
InvalidTypeError: ('serviceport_connector.transMethod', <type 'int'>, [<type 'str'>, <type 'unicode'>])
|
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 call last):
...
InvalidTypeError: ('serviceport_connector.sourceServicePort', <type 'int'>, <class 'rtsprofile.targets.TargetPort'>)
|
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 call last):
...
InvalidTypeError: ('serviceport_connector.targetServicePort', <type 'int'>, <class 'rtsprofile.targets.TargetPort'>)
|
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:
>>> c.comment = 1
Traceback (most recent call last):
...
InvalidTypeError: ('serviceport_connector.ext.comment', <type 'int'>, [<type 'str'>, <type 'unicode'>])
|
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:
>>> c.visible = 1
Traceback (most recent call last):
...
InvalidTypeError: ('serviceport_connector.ext.visible', <type 'int'>, <type 'bool'>)
|
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 call last):
...
InvalidTypeError: ('serviceport_connector.ext.Properties', <type 'int'>, <type 'dict'>)
|
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><DEDENT>self.comment = node.getAttributeNS(RTS_EXT_NS, '<STR_LIT>')<EOL>if node.hasAttributeNS(RTS_EXT_NS, '<STR_LIT>'):<EOL><INDENT>visible = node.getAttributeNS(RTS_EXT_NS, '<STR_LIT>')<EOL>if visible == '<STR_LIT:true>' or visible == '<STR_LIT:1>':<EOL><INDENT>self.visible = True<EOL><DEDENT>else:<EOL><INDENT>self.visible = False<EOL><DEDENT><DEDENT>if node.getElementsByTagNameNS(RTS_NS, '<STR_LIT>').length != <NUM_LIT:1>:<EOL><INDENT>raise InvalidServicePortConnectorNodeError<EOL><DEDENT>self.source_service_port = TargetPort().parse_xml_node(node.getElementsByTagNameNS(RTS_NS, '<STR_LIT>')[<NUM_LIT:0>])<EOL>if node.getElementsByTagNameNS(RTS_NS, '<STR_LIT>').length != <NUM_LIT:1>:<EOL><INDENT>raise InvalidServicePortConnectorNodeError<EOL><DEDENT>self.target_service_port = TargetPort().parse_xml_node(node.getElementsByTagNameNS(RTS_NS, '<STR_LIT>')[<NUM_LIT:0>])<EOL>for c in get_direct_child_elements_xml(node, prefix=RTS_EXT_NS,<EOL>local_name='<STR_LIT>'):<EOL><INDENT>name, value = parse_properties_xml(c)<EOL>self._properties[name] = value<EOL><DEDENT>return self<EOL>
|
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><DEDENT>else:<EOL><INDENT>self.comment = '<STR_LIT>'<EOL><DEDENT>if RTS_EXT_NS_YAML + '<STR_LIT>' in y:<EOL><INDENT>visible = y[RTS_EXT_NS_YAML + '<STR_LIT>']<EOL>if visible == True or visible == '<STR_LIT:true>' or visible == '<STR_LIT:1>':<EOL><INDENT>self.visible = True<EOL><DEDENT>else:<EOL><INDENT>self.visible = False<EOL><DEDENT><DEDENT>if '<STR_LIT>' not in y:<EOL><INDENT>raise InvalidServicePortConnectorNodeError<EOL><DEDENT>self.source_service_port =TargetPort().parse_yaml(y['<STR_LIT>'])<EOL>if '<STR_LIT>' not in y:<EOL><INDENT>raise InvalidServicePortConnectorNodeError<EOL><DEDENT>self.target_service_port =TargetPort().parse_yaml(y['<STR_LIT>'])<EOL>if RTS_EXT_NS_YAML + '<STR_LIT>' in y:<EOL><INDENT>for p in y[RTS_EXT_NS_YAML + '<STR_LIT>']:<EOL><INDENT>if '<STR_LIT:value>' in p:<EOL><INDENT>value = p['<STR_LIT:value>']<EOL><DEDENT>else:<EOL><INDENT>value = None<EOL><DEDENT>self._properties[p['<STR_LIT:name>']] = value<EOL><DEDENT><DEDENT>return self<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>',<EOL>self.trans_method)<EOL><DEDENT>if self.comment:<EOL><INDENT>element.setAttributeNS(RTS_EXT_NS, RTS_EXT_NS_S + '<STR_LIT>',<EOL>self.comment)<EOL><DEDENT>if self.visible != True:<EOL><INDENT>element.setAttributeNS(RTS_EXT_NS, RTS_EXT_NS_S + '<STR_LIT>',<EOL>str(self.visible).lower())<EOL><DEDENT>new_element = doc.createElementNS(RTS_NS,<EOL>RTS_NS_S + '<STR_LIT>')<EOL>self.source_service_port.save_xml(doc, new_element)<EOL>element.appendChild(new_element)<EOL>new_element = doc.createElementNS(RTS_NS,<EOL>RTS_NS_S + '<STR_LIT>')<EOL>self.target_service_port.save_xml(doc, new_element)<EOL>element.appendChild(new_element)<EOL>for p in self.properties:<EOL><INDENT>new_prop_element = doc.createElementNS(RTS_EXT_NS,<EOL>RTS_EXT_NS_S + '<STR_LIT>')<EOL>properties_to_xml(new_prop_element, p, self.properties[p])<EOL>element.appendChild(new_prop_element)<EOL><DEDENT>
|
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_LIT>'] = self.trans_method<EOL><DEDENT>if self.comment:<EOL><INDENT>d[RTS_EXT_NS_YAML + '<STR_LIT>'] = self.comment<EOL><DEDENT>props = []<EOL>for name in self.properties:<EOL><INDENT>p = {'<STR_LIT:name>': name}<EOL>if self.properties[name]:<EOL><INDENT>p['<STR_LIT:value>'] = str(self.properties[name])<EOL><DEDENT>props.append(p)<EOL><DEDENT>if props:<EOL><INDENT>d[RTS_EXT_NS_YAML + '<STR_LIT>'] = props<EOL><DEDENT>return d<EOL>
|
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 xml_spec A string or open file object containing the XML
specification of the RTS Profile. If present, the other arguments must
be None.
@param yaml_spec A string or open file object containing the YAML
specification of the RTS Profile. If present, the other arguments must
be None.
Example:
>>> s = RtsProfile()
Initialize from xml string:
>>> input = open('test/rtsystem.xml').read()
>>> s = RtsProfile(xml_spec=input)
Initialize from yaml string:
>>> input = open('test/rtsystem.yaml').read()
>>> s = RtsProfile(yaml_spec=input)
Get system summary as string:
>>> str(s).find('ID:') != -1
True
|
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):
...
InvalidTypeError: ('rts_profile.id', <type 'int'>, [<type 'str'>, <type 'unicode'>])
|
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.abstract', <type 'int'>, [<type 'str'>, <type 'unicode'>])
|
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 call last):
...
InvalidTypeError: ('rts_profile.creationDate', <type 'int'>, [<type 'str'>, <type 'unicode'>])
|
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 recent call last):
...
InvalidTypeError: ('rts_profile.updateDate', <type 'int'>, [<type 'str'>, <type 'unicode'>])
|
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 'int'>, [<type 'str'>, <type 'unicode'>])
|
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
Traceback (most recent call last):
...
InvalidTypeError: ('rts_profile.Components', <type 'int'>, <type 'list'>)
|
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
Traceback (most recent call last):
...
InvalidTypeError: ('rts_profile.Groups', <type 'int'>, <type 'list'>)
|
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):
...
InvalidTypeError: ('rts_profile.DataPortConnectors', <type 'int'>, <type 'list'>)
|
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 recent call last):
...
InvalidTypeError: ('rts_profile.ServicePortConnectors', <type 'int'>, <type 'list'>)
|
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):
...
InvalidTypeError: ('rts_profile.StartUp', <type 'int'>, <class 'rtsprofile.message_sending.StartUp'>)
|
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):
...
InvalidTypeError: ('rts_profile.ShutDown', <type 'int'>, <class 'rtsprofile.message_sending.ShutDown'>)
|
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):
...
InvalidTypeError: ('rts_profile.Activation', <type 'int'>, <class 'rtsprofile.message_sending.Activation'>)
|
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 call last):
...
InvalidTypeError: ('rts_profile.Deactivation', <type 'int'>, <class 'rtsprofile.message_sending.Deactivation'>)
|
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):
...
InvalidTypeError: ('rts_profile.Resetting', <type 'int'>, <class 'rtsprofile.message_sending.Resetting'>)
|
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 call last):
...
InvalidTypeError: ('rts_profile.Initializing', <type 'int'>, <class 'rtsprofile.message_sending.Initialize'>)
|
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):
...
InvalidTypeError: ('rts_profile.Finalizing', <type 'int'>, <class 'rtsprofile.message_sending.Finalize'>)
|
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:
>>> s.comment = 1
Traceback (most recent call last):
...
InvalidTypeError: ('rtsprofile.ext.comment', <type 'int'>, [<type 'str'>, <type 'unicode'>])
|
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 throw exception:
>>> s.version_up_log = 1
Traceback (most recent call last):
...
InvalidTypeError: ('rtsprofile.ext.VersionUpLog', <type 'int'>, <type 'list'>)
|
f5228:c0:m36
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.