From 0aa4b5021f65ef57c06ef34b361c9202f5ef96ba Mon Sep 17 00:00:00 2001 From: Yauheni Kachan <19803638+bagxi@users.noreply.github.com> Date: Thu, 4 Jan 2024 23:20:23 +0300 Subject: [PATCH] docs: DeprecationWarning: invalid escape sequence \* in hydra-slayer --- hydra_slayer/factory.py | 16 ++++++++-------- hydra_slayer/functional.py | 4 ++-- hydra_slayer/registry.py | 8 ++++---- tests/test_functional.py | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/hydra_slayer/factory.py b/hydra_slayer/factory.py index 1393b43..ed1d291 100644 --- a/hydra_slayer/factory.py +++ b/hydra_slayer/factory.py @@ -39,8 +39,8 @@ def metafactory_factory(factory: Factory, args: Tuple, kwargs: Mapping): Args: factory: factory to create instance from - args: \*args to pass to the factory - kwargs: \*\*kwargs to pass to the factory + *args: positional arguments to be passed into the factory + **kwargs: keyword arguments to be passed into the factory Returns: Instance. @@ -88,8 +88,8 @@ def call_meta_factory(factory: Factory, args: Tuple, kwargs: Mapping): Args: factory: factory to create instance from - args: \*args to pass to the factory - kwargs: \*\*kwargs to pass to the factory + *args: positional arguments to be passed into the factory + **kwargs: keyword arguments to be passed into the factory Returns: Instance. @@ -112,8 +112,8 @@ def partial_meta_factory(factory: Factory, args: Tuple, kwargs: Mapping): Args: factory: factory to create instance from - args: \*args to merge into the factory - kwargs: \*\*kwargs to merge into the factory + *args: positional arguments to be merged into the factory + **kwargs: keyword arguments to be merged into the factory Returns: Partial object. @@ -138,8 +138,8 @@ def default_meta_factory(factory: Factory, args: Tuple, kwargs: Mapping): Args: factory: factory to create instance from - args: \*args to pass to the factory - kwargs: \*\*kwargs to pass to the factory + *args: positional arguments to be passed into the factory + **kwargs: keyword arguments to be passed into the factory Returns: Instance. diff --git a/hydra_slayer/functional.py b/hydra_slayer/functional.py index 5e16c20..d6e7d83 100644 --- a/hydra_slayer/functional.py +++ b/hydra_slayer/functional.py @@ -90,8 +90,8 @@ def _get_instance( factory_key: key to extract factory name from get_factory_func: function that returns factory by its name. Default: :py:func:`.functional.get_factory` - args: \*args to pass to the factory - kwargs: \*\*kwargs to pass to the factory + *args: positional arguments to be passed into the factory + **kwargs: keyword arguments to be passed into the factory Returns: created instance diff --git a/hydra_slayer/registry.py b/hydra_slayer/registry.py index 2bfa3a1..c89c00c 100644 --- a/hydra_slayer/registry.py +++ b/hydra_slayer/registry.py @@ -70,7 +70,7 @@ def add( factories: more instances name: name to use for the first factory instance, if a single instance is passed - named_factories: factory and their names as \*\*kwargs + named_factories: factory and their names as keyword arguments Returns: first factory passed @@ -193,8 +193,8 @@ def get_instance(self, *args, **kwargs): Creates instance by calling specified factory with ``instantiate_fn``. Args: - *args: \*args to pass to the factory - **kwargs: \*\*kwargs to pass to the factory + *args: positional arguments to be passed into the factory + **kwargs: keyword arguments to be passed into the factory Returns: created instance @@ -214,7 +214,7 @@ def get_from_params( Args: shared_params: params to pass on all levels in case of recursive creation - **kwargs: \*\*kwargs to pass to the factory + **kwargs: keyword arguments to be passed into the factory Returns: result of calling ``instantiate_fn(factory, **sub_kwargs)`` diff --git a/tests/test_functional.py b/tests/test_functional.py index 93f9a00..60d80f0 100644 --- a/tests/test_functional.py +++ b/tests/test_functional.py @@ -367,7 +367,7 @@ def test_get_from_params_var_method_with_params(): def test_fail_get_from_params_on_exclusive_keywords(): - error_msg = "`.+` and `.+` \(in get mode\) keywords are exclusive" + error_msg = r"`.+` and `.+` \(in get mode\) keywords are exclusive" with pytest.raises(ValueError, match=error_msg): F.get_from_params( **{