Skip to content
This repository was archived by the owner on Jan 26, 2023. It is now read-only.

Commit f6c7ab4

Browse files
add docstrings to validation
1 parent 034b410 commit f6c7ab4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

gitcoin/validation.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
"""Validate parameter values for the Gitcoin API client."""
12

23
# Valid parameter values as seen at
34
# https://github.com/gitcoinco/web/blob/84babc30611c281c817582b4d677dda6366def83/app/dashboard/models.py#L119-L168
@@ -25,24 +26,30 @@
2526
}
2627

2728
def _validate_options(field_name, value):
29+
"""Validate values for the given field name."""
2830
if value in options[field_name]:
2931
return value
3032
msg = 'Unknown value "{val}" for field "{name}".'
3133
raise ValueError(msg.format(val=value, name=field_name))
3234

3335
def experience_level(value):
36+
"""Validate values for "experience_level"."""
3437
return _validate_options('experience_level', value)
3538

3639
def project_length(value):
40+
"""Validate values for "project_length"."""
3741
return _validate_options('project_length', value)
3842

3943
def bounty_type(value):
44+
"""Validate values for "bounty_type"."""
4045
return _validate_options('bounty_type', value)
4146

4247
def idx_status(value):
48+
"""Validate values for "idx_status"."""
4349
return _validate_options('idx_status', value)
4450

4551
def order_by(direction):
52+
"""Validate values for "order_by"."""
4653
if direction in options['order_by']:
4754
return direction
4855
if direction[0:1] == '-' and direction[1:] in options['order_by']:

0 commit comments

Comments
 (0)