HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/cheroot/__pycache__/cli.cpython-310.pyc
o

�N�gR�@sXdZddlZddlmZddlZddlZddlZddlmZddlm	Z	ddl
mZeZ
Gdd	�d	�ZGd
d�de�ZGdd
�d
e�ZGdd�de�ZGdd�d�ZGdd�d�Zdd�Zdd�Zdejdd�ddeddd�d ejd!d�d"ed#d$�d%d&ed'd(�d%d)ed*d(�d%d+ed,d(�d%d-ed.d(�d%d/ed0d(�d%d1ed2d(�d%d3ed4d(�d5�Zd6d7�ZdS)8a:Command line tool for starting a Cheroot WSGI/HTTP server instance.

Basic usage:

.. code-block:: shell-session

    $ # Start a server on 127.0.0.1:8000 with the default settings
    $ # for the WSGI app myapp/wsgi.py:application()
    $ cheroot myapp.wsgi

    $ # Start a server on 0.0.0.0:9000 with 8 threads
    $ # for the WSGI app myapp/wsgi.py:main_app()
    $ cheroot myapp.wsgi:main_app --bind 0.0.0.0:9000 --threads 8

    $ # Start a server for the cheroot.server.Gateway subclass
    $ # myapp/gateway.py:HTTPGateway
    $ cheroot myapp.gateway:HTTPGateway

    $ # Start a server on the UNIX socket /var/spool/myapp.sock
    $ cheroot myapp.wsgi --bind /var/spool/myapp.sock

    $ # Start a server on the abstract UNIX socket CherootServer
    $ cheroot myapp.wsgi --bind @CherootServer

.. spelling::

   cli
�N)�
import_module�)�server)�wsgi)�suppressc@seZdZdZdS)�BindLocationz=A class for storing the bind location for a Cheroot instance.N)�__name__�
__module__�__qualname__�__doc__�rr�?/opt/saltstack/salt/lib/python3.10/site-packages/cheroot/cli.pyr-src@�eZdZdZdd�ZdS)�	TCPSocketz
TCPSocket.cCs||f|_dS)zInitialize.

        Args:
            address (str): Host name or IP address
            port (int): TCP port number

        N��	bind_addr)�self�address�portrrr
�__init__4szTCPSocket.__init__N�rr	r
rrrrrr
r1�rc@r)�
UnixSocketzUnixSocket.cC�
||_dS)�Initialize.Nr)r�pathrrr
rB�
zUnixSocket.__init__Nrrrrr
r?rrc@r)�AbstractSocketzAbstractSocket.cCsdj|d�|_dS)rz{sock_path})Z	sock_pathN)�formatr)rZabstract_socketrrr
rJszAbstractSocket.__init__Nrrrrr
rGrrc@s4eZdZdZedd��Zdd�Zdd�Zdd	�Zd
S)�ApplicationzApplication.cCsz|�d�\}}}tt|�|pd�}tt��t|tj�r't|�Wd�SWd�||�S1s4wY||�S)z@Read WSGI app/Gateway path string and import application module.�:ZapplicationN)	�	partition�getattrrr�	TypeError�
issubclassrZGateway�	GatewayYo)�cls�	full_pathZmod_path�_Zapp_pathZapprrr
�resolveRs
�
��zApplication.resolvecCst|�std��||_dS)rzHApplication must be a callable object or cheroot.server.Gateway subclassN)�callabler#�wsgi_app)rr+rrr
r^s
�
zApplication.__init__cCs(dd�t|���D�}|�t|��|S)z%Return keyword args for Server class.cSs(i|]\}}|�d�s|dur||�qS)r(N)�
startswith)�.0�arg�valuerrr
�
<dictcomp>is��z+Application.server_args.<locals>.<dictcomp>)�vars�items�update)r�parsed_args�argsrrr
�server_argsgs

�zApplication.server_argscCstjdi|�|���S)�Server.Nr)rZServerr6)rr4rrr
rqszApplication.serverN)	rr	r
r�classmethodr)rr6rrrrr
rOs
	
rc@s eZdZdZdd�Zdd�ZdS)r%zGateway.cCr)zInit.N)�gateway)rr9rrr
ryrzGatewayYo.__init__cCsLt|�}|d|d<|jdur|j|d<|jdur|j|d<tjdi|��S)r7rNZ
maxthreadsZ
minthreadsr)r1�max�
numthreadsrZ
HTTPServer)rr4r6rrr
r}s



zGatewayYo.serverN)rr	r
rrrrrrr
r%vsr%cCs||�d�r
t|dd��Stjjj�dj|d��}z|j}|j	}|dus(|dur.t
||�WSWn	ty8Ynwt|d�S)z.Convert bind address string to a BindLocation.�@rNz//{addr})�addr)r)
r,r�sixZmoves�urllib�parse�urlparser�hostnamerr�
ValueErrorr)�bind_addr_string�matchr=rrrr
�parse_wsgi_bind_location�s


���
rFcCs
t|�jS)z6Convert bind address string to bind address parameter.)rFr)rDrrr
�parse_wsgi_bind_addr�rrGZ
APP_MODULEz<WSGI application callable or cheroot.server.Gateway subclass)�metavar�type�helpZADDRESSrz
[::1]:8000z4Network interface to listen on (default: [::1]:8000))rH�destrI�defaultrJ�PATHzSet the working directoryZserver_namez7Web server name to be advertised via Server HTTP header)rKrIrJZINTr;z Minimum number of worker threads)rHrKrIrJr:z Maximum number of worker threads�timeoutz+Timeout in seconds for accepted connectionsZshutdown_timeoutz:Time in seconds to wait for worker threads to cleanly exitZrequest_queue_sizez$Maximum number of queued connectionsZaccepted_queue_sizez*Maximum number of active requests in queueZaccepted_queue_timeoutz2Timeout in seconds for putting requests into queue)�	_wsgi_appz--bindz--chdirz
--server-namez	--threadsz
--max-threadsz	--timeoutz--shutdown-timeoutz--request-queue-sizez--accepted-queue-sizez--accepted-queue-timeoutcCsztjdd�}t��D]
\}}|j|fi|��q
|��}dtjvp2tj�dd�|j	�
|���dS|j	�
|���dS)zCCreate a new Cheroot instance with arguments from the command line.z2Start an instance of the Cheroot WSGI/HTTP server.)�description�rN)�argparse�ArgumentParser�	_arg_specr2�add_argument�
parse_args�sysr�insertrOrZ
safe_start)�parserr.�specZraw_argsrrr
�main�s��r[)rrR�	importlibr�osrWr>rQrrZ_compatrrIZ
__metaclass__rrrrrr%rFrGr)�chdir�str�intrTr[rrrr
�<module>s�'������������D