From 94fe938075c4edba742db66280c8e02198d79e1e Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Sat, 20 Jun 2020 13:41:35 -0500 Subject: Add python 3.5 support, ConfigFileError, and more type hints Also, get_all, set_all, and delete_all in JsonParser have been renamed to just all. --- CHANGELOG.md | 195 +++++++++-------- config_file/__init__.py | 4 +- config_file/config_file.py | 18 +- config_file/exceptions.py | 6 + config_file/parsers/base_parser.py | 3 - config_file/parsers/ini_parser.py | 7 +- config_file/parsers/json_parser.py | 21 +- config_file/parsers/toml_parser.py | 0 config_file/parsers/yaml_parser.py | 0 poetry.lock | 425 +++++++++++++++++++------------------ pyproject.toml | 16 +- tests/test_config_file.py | 11 +- tests/test_ini_parser.py | 3 +- tests/test_json_parser.py | 11 +- tox.ini | 2 +- 15 files changed, 381 insertions(+), 341 deletions(-) create mode 100644 config_file/exceptions.py create mode 100644 config_file/parsers/toml_parser.py create mode 100644 config_file/parsers/yaml_parser.py diff --git a/CHANGELOG.md b/CHANGELOG.md index e0a3ce8..e6ac91f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,167 +5,182 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +Added + +- Support for Python 3.5 by removing use of f-strings from codebase. +- A generic `ConfigFileError`. +- More type hints from `typings` have been added to `ConfigFile` for better type information. + +Changed + +- `ParsingError` now inherits from `ConfigFileError` rather than `Exception`. +- Errors have been moved to `exceptions.py`. +- The `get_all`, `set_all`, and `delete_all` optional parameter options in `JsonParser` have + been renamed to just `all`. This shouldn't have any effect since `JsonParser` is not intended + to be used directly, and that option is not in `ConfigFile`. + ## 0.10.0 - 2020-05-10 Changed - - `toml` and `pyyaml` are now optional extra dependencies. This allows you to - not have to install them if you aren't using them. - - - `retrieve_all` in `JsonParser`'s `get` method is now called `get_all` for - consistency. It isn't publicly available yet. The thought is to write a custom - ini parser first that supports multiple of the same keys and subsections. - This way you can have the `get_all`, `set_all`, `delete_all`, etc. methods - for all file type parsers. I would have to weight if that added complexity - of not using the built-in configparser and roll our own for some added - features is worth it or see if there are ways to work around it with - configparser that are ideal. +- `toml` and `pyyaml` are now optional extra dependencies. This allows you to + not have to install them if you aren't using them. -Fixed +- `retrieve_all` in `JsonParser`'s `get` method is now called `get_all` for + consistency. It isn't publicly available yet. The thought is to write a custom + ini parser first that supports multiple of the same keys and subsections. + This way you can have the `get_all`, `set_all`, `delete_all`, etc. methods + for all file type parsers. I would have to weight if that added complexity + of not using the built-in configparser and roll our own for some added + features is worth it or see if there are ways to work around it with + configparser that are ideal. - - You can now specify a default and still coerce your return type. Previously, - if you specified a default, there was no logic in that branch to coerce your - return type as well. +Fixed +- You can now specify a default and still coerce your return type. Previously, + if you specified a default, there was no logic in that branch to coerce your + return type as well. ## 0.9.0 - 2020-02-09 Added - - `default` optional parameter to the `get()` method of `ConfigFile`. - The allows a default value to be fallen back to if the given key is missing. - - - `return_type` optional parameter to `get()` method of `ConfigFile`. This - allows you to coerce the return type to one of your choosing by feeding it - the return value. +- `default` optional parameter to the `get()` method of `ConfigFile`. + The allows a default value to be fallen back to if the given key is missing. + +- `return_type` optional parameter to `get()` method of `ConfigFile`. This + allows you to coerce the return type to one of your choosing by feeding it + the return value. Changed - - Automatic type parsing is now off by default. This is because of the addition of - the `return_type` optional parameter. After using the package more, I think - the explicitness of specifying the type you're after or that you'd like to - automatically parse the type to one of the basic types is more maintainable. - However, I think the option to automatically parse or parse a whole section of - values is still a useful one. - - - The `parse_type` parameter to `ConfigFile`'s `get()` method is now called - `parse_types`. +- Automatic type parsing is now off by default. This is because of the addition of + the `return_type` optional parameter. After using the package more, I think + the explicitness of specifying the type you're after or that you'd like to + automatically parse the type to one of the basic types is more maintainable. + However, I think the option to automatically parse or parse a whole section of + values is still a useful one. + +- The `parse_type` parameter to `ConfigFile`'s `get()` method is now called + `parse_types`. ## 0.8.0 - 2020-02-02 Added - - More type hints to `ConfigFile` and `IniParser`. - - `nested_lookup` dependency to help with modifying deeply nested structures - (JSON + YAML) - - `JsonParser` so you can now specify `.json` files to be parsed. - +- More type hints to `ConfigFile` and `IniParser`. +- `nested_lookup` dependency to help with modifying deeply nested structures + (JSON + YAML) +- `JsonParser` so you can now specify `.json` files to be parsed. + Changed - - The original content of the passed in file is now called `content` - instead of `contents`. This is for consistency since the parsed version is - called `parsed_content`. +- The original content of the passed in file is now called `content` + instead of `contents`. This is for consistency since the parsed version is + called `parsed_content`. ## 0.7.0 - 2020-01-27 Fixed - - Support for using custom parsers with `ConfigFile` with the `parser` optional - argument. This was technically supported before, but it was not tested and found - to not actually use the passed in parser once tested. +- Support for using custom parsers with `ConfigFile` with the `parser` optional + argument. This was technically supported before, but it was not tested and found + to not actually use the passed in parser once tested. Changed - - The `reset()` method on `ConfigFile` is now called `restore_original()`. - The behavior is the same. This was done to better describe what exactly that method - is doing. Since the file is not written back out with every `set()` or `delete()` - and calling `save()` explicitly is required, `reset()` may have been confused with - resetting the changes you've made rather than deleting and restoring the original - configuration file. +- The `reset()` method on `ConfigFile` is now called `restore_original()`. + The behavior is the same. This was done to better describe what exactly that method + is doing. Since the file is not written back out with every `set()` or `delete()` + and calling `save()` explicitly is required, `reset()` may have been confused with + resetting the changes you've made rather than deleting and restoring the original + configuration file. ## 0.6.0 - 2020-01-24 Changed - - Bumped down python version requirement to 3.6 and now test 3.6, 3.7, and 3.8 on CI. +- Bumped down python version requirement to 3.6 and now test 3.6, 3.7, and 3.8 on CI. ## 0.5.0 - 2020-01-19 Added - - Support for retrieving entire sections as a `dict` with `get()`. +- Support for retrieving entire sections as a `dict` with `get()`. ## 0.4.0 - 2020-01-19 Added - - `reset()` and `save()` methods to `ConfigFile`. This allows you to reset your - configuration file to an "original state," given the original config file path. - However, say you have a `config/config.json` file. Then it will automatically try - to look for `config/config.original.json` if no file path is specified. The `save()` - method should be called after your changes to the config file. It will write them - back out. - - - Raise test coverage to 93%. +- `reset()` and `save()` methods to `ConfigFile`. This allows you to reset your + configuration file to an "original state," given the original config file path. + However, say you have a `config/config.json` file. Then it will automatically try + to look for `config/config.original.json` if no file path is specified. The `save()` + method should be called after your changes to the config file. It will write them + back out. + +- Raise test coverage to 93%. ## 0.3.3 - 2020-01-18 Changed - - `_split_on_dot` is no longer in base parser (now in a utils file). Also, the default +- `_split_on_dot` is no longer in base parser (now in a utils file). Also, the default behavior is now to split on every dot and split on only the last dot if specified - + Fixed - - `ConfigFile` was trying to use `_split_on_dot`, but it no longer inherited from base parser. - - - `TypeError` when setting the key/value pairs since configparser requires the option - to be a string. The parser now just converts the value to a string if it is not one - and then adds the key/value pair. It would still be parsed correctly when retrieving - it. +- `ConfigFile` was trying to use `_split_on_dot`, but it no longer inherited from base parser. + +- `TypeError` when setting the key/value pairs since configparser requires the option + to be a string. The parser now just converts the value to a string if it is not one + and then adds the key/value pair. It would still be parsed correctly when retrieving + it. ## 0.3.1 - 2020-01-17 Fixed - - `isinstance` call for `BaseParser` to be correctly used. +- `isinstance` call for `BaseParser` to be correctly used. ## 0.3.0 - 2020-01-17 Added - - Abstract base parser as a contract for concrete file format parser implementations. - - - Exposed `ConfigFile`, `BaseParser`, and `ParsingError` to the Public API. The base - parser is exposed to allow future custom extensions of the config file and what it +- Abstract base parser as a contract for concrete file format parser implementations. + +- Exposed `ConfigFile`, `BaseParser`, and `ParsingError` to the Public API. The base + parser is exposed to allow future custom extensions of the config file and what it can parse by its users. - - - `has_section` and `has_key` is now changed to a single `has` method which determines - whether you're checking a section or key by the presence of a dot. - - - `IniParser` to support the ini format. It uses configparser internally, but it is - only exposed through the `ConfigFile` object. + +- `has_section` and `has_key` is now changed to a single `has` method which determines + whether you're checking a section or key by the presence of a dot. + +- `IniParser` to support the ini format. It uses configparser internally, but it is + only exposed through the `ConfigFile` object. ## 0.2.0 - 2020-01-04 Added - - Parsing of strings to their native values +- Parsing of strings to their native values ## 0.1.0 - 2020-01-04 Added - - Created the config_file package with only the version inside it - - - toml and pyyaml to dependencies - - - Pre-commit pipeline with autoflake, isort, black, and flake8 - - - MIT license - - - Contributing guidelines - - - bump2version for easily upgrading versions of config file - - - pytest to dev dependencies for testing later on +- Created the config_file package with only the version inside it + +- toml and pyyaml to dependencies + +- Pre-commit pipeline with autoflake, isort, black, and flake8 + +- MIT license + +- Contributing guidelines + +- bump2version for easily upgrading versions of config file + +- pytest to dev dependencies for testing later on diff --git a/config_file/__init__.py b/config_file/__init__.py index 3bae28a..f37019a 100644 --- a/config_file/__init__.py +++ b/config_file/__init__.py @@ -1,10 +1,12 @@ from config_file.config_file import ConfigFile -from config_file.parsers.base_parser import BaseParser, ParsingError +from config_file.parsers.base_parser import BaseParser +from config_file.exceptions import ParsingError, ConfigFileError __version__ = "0.10.0" __all__ = [ "ConfigFile", "ParsingError", + "ConfigFileError", "BaseParser", ] diff --git a/config_file/config_file.py b/config_file/config_file.py index 91202da..805fc49 100644 --- a/config_file/config_file.py +++ b/config_file/config_file.py @@ -1,15 +1,17 @@ import inspect from pathlib import Path, PurePath from shutil import copyfile +from typing import Type, Union -from config_file.parsers.base_parser import BaseParser, ParsingError +from config_file.parsers.base_parser import BaseParser from config_file.parsers.ini_parser import IniParser from config_file.parsers.json_parser import JsonParser from config_file.utils import split_on_dot +from config_file.exceptions import ParsingError class ConfigFile: - def __init__(self, file_path, parser: BaseParser = None): + def __init__(self, file_path: Type[Union[str, PurePath]], parser: Type[BaseParser] = None) -> None: """ Saves the config file path and expands it if needed, reads in the file contents, and determines what parser should be used for @@ -17,7 +19,6 @@ class ConfigFile: :param file_path: The path to your configuration file. :param parser: A custom parser you'd like used for your config file. - It must be a concrete implementation of BaseParser. :raises ValueError: If the specified file path does not have an extension that is supported or it is a directory. @@ -27,7 +28,7 @@ class ConfigFile: self.parser = self.__determine_parser(file_path, parser) @staticmethod - def __create_config_path(file_path, original: bool = False) -> str: + def __create_config_path(file_path: Type[Union[str, PurePath]], original: bool = False) -> str: if isinstance(file_path, PurePath): file_path = str(file_path) @@ -40,11 +41,11 @@ class ConfigFile: file_path = ".".join(file_parts) if Path(file_path).is_dir(): - raise ValueError(f"The specified config file ({file_path}) is a directory.") + raise ValueError("The specified config file ({}) is a directory.".format(file_path)) return file_path - def __determine_parser(self, file_path, parser: BaseParser): + def __determine_parser(self, file_path: Type[Union[str, PurePath]], parser: Type[BaseParser]) -> BaseParser: if isinstance(file_path, PurePath): file_path = str(file_path) @@ -58,8 +59,7 @@ class ConfigFile: return JsonParser(self.contents) else: raise ValueError( - f"File path contains an unsupported or " - f"unrecognized file type: {file_path}" + "File path contains an unsupported or unrecognized file type: {}".format(file_path) ) def __read_config_file(self): @@ -134,7 +134,7 @@ class ConfigFile: if not Path(original_file_path).exists(): raise OSError( - f"The {original_file_path} file to restore to does not exist." + "The {} file to restore to does not exist.".format(original_file_path) ) Path(self.path).expanduser().unlink() diff --git a/config_file/exceptions.py b/config_file/exceptions.py new file mode 100644 index 0000000..cd7e236 --- /dev/null +++ b/config_file/exceptions.py @@ -0,0 +1,6 @@ +class ConfigFileError(Exception): + """A generic error from the package.""" + +class ParsingError(ConfigFileError): + """Unable to parse the configuration file.""" + \ No newline at end of file diff --git a/config_file/parsers/base_parser.py b/config_file/parsers/base_parser.py index 42f93b1..5fc47c2 100644 --- a/config_file/parsers/base_parser.py +++ b/config_file/parsers/base_parser.py @@ -74,6 +74,3 @@ class BaseParser(ABC): """ raise NotImplementedError - -class ParsingError(Exception): - """Unable to parse the configuration file""" diff --git a/config_file/parsers/ini_parser.py b/config_file/parsers/ini_parser.py index 81f2d1b..31b0dcf 100644 --- a/config_file/parsers/ini_parser.py +++ b/config_file/parsers/ini_parser.py @@ -1,9 +1,10 @@ import configparser from io import StringIO -from config_file.parsers.base_parser import BaseParser, ParsingError +from config_file.parsers.base_parser import BaseParser from config_file.parsers.parse_value import parse_value from config_file.utils import split_on_dot +from config_file.exceptions import ParsingError class IniParser(BaseParser): @@ -95,7 +96,7 @@ class IniParser(BaseParser): if "." not in section_key: if not self.parsed_content.has_section(section_key): raise ValueError( - f"Cannot delete {section_key} because it is not in the config file." + "Cannot delete {} because it is not in the config file.".format(section_key) ) self.parsed_content.remove_section(section_key) @@ -104,7 +105,7 @@ class IniParser(BaseParser): section, key = split_on_dot(section_key, only_last_dot=True) if key not in self.parsed_content[section]: raise ValueError( - f"Cannot delete {section}.{key} because {key} is not in {section}." + "Cannot delete {section}.{key} because {key} is not in {section}.".format(section = section, key = key) ) self.parsed_content.remove_option(section, key) diff --git a/config_file/parsers/json_parser.py b/config_file/parsers/json_parser.py index 20eb085..4d93ca3 100644 --- a/config_file/parsers/json_parser.py +++ b/config_file/parsers/json_parser.py @@ -7,9 +7,10 @@ from nested_lookup import ( nested_update, ) -from config_file.parsers.base_parser import BaseParser, ParsingError +from config_file.parsers.base_parser import BaseParser from config_file.parsers.parse_value import parse_value from config_file.utils import split_on_dot +from config_file.exceptions import ParsingError class JsonParser(BaseParser): @@ -34,7 +35,7 @@ class JsonParser(BaseParser): >>> { "key2": "foo", "key1": "bar" } parser.get('key1.key2') >>> "foo" - parser.get('key1', get_all=True) + parser.get('key1', all=True) >>> [{ "key2": "foo", "key1": "bar" }, "bar"] """ @@ -48,7 +49,7 @@ class JsonParser(BaseParser): except json.decoder.JSONDecodeError as error: raise ParsingError(error) - def get(self, key: str, parse_types: bool = False, get_all: bool = False): + def get(self, key: str, parse_types: bool = False, all: bool = False): """ Retrieve values using a dot syntax. @@ -56,14 +57,14 @@ class JsonParser(BaseParser): :param parse_types: Whether you'd like the type parsed into its native one. - :param get_all: Specify whether you'd like to recursively receive + :param all: Specify whether you'd like to recursively receive all values that match the given key. Returned as a list. e.g. 'foo' would retrieve all values that have the key 'foo', anywhere in the json. :return: the value of the given key """ - if get_all: + if all: result = nested_lookup(key, self.parsed_content) elif "." in key: split_keys = split_on_dot(key) @@ -77,15 +78,15 @@ class JsonParser(BaseParser): result = result[key] except TypeError: raise ParsingError( - f"Cannot get {key} because {key_for_error} is not subscriptable." + "Cannot get {} because {} is not subscriptable.".format(key, key_for_error) ) else: result = self.parsed_content[key] return parse_value(result) if parse_types else result - def set(self, key: str, value, set_all: bool = False): - if set_all: + def set(self, key: str, value, all: bool = False): + if all: nested_update(self.parsed_content, key, value, in_place=True) elif "." in key: indexes = split_on_dot(key) @@ -103,8 +104,8 @@ class JsonParser(BaseParser): return True - def delete(self, key, delete_all: bool = False): - if delete_all: + def delete(self, key, all: bool = False): + if all: nested_delete(self.parsed_content, key, in_place=True) elif "." in key: indexes = split_on_dot(key) diff --git a/config_file/parsers/toml_parser.py b/config_file/parsers/toml_parser.py new file mode 100644 index 0000000..e69de29 diff --git a/config_file/parsers/yaml_parser.py b/config_file/parsers/yaml_parser.py new file mode 100644 index 0000000..e69de29 diff --git a/poetry.lock b/poetry.lock index 9ee97f5..566d146 100644 --- a/poetry.lock +++ b/poetry.lock @@ -9,18 +9,20 @@ version = "0.7.12" [[package]] category = "dev" description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." +marker = "python_version >= \"3.6\" and python_version < \"4.0\"" name = "appdirs" optional = false python-versions = "*" -version = "1.4.3" +version = "1.4.4" [[package]] category = "dev" description = "Utilities for refactoring imports in python-like syntax." +marker = "python_version >= \"3.6.1\" and python_version < \"4.0.0\"" name = "aspy.refactor-imports" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "1.1.0" +python-versions = ">=3.6.1" +version = "2.1.1" [package.dependencies] cached-property = "*" @@ -43,7 +45,7 @@ marker = "sys_platform == \"win32\"" name = "atomicwrites" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "1.3.0" +version = "1.4.0" [[package]] category = "dev" @@ -84,6 +86,7 @@ pytz = ">=2015.7" [[package]] category = "dev" description = "The uncompromising code formatter." +marker = "python_version >= \"3.6\" and python_version < \"4.0\"" name = "black" optional = false python-versions = ">=3.6" @@ -112,6 +115,7 @@ version = "1.0.0" [[package]] category = "dev" description = "A decorator for caching properties in classes." +marker = "python_version >= \"3.6.1\" and python_version < \"4.0.0\"" name = "cached-property" optional = false python-versions = "*" @@ -123,15 +127,18 @@ description = "Python package for providing Mozilla's CA Bundle." name = "certifi" optional = false python-versions = "*" -version = "2019.11.28" +version = "2020.4.5.2" [[package]] category = "dev" description = "Validate configuration and produce human readable error messages." name = "cfgv" optional = false -python-versions = ">=3.6" -version = "3.0.0" +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" +version = "2.0.1" + +[package.dependencies] +six = "*" [[package]] category = "dev" @@ -144,10 +151,11 @@ version = "3.0.4" [[package]] category = "dev" description = "Composable command line interface toolkit" +marker = "python_version >= \"3.6\" and python_version < \"4.0\"" name = "click" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" -version = "7.1.1" +version = "7.1.2" [[package]] category = "dev" @@ -164,19 +172,11 @@ description = "Code coverage measurement for Python" name = "coverage" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4" -version = "5.0.4" +version = "5.1" [package.extras] toml = ["toml"] -[[package]] -category = "dev" -description = "Distribution utilities" -name = "distlib" -optional = false -python-versions = "*" -version = "0.3.0" - [[package]] category = "dev" description = "Docutils -- Python Documentation Utilities" @@ -187,33 +187,20 @@ version = "0.16" [[package]] category = "dev" -description = "Discover and load entry points from installed packages." -name = "entrypoints" -optional = false -python-versions = ">=2.7" -version = "0.3" - -[[package]] -category = "dev" -description = "A platform independent file lock." -name = "filelock" -optional = false -python-versions = "*" -version = "3.0.12" - -[[package]] -category = "dev" -description = "the modular source code checker: pep8, pyflakes and co" +description = "the modular source code checker: pep8 pyflakes and co" name = "flake8" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "3.7.9" +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7" +version = "3.8.3" [package.dependencies] -entrypoints = ">=0.3.0,<0.4.0" mccabe = ">=0.6.0,<0.7.0" -pycodestyle = ">=2.5.0,<2.6.0" -pyflakes = ">=2.1.0,<2.2.0" +pycodestyle = ">=2.6.0a1,<2.7.0" +pyflakes = ">=2.2.0,<2.3.0" + +[package.dependencies.importlib-metadata] +python = "<3.8" +version = "*" [[package]] category = "dev" @@ -221,7 +208,7 @@ description = "File identification library for Python" name = "identify" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7" -version = "1.4.13" +version = "1.4.19" [package.extras] license = ["editdistance"] @@ -249,14 +236,14 @@ marker = "python_version < \"3.8\"" name = "importlib-metadata" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" -version = "1.6.0" +version = "1.6.1" [package.dependencies] zipp = ">=0.5" [package.extras] docs = ["sphinx", "rst.linker"] -testing = ["packaging", "importlib-resources"] +testing = ["packaging", "pep517", "importlib-resources (>=1.3)"] [[package]] category = "dev" @@ -265,7 +252,7 @@ marker = "python_version < \"3.7\"" name = "importlib-resources" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" -version = "1.4.0" +version = "2.0.0" [package.dependencies] [package.dependencies.importlib-metadata] @@ -299,7 +286,7 @@ description = "A very fast and expressive template engine." name = "jinja2" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" -version = "2.11.1" +version = "2.11.2" [package.dependencies] MarkupSafe = ">=0.23" @@ -329,7 +316,7 @@ description = "More routines for operating on iterables, beyond itertools" name = "more-itertools" optional = false python-versions = ">=3.5" -version = "8.2.0" +version = "8.3.0" [[package]] category = "main" @@ -348,7 +335,7 @@ description = "Node.js virtual environment builder" name = "nodeenv" optional = false python-versions = "*" -version = "1.3.5" +version = "1.4.0" [[package]] category = "dev" @@ -356,19 +343,32 @@ description = "Core utilities for Python packages" name = "packaging" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "20.3" +version = "20.4" [package.dependencies] pyparsing = ">=2.0.2" six = "*" +[[package]] +category = "dev" +description = "Object-oriented filesystem paths" +marker = "python_version < \"3.6\"" +name = "pathlib2" +optional = false +python-versions = "*" +version = "2.3.5" + +[package.dependencies] +six = "*" + [[package]] category = "dev" description = "Utility library for gitignore style pattern matching of file paths." +marker = "python_version >= \"3.6\" and python_version < \"4.0\"" name = "pathspec" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" -version = "0.7.0" +version = "0.8.0" [[package]] category = "dev" @@ -426,7 +426,7 @@ description = "Python style guide checker" name = "pycodestyle" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "2.5.0" +version = "2.6.0" [[package]] category = "dev" @@ -434,7 +434,7 @@ description = "passive checker of Python programs" name = "pyflakes" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "2.1.1" +version = "2.2.0" [[package]] category = "dev" @@ -450,7 +450,7 @@ description = "Python parsing module" name = "pyparsing" optional = false python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" -version = "2.4.6" +version = "2.4.7" [[package]] category = "dev" @@ -458,7 +458,7 @@ description = "pytest: simple powerful testing with Python" name = "pytest" optional = false python-versions = ">=3.5" -version = "5.4.1" +version = "5.4.3" [package.dependencies] atomicwrites = ">=1.0" @@ -474,6 +474,10 @@ wcwidth = "*" python = "<3.8" version = ">=0.12" +[package.dependencies.pathlib2] +python = "<3.6" +version = ">=2.2.0" + [package.extras] checkqa-mypy = ["mypy (v0.761)"] testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "requests", "xmlschema"] @@ -483,15 +487,28 @@ category = "dev" description = "Pytest plugin for measuring coverage." name = "pytest-cov" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "2.8.1" +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +version = "2.9.0" [package.dependencies] coverage = ">=4.4" pytest = ">=3.6" [package.extras] -testing = ["fields", "hunter", "process-tests (2.0.2)", "six", "virtualenv"] +testing = ["fields", "hunter", "process-tests (2.0.2)", "six", "pytest-xdist", "virtualenv"] + +[[package]] +category = "dev" +description = "pytest-sugar is a plugin for pytest that changes the default look and feel of pytest (e.g. progressbar, show tests that fail instantly)." +name = "pytest-sugar" +optional = false +python-versions = "*" +version = "0.9.3" + +[package.dependencies] +packaging = ">=14.1" +pytest = ">=2.9" +termcolor = ">=1.1.0" [[package]] category = "dev" @@ -499,7 +516,7 @@ description = "World timezone definitions, modern and historical" name = "pytz" optional = false python-versions = "*" -version = "2019.3" +version = "2020.1" [[package]] category = "main" @@ -512,10 +529,11 @@ version = "5.3.1" [[package]] category = "dev" description = "Alternative regular expression module, to replace re." +marker = "python_version >= \"3.6\" and python_version < \"4.0\"" name = "regex" optional = false python-versions = "*" -version = "2020.2.20" +version = "2020.6.8" [[package]] category = "dev" @@ -538,10 +556,11 @@ socks = ["PySocks (>=1.5.6,<1.5.7 || >1.5.7)", "win-inet-pton"] [[package]] category = "dev" description = "Statically populate the `known_third_party` `isort` setting." +marker = "python_version >= \"3.6.1\" and python_version < \"4.0.0\"" name = "seed-isort-config" optional = false -python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7" -version = "1.9.4" +python-versions = ">=3.6.1" +version = "2.2.0" [package.dependencies] "aspy.refactor-imports" = "*" @@ -552,7 +571,7 @@ description = "Python 2 and 3 compatibility utilities" name = "six" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" -version = "1.14.0" +version = "1.15.0" [[package]] category = "dev" @@ -678,6 +697,7 @@ test = ["pytest"] [[package]] category = "dev" description = "tasks runner for python projects" +marker = "python_version >= \"3.6\" and python_version < \"4.0\"" name = "taskipy" optional = false python-versions = ">=3.6,<4.0" @@ -686,17 +706,26 @@ version = "1.2.1" [package.dependencies] toml = ">=0.10.0,<0.11.0" +[[package]] +category = "dev" +description = "ANSII Color formatting for output in terminal." +name = "termcolor" +optional = false +python-versions = "*" +version = "1.1.0" + [[package]] category = "main" description = "Python Library for Tom's Obvious, Minimal Language" name = "toml" optional = false python-versions = "*" -version = "0.10.0" +version = "0.10.1" [[package]] category = "dev" description = "a fork of Python 2 and 3 ast modules with type comment support" +marker = "python_version >= \"3.6\" and python_version < \"4.0\"" name = "typed-ast" optional = false python-versions = "*" @@ -708,11 +737,11 @@ description = "HTTP library with thread-safe connection pooling, file post, and name = "urllib3" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4" -version = "1.25.8" +version = "1.25.9" [package.extras] brotli = ["brotlipy (>=0.6.0)"] -secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "certifi", "ipaddress"] +secure = ["certifi", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "pyOpenSSL (>=0.14)", "ipaddress"] socks = ["PySocks (>=1.5.6,<1.5.7 || >1.5.7,<2.0)"] [[package]] @@ -721,33 +750,19 @@ description = "Virtual Python Environment builder" name = "virtualenv" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7" -version = "20.0.15" - -[package.dependencies] -appdirs = ">=1.4.3,<2" -distlib = ">=0.3.0,<1" -filelock = ">=3.0.0,<4" -six = ">=1.9.0,<2" - -[package.dependencies.importlib-metadata] -python = "<3.8" -version = ">=0.12,<2" - -[package.dependencies.importlib-resources] -python = "<3.7" -version = ">=1.0,<2" +version = "16.7.10" [package.extras] -docs = ["sphinx (>=2.0.0,<3)", "sphinx-argparse (>=0.2.5,<1)", "sphinx-rtd-theme (>=0.4.3,<1)", "towncrier (>=19.9.0rc1)", "proselint (>=0.10.2,<1)"] -testing = ["pytest (>=4.0.0,<6)", "coverage (>=4.5.1,<6)", "pytest-mock (>=2.0.0,<3)", "pytest-env (>=0.6.2,<1)", "pytest-timeout (>=1.3.4,<2)", "packaging (>=20.0)", "xonsh (>=0.9.13,<1)"] +docs = ["sphinx (>=1.8.0,<2)", "towncrier (>=18.5.0)", "sphinx-rtd-theme (>=0.4.2,<1)"] +testing = ["pytest (>=4.0.0,<5)", "coverage (>=4.5.0,<5)", "pytest-timeout (>=1.3.0,<2)", "six (>=1.10.0,<2)", "pytest-xdist", "pytest-localserver", "pypiserver", "mock", "xonsh"] [[package]] category = "dev" -description = "Measures number of Terminal column cells of wide-character codes" +description = "Measures the displayed width of unicode strings in a terminal" name = "wcwidth" optional = false python-versions = "*" -version = "0.1.9" +version = "0.2.4" [[package]] category = "dev" @@ -755,20 +770,20 @@ description = "Backport of pathlib-compatible object wrapper for zip files" marker = "python_version < \"3.8\"" name = "zipp" optional = false -python-versions = ">=3.6" -version = "3.1.0" +python-versions = ">=2.7" +version = "1.2.0" [package.extras] docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"] -testing = ["jaraco.itertools", "func-timeout"] +testing = ["pathlib2", "unittest2", "jaraco.itertools", "func-timeout"] [extras] toml = ["toml"] yaml = ["pyyaml"] [metadata] -content-hash = "08e43891b71c2bd97878564d8084ce7950165cfcccea39d0ad362363de3055c3" -python-versions = "^3.6" +content-hash = "cbcbacf7c64fd8aec4372a6979e3ef11a81c049e7baf24b1b396023209b960cd" +python-versions = "^3.5" [metadata.files] alabaster = [ @@ -776,20 +791,20 @@ alabaster = [ {file = "alabaster-0.7.12.tar.gz", hash = "sha256:a661d72d58e6ea8a57f7a86e37d86716863ee5e92788398526d58b26a4e4dc02"}, ] appdirs = [ - {file = "appdirs-1.4.3-py2.py3-none-any.whl", hash = "sha256:d8b24664561d0d34ddfaec54636d502d7cea6e29c3eaf68f3df6180863e2166e"}, - {file = "appdirs-1.4.3.tar.gz", hash = "sha256:9e5896d1372858f8dd3344faf4e5014d21849c756c8d5701f78f8a103b372d92"}, + {file = "appdirs-1.4.4-py2.py3-none-any.whl", hash = "sha256:a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128"}, + {file = "appdirs-1.4.4.tar.gz", hash = "sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41"}, ] "aspy.refactor-imports" = [ - {file = "aspy.refactor_imports-1.1.0-py2.py3-none-any.whl", hash = "sha256:6d465c18cadad7e5a87810ecf8e516cb6f78e91871f4f55d0f228c6c376bd16a"}, - {file = "aspy.refactor_imports-1.1.0.tar.gz", hash = "sha256:88418d9bd1a0d50b9d3836504469dce6f26ee8b2d78bd58b805d73dd8b381d55"}, + {file = "aspy.refactor_imports-2.1.1-py2.py3-none-any.whl", hash = "sha256:9df76bf19ef81620068b785a386740ab3c8939fcbdcebf20c4a4e0057230d782"}, + {file = "aspy.refactor_imports-2.1.1.tar.gz", hash = "sha256:eec8d1a73bedf64ffb8b589ad919a030c1fb14acf7d1ce0ab192f6eedae895c5"}, ] "aspy.yaml" = [ {file = "aspy.yaml-1.3.0-py2.py3-none-any.whl", hash = "sha256:463372c043f70160a9ec950c3f1e4c3a82db5fca01d334b6bc89c7164d744bdc"}, {file = "aspy.yaml-1.3.0.tar.gz", hash = "sha256:e7c742382eff2caed61f87a39d13f99109088e5e93f04d76eb8d4b28aa143f45"}, ] atomicwrites = [ - {file = "atomicwrites-1.3.0-py2.py3-none-any.whl", hash = "sha256:03472c30eb2c5d1ba9227e4c2ca66ab8287fbfbbda3888aa93dc2e28fc6811b4"}, - {file = "atomicwrites-1.3.0.tar.gz", hash = "sha256:75a9445bac02d8d058d5e1fe689654ba5a6556a1dfd8ce6ec55a0ed79866cfa6"}, + {file = "atomicwrites-1.4.0-py2.py3-none-any.whl", hash = "sha256:6d1784dea7c0c8d4a5172b6c620f40b6e4cbfdf96d783691f2e1302a7b88e197"}, + {file = "atomicwrites-1.4.0.tar.gz", hash = "sha256:ae70396ad1a434f9c7046fd2dd196fc04b12f9e91ffb859164193be8b6168a7a"}, ] attrs = [ {file = "attrs-19.3.0-py2.py3-none-any.whl", hash = "sha256:08a96c641c3a74e44eb59afb61a24f2cb9f4d7188748e76ba4bb5edfa3cb7d1c"}, @@ -815,80 +830,69 @@ cached-property = [ {file = "cached_property-1.5.1-py2.py3-none-any.whl", hash = "sha256:3a026f1a54135677e7da5ce819b0c690f156f37976f3e30c5430740725203d7f"}, ] certifi = [ - {file = "certifi-2019.11.28-py2.py3-none-any.whl", hash = "sha256:017c25db2a153ce562900032d5bc68e9f191e44e9a0f762f373977de9df1fbb3"}, - {file = "certifi-2019.11.28.tar.gz", hash = "sha256:25b64c7da4cd7479594d035c08c2d809eb4aab3a26e5a990ea98cc450c320f1f"}, + {file = "certifi-2020.4.5.2-py2.py3-none-any.whl", hash = "sha256:9cd41137dc19af6a5e03b630eefe7d1f458d964d406342dd3edf625839b944cc"}, + {file = "certifi-2020.4.5.2.tar.gz", hash = "sha256:5ad7e9a056d25ffa5082862e36f119f7f7cec6457fa07ee2f8c339814b80c9b1"}, ] cfgv = [ - {file = "cfgv-3.0.0-py2.py3-none-any.whl", hash = "sha256:f22b426ed59cd2ab2b54ff96608d846c33dfb8766a67f0b4a6ce130ce244414f"}, - {file = "cfgv-3.0.0.tar.gz", hash = "sha256:04b093b14ddf9fd4d17c53ebfd55582d27b76ed30050193c14e560770c5360eb"}, + {file = "cfgv-2.0.1-py2.py3-none-any.whl", hash = "sha256:fbd93c9ab0a523bf7daec408f3be2ed99a980e20b2d19b50fc184ca6b820d289"}, + {file = "cfgv-2.0.1.tar.gz", hash = "sha256:edb387943b665bf9c434f717bf630fa78aecd53d5900d2e05da6ad6048553144"}, ] chardet = [ {file = "chardet-3.0.4-py2.py3-none-any.whl", hash = "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691"}, {file = "chardet-3.0.4.tar.gz", hash = "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae"}, ] click = [ - {file = "click-7.1.1-py2.py3-none-any.whl", hash = "sha256:e345d143d80bf5ee7534056164e5e112ea5e22716bbb1ce727941f4c8b471b9a"}, - {file = "click-7.1.1.tar.gz", hash = "sha256:8a18b4ea89d8820c5d0c7da8a64b2c324b4dabb695804dbfea19b9be9d88c0cc"}, + {file = "click-7.1.2-py2.py3-none-any.whl", hash = "sha256:dacca89f4bfadd5de3d7489b7c8a566eee0d3676333fbb50030263894c38c0dc"}, + {file = "click-7.1.2.tar.gz", hash = "sha256:d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a"}, ] colorama = [ {file = "colorama-0.4.3-py2.py3-none-any.whl", hash = "sha256:7d73d2a99753107a36ac6b455ee49046802e59d9d076ef8e47b61499fa29afff"}, {file = "colorama-0.4.3.tar.gz", hash = "sha256:e96da0d330793e2cb9485e9ddfd918d456036c7149416295932478192f4436a1"}, ] coverage = [ - {file = "coverage-5.0.4-cp27-cp27m-macosx_10_12_x86_64.whl", hash = "sha256:8a620767b8209f3446197c0e29ba895d75a1e272a36af0786ec70fe7834e4307"}, - {file = "coverage-5.0.4-cp27-cp27m-macosx_10_13_intel.whl", hash = "sha256:73aa6e86034dad9f00f4bbf5a666a889d17d79db73bc5af04abd6c20a014d9c8"}, - {file = "coverage-5.0.4-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:408ce64078398b2ee2ec08199ea3fcf382828d2f8a19c5a5ba2946fe5ddc6c31"}, - {file = "coverage-5.0.4-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:cda33311cb9fb9323958a69499a667bd728a39a7aa4718d7622597a44c4f1441"}, - {file = "coverage-5.0.4-cp27-cp27m-win32.whl", hash = "sha256:5f587dfd83cb669933186661a351ad6fc7166273bc3e3a1531ec5c783d997aac"}, - {file = "coverage-5.0.4-cp27-cp27m-win_amd64.whl", hash = "sha256:9fad78c13e71546a76c2f8789623eec8e499f8d2d799f4b4547162ce0a4df435"}, - {file = "coverage-5.0.4-cp27-cp27mu-manylinux1_i686.whl", hash = "sha256:2e08c32cbede4a29e2a701822291ae2bc9b5220a971bba9d1e7615312efd3037"}, - {file = "coverage-5.0.4-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:922fb9ef2c67c3ab20e22948dcfd783397e4c043a5c5fa5ff5e9df5529074b0a"}, - {file = "coverage-5.0.4-cp35-cp35m-macosx_10_12_x86_64.whl", hash = "sha256:c3fc325ce4cbf902d05a80daa47b645d07e796a80682c1c5800d6ac5045193e5"}, - {file = "coverage-5.0.4-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:046a1a742e66d065d16fb564a26c2a15867f17695e7f3d358d7b1ad8a61bca30"}, - {file = "coverage-5.0.4-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:6ad6ca45e9e92c05295f638e78cd42bfaaf8ee07878c9ed73e93190b26c125f7"}, - {file = "coverage-5.0.4-cp35-cp35m-win32.whl", hash = "sha256:eda55e6e9ea258f5e4add23bcf33dc53b2c319e70806e180aecbff8d90ea24de"}, - {file = "coverage-5.0.4-cp35-cp35m-win_amd64.whl", hash = "sha256:4a8a259bf990044351baf69d3b23e575699dd60b18460c71e81dc565f5819ac1"}, - {file = "coverage-5.0.4-cp36-cp36m-macosx_10_13_x86_64.whl", hash = "sha256:f372cdbb240e09ee855735b9d85e7f50730dcfb6296b74b95a3e5dea0615c4c1"}, - {file = "coverage-5.0.4-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:a37c6233b28e5bc340054cf6170e7090a4e85069513320275a4dc929144dccf0"}, - {file = "coverage-5.0.4-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:443be7602c790960b9514567917af538cac7807a7c0c0727c4d2bbd4014920fd"}, - {file = "coverage-5.0.4-cp36-cp36m-win32.whl", hash = "sha256:165a48268bfb5a77e2d9dbb80de7ea917332a79c7adb747bd005b3a07ff8caf0"}, - {file = "coverage-5.0.4-cp36-cp36m-win_amd64.whl", hash = "sha256:0a907199566269e1cfa304325cc3b45c72ae341fbb3253ddde19fa820ded7a8b"}, - {file = "coverage-5.0.4-cp37-cp37m-macosx_10_13_x86_64.whl", hash = "sha256:513e6526e0082c59a984448f4104c9bf346c2da9961779ede1fc458e8e8a1f78"}, - {file = "coverage-5.0.4-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:3844c3dab800ca8536f75ae89f3cf566848a3eb2af4d9f7b1103b4f4f7a5dad6"}, - {file = "coverage-5.0.4-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:641e329e7f2c01531c45c687efcec8aeca2a78a4ff26d49184dce3d53fc35014"}, - {file = "coverage-5.0.4-cp37-cp37m-win32.whl", hash = "sha256:db1d4e38c9b15be1521722e946ee24f6db95b189d1447fa9ff18dd16ba89f732"}, - {file = "coverage-5.0.4-cp37-cp37m-win_amd64.whl", hash = "sha256:62061e87071497951155cbccee487980524d7abea647a1b2a6eb6b9647df9006"}, - {file = "coverage-5.0.4-cp38-cp38-macosx_10_13_x86_64.whl", hash = "sha256:65a7e00c00472cd0f59ae09d2fb8a8aaae7f4a0cf54b2b74f3138d9f9ceb9cb2"}, - {file = "coverage-5.0.4-cp38-cp38-manylinux1_i686.whl", hash = "sha256:1f66cf263ec77af5b8fe14ef14c5e46e2eb4a795ac495ad7c03adc72ae43fafe"}, - {file = "coverage-5.0.4-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:85596aa5d9aac1bf39fe39d9fa1051b0f00823982a1de5766e35d495b4a36ca9"}, - {file = "coverage-5.0.4-cp38-cp38-win32.whl", hash = "sha256:86a0ea78fd851b313b2e712266f663e13b6bc78c2fb260b079e8b67d970474b1"}, - {file = "coverage-5.0.4-cp38-cp38-win_amd64.whl", hash = "sha256:03f630aba2b9b0d69871c2e8d23a69b7fe94a1e2f5f10df5049c0df99db639a0"}, - {file = "coverage-5.0.4-cp39-cp39-win32.whl", hash = "sha256:7c9762f80a25d8d0e4ab3cb1af5d9dffbddb3ee5d21c43e3474c84bf5ff941f7"}, - {file = "coverage-5.0.4-cp39-cp39-win_amd64.whl", hash = "sha256:4482f69e0701139d0f2c44f3c395d1d1d37abd81bfafbf9b6efbe2542679d892"}, - {file = "coverage-5.0.4.tar.gz", hash = "sha256:1b60a95fc995649464e0cd48cecc8288bac5f4198f21d04b8229dc4097d76823"}, -] -distlib = [ - {file = "distlib-0.3.0.zip", hash = "sha256:2e166e231a26b36d6dfe35a48c4464346620f8645ed0ace01ee31822b288de21"}, + {file = "coverage-5.1-cp27-cp27m-macosx_10_12_x86_64.whl", hash = "sha256:0cb4be7e784dcdc050fc58ef05b71aa8e89b7e6636b99967fadbdba694cf2b65"}, + {file = "coverage-5.1-cp27-cp27m-macosx_10_13_intel.whl", hash = "sha256:c317eaf5ff46a34305b202e73404f55f7389ef834b8dbf4da09b9b9b37f76dd2"}, + {file = "coverage-5.1-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:b83835506dfc185a319031cf853fa4bb1b3974b1f913f5bb1a0f3d98bdcded04"}, + {file = "coverage-5.1-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:5f2294dbf7875b991c381e3d5af2bcc3494d836affa52b809c91697449d0eda6"}, + {file = "coverage-5.1-cp27-cp27m-win32.whl", hash = "sha256:de807ae933cfb7f0c7d9d981a053772452217df2bf38e7e6267c9cbf9545a796"}, + {file = "coverage-5.1-cp27-cp27m-win_amd64.whl", hash = "sha256:bf9cb9a9fd8891e7efd2d44deb24b86d647394b9705b744ff6f8261e6f29a730"}, + {file = "coverage-5.1-cp27-cp27mu-manylinux1_i686.whl", hash = "sha256:acf3763ed01af8410fc36afea23707d4ea58ba7e86a8ee915dfb9ceff9ef69d0"}, + {file = "coverage-5.1-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:dec5202bfe6f672d4511086e125db035a52b00f1648d6407cc8e526912c0353a"}, + {file = "coverage-5.1-cp35-cp35m-macosx_10_12_x86_64.whl", hash = "sha256:7a5bdad4edec57b5fb8dae7d3ee58622d626fd3a0be0dfceda162a7035885ecf"}, + {file = "coverage-5.1-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:1601e480b9b99697a570cea7ef749e88123c04b92d84cedaa01e117436b4a0a9"}, + {file = "coverage-5.1-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:dbe8c6ae7534b5b024296464f387d57c13caa942f6d8e6e0346f27e509f0f768"}, + {file = "coverage-5.1-cp35-cp35m-win32.whl", hash = "sha256:a027ef0492ede1e03a8054e3c37b8def89a1e3c471482e9f046906ba4f2aafd2"}, + {file = "coverage-5.1-cp35-cp35m-win_amd64.whl", hash = "sha256:0e61d9803d5851849c24f78227939c701ced6704f337cad0a91e0972c51c1ee7"}, + {file = "coverage-5.1-cp36-cp36m-macosx_10_13_x86_64.whl", hash = "sha256:2d27a3f742c98e5c6b461ee6ef7287400a1956c11421eb574d843d9ec1f772f0"}, + {file = "coverage-5.1-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:66460ab1599d3cf894bb6baee8c684788819b71a5dc1e8fa2ecc152e5d752019"}, + {file = "coverage-5.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:5c542d1e62eece33c306d66fe0a5c4f7f7b3c08fecc46ead86d7916684b36d6c"}, + {file = "coverage-5.1-cp36-cp36m-win32.whl", hash = "sha256:2742c7515b9eb368718cd091bad1a1b44135cc72468c731302b3d641895b83d1"}, + {file = "coverage-5.1-cp36-cp36m-win_amd64.whl", hash = "sha256:dead2ddede4c7ba6cb3a721870f5141c97dc7d85a079edb4bd8d88c3ad5b20c7"}, + {file = "coverage-5.1-cp37-cp37m-macosx_10_13_x86_64.whl", hash = "sha256:01333e1bd22c59713ba8a79f088b3955946e293114479bbfc2e37d522be03355"}, + {file = "coverage-5.1-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:e1ea316102ea1e1770724db01998d1603ed921c54a86a2efcb03428d5417e489"}, + {file = "coverage-5.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:adeb4c5b608574a3d647011af36f7586811a2c1197c861aedb548dd2453b41cd"}, + {file = "coverage-5.1-cp37-cp37m-win32.whl", hash = "sha256:782caea581a6e9ff75eccda79287daefd1d2631cc09d642b6ee2d6da21fc0a4e"}, + {file = "coverage-5.1-cp37-cp37m-win_amd64.whl", hash = "sha256:00f1d23f4336efc3b311ed0d807feb45098fc86dee1ca13b3d6768cdab187c8a"}, + {file = "coverage-5.1-cp38-cp38-macosx_10_13_x86_64.whl", hash = "sha256:402e1744733df483b93abbf209283898e9f0d67470707e3c7516d84f48524f55"}, + {file = "coverage-5.1-cp38-cp38-manylinux1_i686.whl", hash = "sha256:a3f3654d5734a3ece152636aad89f58afc9213c6520062db3978239db122f03c"}, + {file = "coverage-5.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:6402bd2fdedabbdb63a316308142597534ea8e1895f4e7d8bf7476c5e8751fef"}, + {file = "coverage-5.1-cp38-cp38-win32.whl", hash = "sha256:8fa0cbc7ecad630e5b0f4f35b0f6ad419246b02bc750de7ac66db92667996d24"}, + {file = "coverage-5.1-cp38-cp38-win_amd64.whl", hash = "sha256:79a3cfd6346ce6c13145731d39db47b7a7b859c0272f02cdb89a3bdcbae233a0"}, + {file = "coverage-5.1-cp39-cp39-win32.whl", hash = "sha256:a82b92b04a23d3c8a581fc049228bafde988abacba397d57ce95fe95e0338ab4"}, + {file = "coverage-5.1-cp39-cp39-win_amd64.whl", hash = "sha256:bb28a7245de68bf29f6fb199545d072d1036a1917dca17a1e75bbb919e14ee8e"}, + {file = "coverage-5.1.tar.gz", hash = "sha256:f90bfc4ad18450c80b024036eaf91e4a246ae287701aaa88eaebebf150868052"}, ] docutils = [ {file = "docutils-0.16-py2.py3-none-any.whl", hash = "sha256:0c5b78adfbf7762415433f5515cd5c9e762339e23369dbe8000d84a4bf4ab3af"}, {file = "docutils-0.16.tar.gz", hash = "sha256:c2de3a60e9e7d07be26b7f2b00ca0309c207e06c100f9cc2a94931fc75a478fc"}, ] -entrypoints = [ - {file = "entrypoints-0.3-py2.py3-none-any.whl", hash = "sha256:589f874b313739ad35be6e0cd7efde2a4e9b6fea91edcc34e58ecbb8dbe56d19"}, - {file = "entrypoints-0.3.tar.gz", hash = "sha256:c70dd71abe5a8c85e55e12c19bd91ccfeec11a6e99044204511f9ed547d48451"}, -] -filelock = [ - {file = "filelock-3.0.12-py3-none-any.whl", hash = "sha256:929b7d63ec5b7d6b71b0fa5ac14e030b3f70b75747cef1b10da9b879fef15836"}, - {file = "filelock-3.0.12.tar.gz", hash = "sha256:18d82244ee114f543149c66a6e0c14e9c4f8a1044b5cdaadd0f82159d6a6ff59"}, -] flake8 = [ - {file = "flake8-3.7.9-py2.py3-none-any.whl", hash = "sha256:49356e766643ad15072a789a20915d3c91dc89fd313ccd71802303fd67e4deca"}, - {file = "flake8-3.7.9.tar.gz", hash = "sha256:45681a117ecc81e870cbf1262835ae4af5e7a8b08e40b944a8a6e6b895914cfb"}, + {file = "flake8-3.8.3-py2.py3-none-any.whl", hash = "sha256:15e351d19611c887e482fb960eae4d44845013cc142d42896e9862f775d8cf5c"}, + {file = "flake8-3.8.3.tar.gz", hash = "sha256:f04b9fcbac03b0a3e58c0ab3a0ecc462e023a9faf046d57794184028123aa208"}, ] identify = [ - {file = "identify-1.4.13-py2.py3-none-any.whl", hash = "sha256:a7577a1f55cee1d21953a5cf11a3c839ab87f5ef909a4cba6cf52ed72b4c6059"}, - {file = "identify-1.4.13.tar.gz", hash = "sha256:ab246293e6585a1c6361a505b68d5b501a0409310932b7de2c2ead667b564d89"}, + {file = "identify-1.4.19-py2.py3-none-any.whl", hash = "sha256:781fd3401f5d2b17b22a8b18b493a48d5d948e3330634e82742e23f9c20234ef"}, + {file = "identify-1.4.19.tar.gz", hash = "sha256:249ebc7e2066d6393d27c1b1be3b70433f824a120b1d8274d362f1eb419e3b52"}, ] idna = [ {file = "idna-2.9-py2.py3-none-any.whl", hash = "sha256:a068a21ceac8a4d63dbfd964670474107f541babbd2250d61922f029858365fa"}, @@ -899,20 +903,20 @@ imagesize = [ {file = "imagesize-1.2.0.tar.gz", hash = "sha256:b1f6b5a4eab1f73479a50fb79fcf729514a900c341d8503d62a62dbc4127a2b1"}, ] importlib-metadata = [ - {file = "importlib_metadata-1.6.0-py2.py3-none-any.whl", hash = "sha256:2a688cbaa90e0cc587f1df48bdc97a6eadccdcd9c35fb3f976a09e3b5016d90f"}, - {file = "importlib_metadata-1.6.0.tar.gz", hash = "sha256:34513a8a0c4962bc66d35b359558fd8a5e10cd472d37aec5f66858addef32c1e"}, + {file = "importlib_metadata-1.6.1-py2.py3-none-any.whl", hash = "sha256:15ec6c0fd909e893e3a08b3a7c76ecb149122fb14b7efe1199ddd4c7c57ea958"}, + {file = "importlib_metadata-1.6.1.tar.gz", hash = "sha256:0505dd08068cfec00f53a74a0ad927676d7757da81b7436a6eefe4c7cf75c545"}, ] importlib-resources = [ - {file = "importlib_resources-1.4.0-py2.py3-none-any.whl", hash = "sha256:dd98ceeef3f5ad2ef4cc287b8586da4ebad15877f351e9688987ad663a0a29b8"}, - {file = "importlib_resources-1.4.0.tar.gz", hash = "sha256:4019b6a9082d8ada9def02bece4a76b131518866790d58fdda0b5f8c603b36c2"}, + {file = "importlib_resources-2.0.0-py2.py3-none-any.whl", hash = "sha256:a86462cf34a6d391d1d5d598a5e2f5aac9fc00b265d40542e1196328f015d1f6"}, + {file = "importlib_resources-2.0.0.tar.gz", hash = "sha256:7f6aae2ed252ba10f5d1af5676b0e35f3b3eb7d3cc103b8365cc92aec0c79258"}, ] isort = [ {file = "isort-4.3.21-py2.py3-none-any.whl", hash = "sha256:6e811fcb295968434526407adb8796944f1988c5b65e8139058f2014cbe100fd"}, {file = "isort-4.3.21.tar.gz", hash = "sha256:54da7e92468955c4fceacd0c86bd0ec997b0e1ee80d97f67c35a78b719dccab1"}, ] jinja2 = [ - {file = "Jinja2-2.11.1-py2.py3-none-any.whl", hash = "sha256:b0eaf100007721b5c16c1fc1eecb87409464edc10469ddc9a22a27a99123be49"}, - {file = "Jinja2-2.11.1.tar.gz", hash = "sha256:93187ffbc7808079673ef52771baa950426fd664d3aad1d0fa3e95644360e250"}, + {file = "Jinja2-2.11.2-py2.py3-none-any.whl", hash = "sha256:f0a4641d3cf955324a89c04f3d94663aa4d638abe8f733ecd3582848e1c37035"}, + {file = "Jinja2-2.11.2.tar.gz", hash = "sha256:89aab215427ef59c34ad58735269eb58b1a5808103067f7bb9d5836c651b3bb0"}, ] markupsafe = [ {file = "MarkupSafe-1.1.1-cp27-cp27m-macosx_10_6_intel.whl", hash = "sha256:09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161"}, @@ -954,22 +958,26 @@ mccabe = [ {file = "mccabe-0.6.1.tar.gz", hash = "sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"}, ] more-itertools = [ - {file = "more-itertools-8.2.0.tar.gz", hash = "sha256:b1ddb932186d8a6ac451e1d95844b382f55e12686d51ca0c68b6f61f2ab7a507"}, - {file = "more_itertools-8.2.0-py3-none-any.whl", hash = "sha256:5dd8bcf33e5f9513ffa06d5ad33d78f31e1931ac9a18f33d37e77a180d393a7c"}, + {file = "more-itertools-8.3.0.tar.gz", hash = "sha256:558bb897a2232f5e4f8e2399089e35aecb746e1f9191b6584a151647e89267be"}, + {file = "more_itertools-8.3.0-py3-none-any.whl", hash = "sha256:7818f596b1e87be009031c7653d01acc46ed422e6656b394b0f765ce66ed4982"}, ] nested-lookup = [ {file = "nested-lookup-0.2.21.tar.gz", hash = "sha256:23789e328bd1d0b3f9db93cf51b7103a978dd0d8a834770d2c19b365e934ab96"}, ] nodeenv = [ - {file = "nodeenv-1.3.5-py2.py3-none-any.whl", hash = "sha256:5b2438f2e42af54ca968dd1b374d14a1194848955187b0e5e4be1f73813a5212"}, + {file = "nodeenv-1.4.0-py2.py3-none-any.whl", hash = "sha256:4b0b77afa3ba9b54f4b6396e60b0c83f59eaeb2d63dc3cc7a70f7f4af96c82bc"}, ] packaging = [ - {file = "packaging-20.3-py2.py3-none-any.whl", hash = "sha256:82f77b9bee21c1bafbf35a84905d604d5d1223801d639cf3ed140bd651c08752"}, - {file = "packaging-20.3.tar.gz", hash = "sha256:3c292b474fda1671ec57d46d739d072bfd495a4f51ad01a055121d81e952b7a3"}, + {file = "packaging-20.4-py2.py3-none-any.whl", hash = "sha256:998416ba6962ae7fbd6596850b80e17859a5753ba17c32284f67bfff33784181"}, + {file = "packaging-20.4.tar.gz", hash = "sha256:4357f74f47b9c12db93624a82154e9b120fa8293699949152b22065d556079f8"}, +] +pathlib2 = [ + {file = "pathlib2-2.3.5-py2.py3-none-any.whl", hash = "sha256:0ec8205a157c80d7acc301c0b18fbd5d44fe655968f5d947b6ecef5290fc35db"}, + {file = "pathlib2-2.3.5.tar.gz", hash = "sha256:6cd9a47b597b37cc57de1c05e56fb1a1c9cc9fab04fe78c29acd090418529868"}, ] pathspec = [ - {file = "pathspec-0.7.0-py2.py3-none-any.whl", hash = "sha256:163b0632d4e31cef212976cf57b43d9fd6b0bac6e67c26015d611a647d5e7424"}, - {file = "pathspec-0.7.0.tar.gz", hash = "sha256:562aa70af2e0d434367d9790ad37aed893de47f1693e4201fd1d3dca15d19b96"}, + {file = "pathspec-0.8.0-py2.py3-none-any.whl", hash = "sha256:7d91249d21749788d07a2d0f94147accd8f845507400749ea19c1ec9054a12b0"}, + {file = "pathspec-0.8.0.tar.gz", hash = "sha256:da45173eb3a6f2a5a487efba21f050af2b41948be6ab52b6a1e3ff22bb8b7061"}, ] pluggy = [ {file = "pluggy-0.13.1-py2.py3-none-any.whl", hash = "sha256:966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d"}, @@ -984,32 +992,35 @@ py = [ {file = "py-1.8.1.tar.gz", hash = "sha256:5e27081401262157467ad6e7f851b7aa402c5852dbcb3dae06768434de5752aa"}, ] pycodestyle = [ - {file = "pycodestyle-2.5.0-py2.py3-none-any.whl", hash = "sha256:95a2219d12372f05704562a14ec30bc76b05a5b297b21a5dfe3f6fac3491ae56"}, - {file = "pycodestyle-2.5.0.tar.gz", hash = "sha256:e40a936c9a450ad81df37f549d676d127b1b66000a6c500caa2b085bc0ca976c"}, + {file = "pycodestyle-2.6.0-py2.py3-none-any.whl", hash = "sha256:2295e7b2f6b5bd100585ebcb1f616591b652db8a741695b3d8f5d28bdc934367"}, + {file = "pycodestyle-2.6.0.tar.gz", hash = "sha256:c58a7d2815e0e8d7972bf1803331fb0152f867bd89adf8a01dfd55085434192e"}, ] pyflakes = [ - {file = "pyflakes-2.1.1-py2.py3-none-any.whl", hash = "sha256:17dbeb2e3f4d772725c777fabc446d5634d1038f234e77343108ce445ea69ce0"}, - {file = "pyflakes-2.1.1.tar.gz", hash = "sha256:d976835886f8c5b31d47970ed689944a0262b5f3afa00a5a7b4dc81e5449f8a2"}, + {file = "pyflakes-2.2.0-py2.py3-none-any.whl", hash = "sha256:0d94e0e05a19e57a99444b6ddcf9a6eb2e5c68d3ca1e98e90707af8152c90a92"}, + {file = "pyflakes-2.2.0.tar.gz", hash = "sha256:35b2d75ee967ea93b55750aa9edbbf72813e06a66ba54438df2cfac9e3c27fc8"}, ] pygments = [ {file = "Pygments-2.6.1-py3-none-any.whl", hash = "sha256:ff7a40b4860b727ab48fad6360eb351cc1b33cbf9b15a0f689ca5353e9463324"}, {file = "Pygments-2.6.1.tar.gz", hash = "sha256:647344a061c249a3b74e230c739f434d7ea4d8b1d5f3721bc0f3558049b38f44"}, ] pyparsing = [ - {file = "pyparsing-2.4.6-py2.py3-none-any.whl", hash = "sha256:c342dccb5250c08d45fd6f8b4a559613ca603b57498511740e65cd11a2e7dcec"}, - {file = "pyparsing-2.4.6.tar.gz", hash = "sha256:4c830582a84fb022400b85429791bc551f1f4871c33f23e44f353119e92f969f"}, + {file = "pyparsing-2.4.7-py2.py3-none-any.whl", hash = "sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"}, + {file = "pyparsing-2.4.7.tar.gz", hash = "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"}, ] pytest = [ - {file = "pytest-5.4.1-py3-none-any.whl", hash = "sha256:0e5b30f5cb04e887b91b1ee519fa3d89049595f428c1db76e73bd7f17b09b172"}, - {file = "pytest-5.4.1.tar.gz", hash = "sha256:84dde37075b8805f3d1f392cc47e38a0e59518fb46a431cfdaf7cf1ce805f970"}, + {file = "pytest-5.4.3-py3-none-any.whl", hash = "sha256:5c0db86b698e8f170ba4582a492248919255fcd4c79b1ee64ace34301fb589a1"}, + {file = "pytest-5.4.3.tar.gz", hash = "sha256:7979331bfcba207414f5e1263b5a0f8f521d0f457318836a7355531ed1a4c7d8"}, ] pytest-cov = [ - {file = "pytest-cov-2.8.1.tar.gz", hash = "sha256:cc6742d8bac45070217169f5f72ceee1e0e55b0221f54bcf24845972d3a47f2b"}, - {file = "pytest_cov-2.8.1-py2.py3-none-any.whl", hash = "sha256:cdbdef4f870408ebdbfeb44e63e07eb18bb4619fae852f6e760645fa36172626"}, + {file = "pytest-cov-2.9.0.tar.gz", hash = "sha256:b6a814b8ed6247bd81ff47f038511b57fe1ce7f4cc25b9106f1a4b106f1d9322"}, + {file = "pytest_cov-2.9.0-py2.py3-none-any.whl", hash = "sha256:c87dfd8465d865655a8213859f1b4749b43448b5fae465cb981e16d52a811424"}, +] +pytest-sugar = [ + {file = "pytest-sugar-0.9.3.tar.gz", hash = "sha256:1630b5b7ea3624919b73fde37cffb87965c5087a4afab8a43074ff44e0d810c4"}, ] pytz = [ - {file = "pytz-2019.3-py2.py3-none-any.whl", hash = "sha256:1c557d7d0e871de1f5ccd5833f60fb2550652da6be2693c1e02300743d21500d"}, - {file = "pytz-2019.3.tar.gz", hash = "sha256:b02c06db6cf09c12dd25137e563b31700d3b80fcc4ad23abb7a315f2789819be"}, + {file = "pytz-2020.1-py2.py3-none-any.whl", hash = "sha256:a494d53b6d39c3c6e44c3bec237336e14305e4f29bbf800b599253057fbb79ed"}, + {file = "pytz-2020.1.tar.gz", hash = "sha256:c35965d010ce31b23eeb663ed3cc8c906275d6be1a34393a1d73a41febf4a048"}, ] pyyaml = [ {file = "PyYAML-5.3.1-cp27-cp27m-win32.whl", hash = "sha256:74809a57b329d6cc0fdccee6318f44b9b8649961fa73144a98735b0aaf029f1f"}, @@ -1025,39 +1036,39 @@ pyyaml = [ {file = "PyYAML-5.3.1.tar.gz", hash = "sha256:b8eac752c5e14d3eca0e6dd9199cd627518cb5ec06add0de9d32baeee6fe645d"}, ] regex = [ - {file = "regex-2020.2.20-cp27-cp27m-win32.whl", hash = "sha256:99272d6b6a68c7ae4391908fc15f6b8c9a6c345a46b632d7fdb7ef6c883a2bbb"}, - {file = "regex-2020.2.20-cp27-cp27m-win_amd64.whl", hash = "sha256:974535648f31c2b712a6b2595969f8ab370834080e00ab24e5dbb9d19b8bfb74"}, - {file = "regex-2020.2.20-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:5de40649d4f88a15c9489ed37f88f053c15400257eeb18425ac7ed0a4e119400"}, - {file = "regex-2020.2.20-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:82469a0c1330a4beb3d42568f82dffa32226ced006e0b063719468dcd40ffdf0"}, - {file = "regex-2020.2.20-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:d58a4fa7910102500722defbde6e2816b0372a4fcc85c7e239323767c74f5cbc"}, - {file = "regex-2020.2.20-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:f1ac2dc65105a53c1c2d72b1d3e98c2464a133b4067a51a3d2477b28449709a0"}, - {file = "regex-2020.2.20-cp36-cp36m-win32.whl", hash = "sha256:8c2b7fa4d72781577ac45ab658da44c7518e6d96e2a50d04ecb0fd8f28b21d69"}, - {file = "regex-2020.2.20-cp36-cp36m-win_amd64.whl", hash = "sha256:269f0c5ff23639316b29f31df199f401e4cb87529eafff0c76828071635d417b"}, - {file = "regex-2020.2.20-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:bed7986547ce54d230fd8721aba6fd19459cdc6d315497b98686d0416efaff4e"}, - {file = "regex-2020.2.20-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:046e83a8b160aff37e7034139a336b660b01dbfe58706f9d73f5cdc6b3460242"}, - {file = "regex-2020.2.20-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:b33ebcd0222c1d77e61dbcd04a9fd139359bded86803063d3d2d197b796c63ce"}, - {file = "regex-2020.2.20-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:bba52d72e16a554d1894a0cc74041da50eea99a8483e591a9edf1025a66843ab"}, - {file = "regex-2020.2.20-cp37-cp37m-win32.whl", hash = "sha256:01b2d70cbaed11f72e57c1cfbaca71b02e3b98f739ce33f5f26f71859ad90431"}, - {file = "regex-2020.2.20-cp37-cp37m-win_amd64.whl", hash = "sha256:113309e819634f499d0006f6200700c8209a2a8bf6bd1bdc863a4d9d6776a5d1"}, - {file = "regex-2020.2.20-cp38-cp38-manylinux1_i686.whl", hash = "sha256:25f4ce26b68425b80a233ce7b6218743c71cf7297dbe02feab1d711a2bf90045"}, - {file = "regex-2020.2.20-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:9b64a4cc825ec4df262050c17e18f60252cdd94742b4ba1286bcfe481f1c0f26"}, - {file = "regex-2020.2.20-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:9ff16d994309b26a1cdf666a6309c1ef51ad4f72f99d3392bcd7b7139577a1f2"}, - {file = "regex-2020.2.20-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:c7f58a0e0e13fb44623b65b01052dae8e820ed9b8b654bb6296bc9c41f571b70"}, - {file = "regex-2020.2.20-cp38-cp38-win32.whl", hash = "sha256:200539b5124bc4721247a823a47d116a7a23e62cc6695744e3eb5454a8888e6d"}, - {file = "regex-2020.2.20-cp38-cp38-win_amd64.whl", hash = "sha256:7f78f963e62a61e294adb6ff5db901b629ef78cb2a1cfce3cf4eeba80c1c67aa"}, - {file = "regex-2020.2.20.tar.gz", hash = "sha256:9e9624440d754733eddbcd4614378c18713d2d9d0dc647cf9c72f64e39671be5"}, + {file = "regex-2020.6.8-cp27-cp27m-win32.whl", hash = "sha256:fbff901c54c22425a5b809b914a3bfaf4b9570eee0e5ce8186ac71eb2025191c"}, + {file = "regex-2020.6.8-cp27-cp27m-win_amd64.whl", hash = "sha256:112e34adf95e45158c597feea65d06a8124898bdeac975c9087fe71b572bd938"}, + {file = "regex-2020.6.8-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:92d8a043a4241a710c1cf7593f5577fbb832cf6c3a00ff3fc1ff2052aff5dd89"}, + {file = "regex-2020.6.8-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:bae83f2a56ab30d5353b47f9b2a33e4aac4de9401fb582b55c42b132a8ac3868"}, + {file = "regex-2020.6.8-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:b2ba0f78b3ef375114856cbdaa30559914d081c416b431f2437f83ce4f8b7f2f"}, + {file = "regex-2020.6.8-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:95fa7726d073c87141f7bbfb04c284901f8328e2d430eeb71b8ffdd5742a5ded"}, + {file = "regex-2020.6.8-cp36-cp36m-win32.whl", hash = "sha256:e3cdc9423808f7e1bb9c2e0bdb1c9dc37b0607b30d646ff6faf0d4e41ee8fee3"}, + {file = "regex-2020.6.8-cp36-cp36m-win_amd64.whl", hash = "sha256:c78e66a922de1c95a208e4ec02e2e5cf0bb83a36ceececc10a72841e53fbf2bd"}, + {file = "regex-2020.6.8-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:08997a37b221a3e27d68ffb601e45abfb0093d39ee770e4257bd2f5115e8cb0a"}, + {file = "regex-2020.6.8-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:2f6f211633ee8d3f7706953e9d3edc7ce63a1d6aad0be5dcee1ece127eea13ae"}, + {file = "regex-2020.6.8-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:55b4c25cbb3b29f8d5e63aeed27b49fa0f8476b0d4e1b3171d85db891938cc3a"}, + {file = "regex-2020.6.8-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:89cda1a5d3e33ec9e231ece7307afc101b5217523d55ef4dc7fb2abd6de71ba3"}, + {file = "regex-2020.6.8-cp37-cp37m-win32.whl", hash = "sha256:690f858d9a94d903cf5cada62ce069b5d93b313d7d05456dbcd99420856562d9"}, + {file = "regex-2020.6.8-cp37-cp37m-win_amd64.whl", hash = "sha256:1700419d8a18c26ff396b3b06ace315b5f2a6e780dad387e4c48717a12a22c29"}, + {file = "regex-2020.6.8-cp38-cp38-manylinux1_i686.whl", hash = "sha256:654cb773b2792e50151f0e22be0f2b6e1c3a04c5328ff1d9d59c0398d37ef610"}, + {file = "regex-2020.6.8-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:52e1b4bef02f4040b2fd547357a170fc1146e60ab310cdbdd098db86e929b387"}, + {file = "regex-2020.6.8-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:cf59bbf282b627130f5ba68b7fa3abdb96372b24b66bdf72a4920e8153fc7910"}, + {file = "regex-2020.6.8-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:5aaa5928b039ae440d775acea11d01e42ff26e1561c0ffcd3d805750973c6baf"}, + {file = "regex-2020.6.8-cp38-cp38-win32.whl", hash = "sha256:97712e0d0af05febd8ab63d2ef0ab2d0cd9deddf4476f7aa153f76feef4b2754"}, + {file = "regex-2020.6.8-cp38-cp38-win_amd64.whl", hash = "sha256:6ad8663c17db4c5ef438141f99e291c4d4edfeaacc0ce28b5bba2b0bf273d9b5"}, + {file = "regex-2020.6.8.tar.gz", hash = "sha256:e9b64e609d37438f7d6e68c2546d2cb8062f3adb27e6336bc129b51be20773ac"}, ] requests = [ {file = "requests-2.23.0-py2.py3-none-any.whl", hash = "sha256:43999036bfa82904b6af1d99e4882b560e5e2c68e5c4b0aa03b655f3d7d73fee"}, {file = "requests-2.23.0.tar.gz", hash = "sha256:b3f43d496c6daba4493e7c431722aeb7dbc6288f52a6e04e7b6023b0247817e6"}, ] seed-isort-config = [ - {file = "seed_isort_config-1.9.4-py2.py3-none-any.whl", hash = "sha256:81f7adf8dd0bc24e03d0f5eef87561e170757fc7a36050c01e4c29d150757783"}, - {file = "seed_isort_config-1.9.4.tar.gz", hash = "sha256:cecccb911b8d01ecdca16e17d083bf4cd78e928db4d7906125b0373b81f1c7ec"}, + {file = "seed_isort_config-2.2.0-py2.py3-none-any.whl", hash = "sha256:8601fb715a5a4aac39256bbf73c2da6a81f964da9c9d9897ab9074db3663526f"}, + {file = "seed_isort_config-2.2.0.tar.gz", hash = "sha256:be4cfef8f9a3fe8ea1817069c6b624538ac0b429636ec746edeb27e98ed628c8"}, ] six = [ - {file = "six-1.14.0-py2.py3-none-any.whl", hash = "sha256:8f3cd2e254d8f793e7f3d6d9df77b92252b52637291d0f0da013c76ea2724b6c"}, - {file = "six-1.14.0.tar.gz", hash = "sha256:236bdbdce46e6e6a3d61a337c0f8b763ca1e8717c03b369e87a7ec7ce1319c0a"}, + {file = "six-1.15.0-py2.py3-none-any.whl", hash = "sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced"}, + {file = "six-1.15.0.tar.gz", hash = "sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259"}, ] snowballstemmer = [ {file = "snowballstemmer-2.0.0-py2.py3-none-any.whl", hash = "sha256:209f257d7533fdb3cb73bdbd24f436239ca3b2fa67d56f6ff88e86be08cc5ef0"}, @@ -1099,10 +1110,12 @@ taskipy = [ {file = "taskipy-1.2.1-py3-none-any.whl", hash = "sha256:99bdaf5b19791c2345806847147e0fc2d28e1ac9446058def5a8b6b3fc9f23e2"}, {file = "taskipy-1.2.1.tar.gz", hash = "sha256:5eb2c3b1606c896c7fa799848e71e8883b880759224958d07ba760e5db263175"}, ] +termcolor = [ + {file = "termcolor-1.1.0.tar.gz", hash = "sha256:1d6d69ce66211143803fbc56652b41d73b4a400a2891d7bf7a1cdf4c02de613b"}, +] toml = [ - {file = "toml-0.10.0-py2.7.egg", hash = "sha256:f1db651f9657708513243e61e6cc67d101a39bad662eaa9b5546f789338e07a3"}, - {file = "toml-0.10.0-py2.py3-none-any.whl", hash = "sha256:235682dd292d5899d361a811df37e04a8828a5b1da3115886b73cf81ebc9100e"}, - {file = "toml-0.10.0.tar.gz", hash = "sha256:229f81c57791a41d65e399fc06bf0848bab550a9dfd5ed66df18ce5f05e73d5c"}, + {file = "toml-0.10.1-py2.py3-none-any.whl", hash = "sha256:bda89d5935c2eac546d648028b9901107a595863cb36bae0c73ac804a9b4ce88"}, + {file = "toml-0.10.1.tar.gz", hash = "sha256:926b612be1e5ce0634a2ca03470f95169cf16f939018233a670519cb4ac58b0f"}, ] typed-ast = [ {file = "typed_ast-1.4.1-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:73d785a950fc82dd2a25897d525d003f6378d1cb23ab305578394694202a58c3"}, @@ -1128,18 +1141,18 @@ typed-ast = [ {file = "typed_ast-1.4.1.tar.gz", hash = "sha256:8c8aaad94455178e3187ab22c8b01a3837f8ee50e09cf31f1ba129eb293ec30b"}, ] urllib3 = [ - {file = "urllib3-1.25.8-py2.py3-none-any.whl", hash = "sha256:2f3db8b19923a873b3e5256dc9c2dedfa883e33d87c690d9c7913e1f40673cdc"}, - {file = "urllib3-1.25.8.tar.gz", hash = "sha256:87716c2d2a7121198ebcb7ce7cccf6ce5e9ba539041cfbaeecfb641dc0bf6acc"}, + {file = "urllib3-1.25.9-py2.py3-none-any.whl", hash = "sha256:88206b0eb87e6d677d424843ac5209e3fb9d0190d0ee169599165ec25e9d9115"}, + {file = "urllib3-1.25.9.tar.gz", hash = "sha256:3018294ebefce6572a474f0604c2021e33b3fd8006ecd11d62107a5d2a963527"}, ] virtualenv = [ - {file = "virtualenv-20.0.15-py2.py3-none-any.whl", hash = "sha256:4e399f48c6b71228bf79f5febd27e3bbb753d9d5905776a86667bc61ab628a25"}, - {file = "virtualenv-20.0.15.tar.gz", hash = "sha256:9e81279f4a9d16d1c0654a127c2c86e5bca2073585341691882c1e66e31ef8a5"}, + {file = "virtualenv-16.7.10-py2.py3-none-any.whl", hash = "sha256:105893c8dc66b7817691c7371439ec18e3b6c5e323a304b5ed96cdd2e75cc1ec"}, + {file = "virtualenv-16.7.10.tar.gz", hash = "sha256:e88fdcb08b0ecb11da97868f463dd06275923f50d87f4b9c8b2fc0994eec40f4"}, ] wcwidth = [ - {file = "wcwidth-0.1.9-py2.py3-none-any.whl", hash = "sha256:cafe2186b3c009a04067022ce1dcd79cb38d8d65ee4f4791b8888d6599d1bbe1"}, - {file = "wcwidth-0.1.9.tar.gz", hash = "sha256:ee73862862a156bf77ff92b09034fc4825dd3af9cf81bc5b360668d425f3c5f1"}, + {file = "wcwidth-0.2.4-py2.py3-none-any.whl", hash = "sha256:79375666b9954d4a1a10739315816324c3e73110af9d0e102d906fdb0aec009f"}, + {file = "wcwidth-0.2.4.tar.gz", hash = "sha256:8c6b5b6ee1360b842645f336d9e5d68c55817c26d3050f46b235ef2bc650e48f"}, ] zipp = [ - {file = "zipp-3.1.0-py3-none-any.whl", hash = "sha256:aa36550ff0c0b7ef7fa639055d797116ee891440eac1a56f378e2d3179e0320b"}, - {file = "zipp-3.1.0.tar.gz", hash = "sha256:c599e4d75c98f6798c509911d08a22e6c021d074469042177c8c86fb92eefd96"}, + {file = "zipp-1.2.0-py2.py3-none-any.whl", hash = "sha256:e0d9e63797e483a30d27e09fffd308c59a700d365ec34e93cc100844168bf921"}, + {file = "zipp-1.2.0.tar.gz", hash = "sha256:c70410551488251b0fee67b460fb9a536af8d6f9f008ad10ac51f615b6a521b1"}, ] diff --git a/pyproject.toml b/pyproject.toml index 9cf335a..97c98c7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,10 @@ classifiers = [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", + "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", "Topic :: Software Development :: Libraries", "Topic :: Software Development :: Libraries :: Python Modules", ] @@ -20,8 +23,8 @@ classifiers = [ test = "poetry run pytest -v --cov=config_file/ --cov-report term-missing tests/" [tool.poetry.dependencies] -python = "^3.6" -nested-lookup = "^0.2.19" +python = "^3.5" +nested-lookup = "^0.2.21" toml = { version = "^0.10.0", optional = true } pyyaml = { version = "^5.3.1", optional = true } @@ -33,19 +36,20 @@ yaml = ["pyyaml"] pre-commit = "^1.20" autoflake = "^1.3.1" isort = "^4.3.21" -seed-isort-config = "^1.9" +seed-isort-config = { version = "^2.1.1", python = "^3.6.1" } pytest = "^5.4.1" pytest-cov = "^2.8.1" +pytest-sugar = "^0.9.3" sphinx = "^2.4.4" sphinx_rtd_theme = "^0.4.3" -taskipy = "^1.2.1" +taskipy = { version = "^1.2.1", python = "^3.6" } bump2version = "^1.0.0" flake8 = "^3.7.9" -black = "^19.10b0" +black = { version = "^19.10b0", python = "^3.6" } [tool.black] line-length = 88 -target_version = ['py38'] +target_version = ['py35'] include = '\.pyi?$' [tool.isort] diff --git a/tests/test_config_file.py b/tests/test_config_file.py index f083538..fe8539f 100644 --- a/tests/test_config_file.py +++ b/tests/test_config_file.py @@ -3,8 +3,7 @@ from pathlib import Path import pytest -from config_file.config_file import ConfigFile -from config_file.parsers.base_parser import BaseParser +from config_file import ConfigFile, BaseParser @pytest.mark.parametrize( @@ -49,14 +48,14 @@ def test_missing_config_files_during_restore( tmpdir, file_extension, specify_original_config_path ): with pytest.raises(OSError): - temp_path = tmpdir / f"config.{file_extension}" + temp_path = tmpdir / "config.{}".format(file_extension) temp_path.write("") config = ConfigFile(str(temp_path)) if specify_original_config_path: - specify_original_config_path = f"does_not_exist.{file_extension}" + specify_original_config_path = "does_not_exist.{}".format(file_extension) else: - config.path = f"does_not_exist.{file_extension}" + config.path = "does_not_exist.{}".format(file_extension) specify_original_config_path = None config.restore_original(original_file_path=specify_original_config_path) @@ -160,7 +159,7 @@ def test_that_config_file_can_get( def test_that_config_file_can_find_sections_and_keys( tmpdir, file_extension, file_contents, section_key, expected_result ): - config_path = tmpdir / f"config.{file_extension}" + config_path = tmpdir / "config.{}".format(file_extension) config_path.write_text(file_contents, encoding="utf-8") config = ConfigFile(str(config_path)) assert config.has(section_key) == expected_result diff --git a/tests/test_ini_parser.py b/tests/test_ini_parser.py index 7cdeea8..1b2fd3b 100644 --- a/tests/test_ini_parser.py +++ b/tests/test_ini_parser.py @@ -1,6 +1,7 @@ import pytest -from config_file.parsers.ini_parser import IniParser, ParsingError +from config_file.parsers.ini_parser import IniParser +from config_file.exceptions import ParsingError @pytest.mark.parametrize("ini_file", ["blahblahblah", "{ 'key1': 5 }"]) diff --git a/tests/test_json_parser.py b/tests/test_json_parser.py index a5e38a1..9a8ac09 100644 --- a/tests/test_json_parser.py +++ b/tests/test_json_parser.py @@ -2,7 +2,8 @@ import json import pytest -from config_file.parsers.json_parser import JsonParser, ParsingError +from config_file.parsers.json_parser import JsonParser +from config_file.exceptions import ParsingError @pytest.mark.parametrize("test_json", ["{'test': }", "[section]\nblah = value\n\n"]) @@ -162,7 +163,7 @@ def test_that_json_parser_can_delete_keys(key, test_json, expected_json): ) def test_that_json_parser_can_retrieve_all_keys(test_json, key, expected_output): parser = JsonParser(json.dumps(test_json)) - assert parser.get(key, get_all=True) == expected_output + assert parser.get(key, all=True) == expected_output @pytest.mark.parametrize( @@ -178,8 +179,8 @@ def test_that_json_parser_can_retrieve_all_keys(test_json, key, expected_output) ) def test_that_json_parser_can_set_all_keys(test_json, key, value, expected_output): parser = JsonParser(json.dumps(test_json)) - parser.set(key, value, set_all=True) - assert parser.get(key, get_all=True) == expected_output + parser.set(key, value, all=True) + assert parser.get(key, all=True) == expected_output @pytest.mark.parametrize( @@ -194,5 +195,5 @@ def test_that_json_parser_can_set_all_keys(test_json, key, value, expected_outpu ) def test_that_json_parser_can_delete_all_keys(test_json, key, expected_output): parser = JsonParser(json.dumps(test_json)) - parser.delete(key, delete_all=True) + parser.delete(key, all=True) assert parser.stringify() == json.dumps(expected_output) diff --git a/tox.ini b/tox.ini index 1098700..1a1512f 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] isolated_build = true -envlist = py{36, 37, 38} +envlist = py{35, 36, 37, 38} recreate = True [testenv] -- cgit v1.2.3 From 6924f9027ccb0a97e67929961b6d87bf647eaf88 Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Sat, 20 Jun 2020 13:44:38 -0500 Subject: Run travis CI on python 3.5 --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 507c5e1..e04fe9a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,7 @@ language: python os: linux python: + - "3.5" - "3.6" - "3.7" - "3.8" @@ -10,4 +11,4 @@ install: - curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python - source $HOME/.poetry/env - pip install --upgrade pip tox-travis codecov -script: tox \ No newline at end of file +script: tox -- cgit v1.2.3 From d69d842faba3308a71fac31d19af55595d3e23dd Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Sat, 20 Jun 2020 13:47:27 -0500 Subject: Remove taskipy from tox & add default to parser in __determine_parser Taskipy uses f-strings which break on 3.5. --- config_file/config_file.py | 20 +++++++++++++++----- tox.ini | 4 ++-- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/config_file/config_file.py b/config_file/config_file.py index 805fc49..1cddd20 100644 --- a/config_file/config_file.py +++ b/config_file/config_file.py @@ -11,7 +11,9 @@ from config_file.exceptions import ParsingError class ConfigFile: - def __init__(self, file_path: Type[Union[str, PurePath]], parser: Type[BaseParser] = None) -> None: + def __init__( + self, file_path: Type[Union[str, PurePath]], parser: Type[BaseParser] = None + ) -> None: """ Saves the config file path and expands it if needed, reads in the file contents, and determines what parser should be used for @@ -28,7 +30,9 @@ class ConfigFile: self.parser = self.__determine_parser(file_path, parser) @staticmethod - def __create_config_path(file_path: Type[Union[str, PurePath]], original: bool = False) -> str: + def __create_config_path( + file_path: Type[Union[str, PurePath]], original: bool = False + ) -> str: if isinstance(file_path, PurePath): file_path = str(file_path) @@ -41,11 +45,15 @@ class ConfigFile: file_path = ".".join(file_parts) if Path(file_path).is_dir(): - raise ValueError("The specified config file ({}) is a directory.".format(file_path)) + raise ValueError( + "The specified config file ({}) is a directory.".format(file_path) + ) return file_path - def __determine_parser(self, file_path: Type[Union[str, PurePath]], parser: Type[BaseParser]) -> BaseParser: + def __determine_parser( + self, file_path: Type[Union[str, PurePath]], parser: Type[BaseParser] = None + ) -> BaseParser: if isinstance(file_path, PurePath): file_path = str(file_path) @@ -59,7 +67,9 @@ class ConfigFile: return JsonParser(self.contents) else: raise ValueError( - "File path contains an unsupported or unrecognized file type: {}".format(file_path) + "File path contains an unsupported or unrecognized file type: {}".format( + file_path + ) ) def __read_config_file(self): diff --git a/tox.ini b/tox.ini index 1a1512f..6b849bc 100644 --- a/tox.ini +++ b/tox.ini @@ -9,6 +9,6 @@ deps = codecov>=1.4.0 whitelist_externals = poetry commands = poetry install -v --no-dev -E toml -E yaml - pip install pytest pytest-cov requests taskipy - poetry run task test + pip install pytest pytest-cov requests + poetry run pytest -v --cov=config_file/ --cov-report term-missing tests/ codecov -e TOXENV -- cgit v1.2.3 From 792d5422b663f5669b37e1085200d69821aa3906 Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Sat, 20 Jun 2020 15:13:53 -0500 Subject: Change path, parser, and contents to be properties Also, restore_original now raises a FileNotFoundError. --- .pre-commit-config.yaml | 42 +++++++++++++-------- CHANGELOG.md | 3 ++ config_file/config_file.py | 94 +++++++++++++++++++++++----------------------- config_file/utils.py | 22 +++++++---- tests/test_config_file.py | 45 +++++++++------------- 5 files changed, 108 insertions(+), 98 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9975877..879742c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,30 +1,42 @@ repos: + - repo: git@github.com:humitos/mirrors-autoflake.git + rev: v1.3 + hooks: + - id: autoflake + args: + [ + "--in-place", + "--remove-all-unused-imports", + "--remove-unused-variable", + ] -- repo: git@github.com:humitos/mirrors-autoflake.git - rev: v1.3 - hooks: - - id: autoflake - args: ['--in-place', '--remove-all-unused-imports', '--remove-unused-variable'] - -- repo: https://github.com/asottile/seed-isort-config + - repo: https://github.com/asottile/seed-isort-config rev: v1.9.4 hooks: - - id: seed-isort-config + - id: seed-isort-config -- repo: https://github.com/pre-commit/mirrors-isort + - repo: https://github.com/pre-commit/mirrors-isort rev: v4.3.21 hooks: - - id: isort + - id: isort additional_dependencies: - toml -- repo: https://github.com/ambv/black + - repo: https://github.com/ambv/black rev: stable hooks: - - id: black - language_version: python3.8 + - id: black + + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v2.5.0 + hooks: + - id: trailing-whitespace + - id: check-docstring-first + - id: check-case-conflict + - id: check-yaml + - id: check-toml -- repo: https://github.com/pre-commit/pre-commit-hooks + - repo: https://github.com/pre-commit/pre-commit-hooks rev: v1.2.3 hooks: - - id: flake8 + - id: flake8 diff --git a/CHANGELOG.md b/CHANGELOG.md index e6ac91f..2c9e591 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,9 @@ Changed - The `get_all`, `set_all`, and `delete_all` optional parameter options in `JsonParser` have been renamed to just `all`. This shouldn't have any effect since `JsonParser` is not intended to be used directly, and that option is not in `ConfigFile`. +- `path`, `parser`, and `contents` on the `ConfigFile` are now all properties and can only be retrieved. +- `restore_original` in `ConfigFile` now raises a `FileNotFoundError` instead of an `OSError` if the original + file path does not exist. ## 0.10.0 - 2020-05-10 diff --git a/config_file/config_file.py b/config_file/config_file.py index 1cddd20..d4131de 100644 --- a/config_file/config_file.py +++ b/config_file/config_file.py @@ -1,18 +1,18 @@ import inspect -from pathlib import Path, PurePath +from pathlib import Path from shutil import copyfile from typing import Type, Union +from config_file.exceptions import ParsingError from config_file.parsers.base_parser import BaseParser from config_file.parsers.ini_parser import IniParser from config_file.parsers.json_parser import JsonParser -from config_file.utils import split_on_dot -from config_file.exceptions import ParsingError +from config_file.utils import read_file, split_on_dot class ConfigFile: def __init__( - self, file_path: Type[Union[str, PurePath]], parser: Type[BaseParser] = None + self, file_path: Type[Union[str, Path]], parser: Type[BaseParser] = None ) -> None: """ Saves the config file path and expands it if needed, reads in @@ -25,19 +25,29 @@ class ConfigFile: :raises ValueError: If the specified file path does not have an extension that is supported or it is a directory. """ - self.path = self.__create_config_path(file_path) - self.contents = self.__read_config_file() - self.parser = self.__determine_parser(file_path, parser) + if type(file_path) is not Path: + file_path = Path(file_path) - @staticmethod - def __create_config_path( - file_path: Type[Union[str, PurePath]], original: bool = False - ) -> str: - if isinstance(file_path, PurePath): - file_path = str(file_path) + self.__path = self.__create_config_path(file_path) + self.__contents = read_file(self.__path) + self.__parser = self.__determine_parser(file_path, parser) + + @property + def path(self) -> Path: + return self.__path + + @property + def contents(self) -> str: + return self.__contents - if len(file_path) > 1 and file_path[0] == "~": - return str(Path(file_path).expanduser()) + @property + def parser(self) -> Type[BaseParser]: + return self.__parser + + @staticmethod + def __create_config_path(file_path: Path, original: bool = False) -> str: + if len(file_path.parts) >= 1 and file_path.parts[0] == "~": + return file_path.expanduser() if original: file_parts = split_on_dot(file_path, only_last_dot=True) @@ -52,30 +62,21 @@ class ConfigFile: return file_path def __determine_parser( - self, file_path: Type[Union[str, PurePath]], parser: Type[BaseParser] = None + self, file_path: Path, parser: Type[BaseParser] = None ) -> BaseParser: - if isinstance(file_path, PurePath): - file_path = str(file_path) - if parser is not None and not inspect.isabstract(parser): - return parser(self.contents) + return parser(self.__contents) file_type = split_on_dot(file_path, only_last_dot=True)[-1] if file_type == "ini": - return IniParser(self.contents) + return IniParser(self.__contents) elif file_type == "json": - return JsonParser(self.contents) + return JsonParser(self.__contents) else: raise ValueError( - "File path contains an unsupported or unrecognized file type: {}".format( - file_path - ) + "File path contains an unrecognized file type: {}".format(file_path) ) - def __read_config_file(self): - with open(self.path, "r") as file: - return file.read() - def get(self, key: str, parse_types: bool = False, return_type=None, default=None): """ Retrieve the value of a key. @@ -92,10 +93,10 @@ class ConfigFile: :return: The value of the key. """ if default is None: - key_value = self.parser.get(key, parse_types=parse_types) + key_value = self.__parser.get(key, parse_types=parse_types) else: try: - key_value = self.parser.get(key, parse_types=parse_types) + key_value = self.__parser.get(key, parse_types=parse_types) except ParsingError: return default @@ -103,15 +104,15 @@ class ConfigFile: def set(self, key: str, value): """Sets the value of a key.""" - return self.parser.set(key, value) + return self.__parser.set(key, value) def delete(self, section_key: str): """Deletes a key/value pair or entire sections.""" - return self.parser.delete(section_key) + return self.__parser.delete(section_key) def stringify(self) -> str: """Convert the parsed internal representation of the file back into a string.""" - return self.parser.stringify() + return self.__parser.stringify() def has(self, section_key: str) -> bool: """ @@ -121,7 +122,7 @@ class ConfigFile: Some formats, like JSON, do not have sections and therefore, it would only be checking if the key exists. """ - return self.parser.has(section_key) + return self.__parser.has(section_key) def restore_original(self, original_file_path=None): """ @@ -134,23 +135,22 @@ class ConfigFile: method would look for a config.original.json in the same folder by default. :return: True if the reset succeeded - :raises OSError: If the original configuration file is not present or if an - error occurred when trying to copy the file. + :raises FileNotFoundError: If the original configuration file does not exist + :raises OSError: If self.path is not writable + :raises SameFileError: If self.path and original_file_path are the same file. """ if original_file_path is None: - original_file_path = self.__create_config_path( - str(self.path), original=True - ) + original_file_path = self.__create_config_path(self.__path, original=True) if not Path(original_file_path).exists(): - raise OSError( + raise FileNotFoundError( "The {} file to restore to does not exist.".format(original_file_path) ) - Path(self.path).expanduser().unlink() - copyfile(original_file_path, self.path) - self.contents = self.__read_config_file() - self.parser.parsed_content = self.parser.parse(self.contents) + self.__path.expanduser().unlink() + copyfile(original_file_path, self.__path) + self.__contents = read_file(self.path) + self.__parser.parsed_content = self.__parser.parse(self.__contents) return True @@ -159,7 +159,7 @@ class ConfigFile: Save the configuration changes by writing the file out to the specified path :return: True if the save succeeded. """ - with open(self.path, "w") as config_file: - config_file.write(self.parser.stringify()) + with open(self.__path, "w") as config_file: + config_file.write(self.__parser.stringify()) return True diff --git a/config_file/utils.py b/config_file/utils.py index 61f0ae0..05c3a7a 100644 --- a/config_file/utils.py +++ b/config_file/utils.py @@ -1,4 +1,8 @@ -def split_on_dot(line: str, only_last_dot=False): +from pathlib import Path +from typing import Union + + +def split_on_dot(line: Union[str, Path], only_last_dot=False): """ Split a string on the dot character (.). @@ -7,15 +11,17 @@ def split_on_dot(line: str, only_last_dot=False): :raises ValueError: if the line does not have a dot. """ + if isinstance(line, Path): + line = str(line) + if "." not in line: - # TODO: This is used in the parser for section.keys where a more specific - # error message would be nice, but it is only used more generically to, say, - # split a file path. We may just have to insert some try-catches to catch the - # ValueError and insert a more specific error message or create a custom error - # for this method? raise ValueError( - "section_key must contain the section and key separated by a dot. " - + "e.g. 'section.key'" + "The given string does not have a dot to split on: {}".format(line) ) return line.rsplit(".", 1) if only_last_dot else line.split(".") + + +def read_file(path: Union[str, Path]): + with open(path, "r") as file: + return file.read() diff --git a/tests/test_config_file.py b/tests/test_config_file.py index fe8539f..38cdf38 100644 --- a/tests/test_config_file.py +++ b/tests/test_config_file.py @@ -3,7 +3,7 @@ from pathlib import Path import pytest -from config_file import ConfigFile, BaseParser +from config_file import BaseParser, ConfigFile @pytest.mark.parametrize( @@ -14,7 +14,7 @@ def test_that_config_file_initializes_correctly(tmp_path, file_contents, file_na temp.write_text(file_contents) config = ConfigFile(temp) - assert config.path == str(temp) + assert config.path == temp assert config.contents == temp.read_text() assert isinstance(config.parser, BaseParser) @@ -26,39 +26,27 @@ def test_that_config_file_initializes_correctly(tmp_path, file_contents, file_na def test_that_config_file_can_restore_the_original( tmpdir, file_contents, file_name, original_file_name ): - config_path = tmpdir / file_name + config_path = Path(tmpdir / file_name) config_path.write_text(file_contents, encoding="utf-8") - - original_config_path = tmpdir / original_file_name + original_config_path = Path(tmpdir / original_file_name) original_config_path.write_text(file_contents, encoding="utf-8") - config = ConfigFile(str(config_path)) - config.set("calendar.sunday_index", 0) + config = ConfigFile(config_path) + config.set("calendar.sunday_index", 5) config.restore_original() - assert config.stringify() == ConfigFile(str(original_config_path)).stringify() - assert config_path.read_text(encoding="utf-8") == original_config_path.read_text( - encoding="utf-8" - ) + assert config.stringify() == ConfigFile(original_config_path).stringify() -@pytest.mark.parametrize( - "file_extension, specify_original_config_path", [("ini", False), ("ini", True)] -) -def test_missing_config_files_during_restore( - tmpdir, file_extension, specify_original_config_path -): - with pytest.raises(OSError): - temp_path = tmpdir / "config.{}".format(file_extension) - temp_path.write("") - config = ConfigFile(str(temp_path)) - if specify_original_config_path: - specify_original_config_path = "does_not_exist.{}".format(file_extension) - else: - config.path = "does_not_exist.{}".format(file_extension) - specify_original_config_path = None +def test_missing_config_files_during_restore(tmpdir): + config_path = Path(tmpdir / "config.ini") + config_path.write_text("") + config = ConfigFile(config_path) - config.restore_original(original_file_path=specify_original_config_path) + with pytest.raises(FileNotFoundError) as error: + config.restore_original(original_file_path="jhklasdfhjlkasjej") + + assert "file to restore to does not exist" in str(error) @pytest.mark.parametrize( @@ -228,6 +216,7 @@ def test_that_custom_parser_can_be_used(tmpdir): config_path = tmpdir / "config.conf" config_path.write_text("", encoding="utf-8") config = ConfigFile(str(config_path), parser=CustomParser) + assert isinstance(config.parser, CustomParser) assert config.get("key") == "key" assert config.set("key", "value") == ("key", "value") @@ -242,6 +231,6 @@ def test_that_a_tidle_in_the_config_path_expands_to_the_absolute_path(): try: Path(config_path).expanduser().touch() - assert ConfigFile(config_path).path == str(Path.home() / config_name) + assert ConfigFile(config_path).path == Path.home() / config_name finally: Path(config_path).expanduser().unlink() -- cgit v1.2.3 From a4d252e5dbcf8d366707ab0c4ddac8a81963a801 Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Sat, 20 Jun 2020 15:30:11 -0500 Subject: Revert Python 3.5 support --- CHANGELOG.md | 1 - CONTRIBUTING.md | 35 ++++++++++++++++++----------------- config_file/config_file.py | 10 +++++----- config_file/parsers/ini_parser.py | 6 +++--- config_file/parsers/json_parser.py | 4 ++-- config_file/utils.py | 14 ++++++-------- pyproject.toml | 9 ++++----- tox.ini | 6 +++--- 8 files changed, 41 insertions(+), 44 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c9e591..3f89271 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 Added -- Support for Python 3.5 by removing use of f-strings from codebase. - A generic `ConfigFileError`. - More type hints from `typings` have been added to `ConfigFile` for better type information. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8669fd0..902c669 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,33 +14,34 @@ Here are some guidelines to keep in mind when submitting a pull request: paragraphs of explanation as you need. This is the place to clarify any subtleties you have in your implemeƒntation, document other approaches you tried that didn't end up working, any limitations on your implementation, etc. The most important - part here is to describe *why* you made the change you did, not simply *what* the + part here is to describe _why_ you made the change you did, not simply _what_ the change you made is. - Changelog: Please ensure to update the changelog by adding a new bullet under - an ``Added``, ``Changed``, ``Deprecated``, ``Removed``, ``Fixed``, or ``Security`` section - headers under the ``Unreleased`` version. If any of those sections are not present, + an `Added`, `Changed`, `Deprecated`, `Removed`, `Fixed`, or `Security` section + headers under the `Unreleased` version. If any of those sections are not present, feel free to add the one you need. See [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) if you need guidance on what makes a good entry since this project follows those principles. If you're not comfortable with your English, we'd be happy to write it for you. -- Ensure the tests pass: ``poetry run task test`` to run all tests. +- Ensure the tests pass: `poetry run task test` to run all tests. - New features should be accompanied with tests for them: + - Unit tests are written using [pytest](https://docs.pytest.org/en/latest/). - Pre-commit pipeline: We use a pre-commit pipeline to ensure standard code format. - - Unused imports are automatically removed using `autoflake `_ - - - The remaining imports are sorted using `isort `_. - - - All code is automatically formatted with `black `_ - - - Lastly, everything is checked by `flake8 `_. - - Make sure to install pre-commit before making commits. + - Unused imports are automatically removed using `autoflake `\_ + + - The remaining imports are sorted using `isort `\_. + + - All code is automatically formatted with `black `\_ + + - Lastly, everything is checked by `flake8 `\_. + + Make sure to install pre-commit before making commits. Note: if any of the items had to do any reformatting, sorting, etc., the commit will fail. You'll have to re-add the items it fixed and try again. @@ -48,11 +49,11 @@ Here are some guidelines to keep in mind when submitting a pull request: ```bash pre-commit install ``` - + - CI Pipeline: There is a CI pipeline that is run by Travis CI on commits to master and on pull requests. - + - All it does is ensure that all the tests pass. -To get started, make sure you have poetry installed and run ``poetry install`` and -``poetry shell`` to enter the virtual environment. \ No newline at end of file +To get started, make sure you have poetry installed and run `poetry install` and +`poetry shell` to enter the virtual environment. diff --git a/config_file/config_file.py b/config_file/config_file.py index d4131de..3af1083 100644 --- a/config_file/config_file.py +++ b/config_file/config_file.py @@ -55,9 +55,7 @@ class ConfigFile: file_path = ".".join(file_parts) if Path(file_path).is_dir(): - raise ValueError( - "The specified config file ({}) is a directory.".format(file_path) - ) + raise ValueError(f"The specified config file ({file_path}) is a directory.") return file_path @@ -74,7 +72,7 @@ class ConfigFile: return JsonParser(self.__contents) else: raise ValueError( - "File path contains an unrecognized file type: {}".format(file_path) + f"File path contains an unrecognized file type: {file_path}" ) def get(self, key: str, parse_types: bool = False, return_type=None, default=None): @@ -91,6 +89,8 @@ class ConfigFile: :param default: The default value to return if the value of the key is empty. :return: The value of the key. + + :raises ValueError: If the value is not able to be coerced into return_type """ if default is None: key_value = self.__parser.get(key, parse_types=parse_types) @@ -144,7 +144,7 @@ class ConfigFile: if not Path(original_file_path).exists(): raise FileNotFoundError( - "The {} file to restore to does not exist.".format(original_file_path) + f"The {original_file_path} file to restore to does not exist." ) self.__path.expanduser().unlink() diff --git a/config_file/parsers/ini_parser.py b/config_file/parsers/ini_parser.py index 31b0dcf..2db1ae8 100644 --- a/config_file/parsers/ini_parser.py +++ b/config_file/parsers/ini_parser.py @@ -1,10 +1,10 @@ import configparser from io import StringIO +from config_file.exceptions import ParsingError from config_file.parsers.base_parser import BaseParser from config_file.parsers.parse_value import parse_value from config_file.utils import split_on_dot -from config_file.exceptions import ParsingError class IniParser(BaseParser): @@ -96,7 +96,7 @@ class IniParser(BaseParser): if "." not in section_key: if not self.parsed_content.has_section(section_key): raise ValueError( - "Cannot delete {} because it is not in the config file.".format(section_key) + f"Cannot delete {section_key} because it is not in the config file." ) self.parsed_content.remove_section(section_key) @@ -105,7 +105,7 @@ class IniParser(BaseParser): section, key = split_on_dot(section_key, only_last_dot=True) if key not in self.parsed_content[section]: raise ValueError( - "Cannot delete {section}.{key} because {key} is not in {section}.".format(section = section, key = key) + f"Cannot delete {section}.{key} because {key} is not in {section}." ) self.parsed_content.remove_option(section, key) diff --git a/config_file/parsers/json_parser.py b/config_file/parsers/json_parser.py index 4d93ca3..10d5afc 100644 --- a/config_file/parsers/json_parser.py +++ b/config_file/parsers/json_parser.py @@ -7,10 +7,10 @@ from nested_lookup import ( nested_update, ) +from config_file.exceptions import ParsingError from config_file.parsers.base_parser import BaseParser from config_file.parsers.parse_value import parse_value from config_file.utils import split_on_dot -from config_file.exceptions import ParsingError class JsonParser(BaseParser): @@ -78,7 +78,7 @@ class JsonParser(BaseParser): result = result[key] except TypeError: raise ParsingError( - "Cannot get {} because {} is not subscriptable.".format(key, key_for_error) + f"Cannot get {key} because {key_for_error} is not subscriptable." ) else: result = self.parsed_content[key] diff --git a/config_file/utils.py b/config_file/utils.py index 05c3a7a..9ed09b5 100644 --- a/config_file/utils.py +++ b/config_file/utils.py @@ -1,8 +1,8 @@ -from pathlib import Path -from typing import Union +from pathlib import PurePath +from typing import Type, Union -def split_on_dot(line: Union[str, Path], only_last_dot=False): +def split_on_dot(line: Union[str, Type[PurePath]], only_last_dot=False): """ Split a string on the dot character (.). @@ -11,17 +11,15 @@ def split_on_dot(line: Union[str, Path], only_last_dot=False): :raises ValueError: if the line does not have a dot. """ - if isinstance(line, Path): + if isinstance(line, PurePath): line = str(line) if "." not in line: - raise ValueError( - "The given string does not have a dot to split on: {}".format(line) - ) + raise ValueError(f"The given string does not have a dot to split on: {line}") return line.rsplit(".", 1) if only_last_dot else line.split(".") -def read_file(path: Union[str, Path]): +def read_file(path: Union[str, Type[PurePath]]): with open(path, "r") as file: return file.read() diff --git a/pyproject.toml b/pyproject.toml index 97c98c7..0f3bf5f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,6 @@ classifiers = [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", - "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", @@ -23,7 +22,7 @@ classifiers = [ test = "poetry run pytest -v --cov=config_file/ --cov-report term-missing tests/" [tool.poetry.dependencies] -python = "^3.5" +python = "^3.6" nested-lookup = "^0.2.21" toml = { version = "^0.10.0", optional = true } pyyaml = { version = "^5.3.1", optional = true } @@ -42,14 +41,14 @@ pytest-cov = "^2.8.1" pytest-sugar = "^0.9.3" sphinx = "^2.4.4" sphinx_rtd_theme = "^0.4.3" -taskipy = { version = "^1.2.1", python = "^3.6" } +taskipy = "^1.2.1" bump2version = "^1.0.0" flake8 = "^3.7.9" -black = { version = "^19.10b0", python = "^3.6" } +black = "^19.10b0" [tool.black] line-length = 88 -target_version = ['py35'] +target_version = ['py36'] include = '\.pyi?$' [tool.isort] diff --git a/tox.ini b/tox.ini index 6b849bc..1098700 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] isolated_build = true -envlist = py{35, 36, 37, 38} +envlist = py{36, 37, 38} recreate = True [testenv] @@ -9,6 +9,6 @@ deps = codecov>=1.4.0 whitelist_externals = poetry commands = poetry install -v --no-dev -E toml -E yaml - pip install pytest pytest-cov requests - poetry run pytest -v --cov=config_file/ --cov-report term-missing tests/ + pip install pytest pytest-cov requests taskipy + poetry run task test codecov -e TOXENV -- cgit v1.2.3 From 3fc0b5a1a4281b21132ceb2fb6b1859c55be6e04 Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Sat, 20 Jun 2020 15:35:05 -0500 Subject: Add more type hints to ConfigFile and lint all files --- README.md | 8 ++++---- config_file/__init__.py | 2 +- config_file/config_file.py | 28 ++++++++++++++++++---------- config_file/exceptions.py | 2 +- config_file/parsers/base_parser.py | 1 - tests/test_ini_parser.py | 2 +- tests/test_json_parser.py | 2 +- 7 files changed, 26 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index b7ef6ef..223f3e7 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ ## About Config File -The Config File project is designed to allow you to easily manipulate your +The Config File project is designed to allow you to easily manipulate your configuration files with the same simple API whether they are in INI, JSON, YAML, or TOML. For the time being, it only supports INI and JSON. @@ -49,7 +49,7 @@ from config_file import ConfigFile ORIGINAL_CONFIG_PATH = Path("~/some-project/some-other-config-file.ini") CONFIG_PATH = Path("~/some-project/config.ini") -# Our path can be a string or a Path object. +# Our path can be a string or a Path object. # The "~" will be automatically expanded to the full path for us. config = ConfigFile(CONFIG_PATH) @@ -66,7 +66,7 @@ print(config.get("section")) print(config.get("section", parse_types=True)) >>> {'first_key': 5, 'second_key': 'blah', 'third_key': True} -# Sometimes we want to retrieve a key but don't know whether or not +# Sometimes we want to retrieve a key but don't know whether or not # it will be set. In that case, we can set a default. print(config.get("section.unknown", default=False)) >>> False @@ -96,7 +96,7 @@ print(config.restore_original(original_file_path=ORIGINAL_CONFIG_PATH)) >>> True # Otherwise, a config.original.ini file will automatically be looked for in the -# current directory (because our configuration file we passed in was +# current directory (because our configuration file we passed in was # named config.ini). print(config.restore_original()) >>> True diff --git a/config_file/__init__.py b/config_file/__init__.py index f37019a..5fb800a 100644 --- a/config_file/__init__.py +++ b/config_file/__init__.py @@ -1,6 +1,6 @@ from config_file.config_file import ConfigFile +from config_file.exceptions import ConfigFileError, ParsingError from config_file.parsers.base_parser import BaseParser -from config_file.exceptions import ParsingError, ConfigFileError __version__ = "0.10.0" diff --git a/config_file/config_file.py b/config_file/config_file.py index 3af1083..431521a 100644 --- a/config_file/config_file.py +++ b/config_file/config_file.py @@ -1,7 +1,7 @@ import inspect -from pathlib import Path +from pathlib import Path, PurePath from shutil import copyfile -from typing import Type, Union +from typing import Any, Type, Union from config_file.exceptions import ParsingError from config_file.parsers.base_parser import BaseParser @@ -12,7 +12,9 @@ from config_file.utils import read_file, split_on_dot class ConfigFile: def __init__( - self, file_path: Type[Union[str, Path]], parser: Type[BaseParser] = None + self, + file_path: Type[Union[str, Type[PurePath]]], + parser: Type[BaseParser] = None, ) -> None: """ Saves the config file path and expands it if needed, reads in @@ -33,7 +35,7 @@ class ConfigFile: self.__parser = self.__determine_parser(file_path, parser) @property - def path(self) -> Path: + def path(self) -> Type[PurePath]: return self.__path @property @@ -45,7 +47,7 @@ class ConfigFile: return self.__parser @staticmethod - def __create_config_path(file_path: Path, original: bool = False) -> str: + def __create_config_path(file_path: Type[PurePath], original: bool = False) -> str: if len(file_path.parts) >= 1 and file_path.parts[0] == "~": return file_path.expanduser() @@ -60,7 +62,7 @@ class ConfigFile: return file_path def __determine_parser( - self, file_path: Path, parser: Type[BaseParser] = None + self, file_path: Type[PurePath], parser: Type[BaseParser] = None ) -> BaseParser: if parser is not None and not inspect.isabstract(parser): return parser(self.__contents) @@ -75,7 +77,13 @@ class ConfigFile: f"File path contains an unrecognized file type: {file_path}" ) - def get(self, key: str, parse_types: bool = False, return_type=None, default=None): + def get( + self, + key: str, + parse_types: bool = False, + return_type: Any = None, + default: Any = None, + ) -> Any: """ Retrieve the value of a key. @@ -102,7 +110,7 @@ class ConfigFile: return return_type(key_value) if return_type else key_value - def set(self, key: str, value): + def set(self, key: str, value: Any) -> bool: """Sets the value of a key.""" return self.__parser.set(key, value) @@ -124,7 +132,7 @@ class ConfigFile: """ return self.__parser.has(section_key) - def restore_original(self, original_file_path=None): + def restore_original(self, original_file_path: Union[str, Type[PurePath]] = None): """ Restores the original the config file by deleting it and copying the original back in its place. The internal contents of this config file object are then set @@ -154,7 +162,7 @@ class ConfigFile: return True - def save(self): + def save(self) -> bool: """ Save the configuration changes by writing the file out to the specified path :return: True if the save succeeded. diff --git a/config_file/exceptions.py b/config_file/exceptions.py index cd7e236..e1af755 100644 --- a/config_file/exceptions.py +++ b/config_file/exceptions.py @@ -1,6 +1,6 @@ class ConfigFileError(Exception): """A generic error from the package.""" + class ParsingError(ConfigFileError): """Unable to parse the configuration file.""" - \ No newline at end of file diff --git a/config_file/parsers/base_parser.py b/config_file/parsers/base_parser.py index 5fc47c2..bbdfd91 100644 --- a/config_file/parsers/base_parser.py +++ b/config_file/parsers/base_parser.py @@ -73,4 +73,3 @@ class BaseParser(ABC): if you're going to be using the super() constructor. """ raise NotImplementedError - diff --git a/tests/test_ini_parser.py b/tests/test_ini_parser.py index 1b2fd3b..fb92373 100644 --- a/tests/test_ini_parser.py +++ b/tests/test_ini_parser.py @@ -1,7 +1,7 @@ import pytest -from config_file.parsers.ini_parser import IniParser from config_file.exceptions import ParsingError +from config_file.parsers.ini_parser import IniParser @pytest.mark.parametrize("ini_file", ["blahblahblah", "{ 'key1': 5 }"]) diff --git a/tests/test_json_parser.py b/tests/test_json_parser.py index 9a8ac09..42a0ba9 100644 --- a/tests/test_json_parser.py +++ b/tests/test_json_parser.py @@ -2,8 +2,8 @@ import json import pytest -from config_file.parsers.json_parser import JsonParser from config_file.exceptions import ParsingError +from config_file.parsers.json_parser import JsonParser @pytest.mark.parametrize("test_json", ["{'test': }", "[section]\nblah = value\n\n"]) -- cgit v1.2.3 From dcc86d388f5305b8d2c16a6aaf8e5031be358c02 Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Sat, 20 Jun 2020 15:36:02 -0500 Subject: Convert string to f-string in test --- tests/test_config_file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_config_file.py b/tests/test_config_file.py index 38cdf38..861b169 100644 --- a/tests/test_config_file.py +++ b/tests/test_config_file.py @@ -147,7 +147,7 @@ def test_that_config_file_can_get( def test_that_config_file_can_find_sections_and_keys( tmpdir, file_extension, file_contents, section_key, expected_result ): - config_path = tmpdir / "config.{}".format(file_extension) + config_path = tmpdir / f"config.{file_extension}" config_path.write_text(file_contents, encoding="utf-8") config = ConfigFile(str(config_path)) assert config.has(section_key) == expected_result -- cgit v1.2.3 From 0793757c3a617ad2b736c879216ccf802e2ae921 Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Sat, 20 Jun 2020 15:56:03 -0500 Subject: Use xml cov report for pytest --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 0f3bf5f..5819885 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,7 +19,7 @@ classifiers = [ ] [tool.taskipy.tasks] -test = "poetry run pytest -v --cov=config_file/ --cov-report term-missing tests/" +test = "poetry run pytest -v --cov=config_file/ --cov-report=xml term-missing tests/" [tool.poetry.dependencies] python = "^3.6" -- cgit v1.2.3