fix inline examples

pull/757/head
Abe Hanoka 2024-12-10 09:58:45 -05:00
rodzic 804ab52970
commit 87d90b4982
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7B605E1EB3F95000
1 zmienionych plików z 11 dodań i 9 usunięć

Wyświetl plik

@ -613,10 +613,14 @@ class Component(CaselessDict):
Example:
>>> from icalendar import Calendar
>>> from pathlib import Path
>>> # Read a calendar file
>>> cal = Calendar.from_file("src/icalendar/tests/calendars/example.ics")
>>> # Read multiple calendars
>>> cals = Calendar.from_file("src/icalendar/tests/calendars/multiple_calendar_components.ics", multiple=True)
>>> # or pass a Path object
>>> path = Path("src/icalendar/tests/calendars/example.ics")
>>> cal = Calendar.from_file(path)
"""
# Handle string path by converting to Path
if isinstance(file, str):
@ -637,15 +641,13 @@ class Component(CaselessDict):
sorted: Whether parameters and properties should be lexicographically sorted.
Example:
>>> from icalendar import Calendar
>>> from pathlib import Path
>>> # Read a calendar file
>>> cal = Calendar.from_file("src/icalendar/tests/calendars/example.ics")
>>> # or pass a Path object
>>> path = Path("src/icalendar/tests/calendars/example.ics")
>>> cal = Calendar.from_file(path)
>>> # Read multiple calendars
>>> cals = Calendar.from_file("src/icalendar/tests/calendars/multiple_calendar_components.ics", multiple=True)
>>> from icalendar import Calendar, Event
>>> # Write a calendar
>>> cal = Calendar()
>>> cal.to_file("calendar.ics")
>>> # Write an event
>>> event = Event()
>>> event.to_file("event.ics")
"""