
    8Cf!                        d dl mZ d dlmZmZ d dlmZmZmZm	Z	 d dl
mZ d dlmZ d dlmZ  G d d      Z G d d	e      Z G d
 de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Zy)    )annotations)ArgumentParser_ArgumentGroup)ListOptionalTypeUnion)__version__)HTTPc                  f    e Zd ZU ded<   ded<   g Zded<   ddZddZedd	       Zd
ddZ	ddZ
y)GroupOptional[str]namez%Union[ArgumentParser, _ArgumentGroup]	containerzList[Type[Group]]	_registryc                B    t         j                  j                  |        y N)r   r   append)clss    S/var/www/highfloat_scraper/venv/lib/python3.12/site-packages/sanic/cli/arguments.py__init_subclass__zGroup.__init_subclass__   s    s#    c                    || _         |r%| j                   j                  d|       | _        y | j                   | _        y )Nz  )title)parseradd_argument_groupr   )selfr   r   s      r   __init__zGroup.__init__   s6    ![[;;Bug,;ODN![[DNr   c                ,     | || j                         }|S r   )r   )r   r   instances      r   createzGroup.create   s    vsxx(r   F)nullablec                  | j                   j                         }|d   j                         |d<    |j                  |ddi| d|d   j	                          j                         |d<    |j                  d|d   dd  z   g|dd  dd	i| |r-|d   dd  j                  d
d      d i} |j                  di | y y )Nhelpaction
store_truezno z--no-r         store_false-_ )r   add_mutually_exclusive_group
capitalizeadd_argumentlowerreplaceset_defaults)r   r"   argskwargsgroupparamss         r   add_bool_argumentszGroup.add_bool_arguments!   s    ;;=224vD@@@vf~33567BBDvd1gabk!	
$(H	
5B	
FL	
 1gabk))#s3T:FE(( r   c                     y r   r,   r   r3   s     r   preparezGroup.prepare-   s    r   N)returnNone)r   r   r   r   )r   r   )__name__
__module____qualname____annotations__r   r   r   classmethodr!   r7   r:   r,   r   r   r   r      sF    
44#%I %$)   27 
)r   r   c                      e Zd ZdZd Zy)GeneralGroupNc                    | j                   j                  dddt         dt                | j                   j                  dd       y )	Nz	--versionversionzSanic z
; Routing )r%   rE   targeta  Path to your Sanic app instance.
	Example: path.to.server:app
If running a Simple Server, path to directory to serve.
	Example: ./
Additionally, this can be a path to a factory function
that returns a Sanic app instance.
	Example: path.to.server:create_app
r$   )r   r/   r
   __routing_version__r   s    r   attachzGeneralGroup.attach4   sR    ##[M4G3HI 	$ 	
 	##9 	$ 	
r   r=   r>   r?   r   rJ   r,   r   r   rC   rC   1   s    D
r   rC   c                      e Zd ZdZd Zy)ApplicationGroupApplicationc                    | j                   j                         }|j                  ddd       |j                  ddddd	       | j                  d
d       y )Nz	--factoryr&   zFTreat app as an application factory, i.e. a () -> <Sanic app> callabler%   r$   z-sz--simplesimplezaRun Sanic as a Simple Server, and serve the contents of a directory
(module arg should be a path)destr%   r$   z--replz0Run the server with an interactive shell sessionrG   )r   r-   r/   r7   r   r5   s     r   rJ   zApplicationGroup.attachL   ss    ;;=4	 	 	
 	= 	 		
 	C 	  	
r   NrK   r,   r   r   rM   rM   I   s    D
r   rM   c                      e Zd ZdZd Zd Zy)HTTPVersionGroupzHTTP versionc                B   t         j                  j                         D cg c]  }|j                   }}| j                  j                  ddd|t        d       | j                  j                  ddddd	
       | j                  j                  ddddd
       y c c}w )Nz--httphttpr   zZWhich HTTP version to use: HTTP/1.1 or HTTP/3. Value should
be either 1, or 3. [default 1])rS   r%   choicestyper$   z-1append_constr(   zRun Sanic server using HTTP/1.1)rS   r%   constr$   z-3   zRun Sanic server using HTTP/3)r   __members__valuesvaluer   r/   int)r   rX   http_valuess      r   rJ   zHTTPVersionGroup.attachi   s    .2.>.>.E.E.GHdtzzHH##1 	$ 
	
 	##!3 	$ 	
 	##!1 	$ 	
) Is   Bc           
         |j                   sdg|_         t        t        t        t	        t
        |j                               d            |_         y )Nr(   T)reverse)rX   tuplesortedsetmapr   r9   s     r   r:   zHTTPVersionGroup.prepare   s5    yyDI&Styy%9!:DIJ	r   N)r=   r>   r?   r   rJ   r:   r,   r   r   rV   rV   f   s    D
:Kr   rV   c                      e Zd ZdZd Zy)SocketGroupzSocket bindingc                    | j                   j                  dddt        d       | j                   j                  dddt        d	       | j                   j                  d
ddt        dd       y )Nz-Hz--hosthostz Host address [default 127.0.0.1]rS   rZ   r$   z-pz--portportzPort to serve on [default 8000]z-uz--unixunix zlocation of unix socketrS   rZ   defaultr$   )r   r/   strra   rI   s    r   rJ   zSocketGroup.attach   s{    ##3 	$ 	
 	##2 	$ 	
 	##* 	$ 	
r   NrK   r,   r   r   rj   rj      s    D
r   rj   c                      e Zd ZdZd Zy)TLSGroupzTLS certificatec                   | j                   j                  ddt        d       | j                   j                  ddt        d       | j                   j                  dd	t        d
d       | j                   j                  dddd       y )Nz--certcertz3Location of fullchain.pem, bundle.crt or equivalentrm   z--keykeyz/Location of privkey.pem or equivalent .key filez--tlsDIRr   zyTLS certificate folder with fullchain.pem and privkey.pem
May be specified multiple times to choose multiple certificates)metavarrZ   r%   r$   z--tls-strict-hosttlshostr&   z9Only allow clients that send an SNI matching server certsrR   )r   r/   rs   rI   s    r   rJ   zTLSGroup.attach   s    ##F	 	$ 	
 	##B	 	$ 	
 	## 	$ 
	
 	##L	 	$ 	
r   NrK   r,   r   r   ru   ru      s    D
r   ru   c                      e Zd ZdZd Zy)WorkerGroupWorkerc                    | j                   j                         }|j                  dddt        dd       |j                  ddd	d
       |j                  ddd	d       | j	                  dddd        y )Nz-wz	--workersworkersr(   z&Number of worker processes [default 1]rq   z--fastfastr&   z(Set the number of workers to max allowedrR   z--single-processsinglez:Do not use multiprocessing, run server in a single processz--access-logs
access_logzdisplay access logs)rS   r$   rr   )r   r-   r/   ra   r7   rT   s     r   rJ   zWorkerGroup.attach   s    ;;=9 	 	
 	;	 	 	
 	M	 	 	
 	&	 	  	
r   NrK   r,   r   r   r}   r}      s    D
r   r}   c                      e Zd ZdZd Zy)DevelopmentGroupDevelopmentc                B   | j                   j                  dddd       | j                   j                  dddd	dd
       | j                   j                  ddddd       | j                   j                  ddddd       | j                   j                  dddd       y )Nz--debugdebugr&   zRun the server in debug moderR   z-rz--reloadz--auto-reloadauto_reloadz=Watch source directory for file changes and reload on changesz-Rz--reload-dirpathr   z0Extra directories to watch and reload on changesz-dz--devdevzdebug + auto reloadz
--auto-tlsauto_tlszUCreate a temporary TLS certificate for local development (requires mkcert or trustme))r   r/   rI   s    r   rJ   zDevelopmentGroup.attach   s    ##/	 	$ 	
 	## 	$ 
	
 	##C 	$ 	
 	##' 	$ 	
 	##/ 	$ 	
r   NrK   r,   r   r   r   r      s    D(
r   r   c                      e Zd ZdZd Zy)OutputGroupOutputc                    | j                  dddd       | j                  dddd	       | j                  j                  d
ddd       | j                  ddd       y )Nz--coffeecoffeeFzUhm, coffee?)rS   rr   r$   z--motdmotdTzShow the startup displayz-vz--verbositycountz;Control logging noise, eg. -vv or --verbosity=2 [default 0]rP   z--noisy-exceptionsnoisy_exceptionsz&Output stack traces for all exceptions)rS   r$   )r7   r   r/   rI   s    r   rJ   zOutputGroup.attach  s    	 	  	
 	+	 	  	
 	##N	 	$ 	
 	 #9 	  	
r   NrK   r,   r   r   r   r     s    D
r   r   N)
__future__r   argparser   r   typingr   r   r   r	   sanic_routingr
   rH   sanicsanic.http.constantsr   r   rC   rM   rV   rj   ru   r}   r   r   r,   r   r   <module>r      s    " 3 . . <  %" "J
5 
0
u 
:#Ku #KL
% 
8 
u  
F
% 
B+
u +
\
% 
r   