Return a modifier from a signature
        Args:
            modifier_name (str): signature of the modifier
        Returns:
            Modifier
978728
def get_modifier_from_signature(self, modifier_signature):
        
        return next((m for m in self.modifiers if m.full_name == modifier_signature), None)
1128616
def _get_dim_modifier(self, modifiers, dimstring=None):
        
        if dimstring is None:
            suffix = modifiers.split("dimension")[1]
            start = modifiers.index("dimension") + len("dimension")
        else:
            suffix = dimstring
            start = 0
        
        #We use a stack to monitor how many parenthesis we have traversed in the string.
        #Once we reach the closing parenthesis, we know that we have the dimension info.
        stack = []
        args = []
        for i in range(len(suffix)):
            if suffix[i] == '(':
                stack.append(i + start)
            elif suffix[i] == ')':
                args.append((stack.pop(), i + start))
                if len(stack) == 0:
                    #The last entry in args should be the indices of the entire
                    #dimension expression once the very first '(' has its twin found.
                    return args[-1]
406709
def getMethName(meth):
    '''
    
    '''
    item = meth.__self__
    mname = item.__module__
    cname = item.__class__.__name__
    fname = meth.__func__.__name__
    return '.'.join((mname, cname, fname))
244767
function (modifierName, params) {
                // IMPORTANT: neither this method, nor any modifier, should assume
                // that `this === aria.templates.Modifiers` holds,
                // as they're copied in aria.core.Template (so 'this' is most of the time
                // an object extending aria.core.Template)
                modifierName = "" + modifierName;
                var modifier = __modifiers[modifierName.toLowerCase()];
                if (modifier) {
                    // call the modifier with this, so that this.$log is available
                    return modifier.fn.apply(this, params);
                } else {
                    this.$logError(aria.templates.Modifiers.UNKNOWN_MODIFIER, [modifierName]);
                }
            }
293781
def _get_filter_modifier(self, field):
        """"""
        tokens = field.split(FIELD_SEPARATOR)
        if len(tokens) == 1:
            return field, ""
        if tokens[-1] in self.FILTER_OPERATORS.keys():
            return u'.'.join(tokens[:-1]), tokens[-1]
        return u'.'.join(tokens), ""
173725
def get_signature(token, contextable=False, comparison=False):
    
    bits = split(token.contents)
    args, kwargs = (), {}
    if comparison and bits[-1] == 'negate':
        kwargs['negate'] = True
        bits = bits[:-1]
    if contextable and len(bits) > 2 and bits[-2] == 'as':
        kwargs['varname'] = bits[-1]
        bits = bits[:-2]
    kwarg_re = re.compile(r'^([-\w]+)\=(.*)$')
    for bit in bits[1:]:
        match = kwarg_re.match(bit)
        if match:
            kwargs[str(match.group(1))] = force_unicode(match.group(2))
        else:
            args += (bit,)
    return bits[0], args, kwargs
23370
public function isTrustedModifier($modifier_name, $compiler)
    {
        // check for internal always allowed modifier
        if (in_array($modifier_name, array('default'))) {
            return true;
        }
        // check security settings
        if (empty($this->allowed_modifiers)) {
            if (empty($this->disabled_modifiers) || !in_array($modifier_name, $this->disabled_modifiers)) {
                return true;
            } else {
                $compiler->trigger_template_error("modifier '{$modifier_name}' disabled by security setting", null, true);
            }
        } elseif (in_array($modifier_name, $this->allowed_modifiers) &&
            !in_array($modifier_name, $this->disabled_modifiers)
        ) {
            return true;
        } else {
            $compiler->trigger_template_error("modifier '{$modifier_name}' not allowed by security setting", null, true);
        }

        return false; // should not, but who knows what happens to the compiler in the future?
    }
513425
def call_signature(request_method)
      desc = rpc_desc(request_method)
      desc&.name ? desc.name.to_s.underscore.to_sym : nil
    end
