Ë
    qûàgÊ  ã                   óŠ   — d dl Zd dlZd dlZd dlZd dlZd dlmZ d dlm	Z	 d dl
mZmZ d dlmZ  G d„ d«      Z G d„ d	e«      Zy)
é    N)Úutil)ÚArbiter)ÚConfigÚget_default_config_file)Údebugc                   óH   — e Zd ZdZdd„Zd„ Zd„ Zd„ Zd„ Zd„ Z	d	„ Z
d
„ Zd„ Zy)ÚBaseApplicationzw
    An application interface for configuring and loading
    the various necessities for any given web framework.
    Nc                 ój   — || _         d | _        d | _        || _        d | _        | j                  «        y ©N)ÚusageÚcfgÚcallableÚprogÚloggerÚdo_load_config)Úselfr   r   s      úO/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/gunicorn/app/base.pyÚ__init__zBaseApplication.__init__   s1   € ØˆŒ
ØˆŒØˆŒØˆŒ	ØˆŒØ×ÑÕó    c                 ó&  — 	 | j                  «        | j                  «        y# t        $ rd}t        dt	        |«      z  t
        j                  ¬«       t
        j                  j                  «        t        j                  d«       Y d}~yd}~ww xY w)z)
        Loads the configuration
        z

Error: %s©Úfileé   N)	Úload_default_configÚload_configÚ	ExceptionÚprintÚstrÚsysÚstderrÚflushÚexit©r   Úes     r   r   zBaseApplication.do_load_config   sc   € ð	Ø×$Ñ$Ô&Ø×ÑÕøÜò 	Ü�-¤# a£&Ñ(¬s¯z©zÕ:Ü�J‰J×ÑÔÜ�H‰H�Q�K‰Kûð	ús   ‚ # £	B¬ABÂBc                 óP   — t        | j                  | j                  ¬«      | _        y )N)r   )r   r   r   r   ©r   s    r   r   z#BaseApplication.load_default_config)   s   € ä˜$Ÿ*™*¨4¯9©9Ô5ˆ�r   c                 ó   — t         ‚r   ©ÚNotImplementedError)r   ÚparserÚoptsÚargss       r   ÚinitzBaseApplication.init-   ó   € Ü!Ð!r   c                 ó   — t         ‚r   r(   r&   s    r   ÚloadzBaseApplication.load0   r.   r   c                 ó   — t         ‚)zÆ
        This method is used to load the configuration from one or several input(s).
        Custom Command line, configuration file.
        You have to override this method in your class.
        r(   r&   s    r   r   zBaseApplication.load_config3   s
   € ô "Ð!r   c                 óz   — | j                  «        | j                  j                  rt        j                  «        y y r   )r   r   Úspewr   r&   s    r   ÚreloadzBaseApplication.reload;   s'   € Ø×ÑÔØ�8‰8�=Š=Ü�J‰J�Lð r   c                 ó\   — | j                   €| j                  «       | _         | j                   S r   )r   r0   r&   s    r   ÚwsgizBaseApplication.wsgi@   s#   € Ø�=‰=Ð Ø ŸI™I›KˆDŒMØ�}‰}Ðr   c                 ó  — 	 t        | «      j                  «        y # t        $ r[}t        d|z  t        j
                  ¬«       t        j
                  j                  «        t	        j                  d«       Y d }~y d }~ww xY w)Nz
Error: %s
r   r   )r   ÚrunÚRuntimeErrorr   r   r    r!   r"   r#   s     r   r8   zBaseApplication.runE   sW   € ð	Ü�D‹M×ÑÕøÜò 	Ü�/ AÑ%¬C¯J©JÕ7Ü�J‰J×ÑÔÜ�H‰H�Q�K‰Kûð	ús   ‚ œ	B ¥AA;Á;B )NN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r-   r0   r   r4   r6   r8   © r   r   r	   r	      s4   „ ñóò
ò6ò"ò"ò"òò
ó
r   r	   c                   óB   ‡ — e Zd Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zˆ fd„Z	ˆ xZ
S )ÚApplicationc                 ó  — t        j                  | j                  j                  «       | j                  j                  t        j                  vr5t        j                  j                  d| j                  j                  «       y y )Nr   )ÚosÚchdirr   r   ÚpathÚinsertr&   s    r   rC   zApplication.chdirS   sM   € ô 	�‰�—‘—‘Ô ð �8‰8�>‰>¤§¡Ñ)Ü�H‰H�O‰O˜A˜tŸx™xŸ~™~Õ.ð *r   c                 óN  — t         j                  j                  |«      st        d|z  «      ‚t         j                  j	                  |«      d   }	 d}|dv r!t
        j                  j                  ||«      }nYd}t        j                  |«       t
        j                  j                  ||«      }t
        j                  j                  |||¬«      }t
        j                  j                  |«      }|t        j                  |<   |j                  j                  |«       t/        |«      S # t         $ rr t#        d|z  t        j$                  ¬«       t'        j(                  «        t        j$                  j+                  «        t        j,                  d«       Y t/        «      S w xY w)	Nz%r doesn't existr   Ú
