Skip to content

Commit a80c1e7

Browse files
authored
Turn coroutine to async def (#136)
* Turn coroutine to async def * Update changelog
1 parent 7bcd69d commit a80c1e7

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,15 @@ and this project adheres to [Semantic Versioning][semver].
2020
- Fix `__init__()` constructors in several interface types ([#125])
2121
- Fix valueSet type in `SymbolKindAbstract` ([#125])
2222

23+
### Fixed
24+
25+
- `coroutine` deprecation warning - use async def instead ([#136])
26+
2327
[#125]: https://github.com/openlawlibrary/pygls/pull/125
2428
[#123]: https://github.com/openlawlibrary/pygls/pull/123
2529
[#120]: https://github.com/openlawlibrary/pygls/pull/120
2630
[#117]: https://github.com/openlawlibrary/pygls/pull/117
31+
[#136]: https://github.com/openlawlibrary/pygls/pull/136
2732

2833
## [0.9.0] - 04/20/2020
2934

‎pygls/feature_manager.py‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,14 @@ def wrap_with_server(f, server):
5959
return f
6060

6161
if asyncio.iscoroutinefunction(f):
62-
return asyncio.coroutine(functools.partial(f, server))
62+
async def wrapped(*args, **kwargs):
63+
return await f(server, *args, **kwargs)
6364
else:
6465
wrapped = functools.partial(f, server)
6566
if is_thread_function(f):
6667
assign_thread_attr(wrapped)
67-
return wrapped
68+
69+
return wrapped
6870

6971

7072
class FeatureManager:

0 commit comments

Comments
 (0)