Kaynağa Gözat

Bump version to 2026.5.0

- enable Bugbear ruff checks and fix issues (some test issues silenced)
Jason Rumney 2 ay önce
ebeveyn
işleme
7d6cf8dffa

+ 1 - 1
custom_components/tuya_local/entity.py

@@ -55,7 +55,7 @@ class TuyaLocalEntity:
         own_name = self._config.name
         if not own_name and not self.use_device_name:
             # super has the translation logic
-            own_name = getattr(super(), "name")
+            own_name = super().name
         return own_name
 
     @property

+ 5 - 1
custom_components/tuya_local/helpers/device_config.py

@@ -939,10 +939,14 @@ class TuyaDpsConfig:
 
         return c_match
 
-    def get_values_to_set(self, device, value, pending_map={}):
+    def get_values_to_set(self, device, value, pending_map=None):
         """Return the dps values that would be set when setting to value"""
         result = value
         dps_map = {}
+
+        if pending_map is None:
+            pending_map = {}
+
         if self.readonly:
             return dps_map
 

+ 1 - 1
custom_components/tuya_local/manifest.json

@@ -18,5 +18,5 @@
         "tinytuya==1.18.0",
         "tuya-device-sharing-sdk~=0.2.4"
     ],
-    "version": "2026.4.3"
+    "version": "2026.5.0"
 }

+ 4 - 1
pyproject.toml

@@ -52,13 +52,16 @@ select = [
   "E",     # pycodestyle
   "W",     # pycodestyle warnings
 #  "S",     # flake8-bandit
-#  "B",     # flake8-bugbear
+  "B",     # flake8-bugbear
   "A",    # flake8-builtins
 ]
 ignore = [
   "E501",  # Duplicate of format rule, hits on tests
 ]
 
+[tool.ruff.lint.per-file-ignores]
+"tests/**.py" = ["B011", "B028"]
+
 [tool.uv.build-backend]
 module-name = ["custom_components.tuya_local", "util"]
 module-root = ""

+ 1 - 1
tests/devices/test_goldair_gpph_heater.py

@@ -182,7 +182,7 @@ class TestGoldairHeater(
         self.assertIsNone(self.subject.max_humidity)
         self.assertIsNone(self.subject.current_humidity)
         with self.assertRaises(NotImplementedError):
-            self.subject.target_humidity
+            self.subject.target_humidity  # noqa: B018
 
     async def test_set_humidity_unsupported(self):
         with self.assertRaises(NotImplementedError):

+ 4 - 1
tests/mixins/light.py

@@ -173,9 +173,12 @@ class DimmableLightTests:
         dps,
         subject,
         offval=0,
-        tests=[(100, 100)],
+        tests=None,
         no_off=False,
     ):
+        if tests is None:
+            tests = [(100, 100)]
+
         self.dimmableLight = subject
         self.dimmableLightDps = dps
         self.dimmableLightOff = offval

+ 2 - 2
tests/mixins/text.py

@@ -23,7 +23,7 @@ class BasicTextTests:
         mode=TextMode.TEXT,
         pattern=None,
         testdata=None,
-        extra_state={},
+        extra_state=None,
     ):
         self.basicText = subject
         self.basicTextDp = dp
@@ -32,7 +32,7 @@ class BasicTextTests:
         self.basicTextMode = mode
         self.basicTextPattern = pattern
         self.basicTextTestData = testdata
-        self.basicTextExtra = extra_state
+        self.basicTextExtra = extra_state or {}
 
     def test_text_min_value(self):
         if self.basicTextMin is not None:

+ 1 - 1
tests/test_device_config.py

@@ -311,7 +311,7 @@ KNOWN_DPS = {
 def test_can_find_config_files():
     """Test that the config files can be found by the parser."""
     found = False
-    for cfg in available_configs():
+    for _ in available_configs():
         found = True
         break
     assert found

+ 1 - 1
tests/test_translations.py

@@ -14,7 +14,7 @@ import custom_components.tuya_local as root
 
 def get_translations():
     translations = join(dirname(root.__file__), "translations")
-    for path, dirs, files in walk(translations):
+    for path, _, files in walk(translations):
         for file in files:
             if fnmatch(file, "*.json") and file != "en.json":
                 yield (file, load_json(join(path, file)))