diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..32f43b7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +**/*.egg-info +*.pyc +.idea +.venv +site +src/msglc/*.c +src/msglc/*.so diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/404.html b/404.html new file mode 100644 index 0000000..0a5ddbc --- /dev/null +++ b/404.html @@ -0,0 +1,587 @@ + + + +
+ + + + + + + + + + + + + + + + +src/msglc/writer.py
Python | |
---|---|
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 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 |
|
__init__(buffer_or_path, *, mode='w')
+
+The mode resembles typical mode designations and implies the same meaning. +If the mode is 'w', the file is overwritten. +If the mode is 'a', the file is appended.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
+ buffer_or_path
+ |
+
+ str | BufferWriter
+ |
+
+
+
+ target buffer or file path + |
+ + required + | +
+ mode
+ |
+
+ Literal['a', 'w']
+ |
+
+
+
+ mode of operation, 'w' for write and 'a' for append + |
+
+ 'w'
+ |
+
src/msglc/writer.py
write(obj, name=None)
+
+Write a number of objects to the file.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
+ obj
+ |
+
+ Generator
+ |
+
+
+
+ a generator of objects to be written to the file + |
+ + required + | +
+ name
+ |
+
+ str | None
+ |
+
+
+
+ a name to be assigned to the object, only required when combining in dict mode + |
+
+ None
+ |
+
src/msglc/writer.py
+ Bases: LazyItem
src/msglc/reader.py
Python | |
---|---|
445 +446 +447 +448 +449 +450 +451 +452 +453 +454 +455 +456 +457 +458 +459 +460 +461 +462 +463 +464 +465 +466 +467 +468 +469 +470 +471 +472 +473 +474 +475 +476 +477 +478 +479 +480 +481 +482 +483 +484 +485 +486 +487 +488 +489 +490 +491 +492 +493 +494 +495 +496 +497 +498 +499 +500 +501 +502 +503 +504 +505 +506 +507 +508 +509 +510 +511 +512 +513 +514 +515 +516 +517 +518 +519 +520 +521 +522 +523 +524 +525 +526 +527 +528 +529 +530 +531 +532 +533 +534 +535 +536 +537 +538 +539 +540 +541 +542 +543 +544 +545 +546 +547 +548 +549 +550 +551 +552 +553 +554 +555 +556 +557 +558 +559 +560 +561 +562 +563 +564 +565 +566 +567 +568 +569 +570 +571 +572 +573 +574 +575 +576 +577 +578 +579 +580 +581 +582 +583 +584 +585 +586 +587 +588 +589 +590 +591 +592 +593 +594 +595 +596 +597 +598 +599 +600 +601 +602 +603 +604 +605 +606 +607 +608 +609 +610 +611 +612 +613 +614 +615 +616 +617 +618 +619 +620 +621 +622 +623 +624 +625 +626 +627 +628 +629 +630 +631 +632 +633 +634 +635 +636 +637 +638 +639 +640 +641 +642 +643 +644 +645 +646 +647 +648 +649 +650 +651 +652 +653 +654 +655 +656 +657 +658 +659 +660 +661 +662 +663 +664 +665 +666 +667 +668 +669 +670 +671 +672 +673 +674 +675 +676 +677 +678 +679 +680 +681 +682 +683 +684 +685 |
|
__init__(buffer_or_path, *, counter=None, cached=True, unpacker=None)
+
+It is possible to use a customized unpacker.
+Please inherit the Unpacker
class from the unpacker.py
.
+There are already several unpackers available using different libraries.
Python | |
---|---|
Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
+ buffer_or_path
+ |
+
+ str | BufferReader
+ |
+
+
+
+ the buffer or path to the file + |
+ + required + | +
+ counter
+ |
+
+ LazyStats | None
+ |
+
+
+
+ the counter object for tracking the number of bytes read + |
+
+ None
+ |
+
+ cached
+ |
+
+ bool
+ |
+
+
+
+ whether to cache the data + |
+
+ True
+ |
+
+ unpacker
+ |
+
+ Unpacker | None
+ |
+
+
+
+ the unpacker object for reading the data + |
+
+ None
+ |
+
src/msglc/reader.py
Python | |
---|---|
446 +447 +448 +449 +450 +451 +452 +453 +454 +455 +456 +457 +458 +459 +460 +461 +462 +463 +464 +465 +466 +467 +468 +469 +470 +471 +472 +473 +474 +475 +476 +477 +478 +479 +480 +481 +482 +483 +484 +485 +486 +487 +488 +489 +490 +491 +492 +493 +494 +495 +496 +497 +498 +499 +500 +501 +502 +503 +504 +505 +506 +507 +508 +509 +510 |
|
async_read(path=None)
+
+
+ async
+
+
+Reads the data from the given path.
+This method navigates through the data structure based on the provided path. +The path can be a string or a list. If it's a string, it's split into a list +using '/' as the separator. Each element of the list is used to navigate +through the data structure.
+If the path is None, it returns the root object.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
+ path
+ |
+
+ str | list | slice | None
+ |
+
+
+
+ the path to the data to read + |
+
+ None
+ |
+
Returns:
+Type | +Description | +
---|---|
+ | +
+
+
+ The data at the given path. + |
+
src/msglc/reader.py
async_visit(path='')
+
+
+ async
+
+
+Reads the data from the given path.
+This method navigates through the data structure based on the provided path. +The path can be a string of paths separated by '/'.
+If the path is None, it returns the root object.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
+ path
+ |
+
+ str
+ |
+
+
+
+ the path to the data to read + |
+
+ ''
+ |
+
Returns:
+Type | +Description | +
---|---|
+ | +
+
+
+ The data at the given path. + |
+
src/msglc/reader.py
get(key, default=None)
+
+items()
+
+keys()
+
+read(path=None)
+
+Reads the data from the given path.
+This method navigates through the data structure based on the provided path. +The path can be a string or a list. If it's a string, it's split into a list +using '/' as the separator. Each element of the list is used to navigate +through the data structure.
+If the path is None, it returns the root object.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
+ path
+ |
+
+ str | list | slice | None
+ |
+
+
+
+ the path to the data to read + |
+
+ None
+ |
+
Returns:
+Type | +Description | +
---|---|
+ | +
+
+
+ The data at the given path. + |
+
src/msglc/reader.py
to_obj()
+
+Converts the data structure to a JSON serializable object.
+This method will read the entire data structure into memory.
+Data returned by this method can leave the LazyReader
context.
src/msglc/reader.py
values()
+
+visit(path='')
+
+Reads the data from the given path.
+This method navigates through the data structure based on the provided path. +The path can be a string of paths separated by '/'.
+If the path is None, it returns the root object.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
+ path
+ |
+
+ str
+ |
+
+
+
+ the path to the data to read + |
+
+ ''
+ |
+
Returns:
+Type | +Description | +
---|---|
+ | +
+
+
+ The data at the given path. + |
+
src/msglc/reader.py
src/msglc/writer.py
Python | |
---|---|
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 + 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 |
|
__init__(buffer_or_path, packer=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
+ |
+
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 + |
+
src/msglc/writer.py
The following are main utility functions to create archive.
+This function is used to write the object to the file.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
+ file
+ |
+
+ str | BytesIO
+ |
+
+
+
+ a string representing the file path + |
+ + required + | +
+ obj
+ |
+ + | +
+
+
+ the object to be written to the file + |
+ + required + | +
+ kwargs
+ |
+ + | +
+
+
+ additional keyword arguments to be passed to the |
+
+ {}
+ |
+
Returns:
+Type | +Description | +
---|---|
+ | +
+
+
+ None + |
+
src/msglc/__init__.py
This function is used to combine the multiple serialized files into a single archive.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
+ archive
+ |
+
+ str | BytesIO
+ |
+
+
+
+ a string representing the file path of the archive + |
+ + required + | +
+ files
+ |
+
+ FileInfo | list[FileInfo]
+ |
+
+
+
+ a list of FileInfo objects + |
+ + required + | +
+ mode
+ |
+
+ Literal['a', 'w']
+ |
+
+
+
+ a string representing the combination mode, 'w' for write and 'a' for append + |
+
+ 'w'
+ |
+
+ validate
+ |
+
+ bool
+ |
+
+
+
+ switch on to validate the files before combining + |
+
+ True
+ |
+
Returns:
+Type | +Description | +
---|---|
+ | +
+
+
+ None + |
+
src/msglc/__init__.py
This function is used to append the multiple serialized files to an existing single archive.
+ + +Parameters:
+Name | +Type | +Description | +Default | +
---|---|---|---|
+ archive
+ |
+
+ str | BytesIO
+ |
+
+
+
+ a string representing the file path of the archive + |
+ + required + | +
+ files
+ |
+
+ FileInfo | list[FileInfo]
+ |
+
+
+
+ a list of FileInfo objects + |
+ + required + | +
+ validate
+ |
+
+ bool
+ |
+
+
+
+ switch on to validate the files before combining + |
+
+ True
+ |
+
Returns:
+Type | +Description | +
---|---|
+ | +
+
+
+ None + |
+
src/msglc/__init__.py