(self, dt)
| 5605 | return self.stdoffset + self.dst(dt) |
| 5606 | |
| 5607 | def dst(self, dt): |
| 5608 | if dt is None or dt.tzinfo is None: |
| 5609 | # An exception instead may be sensible here, in one or more of |
| 5610 | # the cases. |
| 5611 | return ZERO |
| 5612 | assert dt.tzinfo is self |
| 5613 | |
| 5614 | # Find first Sunday in April. |
| 5615 | start = first_sunday_on_or_after(DSTSTART.replace(year=dt.year)) |
| 5616 | assert start.weekday() == 6 and start.month == 4 and start.day <= 7 |
| 5617 | |
| 5618 | # Find last Sunday in October. |
| 5619 | end = first_sunday_on_or_after(DSTEND.replace(year=dt.year)) |
| 5620 | assert end.weekday() == 6 and end.month == 10 and end.day >= 25 |
| 5621 | |
| 5622 | # Can't compare naive to aware objects, so strip the timezone from |
| 5623 | # dt first. |
| 5624 | if start <= dt.replace(tzinfo=None) < end: |
| 5625 | return HOUR |
| 5626 | else: |
| 5627 | return ZERO |
| 5628 | |
| 5629 | Eastern = USTimeZone(-5, "Eastern", "EST", "EDT") |
| 5630 | Central = USTimeZone(-6, "Central", "CST", "CDT") |
no test coverage detected