@@ -60,46 +60,44 @@ def getvalue(self):
60
60
61
61
DEFAULT_RECURSE_LIMIT = 511
62
62
63
- def pack (o , stream , default = None , encoding = 'utf-8' , unicode_errors = 'strict' ):
64
- """ Pack object `o` and write it to `stream` """
65
- packer = Packer (default = default , encoding = encoding ,
66
- unicode_errors = unicode_errors )
63
+ def pack (o , stream , ** kwargs ):
64
+ """
65
+ Pack object `o` and write it to `stream`
66
+
67
+ See :class:`Packer` for options.
68
+ """
69
+ packer = Packer (** kwargs )
67
70
stream .write (packer .pack (o ))
68
71
69
- def packb (o , default = None , encoding = 'utf-8' , unicode_errors = 'struct' ,
70
- use_single_float = False ):
71
- """ Pack object `o` and return packed bytes """
72
- packer = Packer (default = default ,
73
- encoding = encoding ,
74
- unicode_errors = unicode_errors ,
75
- use_single_float = use_single_float )
76
- return packer .pack (o )
77
-
78
- def unpack (stream , object_hook = None , list_hook = None , use_list = True ,
79
- encoding = None , unicode_errors = 'strict' ,
80
- object_pairs_hook = None ):
81
- """ Unpack an object from `stream`.
82
-
83
- Raises `ExtraData` when `stream` has extra bytes. """
84
- unpacker = Unpacker (stream , object_hook = object_hook , list_hook = list_hook ,
85
- use_list = use_list ,
86
-
8000
encoding = encoding , unicode_errors = unicode_errors ,
87
- object_pairs_hook = object_pairs_hook )
72
+ def packb (o , ** kwargs ):
73
+ """
74
+ Pack object `o` and return packed bytes
75
+
76
+ See :class:`Packer` for options.
77
+ """
78
+ return Packer (** kwargs ).pack (o )
79
+
80
+ def unpack (stream , ** kwargs ):
81
+ """
82
+ Unpack an object from `stream`.
83
+
84
+ Raises `ExtraData` when `packed` contains extra bytes.
85
+ See :class:`Unpacker` for options.
86
+ """
87
+ unpacker = Unpacker (stream , ** kwargs )
88
88
ret = unpacker ._fb_unpack ()
89
89
if unpacker ._fb_got_extradata ():
90
90
raise ExtraData (ret , unpacker ._fb_get_extradata ())
91
91
return ret
92
92
93
- def unpackb (packed , object_hook = None , list_hook = None , use_list = True ,
94
- encoding = None , unicode_errors = 'strict' ,
95
- object_pairs_hook = None ):
96
- """ Unpack an object from `packed`.
93
+ def unpackb (packed , ** kwargs ):
94
+ """
95
+ Unpack an object from `packed`.
97
96
98
- Raises `ExtraData` when `packed` contains extra bytes. """
99
- unpacker = Unpacker (None , object_hook = object_hook , list_hook = list_hook ,
100
- use_list = use_list ,
101
- encoding = encoding , unicode_errors = unicode_errors ,
102
- object_pairs_hook = object_pairs_hook )
97
+ Raises `ExtraData` when `packed` contains extra bytes.
98
+ See :class:`Unpacker` for options.
99
+ """
100
+ unpacker = Unpacker (None , ** kwargs )
103
101
unpacker .feed (packed )
104
102
try :
105
103
ret = unpacker ._fb_unpack ()
0 commit comments