def specification(self, of, defaults=True, via=None):
        """Build our internal specification of the target callable.

        Optionally, pre-populate the callbacks for --help/-h and --version/-V.
        """

        cmd = Bunch(target=of)
        cmd.doc = partitionhelp(getdoc(cmd.target)) if getdoc(cmd.target) else None
        cmd.cls = isclass(cmd.target)
        cmd.fn = isfunction(cmd.target)
        cmd.method = ismethod(cmd.target)
        cmd.callable = cmd.target.__init__ if cmd.cls else cmd.target
        
        try:
            cmd.spec = getargspec(cmd.callable)
        except __HOLE__:
            # __init__ of built-in class, such as object
            cmd.spec = Bunch(args=['self'], varargs=None, keywords=None, defaults=None)
        
        cmd.trans = dict((i.replace('_', '-'), i) for i in cmd.spec.args)
        cmd.positional = cmd.spec.args[:len(cmd.spec.args)-len(cmd.spec.defaults or [])]
        cmd.named = cmd.spec.args[len(cmd.spec.args)-len(cmd.spec.defaults or []):]
        cmd.defaults = dict((i, j) for i, j in zip(reversed(cmd.spec.args), reversed(cmd.spec.defaults or [])))
        cmd.instance = None
        cmd.indexed = cmd.spec.varargs
        cmd.keyed = cmd.spec.keywords
        cmd.docs = dict()
        cmd.parent = via

        if cmd.cls or cmd.method:
            cmd.positional = cmd.positional[1:]

        cmd.range = (len(cmd.positional), 65535 if cmd.spec.varargs else len(cmd.positional))

        cast = dict()
        short = dict()
        callbacks = dict()

        if defaults:
            cmd.named.extend(('help', 'version'))
            callbacks.update(help=self.help, version=self.version)
            short.update(h='help', V='version')
            cast.update(help=boolean, version=boolean)

        for name in sorted(cmd.defaults):
            # Determine typecasting information.
            if isinstance(cmd.defaults[name], bool): cast[name] = boolean
            elif isinstance(cmd.defaults[name], (list, tuple)): cast[name] = array
            elif cmd.defaults[name] is not None: cast[name] = type(cmd.defaults[name])

            # Determine abbreviations.
            for char in "".join(i for j in zip(name, name.upper()) for i in j):
                if char in short: continue
                short[char] = name
                break

        cmd.cast = cast
        cmd.short = short
        cmd.callbacks = callbacks

        return cmd
dataset/ETHPy150Open marrow/script/marrow/script/core.py/Parser.specification