Skip to content

Commit 0984199

Browse files
committed
Remove Period.intersect()
1 parent fc33b9f commit 0984199

File tree

3 files changed

+1
-83
lines changed

3 files changed

+1
-83
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
- Removed `xrange()` method of the `Period` class and made `range()` a generator.
3232
- New locale system which uses CLDR data for most of the translations.
3333
- `diff_for_humans()` now returns `a few seconds` where appropriate.
34+
- Removed `Period.intersect()`.
3435

3536

3637

pendulum/period.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -265,30 +265,6 @@ def range(self, unit, amount=1):
265265

266266
i += amount
267267

268-
def intersect(self, *periods):
269-
"""
270-
Return the Period intersection of the current Period
271-
and the given periods.
272-
273-
:type periods: tuple of Period
274-
275-
:rtype: Period
276-
"""
277-
start, end = self.start, self.end
278-
has_intersection = False
279-
for period in periods:
280-
if period.end < start or period.start > end:
281-
continue
282-
283-
has_intersection = True
284-
start = max(start, period.start)
285-
end = min(end, period.end)
286-
287-
if not has_intersection:
288-
return None
289-
290-
return self.__class__(start, end)
291-
292268
def as_interval(self):
293269
"""
294270
Return the Period as an Duration.

tests/period/test_intersect.py

Lines changed: 0 additions & 59 deletions
This file was deleted.

0 commit comments

Comments
 (0)