Skip to content

Minor Changes #4561

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
25 changes: 15 additions & 10 deletions src/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3930,9 +3930,10 @@ def delete_pages(self, *args, **kw):
numbers = tuple(range(f, t + 1))
else:
r = args[0]
if type(r) not in (int, range, list, tuple):
raise ValueError("need int or sequence if one argument")
numbers = tuple(r)
if type(r) is int:
numbers = (r,)
else:
numbers = tuple(r)

numbers = list(map(int, set(numbers))) # ensure unique integers
if numbers == []:
Expand Down Expand Up @@ -11401,13 +11402,17 @@ def intersect(self, r):

def intersects(self, x):
"""Check if intersection with rectangle x is not empty."""
r1 = Rect(x)
if self.is_empty or self.is_infinite or r1.is_empty or r1.is_infinite:
return False
r = Rect(self)
if r.intersect(r1).is_empty:
return False
return True
rect2 = Rect(x)
return (1
and not self.is_empty
and not self.is_infinite
and not rect2.is_empty
and not rect2.is_infinite
and self.x0 < rect2.x1
and rect2.x0 < self.x1
and self.y0 < rect2.y1
and rect2.y0 < self.y1
)

@property
def is_empty(self):
Expand Down
Loading