From d43ec2bd7531ba287354d860a052dd527ad6e2ae Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Mon, 20 Jul 2026 20:04:50 +0200 Subject: [PATCH 1/2] refactor: typing _SYNTAX_PARSER_STARTS Signed-off-by: Jan Kowalleck --- src/rfc3987_syntax2/syntax_helpers.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/rfc3987_syntax2/syntax_helpers.py b/src/rfc3987_syntax2/syntax_helpers.py index dc51199..24a3b59 100644 --- a/src/rfc3987_syntax2/syntax_helpers.py +++ b/src/rfc3987_syntax2/syntax_helpers.py @@ -110,14 +110,14 @@ "pct_encoded", ] -_SYNTAX_PARSER_STARTS = ["iri", "iri_reference", "absolute_iri"] -_SYNTAX_PARSER_TERM = Literal["iri", "iri_reference", "absolute_iri"] +_T_SYNTAX_PARSER_TERM = Literal["iri", "iri_reference", "absolute_iri"] +_SYNTAX_PARSER_STARTS: list[_T_SYNTAX_PARSER_TERM] = ["iri", "iri_reference", "absolute_iri"] -def parse(term: _SYNTAX_PARSER_TERM, value: str) -> 'ParseTree': +def parse(term: _T_SYNTAX_PARSER_TERM, value: str) -> 'ParseTree': return _get_syntax_parser().parse(value, start=term) -def is_valid_syntax(term: _SYNTAX_PARSER_TERM, value: str) -> bool: +def is_valid_syntax(term: _T_SYNTAX_PARSER_TERM, value: str) -> bool: try: parse(term=term, value=value) return True From 1d6cd995d88b31b567d77152ce6defdaf45fc15e Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Mon, 20 Jul 2026 20:06:41 +0200 Subject: [PATCH 2/2] docs Signed-off-by: Jan Kowalleck --- CHANGELOG.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e10efcb..7f6f1c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,9 +13,9 @@ All notable changes to this project will be documented in this file. * Fix `RFC3987_SYNTAX_TERMS` correctly containing "ipath_rootless" (via [#41]) * Fix `RFC3987_SYNTAX_TERMS` correctly containing "ipath_empty" (via [#41]) * Fix `ucschar` range (via [#45]) - * Fix `parse()`'s typehint for arg `term` (via [#50]) + * Typehint of `parse()`'s arg `term` (via [#50], [#52]) Narrowed down to valid values: "iri", "iri_reference", "absolute_iri" - * Fix `is_valid_syntax`'s typehint for arg `term` (via [#50]) + * Typehint of `is_valid_syntax`'s arg `term` (via [#50], [#52]) Narrowed down to valid values: "iri", "iri_reference", "absolute_iri" * Added * Function `is_valid_syntax_scheme` (via [#48]) @@ -33,6 +33,7 @@ All notable changes to this project will be documented in this file. [#48]: https://github.com/jkowalleck/rfc3987-syntax2/pull/48 [#49]: https://github.com/jkowalleck/rfc3987-syntax2/pull/49 [#50]: https://github.com/jkowalleck/rfc3987-syntax2/pull/50 +[#52]: https://github.com/jkowalleck/rfc3987-syntax2/pull/52 ## v1.2.0 - 2026-07-16