Skip to content

Commit

Permalink
chore!: update pyparsing and pyhocon (#145)
Browse files Browse the repository at this point in the history
This PR was originally intended to just update pyparsing but it appears
that in order to do that, I also have to update pyhocon.

The upgrade went relatively smoothly however I did have to slightly
modify a single test that utilizes pyhocon. I'm not super familiar with
HOCON but the fact that a space inserted before the newline character
fixes the broken test seems to suggest that there is a bug with pyhocon
itself.

The test in question can be found
[here](8076080).
  • Loading branch information
lannuttia authored Mar 8, 2024
1 parent 821ed40 commit e28e1bf
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
3 changes: 1 addition & 2 deletions dataconf/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,7 @@ def __parse(value: any, clazz: Type, path: str, strict: bool, ignore_unexpected:
elif issubclass(clazz, str):
return clazz(value)
elif isinstance(value, str):
return clazz.__getattr__(value)

return clazz.__getitem__(value)
raise TypeConfigException(f"expected str or int at {path}, got {type(value)}")

if isclass(clazz) and issubclass(clazz, Path):
Expand Down
23 changes: 13 additions & 10 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ dataconf = 'dataconf.cli:run'

[tool.poetry.dependencies]
python = "^3.8"
pyhocon = "0.3.59"
python-dateutil = "^2.8.2"
PyYAML = "^6.0.1"
pyparsing = "2.4.7"
isodate = "^0.6.1"
pyhocon = "^0.3.60"
pyparsing = "^3.1.2"

[tool.poetry.group.dev.dependencies]
pytest = ">=7.4.2,<9.0.0"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class N:
class A:
a: N

assert multi.string("a { b = 1\nc = 2 }").string("a { c = 3\nd = 4 }").on(
assert multi.string("a { b = 1\nc = 2 }").string("a { c = 3 \nd = 4 }").on(
A
) == A(a=N(b=1, c=3, d=4))

Expand Down

0 comments on commit e28e1bf

Please sign in to comment.