def make_static_request(method, *args, **kwargs):
    """Creates a request from a static method function call."""
    if args and not use_signature:
        raise NotImplementedError("Only keyword arguments allowed in Python2")

    if use_signature:
        new_kwargs = {kw: unwrap(value) for kw, value in kwargs.items()}
        new_args = tuple(unwrap(value) for value in args)
        bound_args = method.signature.bind(
            None, *new_args, **new_kwargs).arguments

        # if we encounter any Enum arguments, replace them with their value
        for k in bound_args:
            if isinstance(bound_args[k], Enum):
                bound_args[k] = bound_args[k].value

        new_kwargs = {kw: v for kw, v in bound_args.items() if kw != 'cls'}

    else:
        new_kwargs = {kw: unwrap(value) for kw, value in kwargs.items()}

    return method.request_type(**new_kwargs)
def make_static_request ( method , * args , ** kwargs ) : if args and not use_signature : raise NotImplementedError ( "Only keyword arguments allowed in Python2" ) if use_signature : new_kwargs = { kw : unwrap ( value ) for kw , value in kwargs . items ( ) } new_args = tuple ( unwrap ( value ) for value in args ) bound_args = method . signature . bind ( None , * new_args , ** new_kwargs ) . arguments for k in bound_args : if isinstance ( bound_args [ k ] , Enum ) : bound_args [ k ] = bound_args [ k ] . value new_kwargs = { kw : v for kw , v in bound_args . items ( ) if kw != 'cls' } else : new_kwargs = { kw : unwrap ( value ) for kw , value in kwargs . items ( ) } return method . request_type ( ** new_kwargs )
Creates a request from a static method function call.