File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/cheroot/__pycache__/cli.cpython-310.pyc
Back
o ;j � @ sL d Z ddlZddlZddlZddlZddlmZ ddlm Z ddl mZmZ G dd� d�Z G d d � d e �ZG dd� de �ZG d d� de �ZG dd� d�ZG dd� d�Zdd� Zdd� Zdejdd�ddeddd�dejd d�d!ed"d#�d$d%ed&d'�d$d(ed)d'�d$d*ed+d'�d$d,ed-d'�d$d.ed/d'�d$d0ed1d'�d$d2ed3d'�d4�Zd5d6� ZdS )7a: 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)�suppress)� import_module� )�server�wsgic @ s e Zd ZdZdS )�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 ( s r c @ � e Zd ZdZdd� ZdS )� TCPSocketz TCPSocket.c C s ||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__/ s zTCPSocket.__init__N�r r r r r r r r r r , � r c @ r )� UnixSocketzUnixSocket.c C � || _ dS )�Initialize.Nr )r �pathr r r r = � zUnixSocket.__init__Nr r r r r r : r r c @ r )�AbstractSocketzAbstractSocket.c C s d|� �| _ dS )r � Nr )r Zabstract_socketr r r r E s zAbstractSocket.__init__Nr r r r r r B r r c @ s4 e Zd ZdZedd� �Zdd� Zdd� Zdd � Zd S )�ApplicationzApplication.c C sz |� d�\}}}tt|�|pd�}tt�� t|tj�r't|�W d � S W d � | |�S 1 s4w Y | |�S )z@Read WSGI app/Gateway path string and import application module.�:ZapplicationN) � partition�getattrr r � TypeError� issubclassr ZGateway� GatewayYo)�cls� full_pathZmod_path�_Zapp_pathZappr r r �resolveM s � ��zApplication.resolvec C s t |�std��|| _dS )r zHApplication must be a callable object or cheroot.server.Gateway subclassN)�callabler# �wsgi_app)r r+ r r r r Y s � zApplication.__init__c C s( dd� t |��� D �}|�t | �� |S )z*Return keyword arguments for Server class.c S s( i | ]\}}|� d �s|dur||�qS )r( N)� startswith)�.0�arg�valuer r r � <dictcomp>d s ��z+Application.server_args.<locals>.<dictcomp>)�vars�items�update)r �parsed_args�argsr r r �server_argsb s �zApplication.server_argsc C s t jdi | �|���S )�Server.Nr )r ZServerr6 )r r4 r r r r l s zApplication.serverN) r r r r �classmethodr) r r6 r r r r r r J s r c @ s e Zd ZdZdd� Zdd� ZdS )r% zGateway.c C r )zInit.N)�gateway)r r9 r r r r t r zGatewayYo.__init__c C sL t | �}|d |d<