818461
def get_optimizer_impstr(optimizer_name):
    
    possibilities = {"bfgs":"BFGS",
                     "bfgslinesearch":"BFGSLineSearch",
                     "fire":"FIRE",
                     "goodoldquasinewton":"GoodOldQuasiNewton",
                     "hesslbfgs":"HessLBFGS",
                     "lbfgs":"LBFGS",
                     "lbfgslinesearch":"LBFGSLineSearch",
                     "linelbfgs":"LineLBFGS",
                     "mdmin":"MDMin",
                     "ndpoly":"NDPoly",
                     "quasinewton":"QuasiNewton",
                     "scipyfmin":"SciPyFmin",
                     "scipyfminbfgs":"SciPyFminBFGS",
                     "scipyfmincg":"SciPyFminCG",
                     "scipyfminpowell":"SciPyFminPowell",
                     "scipygradientlessoptimizer":"SciPyGradientlessOptimizer",
                     }
    
    current_val = possibilities.get(optimizer_name.lower())
    
    if current_val:
        return "from ase.optimize import {} as custom_optimizer".format(current_val)
    else:
        package,current_val = optimizer_name.rsplit('.',1)
        return "from ase.optimize.{} import {} as custom_optimizer".format(package,current_val)
104521
def get_callproc_signature(self, name, param_types):
    
    if isinstance(param_types[0], (list, tuple)):
      params = [self.sql_writer.to_placeholder(*pt) for pt in param_types]
    else:
      params = [self.sql_writer.to_placeholder(None, pt) for pt in param_types]

    return name + self.sql_writer.to_tuple(params)
868213
def fn_signature(callable, 
                 argument_transform=(lambda name: name),
                 default_transform=(lambda name, value: "%s=%s" % 
                                                        (name, repr(value))),
                 vararg_transform=(lambda name: "*" + name),
                 kwargs_transform=(lambda name: "**" + name)):
    """"""
    signature = []
    fn = get_fn(callable)
    avail_ac = fn_available_argcount(fn)
    kwargs = fn_kwargs(fn)
    argnames = fn_argnames(fn)
    for name in stop_at(argnames, avail_ac):
        if name in kwargs:
            signature.append(default_transform(name, kwargs[name]))
        else:
            signature.append(argument_transform(name))
    if fn_has_args(fn):
        if fn_has_kwargs(fn):
            signature.append(vararg_transform(argnames[-2]))
            signature.append(kwargs_transform(argnames[-1]))
        else:
            signature.append(vararg_transform(argnames[-1]))
    elif fn_has_kwargs(fn):
        signature.append(kwargs_transform(argnames[-1]))

    return signature
1255760
function getModifiersForDay(day) {
  var modifiersObj = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

  return Object.keys(modifiersObj).reduce(function (modifiers, modifierName) {
    var value = modifiersObj[modifierName];
    if (dayMatchesModifier(day, value)) {
      modifiers.push(modifierName);
    }
    return modifiers;
  }, []);
}
381941
def signature(self):
        ''' 
        '''
        return self.name, [str(x.type) for x in self.elems]
446769
def identifierify(name):
    
    name = name.lower()
    name = re.sub('[^a-z0-9]', '_', name)
    return name
459666
def get_function_signature(self, node):
        """"""
        name = self.extract_text(self.get_specific_subnodes(node, 'name'))
        if self.with_type_info:
            argsstring = self.extract_text(self.get_specific_subnodes(node, 'argsstring'))
        else:
            argsstring = []
            param_id = 1
            for n_param in self.get_specific_subnodes(node, 'param'):
                declname = self.extract_text(self.get_specific_subnodes(n_param, 'declname'))
                if not declname:
                    declname = 'arg' + str(param_id)
                defval = self.extract_text(self.get_specific_subnodes(n_param, 'defval'))
                if defval:
                    defval = '=' + defval
                argsstring.append(declname + defval)
                param_id = param_id + 1
            argsstring = '(' + ', '.join(argsstring) + ')'
        type = self.extract_text(self.get_specific_subnodes(node, 'type'))
        function_definition = name + argsstring
        if type != '' and type != 'void':
            function_definition = function_definition + ' -> ' + type
        return '`' + function_definition + '`  '
349223
def repr_part(self):
        """"""
        optargs = [('norm', self.norm, ''),
                   ('exponent', self.exponent, 2.0)]
        return signature_string([], optargs, mod=[[], ['!r', ':.4']])
472055
def __get_activator_method(self, method_name):
        
        # Get the activator
        activator = getattr(self.__module, ACTIVATOR, None)
        if activator is None:
            # Get the old activator
            activator = getattr(self.__module, ACTIVATOR_LEGACY, None)
            if activator is not None:
                # Old activator found: print a deprecation warning
                _logger.warning(
                    "Bundle %s uses the deprecated '%s' to declare"
                    " its activator. Use @BundleActivator instead.",
                    self.__name,
                    ACTIVATOR_LEGACY,
                )
        return getattr(activator, method_name, None)