Skip to content

Commit e9ed37c

Browse files
committed
fix: replace regex with startswith because it's faster
1 parent 6c4ac2e commit e9ed37c

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

  • custom_components/powercalc/power_profile/loader

custom_components/powercalc/power_profile/loader/local.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import json
33
import logging
44
import os
5-
import re
65
from typing import Any, cast
76

87
from homeassistant.core import HomeAssistant
@@ -154,8 +153,7 @@ def _load_custom_library(self) -> None:
154153

155154
manufacturer = manufacturer_dir.lower()
156155
for model_dir in next(os.walk(manufacturer_path))[1]:
157-
pattern = re.compile(r"^\..*")
158-
if pattern.match(model_dir):
156+
if model_dir.startswith("."):
159157
continue
160158

161159
model_path = os.path.join(manufacturer_path, model_dir)

0 commit comments

Comments
 (0)