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

Module compat'

source code

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

Classes [hide private]
  _LazyOverlayModule
proxy module which overlays original module, and lazily imports specified attributes.
  base_string_types
Type basestring cannot be instantiated; it is the base for str and unicode.
  bytes
str(object='') -> string
  imap
imap(func, *iterables) --> imap object
  irange
xrange(stop) -> xrange object xrange(start, stop[, step]) -> xrange object
  unicode
unicode(object='') -> unicode object unicode(string[, encoding[, errors]]) -> unicode object
Functions [hide private]
 
_import_object(source)
helper to import object from module; accept format `path.to.object`
source code
 
add_doc(obj, doc)
add docstring to an object
source code
 
b(s) source code
 
bascii_to_str(s)
helper to convert ascii bytes -> native str
source code
integer
byte_elem_value(c)
Return the integer ordinal of a one-character string.
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
 
iter_byte_chars(s)
iterate over byte string as sequence of 1-byte strings
source code
 
iter_byte_values(s)
iterate over byte string as sequence of ints 0-255
source code
 
iteritems(d) source code
 
itervalues(d) source code
string
join_byte_elems(S, iterable)
Return a string which is the concatenation of the strings in the iterable.
source code
 
join_byte_values(values) source code
string
join_bytes(S, iterable)
Return a string which is the concatenation of the strings in the iterable.
source code
unicode
join_unicode(S, iterable)
Return a string which is the concatenation of the strings in the iterable.
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).
 
next(iterator, default=...)
Return the next item from the iterator.
 
print_(*args, **kwds)
The new-style print function.
source code
 
str_to_bascii(s)
helper to convert ascii native str -> bytes
source code
 
str_to_uascii(s)
helper to convert ascii native str -> unicode
source code
 
u(s) source code
 
uascii_to_str(s)
helper to convert ascii unicode -> native str
source code
Variables [hide private]
  JYTHON = False
  PY2 = True
  PY27 = True
  PY3 = False
  PYPY = False
  PY_MAX_25 = False
  PY_MIN_32 = False
  SUPPORTS_DIR_METHOD = True
  __package__ = 'ldaptor'
  _lazy_attrs = {'BytesIO': 'cStringIO.StringIO', 'NativeStringI...
  int_types = (<type 'int'>, <type 'long'>)
  log = logging.getLogger(__name__)
  method_function_attr = 'im_func'
  next_method_attr = 'next'
  num_types = (<type 'int'>, <type 'long'>, <type 'float'>)
Function Details [hide private]

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

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

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_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

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.


Variables Details [hide private]

_lazy_attrs

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