https://tiplanet.org/compare/?mode=QCC2023

def clean(s):
for ss in ("<", ">", "'", "class ", "module "):
s = s.replace(ss, "")
return s
def module_entry_type(entry_name, module_name):
return clean(str(eval("type({:s}.{:s})".format(module_name, entry_name))))
def maxf(l, f):
return max([f(s) for s in l])
def rightPad(s, n):
while len(s) < n:
s += ' '
return s
def explmod(module):
module_name = module.__name__
lnames = dir(module)
lnames.sort()
dcol1 = maxf(lnames, len)
dcol2 = maxf([module_entry_type(name, module_name) for name in lnames], len)
n = len(lnames)
for f in lnames:
val = eval("{:s}.{:s}".format(module_name, f))
ignore = False
if f[:2] == "__" and f[-2:] == "__" and isinstance(val, str):
n -= 1
ignore = True
stype = module_entry_type(f, module_name)
sval = clean(str(eval("{:s}.{:s}".format(module_name, f))))
print("{:s} {:s} {:s} {:s}".format(ignore and '-' or '+', rightPad(f, dcol1), rightPad(stype, dcol2), sval))
return n
Users browsing this forum: ClaudeBot [spider] and 29 guests