Skip to content

Commit a2d6bb8

Browse files
committed
refactor: Simplify expression
Sourcery suggested: suggestion: Using re.match for a simple lowercase check may be overkill. Consider replacing the regex with: if not (stage_name.islower() and stage_name.isalpha()): ... for better readability and efficiency. This also removes the dependency on the `re` module.
1 parent 2952490 commit a2d6bb8

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

staged_script/staged_script.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from __future__ import annotations
1515

1616
import functools
17-
import re
1817
import shlex
1918
import subprocess
2019
from argparse import (
@@ -58,7 +57,7 @@ def validate_stage_name(stage_name: str) -> None:
5857
Raises:
5958
ValueError: If the stage name is invalid.
6059
"""
61-
if not re.match("^[a-z]+$", stage_name):
60+
if not (stage_name.islower() and stage_name.isalpha()):
6261
message = (
6362
f"Stage name {stage_name!r} must contain only lowercase letters."
6463
)

0 commit comments

Comments
 (0)