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

7 statements  

« prev     ^ index     » next       coverage.py v7.4.4, created at 2025-02-19 11:48 +0000

1""" 

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

3""" 

4 

5import warnings 

6from typing import List, Union 

7from filip.models.ngsi_v2.iot import Device 

8from filip.utils.filter import filter_device_list as filter_device_list_new 

9 

10 

11def filter_device_list( 

12 devices: List[Device], 

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

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

15 entity_types: Union[str, List[str]] = None, 

16) -> List[Device]: 

17 """ 

18 Filter the given device list based on conditions 

19 

20 Args: 

21 devices: device list that need to be filtered 

22 device_ids: A list of device_id as filter condition 

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

24 entity_types: A list of entity_type as filter condition 

25 

26 Returns: 

27 List of matching devices 

28 """ 

29 warnings.warn( 

30 "This function has been moved to 'filip.utils.filter' " 

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

32 DeprecationWarning, 

33 ) 

34 

35 return filter_device_list_new( 

36 devices=devices, 

37 device_ids=device_ids, 

38 entity_names=entity_names, 

39 entity_types=entity_types, 

40 )