def dump_slides() -> None: for filename in get_free_args(): print(f"filename {filename}") presentation = Presentation(filename) for number, slide in enumerate(presentation.slides): print(f"slide {number}") dump_print(slide)
def extract_text() -> None: for filename in get_free_args(): presentation = Presentation(filename) for slide_number, slide in enumerate(presentation.slides): print(f"slide number {slide_number}") if slide.name != "": print(f"slide.name {slide.name}") # This block extracts hyperlinks for v in slide.part.rels.values(): target: str = v.target_ref if target.startswith(".."): continue print(v.target_ref) for shape in slide.shapes: # pylint: disable=no-member if shape.shape_type == MSO_SHAPE_TYPE.PLACEHOLDER: print(shape.shape_type) print(shape.text) if shape.shape_type == MSO_SHAPE_TYPE.TEXT_BOX: print(shape.shape_type) print(shape.text) if shape.shape_type == MSO_SHAPE_TYPE.TABLE: print(shape.shape_type) for row in shape.table.rows: for cell in row.cells: print(cell.text)
def test_free_args(self): register_function( name="foo", description="foobar", function=raise_value_error, allow_free_args=True, ) config_arg_parse_and_launch( args=["foo", "--num=30", "zoo"], launch=False, do_exit=False, ) self.assertListEqual(get_free_args(), ["zoo"])
def view() -> None: view_svgs(get_free_args())
def print_pickle() -> None: for filename in get_free_args(): with open(filename, "rb") as file_handle: print(f"{filename}") for x, y in pickle.load(file_handle).items(): print(x, y)
def download_links() -> None: refs = get_sorted_refs(get_free_args()) for ref in refs: download(ref)
def extract_links() -> None: refs = get_sorted_refs(get_free_args()) for ref in refs: print(ref)
def remove_folders() -> None: result = [] for f in get_free_args(): r = os.path.splitext(os.sep.join(f.split(os.sep)[1:]))[0] result.append(r) print(' '.join(result), end='')