11import datetime
22from _typeshed import Incomplete , SupportsItems
3- from collections .abc import Callable
4- from typing import Any , ClassVar , Final , Literal , NamedTuple , overload
3+ from collections .abc import Callable , Iterable
4+ from typing import Any , ClassVar , Final , Literal , NamedTuple , TypeVar , overload
55from typing_extensions import Self
66
77from .alarms import Alarms
88from .caselessdict import CaselessDict
99from .error import IncompleteComponent as IncompleteComponent
1010from .parser import Contentline , Contentlines
11- from .prop import TypesFactory , vRecur
11+ from .parser_tools import ICAL_TYPE
12+ from .prop import TypesFactory , _vType , vRecur
1213from .timezone .tzp import TZP
1314
15+ _D = TypeVar ("_D" )
16+
1417__all__ = [
1518 "Alarm" ,
1619 "Calendar" ,
@@ -32,7 +35,8 @@ __all__ = [
3235def get_example (component_directory : str , example_name : str ) -> bytes : ...
3336
3437class ComponentFactory (CaselessDict [Incomplete ]):
35- def __init__ (self , * args , ** kwargs ) -> None : ...
38+ # Inherit complex __init__ from CaselessDict<-dict.
39+ ...
3640
3741INLINE : CaselessDict [int ]
3842
@@ -47,7 +51,7 @@ class Component(CaselessDict[Incomplete]):
4751 subcomponents : list [Incomplete ]
4852 errors : list [str ]
4953
50- def __init__ ( self , * args , ** kwargs ) -> None : .. .
54+ # Inherit complex __init__ from CaselessDict<-dict .
5155 def __bool__ (self ) -> bool : ...
5256 __nonzero__ = __bool__
5357 def is_empty (self ) -> bool : ...
@@ -59,9 +63,12 @@ class Component(CaselessDict[Incomplete]):
5963 def add (
6064 self , name : str , value : Any , parameters : SupportsItems [str , str | None ] | None = None , encode : Literal [True ] = True
6165 ) -> None : ...
62- def decoded (self , name , default = []): ...
63- def get_inline (self , name , decode : bool = True ): ...
64- def set_inline (self , name , values , encode : bool = True ) -> None : ...
66+ def decoded (self , name : str , default : _D = ...) -> Incomplete | _D : ...
67+ def get_inline (self , name : str , decode : bool = True ) -> list [Incomplete ]: ...
68+ @overload
69+ def set_inline (self , name : str , values : Iterable [str ], encode : Literal [False ] = ...) -> None : ...
70+ @overload
71+ def set_inline (self , name : str , values : Iterable [Incomplete ], encode : Literal [True ] = True ) -> None : ...
6572 def add_component (self , component : Component ) -> None : ...
6673 def walk (self , name : str | None = None , select : Callable [[Component ], bool ] = ...) -> list [Component ]: ...
6774 def property_items (self , recursive : bool = True , sorted : bool = True ) -> list [tuple [str , object ]]: ...
@@ -71,7 +78,7 @@ class Component(CaselessDict[Incomplete]):
7178 @overload
7279 @classmethod
7380 def from_ical (cls , st : str , multiple : Literal [True ]) -> list [Component ]: ... # or any of its subclasses
74- def content_line (self , name : str , value , sorted : bool = True ) -> Contentline : ...
81+ def content_line (self , name : str , value : _vType | ICAL_TYPE , sorted : bool = True ) -> Contentline : ...
7582 def content_lines (self , sorted : bool = True ) -> Contentlines : ...
7683 def to_ical (self , sorted : bool = True ) -> bytes : ...
7784 def __eq__ (self , other : Component ) -> bool : ... # type: ignore[override]
0 commit comments