summaryrefslogtreecommitdiff
path: root/pylint/config/config_file_parser.py
diff options
context:
space:
mode:
authorDaniël van Noord <13665637+DanielNoord@users.noreply.github.com>2022-04-02 12:08:30 +0200
committerDaniël van Noord <13665637+DanielNoord@users.noreply.github.com>2022-04-02 12:41:46 +0200
commitfb8c75159e185b29b09998cac0cd52c06c216d1a (patch)
tree05c5f7594cac97b8e8194dcd8f5e52a68795ffda /pylint/config/config_file_parser.py
parentca3bc0e3fadb83972ba339cb4a0de99fc0300d8c (diff)
downloadpylint-git-fb8c75159e185b29b09998cac0cd52c06c216d1a.tar.gz
Move ``_parse_rich_type_value`` to ``utils``
Diffstat (limited to 'pylint/config/config_file_parser.py')
-rw-r--r--pylint/config/config_file_parser.py15
1 files changed, 5 insertions, 10 deletions
diff --git a/pylint/config/config_file_parser.py b/pylint/config/config_file_parser.py
index dd2faedc4..59b45dc54 100644
--- a/pylint/config/config_file_parser.py
+++ b/pylint/config/config_file_parser.py
@@ -8,7 +8,9 @@ import configparser
import os
import sys
from pathlib import Path
-from typing import TYPE_CHECKING, Any, Dict, Optional
+from typing import TYPE_CHECKING, Dict, Optional
+
+from pylint.config.utils import _parse_rich_type_value
if sys.version_info >= (3, 11):
import tomllib
@@ -41,13 +43,6 @@ class _ConfigurationFileParser:
config_content[opt] = parser[section][opt]
return config_content
- @staticmethod
- def _parse_toml_value(value: Any) -> str:
- """Parse rich toml types into strings."""
- if isinstance(value, (list, tuple)):
- return ",".join(value)
- return str(value)
-
def _parse_toml_file(self, file_path: Path) -> Dict[str, str]:
"""Parse and handle errors of a toml configuration file."""
try:
@@ -66,9 +61,9 @@ class _ConfigurationFileParser:
for opt, values in sections_values.items():
if isinstance(values, dict):
for config, value in values.items():
- config_content[config] = self._parse_toml_value(value)
+ config_content[config] = _parse_rich_type_value(value)
else:
- config_content[opt] = self._parse_toml_value(values)
+ config_content[opt] = _parse_rich_type_value(values)
return config_content
def parse_config_file(self, file_path: Optional[Path]) -> Dict[str, str]: