From 12b4e12865088354c94cdf6d6b6c0534185253bd Mon Sep 17 00:00:00 2001 From: "Alex Xu (Hello71)" Date: Tue, 5 Oct 2021 13:01:56 -0400 Subject: optimize, delete dead code --- wfs.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/wfs.py b/wfs.py index c107c67..08ce689 100755 --- a/wfs.py +++ b/wfs.py @@ -109,7 +109,7 @@ def extract(path, fonts, screenshots): height = DRIVER.execute_script(''.join([ "let style = document.createElement('style'); style.innerHTML = '", ''.join(gen_font_face(font) for font in fonts), - "'; document.body.appendChild(style); return document.body.parentNode.scrollHeight"])) + "'; document.body.appendChild(style); return document.documentElement.scrollHeight"])) logger.info('taking pre-screenshot for %s', path) DRIVER.set_window_size(1920, height) screenshot = DRIVER.get_screenshot_as_png() @@ -155,21 +155,11 @@ def verify(path, screenshot_begin_png): DRIVER.set_window_size(*screenshot_begin.size) screenshot_end_png = DRIVER.get_screenshot_as_png() - logger.info('checking screenshot for %s', path) screenshot_end = Image.open(BytesIO(screenshot_end_png), formats=('PNG',)).convert('RGB') + logger.info('checking %s screenshots for %s', 'x'.join(map(str, screenshot_end.size)), path) if ImageChops.difference(screenshot_begin, screenshot_end).getbbox(): raise Exception(f'screenshots do not match for {path}') -class LocalPool: - def __init__(self, driver_name): - start_wworker(driver_name) - - def starmap(self, func, args, *_): - return [func(*arg) for arg in args] - - def close(self): - stop_driver() - def main(argv): parser = argparse.ArgumentParser(description='Web Font Subsetter', epilog='see pyftsubset --help for additional options') parser.add_argument('--driver', help='selenium driver name (chrome or firefox)', default='chrome') -- cgit v1.2.3-70-g09d2