Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add py.typed #59

Merged
merged 2 commits into from
Sep 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "sw-utils"
version = "0.3.22"
version = "0.3.23"
description = "StakeWise Python utils"
authors = ["StakeWise Labs <[email protected]>"]
license = "GPL-3.0-or-later"
Expand Down
6 changes: 3 additions & 3 deletions sw_utils/ipfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def _ipfs_fetch_bytes(self, endpoint: str, ipfs_hash: str) -> bytes:
) as client:
return client.cat(ipfs_hash, timeout=self.timeout)

async def fetch_json(self, ipfs_hash: str) -> dict | list:
async def fetch_json(self, ipfs_hash: str) -> Any:
"""Tries to fetch IPFS hash from different sources."""
if not ipfs_hash:
raise ValueError('Empty IPFS hash provided')
Expand All @@ -295,13 +295,13 @@ async def fetch_json(self, ipfs_hash: str) -> dict | list:

raise IpfsException(f'Failed to fetch IPFS data at {ipfs_hash}')

async def _http_gateway_fetch_json(self, endpoint: str, ipfs_hash: str) -> dict | list:
async def _http_gateway_fetch_json(self, endpoint: str, ipfs_hash: str) -> Any:
async with ClientSession(timeout=ClientTimeout(self.timeout)) as session:
async with session.get(f"{endpoint.rstrip('/')}/ipfs/{ipfs_hash}") as response:
response.raise_for_status()
return await response.json()

def _ipfs_fetch_json(self, endpoint: str, ipfs_hash: str) -> dict | list:
def _ipfs_fetch_json(self, endpoint: str, ipfs_hash: str) -> Any:
with ipfshttpclient.connect(
endpoint,
) as client:
Expand Down
Empty file added sw_utils/py.typed
Empty file.
Loading