FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
NewSimpleSQL/NewSimpleSQL/serialize_data.py at main · DevGreem/NewSimpleSQL · GitHub
DevGreem
/
NewSimpleSQL
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
2
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
NewSimpleSQL
/
NewSimpleSQL
/
serialize_data.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
65 lines (46 loc) · 1.58 KB
Breadcrumbs
NewSimpleSQL
/
NewSimpleSQL
/
serialize_data.py
Copy path
File metadata and controls
65 lines (46 loc) · 1.58 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import
pickle
from
sqlite3
import
Blob
class
Module
():
pass
def
Serialize
(
value
:
any
,
serializer
:
Module
=
pickle
)
->
Blob
:
"""_summary_
Serialize an object to a Binary object
Args:
value (any): Value to serialize
serializer (_type_, optional): Module serializer. Defaults to pickle.
Returns:
Blob: Return a Binary
"""
return
serializer
.
dumps
(
value
)
def
Deserialize
(
value
:
any
,
deserializer
:
Module
=
pickle
)
->
any
:
"""_summary_
Deserialize an object
Args:
value (any): Value to deserialize
deserializer (_type_, optional): Module serializer. Defaults to pickle.
Returns:
any: Return a object, but deserialized
"""
return
deserializer
.
loads
(
value
)
class
Serializer
():
def
__init__
(
self
,
serializer
:
Module
=
pickle
):
self
.
__serializer
=
serializer
def
Serialize
(
self
,
value
:
any
):
"""_summary_
Serialize an object to a Binary object
Args:
value (any): Value to serialize
serializer (_type_, optional): Module serializer. Defaults to pickle.
Returns:
Blob: Return a Binary
"""
Serialize
(
value
,
self
.
__serializer
)
def
Deserialize
(
self
,
value
:
any
):
"""_summary_
Deserialize an object
Args:
value (any): Value to deserialize
deserializer (_type_, optional): Module serializer. Defaults to pickle.
Returns:
any: Return a object, but deserialized
"""
Deserialize
(
value
,
self
.
__serializer
)
Back
|
FazBrowse Home
|
New Git URL