@File : utils.py @Time : 2026/06/10 11:02:26 @Author : Alejandro Marrero (amarrerd@ull.edu.es) @Version : 1.0 @Contact : amarrerd@ull.edu.es @License : (C)Copyright 2026, Alejandro Marrero @Desc : None

check_valid_instance_batch(instances)

Checks that all objects are valid Instances

Parameters:
  • instances (Sequence[Instance]) –

    Sequence of object of the Instance class

Returns:
  • bool( bool ) –

    If all of the objects inside the instances parameter are valid

Source code in digneapy/archives/_utils.py
18
19
20
21
22
23
24
25
26
27
def check_valid_instance_batch(instances: Sequence[Instance]) -> bool:
    """Checks that all objects are valid Instances

    Args:
        instances (Sequence[Instance]): Sequence of object of the Instance class

    Returns:
        bool: If all of the objects inside the instances parameter are valid
    """
    return all(isinstance(x, Instance) for x in instances)

check_valid_shapes(instances, *args)

Check that all components have the same length of the instances

Parameters:
  • instances (Sequence[Instance]) –

    Collection of instances to compare the length to.

Returns:
  • bool( bool ) –

    True if all the other components have the same length. False otherwise.

Source code in digneapy/archives/_utils.py
30
31
32
33
34
35
36
37
38
39
40
41
42
43
def check_valid_shapes(instances: Sequence[Instance], *args) -> bool:
    """Check that all components have the same length of the instances

    Args:
        instances (Sequence[Instance]): Collection of instances to compare the length to.

    Returns:
        bool: True if all the other components have the same length. False otherwise.
    """
    expected = len(instances)
    try:
        return all(len(component) == expected for component in args)
    except Exception:
        return False