linexcel.values¶
linexcel.values ¶
What a cell value is, once something has read it.
The engine, the file's own cache and a linked workbook each hand values back in their own shape: a Rust error object, a float that is really a date, a string that is really an error code. This module is the one place that decides what such a thing means: whether it counts as computed, whether two readings of it agree, and how it is written down for the report.
Kept apart from the reading (:mod:linexcel.loader) and from the reasoning
(:mod:linexcel.analyzer) because both need these answers and neither owns
them.
SpreadsheetError ¶
serial_to_date_text ¶
Convert an Excel serial number to YYYY-MM-DD, or None if it is not a date.
Source code in src/linexcel/values.py
serial_to_time_text ¶
A fraction of one Excel day as a timezone-free time of day.
Cached times are read at millisecond precision. Keep the date component meaningful: 1.5 days must not silently become the same value as noon.
Source code in src/linexcel/values.py
temporal_serials_agree ¶
Compare Excel day serials with the cache's absolute 0.5 ms precision.
Source code in src/linexcel/values.py
readings_agree ¶
readings_agree(
recalculated: Any,
stored: Any,
date_text: str | None,
*,
recalculated_is_error: bool | None = None,
stored_is_error: bool | None = None,
stored_is_text: bool = False,
epoch_1904: bool | None = None,
date_formatted: bool = False,
) -> str
How the two readings of one cell relate: same, format or differ.
One rule, in one place. The report used to hold two: Python compared
values for the warnings and returned "no difference" for every pair of
strings, missing a recalculated non over a stored oui, while the
viewer compared the rendered text and called any difference a
disagreement, which is what made a French workbook light up red over
6,7 €.
format is the middle answer neither of them had: the same value, spelt
with the separators of whatever saved the file. Both readings are still
shown; only the verdict softens.
stored_is_text identifies a literal cache string before serialization.
Otherwise date metadata may describe a serialized temporal cache, as in
older report callers; that compatibility does not prove a literal's type.
epoch_1904 supplies the workbook calendar when day zero has no date label.
date_formatted preserves temporal precision for numeric date or duration
caches, including Excel's fictitious 1900 leap day and elapsed durations
beyond Python's range. It does not assign a calendar label to a duration.
Source code in src/linexcel/values.py
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 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 | |