Merge remote-tracking branch 'origin' into ci/devcontainers

pull/135/head
Martin Eigenmann 2024-09-09 12:33:17 +02:00
commit 04ce161b4b
Nie znaleziono w bazie danych klucza dla tego podpisu
6 zmienionych plików z 141 dodań i 9 usunięć

Wyświetl plik

@ -23,14 +23,14 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install poetry==1.1.11 pip install poetry==1.8.3
- name: Build package - name: Build package
run: poetry build run: poetry build
- name: Upload packages to Jazzband - name: Upload packages to Jazzband
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master uses: pypa/gh-action-pypi-publish@release/v1
with: with:
user: jazzband user: jazzband
password: ${{ secrets.JAZZBAND_RELEASE_KEY }} password: ${{ secrets.JAZZBAND_RELEASE_KEY }}

Wyświetl plik

@ -31,4 +31,4 @@ jobs:
- name: 'Upload coverage to Codecov' - name: 'Upload coverage to Codecov'
uses: codecov/codecov-action@v4 uses: codecov/codecov-action@v4
with: with:
fail_ci_if_error: true fail_ci_if_error: false

Wyświetl plik

@ -365,12 +365,42 @@ def parse_events(
if type(s) is date and e.recurring == False: if type(s) is date and e.recurring == False:
f, t = start, end f, t = start, end
elif type(s) is datetime and s.tzinfo: elif type(s) is datetime and s.tzinfo:
f, t = datetime( f = (
start.year, start.month, start.day, tzinfo=s.tzinfo datetime(
), datetime(end.year, end.month, end.day, tzinfo=s.tzinfo) start.year,
start.month,
start.day,
start.hour,
start.minute,
tzinfo=s.tzinfo,
)
if type(start) == datetime
else datetime(start.year, start.month, start.day, tzinfo=s.tzinfo)
)
t = (
datetime(
end.year,
end.month,
end.day,
end.hour,
end.minute,
tzinfo=s.tzinfo,
)
if type(end) == datetime
else datetime(end.year, end.month, end.day, tzinfo=s.tzinfo)
)
else: else:
f, t = datetime(start.year, start.month, start.day), datetime( f = (
end.year, end.month, end.day datetime(
start.year, start.month, start.day, start.hour, start.minute
)
if type(start) == datetime
else datetime(start.year, start.month, start.day)
)
t = (
datetime(end.year, end.month, end.day, end.hour, end.minute)
if type(end) == datetime
else datetime(end.year, end.month, end.day)
) )
if e.recurring: if e.recurring:

Wyświetl plik

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "icalevents" name = "icalevents"
version = "0.1.27" version = "0.1.28"
description = "Simple Python 3 library to download, parse and query iCal sources." description = "Simple Python 3 library to download, parse and query iCal sources."
authors = ["Martin Eigenmann <github@eigenmannmartin.ch>", "Thomas Irgang <thomas@irgang.eu>", authors = ["Martin Eigenmann <github@eigenmannmartin.ch>", "Thomas Irgang <thomas@irgang.eu>",
"Alexander Hultnér <ahultner+github@gmail.com>"] "Alexander Hultnér <ahultner+github@gmail.com>"]

Wyświetl plik

@ -0,0 +1,91 @@
BEGIN:VCALENDAR
METHOD:PUBLISH
PRODID:Microsoft Exchange Server 2010
VERSION:2.0
X-WR-CALNAME:Calendar
BEGIN:VTIMEZONE
TZID:Pacific Standard Time
BEGIN:STANDARD
DTSTART:16010101T020000
TZOFFSETFROM:-0700
TZOFFSETTO:-0800
RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:16010101T020000
TZOFFSETFROM:-0800
TZOFFSETTO:-0700
RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VTIMEZONE
TZID:UTC
BEGIN:STANDARD
DTSTART:16010101T000000
TZOFFSETFROM:+0000
TZOFFSETTO:+0000
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:16010101T000000
TZOFFSETFROM:+0000
TZOFFSETTO:+0000
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VTIMEZONE
TZID:Central Standard Time
BEGIN:STANDARD
DTSTART:16010101T020000
TZOFFSETFROM:-0500
TZOFFSETTO:-0600
RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:16010101T020000
TZOFFSETFROM:-0600
TZOFFSETTO:-0500
RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VTIMEZONE
TZID:Eastern Standard Time
BEGIN:STANDARD
DTSTART:16010101T020000
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=1SU;BYMONTH=11
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:16010101T020000
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
RRULE:FREQ=YEARLY;INTERVAL=1;BYDAY=2SU;BYMONTH=3
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VTIMEZONE
TZID:India Standard Time
BEGIN:STANDARD
DTSTART:16010101T000000
TZOFFSETFROM:+0530
TZOFFSETTO:+0530
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:16010101T000000
TZOFFSETFROM:+0530
TZOFFSETTO:+0530
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
UID:0400AAAA8200E00074C5B7101A82E0080000000085E5DC3409AAAA01000000000000000
010000000AAAADE08C53CAA4283D0AAA1A2AAA97
SUMMARY:TEST Summary
DTSTART;TZID=Pacific Standard Time:20230509T090000
DTEND;TZID=Pacific Standard Time:20230509T100000
CLASS:PUBLIC
PRIORITY:5
DTSTAMP:20230509T014745Z
TRANSP:OPAQUE
STATUS:CONFIRMED
SEQUENCE:0
LOCATION:
END:VEVENT
END:VCALENDAR

Wyświetl plik

@ -862,6 +862,17 @@ class ICalEventsTests(unittest.TestCase):
"starts at 5 utc summer time (+2:00)", "starts at 5 utc summer time (+2:00)",
) )
def test_small_time_frame(self):
ical = "test/test_data/small_time_frame.ics"
PT = gettz("America/Los_Angeles")
start = datetime(month=5, day=9, year=2023, tzinfo=PT)
end = datetime(month=5, day=9, year=2023, hour=23, tzinfo=PT)
events = icalevents.events(file=ical, start=start, end=end, strict=True)
self.assertEqual(len(events), 1, "1 events")
def test_regression_repeating_events_raise_an_error(self): def test_regression_repeating_events_raise_an_error(self):
ical = "test/test_data/recurrence_tzinfo.ics" ical = "test/test_data/recurrence_tzinfo.ics"
start = date(2023, 1, 1) start = date(2023, 1, 1)