Return the values for this attribute as stored in an AFF4Object.
552724
def GetValues(self, fd):
    """"""
    result = None
    for result in fd.new_attributes.get(self, []):
      # We need to interpolate sub fields in this rdfvalue.
      if self.field_names:
        for x in self.GetSubFields(result, self.field_names):
          yield x

      else:
        yield result

    for result in fd.synced_attributes.get(self, []):
      result = result.ToRDFValue()

      # We need to interpolate sub fields in this rdfvalue.
      if result is not None:
        if self.field_names:
          for x in self.GetSubFields(result, self.field_names):
            yield x

        else:
          yield result

    if result is None:
      default = self.GetDefault(fd)
      if default is not None:
        yield default
826074
def get_tuple(self):
        """"""
        objType, objInstance = self.value

        if isinstance(objType, int):
            pass
        elif isinstance(objType, str):
            # turn it back into an integer
            objType = self.objectTypeClass()[objType]
        else:
            raise TypeError("invalid datatype for objType")

        # pack the components together
        return (objType, objInstance)
537149
def attributes(self):
    """"""
    if not self._is_parsed:
      self._Parse()
      self._is_parsed = True

    return iter(self._attributes.values())
963145
def get_attribute_value(item, field, context, force=False, skip_autofield=True):
    
    # Find the value of the field, catching any database issues
    try:
        value = getattr(item, field.name)
    except ObjectDoesNotExist:
        raise SkipValue('Could not find object for %s.%s, ignoring.\n' % (item.__class__.__name__, field.name))

    # AutoField: We don't include the auto fields, they'll be automatically recreated
    if skip_autofield and isinstance(field, AutoField):
        raise SkipValue()

    # Some databases (eg MySQL) might store boolean values as 0/1, this needs to be cast as a bool
    elif isinstance(field, BooleanField) and value is not None:
        return repr(bool(value))

    # Post file-storage-refactor, repr() on File/ImageFields no longer returns the path
    elif isinstance(field, FileField):
        return repr(force_text(value))

    # ForeignKey fields, link directly using our stored python variable name
    elif isinstance(field, ForeignKey) and value is not None:

        # Special case for contenttype foreign keys: no need to output any
        # content types in this script, as they can be generated again
        # automatically.
        # NB: Not sure if "is" will always work
        if field.remote_field.model is ContentType:
            return 'ContentType.objects.get(app_label="%s", model="%s")' % (value.app_label, value.model)

        # Generate an identifier (key) for this foreign object
        pk_name = value._meta.pk.name
        key = '%s_%s' % (value.__class__.__name__, getattr(value, pk_name))

        if key in context:
            variable_name = context[key]
            # If the context value is set to None, this should be skipped.
            # This identifies models that have been skipped (inheritance)
            if variable_name is None:
                raise SkipValue()
            # Return the variable name listed in the context
            return "%s" % variable_name
        elif value.__class__ not in context["__avaliable_models"] or force:
            context["__extra_imports"][value._meta.object_name] = value.__module__
            item_locator = orm_item_locator(value)
            return item_locator
        else:
            raise DoLater('(FK) %s.%s\n' % (item.__class__.__name__, field.name))

    elif isinstance(field, (DateField, DateTimeField)) and value is not None:
        return "dateutil.parser.parse(\"%s\")" % value.isoformat()

    # A normal field (e.g. a python built-in)
    else:
        return repr(value)
316709
def getFields(self):
        
        d = {}
        for i in self._attrsList:
            key = i
            value = getattr(self,  i)
            d[key] = value
        return d
563703
def get_value(cls, object_version, key):
        """"""
        obj = cls.get(object_version, key)
        return obj.value if obj else None
467296
def _values(self):
        """"""
        return [abs(val) for val in super(Dot, self)._values if val != 0]
13696
def _repr_values(self):
        """"""
        def getattr_better(obj, field):
            try:
                return getattr(obj, field)
            except AttributeError as e:
                try:
                    return getattr(obj, '_' + field)
                except AttributeError:
                    raise e

        return (getattr_better(self, attr) for attr in self._repr_attributes)
170903
def getanymentions(idf, anidfobject):
    """"""
    name = anidfobject.obj[1]
    foundobjs = []
    keys = idfobjectkeys(idf)
    idfkeyobjects = [idf.idfobjects[key.upper()] for key in keys]
    for idfobjects in idfkeyobjects:
        for idfobject in idfobjects:
            if name.upper() in [item.upper() 
                                    for item in idfobject.obj 
                                        if isinstance(item, basestring)]:
                foundobjs.append(idfobject)
    return foundobjs
152461
def _to_api_value(self, attribute_type, value):
        """"""

        if not value:
            return None

        if isinstance(attribute_type, properties.Instance):
            return value.to_api()

        if isinstance(attribute_type, properties.List):
            return self._parse_api_value_list(value)

        return attribute_type.serialize(value)
684555
def raw_value(self) -> RawValue:
        """"""
        if isinstance(self.value, ObjectValue):
            return {m: self._member(m).raw_value() for m in self.value}
        if isinstance(self.value, ArrayValue):
            return [en.raw_value() for en in self]
        return self.schema_node.type.to_raw(self.value)
1094850
def rgetattr(obj, attr, *args):
  """"""
  def _getattr(obj, attr):
    return getattr(obj, attr, *args)
  return functools.reduce(_getattr, [obj] + attr.split("."))
1024693
def attributes(self):
        

        overridden_attrs = self._attributes
        sortmap = {"neutral": 1, "positive": 2,
                   "negative": 3}

        sortedattrs = list(overridden_attrs.values())
        sortedattrs.sort(key=operator.itemgetter("defindex"))
        sortedattrs.sort(key=lambda t: sortmap.get(t.get("effect_type",
                                                         "neutral"), 99))
        return [item_attribute(theattr) for theattr in sortedattrs]
468048
def getVals(self):
        
        return [(name, self._fieldValDict.get(name)) 
                for name in self._fieldNameList]
818990
def __get_values(self):
        
        array = self._get_target().getDataArray()
        return tuple(itertools.chain.from_iterable(array))
729717
def _ValidateAFF4Type(aff4_type):
  """"""
  if aff4_type is None:
    return

  if not isinstance(aff4_type, type):
    raise TypeError("aff4_type=%s must be a type" % aff4_type)
  if not issubclass(aff4_type, AFF4Object):
    raise TypeError("aff4_type=%s must be a subclass of AFF4Object." %
                    aff4_type)
411435
def _GetAttributes(self):
    
    if self._attributes is None:
      self._attributes = []
      for fsntfs_attribute in self._fsntfs_file_entry.attributes:
        attribute_class = self._ATTRIBUTE_TYPE_CLASS_MAPPINGS.get(
            fsntfs_attribute.attribute_type, NTFSAttribute)

        attribute_object = attribute_class(fsntfs_attribute)
        self._attributes.append(attribute_object)

    return self._attributes