Skip to content

Commit

Permalink
Update main.py
Browse files Browse the repository at this point in the history
  • Loading branch information
VladyslavBazhyn authored Nov 17, 2023
1 parent 59fdedf commit 804f813
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,36 @@


class IntegerRange:
def __init__(self,
min_amount: int,
def __init__(self,
min_amount: int,
max_amount: int) -> None:
self.min_amount = min_amount
self.max_amount = max_amount

def __get__(self,
obj: any,
def __get__(self,
obj: any,
instance: any) -> None:
return getattr(obj, "_value")

def __set__(self,
obj: any,
def __set__(self,
obj: any,
value: any) -> None:
if not self.min_amount <= value <= self.max_amount:
raise ValueError(f"Value {value} is not "
f"within the range {self.min_amount}"
f"-{self.max_amount}")
setattr(obj, "_value", value)

def __set_name__(self,
owner: any,
def __set_name__(self,
owner: any,
name: str) -> None:
setattr(owner, name, self)

class Visitor:
def __init__(self,
name: str,
def __init__(self,
name: str,
age: int,
weight: int,
weight: int,
height: int) -> None:
self.name = name
self.age = age
Expand All @@ -41,7 +41,7 @@ def __init__(self,

class SlideLimitationValidator(ABC):
def __init__(self, age_range: IntegerRange,
weight_range: IntegerRange,
weight_range: IntegerRange,
height_range: IntegerRange
) -> None:
self.age_range = age_range
Expand Down

0 comments on commit 804f813

Please sign in to comment.