Skip to content

Commit 78d91a3

Browse files
committed
refactor: improve docstrings in AbstractPatcher for clarity
1 parent 7b761f9 commit 78d91a3

File tree

2 files changed

+4
-17
lines changed

2 files changed

+4
-17
lines changed

src/awepatch/_function.py

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from collections import defaultdict
88
from collections.abc import Callable
99
from functools import partial
10-
from types import CodeType, TracebackType
10+
from types import CodeType
1111

1212
from awepatch._utils import (
1313
AWEPATCH_DEBUG,
@@ -246,16 +246,3 @@ def restore(self) -> None:
246246
"""Restore all original functions."""
247247
for patcher in self._func_patchers.values():
248248
patcher.restore()
249-
250-
def __enter__(self) -> None:
251-
"""Enter the context manager, applying all patches."""
252-
self.apply()
253-
254-
def __exit__(
255-
self,
256-
exc_type: type[BaseException] | None,
257-
exc_value: BaseException | None,
258-
traceback: TracebackType | None,
259-
) -> None:
260-
"""Exit the context manager, restoring all original functions."""
261-
self.restore()

src/awepatch/_utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,11 +316,11 @@ def apply_prepared_patches(prepared: PreparedPatches) -> None:
316316
class AbstractPatcher(ABC):
317317
@abstractmethod
318318
def apply(self) -> None:
319-
"""Apply the patches to the function."""
319+
"""Apply the patches."""
320320

321321
@abstractmethod
322322
def restore(self) -> None:
323-
"""Restore the original function."""
323+
"""Restore the original code."""
324324

325325
def __enter__(self) -> None:
326326
"""Enter the context manager, applying the patches."""
@@ -332,7 +332,7 @@ def __exit__(
332332
exc_value: BaseException,
333333
traceback: TracebackType,
334334
) -> None:
335-
"""Exit the context manager, restoring the original function."""
335+
"""Exit the context manager, restoring the original code."""
336336
self.restore()
337337

338338

0 commit comments

Comments
 (0)