@@ -140,7 +140,7 @@ def _get_headers(
140
140
return headers
141
141
142
142
@staticmethod
143
- def is_supported_type_by_file_ext (file_ext : str , is_document : bool = False ) -> bool :
143
+ def is_supported_doc_type_by_file_ext (file_ext : str , is_document : bool = False ) -> bool :
144
144
"""
145
145
Checks if the given file extension is supported.
146
146
@@ -158,7 +158,7 @@ def is_supported_type_by_file_ext(file_ext: str, is_document: bool=False) -> boo
158
158
return file_ext .lower () in supported_types
159
159
160
160
@staticmethod
161
- def is_supported_type_by_file_path (file_path : Path , is_document : bool = False ) -> bool :
161
+ def is_supported_doc_type_by_file_path (file_path : Path , is_document : bool = False ) -> bool :
162
162
"""
163
163
Checks if the given file path has a supported file type.
164
164
@@ -172,7 +172,7 @@ def is_supported_type_by_file_path(file_path: Path, is_document: bool=False) ->
172
172
if not file_path .is_file ():
173
173
return False
174
174
file_ext = file_path .suffix .lower ()
175
- return AzureContentUnderstandingClient .is_supported_type_by_file_ext (file_ext , is_document )
175
+ return AzureContentUnderstandingClient .is_supported_doc_type_by_file_ext (file_ext , is_document )
176
176
177
177
def get_all_analyzers (self ) -> Dict [str , Any ]:
178
178
"""
@@ -332,11 +332,11 @@ def begin_analyze(self, analyzer_id: str, file_location: str) -> Response:
332
332
"data" : base64 .b64encode (f .read_bytes ()).decode ("utf-8" )
333
333
}
334
334
for f in file_path .rglob ("*" )
335
- if f .is_file () and self .is_supported_type_by_file_path (f , is_document = True )
335
+ if f .is_file () and self .is_supported_doc_type_by_file_path (f , is_document = True )
336
336
]
337
337
}
338
338
headers = {"Content-Type" : "application/json" }
339
- elif file_path .is_file () and self . is_supported_type_by_file_path ( file_path ) :
339
+ elif file_path .is_file ():
340
340
with open (file_location , "rb" ) as file :
341
341
data = file .read ()
342
342
headers = {"Content-Type" : "application/octet-stream" }
@@ -453,7 +453,7 @@ def _get_analyze_list(
453
453
for dirpath , _ , filenames in os .walk (reference_docs_folder ):
454
454
for filename in filenames :
455
455
_ , file_ext = os .path .splitext (filename )
456
- if self .is_supported_type_by_file_ext (file_ext , is_document = True ):
456
+ if self .is_supported_doc_type_by_file_ext (file_ext , is_document = True ):
457
457
file_path = os .path .join (dirpath , filename )
458
458
result_file_name = filename + self .OCR_RESULT_FILE_SUFFIX
459
459
analyze_list .append (
@@ -483,7 +483,7 @@ def _get_upload_only_list(
483
483
for dirpath , _ , filenames in os .walk (reference_docs_folder ):
484
484
for filename in filenames :
485
485
_ , file_ext = os .path .splitext (filename )
486
- if self .is_supported_type_by_file_ext (file_ext , is_document = True ):
486
+ if self .is_supported_doc_type_by_file_ext (file_ext , is_document = True ):
487
487
file_path = os .path .join (dirpath , filename )
488
488
result_file_name = filename + self .OCR_RESULT_FILE_SUFFIX
489
489
result_file_path = os .path .join (dirpath , result_file_name )
@@ -505,7 +505,7 @@ def _get_upload_only_list(
505
505
if original_filename in filenames :
506
506
# skip result.json files corresponding to the file with supported document type
507
507
_ , original_file_ext = os .path .splitext (original_filename )
508
- if self .is_supported_type_by_file_ext (original_file_ext , is_document = True ):
508
+ if self .is_supported_doc_type_by_file_ext (original_file_ext , is_document = True ):
509
509
continue
510
510
else :
511
511
raise ValueError (
0 commit comments