1
1
"""Base class for VCS Project plugins."""
2
2
import logging
3
3
import pathlib
4
- from typing import NamedTuple , Optional , Tuple
4
+ from typing import NamedTuple , Optional , Protocol , Tuple
5
5
from urllib import parse as urlparse
6
6
7
7
from libvcs ._internal .run import CmdLoggingAdapter , run
@@ -32,18 +32,21 @@ def convert_pip_url(pip_url: str) -> VCSLocation:
32
32
return VCSLocation (url = url , rev = rev )
33
33
34
34
35
- class BaseProject :
35
+ class BaseProject ( Protocol ) :
36
36
"""Base class for repositories."""
37
37
38
- log_in_real_time = None
38
+ log_in_real_time : bool
39
39
"""Log command output to buffer"""
40
40
41
- bin_name = ""
41
+ bin_name : str
42
42
"""VCS app name, e.g. 'git'"""
43
43
44
44
schemes : Tuple [str , ...] = ()
45
45
"""List of supported schemes to register in ``urlparse.uses_netloc``"""
46
46
47
+ dir : StrPath
48
+ """CWD of project"""
49
+
47
50
def __init__ (self , * , url : str , dir : StrPath , progress_callback = None , ** kwargs ):
48
51
r"""
49
52
Parameters
@@ -85,7 +88,6 @@ def __init__(self, *, url: str, dir: StrPath, progress_callback=None, **kwargs):
85
88
self .progress_callback = progress_callback
86
89
87
90
#: Directory to check out
88
- self .dir : pathlib .Path
89
91
if isinstance (dir , pathlib .Path ):
90
92
self .dir = dir
91
93
else :
0 commit comments