Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/connexion/frameworks/abstract.py: 78%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

23 statements  

1import abc 

2import typing as t 

3 

4 

5class Framework(t.Protocol): 

6 @staticmethod 

7 @abc.abstractmethod 

8 def is_framework_response(response: t.Any) -> bool: 

9 """Return True if provided response is a framework type""" 

10 raise NotImplementedError 

11 

12 @classmethod 

13 @abc.abstractmethod 

14 def connexion_to_framework_response(cls, response): 

15 """Cast ConnexionResponse to framework response class""" 

16 raise NotImplementedError 

17 

18 @classmethod 

19 @abc.abstractmethod 

20 def build_response( 

21 cls, 

22 data: t.Any, 

23 *, 

24 content_type: t.Optional[str] = None, 

25 headers: t.Optional[dict] = None, 

26 status_code: t.Optional[int] = None, 

27 ): 

28 raise NotImplementedError 

29 

30 @staticmethod 

31 @abc.abstractmethod 

32 def get_request(*args, **kwargs): 

33 """Return a framework request from the context.""" 

34 raise NotImplementedError 

35 

36 @staticmethod 

37 @abc.abstractmethod 

38 def get_body(request): 

39 """Get body from a framework request""" 

40 raise NotImplementedError