fix
This commit is contained in:
@@ -29,4 +29,4 @@ class Converter(ABC):
|
||||
...
|
||||
|
||||
async def convert_async(self, document: Document) -> Document:
|
||||
...
|
||||
...
|
||||
@@ -1,4 +1,7 @@
|
||||
from docutranslate.converter.base import Converter
|
||||
from dataclasses import dataclass
|
||||
from typing import Hashable
|
||||
|
||||
from docutranslate.converter.base import Converter, ConverterConfig
|
||||
from docutranslate.ir.document import Document
|
||||
|
||||
|
||||
|
||||
@@ -1,17 +1,24 @@
|
||||
import asyncio
|
||||
import csv
|
||||
import logging
|
||||
from dataclasses import dataclass
|
||||
from io import BytesIO, StringIO
|
||||
from typing import Hashable
|
||||
|
||||
# 引入 chardet 用于编码检测
|
||||
import chardet
|
||||
import openpyxl
|
||||
from docutranslate.converter.x2xlsx.base import X2XlsxConverter
|
||||
|
||||
from docutranslate.converter.x2xlsx.base import X2XlsxConverter, X2XlsxConverterConfig
|
||||
from docutranslate.ir.document import Document
|
||||
|
||||
|
||||
# 配置一个基本的日志记录器(如果您的项目尚未配置)
|
||||
# logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
||||
@dataclass(kw_only=True)
|
||||
class ConverterCsv2XlsxConfig(X2XlsxConverterConfig):
|
||||
|
||||
def gethash(self) -> Hashable:
|
||||
return "1"
|
||||
|
||||
|
||||
class ConverterCsv2Xlsx(X2XlsxConverter):
|
||||
@@ -25,6 +32,8 @@ class ConverterCsv2Xlsx(X2XlsxConverter):
|
||||
- 完善的错误处理和日志记录。
|
||||
"""
|
||||
|
||||
def __init__(self, config: ConverterCsv2XlsxConfig):
|
||||
super().__init__(config=config)
|
||||
|
||||
def convert(self, document: Document) -> Document:
|
||||
"""
|
||||
@@ -107,4 +116,4 @@ class ConverterCsv2Xlsx(X2XlsxConverter):
|
||||
"""
|
||||
声明此转换器支持的源文件格式。
|
||||
"""
|
||||
return [".csv"]
|
||||
return [".csv"]
|
||||
|
||||
Reference in New Issue
Block a user