Skip to content

Commit

Permalink
Allow caps in dirname (#420)
Browse files Browse the repository at this point in the history
Co-authored-by: Dave Berenbaum <dave.berenbaum@gmail.com>
  • Loading branch information
dacbd and dberenbaum authored Oct 5, 2023
1 parent ea29215 commit 701fa68
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions gto/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ def tag_to_name(value):
return value.replace(SEPARATOR_IN_TAG, SEPARATOR_IN_NAME)


dirname = "[a-z0-9-_./]+" # improve?
name = r"[a-z0-9]([a-z0-9-/_]*[a-z0-9])?"
dirname = "[a-zA-Z0-9-_./]+" # improve?
name = r"[a-zA-Z0-9]([a-zA-Z0-9-/_]*[a-zA-Z0-9])?"
semver = r"(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)(?:-(?P<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?"
counter = "?P<counter>[0-9]+"
name_re = re.compile(f"^{name}$")
Expand Down
7 changes: 5 additions & 2 deletions tests/test_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
"model-prod-v1",
"model_prod_v1",
"dvclive/model",
"model_A",
"DVCLive/Model",
],
)
def test_check_name_is_valid(name):
Expand All @@ -40,8 +42,6 @@ def test_check_name_is_valid(name):
"model@1",
"model#1",
"@namespace/model",
"DVCLive/Model",
"model A",
],
)
def test_check_name_is_invalid(name):
Expand All @@ -54,6 +54,7 @@ def test_check_name_is_invalid(name):
"model",
"dvclive:model",
"some/folder:some/model",
"some/Other_Folder:some/model",
],
)
def test_check_fullname_is_valid(name):
Expand All @@ -66,6 +67,8 @@ def test_check_fullname_is_valid(name):
"model",
"dvclive=model",
"some/folder=some/model",
"Some/folder/A=model",
"Some/folder/A=Model",
],
)
def test_check_fullname_in_tag_is_valid(name):
Expand Down

0 comments on commit 701fa68

Please sign in to comment.