Skip to content

Commit

Permalink
fix: update async iterator to parse incoming message (#171)
Browse files Browse the repository at this point in the history
Co-authored-by: fern-api <115122769+fern-api[bot]@users.noreply.github.com>
Co-authored-by: Norman Bukingolts <[email protected]>
  • Loading branch information
3 people authored Sep 11, 2024
1 parent fb423bc commit a81f2c0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
22 changes: 10 additions & 12 deletions .github/workflows/legacy_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
- "3.11"

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Python ${{ matrix.python-version }} Setup
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -38,7 +38,6 @@ jobs:
shell: bash
run: |
pip install poetry
if [ -d /poetryenvs ]; then rm -rf ~/poetryenvs; fi
poetry config virtualenvs.path ~/poetryenvs
poetry install
Expand Down Expand Up @@ -66,13 +65,13 @@ jobs:
poetry run pydocstyle hume
- name: Upload HTML Coverage
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: hume-unit-coverage-html
path: hume/htmlcov

- name: Upload XML Coverage
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: hume-unit-coverage-xml
path: hume/coverage.xml
Expand All @@ -88,10 +87,10 @@ jobs:
- "3.10"

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Python ${{ matrix.python-version }} Setup
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -105,7 +104,6 @@ jobs:
shell: bash
run: |
pip install poetry
if [ -d /poetryenvs ]; then rm -rf ~/poetryenvs; fi
poetry config virtualenvs.path ~/poetryenvs
poetry install
Expand All @@ -119,13 +117,13 @@ jobs:
poetry run pytest tests/custom/_legacy -m service
- name: Upload HTML Coverage
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: hume-service-coverage-html
path: hume/htmlcov

- name: Upload XML Coverage
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: hume-service-coverage-xml
path: hume/coverage.xml
Expand All @@ -139,10 +137,10 @@ jobs:
- "3.10"

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Python ${{ matrix.python-version }} Setup
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

Expand Down
2 changes: 1 addition & 1 deletion src/hume/empathic_voice/chat/socket_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def __init__(

async def __aiter__(self):
async for message in self.websocket:
yield message
yield parse_obj_as(SubscribeEvent, json.loads(message)) # type: ignore

async def _send(self, data: typing.Any) -> None:
if isinstance(data, dict):
Expand Down
2 changes: 1 addition & 1 deletion src/hume/expression_measurement/stream/socket_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def __init__(

async def __aiter__(self):
async for message in self.websocket:
yield message
yield parse_obj_as(SubscribeEvent, json.loads(message)) # type: ignore

# TODO: we can likely coerce the right response model within the union here, if we're
# assuming request-response pattern and 1:1 mapping between request and response types
Expand Down

0 comments on commit a81f2c0

Please sign in to comment.