comicbox.readinglists.identity ¶
Identity: when two reading-list entries are the same issue.
entry_keys is the one definition. combine, compare, the CLI matcher and codex’s database matcher all use it, so they agree on what counts as the same issue.
Discriminators dataclass ¶
What a row tells its volume by: up to one discriminator of each kind.
year is the year-like one: the start year or, failing that, a volume number of 1900 or more, as a CBL’s Volume="2006" is. volume is a volume number under 1900. Z-Men (1991) volume 2 has both.
Source code in comicbox/readinglists/identity.py
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 | |
conflicts(other) ¶
Tell whether two rows are of two volumes.
They conflict when they have a discriminator of the same kind and those differ, in either kind: the 2011 and 2016 volumes, or volumes 1 and 2. A start year and volume 2 cannot be compared.
Source code in comicbox/readinglists/identity.py
171 172 173 174 175 176 177 178 179 | |
shares_a_kind(other) ¶
Tell whether two rows have a discriminator of one kind each.
Source code in comicbox/readinglists/identity.py
165 166 167 168 169 | |
ParsedIssue dataclass ¶
An issue name, normalized, and the number and suffix read out of it.
Source code in comicbox/readinglists/identity.py
61 62 63 64 65 66 67 | |
any_conflict(values) ¶
Tell whether any two of some rows’ discriminators conflict.
Source code in comicbox/readinglists/identity.py
224 225 226 227 228 229 | |
discriminators(entry) ¶
Get what an entry tells its volume by.
Source code in comicbox/readinglists/identity.py
186 187 188 189 190 191 192 193 | |
entry_date(entry) ¶
Get the cover date, or the first day the year and month allow.
Source code in comicbox/readinglists/identity.py
351 352 353 354 355 356 357 358 359 360 361 362 363 | |
entry_keys(entry) ¶
List the keys that identify an entry’s issue, strongest first.
("id", source, key) for each issue id, best ranked source first, then ("name", series, "year", year, number, suffix) by the start year or a year-like volume, then ("name", series, "volume", volume, number, suffix) by a volume number under 1900, then the weakest, ("name-year", series, cover year, number, suffix). Two entries are the same issue when they share a key and their discriminators do not conflict (Discriminators.conflicts): Z-Men (1963) and Z-Men (1991) may both be volume 1. An entry with none, no id and no series and issue with a start year, volume or cover year, matches nothing.
Source code in comicbox/readinglists/identity.py
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 | |
entry_sort_key(entry) ¶
Sort by date, series and issue; anything missing sorts last.
Source code in comicbox/readinglists/identity.py
366 367 368 369 370 371 372 373 374 375 376 377 378 | |
name_variants(entry) ¶
List the series names to try for an entry, normalized, in order.
The name as given; the name without a trailing year or volume in parentheses (Bladehawk (2016), X (Vol. 2)), when it has one; the name without a leading article; and the name without a reprint suffix such as TPB or Omnibus. A year or volume is never added: Ivory Knight is not the series Ivory Knight 2020. For matching a list against comics only: entry_keys stays strict, so combine never joins on a variant.
Source code in comicbox/readinglists/identity.py
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | |
parse_issue(text) ¶
Normalize an issue name and split it into its number and suffix.
The comicbox rules: #004AU is 4AU, number 4 and suffix AU; ½ is .5. 3 and 3.0 have equal numbers. -1 is a real issue number: IssueField.split_issue reads its sign.
Source code in comicbox/readinglists/identity.py
79 80 81 82 83 84 85 86 87 88 89 | |
variant_keys(entry) ¶
Build the name keys of an entry’s variants, its own name key first.
Each keeps one of the entry’s discriminators and its issue, so an entry with no name key has no variants either: it still matches by id alone. For each name, the year key comes before the volume key.
Source code in comicbox/readinglists/identity.py
316 317 318 319 320 321 322 323 324 325 326 327 328 | |