(self, tzinfos, tzname, tzoffset)
| 1157 | # subclassing. |
| 1158 | |
| 1159 | def _build_tzinfo(self, tzinfos, tzname, tzoffset): |
| 1160 | if callable(tzinfos): |
| 1161 | tzdata = tzinfos(tzname, tzoffset) |
| 1162 | else: |
| 1163 | tzdata = tzinfos.get(tzname) |
| 1164 | # handle case where tzinfo is paased an options that returns None |
| 1165 | # eg tzinfos = {'BRST' : None} |
| 1166 | if isinstance(tzdata, datetime.tzinfo) or tzdata is None: |
| 1167 | tzinfo = tzdata |
| 1168 | elif isinstance(tzdata, text_type): |
| 1169 | tzinfo = tz.tzstr(tzdata) |
| 1170 | elif isinstance(tzdata, integer_types): |
| 1171 | tzinfo = tz.tzoffset(tzname, tzdata) |
| 1172 | else: |
| 1173 | raise TypeError("Offset must be tzinfo subclass, tz string, " |
| 1174 | "or int offset.") |
| 1175 | return tzinfo |
| 1176 | |
| 1177 | def _build_tzaware(self, naive, res, tzinfos): |
| 1178 | if (callable(tzinfos) or (tzinfos and res.tzname in tzinfos)): |
no test coverage detected