diff options
| -rw-r--r-- | config_file/config_file.py | 6 | ||||
| -rw-r--r-- | config_file/config_file_path.py | 10 | ||||
| -rw-r--r-- | config_file/parsers/__init__.py (renamed from tests/test_base_parser.py) | 0 | ||||
| -rw-r--r-- | config_file/parsers/abstract_parser.py (renamed from config_file/abstract_parser.py) | 0 | ||||
| -rw-r--r-- | config_file/parsers/base_parser.py (renamed from config_file/base_parser.py) | 2 | ||||
| -rw-r--r-- | config_file/parsers/ini_parser.py (renamed from config_file/ini_parser.py) | 2 | ||||
| -rw-r--r-- | config_file/parsers/json_parser.py (renamed from config_file/json_parser.py) | 0 | ||||
| -rw-r--r-- | config_file/parsers/parse_value.py (renamed from config_file/parse_value.py) | 0 | ||||
| -rw-r--r-- | config_file/parsers/toml_parser.py (renamed from config_file/toml_parser.py) | 0 | ||||
| -rw-r--r-- | config_file/parsers/yaml_parser.py (renamed from config_file/yaml_parser.py) | 0 | ||||
| -rw-r--r-- | tests/conftest.py | 12 | ||||
| -rw-r--r-- | tests/test_abstract_parser.py | 6 | ||||
| -rw-r--r-- | tests/test_config_file.py | 8 | ||||
| -rw-r--r-- | tests/test_config_file_path.py | 8 | ||||
| -rw-r--r-- | tests/test_parse_value.py | 2 | ||||
| -rw-r--r-- | tests/test_toml_parser.py | 2 | ||||
| -rw-r--r-- | tests/test_yaml_parser.py | 2 |
17 files changed, 29 insertions, 31 deletions
diff --git a/config_file/config_file.py b/config_file/config_file.py index 18f3e0f..f4979bb 100644 --- a/config_file/config_file.py +++ b/config_file/config_file.py @@ -3,7 +3,7 @@ from shutil import copyfile from typing import Any, Union from config_file.config_file_path import ConfigFilePath -from config_file.parse_value import parse_value +from config_file.parsers.parse_value import parse_value from config_file.utils import Default @@ -131,8 +131,8 @@ class ConfigFile: Returns: The internal representation of the file that has been read in converted to a string. - - Depreciated: + + Depreciated: Use str() on the ConfigFile object instead. """ return self.__parser.stringify() diff --git a/config_file/config_file_path.py b/config_file/config_file_path.py index ecb6531..0558faa 100644 --- a/config_file/config_file_path.py +++ b/config_file/config_file_path.py @@ -3,11 +3,11 @@ from pathlib import Path as _Path_ from pathlib import _posix_flavour, _windows_flavour from typing import Type -from config_file.abstract_parser import AbstractParser -from config_file.ini_parser import IniParser -from config_file.json_parser import JsonParser -from config_file.toml_parser import TomlParser -from config_file.yaml_parser import YamlParser +from config_file.parsers.abstract_parser import AbstractParser +from config_file.parsers.ini_parser import IniParser +from config_file.parsers.json_parser import JsonParser +from config_file.parsers.toml_parser import TomlParser +from config_file.parsers.yaml_parser import YamlParser from .utils import split_on_dot diff --git a/tests/test_base_parser.py b/config_file/parsers/__init__.py index e69de29..e69de29 100644 --- a/tests/test_base_parser.py +++ b/config_file/parsers/__init__.py diff --git a/config_file/abstract_parser.py b/config_file/parsers/abstract_parser.py index 460b238..460b238 100644 --- a/config_file/abstract_parser.py +++ b/config_file/parsers/abstract_parser.py diff --git a/config_file/base_parser.py b/config_file/parsers/base_parser.py index 5063cc7..ea94164 100644 --- a/config_file/base_parser.py +++ b/config_file/parsers/base_parser.py @@ -1,9 +1,9 @@ from abc import abstractmethod from typing import Any, Type -from config_file.abstract_parser import AbstractParser from config_file.exceptions import ParsingError from config_file.nested_lookup import get_occurrence_of_key +from config_file.parsers.abstract_parser import AbstractParser from config_file.utils import split_on_dot diff --git a/config_file/ini_parser.py b/config_file/parsers/ini_parser.py index 0048288..fe78f05 100644 --- a/config_file/ini_parser.py +++ b/config_file/parsers/ini_parser.py @@ -1,6 +1,6 @@ import configparser from io import StringIO -from typing import Type, Any +from typing import Any, Type from .base_parser import BaseParser diff --git a/config_file/json_parser.py b/config_file/parsers/json_parser.py index 58924b4..58924b4 100644 --- a/config_file/json_parser.py +++ b/config_file/parsers/json_parser.py diff --git a/config_file/parse_value.py b/config_file/parsers/parse_value.py index 12032d6..12032d6 100644 --- a/config_file/parse_value.py +++ b/config_file/parsers/parse_value.py diff --git a/config_file/toml_parser.py b/config_file/parsers/toml_parser.py index de5226c..de5226c 100644 --- a/config_file/toml_parser.py +++ b/config_file/parsers/toml_parser.py diff --git a/config_file/yaml_parser.py b/config_file/parsers/yaml_parser.py index fc4239a..fc4239a 100644 --- a/config_file/yaml_parser.py +++ b/config_file/parsers/yaml_parser.py diff --git a/tests/conftest.py b/tests/conftest.py index 075d356..9392368 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -3,8 +3,8 @@ from typing import Callable, Tuple, Type, Union import pytest -from config_file.abstract_parser import AbstractParser from config_file.config_file_path import ConfigFilePath +from config_file.parsers.abstract_parser import AbstractParser @pytest.fixture @@ -42,7 +42,7 @@ def template_file(tmp_file: Callable[[str, str], Path]) -> Callable[[str, str], template_name: The name of the template to retrieve. Defaults to the "default" template. i.e. the template with the name "default" with it's respective file extension. - + Returns: A Path object point to that test template. """ @@ -69,7 +69,7 @@ def template_original_file() -> Callable[[Path], Path]: Args: template_path: The path to the temporary template file we're using. - + Returns: A Path object pointing to the newly created original template file. """ @@ -99,9 +99,9 @@ def template_and_parser( file_type: The parser type to retrieve i.e. "ini" -> IniParser template_name: The template to retrieve. Defaults to the "default" template file for each extension. - + Returns: - The template and parser corresponding to the file_type with + The template and parser corresponding to the file_type with the template file read in. """ @@ -125,7 +125,7 @@ def templated_parser(template_and_parser) -> Callable[[str, str], Type[AbstractP file_type: The parser type to retrieve i.e. "ini" -> IniParser template_name: The template to retrieve. Defaults to the "default" template file for each extension. - + Returns: The parser corresponding to the file_type with the template file read in. diff --git a/tests/test_abstract_parser.py b/tests/test_abstract_parser.py index 1a1346a..67469a6 100644 --- a/tests/test_abstract_parser.py +++ b/tests/test_abstract_parser.py @@ -1,9 +1,7 @@ -from typing import Type - import pytest -from config_file.abstract_parser import AbstractParser -from config_file.base_parser import BaseParser +from config_file.parsers.abstract_parser import AbstractParser +from config_file.parsers.base_parser import BaseParser class ConcreteAbstractParser(AbstractParser): diff --git a/tests/test_config_file.py b/tests/test_config_file.py index 74e4dd3..72dbf13 100644 --- a/tests/test_config_file.py +++ b/tests/test_config_file.py @@ -4,11 +4,11 @@ from typing import Callable, Tuple import pytest -from config_file.abstract_parser import AbstractParser from config_file.config_file import ConfigFile -from config_file.exceptions import ParsingError -from config_file.ini_parser import IniParser from config_file.config_file_path import ConfigFilePath +from config_file.exceptions import ParsingError +from config_file.parsers.abstract_parser import AbstractParser +from config_file.parsers.ini_parser import IniParser SUPPORTED_FILE_TYPES = ["ini", "json", "yaml", "toml"] @@ -125,7 +125,7 @@ def test_set_can_add_to_or_alter_the_file(templated_config_file, key, value): """ config_file.config_file.ConfigFile.set - Ensure that for the keys we can, we retrieve that same value back + Ensure that for the keys we can, we retrieve that same value back (with the exception of ini, which should always be a string). """ config = templated_config_file() diff --git a/tests/test_config_file_path.py b/tests/test_config_file_path.py index 3bb7215..6b4dd93 100644 --- a/tests/test_config_file_path.py +++ b/tests/test_config_file_path.py @@ -4,10 +4,10 @@ from pathlib import Path, _posix_flavour, _windows_flavour import pytest from config_file.config_file_path import ConfigFilePath -from config_file.ini_parser import IniParser -from config_file.json_parser import JsonParser -from config_file.toml_parser import TomlParser -from config_file.yaml_parser import YamlParser +from config_file.parsers.ini_parser import IniParser +from config_file.parsers.json_parser import JsonParser +from config_file.parsers.toml_parser import TomlParser +from config_file.parsers.yaml_parser import YamlParser def test_config_file_path_is_a_path(): diff --git a/tests/test_parse_value.py b/tests/test_parse_value.py index 7956a06..4845f76 100644 --- a/tests/test_parse_value.py +++ b/tests/test_parse_value.py @@ -2,7 +2,7 @@ from datetime import datetime import pytest -from config_file.parse_value import ( +from config_file.parsers.parse_value import ( can_be_parsed_as_bool, can_be_parsed_as_dict, can_be_parsed_as_float, diff --git a/tests/test_toml_parser.py b/tests/test_toml_parser.py index 845e78e..7fc7d4e 100644 --- a/tests/test_toml_parser.py +++ b/tests/test_toml_parser.py @@ -2,7 +2,7 @@ from unittest.mock import patch import pytest -from config_file.toml_parser import TomlParser +from config_file.parsers.toml_parser import TomlParser def test_that_import_error_is_raised_if_no_tomlkit(): diff --git a/tests/test_yaml_parser.py b/tests/test_yaml_parser.py index 1f46692..e375dd9 100644 --- a/tests/test_yaml_parser.py +++ b/tests/test_yaml_parser.py @@ -2,7 +2,7 @@ from unittest.mock import patch import pytest -from config_file.yaml_parser import YamlParser +from config_file.parsers.yaml_parser import YamlParser def test_that_import_error_is_raised_if_no_ruamelyaml(): |