-
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
Solution #588
base: master
Are you sure you want to change the base?
Solution #588
Conversation
app/main.py
Outdated
def __get__(self, instance: Any, owner: Any) -> Any: | ||
return getattr(instance, self.protected_name) | ||
|
||
def __set__(self, instance: Any, value: int) -> Any: |
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 annotation is incorrect.
app/main.py
Outdated
def __init__( | ||
self, | ||
name: str, | ||
limitation_class: 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.
limitation_class: SlideLimitationValidator | |
limitation_class: Type[SlideLimitationValidator] |
app/main.py
Outdated
def can_access(self, visitor: Visitor) -> bool: | ||
try: | ||
self.limitation_class.age = visitor.age | ||
self.limitation_class.height = visitor.height | ||
self.limitation_class.weight = visitor.weight | ||
except (TypeError, ValueError): | ||
return False | ||
return True |
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 can_access(self, visitor: Visitor) -> bool: | |
try: | |
self.limitation_class.age = visitor.age | |
self.limitation_class.height = visitor.height | |
self.limitation_class.weight = visitor.weight | |
except (TypeError, ValueError): | |
return False | |
return True | |
def can_access(self, visitor: Visitor) -> bool: | |
try: | |
self.limitation_class(visitor.age, visitor.height, visitor.weight) | |
except (TypeError, ValueError): | |
return False | |
return True |
app/main.py
Outdated
def __get__(self, instance: Any, owner: type) -> Any: | ||
return getattr(instance, self.protected_name) | ||
|
||
def __set__(self, instance: Any, value: int) -> Any: | ||
if not isinstance(value, int): |
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 __get__(self, instance: Any, owner: type) -> Any: | |
return getattr(instance, self.protected_name) | |
def __set__(self, instance: Any, value: int) -> Any: | |
if not isinstance(value, int): | |
def __get__(self, instance: Any, owner: type) -> Any: | |
return getattr(instance, self.protected_name) | |
def __set__(self, instance: Any, value: int) -> Any: | |
if not isinstance(value, int): |
app/main.py
Outdated
self.min_amount = min_amount | ||
self.max_amount = max_amount | ||
|
||
def __get__(self, instance: Any, owner: type) -> Any: |
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 __get__(self, instance: Any, owner: type) -> Any: | |
def __get__(self, instance: object, owner: type) -> Any: |
app/main.py
Outdated
def __get__(self, instance: Any, owner: type) -> Any: | ||
return getattr(instance, self.protected_name) | ||
|
||
def __set__(self, instance: Any, value: int) -> Any: |
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 __set__(self, instance: Any, value: int) -> Any: | |
def __set__(self, instance: object, value: int) -> Any: |
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.
Great!
No description provided.