Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate full model name in the deprecate model flow #427

Merged
merged 22 commits into from
Oct 26, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
assert_fullname_is_valid instead of check_args
tapadipti committed Oct 13, 2023
commit 1ddc807b6aeb5c558c9bea019bff7d60acc79fb2
7 changes: 4 additions & 3 deletions gto/registry.py
Original file line number Diff line number Diff line change
@@ -421,7 +421,8 @@ def deprecate(
author: Optional[str] = None,
author_email: Optional[str] = None,
) -> Optional[Deprecation]:
self._check_args(name=name, version=None, rev=rev, deprecate_model=True)
"""Deprecate artifact"""
assert_fullname_is_valid(name)
if force:
if simple:
raise WrongArgs("Can't use 'force' with 'simple=True'")
@@ -461,13 +462,13 @@ def deprecate(
)
return self._return_event(tag)

def _check_args(self, name, version, rev, stage=None, deprecate_model=False):
def _check_args(self, name, version, rev, stage=None):
assert_fullname_is_valid(name)
if stage is not None:
self.config.assert_stage(stage)
if version:
self._check_version(version)
if not deprecate_model and not (version is None) ^ (rev is None):
if not (version is None) ^ (rev is None):
raise WrongArgs("One and only one of (version, rev) must be specified.")

@staticmethod