solax-py-library 1.0.0.6__tar.gz → 1.0.0.7__tar.gz
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.
- {solax_py_library-1.0.0.6 → solax_py_library-1.0.0.7}/PKG-INFO +1 -1
- {solax_py_library-1.0.0.6 → solax_py_library-1.0.0.7}/pyproject.toml +1 -1
- {solax_py_library-1.0.0.6 → solax_py_library-1.0.0.7}/solax_py_library/upload/core/upload_service/ftp.py +3 -3
- {solax_py_library-1.0.0.6 → solax_py_library-1.0.0.7}/solax_py_library/upload/test/test_ftp.py +4 -4
- {solax_py_library-1.0.0.6 → solax_py_library-1.0.0.7}/solax_py_library/upload/types/client.py +5 -5
- {solax_py_library-1.0.0.6 → solax_py_library-1.0.0.7}/solax_py_library/upload/types/ftp.py +7 -6
- {solax_py_library-1.0.0.6 → solax_py_library-1.0.0.7}/README.md +0 -0
- {solax_py_library-1.0.0.6 → solax_py_library-1.0.0.7}/solax_py_library/__init__.py +0 -0
- {solax_py_library-1.0.0.6 → solax_py_library-1.0.0.7}/solax_py_library/upload/__init__.py +0 -0
- {solax_py_library-1.0.0.6 → solax_py_library-1.0.0.7}/solax_py_library/upload/api/__init__.py +0 -0
- {solax_py_library-1.0.0.6 → solax_py_library-1.0.0.7}/solax_py_library/upload/api/service.py +0 -0
- {solax_py_library-1.0.0.6 → solax_py_library-1.0.0.7}/solax_py_library/upload/core/__init__.py +0 -0
- {solax_py_library-1.0.0.6 → solax_py_library-1.0.0.7}/solax_py_library/upload/core/data_adapter/__init__.py +0 -0
- {solax_py_library-1.0.0.6 → solax_py_library-1.0.0.7}/solax_py_library/upload/core/data_adapter/base.py +0 -0
- {solax_py_library-1.0.0.6 → solax_py_library-1.0.0.7}/solax_py_library/upload/core/data_adapter/csv.py +0 -0
- {solax_py_library-1.0.0.6 → solax_py_library-1.0.0.7}/solax_py_library/upload/core/upload_service/__init__.py +0 -0
- {solax_py_library-1.0.0.6 → solax_py_library-1.0.0.7}/solax_py_library/upload/core/upload_service/base.py +0 -0
- {solax_py_library-1.0.0.6 → solax_py_library-1.0.0.7}/solax_py_library/upload/errors/__init__.py +0 -0
- {solax_py_library-1.0.0.6 → solax_py_library-1.0.0.7}/solax_py_library/upload/errors/base.py +0 -0
- {solax_py_library-1.0.0.6 → solax_py_library-1.0.0.7}/solax_py_library/upload/errors/upload_error.py +0 -0
- {solax_py_library-1.0.0.6 → solax_py_library-1.0.0.7}/solax_py_library/upload/test/__init__.py +0 -0
- {solax_py_library-1.0.0.6 → solax_py_library-1.0.0.7}/solax_py_library/upload/types/__init__.py +0 -0
@@ -18,7 +18,7 @@ from solax_py_library.upload.errors.upload_error import (
|
|
18
18
|
|
19
19
|
|
20
20
|
class FTPUploadService(BaseUploadService):
|
21
|
-
upload_type = UploadType.FTP
|
21
|
+
upload_type = UploadType.FTP.value
|
22
22
|
|
23
23
|
def __init__(self, **kwargs):
|
24
24
|
super().__init__(**kwargs)
|
@@ -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
|
64
|
+
+ FTPFileType.get_file_suffix(upload_data.file_type),
|
65
65
|
file_path=parsed_data,
|
66
66
|
)
|
67
67
|
|
{solax_py_library-1.0.0.6 → solax_py_library-1.0.0.7}/solax_py_library/upload/test/test_ftp.py
RENAMED
@@ -15,13 +15,13 @@ class FTPTest(unittest.TestCase):
|
|
15
15
|
"remote_path": "/xixi",
|
16
16
|
}
|
17
17
|
asyncio.run(upload(
|
18
|
-
upload_type=UploadType.FTP,
|
18
|
+
upload_type=UploadType.FTP.value,
|
19
19
|
configuration=ftp_config,
|
20
20
|
upload_data=UploadData(
|
21
|
-
upload_type=UploadType.FTP,
|
21
|
+
upload_type=UploadType.FTP.value,
|
22
22
|
data=dict(
|
23
|
-
file_type=FTPFileType.CSV,
|
24
|
-
file_name="new_file
|
23
|
+
file_type=FTPFileType.CSV.value,
|
24
|
+
file_name="new_file",
|
25
25
|
data=[
|
26
26
|
{
|
27
27
|
"EMS1000序列号": "XMG11A011L",
|
{solax_py_library-1.0.0.6 → solax_py_library-1.0.0.7}/solax_py_library/upload/types/client.py
RENAMED
@@ -1,19 +1,19 @@
|
|
1
|
-
from enum import
|
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(
|
9
|
-
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:
|
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()
|
18
|
-
if self.upload_type == UploadType.FTP:
|
18
|
+
if self.upload_type == UploadType.FTP.value:
|
19
19
|
return FTPData(**dict_obj_data)
|
@@ -1,17 +1,18 @@
|
|
1
1
|
import os
|
2
|
-
from enum import
|
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(
|
9
|
-
CSV =
|
8
|
+
class FTPFileType(IntEnum):
|
9
|
+
CSV = 1
|
10
10
|
|
11
|
-
|
11
|
+
@classmethod
|
12
|
+
def get_file_suffix(cls, value):
|
12
13
|
return {
|
13
|
-
FTPFileType.CSV: ".csv",
|
14
|
-
}.get(
|
14
|
+
FTPFileType.CSV.value: ".csv",
|
15
|
+
}.get(value)
|
15
16
|
|
16
17
|
|
17
18
|
class FTPData(BaseModel):
|
File without changes
|
File without changes
|
File without changes
|
{solax_py_library-1.0.0.6 → solax_py_library-1.0.0.7}/solax_py_library/upload/api/__init__.py
RENAMED
File without changes
|
{solax_py_library-1.0.0.6 → solax_py_library-1.0.0.7}/solax_py_library/upload/api/service.py
RENAMED
File without changes
|
{solax_py_library-1.0.0.6 → solax_py_library-1.0.0.7}/solax_py_library/upload/core/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{solax_py_library-1.0.0.6 → solax_py_library-1.0.0.7}/solax_py_library/upload/errors/__init__.py
RENAMED
File without changes
|
{solax_py_library-1.0.0.6 → solax_py_library-1.0.0.7}/solax_py_library/upload/errors/base.py
RENAMED
File without changes
|
{solax_py_library-1.0.0.6 → solax_py_library-1.0.0.7}/solax_py_library/upload/errors/upload_error.py
RENAMED
File without changes
|
{solax_py_library-1.0.0.6 → solax_py_library-1.0.0.7}/solax_py_library/upload/test/__init__.py
RENAMED
File without changes
|
{solax_py_library-1.0.0.6 → solax_py_library-1.0.0.7}/solax_py_library/upload/types/__init__.py
RENAMED
File without changes
|