Skip to content

Commit

Permalink
Don't use Optional[float|tuple], that's a Python 3.10+ thing
Browse files Browse the repository at this point in the history
  • Loading branch information
jimwins committed Mar 7, 2024
1 parent c22f52b commit 803964d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions frozen_soup/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Optional
from typing import Optional, Union

import requests

Expand All @@ -13,7 +13,7 @@
def freeze_to_string(
url: str,
session: Optional[requests.Session] = None,
timeout: Optional[float|tuple] = 900.0,
timeout: Union[float, tuple[float, float], None] = 900.0,
formatter: str = 'html5',
) -> str:
if session is None:
Expand Down
6 changes: 3 additions & 3 deletions frozen_soup/css/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Optional
from typing import Optional, Union

import requests
import tinycss2
Expand All @@ -9,7 +9,7 @@ def expand_urls_in_css(
css: str,
base_url: str,
session: Optional[requests.Session] = None,
timeout: Optional[float|tuple] = 900.0,
timeout: Union[float, tuple[float, float], None] = 900.0,
) -> str:
rules = tinycss2.parse_stylesheet(css)

Expand All @@ -25,7 +25,7 @@ def expand_urls_in_rule(
rule,
base_url: str,
session: Optional[requests.Session] = None,
timeout: Optional[float|tuple] = 900.0,
timeout: Union[float, tuple[float, float], None] = 900.0,
):
if type(rule) == tinycss2.ast.QualifiedRule or type(rule) == tinycss2.ast.AtRule:
for child_rule in rule.content:
Expand Down
4 changes: 2 additions & 2 deletions frozen_soup/resource/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Optional
from typing import Optional, Union

import base64
import requests
Expand All @@ -8,7 +8,7 @@ def get_ref_as_dataurl(
base_url: str,
ref_url: str,
session: requests.Session,
timeout: Optional[float|tuple],
timeout: Union[float, tuple[float, float], None] = 900.0,
) -> str:
url = urljoin(base_url, ref_url)
response = session.get(url, timeout= timeout)
Expand Down

0 comments on commit 803964d

Please sign in to comment.