Commit f1f89f5
github-actions
feat: Add partial address validation with component cleaning
Add support for partial address validation where optional components like Zip4
can be cleaned/removed while keeping addresses valid. This prevents entire
address parsing from failing due to invalid optional fields.
Key changes:
- Add CleaningOperation dataclass to track cleaning operations
- Extend ParseResult with cleaning tracking fields and methods
- Add allow_partial parameter to parse_auto() functions
- Add component-level validation functions (validate_zip5, validate_zip4)
- Implement partial validation logic that cleans invalid optional components
- Add comprehensive test coverage for partial validation behavior
- Update ruff config for Python 3.9 type annotation compatibility
Addresses issue where addresses with invalid optional components (like malformed
Zip4) would fail completely. Now such components are cleaned and tracked,
allowing the address to remain valid with proper reporting.
BREAKING: parse_auto() now accepts allow_partial=False by default for backward compatibility
FEATURE: New allow_partial=True enables cleaning of invalid optional components
FEATURE: Cleaning operations are tracked with timestamps and reasons
FEATURE: Enhanced ParseResult with cleaning report methods1 parent eff3066 commit f1f89f5
7 files changed
Lines changed: 686 additions & 8 deletions
File tree
- src/ryandata_address_utils
- validation
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| 89 | + | |
89 | 90 | | |
90 | 91 | | |
91 | 92 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
| |||
85 | 86 | | |
86 | 87 | | |
87 | 88 | | |
| 89 | + | |
| 90 | + | |
88 | 91 | | |
89 | 92 | | |
90 | 93 | | |
| |||
104 | 107 | | |
105 | 108 | | |
106 | 109 | | |
| 110 | + | |
107 | 111 | | |
108 | 112 | | |
109 | 113 | | |
| |||
127 | 131 | | |
128 | 132 | | |
129 | 133 | | |
| 134 | + | |
| 135 | + | |
130 | 136 | | |
131 | 137 | | |
132 | 138 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
| 5 | + | |
4 | 6 | | |
5 | | - | |
| 7 | + | |
6 | 8 | | |
7 | 9 | | |
8 | 10 | | |
| |||
670 | 672 | | |
671 | 673 | | |
672 | 674 | | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
673 | 688 | | |
674 | 689 | | |
675 | 690 | | |
| |||
692 | 707 | | |
693 | 708 | | |
694 | 709 | | |
695 | | - | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
696 | 714 | | |
697 | 715 | | |
698 | 716 | | |
| |||
701 | 719 | | |
702 | 720 | | |
703 | 721 | | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
704 | 726 | | |
705 | 727 | | |
706 | 728 | | |
| |||
729 | 751 | | |
730 | 752 | | |
731 | 753 | | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
732 | 805 | | |
733 | 806 | | |
734 | 807 | | |
| |||
0 commit comments