Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/icalendar/prop/uid.py: 78%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1"""UID values from :rfc:`9253`."""
4import uuid
5from typing import ClassVar
7from icalendar.compatibility import Self
9from .text import vText
12class vUid(vText):
13 """A UID of a component.
15 This is defined in :rfc:`9253`, Section 7.
16 """
18 default_value: ClassVar[str] = "UID"
20 @classmethod
21 def new(cls) -> Self:
22 """Create a new UID for convenience.
24 .. code-block:: pycon
26 >>> from icalendar import vUid
27 >>> vUid.new()
28 vUid('d755cef5-2311-46ed-a0e1-6733c9e15c63')
30 """
31 return vUid(uuid.uuid4())
33 @property
34 def uid(self) -> str:
35 """The UID of this property."""
36 return str(self)
38 @property
39 def ical_value(self) -> str:
40 """The UID of this property."""
41 return self.uid
43 def __repr__(self) -> str:
44 """repr(self)"""
45 return f"{self.__class__.__name__}({self.uid!r})"
47 from icalendar.param import FMTTYPE, LABEL, LINKREL
49 @classmethod
50 def examples(cls) -> list[Self]:
51 """Examples of vUid."""
52 return [cls("d755cef5-2311-46ed-a0e1-6733c9e15c63")]
54__all__ = ["vUid"]