fix 一些小东西

This commit is contained in:
shenjack-5600u 2024-07-26 11:41:54 +08:00
parent 6a0c7cf11d
commit 649cd4cd9c
Signed by: shenjack
GPG Key ID: FDF9864E11C7E79F
3 changed files with 21 additions and 17 deletions

View File

@ -4,7 +4,9 @@
# All rights reserved
# -------------------------------
from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING
from Difficult_Rocket.api.types import Options, Version
@ -13,6 +15,21 @@ build_version = Version("3.0.0.0") # 编译文件版本(与游戏本体无关)
api_version = Version("0.1.2.2") # API 版本
__version__ = sdk_version
if TYPE_CHECKING:
from Difficult_Rocket import (
api,
data,
client,
command,
crash,
exception,
server,
mod,
utils,
main,
runtime
)
__all__ = [
# __init__
"DR_status",

View File

@ -83,7 +83,7 @@ class MinecraftWikiButtonTheme(BaseButtonTheme):
height: int,
batch: Batch,
group: Group,
theme: dict = None,
theme: Optional[dict] = None,
):
super().__init__(x, y, width, height, batch, group)
self.batch = batch

View File

@ -1,16 +1,3 @@
# -------------------------------
# Difficult Rocket
# Copyright © 2020-2023 by shenjackyuanjie 3695888@qq.com
# All rights reserved
# -------------------------------
"""
writen by shenjackyuanjie
mail: 3695888@qq.com
github: @shenjackyuanjie
gitee: @shenjackyuanjie
"""
import functools
import inspect
import threading
@ -76,7 +63,7 @@ class FunctionThread(threading.Thread):
target=target, args=args, kwargs=kwargs, name=name, daemon=daemon
)
self.__return_value = self.__NONE
self.__error = None
self.__error: Optional[Exception] = None
def wrapped_target(*args_, **kwargs_):
try:
@ -123,7 +110,7 @@ def new_thread(
arg: Optional[Union[str, Callable]] = None,
daemon: bool = False,
log_thread: bool = True,
):
) -> Callable:
"""
This is a one line solution to make your function executes in parallels.
When decorated with this decorator, functions will be executed in a new daemon thread
@ -178,7 +165,7 @@ def new_thread(
# bring the signature of the func to the wrap function
# so inspect.getfullargspec(func) works correctly
copy_signature(wrap, func)
wrap.original = func # access this field to get the original function
wrap.original = func # access this field to get the original function # pyright: ignore reportAttributeAccessIssue
return wrap
# Directly use @new_thread without ending brackets case, e.g. @new_thread