Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1from __future__ import (absolute_import, division, print_function, 

2 unicode_literals) 

3import sys 

4 

5 

6IS_PYTHON2 = (sys.version_info[0] == 2) 

7 

8 

9def b(s, encoding='ascii', errors='replace'): # pragma: no cover 

10 if IS_PYTHON2: 

11 return bytes(s) 

12 else: 

13 if isinstance(s, str): 

14 return bytes(s, encoding, errors) 

15 else: 

16 return s 

17 # return bytes(s, encoding, errors) 

18 

19 

20def s(s): # pragma: no cover 

21 if IS_PYTHON2: 

22 return bytes(s) 

23 else: 

24 return s