##// END OF EJS Templates
Pretty print dict_proxy as prefixed in CPython 2.7...
Pretty print dict_proxy as prefixed in CPython 2.7 - Add tests for dict proxies (instances of types.DictProxyType) - Uses the "dict_proxy({...})" pattern for representation, as happens in CPython 2.7 with types.DictProxyType.__repr__ - Used ctypes.pythonapi.PyDictProxy_New to instantiate dict proxies inside the tests - Only for CPython 2.7: in PyPy the types.DictProxyType is dict, and in CPython 3 there's no such type, just the new types.MappingProxyType in CPython 3.3+

File last commit:

r9318:ab1ae261
r22749:fce2225f
Show More
version.py
36 lines | 1.2 KiB | text/x-python | PythonLexer
# encoding: utf-8
"""
Utilities for version comparison
It is a bit ridiculous that we need these.
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2013 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
from distutils.version import LooseVersion
#-----------------------------------------------------------------------------
# Code
#-----------------------------------------------------------------------------
def check_version(v, check):
"""check version string v >= check
If dev/prerelease tags result in TypeError for string-number comparison,
it is assumed that the dependency is satisfied.
Users on dev branches are responsible for keeping their own packages up to date.
"""
try:
return LooseVersion(v) >= LooseVersion(check)
except TypeError:
return True