AlkantarClanX12
Current Path : /lib64/python3.6/__pycache__/ |
Current File : //lib64/python3.6/__pycache__/contextlib.cpython-36.pyc |
3 \j3 � @ s� d Z ddlZddlZddlZddlmZ ddlmZ ddddd d ddgZG d d� dej �Z G dd� de�ZG dd� dee �Z dd� ZG dd� de �ZG dd� de �ZG dd � d e�ZG dd� de�ZG dd� de �ZG dd � d e �ZdS )z4Utilities for with-statement contexts. See PEP 343.� N)�deque)�wraps�contextmanager�closing�AbstractContextManager�ContextDecorator� ExitStack�redirect_stdout�redirect_stderr�suppressc @ s2 e Zd ZdZdd� Zejdd� �Zedd� �Z dS ) r z,An abstract base class for context managers.c C s | S )z0Return `self` upon entering the runtime context.� )�selfr r �"/usr/lib64/python3.6/contextlib.py� __enter__ s z AbstractContextManager.__enter__c C s dS )z9Raise any exception triggered within the runtime context.Nr )r �exc_type� exc_value� tracebackr r r �__exit__ s zAbstractContextManager.__exit__c C s | t krtj|dd�S tS )Nr r )r �_collections_abc�_check_methods�NotImplemented)�cls�Cr r r �__subclasshook__ s z'AbstractContextManager.__subclasshook__N) �__name__� __module__�__qualname__�__doc__r �abc�abstractmethodr �classmethodr r r r r r s c @ s e Zd ZdZdd� Zdd� ZdS )r zJA base class or mixin that enables context managers to work as decorators.c C s | S )a6 Return a recreated instance of self. Allows an otherwise one-shot context manager like _GeneratorContextManager to support use as a decorator via implicit recreation. This is a private interface just for _GeneratorContextManager. See issue #11647 for details. r )r r r r �_recreate_cm$ s zContextDecorator._recreate_cmc s t � �� �fdd��}|S )Nc s �j � � � | |�S Q R X d S )N)r! )�args�kwds)�funcr r r �inner1 s z(ContextDecorator.__call__.<locals>.inner)r )r r$ r% r )r$ r r �__call__0 s zContextDecorator.__call__N)r r r r r! r&