build: Remove async_generator as a dependency
As Python <3.6 is no longer supported, this library is obsolete.
This commit is contained in:
parent
93f2d329a4
commit
5cd7cba3df
13
poetry.lock
generated
13
poetry.lock
generated
@ -25,17 +25,6 @@ files = [
|
||||
[package.extras]
|
||||
test = ["coverage", "mypy", "pexpect", "ruff", "wheel"]
|
||||
|
||||
[[package]]
|
||||
name = "async-generator"
|
||||
version = "1.10"
|
||||
description = "Async generators and context managers for Python 3.5+"
|
||||
optional = false
|
||||
python-versions = ">=3.5"
|
||||
files = [
|
||||
{file = "async_generator-1.10-py3-none-any.whl", hash = "sha256:01c7bf666359b4967d2cda0000cc2e4af16a0ae098cbffcb8472fb9e8ad6585b"},
|
||||
{file = "async_generator-1.10.tar.gz", hash = "sha256:6ebb3d106c12920aaae42ccb6f787ef5eefdcdd166ea3d628fa8476abe712144"},
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "babel"
|
||||
version = "2.13.1"
|
||||
@ -1260,4 +1249,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p
|
||||
[metadata]
|
||||
lock-version = "2.0"
|
||||
python-versions = "^3.12"
|
||||
content-hash = "4f9ec52a576209d59ea926bd2e332f5f06b4b2158c2ea348185704d21c63bd73"
|
||||
content-hash = "b578043d7c76e0f421f1e0557bbea78870cca9fb9f8713dd3b7299f08823546b"
|
||||
|
@ -9,7 +9,6 @@ packages = [{include = "secret_handshake"}]
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.12"
|
||||
async_generator = "^1.10"
|
||||
PyNaCl = "^1.5.0"
|
||||
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
|
@ -1,7 +1,6 @@
|
||||
import struct
|
||||
from asyncio import IncompleteReadError
|
||||
|
||||
from async_generator import async_generator, yield_
|
||||
from nacl.secret import SecretBox
|
||||
|
||||
from .util import inc_nonce, split_chunks
|
||||
@ -59,13 +58,16 @@ class UnboxStream(object):
|
||||
self.nonce = inc_nonce(inc_nonce(self.nonce))
|
||||
return body
|
||||
|
||||
@async_generator
|
||||
async def __aiter__(self):
|
||||
while True:
|
||||
data = await self.read()
|
||||
if data is None:
|
||||
return
|
||||
await yield_(data)
|
||||
def __aiter__(self):
|
||||
return self
|
||||
|
||||
async def __anext__(self):
|
||||
data = await self.read()
|
||||
|
||||
if data is None:
|
||||
raise StopAsyncIteration()
|
||||
|
||||
return data
|
||||
|
||||
|
||||
class BoxStream(object):
|
||||
|
@ -21,8 +21,6 @@
|
||||
|
||||
import asyncio
|
||||
|
||||
from async_generator import async_generator, yield_
|
||||
|
||||
from .boxstream import get_stream_pair
|
||||
from .crypto import SHSClientCrypto, SHSServerCrypto
|
||||
|
||||
@ -48,10 +46,16 @@ class SHSDuplexStream(object):
|
||||
self.read_stream.close()
|
||||
self.is_connected = False
|
||||
|
||||
@async_generator
|
||||
async def __aiter__(self):
|
||||
async for msg in self.read_stream:
|
||||
await yield_(msg)
|
||||
def __aiter__(self):
|
||||
return self
|
||||
|
||||
async def __anext__(self):
|
||||
msg = await self.read()
|
||||
|
||||
if msg is None:
|
||||
raise StopAsyncIteration()
|
||||
|
||||
return msg
|
||||
|
||||
|
||||
class SHSEndpoint(object):
|
||||
|
Loading…
Reference in New Issue
Block a user