Coverage for .nox/test-3-12/lib/python3.12/site-packages/nskit/vcs/providers/abstract.py: 75%

24 statements  

« prev     ^ index     » next       coverage.py v7.3.3, created at 2023-12-19 17:42 +0000

1"""Abstract classes for the provider.""" 

2from abc import ABC, abstractmethod, abstractproperty 

3from typing import List 

4 

5from pydantic import HttpUrl 

6 

7from nskit.common.configuration import BaseConfiguration 

8 

9 

10class RepoClient(ABC): 

11 """Repo management client.""" 

12 

13 @abstractmethod 

14 def create(self, repo_name: str): 

15 """Create a repo.""" 

16 raise NotImplementedError() 

17 

18 @abstractmethod 

19 def get_remote_url(self, repo_name: str) -> HttpUrl: 

20 """Get the remote url for a repo.""" 

21 raise NotImplementedError() 

22 

23 @abstractmethod 

24 def delete(self, repo_name: str): 

25 """Delete a repo.""" 

26 raise NotImplementedError() 

27 

28 @abstractmethod 

29 def check_exists(self, repo_name: str) -> bool: 

30 """Check if the repo exists on the remote.""" 

31 raise NotImplementedError() 

32 

33 @abstractmethod 

34 def list(self) -> List[str]: 

35 """List all repos on the remote.""" 

36 raise NotImplementedError() 

37 

38 

39class VCSProviderSettings(ABC, BaseConfiguration): 

40 """Settings for VCS Provider.""" 

41 

42 @abstractproperty 

43 def repo_client(self) -> RepoClient: 

44 """Return the instantiated repo client object for the provider.""" 

45 raise NotImplementedError()