Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for async functions? #94

Closed
Rahuum opened this issue Mar 5, 2021 · 6 comments
Closed

Add support for async functions? #94

Rahuum opened this issue Mar 5, 2021 · 6 comments

Comments

@Rahuum
Copy link

Rahuum commented Mar 5, 2021

Hey there!

Noticed that pyment doesn't seem to recognize async functions as functions- it doesn't generate anything for them at all.

Figured I should toss it up on the issue tracker.

@dadadel
Copy link
Owner

dadadel commented Mar 5, 2021

Hi @Rahuum
Can you provide an example of function that doesn't work ?
The current version of Pyment supports async functions. See issue #88.

For instance:

async def func(param):
    pass

Will produce:

--- a/test.py
+++ b/test.py
@@ -1,3 +1,8 @@
 async def func(param):
+    """
+
+    :param param: 
+
+    """
     pass

@Rahuum
Copy link
Author

Rahuum commented Mar 7, 2021

Sure.

(env) [Rahuum@#####-main:src]$ cat test.py                      (03-06 22:51)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import asyncio
import opcodes

async def ping_runner(self):
    await self.send(*opcodes.CMSG_PING(self))
    await asyncio.sleep(30)

(env) [Rahuum@#####-main:src]$ pyment test.py                   (03-06 22:51)
(env) [Rahuum@#####-main:src]$ cat test.py.patch                (03-06 22:51)
# Patch generated by Pyment v0.3.3

(env) [Rahuum@#####-main:src]$                                  (03-06 22:51)

Pulled an example out into a minimal test file, but pretty much every async function (all of them? haven't checked, there's thousands) gets missed.

@dadadel
Copy link
Owner

dadadel commented Mar 7, 2021

@Rahuum I think you didn't use the last version of Pyment. After a git pull and activating a virtualenv, please run python setup.py install before using Pyment.

Using your example produces:

--- a/issue94.py
+++ b/issue94.py
@@ -4,5 +4,6 @@
 import opcodes

 async def ping_runner(self):
+    """ """
     await self.send(*opcodes.CMSG_PING(self))
     await asyncio.sleep(30)

@Rahuum
Copy link
Author

Rahuum commented Mar 7, 2021

Has this been pushed to pip? As you can see from the generated patch, I'm on v0.3.3, which seems to be the latest release.

@dadadel
Copy link
Owner

dadadel commented Mar 7, 2021

No, I didn't! My bad, actually, I re-released a v0.3.3 on github not on pip but it was a mistake as it is a different version! I think I will reversion it to v0.3.4.
However, I am currently working on a v0.4.0 that will manage also the type hints. It will be this one that I will release on pip.
I hope soon! Work is in progress.

@dadadel
Copy link
Owner

dadadel commented Mar 8, 2021

@Rahuum
I close this issue as it is fixed in current master version.
You can track for next Pypi release.

@dadadel dadadel closed this as completed Mar 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants