-
Notifications
You must be signed in to change notification settings - Fork 677
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 #344
base: master
Are you sure you want to change the base?
Solution #344
Conversation
app/main.py
Outdated
if not isinstance(value, int): | ||
raise TypeError | ||
if not self.min_amount <= value <= self.max_amount: | ||
raise ValueError |
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.
raise ValueError | |
raise ValueError (add some message) |
app/main.py
Outdated
|
||
def __set__(self, instance: any, value: int) -> None: | ||
if not isinstance(value, int): | ||
raise TypeError |
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.
raise TypeError | |
raise TypeError (add some message) |
app/main.py
Outdated
self.min_amount = min_amount | ||
self.max_amount = max_amount | ||
|
||
def __get__(self, instance: any, owner: any) -> 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: any) -> int: | |
def __get__(self, instance: object, owner: type) -> int: |
app/main.py
Outdated
def __get__(self, instance: any, owner: any) -> int: | ||
return getattr(instance, self.protected_name) | ||
|
||
def __set__(self, instance: any, value: int) -> 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 __set__(self, instance: any, value: int) -> None: | |
def __set__(self, instance: object, value: int) -> None: |
app/main.py
Outdated
raise ValueError | ||
setattr(instance, self.protected_name, value) | ||
|
||
def __set_name__(self, owner: any, name: str) -> 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 __set_name__(self, owner: any, name: str) -> None: | |
def __set_name__(self, owner: type, name: str) -> 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.
Looks Good 👍
No description provided.