Skip to content

Commit a168ad4

Browse files
committed
style fix
1 parent c2f72c3 commit a168ad4

2 files changed

Lines changed: 20 additions & 8 deletions

File tree

examples/get_events_example.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
#!/usr/bin/env python3
22
import json
33

4+
from caldav.davclient import get_davclient
5+
46
## Code contributed by Крылов Александр. Minor changes and quite some
57
## comments by Tobias Brox.
6-
78
## Set CALDAV_USERNAME, CALDAV_URL and CALDAV_PASSWORD through
89
## environment variables before running this example
910

10-
from caldav.davclient import get_davclient
1111

1212
def fetch_and_print():
1313
with get_davclient() as client:
1414
print_calendars_demo(client.principal().calendars())
1515

16+
1617
def print_calendars_demo(calendars):
1718
if not calendars:
1819
return
@@ -29,6 +30,7 @@ def print_calendars_demo(calendars):
2930
events.append(fill_event(component, calendar))
3031
print(json.dumps(events, indent=2, ensure_ascii=False))
3132

33+
3234
def fill_event(component, calendar) -> dict[str, str]:
3335
## quite some data is tossed away here - like, the recurring rule.
3436
cur = {}
@@ -44,5 +46,6 @@ def fill_event(component, calendar) -> dict[str, str]:
4446
cur["datestamp"] = component.get("dtstamp").dt.strftime("%m/%d/%Y %H:%M")
4547
return cur
4648

49+
4750
if __name__ == "__main__":
4851
fetch_and_print()

tests/test_examples.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,28 @@
11
import os
22
import sys
3-
from caldav.davclient import get_davclient
43
from datetime import datetime
54

5+
from caldav.davclient import get_davclient
6+
7+
68
class TestExamples:
79
def setup_method(self):
8-
os.environ['PYTHON_CALDAV_USE_TEST_SERVER'] = '1'
9-
sys.path.insert(0,'.')
10-
sys.path.insert(1,'..')
10+
os.environ["PYTHON_CALDAV_USE_TEST_SERVER"] = "1"
11+
sys.path.insert(0, ".")
12+
sys.path.insert(1, "..")
13+
1114
def teardown_method(self):
1215
sys.path = sys.path[2:]
13-
del os.environ['PYTHON_CALDAV_USE_TEST_SERVER']
16+
del os.environ["PYTHON_CALDAV_USE_TEST_SERVER"]
17+
1418
def test_get_events_example(self):
1519
with get_davclient() as client:
1620
mycal = client.principal().make_calendar(name="Test calendar")
17-
mycal.save_event(dtstart=datetime(2025,5,3,10), dtend=datetime(2025,5,3,11),summary="testevent")
21+
mycal.save_event(
22+
dtstart=datetime(2025, 5, 3, 10),
23+
dtend=datetime(2025, 5, 3, 11),
24+
summary="testevent",
25+
)
1826
from examples import get_events_example
27+
1928
get_events_example.fetch_and_print()

0 commit comments

Comments
 (0)