Coverage for oarepo_c4gh / crypt4gh / common / header.py: 100%

14 statements  

« prev     ^ index     » next       coverage.py v7.12.0, created at 2025-12-06 16:58 +0000

1"""Protocol for header implementation. 

2 

3""" 

4 

5from typing import Protocol, abstractmethod 

6 

7 

8class Header(Protocol): 

9 """This is a protocol class which guarantees that a header packets 

10 collection is available by its descendants. The properties 

11 provided are a list of packets - both readable and unreadable - 

12 and header metadata fields magic_bytes and version. 

13 

14 """ 

15 

16 @property 

17 @abstractmethod 

18 def packets(self) -> list: 

19 """Must return original or transformed list of header packets.""" 

20 ... 

21 

22 @property 

23 @abstractmethod 

24 def magic_bytes(self) -> bytes: 

25 """Must return the original magic bytes.""" 

26 ... 

27 

28 @property 

29 @abstractmethod 

30 def version(self) -> int: 

31 """Must return the version of the loaded/transformer 

32 container. Must always return 1. 

33 

34 """ 

35 ... 

36 

37 @property 

38 @abstractmethod 

39 def edit_list(self) -> list[int]: 

40 """Must return the skip and keep lengths list of the edit 

41 list.""" 

42 ...