@@ -85,33 +85,33 @@ def register(self, cls: Matcher) -> None:
85
85
... is_explicit = True
86
86
87
87
>>> @dataclasses.dataclass(repr=False)
88
- ... class GitHubLocation (GitURL):
88
+ ... class GitHubURL (GitURL):
89
89
... matchers: MatcherRegistry = MatcherRegistry(
90
90
... _matchers={'github_prefix': GitHubPrefix}
91
91
... )
92
92
93
- >>> GitHubLocation .is_valid(url='github:vcs-python/libvcs')
93
+ >>> GitHubURL .is_valid(url='github:vcs-python/libvcs')
94
94
True
95
95
96
- >>> GitHubLocation .is_valid(url='github:vcs-python/libvcs', is_explicit=True)
96
+ >>> GitHubURL .is_valid(url='github:vcs-python/libvcs', is_explicit=True)
97
97
True
98
98
99
99
Notice how ``pattern_defaults`` neatly fills the values for us.
100
100
101
- >>> GitHubLocation (url='github:vcs-python/libvcs')
102
- GitHubLocation (url=github:vcs-python/libvcs,
101
+ >>> GitHubURL (url='github:vcs-python/libvcs')
102
+ GitHubURL (url=github:vcs-python/libvcs,
103
103
scheme=https,
104
104
hostname=github.com,
105
105
path=vcs-python/libvcs,
106
106
matcher=gh-prefix)
107
107
108
- >>> GitHubLocation (url='github:vcs-python/libvcs').to_url()
108
+ >>> GitHubURL (url='github:vcs-python/libvcs').to_url()
109
109
'https://github.com/vcs-python/libvcs'
110
110
111
- >>> GitHubLocation .is_valid(url='gitlab:vcs-python/libvcs')
111
+ >>> GitHubURL .is_valid(url='gitlab:vcs-python/libvcs')
112
112
False
113
113
114
- `GitHubLocation ` sees this as invalid since it only has one matcher,
114
+ `GitHubURL ` sees this as invalid since it only has one matcher,
115
115
`GitHubPrefix`.
116
116
117
117
>>> GitURL.is_valid(url='gitlab:vcs-python/libvcs')
@@ -135,12 +135,12 @@ def register(self, cls: Matcher) -> None:
135
135
Option 1: Create a brand new matcher
136
136
137
137
>>> @dataclasses.dataclass(repr=False)
138
- ... class GitLabLocation (GitURL):
138
+ ... class GitLabURL (GitURL):
139
139
... matchers: MatcherRegistry = MatcherRegistry(
140
140
... _matchers={'gitlab_prefix': GitLabPrefix}
141
141
... )
142
142
143
- >>> GitLabLocation .is_valid(url='gitlab:vcs-python/libvcs')
143
+ >>> GitLabURL .is_valid(url='gitlab:vcs-python/libvcs')
144
144
True
145
145
146
146
Option 2 (global, everywhere): Add to the global :class:`GitURL`:
0 commit comments