Package Bio :: Package _py3k
[hide private]
[frames] | no frames]

Package _py3k

source code

Python 3 compatibility tools (PRIVATE).

We used to have lines like this under Python 2 in order to use
iterator based zip, map and filter (in Python 3 these functions
are all iterator based)::

    from future_builtins import zip

There is no similar option for range yet, other than::

    range = xrange
    input = raw_input

or::

    from __builtin__ import xrange as range
    from __builtin__ import raw_input as input

Under Python 3 these imports need to be removed. Also, deliberate
importing of built in functions like open changes from Python 2::

    from __builtin__ import open

to this under Python 3::

    from builtins import open

Instead, we can do this under either Python 2 or 3::

    from Bio._py3k import open
    from Bio._py3k import zip

Once we drop support for Python 2, the whole of Bio._py3k will
go away.

Submodules [hide private]

Functions [hide private]
 
_bytes_to_string(b) source code
 
_string_to_bytes(s) source code
 
_bytes_bytearray_to_str(s)
If s is bytes or bytearray, convert to a string.
source code
 
_as_unicode(s)
Turn a (byte) string or a unicode string into a (byte) string.
source code
 
_as_bytes(s)
Turn a (byte) string or a unicode string into a (byte) string.
source code
 
_as_string(s)
Turn a (byte) string or a unicode string into a (byte) string.
source code
 
_is_int_or_long(i)
Check if the value is an integer or long.
source code
 
_binary_to_string_handle(handle)
Treat a binary handle like a text handle.
source code
Variables [hide private]
  _universal_read_mode = 'rU'
  __package__ = 'Bio._py3k'