Skip to content

Commit

Permalink
Put downladed files into a named tuple class
Browse files Browse the repository at this point in the history
  • Loading branch information
insolor committed Jun 9, 2024
1 parent 3f2694f commit 42e9948
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
26 changes: 25 additions & 1 deletion package_build/download_parts.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import NamedTuple

import requests
import streamlit as st

Expand All @@ -10,21 +12,43 @@ def download(url: str) -> bytes:
return response.content


class DownloadedParts(NamedTuple):
library: bytes
config: bytes
offsets: bytes
csv_file: bytes
font_file: bytes
encoding_config: bytes


# @st.cache_data
def download_parts(
hook_info: HookInfoEntry,
dict_info: DictInfoEntry,
) -> tuple[bytes, bytes, bytes, bytes, bytes, bytes]:
st.write("Download library...")
library = download(hook_info.lib)

st.write("Download config...")
config = download(hook_info.config)

st.write("Download offseets...")
offsets = download(hook_info.offsets)

st.write("Download csv dictionary...")
csv_file = download(dict_info.csv)

st.write("Download font file...")
font_file = download(dict_info.font)

st.write("Download encoding config...")
encoding_config = download(dict_info.encoding)
return library, config, offsets, csv_file, font_file, encoding_config

return DownloadedParts(
library=library,
config=config,
offsets=offsets,
csv_file=csv_file,
font_file=font_file,
encoding_config=encoding_config,
)
2 changes: 1 addition & 1 deletion package_build/parse_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def parse_url(url: str) -> tuple[str, str, str]:


def parse_metadata(metadata: list[HookInfoEntry]) -> MetadataParsingResult:
mapping = dict()
mapping = {}
df_versions = set()
variants = set()
operating_systems = set()
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ line-length = 120
select = ["ALL"]
ignore = [
"ANN101", # Missing type annotation for self in method
"C408", # Unnecessary `dict` call (rewrite as a literal)
"D",
# "D100", # Missing docstring in public module
# "D104", # Missing docstring in public package
Expand Down

0 comments on commit 42e9948

Please sign in to comment.