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 #577

Closed
wants to merge 1 commit into from
Closed

Conversation

arsen-arutiunov
Copy link

No description provided.

Comment on lines +53 to +57
if ((not (4 <= self.age <= 14))
or (not (20 <= self.weight <= 50))
or (not (80 <= self.height <= 120))):
return False
return True
Copy link

Choose a reason for hiding this comment

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

DRY

Comment on lines +64 to +69
def validate(self) -> bool:
if (not (14 <= self.age <= 60)
or not (50 <= self.weight <= 120)
or not (120 <= self.height <= 220)):
return False
return True
Copy link

Choose a reason for hiding this comment

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

DRY
don't repeat yourself

Comment on lines +81 to +90
try:
self.limitation_class(visitor.age,
visitor.weight,
visitor.height)
except ValueError:
...
obj = self.limitation_class(visitor.age,
visitor.weight,
visitor.height)
return obj.validate()
Copy link

Choose a reason for hiding this comment

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

Suggested change
try:
self.limitation_class(visitor.age,
visitor.weight,
visitor.height)
except ValueError:
...
obj = self.limitation_class(visitor.age,
visitor.weight,
visitor.height)
return obj.validate()
try:
self.limitation_class(
visitor.age,
visitor.weight,
visitor.height
)
except (TypeError, ValueError):
return False
return True

Comment on lines +75 to +76
limitation_class: [ChildrenSlideLimitationValidator,
AdultSlideLimitationValidator]) -> None:
Copy link

Choose a reason for hiding this comment

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

Suggested change
limitation_class: [ChildrenSlideLimitationValidator,
AdultSlideLimitationValidator]) -> None:
limitation_class: Type[SlideLimitationValidator]) -> None:

Comment on lines +16 to +17
"""if not (self.min_amount <= value <= self.max_amount):
raise ValueError("ValueError")"""
Copy link

Choose a reason for hiding this comment

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

Suggested change
"""if not (self.min_amount <= value <= self.max_amount):
raise ValueError("ValueError")"""
if not isinstance(value, int):
raise TypeError("message")
if not (self.max_amount >= value >= self.min_amount):
raise ValueError("message")

@arsen-arutiunov arsen-arutiunov closed this by deleting the head repository Aug 26, 2024
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