Skip to content

Commit

Permalink
[MISC] automatic linting
Browse files Browse the repository at this point in the history
  • Loading branch information
seqan-actions committed Oct 21, 2024
1 parent f9c9e27 commit 596a589
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 22 deletions.
6 changes: 3 additions & 3 deletions workflow/scripts/plot/components/plot_css_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"Number of reads": 1048576,
"Read length": 250,
"Read errors": 2,
}
},
}


Expand Down Expand Up @@ -169,8 +169,8 @@ def get_hover_code():


def landing_page_css():
""" Returns the CSS style for the landing page."""
return"""
"""Returns the CSS style for the landing page."""
return """
body {
font-family: Arial, sans-serif;
background-color: #15191c;
Expand Down
23 changes: 12 additions & 11 deletions workflow/scripts/plot/landingpage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,27 @@
Creates a landing page gallery with screenshots of Bokeh plot HTML files.
"""

import os
import json
import os

from bs4 import BeautifulSoup

from components.log_init import log_init
from components.plot_css_html import landing_page_css

html_files = snakemake.input["PLOT_FILE"] # type: ignore
output_file = snakemake.output["OUTPUT_FILE"] # type: ignore
extra_file_plotting = snakemake.params["EXTRA_FILE_PLOTTING"] # type: ignore
html_dir = snakemake.params["HTML_DIR"] # type: ignore

html_files = snakemake.input["PLOT_FILE"] # type: ignore
output_file = snakemake.output["OUTPUT_FILE"] # type: ignore
extra_file_plotting = snakemake.params["EXTRA_FILE_PLOTTING"] # type: ignore
html_dir = snakemake.params["HTML_DIR"] # type: ignore

log_init(snakemake.log[0]) # type: ignore
log_init(snakemake.log[0]) # type: ignore


# recursiv text extraction from json
def find_texts(obj, texts):
if isinstance(obj, dict):
for key, value in obj.items():
if key == 'text':
if key == "text":
texts.append(value)
elif isinstance(value, (dict, list)):
find_texts(value, texts)
Expand All @@ -40,14 +41,14 @@ def get_html_name(html_file):
def clean_html(html_file):
with open(html_file, "r", encoding="utf-8") as f:
html = str(f.read())
soup = BeautifulSoup(html, 'html.parser')
soup = BeautifulSoup(html, "html.parser")
extracted_script = soup.find("script", {"type": "application/json"})
converted_html = extracted_script.get_text().replace("&lt;", "<").replace("&gt;", ">").replace('\"', '"')
converted_html = extracted_script.get_text().replace("&lt;", "<").replace("&gt;", ">").replace('"', '"')
json_data = json.loads(converted_html)
texts = []
find_texts(json_data, texts)
text_string = "\n".join(texts)
converted_soup = BeautifulSoup(text_string, 'html.parser')
converted_soup = BeautifulSoup(text_string, "html.parser")
dataset = converted_soup.find("div", {"id": "dataset"})
return dataset

Expand Down
16 changes: 8 additions & 8 deletions workflow/scripts/plot/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@
from components.log_init import log_init
from components.plot_style import add_legend, add_second_y_axis, configure_size_plot, configure_time_plot, save_tabs

log_init(snakemake.log[0]) # type: ignore
log_init(snakemake.log[0]) # type: ignore

SIZE_INPUT = snakemake.input["SIZE_INPUT"] # type: ignore
TIME_INPUT = snakemake.input["TIME_INPUT"] # type: ignore
SIZE_INPUT = snakemake.input["SIZE_INPUT"] # type: ignore
TIME_INPUT = snakemake.input["TIME_INPUT"] # type: ignore

PLOT_FILE = snakemake.output["PLOT_FILE"] # type: ignore
PLOT_FILE = snakemake.output["PLOT_FILE"] # type: ignore

THEME = snakemake.params["THEME"] # type: ignore
KEYS = snakemake.params["KEYS"] # type: ignore
TIME = snakemake.params["TIME"] # type: ignore
SIZE = snakemake.params["SIZE"] # type: ignore
THEME = snakemake.params["THEME"] # type: ignore
KEYS = snakemake.params["KEYS"] # type: ignore
TIME = snakemake.params["TIME"] # type: ignore
SIZE = snakemake.params["SIZE"] # type: ignore

TIME_NAMES = [TIME["NAMES"].get(key, key) for key in TIME["FORMAT"]]
SIZE_NAMES = [SIZE["NAMES"].get(key, key) for key in SIZE["FORMAT"]]
Expand Down

0 comments on commit 596a589

Please sign in to comment.