AutoInitAndCloseable¶
-
class
tfsnippet.utils.
AutoInitAndCloseable
¶ Bases:
object
Classes with
init()
to initialize its internal states, and alsoclose()
to destroy these states. Theinit()
method can be repeatedly called, which will cause initialization only at the first call. Thus other methods may always callinit()
at beginning, which can bring auto-initialization to the class.A context manager is implemented:
init()
is explicitly called when entering the context, whiledestroy()
is called when exiting the context.Methods Summary
close
()Ensure the internal states are destroyed. init
()Ensure the internal states are initialized. Methods Documentation
-
close
()¶ Ensure the internal states are destroyed.
-
init
()¶ Ensure the internal states are initialized.
-