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

solution #670

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

solution #670

wants to merge 1 commit into from

Conversation

Bombardier256
Copy link

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.

Great job on implementing the task requirements! 🎉 While there are a few areas for improvement, such as using the IntegerRange descriptors correctly in the can_access method and providing more descriptive error messages, these are minor issues that don't significantly impact the functionality. Keep up the good work and consider these suggestions for future enhancements! 😊

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨


def __set__(self, instance: object, value: int) -> None:
if not isinstance(value, int):
raise TypeError

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider providing a more descriptive error message when raising the TypeError to indicate that the value must be an integer.

if self.min_amount <= value <= self.max_amount:
setattr(instance, self.protected_name, value)
else:
setattr(instance, self.protected_name, None)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of setting the attribute to None when the value is out of range, it would be more appropriate to raise a ValueError with a descriptive message. This will make it clear that the value is invalid and why.

self.limitation_class = limitation_class

def can_access(self, man: Visitor) -> bool:
access = self.limitation_class(man.age, man.weight, man.height)

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 creates an instance of the limitation class with the visitor's attributes. However, the IntegerRange descriptors are not being used correctly. You should check if the visitor's attributes are within the allowed range using the descriptors, rather than relying on the instantiation of the limitation class.

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