diff --git a/poetry.lock b/poetry.lock index 5993f17c..b5ff7ebd 100644 --- a/poetry.lock +++ b/poetry.lock @@ -114,14 +114,6 @@ optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" version = "0.4.1" -[[package]] -category = "dev" -description = "Cross-platform colored terminal text." -name = "colorama" -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" -version = "0.4.3" - [[package]] category = "dev" description = "Updated configparser from Python 3.7 for Python 2.6+." @@ -258,17 +250,6 @@ version = "5.2.0" pipfile_deprecated_finder = ["pipreqs", "requirementslib", "tomlkit (>=0.5.3)"] requirements_deprecated_finder = ["pipreqs", "pip-api"] -[[package]] -category = "dev" -description = "More routines for operating on iterables, beyond itertools" -name = "more-itertools" -optional = false -python-versions = "*" -version = "5.0.0" - -[package.dependencies] -six = ">=1.0.0,<2.0.0" - [[package]] category = "dev" description = "More routines for operating on iterables, beyond itertools" @@ -413,8 +394,8 @@ category = "dev" description = "YAML parser and emitter for Python" name = "pyyaml" optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" -version = "5.1.2" +python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +version = "5.3.1" [[package]] category = "dev" @@ -562,9 +543,9 @@ docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"] testing = ["pathlib2", "unittest2", "jaraco.itertools", "func-timeout"] [metadata] -content-hash = "f5d992ebff62fb4db9523d46d0f89977458dad5a204d1ddc4c9b661835dee082" +content-hash = "c9969acb3fec641f267adc9c8ea62b8a424b229c29834d0f5ce6427d71b114b1" lock-version = "1.1" -python-versions = "~2.7 || ^3.4" +python-versions = "~2.7 || ^3.5" [metadata.files] appdirs = [ @@ -610,10 +591,6 @@ codecov = [ colorama = [ {file = "colorama-0.4.1-py2.py3-none-any.whl", hash = "sha256:f8ac84de7840f5b9c4e3347b3c1eaa50f7e49c2b07596221daec5edaabbd7c48"}, {file = "colorama-0.4.1.tar.gz", hash = "sha256:05eed71e2e327246ad6b38c540c4a3117230b19679b875190486ddd2d721422d"}, - {file = "colorama-0.4.1-py2.py3-none-any.whl", hash = "sha256:f8ac84de7840f5b9c4e3347b3c1eaa50f7e49c2b07596221daec5edaabbd7c48"}, - {file = "colorama-0.4.1.tar.gz", hash = "sha256:05eed71e2e327246ad6b38c540c4a3117230b19679b875190486ddd2d721422d"}, - {file = "colorama-0.4.3-py2.py3-none-any.whl", hash = "sha256:7d73d2a99753107a36ac6b455ee49046802e59d9d076ef8e47b61499fa29afff"}, - {file = "colorama-0.4.3.tar.gz", hash = "sha256:e96da0d330793e2cb9485e9ddfd918d456036c7149416295932478192f4436a1"}, ] configparser = [ {file = "configparser-4.0.2-py2.py3-none-any.whl", hash = "sha256:254c1d9c79f60c45dfde850850883d5aaa7f19a23f13561243a050d5a7c3fe4c"}, @@ -703,9 +680,9 @@ isort = [ ] more-itertools = [ {file = "more-itertools-5.0.0.tar.gz", hash = "sha256:38a936c0a6d98a38bcc2d03fdaaedaba9f412879461dd2ceff8d37564d6522e4"}, + {file = "more-itertools-7.2.0.tar.gz", hash = "sha256:409cd48d4db7052af495b09dec721011634af3753ae1ef92d2b32f73a745f832"}, {file = "more_itertools-5.0.0-py2-none-any.whl", hash = "sha256:c0a5785b1109a6bd7fac76d6837fd1feca158e54e521ccd2ae8bfe393cc9d4fc"}, {file = "more_itertools-5.0.0-py3-none-any.whl", hash = "sha256:fe7a7cae1ccb57d33952113ff4fa1bc5f879963600ed74918f1236e212ee50b9"}, - {file = "more-itertools-7.2.0.tar.gz", hash = "sha256:409cd48d4db7052af495b09dec721011634af3753ae1ef92d2b32f73a745f832"}, {file = "more_itertools-7.2.0-py3-none-any.whl", hash = "sha256:92b8c4b06dac4f0611c0729b2f2ede52b2e1bac1ab48f089c7ddc12e26bb60c4"}, ] nodeenv = [ @@ -748,19 +725,17 @@ pytest-cov = [ {file = "pytest_cov-2.8.1-py2.py3-none-any.whl", hash = "sha256:cdbdef4f870408ebdbfeb44e63e07eb18bb4619fae852f6e760645fa36172626"}, ] pyyaml = [ - {file = "PyYAML-5.1.2-cp27-cp27m-win32.whl", hash = "sha256:5124373960b0b3f4aa7df1707e63e9f109b5263eca5976c66e08b1c552d4eaf8"}, - {file = "PyYAML-5.1.2-cp27-cp27m-win_amd64.whl", hash = "sha256:f81025eddd0327c7d4cfe9b62cf33190e1e736cc6e97502b3ec425f574b3e7a8"}, - {file = "PyYAML-5.1.2-cp34-cp34m-win32.whl", hash = "sha256:0113bc0ec2ad727182326b61326afa3d1d8280ae1122493553fd6f4397f33df9"}, - {file = "PyYAML-5.1.2-cp34-cp34m-win_amd64.whl", hash = "sha256:5ca4f10adbddae56d824b2c09668e91219bb178a1eee1faa56af6f99f11bf696"}, - {file = "PyYAML-5.1.2-cp35-cp35m-win32.whl", hash = "sha256:bf47c0607522fdbca6c9e817a6e81b08491de50f3766a7a0e6a5be7905961b41"}, - {file = "PyYAML-5.1.2-cp35-cp35m-win_amd64.whl", hash = "sha256:87ae4c829bb25b9fe99cf71fbb2140c448f534e24c998cc60f39ae4f94396a73"}, - {file = "PyYAML-5.1.2-cp36-cp36m-win32.whl", hash = "sha256:9de9919becc9cc2ff03637872a440195ac4241c80536632fffeb6a1e25a74299"}, - {file = "PyYAML-5.1.2-cp36-cp36m-win_amd64.whl", hash = "sha256:a5a85b10e450c66b49f98846937e8cfca1db3127a9d5d1e31ca45c3d0bef4c5b"}, - {file = "PyYAML-5.1.2-cp37-cp37m-win32.whl", hash = "sha256:b0997827b4f6a7c286c01c5f60384d218dca4ed7d9efa945c3e1aa623d5709ae"}, - {file = "PyYAML-5.1.2-cp37-cp37m-win_amd64.whl", hash = "sha256:7907be34ffa3c5a32b60b95f4d95ea25361c951383a894fec31be7252b2b6f34"}, - {file = "PyYAML-5.1.2-cp38-cp38m-win32.whl", hash = "sha256:7ec9b2a4ed5cad025c2278a1e6a19c011c80a3caaac804fd2d329e9cc2c287c9"}, - {file = "PyYAML-5.1.2-cp38-cp38m-win_amd64.whl", hash = "sha256:b631ef96d3222e62861443cc89d6563ba3eeb816eeb96b2629345ab795e53681"}, - {file = "PyYAML-5.1.2.tar.gz", hash = "sha256:01adf0b6c6f61bd11af6e10ca52b7d4057dd0be0343eb9283c878cf3af56aee4"}, + {file = "PyYAML-5.3.1-cp27-cp27m-win32.whl", hash = "sha256:74809a57b329d6cc0fdccee6318f44b9b8649961fa73144a98735b0aaf029f1f"}, + {file = "PyYAML-5.3.1-cp27-cp27m-win_amd64.whl", hash = "sha256:240097ff019d7c70a4922b6869d8a86407758333f02203e0fc6ff79c5dcede76"}, + {file = "PyYAML-5.3.1-cp35-cp35m-win32.whl", hash = "sha256:4f4b913ca1a7319b33cfb1369e91e50354d6f07a135f3b901aca02aa95940bd2"}, + {file = "PyYAML-5.3.1-cp35-cp35m-win_amd64.whl", hash = "sha256:cc8955cfbfc7a115fa81d85284ee61147059a753344bc51098f3ccd69b0d7e0c"}, + {file = "PyYAML-5.3.1-cp36-cp36m-win32.whl", hash = "sha256:7739fc0fa8205b3ee8808aea45e968bc90082c10aef6ea95e855e10abf4a37b2"}, + {file = "PyYAML-5.3.1-cp36-cp36m-win_amd64.whl", hash = "sha256:69f00dca373f240f842b2931fb2c7e14ddbacd1397d57157a9b005a6a9942648"}, + {file = "PyYAML-5.3.1-cp37-cp37m-win32.whl", hash = "sha256:d13155f591e6fcc1ec3b30685d50bf0711574e2c0dfffd7644babf8b5102ca1a"}, + {file = "PyYAML-5.3.1-cp37-cp37m-win_amd64.whl", hash = "sha256:73f099454b799e05e5ab51423c7bcf361c58d3206fa7b0d555426b1f4d9a3eaf"}, + {file = "PyYAML-5.3.1-cp38-cp38-win32.whl", hash = "sha256:06a0d7ba600ce0b2d2fe2e78453a470b5a6e000a985dd4a4e54e436cc36b0e97"}, + {file = "PyYAML-5.3.1-cp38-cp38-win_amd64.whl", hash = "sha256:95f71d2af0ff4227885f7a6605c37fd53d3a106fcab511b8860ecca9fcf400ee"}, + {file = "PyYAML-5.3.1.tar.gz", hash = "sha256:b8eac752c5e14d3eca0e6dd9199cd627518cb5ec06add0de9d32baeee6fe645d"}, ] regex = [ {file = "regex-2020.4.4-cp27-cp27m-win32.whl", hash = "sha256:90742c6ff121a9c5b261b9b215cb476eea97df98ea82037ec8ac95d1be7a034f"}, diff --git a/pyproject.toml b/pyproject.toml index 898b0755..5c87cd00 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,7 +16,7 @@ packages = [ ] [tool.poetry.dependencies] -python = "~2.7 || ^3.4" +python = "~2.7 || ^3.5" # enum34 is needed for Python 2.7 enum34 = { version = "^1.1", python = "~2.7" } @@ -34,7 +34,7 @@ black = { version = "^19.3b0", markers = "python_version >= '3.6' and python_ver pre-commit = "^1.10" tox = "^3.1" codecov = "^2.0" -pyyaml = "~5.1.1" +pyyaml = "~5.3.1" isort = {version = "^5.2.0", python = "^3.6"} [tool.black] diff --git a/tests/test_toml_spec_tests.py b/tests/test_toml_spec_tests.py index a54f7bf2..b2d2549e 100644 --- a/tests/test_toml_spec_tests.py +++ b/tests/test_toml_spec_tests.py @@ -17,7 +17,7 @@ # The following tests trigger a RecursionError IGNORED_TESTS += ["qa-array-inline-nested-1000", "qa-table-inline-nested-1000"] # The following tests don't work due to time microseconds precision of the tests -IGNORED_TESTS += ["spec-date-time-6", "spec-date-time-local-2"] +IGNORED_TESTS += ["spec-date-time-6", "spec-date-time-local-2", "spec-time-2"] # The following tests don't work due to nan always comparing to False IGNORED_TESTS += ["spec-float-13", "spec-float-14", "spec-float-15"] # The following tests don't work due to issues with th epyyaml library @@ -103,11 +103,6 @@ def test_valid_decode(test): yaml_val = untag(json.loads(f.read())) assert toml_val == yaml_val - print("1") - print(toml_val.as_string()) - print(toml_val._body) - print("2") - print(toml_content) assert toml_val.as_string() == toml_content diff --git a/tomlkit/parser.py b/tomlkit/parser.py index 2c36a52b..bdf98b31 100644 --- a/tomlkit/parser.py +++ b/tomlkit/parser.py @@ -386,7 +386,9 @@ def _parse_key_value(self, parse_comment=False): # type: (bool) -> (Key, Item) if parse_comment: cws, comment, trail = self._parse_comment_trail() meta = val.trivia - meta.comment_ws = cws + if not meta.comment_ws: + meta.comment_ws = cws + meta.comment = comment meta.trail = trail else: @@ -468,11 +470,9 @@ def _handle_dotted_key( self, container, key, value ): # type: (Union[Container, Table], Key, Any) -> None names = tuple(self._split_table_name(key.as_string())) - print("NAMES", names) name = names[0] name._dotted = True if name in container: - print("IN", name) table = container[name] else: table = Table(Container(True), Trivia(), False, is_super_table=True) @@ -1007,7 +1007,6 @@ def _parse_table( key = Key(name, sep="") name_parts = tuple(self._split_table_name(name)) - print("TABLE", name_parts) missing_table = False if parent_name: parent_name_parts = tuple(self._split_table_name(parent_name)) @@ -1018,7 +1017,6 @@ def _parse_table( missing_table = True name_parts = name_parts[len(parent_name_parts) :] - print(name_parts) values = Container(True) @@ -1095,7 +1093,6 @@ def _parse_table( else: if self._current == "[": is_aot_next, name_next = self._peek_table() - print(name, name_next, self._is_child(name, name_next)) if self._is_child(name, name_next): key_next, table_next = self._parse_table(name, table)