Add pyupgrade (in pre-commit and CI) (#33688)
* Add pyupgrade (in pre-commit and CI) * Fix leftover results of pyupgrade * Ensure we run for Python 3.7 on pyupgrade
This commit is contained in:
1 parent
5bf7e0fcc0
commit
f38011560f
9 files changed
+18
-9
No files matched your search
@@ -62,7 +62,7 @@ def validate(integrations: Dict[str, Integration], config: Config):
|
||||
codeowners_path = config.root / "CODEOWNERS"
|
||||
config.cache["codeowners"] = content = generate_and_validate(integrations)
|
||||
|
||||
with open(str(codeowners_path), "r") as fp:
|
||||
with open(str(codeowners_path)) as fp:
|
||||
if fp.read().strip() != content:
|
||||
config.add_error(
|
||||
"codeowners",
|
||||
|
||||
@@ -68,7 +68,7 @@ def validate(integrations: Dict[str, Integration], config: Config):
|
||||
config_flow_path = config.root / "homeassistant/generated/config_flows.py"
|
||||
config.cache["config_flow"] = content = generate_and_validate(integrations)
|
||||
|
||||
with open(str(config_flow_path), "r") as fp:
|
||||
with open(str(config_flow_path)) as fp:
|
||||
if fp.read().strip() != content:
|
||||
config.add_error(
|
||||
"config_flow",
|
||||
|
||||
@@ -17,7 +17,7 @@ class Error:
|
||||
|
||||
def __str__(self) -> str:
|
||||
"""Represent error as string."""
|
||||
return "[{}] {}".format(self.plugin.upper(), self.error)
|
||||
return f"[{self.plugin.upper()}] {self.error}"
|
||||
|
||||
|
||||
@attr.s
|
||||
|
||||
@@ -65,7 +65,7 @@ def validate(integrations: Dict[str, Integration], config: Config):
|
||||
ssdp_path = config.root / "homeassistant/generated/ssdp.py"
|
||||
config.cache["ssdp"] = content = generate_and_validate(integrations)
|
||||
|
||||
with open(str(ssdp_path), "r") as fp:
|
||||
with open(str(ssdp_path)) as fp:
|
||||
if fp.read().strip() != content:
|
||||
config.add_error(
|
||||
"ssdp",
|
||||
|
||||
@@ -120,7 +120,7 @@ def validate(integrations: Dict[str, Integration], config: Config):
|
||||
zeroconf_path = config.root / "homeassistant/generated/zeroconf.py"
|
||||
config.cache["zeroconf"] = content = generate_and_validate(integrations)
|
||||
|
||||
with open(str(zeroconf_path), "r") as fp:
|
||||
with open(str(zeroconf_path)) as fp:
|
||||
current = fp.read().strip()
|
||||
if current != content:
|
||||
config.add_error(
|
||||
|
||||
Reference in new issue
Block a user