@@ -43,6 +43,7 @@ def register(self, cls: Matcher) -> None:
43
43
44
44
.. currentmodule:: libvcs.parse.git
45
45
46
+ >>> from dataclasses import dataclass
46
47
>>> from libvcs.parse.git import GitURL, GitBaseURL
47
48
48
49
:class:`GitBaseURL` - the ``git(1)`` compliant parser - won't accept a pip-style URL:
@@ -71,8 +72,9 @@ def register(self, cls: Matcher) -> None:
71
72
... 'scheme': 'https'
72
73
... }
73
74
74
- >>> class GitHubLocation(GitURL):
75
- ... matchers = MatcherRegistry = MatcherRegistry(
75
+ >>> @dataclasses.dataclass(repr=False)
76
+ ... class GitHubLocation(GitURL):
77
+ ... matchers: MatcherRegistry = MatcherRegistry(
76
78
... _matchers={'github_prefix': GitHubPrefix}
77
79
... )
78
80
@@ -94,10 +96,11 @@ def register(self, cls: Matcher) -> None:
94
96
95
97
Option 1: Create a brand new matcher
96
98
97
- >>> class GitLabLocation(GitURL):
98
- ... matchers = MatcherRegistry = MatcherRegistry(
99
- ... _matchers={'gitlab_prefix': GitLabPrefix}
100
- ... )
99
+ >>> @dataclasses.dataclass(repr=False)
100
+ ... class GitLabLocation(GitURL):
101
+ ... matchers: MatcherRegistry = MatcherRegistry(
102
+ ... _matchers={'gitlab_prefix': GitLabPrefix}
103
+ ... )
101
104
102
105
>>> GitLabLocation.is_valid(url='gitlab:vcs-python/libvcs')
103
106
True
@@ -122,7 +125,8 @@ def register(self, cls: Matcher) -> None:
122
125
123
126
>>> from libvcs.parse.git import DEFAULT_MATCHERS, PIP_DEFAULT_MATCHERS
124
127
125
- >>> class GitURLWithPip(GitBaseURL):
128
+ >>> @dataclasses.dataclass(repr=False)
129
+ ... class GitURLWithPip(GitBaseURL):
126
130
... matchers: MatcherRegistry = MatcherRegistry(
127
131
... _matchers={m.label: m for m in [*DEFAULT_MATCHERS, *PIP_DEFAULT_MATCHERS]}
128
132
... )
0 commit comments