Skip to content

Commit

Permalink
Migrate: use @property decorator
Browse files Browse the repository at this point in the history
  • Loading branch information
Rotzbua authored and florianfesti committed Jan 23, 2023
1 parent 13d31f1 commit 7cdb874
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions boxes/extents.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,13 @@ def __radd__(self,extent):
return Extents(self.xmin,self.ymin,self.xmax,self.ymax)
return self.__add__(extent)

def get_width(self):
return self.xmax-self.xmin
@property
def width(self) -> float:
return self.xmax - self.xmin

def get_height(self):
return self.ymax-self.ymin

width = property(get_width)
height = property(get_height)
@property
def height(self) -> float:
return self.ymax - self.ymin

def __repr__(self) -> str:
return f'Extents ({self.xmin},{self.ymin})-({self.xmax},{self.ymax})'

0 comments on commit 7cdb874

Please sign in to comment.