Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pyrightconfig.stricter.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
"stubs/html5lib",
"stubs/httplib2",
"stubs/hvac",
"stubs/icalendar",
"stubs/icalendar/icalendar/prop.pyi",
"stubs/icalendar/icalendar/timezone/provider.pyi",
"stubs/jsonschema",
"stubs/jwcrypto",
"stubs/ldap3",
Expand Down
2 changes: 0 additions & 2 deletions stubs/icalendar/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ icalendar\.tests(\..*)?

# Methods that use `int` to mean `bool`.
icalendar.Component.get_inline
icalendar.Component.set_inline
icalendar.cal.Component.get_inline
icalendar.cal.Component.set_inline

# Stubtest gets confused by multiple inheritance.
icalendar.prop.vSkip.__new__
Expand Down
4 changes: 2 additions & 2 deletions stubs/icalendar/icalendar/alarms.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class AlarmTime:
acknowledged_until: datetime.datetime | None = None,
snoozed_until: datetime.datetime | None = None,
parent: Parent | None = None,
): ...
) -> None: ...
@property
def acknowledged(self) -> datetime.datetime | None: ...
@property
Expand All @@ -33,7 +33,7 @@ class AlarmTime:
def trigger(self) -> datetime.date: ...

class Alarms:
def __init__(self, component: Alarm | Event | Todo | None = None): ...
def __init__(self, component: Alarm | Event | Todo | None = None) -> None: ...
def add_component(self, component: Alarm | Parent) -> None: ...
def set_parent(self, parent: Parent) -> None: ...
def add_alarm(self, alarm: Alarm) -> None: ...
Expand Down
25 changes: 16 additions & 9 deletions stubs/icalendar/icalendar/cal.pyi
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import datetime
from _typeshed import Incomplete, SupportsItems
from collections.abc import Callable
from typing import Any, ClassVar, Final, Literal, NamedTuple, overload
from collections.abc import Callable, Iterable
from typing import Any, ClassVar, Final, Literal, NamedTuple, TypeVar, overload
from typing_extensions import Self

from .alarms import Alarms
from .caselessdict import CaselessDict
from .error import IncompleteComponent as IncompleteComponent
from .parser import Contentline, Contentlines
from .prop import TypesFactory, vRecur
from .parser_tools import ICAL_TYPE
from .prop import TypesFactory, _vType, vRecur
from .timezone.tzp import TZP

_D = TypeVar("_D")

