Skip to content

Commit ac304e7

Browse files
committed
Convert docstrings to imperative
1 parent 1b8f214 commit ac304e7

11 files changed

Lines changed: 37 additions & 25 deletions

File tree

‎validators/between.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
@validator
66
def between(value, min=None, max=None):
77
"""
8-
Validates that a number is between minimum and/or maximum value.
8+
Validate that a number is between minimum and/or maximum value.
9+
910
This will work with any comparable type, such as floats, decimals and dates
1011
not just integers.
1112

‎validators/email.py‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@
2525
@validator
2626
def email(value, whitelist=None):
2727
"""
28-
Validates an email address. This validator is based on `Django's
29-
email validator`_. Returns ``True`` on success and
30-
:class:`~validators.utils.ValidationFailure` when validation fails.
28+
Validate an email address.
29+
30+
This validator is based on `Django's email validator`_. Returns
31+
``True`` on success and :class:`~validators.utils.ValidationFailure`
32+
when validation fails.
3133
3234
Examples::
3335

‎validators/i18n/fi.py‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@
1919
@validator
2020
def fi_business_id(business_id):
2121
"""
22-
Validates a Finnish Business ID. Each company in Finland has a distinct
23-
business id. For more information see `Finnish Trade Register`_
22+
Validate a Finnish Business ID.
23+
24+
Each company in Finland has a distinct business id. For more
25+
information see `Finnish Trade Register`_
2426
2527
.. _Finnish Trade Register:
2628
http://en.wikipedia.org/wiki/Finnish_Trade_Register
@@ -50,8 +52,9 @@ def fi_business_id(business_id):
5052
@validator
5153
def fi_ssn(ssn):
5254
"""
53-
Validates a Finnish Social Security Number. This validator is based on
54-
`django-localflavor-fi`_.
55+
Validate a Finnish Social Security Number.
56+
57+
This validator is based on `django-localflavor-fi`_.
5558
5659
.. _django-localflavor-fi:
5760
https://github.com/django/django-localflavor-fi/

‎validators/ip_address.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
@validator
55
def ipv4(value):
66
"""
7-
Returns whether or not given value is a valid IP version 4 address.
7+
Return whether or not given value is a valid IP version 4 address.
88
99
This validator is based on `WTForms IPAddress validator`_
1010
@@ -34,7 +34,7 @@ def ipv4(value):
3434
@validator
3535
def ipv6(value):
3636
"""
37-
Returns whether or not given value is a valid IP version 6 address.
37+
Return whether or not given value is a valid IP version 6 address.
3838
3939
This validator is based on `WTForms IPAddress validator`_.
4040

‎validators/length.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
@validator
66
def length(value, min=None, max=None):
77
"""
8-
Returns whether or not the length of given string is within a specified
8+
Return whether or not the length of given string is within a specified
99
range.
1010
1111
Examples::

‎validators/mac_address.py‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
@validator
99
def mac_address(value):
1010
"""
11-
Returns whether or not given value is a valid mac address. If the value is
12-
valid mac address this function returns ``True``, otherwise
13-
:class:`~validators.utils.ValidationFailure`.
11+
Return whether or not given value is a valid mac address.
12+
13+
If the value is valid mac address this function returns ``True``,
14+
otherwise :class:`~validators.utils.ValidationFailure`.
1415
1516
This validator is based on `WTForms MacAddress validator`_.
1617

‎validators/slug.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
@validator
99
def slug(value):
1010
"""
11-
Validates whether or not given value is valid slug (contains only
12-
alphanumeric characters, hyphens or underscores).
11+
Validate whether or not given value is valid slug.
12+
13+
Valid slug can contain only alphanumeric characters, hyphens and
14+
underscores.
1315
1416
Examples::
1517

‎validators/truthy.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
@validator
66
def truthy(value):
77
"""
8-
Validates that given value is not a falsey value.
8+
Validate that given value is not a falsey value.
99
1010
This validator is based on `WTForms DataRequired validator`_.
1111

‎validators/url.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414
@validator
1515
def url(value, require_tld=True):
1616
"""
17-
Returns whether or not given value is a valid URL. If the value is
18-
valid URL this function returns ``True``, otherwise
17+
Return whether or not given value is a valid URL.
18+
19+
If the value is valid URL this function returns ``True``, otherwise
1920
:class:`~validators.utils.ValidationFailure`.
2021
2122
This validator is based on `WTForms URL validator`_.

‎validators/utils.py‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def __nonzero__(self):
3636

3737
def func_args_as_dict(func, args, kwargs):
3838
"""
39-
Returns given function positional and key value arguments as an ordered
39+
Return given function's positional and key value arguments as an ordered
4040
dictionary.
4141
"""
4242
arg_names = list(
@@ -55,9 +55,10 @@ def func_args_as_dict(func, args, kwargs):
5555

5656
def validator(func, *args, **kwargs):
5757
"""
58-
A decorator that makes given function validator. Whenever the given
59-
function is called and returns ``False`` value this decorator returns
60-
:class:`ValidationFailure` object.
58+
A decorator that makes given function validator.
59+
60+
Whenever the given function is called and returns ``False`` value
61+
this decorator returns :class:`ValidationFailure` object.
6162
6263
Example::
6364

0 commit comments

Comments
 (0)