is_query_like#

is_query_like(test_subject)#

Test whether something can be interpreted as a recognisable muspan query.

Parameters:
test_subjectany

Subject to test.

Returns:
bool

True if the test_subject is a muspan query, query_container, a tuple that can be expanded into a query, or a list/array of object IDs, otherwise False.

Notes

Tuple-like queries can be of the following forms:
  • (label_name, label_value) - interpreted as `ms.query.query(domain, ('label',label_name),'is',label_value)`

  • (‘collection’, collection_name) - interpreted as `ms.query.query(domain, ('collection',),'is',collection_name)`

  • (‘object’, object_type) - interpreted as `ms.query.query(domain, ('object','type'),'is',object_type)`

  • (‘label’, label_name) - interpreted as `ms.query.query(domain, ('label',label_name),'is',True)`, i.e., the object has this label