vc2_conformance.py2x_compat: Python 3.x backports

The vc2_conformance.py2x_compat module provides backported implementations of various functions from Python 3 which are used by this software.

zip_longest()

In Python 3.x an alias for itertools.zip_longest(), in Python 2.x, an alias for itertools.izip_longest.

get_terminal_size()

In Python 3.x an alias for shutil.get_terminal_size(), in Python 2.x, a dummy function always returning (80, 20).

wraps()

In Python 3.x an alias for functools.wraps(). In Python 2.x, an alternative implementation of functools.wraps which includes the Python 3.x behaviour of setting the __wrapped__ attribute to allow introspection of wrapped functions (see unwrap()).

unwrap()

In Python 3.x an alias for inspect.unwrap(). In Python 2.x a backported implementation of that function. Relies on the backported wraps() implementation provided by this module.

quote()

In Python 3.x an alias for shlex.quote(), in Python 2.x, an alias for pipes.quote.

string_types

A tuple enumerating the native string-like types. In Python 3.x, (str, ), in Python 2.x, (str, unicode).

gcd()

In Python 3.x an alias for math.gcd(), in Python 2.x, an alias for fractions.gcd.

zip()

In Python 3.x an alias for zip(), in Python 2.x, an alias for itertools.izip.

makedirs()

In Python 3.x an alias for os.makedirs(). In Python 2.x, a backport of this function which includes the exist_ok argument.

FileType()

In Python 3.x an alias for argparse.FileType. In Python 2.x, a wrapper around argparse.FileType adding support for the ‘encoding’ keyword argument when opening with mode “r”.