(self, dt)
| 115 | return self.stdoffset + self.dst(dt) |
| 116 | |
| 117 | def dst(self, dt): |
| 118 | if dt is None or dt.tzinfo is None: |
| 119 | # An exception may be sensible here, in one or both cases. |
| 120 | # It depends on how you want to treat them. The default |
| 121 | # fromutc() implementation (called by the default astimezone() |
| 122 | # implementation) passes a datetime with dt.tzinfo is self. |
| 123 | return ZERO |
| 124 | assert dt.tzinfo is self |
| 125 | |
| 126 | # Find first Sunday in April & the last in October. |
| 127 | start = first_sunday_on_or_after(DSTSTART.replace(year=dt.year)) |
| 128 | end = first_sunday_on_or_after(DSTEND.replace(year=dt.year)) |
| 129 | |
| 130 | # Can't compare naive to aware objects, so strip the timezone from |
| 131 | # dt first. |
| 132 | if start <= dt.replace(tzinfo=None) < end: |
| 133 | return HOUR |
| 134 | else: |
| 135 | return ZERO |
| 136 | |
| 137 | Eastern = USTimeZone(-5, "Eastern", "EST", "EDT") |
| 138 | Central = USTimeZone(-6, "Central", "CST", "CDT") |
no test coverage detected