Skip to content

Commit

Permalink
fix(sdk): lint messages
Browse files Browse the repository at this point in the history
  • Loading branch information
artem-chupryna committed Oct 28, 2024
1 parent 42a046a commit 10935ed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
2 changes: 1 addition & 1 deletion python/src/numerous/_client/_fs_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def save(self, path: Path) -> None:
def convert_to_serializable(obj: Path) -> str:
if isinstance(obj, Path):
return str(obj)
return None
return ""

with path.open("w") as f:
json.dump(asdict(self), f, default=convert_to_serializable)
Expand Down
16 changes: 5 additions & 11 deletions python/src/numerous/collection/numerous_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@


_REQUEST_TIMEOUT_SECONDS_ = 1.5
_NO_DOWNLOAD_URL_MSG_ = "No download URL for this file."


class NumerousFile:
Expand Down Expand Up @@ -51,9 +52,7 @@ def __init__(
self.download_url = numerous_file_ref.download_url
self.upload_url = numerous_file_ref.upload_url
self.file_id = numerous_file_ref.id
self._tags: dict[str, str] = (
dict_of_tags if dict_of_tags is not None else {}
)
self._tags: dict[str, str] = dict_of_tags if dict_of_tags else {}

@property
def exists(self) -> bool:
Expand Down Expand Up @@ -115,8 +114,7 @@ def _update_file(self) -> None:
"""
if self.download_url is None:
msg = "No download URL for this file."
raise ValueError(msg)
raise ValueError(_NO_DOWNLOAD_URL_MSG_)
if self.local_path is None:
msg = "No local path for this file."
raise ValueError(msg)
Expand All @@ -141,10 +139,8 @@ def read_text(self) -> str:
"""
if self.download_url is None:
msg = "No download URL for this file."
raise ValueError(msg)
raise ValueError(_NO_DOWNLOAD_URL_MSG_)
with tempfile.NamedTemporaryFile(mode="r+", delete=True) as temp_file:

response = requests.get(
self.download_url, timeout=_REQUEST_TIMEOUT_SECONDS_
)
Expand All @@ -169,11 +165,9 @@ def read_bytes(self) -> bytes:
"""
if self.download_url is None:
msg = "No download URL for this file."
raise ValueError(msg)
raise ValueError(_NO_DOWNLOAD_URL_MSG_)

with tempfile.NamedTemporaryFile(mode="r+b", delete=True) as temp_file:

response = requests.get(
self.download_url, timeout=_REQUEST_TIMEOUT_SECONDS_
)
Expand Down

0 comments on commit 10935ed

Please sign in to comment.