Update caldav to 1.2 (#9821)

Also add a few default values and replace some instances of Any with
Incomplete.
This commit is contained in:
Sebastian Rittau
2023-02-27 13:42:33 +01:00
committed by GitHub
parent 88506f0e56
commit 05453b0c0a
3 changed files with 36 additions and 31 deletions

View File

@@ -1,4 +1,4 @@
version = "1.0.*"
version = "1.2.*"
# also types-lxml and types-icalendar when those stubs are added
requires = ["types-requests", "types-vobject"]

View File

@@ -1,6 +1,6 @@
from _typeshed import Incomplete
from collections.abc import Iterable, Mapping
from types import TracebackType
from typing import Any
from typing_extensions import Self, TypeAlias
from urllib.parse import ParseResult, SplitResult
@@ -12,7 +12,7 @@ from requests.structures import CaseInsensitiveDict
from .lib.url import URL
from .objects import Calendar, DAVObject, Principal
_Element: TypeAlias = Any # actually lxml.etree._Element
_Element: TypeAlias = Incomplete # actually lxml.etree._Element
class DAVResponse:
reason: str
@@ -26,7 +26,7 @@ class DAVResponse:
def validate_status(self, status: str) -> None: ...
def find_objects_and_props(self) -> None: ...
def expand_simple_props(
self, props: Iterable[Any] = ..., multi_value_props: Iterable[Any] = ..., xpath: str | None = ...
self, props: Iterable[Incomplete] = ..., multi_value_props: Iterable[Incomplete] = ..., xpath: str | None = ...
) -> dict[str, dict[str, str]]: ...
class DAVClient:
@@ -42,13 +42,14 @@ class DAVClient:
def __init__(
self,
url: str,
proxy: str | None = ...,
username: str | None = ...,
password: str | None = ...,
auth: AuthBase | None = ...,
timeout: _Timeout | None = ...,
ssl_verify_cert: bool | str = ...,
ssl_cert: str | tuple[str, str] | None = ...,
proxy: str | None = None,
username: str | None = None,
password: str | None = None,
auth: AuthBase | None = None,
timeout: _Timeout | None = None,
ssl_verify_cert: bool | str = True,
ssl_cert: str | tuple[str, str] | None = None,
headers: dict[str, str] = ...,
) -> None: ...
def __enter__(self) -> Self: ...
def __exit__(
@@ -61,8 +62,8 @@ class DAVClient:
parent: DAVObject | None = ...,
name: str | None = ...,
id: str | None = ...,
props: Mapping[Any, Any] = ...,
**extra: Any,
props: Mapping[Incomplete, Incomplete] = ...,
**extra: Incomplete,
) -> Calendar: ...
def check_dav_support(self) -> str | None: ...
def check_cdav_support(self) -> bool: ...

View File

@@ -1,7 +1,7 @@
import datetime
from _typeshed import Incomplete
from collections.abc import Iterable, Iterator, Mapping, Sequence
from typing import Any, TypeVar, overload
from typing import TypeVar, overload
from typing_extensions import Literal, Self, TypeAlias
from urllib.parse import ParseResult, SplitResult
@@ -14,7 +14,7 @@ from .lib.url import URL
_CC = TypeVar("_CC", bound=CalendarObjectResource)
# Actually "type[Todo] | type[Event] | type[Journal]", but mypy doesn't like that.
_CompClass: TypeAlias = type[CalendarObjectResource]
_VCalAddress: TypeAlias = Any # actually icalendar.vCalAddress
_VCalAddress: TypeAlias = Incomplete # actually icalendar.vCalAddress
class DAVObject:
id: str | None
@@ -22,8 +22,8 @@ class DAVObject:
client: DAVClient | None
parent: DAVObject | None
name: str | None
props: Mapping[Any, Any]
extra_init_options: dict[str, Any]
props: Mapping[Incomplete, Incomplete]
extra_init_options: dict[str, Incomplete]
def __init__(
self,
client: DAVClient | None = ...,
@@ -31,13 +31,13 @@ class DAVObject:
parent: DAVObject | None = ...,
name: str | None = ...,
id: str | None = ...,
props: Mapping[Any, Any] | None = ...,
**extra: Any,
props: Mapping[Incomplete, Incomplete] | None = ...,
**extra: Incomplete,
) -> None: ...
@property
def canonical_url(self) -> str: ...
def children(self, type: str | None = ...) -> list[tuple[URL, Any, Any]]: ...
def get_property(self, prop, use_cached: bool = ..., **passthrough) -> Any | None: ...
def children(self, type: str | None = ...) -> list[tuple[URL, Incomplete, Incomplete]]: ...
def get_property(self, prop, use_cached: bool = ..., **passthrough) -> Incomplete | None: ...
def get_properties(
self, props: Incomplete | None = ..., depth: int = ..., parse_response_xml: bool = ..., parse_props: bool = ...
): ...
@@ -58,7 +58,7 @@ class Principal(DAVObject):
def make_calendar(
self, name: str | None = ..., cal_id: str | None = ..., supported_calendar_component_set: Incomplete | None = ...
) -> Calendar: ...
def calendar(self, name: str | None = ..., cal_id: str | None = ...) -> Calendar: ...
def calendar(self, name: str | None = None, cal_id: str | None = None, cal_url: str | None = None) -> Calendar: ...
def get_vcal_address(self) -> _VCalAddress: ...
calendar_home_set: CalendarSet # can also be set to anything URL.objectify() accepts
def freebusy_request(self, dtstart, dtend, attendees): ...
@@ -67,12 +67,16 @@ class Principal(DAVObject):
def schedule_outbox(self) -> ScheduleOutbox: ...
class Calendar(DAVObject):
def get_supported_components(self) -> list[Any]: ...
def get_supported_components(self) -> list[Incomplete]: ...
def save_with_invites(self, ical: str, attendees, **attendeeoptions) -> None: ...
def save_event(self, ical: str | None = ..., no_overwrite: bool = ..., no_create: bool = ..., **ical_data: Any) -> Event: ...
def save_todo(self, ical: str | None = ..., no_overwrite: bool = ..., no_create: bool = ..., **ical_data: Any) -> Todo: ...
def save_event(
self, ical: str | None = ..., no_overwrite: bool = ..., no_create: bool = ..., **ical_data: Incomplete
) -> Event: ...
def save_todo(
self, ical: str | None = ..., no_overwrite: bool = ..., no_create: bool = ..., **ical_data: Incomplete
) -> Todo: ...
def save_journal(
self, ical: str | None = ..., no_overwrite: bool = ..., no_create: bool = ..., **ical_data: Any
self, ical: str | None = ..., no_overwrite: bool = ..., no_create: bool = ..., **ical_data: Incomplete
) -> Journal: ...
add_event = save_event
add_todo = save_todo
@@ -192,10 +196,10 @@ class ScheduleOutbox(ScheduleMailbox):
class SynchronizableCalendarObjectCollection:
def __init__(self, calendar, objects, sync_token) -> None: ...
def __iter__(self) -> Iterator[Any]: ...
def __iter__(self) -> Iterator[Incomplete]: ...
def __len__(self) -> int: ...
def objects_by_url(self): ...
def sync(self) -> tuple[Any, Any]: ...
def sync(self) -> tuple[Incomplete, Incomplete]: ...
class CalendarObjectResource(DAVObject):
def __init__(
@@ -216,7 +220,7 @@ class CalendarObjectResource(DAVObject):
def decline_invite(self, calendar: Incomplete | None = ...) -> None: ...
def tentatively_accept_invite(self, calendar: Incomplete | None = ...) -> None: ...
def copy(self, keep_uid: bool = ..., new_parent: Incomplete | None = ...) -> Self: ...
def load(self) -> Self: ...
def load(self, only_if_unloaded: bool = False) -> Self: ...
def change_attendee_status(self, attendee: Incomplete | None = ..., **kwargs) -> None: ...
def save(
self,
@@ -227,9 +231,9 @@ class CalendarObjectResource(DAVObject):
if_schedule_tag_match: bool = ...,
) -> Self: ...
def get_duration(self) -> datetime.timedelta: ...
data: Any
data: Incomplete
vobject_instance: VBase
icalendar_instance: Any
icalendar_instance: Incomplete
instance: VBase
class Event(CalendarObjectResource): ...