def __add_command(cls, key):
path = (cls.__module__, cls.__name__, cls.frontend.__class__.__name__)
t = cls.__type(cls.cache[key])
if t == types.FunctionType:
scr = functools.partial("command script add -f {:s}.{:s} {:s}".format, '.'.join(path), key)
elif t == types.ObjectType and key in cls.__synchronicity__:
scr = functools.partial("command script add -c {:s}.{:s} -s {:s} {:s}".format, '.'.join(path), key, cls.__synchronicity__[key])
elif t == types.ObjectType and key not in cls.__synchronicity__:
scr = functools.partial("command script add -c {:s}.{:s} {:s}".format, '.'.join(path), key)
else:
raise TypeError('{:s}.{:s} : Unable to generate command with unknown type. {!r}'.format(cls.__module__, cls.__name__, t))
return scr
评论列表
文章目录