Skip to content

Commit a3bca13

Browse files
committed
Note the version we added Validator in
Also add this to the methods for documentation purposes.
1 parent 6b8e178 commit a3bca13

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

src/rfc3986/validators.py

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
class Validator(object):
2222
"""Object used to configure validation of all objects in rfc3986.
2323
24+
.. versionadded:: 1.0
25+
2426
Example usage::
2527
2628
>>> from rfc3986 import api, validators
@@ -72,6 +74,8 @@ def __init__(self):
7274
def allow_schemes(self, *schemes):
7375
"""Require the scheme to be one of the provided schemes.
7476
77+
.. versionadded:: 1.0
78+
7579
:param schemes:
7680
Schemes, without ``://`` that are allowed.
7781
:returns:
@@ -86,6 +90,8 @@ def allow_schemes(self, *schemes):
8690
def allow_hosts(self, *hosts):
8791
"""Require the host to be one of the provided hosts.
8892
93+
.. versionadded:: 1.0
94+
8995
:param hosts:
9096
Hosts that are allowed.
9197
:returns:
@@ -100,6 +106,8 @@ def allow_hosts(self, *hosts):
100106
def allow_ports(self, *ports):
101107
"""Require the port to be one of the provided ports.
102108
109+
.. versionadded:: 1.0
110+
103111
:param ports:
104112
Ports that are allowed.
105113
:returns:
@@ -114,18 +122,36 @@ def allow_ports(self, *ports):
114122
return self
115123

116124
def allow_use_of_password(self):
117-
"""Allow passwords to be present in the URI."""
125+
"""Allow passwords to be present in the URI.
126+
127+
.. versionadded:: 1.0
128+
129+
:returns:
130+
The validator instance.
131+
:rtype:
132+
Validator
133+
"""
118134
self.allow_password = True
119135
return self
120136

121137
def forbid_use_of_password(self):
122-
"""Prevent passwords from being included in the URI."""
138+
"""Prevent passwords from being included in the URI.
139+
140+
.. versionadded:: 1.0
141+
142+
:returns:
143+
The validator instance.
144+
:rtype:
145+
Validator
146+
"""
123147
self.allow_password = False
124148
return self
125149

126150
def require_presence_of(self, *components):
127151
"""Require the components provided.
128152
153+
.. versionadded:: 1.0
154+
129155
:param components:
130156
Names of components from :attr:`Validator.COMPONENT_NAMES`.
131157
:returns:
@@ -147,6 +173,8 @@ def require_presence_of(self, *components):
147173
def validate(self, uri):
148174
"""Check a URI for conditions specified on this validator.
149175
176+
.. versionadded:: 1.0
177+
150178
:param uri:
151179
Parsed URI to validate.
152180
:type uri:

0 commit comments

Comments
 (0)