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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

not implemented ast ast_generatorexp #564

Open
jkaberg opened this issue Jan 5, 2024 · 1 comment
Open

not implemented ast ast_generatorexp #564

jkaberg opened this issue Jan 5, 2024 · 1 comment

Comments

@jkaberg
Copy link

jkaberg commented Jan 5, 2024

I'm guessing someone hasn't come around to it, just parking this here for myself or if someone else has the time 馃槃

majo-hast-1  | 2024-01-05 15:23:09.477 ERROR (MainThread) [custom_components.pyscript.scripts.energy_price.fetch_prices] Exception in <scripts.energy_price.fetch_prices> line 49:
majo-hast-1  |             hour['is_avarage'] = not any(value for key, value in hour.items() if key.endswith(('lowest', 'highest')))
majo-hast-1  |                                         ^
majo-hast-1  | NotImplementedError: scripts.energy_price.fetch_prices: not implemented ast ast_generatorexp
@craigbarratt
Copy link
Member

Since pyscript is implemented as an interpreter, generator expressions and yield are quite hard to implement. It's mentioned in the Language Limitations section of the docs.

A workaround is to put the generator or yield code in a function with a @pyscript_compile decorator. That will use native Python.

That said, any implementations would be most welcome!

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