comicbox.readinglists.transform ¶
Base class for converting a format’s document to and from the model.
A sibling of BaseTransform, not a subclass. BaseTransform compiles glom keypath specs and loads its result as a comic; a reading list is a list of nested rows, so each format converts with builder functions, and the result is a reading list.
ReadingListTransform ¶
Convert one format’s document to and from the reading-list model.
One instance serves one call. warnings collects what the call had to drop or guess, for the caller to show; the library does not log them.
Source code in comicbox/readinglists/transform.py
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 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | |
root_tag property ¶
The root tag of this format’s documents.
__init__(path=None) ¶
Get the schema and start an empty warnings list.
Source code in comicbox/readinglists/transform.py
79 80 81 82 83 | |
from_document(document) ¶
Load a parsed document through this format’s schema.
Source code in comicbox/readinglists/transform.py
120 121 122 123 124 125 126 127 128 129 | |
from_reading_list(reading_list) ¶
Convert the model’s inner mapping to a document for this format.
Source code in comicbox/readinglists/transform.py
150 151 152 | |
load_document(document) ¶
Load a parsed document through the schema, naming what it drops.
Source code in comicbox/readinglists/transform.py
131 132 133 134 135 136 | |
parse(text) ¶
Parse text, then load it through this format’s schema.
Source code in comicbox/readinglists/transform.py
94 95 96 97 98 99 100 | |
parse_data(data, text, *, replaced) ¶
Parse a document as it was read: its bytes, and the text they decode to.
replaced says the bytes were not UTF-8, so the text has U+FFFD in their place; that is a warning. A format that decodes its own bytes, as XML does by its declaration, parses data instead.
Source code in comicbox/readinglists/transform.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | |
render(document) ¶
Serialize a document with this format’s schema.
Source code in comicbox/readinglists/transform.py
138 139 140 | |
to_reading_list(data) ¶
Convert a parsed document to the model’s inner mapping.
Source code in comicbox/readinglists/transform.py
142 143 144 145 146 147 148 | |
unwritable(reading_list) ¶
List the positions, from 0, of entries this format cannot write.
Source code in comicbox/readinglists/transform.py
154 155 156 157 | |
entry_issue_name(entry) ¶
Get an entry’s issue name, or build it from the number and suffix.
Source code in comicbox/readinglists/transform.py
58 59 60 61 62 63 64 65 | |
issue_id(entry, source) ¶
Get an entry’s issue id for a database, ignoring other id types.
Source code in comicbox/readinglists/transform.py
43 44 45 46 47 48 | |
series_id(entry, source) ¶
Get an entry’s series id for a database.
Source code in comicbox/readinglists/transform.py
51 52 53 54 55 | |