Skip to content

Commit

Permalink
Cleanups
Browse files Browse the repository at this point in the history
langhelper is not actually needed :)

Closes: #1
Pull-request: #1
Pull-request-sha: aabfb58

Change-Id: I189241623ca7ecc98fe9a4ff6ab41df0ac5f92d3
  • Loading branch information
CaselIT authored and sqla-tester committed Jun 15, 2024
1 parent c68c169 commit a1cec1b
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 298 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/run_tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Run tests

on: [push, pull_request]

permissions:
contents: read

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- "ubuntu-latest"
- "windows-latest"
- "macos-latest"
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "pypy-3.10"
env:
- py

include:
- os: "ubuntu-latest"
python-version: "3.12"
env: sqla14
- os: "ubuntu-latest"
python-version: "3.12"
env: sqla20
- os: "ubuntu-latest"
python-version: "3.12"
env: sqla21
- os: "ubuntu-latest"
python-version: "3.12"
env: pep484
- os: "ubuntu-latest"
python-version: "3.12"
env: pep8

fail-fast: false

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Set up python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install tox
run: pip install tox

- name: Run tests
run: tox -e ${{ matrix.env }}
10 changes: 5 additions & 5 deletions awaitlet/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ def _safe_cancel_awaitable(awaitable: Awaitable[Any]) -> None:
def awaitlet(awaitable: Awaitable[_T]) -> _T:
"""Awaits an async function in a sync method.
The sync method must be inside a :func:`greenlet_spawn` context.
:func:`await_` calls cannot be nested.
The sync method must be inside a :func:`async_def` context.
:func:`awaitlet` calls cannot be nested.
:param awaitable: The coroutine to call.
Expand Down Expand Up @@ -95,7 +95,7 @@ async def async_def(
) -> _T:
"""Runs a sync function ``fn`` in a new greenlet.
The sync function can then use :func:`await_` to wait for async
The sync function can then use :func:`awaitlet` to wait for async
functions.
:param fn: The sync callable to call.
Expand All @@ -106,15 +106,15 @@ async def async_def(
result: Any
context = _AsyncIoGreenlet(fn, greenlet.getcurrent())
# runs the function synchronously in gl greenlet. If the execution
# is interrupted by await_, context is not dead and result is a
# is interrupted by awaitlet, context is not dead and result is a
# coroutine to wait. If the context is dead the function has
# returned, and its result can be returned.
switch_occurred = False
result = context.switch(*args, **kwargs)
while not context.dead:
switch_occurred = True
try:
# wait for a coroutine from await_ and then return its
# wait for a coroutine from awaitlet and then return its
# result back to it.
value = await result
except BaseException:
Expand Down
279 changes: 0 additions & 279 deletions awaitlet/util/langhelpers.py

This file was deleted.

Loading

0 comments on commit a1cec1b

Please sign in to comment.