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

task completed (1) #287

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

Conversation

DaniilHinzburh
Copy link

No description provided.

app/main.py Outdated
return instance.__dict__[self.name]

def __set__(self, instance: object, value: int) -> None:
instance.__dict__[self.name] = value
Copy link

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
Comment on lines 46 to 48
super().__init__(age=IntegerRange(4, 14),
weight=IntegerRange(20, 50),
height=IntegerRange(80, 120))
Copy link

Choose a reason for hiding this comment

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

Suggested change
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

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
Comment on lines 10 to 14
def __get__(self, instance: object, owner: object) -> int:
return instance.name

def __set__(self, instance: object, value: int) -> None:
instance.name = value

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

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
Comment on lines 34 to 41
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

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:

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

Choose a reason for hiding this comment

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

Suggested change
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()

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

Copy link

@ArsenPidhoretskyi ArsenPidhoretskyi left a comment

Choose a reason for hiding this comment

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

Comments not fixed

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.

Comments not fixed

Copy link

@ArsenPidhoretskyi ArsenPidhoretskyi left a 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
Comment on lines 10 to 14
def __get__(self, instance: object, owner: object) -> int:
return instance.name

def __set__(self, instance: object, value: int) -> None:
instance.name = value

Choose a reason for hiding this comment

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

Not fixed

@DaniilHinzburh
Copy link
Author

photo_2024-01-09_22-02-30

app/main.py Outdated
Comment on lines 19 to 20
self.name = name
self.name = name

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:

Choose a reason for hiding this comment

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

Suggested change
def __init__(self, name: str, limitation_class: object) -> None:
def __init__(self, name: str, limitation_class: type[SlideLimitationValidator]) -> 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.

please fix flake8 error
image

Copy link

@ArsenPidhoretskyi ArsenPidhoretskyi left a comment

Choose a reason for hiding this comment

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

Well done!

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.

3 participants