Add object attribute based on method name.
482710
def set_corrected_pval(self, nt_method, pvalue):
        """"""
        self.method_flds.append(nt_method)
        fieldname = "".join(["p_", nt_method.fieldname])
        setattr(self, fieldname, pvalue)
881619
def _maybe_wrap(attribute):
    """"""
    if iscoroutinefunction(attribute):
        return asynchronous(attribute)
    if isinstance(attribute, (classmethod, staticmethod)):
        if iscoroutinefunction(attribute.__func__):
            return attribute.__class__(asynchronous(attribute.__func__))
    return attribute
409013
def _set_attribute(self, name, value):
        """"""
        setattr(self, name, value)
        self.namespace.update({name: getattr(self, name)})
152045
def _load_attributes(new_class):
        """"""
        for field_name, field_obj in new_class.meta_.declared_fields.items():
            new_class.meta_.attributes[field_obj.get_attribute_name()] = field_obj
635191
def _add_attribute(self, name, value, allowed_values=None):
        """"""
        if value and value != 'none':

            if isinstance(value, (int, bool)):
                value = str(value)

            if allowed_values and value not in allowed_values:
                raise TypeError(
                    "Attribute '" + name + "' must be one of " + str(
                        allowed_values) + " but is '" + str(value) + "'")

            self.element_attrs[name] = value
1023926
def _onInstanceAttribute(self, name, line, pos, absPosition, level):
        """"""
        # Instance attributes may appear in member functions only so we already
        # have a function on the stack of objects. To get the class object one
        # more step is required so we -1 here.
        attributes = self.objectsStack[level - 1].instanceAttributes
        for item in attributes:
            if item.name == name:
                return
        attributes.append(InstanceAttribute(name, line, pos, absPosition))
1290526
def addObject(self, object, name=None):
    
    if name is None:
      name = len(self.objects)

    self.objects[name] = object
1127475
def method(func):
    """"""
    attr = abc.abstractmethod(func)
    attr.__imethod__ = True
    return attr
930053
public static void addAttribute(String name, String oid, Class<?> clazz)
            throws CertificateException {
        ObjectIdentifier objId;
        try {
            objId = new ObjectIdentifier(oid);
        } catch (IOException ioe) {
            throw new CertificateException
                                ("Invalid Object identifier: " + oid);
        }
        OIDInfo info = new OIDInfo(name, objId, clazz);
        if (oidMap.put(objId, info) != null) {
            throw new CertificateException
                                ("Object identifier already exists: " + oid);
        }
        if (nameMap.put(name, info) != null) {
            throw new CertificateException("Name already exists: " + name);
        }
    }
1302028
def method_already_there(object_type, method_name, this_class_only=False):
    
    if this_class_only:
        return method_name in vars(object_type)  # or object_type.__dict__
    else:
        try:
            method = getattr(object_type, method_name)
        except AttributeError:
            return False
        else:
            return method is not None and method is not getattr(object, method_name, None)
487229
def add(self, directory, path=None) -> None:
        """"""
        objecttools.valid_variable_identifier(directory)
        if path is None:
            path = directory
        setattr(self, directory, path)
269480
def add_method_model(self,
                         func,  # type: Callable
                         name=None,  # type: Optional[str]
                         description=None,  # type: Optional[str]
                         owner=None,  # type: object
                         ):
        # type: (...) -> MethodModel
        """"""
        if name is None:
            name = func.__name__
        method = MethodModel.from_callable(func, description)
        self._add_field(owner, name, method, func)
        return method
508374
def _new_name(method, old_name):
    """"""
    # Looks suspiciously like a decorator, but isn't!

    @wraps(method)
    def _method(*args, **kwargs):
        warnings.warn(
            "method '{}' has been deprecated, please rename to '{}'".format(
                old_name, method.__name__
            ),
            DeprecationWarning,
        )
        return method(*args, **kwargs)

    deprecated_msg = """
        Note:
            .. deprecated:: 2.2.0
                Please use `~{}`
""".format(
        method.__name__
    )
    if getattr(_method, "__doc__"):
        _method.__doc__ += deprecated_msg

    return _method
1122395
def add_properties(self, names, methods):
        
        cls = type(self)
        cls = type(cls.__name__, (cls,), dict(cls.__dict__))
        if isinstance(names, string_types):
            names = [names]
            methods = [methods]
        for name,method in zip(names, methods):
            setattr(cls, name, property(method))
        return self.view(type=cls)
278325
function addMethod(name, method) {
        if (method !== undefined) {
            methods[name] = method;
        }
        return methods[name];
    }
589930
def delegate(attribute_name, method_names):
    """"""
    # hack for python 2.7 as nonlocal is not available
    info = {
        'attribute': attribute_name,
        'methods': method_names
    }

    def decorator(cls):
        """Decorate class."""
        attribute = info['attribute']
        if attribute.startswith("__"):
            attribute = "_" + cls.__name__ + attribute
        for name in info['methods']:
            setattr(cls, name, eval("lambda self, *a, **kw: "
                                    "self.{0}.{1}(*a, **kw)".format(attribute, name)))
        return cls
    return decorator
1085844
public void setAttribute(String name, Object o) {
		if(logger.isDebugEnabled()) {
        	logger.debug("setAttribute - name=" + name + ", object=" + o);
        }
		if (name == null)
			throw new NullPointerException("Attribute name can not be null.");
		this.getAttributeMap().put(name, o);
	}