-
Notifications
You must be signed in to change notification settings - Fork 674
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 #648
base: master
Are you sure you want to change the base?
Solution #648
Conversation
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 project! 😊 There are a couple of critical issues that need to be addressed to ensure the code functions correctly.
-
The
__get__
method in theIntegerRange
class should return the value of the attribute, but it currently returnsNone
. This needs to be corrected to ensure that the attribute value is properly retrieved. -
The
Slide
class incorrectly usesClass
frompyclbr
for instantiation, which is not appropriate. You should usetype
or a specific class type that can be instantiated instead.
Once these issues are resolved, your code will be in great shape! Keep up the great work, and I'm looking forward to seeing the improvements. 🚀
✨ 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.
app/main.py
Outdated
@@ -1,25 +1,68 @@ | |||
from abc import ABC | |||
from pyclbr import Class |
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 import from pyclbr import Class
is incorrect for the intended usage. Class
from pyclbr
is not meant to be used as a type for instantiation. Consider using type
or a specific class type that can be instantiated.
app/main.py
Outdated
def __set_name__(self, owner: Any, name: str) -> None: | ||
self.protected_name = f"_{name}" | ||
|
||
def __get__(self, instance: Any, owner: Any) -> None: |
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 __get__
method should return the value of the attribute, but it currently returns None
. Change the return type to Any
to reflect that it should return the attribute value.
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.
Review Summary
Great job on addressing the previous issues and improving the code! 🎉 The code now meets the task requirements and constraints, and all necessary classes and methods are implemented correctly. However, there are a couple of areas that could still use some attention:
-
__get__
Method inIntegerRange
Class: The method should return the value as a string, as indicated by its return type annotation-> str
. Consider converting the returned value to a string to align with the expected behavior. -
limitation_class
Check inSlide
Class: It would be beneficial to add a check to ensure thatlimitation_class
is a subclass ofSlideLimitationValidator
. This will prevent incorrect usage and ensure that only valid limitation classes are used with theSlide
class.
Despite these minor issues, the decision is to APPROVE the Pull Request to help you move forward with your learning. Please review the comments and consider making these improvements in future iterations. Keep up the good work and continue to learn from your experiences! 🚀
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
def __get__(self, instance: Any, owner: Any) -> str: | ||
return getattr(instance, self.protected_name) |
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 __get__
method in the IntegerRange
class should return the value as a string, as indicated by its return type annotation -> str
. Consider converting the returned value to a string.
def __init__(self, name: str, limitation_class: type) -> None: | ||
self.name = name | ||
self.limitation_class = limitation_class |
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.
Consider adding a check to ensure that limitation_class
is a subclass of SlideLimitationValidator
to prevent incorrect usage. This will ensure that only valid limitation classes are used with the Slide
class.
No description provided.