관리-도구
편집 파일: migrations.cpython-311.pyc
� �܋f � �� � d Z ddlZddlmZmZ ddlmZ ddlmZ ddl m Z ddlmZ ddl mZ d � Z G d � dej � � Z G d� d ej � � Zd� Zd� Zd� ZdS )z� Various suggestions around migrations. Disabled by default! Enable with pylint --load-plugins=pylint_django.checkers.migrations � N)�checkers� interfaces)�utils)�suppress_message)�compat)�BASE_ID)�is_migrations_modulec � � t | j t j � � sdS | j j dk sdS | j D ]J}|j dk r=t |j t j � � r|j j D ]}|j dk r dS ��KdS )NF�AddField�field�defaultT) � isinstance�func�astroid� Attribute�attrname�keywords�arg�value�Call)�call�keyword� field_keywords �r/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/pylint_django/checkers/migrations.py�_is_addfield_with_defaultr s� � ��d�i��!2�3�3� ��u��9���+�+��u��=� � ���;�'�!�!�j�����&M�&M�!� ")��!7� � � � �$� �1�1��4�4�4� 2�� �5� c �| � e Zd ZdZej fZdZde� d�diZ g Z i Zd� Zd� Z ej d� � d� � � Zd S ) �NewDbFieldWithDefaultCheckera� Looks for migrations which add new model fields and these fields have a default value. According to Django docs this may have performance penalties especially on large tables: https://docs.djangoproject.com/en/2.0/topics/migrations/#postgresql The preferred way is to add a new DB column with null=True because it will be created instantly and then possibly populate the table with the desired default values. �new-db-field-with-default�W�98)z%s AddField with default valuer zKUsed when Pylint detects migrations adding new fields with a default value.c �\ � t |� � r| j � |� � d S d S �N)r �_migration_modules�append)�self�nodes r �visit_modulez)NewDbFieldWithDefaultChecker.visit_moduleE s9 � ���%�%� 1��#�*�*�4�0�0�0�0�0� 1� 1r c � � |� � � j }n# Y d S xY wt |� � sd S t |� � rD|| j vr g | j |<