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

add docstrings to registry methods #586

Merged
merged 1 commit into from Sep 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 17 additions & 0 deletions responses/__init__.py
Expand Up @@ -680,9 +680,25 @@ def __init__(
self._thread_lock = _ThreadingLock()

def get_registry(self) -> FirstMatchRegistry:
"""Returns current registry instance with responses.

Returns
-------
FirstMatchRegistry
Current registry instance with responses.

"""
return self._registry

def _set_registry(self, new_registry: Type[FirstMatchRegistry]) -> None:
"""Replaces current registry with `new_registry`.

Parameters
----------
new_registry : Type[FirstMatchRegistry]
Class reference of the registry that should be set, eg OrderedRegistry

"""
if self.registered():
err_msg = (
"Cannot replace Registry, current registry has responses.\n"
Expand All @@ -693,6 +709,7 @@ def _set_registry(self, new_registry: Type[FirstMatchRegistry]) -> None:
self._registry = new_registry()

def reset(self) -> None:
"""Resets registry (including type), calls, passthru_prefixes to default values."""
self._registry = FirstMatchRegistry()
self._calls.reset()
self.passthru_prefixes = ()
Expand Down