Commit e224f39
committed
refactor: move response-related logic from protocol/ into response.py
- Moved all result dataclasses (PropfindResult, CalendarQueryResult,
SyncCollectionResult, MultistatusResponse) and XML parse functions
(_parse_multistatus, _parse_propfind_response, etc.) from
protocol/types.py and protocol/xml_parsers.py into response.py,
which is the natural home for response-parsing logic.
- Deleted protocol/types.py and protocol/xml_parsers.py entirely.
protocol/__init__.py now re-exports the result types from response.py.
- Added parse_propfind(), parse_calendar_query(), parse_sync_collection()
as instance methods on BaseDAVResponse so callers can simply do
`response.parse_propfind()` instead of passing raw bytes, status code
and huge_tree as arguments to a standalone function.
- Dropped MultiGetResult dataclass — it was an exact structural copy of
CalendarQueryResult with no distinct semantics and was never imported
in production code.
- Updated async_davclient.py and davclient.py to use the new instance
methods (eliminating the raw-bytes boilerplate at each call site).
- Fixed unit tests that were mocking _async_get_vcal_address directly
instead of the dual-mode get_vcal_address; and removed the TestDAVTypes
class that tested now-deleted Sans-IO types (DAVRequest, DAVResponse).
prompt: All response-related logic in the protocol directory should be moved back to the response class.
followup-prompt: Make sure there is no duplicated code or logic. I feel more comfortable having things organized as methods under the Response class than having them as pure functions, consider if any of the functions moved over would fit as methods. Those new dataclasses, make sure they are either used consequently whenever it makes sense, or that they are dropped completely. Make me an overview of places where those new functions and classes are used, when not being called from the Response class.
AI Prompts:
claude-sonnet-4-6: All response-related logic in the protocol directory should be moved back to the response class.1 parent 7785774 commit e224f39
8 files changed
Lines changed: 357 additions & 845 deletions
File tree
- caldav
- protocol
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | 74 | | |
79 | 75 | | |
80 | 76 | | |
81 | 77 | | |
82 | 78 | | |
83 | 79 | | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | 80 | | |
90 | | - | |
| 81 | + | |
91 | 82 | | |
92 | 83 | | |
93 | 84 | | |
| |||
562 | 553 | | |
563 | 554 | | |
564 | 555 | | |
565 | | - | |
566 | 556 | | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | | - | |
| 557 | + | |
573 | 558 | | |
574 | 559 | | |
575 | 560 | | |
| |||
779 | 764 | | |
780 | 765 | | |
781 | 766 | | |
782 | | - | |
783 | 767 | | |
784 | | - | |
785 | | - | |
786 | | - | |
787 | | - | |
788 | | - | |
789 | | - | |
| 768 | + | |
790 | 769 | | |
791 | 770 | | |
792 | 771 | | |
| |||
816 | 795 | | |
817 | 796 | | |
818 | 797 | | |
819 | | - | |
820 | 798 | | |
821 | | - | |
822 | | - | |
823 | | - | |
824 | | - | |
825 | | - | |
826 | | - | |
| 799 | + | |
827 | 800 | | |
828 | 801 | | |
829 | 802 | | |
| |||
855 | 828 | | |
856 | 829 | | |
857 | 830 | | |
858 | | - | |
859 | 831 | | |
860 | | - | |
861 | | - | |
862 | | - | |
863 | | - | |
864 | | - | |
865 | | - | |
| 832 | + | |
866 | 833 | | |
867 | 834 | | |
868 | 835 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
717 | 717 | | |
718 | 718 | | |
719 | 719 | | |
720 | | - | |
721 | 720 | | |
722 | | - | |
723 | | - | |
724 | | - | |
725 | | - | |
726 | | - | |
727 | | - | |
728 | | - | |
729 | | - | |
| 721 | + | |
730 | 722 | | |
731 | 723 | | |
732 | 724 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
| 4 | + | |
| 5 | + | |
17 | 6 | | |
18 | 7 | | |
19 | | - | |
| 8 | + | |
20 | 9 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | 10 | | |
26 | | - | |
27 | 11 | | |
28 | 12 | | |
29 | 13 | | |
30 | 14 | | |
31 | 15 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | 16 | | |
39 | | - | |
40 | 17 | | |
41 | | - | |
42 | 18 | | |
43 | 19 | | |
44 | 20 | | |
This file was deleted.
0 commit comments