@@ -44,20 +44,72 @@ class File(BaseModel):
4444 arbitrary_types_allowed = True ,
4545 )
4646
47- filepath : str = Field (..., exclude = True )
48- handler : Union [BytesIO , StringIO , IO , None ] = Field (default = None , exclude = True )
49- description : str = ""
50- directory_label : str = Field (default = "" , alias = "directoryLabel" )
51- mimeType : str = "application/octet-stream"
52- categories : Optional [List [str ]] = ["DATA" ]
53- restrict : bool = False
54- checksum_type : ChecksumTypes = Field (default = ChecksumTypes .MD5 , exclude = True )
55- storageIdentifier : Optional [str ] = None
56- file_name : Optional [str ] = Field (default = None , alias = "fileName" )
57- checksum : Optional [Checksum ] = None
58- to_replace : bool = False
59- file_id : Optional [Union [str , int ]] = Field (default = None , alias = "fileToReplaceId" )
60- tab_ingest : bool = Field (default = True , alias = "tabIngest" )
47+ filepath : str = Field (
48+ ...,
49+ exclude = True ,
50+ description = "The path to the file" ,
51+ )
52+ handler : Union [BytesIO , StringIO , IO , None ] = Field (
53+ default = None ,
54+ exclude = True ,
55+ description = "File handler for reading the file contents" ,
56+ )
57+ description : Optional [str ] = Field (
58+ default = None ,
59+ alias = "description" ,
60+ description = "The description of the file" ,
61+ )
62+ directory_label : Optional [str ] = Field (
63+ default = None ,
64+ alias = "directoryLabel" ,
65+ description = "The label of the directory where the file is stored" ,
66+ )
67+ mimeType : str = Field (
68+ default = "application/octet-stream" ,
69+ description = "The MIME type of the file" ,
70+ )
71+ categories : Optional [List [str ]] = Field (
72+ default = ["DATA" ],
73+ alias = "categories" ,
74+ description = "The categories associated with the file" ,
75+ )
76+ restrict : bool = Field (
77+ default = False ,
78+ alias = "restrict" ,
79+ description = "Indicates if the file is restricted" ,
80+ )
81+ checksum_type : ChecksumTypes = Field (
82+ default = ChecksumTypes .MD5 ,
83+ exclude = True ,
84+ description = "The type of checksum used for the file" ,
85+ )
86+ storageIdentifier : Optional [str ] = Field (
87+ default = None ,
88+ description = "The identifier of the storage where the file is stored" ,
89+ )
90+ file_name : Optional [str ] = Field (
91+ default = None ,
92+ alias = "fileName" ,
93+ description = "The name of the file" ,
94+ )
95+ checksum : Optional [Checksum ] = Field (
96+ default = None ,
97+ description = "The checksum of the file" ,
98+ )
99+ file_id : Optional [Union [str , int ]] = Field (
100+ default = None ,
101+ alias = "fileToReplaceId" ,
102+ description = "The ID of the file to replace" ,
103+ )
104+ tab_ingest : bool = Field (
105+ default = True ,
106+ alias = "tabIngest" ,
107+ description = "Indicates if tabular ingest should be performed" ,
108+ )
109+ to_replace : bool = Field (
110+ default = False ,
111+ description = "Indicates if the file should be replaced" ,
112+ )
61113
62114 _size : int = PrivateAttr (default = 0 )
63115 _unchanged_data : bool = PrivateAttr (default = False )
@@ -126,7 +178,6 @@ def apply_checksum(self):
126178
127179 self .checksum .apply_checksum ()
128180
129-
130181 def update_checksum_chunked (self , blocksize = 2 ** 20 ):
131182 """Updates the checksum with data read from a file-like object in chunks.
132183
@@ -155,7 +206,6 @@ def update_checksum_chunked(self, blocksize=2**20):
155206
156207 self .handler .seek (0 )
157208
158-
159209 def __del__ (self ):
160210 if self .handler is not None :
161211 self .handler .close ()
0 commit comments