From 98f036e14c6da903c992ae2ebc9511c308384b61 Mon Sep 17 00:00:00 2001 From: Roman Mogylatov Date: Thu, 30 Sep 2021 19:26:04 -0400 Subject: [PATCH] Update quotes in the docs --- docs/examples-other/chained-factories.rst | 8 +++--- docs/examples-other/factory-of-factories.rst | 8 +++--- docs/providers/configuration.rst | 28 ++++++++++---------- docs/providers/dict.rst | 4 +-- docs/providers/typing_mypy.rst | 4 +-- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/docs/examples-other/chained-factories.rst b/docs/examples-other/chained-factories.rst index 0bec024e..4106e6e1 100644 --- a/docs/examples-other/chained-factories.rst +++ b/docs/examples-other/chained-factories.rst @@ -19,7 +19,7 @@ additional arguments. ) - if __name__ == '__main__': + if __name__ == "__main__": instance = concrete_factory() # Same as: # instance = SomeClass(base_argument=1, extra_argument=2) @@ -43,21 +43,21 @@ Passing of the arguments works the same way like for any other :ref:`factory-pro providers.Factory(dict, arg1=1), arg2=2, ) - print(chained_dict_factory()) # prints: {'arg1': 1, 'arg2': 2} + print(chained_dict_factory()) # prints: {"arg1": 1, "arg2": 2} # 2. Keyword arguments of upper level factory have priority chained_dict_factory = providers.Factory( providers.Factory(dict, arg1=1), arg1=2, ) - print(chained_dict_factory()) # prints: {'arg1': 2} + print(chained_dict_factory()) # prints: {"arg1": 2} # 3. Keyword arguments provided from context have the most priority chained_dict_factory = providers.Factory( providers.Factory(dict, arg1=1), arg1=2, ) - print(chained_dict_factory(arg1=3)) # prints: {'arg1': 3} + print(chained_dict_factory(arg1=3)) # prints: {"arg1": 3} Credits diff --git a/docs/examples-other/factory-of-factories.rst b/docs/examples-other/factory-of-factories.rst index 6cc71aa3..bb45faba 100644 --- a/docs/examples-other/factory-of-factories.rst +++ b/docs/examples-other/factory-of-factories.rst @@ -20,7 +20,7 @@ additional arguments. ) - if __name__ == '__main__': + if __name__ == "__main__": instance = concrete_factory() # Same as: # instance = SomeClass(base_argument=1, extra_argument=2) @@ -46,7 +46,7 @@ Passing of the arguments works the same way like for any other :ref:`factory-pro arg1=1, ) dict_factory = factory_of_dict_factories(arg2=2) - print(dict_factory()) # prints: {'arg1': 1, 'arg2': 2} + print(dict_factory()) # prints: {"arg1": 1, "arg2": 2} # 2. Keyword arguments of upper level factory have priority factory_of_dict_factories = providers.Factory( @@ -55,7 +55,7 @@ Passing of the arguments works the same way like for any other :ref:`factory-pro arg1=1, ) dict_factory = factory_of_dict_factories(arg1=2) - print(dict_factory()) # prints: {'arg1': 2} + print(dict_factory()) # prints: {"arg1": 2} # 3. Keyword arguments provided from context have the most priority factory_of_dict_factories = providers.Factory( @@ -64,7 +64,7 @@ Passing of the arguments works the same way like for any other :ref:`factory-pro arg1=1, ) dict_factory = factory_of_dict_factories(arg1=2) - print(dict_factory(arg1=3)) # prints: {'arg1': 3} + print(dict_factory(arg1=3)) # prints: {"arg1": 3} Credits ------- diff --git a/docs/providers/configuration.rst b/docs/providers/configuration.rst index e5c3e1ae..0cd66e0b 100644 --- a/docs/providers/configuration.rst +++ b/docs/providers/configuration.rst @@ -91,7 +91,7 @@ To use another loader use ``loader`` argument: import yaml - container.config.from_yaml('config.yml', loader=yaml.UnsafeLoader) + container.config.from_yaml("config.yml", loader=yaml.UnsafeLoader) .. note:: @@ -123,7 +123,7 @@ If you need to pass an argument to this call, use ``.from_pydantic()`` keyword a .. code-block:: python - container.config.from_pydantic(Settings(), exclude={'optional'}) + container.config.from_pydantic(Settings(), exclude={"optional"}) .. note:: @@ -225,7 +225,7 @@ undefined environment variable that doesn't have a default value, pass argument .. code-block:: python - container.config.from_yaml('config.yml', envs_required=True) + container.config.from_yaml("config.yml", envs_required=True) See also: :ref:`configuration-strict-mode`. @@ -270,13 +270,13 @@ Mandatory YAML file: .. code-block:: python - container.config.from_yaml('config.yaml', required=True) + container.config.from_yaml("config.yaml", required=True) Mandatory INI file: .. code-block:: python - container.config.from_ini('config.ini', required=True) + container.config.from_ini("config.ini", required=True) Mandatory dictionary: @@ -288,7 +288,7 @@ Mandatory environment variable: .. code-block:: python - container.config.api_key.from_env('API_KEY', required=True) + container.config.api_key.from_env("API_KEY", required=True) See also: :ref:`configuration-strict-mode`. @@ -346,16 +346,16 @@ configuration data is undefined: config = providers.Configuration(strict=True) - if __name__ == '__main__': + if __name__ == "__main__": container = Container() try: - container.config.from_yaml('does-not_exist.yml') # raise exception + container.config.from_yaml("does-not_exist.yml") # raise exception except FileNotFoundError: ... try: - container.config.from_ini('does-not_exist.ini') # raise exception + container.config.from_ini("does-not_exist.ini") # raise exception except FileNotFoundError: ... @@ -365,7 +365,7 @@ configuration data is undefined: ... try: - container.config.from_env('UNDEFINED_ENV_VAR') # raise exception + container.config.from_env("UNDEFINED_ENV_VAR") # raise exception except ValueError: ... @@ -385,7 +385,7 @@ an undefined environment variable without a default value. .. code-block:: python try: - container.config.from_yaml('undefined_env.yml') # raise exception + container.config.from_yaml("undefined_env.yml") # raise exception except ValueError: ... @@ -398,11 +398,11 @@ You can override ``.from_*()`` methods behaviour in strict mode using ``required config = providers.Configuration(strict=True) - if __name__ == '__main__': + if __name__ == "__main__": container = Container() - container.config.from_yaml('config.yml') - container.config.from_yaml('config.local.yml', required=False) + container.config.from_yaml("config.yml") + container.config.from_yaml("config.local.yml", required=False) You can also use ``.required()`` option modifier when making an injection. It does not require to switch configuration provider to strict mode. diff --git a/docs/providers/dict.rst b/docs/providers/dict.rst index bf62c4e6..526a176a 100644 --- a/docs/providers/dict.rst +++ b/docs/providers/dict.rst @@ -23,8 +23,8 @@ To use non-string keys or keys with ``.`` and ``-`` provide a dictionary as a po providers.Dict({ SomeClass: providers.Factory(...), - 'key.with.periods': providers.Factory(...), - 'key-with-dashes': providers.Factory(...), + "key.with.periods": providers.Factory(...), + "key-with-dashes": providers.Factory(...), }) Example: diff --git a/docs/providers/typing_mypy.rst b/docs/providers/typing_mypy.rst index f108a77a..9c033478 100644 --- a/docs/providers/typing_mypy.rst +++ b/docs/providers/typing_mypy.rst @@ -30,7 +30,7 @@ IDE. provider = providers.Factory(Cat) - if __name__ == '__main__': + if __name__ == "__main__": animal = provider() # mypy knows that animal is of type "Cat" @@ -54,5 +54,5 @@ function or method. provider: providers.Provider[Animal] = providers.Factory(Cat) - if __name__ == '__main__': + if __name__ == "__main__": animal = provider() # mypy knows that animal is of type "Animal"