MCPcopy Index your code
hub / github.com/python/cpython / _populate_tzpath

Method _populate_tzpath

Lib/test/test_zoneinfo/test_zoneinfo.py:2178–2196  ·  view source on GitHub ↗
(self, source_json)

Source from the content-addressed store, hash-verified

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))

Callers 1

__init__Method · 0.95

Calls 9

_decode_textMethod · 0.95
_convert_to_v1Method · 0.95
path_from_keyMethod · 0.95
openFunction · 0.50
loadMethod · 0.45
itemsMethod · 0.45
appendMethod · 0.45
mkdirMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected