Mercurial > babel > mirror
diff babel/compat.py @ 567:c81a11cb1476 trunk
add a compat module to shield the code from changes in different versions of Python
author | fschwarz |
---|---|
date | Mon, 26 Sep 2011 09:42:43 +0000 |
parents | |
children | 8ce41e60f90d |
line wrap: on
line diff
new file mode 100644 --- /dev/null +++ b/babel/compat.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +# +# Copyright (C) 2007-2011 Edgewall Software +# All rights reserved. +# +# This software is licensed as described in the file COPYING, which +# you should have received as part of this distribution. The terms +# are also available at http://babel.edgewall.org/wiki/License. +# +# This software consists of voluntary contributions made by many +# individuals. For the exact contribution history, see the revision +# history and logs, available at http://babel.edgewall.org/log/. + +try: + from xml.etree import ElementTree +except ImportError: + from elementtree import ElementTree + +try: + any = any +except NameError: + def any(iterable): + return filter(None, list(iterable)) + +try: + import threading +except ImportError: + import dummy_threading as threading +