Coverage for filip/utils/iot.py: 0%

7 statements  

« prev     ^ index     » next       coverage.py v7.4.4, created at 2024-11-20 16:54 +0000

1""" 

2Helper functions to handle the devices related with the IoT Agent 

3""" 

4import warnings 

5from typing import List, Union 

6from filip.models.ngsi_v2.iot import Device 

7from filip.utils.filter import filter_device_list as filter_device_list_new 

8 

9def filter_device_list(devices: List[Device], 

10 device_ids: Union[str, List[str]] = None, 

11 entity_names: Union[str, List[str]] = None, 

12 entity_types: Union[str, List[str]] = None) -> List[Device]: 

13 """ 

14 Filter the given device list based on conditions 

15 

16 Args: 

17 devices: device list that need to be filtered 

18 device_ids: A list of device_id as filter condition 

19 entity_names: A list of entity_name (e.g. entity_id) as filter condition. 

20 entity_types: A list of entity_type as filter condition 

21 

22 Returns: 

23 List of matching devices 

24 """ 

25 warnings.warn("This function has been moved to 'filip.utils.filter' " 

26 "and will be removed from this module in future releases!", 

27 DeprecationWarning) 

28 

29 return filter_device_list_new(devices=devices, 

30 device_ids=device_ids, 

31 entity_names=entity_names, 

32 entity_types=entity_types)