Repository URL to install this package:
Version:
3.3.29 ▾
|
contego
/
home
/
tvault
/
.virtenv
/
lib
/
python2.7
/
site-packages
/
swiftclient
/
multithreading.pyc
|
---|
ó ~EYc @ s d d l m Z d d l Z d d l Z d d l m Z d d l m Z d e f d YZ d e f d YZ d e f d YZ d S( iÿÿÿÿ( t print_functionN( t ThreadPoolExecutor( t PriorityQueuet OutputManagerc B s e Z d Z d Z d d d Z d Z d Z d Z d Z d Z e e d Z d Z d Z d d Z d d Z d Z RS( s One object to manage and provide helper functions for output. This object is a context manager and returns itself into the context. When entering the context, two printing threads are created (see below) and they are waited on and cleaned up when exiting the context. Also, thread-safe printing to two streams is provided. The :meth:`print_msg` method will print to the supplied ``print_stream`` (defaults to ``sys.stdout``) and the :meth:`error` method will print to the supplied ``error_stream`` (defaults to ``sys.stderr``). Both of these printing methods will format the given string with any supplied ``*args`` (a la printf). On Python 2, Unicode messages are encoded to utf8. The attribute :attr:`self.error_count` is incremented once per error message printed, so an application can tell if any worker threads encountered exceptions or otherwise called :meth:`error` on this instance. The swift command-line tool uses this to exit non-zero if any error strings were printed. i c C sU | p t j | _ t d d | _ | p0 t j | _ t d d | _ d | _ d S( s5 :param print_stream: The stream to which :meth:`print_msg` sends formatted messages. :param error_stream: The stream to which :meth:`error` sends formatted messages. On Python 2, Unicode messages are encoded to utf8. t max_workersi i N( t syst stdoutt print_streamR t print_poolt stderrt error_streamt error_print_poolt error_count( t selfR R ( ( sO /home/tvault/.virtenv/lib/python2.7/site-packages/swiftclient/multithreading.pyt __init__0 s c C s | S( N( ( R ( ( sO /home/tvault/.virtenv/lib/python2.7/site-packages/swiftclient/multithreading.pyt __enter__@ s c C s0 | j j | | | | j j | | | d S( N( R t __exit__R ( R t exc_typet exc_valuet traceback( ( sO /home/tvault/.virtenv/lib/python2.7/site-packages/swiftclient/multithreading.pyR C s c C s | j j | j | | j d S( N( R t submitt _writeR ( R t data( ( sO /home/tvault/.virtenv/lib/python2.7/site-packages/swiftclient/multithreading.pyt print_rawG s c C sM t j r&