Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/cherrypy/process/__pycache__/wspbus.cpython-39.pyc
Ðазад
a v�h�S � @ sL d Z ddlZzddlZW n ey. dZY n0 ddlZddlZddlZddlZddlZddl Z ddlZddlZddl Z ddlmZ e�� ZG dd� de�ZG dd� de�Ze� Ze�� e_e�� e_e�� e_e�� e_e�� e_zddlZW n e�y dZY n*0 ze�d�ZW n e �y0 d ZY n0 G d d� de�Z!e!� Z"dS )a� An implementation of the Web Site Process Bus. This module is completely standalone, depending only on the stdlib. Web Site Process Bus -------------------- A Bus object is used to contain and manage site-wide behavior: daemonization, HTTP server start/stop, process reload, signal handling, drop privileges, PID file management, logging for all of these, and many more. In addition, a Bus object provides a place for each web framework to register code that runs in response to site-wide events (like process start and stop), or which controls or otherwise interacts with the site-wide components mentioned above. For example, a framework which uses file-based templates would add known template filenames to an autoreload component. Ideally, a Bus object will be flexible enough to be useful in a variety of invocation scenarios: 1. The deployer starts a site from the command line via a framework-neutral deployment script; applications from multiple frameworks are mixed in a single site. Command-line arguments and configuration files are used to define site-wide components such as the HTTP server, WSGI component graph, autoreload behavior, signal handling, etc. 2. The deployer starts a site via some other process, such as Apache; applications from multiple frameworks are mixed in a single site. Autoreload and signal handling (from Python at least) are disabled. 3. The deployer starts a site via a framework-specific mechanism; for example, when running tests, exploring tutorials, or deploying single applications from a single framework. The framework controls which site-wide components are enabled as it sees fit. The Bus object in this package uses topic-based publish-subscribe messaging to accomplish all this. A few topic channels are built in ('start', 'stop', 'exit', 'graceful', 'log', and 'main'). Frameworks and site containers are free to define their own. If a message is sent to a channel that has not been defined or has no listeners, there is no effect. In general, there should only ever be a single Bus object per process. Frameworks and site containers share a single Bus object by publishing messages and subscribing listeners. The Bus object works as a finite state machine which models the current state of the process. Bus methods move it from one state to another; those methods then publish to subscribed listeners on the channel for the new state.:: O | V STOPPING --> STOPPED --> EXITING -> X A A | | \___ | | \ | | V V STARTED <-- STARTING � N)�always_iterablec sL e Zd ZdZdZ� fdd�Zdd� Zdd� Zd d � ZeZ dd� Z e Z� ZS ) �ChannelFailuresz0Exception raised during errors on Bus.publish().� c s"