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
« 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
5from pydantic import HttpUrl
7from nskit.common.configuration import BaseConfiguration
10class RepoClient(ABC):
11 """Repo management client."""
13 @abstractmethod
14 def create(self, repo_name: str):
15 """Create a repo."""
16 raise NotImplementedError()
18 @abstractmethod
19 def get_remote_url(self, repo_name: str) -> HttpUrl:
20 """Get the remote url for a repo."""
21 raise NotImplementedError()
23 @abstractmethod
24 def delete(self, repo_name: str):
25 """Delete a repo."""
26 raise NotImplementedError()
28 @abstractmethod
29 def check_exists(self, repo_name: str) -> bool:
30 """Check if the repo exists on the remote."""
31 raise NotImplementedError()
33 @abstractmethod
34 def list(self) -> List[str]:
35 """List all repos on the remote."""
36 raise NotImplementedError()
39class VCSProviderSettings(ABC, BaseConfiguration):
40 """Settings for VCS Provider."""
42 @abstractproperty
43 def repo_client(self) -> RepoClient:
44 """Return the instantiated repo client object for the provider."""
45 raise NotImplementedError()