Source code for iwopy.core.base

[docs] class Base: """ Generic base for various iwopy objects. Attributes ---------- name: str The name :group: core """
[docs] def __init__(self, name): """ Constructor Parameters ---------- name: str The name """ self.name = name self._initialized = False if name is None: self.name = type(self).__name__
[docs] def __str__(self): """ Get info string Returns ------- str : Info string """ if self.name == type(self).__name__: return self.name return f"{self.name} ({type(self).__name__})"
@property def initialized(self): """ Flag for finished initialization Returns ------- bool : True if initialization has been done """ return self._initialized
[docs] def initialize(self, verbosity=0): """ Initialize the object. Parameters ---------- verbosity: int The verbosity level, 0 = silent """ self._initialized = True
[docs] def finalize(self, verbosity=0): """ Finalize the object. Parameters ---------- verbosity: int The verbosity level, 0 = silent """ self._initialized = False