Skip to content

Conversation

max-moser
Copy link
Contributor

The use of lstrip() here was a bit too aggressive.
For example:

In [1]: "mailto:maximilian.moser@tuwien.ac.at".lstrip("mailto:")
Out[1]: 'ximilian.moser@tuwien.ac.at'

But:

In [2]: "mailto:maximilian.moser@tuwien.ac.at".removeprefix("mailto:")
Out[2]: 'maximilian.moser@tuwien.ac.at'

@max-moser max-moser changed the title fix(uri): replace lstrip() with removesuffix() fix(uri): replace lstrip() with removeprefix() Mar 18, 2025
@max-moser max-moser force-pushed the mm/fix-mailto-check branch from 9182503 to dbd9946 Compare March 18, 2025 19:30
@d-chris
Copy link
Contributor

d-chris commented Mar 18, 2025

@max-moser str.removeprefix was introduced in Python 3.9.

Since the package currently supports Python >=3.8, your PR will introduce an incompatibility.

@max-moser

This comment was marked as outdated.

@max-moser max-moser force-pushed the mm/fix-mailto-check branch from dbd9946 to 35e6a69 Compare March 19, 2025 21:57
@max-moser max-moser changed the title fix(uri): replace lstrip() with removeprefix() fix(uri): replace lstrip("mailto:") with manual prefix removal Mar 19, 2025
@max-moser
Copy link
Contributor Author

updated the PR to avoid incompatibility.

@yozachar yozachar added the maintenance PR: Alters existing source code label Mar 29, 2025
* the use of `lstrip()` here was a bit too aggressive
* `removeprefix()` is only available with python 3.9+
@yozachar yozachar force-pushed the mm/fix-mailto-check branch from 35e6a69 to 1dbbd0c Compare March 29, 2025 05:15
@yozachar yozachar merged commit d6241fc into python-validators:master Mar 29, 2025
17 checks passed
@max-moser max-moser deleted the mm/fix-mailto-check branch March 29, 2025 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance PR: Alters existing source code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants