Application.utils ================= .. py:module:: Application.utils Attributes ---------- .. autoapisummary:: Application.utils.logger Classes ------- .. autoapisummary:: Application.utils.Singleton Application.utils.ShittyMultiThreading Application.utils.SimpleTimer Functions --------- .. autoapisummary:: Application.utils.natural_time Module Contents --------------- .. py:data:: logger .. py:function:: natural_time(time_in_seconds: float) -> str Converts a time in seconds to a 6-padded scaled unit E.g.: 1.5000 -> 1.50 s 0.1000 -> 100.00 ms 0.0001 -> 100.00 us .. py:class:: Singleton Bases: :py:obj:`type` Handcuffs .. py:attribute:: _instances .. py:method:: __call__(*args, **kwargs) .. py:class:: ShittyMultiThreading(work, tasks, num_threads=5) terrible, utterly horrendous. doesn't even store the return values lmao .. py:attribute:: work .. py:attribute:: num_threads :value: 5 .. py:attribute:: queue .. py:method:: worker() .. py:method:: start() .. py:class:: SimpleTimer(process_name=None, log=False) Basic timer utility. This is for when you want to see just how incredibly inefficient your pile of shit it. Example ------- Timing something and printing the total time as a formatted string: :: with SimpleTimer("Test Timer") as timer: ... print(timer) .. py:attribute:: start :value: 0 .. py:attribute:: time :value: 0 .. py:attribute:: name :value: None .. py:attribute:: log :value: False .. py:method:: __enter__() .. py:method:: __exit__(*args) .. py:method:: __str__()