From d8a9275fe494ece48f0ebd6dccb2bd3c72f9916f Mon Sep 17 00:00:00 2001 From: Huanghe Date: Thu, 22 Aug 2024 18:20:10 -0500 Subject: [PATCH] Bug fix: literals passed to FormatterBuilder now implements `__str__` correctly --- pyproject.toml | 2 +- src/formatron/extractor.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 24755e9e..bbabf554 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["setuptools>=61.0"] build-backend = "setuptools.build_meta" [project] name = "formatron" -version = "0.3.1" +version = "0.3.2" authors = [ {name = "Xintong Sun", email = "xs28@rice.edu"}, ] diff --git a/src/formatron/extractor.py b/src/formatron/extractor.py index 9fb489ab..f0d00f84 100644 --- a/src/formatron/extractor.py +++ b/src/formatron/extractor.py @@ -80,6 +80,9 @@ def extract(self, input_str: str) -> typing.Optional[tuple[str, typing.Any]]: def kbnf_representation(self) -> str: return repr(self._literal) + def __str__(self): + return f"${{{self.kbnf_representation}}}" + class RegexExtractor(Extractor): """