Skip to content

Commit fd82193

Browse files
chore: turn empty tag regex warning into constant
1 parent fa84748 commit fd82193

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/setuptools_scm/_get_version_impl.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
from .version import format_version as _format_version
1919
from .version import ScmVersion
2020

21+
EMPTY_TAG_REGEX_DEPRECATION = DeprecationWarning(
22+
"empty regex for tag regex is invalid, using default"
23+
)
24+
2125
_log = logging.getLogger(__name__)
2226

2327

@@ -162,11 +166,7 @@ def get_version(
162166
def parse_tag_regex(tag_regex: str | Pattern[str]) -> Pattern[str]:
163167
if isinstance(tag_regex, str):
164168
if tag_regex == "":
165-
warnings.warn(
166-
DeprecationWarning(
167-
"empty regex for tag regex is invalid, using default"
168-
)
169-
)
169+
warnings.warn(EMPTY_TAG_REGEX_DEPRECATION)
170170
return _config.DEFAULT_TAG_REGEX
171171
else:
172172
return re.compile(tag_regex)

0 commit comments

Comments
 (0)