flopz.listener package

Subpackages

Submodules

flopz.listener.event module

class Event(data=None, flopz_config=None)

Bases: object

A base class for all events that we can receive from targets

Parameters
  • data (Optional[dict]) –

  • flopz_config (Optional[dict]) –

enter()

Interactive events will be ‘entered’ During enter(), the event takes over control and only returns when the event has been dealt with. Override this for interactive events. :return:

is_interactive()

Events can be interactive or non-interactive. :rtype: bool :return: True, if this event requires interaction, False otherwise

pretty_print()

used for logging this event to a text string :rtype: str :return: a pretty-printed string

pretty_print_logger(logger, level)

used for logging to the console or standard log files :type logger: Logger :param logger: a logging.Logger :return: nothing

flopz.listener.flopz_logger module

class FlopzLogger(flopz_config, args=None)

Bases: object

A base class which handles logging events.

Parameters
  • flopz_config (dict) –

  • args (Optional[Namespace]) –

close()

called before the program exits. close file handles etc.

flush()

Ensures that all data is written, f.ex. when logging to a file or socket

log(event)

logs a single event :type event: Event :param event: the event to log :rtype: None :return: nothing

static name()
Return type

str

Returns

a unique name for this logger class

flopz.listener.protocol module

class Protocol(config, link)

Bases: object

A base class for (wire) protocols that a target can implement. Protocols are used to interpret the data we receive over a link. Likewise, it can be used to encode data that we send to the target. A target can implement its own protocol or use a generic protocol.

Parameters
  • config (dict) –

  • link (Link) –

feed(data)

Consume a (potentially incomplete) chunk of bytes Generates events internally, as data comes in After calling this, you can check if events are available using has_events() :type data: bytes :param data:

get_event()
Return type

Event

has_events()
Return type

bool

Module contents