mirror of
https://github.com/morpheus65535/bazarr.git
synced 2025-02-27 00:10:02 +08:00
17 lines
No EOL
473 B
Python
17 lines
No EOL
473 B
Python
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'utf-8')
|
|
else:return text
|
|
def to_text(string):
|
|
A=string
|
|
if PY2:return A.decode('utf-8')
|
|
else:return A |