Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Nov 16, 2024
1 parent 15def3f commit 2b322a0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
9 changes: 8 additions & 1 deletion juriscraper/lib/html_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,14 @@
ALLOWED_ATTRIBUTES["div"] = {"class", "id"}
ALLOWED_ATTRIBUTES["font"] = {"face", "size"}
ALLOWED_ATTRIBUTES["form"] = {"name", "method", "action"}
ALLOWED_ATTRIBUTES["input"] = {"class", "id", "name", "value", "type", "onclick"}
ALLOWED_ATTRIBUTES["input"] = {
"class",
"id",
"name",
"value",
"type",
"onclick",
}
ALLOWED_ATTRIBUTES["span"] = {"class"}
ALLOWED_ATTRIBUTES["table"].update({"border", "class"})
ALLOWED_ATTRIBUTES["tr"].add("class")
Expand Down
14 changes: 10 additions & 4 deletions juriscraper/pacer/appellate_attachment_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@

from juriscraper.lib.html_utils import strip_bad_html_tags_insecure
from juriscraper.lib.string_utils import force_unicode
from juriscraper.pacer.utils import get_pacer_doc_id_from_doc1_url, \
reverse_sumDocSelected_function
from juriscraper.pacer.utils import (
get_pacer_doc_id_from_doc1_url,
reverse_sumDocSelected_function,
)

from ..lib.log_tools import make_default_logger
from .reports import BaseReport
Expand Down Expand Up @@ -167,7 +169,9 @@ def _get_page_count_from_tr(row: html.HtmlElement) -> Optional[int]:
try:
onclick = input_el.xpath("./@onclick")
if onclick and "sumDocSelected" in onclick[0]:
sum_doc_selected_parts = reverse_sumDocSelected_function(onclick[0])
sum_doc_selected_parts = reverse_sumDocSelected_function(
onclick[0]
)
if sum_doc_selected_parts:
return sum_doc_selected_parts["page_count"]
except IndexError:
Expand All @@ -188,7 +192,9 @@ def _get_file_size_bytes_from_tr(row: html.HtmlElement) -> Optional[int]:
try:
onclick = input_el.xpath("./@onclick")
if onclick and "sumDocSelected" in onclick[0]:
sum_doc_selected_parts = reverse_sumDocSelected_function(onclick[0])
sum_doc_selected_parts = reverse_sumDocSelected_function(
onclick[0]
)
if sum_doc_selected_parts:
return sum_doc_selected_parts["file_size_bytes"]
except IndexError:
Expand Down
2 changes: 1 addition & 1 deletion juriscraper/pacer/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ def reverse_sumDocSelected_function(s):
- doc_id: document ID without court prefix, sometimes called dlsid.
"""
match = re.search(r"sumDocSelected\((.*?)\)", s)
args = [arg.strip() for arg in match.group(1).split(',')]
args = [arg.strip() for arg in match.group(1).split(",")]
if args[0] != "this":
return None
parts = {
Expand Down

0 comments on commit 2b322a0

Please sign in to comment.