Returns the attributes of ncdf variable
345513
def ncVarAttributes(ncVar):
    
    try:
        return ncVar.__dict__
    except Exception as ex:
        # Due to some internal error netCDF4 may raise an AttributeError or KeyError,
        # depending on its version.
        logger.warn("Unable to read the attributes from {}. Reason: {}"
                    .format(ncVar.name, ex))
        return {}
1325702
def attributes(self, source=None, relation=None, target=None):
        
        attrmatch = lambda a: (
            (source is None or source == a.source) and
            (relation is None or relation == a.relation) and
            (target is None or target == a.target)
        )
        variables = self.variables()
        attrs = [t for t in self.triples() if t.target not in variables]
        return list(filter(attrmatch, attrs))
231175
public static String getAttrVal(final NamedNodeMap nnm, final String name) {
    Node nmAttr = nnm.getNamedItem(name);

    if ((nmAttr == null) || (absent(nmAttr.getNodeValue()))) {
      return null;
    }

    return nmAttr.getNodeValue();
  }
599802
def get_attribute_ns(namespace, name)
      each_attribute() { |attribute|
        if name == attribute.name &&
          namespace == attribute.namespace()
          return attribute
        end
      }
      nil
    end
155254
def unit(self):
        
        unit = ncVarUnit(self._ncVar)
        fieldNames = self._ncVar.dtype.names

        # If the missing value attribute is a list with the same length as the number of fields,
        # return the missing value for field that equals the self.nodeName.
        if hasattr(unit, '__len__') and len(unit) == len(fieldNames):
            idx = fieldNames.index(self.nodeName)
            return unit[idx]
        else:
            return unit
971537
def _analyze_variable_attributes(self, attributes):
        ''''
            
        '''
        if 'storageLocation' in attributes:
            location = attributes['storageLocation']
            self._location = location
        else:
            if 'memory' in attributes['type']:
                self._location = 'memory'
            elif'storage' in attributes['type']:
                self._location = 'storage'
            else:
                self._location = 'default'

        super(LocalVariableSolc, self)._analyze_variable_attributes(attributes)
1101406
def attributes(self):
        """"""
        if self._attributes is None:
            self._filters, self._attributes = self._fetch_configuration()
        return self._attributes
310270
def get_variable_docstrings(filename):
    

    def walk_node(parent, values=None, prefix=""):
        """
        walk the ast searching for docstrings/values
        """
        docstrings = {}
        if values is None:
            values = {}
        key = None
        for node in ast.iter_child_nodes(parent):
            if isinstance(node, ast.ClassDef):
                # We are in a class so walk the class
                docs = walk_node(node, values, prefix + node.name + ".")[0]
                docstrings[node.name] = docs
            elif isinstance(node, ast.Assign):
                key = node.targets[0].id
                if isinstance(node.value, ast.Num):
                    values[key] = node.value.n
                if isinstance(node.value, ast.Str):
                    values[key] = node.value.s
                if isinstance(node.value, ast.Name):
                    if node.value.id in values:
                        values[prefix + key] = values[node.value.id]
            elif isinstance(node, ast.Expr) and key:
                docstrings[key] = node.value.s
            else:
                key = None
        return docstrings, values

    with open(filename, "r") as f:
        source = f.read()
    return walk_node(ast.parse(source))
1356444
def _get_attrs(self):
        """"""
        attrs = []
        attrs.append(("N Cells", self.GetNumberOfCells(), "{}"))
        attrs.append(("N Points", self.GetNumberOfPoints(), "{}"))
        bds = self.bounds
        attrs.append(("X Bounds", (bds[0], bds[1]), "{:.3e}, {:.3e}"))
        attrs.append(("Y Bounds", (bds[2], bds[3]), "{:.3e}, {:.3e}"))
        attrs.append(("Z Bounds", (bds[4], bds[5]), "{:.3e}, {:.3e}"))
        # if self.n_cells <= vtki.REPR_VOLUME_MAX_CELLS and self.n_cells > 0:
        #     attrs.append(("Volume", (self.volume), "{:.3e}"))
        return attrs
672499
def get_attrs(self):
        """"""
        return FrozenOrderedDict((a, getattr(self.ds, a)) for a in self.ds.ncattrs())
