Skip to content

Commit

Permalink
Turn coroutine to async def (#136)
Browse files Browse the repository at this point in the history
* Turn coroutine to async def

* Update changelog
  • Loading branch information
danixeee authored Sep 29, 2020
1 parent 7bcd69d commit a80c1e7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,15 @@ and this project adheres to [Semantic Versioning][semver].
- Fix `__init__()` constructors in several interface types ([#125])
- Fix valueSet type in `SymbolKindAbstract` ([#125])

### Fixed

- `coroutine` deprecation warning - use async def instead ([#136])

[#125]: https://github.com/openlawlibrary/pygls/pull/125
[#123]: https://github.com/openlawlibrary/pygls/pull/123
[#120]: https://github.com/openlawlibrary/pygls/pull/120
[#117]: https://github.com/openlawlibrary/pygls/pull/117
[#136]: https://github.com/openlawlibrary/pygls/pull/136

## [0.9.0] - 04/20/2020

Expand Down
6 changes: 4 additions & 2 deletions pygls/feature_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,14 @@ def wrap_with_server(f, server):
return f

if asyncio.iscoroutinefunction(f):
return asyncio.coroutine(functools.partial(f, server))
async def wrapped(*args, **kwargs):
return await f(server, *args, **kwargs)
else:
wrapped = functools.partial(f, server)
if is_thread_function(f):
assign_thread_attr(wrapped)
return wrapped

return wrapped


class FeatureManager:
Expand Down

0 comments on commit a80c1e7

Please sign in to comment.