Module livelossplot.outputs.base_output
Expand source code
from abc import ABC, abstractmethod
from livelossplot.main_logger import MainLogger
class BaseOutput(ABC):
@abstractmethod
def send(self, logger: MainLogger):
"""Abstract method - handle logs for a plugin"""
...
def close(self):
"""Overwrite it with last steps"""
...
def set_output_mode(self, mode: str):
"""Some of output plugins needs to know target format"""
assert mode in ('notebook', 'script')
self._set_output_mode(mode)
def _set_output_mode(self, mode: str):
"""
Args:
mode: mode for callbacks - some of outputs need to change some behaviors,
depending on the working environment (scripts and jupyter notebooks)
"""
...
Classes
class BaseOutput
-
Helper class that provides a standard way to create an ABC using inheritance.
Expand source code
class BaseOutput(ABC): @abstractmethod def send(self, logger: MainLogger): """Abstract method - handle logs for a plugin""" ... def close(self): """Overwrite it with last steps""" ... def set_output_mode(self, mode: str): """Some of output plugins needs to know target format""" assert mode in ('notebook', 'script') self._set_output_mode(mode) def _set_output_mode(self, mode: str): """ Args: mode: mode for callbacks - some of outputs need to change some behaviors, depending on the working environment (scripts and jupyter notebooks) """ ...
Ancestors
- abc.ABC
Subclasses
Methods
def close(self)
-
Overwrite it with last steps
Expand source code
def close(self): """Overwrite it with last steps""" ...
def send(self, logger: MainLogger)
-
Abstract method - handle logs for a plugin
Expand source code
@abstractmethod def send(self, logger: MainLogger): """Abstract method - handle logs for a plugin""" ...
def set_output_mode(self, mode: str)
-
Some of output plugins needs to know target format
Expand source code
def set_output_mode(self, mode: str): """Some of output plugins needs to know target format""" assert mode in ('notebook', 'script') self._set_output_mode(mode)