Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/future/__init__.py: 100%

9 statements  

« prev     ^ index     » next       coverage.py v7.3.1, created at 2023-09-25 06:53 +0000

1""" 

2future: Easy, safe support for Python 2/3 compatibility 

3======================================================= 

4 

5``future`` is the missing compatibility layer between Python 2 and Python 

63. It allows you to use a single, clean Python 3.x-compatible codebase to 

7support both Python 2 and Python 3 with minimal overhead. 

8 

9It is designed to be used as follows:: 

10 

11 from __future__ import (absolute_import, division, 

12 print_function, unicode_literals) 

13 from builtins import ( 

14 bytes, dict, int, list, object, range, str, 

15 ascii, chr, hex, input, next, oct, open, 

16 pow, round, super, 

17 filter, map, zip) 

18 

19followed by predominantly standard, idiomatic Python 3 code that then runs 

20similarly on Python 2.6/2.7 and Python 3.3+. 

21 

22The imports have no effect on Python 3. On Python 2, they shadow the 

23corresponding builtins, which normally have different semantics on Python 3 

24versus 2, to provide their Python 3 semantics. 

25 

26 

27Standard library reorganization 

28~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 

29 

30``future`` supports the standard library reorganization (PEP 3108) through the 

31following Py3 interfaces: 

32 

33 >>> # Top-level packages with Py3 names provided on Py2: 

34 >>> import html.parser 

35 >>> import queue 

36 >>> import tkinter.dialog 

37 >>> import xmlrpc.client 

38 >>> # etc. 

39 

40 >>> # Aliases provided for extensions to existing Py2 module names: 

41 >>> from future.standard_library import install_aliases 

42 >>> install_aliases() 

43 

44 >>> from collections import Counter, OrderedDict # backported to Py2.6 

45 >>> from collections import UserDict, UserList, UserString 

46 >>> import urllib.request 

47 >>> from itertools import filterfalse, zip_longest 

48 >>> from subprocess import getoutput, getstatusoutput 

49 

50 

51Automatic conversion 

52-------------------- 

53 

54An included script called `futurize 

55<http://python-future.org/automatic_conversion.html>`_ aids in converting 

56code (from either Python 2 or Python 3) to code compatible with both 

57platforms. It is similar to ``python-modernize`` but goes further in 

58providing Python 3 compatibility through the use of the backported types 

59and builtin functions in ``future``. 

60 

61 

62Documentation 

63------------- 

64 

65See: http://python-future.org 

66 

67 

68Credits 

69------- 

70 

71:Author: Ed Schofield, Jordan M. Adler, et al 

72:Sponsor: Python Charmers Pty Ltd, Australia, and Python Charmers Pte 

73 Ltd, Singapore. http://pythoncharmers.com 

74:Others: See docs/credits.rst or http://python-future.org/credits.html 

75 

76 

77Licensing 

78--------- 

79Copyright 2013-2019 Python Charmers Pty Ltd, Australia. 

80The software is distributed under an MIT licence. See LICENSE.txt. 

81 

82""" 

83 

84__title__ = 'future' 

85__author__ = 'Ed Schofield' 

86__license__ = 'MIT' 

87__copyright__ = 'Copyright 2013-2019 Python Charmers Pty Ltd' 

88__ver_major__ = 0 

89__ver_minor__ = 18 

90__ver_patch__ = 3 

91__ver_sub__ = '' 

92__version__ = "%d.%d.%d%s" % (__ver_major__, __ver_minor__, 

93 __ver_patch__, __ver_sub__)