-
Notifications
You must be signed in to change notification settings - Fork 514
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
Solution #495
base: master
Are you sure you want to change the base?
Solution #495
Conversation
Le0n-K
commented
Jan 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your hard work on this Pull Request! 😊 While your code is well-structured and mostly meets the task requirements, there are a couple of critical issues that need to be addressed before we can approve it:
-
run_program
Method Input: Therun_program
method inIOTService
is currently being passed the result ofrun_parallel(wake_up, sleep)
, which is not a list ofMessage
objects as expected. Please ensure that the method receives the correct type of input by restructuring the code to pass a list ofMessage
objects. -
Awaiting Messages: The
run_program
method attempts toawait
a list ofMessage
objects, which is not valid. You should iterate over theprogram
list and await each message's processing individually. Consider using a loop to handle each message asynchronously.
Once these issues are resolved, your code should be ready for approval. Keep up the great work, and don't hesitate to reach out if you need further assistance! 🚀
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
🔄 Fix the issues, commit the changes, and then re-request my review using the Re-request review
button in the Reviewers tab.
async def run_program(self, program: list[Message]) -> None: | ||
print("=====RUNNING PROGRAM======") | ||
for msg in program: | ||
self.send_msg(msg) | ||
await program |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The run_program
method attempts to await
a list of Message
objects, which is not valid. You need to iterate over the program
list and await each message's processing individually. Consider using a loop to handle each message asynchronously.
|
||
# run the programs | ||
service.run_program(wake_up_program) | ||
service.run_program(sleep_program) | ||
await service.run_program(run_parallel(wake_up, sleep)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The run_program
method in IOTService
expects a list of Message
objects, but here it is being passed the result of run_parallel(wake_up, sleep)
, which is not a list of Message
objects. You need to ensure that the run_program
method receives the correct type of input. Consider restructuring the code to pass a list of Message
objects instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, the pull request review was unsuccessful for the following reasons:
Warning
No changes were made in the pull request since the last review. Please make sure that you have added files to the pull request and committed the changes.
[CODE: 7]
If the issue is within your control, please address it.
The next review attempt will automatically launch in 1 hour.
If you believe this is an error or need assistance, please contact the support team.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your submission! 🎉 Your code demonstrates a solid understanding of asynchronous programming patterns in Python, particularly in the context of IoT device management. However, there are a couple of critical issues that need to be addressed to ensure the functionality aligns with the task requirements:
-
run_program
Method Input: Therun_program
method in theIOTService
class is currently being passed the result ofrun_parallel(wake_up, sleep)
, which is not a list ofMessage
objects as expected. Please restructure your code to ensure that the method receives the correct type of input. -
Awaiting Messages: The
run_program
method attempts toawait
a list ofMessage
objects directly, which is not valid. You should iterate over theprogram
list and await each message's processing individually. Consider using a loop to handle each message asynchronously.
These issues are crucial for the correct operation of your code, and addressing them will greatly enhance its robustness. Despite these points, your implementation is well-structured and shows promise. Keep up the good work, and make sure to incorporate the feedback to improve your code. This decision is made to help you move forward with your learning journey. 🚀
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
async def run_program(self, program: list[Message]) -> None: | ||
print("=====RUNNING PROGRAM======") | ||
for msg in program: | ||
self.send_msg(msg) | ||
await program |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The run_program
method attempts to await
a list of Message
objects, which is not valid. You should iterate over the program
list and await each message's processing individually. Consider using a loop to handle each message asynchronously.
# run the programs. | ||
await service.run_program(run_parallel(wake_up, sleep)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The run_program
method is being passed the result of run_parallel(wake_up, sleep)
, which is not a list of Message
objects as expected. Please ensure that the method receives the correct type of input by restructuring the code to pass a list of Message
objects.