:py:mod:`dbg` ============= .. py:module:: dbg Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: dbg.MemSizeType dbg.MemSize Functions ~~~~~~~~~ .. autoapisummary:: dbg.get_size dbg.explore_sizes dbg.print_size dbg.profile dbg.prepare_text dbg.p dbg.u Attributes ~~~~~~~~~~ .. autoapisummary:: dbg.has_asizeof dbg.RUNTIME_CONSOLE dbg.EXCLUSION_TYPES dbg.EXCLUSION_MODULES .. py:data:: has_asizeof :value: 'True' .. py:data:: RUNTIME_CONSOLE :value: 'True' .. py:data:: EXCLUSION_TYPES .. py:data:: EXCLUSION_MODULES :value: "['numpy', 'h5py', 'h5pickle']" .. py:class:: MemSizeType(*args, **kwds) Bases: :py:obj:`enum.Enum` Create a collection of name/value pairs. Example enumeration: >>> class Color(Enum): ... RED = 1 ... BLUE = 2 ... GREEN = 3 Access them by: - attribute access:: >>> Color.RED - value lookup: >>> Color(1) - name lookup: >>> Color['RED'] Enumerations can be iterated over, and know how many members they have: >>> len(Color) 3 >>> list(Color) [, , ] Methods can be added to enumerations, and members can have their own attributes -- see the documentation for details. .. py:attribute:: byte .. py:attribute:: bit .. py:attribute:: kilobyte .. py:attribute:: kilobit .. py:attribute:: megabyte .. py:attribute:: megabit .. py:attribute:: gigabyte .. py:attribute:: gigabit .. py:class:: MemSize(value: Union[int, float], size_type: Union[str, MemSizeType] = MemSizeType.megabyte) Bases: :py:obj:`float` Convert a string or number to a floating point number, if possible. .. py:attribute:: size_type .. py:method:: in_mb() -> float .. py:method:: str_2_size_type(type_str: str) :staticmethod: .. py:method:: size_type_2_str(size_type: MemSizeType) :staticmethod: .. py:method:: __str__() Return str(self). .. py:function:: get_size(test_obj: object, size_type: Union[str, MemSizeType] = MemSizeType.megabyte) .. py:function:: explore_sizes(test_obj: object, size_type: Union[str, MemSizeType] = MemSizeType.megabyte, max_level=5, min_size_mb=None, stop_on_max_level=True, exclusion_types=None, exclusion_modules=None, only_show_new=False, __current_level=0, __objs_tested=None) .. py:function:: print_size(test_obj: object, size_type: Union[str, MemSizeType] = MemSizeType.megabyte) .. py:function:: profile(fnc) A decorator that uses cProfile to profile a function .. py:function:: prepare_text(debug_print, debug_from=None) .. py:function:: p(debug_print, debug_from=None) Prints text to terminal for debugging. .. py:function:: u(debug_print: str, debug_from: str = None, end: bool = False) Updates the colourised string of the terminal with debug_print. If end is True the line is ended Parameters ---------- debug_print: str Test to be used updated the terminal with. debug_from: str, optional To specify where debug text is being called from. end: str, optional If true the line is ended.