six

Utilities for writing code that runs on Python 2 and 3

Module Contents

Classes

X()
_LazyDescr(self,name)
MovedModule(self,name,old,new=None)
_LazyModule(self,name)
MovedAttribute(self,name,old_mod,new_mod,old_attr=None,new_attr=None)
_SixMetaPathImporter(self,six_module_name) A meta path importer to import six.moves and its submodules.
_MovedItems() Lazy loading of moved objects
Module_six_moves_urllib_parse() Lazy loading of moved objects in six.moves.urllib_parse
Module_six_moves_urllib_error() Lazy loading of moved objects in six.moves.urllib_error
Module_six_moves_urllib_request() Lazy loading of moved objects in six.moves.urllib_request
Module_six_moves_urllib_response() Lazy loading of moved objects in six.moves.urllib_response
Module_six_moves_urllib_robotparser() Lazy loading of moved objects in six.moves.urllib_robotparser
Module_six_moves_urllib() Create a six.moves.urllib namespace that resembles the Python 3 namespace
Iterator()

Functions

_add_doc(func,doc) Add documentation to a function.
_import_module(name) Import module, returning the module after the last dot.
add_move(move) Add an item to six.moves.
remove_move(name) Remove item from six.moves.
advance_iterator(it)
callable(obj)
get_unbound_function(unbound)
get_unbound_function(unbound)
create_bound_method(func,obj)
iterkeys(d,**kw)
itervalues(d,**kw)
iteritems(d,**kw)
iterlists(d,**kw)
iterkeys(d,**kw)
itervalues(d,**kw)
iteritems(d,**kw)
iterlists(d,**kw)
b(s)
u(s)
int2byte(i)
b(s)
u(s)
byte2int(bs)
indexbytes(buf,i)
iterbytes(buf)
reraise(tp,value,tb=None)
exec_(_code_,_globs_=None,_locs_=None) Execute code in a namespace.
print_(*args,**kwargs) The new-style print function for Python 2.4 and 2.5.
wraps(wrapped,assigned=None,updated=None)
with_metaclass(meta,*bases) Create a base class with a metaclass.
add_metaclass(metaclass) Class decorator for creating a class with a metaclass.
class X
__len__()
_add_doc(func, doc)

Add documentation to a function.

_import_module(name)

Import module, returning the module after the last dot.

class _LazyDescr(name)
__init__(name)
__get__(obj, tp)
class MovedModule(name, old, new=None)
__init__(name, old, new=None)
_resolve()
__getattr__(attr)
class _LazyModule(name)
__init__(name)
__dir__()
class MovedAttribute(name, old_mod, new_mod, old_attr=None, new_attr=None)
__init__(name, old_mod, new_mod, old_attr=None, new_attr=None)
_resolve()
class _SixMetaPathImporter(six_module_name)

A meta path importer to import six.moves and its submodules.

This class implements a PEP302 finder and loader. It should be compatible with Python 2.5 and all existing versions of Python3

__init__(six_module_name)
_add_module(mod, *fullnames)
_get_module(fullname)
find_module(fullname, path=None)
__get_module(fullname)
load_module(fullname)
is_package(fullname)

Return true, if the named module is a package.

We need this method to get correct spec objects with Python 3.4 (see PEP451)

get_code(fullname)

Return None

Required, if is_package is implemented

class _MovedItems

Lazy loading of moved objects

class Module_six_moves_urllib_parse

Lazy loading of moved objects in six.moves.urllib_parse

class Module_six_moves_urllib_error

Lazy loading of moved objects in six.moves.urllib_error

class Module_six_moves_urllib_request

Lazy loading of moved objects in six.moves.urllib_request

class Module_six_moves_urllib_response

Lazy loading of moved objects in six.moves.urllib_response

class Module_six_moves_urllib_robotparser

Lazy loading of moved objects in six.moves.urllib_robotparser

class Module_six_moves_urllib

Create a six.moves.urllib namespace that resembles the Python 3 namespace

__dir__()
add_move(move)

Add an item to six.moves.

remove_move(name)

Remove item from six.moves.

advance_iterator(it)
callable(obj)
get_unbound_function(unbound)
get_unbound_function(unbound)
create_bound_method(func, obj)
class Iterator
next()
iterkeys(d, **kw)
itervalues(d, **kw)
iteritems(d, **kw)
iterlists(d, **kw)
iterkeys(d, **kw)
itervalues(d, **kw)
iteritems(d, **kw)
iterlists(d, **kw)
b(s)
u(s)
int2byte(i)
b(s)
u(s)
byte2int(bs)
indexbytes(buf, i)
iterbytes(buf)
reraise(tp, value, tb=None)
exec_(_code_, _globs_=None, _locs_=None)

Execute code in a namespace.

print_(*args, **kwargs)

The new-style print function for Python 2.4 and 2.5.

wraps(wrapped, assigned=None, updated=None)
with_metaclass(meta, *bases)

Create a base class with a metaclass.

add_metaclass(metaclass)

Class decorator for creating a class with a metaclass.