mirror of
https://github.com/esphome/esphome.git
synced 2024-11-25 08:28:12 +01:00
Bump pylint from 2.5.3 to 2.6.0 (#1262)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Otto Winter <otto@otto-winter.com>
This commit is contained in:
parent
a401c71d3e
commit
e7bd93b4b0
17 changed files with 53 additions and 37 deletions
|
@ -181,7 +181,7 @@ class APIClient(threading.Thread):
|
||||||
self._address)
|
self._address)
|
||||||
_LOGGER.warning("(If this error persists, please set a static IP address: "
|
_LOGGER.warning("(If this error persists, please set a static IP address: "
|
||||||
"https://esphome.io/components/wifi.html#manual-ips)")
|
"https://esphome.io/components/wifi.html#manual-ips)")
|
||||||
raise APIConnectionError(err)
|
raise APIConnectionError(err) from err
|
||||||
|
|
||||||
_LOGGER.info("Connecting to %s:%s (%s)", self._address, self._port, ip)
|
_LOGGER.info("Connecting to %s:%s (%s)", self._address, self._port, ip)
|
||||||
self._socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
self._socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
|
@ -346,12 +346,12 @@ class APIClient(threading.Thread):
|
||||||
raise APIConnectionError("No socket!")
|
raise APIConnectionError("No socket!")
|
||||||
try:
|
try:
|
||||||
val = self._socket.recv(amount - len(ret))
|
val = self._socket.recv(amount - len(ret))
|
||||||
except AttributeError:
|
except AttributeError as err:
|
||||||
raise APIConnectionError("Socket was closed")
|
raise APIConnectionError("Socket was closed") from err
|
||||||
except socket.timeout:
|
except socket.timeout:
|
||||||
continue
|
continue
|
||||||
except OSError as err:
|
except OSError as err:
|
||||||
raise APIConnectionError(f"Error while receiving data: {err}")
|
raise APIConnectionError(f"Error while receiving data: {err}") from err
|
||||||
ret += val
|
ret += val
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
|
@ -84,6 +84,7 @@ def validate_automation(extra_schema=None, extra_validators=None, single=False):
|
||||||
return cv.Schema([schema])(value)
|
return cv.Schema([schema])(value)
|
||||||
except cv.Invalid as err2:
|
except cv.Invalid as err2:
|
||||||
if 'extra keys not allowed' in str(err2) and len(err2.path) == 2:
|
if 'extra keys not allowed' in str(err2) and len(err2.path) == 2:
|
||||||
|
# pylint: disable=raise-missing-from
|
||||||
raise err
|
raise err
|
||||||
if 'Unable to find action' in str(err):
|
if 'Unable to find action' in str(err):
|
||||||
raise err2
|
raise err2
|
||||||
|
|
|
@ -104,6 +104,7 @@ def parse_multi_click_timing_str(value):
|
||||||
try:
|
try:
|
||||||
state = cv.boolean(parts[0])
|
state = cv.boolean(parts[0])
|
||||||
except cv.Invalid:
|
except cv.Invalid:
|
||||||
|
# pylint: disable=raise-missing-from
|
||||||
raise cv.Invalid("First word must either be ON or OFF, not {}".format(parts[0]))
|
raise cv.Invalid("First word must either be ON or OFF, not {}".format(parts[0]))
|
||||||
|
|
||||||
if parts[1] != 'for':
|
if parts[1] != 'for':
|
||||||
|
|
|
@ -42,9 +42,9 @@ def validate_glyphs(value):
|
||||||
def validate_pillow_installed(value):
|
def validate_pillow_installed(value):
|
||||||
try:
|
try:
|
||||||
import PIL
|
import PIL
|
||||||
except ImportError:
|
except ImportError as err:
|
||||||
raise cv.Invalid("Please install the pillow python package to use this feature. "
|
raise cv.Invalid("Please install the pillow python package to use this feature. "
|
||||||
"(pip install pillow)")
|
"(pip install pillow)") from err
|
||||||
|
|
||||||
if PIL.__version__[0] < '4':
|
if PIL.__version__[0] < '4':
|
||||||
raise cv.Invalid("Please update your pillow installation to at least 4.0.x. "
|
raise cv.Invalid("Please update your pillow installation to at least 4.0.x. "
|
||||||
|
|
|
@ -43,8 +43,8 @@ def validate_url(value):
|
||||||
value = cv.string(value)
|
value = cv.string(value)
|
||||||
try:
|
try:
|
||||||
parsed = list(urlparse.urlparse(value))
|
parsed = list(urlparse.urlparse(value))
|
||||||
except Exception:
|
except Exception as err:
|
||||||
raise cv.Invalid('Invalid URL')
|
raise cv.Invalid('Invalid URL') from err
|
||||||
|
|
||||||
if not parsed[0] or not parsed[1]:
|
if not parsed[0] or not parsed[1]:
|
||||||
raise cv.Invalid('URL must have a URL scheme and host')
|
raise cv.Invalid('URL must have a URL scheme and host')
|
||||||
|
|
|
@ -18,8 +18,8 @@ def validate_uid(value):
|
||||||
"long.")
|
"long.")
|
||||||
try:
|
try:
|
||||||
x = int(x, 16)
|
x = int(x, 16)
|
||||||
except ValueError:
|
except ValueError as err:
|
||||||
raise cv.Invalid("Valid characters for parts of a UID are 0123456789ABCDEF.")
|
raise cv.Invalid("Valid characters for parts of a UID are 0123456789ABCDEF.") from err
|
||||||
if x < 0 or x > 255:
|
if x < 0 or x > 255:
|
||||||
raise cv.Invalid("Valid values for UID parts (separated by '-') are 00 to FF")
|
raise cv.Invalid("Valid values for UID parts (separated by '-') are 00 to FF")
|
||||||
return value
|
return value
|
||||||
|
|
|
@ -28,6 +28,7 @@ def validate_acceleration(value):
|
||||||
try:
|
try:
|
||||||
value = float(value)
|
value = float(value)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
# pylint: disable=raise-missing-from
|
||||||
raise cv.Invalid(f"Expected acceleration as floating point number, got {value}")
|
raise cv.Invalid(f"Expected acceleration as floating point number, got {value}")
|
||||||
|
|
||||||
if value <= 0:
|
if value <= 0:
|
||||||
|
@ -48,6 +49,7 @@ def validate_speed(value):
|
||||||
try:
|
try:
|
||||||
value = float(value)
|
value = float(value)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
# pylint: disable=raise-missing-from
|
||||||
raise cv.Invalid(f"Expected speed as floating point number, got {value}")
|
raise cv.Invalid(f"Expected speed as floating point number, got {value}")
|
||||||
|
|
||||||
if value <= 0:
|
if value <= 0:
|
||||||
|
|
|
@ -138,6 +138,7 @@ def _parse_cron_int(value, special_mapping, message):
|
||||||
try:
|
try:
|
||||||
return int(value)
|
return int(value)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
# pylint: disable=raise-missing-from
|
||||||
raise cv.Invalid(message.format(value))
|
raise cv.Invalid(message.format(value))
|
||||||
|
|
||||||
|
|
||||||
|
@ -158,6 +159,7 @@ def _parse_cron_part(part, min_value, max_value, special_mapping):
|
||||||
try:
|
try:
|
||||||
repeat_n = int(repeat)
|
repeat_n = int(repeat)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
# pylint: disable=raise-missing-from
|
||||||
raise cv.Invalid("Repeat for '/' time expression must be an integer, got {}"
|
raise cv.Invalid("Repeat for '/' time expression must be an integer, got {}"
|
||||||
.format(repeat))
|
.format(repeat))
|
||||||
return set(range(offset_n, max_value + 1, repeat_n))
|
return set(range(offset_n, max_value + 1, repeat_n))
|
||||||
|
|
|
@ -18,9 +18,9 @@ _LOGGER = logging.getLogger(__name__)
|
||||||
def validate_cryptography_installed():
|
def validate_cryptography_installed():
|
||||||
try:
|
try:
|
||||||
import cryptography
|
import cryptography
|
||||||
except ImportError:
|
except ImportError as err:
|
||||||
raise cv.Invalid("This settings requires the cryptography python package. "
|
raise cv.Invalid("This settings requires the cryptography python package. "
|
||||||
"Please install it with `pip install cryptography`")
|
"Please install it with `pip install cryptography`") from err
|
||||||
|
|
||||||
if cryptography.__version__[0] < '2':
|
if cryptography.__version__[0] < '2':
|
||||||
raise cv.Invalid("Please update your python cryptography installation to least 2.x "
|
raise cv.Invalid("Please update your python cryptography installation to least 2.x "
|
||||||
|
|
|
@ -675,7 +675,7 @@ def _load_config(command_line_substitutions):
|
||||||
try:
|
try:
|
||||||
config = yaml_util.load_yaml(CORE.config_path)
|
config = yaml_util.load_yaml(CORE.config_path)
|
||||||
except EsphomeError as e:
|
except EsphomeError as e:
|
||||||
raise InvalidYAMLError(e)
|
raise InvalidYAMLError(e) from e
|
||||||
CORE.raw_config = config
|
CORE.raw_config = config
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -693,7 +693,7 @@ def load_config(command_line_substitutions):
|
||||||
try:
|
try:
|
||||||
return _load_config(command_line_substitutions)
|
return _load_config(command_line_substitutions)
|
||||||
except vol.Invalid as err:
|
except vol.Invalid as err:
|
||||||
raise EsphomeError(f"Error while parsing config: {err}")
|
raise EsphomeError(f"Error while parsing config: {err}") from err
|
||||||
|
|
||||||
|
|
||||||
def line_info(obj, highlight=True):
|
def line_info(obj, highlight=True):
|
||||||
|
|
|
@ -224,6 +224,7 @@ def int_(value):
|
||||||
try:
|
try:
|
||||||
return int(value, base)
|
return int(value, base)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
# pylint: disable=raise-missing-from
|
||||||
raise Invalid(f"Expected integer, but cannot parse {value} as an integer")
|
raise Invalid(f"Expected integer, but cannot parse {value} as an integer")
|
||||||
|
|
||||||
|
|
||||||
|
@ -423,6 +424,7 @@ def time_period_str_colon(value):
|
||||||
try:
|
try:
|
||||||
parsed = [int(x) for x in value.split(':')]
|
parsed = [int(x) for x in value.split(':')]
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
# pylint: disable=raise-missing-from
|
||||||
raise Invalid(TIME_PERIOD_ERROR.format(value))
|
raise Invalid(TIME_PERIOD_ERROR.format(value))
|
||||||
|
|
||||||
if len(parsed) == 2:
|
if len(parsed) == 2:
|
||||||
|
@ -527,6 +529,7 @@ def time_of_day(value):
|
||||||
try:
|
try:
|
||||||
date = datetime.strptime(value, '%H:%M:%S %p')
|
date = datetime.strptime(value, '%H:%M:%S %p')
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
# pylint: disable=raise-missing-from
|
||||||
raise Invalid(f"Invalid time of day: {err}")
|
raise Invalid(f"Invalid time of day: {err}")
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -548,6 +551,7 @@ def mac_address(value):
|
||||||
try:
|
try:
|
||||||
parts_int.append(int(part, 16))
|
parts_int.append(int(part, 16))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
# pylint: disable=raise-missing-from
|
||||||
raise Invalid("MAC Address parts must be hexadecimal values from 00 to FF")
|
raise Invalid("MAC Address parts must be hexadecimal values from 00 to FF")
|
||||||
|
|
||||||
return core.MACAddress(*parts_int)
|
return core.MACAddress(*parts_int)
|
||||||
|
@ -565,6 +569,7 @@ def bind_key(value):
|
||||||
try:
|
try:
|
||||||
parts_int.append(int(part, 16))
|
parts_int.append(int(part, 16))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
# pylint: disable=raise-missing-from
|
||||||
raise Invalid("Bind key must be hex values from 00 to FF")
|
raise Invalid("Bind key must be hex values from 00 to FF")
|
||||||
|
|
||||||
return ''.join(f'{part:02X}' for part in parts_int)
|
return ''.join(f'{part:02X}' for part in parts_int)
|
||||||
|
@ -686,8 +691,8 @@ def domain(value):
|
||||||
return value
|
return value
|
||||||
try:
|
try:
|
||||||
return str(ipv4(value))
|
return str(ipv4(value))
|
||||||
except Invalid:
|
except Invalid as err:
|
||||||
raise Invalid(f"Invalid domain: {value}")
|
raise Invalid(f"Invalid domain: {value}") from err
|
||||||
|
|
||||||
|
|
||||||
def domain_name(value):
|
def domain_name(value):
|
||||||
|
@ -739,8 +744,8 @@ def _valid_topic(value):
|
||||||
value = string(value)
|
value = string(value)
|
||||||
try:
|
try:
|
||||||
raw_value = value.encode('utf-8')
|
raw_value = value.encode('utf-8')
|
||||||
except UnicodeError:
|
except UnicodeError as err:
|
||||||
raise Invalid("MQTT topic name/filter must be valid UTF-8 string.")
|
raise Invalid("MQTT topic name/filter must be valid UTF-8 string.") from err
|
||||||
if not raw_value:
|
if not raw_value:
|
||||||
raise Invalid("MQTT topic name/filter must not be empty.")
|
raise Invalid("MQTT topic name/filter must not be empty.")
|
||||||
if len(raw_value) > 65535:
|
if len(raw_value) > 65535:
|
||||||
|
@ -792,6 +797,7 @@ def mqtt_qos(value):
|
||||||
try:
|
try:
|
||||||
value = int(value)
|
value = int(value)
|
||||||
except (TypeError, ValueError):
|
except (TypeError, ValueError):
|
||||||
|
# pylint: disable=raise-missing-from
|
||||||
raise Invalid(f"MQTT Quality of Service must be integer, got {value}")
|
raise Invalid(f"MQTT Quality of Service must be integer, got {value}")
|
||||||
return one_of(0, 1, 2)(value)
|
return one_of(0, 1, 2)(value)
|
||||||
|
|
||||||
|
@ -836,6 +842,7 @@ def possibly_negative_percentage(value):
|
||||||
else:
|
else:
|
||||||
value = float(value)
|
value = float(value)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
# pylint: disable=raise-missing-from
|
||||||
raise Invalid("invalid number")
|
raise Invalid("invalid number")
|
||||||
if value > 1:
|
if value > 1:
|
||||||
msg = "Percentage must not be higher than 100%."
|
msg = "Percentage must not be higher than 100%."
|
||||||
|
@ -1006,6 +1013,7 @@ def dimensions(value):
|
||||||
try:
|
try:
|
||||||
width, height = int(value[0]), int(value[1])
|
width, height = int(value[0]), int(value[1])
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
# pylint: disable=raise-missing-from
|
||||||
raise Invalid("Width and height dimensions must be integers")
|
raise Invalid("Width and height dimensions must be integers")
|
||||||
if width <= 0 or height <= 0:
|
if width <= 0 or height <= 0:
|
||||||
raise Invalid("Width and height must at least be 1")
|
raise Invalid("Width and height must at least be 1")
|
||||||
|
|
|
@ -83,19 +83,19 @@ def receive_exactly(sock, amount, msg, expect, decode=True):
|
||||||
try:
|
try:
|
||||||
data += recv_decode(sock, 1, decode=decode)
|
data += recv_decode(sock, 1, decode=decode)
|
||||||
except OSError as err:
|
except OSError as err:
|
||||||
raise OTAError(f"Error receiving acknowledge {msg}: {err}")
|
raise OTAError(f"Error receiving acknowledge {msg}: {err}") from err
|
||||||
|
|
||||||
try:
|
try:
|
||||||
check_error(data, expect)
|
check_error(data, expect)
|
||||||
except OTAError as err:
|
except OTAError as err:
|
||||||
sock.close()
|
sock.close()
|
||||||
raise OTAError(f"Error {msg}: {err}")
|
raise OTAError(f"Error {msg}: {err}") from err
|
||||||
|
|
||||||
while len(data) < amount:
|
while len(data) < amount:
|
||||||
try:
|
try:
|
||||||
data += recv_decode(sock, amount - len(data), decode=decode)
|
data += recv_decode(sock, amount - len(data), decode=decode)
|
||||||
except OSError as err:
|
except OSError as err:
|
||||||
raise OTAError(f"Error receiving {msg}: {err}")
|
raise OTAError(f"Error receiving {msg}: {err}") from err
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ def send_check(sock, data, msg):
|
||||||
|
|
||||||
sock.sendall(data)
|
sock.sendall(data)
|
||||||
except OSError as err:
|
except OSError as err:
|
||||||
raise OTAError(f"Error sending {msg}: {err}")
|
raise OTAError(f"Error sending {msg}: {err}") from err
|
||||||
|
|
||||||
|
|
||||||
def perform_ota(sock, password, file_handle, filename):
|
def perform_ota(sock, password, file_handle, filename):
|
||||||
|
@ -226,7 +226,7 @@ def perform_ota(sock, password, file_handle, filename):
|
||||||
sock.sendall(chunk)
|
sock.sendall(chunk)
|
||||||
except OSError as err:
|
except OSError as err:
|
||||||
sys.stderr.write('\n')
|
sys.stderr.write('\n')
|
||||||
raise OTAError(f"Error sending data: {err}")
|
raise OTAError(f"Error sending data: {err}") from err
|
||||||
|
|
||||||
progress.update(offset / float(file_size))
|
progress.update(offset / float(file_size))
|
||||||
progress.done()
|
progress.done()
|
||||||
|
@ -259,7 +259,7 @@ def run_ota_impl_(remote_host, remote_port, password, filename):
|
||||||
remote_host)
|
remote_host)
|
||||||
_LOGGER.error("(If this error persists, please set a static IP address: "
|
_LOGGER.error("(If this error persists, please set a static IP address: "
|
||||||
"https://esphome.io/components/wifi.html#manual-ips)")
|
"https://esphome.io/components/wifi.html#manual-ips)")
|
||||||
raise OTAError(err)
|
raise OTAError(err) from err
|
||||||
_LOGGER.info(" -> %s", ip)
|
_LOGGER.info(" -> %s", ip)
|
||||||
|
|
||||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
|
|
|
@ -89,7 +89,7 @@ def mkdir_p(path):
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
from esphome.core import EsphomeError
|
from esphome.core import EsphomeError
|
||||||
raise EsphomeError(f"Error creating directories {path}: {err}")
|
raise EsphomeError(f"Error creating directories {path}: {err}") from err
|
||||||
|
|
||||||
|
|
||||||
def is_ip_address(host):
|
def is_ip_address(host):
|
||||||
|
@ -110,13 +110,13 @@ def _resolve_with_zeroconf(host):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
zc = Zeroconf()
|
zc = Zeroconf()
|
||||||
except Exception:
|
except Exception as err:
|
||||||
raise EsphomeError("Cannot start mDNS sockets, is this a docker container without "
|
raise EsphomeError("Cannot start mDNS sockets, is this a docker container without "
|
||||||
"host network mode?")
|
"host network mode?") from err
|
||||||
try:
|
try:
|
||||||
info = zc.resolve_host(host + '.')
|
info = zc.resolve_host(host + '.')
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
raise EsphomeError(f"Error resolving mDNS hostname: {err}")
|
raise EsphomeError(f"Error resolving mDNS hostname: {err}") from err
|
||||||
finally:
|
finally:
|
||||||
zc.close()
|
zc.close()
|
||||||
if info is None:
|
if info is None:
|
||||||
|
@ -142,7 +142,7 @@ def resolve_ip_address(host):
|
||||||
except OSError as err:
|
except OSError as err:
|
||||||
errs.append(str(err))
|
errs.append(str(err))
|
||||||
raise EsphomeError("Error resolving IP address: {}"
|
raise EsphomeError("Error resolving IP address: {}"
|
||||||
"".format(', '.join(errs)))
|
"".format(', '.join(errs))) from err
|
||||||
|
|
||||||
|
|
||||||
def get_bool_env(var, default=False):
|
def get_bool_env(var, default=False):
|
||||||
|
@ -165,10 +165,10 @@ def read_file(path):
|
||||||
return f_handle.read()
|
return f_handle.read()
|
||||||
except OSError as err:
|
except OSError as err:
|
||||||
from esphome.core import EsphomeError
|
from esphome.core import EsphomeError
|
||||||
raise EsphomeError(f"Error reading file {path}: {err}")
|
raise EsphomeError(f"Error reading file {path}: {err}") from err
|
||||||
except UnicodeDecodeError as err:
|
except UnicodeDecodeError as err:
|
||||||
from esphome.core import EsphomeError
|
from esphome.core import EsphomeError
|
||||||
raise EsphomeError(f"Error reading file {path}: {err}")
|
raise EsphomeError(f"Error reading file {path}: {err}") from err
|
||||||
|
|
||||||
|
|
||||||
def _write_file(path: Union[Path, str], text: Union[str, bytes]):
|
def _write_file(path: Union[Path, str], text: Union[str, bytes]):
|
||||||
|
@ -205,9 +205,9 @@ def _write_file(path: Union[Path, str], text: Union[str, bytes]):
|
||||||
def write_file(path: Union[Path, str], text: str):
|
def write_file(path: Union[Path, str], text: str):
|
||||||
try:
|
try:
|
||||||
_write_file(path, text)
|
_write_file(path, text)
|
||||||
except OSError:
|
except OSError as err:
|
||||||
from esphome.core import EsphomeError
|
from esphome.core import EsphomeError
|
||||||
raise EsphomeError(f"Could not write file at {path}")
|
raise EsphomeError(f"Could not write file at {path}") from err
|
||||||
|
|
||||||
|
|
||||||
def write_file_if_changed(path: Union[Path, str], text: str):
|
def write_file_if_changed(path: Union[Path, str], text: str):
|
||||||
|
@ -230,7 +230,7 @@ def copy_file_if_changed(src, dst):
|
||||||
shutil.copy(src, dst)
|
shutil.copy(src, dst)
|
||||||
except OSError as err:
|
except OSError as err:
|
||||||
from esphome.core import EsphomeError
|
from esphome.core import EsphomeError
|
||||||
raise EsphomeError(f"Error copying file {src} to {dst}: {err}")
|
raise EsphomeError(f"Error copying file {src} to {dst}: {err}") from err
|
||||||
|
|
||||||
|
|
||||||
def list_starts_with(list_, sub):
|
def list_starts_with(list_, sub):
|
||||||
|
|
|
@ -67,7 +67,7 @@ def initialize(config, subscriptions, on_message, username, password, client_id)
|
||||||
port = int(config[CONF_MQTT][CONF_PORT])
|
port = int(config[CONF_MQTT][CONF_PORT])
|
||||||
client.connect(host, port)
|
client.connect(host, port)
|
||||||
except OSError as err:
|
except OSError as err:
|
||||||
raise EsphomeError(f"Cannot connect to MQTT broker: {err}")
|
raise EsphomeError(f"Cannot connect to MQTT broker: {err}") from err
|
||||||
|
|
||||||
try:
|
try:
|
||||||
client.loop_forever()
|
client.loop_forever()
|
||||||
|
|
|
@ -32,6 +32,7 @@ class _Schema(vol.Schema):
|
||||||
try:
|
try:
|
||||||
res = extra(res)
|
res = extra(res)
|
||||||
except vol.Invalid as err:
|
except vol.Invalid as err:
|
||||||
|
# pylint: disable=raise-missing-from
|
||||||
raise ensure_multiple_invalid(err)
|
raise ensure_multiple_invalid(err)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
|
@ -126,6 +126,7 @@ class ESPHomeLoader(yaml.SafeLoader): # pylint: disable=too-many-ancestors
|
||||||
try:
|
try:
|
||||||
hash(key)
|
hash(key)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
|
# pylint: disable=raise-missing-from
|
||||||
raise yaml.constructor.ConstructorError(
|
raise yaml.constructor.ConstructorError(
|
||||||
f'Invalid key "{key}" (not hashable)', key_node.start_mark)
|
f'Invalid key "{key}" (not hashable)', key_node.start_mark)
|
||||||
|
|
||||||
|
@ -297,7 +298,7 @@ def _load_yaml_internal(fname):
|
||||||
try:
|
try:
|
||||||
return loader.get_single_data() or OrderedDict()
|
return loader.get_single_data() or OrderedDict()
|
||||||
except yaml.YAMLError as exc:
|
except yaml.YAMLError as exc:
|
||||||
raise EsphomeError(exc)
|
raise EsphomeError(exc) from exc
|
||||||
finally:
|
finally:
|
||||||
loader.dispose()
|
loader.dispose()
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
pylint==2.5.3
|
pylint==2.6.0
|
||||||
flake8==3.8.3
|
flake8==3.8.3
|
||||||
pillow>4.0.0
|
pillow>4.0.0
|
||||||
cryptography>=2.0.0,<4
|
cryptography>=2.0.0,<4
|
||||||
|
|
Loading…
Reference in a new issue