__all__ = [
"Alarm",
"Calendar",
Expand All @@ -32,7 +35,8 @@ __all__ = [
def get_example(component_directory: str, example_name: str) -> bytes: ...

class ComponentFactory(CaselessDict[Incomplete]):
def __init__(self, *args, **kwargs) -> None: ...
# Inherit complex __init__ from CaselessDict<-dict.
...

INLINE: CaselessDict[int]

Expand All @@ -47,7 +51,7 @@ class Component(CaselessDict[Incomplete]):
subcomponents: list[Incomplete]
errors: list[str]

def __init__(self, *args, **kwargs) -> None: ...
# Inherit complex __init__ from CaselessDict<-dict.
def __bool__(self) -> bool: ...
__nonzero__ = __bool__
def is_empty(self) -> bool: ...
Expand All @@ -59,9 +63,12 @@ class Component(CaselessDict[Incomplete]):
def add(
self, name: str, value: Any, parameters: SupportsItems[str, str | None] | None = None, encode: Literal[True] = True
) -> None: ...
def decoded(self, name, default=[]): ...
def get_inline(self, name, decode: bool = True): ...
def set_inline(self, name, values, encode: bool = True) -> None: ...
def decoded(self, name: str, default: _D = ...) -> Incomplete | _D: ...
def get_inline(self, name: str, decode: bool = True) -> list[Incomplete]: ...
@overload
def set_inline(self, name: str, values: Iterable[str], encode: Literal[False] = ...) -> None: ...
@overload
def set_inline(self, name: str, values: Iterable[Incomplete], encode: Literal[True] = True) -> None: ...
def add_component(self, component: Component) -> None: ...
def walk(self, name: str | None = None, select: Callable[[Component], bool] = ...) -> list[Component]: ...
def property_items(self, recursive: bool = True, sorted: bool = True) -> list[tuple[str, object]]: ...
Expand All @@ -71,7 +78,7 @@ class Component(CaselessDict[Incomplete]):
@overload
@classmethod
def from_ical(cls, st: str, multiple: Literal[True]) -> list[Component]: ... # or any of its subclasses
def content_line(self, name: str, value, sorted: bool = True) -> Contentline: ...
def content_line(self, name: str, value: _vType | ICAL_TYPE, sorted: bool = True) -> Contentline: ...
def content_lines(self, sorted: bool = True) -> Contentlines: ...
def to_ical(self, sorted: bool = True) -> bytes: ...
def __eq__(self, other: Component) -> bool: ... # type: ignore[override]
Expand Down
3 changes: 2 additions & 1 deletion stubs/icalendar/icalendar/parser.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ from typing_extensions import Self

from .caselessdict import CaselessDict
from .parser_tools import ICAL_TYPE
from .prop import _vType

__all__ = [
"Contentline",
Expand Down Expand Up @@ -83,7 +84,7 @@ class Contentline(str):
strict: bool
def __new__(cls, value: str | bytes, strict: bool = False, encoding: str = "utf-8") -> Self: ...
@classmethod
def from_parts(cls, name: ICAL_TYPE, params: Parameters, values, sorted: bool = True) -> Self: ...
def from_parts(cls, name: ICAL_TYPE, params: Parameters, values: _vType | ICAL_TYPE, sorted: bool = True) -> Self: ...
def parts(self) -> tuple[str, Parameters, str]: ...
@classmethod
def from_ical(cls, ical: str | bytes, strict: bool = False) -> Self: ...
Expand Down
6 changes: 3 additions & 3 deletions stubs/icalendar/icalendar/prop.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import datetime
from _typeshed import ConvertibleToFloat, ConvertibleToInt, SupportsKeysAndGetItem, Unused
from _typeshed import ConvertibleToFloat, ConvertibleToInt, Incomplete, SupportsKeysAndGetItem, Unused
from collections.abc import Iterable, Iterator
from enum import Enum
from re import Pattern
Expand Down Expand Up @@ -84,7 +84,7 @@ class vText(str):

class vCalAddress(str):
params: Parameters
def __new__(cls, value: ICAL_TYPE, encoding="utf-8", params: SupportsKeysAndGetItem[str, str] = {}) -> Self: ...
def __new__(cls, value: ICAL_TYPE, encoding: str = "utf-8", params: SupportsKeysAndGetItem[str, str] = {}) -> Self: ...
def to_ical(self) -> bytes: ...
@classmethod
def from_ical(cls, ical: ICAL_TYPE) -> Self: ...
Expand Down Expand Up @@ -127,7 +127,7 @@ class vDDDLists:
def __init__(self, dt_list: Iterable[_AnyTimeType] | _AnyTimeType) -> None: ...
def to_ical(self) -> bytes: ...
@staticmethod
def from_ical(ical: str, timezone: str | datetime.timezone | None = None): ...
def from_ical(ical: str, timezone: str | datetime.timezone | None = None) -> list[Incomplete]: ...
def __eq__(self, other: object) -> bool: ...

class vCategory:
Expand Down
6 changes: 1 addition & 5 deletions stubs/icalendar/icalendar/timezone/zoneinfo.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import datetime
from typing import Final, Literal
from zoneinfo import ZoneInfo

from dateutil.rrule import rrule, rruleset
from dateutil.rrule import rrule

from ..cal import Timezone
from ..prop import vRecur
Expand All @@ -22,7 +22,3 @@ class ZONEINFO(TZProvider):
def create_timezone(self, tz: Timezone) -> datetime.tzinfo: ... # type: ignore[override]
def uses_pytz(self) -> Literal[False]: ...
def uses_zoneinfo(self) -> Literal[True]: ...

def pickle_tzicalvtz(tzicalvtz): ...
def pickle_rruleset_with_cache(rs: rruleset): ...
def unpickle_rruleset_with_cache(rrule, rdate, exrule, exdate, cache): ...
Comment on lines -25 to -28
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like internal helpers used by copyreg for pickle support