22
33import os
44import io
5- from typing import List
6- from .functions import upload as d , types as t , deal_status , get_uploads as getUploads , download as _download
5+ from .functions import upload as d ,deal_status , get_uploads as getUploads , download as _download
76
87
98class Lighthouse :
@@ -14,7 +13,7 @@ def __init__(self, token: str = ""):
1413 "No token provided: Please provide a token or set the LIGHTHOUSE_TOKEN environment variable"
1514 )
1615
17- def upload (self , source : str , tag : str = '' ) -> t . Upload :
16+ def upload (self , source : str , tag : str = '' ):
1817 """
1918 Upload a file or directory to the Lighthouse.
2019
@@ -26,7 +25,7 @@ def upload(self, source: str, tag: str = '') -> t.Upload:
2625 except Exception as e :
2726 raise e
2827
29- def uploadBlob (self , source : io .BufferedReader , filename : str , tag : str = '' ) -> t . Upload :
28+ def uploadBlob (self , source : io .BufferedReader , filename : str , tag : str = '' ):
3029 """
3130 Upload Blob a file or directory to the Lighthouse.
3231
@@ -41,14 +40,13 @@ def uploadBlob(self, source: io.BufferedReader, filename: str, tag: str = '') ->
4140 raise e
4241
4342 @staticmethod
44- def downloadBlob (dist : io .BufferedWriter , cid : str , chunk_size = 1024 * 1024 * 10 ) -> t . Upload :
43+ def downloadBlob (dist : io .BufferedWriter , cid : str , chunk_size = 1024 * 1024 * 10 ):
4544 """
4645 Download a Blob (file or directory) from the Lighthouse.
4746
4847 :param dist: BufferedWriter, destination to write the downloaded data
4948 :param cid: str, Content Identifier for the data to be downloaded
5049 :param chunk_size: int, size of chunks in which the file will be downloaded (default: 10MB)
51- :param useCidAsTag: bool, flag to use CID as a tag (default: False)
5250 :return: t.Upload, the download result
5351 """
5452 if not (hasattr (dist , 'read' ) and hasattr (dist , 'close' )):
@@ -57,24 +55,9 @@ def downloadBlob(dist: io.BufferedWriter, cid: str, chunk_size=1024*1024*10) ->
5755 return _download .download_file_into_writable (cid , dist , chunk_size )
5856 except Exception as e :
5957 raise e
60-
61- @staticmethod
62- def downloadBlob (dist : io .BufferedWriter , cid : str , chunk_size = 1024 * 1024 * 10 ) -> t .Upload :
63- """
64- Download Blob a file or directory to the Lighthouse.
65-
66- :param source: str, path to file or directory
67- :return: t.Upload, the upload result
68- """
69- if not (hasattr (dist , 'read' ) and hasattr (dist , 'close' )):
70- raise TypeError ("source must have 'read' and 'close' methods" )
71- try :
72- return _download .download_file_into_writable (cid , dist , chunk_size )
73- except Exception as e :
74- raise e
75-
58+
7659 @staticmethod
77- def getDealStatus (cid : str ) -> List [ t . DealData ] :
60+ def getDealStatus (cid : str ):
7861 """
7962 Get deal status from the Lighthouse.
8063
@@ -87,7 +70,7 @@ def getDealStatus(cid: str) -> List[t.DealData]:
8770 raise e
8871
8972 @staticmethod
90- def getUploads (publicKey : str , pageNo : int = 1 ) -> List [ t . DealData ] :
73+ def getUploads (publicKey : str , pageNo : int = 1 ):
9174 """
9275 Get uploads from the Lighthouse.
9376
@@ -101,7 +84,7 @@ def getUploads(publicKey: str, pageNo: int = 1) -> List[t.DealData]:
10184 raise e
10285
10386 @staticmethod
104- def download (cid : str ) -> bytes :
87+ def download (cid : str ):
10588 """
10689 Download content from the Lighthouse using its Content Identifier (CID).
10790
@@ -114,7 +97,7 @@ def download(cid: str) -> bytes:
11497 except Exception as e :
11598 raise e
11699
117- def getTagged (self , tag : str ) -> t . Upload :
100+ def getTagged (self , tag : str ):
118101 """
119102 Retrieve an upload from the Lighthouse using its tag.
120103
0 commit comments