mirror of
https://github.com/PyCQA/flake8.git
synced 2026-04-02 11:56:52 +00:00
Add option_normalizer for setuptools
This commit is contained in:
parent
bf19122741
commit
f67552d09a
1 changed files with 12 additions and 0 deletions
|
|
@ -66,3 +66,15 @@ def force_disable_jobs(styleguide):
|
|||
def flag_on(val):
|
||||
"""Return true if flag is on"""
|
||||
return str(val).upper() in ('1', 'T', 'TRUE', 'ON')
|
||||
|
||||
|
||||
def option_normalizer(value):
|
||||
if str(value).upper() in ('1', 'T', 'TRUE', 'ON'):
|
||||
value = True
|
||||
if str(value).upper() in ('0', 'F', 'FALSE', 'OFF'):
|
||||
value = False
|
||||
|
||||
if isinstance(value, str):
|
||||
value = [opt.strip() for opt in value.split(',') if opt.strip()]
|
||||
|
||||
return value
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue