def call_signature(self, comp):
        """Construct the function's call signature.

        comp.docstring() is not reliable and we don't need the entire
        docstring.

        Returns a tuple of (full, abbr) call signatures.
        """
        params = []
        params_abbr = []
        try:
            # Total length includes parenthesis
            length = len(comp.name)
            for i, p in enumerate(comp.params):
                desc = p.description.strip()
                if i == 0 and desc == 'self':
                    continue

                if '\\n' in desc:
                    desc = desc.replace('\\n', '\\x0A')

                length += len(desc) + 2
                params.append(desc)

            params_abbr = params[:]
            if self.desc_len > 0:
                if length > self.desc_len:
                    # First remove all keyword params to see if that makes it
                    # short enough.
                    params_abbr = [x.split('=', 1)[0] for x in params_abbr]
                    length = len(comp.name) + sum([len(x) + 2
                                                   for x in params_abbr])

                while length + 3 > self.desc_len \
                        and len(params_abbr):
                    # Keep removing params until short enough.
                    length -= len(params_abbr[-1]) - 3
                    params_abbr = params_abbr[:-1]
                if len(params) > len(params_abbr):
                    params_abbr.append('...')
        except AttributeError:
            pass

        return ('{}({})'.format(comp.name, ', '.join(params)),
                '{}({})'.format(comp.name, ', '.join(params_abbr)))
dataset/ETHPy150Open zchee/deoplete-jedi/rplugin/python3/deoplete/sources/deoplete_jedi/server.py/Server.call_signature/original