pyg90alarm 2.3.0__py3-none-any.whl → 2.3.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -68,7 +68,7 @@ class G90BaseList(Generic[T], ABC):
68
68
 
69
69
  :return: Async generator of entities
70
70
  """
71
- yield cast(T, None)
71
+ yield cast(T, None) # pragma: no cover
72
72
 
73
73
  @property
74
74
  async def entities(self) -> List[T]:
@@ -231,25 +231,30 @@ class G90BaseList(Generic[T], ABC):
231
231
  # Collect indexes in use by the existing entities
232
232
  occupied_indexes = set(x.index for x in entities)
233
233
  # Generate a set of possible indexes from 0 to the maximum index in
234
- # use
235
- possible_indexes = set(range(0, max(occupied_indexes)))
234
+ # use, or provide an empty set if there are no existing entities
235
+ if occupied_indexes:
236
+ possible_indexes = set(range(0, max(occupied_indexes)))
237
+ else:
238
+ # No occupied indexes, so possible_indexes is empty
239
+ possible_indexes = set()
236
240
 
237
241
  try:
238
242
  # Find the first free index by taking difference between
239
243
  # possible indexes and occupied ones, and then taking the minimum
240
244
  # value off the difference
241
245
  free_idx = min(
242
- set(possible_indexes).difference(occupied_indexes)
246
+ possible_indexes.difference(occupied_indexes)
243
247
  )
244
- _LOGGER.debug(
245
- 'Found free index: %s out of occupied indexes: %s',
246
- free_idx, occupied_indexes
247
- )
248
- return free_idx
249
248
  except ValueError:
250
249
  # If no gaps in existing indexes, then return the index next to
251
250
  # the last existing entity
252
- return len(entities)
251
+ free_idx = len(entities)
252
+
253
+ _LOGGER.debug(
254
+ 'Found free index=%s out of occupied indexes: %s',
255
+ free_idx, occupied_indexes
256
+ )
257
+ return free_idx
253
258
 
254
259
  @property
255
260
  def list_change_callback(self) -> Optional[ListChangeCallback[T]]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyg90alarm
3
- Version: 2.3.0
3
+ Version: 2.3.1
4
4
  Summary: G90 Alarm system protocol
5
5
  Home-page: https://github.com/hostcc/pyg90alarm
6
6
  Author: Ilia Sotnikov
@@ -15,7 +15,7 @@ pyg90alarm/definitions/devices.py,sha256=K0DQnyE-1hlhIGwRfZojKJYMSmlJzmyWcZ_98ur
15
15
  pyg90alarm/definitions/sensors.py,sha256=bDecBGyUo7wFVNuD5Fu1JNZQHcMDv-234BuNKioaQQs,27426
16
16
  pyg90alarm/entities/__init__.py,sha256=hHb6AOiC4Tz--rOWiiICMdLaZDs1Tf_xpWk_HeS_gO4,66
17
17
  pyg90alarm/entities/base_entity.py,sha256=hNhhuuwNuir54uVMZzPbjE0N6WL8wKvoW_KZa4R8L8U,2680
18
- pyg90alarm/entities/base_list.py,sha256=Ot4kd44CUheSvYETjEQBQNT_HaOTWZhKa-4L5pr8LMI,9276
18
+ pyg90alarm/entities/base_list.py,sha256=vNP0T8qg7lgrES0IBs4zOggQM6Uxyfarfds46bbAnH0,9482
19
19
  pyg90alarm/entities/device.py,sha256=eWE_N83hiDs5I-TT5F_W0Vb8sVugLldrDc9Lj9sgVLo,3700
20
20
  pyg90alarm/entities/device_list.py,sha256=PKnHEazeT3iUEaz70bW1OaWh0wq-7WOY-7dpV4FVCTc,5984
21
21
  pyg90alarm/entities/sensor.py,sha256=hunu-X-RhC8Wp52VMeanfqQg8rBSP8TG0qacJiFZEhg,27653
@@ -35,8 +35,8 @@ pyg90alarm/local/user_data_crc.py,sha256=JQBOPY3RlOgVtvR55R-rM8OuKjYW-BPXQ0W4pi6
35
35
  pyg90alarm/notifications/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
36
36
  pyg90alarm/notifications/base.py,sha256=_YX0kL9bqMAOdKBRZ5M-SIrwR4xotnZwgxqWoyEgxAk,16032
37
37
  pyg90alarm/notifications/protocol.py,sha256=mvn6hVNopOUgwQy4nWHKp7ydt5r84lsDWCCaWYJjL9Q,4422
38
- pyg90alarm-2.3.0.dist-info/licenses/LICENSE,sha256=f884inRbeNv-O-hbwz62Ro_1J8xiHRTnJ2cCx6A0WvU,1070
39
- pyg90alarm-2.3.0.dist-info/METADATA,sha256=bPvzjRYbZ8Cq_pO0pCbD4ensWw0m_HICuo0x4FbeORQ,12568
40
- pyg90alarm-2.3.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
41
- pyg90alarm-2.3.0.dist-info/top_level.txt,sha256=czHiGxYMyTk5QEDTDb0EpPiKqUMRa8zI4zx58Ii409M,11
42
- pyg90alarm-2.3.0.dist-info/RECORD,,
38
+ pyg90alarm-2.3.1.dist-info/licenses/LICENSE,sha256=f884inRbeNv-O-hbwz62Ro_1J8xiHRTnJ2cCx6A0WvU,1070
39
+ pyg90alarm-2.3.1.dist-info/METADATA,sha256=2t6egkAMkWvJjEhBAK_4MYn7tlCnuQYq85WQOz0Vtx8,12568
40
+ pyg90alarm-2.3.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
41
+ pyg90alarm-2.3.1.dist-info/top_level.txt,sha256=czHiGxYMyTk5QEDTDb0EpPiKqUMRa8zI4zx58Ii409M,11
42
+ pyg90alarm-2.3.1.dist-info/RECORD,,