__config__)z.pyz.pycz9configuration file should have a valid Python extension.
)ÚloaderzFailed to read config file: %sr   )rB   rD   Úexistsr9   ÚsplitextÚ	importlibr   Úspec_from_file_locationÚwarnÚ	machineryÚSourceFileLoaderÚmodule_from_specr   ÚmodulesrH   Úexec_moduler   r   r    Ú	tracebackÚ	print_excr!   r"   Úvars)r   ÚfilenameÚextÚmodule_nameÚspecÚmsgÚloader_Úmods           r   Úget_config_from_filenamez$Application.get_config_from_filename\   s>  € ä�w‰w�~‰~˜hÔ'ÜÐ1°HÑ<Ó=Ð=ä�g‰g×Ñ˜xÓ(¨Ñ+ˆð	Ø&ˆKØ�oÑ%Ü —~‘~×=Ñ=¸kÈ8ÓT‘àR�Ü—	‘	˜#”Ü#×-Ñ-×>Ñ>¸{ÈHÓU�Ü —~‘~×=Ñ=¸kÈ8Ð\cÐ=Ód�Ü—.‘.×1Ñ1°$Ó7ˆCØ'*ŒC�K‰K˜Ñ$Ø�K‰K×#Ñ# CÔ(ô �C‹yÐøô ò 	ÜÐ2°XÑ=ÄCÇJÁJÕOÜ×ÑÔ!Ü�J‰J×ÑÔÜ�H‰H�Q�Kä�C‹yÐð	ús   ÁCD) Ä)A.F$Æ#F$c                 ó>   — t        t        j                  |«      «      S r   )rU   rK   Úimport_module)r   rX   s     r   Úget_config_from_module_namez'Application.get_config_from_module_namew   s   € Ü”I×+Ñ+¨KÓ8Ó9Ð9r   c           	      ó"  — |j                  d«      r |t        d«      d }| j                  |«      }n3|j                  d«      r|t        d«      d }n|}| j                  |«      }|j	                  «       D ]I  \  }}|| j
                  j                  vrŒ	 | j
                  j                  |j                  «       |«       ŒK |S # t        $ rB t        d|›d|›d�t        j                  ¬«       t        j                  j                  «        ‚ w xY w)zÃ
        Loads the configuration file: the file is a python file, otherwise raise an RuntimeError
        Exception or stop the process if the configuration file contains a syntax error.
        zpython:Nzfile:zInvalid value for z: ú
