| Trees | Indices | Help |
|
|---|
|
|
General infrastructure level utilities.
Copyright Schrodinger, LLC. All rights reserved.
|
|||
|
cached_property Decorator that converts a method with a single self argument into a property cached on the instance. |
|||
|
CreateWhenNeeded This class can be used like property() (i.e., it is a descriptor; see section 3.3.2.2 in the python reference). |
|||
|
DecoratorAndContextManager An abstract base class for context managers that can also be used to decorate functions and classes. |
|||
|
OneIndexedList A list that starts at one instead of zero |
|||
|
|||
|
|||
|
|||
|
|||
__package__ =
|
|||
|
|||
Create a context manager that sets the specified class attribute to the
given value and then restores the original value of the attribute when
leaving the context.
Example:
class Foo(object):
_includingStructure = util.flag_context_manager("_including_structure")
def __init__(self):
self._including_structure = False
def includeStructure(proj_row):
with self._includingStructure():
proj_row.in_workspace = project.IN_WORKSPACE
@see: L{skip_if}
@param attr_name: The attribute to set to C{set_to}
@type attr_name: str
@param set_to: The value to set C{attr_name} to
@type set_to: object
|
Create a decorator that converts the decorated method to a no-op if class
attribute C{attr_name} equals C{is_set_to}.
Example:
skip_if_including_structure = util.skip_if("_including_structure")
class Foo(object):
_includingStructure = util.flag_context_manager("_including_structure")
def __init__(self):
self._including_structure = False
def includeStructure(proj_row):
with self._includingStructure():
proj_row.in_workspace = project.IN_WORKSPACE
@skip_if_including_structure
def skipped_method(self):
print ("This method would have been skipped if we were the process "
"of including a structure")
@see: L{flag_context_manager}
@param attr_name: The attribute name to check
@type attr_name: str
@param if_set_to: The decorated method will be skipped if C{attr_name}
equals this value.
@type if_set_to: object
|
| Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Wed Aug 3 07:59:14 2016 | http://epydoc.sourceforge.net |