Skip to content

Commit

Permalink
Use str.isidentifier instead of regex
Browse files Browse the repository at this point in the history
  • Loading branch information
Xpirix committed Nov 15, 2024
1 parent d390f35 commit 59ec11d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions qgis-app/plugins/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,11 +245,12 @@ def validator(package, is_new: bool = False):
)
)
# Check if package_name is PEP 8 compliant
if is_new and not re.match(r"^[a-z_][a-z0-9_]*$", package_name):
if is_new and not package_name.isidentifier():
raise ValidationError(
_(
"The name of the top level directory inside the zip package must be PEP 8 compliant: "
"lowercase with words separated by underscores, and must start with a letter or underscore."
"a valid Python identifier, which means it must start with a letter or underscore, "
"and can only contain letters, digits, and underscores."
)
)

Expand Down

0 comments on commit 59ec11d

Please sign in to comment.