Skip to content

Commit 5495784

Browse files
committed
feat: add String.type property to retrieve the string type
Close #443 Signed-off-by: Frost Ming <[email protected]>
1 parent a61a4d5 commit 5495784

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Added
66

77
- Custom encoders can now receive `_parent` and `_sort_keys` parameters to enable proper encoding of nested structures. ([#429](https://github.com/python-poetry/tomlkit/issues/429))
8+
- Add `String.type` property to get the string type. ([#443](https://github.com/python-poetry/tomlkit/issues/443))
89

910
## Fixed
1011

tomlkit/items.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1867,6 +1867,10 @@ def value(self) -> str:
18671867
def as_string(self) -> str:
18681868
return f"{self._t.value}{decode(self._original)}{self._t.value}"
18691869

1870+
@property
1871+
def type(self) -> StringType:
1872+
return self._t
1873+
18701874
def __add__(self: ItemT, other: str) -> ItemT:
18711875
if not isinstance(other, str):
18721876
return NotImplemented

0 commit comments

Comments
 (0)