Migrate: use `@property` decorator
This commit is contained in:
parent
13d31f1a01
commit
7cdb8749bf
|
@ -31,14 +31,13 @@ class Extents:
|
||||||
return Extents(self.xmin,self.ymin,self.xmax,self.ymax)
|
return Extents(self.xmin,self.ymin,self.xmax,self.ymax)
|
||||||
return self.__add__(extent)
|
return self.__add__(extent)
|
||||||
|
|
||||||
def get_width(self):
|
@property
|
||||||
|
def width(self) -> float:
|
||||||
return self.xmax - self.xmin
|
return self.xmax - self.xmin
|
||||||
|
|
||||||
def get_height(self):
|
@property
|
||||||
|
def height(self) -> float:
|
||||||
return self.ymax - self.ymin
|
return self.ymax - self.ymin
|
||||||
|
|
||||||
width = property(get_width)
|
|
||||||
height = property(get_height)
|
|
||||||
|
|
||||||
def __repr__(self) -> str:
|
def __repr__(self) -> str:
|
||||||
return f'Extents ({self.xmin},{self.ymin})-({self.xmax},{self.ymax})'
|
return f'Extents ({self.xmin},{self.ymin})-({self.xmax},{self.ymax})'
|
||||||
|
|
Loading…
Reference in New Issue