decide whether an action has to be performed on the attribute or not, based on its name
480245
def is_attr_selected(attr_name,     # type: str
                     include=None,  # type: Union[str, Tuple[str]]
                     exclude=None   # type: Union[str, Tuple[str]]
                     ):
    """"""

    if include is not None and exclude is not None:
        raise ValueError('Only one of \'include\' or \'exclude\' argument should be provided.')

    # win time by not doing this
    # check_var(include, var_name='include', var_types=[str, tuple], enforce_not_none=False)
    # check_var(exclude, var_name='exclude', var_types=[str, tuple], enforce_not_none=False)

    if attr_name is 'self':
        return False
    if exclude and attr_name in exclude:
        return False
    if not include or attr_name in include:
        return True
    else:
        return False
446824
function(attrs, options) {
      if (options.silent || !this.validate) {
        return true;
      }
      attrs = _.extend({}, this.attributes, attrs);
      var error = this.validate(attrs, options);
      if (!error) {
        return true;
      }
      if (options && options.error) {
        options.error(this, error, options);
      } else {
        this.trigger('error', this, error, options);
      }
      return false;
    }
427208
function _objectByAttribute(obj, attr, map, action) {
    var subAttrs = attr.split(".");
    var attrValue = obj;
    for (var i = 0; i < subAttrs.length; i++) {
      attrValue = attrValue[subAttrs[i]];
      if (attrValue === undefined) {
        return;
      }
    }

    if ($.isArray(attrValue)) {
      // TODO implement this when we actually need it
    }
    else if ($.isPlainObject(attrValue)) {
      for (var key in attrValue) {
        var val = attrValue[key];
        if (!map[key]) {
          map[key] = {};
        }
        if (action === "DELETED") {
          delete map[key][val];
        }
        else {
          map[key][val] = obj;
        }
      }
    }
    else {
      if (action === "DELETED") {
        delete map[attrValue];
      }
      else {
        map[attrValue] = obj;
      }
    }
  }
45766
def _check_action(action):
    """"""
    if isinstance(action, types.StringTypes):
        action = action.lower()

    if action not in ['learn', 'forget', 'report', 'revoke']:
        raise SpamCError('The action option is invalid')
    return action
1342482
function Attribute(name, actionDict, builtInDefault) {
  this.name = name;
  this.formals = [];
  this.actionDict = actionDict;
  this.builtInDefault = builtInDefault;
}
469719
def _has_actions(self, event):
        """"""
        event_actions = self._aconfig.get(event)
        return event_actions is None or bool(event_actions)
1323741
def do_attr_any(self, element, decl, pseudo):
        """"""
        step = self.state[self.state['current_step']]
        actions = step['actions']
        strval = self.eval_string_value(element, decl.value)
        actions.append(('attrib', (decl.name[5:], strval)))
306932
public void required(final String tagName, final String actionName, final String attributeName, final Object attribute) throws PageException {
	if (attribute == null) {
	    final Excepton util = CFMLEngineFactory.getInstance().getExceptionUtil();
	    throw util.createApplicationException("Attribute [" + attributeName + "] for tag [" + tagName + "] is required if attribute action has the value [" + actionName + "]");
	}
    }
613290
protected void checkAttribute(String attribute) {
        if (!hasAttribute(attribute)) {
            String sb = "Attribute: '" + attribute + "' is not defined in model: '" + getModelClass() + ". "
                    + "Available attributes: " +getAttributeNames();
            throw new IllegalArgumentException(sb);
        }
    }
1077873
function(action, settings){
            var handler = this.performableActions[action];
            if(!handler){
                return false;
            }

            if(!handler.getTargetsForAction){
                return false;
            }

            settings = settings || {};
            if(!settings.skipCanPerformAction && !this.canPerformAction(action, settings)){
                return false;
            }

            return handler.getTargetsForAction.call(this, settings);
        }
135549
async def trigger(self, action, args):
        
        handler_name = f"on_{action}"
        handler = getattr(self, handler_name, None)
        if not handler:
            return None
        await handler(*args)
1146133
def _required_attribute(element, name, default):
    
    if element.get(name) is None:
        element.set(name, default)
511176
def set_action_name(self, name):
        
        if self._open and name is not None:
            self._open[-1].name = name
            self.notify()
984192
def _action_enabled(self, event, action):
        """"""
        event_actions = self._aconfig.get(event)
        if event_actions is None:
            return True
        if event_actions is False:
            return False
        return action in event_actions
1172428
def has_attribute(module_name, attribute_name):
    """"""
    init_file = '%s/__init__.py' % module_name
    return any(
        [attribute_name in init_line for init_line in open(init_file).readlines()]
    )
104782
def action_factory(name, parameter=False):
    
    if parameter:
        return partial(ParameterizedActionNeed, name)
    else:
        return ActionNeed(name)
573075
def is_attribute(method, name=None):
    
    if name is None:
        name = method.__name__
    method.is_attribute = True
    method.name = name
    return method