Create a signature for this method, only in Python > 3.4
513959
def signature(self):
        """"""
        if not use_signature:
            raise NotImplementedError("Python 3 only.")

        if self.static:
            parameters = \
                (Parameter(name='cls',
                           kind=Parameter.POSITIONAL_ONLY),)

        else:
            parameters = \
                (Parameter(name='self',
                           kind=Parameter.POSITIONAL_ONLY),)

        if self.input_transform:
            return signature(self.input_transform)

        if self.uses_request:
            fields = get_fields(self.request_type)
            if not self.static:
                if self.field_name not in fields:
                    raise NameError("field '{}' not found in {}".format(
                        self.field_name, self.request_name))
                fields.remove(self.field_name)
            parameters += tuple(
                Parameter(name=name, kind=Parameter.POSITIONAL_OR_KEYWORD,
                          default=None)
                for name in fields)

        return Signature(parameters)
310325
def generate_signature_class(cls):
    
    return type("%sSigs" % cls.__name__, (Base,),
                {'__tablename__': "%s_sigs" % cls.__tablename__,
                 'id': sa.Column(sa.Integer,
                                 sa.Sequence('%s_id_seq' % cls.__tablename__),
                                 primary_key=True,
                                 doc="primary key"),
                 'data': sa.Column(sa.Text(), nullable=False,
                                   doc="The signed data"),
                 '%s_id' % cls.__tablename__: sa.Column(sa.Integer,
                                                        sa.ForeignKey("%s.id" % cls.__tablename__),
                                                        nullable=False)})
376042
def _format_method_nodes(self, task_method, modulename, classname):
        
        methodname = task_method.__name__
        fullname = '.'.join((modulename, classname, methodname))

        # The signature term
        signature = Signature(task_method, bound_method=True)
        desc_sig_node = self._format_signature(
            signature, modulename, classname, fullname, 'py:meth')

        # The content is the one-sentence summary.
        content_node = desc_content()
        content_node += self._create_doc_summary(task_method, fullname,
                                                 'py:meth')

        desc_node = desc()
        desc_node['noindex'] = True
        desc_node['domain'] = 'py'
        desc_node['objtype'] = 'method'
        desc_node += desc_sig_node
        desc_node += content_node
        return desc_node
40831
def _get_signature_method(self, request):
        """"""
        signature_method = request.get('oauth_signature_method')
        if signature_method is None:
            signature_method = SIGNATURE_METHOD

        try:
            # Get the signature method object.
            return self.signature_methods[signature_method]
        except KeyError:
            signature_method_names = ', '.join(self.signature_methods.keys())
            raise Error('Signature method %s not supported try one of the '
                        'following: %s'
                            % (signature_method, signature_method_names))
260701
def signature(self, name, file_name, file_type, file_content, owner=None, **kwargs):
        
        return Signature(self.tcex, name, file_name, file_type, file_content, owner=owner, **kwargs)
513425
def call_signature(request_method)
      desc = rpc_desc(request_method)
      desc&.name ? desc.name.to_s.underscore.to_sym : nil
    end
637894
function parseSignature (sig) {
  var tmp = /^(\w+)\((.*)\)$/.exec(sig)

  if (tmp.length !== 3) {
    throw new Error('Invalid method signature')
  }

  var args = /^(.+)\):\((.+)$/.exec(tmp[2])

  if (args !== null && args.length === 3) {
    return {
      method: tmp[1],
      args: args[1].split(','),
      retargs: args[2].split(',')
    }
  } else {
    var params = tmp[2].split(',')
    if (params.length === 1 && params[0] === '') {
      // Special-case (possibly naive) fixup for functions that take no arguments.
      // TODO: special cases are always bad, but this makes the function return
      // match what the calling functions expect
      params = []
    }
    return {
      method: tmp[1],
      args: params
    }
  }
}
1250562
def repr_part(self):
        """"""
        # Lazy import to improve `import odl` time
        import scipy.sparse

        if scipy.sparse.isspmatrix(self.matrix):
            optargs = [('matrix', str(self.matrix), '')]
        else:
            optargs = [('matrix', array_str(self.matrix, nprint=10), '')]

        optargs.append(('exponent', self.exponent, 2.0))
        return signature_string([], optargs, mod=[[], ['!s', ':.4']])
107192
private String createMethodSignature(Method method)
   {
      StringBuilder sb = new StringBuilder();
      sb.append("(");
      for (Class<?> type : method.getParameterTypes())
      {
         sb.append(getTypeString(type));
      }
      sb.append(")");
      Class<?> type = method.getReturnType();
      if (type.getName().equals("void"))
      {
         sb.append("V");
      }
      else
      {
         sb.append(getTypeString(type));
      }
      return sb.toString();
   }
