@@ -52,7 +52,6 @@ class Image(AsyncFileBase):
5252@dataclass
5353class Video (AsyncFileBase ):
5454 type : Literal [AttachmentTypes .VIDEO ]
55-
5655 duration : int
5756
5857
@@ -64,7 +63,6 @@ class Document(AsyncFileBase):
6463@dataclass
6564class Voice (AsyncFileBase ):
6665 type : Literal [AttachmentTypes .VOICE ]
67-
6866 duration : int
6967
7068
@@ -78,12 +76,6 @@ class APIAsyncFileBase(VerifiedPayloadBaseModel):
7876 file_hash : str
7977
8078 class Config :
81- """BotX sends extra fields which are used by client only.
82-
83- We skip their validation, but extra fields will be saved during
84- serialization/deserialization.
85- """
86-
8779 extra = "allow"
8880
8981
@@ -93,7 +85,6 @@ class ApiAsyncFileImage(APIAsyncFileBase):
9385
9486class ApiAsyncFileVideo (APIAsyncFileBase ):
9587 type : Literal [APIAttachmentTypes .VIDEO ]
96-
9788 duration : int
9889
9990
@@ -103,7 +94,6 @@ class ApiAsyncFileDocument(APIAsyncFileBase):
10394
10495class ApiAsyncFileVoice (APIAsyncFileBase ):
10596 type : Literal [APIAttachmentTypes .VOICE ]
106-
10797 duration : int
10898
10999
@@ -121,7 +111,6 @@ def convert_async_file_from_domain(file: File) -> APIAsyncFile:
121111 attachment_type = convert_attachment_type_from_domain (file .type )
122112
123113 if attachment_type == APIAttachmentTypes .IMAGE :
124- attachment_type = cast (Literal [APIAttachmentTypes .IMAGE ], attachment_type )
125114 file = cast (Image , file )
126115
127116 return ApiAsyncFileImage (
@@ -135,7 +124,6 @@ def convert_async_file_from_domain(file: File) -> APIAsyncFile:
135124 )
136125
137126 if attachment_type == APIAttachmentTypes .VIDEO :
138- attachment_type = cast (Literal [APIAttachmentTypes .VIDEO ], attachment_type )
139127 file = cast (Video , file )
140128
141129 return ApiAsyncFileVideo (
@@ -150,7 +138,6 @@ def convert_async_file_from_domain(file: File) -> APIAsyncFile:
150138 )
151139
152140 if attachment_type == APIAttachmentTypes .DOCUMENT :
153- attachment_type = cast (Literal [APIAttachmentTypes .DOCUMENT ], attachment_type )
154141 file = cast (Document , file )
155142
156143 return ApiAsyncFileDocument (
@@ -164,7 +151,6 @@ def convert_async_file_from_domain(file: File) -> APIAsyncFile:
164151 )
165152
166153 if attachment_type == APIAttachmentTypes .VOICE :
167- attachment_type = cast (Literal [APIAttachmentTypes .VOICE ], attachment_type )
168154 file = cast (Voice , file )
169155
170156 return ApiAsyncFileVoice (
@@ -185,7 +171,6 @@ def convert_async_file_to_domain(async_file: APIAsyncFile) -> File:
185171 attachment_type = convert_attachment_type_to_domain (async_file .type )
186172
187173 if attachment_type == AttachmentTypes .IMAGE :
188- attachment_type = cast (Literal [AttachmentTypes .IMAGE ], attachment_type )
189174 async_file = cast (ApiAsyncFileImage , async_file )
190175
191176 return Image (
@@ -200,7 +185,6 @@ def convert_async_file_to_domain(async_file: APIAsyncFile) -> File:
200185 )
201186
202187 if attachment_type == AttachmentTypes .VIDEO :
203- attachment_type = cast (Literal [AttachmentTypes .VIDEO ], attachment_type )
204188 async_file = cast (ApiAsyncFileVideo , async_file )
205189
206190 return Video (
@@ -216,7 +200,6 @@ def convert_async_file_to_domain(async_file: APIAsyncFile) -> File:
216200 )
217201
218202 if attachment_type == AttachmentTypes .DOCUMENT :
219- attachment_type = cast (Literal [AttachmentTypes .DOCUMENT ], attachment_type )
220203 async_file = cast (ApiAsyncFileDocument , async_file )
221204
222205 return Document (
@@ -231,7 +214,6 @@ def convert_async_file_to_domain(async_file: APIAsyncFile) -> File:
231214 )
232215
233216 if attachment_type == AttachmentTypes .VOICE :
234- attachment_type = cast (Literal [AttachmentTypes .VOICE ], attachment_type )
235217 async_file = cast (ApiAsyncFileVoice , async_file )
236218
237219 return Voice (
0 commit comments