INNER CODE UNIT · Python
__init__
braedon/prometheus-es-exporter · prometheus_es_exporter/__init__.py:272
def __init__(self, choices, case_sensitive=True):
self.choices = choices
self.case_sensitive = case_sensitive
def get_metavar(self, param):
return '[%s]' % '|'.join(self.choices)
def get_missing_message(self, param):
return 'Choose one or more from:\n\t%s.' % ',\n\t'.join(self.choices)
def convert_one(self, value, param, ctx):
# Exact match
if value in self.choices:
return value
# Match through normalization and case sensitivity
# first do token_normalize_func, then lowercase
# preserve original `value` to produce an accurate message in