Represents value as a module attribute.

        Examples:
            attr: package.attr
            attr: package.module.attr

        :param str value:
        :rtype: str
494111
def _parse_attr(cls, value, package_dir=None):
        
        attr_directive = 'attr:'
        if not value.startswith(attr_directive):
            return value

        attrs_path = value.replace(attr_directive, '').strip().split('.')
        attr_name = attrs_path.pop()

        module_name = '.'.join(attrs_path)
        module_name = module_name or '__init__'

        parent_path = os.getcwd()
        if package_dir:
            if attrs_path[0] in package_dir:
                # A custom path was specified for the module we want to import
                custom_path = package_dir[attrs_path[0]]
                parts = custom_path.rsplit('/', 1)
                if len(parts) > 1:
                    parent_path = os.path.join(os.getcwd(), parts[0])
                    module_name = parts[1]
                else:
                    module_name = custom_path
            elif '' in package_dir:
                # A custom parent directory was specified for all root modules
                parent_path = os.path.join(os.getcwd(), package_dir[''])
        sys.path.insert(0, parent_path)
        try:
            module = import_module(module_name)
            value = getattr(module, attr_name)

        finally:
            sys.path = sys.path[1:]

        return value
378561
def import_from_string(value):
    """"""
    value = value.replace('-', '_')
    try:
        module_path, class_name = value.rsplit('.', 1)
        module = import_module(module_path)
        return getattr(module, class_name)
    except (ImportError, AttributeError) as ex:
        raise ImportError("Could not import '{}'. {}: {}.".format(
            value, ex.__class__.__name__, ex))
722038
def _setAttr(self, attr, value):
        
        meth = "_set_%s" % attr
        if not hasattr(self, meth):
            raise AttributeError("No setter for attribute '%s'." % attr)
        meth = getattr(self, meth)
        meth(value)
920636
def _set_attr(self, **kwargs):
        
        for key, value in kwargs.items():
            if not isinstance(value, string_types):
                raise ValueError("Set Attr only accepts string values")
            check_call(_LIB.MXSymbolSetAttr(
                self.handle, c_str(key), c_str(str(value))))
1316662
def pack(self, value=None):
        
        if value is None:
            output = self.header.pack()
            output += self.value.pack()
            return output

        elif isinstance(value, type(self)):
            return value.pack()
        else:
            msg = "{} is not an instance of {}".format(value,
                                                       type(self).__name__)
            raise PackException(msg)
35540
def modules(self, value):
        """"""

        modules = [module.__name__ for module in self.loadmodules(value)]

        self._modules = [
            module for module in self._modules + modules
            if module not in self._modules
        ]
1032565
def package(self, value):
        

        if value is not None:
            assert type(value) is unicode, "'{0}' attribute: '{1}' type is not 'unicode'!".format(
                "package", value)
        self.__package = value
1038686
def code(self, value):
        
        if value not in list(defines.Codes.LIST.keys()) and value is not None:
            raise AttributeError
        self._code = value
1053019
public BaseBo setAttribute(String attrName, Object value) {
        return setAttribute(attrName, value, true);
    }
609404
def values(self):
        
        if not hasattr(self, VALUES_ATTR_NAME):
            setattr(self, VALUES_ATTR_NAME, {})
        return getattr(self, VALUES_ATTR_NAME)
671030
def tag(self, value):
        
        if value is None:
            value = sys.argv[0]
        self._tag = value[:self.MAX_TAG_LEN]
1277013
def _set_attr(self, **kwargs):
        
        keys = c_str_array(kwargs.keys())
        vals = c_str_array([str(s) for s in kwargs.values()])
        num_args = mx_uint(len(kwargs))
        check_call(_LIB.MXSymbolSetAttrs(
            self.handle, num_args, keys, vals))
744326
def getValueFromValue(value):
    
    if type(value) != common.AttributeValue:
        raise TypeError(
            "Expected an AttributeValue, but got {}".format(type(value)))
    if value.WhichOneof("value") is None:
        raise AttributeError("Nothing set for {}".format(value))
    return getattr(value, value.WhichOneof("value"))
830618
def attrdump(value: Any, **kwargs) -> Any:
    
    from . import datadumper
    from .plugins import attrdump as dumpplugin
    dumper = datadumper.Dumper(**kwargs)
    dumpplugin.add2dumper(dumper)
    return dumper.dump(value)
243923
def rec_setattr(obj, attr, value):
    
    attrs = attr.split('.')
    setattr(reduce(getattr, attrs[:-1], obj), attrs[-1], value)
1051423
def set_attr(self, name, value):
    
    self.exec_script("node.setAttribute(%s, %s)" % (repr(name), repr(value)))
177425
def set_attr_value(self, key, attr, value):
        
        idx = self._keys[key]
        self._attrs[attr][idx].set(value)