Coverage for src/fluree_py/http/protocol/mixin/commit.py: 80%

10 statements  

« prev     ^ index     » next       coverage.py v7.8.0, created at 2025-04-02 03:03 +0000

1from typing import Protocol 

2 

3from fluree_py.http.response import FlureeResponse 

4 

5 

6class SupportsCommit(Protocol): 

7 """Protocol for objects that support synchronous commit operations.""" 

8 

9 def commit(self) -> FlureeResponse: 

10 """Executes the transaction synchronously. 

11 

12 Exceptions: 

13 httpx.RequestError: If the HTTP request fails. 

14 TypeError: If the type parameter cannot be resolved. 

15 """ 

16 ... 

17 

18 

19class SupportsAsyncCommit(Protocol): 

20 """Protocol for objects that support asynchronous commit operations.""" 

21 

22 async def acommit(self) -> FlureeResponse: 

23 """Executes the transaction asynchronously. 

24 

25 Exceptions: 

26 httpx.RequestError: If the HTTP request fails. 

27 TypeError: If the type parameter cannot be resolved. 

28 """ 

29 ... 

30 

31 

32class SupportsCommitable(SupportsCommit, SupportsAsyncCommit, Protocol): 

33 """Protocol for objects that support both sync and async commit operations.""" 

34 

35 pass