(self, file, pattern_list: List, with_filter: bool, limit: int, get_buffer, save_image)
| 47 | return False |
| 48 | |
| 49 | def handle(self, file, pattern_list: List, with_filter: bool, limit: int, get_buffer, save_image): |
| 50 | buffer = get_buffer(file) |
| 51 | if type(limit) is str: |
| 52 | limit = int(limit) |
| 53 | if type(with_filter) is str: |
| 54 | with_filter = with_filter.lower() == 'true' |
| 55 | if pattern_list is not None and len(pattern_list) > 0: |
| 56 | split_model = SplitModel(pattern_list, with_filter, limit) |
| 57 | else: |
| 58 | split_model = SplitModel(default_pattern_list, with_filter=with_filter, limit=limit) |
| 59 | try: |
| 60 | content = buffer.decode(detect(buffer)['encoding']) |
| 61 | except BaseException as e: |
| 62 | maxkb_logger.error(f"Error processing TEXT file {file.name}: {e}, {traceback.format_exc()}") |
| 63 | return {'name': file.name, 'content': []} |
| 64 | return {'name': file.name, 'content': split_model.parse(content)} |
| 65 | |
| 66 | def get_content(self, file, save_image): |
| 67 | buffer = file.read() |
nothing calls this directly
no test coverage detected