mirror of
https://github.com/home-assistant/core.git
synced 2025-07-26 22:57:17 +00:00
Python 3.5 adjustments (#13173)
This commit is contained in:
parent
6909be1cc7
commit
27c1806897
@ -86,14 +86,6 @@ def async_from_config_dict(config: Dict[str, Any],
|
|||||||
if enable_log:
|
if enable_log:
|
||||||
async_enable_logging(hass, verbose, log_rotate_days, log_file)
|
async_enable_logging(hass, verbose, log_rotate_days, log_file)
|
||||||
|
|
||||||
if sys.version_info[:2] < (3, 5):
|
|
||||||
_LOGGER.warning(
|
|
||||||
'Python 3.4 support has been deprecated and will be removed in '
|
|
||||||
'the beginning of 2018. Please upgrade Python or your operating '
|
|
||||||
'system. More info: https://home-assistant.io/blog/2017/10/06/'
|
|
||||||
'deprecating-python-3.4-support/'
|
|
||||||
)
|
|
||||||
|
|
||||||
core_config = config.get(core.DOMAIN, {})
|
core_config = config.get(core.DOMAIN, {})
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -545,9 +545,8 @@ def setup_mysensors_platform(
|
|||||||
device_class_copy = device_class[s_type]
|
device_class_copy = device_class[s_type]
|
||||||
name = get_mysensors_name(gateway, node_id, child_id)
|
name = get_mysensors_name(gateway, node_id, child_id)
|
||||||
|
|
||||||
# python 3.4 cannot unpack inside tuple, but combining tuples works
|
args_copy = (*device_args, gateway, node_id, child_id, name,
|
||||||
args_copy = device_args + (
|
value_type)
|
||||||
gateway, node_id, child_id, name, value_type)
|
|
||||||
devices[dev_id] = device_class_copy(*args_copy)
|
devices[dev_id] = device_class_copy(*args_copy)
|
||||||
new_devices.append(devices[dev_id])
|
new_devices.append(devices[dev_id])
|
||||||
if new_devices:
|
if new_devices:
|
||||||
|
@ -117,11 +117,7 @@ class HomeAssistant(object):
|
|||||||
else:
|
else:
|
||||||
self.loop = loop or asyncio.get_event_loop()
|
self.loop = loop or asyncio.get_event_loop()
|
||||||
|
|
||||||
executor_opts = {'max_workers': 10}
|
executor_opts = {'max_workers': None}
|
||||||
if sys.version_info[:2] >= (3, 5):
|
|
||||||
# It will default set to the number of processors on the machine,
|
|
||||||
# multiplied by 5. That is better for overlap I/O workers.
|
|
||||||
executor_opts['max_workers'] = None
|
|
||||||
if sys.version_info[:2] >= (3, 6):
|
if sys.version_info[:2] >= (3, 6):
|
||||||
executor_opts['thread_name_prefix'] = 'SyncWorker'
|
executor_opts['thread_name_prefix'] = 'SyncWorker'
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ def disable_c_asyncio():
|
|||||||
def find_module(self, fullname, path=None):
|
def find_module(self, fullname, path=None):
|
||||||
"""Find a module."""
|
"""Find a module."""
|
||||||
if fullname == self.PATH_TRIGGER:
|
if fullname == self.PATH_TRIGGER:
|
||||||
# We lint in Py34, exception is introduced in Py36
|
# We lint in Py35, exception is introduced in Py36
|
||||||
# pylint: disable=undefined-variable
|
# pylint: disable=undefined-variable
|
||||||
raise ModuleNotFoundError() # noqa
|
raise ModuleNotFoundError() # noqa
|
||||||
return None
|
return None
|
||||||
|
@ -95,9 +95,12 @@ def run(script_args: List) -> int:
|
|||||||
if args.files:
|
if args.files:
|
||||||
print(color(C_HEAD, 'yaml files'), '(used /',
|
print(color(C_HEAD, 'yaml files'), '(used /',
|
||||||
color('red', 'not used') + ')')
|
color('red', 'not used') + ')')
|
||||||
# Python 3.5 gets a recursive, but not in 3.4
|
deps = os.path.join(config_dir, 'deps')
|
||||||
for yfn in sorted(glob(os.path.join(config_dir, '*.yaml')) +
|
yaml_files = [f for f in glob(os.path.join(config_dir, '**/*.yaml'),
|
||||||
glob(os.path.join(config_dir, '*/*.yaml'))):
|
recursive=True)
|
||||||
|
if not f.startswith(deps)]
|
||||||
|
|
||||||
|
for yfn in sorted(yaml_files):
|
||||||
the_color = '' if yfn in res['yaml_files'] else 'red'
|
the_color = '' if yfn in res['yaml_files'] else 'red'
|
||||||
print(color(the_color, '-', yfn))
|
print(color(the_color, '-', yfn))
|
||||||
|
|
||||||
|
@ -41,9 +41,7 @@ class TestCheckConfig(unittest.TestCase):
|
|||||||
# this ensures we have one.
|
# this ensures we have one.
|
||||||
try:
|
try:
|
||||||
asyncio.get_event_loop()
|
asyncio.get_event_loop()
|
||||||
except (RuntimeError, AssertionError):
|
except RuntimeError:
|
||||||
# Py35: RuntimeError
|
|
||||||
# Py34: AssertionError
|
|
||||||
asyncio.set_event_loop(asyncio.new_event_loop())
|
asyncio.set_event_loop(asyncio.new_event_loop())
|
||||||
|
|
||||||
# Will allow seeing full diff
|
# Will allow seeing full diff
|
||||||
|
Loading…
x
Reference in New Issue
Block a user