HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/env/lib64/python3.10/site-packages/wtforms/__pycache__/meta.cpython-310.pyc
o

"we�@s6ddlmZddlmZddlmZGdd�d�ZdS)�)�i18n)�WebobInputWrapper��	clean_keyc@s`eZdZdZdd�Zdd�Zdd�ZdZd	Zd
Z	d
Z
d
Zdd�ZdZ
d
ZiZdd�Zdd�Zd
S)�DefaultMetaz�
    This is the default Meta class which defines all the default values and
    therefore also the 'API' of the class Meta interface.
    cCs|jdd|i|��S)a�
        bind_field allows potential customization of how fields are bound.

        The default implementation simply passes the options to
        :meth:`UnboundField.bind`.

        :param form: The form.
        :param unbound_field: The unbound field.
        :param options:
            A dictionary of options which are typically passed to the field.

        :return: A bound field
        �formN�)�bind)�selfr�
unbound_field�optionsrr�E/home/arjun/projects/env/lib/python3.10/site-packages/wtforms/meta.py�
bind_fieldszDefaultMeta.bind_fieldcCs0|durt|d�st|d�rt|�Std��|S)aZ
        wrap_formdata allows doing custom wrappers of WTForms formdata.

        The default implementation detects webob-style multidicts and wraps
        them, otherwise passes formdata back un-changed.

        :param form: The form.
        :param formdata: Form data.
        :return: A form-input wrapper compatible with WTForms.
        N�getlist�getallzNformdata should be a multidict-type wrapper that supports the 'getlist' method)�hasattrr�	TypeError)r
r�formdatarrr
�
wrap_formdatas
�zDefaultMeta.wrap_formdatacCsZdd�|��D�}t|dd�}|dur$dd�|��D�}t|fi|��}|j|fi|��S)z�
        render_field allows customization of how widget rendering is done.

        The default implementation calls ``field.widget(field, **render_kw)``
        cS�i|]	\}}t|�|�qSrr��.0�k�vrrr
�
<dictcomp>:�z,DefaultMeta.render_field.<locals>.<dictcomp>�	render_kwNcSrrrrrrr
r>r)�items�getattr�dict�widget)r
�fieldr�other_kwrrr
�render_field3szDefaultMeta.render_fieldF�
csrf_tokenNcCs$|jdur	|��Sddlm}|�S)a�
        Build a CSRF implementation. This is called once per form instance.

        The default implementation builds the class referenced to by
        :attr:`csrf_class` with zero arguments. If `csrf_class` is ``None``,
        will instead use the default implementation
        :class:`wtforms.csrf.session.SessionCSRF`.

        :param form: The form.
        :return: A CSRF implementation.
        Nr)�SessionCSRF)�
csrf_class�wtforms.csrf.sessionr%)r
rr%rrr
�
build_csrfJs
zDefaultMeta.build_csrfTcCs^|j}|dur	dS|jr*|rt|�nd}|j�|�}|dur(t�|�}|j|<|St�|�S)z�
        Override in subclasses to provide alternate translations factory.
        See the i18n documentation for more.

        :param form: The form.
        :return: An object that provides gettext() and ngettext() methods.
        FN)�locales�cache_translations�tuple�translations_cache�getr�get_translations)r
rr)�translationsrrr
r.cs�
zDefaultMeta.get_translationscCs"|��D]
\}}t|||�qdS)zV
        Given a dictionary of values, update values on this `Meta` instance.
        N)r�setattr)r
�values�key�valuerrr
�
update_valuess�zDefaultMeta.update_values)�__name__�
__module__�__qualname__�__doc__rrr#�csrf�csrf_field_name�csrf_secret�csrf_contextr&r(r)r*r,r.r4rrrr
rs rN)�wtformsr�
wtforms.utilsr�wtforms.widgets.corerrrrrr
�<module>s