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
StringIO
StringIO
xrange
xrange()
range()
quote
urllib.quote()
unquote
urllib.quote()
quote_plus
urllib.quote_plus()
unquote_plus
urllib.unquote_plus()
ifilter
itertools.ifilter()
Iterable
collections.Iterable
Also, one function is defined:
Function
Action
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)¶