hvl_ccb.comm.telnet
digraph inheritance5eeea911b0 { bgcolor=transparent; rankdir=TB; size=""; "ABC" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",tooltip="Helper class that provides a standard way to create an ABC using"]; "AsyncCommunicationProtocol" [URL="../hvl_ccb.comm.base.html#hvl_ccb.comm.base.AsyncCommunicationProtocol",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Abstract base class for asynchronous communication protocols"]; "CommunicationProtocol" -> "AsyncCommunicationProtocol" [arrowsize=0.5,style="setlinewidth(0.5)"]; "AsyncCommunicationProtocolConfig" [URL="../hvl_ccb.comm.base.html#hvl_ccb.comm.base.AsyncCommunicationProtocolConfig",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Base configuration data class for asynchronous communication protocols"]; "CCBError" [URL="../hvl_ccb.error.html#hvl_ccb.error.CCBError",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "CommunicationError" [URL="../hvl_ccb.comm.base.html#hvl_ccb.comm.base.CommunicationError",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top"]; "CCBError" -> "CommunicationError" [arrowsize=0.5,style="setlinewidth(0.5)"]; "CommunicationProtocol" [URL="../hvl_ccb.comm.base.html#hvl_ccb.comm.base.CommunicationProtocol",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Communication protocol abstract base class."]; "ConfigurationMixin" -> "CommunicationProtocol" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ABC" -> "CommunicationProtocol" [arrowsize=0.5,style="setlinewidth(0.5)"]; "ConfigurationMixin" [URL="../hvl_ccb.configuration.html#hvl_ccb.configuration.ConfigurationMixin",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Mixin providing configuration to a class."]; "ABC" -> "ConfigurationMixin" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TelnetCommunication" [URL="../hvl_ccb.comm.telnet.html#hvl_ccb.comm.telnet.TelnetCommunication",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Implements the Communication Protocol for telnet."]; "AsyncCommunicationProtocol" -> "TelnetCommunication" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TelnetCommunicationConfig" [URL="../hvl_ccb.comm.telnet.html#hvl_ccb.comm.telnet.TelnetCommunicationConfig",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Configuration dataclass for :class:`TelnetCommunication`."]; "AsyncCommunicationProtocolConfig" -> "TelnetCommunicationConfig" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TelnetError" [URL="../hvl_ccb.comm.telnet.html#hvl_ccb.comm.telnet.TelnetError",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Telnet communication related errors."]; "CommunicationError" -> "TelnetError" [arrowsize=0.5,style="setlinewidth(0.5)"]; }Communication protocol for telnet. Makes use of the telnetlib library.
- class TelnetCommunication(configuration)[source]
Bases:
AsyncCommunicationProtocol
Implements the Communication Protocol for telnet.
- static config_cls()[source]
Return the default configdataclass class.
- Returns:
a reference to the default configdataclass class
- property is_open: bool
Is the connection open?
- Returns:
True for an open connection
- read_bytes() bytes [source]
Read data as bytes from the telnet connection.
- Returns:
data from telnet connection
- Raises:
TelnetError – when connection is not open, raises an Error during the communication
- write_bytes(data: bytes)[source]
Write the data as bytes to the telnet connection.
- Parameters:
data – Data to be sent.
- Raises:
TelnetError – when connection is not open, raises an Error during the communication
- class TelnetCommunicationConfig(terminator: bytes = b'\r\n', encoding: str = 'utf-8', encoding_error_handling: str = 'strict', wait_sec_read_text_nonempty: int | float = 0.5, default_n_attempts_read_text_nonempty: int = 10, host: str | IPv4Address | IPv6Address | None = None, port: int = 0, timeout: int | float = 0.2)[source]
Bases:
AsyncCommunicationProtocolConfig
Configuration dataclass for
TelnetCommunication
.- create_telnet() Telnet | None [source]
Create a telnet client :return: Opened Telnet object or None if connection is not possible
- force_value(fieldname, value)
Forces a value to a dataclass field despite the class being frozen.
NOTE: you can define post_force_value method with same signature as this method to do extra processing after value has been forced on fieldname.
- Parameters:
fieldname – name of the field
value – value to assign
- classmethod keys() Sequence[str]
Returns a list of all configdataclass fields key-names.
- Returns:
a list of strings containing all keys.
- classmethod optional_defaults() dict[str, object]
Returns a list of all configdataclass fields, that have a default value assigned and may be optionally specified on instantiation.
- Returns:
a list of strings containing all optional keys.
- port: int = 0
Port at which the host is listening
- classmethod required_keys() Sequence[str]
Returns a list of all configdataclass fields, that have no default value assigned and need to be specified on instantiation.
- Returns:
a list of strings containing all required keys.
- timeout: int | float = 0.2
Timeout for reading a line
- exception TelnetError[source]
Bases:
OSError
,CommunicationError
Telnet communication related errors.