3
3
# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt
4
4
5
5
import functools
6
- import optparse # pylint: disable=deprecated-module
7
6
8
7
from pylint .config .utils import _parse_rich_type_value
9
- from pylint .lint import PyLinter
10
8
from pylint .testutils .checker_test_case import CheckerTestCase
11
9
12
10
@@ -20,32 +18,7 @@ def set_config(**kwargs):
20
18
def _wrapper (fun ):
21
19
@functools .wraps (fun )
22
20
def _forward (self , * args , ** test_function_kwargs ):
23
- try :
24
- for key , value in kwargs .items ():
25
- self .checker .set_option (key .replace ("_" , "-" ), value )
26
- except optparse .OptionError :
27
- # Check if option is one of the base options of the PyLinter class
28
- for key , value in kwargs .items ():
29
- try :
30
- self .checker .set_option (
31
- key .replace ("_" , "-" ),
32
- value ,
33
- optdict = dict (PyLinter ().make_options ())[
34
- key .replace ("_" , "-" )
35
- ],
36
- )
37
- except KeyError :
38
- # pylint: disable-next=fixme
39
- # TODO: Find good way to double load checkers in unittests
40
- # When options are used by multiple checkers we need to load both of them
41
- # to be able to get an optdict
42
- self .checker .set_option (
43
- key .replace ("_" , "-" ),
44
- value ,
45
- optdict = {},
46
- )
47
-
48
- # Set option via argparse
21
+ """Set option via argparse."""
49
22
# pylint: disable-next=fixme
50
23
# TODO: Revisit this decorator after all checkers have switched
51
24
options = []
0 commit comments