mirror of
https://github.com/esphome/esphome.git
synced 2024-11-26 17:05:21 +01:00
22fd4ec722
* Make compatible with python 3 * Update travis * Env * Fix typo * Fix install correct platformio * Lint * Fix build flags * Lint * Upgrade pylint * Lint
25 lines
469 B
Python
25 lines
469 B
Python
import sys
|
|
|
|
PYTHON_MAJOR = sys.version_info[0]
|
|
IS_PY2 = PYTHON_MAJOR == 2
|
|
IS_PY3 = PYTHON_MAJOR == 3
|
|
|
|
|
|
# pylint: disable=no-else-return
|
|
def safe_input(line):
|
|
if IS_PY2:
|
|
return raw_input(line)
|
|
else:
|
|
return input(line)
|
|
|
|
|
|
if IS_PY2:
|
|
text_type = unicode
|
|
string_types = (str, unicode)
|
|
integer_types = (int, long)
|
|
binary_type = str
|
|
else:
|
|
text_type = str
|
|
string_types = (str,)
|
|
integer_types = (int,)
|
|
binary_type = bytes
|