Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Private Member Functions
contextlib.ContextDecorator Class Reference
Inheritance diagram for contextlib.ContextDecorator:
Inheritance graph
[legend]
Collaboration diagram for contextlib.ContextDecorator:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __call__

Public Attributes

_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type

Private Member Functions

def _recreate_cm

Detailed Description

Definition at line 10 of file contextlib.py.


Member Function Documentation

def contextlib.ContextDecorator.__call__ (   self,
  func 
)

Definition at line 25 of file contextlib.py.

00025 
00026     def __call__(self, func):
00027         @wraps(func)
00028         def inner(*args, **kwds):
00029             with self._recreate_cm():
00030                 return func(*args, **kwds)
00031         return inner
00032 

Here is the call graph for this function:

def contextlib.ContextDecorator._recreate_cm (   self) [private]
Return a recreated instance of self.

Allows otherwise one-shot context managers like
_GeneratorContextManager to support use as
decorators via implicit recreation.

Note: this is a private interface just for _GCM in 3.2 but will be
renamed and documented for third party use in 3.3

Reimplemented in contextlib._GeneratorContextManager.

Definition at line 13 of file contextlib.py.

00013 
00014     def _recreate_cm(self):
00015         """Return a recreated instance of self.
00016 
00017         Allows otherwise one-shot context managers like
00018         _GeneratorContextManager to support use as
00019         decorators via implicit recreation.
00020 
00021         Note: this is a private interface just for _GCM in 3.2 but will be
00022         renamed and documented for third party use in 3.3
00023         """
00024         return self

Here is the caller graph for this function:


Member Data Documentation

Definition at line 107 of file object.h.

struct _typeobject* _object::ob_type [inherited]

Definition at line 108 of file object.h.


The documentation for this class was generated from the following file: