46 lines
1.3 KiB
Python
46 lines
1.3 KiB
Python
|
# -------------------------------
|
||
|
# Difficult Rocket
|
||
|
# Copyright © 2021-2022 by shenjackyuanjie 3695888@qq.com
|
||
|
# All rights reserved
|
||
|
# -------------------------------
|
||
|
import threading
|
||
|
|
||
|
from types import FrameType
|
||
|
from typing import Union, List, Optional, Iterable
|
||
|
|
||
|
class ThreadLock:
|
||
|
# with ThreadLock
|
||
|
def __init__(self, the_lock: threading.Lock, time_out: Union[float, int] = 1 / 60) -> None: ...
|
||
|
def __enter__(self) -> "ThreadLock": ...
|
||
|
def __exit__(self, exc_type, exc_val, exc_tb) -> None: ...
|
||
|
|
||
|
class ListCache:
|
||
|
"""一个线程安全的列表缓存"""
|
||
|
def __init__(self, lock: ThreadLock) -> None: ...
|
||
|
def __call__(self, *args, **kwargs) -> List[str]: ...
|
||
|
# ListCache()
|
||
|
def __iter__(self) -> "ListCache": ...
|
||
|
def __next__(self) -> str: ...
|
||
|
# support for x in ListCache
|
||
|
def __bool__(self) -> bool: ...
|
||
|
# True if have cache
|
||
|
def __getitem__(self, item: int) -> str: ...
|
||
|
# ListCache[int]
|
||
|
def append(self, value: Union[str, Iterable[str]]): ...
|
||
|
# ListCache.append('abc' | ['abc'])
|
||
|
@property
|
||
|
def cache(self) -> List[str]: ...
|
||
|
# ListCache.cache
|
||
|
def clear(self) -> None: ...
|
||
|
# ListCache.clear()
|
||
|
|
||
|
|
||
|
class LogFileCache:
|
||
|
...
|
||
|
|
||
|
|
||
|
class Logger:
|
||
|
...
|
||
|
|
||
|
def test_logger(the_logger: Logger) -> None:
|
||
|
...
|