Skip to content

Commit f6a52dd

Browse files
committed
docs(frozen_dataclass): Improve method injection comments for clarity
1 parent ca47385 commit f6a52dd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/libtmux/_internal/frozen_dataclass.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ def __delattr__(self: t.Any, name: str) -> None:
7575
# Allow the deletion
7676
object.__delattr__(self, name)
7777

78-
# F. Inject into the class using setattr to avoid explicit mypy type ignores
79-
setattr(cls, "__init__", __init__)
80-
setattr(cls, "__setattr__", __setattr__)
81-
setattr(cls, "__delattr__", __delattr__)
78+
# F. Inject methods into the class (using setattr to satisfy mypy)
79+
setattr(cls, "__init__", __init__) # Sets _frozen flag post-initialization
80+
setattr(cls, "__setattr__", __setattr__) # Blocks attribute modification post-init
81+
setattr(cls, "__delattr__", __delattr__) # Blocks attribute deletion post-init
8282

8383
return cls

0 commit comments

Comments
 (0)