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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

Molodoirockstar
Copy link

No description provided.

app/main.py Outdated
if not isinstance(value, int):
raise TypeError
if not self.min_amount <= value <= self.max_amount:
raise 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
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
Copy link

Choose a reason for hiding this comment

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

Suggested change
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:
Copy link

Choose a reason for hiding this comment

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

Suggested change
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:
Copy link

Choose a reason for hiding this comment

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

Suggested change
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:
Copy link

Choose a reason for hiding this comment

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

Suggested change
def __set_name__(self, owner: any, name: str) -> None:
def __set_name__(self, owner: type, name: str) -> None:

Copy link

@vsmutok vsmutok left a comment

Choose a reason for hiding this comment

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

Looks Good 👍

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