Skip to content

Commit d567807

Browse files
committed
Fix stub with additional methods and locks
1 parent 0035a5e commit d567807

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

src/ducktools/classbuilder/methods.pyi

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
__lazy_modules__: list[str]
2424

25-
import threading
25+
import _thread
2626
import types
2727
import typing
2828

@@ -111,7 +111,7 @@ class _AttachedMethod:
111111
cls: type
112112

113113
_generated_method: types.FunctionType
114-
_lock: threading.Lock
114+
_lock: _thread.LockType
115115

116116
def __init__(
117117
self,
@@ -163,10 +163,19 @@ def get_init_parameters(cls: type) -> _FunctionParameterType: ...
163163
def get_counter_field_names(argcount: int) -> list[str]: ...
164164

165165
class _CacheStats:
166-
__slots__: tuple[str, str, str]
166+
__slots__: tuple[str, ...]
167167
hits: int
168168
misses: int
169169
skips: int
170+
171+
_hitlock: _thread.LockType
172+
_misslock: _thread.LockType
173+
_skiplock: _thread.LockType
174+
175+
def add_hit(self) -> None: ...
176+
def add_miss(self) -> None: ...
177+
def add_skip(self) -> None: ...
178+
170179
@property
171180
def hit_percent(self) -> float: ...
172181
def __init__(self) -> None: ...
@@ -177,7 +186,7 @@ class _SimpleCache:
177186
_func: Callable[..., types.FunctionType]
178187
_internal_cache: dict[tuple, types.FunctionType]
179188
_stats: _CacheStats
180-
_lock_cache: dict[tuple, threading.Lock]
189+
_lock_cache: dict[tuple, _thread.LockType]
181190
def __init__(
182191
self,
183192
func: types.FunctionType,

0 commit comments

Comments
 (0)