Closed ZhaoTzuHsien closed 1 month ago
why is the output component/block.baseblock the class name? Follow up, where did you wrap users' handle() method
why is the output component/block.baseblock the class name? Follow up, where did you wrap users' handle() method
@ChuWeiChang I cannot understand your first question. Please clarify it.
The user-defined handle() function has been illustrated at the test block, which is located at tests/guest.py
.
I was saying, isn't execute function supposed to run user's "handle" function? You may change the function name in guest.py from "handle" to any other name and the program still compiles, which is a bit odd. I expect there some codes like user_handle_funtion = getattr(cls, "handle") return user_handle_function(payload)
That is the code you need to write, which stated at #5. I just provided a method called _find_block_class() to let you get the __class__
object of the user-defined Block
class. https://github.com/kalgory-com/kalgory-py/blob/059648b28e42b125aa6322c3a9747ee2b5bf0e3f/kalgory/component/block.py#L10-L20
OK i see. I will take on the task from now
Before you start implementing #5, accept the review if you don't find any other problems.
In this pull request, user can define
Block
class with arbitraryhandle()
logic and parameters, as well as enforcing static WIT definition at the same time. Besides, pytest, ruff, code climate, and related GitHub Actions workflow has been integrated to improve code quality. After the parsing logic inBaseBlock.execute()
has been implemented, we can release the first version of this library.