Bump pylint from 2.10.2 to 2.11.1 (#3128)
* Bump pylint from 2.10.2 to 2.11.1 Bumps [pylint](https://github.com/PyCQA/pylint) from 2.10.2 to 2.11.1. - [Release notes](https://github.com/PyCQA/pylint/releases) - [Changelog](https://github.com/PyCQA/pylint/blob/main/ChangeLog) - [Commits](https://github.com/PyCQA/pylint/compare/v2.10.2...v2.11.1) --- updated-dependencies: - dependency-name: pylint dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Fix linter issues * fix tests lint Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Pascal Vizeli <pvizeli@syshack.ch>
This commit is contained in:
parent
96f6c07912
commit
a85e816cd7
|
@ -5,7 +5,7 @@ flake8-docstrings==1.6.0
|
|||
flake8==3.9.2
|
||||
pre-commit==2.15.0
|
||||
pydocstyle==6.1.1
|
||||
pylint==2.10.2
|
||||
pylint==2.11.1
|
||||
pytest-aiohttp==0.3.0
|
||||
pytest-asyncio==0.12.0 # NB!: Versions over 0.12.0 breaks pytest-aiohttp (https://github.com/aio-libs/pytest-aiohttp/issues/16)
|
||||
pytest-cov==2.12.1
|
||||
|
|
|
@ -530,8 +530,7 @@ class Addon(AddonModel):
|
|||
|
||||
# Write pulse config
|
||||
try:
|
||||
with self.path_pulse.open("w") as config_file:
|
||||
config_file.write(pulse_config)
|
||||
self.path_pulse.write_text(pulse_config, encoding="utf-8")
|
||||
except OSError as err:
|
||||
_LOGGER.error(
|
||||
"Add-on %s can't write pulse/client.config: %s", self.slug, err
|
||||
|
|
|
@ -184,8 +184,7 @@ class AddonModel(CoreSysAttributes, ABC):
|
|||
return None
|
||||
|
||||
# Return data
|
||||
with readme.open("r") as readme_file:
|
||||
return readme_file.read()
|
||||
return readme.read_text(encoding="utf-8")
|
||||
|
||||
@property
|
||||
def repository(self) -> str:
|
||||
|
|
|
@ -94,7 +94,7 @@ async def initialize_coresys() -> CoreSys:
|
|||
|
||||
# Set Machine/Host ID
|
||||
if MACHINE_ID.exists():
|
||||
coresys.machine_id = MACHINE_ID.read_text().strip()
|
||||
coresys.machine_id = MACHINE_ID.read_text(encoding="utf-8").strip()
|
||||
|
||||
# Check if ENV is in development mode
|
||||
if coresys.dev:
|
||||
|
|
|
@ -55,7 +55,7 @@ class Core(CoreSysAttributes):
|
|||
if self._state == new_state:
|
||||
return
|
||||
try:
|
||||
RUN_SUPERVISOR_STATE.write_text(new_state.value)
|
||||
RUN_SUPERVISOR_STATE.write_text(new_state.value, encoding="utf-8")
|
||||
except OSError as err:
|
||||
_LOGGER.warning(
|
||||
"Can't update the Supervisor state to %s: %s", new_state, err
|
||||
|
|
|
@ -32,9 +32,7 @@ def interface_update_payload(
|
|||
|
||||
def ipv6_to_byte(ip_address: IPv6Address) -> str:
|
||||
"""Convert an ipv6 to an byte array."""
|
||||
return (
|
||||
f'[byte {", ".join("0x{:02x}".format(val) for val in ip_address.packed)}]'
|
||||
)
|
||||
return f'[byte {", ".join(f"0x{val:02x}" for val in ip_address.packed)}]'
|
||||
|
||||
# Init template
|
||||
env.filters["ipv4_to_int"] = ipv4_to_int
|
||||
|
|
|
@ -65,7 +65,7 @@ class HwDisk(CoreSysAttributes):
|
|||
return round(free / (1024.0 ** 3), 1)
|
||||
|
||||
def _get_mountinfo(self, path: str) -> str:
|
||||
mountinfo = _MOUNTINFO.read_text()
|
||||
mountinfo = _MOUNTINFO.read_text(encoding="utf-8")
|
||||
for line in mountinfo.splitlines():
|
||||
mountinfoarr = line.split()
|
||||
if mountinfoarr[4] == path:
|
||||
|
@ -92,7 +92,7 @@ class HwDisk(CoreSysAttributes):
|
|||
return None
|
||||
|
||||
# JEDEC health status DEVICE_LIFE_TIME_EST_TYP_A/B
|
||||
emmc_life_time = life_time_path.read_text().split()
|
||||
emmc_life_time = life_time_path.read_text(encoding="utf-8").split()
|
||||
|
||||
if len(emmc_life_time) < 2:
|
||||
return None
|
||||
|
|
|
@ -45,8 +45,7 @@ class HwHelper(CoreSysAttributes):
|
|||
def last_boot(self) -> Optional[str]:
|
||||
"""Return last boot time."""
|
||||
try:
|
||||
with _PROC_STAT.open("r") as stat_file:
|
||||
stats: str = stat_file.read()
|
||||
stats: str = _PROC_STAT.read_text(encoding="utf-8")
|
||||
except OSError as err:
|
||||
_LOGGER.error("Can't read stat data: %s", err)
|
||||
return None
|
||||
|
|
|
@ -114,8 +114,8 @@ class HomeAssistant(FileConfiguration, CoreSysAttributes):
|
|||
@property
|
||||
def api_url(self) -> str:
|
||||
"""Return API url to Home Assistant."""
|
||||
return "{}://{}:{}".format(
|
||||
"https" if self.api_ssl else "http", self.ip_address, self.api_port
|
||||
return (
|
||||
f"{'https' if self.api_ssl else 'http'}://{self.ip_address}:{self.api_port}"
|
||||
)
|
||||
|
||||
@property
|
||||
|
@ -257,8 +257,7 @@ class HomeAssistant(FileConfiguration, CoreSysAttributes):
|
|||
|
||||
# Write pulse config
|
||||
try:
|
||||
with self.path_pulse.open("w") as config_file:
|
||||
config_file.write(pulse_config)
|
||||
self.path_pulse.write_text(pulse_config, encoding="utf-8")
|
||||
except OSError as err:
|
||||
_LOGGER.error("Home Assistant can't write pulse/client.config: %s", err)
|
||||
else:
|
||||
|
|
|
@ -312,7 +312,7 @@ class PluginDns(PluginBase):
|
|||
data = self.hosts_template.render(entries=self._hosts)
|
||||
|
||||
try:
|
||||
self.hosts.write_text(data)
|
||||
self.hosts.write_text(data, encoding="utf-8")
|
||||
except OSError as err:
|
||||
_LOGGER.error("Can't update hosts: %s", err)
|
||||
raise CoreDNSError() from err
|
||||
|
|
|
@ -35,6 +35,6 @@ class EvaluateAppArmor(EvaluateBase):
|
|||
async def evaluate(self) -> None:
|
||||
"""Run evaluation."""
|
||||
try:
|
||||
return _APPARMOR_KERNEL.read_text().strip().upper() != "Y"
|
||||
return _APPARMOR_KERNEL.read_text(encoding="utf-8").strip().upper() != "Y"
|
||||
except OSError:
|
||||
return True
|
||||
|
|
|
@ -34,6 +34,6 @@ class EvaluateLxc(EvaluateBase):
|
|||
async def evaluate(self):
|
||||
"""Run evaluation."""
|
||||
with suppress(OSError):
|
||||
if "container=lxc" in Path("/proc/1/environ").read_text():
|
||||
if "container=lxc" in Path("/proc/1/environ").read_text(encoding="utf-8"):
|
||||
return True
|
||||
return Path("/dev/lxd/sock").exists()
|
||||
|
|
|
@ -143,7 +143,7 @@ class Supervisor(CoreSysAttributes):
|
|||
with TemporaryDirectory(dir=self.sys_config.path_tmp) as tmp_dir:
|
||||
profile_file = Path(tmp_dir, "apparmor.txt")
|
||||
try:
|
||||
profile_file.write_text(data)
|
||||
profile_file.write_text(data, encoding="utf-8")
|
||||
except OSError as err:
|
||||
raise SupervisorAppArmorError(
|
||||
f"Can't write temporary profile: {err!s}", _LOGGER.error
|
||||
|
|
|
@ -6,13 +6,13 @@ from pathlib import Path
|
|||
def load_json_fixture(filename: str) -> dict:
|
||||
"""Load a json fixture."""
|
||||
path = Path(Path(__file__).parent.joinpath("fixtures"), filename)
|
||||
return json.loads(path.read_text())
|
||||
return json.loads(path.read_text(encoding="utf-8"))
|
||||
|
||||
|
||||
def load_fixture(filename: str) -> str:
|
||||
"""Load a fixture."""
|
||||
path = Path(Path(__file__).parent.joinpath("fixtures"), filename)
|
||||
return path.read_text()
|
||||
return path.read_text(encoding="utf-8")
|
||||
|
||||
|
||||
def exists_fixture(filename: str) -> bool:
|
||||
|
|
Loading…
Reference in New Issue