Skip to content

Commit

Permalink
add docstrings to registry methods (#586)
Browse files Browse the repository at this point in the history
  • Loading branch information
beliaev-maksim authored Sep 6, 2022
1 parent 60931f1 commit 240504c
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions responses/__init__.py
Original file line number Diff line number Diff line change
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

0 comments on commit 240504c

Please sign in to comment.