Skip to content

Add __slots__ entries. #4637

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10785,7 +10785,7 @@ def __del__(self):

del Point
class Point:

__slots__ = ("x", "y")
def __abs__(self):
return math.sqrt(self.x * self.x + self.y * self.y)

Expand Down Expand Up @@ -10972,7 +10972,7 @@ def unit(self):


class Quad:

__slots__ = ("ul", "ur", "ll", "lr")
def __abs__(self):
if self.is_empty:
return 0.0
Expand Down Expand Up @@ -11036,6 +11036,7 @@ def __init__(self, *args, ul=None, ur=None, ll=None, lr=None):
None.

'''

if not args:
self.ul = self.ur = self.ll = self.lr = Point()
elif len(args) > 4:
Expand Down Expand Up @@ -11204,7 +11205,7 @@ def transform(self, m):


class Rect:

__slots__ = ("x0", "y0", "x1", "y1")
def __abs__(self):
if self.is_empty or self.is_infinite:
return 0.0
Expand Down Expand Up @@ -12647,7 +12648,7 @@ class IRect:
IRect(top-left, bottom-right) - 2 points
IRect(sequ) - new from sequence or rect-like
"""

__slots__ = ("x0", "y0", "x1", "y1")
def __add__(self, p):
return Rect.__add__(self, p).round()

Expand Down