The values of :attr:`forms` and :attr:`files` combined into a single
            :class:`FormsDict`. Values are either strings (form values) or
            instances of :class:`cgi.FieldStorage` (file uploads).
507573
def POST(self):
        
        post = FormsDict()
        # We default to application/x-www-form-urlencoded for everything that
        # is not multipart and take the fast path (also: 3.1 workaround)
        if not self.content_type.startswith('multipart/'):
            pairs = _parse_qsl(tonat(self._get_body_string(), 'latin1'))
            for key, value in pairs:
                post[key] = value
            return post

        safe_env = {'QUERY_STRING':''} # Build a safe environment for cgi
        for key in ('REQUEST_METHOD', 'CONTENT_TYPE', 'CONTENT_LENGTH'):
            if key in self.environ: safe_env[key] = self.environ[key]
        args = dict(fp=self.body, environ=safe_env, keep_blank_values=True)
        if py31:
            args['fp'] = NCTextIOWrapper(args['fp'], encoding='utf8',
                                         newline='\n')
        elif py3k:
            args['encoding'] = 'utf8'
        data = cgi.FieldStorage(**args)
        self['_cgi.FieldStorage'] = data #http://bugs.python.org/issue18394#msg207958
        data = data.list or []
        for item in data:
            if item.filename:
                post[item.name] = FileUpload(item.file, item.name,
                                             item.filename, item.headers)
            else:
                post[item.name] = item.value
        return post
1055708
def as_dict(self):
        
        self.clean()
        d = OrderedDict()
        all_props = self.__class__.CONFIG_PROPERTIES
        for attr_name, attr_config in six.iteritems(all_props):
            value = self._config[attr_name]
            attr_type = attr_config.attr_type
            if attr_type:
                if value:
                    if issubclass(attr_type, list):
                        if issubclass(attr_type, NamedTupleList):
                            d[attr_name] = [i._asdict() for i in value]
                        else:
                            d[attr_name] = value[:]
                    elif attr_type is dict:
                        d[attr_name] = dict(value)
            elif value is not NotSet:
                d[attr_name] = value
        return d
527669
def value_from_datadict(self, data, files, name):
        """"""
        upload = super(StickyUploadWidget, self).value_from_datadict(data, files, name)
        if upload is not None:
            # File was posted or cleared as normal
            return upload
        else:
            # Try the hidden input
            hidden_name = self.get_hidden_name(name)
            value = data.get(hidden_name, None)
            if value is not None:
                upload = open_stored_file(value, self.url)
                if upload is not None:
                    setattr(upload, '_seralized_location', value)
        return upload
1063240
def accept(self):
        '''
        
        '''
        result = dict(self.python_data)
        for field in self.fields:
            if field.writable:
                result.update(field.accept())
            else:
                # readonly field
                field.set_raw_value(self.form.raw_data,
                                    field.from_python(result[field.name]))
        self.clean_value = self.conv.accept(result)
        return {self.name: self.clean_value}
1047401
def get_form_kwargs(self):
        
        kwargs = {'initial': self.get_initial(),
                  'instance': self.object}

        if self.request.method in ('POST', 'PUT') and self.can_submit:
            kwargs.update({
                'data': self.request.POST,
                'files': self.request.FILES
            })
        return kwargs
550485
def yank_fields_from_attrs(attrs, _as=None, sort=True):
    
    fields_with_names = []
    for attname, value in list(attrs.items()):
        field = get_field_as(value, _as)
        if not field:
            continue
        fields_with_names.append((attname, field))

    if sort:
        fields_with_names = sorted(fields_with_names, key=lambda f: f[1])
    return OrderedDict(fields_with_names)
776558
def _form_loader(self, _):
        '''
        
        '''
        data = {}
        for key in self.request.arguments:
            val = self.get_arguments(key)
            if len(val) == 1:
                data[key] = val[0]
            else:
                data[key] = val
        return data
1258923
def _format_attrs(self):
        
        attrs = self._get_data_as_items()
        if self.name is not None:
            attrs.append(('name', ibase.default_pprint(self.name)))
        return attrs
30898
def value_attr(attr_name):
    

    def value_attr(value, context, **_params):
        value = getattr(value, attr_name)
        return _attr(value)

    return value_attr
962785
def get_switched_form_field_attrs(self, prefix, input_type, name):
        
        attributes = {'class': 'switched', 'data-switch-on': prefix + 'field'}
        attributes['data-' + prefix + 'field-' + input_type] = name
        return attributes
1088031
def values(self, *fields):
        
        if not fields:
            fields = self._get_simple_fields()

        fields = self._coerce_fields_parameters(fields)

        self._instances = False
        self._values = {'fields': fields, 'mode': 'dicts'}
        return self
1220356
def render_attrs(attrs):
    
    if attrs is not None:
        def parts():
            for key, value in sorted(attrs.items()):
                if value is None:
                    continue
                if value is True:
                    yield '%s' % (key, )
                    continue
                if key == 'class' and isinstance(value, dict):
                    if not value:
                        continue
                    value = render_class(value)
                if key == 'style' and isinstance(value, dict):
                    if not value:
                        continue
                    value = render_style(value)
                yield '%s="%s"' % (key, ('%s' % value).replace('"', '&quot;'))
        return mark_safe(' %s' % ' '.join(parts()))
    return ''
573542
def add_attr2fields(self, attr_name, attr_val, fields=[], exclude=[], include_all_if_empty=True):
        
        for f in self.filter_fields(fields, exclude, include_all_if_empty):
            f = self.fields[f.name]
            org_val = f.widget.attrs.get(attr_name, '')
            f.widget.attrs[attr_name] = '%s %s' % (org_val, attr_val) if org_val else attr_val
1333803
def attrs(self) -> _Attrs:
        
        if self._attrs is None:
            self._attrs = {k: v for k, v in self.element.items()}

            # Split class and rel up, as there are ussually many of them:
            for attr in ['class', 'rel']:
                if attr in self._attrs:
                    self._attrs[attr] = tuple(self._attrs[attr].split())

        return self._attrs
955362
def structure_attrs_fromdict(self, obj, cl):
        # type: (Mapping[str, Any], Type[T]) -> T
        """"""
        # For public use.
        conv_obj = {}  # Start with a fresh dict, to ignore extra keys.
        dispatch = self._structure_func.dispatch
        for a in cl.__attrs_attrs__:  # type: ignore
            # We detect the type by metadata.
            type_ = a.type
            name = a.name

            try:
                val = obj[name]
            except KeyError:
                continue

            if name[0] == "_":
                name = name[1:]

            conv_obj[name] = (
                dispatch(type_)(val, type_) if type_ is not None else val
            )

        return cl(**conv_obj)
1263175
def print_attr_values( thing, all=False, heading=None, file=None ):
    '''
    
    '''
    if heading :
        if isinstance( heading, int ) :
            # request for default heading
            heading = '== {} attributes of {} =='.format(
                            'all' if all else 'non-empty',
                            getattr( thing, '__name__', str(thing) )
            )
        print( heading, file=file )

    for attr in object_attributes( thing, all ):
        attr_value = getattr( thing, attr )
        if attr_value is not None :
            print( attr, ':', attr_value, file=file )
        elif all :
            print( attr, ':' )
1111624
def file(self, value):
        

        if value is not None:
            assert type(value) is unicode, "'{0}' attribute: '{1}' type is not 'unicode'!".format("file", value)
        self.__file = value