Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 609a123

Browse filesBrowse files
committed
refactor!: BaseProject to abstract base class
1 parent 5e5cbc4 commit 609a123
Copy full SHA for 609a123

File tree

Expand file treeCollapse file tree

1 file changed

+7
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-5
lines changed

‎libvcs/projects/base.py

Copy file name to clipboardExpand all lines: libvcs/projects/base.py
+7-5Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Base class for VCS Project plugins."""
22
import logging
33
import pathlib
4-
from typing import NamedTuple, Optional, Tuple
4+
from typing import NamedTuple, Optional, Protocol, Tuple
55
from urllib import parse as urlparse
66

77
from libvcs._internal.run import CmdLoggingAdapter, run
@@ -32,18 +32,21 @@ def convert_pip_url(pip_url: str) -> VCSLocation:
3232
return VCSLocation(url=url, rev=rev)
3333

3434

35-
class BaseProject:
35+
class BaseProject(Protocol):
3636
"""Base class for repositories."""
3737

38-
log_in_real_time = None
38+
log_in_real_time: bool
3939
"""Log command output to buffer"""
4040

41-
bin_name = ""
41+
bin_name: str
4242
"""VCS app name, e.g. 'git'"""
4343

4444
schemes: Tuple[str, ...] = ()
4545
"""List of supported schemes to register in ``urlparse.uses_netloc``"""
4646

47+
dir: StrPath
48+
"""CWD of project"""
49+
4750
def __init__(self, *, url: str, dir: StrPath, progress_callback=None, **kwargs):
4851
r"""
4952
Parameters
@@ -85,7 +88,6 @@ def __init__(self, *, url: str, dir: StrPath, progress_callback=None, **kwargs):
8588
self.progress_callback = progress_callback
8689

8790
#: Directory to check out
88-
self.dir: pathlib.Path
8991
if isinstance(dir, pathlib.Path):
9092
self.dir = dir
9193
else:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.