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`."""
3import uuid
4from typing import ClassVar
6from icalendar.compatibility import Self
8from .text import vText
11class vUid(vText):
12 """A UID of a component.
14 This is defined in :rfc:`9253`, Section 7.
15 """
17 default_value: ClassVar[str] = "UID"
19 @classmethod
20 def new(cls) -> Self:
21 """Create a new UID for convenience.
23 .. code-block:: pycon
25 >>> from icalendar import vUid
26 >>> vUid.new()
27 vUid('d755cef5-2311-46ed-a0e1-6733c9e15c63')
29 """
30 return vUid(uuid.uuid4())
32 @property
33 def uid(self) -> str:
34 """The UID of this property."""
35 return str(self)
37 @property
38 def ical_value(self) -> str:
39 """The UID of this property."""
40 return self.uid
42 def __repr__(self) -> str:
43 """repr(self)"""
44 return f"{self.__class__.__name__}({self.uid!r})"
46 from icalendar.param import FMTTYPE, LABEL, LINKREL
48 @classmethod
49 def examples(cls) -> list[Self]:
50 """Examples of vUid."""
51 return [cls("d755cef5-2311-46ed-a0e1-6733c9e15c63")]
54__all__ = ["vUid"]