10271
def create_signature(secret, value, digestmod='sha256', encoding='utf-8'):
    
    if isinstance(secret, str):
        secret = secret.encode(encoding)

    if isinstance(value, str):
        value = value.encode(encoding)

    if isinstance(digestmod, str):
        digestmod = getattr(hashlib, digestmod, hashlib.sha1)

    hm = hmac.new(secret, digestmod=digestmod)
    hm.update(value)
    return hm.hexdigest()
1280425
private static String buildLepSignature(LepMethod method) {

        String className = Optional.ofNullable(method)
                                   .map(LepMethod::getMethodSignature)
                                   .map(MethodSignature::getDeclaringClass)
                                   .map(Class::getSimpleName).orElse(LOG_QUESTION);

        String methodName = Optional.ofNullable(method)
                                    .map(LepMethod::getMethodSignature)
                                    .map(MethodSignature::getName).orElse(LOG_QUESTION);

        return className + LOG_SEMICOLON + methodName;
    }
369321
def _make_signature(self):
        
        # Create KEYWORD_ONLY arguments with the names of the minimizers.
        name = lambda x: x.__class__.__name__
        count = Counter(
            [name(minimizer) for minimizer in self.minimizers]
        ) # Count the number of each minimizer, they don't have to be unique

        # Note that these are inspect_sig.Parameter's, not symfit parameters!
        parameters = []
        for minimizer in reversed(self.minimizers):
            if count[name(minimizer)] == 1:
                # No ambiguity, so use the name directly.
                param_name = name(minimizer)
            else:
                # Ambiguity, so append the number of remaining minimizers
                param_name = '{}_{}'.format(name(minimizer), count[name(minimizer)])
            count[name(minimizer)] -= 1

            parameters.append(
                inspect_sig.Parameter(
                    param_name,
                    kind=inspect_sig.Parameter.KEYWORD_ONLY,
                    default={}
                )
            )
        return inspect_sig.Signature(parameters=reversed(parameters))
41567
function() {
    if (arguments.length === 1) {
      var signatures = arguments[0];
      if (lib.type.isObject(signatures)) {
        var keys = Object.keys(signatures).sort();
        var length = keys.length;
        for (var i = length; i > 0; i--) {
          this.addSignature(keys[i-1],signatures[keys[i-1]]);
        }
      } else if (lib.type.isFunction(signatures)) {
        this.addSignature("_",signatures);
      }
    } else if (arguments.length === 2) {
      var signature = arguments[0];
      var func = arguments[1];
      if (signature === "_") {
        this.tree._ = this.addFunction(func);
      } else if (regExp.number.test(signature)) {
        (this.tree[signature] || (this.tree[signature] = {}))._ = this.addFunction(func);
      } else if (regExp.letter.test(signature)) {
        var length = signature.length;
        var tree = this.tree[length] || (this.tree[length] = {});
        for (var i = 0; i < length; i++) {
          tree = tree[signature[i]] || (tree[signature[i]] = {});
        }
        tree._ = this.addFunction(func,parseArgs(signature));
      }
    }
  }
925446
private void genMethodTypeSignature(ExecutableElement method, StringBuilder sb) {
    genOptFormalTypeParameters(method.getTypeParameters(), sb);
    sb.append('(');
    for (VariableElement param : method.getParameters()) {
      genTypeSignature(param.asType(), sb);
    }
    sb.append(')');
    genTypeSignature(method.getReturnType(), sb);
    List<? extends TypeMirror> thrownTypes = method.getThrownTypes();
    if (hasGenericSignature(thrownTypes)) {
      for (TypeMirror thrownType : thrownTypes) {
        sb.append('^');
        genTypeSignature(thrownType, sb);
      }
    }
  }
1234513
def sign(self, method, params):
        
        query_str = utils.percent_encode(params.items(), True)

        str_to_sign = "{0}&%2F&{1}".format(
            method, utils.percent_quote(query_str)
        )

        sig = hmac.new(
            utils.to_bytes(self._secret_key + "&"),
            utils.to_bytes(str_to_sign),
            hashlib.sha1
        )
        return base64.b64encode(sig.digest())
783260
def kwargs_only(func):
    
    if hasattr(inspect, 'signature'):  # pragma: no cover
        # Python 3
        signature = inspect.signature(func)
        first_arg_name = list(signature.parameters.keys())[0]
    else:  # pragma: no cover
        # Python 2
        signature = inspect.getargspec(func)
        first_arg_name = signature.args[0]

    if first_arg_name in ('self', 'cls'):
        allowable_args = 1
    else:
        allowable_args = 0

    @wraps(func)
    def wrapper(*args, **kwargs):
        if len(args) > allowable_args:
            raise TypeError("{} should only be called with keyword args".format(func.__name__))
        return func(*args, **kwargs)

    return wrapper
318341
def build_payload(cls, method, args):
        
        ref = str(uuid.uuid4())
        return (method, args, ref)