Source code for core.utils.status

# core/plugs/status.py
#
#

""" show version. """

__copyright__ = "Copyright 2015, B.H.J Thate"

## IMPORTS

from core.utils.time import elapsed_days

import time

## HELPERS

[docs]def loops(obj): try: print(obj._nrs.loops) ; return obj._nrs.loops except: return ""
[docs]def until(obj): try: return elapsed_days(int(obj.sleep) - int(time.time() - obj._last)) except: return ""
[docs]def upt(obj): try: return elapsed_days(int(time.time()) - int(obj._start)) except: return ""
[docs]def waiting(obj): if sleeptime(obj): return "%s/%s" % (until(obj), sleeptime(obj)) else: return ""
[docs]def idle(obj): try: return elapsed_days(int(obj._last - obj._start)) except: return ""
[docs]def since(obj): try: return elapsed_days(int(time.time()) - int(obj._last)) except: return ""
[docs]def status(obj): try: return obj._status except: return ""
[docs]def name(obj): try: return obj._name except: return ""
[docs]def running(obj): try: return obj._running except: return ""
[docs]def sleeptime(obj): try: return elapsed_days(obj.sleep) except: return ""
[docs]def plugname(obj): try: return obj.plugname except: return ""