UniteLabs

BaseTransport

Bases
asyncio.BaseTransport, typing.Generic[P_co]

Methods

  • __init__(self) -> None

  • get_protocol(self) -> typing.Optional[P_co]

    Get the current `Protocol` associated with this transport.

    Response

    Type
    typing.Optional[P_co]
    Description

    The current `Protocol` instance.

  • set_protocol(self, protocol : P_co) -> None

    Associate a new `Protocol` with this transport.

    Parameters

    • Name
      self
      Type
      Default
      Description

    • Name
      protocol
      Type
      P_co
      Default
      Description

      The new `Protocol` instance.

    Exceptions

    Type
    TypeError
    Description
    If the protocol is not an instance of asyncio.BaseProtocol or None.
  • is_closing(self) -> bool

    Whether the transport is closing or closed.

    Response

    Type
    bool
    Description

    True if the transport is closing or closed, False otherwise.

  • open(self) -> None

    Open the transport and inform the `Protocol` whether the connection was established successfully.

  • _open(self) -> None

    Underlying action performed when calling `open`. Subclasses override this method to specify behavior when opening the connection.

  • close(self) -> None

    Close the transport and inform the protocol whether the connection was terminated successfully.

  • _close(self) -> None

    Underlying action performed when calling `close`. Subclasses override this method to specify behavior when closing the connection.

  • abort(self) -> None

    Close the transport immediately.

  • _abort(self, exception : typing.Optional[Exception]) -> None

    Underlying action performed when calling `abort`. Subclasses may override this method to specify behavior when aborting the connection.

    Parameters

    • Name
      self
      Type
      Default
      Description

    • Name
      exception
      Type
      typing.Optional[Exception]
      Default
      = None
      Description

      The Exception to propagate to the protocol, if connected.

  • _exception(
      self,
      exception : Exception,
      message : str
    ) -> None

    Report a fatal error to the event-loop and abort the transport.

    Parameters

    • Name
      self
      Type
      Default
      Description

    • Name
      exception
      Type
      Exception
      Default
      Description

      The Exception to pass on the the loop's exception handler.

    • Name
      message
      Type
      str
      Default
      Description

      Human-readable text describing the exception's execution state, cause, etc.

Attributes

  • Name
    _loop
    Type
    Value

    = asyncio.get_event_loop_policy().get_event_loop()

    Description

  • Name
    _protocol
    Type
    typing.Optional[P_co]
    Value

    = None

    Description

  • Name
    _is_closing
    Type
    Value

    = True

    Description

Copyright © 2025