(self, source_json)
| 2176 | return self.tzpath / key |
| 2177 | |
| 2178 | def _populate_tzpath(self, source_json): |
| 2179 | with open(source_json, "rb") as f: |
| 2180 | zoneinfo_dict = json.load(f) |
| 2181 | |
| 2182 | zoneinfo_data = zoneinfo_dict["data"] |
| 2183 | |
| 2184 | for key, value in zoneinfo_data.items(): |
| 2185 | self.keys.append(key) |
| 2186 | raw_data = self._decode_text(value) |
| 2187 | |
| 2188 | if self.v1: |
| 2189 | data = self._convert_to_v1(raw_data) |
| 2190 | else: |
| 2191 | data = raw_data |
| 2192 | |
| 2193 | destination = self.path_from_key(key) |
| 2194 | destination.parent.mkdir(exist_ok=True, parents=True) |
| 2195 | with open(destination, "wb") as f: |
| 2196 | f.write(data) |
| 2197 | |
| 2198 | def _decode_text(self, contents): |
| 2199 | raw_data = b"".join(map(str.encode, contents)) |
no test coverage detected