LazyWriter
Source code in src/msglc/writer.py
| Python | |
|---|---|
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | |
__init__(buffer_or_path, packer=None, *, s3fs=None)
It is possible to provide a custom packer object to be used for packing the object.
However, this packer must be compatible with the msgpack packer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
buffer_or_path
|
str | BufferWriter
|
target buffer or file path |
required |
packer
|
Packer
|
packer object to be used for packing the object |
None
|
s3fs
|
s3fs object (s3fs.S3FileSystem) to be used for storing |
None
|
Source code in src/msglc/writer.py
write(obj)
This function is used to write the object to the file.
Only one write is allowed. The function raises a ValueError if it is called more than once.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
obj
|
the object to be written to the file |
required |
Returns:
| Type | Description |
|---|---|
None
|
None |
Raises:
| Type | Description |
|---|---|
ValueError
|
if the function is called more than once |