Coverage for oarepo_c4gh/crypt4gh/filter/add_recipient.py: 100%

15 statements  

« prev     ^ index     » next       coverage.py v7.10.2, created at 2025-08-07 12:05 +0000

1"""This module implements a filtered Crypt4GH container backed by 

2other Crypt4GH container but presenting added packets based on 

3recipients to be added. 

4 

5""" 

6 

7from ..common.proto4gh import Proto4GH 

8from ..common.header import Header 

9from typing import Generator, List 

10from ..common.data_block import DataBlock 

11from .header import FilterHeader 

12from .filter import Filter 

13from ...key import Key 

14from .add_recipient_header import AddRecipientHeader 

15 

16 

17class AddRecipientFilter(Filter): 

18 """The whole container filter which actually filters only header 

19 packets but for the writer the whole interface is needed. 

20 

21 """ 

22 

23 def __init__(self, original: Proto4GH, *recipients: List[Key]) -> None: 

24 """Only prepares the filtered header and original container 

25 with original blocks. 

26 

27 Parameters: 

28 original: the original container to be filtered. 

29 

30 """ 

31 super().__init__(original) 

32 self._header = AddRecipientHeader(original.header, recipients) 

33 

34 @property 

35 def header(self) -> FilterHeader: 

36 """Returns the filtered header instance.""" 

37 return self._header