mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-03 18:13:36 +08:00
[icalendar] Update to 6.0.0 (#12706)
This commit is contained in:
@@ -1,9 +1,23 @@
|
||||
# Command line app
|
||||
icalendar\.cli
|
||||
icalendar.cli
|
||||
|
||||
# Tests
|
||||
icalendar\.tests(\..*)?
|
||||
|
||||
# Methods that use `int` to mean `bool`.
|
||||
icalendar\.cal\.Component\.get_inline
|
||||
icalendar\.cal\.Component\.set_inline
|
||||
icalendar.Component.get_inline
|
||||
icalendar.Component.set_inline
|
||||
icalendar.cal.Component.get_inline
|
||||
icalendar.cal.Component.set_inline
|
||||
|
||||
# Runtime __all__ has extra items that don't exist.
|
||||
icalendar.__all__
|
||||
icalendar.vTypesFactory
|
||||
icalendar.parser.__all__
|
||||
icalendar.parser.tzid_from_dt
|
||||
# Runtime __all__ is missing a comma, leading to incorrect items.
|
||||
icalendar.parser_tools.__all__
|
||||
icalendar.parser_tools.ICAL_TYPEdata_encode
|
||||
|
||||
# Stubtest gets confused by multiple inheritance.
|
||||
icalendar.prop.vSkip.__new__
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
version = "5.0.*"
|
||||
version = "6.0.*"
|
||||
upstream_repository = "https://github.com/collective/icalendar"
|
||||
requires = ["types-pytz"]
|
||||
requires = ["types-python-dateutil", "backports.zoneinfo; python_version<'3.9'"]
|
||||
|
||||
[tool.stubtest]
|
||||
stubtest_requirements = ["pytz"]
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
from typing import Final
|
||||
|
||||
from .cal import (
|
||||
Alarm as Alarm,
|
||||
Calendar as Calendar,
|
||||
Component as Component,
|
||||
ComponentFactory as ComponentFactory,
|
||||
Event as Event,
|
||||
FreeBusy as FreeBusy,
|
||||
@@ -14,8 +13,6 @@ from .cal import (
|
||||
)
|
||||
from .parser import Parameters as Parameters, q_join as q_join, q_split as q_split
|
||||
from .prop import (
|
||||
FixedOffset as FixedOffset,
|
||||
LocalTimezone as LocalTimezone,
|
||||
TypesFactory as TypesFactory,
|
||||
vBinary as vBinary,
|
||||
vBoolean as vBoolean,
|
||||
@@ -36,5 +33,52 @@ from .prop import (
|
||||
vUTCOffset as vUTCOffset,
|
||||
vWeekday as vWeekday,
|
||||
)
|
||||
from .timezone import use_pytz, use_zoneinfo
|
||||
from .version import (
|
||||
__version__ as __version__,
|
||||
__version_tuple__ as __version_tuple__,
|
||||
version as version,
|
||||
version_tuple as version_tuple,
|
||||
)
|
||||
|
||||
__version__: Final[str]
|
||||
__all__ = [
|
||||
"Calendar",
|
||||
"Event",
|
||||
"Todo",
|
||||
"Journal",
|
||||
"Timezone",
|
||||
"TimezoneStandard",
|
||||
"TimezoneDaylight",
|
||||
"FreeBusy",
|
||||
"Alarm",
|
||||
"ComponentFactory",
|
||||
"vBinary",
|
||||
"vBoolean",
|
||||
"vCalAddress",
|
||||
"vDatetime",
|
||||
"vDate",
|
||||
"vDDDTypes",
|
||||
"vDuration",
|
||||
"vFloat",
|
||||
"vInt",
|
||||
"vPeriod",
|
||||
"vWeekday",
|
||||
"vFrequency",
|
||||
"vRecur",
|
||||
"vText",
|
||||
"vTime",
|
||||
"vUri",
|
||||
"vGeo",
|
||||
"vUTCOffset",
|
||||
"Parameters",
|
||||
"q_split",
|
||||
"q_join",
|
||||
"use_pytz",
|
||||
"use_zoneinfo",
|
||||
"__version__",
|
||||
"version",
|
||||
"__version_tuple__",
|
||||
"version_tuple",
|
||||
"TypesFactory",
|
||||
"Component",
|
||||
]
|
||||
|
||||
@@ -1,12 +1,31 @@
|
||||
import datetime
|
||||
from _typeshed import Incomplete, SupportsItems
|
||||
from collections.abc import Callable
|
||||
from typing import Any, ClassVar, Final, Literal, overload
|
||||
|
||||
from pytz.tzinfo import DstTzInfo
|
||||
|
||||
from .caselessdict import CaselessDict
|
||||
from .parser import Contentline, Contentlines
|
||||
from .prop import TypesFactory
|
||||
|
||||
__all__ = [
|
||||
"Alarm",
|
||||
"Calendar",
|
||||
"Component",
|
||||
"ComponentFactory",
|
||||
"Event",
|
||||
"FreeBusy",
|
||||
"INLINE",
|
||||
"Journal",
|
||||
"Timezone",
|
||||
"TimezoneDaylight",
|
||||
"TimezoneStandard",
|
||||
"Todo",
|
||||
"component_factory",
|
||||
"get_example",
|
||||
]
|
||||
|
||||
def get_example(component_directory: str, example_name: str) -> bytes: ...
|
||||
|
||||
class ComponentFactory(CaselessDict[Incomplete]):
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
|
||||
@@ -27,8 +46,6 @@ class Component(CaselessDict[Incomplete]):
|
||||
def __bool__(self) -> bool: ...
|
||||
__nonzero__ = __bool__
|
||||
def is_empty(self) -> bool: ...
|
||||
@property
|
||||
def is_broken(self) -> bool: ...
|
||||
@overload
|
||||
def add(self, name: str, value: Any, *, encode: Literal[False]) -> None: ...
|
||||
@overload
|
||||
@@ -41,7 +58,7 @@ class Component(CaselessDict[Incomplete]):
|
||||
def get_inline(self, name, decode: bool = True): ...
|
||||
def set_inline(self, name, values, encode: bool = True) -> None: ...
|
||||
def add_component(self, component: Component) -> None: ...
|
||||
def walk(self, name: Incomplete | None = None): ...
|
||||
def walk(self, name: str | None = None, select: Callable[[Component], bool] = ...): ...
|
||||
def property_items(self, recursive: bool = True, sorted: bool = True): ...
|
||||
@overload
|
||||
@classmethod
|
||||
@@ -56,6 +73,8 @@ class Component(CaselessDict[Incomplete]):
|
||||
|
||||
class Event(Component):
|
||||
name: ClassVar[Literal["VEVENT"]]
|
||||
@classmethod
|
||||
def example(cls, name: str) -> Event: ...
|
||||
|
||||
class Todo(Component):
|
||||
name: ClassVar[Literal["VTODO"]]
|
||||
@@ -68,7 +87,12 @@ class FreeBusy(Component):
|
||||
|
||||
class Timezone(Component):
|
||||
name: ClassVar[Literal["VTIMEZONE"]]
|
||||
def to_tz(self) -> DstTzInfo: ...
|
||||
@classmethod
|
||||
def example(cls, name: str) -> Calendar: ...
|
||||
def to_tz(self, tzp=...): ... # FIXME -> DstTzInfo: ...
|
||||
@property
|
||||
def tz_name(self) -> str: ...
|
||||
def get_transitions(self) -> tuple[list[datetime.datetime], list[tuple[datetime.timedelta, datetime.timedelta, str]]]: ...
|
||||
|
||||
class TimezoneStandard(Component):
|
||||
name: ClassVar[Literal["STANDARD"]]
|
||||
@@ -81,6 +105,8 @@ class Alarm(Component):
|
||||
|
||||
class Calendar(Component):
|
||||
name: ClassVar[Literal["VCALENDAR"]]
|
||||
@classmethod
|
||||
def example(cls, name: str) -> Calendar: ...
|
||||
|
||||
types_factory: Final[TypesFactory]
|
||||
component_factory: Final[ComponentFactory]
|
||||
|
||||
@@ -4,6 +4,8 @@ from collections.abc import Iterable, Mapping
|
||||
from typing import ClassVar, TypeVar, overload
|
||||
from typing_extensions import Self
|
||||
|
||||
__all__ = ["canonsort_keys", "canonsort_items", "CaselessDict"]
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_VT = TypeVar("_VT")
|
||||
|
||||
|
||||
@@ -7,9 +7,33 @@ from typing_extensions import Self
|
||||
|
||||
from .caselessdict import CaselessDict
|
||||
|
||||
__all__ = [
|
||||
"Contentline",
|
||||
"Contentlines",
|
||||
"FOLD",
|
||||
"NAME",
|
||||
"NEWLINE",
|
||||
"Parameters",
|
||||
"QUNSAFE_CHAR",
|
||||
"QUOTABLE",
|
||||
"UNSAFE_CHAR",
|
||||
"dquote",
|
||||
"escape_char",
|
||||
"escape_string",
|
||||
"foldline",
|
||||
"param_value",
|
||||
"q_join",
|
||||
"q_split",
|
||||
"uFOLD",
|
||||
"unescape_char",
|
||||
"unescape_list_or_string",
|
||||
"unescape_string",
|
||||
"validate_param_value",
|
||||
"validate_token",
|
||||
]
|
||||
|
||||
def escape_char(text: str) -> str: ...
|
||||
def unescape_char(text: AnyStr) -> AnyStr: ...
|
||||
def tzid_from_dt(dt): ...
|
||||
def foldline(line: str, limit: int = 75, fold_sep: str = "\r\n ") -> str: ...
|
||||
def param_value(value: str | list[str] | tuple[str, ...] | Incomplete) -> str: ...
|
||||
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
from typing import Any, Final, TypeVar, overload
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
__all__ = ["DEFAULT_ENCODING", "SEQUENCE_TYPES", "ICAL_TYPE", "data_encode", "from_unicode", "to_unicode"]
|
||||
|
||||
SEQUENCE_TYPES: Final[tuple[type[Any], ...]]
|
||||
DEFAULT_ENCODING: str
|
||||
ICAL_TYPE: TypeAlias = str | bytes
|
||||
|
||||
def from_unicode(value: str | bytes, encoding: str = "utf-8") -> bytes: ...
|
||||
def to_unicode(value: str | bytes, encoding: str = "utf-8") -> str: ...
|
||||
def from_unicode(value: ICAL_TYPE, encoding: str = "utf-8") -> bytes: ...
|
||||
def to_unicode(value: ICAL_TYPE, encoding: str = "utf-8-sig") -> str: ...
|
||||
@overload
|
||||
def data_encode(data: str, encoding: str = ...) -> bytes: ...
|
||||
def data_encode(data: ICAL_TYPE, encoding: str = ...) -> bytes: ...
|
||||
@overload
|
||||
def data_encode(data: dict[Any, Any], encoding: str = ...) -> dict[Any, Any]: ...
|
||||
@overload
|
||||
|
||||
@@ -1,137 +1,166 @@
|
||||
import datetime
|
||||
from _typeshed import Incomplete
|
||||
from datetime import tzinfo
|
||||
from _typeshed import Incomplete, Unused
|
||||
from collections.abc import Iterator
|
||||
from enum import Enum
|
||||
from re import Pattern
|
||||
from typing import Any, ClassVar, Final
|
||||
from typing_extensions import TypeAlias
|
||||
from typing import Any, ClassVar, Final, TypeVar, overload
|
||||
from typing_extensions import Self, TypeAlias
|
||||
|
||||
from .caselessdict import CaselessDict
|
||||
from .parser import Parameters
|
||||
from .parser_tools import ICAL_TYPE
|
||||
|
||||
__all__ = [
|
||||
"DURATION_REGEX",
|
||||
"TimeBase",
|
||||
"TypesFactory",
|
||||
"WEEKDAY_RULE",
|
||||
"tzid_from_dt",
|
||||
"vBinary",
|
||||
"vBoolean",
|
||||
"vCalAddress",
|
||||
"vCategory",
|
||||
"vDDDLists",
|
||||
"vDDDTypes",
|
||||
"vDate",
|
||||
"vDatetime",
|
||||
"vDuration",
|
||||
"vFloat",
|
||||
"vFrequency",
|
||||
"vGeo",
|
||||
"vInline",
|
||||
"vInt",
|
||||
"vMonth",
|
||||
"vPeriod",
|
||||
"vRecur",
|
||||
"vSkip",
|
||||
"vText",
|
||||
"vTime",
|
||||
"vUTCOffset",
|
||||
"vUri",
|
||||
"vWeekday",
|
||||
]
|
||||
|
||||
_PropType: TypeAlias = type[Any] # any of the v* classes in this file
|
||||
_vRecurT = TypeVar("_vRecurT", bound=vRecur)
|
||||
|
||||
DURATION_REGEX: Final[Pattern[str]]
|
||||
WEEKDAY_RULE: Final[Pattern[str]]
|
||||
ZERO: Final[datetime.timedelta]
|
||||
HOUR: Final[datetime.timedelta]
|
||||
STDOFFSET: Final[datetime.timedelta]
|
||||
DSTOFFSET: Final[datetime.timedelta]
|
||||
DSTDIFF: Final[datetime.timedelta]
|
||||
|
||||
class FixedOffset(tzinfo):
|
||||
def __init__(self, offset, name) -> None: ...
|
||||
def utcoffset(self, dt): ...
|
||||
def tzname(self, dt): ...
|
||||
def dst(self, dt): ...
|
||||
|
||||
class LocalTimezone(tzinfo):
|
||||
def utcoffset(self, dt): ...
|
||||
def dst(self, dt): ...
|
||||
def tzname(self, dt): ...
|
||||
def tzid_from_dt(dt: datetime.datetime) -> str | None: ...
|
||||
|
||||
class vBinary:
|
||||
obj: Incomplete
|
||||
params: Incomplete
|
||||
params: Parameters
|
||||
def __init__(self, obj) -> None: ...
|
||||
def to_ical(self): ...
|
||||
def to_ical(self) -> bytes: ...
|
||||
@staticmethod
|
||||
def from_ical(ical): ...
|
||||
def __eq__(self, other): ...
|
||||
|
||||
class vBoolean(int):
|
||||
BOOL_MAP: Incomplete
|
||||
params: Incomplete
|
||||
params: Parameters
|
||||
def __new__(cls, *args, **kwargs): ...
|
||||
def to_ical(self): ...
|
||||
def to_ical(self) -> bytes: ...
|
||||
@classmethod
|
||||
def from_ical(cls, ical): ...
|
||||
|
||||
class vText(str):
|
||||
encoding: str
|
||||
params: Parameters
|
||||
def __new__(cls, value: ICAL_TYPE, encoding: str = "utf-8") -> Self: ...
|
||||
def to_ical(self) -> bytes: ...
|
||||
@classmethod
|
||||
def from_ical(cls, ical: ICAL_TYPE) -> Self: ...
|
||||
|
||||
class vCalAddress(str):
|
||||
params: Incomplete
|
||||
params: Parameters
|
||||
def __new__(cls, value, encoding="utf-8"): ...
|
||||
def to_ical(self): ...
|
||||
def to_ical(self) -> bytes: ...
|
||||
@classmethod
|
||||
def from_ical(cls, ical): ...
|
||||
|
||||
class vFloat(float):
|
||||
params: Incomplete
|
||||
params: Parameters
|
||||
def __new__(cls, *args, **kwargs): ...
|
||||
def to_ical(self): ...
|
||||
def to_ical(self) -> bytes: ...
|
||||
@classmethod
|
||||
def from_ical(cls, ical): ...
|
||||
|
||||
class vInt(int):
|
||||
params: Incomplete
|
||||
params: Parameters
|
||||
def __new__(cls, *args, **kwargs): ...
|
||||
def to_ical(self): ...
|
||||
def to_ical(self) -> bytes: ...
|
||||
@classmethod
|
||||
def from_ical(cls, ical): ...
|
||||
def from_ical(cls, ical: ICAL_TYPE) -> Self: ...
|
||||
|
||||
class vDDDLists:
|
||||
params: Incomplete
|
||||
params: Parameters
|
||||
dts: Incomplete
|
||||
def __init__(self, dt_list) -> None: ...
|
||||
def to_ical(self): ...
|
||||
def to_ical(self) -> bytes: ...
|
||||
@staticmethod
|
||||
def from_ical(ical, timezone: Incomplete | None = None): ...
|
||||
def __eq__(self, other): ...
|
||||
|
||||
class vCategory:
|
||||
cats: Incomplete
|
||||
params: Incomplete
|
||||
params: Parameters
|
||||
def __init__(self, c_list) -> None: ...
|
||||
def to_ical(self): ...
|
||||
def __iter__(self) -> Iterator[str]: ...
|
||||
def to_ical(self) -> bytes: ...
|
||||
@staticmethod
|
||||
def from_ical(ical): ...
|
||||
def __eq__(self, other): ...
|
||||
def from_ical(ical: ICAL_TYPE) -> str: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
|
||||
class TimeBase:
|
||||
def __eq__(self, other): ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def __hash__(self): ...
|
||||
|
||||
class vDDDTypes(TimeBase):
|
||||
params: Incomplete
|
||||
params: Parameters
|
||||
dt: Incomplete
|
||||
def __init__(self, dt) -> None: ...
|
||||
def to_ical(self): ...
|
||||
def to_ical(self) -> bytes: ...
|
||||
@classmethod
|
||||
def from_ical(cls, ical, timezone: Incomplete | None = None): ...
|
||||
|
||||
class vDate(TimeBase):
|
||||
dt: Incomplete
|
||||
params: Incomplete
|
||||
params: Parameters
|
||||
def __init__(self, dt) -> None: ...
|
||||
def to_ical(self): ...
|
||||
def to_ical(self) -> bytes: ...
|
||||
@staticmethod
|
||||
def from_ical(ical): ...
|
||||
|
||||
class vDatetime(TimeBase):
|
||||
dt: Incomplete
|
||||
params: Incomplete
|
||||
params: Parameters
|
||||
def __init__(self, dt) -> None: ...
|
||||
def to_ical(self): ...
|
||||
def to_ical(self) -> bytes: ...
|
||||
@staticmethod
|
||||
def from_ical(ical, timezone: Incomplete | None = None): ...
|
||||
def from_ical(ical, timezone: str | None = None) -> datetime.datetime: ...
|
||||
|
||||
class vDuration(TimeBase):
|
||||
td: Incomplete
|
||||
params: Incomplete
|
||||
params: Parameters
|
||||
def __init__(self, td) -> None: ...
|
||||
def to_ical(self): ...
|
||||
def to_ical(self) -> bytes: ...
|
||||
@staticmethod
|
||||
def from_ical(ical): ...
|
||||
@property
|
||||
def dt(self): ...
|
||||
|
||||
class vPeriod(TimeBase):
|
||||
params: Incomplete
|
||||
params: Parameters
|
||||
start: Incomplete
|
||||
end: Incomplete
|
||||
by_duration: Incomplete
|
||||
duration: Incomplete
|
||||
def __init__(self, per) -> None: ...
|
||||
def overlaps(self, other): ...
|
||||
def to_ical(self): ...
|
||||
def to_ical(self) -> bytes: ...
|
||||
@staticmethod
|
||||
def from_ical(ical, timezone: Incomplete | None = None): ...
|
||||
@property
|
||||
@@ -140,61 +169,72 @@ class vPeriod(TimeBase):
|
||||
class vWeekday(str):
|
||||
week_days: Incomplete
|
||||
relative: Incomplete
|
||||
params: Incomplete
|
||||
params: Parameters
|
||||
def __new__(cls, value, encoding="utf-8"): ...
|
||||
def to_ical(self): ...
|
||||
def to_ical(self) -> bytes: ...
|
||||
@classmethod
|
||||
def from_ical(cls, ical): ...
|
||||
|
||||
class vFrequency(str):
|
||||
frequencies: Incomplete
|
||||
params: Incomplete
|
||||
params: Parameters
|
||||
def __new__(cls, value, encoding="utf-8"): ...
|
||||
def to_ical(self): ...
|
||||
def to_ical(self) -> bytes: ...
|
||||
@classmethod
|
||||
def from_ical(cls, ical): ...
|
||||
|
||||
class vMonth(int):
|
||||
leap: bool
|
||||
params: Parameters
|
||||
def __new__(cls, month: vMonth | str | int) -> Self: ...
|
||||
def to_ical(self) -> bytes: ...
|
||||
@classmethod
|
||||
def from_ical(cls, ical: vMonth | str | int) -> Self: ...
|
||||
|
||||
class vSkip(vText, Enum):
|
||||
OMIT = "OMIT"
|
||||
FORWARD = "FORWARD"
|
||||
BACKWARD = "BACKWARD"
|
||||
|
||||
def __reduce_ex__(self, proto: Unused) -> tuple[Any, ...]: ...
|
||||
|
||||
class vRecur(CaselessDict[Incomplete]):
|
||||
frequencies: ClassVar[list[str]]
|
||||
canonical_order: ClassVar[tuple[str, ...]]
|
||||
types: ClassVar[CaselessDict[_PropType]]
|
||||
params: Parameters
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
def to_ical(self): ...
|
||||
def to_ical(self) -> bytes: ...
|
||||
@classmethod
|
||||
def parse_type(cls, key, values): ...
|
||||
@classmethod
|
||||
def from_ical(cls, ical) -> dict[str, Incomplete]: ...
|
||||
|
||||
class vText(str):
|
||||
encoding: Incomplete
|
||||
params: Incomplete
|
||||
def __new__(cls, value, encoding="utf-8"): ...
|
||||
def to_ical(self): ...
|
||||
@overload
|
||||
def from_ical(cls, ical: _vRecurT) -> _vRecurT: ...
|
||||
@classmethod
|
||||
def from_ical(cls, ical): ...
|
||||
@overload
|
||||
def from_ical(cls, ical: str) -> Self: ...
|
||||
|
||||
class vTime(TimeBase):
|
||||
dt: Incomplete
|
||||
params: Incomplete
|
||||
params: Parameters
|
||||
def __init__(self, *args) -> None: ...
|
||||
def to_ical(self): ...
|
||||
def to_ical(self) -> bytes: ...
|
||||
@staticmethod
|
||||
def from_ical(ical): ...
|
||||
|
||||
class vUri(str):
|
||||
params: Incomplete
|
||||
params: Parameters
|
||||
def __new__(cls, value, encoding="utf-8"): ...
|
||||
def to_ical(self): ...
|
||||
def to_ical(self) -> bytes: ...
|
||||
@classmethod
|
||||
def from_ical(cls, ical): ...
|
||||
|
||||
class vGeo:
|
||||
latitude: Incomplete
|
||||
longitude: Incomplete
|
||||
params: Incomplete
|
||||
params: Parameters
|
||||
def __init__(self, geo) -> None: ...
|
||||
def to_ical(self): ...
|
||||
def to_ical(self) -> bytes: ...
|
||||
@staticmethod
|
||||
def from_ical(ical): ...
|
||||
def __eq__(self, other): ...
|
||||
@@ -202,17 +242,17 @@ class vGeo:
|
||||
class vUTCOffset:
|
||||
ignore_exceptions: bool
|
||||
td: Incomplete
|
||||
params: Incomplete
|
||||
params: Parameters
|
||||
def __init__(self, td) -> None: ...
|
||||
def to_ical(self): ...
|
||||
def to_ical(self) -> bytes: ...
|
||||
@classmethod
|
||||
def from_ical(cls, ical): ...
|
||||
def __eq__(self, other): ...
|
||||
|
||||
class vInline(str):
|
||||
params: Incomplete
|
||||
params: Parameters
|
||||
def __new__(cls, value, encoding="utf-8"): ...
|
||||
def to_ical(self): ...
|
||||
def to_ical(self) -> bytes: ...
|
||||
@classmethod
|
||||
def from_ical(cls, ical): ...
|
||||
|
||||
|
||||
8
stubs/icalendar/icalendar/timezone/__init__.pyi
Normal file
8
stubs/icalendar/icalendar/timezone/__init__.pyi
Normal file
@@ -0,0 +1,8 @@
|
||||
from ..timezone.tzp import TZP # to prevent "tzp" from being defined here
|
||||
|
||||
__all__ = ["tzp", "use_pytz", "use_zoneinfo"]
|
||||
|
||||
tzp: TZP
|
||||
|
||||
def use_pytz() -> None: ...
|
||||
def use_zoneinfo() -> None: ...
|
||||
29
stubs/icalendar/icalendar/timezone/provider.pyi
Normal file
29
stubs/icalendar/icalendar/timezone/provider.pyi
Normal file
@@ -0,0 +1,29 @@
|
||||
__all__ = ["TZProvider"]
|
||||
|
||||
import datetime
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
from dateutil.rrule import rrule
|
||||
|
||||
from ..prop import vRecur
|
||||
|
||||
class TZProvider(ABC):
|
||||
@property
|
||||
@abstractmethod
|
||||
def name(self) -> str: ...
|
||||
@abstractmethod
|
||||
def localize_utc(self, dt: datetime.datetime) -> datetime.datetime: ...
|
||||
@abstractmethod
|
||||
def localize(self, dt: datetime.datetime, tz: datetime.tzinfo) -> datetime.datetime: ...
|
||||
@abstractmethod
|
||||
def knows_timezone_id(self, id: str) -> bool: ...
|
||||
@abstractmethod
|
||||
def fix_rrule_until(self, rrule: rrule, ical_rrule: vRecur) -> None: ...
|
||||
@abstractmethod
|
||||
def create_timezone(self, name: str, transition_times, transition_info) -> datetime.tzinfo: ...
|
||||
@abstractmethod
|
||||
def timezone(self, name: str) -> datetime.tzinfo | None: ...
|
||||
@abstractmethod
|
||||
def uses_pytz(self) -> bool: ...
|
||||
@abstractmethod
|
||||
def uses_zoneinfo(self) -> bool: ...
|
||||
22
stubs/icalendar/icalendar/timezone/pytz.pyi
Normal file
22
stubs/icalendar/icalendar/timezone/pytz.pyi
Normal file
@@ -0,0 +1,22 @@
|
||||
__all__ = ["PYTZ"]
|
||||
|
||||
import datetime
|
||||
from typing import Literal
|
||||
|
||||
from dateutil.rrule import rrule
|
||||
|
||||
from ..cal import Timezone
|
||||
from ..prop import vRecur
|
||||
from .provider import TZProvider
|
||||
|
||||
class PYTZ(TZProvider):
|
||||
@property
|
||||
def name(self) -> Literal["pytz"]: ...
|
||||
def localize_utc(self, dt: datetime.datetime) -> datetime.datetime: ...
|
||||
def localize(self, dt: datetime.datetime, tz: datetime.tzinfo) -> datetime.datetime: ...
|
||||
def knows_timezone_id(self, id: str) -> bool: ...
|
||||
def fix_rrule_until(self, rrule: rrule, ical_rrule: vRecur) -> None: ...
|
||||
def create_timezone(self, tz: Timezone) -> datetime.tzinfo: ... # type: ignore[override]
|
||||
def timezone(self, name: str) -> datetime.tzinfo | None: ...
|
||||
def uses_pytz(self) -> bool: ...
|
||||
def uses_zoneinfo(self) -> bool: ...
|
||||
30
stubs/icalendar/icalendar/timezone/tzp.pyi
Normal file
30
stubs/icalendar/icalendar/timezone/tzp.pyi
Normal file
@@ -0,0 +1,30 @@
|
||||
import datetime
|
||||
from typing import Final
|
||||
|
||||
from dateutil.rrule import rrule
|
||||
|
||||
from ..cal import Timezone
|
||||
from ..prop import vRecur
|
||||
from .provider import TZProvider
|
||||
|
||||
__all__ = ["TZP"]
|
||||
|
||||
DEFAULT_TIMEZONE_PROVIDER: Final = "zoneinfo"
|
||||
|
||||
class TZP:
|
||||
def __init__(self, provider: str | TZProvider = "zoneinfo") -> None: ...
|
||||
def use_pytz(self) -> None: ...
|
||||
def use_zoneinfo(self) -> None: ...
|
||||
def use(self, provider: str | TZProvider) -> None: ...
|
||||
def use_default(self) -> None: ...
|
||||
def localize_utc(self, dt: datetime.datetime) -> datetime.datetime: ...
|
||||
def localize(self, dt: datetime.datetime, tz: datetime.tzinfo | str) -> datetime.datetime: ...
|
||||
def cache_timezone_component(self, timezone_component: Timezone) -> None: ...
|
||||
def fix_rrule_until(self, rrule: rrule, ical_rrule: vRecur) -> None: ...
|
||||
def create_timezone(self, timezone_component: Timezone) -> datetime.tzinfo: ...
|
||||
def clean_timezone_id(self, tzid: str) -> str: ...
|
||||
def timezone(self, id: str) -> datetime.tzinfo | None: ...
|
||||
def uses_pytz(self) -> bool: ...
|
||||
def uses_zoneinfo(self) -> bool: ...
|
||||
@property
|
||||
def name(self) -> str: ...
|
||||
33
stubs/icalendar/icalendar/timezone/zoneinfo.pyi
Normal file
33
stubs/icalendar/icalendar/timezone/zoneinfo.pyi
Normal file
@@ -0,0 +1,33 @@
|
||||
import datetime
|
||||
import sys
|
||||
from typing import Final, Literal
|
||||
|
||||
from dateutil.rrule import rrule, rruleset
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
from zoneinfo import ZoneInfo
|
||||
else:
|
||||
from backports.zoneinfo import ZoneInfo
|
||||
|
||||
from ..cal import Timezone
|
||||
from ..prop import vRecur
|
||||
from .provider import TZProvider
|
||||
|
||||
__all__ = ["ZONEINFO"]
|
||||
|
||||
class ZONEINFO(TZProvider):
|
||||
@property
|
||||
def name(self) -> Literal["zoneinfo"]: ...
|
||||
utc: Final[ZoneInfo]
|
||||
def localize(self, dt: datetime.datetime, tz: ZoneInfo) -> datetime.datetime: ... # type: ignore[override]
|
||||
def localize_utc(self, dt: datetime.datetime) -> datetime.datetime: ...
|
||||
def timezone(self, name: str) -> datetime.tzinfo | None: ...
|
||||
def knows_timezone_id(self, id: str) -> bool: ...
|
||||
def fix_rrule_until(self, rrule: rrule, ical_rrule: vRecur) -> None: ...
|
||||
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): ...
|
||||
@@ -2,6 +2,8 @@ from typing import Final
|
||||
|
||||
from .prop import vText
|
||||
|
||||
__all__ = ["UIDGenerator"]
|
||||
|
||||
class UIDGenerator:
|
||||
chars: Final[list[str]]
|
||||
@staticmethod
|
||||
|
||||
8
stubs/icalendar/icalendar/version.pyi
Normal file
8
stubs/icalendar/icalendar/version.pyi
Normal file
@@ -0,0 +1,8 @@
|
||||
__all__ = ["__version__", "version", "__version_tuple__", "version_tuple"]
|
||||
|
||||
from typing import Final
|
||||
|
||||
__version__: Final[str]
|
||||
__version_tuple__: Final[tuple[int, ...]]
|
||||
version: Final[str]
|
||||
version_tuple: Final[tuple[int, ...]]
|
||||
Reference in New Issue
Block a user