Skip to content

Commit

Permalink
Merge pull request #160 from niccokunzmann/issue-159
Browse files Browse the repository at this point in the history
remove and list TODOs
  • Loading branch information
niccokunzmann authored Aug 21, 2024
2 parents 326929f + 9f7ac32 commit 95ecb7d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
15 changes: 3 additions & 12 deletions recurring_ical_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,6 @@ def __init__(self, components: Sequence[ComponentAdapter]):
if isinstance(rdate, tuple):
# we have a period as rdate
self.rdates.add(rdate[0])
# TODO: Test RDATE Period with duration
for recurrence_id in to_recurrence_ids(rdate[0]):
self.replace_ends[recurrence_id] = rdate[1]
else:
Expand Down Expand Up @@ -385,9 +384,7 @@ def __init__(self, components: Sequence[ComponentAdapter]):
self.rule_set.rdate(rdate)

if not last_until or not compare_greater(self.start, last_until):
self.rule_set.rdate(
self.start
) # TODO: Check if we can remove this when all tests run
self.rule_set.rdate(self.start)

def create_rule_with_start(self, rule_string) -> rrule:
"""Helper to create an rrule from a rule_string
Expand Down Expand Up @@ -504,8 +501,6 @@ def between(self, span_start: Time, span_stop: Time) -> Generator[Occurrence]:
span_stop_dt = convert_to_datetime(span_stop, self.tzinfo)
if compare_greater(span_start_dt, self.start):
# do not exclude an component if it spans across the time span
# TODO: Test if modification is included if it has a very long
# duration even if the start is way off
span_start_dt -= self.core.duration
# we have to account for pytz timezones not being properly calculated
# at the timezone changes. This is a heuristic: most changes are only 1 hour.
Expand All @@ -519,9 +514,6 @@ def between(self, span_start: Time, span_stop: Time) -> Generator[Occurrence]:
# may still be mixed because RDATE, EXDATE, start and rule.
for start in self.rrule_between(span_start_dt, span_stop_dt):
recurrence_ids = to_recurrence_ids(start)
# TODO: What if a modification is moved to the same time as another
# occurrence?
# This should be tested.
if (
start in returned_starts
or convert_to_date(start) in self.check_exdates_date
Expand Down Expand Up @@ -552,7 +544,6 @@ def between(self, span_start: Time, span_stop: Time) -> Generator[Occurrence]:
continue
returned_modifications.add(adapter)
occurrence = Occurrence(adapter)
# TODO: Test: use time from event modification over RDATE
if occurrence.is_in_span(span_start, span_stop):
yield occurrence
for modification in self.modifications:
Expand Down Expand Up @@ -651,7 +642,6 @@ def collect_components(
def as_component(self, start: Time, stop: Time, keep_recurrence_attributes: bool): # noqa: FBT001
"""Create a shallow copy of the source event and modify some attributes."""
copied_component = self._component.copy()
# TODO: Test that duration gets removed for all component types
copied_component["DTSTART"] = vDDDTypes(start)
if self.end_property is not None:
copied_component[self.end_property] = vDDDTypes(stop)
Expand Down Expand Up @@ -1109,7 +1099,7 @@ def count(self) -> int:
return i

def of(
a_calendar : Component,
a_calendar: Component,
keep_recurrence_attributes=False,
components: Sequence[str | type[ComponentAdapter]] = ("VEVENT",),
skip_bad_series: bool = False, # noqa: FBT001
Expand All @@ -1127,6 +1117,7 @@ def of(
a_calendar, keep_recurrence_attributes, components, skip_bad_series
)


__all__ = [
"of",
"InvalidCalendar",
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

[tox]
skipsdist = True
envlist = py38, py39, py310, py311, py312
envlist = py38, py39, py310, py311, py312, ruff

[testenv]
setenv = TMPDIR={envtmpdir}
Expand Down

0 comments on commit 95ecb7d

Please sign in to comment.