Utilities to assist in the "flag day" new-style object transition.

Function passthru Return arg. Do nothing.
Function _shouldEnableNewStyle No summary
Function _ensureOldClass Ensure that cls is an old-style class.
Function _oldStyle No summary
def passthru(arg): (source)

Return arg. Do nothing.

ParametersargThe arg to return.
Returnsarg
def _shouldEnableNewStyle(): (source)

Returns whether or not we should enable the new-style conversion of old-style classes. It inspects the environment for TWISTED_NEWSTYLE, accepting an empty string, no, false, False, and 0 as falsey values and everything else as a truthy value.

Returns (type: bool)
def _ensureOldClass(cls): (source)

Ensure that cls is an old-style class.

ParametersclsThe class to check.
ReturnsThe class, if it is an old-style class.
RaisesValueError if it is a new-style class.
@_replaceIf(_PY3, passthru)
@_replaceIf(_shouldEnableNewStyle(), _ensureOldClass)
def _oldStyle(cls): (source)

A decorator which conditionally converts old-style classes to new-style classes. If it is Python 3, or if the TWISTED_NEWSTYLE environment variable has a falsey (no, false, False, or 0) value in the environment, this decorator is a no-op.

ParametersclsAn old-style class to convert to new-style. (type: types.ClassType)
ReturnsA new-style version of cls.
API Documentation for Twisted, generated by pydoctor at 2016-05-18 16:01:36.