Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/future/builtins/__init__.py: 89%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

19 statements  

1""" 

2A module that brings in equivalents of the new and modified Python 3 

3builtins into Py2. Has no effect on Py3. 

4 

5See the docs `here <https://python-future.org/what-else.html>`_ 

6(``docs/what-else.rst``) for more information. 

7 

8""" 

9 

10from future.builtins.iterators import (filter, map, zip) 

11# The isinstance import is no longer needed. We provide it only for 

12# backward-compatibility with future v0.8.2. It will be removed in future v1.0. 

13from future.builtins.misc import (ascii, chr, hex, input, isinstance, next, 

14 oct, open, pow, round, super, max, min) 

15from future.utils import PY3 

16 

17if PY3: 

18 import builtins 

19 bytes = builtins.bytes 

20 dict = builtins.dict 

21 int = builtins.int 

22 list = builtins.list 

23 object = builtins.object 

24 range = builtins.range 

25 str = builtins.str 

26 __all__ = [] 

27else: 

28 from future.types import (newbytes as bytes, 

29 newdict as dict, 

30 newint as int, 

31 newlist as list, 

32 newobject as object, 

33 newrange as range, 

34 newstr as str) 

35from future import utils 

36 

37 

38if not utils.PY3: 

39 # We only import names that shadow the builtins on Py2. No other namespace 

40 # pollution on Py2. 

41 

42 # Only shadow builtins on Py2; no new names 

43 __all__ = ['filter', 'map', 'zip', 

44 'ascii', 'chr', 'hex', 'input', 'next', 'oct', 'open', 'pow', 

45 'round', 'super', 

46 'bytes', 'dict', 'int', 'list', 'object', 'range', 'str', 'max', 'min' 

47 ] 

48 

49else: 

50 # No namespace pollution on Py3 

51 __all__ = []