Skip to content

Commit ad6c0fe

Browse files
authored
Merge pull request #13 from Summersweet-Software/staging
fix order of types in TomlWriter.format_value (bugfix)
2 parents 9a0220e + 4459bda commit ad6c0fe

4 files changed

Lines changed: 6 additions & 4 deletions

File tree

comprehensiveconfig/toml.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,10 @@ def dump_section(cls, node) -> list[str]:
7272
def format_value(cls, field, value) -> str:
7373
"""Format individual values into properly represented strings of valid toml values."""
7474
match value:
75-
case int() | float():
76-
return str(value)
7775
case bool():
7876
return "true" if value else "false"
77+
case int() | float():
78+
return str(value)
7979
case str():
8080
return f'"{escape(value)}"'
8181
case list():

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "comprehensiveconfig"
3-
version = "1.1.1"
3+
version = "1.1.2"
44
description = "A library to create ergonomic, auto-validated configuration models with great support for static type annotations."
55
readme = "readme.md"
66
requires-python = ">=3.12"

testing.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from comprehensiveconfig import ConfigSpec
44
from comprehensiveconfig.json import JsonWriter
55
from comprehensiveconfig.spec import (
6+
Boolean,
67
Table,
78
TableSpec,
89
Section,
@@ -47,6 +48,7 @@ class Credentials(Section, name="Credentials"):
4748
password = Text("MyPassword")
4849

4950
some_field = Float(6.9)
51+
some_bool = Boolean(True)
5052
example_list_field = List(
5153
["12", "13", "14", 22], inner_type=Text(regex=r"[0-9]*") | Integer()
5254
)

uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)