|
12 | 12 | import logging |
13 | 13 | import sys |
14 | 14 | import uuid |
| 15 | +import warnings |
15 | 16 | from datetime import datetime |
16 | 17 | from typing import Any |
17 | 18 | from typing import List |
@@ -616,42 +617,6 @@ def calendar_multiget(self, *largs, **kwargs): |
616 | 617 | """ |
617 | 618 | return list(self.multiget(*largs, **kwargs)) |
618 | 619 |
|
619 | | - ## TODO: Upgrade the warning to an error (and perhaps critical) in future |
620 | | - ## releases, and then finally remove this method completely. |
621 | | - def build_date_search_query( |
622 | | - self, |
623 | | - start, |
624 | | - end: Optional[datetime] = None, |
625 | | - compfilter: Optional[Literal["VEVENT"]] = "VEVENT", |
626 | | - expand: Union[bool, Literal["maybe"]] = "maybe", |
627 | | - ): |
628 | | - """ |
629 | | - WARNING: DEPRECATED |
630 | | - """ |
631 | | - ## This is dead code. It has no tests. It was made for usage |
632 | | - ## by the date_search method, but I've decided not to use it |
633 | | - ## there anymore. Most likely nobody is using this, as it's |
634 | | - ## sort of an internal method - but for the sake of backward |
635 | | - ## compatibility I will keep it for a while. I regret naming |
636 | | - ## it build_date_search_query rather than |
637 | | - ## _build_date_search_query... |
638 | | - logging.warning( |
639 | | - "DEPRECATION WARNING: The calendar.build_date_search_query method will be removed in caldav library from version 1.0 or perhaps earlier. Use calendar.build_search_xml_query instead." |
640 | | - ) |
641 | | - if expand == "maybe": |
642 | | - expand = end |
643 | | - |
644 | | - if compfilter == "VEVENT": |
645 | | - comp_class = Event |
646 | | - elif compfilter == "VTODO": |
647 | | - comp_class = Todo |
648 | | - else: |
649 | | - comp_class = None |
650 | | - |
651 | | - return self.build_search_xml_query( |
652 | | - comp_class=comp_class, expand=expand, start=start, end=end |
653 | | - ) |
654 | | - |
655 | 620 | def date_search( |
656 | 621 | self, |
657 | 622 | start: datetime, |
@@ -681,9 +646,11 @@ def date_search( |
681 | 646 | * [CalendarObjectResource(), ...] |
682 | 647 |
|
683 | 648 | """ |
684 | | - ## TODO: upgrade to warning and error before removing this method |
685 | | - logging.info( |
686 | | - "DEPRECATION NOTICE: The calendar.date_search method may be removed in release 2.0 of the caldav library. Use calendar.search instead" |
| 649 | + ## date_search will probably disappear in 3.0 |
| 650 | + warnings.warn( |
| 651 | + "use `calendar.search rather than `calendar.date_search`", |
| 652 | + DeprecationWarning, |
| 653 | + stacklevel=2, |
687 | 654 | ) |
688 | 655 |
|
689 | 656 | if verify_expand: |
@@ -791,8 +758,7 @@ def search( |
791 | 758 | LEGACY WARNING: the expand attribute currently takes four |
792 | 759 | possible values - True, False, server and client. The two |
793 | 760 | latter value were hastily added just prior to launching |
794 | | - version 1.4, the API may be reconsidered and changed without |
795 | | - notice when launching version 2.0 |
| 761 | + version 1.4, the API may be reconsidered at some point. |
796 | 762 |
|
797 | 763 | Parameters supported: |
798 | 764 |
|
|
0 commit comments