Skip to content

Commit 668227a

Browse files
committed
chore: 优化 type check
1 parent 301eec7 commit 668227a

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ body:
66
- type: markdown
77
attributes:
88
value: |
9-
你是一位 python-openbmclapi 的长期使用者。在一个阳光明媚的早晨 ☀️,你打开了 OpenBMCLAPI 仪表盘,你发现你的一个正在使用 python-openbmclapi 的节点的信用值掉到了 -1800,一怒之下,你打开 GitHub 来到了本仓库,来提交这个问候 python-openbmclapi 的那些开发者全家人的友好 Issue。
9+
你是一位 python-openbmclapi 的长期使用者。在一个阳光明媚的早晨 ☀️,你打开了 OpenBMCLAPI 仪表盘,你发现你的一个正在使用 python-openbmclapi 的节点的信用值掉到了 -23746,一怒之下,你打开 GitHub 来到了本仓库,来提交这个问候 python-openbmclapi 的那些开发者全家人的友好 Issue。
1010
- type: checkboxes
1111
attributes:
1212
label: 在开始之前……
@@ -20,7 +20,7 @@ body:
2020
attributes:
2121
label: 问题描述
2222
description: 对遇到的漏洞进行清晰的描述。
23-
placeholder: 我的 trust 被你们干到了 -1800
23+
placeholder: 我的 trust 被你们干到了 -23746
2424
validations:
2525
required: true
2626
- type: textarea

core/utils.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@
44
import math
55
from pathlib import Path
66
import time
7-
from typing import Any, Awaitable, Callable, Optional, Coroutine, MutableMapping, TypeVar
7+
from typing import (
8+
Any,
9+
Awaitable,
10+
Callable,
11+
Optional,
12+
Coroutine,
13+
TypeVar,
14+
TYPE_CHECKING
15+
)
816

917
import anyio
1018
import anyio.abc
@@ -17,8 +25,10 @@
1725
from .abc import CertificateType
1826
from .config import cfg
1927

20-
K = TypeVar("K")
21-
V = TypeVar("V")
28+
if TYPE_CHECKING:
29+
K = TypeVar("K")
30+
V = TypeVar("V")
31+
T = TypeVar("T")
2232

2333
class Runtime:
2434
def __init__(
@@ -160,8 +170,6 @@ async def get_item(self):
160170

161171
def __len__(self):
162172
return len(self._items)
163-
164-
165173

166174
class Lock:
167175
def __init__(

0 commit comments

Comments
 (0)