bg dZddlmZddlmZmZmZmZddlm Z ddl m Z ddl m Z ddlmZddlmZmZd ed d d ed d d eddd eddiZdZdZdZGdde ZdS)zModels.)Const)Assign AssignNameClassDef FunctionDef) 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|try|jdkrn|D]Y}t|ts|jdjdks/t|jtsJ|jjrdSZdS)NMetarabstractTF) isinstancername get_childrenrtargetsvaluer)node meta_childs n/builddir/build/BUILD/cloudlinux-venv-1.0.7/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  5cf|jdS|jjD]}t|dddkrdSdS)NFrpython_2_unicode_compatibleT) decoratorsnodesgetattr)r decorators r*_has_python_2_unicode_compatible_decoratorr'6sO u_* 9fd + +/L L L44 M 5r cb|jdkrdS|jdkrt|jrdSdS)N __unicode__T__str__F)rr'parent)methods r,_is_unicode_or_str_in_python_2_compatibilityr-As; {m##t {i$Nv}$]$]t 5r cFeZdZdZeZdZeZe ddZ dS) ModelCheckerzDjango model checker.zdjango-model-checkerrct|ddsdS|D]-}t|rdSt|trt |}t|dt sg|dj}|dkr{|d}|d}| rdS| dtd|j| dSt|tr;|jdkr0tr&| d td |j| dS/|D]E}|j|kr8t!|r)| d td |j| dSFt#|rdStrdS| d td|j| dS) zClass visitor.zdjango.db.models.base.Modelz.ModelNrr)rr)argsrrrr)r rrrrlistrrinferredcallable add_messager rr methodsr+r-r')selfrchild grandchildrenr grandchildassignedr,s rvisit_classdefzModelChecker.visit_classdefSs &CXNN  F&&((  E%e,, %((  $U%7%7%9%9 : : !-"2J??$Q',=((*1- %..003$$&&FF  Wtyt LLL%-- %* 2M2MQ$$____494$PPP llnn  F}$$)UV\)])]$  Wtyt LLL 6d ; ;  F   F WtytDDDDDr N) __name__ __module__ __qualname____doc__r __implements__rMESSAGESmsgsr r=r rr/r/KsS$N !D D^+,,4E4E-,4E4E4Er r/N)rAastroidr astroid.nodesrrrrpylint.checkersrpylint.checkers.utilsr pylint.interfacesr pylint_django.__pkginfo__r pylint_django.utilsr r rCrr'r-r/rEr rrMsZ CCCCCCCCCCCC''''''000000------------55555555OOO OOO OOO OOO! 2$=E=E=E=E=E;=E=E=E=E=Er