Figures out what fields should be readonly.  We iterate our field_config to find all
        that have a readonly of true
963714
def derive_readonly(self):
        
        readonly = list(self.readonly)
        for key, value in self.field_config.items():
            if 'readonly' in value and value['readonly']:
                readonly.append(key)

        return readonly
1225834
def to_dict(self, include_readonly=True, field_names=None):
        '''
        
        '''
        fields = self.fields(writable=not include_readonly)

        if field_names is not None:
            fields = [f for f in fields if f in field_names]

        data = self.__dict__
        return {name: data[name] for name in fields}
108072
protected function checkReadonlyField(&$data) {
        if(!empty($this->readonlyField)) {
            foreach ($this->readonlyField as $key=>$field){
                if(isset($data[$field]))
                    unset($data[$field]);
            }
        }
        return $data;
    }
282899
def _all_fields(self):
        
        if (
            not settings.ENABLE_FIELDS_CACHE or
            not self.ENABLE_FIELDS_CACHE or
            self.__class__ not in FIELDS_CACHE
        ):
            all_fields = super(
                WithDynamicSerializerMixin,
                self
            ).get_fields()

            if (
                settings.ENABLE_FIELDS_CACHE and
                self.ENABLE_FIELDS_CACHE
            ):
                FIELDS_CACHE[self.__class__] = all_fields
        else:
            all_fields = copy.copy(FIELDS_CACHE[self.__class__])
            for k, field in six.iteritems(all_fields):
                if hasattr(field, 'reset'):
                    field.reset()

        for k, field in six.iteritems(all_fields):
            field.field_name = k
            field.parent = self

        return all_fields
1260167
def is_set_on(self, xblock):
        
        # pylint: disable=protected-access
        return self._is_dirty(xblock) or xblock._field_data.has(xblock, self.name)
1020180
def filter_fields(self, fields=[], exclude=[], include_all_if_empty=True):
        
        if not include_all_if_empty and not fields:
            return []
        ret = []
        for f in self.visible_fields():
            if fields and f.name not in fields:
                continue
            if exclude and f.name in exclude:
                continue
            ret.append(f)
        return ret
592836
def is_readonly_path(fn):
    
    if os.path.exists(fn):
        return (os.stat(fn).st_mode & stat.S_IREAD) or not os.access(fn, os.W_OK)

    return False
492394
def clear!
      @values.delete_if do |_, value|
        if value.is_a?(::Protobuf::Field::FieldArray) || value.is_a?(::Protobuf::Field::FieldHash)
          value.clear
          false
        else
          true
        end
      end
      self
    end
805311
def configure_fields(conf)
      # This loop looks dump, but it is used to suppress the unused parameter configuration warning
      # Learned from `filter_record_transformer`.
      conf.elements.select { |element| element.name == 'fields' }.each do |element|
        element.each_pair { |k, v| element.has_key?(k) }
      end

      return unless @fields

      @extra_fields = @fields.corresponding_config_element.map { |k, v|
	[k, v.empty? ? k : v]
      }.to_h
    end
89733
def get_filter_fields(self, exclude=None):
        

        exclude_set = set(self.exclude)
        if exclude:
            exclude_set = exclude_set.union(set(exclude))

        return [name for name in self.fields
                if name not in exclude_set]
753767
public boolean isReadonly() {
		Boolean value = (Boolean) getStateHelper().eval(PropertyKeys.readonly, false);
		return (boolean) value;
	}
306455
def __list_fields(cls):
        
        for name in cls._doc_type.mapping:
            field = cls._doc_type.mapping[name]
            yield name, field, False

        if hasattr(cls.__class__, '_index'):
            if not cls._index._mapping:
                return
            for name in cls._index._mapping:
                # don't return fields that are in _doc_type
                if name in cls._doc_type.mapping:
                    continue
                field = cls._index._mapping[name]
                yield name, field, True
727633
def setup_fields(attrs):
    
    fields = {}
    iterator = list(attrs.items())
    for key, value in iterator:
        if not isinstance(value, Field):
            continue
        fields[key] = value
        del attrs[key]
    return fields
1330105
def all_optional_fields(self):
        
        def optional_check(f):
            return is_nullable_type(f.data_type) or f.has_default
        return self._filter_fields(optional_check)
510345
def readonly_attributes(*attrs)
      @readonly_attributes ||= [:created_at, :updated_at, :completed_at]
      if attrs.any?
        @readonly_attributes.map!(&:to_sym).concat(attrs).uniq!
        setup_attributes(@readonly_attributes, true)
      end
      @readonly_attributes
    end
596729
def del_fields(self, *names):
        """"""
        cls = type(self)
        self.__class__ = cls
        for n in names:
            # don't raise error if a field is absent
            if isinstance(getattr(cls, n, None), DataField):
                if n in self._field_values:
                    del self._field_values[n]
                delattr(cls, n)
181609
def get_fields(self):
        
        all_fields = self.get_all_fields()
        if self.dynamic is False:
            return all_fields

        if self.id_only():
            return {}

        serializer_fields = copy.deepcopy(all_fields)
        request_fields = self.request_fields
        deferred = self._get_deferred_field_names(serializer_fields)

        # apply request overrides
        if request_fields:
            for name, include in six.iteritems(request_fields):
                if name not in serializer_fields:
                    raise exceptions.ParseError(
                        '"%s" is not a valid field name for "%s".' %
                        (name, self.get_name())
                    )
                if include is not False and name in deferred:
                    deferred.remove(name)
                elif include is False:
                    deferred.add(name)

        for name in deferred:
            serializer_fields.pop(name)

        # Set read_only flags based on read_only_fields meta list.
        # Here to cover DynamicFields not covered by DRF.
        ro_fields = getattr(self.Meta, 'read_only_fields', [])
        self.flag_fields(serializer_fields, ro_fields, 'read_only', True)

        pw_fields = getattr(self.Meta, 'untrimmed_fields', [])
        self.flag_fields(
            serializer_fields,
            pw_fields,
            'trim_whitespace',
            False,
        )

        # Toggle read_only flags for immutable fields.
        # Note: This overrides `read_only` if both are set, to allow
        #       inferred DRF fields to be made immutable.
        immutable_field_names = self._get_flagged_field_names(
            serializer_fields,
            'immutable'
        )
        self.flag_fields(
            serializer_fields,
            immutable_field_names,
            'read_only',
            value=False if self.get_request_method() == 'POST' else True
        )

        return serializer_fields