Coverage for functions \ flipdare \ search \ factory \ _search_document_factory.py: 100%

11 statements  

« prev     ^ index     » next       coverage.py v7.13.0, created at 2026-05-08 12:22 +1000

1#!/usr/bin/env python 

2# Copyright (c) 2026 Flipdare Pty Ltd. All rights reserved. 

3# 

4# This file is part of Flipdare's proprietary software and contains 

5# confidential and copyrighted material. Unauthorised copying, 

6# modification, distribution, or use of this file is strictly 

7# prohibited without prior written permission from Flipdare Pty Ltd. 

8# 

9# This software includes third-party components licensed under MIT, 

10# BSD, and Apache 2.0 licences. See THIRD_PARTY_NOTICES for details. 

11# 

12 

13 

14from abc import ABC, abstractmethod 

15from typing import Any 

16 

17from flipdare.core.tokenizer import Tokenizer 

18from flipdare.generated.shared.search.search_obj_type import SearchObjType 

19from flipdare.search.doc._search_document import SearchDocument 

20 

21__all__ = ["SearchDocumentFactory"] 

22 

23 

24class SearchDocumentFactory(ABC): 

25 """ 

26 NOTE: obj_id is used to represent the actual object being tagged/searched, 

27 NOTE: e.g., for a Dare, the obj_id is the dare's document ID. 

28 """ 

29 

30 def __init__(self, tokenizer: Tokenizer | None = None) -> None: 

31 if tokenizer is None: 

32 tokenizer = Tokenizer.instance() 

33 

34 self.tokenizer = tokenizer 

35 

36 @property 

37 @abstractmethod 

38 def obj_type(self) -> SearchObjType: ... 

39 

40 @abstractmethod 

41 def get_documents(self) -> list[SearchDocument[Any]] | None: ...