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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

what #676

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

what #676

wants to merge 2 commits into from

Conversation

Leo9siy
Copy link

@Leo9siy Leo9siy commented Jan 10, 2025

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a 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:

  1. can_access Method: The method should instantiate the limitation_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.

  2. 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
Comment on lines 58 to 60
def can_access(self, vis: Visitor) -> bool:
self.limitation_class(vis.age, vis.weight, vis.height)
return "age" in self.limitation_class.__dict__.keys()

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.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a 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:

  1. 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 of age, weight, and height fall within the specified IntegerRange constraints.
  2. Error Handling:

    • The can_access method lacks error handling to ensure it returns a boolean value even if exceptions like TypeError or ValueError occur during validation. Implementing robust error handling will make your code more reliable.
  3. 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.

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! ✨

Comment on lines +58 to +62
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())

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.

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

Successfully merging this pull request may close these issues.

2 participants