File: compat.py

package info (click to toggle)
python-dynaconf 3.1.7-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,116 kB
  • sloc: python: 12,959; makefile: 4
file content (18 lines) | stat: -rw-r--r-- 475 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
_A='utf-8'
import sys
PY2=sys.version_info[0]==2
if PY2:from StringIO import StringIO
else:from io import StringIO
def is_type_checking():
	try:from typing import TYPE_CHECKING as A
	except ImportError:return False
	return A
IS_TYPE_CHECKING=is_type_checking()
if IS_TYPE_CHECKING:from typing import Text
def to_env(text):
	if PY2:return text.encode(sys.getfilesystemencoding()or _A)
	else:return text
def to_text(string):
	A=string
	if PY2:return A.decode(_A)
	else:return A