Python 3.5 adjustments (#13173)
This commit is contained in:
parent
6909be1cc7
commit
27c1806897
6 changed files with 11 additions and 23 deletions
|
@ -86,14 +86,6 @@ def async_from_config_dict(config: Dict[str, Any],
|
|||
if enable_log:
|
||||
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, {})
|
||||
|
||||
try:
|
||||
|
|
|
@ -545,9 +545,8 @@ def setup_mysensors_platform(
|
|||
device_class_copy = device_class[s_type]
|
||||
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, value_type)
|
||||
args_copy = (*device_args, gateway, node_id, child_id, name,
|
||||
value_type)
|
||||
devices[dev_id] = device_class_copy(*args_copy)
|
||||
new_devices.append(devices[dev_id])
|
||||
if new_devices:
|
||||
|
|
|
@ -117,11 +117,7 @@ class HomeAssistant(object):
|
|||
else:
|
||||
self.loop = loop or asyncio.get_event_loop()
|
||||
|
||||
executor_opts = {'max_workers': 10}
|
||||
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
|
||||
executor_opts = {'max_workers': None}
|
||||
if sys.version_info[:2] >= (3, 6):
|
||||
executor_opts['thread_name_prefix'] = 'SyncWorker'
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ def disable_c_asyncio():
|
|||
def find_module(self, fullname, path=None):
|
||||
"""Find a module."""
|
||||
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
|
||||
raise ModuleNotFoundError() # noqa
|
||||
return None
|
||||
|
|
|
@ -95,9 +95,12 @@ def run(script_args: List) -> int:
|
|||
if args.files:
|
||||
print(color(C_HEAD, 'yaml files'), '(used /',
|
||||
color('red', 'not used') + ')')
|
||||
# Python 3.5 gets a recursive, but not in 3.4
|
||||
for yfn in sorted(glob(os.path.join(config_dir, '*.yaml')) +
|
||||
glob(os.path.join(config_dir, '*/*.yaml'))):
|
||||
deps = os.path.join(config_dir, 'deps')
|
||||
yaml_files = [f for f in 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'
|
||||
print(color(the_color, '-', yfn))
|
||||
|
||||
|
|
|
@ -41,9 +41,7 @@ class TestCheckConfig(unittest.TestCase):
|
|||
# this ensures we have one.
|
||||
try:
|
||||
asyncio.get_event_loop()
|
||||
except (RuntimeError, AssertionError):
|
||||
# Py35: RuntimeError
|
||||
# Py34: AssertionError
|
||||
except RuntimeError:
|
||||
asyncio.set_event_loop(asyncio.new_event_loop())
|
||||
|
||||
# Will allow seeing full diff
|
||||
|
|
Loading…
Add table
Reference in a new issue