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

Commit a98057d

Browse files
uppercase const name as recommended by pylint
1 parent db8b5c1 commit a98057d

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

gitcoin/validation.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Valid parameter values as seen at
44
# https://github.com/gitcoinco/web/blob/84babc30611c281c817582b4d677dda6366def83/app/dashboard/models.py#L119-L168
5-
options = {
5+
OPTIONS = {
66
'experience_level': ['Beginner', 'Intermediate', 'Advanced', 'Unknown'],
77
'project_length': ['Hours', 'Days', 'Weeks', 'Months', 'Unknown'],
88
'bounty_type': ['Bug', 'Security', 'Feature', 'Unknown'],
@@ -25,34 +25,40 @@
2525
]
2626
}
2727

28+
2829
def _validate_options(field_name, value):
2930
"""Validate values for the given field name."""
30-
if value in options[field_name]:
31+
if value in OPTIONS[field_name]:
3132
return value
3233
msg = 'Unknown value "{val}" for field "{name}".'
3334
raise ValueError(msg.format(val=value, name=field_name))
3435

36+
3537
def experience_level(value):
3638
"""Validate values for "experience_level"."""
3739
return _validate_options('experience_level', value)
3840

41+
3942
def project_length(value):
4043
"""Validate values for "project_length"."""
4144
return _validate_options('project_length', value)
4245

46+
4347
def bounty_type(value):
4448
"""Validate values for "bounty_type"."""
4549
return _validate_options('bounty_type', value)
4650

51+
4752
def idx_status(value):
4853
"""Validate values for "idx_status"."""
4954
return _validate_options('idx_status', value)
5055

56+
5157
def order_by(direction):
5258
"""Validate values for "order_by"."""
53-
if direction in options['order_by']:
59+
if direction in OPTIONS['order_by']:
5460
return direction
55-
if direction[0:1] == '-' and direction[1:] in options['order_by']:
61+
if direction[0:1] == '-' and direction[1:] in OPTIONS['order_by']:
5662
return direction
5763
msg = 'Unknown direction "{dir}" to order by.'
5864
raise ValueError(msg.format(dir=direction))

tests/test_live.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def test_multiple_value_filters(self):
5959
assert_is_list_of_bounties(result)
6060

6161
def test_order_by(self):
62-
sort_field_names = gitcoin.validation.options['order_by']
62+
sort_field_names = gitcoin.validation.OPTIONS['order_by']
6363
api = Gitcoin()
6464
for field_name in sort_field_names:
6565
for direction in [field_name, ''.join(('-', field_name))]:

0 commit comments

Comments
 (0)