Skip to content

Commit

Permalink
3.2.3 - Typing updates
Browse files Browse the repository at this point in the history
  • Loading branch information
vkottler committed Apr 13, 2024
1 parent d478b74 commit 8afd501
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
- run: |
mk python-release owner=vkottler \
repo=vcorelib version=3.2.2
repo=vcorelib version=3.2.3
if: |
matrix.python-version == '3.11'
&& matrix.system == 'ubuntu-latest'
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
=====================================
generator=datazen
version=3.1.4
hash=a2a4ea5abcd1abefc7a1528728ba2500
hash=f8b97332b3af92a47a234fed499d57a3
=====================================
-->

# vcorelib ([3.2.2](https://pypi.org/project/vcorelib/))
# vcorelib ([3.2.3](https://pypi.org/project/vcorelib/))

[![python](https://img.shields.io/pypi/pyversions/vcorelib.svg)](https://pypi.org/project/vcorelib/)
![Build Status](https://github.com/vkottler/vcorelib/workflows/Python%20Package/badge.svg)
Expand Down
2 changes: 1 addition & 1 deletion local/variables/package.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
major: 3
minor: 2
patch: 2
patch: 3
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta:__legacy__"

[project]
name = "vcorelib"
version = "3.2.2"
version = "3.2.3"
description = "A collection of core Python utilities."
readme = "README.md"
requires-python = ">=3.11"
Expand Down
4 changes: 2 additions & 2 deletions vcorelib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# =====================================
# generator=datazen
# version=3.1.4
# hash=a57b01f6e0ce3490014765c9a7325320
# hash=fc6cd8303d817a213ff66471838bb02b
# =====================================

"""
Expand All @@ -10,7 +10,7 @@

DESCRIPTION = "A collection of core Python utilities."
PKG_NAME = "vcorelib"
VERSION = "3.2.2"
VERSION = "3.2.3"

# vcorelib-specific content.
DEFAULT_INDENT = 2
Expand Down
16 changes: 12 additions & 4 deletions vcorelib/asyncio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ def log_exceptions(
return [x for x in tasks if not x.done()]


def new_eloop(set_current: bool = True) -> _asyncio.AbstractEventLoop:
"""Get a new event loop."""

eloop = _asyncio.new_event_loop()
if set_current:
_asyncio.set_event_loop(eloop)
return eloop


def normalize_eloop(
eloop: _asyncio.AbstractEventLoop = None,
) -> _asyncio.AbstractEventLoop:
Expand All @@ -67,8 +76,7 @@ def normalize_eloop(
try:
eloop = _asyncio.get_running_loop()
except RuntimeError:
eloop = _asyncio.new_event_loop()
_asyncio.set_event_loop(eloop)
eloop = new_eloop()
return eloop


Expand All @@ -93,10 +101,10 @@ def shutdown_loop(


def run_handle_interrupt(
to_run: _Awaitable[_Any],
to_run: _Awaitable[T],
eloop: _asyncio.AbstractEventLoop = None,
enable_uvloop: bool = True,
) -> _Optional[_Any]:
) -> _Optional[T]:
"""
Run a task in an event loop and gracefully handle keyboard interrupts.
Expand Down

0 comments on commit 8afd501

Please sign in to comment.