Mercurial > repos > shellac > sam_consensus_v3
comparison env/lib/python3.9/site-packages/argcomplete/compat.py @ 0:4f3585e2f14b draft default tip
"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
| author | shellac |
|---|---|
| date | Mon, 22 Mar 2021 18:12:50 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:4f3585e2f14b |
|---|---|
| 1 from __future__ import absolute_import, division, print_function, unicode_literals | |
| 2 | |
| 3 import locale | |
| 4 import sys | |
| 5 | |
| 6 sys_encoding = locale.getpreferredencoding() | |
| 7 | |
| 8 USING_PYTHON2 = True if sys.version_info < (3, 0) else False | |
| 9 | |
| 10 if USING_PYTHON2: | |
| 11 str = unicode # noqa | |
| 12 else: | |
| 13 str = str | |
| 14 | |
| 15 | |
| 16 def ensure_bytes(x, encoding=sys_encoding): | |
| 17 if not isinstance(x, bytes): | |
| 18 x = x.encode(encoding) | |
| 19 return x | |
| 20 | |
| 21 | |
| 22 def ensure_str(x, encoding=sys_encoding): | |
| 23 if not isinstance(x, str): | |
| 24 x = x.decode(encoding) | |
| 25 return x |
