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

Method zone_from_tzstr

Lib/test/test_zoneinfo/test_zoneinfo.py:1012–1024  ·  view source on GitHub ↗

Creates a zoneinfo file following a POSIX rule.

(self, tzstr)

Source from the content-addressed store, hash-verified

1010 cls._tzif_header = bytes(out)
1011
1012 def zone_from_tzstr(self, tzstr):
1013 """Creates a zoneinfo file following a POSIX rule."""
1014 zonefile = io.BytesIO(self._tzif_header)
1015 zonefile.seek(0, 2)
1016
1017 # Write the footer
1018 zonefile.write(b"\x0A")
1019 zonefile.write(tzstr.encode("ascii"))
1020 zonefile.write(b"\x0A")
1021
1022 zonefile.seek(0)
1023
1024 return self.klass.from_file(zonefile, key=tzstr)
1025
1026 def test_tzstr_localized(self):
1027 for tzstr, cases in self.test_cases.items():

Callers 4

test_tzstr_localizedMethod · 0.95
test_tzstr_from_utcMethod · 0.95
test_extreme_tzstrMethod · 0.95
test_invalid_tzstrMethod · 0.95

Calls 4

seekMethod · 0.95
writeMethod · 0.95
encodeMethod · 0.45
from_fileMethod · 0.45

Tested by

no test coverage detected