MCPcopy Index your code
hub / github.com/RustPython/RustPython / zone_from_tzstr

Method zone_from_tzstr

Lib/test/test_zoneinfo/test_zoneinfo.py:980–992  ·  view source on GitHub ↗

Creates a zoneinfo file following a POSIX rule.

(self, tzstr)

Source from the content-addressed store, hash-verified

978 cls._tzif_header = bytes(out)
979
980 def zone_from_tzstr(self, tzstr):
981 """Creates a zoneinfo file following a POSIX rule."""
982 zonefile = io.BytesIO(self._tzif_header)
983 zonefile.seek(0, 2)
984
985 # Write the footer
986 zonefile.write(b"\x0A")
987 zonefile.write(tzstr.encode("ascii"))
988 zonefile.write(b"\x0A")
989
990 zonefile.seek(0)
991
992 return self.klass.from_file(zonefile, key=tzstr)
993
994 def test_tzstr_localized(self):
995 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