From dc793e5d8d2c2ea2d48a51f6b04c1518dd44c200 Mon Sep 17 00:00:00 2001
From: Kyomotoi <1172294279@qq.com>
Date: Sun, 31 May 2020 13:01:26 +0800
Subject: =?UTF-8?q?=E5=88=A0=E9=99=A4=E9=83=A8=E5=88=86=E5=A4=B1=E8=B4=A5?=
 =?UTF-8?q?=E4=BD=9C=E5=93=81=EF=BC=8C=E6=96=B0=E5=A2=9E=E7=96=AB=E6=83=85?=
 =?UTF-8?q?=E6=9F=A5=E8=AF=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 AyaBot/plugins/bilibilitest/aio/__init__.py        |   8 ---
 .../aio/__pycache__/__init__.cpython-37.pyc        | Bin 445 -> 0 bytes
 AyaBot/plugins/bilibilitest/aio/requests.py        |  71 ---------------------
 3 files changed, 79 deletions(-)
 delete mode 100644 AyaBot/plugins/bilibilitest/aio/__init__.py
 delete mode 100644 AyaBot/plugins/bilibilitest/aio/__pycache__/__init__.cpython-37.pyc
 delete mode 100644 AyaBot/plugins/bilibilitest/aio/requests.py

(limited to 'AyaBot/plugins/bilibilitest/aio')

diff --git a/AyaBot/plugins/bilibilitest/aio/__init__.py b/AyaBot/plugins/bilibilitest/aio/__init__.py
deleted file mode 100644
index 3cc81f0..0000000
--- a/AyaBot/plugins/bilibilitest/aio/__init__.py
+++ /dev/null
@@ -1,8 +0,0 @@
-import asyncio
-from functools import partial
-from typing import Any
-
-
-async def run_sync_func(func, *args, **kwargs) -> Any:
-    return await asyncio.get_event_loop().run_in_executor(
-        None, partial(func, *args, **kwargs))
diff --git a/AyaBot/plugins/bilibilitest/aio/__pycache__/__init__.cpython-37.pyc b/AyaBot/plugins/bilibilitest/aio/__pycache__/__init__.cpython-37.pyc
deleted file mode 100644
index b379548..0000000
Binary files a/AyaBot/plugins/bilibilitest/aio/__pycache__/__init__.cpython-37.pyc and /dev/null differ
diff --git a/AyaBot/plugins/bilibilitest/aio/requests.py b/AyaBot/plugins/bilibilitest/aio/requests.py
deleted file mode 100644
index 4f7b9d3..0000000
--- a/AyaBot/plugins/bilibilitest/aio/requests.py
+++ /dev/null
@@ -1,71 +0,0 @@
-from typing import Optional, Any
-
-import requests
-from requests import *
-
-from . import run_sync_func
-
-
-class AsyncResponse:
-    def __init__(self, response: requests.Response):
-        self.raw_response = response
-
-    @property
-    def ok(self) -> bool:
-        return self.raw_response.ok
-
-    def __repr__(self):
-        return '<AsyncResponse [%s]>' % self.raw_response.status_code
-
-    def __bool__(self):
-        return self.ok
-
-    @property
-    async def content(self) -> Optional[bytes]:
-        return await run_sync_func(lambda: self.raw_response.content)
-
-    @property
-    async def text(self) -> str:
-        return await run_sync_func(lambda: self.raw_response.text)
-
-    async def json(self, **kwargs) -> Any:
-        return await run_sync_func(self.raw_response.json, **kwargs)
-
-
-async def request(method, url, **kwargs) -> AsyncResponse:
-    return AsyncResponse(await run_sync_func(requests.request,
-                                             method=method, url=url, **kwargs))
-
-
-async def get(url, params=None, **kwargs) -> AsyncResponse:
-    return AsyncResponse(
-        await run_sync_func(requests.get, url=url, params=params, **kwargs))
-
-
-async def options(url, **kwargs) -> AsyncResponse:
-    return AsyncResponse(
-        await run_sync_func(requests.options, url=url, **kwargs))
-
-
-async def head(url, **kwargs) -> AsyncResponse:
-    return AsyncResponse(await run_sync_func(requests.head, url=url, **kwargs))
-
-
-async def post(url, data=None, json=None, **kwargs) -> AsyncResponse:
-    return AsyncResponse(await run_sync_func(requests.post, url=url,
-                                             data=data, json=json, **kwargs))
-
-
-async def put(url, data=None, **kwargs) -> AsyncResponse:
-    return AsyncResponse(
-        await run_sync_func(requests.put, url=url, data=data, **kwargs))
-
-
-async def patch(url, data=None, **kwargs) -> AsyncResponse:
-    return AsyncResponse(
-        await run_sync_func(requests.patch, url=url, data=data, **kwargs))
-
-
-async def delete(url, **kwargs) -> AsyncResponse:
-    return AsyncResponse(
-        await run_sync_func(requests.delete, url=url, **kwargs))
-- 
cgit v1.2.3