Skip to content

👥 feat[idempotent-quoting]: Add idempotent quoting - #13

Merged
pacman82 merged 4 commits into
blue-yonder:masterfrom
DJ73:feat-python-idempotency
Jul 31, 2025
Merged

👥 feat[idempotent-quoting]: Add idempotent quoting#13
pacman82 merged 4 commits into
blue-yonder:masterfrom
DJ73:feat-python-idempotency

Conversation

@DJ73

@DJ73 DJ73 commented Jul 7, 2025

Copy link
Copy Markdown
Contributor

Currently, the Python 3.7 quoting implementation encodes the % character as %25, which causes repeated quoting on already-quoted strings to produce different outputs on each pass. This leads to inconsistent and non-idempotent behavior when the quoting function is applied multiple times to strings with unknown quoting levels.

This change introduces an option to use an idempotent quoting mode that preserves existing percent-encodings and ensures that multiple iterations of quoting produce the same output. This guarantees stability and predictability for quoting operations, preventing double-encoding issues in downstream processing.

@DJ73

DJ73 commented Jul 9, 2025

Copy link
Copy Markdown
Contributor Author

@pacman82 @xhochy @matthias-bach-by
Could anyone please review this request?

@pacman82

pacman82 commented Jul 10, 2025

Copy link
Copy Markdown
Collaborator

Could anyone please review this request?

Sure.

Technically it is sound. The benchmarks would not even have been necessary. The specification you are going against I have some questions though.

What exactly is the problem you are solving? Why can you not be idempotent by remembering the original input? There are other encodings already which also do not use %, why do they not work?

The PYTHON_3_7 prefix was very much intended to communicating to the user that the behavior of PYTHON_3_7 is imitated. The other encodings describe the situation and the use-case they are for. Since imitation is not what you are looking for I would ask you for a descriptive name, which describes it independent from the language and version you are using. Maybe you even discover that one of the existing encodings already covers your use-case?

Best, Markus

@DJ73 DJ73 changed the title 👥 feat[python-quoting]: Add idempotent quoting 👥 feat[idempotent-quoting]: Add idempotent quoting Jul 29, 2025
@DJ73

DJ73 commented Jul 29, 2025

Copy link
Copy Markdown
Contributor Author

Hi @pacman82,
The primary goal here is to compare partially quoted strings for validation—especially when storing user input. I agree that the PYTHON_3_7 name could be misleading; I’ve removed it from the new quoting implementation.

Existing quoting methods are too restrictive for this use case—they’re designed for specific input forms, whereas this approach needs to handle arbitrary quote-checking.

Let me know if anything’s still unclear.

Regards,
DJ

@pacman82

Copy link
Copy Markdown
Collaborator

Okay, I'll approve. Yet please take out the benchmarks. We can vet them in a separate PR.

Best, Markus

@DJ73
DJ73 force-pushed the feat-python-idempotency branch from ac16de2 to 2f8a847 Compare July 30, 2025 19:22
@DJ73

DJ73 commented Jul 30, 2025

Copy link
Copy Markdown
Contributor Author

Hey @pacman82, thanks. Removed the benchmarks for now.

Regards,
DJ

@DJ73
DJ73 force-pushed the feat-python-idempotency branch from f4841d1 to 6ffeeca Compare July 31, 2025 06:28
@pacman82
pacman82 merged commit 2a6b86a into blue-yonder:master Jul 31, 2025
5 checks passed
@pacman82

Copy link
Copy Markdown
Collaborator

@DJ73 , Thanks for the contribution.

@DJ73

DJ73 commented Jul 31, 2025

Copy link
Copy Markdown
Contributor Author

@pacman82, just one more point, could you create a release for it as well please? The build has not been published

@pacman82

pacman82 commented Aug 1, 2025

Copy link
Copy Markdown
Collaborator

@DJ73 Yeah, I realize that. Sadly, I need help publishing it. See: #14

While I am the original author of the package, I no longer work at BY, so I am not sure I can resolve this without help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants