Coverage for C:\Repos\ekr-pylint\pylint\config\configuration_mixin.py: 25%

20 statements  

« prev     ^ index     » next       coverage.py v6.4, created at 2022-05-24 10:21 -0500

1# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html 

2# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE 

3# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt 

4 

5import warnings 

6 

7from pylint.config.option_manager_mixin import OptionsManagerMixIn 

8from pylint.config.options_provider_mixin import OptionsProviderMixIn 

9 

10 

11class ConfigurationMixIn(OptionsManagerMixIn, OptionsProviderMixIn): 

12 """Basic mixin for simple configurations which don't need the 

13 manager / providers model. 

14 """ 

15 

16 def __init__(self, *args, **kwargs): 

17 # TODO: 3.0: Remove deprecated class 

18 warnings.warn( 

19 "ConfigurationMixIn has been deprecated and will be removed in pylint 3.0", 

20 DeprecationWarning, 

21 ) 

22 if not args: 

23 kwargs.setdefault("usage", "") 

24 OptionsManagerMixIn.__init__(self, *args, **kwargs) 

25 OptionsProviderMixIn.__init__(self) 

26 if not getattr(self, "option_groups", None): 

27 self.option_groups = [] 

28 for _, optdict in self.options: 

29 try: 

30 gdef = (optdict["group"].upper(), "") 

31 except KeyError: 

32 continue 

33 if gdef not in self.option_groups: 

34 self.option_groups.append(gdef) 

35 self.register_options_provider(self, own_group=False)