diff --git a/royalnet/engineer/command.py b/royalnet/engineer/command.py index c2482dfd..6abcb2e9 100644 --- a/royalnet/engineer/command.py +++ b/royalnet/engineer/command.py @@ -72,7 +72,7 @@ class Command: text: str = await _msg.text() match: re.Match = self.pattern.search(text) match_kwargs: dict = match.groupdict() - teleported: t.Callable = teleporter.teleporter(is_async=True, validate_output=False)(f) + teleported: t.Callable = teleporter.teleport(is_async=True, validate_output=False)(f) return await teleported(_msg=_msg, **original_kwargs, **match_kwargs) return decorated diff --git a/royalnet/engineer/teleporter.py b/royalnet/engineer/teleporter.py index 77eb57fb..2cfe7b39 100644 --- a/royalnet/engineer/teleporter.py +++ b/royalnet/engineer/teleporter.py @@ -135,10 +135,10 @@ def teleport_out(__model: type, value: Value) -> Value: raise exc.OutTeleporterError(errors=e.raw_errors, model=e.model) -def teleporter(__config__: t.Type[pydantic.BaseConfig] = TeleporterConfig, - is_async: bool = False, - validate_input: bool = True, - validate_output: bool = True): +def teleport(__config__: t.Type[pydantic.BaseConfig] = TeleporterConfig, + is_async: bool = False, + validate_input: bool = True, + validate_output: bool = True): """ A factory that returns a decorator which validates a function's passed arguments and its returned value using a :mod:`pydantic` model. @@ -188,5 +188,5 @@ def teleporter(__config__: t.Type[pydantic.BaseConfig] = TeleporterConfig, __all__ = ( "TeleporterConfig", - "teleporter", + "teleport", ) diff --git a/royalnet/engineer/tests/test_teleporter.py b/royalnet/engineer/tests/test_teleporter.py index 875b707f..59f8fe98 100644 --- a/royalnet/engineer/tests/test_teleporter.py +++ b/royalnet/engineer/tests/test_teleporter.py @@ -59,7 +59,7 @@ def test_signature_to_model(my_function): # noinspection PyTypeChecker class TestTeleporter: def test_standard_function(self): - @tp.teleporter() + @tp.teleport() def standard_function(a: int, b: int, _return_str: bool = False) -> int: if _return_str: return "You asked me this." @@ -92,7 +92,7 @@ class TestTeleporter: @pytest.mark.asyncio async def test_async_function(self): - @tp.teleporter(is_async=True) + @tp.teleport(is_async=True) async def async_function(a: int, b: int, _return_str: bool = False) -> int: if _return_str: return "You asked me this." @@ -124,7 +124,7 @@ class TestTeleporter: _ = await async_function(1, 2) def test_only_input(self): - @tp.teleporter(validate_output=False) + @tp.teleport(validate_output=False) def standard_function(a: int, b: int, _return_str: bool = False) -> int: if _return_str: return "You asked me this." @@ -155,7 +155,7 @@ class TestTeleporter: _ = standard_function(1, 2) def test_only_output(self): - @tp.teleporter(validate_input=False) + @tp.teleport(validate_input=False) def standard_function(a: int, b: int, _return_str: bool = False) -> int: if _return_str: return "You asked me this."