(self, parameters=None, *, return_annotation=_empty,
                 __validate_parameters__=True)
Constructs Signature from the given list of Parameter
        objects and 'return_annotation'.  All arguments are optional.
Constructs Signature from the given list of Parameter
        objects and 'return_annotation'.  All arguments are optional.
Constructs Signature from the given list of Parameter objects and return_annotation . All arguments are optional .
def __init__(self, parameters=None, *, return_annotation=_empty,
                 __validate_parameters__=True):
        """Constructs Signature from the given list of Parameter
        objects and 'return_annotation'.  All arguments are optional.
        """

        if parameters is None:
            params = OrderedDict()
        else:
            if __validate_parameters__:
                params = OrderedDict()
                top_kind = _POSITIONAL_ONLY
                kind_defaults = False

                for param in parameters:
                    kind = param.kind
                    name = param.name

                    if kind < top_kind:
                        msg = (
                            'wrong parameter order: {} parameter before {} '
                            'parameter'
                        )
                        msg = msg.format(top_kind.description,
                                         kind.description)
                        raise ValueError(msg)
                    elif kind > top_kind:
                        kind_defaults = False
                        top_kind = kind

                    if kind in (_POSITIONAL_ONLY, _POSITIONAL_OR_KEYWORD):
                        if param.default is _empty:
                            if kind_defaults:
                                # No default for this parameter, but the
                                # previous parameter of the same kind had
                                # a default
                                msg = 'non-default argument follows default ' \
                                      'argument'
                                raise ValueError(msg)
                        else:
                            # There is a default for this parameter.
                            kind_defaults = True

                    if name in params:
                        msg = 'duplicate parameter name: {!r}'.format(name)
                        raise ValueError(msg)

                    params[name] = param
            else:
                params = OrderedDict((param.name, param) for param in parameters)

        self._parameters = types.MappingProxyType(params)
        self._return_annotation = return_annotation
def __init__ ( self , parameters = None , * , return_annotation = _empty , __validate_parameters__ = True ) : if parameters is None : params = OrderedDict ( ) else : if __validate_parameters__ : params = OrderedDict ( ) top_kind = _POSITIONAL_ONLY kind_defaults = False for param in parameters : kind = param . kind name = param . name if kind < top_kind : msg = ( 'wrong parameter order: {} parameter before {} ' 'parameter' ) msg = msg . format ( top_kind . description , kind . description ) raise ValueError ( msg ) elif kind > top_kind : kind_defaults = False top_kind = kind if kind in ( _POSITIONAL_ONLY , _POSITIONAL_OR_KEYWORD ) : if param . default is _empty : if kind_defaults : # No default for this parameter, but the # previous parameter of the same kind had # a default msg = 'non-default argument follows default ' 'argument' raise ValueError ( msg ) else : # There is a default for this parameter. kind_defaults = True if name in params : msg = 'duplicate parameter name: {!r}' . format ( name ) raise ValueError ( msg ) params [ name ] = param else : params = OrderedDict ( ( param . name , param ) for param in parameters ) self . _parameters = types . MappingProxyType ( params ) self . _return_annotation = return_annotation