Coverage for src/python/ensembl/vep/output/factory/stream/base.py: 100%

8 statements  

« prev     ^ index     » next       coverage.py v7.17.2, created at 2026-11-18 14:41 +0000

1# See the NOTICE file distributed with this work for additional information 

2# regarding copyright ownership. 

3# 

4# Licensed under the Apache License, Version 2.0 (the "License"); 

5# you may not use this file except in compliance with the License. 

6# You may obtain a copy of the License at 

7# http://www.apache.org/licenses/LICENSE-2.0 

8# 

9# Unless required by applicable law or agreed to in writing, software 

10# distributed under the License is distributed on an "AS IS" BASIS, 

11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 

12# See the License for the specific language governing permissions and 

13# limitations under the License. 

14"""The contract for a format adapter over annotated variants.""" 

15 

16from __future__ import annotations 

17 

18from collections.abc import Iterable, Iterator 

19from typing import Protocol, TypeVar 

20 

21from ensembl.vep.output.factory.base import AnnotatedVariant 

22 

23__all__ = ["AnnotationStreamFactory"] 

24 

25RecordT_co = TypeVar("RecordT_co", covariant=True) 

26 

27 

28class AnnotationStreamFactory(Protocol[RecordT_co]): 

29 """Record factory for one annotation output representation.""" 

30 

31 def records(self, variants: Iterable[AnnotatedVariant]) -> Iterator[RecordT_co]: 

32 """Yield one output record for each annotated variant."""