← Back
Editing: django.cpython-311.pyc
� p�{c�* � � � d Z ddlmZ ddlmZ ddlmZ ddlmZm Z m Z ddlmZm Z ddlmZmZ ddlmZ dd lmZ dd lmZ ddlmZ ddlmZ dd lmZ i dd�dd�dd�dd�dd�dd�dd�dd�dd�dd�dd�dd�dd �d!d"�d#d$�d%d&�d'd(�d)d*i�Zd+Z e� � d,� � � Zd-� Z e d.� � � Z!d/� Z" G d0� d1e� � Z#dLd3�Z$d4� Z%d5� Z&d6� Z'd7� Z(d8� Z)d9� Z*d:� Z+ G d;� d<e � � Z, G d=� d>e e� � Z- G d?� d@e � � Z. G dA� dBe e� � Z/ G dC� dDe� � Z0 G dE� dFe� � Z1 G dG� dHe � � Z2 G dI� dJe � � Z3dKS )Mz. Module is used to infer Django model fields. � )� Parameter)�debug)�inference_state_function_cache)�ValueSet�iterator_to_value_set�ValueWrapper)� DictFilter�AttributeOverwrite)�NameWrapper�BaseTreeParamName)�EmptyCompiledName)�TreeInstance)� ClassMixin)�GenericClass)�TupleGenericManager)�AbstractSignature�IntegerField)N�int�BigIntegerField�PositiveIntegerField�SmallIntegerField� CharField)N�str� TextField� EmailField�GenericIPAddressField�URLField� FloatField)N�float�BinaryField)N�bytes�BooleanField)N�bool�DecimalField)�decimal�Decimal� TimeField)�datetime�time� DurationField)r( � timedelta� DateField)r( �date� DateTimeField)r( r( � UUIDField)�uuid�UUID)�create�filter�exclude�update�get� get_or_create�update_or_createc �v � | � d� � � d� � � � � S )N)�django�db�models�query_utils�DeferredAttribute)� import_module�py__getattribute__�execute_annotation)�inference_states �5/usr/lib/python3/dist-packages/jedi/plugins/django.py�_get_deferred_attributesrD , s9 � ��(�(�1�� ���,�-�-�.@�.@�.B�.B�C� c �, � t |� � � \ }}n# t $ r Y d S w xY w|st | � � S |�| j }n| � |f� � }|� |� � D ]}|� � � c S d S �N)�mapping� py__name__�KeyErrorrD �builtins_moduler? r@ �execute_with_values)rB � field_name�field_tree_instance�is_instance�module_name�attribute_name�module� attributes rC �_infer_scalar_fieldrT 3 s� � ��&-�.A�.L�.L�.N�.N�&O�#��^�^��� � � ��t�t����� � 9�'��8�8�8��� �0��� �.�.��~�>�>���.�.�~�>�>� /� /� ��,�,�.�.�.�.�.�/� /s �"% � 3�3c # �� K � t |t � � r�|j � � � }t |d� � \ }}|��|��|� � � D ]�}|� � � dk rY|� � � }| � � � }|� |� � D ]}|� � � r|V � ��s|� � � r|V � ��d S d S d S d S )N)NNr )� isinstancer � _arguments�unpack�next�inferrI �get_safe_value�get_root_contextr@ �is_class) �clsrN �argument_iterator�key�lazy_values�value�foreign_key_class_namerR �vs rC �_get_foreign_key_valuesre E s � � � ��%�|�4�4� �/�:�A�A�C�C��� 1�<�@�@���[��;�;�2�$�*�*�,�,� � ���#�#�%�%��.�.�-2�-A�-A�-C�-C�*� �1�1�3�3�F�#�6�6�7M�N�N� $� $���:�:�<�<� $�"#�G�G�G��$� �^�^�%�%� ��K�K�K�� � � �;�2�2� � rE c �� � | j }|� � � }|D ]�}t ||||� � }|�|c S |� � � }|dk }|dv s|rd|st |� � c S t | |� � } |r)t t d d� | D � � � � � � c S | � � � c S ��t j d|j | � � � � � |S )N�ManyToManyField)� ForeignKey� OneToOneFieldc �. � g | ]}t |d � � ��S )�RelatedManager)�_create_manager_for)�.0rd s rC � <listcomp>z _infer_field.<locals>.<listcomp>h s1 � � .� .� .�AB�'��+;�<�<�.� .� .rE z1django plugin: fail to infer `%s` from class `%s`)rB rZ rT rI rD re r r3 rL r �dbg�string_name) r^ rM rO rB �resultrN �scalar_field�name�is_many_to_many�valuess rC �_infer_fieldrv W sO � ��)�O� � � � � �F�%� 4� 4��*��Z�)<�k�K� K���#�����"�-�-�/�/���"3�3���2�2�2�o�2�� A�/��@�@�@�@�@�,�S�2E�F�F�F�� 4���t� .� .�FL�.� .� .� !� !� � � � � � �1�1�3�3�3�3�3� 3� �I�A��$�c�n�n�&6�&6�8� 8� 8��MrE c �$ � � e Zd Z� fd�Zd� Z� xZS )�DjangoModelNamec �f �� t � � � |� � || _ || _ d S rG )�super�__init__�_cls�_is_instance)�selfr^ rs rO � __class__s �rC r{ zDjangoModelName.__init__t s0 �� � ����������� �'����rE c �B � t | j | j | j � � S rG )rv r| � _wrapped_namer} �r~ s rC rZ zDjangoModelName.infery s � ��D�I�t�'9�4�;L�M�M�MrE )�__name__� __module__�__qualname__r{ rZ � __classcell__�r s @rC rx rx s sN �� � � � � �(� (� (� (� (� N� N� N� N� N� N� NrE rx �BaseManagerc �" � | j � d� � � |� � }|D ]^}|� � � rHt t | g� � f� � }t ||� � � � � D ]}|c c S �_d S )N)r: r; r<