Esempio n. 1
0
def flatten(arr):
    if _is_python_version(major=2, minor=6):
        chainer = itertools.chain.from_iterable
    else:
        chainer = itertools.chain

    flattened = list(chainer(*arr))

    return flattened
Esempio n. 2
0
def test__is_python_version():
    def _assert_version(major, minor):
        if PYTHON_VERSION.major == major and PYTHON_VERSION.minor == minor:
            assert _is_python_version(major=major, minor=minor)

    _assert_version(2, 7)
    _assert_version(3, 4)
    _assert_version(3, 5)
    _assert_version(3, 6)
    _assert_version(3, 7)

    assert _is_python_version(major=PYTHON_VERSION.major,
                              minor=PYTHON_VERSION.minor,
                              patch=PYTHON_VERSION.micro)
Esempio n. 3
0
 def _assert_version(major, minor):
     if PYTHON_VERSION.major == major and PYTHON_VERSION.minor == minor:
         assert _is_python_version(major=major, minor=minor)