plastid.util.services.mini2to3 module

This module provides a thin compatibility layer between Python 2.7 and 3.x. Various objects are aliased as follows:

Exported object

Points to in 2.x

Points to 3.x

safe_bytes

bytes()

lambda x: bytes(x,"utf-8")

safe_str

str()

lambda x: x.decode("utf-8")

cStringIO

cStringIO

io

StringIO

StringIO

io

xrange

xrange()

range()

quote

urllib.quote()

urllib.parse.quote()

unquote

urllib.quote()

urllib.parse.unquote()

quote_plus

urllib.quote_plus()

urllib.parse.quote_plus()

unquote_plus

urllib.unquote_plus()

urllib.parse.unquote_plus()

ifilter

itertools.ifilter()

filter()

Iterable

collections.Iterable

collections.abc.Iterable

Also, one function is defined:

Function

Action

get_func_code()

Retrieves function.func_code in 2.x, function.__code__ in 3.x

plastid.util.services.mini2to3.get_func_code(func)[source]

Return function code attribute for function func

Version

Function attribute

2.x

func_code

3.x

_code

Parameters
funcfunction

Query function

Returns
code

Function code

plastid.util.services.mini2to3.safe_bytes(x)
plastid.util.services.mini2to3.safe_str(x)