qw7>yW d Z ddlmZ ddlmZmZmZmZ ddlm Z ddl mZ ddlm Z ddlmZ ddlmZmZ d e d dde d d de ddde ddiZd Zd Zd Z G d de ZdS )zModels. )Const)Assign AssignNameClassDefFunctionDef)BaseChecker)check_messages)IAstroidChecker)BASE_ID)PY3node_is_subclassE01)z,__unicode__ on a model must be callable (%s)zmodel-unicode-not-callablez3Django models require a callable __unicode__ methodW)z#No __unicode__ method on model (%s)model-missing-unicodezMDjango models should implement a __unicode__ method for string representation02)z=Found __unicode__ method on model (%s). Python3 uses __str__.zmodel-has-unicodezdDjango models should not implement a __unicode__ method for string representation when using Python303)z1Model does not explicitly define __unicode__ (%s)zmodel-no-explicit-unicodezDjango models should implement a __unicode__ method for string representation. A parent class of this model does, but ideally all models should be explicit.c " t | t ry| j dk rn| D ]Y}t |t s|j d j dk s/t |j t sJ|j j r dS ZdS )NMetar abstractTF) isinstancer nameget_childrenr targetsvaluer )node meta_childs o/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib/python3.11/site-packages/pylint_django/checkers/models.py_is_meta_with_abstractr $ s $!! di6&9&9++-- Jj&11 %a(-;;j.66 % tt 5 c f | j dS | j j D ]}t |dd dk r dS dS )NFr python_2_unicode_compatibleT) decoratorsnodesgetattr)r decorators r *_has_python_2_unicode_compatible_decoratorr' 6 sO u_* 9fd++/LLL44 M 5r c b | j dk rdS | j dk rt | j rdS dS )N__unicode__T__str__F)r r' parent)methods r ,_is_unicode_or_str_in_python_2_compatibilityr- A s; {m##t {i$Nv}$]$]t5r c F e Zd ZdZeZdZeZ e d d Z dS )ModelCheckerzDjango model checker.zdjango-model-checkerr c t |dd sdS | D ]-}t | r dS t |t rt | }t |d t sg|d j }|dk r{|d }| d }| r dS | dt d|j | dS t |t r;|j dk r0t r&| d t d|j | dS /| D ]E}|j |k r8t! | r)| d t d|j | dS Ft# | rdS t rdS | d t d|j | dS ) zClass visitor.zdjango.db.models.base.Modelz.ModelNr r) r r )argsr r r r )r r r r r listr r inferredcallableadd_messager r r methodsr+ r- r' )selfr child grandchildrenr grandchildassignedr, s r visit_classdefzModelChecker.visit_classdefS s &CXNN F&&(( E%e,, %(( $U%7%7%9%9 : : !-"2J?? $Q',=((*1- %..003$$&&