Skip to content

Commit

Permalink
Address reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanking13 committed Dec 28, 2023
1 parent b254cb7 commit 6885216
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
11 changes: 5 additions & 6 deletions micropip/_compat_in_pyodide.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@
async def fetch_bytes(url: str, kwargs: dict[str, str]) -> bytes:
parsed_url = urlparse(url)
if parsed_url.scheme == "emfs":
result_bytes = Path(parsed_url.path).read_bytes()
elif parsed_url.scheme == "file":
result_bytes = (await loadBinaryFile(parsed_url.path)).to_bytes()
else:
result_bytes = await (await pyfetch(url, **kwargs)).bytes()
return result_bytes
return Path(parsed_url.path).read_bytes()
if parsed_url.scheme == "file":
return (await loadBinaryFile(parsed_url.path)).to_bytes()

return await (await pyfetch(url, **kwargs)).bytes()


async def fetch_string_and_headers(
Expand Down
3 changes: 1 addition & 2 deletions micropip/_compat_not_in_pyodide.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ def _fetch(url: str, kwargs: dict[str, Any]) -> addinfourl:


async def fetch_bytes(url: str, kwargs: dict[str, Any]) -> bytes:
response = _fetch(url, kwargs=kwargs)
return response.read()
return _fetch(url, kwargs=kwargs).read()


async def fetch_string_and_headers(
Expand Down

0 comments on commit 6885216

Please sign in to comment.