Skip to content

Commit

Permalink
chore: rename the proxy class
Browse files Browse the repository at this point in the history
  • Loading branch information
phil65 committed Nov 14, 2024
1 parent b5613b8 commit c4e12d3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/githarbor/core/proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
)


class RepositoryProxy(BaseRepository):
class Repository(BaseRepository):
"""Proxy class that forwards all method calls to a repository instance."""

def __init__(self, repository: BaseRepository) -> None:
Expand Down
10 changes: 5 additions & 5 deletions src/githarbor/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from typing import TYPE_CHECKING, Any, ClassVar

from githarbor.core.proxy import RepositoryProxy
from githarbor.core.proxy import Repository
from githarbor.exceptions import RepositoryNotFoundError


Expand Down Expand Up @@ -32,7 +32,7 @@ def decorator(repo_class: type[BaseRepository]) -> type[BaseRepository]:
return decorator

@classmethod
def create(cls, name: str, **kwargs: Any) -> RepositoryProxy:
def create(cls, name: str, **kwargs: Any) -> Repository:
"""Create a proxy-wrapped repository instance by name.
Args:
Expand All @@ -48,10 +48,10 @@ def create(cls, name: str, **kwargs: Any) -> RepositoryProxy:
if not (repo_class := cls._repos.get(name)):
msg = f"Repository type {name} not found"
raise RepositoryNotFoundError(msg)
return RepositoryProxy(repo_class(**kwargs))
return Repository(repo_class(**kwargs))

@classmethod
def from_url(cls, url: str, **kwargs: Any) -> RepositoryProxy:
def from_url(cls, url: str, **kwargs: Any) -> Repository:
"""Create a proxy-wrapped repository instance from a URL.
Args:
Expand All @@ -66,7 +66,7 @@ def from_url(cls, url: str, **kwargs: Any) -> RepositoryProxy:
"""
for repo_class in cls._repos.values():
if repo_class.supports_url(url):
return RepositoryProxy(repo_class.from_url(url, **kwargs))
return Repository(repo_class.from_url(url, **kwargs))

msg = f"No repository implementation found for URL: {url}"
raise RepositoryNotFoundError(msg)
Expand Down
6 changes: 3 additions & 3 deletions src/githarbor/repositories.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


if TYPE_CHECKING:
from githarbor.core.proxy import RepositoryProxy
from githarbor.core.proxy import Repository


if importlib.util.find_spec("github"):
Expand Down Expand Up @@ -45,15 +45,15 @@
RepoRegistry.register("local")(LocalRepository)


def create_repository(url: str, **kwargs: Any) -> RepositoryProxy:
def create_repository(url: str, **kwargs: Any) -> Repository:
"""Create a proxy-wrapped repository instance from a URL.
Args:
url: The repository URL (e.g. 'https://github.com/owner/repo')
**kwargs: Repository-specific configuration (tokens, credentials, etc.)
Returns:
RepositoryProxy: Proxy-wrapped repository instance
Repository: Proxy-wrapped repository instance
Raises:
RepositoryNotFoundError: If the URL isn't supported or no repository found
Expand Down

0 comments on commit c4e12d3

Please sign in to comment.