Kaynağa Gözat

fix (time): use array indexes to splice strings

Was using the non-existent substring() method that every other language has,
but Python does not. Use array indexing instead.

Issue #4461
Jason Rumney 6 gün önce
ebeveyn
işleme
d605c497ea
1 değiştirilmiş dosya ile 3 ekleme ve 3 silme
  1. 3 3
      custom_components/tuya_local/time.py

+ 3 - 3
custom_components/tuya_local/time.py

@@ -86,9 +86,9 @@ class TuyaLocalTime(TuyaLocalEntity, TimeEntity):
                         hours = hms[0 : len(hms) - 2]
                         minutes = hms[len(hms) - 2 :]
                     else:
-                        hours = hms.substring(0, len(hms) - 4)
-                        minutes = hms.substring(len(hms) - 4, len(hms) - 2)
-                        seconds = hms.substring(len(hms) - 2)
+                        hours = hms[: len(hms) - 4]
+                        minutes = hms[len(hms) - 4 : len(hms) - 2]
+                        seconds = hms[len(hms) - 2 :]
         if hours is None and minutes is None and seconds is None:
             return None
         hours = hours or 0