summaryrefslogtreecommitdiff
path: root/pylint
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2021-11-08 10:27:18 +0100
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2021-11-08 10:36:54 +0100
commit3723ee7b751106956b155b1b5f8f38c25e34755e (patch)
tree05e1d5788735ef7f430869f6bf64052b8b386fcc /pylint
parent35cdd075b5dd14c87c6de462c36cbd55a6fce071 (diff)
downloadpylint-git-3723ee7b751106956b155b1b5f8f38c25e34755e.tar.gz
Simplify toml handling by removing else after try
Diffstat (limited to 'pylint')
-rw-r--r--pylint/config/option_manager_mixin.py25
1 files changed, 12 insertions, 13 deletions
diff --git a/pylint/config/option_manager_mixin.py b/pylint/config/option_manager_mixin.py
index 34e0b3042..6720bc40e 100644
--- a/pylint/config/option_manager_mixin.py
+++ b/pylint/config/option_manager_mixin.py
@@ -302,19 +302,18 @@ class OptionsManagerMixIn:
try:
sections_values = content["tool"]["pylint"]
except KeyError:
- pass
- else:
- for section, values in sections_values.items():
- # TOML has rich types, convert values to
- # strings as ConfigParser expects.
- for option, value in values.items():
- if isinstance(value, bool):
- values[option] = "yes" if value else "no"
- elif isinstance(value, (int, float)):
- values[option] = str(value)
- elif isinstance(value, list):
- values[option] = ",".join(value)
- parser._sections[section.upper()] = values # type: ignore
+ return
+ for section, values in sections_values.items():
+ # TOML has rich types, convert values to
+ # strings as ConfigParser expects.
+ for option, value in values.items():
+ if isinstance(value, bool):
+ values[option] = "yes" if value else "no"
+ elif isinstance(value, (int, float)):
+ values[option] = str(value)
+ elif isinstance(value, list):
+ values[option] = ",".join(value)
+ parser._sections[section.upper()] = values # type: ignore
def load_config_file(self):
"""Dispatch values previously read from a configuration file to each