-
Notifications
You must be signed in to change notification settings - Fork 663
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
what #676
base: master
Are you sure you want to change the base?
what #676
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.
Hello! 😊 You've done a great job aligning most of your code with the task requirements. However, there are a few critical issues that need to be addressed before we can approve the pull request:
-
can_access
Method: The method should instantiate thelimitation_class
with the visitor's attributes to properly validate access. Currently, it only checks for 'age' in the dictionary, which isn't sufficient for the task requirements. -
Error Handling: It's important to handle exceptions that may be raised by the
limitation_class
during validation. This will ensure that the method returns a boolean value as specified.
Once these issues are resolved, your code will be in great shape! Keep up the good work, and don't hesitate to reach out if you need any help. 🌟
✨ 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
def can_access(self, vis: Visitor) -> bool: | ||
self.limitation_class(vis.age, vis.weight, vis.height) | ||
return "age" in self.limitation_class.__dict__.keys() |
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 can_access
method should instantiate the limitation_class
with the visitor's attributes and handle any exceptions that may be raised. The current implementation only checks if 'age' is in the dictionary, which does not fulfill the task requirement to validate the visitor's attributes against the limitations.
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 effort on addressing the previous issues! 🎉 However, there are still a few critical points that need attention to ensure your code functions as intended:
-
can_access
Method:- The method should validate the actual values of the attributes in the
limitation_class
instance, rather than just checking for the presence of keys in the dictionary. This ensures that the values ofage
,weight
, andheight
fall within the specifiedIntegerRange
constraints.
- The method should validate the actual values of the attributes in the
-
Error Handling:
- The
can_access
method lacks error handling to ensure it returns a boolean value even if exceptions likeTypeError
orValueError
occur during validation. Implementing robust error handling will make your code more reliable.
- The
-
Validation Logic:
- The
IntegerRange
descriptor's__set__
method should raise an exception if the value is not within the specified range or if the type is incorrect. Currently, it simply returns without raising an error, which could lead to unexpected behavior.
- The
These issues are critical for the functionality of your code and should be addressed in future iterations. Remember, addressing these will not only improve your current project but also enhance your coding skills for future tasks. Keep up the good work and continue learning from these experiences! 🚀
✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨
def can_access(self, vis: Visitor) -> bool: | ||
new_class = self.limitation_class(vis.age, vis.weight, vis.height) | ||
return ("_weight" in new_class.__dict__.keys() | ||
and "_age" in new_class.__dict__.keys() | ||
and "_height" in new_class.__dict__.keys()) |
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 can_access
method currently checks for the presence of keys in the new_class.__dict__
. Instead, it should validate the actual values of age
, weight
, and height
against the IntegerRange
constraints. Consider using the attributes directly to ensure they fall within the specified ranges.
No description provided.