Method: pylint.config.option.Option._check_choice
Calls: 1520, Exceptions: 0, Paths: 1Back
Path 1: 1520 calls (1.0)
1def _check_choice(self) -> None:
2 if self.type in {"choice", "multiple_choice", "confidence"}:
3 if self.choices is None: # type: ignore[attr-defined]
4 raise optparse.OptionError(
5 "must supply a list of choices for type 'choice'", self
6 )
7 if not isinstance(self.choices, (tuple, list)): # type: ignore[attr-defined]
8 raise optparse.OptionError(
9 # pylint: disable-next=consider-using-f-string
10 "choices must be a list of strings ('%s' supplied)"
11 % str(type(self.choices)).split("'")[1], # type: ignore[attr-defined]
12 self,
13 )
14 elif self.choices is not None: # type: ignore[attr-defined]
15 raise optparse.OptionError(
16 f"must not supply choices for type {self.type!r}", self
17 )