18
18
import logging
19
19
import pathlib
20
20
import re
21
- import typing
22
- from typing import Any , Dict , NamedTuple , Optional , TypedDict , Union
21
+ from typing import Any , Dict , Optional , Union
23
22
from urllib import parse as urlparse
24
23
25
24
from libvcs ._internal .types import StrOrBytesPath , StrPath
34
33
logger = logging .getLogger (__name__ )
35
34
36
35
37
- class GitRemoteDict (TypedDict ):
38
- """For use when hydrating GitProject via dict, and exporting as dict."""
39
-
40
- name : Optional [str ]
41
- fetch_url : str
42
- push_url : str
43
-
44
-
45
- class GitRemoteTuple (NamedTuple ):
46
- """For use when exporting GitRemote as tuple."""
47
-
48
- name : Optional [str ]
49
- fetch_url : str
50
- push_url : str
51
-
52
-
53
36
@dataclasses .dataclass
54
37
class GitRemote :
55
38
"""Structure containing git working copy information."""
@@ -58,31 +41,9 @@ class GitRemote:
58
41
fetch_url : str
59
42
push_url : str
60
43
61
- def to_tuple (self ) -> GitRemoteTuple :
62
- return GitRemoteTuple (* dataclasses .astuple (self ))
63
-
64
44
65
45
GitProjectRemoteDict = Dict [str , GitRemote ]
66
- GitFullRemoteDict = Dict [str , GitRemoteDict ]
67
- GitRemotesArgs = Union [None , GitFullRemoteDict , GitProjectRemoteDict , Dict [str , str ]]
68
-
69
-
70
- class GitStatusDict (TypedDict ):
71
- branch_oid : Optional [str ]
72
- branch_head : Optional [str ]
73
- branch_upstream : Optional [str ]
74
- branch_ab : Optional [str ]
75
- branch_ahead : Optional [str ]
76
- branch_behind : Optional [str ]
77
-
78
-
79
- class GitStatusTuple (typing .NamedTuple ):
80
- branch_oid : Optional [str ]
81
- branch_head : Optional [str ]
82
- branch_upstream : Optional [str ]
83
- branch_ab : Optional [str ]
84
- branch_ahead : Optional [str ]
85
- branch_behind : Optional [str ]
46
+ GitRemotesArgs = Union [None , GitProjectRemoteDict , Dict [str , str ]]
86
47
87
48
88
49
@dataclasses .dataclass
@@ -94,9 +55,6 @@ class GitStatus:
94
55
branch_ahead : Optional [str ] = None
95
56
branch_behind : Optional [str ] = None
96
57
97
- def to_tuple (self ) -> GitStatusTuple :
98
- return GitStatusTuple (* dataclasses .astuple (self ))
99
-
100
58
@classmethod
101
59
def from_stdout (cls , value : str ) -> "GitStatus" :
102
60
"""Returns ``git status -sb --porcelain=2`` extracted to a dict
0 commit comments