solax-py-library 1.0.0.6__py3-none-any.whl → 1.0.0.8__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -55,13 +55,13 @@ class FTPUploadService(BaseUploadService):
55
55
  print("Connection closed.")
56
56
 
57
57
  def _parse(self, upload_data: FTPData) -> FTPParsedData:
58
- if upload_data.file_type == FTPFileType.CSV:
58
+ if upload_data.file_type == FTPFileType.CSV.value:
59
59
  parsed_data = CSVDataAdapter.parse_data(upload_data.data)
60
60
  else:
61
61
  raise NotImplementedError
62
62
  return FTPParsedData(
63
63
  file_name=upload_data.build_full_path(self.remote_path)
64
- + upload_data.file_type.get_file_suffix(),
64
+ + FTPFileType.get_file_suffix(upload_data.file_type),
65
65
  file_path=parsed_data,
66
66
  )
67
67
 
@@ -21,7 +21,7 @@ class FTPTest(unittest.TestCase):
21
21
  upload_type=UploadType.FTP,
22
22
  data=dict(
23
23
  file_type=FTPFileType.CSV,
24
- file_name="new_file.csv",
24
+ file_name="new_file",
25
25
  data=[
26
26
  {
27
27
  "EMS1000序列号": "XMG11A011L",
@@ -1,17 +1,17 @@
1
- from enum import Enum
1
+ from enum import IntEnum
2
2
  from pydantic import BaseModel
3
3
  from typing import Optional, Union
4
4
 
5
5
  from solax_py_library.upload.types.ftp import FTPData
6
6
 
7
7
 
8
- class UploadType(str, Enum):
9
- FTP = "FTP"
8
+ class UploadType(IntEnum):
9
+ FTP = 1
10
10
 
11
11
 
12
12
  class UploadData(BaseModel):
13
13
  data: Optional[Union[dict, FTPData]]
14
- upload_type: Optional[UploadType]
14
+ upload_type: UploadType
15
15
 
16
16
  def build_data(self):
17
17
  dict_obj_data = self.data if isinstance(self.data, dict) else self.data.dict()
@@ -1,17 +1,18 @@
1
1
  import os
2
- from enum import Enum
2
+ from enum import IntEnum
3
3
  from typing import Any, Optional
4
4
 
5
5
  from pydantic import BaseModel
6
6
 
7
7
 
8
- class FTPFileType(str, Enum):
9
- CSV = "CSV"
8
+ class FTPFileType(IntEnum):
9
+ CSV = 1
10
10
 
11
- def get_file_suffix(self):
11
+ @classmethod
12
+ def get_file_suffix(cls, value):
12
13
  return {
13
- FTPFileType.CSV: ".csv",
14
- }.get(self)
14
+ FTPFileType.CSV.value: ".csv",
15
+ }.get(value)
15
16
 
16
17
 
17
18
  class FTPData(BaseModel):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: solax-py-library
3
- Version: 1.0.0.6
3
+ Version: 1.0.0.8
4
4
  Summary: some common tool
5
5
  Author: shenlvyu
6
6
  Author-email: 13296718439@163.com
@@ -8,15 +8,15 @@ solax_py_library/upload/core/data_adapter/base.py,sha256=Va-SEe0eL3gobhNOnzHGkYB
8
8
  solax_py_library/upload/core/data_adapter/csv.py,sha256=8nlnV_43mMAR3re50MQJymzT5HYpZOo7eSeMsEfnEVE,861
9
9
  solax_py_library/upload/core/upload_service/__init__.py,sha256=uA-UeH31rDNxByeZwvPhNFHPV_-J8JyCev8geuc---k,269
10
10
  solax_py_library/upload/core/upload_service/base.py,sha256=dxCBVtPxDhN7oRTjnwnjtc2XAF4hyIz9HsYCJePlggg,912
11
- solax_py_library/upload/core/upload_service/ftp.py,sha256=dBIf2ZiwYG3KEalVPK5PcYtVhce4fALndHNnFmS8iJI,2674
11
+ solax_py_library/upload/core/upload_service/ftp.py,sha256=QdGA-1OW2z-fkIWtjz_9O5gOKMNr1WjQ6NDrtea5E5s,2691
12
12
  solax_py_library/upload/errors/__init__.py,sha256=pVAcSOXvlsPJW3PjHLBOdbl7KvntiYmz7TP0XuRwZ_A,243
13
13
  solax_py_library/upload/errors/base.py,sha256=T01ZrZHF25PWgCrOv76Vhg26hds3I1Yy8Kl2LZRKOxo,258
14
14
  solax_py_library/upload/errors/upload_error.py,sha256=9pCZzR_y3-VkBWSs5w7mMHYFRJjzVosIcxi-5SO8N1U,409
15
15
  solax_py_library/upload/test/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
- solax_py_library/upload/test/test_ftp.py,sha256=lCuPgi1VOW_JTq9m7tlyxhR64x4oE0F1y0Dlv9lmz0I,1298
16
+ solax_py_library/upload/test/test_ftp.py,sha256=kKzZ8AuDR-TXpn45Bv_-SqeyCEY2kh7MZKB1bbtI2Tk,1294
17
17
  solax_py_library/upload/types/__init__.py,sha256=og9KBpYbcs36_S1izURj3vyHeuNOLJQrD9GpxK_JJaw,244
18
- solax_py_library/upload/types/client.py,sha256=IE4tw2KFRmZABptmujB7SXG2-61cW7X7qN9b2IrBF3Y,505
19
- solax_py_library/upload/types/ftp.py,sha256=APxneZ9m1OwImr3xZWnNkhxlh5Wy5rNCdegcVuOLyEM,644
20
- solax_py_library-1.0.0.6.dist-info/METADATA,sha256=nTuZzLszbr8e6gy6vHuqJmYr4uL_dSpF4LRTdLRx564,1791
21
- solax_py_library-1.0.0.6.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
22
- solax_py_library-1.0.0.6.dist-info/RECORD,,
18
+ solax_py_library/upload/types/client.py,sha256=fG674_QEpOw3ibO171lcxJ0cz27yGR_sd3zgiyr4yuI,492
19
+ solax_py_library/upload/types/ftp.py,sha256=nOloYA_OHoGma1yg5ENWHzfIWK2hoBEwyoyJ72yRZjY,671
20
+ solax_py_library-1.0.0.8.dist-info/METADATA,sha256=Xxdv_wuNlPDUpELYrBoQLQ0VltX_UyCN1D7B6az6e0w,1791
21
+ solax_py_library-1.0.0.8.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
22
+ solax_py_library-1.0.0.8.dist-info/RECORD,,