Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Args:
filename (`str`): The path to the file to delete
"""
self.temp_files.add(filename)
def cleanup_media_files(self):
""" Removes all files that were extracted from the pdf into the filesystem.
"""
for f in self.temp_files:
os.remove(f)
self.temp_files.clear()
class EmptyPage(Page):
""" A dummy page, placeholder for when there are no valid pages around.
This page is a non-notes page with an aspect ratio of 1.3 and nothing else inside.
Also, it has no "rendering" capability, and is made harmless by overriding its render function.
"""
def __init__(self):
self.page = None
self.page_nb = -1
self.parent = None
self.page_label = None
self.links = []
self.medias = []
self.annotations = []
# by default, anything that will have a 1.3 asapect ratio
def page(self, number):
""" Get the specified page.
Args:
number (`int`): number of the page to return
Returns:
:class:`~pympress.document.Page`: the wanted page, or `None` if it does not exist
"""
if number >= self.nb_pages or number < 0:
return None
if number not in self.pages_cache:
self.pages_cache[number] = Page(self.doc.get_page(number), number, self)
return self.pages_cache[number]