SearchSet

class SearchSet(searches_list=<factory>)

Bases: Iterator[Any]

Mutable iterator and collection of Search objects.

Attributes

searches_list

Methods

add(search)

Add a search to the collection.

remove(index)

Remove a search by index.

read_json(path)

Read a search collection from a JSON file.

write_json([path])

Serialize the collection and optionally write it to disk.

to_dicts()

Convert all searches to dictionaries.

Parameters:

searches_list (List[Any])

index: int = 0
add(search)

Add a search to the collection.

Parameters:
  • search (Any) – Search to append.

  • self (SearchSet)

Returns:

None.

Return type:

None

remove(index)

Remove a search by index.

Parameters:
  • index (int) – Search index to remove.

  • self (SearchSet)

Returns:

None.

Return type:

None

write_json(path=None)

Serialize the collection and optionally write it to disk.

Parameters:
  • path (str | None) – Optional destination file path.

  • self (SearchSet)

Returns:

JSON string when no path is supplied, otherwise None.

Return type:

str | None

to_dicts()

Convert all searches to dictionaries.

Returns:

Search parameter dictionaries.

Parameters:

self (SearchSet)

Return type:

List[Dict[str, Any]]

classmethod read_json(path)

Read a search collection from a JSON file.

Parameters:

path (str) – Source file path.

Returns:

Parsed search set.

Return type:

SearchSet