Package ldaptor :: Module compat
[hide private]
[frames] | no frames]

Module compat

source code

passlib.utils.compat - python 2/3 compatibility helpers

Classes [hide private]
  unicode
unicode(object='') -> unicode object unicode(string[, encoding[, errors]]) -> unicode object
  bytes
str(object='') -> string
  base_string_types
Type basestring cannot be instantiated; it is the base for str and unicode.
  irange
xrange(stop) -> xrange object xrange(start, stop[, step]) -> xrange object
  imap
imap(func, *iterables) --> imap object
  _LazyOverlayModule
proxy module which overlays original module, and lazily imports specified attributes.
  SafeConfigParser
  __class__
proxy module which overlays original module, and lazily imports specified attributes.
Functions [hide private]
 
add_doc(obj, doc)
add docstring to an object
source code
 
u(s) source code
 
b(s) source code
unicode
join_unicode(S, iterable)
Return a string which is the concatenation of the strings in the iterable.
source code
string
join_bytes(S, iterable)
Return a string which is the concatenation of the strings in the iterable.
source code
 
uascii_to_str(s)
helper to convert ascii unicode -> native str
source code
 
bascii_to_str(s)
helper to convert ascii bytes -> native str
source code
 
str_to_uascii(s)
helper to convert ascii native str -> unicode
source code
 
str_to_bascii(s)
helper to convert ascii native str -> bytes
source code
 
join_byte_values(values) source code
string
join_byte_elems(S, iterable)
Return a string which is the concatenation of the strings in the iterable.
source code
integer
byte_elem_value(c)
Return the integer ordinal of a one-character string.
 
iter_byte_values(s)
iterate over byte string as sequence of ints 0-255
source code
 
iter_byte_chars(s)
iterate over byte string as sequence of 1-byte strings
source code
list
lmap(function, sequence, sequence=..., ...)
Return a list of the results of applying the function to the items of the argument sequence(s).
 
iteritems(d) source code
 
itervalues(d) source code
 
next(iterator, default=...)
Return the next item from the iterator.
bool
callable(object)
Return whether the object is callable (i.e., some kind of function).
 
exc_err()
return current error object (to avoid try/except syntax change)
source code
 
get_method_function(func)
given (potential) method, return underlying function
source code
 
print_(*args, **kwds)
The new-style print function.
source code
 
_import_object(source)
helper to import object from module; accept format `path.to.object`
source code
 
BytesIO(s=...)
Return a StringIO-like stream for reading or writing
 
NativeStringIO(s=...)
Return a StringIO-like stream for reading or writing
 
__dir__() source code
 
__format__(...)
default object formatter
source code
 
__getattr__(attr) source code
 
__init__(name, attrmap, proxy=None) source code
a new object with type S, a subtype of T
__new__(T, S, ...) source code
 
__reduce__(...)
helper for pickle
source code
 
__reduce_ex__(...)
helper for pickle
source code
 
__repr__() source code
int
__sizeof__()
size of object in memory, in bytes
source code
 
__subclasshook__(...)
Abstract classes can override this to customize issubclass().
source code
Variables [hide private]
  PY2 = True
  PY3 = False
  PY_MAX_25 = False
  PY27 = True
  PY_MIN_32 = False
  PYPY = False
  JYTHON = False
  SUPPORTS_DIR_METHOD = True
  log = logging.getLogger(__name__)
  int_types = (<type 'int'>, <type 'long'>)
  num_types = (<type 'int'>, <type 'long'>, <type 'float'>)
  next_method_attr = 'next'
  _undef = object()
  method_function_attr = 'im_func'
  _lazy_attrs = {'BytesIO': 'cStringIO.StringIO', 'NativeStringI...
  _LazyOverlayModule__attrmap = {'BytesIO': 'cStringIO.StringIO'...
  _LazyOverlayModule__log = logging.getLogger(__name__)
  __delattr__ = <method-wrapper '__delattr__' of _LazyOverlayMod...
  __dict__ = {'BytesIO': <built-in function StringIO>, 'NativeSt...
  __getattribute__ = <method-wrapper '__getattribute__' of _Lazy...
  __hash__ = <method-wrapper '__hash__' of _LazyOverlayModule ob...
  __module__ = 'ldaptor.compat'
  __package__ = 'ldaptor'
  __setattr__ = <method-wrapper '__setattr__' of _LazyOverlayMod...
  __str__ = <method-wrapper '__str__' of _LazyOverlayModule obje...
  __weakref__ = None
hash(x)
Function Details [hide private]

join_unicode(S, iterable)

source code 

Return a string which is the concatenation of the strings in the iterable. The separator between elements is S.

Returns: unicode

join_bytes(S, iterable)

source code 

Return a string which is the concatenation of the strings in the iterable. The separator between elements is S.

Returns: string

join_byte_elems(S, iterable)

source code 

Return a string which is the concatenation of the strings in the iterable. The separator between elements is S.

Returns: string

lmap(function, sequence, sequence=..., ...)

 

Return a list of the results of applying the function to the items of the argument sequence(s). If more than one sequence is given, the function is called with an argument list consisting of the corresponding item of each sequence, substituting None for missing values when not all sequences have the same length. If the function is None, return a list of the items of the sequence (or a list of tuples if more than one sequence).

Returns: list

next(iterator, default=...)

 

Return the next item from the iterator. If default is given and the iterator is exhausted, it is returned instead of raising StopIteration.

callable(object)

 

Return whether the object is callable (i.e., some kind of function). Note that classes are callable, as are instances with a __call__() method.

Returns: bool

__subclasshook__(...)

source code 

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).


Variables Details [hide private]

_lazy_attrs

Value:
{'BytesIO': 'cStringIO.StringIO',
 'NativeStringIO': 'cStringIO.StringIO',
 'SafeConfigParser': 'ConfigParser.SafeConfigParser',
 'UnicodeIO': 'StringIO.StringIO'}

_LazyOverlayModule__attrmap

Value:
{'BytesIO': 'cStringIO.StringIO',
 'NativeStringIO': 'cStringIO.StringIO',
 'SafeConfigParser': 'ConfigParser.SafeConfigParser',
 'UnicodeIO': 'StringIO.StringIO'}

__delattr__

Value:
<method-wrapper '__delattr__' of _LazyOverlayModule object at 0x931f1a\
c>

__dict__

Value:
{'BytesIO': <built-in function StringIO>,
 'NativeStringIO': <built-in function StringIO>,
 'SafeConfigParser': <class ConfigParser.SafeConfigParser at 0xf71dce0\
c>,
 'UnicodeIO': <class StringIO.StringIO at 0xf700f3bc>,
 '_LazyOverlayModule__attrmap': {'BytesIO': 'cStringIO.StringIO',
                                 'NativeStringIO': 'cStringIO.StringIO\
',
...

__getattribute__

Value:
<method-wrapper '__getattribute__' of _LazyOverlayModule object at 0x9\
31f1ac>

__hash__

Value:
<method-wrapper '__hash__' of _LazyOverlayModule object at 0x931f1ac>

__setattr__

Value:
<method-wrapper '__setattr__' of _LazyOverlayModule object at 0x931f1a\
c>

__str__

Value:
<method-wrapper '__str__' of _LazyOverlayModule object at 0x931f1ac>