r   )Ú
startswithÚlenr`   r]   Úitemsr   ÚsettingsÚsetÚlowerr   r   r   r    r!   )r   ÚlocationrX   r   rV   ÚkÚvs          r   Ú(load_config_from_module_name_or_filenamez4Application.load_config_from_module_name_or_filenamez   sî   € ð ×Ñ˜yÔ)Ø"¤3 y£> ?Ð3ˆKØ×2Ñ2°;Ó?‰Cà×"Ñ" 7Ô+Ø#¤C¨£L MÐ2‘à#�Ø×/Ñ/°Ó9ˆCà—I‘I“Kò 		‰DˆAˆqà˜Ÿ™×)Ñ)Ñ)ØðØ—‘—‘˜QŸW™W›Y¨Õ*ð		ð ˆ
øô ò Ý²aºÐ;Ä#Ç*Á*ÕMÜ—
‘
× Ñ Ô"Øðús   Â*CÃADc                 ó&   — | j                  |¬«      S )N)ri   )rl   )r   rV   s     r   Úload_config_from_filez!Application.load_config_from_file—   s   € Ø×<Ñ<ÀhÐ<ÓOÐOr   c                 óÖ  — | j                   j                  «       }|j                  «       }| j                  |||j                  «      }| j                  «        |rB|j                  «       D ]/  \  }}| j                   j                  |j                  «       |«       Œ1 |j                  | j                   j                  «       «      }|j                  r| j                  |j                  «       nE|j                  r| j                  |j                  «       nt        «       }|�| j                  |«       t        |«      j                  «       D ]8  \  }}|€Œ	|dk(  rŒ| j                   j                  |j                  «       |«       Œ: t        |«      j                  «       D ]8  \  }}|€Œ	|dk(  rŒ| j                   j                  |j                  «       |«       Œ: | j                  «        y )Nr,   )r   r*   Ú
parse_argsr-   r,   rC   re   rg   rh   Úget_cmd_args_from_envÚconfigrn   r   rU   )r   r*   r,   r   rj   rk   Úenv_argsÚdefault_configs           r   r   zApplication.load_configš   s‰  € à—‘—‘Ó"ˆØ× Ñ Ó"ˆð �i‰i˜  d§i¡iÓ0ˆð 	�
‰
Œñ ØŸ	™	›ò +‘��1Ø—‘—‘˜QŸW™W›Y¨Õ*ð+ð ×$Ñ$ T§X¡X×%CÑ%CÓ%EÓFˆà�;Š;Ø×&Ñ& t§{¡{Õ3Ø�_Š_Ø×&Ñ& x§¡Õ7ä4Ó6ˆNØÐ)Ø×*Ñ*¨>Ô:ô ˜“N×(Ñ(Ó*ò 	'‰DˆAˆqØˆyØØ�FŠ{ØØ�H‰H�L‰L˜Ÿ™› AÕ&ð	'ô ˜“J×$Ñ$Ó&ò 	'‰DˆAˆqØˆyØØ�FŠ{ØØ�H‰H�L‰L˜Ÿ™› AÕ&ð	'ð 	�
‰
�r   c                 óx  •— | j                   j                  rt        | j                   «       | j                   j                  s| j                   j                  r&	 | j	                  «        t        j                  d«       | j                   j                  rt        j                  «        | j                   j                  rft        j                   j#                  d«      rd}t        |t        j                  d¬«       t%        j&                  | j                   j(                  «       | j                   j*                  r~| j                   j*                  j-                  d	«      }|D ]T  }t        j.                  j1                  |«      }|t        j.                  vsŒ5t        j.                  j3                  d|«       ŒV t4        ‰| �m  «        y # t
        $ rh d}t        |t        j                  ¬«       t        j                  «        t        j                  j                  «        t        j                  d«       Y �ŒÎw xY w)
Nz&
Error while loading the application:
r   r   r   ÚNOTIFY_SOCKETz]Warning: you shouldn't specify `daemon = True` when launching by systemd with `Type = notify`T)r   r!   ú,)r   Úprint_configr   Úcheck_configr0   r   r   r    rS   rT   r!   r"   r3   r   ÚdaemonrB   ÚenvironÚgetr   Ú	daemonizeÚenable_stdio_inheritanceÚ
pythonpathÚsplitrD   ÚabspathrE   Úsuperr8   )r   rZ   ÚpathsrD   r   Ú	__class__s        €r   r8   zApplication.runÉ   sj  ø€ Ø�8‰8× Ò Ü�$—(‘(ŒOà�8‰8× Ò  D§H¡H×$9Ò$9ðØ—	‘	”ô �H‰H�QŒKà�8‰8�=Š=Ü�J‰JŒLà�8‰8�?Š?Ü�z‰z�~‰~˜oÔ.ðH�ä�c¤§
¡
°$Õ7ä�N‰N˜4Ÿ8™8×<Ñ<Ô=ð �8‰8×ÒØ—H‘H×'Ñ'×-Ñ-¨cÓ2ˆEØò 3�ÜŸW™WŸ_™_¨TÓ2�
Ø¤S§X¡XÒ-Ü—H‘H—O‘O A zÕ2ð3ô
 	‰‰�øô7 ò Ø@�Ü�c¤§
¡
Õ+Ü×#Ñ#Ô%Ü—
‘
× Ñ Ô"Ü—‘˜—ðús   ÁG ÇA-H9È8H9)r:   r;   r<   rC   r]   r`   rl   rn   r   r8   Ú__classcell__)r„   s   @r   r@   r@   N   s-   ø„ ò
/òò6:òò:Pò-÷^"ð "r   r@   )Úimportlib.utilrK   Úimportlib.machineryrB   r   rS   Úgunicornr   Úgunicorn.arbiterr   Úgunicorn.configr   r   r   r	   r@   r>   r   r   ú<module>r‹      s;   ðó Û Û 	Û 
Û å Ý $ß ;Ý ÷;ñ ;ô|]�/õ ]r   