Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
John Lyu committed Oct 24, 2024
1 parent e057912 commit 4b78978
Show file tree
Hide file tree
Showing 14 changed files with 21 additions and 27 deletions.
2 changes: 2 additions & 0 deletions dataframe_image/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from ._convert import convert
from ._pandas_accessor import export, export_async
from ._version import __version__

__all__ = ["export", "export_async", "convert", "__version__"]
12 changes: 5 additions & 7 deletions dataframe_image/_browser_pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
import os
import platform
import socket
import urllib.parse
from pathlib import Path
from subprocess import Popen
from tempfile import TemporaryDirectory, mkstemp
from tempfile import mkstemp

import aiohttp
from nbconvert import TemplateExporter
from nbconvert.exporters import Exporter, HTMLExporter
from nbconvert.exporters import HTMLExporter

from .converter.browser.chrome_converter import get_chrome_path

Expand Down Expand Up @@ -141,7 +139,7 @@ def get_pdf_data(file_name):


def get_pdf_data_chromecontroller(file_name):
import ChromeController
import ChromeController # type: ignore

additional_options = get_launch_args()
# ChromeContext will shlex.split binary, so add quote to it
Expand All @@ -150,10 +148,10 @@ def get_pdf_data_chromecontroller(file_name):
) as cr:
# Do a blocking navigate to a URL, and get the page content as served by the remote
# server, with no modification by local javascript (if applicable)
raw_source = cr.blocking_navigate_and_get_source(file_name)
# raw_source = cr.blocking_navigate_and_get_source(file_name)
# Since the page is now rendered by the blocking navigate, we can
# get the page source after any javascript has modified it.
rendered_source = cr.get_rendered_page_source()
# rendered_source = cr.get_rendered_page_source()
# # Or take a screenshot
# # The screenshot is the size of the remote browser's configured viewport,
# # which by default is set to 1024 * 1366. This size can be changed via the
Expand Down
2 changes: 0 additions & 2 deletions dataframe_image/_bundler.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import base64
import json
from pathlib import Path

from tornado import gen


def _jupyter_bundlerextension_paths():
Expand Down
4 changes: 0 additions & 4 deletions dataframe_image/_convert.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import base64
import io
import logging
import os
import re
import shutil
import tempfile
import time
import urllib.parse
import warnings
from pathlib import Path
Expand Down
2 changes: 1 addition & 1 deletion dataframe_image/_latex_pdf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import shutil

from nbconvert.exporters import Exporter, HTMLExporter, PDFExporter
from nbconvert.exporters import PDFExporter

from ._preprocessors import (
ChangeOutputTypePreprocessor,
Expand Down
1 change: 0 additions & 1 deletion dataframe_image/_preprocessors.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import base64
import io
import re
from pathlib import Path

Expand Down
2 changes: 1 addition & 1 deletion dataframe_image/converter/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from .browser import *
from .browser import * # noqa: F403
8 changes: 8 additions & 0 deletions dataframe_image/converter/browser/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,11 @@
from .html2image_converter import Html2ImageConverter
from .playwright_converter import AsyncPlayWrightConverter, PlayWrightConverter
from .selenium_converter import SeleniumConverter

__all__ = [
"ChromeConverter",
"Html2ImageConverter",
"PlayWrightConverter",
"AsyncPlayWrightConverter",
"SeleniumConverter",
]
2 changes: 0 additions & 2 deletions dataframe_image/converter/browser/base.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import base64
import io
import logging
import subprocess
from abc import ABC
from pathlib import Path
from tempfile import TemporaryDirectory

import numpy as np
from PIL import Image, ImageOps
Expand Down
2 changes: 0 additions & 2 deletions dataframe_image/converter/browser/playwright_converter.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import math
from io import BytesIO
from pathlib import Path
from tempfile import TemporaryDirectory

from PIL import Image

Expand Down
1 change: 0 additions & 1 deletion dataframe_image/converter/browser/selenium_converter.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import logging
from pathlib import Path
from tempfile import TemporaryDirectory

Expand Down
7 changes: 3 additions & 4 deletions dataframe_image/converter/matplotlib_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import cssutils
import numpy as np
from lxml.cssselect import CSSSelector
from lxml.etree import tostring
from lxml.html import fromstring
from matplotlib import lines as mlines
from matplotlib import patches as mpatches
Expand Down Expand Up @@ -93,8 +92,8 @@ def get_property(element, property_name):

def parse_row(row):
values = []
rowspan_dict = {}
colspan_total = 0
# rowspan_dict = {}
# colspan_total = 0
row_align = self.get_text_align(row)
for el in row.xpath(".//td|.//th"):
bold = el.tag == "th"
Expand Down Expand Up @@ -169,7 +168,7 @@ def get_all_text_widths(self, rows):
)
row_widths.append(cell_max_width)
all_text_widths.append(row_widths)
pad = 10 # number of pixels to pad columns with
# pad = 10 # number of pixels to pad columns with
return np.array(all_text_widths) + 15

def calculate_col_widths(self):
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import re

import setuptools

Expand Down
2 changes: 1 addition & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from . import conftest
from . import conftest # noqa: F401

0 comments on commit 4b78978

Please sign in to comment.