-
Notifications
You must be signed in to change notification settings - Fork 620
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
task completed (1) #287
base: master
Are you sure you want to change the base?
task completed (1) #287
Conversation
app/main.py
Outdated
return instance.__dict__[self.name] | ||
|
||
def __set__(self, instance: object, value: int) -> None: | ||
instance.__dict__[self.name] = 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.
use setattr
app/main.py
Outdated
super().__init__(age=IntegerRange(4, 14), | ||
weight=IntegerRange(20, 50), | ||
height=IntegerRange(80, 120)) |
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.
super().__init__(age=IntegerRange(4, 14), | |
weight=IntegerRange(20, 50), | |
height=IntegerRange(80, 120)) | |
age=IntegerRange(4, 14), | |
weight=IntegerRange(20, 50), | |
height=IntegerRange(80, 120) |
app/main.py
Outdated
@@ -2,24 +2,65 @@ | |||
|
|||
|
|||
class IntegerRange: | |||
pass | |||
def __init__(self, min_amount: int, max_amount: int) -> None: | |||
self.name = 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.
This is redundant
app/main.py
Outdated
def __get__(self, instance: object, owner: object) -> int: | ||
return instance.name | ||
|
||
def __set__(self, instance: object, value: int) -> None: | ||
instance.name = 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.
Wrong realization, validation must be into set method
Also instance.name will not return proper 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.
Not fixed
app/main.py
Outdated
def validate(self, visitor: Visitor) -> bool: | ||
if (self.age.min_amount <= visitor.age <= self.age.max_amount | ||
and (self.weight.min_amount <= visitor.weight <= ( | ||
self.weight.max_amount)) | ||
and (self.height.min_amount <= visitor.height <= ( | ||
self.height.max_amount))): | ||
return True | ||
return False |
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.
Validate is redundant here
app/main.py
Outdated
|
||
|
||
class Slide: | ||
pass | ||
def __init__(self, name: str, limitation_class: object) -> 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.
limitation_class is type of SlideLimitationValidator
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.
def __init__(self, name: str, limitation_class: object) -> None: | |
def __init__(self, name: str, limitation_class: type[SlideLimitationValidator]) -> None: |
app/main.py
Outdated
pass | ||
def __init__(self, name: str, limitation_class: object) -> 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.
No need to create it here
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.
Comments not fixed
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.
Comments not fixed
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.
No changes
The same errors as before
app/main.py
Outdated
def __get__(self, instance: object, owner: object) -> int: | ||
return instance.name | ||
|
||
def __set__(self, instance: object, value: int) -> None: | ||
instance.name = 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.
Not fixed
app/main.py
Outdated
self.name = name | ||
self.name = 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.
This two lines are redundant
app/main.py
Outdated
|
||
|
||
class Slide: | ||
pass | ||
def __init__(self, name: str, limitation_class: object) -> 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.
def __init__(self, name: str, limitation_class: object) -> None: | |
def __init__(self, name: str, limitation_class: type[SlideLimitationValidator]) -> 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.
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.
Well done!
No description provided.