circuits.six module

Utilities for writing code that runs on Python 2 and 3

class circuits.six.MovedModule(name, old, new=None)

Bases: _LazyDescr

class circuits.six.MovedAttribute(name, old_mod, new_mod, old_attr=None, new_attr=None)

Bases: _LazyDescr

class circuits.six.Module_six_moves_urllib_parse(name)

Bases: _LazyModule

Lazy loading of moved objects in six.moves.urllib_parse

ParseResult
SplitResult
quote_plus
splitquery
splittag
splituser
splitvalue
unquote_plus
urldefrag
urlencode
urlunsplit
uses_fragment
uses_netloc
uses_params
uses_query
uses_relative
class circuits.six.Module_six_moves_urllib_error(name)

Bases: _LazyModule

Lazy loading of moved objects in six.moves.urllib_error

ContentTooShortError
HTTPError
URLError
class circuits.six.Module_six_moves_urllib_request(name)

Bases: _LazyModule

Lazy loading of moved objects in six.moves.urllib_request

AbstractBasicAuthHandler
AbstractDigestAuthHandler
BaseHandler
CacheFTPHandler
FTPHandler
FancyURLopener
FileHandler
HTTPBasicAuthHandler
HTTPCookieProcessor
HTTPDefaultErrorHandler
HTTPDigestAuthHandler
HTTPErrorProcessor
HTTPHandler
HTTPPasswordMgr
HTTPPasswordMgrWithDefaultRealm
HTTPRedirectHandler
HTTPSHandler
OpenerDirector
ProxyBasicAuthHandler
ProxyDigestAuthHandler
ProxyHandler
Request
URLopener
UnknownHandler
build_opener
getproxies
install_opener
pathname2url
proxy_bypass
url2pathname
urlcleanup
urlopen
urlretrieve
class circuits.six.Module_six_moves_urllib_response(name)

Bases: _LazyModule

Lazy loading of moved objects in six.moves.urllib_response

addbase
addclosehook
addinfo
addinfourl
class circuits.six.Module_six_moves_urllib_robotparser(name)

Bases: _LazyModule

Lazy loading of moved objects in six.moves.urllib_robotparser

RobotFileParser
class circuits.six.Module_six_moves_urllib(name, doc=None)

Bases: module

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

parse = <module 'circuits.six.moves.urllib_parse' (<circuits.six._SixMetaPathImporter object>)>
error = <module 'circuits.six.moves.urllib.error'>
request = <module 'circuits.six.moves.urllib.request'>
response = <module 'circuits.six.moves.urllib.response'>
robotparser = <module 'circuits.six.moves.urllib.robotparser'>
circuits.six.add_move(move)

Add an item to six.moves.

circuits.six.remove_move(name)

Remove item from six.moves.

circuits.six.get_unbound_function(unbound)

Get the function out of a possibly unbound function

circuits.six.create_unbound_method(func, cls)
circuits.six.iterkeys(d, **kw)

Return an iterator over the keys of a dictionary.

circuits.six.itervalues(d, **kw)

Return an iterator over the values of a dictionary.

circuits.six.iteritems(d, **kw)

Return an iterator over the (key, value) pairs of a dictionary.

circuits.six.iterlists(d, **kw)

Return an iterator over the (key, [values]) pairs of a dictionary.

circuits.six.b(s)

Byte literal

circuits.six.u(s)

Text literal

circuits.six.int2byte()

S.pack(v1, v2, …) -> bytes

Return a bytes object containing values v1, v2, … packed according to the format string S.format. See help(struct) for more on format strings.

circuits.six.assertCountEqual(self, *args, **kwargs)
circuits.six.assertRaisesRegex(self, *args, **kwargs)
circuits.six.assertRegex(self, *args, **kwargs)
circuits.six.reraise(tp, value, tb=None)

Reraise an exception.

circuits.six.raise_from(value, from_value)
circuits.six.with_metaclass(meta, *bases)

Create a base class with a metaclass.

circuits.six.add_metaclass(metaclass)

Class decorator for creating a class with a metaclass.

circuits.six.python_2_unicode_compatible(klass)

A decorator that defines __unicode__ and __str__ methods under Python 2. Under Python 3 it does nothing.

To support Python 2 and 3 with a single code base, define a __str__ method returning text and apply this decorator to the class.