mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 01:00:29 +08:00
basic python 3.9 support
This commit is contained in:
parent
9dbf7f1d0b
commit
2b064a3bee
@ -65,7 +65,7 @@ def create_short_task(coro: Coroutine) -> asyncio.Task:
|
|||||||
def get_short_tasks() -> List[asyncio.Task]:
|
def get_short_tasks() -> List[asyncio.Task]:
|
||||||
return [
|
return [
|
||||||
task
|
task
|
||||||
for task in asyncio.Task.all_tasks()
|
for task in asyncio.all_tasks()
|
||||||
if getattr(task, _ATTR_SHORT_TASK, False)
|
if getattr(task, _ATTR_SHORT_TASK, False)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@ -56,7 +56,7 @@ async def check_request_auth(auth_manager: AuthManager, exposed: HttpExposed, re
|
|||||||
|
|
||||||
token = request.cookies.get(_COOKIE_AUTH_TOKEN, "")
|
token = request.cookies.get(_COOKIE_AUTH_TOKEN, "")
|
||||||
if token:
|
if token:
|
||||||
user = auth_manager.check(valid_auth_token(token))
|
user = auth_manager.check(valid_auth_token(token)) # type: ignore
|
||||||
if not user:
|
if not user:
|
||||||
set_request_auth_info(request, "- (token)")
|
set_request_auth_info(request, "- (token)")
|
||||||
raise ForbiddenError()
|
raise ForbiddenError()
|
||||||
|
|||||||
@ -226,7 +226,7 @@ class KvmdServer(HttpServer): # pylint: disable=too-many-arguments,too-many-ins
|
|||||||
if name not in current_params:
|
if name not in current_params:
|
||||||
assert exc_cls is not None, name
|
assert exc_cls is not None, name
|
||||||
raise exc_cls()
|
raise exc_cls()
|
||||||
value = validator(value)
|
value = validator(value) # type: ignore
|
||||||
if current_params[name] != value:
|
if current_params[name] != value:
|
||||||
self.__new_streamer_params[name] = value
|
self.__new_streamer_params[name] = value
|
||||||
await self.__streamer_notifier.notify()
|
await self.__streamer_notifier.notify()
|
||||||
|
|||||||
@ -308,7 +308,7 @@ class Streamer: # pylint: disable=too-many-instance-attributes
|
|||||||
mtime=float(response.headers["X-Timestamp"]),
|
mtime=float(response.headers["X-Timestamp"]),
|
||||||
headers=tuple(
|
headers=tuple(
|
||||||
(key, value)
|
(key, value)
|
||||||
for (key, value) in tools.sorted_kvs(response.headers)
|
for (key, value) in tools.sorted_kvs(dict(response.headers))
|
||||||
if key.lower().startswith("x-ustreamer-") or key.lower() in [
|
if key.lower().startswith("x-ustreamer-") or key.lower() in [
|
||||||
"x-timestamp",
|
"x-timestamp",
|
||||||
"access-control-allow-origin",
|
"access-control-allow-origin",
|
||||||
|
|||||||
@ -435,7 +435,7 @@ class VncServer: # pylint: disable=too-many-instance-attributes
|
|||||||
server.close()
|
server.close()
|
||||||
loop.run_until_complete(server.wait_closed())
|
loop.run_until_complete(server.wait_closed())
|
||||||
finally:
|
finally:
|
||||||
tasks = asyncio.Task.all_tasks()
|
tasks = asyncio.all_tasks(loop)
|
||||||
for task in tasks:
|
for task in tasks:
|
||||||
task.cancel()
|
task.cancel()
|
||||||
loop.run_until_complete(asyncio.gather(*tasks, return_exceptions=True))
|
loop.run_until_complete(asyncio.gather(*tasks, return_exceptions=True))
|
||||||
|
|||||||
1
setup.py
1
setup.py
@ -141,6 +141,7 @@ def main() -> None:
|
|||||||
"Development Status :: 4 - Beta",
|
"Development Status :: 4 - Beta",
|
||||||
"Programming Language :: Python :: 3.7",
|
"Programming Language :: Python :: 3.7",
|
||||||
"Programming Language :: Python :: 3.8",
|
"Programming Language :: Python :: 3.8",
|
||||||
|
"Programming Language :: Python :: 3.9",
|
||||||
"Topic :: System :: Systems Administration",
|
"Topic :: System :: Systems Administration",
|
||||||
"Operating System :: POSIX :: Linux",
|
"Operating System :: POSIX :: Linux",
|
||||||
"Intended Audience :: System Administrators",
|
"Intended Audience :: System Administrators",
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
[mypy]
|
[mypy]
|
||||||
python_version = 3.8
|
python_version = 3.9
|
||||||
ignore_missing_imports = true
|
ignore_missing_imports = true
|
||||||
disallow_untyped_defs = true
|
disallow_untyped_defs = true
|
||||||
strict_optional = true
|
strict_optional = true
|
||||||
|
|||||||
@ -34,6 +34,8 @@ disable =
|
|||||||
len-as-condition,
|
len-as-condition,
|
||||||
raise-missing-from,
|
raise-missing-from,
|
||||||
consider-using-in,
|
consider-using-in,
|
||||||
|
unsubscriptable-object,
|
||||||
|
# https://github.com/PyCQA/pylint/issues/3882
|
||||||
|
|
||||||
[CLASSES]
|
[CLASSES]
|
||||||
exclude-protected =
|
exclude-protected =
|
||||||
|
|||||||
@ -3,7 +3,7 @@ envlist = flake8, pylint, mypy, vulture, pytest, eslint, htmlhint
|
|||||||
skipsdist = true
|
skipsdist = true
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
basepython = python3.8
|
basepython = python3.9
|
||||||
sitepackages = true
|
sitepackages = true
|
||||||
changedir = /src
|
changedir = /src
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user