Skip to content

Commit

Permalink
updated Check.register to support multiple arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
ken-morel committed Jun 2, 2024
1 parent cccc4c4 commit 7d384e7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/pyoload/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,19 @@ def register(cls: Any, name: str) -> Any:
:param cls: the Check class
:param name: the name to be registerred as
"""
if name in cls.checks_list:
raise Check.CheckNameAlreadyExistsError(name)
names = [x for x in name.split(' ') if x.strip() != '']
for name in names:
if name in cls.checks_list:
raise Check.CheckNameAlreadyExistsError(name)

def inner(func: Callable) -> Callable:
"""def inner(func: Callable)
:param func: The callable to register
:returns: func
"""
cls.checks_list[name] = func
for name in names:
cls.checks_list[name] = func
return func
return inner

Expand Down

0 comments on commit 7d384e7

Please sign in to comment.