![]() Server : Apache/2.4.52 (Ubuntu) System : Linux webserver 6.8.0-49-generic #49~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Nov 6 17:42:15 UTC 2 x86_64 User : www-data ( 33) PHP Version : 8.1.2-1ubuntu2.21 Disable Function : NONE Directory : /lib/python3/dist-packages/landscape/lib/ |
import inspect def format_object(object): """ Returns a fully-qualified name for the specified object, such as 'landscape.lib.format.format_object()'. """ if inspect.ismethod(object): # FIXME If the method is implemented on a base class of # object's class, the module name and function name will be # from the base class and the method's class name will be from # object's class. name = repr(object).split(" ")[2] return "%s.%s()" % (object.__module__, name) elif inspect.isfunction(object): name = repr(object).split(" ")[1] return "%s.%s()" % (object.__module__, name) return "%s.%s" % (object.__class__.__module__, object.__class__.__name__) def format_delta(seconds): if not seconds: seconds = 0.0 return "%.02fs" % float(seconds) def format_percent(percent): if not percent: percent = 0.0 return "%.02f%%" % float(percent)