qmat.utils ========== .. py:module:: qmat.utils .. autoapi-nested-parse:: Utility function for `qmat` Classes ------- .. autoapisummary:: qmat.utils.Timer Functions --------- .. autoapisummary:: qmat.utils.checkOverriding qmat.utils.checkGenericConstr qmat.utils.storeAlias qmat.utils.storeClass qmat.utils.importAll qmat.utils.getClasses qmat.utils.useQGen Module Contents --------------- .. py:function:: checkOverriding(cls, name, isProperty=True) Check if a class overrides a method with a given name .. py:function:: checkGenericConstr(cls) Check if a class implement a constructor with a `**kwargs` generic parameter .. py:function:: storeAlias(cls, dico, alias) Store a class into a dictionary with a given alias .. py:function:: storeClass(cls, dico) Store a class into a dictionary .. py:function:: importAll(localVars, __all__, __path__, __name__, __import__) Import all submodules in the current (sub-)package .. py:function:: getClasses(dico, module=None) Retrieve all classes stored into a dictionary, filtering aliases .. py:function:: useQGen(__init__) Wrapper to extract :math:`Q_\Delta`-generator parameters from `kwargs` arguments, using either a :math:`Q`-generator `qGen` or separately given parameters. .. py:class:: Timer(name, scale=1, descr='tWall') Utility Timer class, that can be used as follow : >>> with Timer("stuff"): # prints "Starting stuff ... >>> # ... do stuff >>> # prints " -- tWall : {tWall}s The description at the end can be replaced using the `descr` constructor parameter, and the final wall time can be scaled using the `scale` parameter. Can also be used like this : >>> clock = Timer("stuff") >>> clock.start() >>> # ... do stuff >>> clock.stop() >>> tWall = clock.tWall .. py:attribute:: name .. py:attribute:: scale :value: 1 .. py:attribute:: descr :value: 'tWall' .. py:method:: start() .. py:method:: stop()