bgrddlmZddlZddlmZddlmZddlmZddl m Z ddl m Z Gdd eZ dS) )absolute_importN) BaseChecker)check_messages)IAstroidChecker)BASE_ID) foreignkeyceZdZdZdZefZdZdddddd ffZd e d d d efde d diZ fdZ dZ e d dZxZS)ForeignKeyStringsCheckera< Adds transforms to be able to do type inference for model ForeignKeyField properties which use a string to name the foreign relationship. This uses Django's model name resolution and this checker wraps the setup to ensure Django is able to configure itself before attempting to use the lookups. a/Finding foreign-key relationships from strings in pylint-django requires configuring Django. This can be done via the DJANGO_SETTINGS_MODULE environment variable or the pylint option django-settings-module, eg: `pylint --load-plugins=pylint_django --django-settings-module=myproject.settings` . This can also be set as an option in a .pylintrc configuration file. Some basic default settings were used, however this will lead to less accurate linting. Consider passing in an explicit Django configuration file to match your project to improve accuracy.z)Django foreign keys referenced by stringszdjango-settings-moduleNstringzz=A module containing Django settings to be used while linting.)defaulttypemetavarhelpE10zxDjango was not configured. For more information run pylint --load-plugins=pylint_django --help-msg=django-not-configureddjango-not-configuredF)z/Provided Django settings %s could not be loaded django-settings-module-not-foundz@The provided Django settings module %s was not found on the pathcHtj|i|d|_dS)NF)super__init___raise_warning)selfargskwargs __class__s {/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/pylint_django/checkers/foreign_key_strings.pyrz!ForeignKeyStringsChecker.__init__=s-$)&)))#c ddlm}n#t$rYdSwxYw ddl}|ddlm}n#|$r|jj6d|_ ddl m }| |n ddl m }m }| ||jj|n_#t$rR|d|jjddl m }| |YnwxYwYnwxYwt!jt$jdS) Nr)ImproperlyConfigured)appsT)settings)Settingsr"r)r)django.core.exceptionsr ModuleNotFoundErrordjangosetup django.appsr!configdjango_settings_moduler django.confr" configurer# ImportError add_messager add_transformastroidMANAGER)rr r&r!r"r#s ropenzForeignKeyStringsChecker.openAs"        #    FF . # MMM LLNNN        $% #% #% #{19&*#""$$$ # &&xx 0R'S'STTTLLNNNN" # # #$$:![?% &&(((LLNNNNN #1% #P  11111sB :AD)ACD)AD# D)"D##D)(D)cT|jr |d|d|_dSdS)Nr)nodeF)rr.)rr4s r visit_modulez%ForeignKeyStringsChecker.visit_modules?   (   44  @ @ @"'D    ( (r)__name__ __module__ __qualname____doc__ _LONG_MESSAGEr__implements__nameoptionsrmsgsrr2rr5 __classcell__)rs@rr r shM&'N 6D % 5W     G G S #   G  D$$$$$I2I2I2^^+,,((-,(((((rr ) __future__rr0pylint.checkersrpylint.checkers.utilsrpylint.interfacesrpylint_django.__pkginfo__rpylint_django.transformsrr rrrGs&&&&&&''''''000000------------//////I(I(I(I(I({I(I(I(I(I(r