@@ -26,11 +26,16 @@ def children(object_or_name: any, selector: dict) -> tuple:
2626 object_or_name (any): symbolic name, real name, or object reference.
2727
2828 selector (dict): The selector is a dictionary of key-value pairs,
29- where a key is a property of an object, and value is expected value.
29+ The selector is a dictionary consisting of key-value pairs.
30+ In this dictionary:
31+ - Each key represents a property of an object.
32+ - Each value can either be an expected value for that property
33+ or a function that takes exactly one argument.
34+
35+ Additionally, the dictionary can have a key 'type'
36+ where the value should be the expected object type.
3037 An object will pass verification
3138 if the object's property value matches the selector value.
32- Selectors may include functions.
33- The passed functions must accept exactly one argument.
3439
3540 Returns:
3641 Children objects that met the selector criteria.
@@ -62,11 +67,11 @@ def find(object_or_name: any, selector: dict = None, max_depth: int = None) -> t
6267 object_or_name (any): symbolic name, real name, or object reference.
6368
6469 selector (dict, optional): The selector is a dictionary of key-value pairs,
65- where a key is a property of an object, and value is expected value.
70+ where a key is a property of an object and value is expected value
71+ or function. The passed functions must accept exactly one argument.
72+ Accepted key is also 'type' and then value should by object type.
6673 An object will pass verification
6774 if the object's property value matches the selector value.
68- Selectors may include functions.
69- The passed functions must accept exactly one argument.
7075 Defaults to {}, which means all objects pass the verification.
7176
7277 max_depth (int): defines maximum depth in the object structure that should be
@@ -122,11 +127,11 @@ def find_ancestor(object_or_name: any, selector: dict):
122127 object_or_name (any): symbolic name, real name, or object reference.
123128
124129 selector (dict): The selector is a dictionary of key-value pairs,
125- where a key is a property of an object, and value is expected value.
130+ where a key is a property of an object and value is expected value
131+ or function. The passed functions must accept exactly one argument.
132+ Accepted key is also 'type' and then value should by object type.
126133 An object will pass verification
127134 if the object's property value matches the selector value.
128- Selectors may include functions.
129- The passed functions must accept exactly one argument.
130135
131136 Returns:
132137 (Squish object / None): The ancestor object that matches the selector.
@@ -168,11 +173,11 @@ def siblings(object_or_name: any, selector: dict = None) -> tuple:
168173 object_or_name (any): symbolic name, real name, or object reference.
169174
170175 selector (dict, optional): The selector is a dictionary of key-value pairs,
171- where a key is a property of an object, and value is expected value.
176+ where a key is a property of an object and value is expected value
177+ or function. The passed functions must accept exactly one argument.
178+ Accepted key is also 'type' and then value should by object type.
172179 An object will pass verification
173180 if the object's property value matches the selector value.
174- Selectors may include functions.
175- The passed functions must accept exactly one argument.
176181 Defaults to {}, which means all objects pass the verification.
177182
178183 Returns:
@@ -213,11 +218,11 @@ def _is_matching(object_or_name: any, selector: dict) -> bool:
213218 object_or_name (any): symbolic name, real name, or object reference.
214219
215220 selector (dict, optional): The selector is a dictionary of key-value pairs,
216- where a key is a property of an object, and value is expected value.
221+ where a key is a property of an object and value is expected value
222+ or function. The passed functions must accept exactly one argument.
223+ Accepted key is also 'type' and then value should by object type.
217224 An object will pass verification
218225 if the object's property value matches the selector value.
219- Selectors may include functions.
220- The passed functions must accept exactly one argument.
221226 Defaults to {}, which means all objects pass the verification.
222227
223228 Returns:
@@ -241,7 +246,7 @@ def _is_matching(object_or_name: any, selector: dict) -> bool:
241246 # object has given attribute
242247 attr = getattr (object_reference , key )
243248 if isinstance (expected_value , types .FunctionType ):
244- # The key is a lambda function
249+ # The expected_value is a lambda function
245250 lambda_function = expected_value
246251 lambda_result = lambda_function (attr )
247252 if not isinstance (lambda_result , bool ):
0 commit comments