mirror of
https://github.com/lilydjwg/nvchecker.git
synced 2025-03-10 06:14:02 +00:00
fix: Python < 3.10 doesn't have kw_only for dataclass
This commit is contained in:
parent
bdd025d995
commit
d00203d103
1 changed files with 11 additions and 4 deletions
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import sys
|
||||||
import asyncio
|
import asyncio
|
||||||
from asyncio import Queue
|
from asyncio import Queue
|
||||||
from typing import (
|
from typing import (
|
||||||
|
@ -39,10 +40,16 @@ Entry.__doc__ = '''The configuration `dict` for an entry.'''
|
||||||
Entries = Dict[str, Entry]
|
Entries = Dict[str, Entry]
|
||||||
VersData = Dict[str, str]
|
VersData = Dict[str, str]
|
||||||
|
|
||||||
@dataclass(kw_only=True)
|
if sys.version_info[:2] >= (3, 10):
|
||||||
class RichResult:
|
@dataclass(kw_only=True)
|
||||||
version: str
|
class RichResult:
|
||||||
url: Optional[str] = None
|
version: str
|
||||||
|
url: Optional[str] = None
|
||||||
|
else:
|
||||||
|
@dataclass
|
||||||
|
class RichResult:
|
||||||
|
version: str
|
||||||
|
url: Optional[str] = None
|
||||||
|
|
||||||
VersionResult = Union[None, str, List[str], RichResult, Exception]
|
VersionResult = Union[None, str, List[str], RichResult, Exception]
|
||||||
VersionResult.__doc__ = '''The result of a `get_version` check.
|
VersionResult.__doc__ = '''The result of a `get_version` check.
|
||||||
|
|
Loading…
Add table
Reference in a new issue