556148
def getAttribute(self):
        """"""
        data = self.data
        # Step 1 (skip chars)
        c = data.skip(spaceCharactersBytes | frozenset([b"/"]))
        assert c is None or len(c) == 1
        # Step 2
        if c in (b">", None):
            return None
        # Step 3
        attrName = []
        attrValue = []
        # Step 4 attribute name
        while True:
            if c == b"=" and attrName:
                break
            elif c in spaceCharactersBytes:
                # Step 6!
                c = data.skip()
                break
            elif c in (b"/", b">"):
                return b"".join(attrName), b""
            elif c in asciiUppercaseBytes:
                attrName.append(c.lower())
            elif c is None:
                return None
            else:
                attrName.append(c)
            # Step 5
            c = next(data)
        # Step 7
        if c != b"=":
            data.previous()
            return b"".join(attrName), b""
        # Step 8
        next(data)
        # Step 9
        c = data.skip()
        # Step 10
        if c in (b"'", b'"'):
            # 10.1
            quoteChar = c
            while True:
                # 10.2
                c = next(data)
                # 10.3
                if c == quoteChar:
                    next(data)
                    return b"".join(attrName), b"".join(attrValue)
                # 10.4
                elif c in asciiUppercaseBytes:
                    attrValue.append(c.lower())
                # 10.5
                else:
                    attrValue.append(c)
        elif c == b">":
            return b"".join(attrName), b""
        elif c in asciiUppercaseBytes:
            attrValue.append(c.lower())
        elif c is None:
            return None
        else:
            attrValue.append(c)
        # Step 11
        while True:
            c = next(data)
            if c in spacesAngleBrackets:
                return b"".join(attrName), b"".join(attrValue)
            elif c in asciiUppercaseBytes:
                attrValue.append(c.lower())
            elif c is None:
                return None
            else:
                attrValue.append(c)
1224462
def get_elements_attributes(parent_to_parse, element_path=None, attrib_name=None):
    

    attrs = _get_elements_property(parent_to_parse, element_path, 'attrib')

    if not attrib_name:
        return attrs

    return [attr[attrib_name] for attr in attrs if attrib_name in attr]
603010
def ns(self):
        
        ret = libxml2mod.xmlNodeGetNs(self._o)
        if ret is None:return None
        __tmp = xmlNs(_obj=ret)
        return __tmp
1221368
private String toAttributeName(String vcfInfoFieldKey) {
    String attrName = infoFieldKeyToAttrNameMap.get(vcfInfoFieldKey);
    if (attrName == null) {
      throw new RuntimeException(
          format("Missing attribute for VCF info field [%s]", vcfInfoFieldKey));
    }
    return attrName;
  }
80141
def normalize_attr_strings(a: np.ndarray) -> np.ndarray:
	
	if np.issubdtype(a.dtype, np.object_):
		# if np.all([type(x) is str for x in a]) or np.all([type(x) is np.str_ for x in a]) or np.all([type(x) is np.unicode_ for x in a]):
		if np.all([(type(x) is str or type(x) is np.str_ or type(x) is np.unicode_) for x in a]):
			return np.array([x.encode('ascii', 'xmlcharrefreplace') for x in a])
		elif np.all([type(x) is np.string_ for x in a]) or np.all([type(x) is np.bytes_ for x in a]):
			return a.astype("string_")
		else:
			logging.debug(f"Attribute contains mixed object types ({np.unique([str(type(x)) for x in a])}); casting all to string")
			return np.array([str(x) for x in a], dtype="string_")
	elif np.issubdtype(a.dtype, np.string_) or np.issubdtype(a.dtype, np.object_):
		return a
	elif np.issubdtype(a.dtype, np.str_) or np.issubdtype(a.dtype, np.unicode_):
		return np.array([x.encode('ascii', 'xmlcharrefreplace') for x in a])
	else:
		raise ValueError("String values must be object, ascii or unicode.")
399608
def get_attrs(self):
        
        self.non_index_axes = []
        self.nan_rep = None
        self.levels = []

        self.index_axes = [a.infer(self)
                           for a in self.indexables if a.is_an_indexable]
        self.values_axes = [a.infer(self)
                            for a in self.indexables if not a.is_an_indexable]
        self.data_columns = [a.name for a in self.values_axes]
1359713
def get_resource_attributes(ref_key, ref_id, type_id=None, **kwargs):
    

    user_id = kwargs.get('user_id')

    resource_attr_qry = db.DBSession.query(ResourceAttr).filter(
        ResourceAttr.ref_key == ref_key,
        or_(
            ResourceAttr.network_id==ref_id,
            ResourceAttr.node_id==ref_id,
            ResourceAttr.link_id==ref_id,
            ResourceAttr.group_id==ref_id
        ))

    if type_id is not None:
        attr_ids = []
        rs = db.DBSession.query(TypeAttr).filter(TypeAttr.type_id==type_id).all()
        for r in rs:
            attr_ids.append(r.attr_id)

        resource_attr_qry = resource_attr_qry.filter(ResourceAttr.attr_id.in_(attr_ids))

    resource_attrs = resource_attr_qry.all()

    return resource_attrs