MCPcopy Create free account
hub / github.com/dateutil/dateutil / zone_from_tzstr

Function zone_from_tzstr

tests/test_tzfile.py:288–300  ·  view source on GitHub ↗

Creates a zoneinfo file following a POSIX rule.

(tzstr, encoding="ascii")

Source from the content-addressed store, hash-verified

286
287
288def zone_from_tzstr(tzstr, encoding="ascii"):
289 """Creates a zoneinfo file following a POSIX rule."""
290 zonefile = io.BytesIO(_tzstr_header())
291 zonefile.seek(0, 2)
292
293 # Write the footer
294 zonefile.write(b"\x0a")
295 zonefile.write(tzstr.encode(encoding))
296 zonefile.write(b"\x0a")
297
298 zonefile.seek(0)
299
300 return tz.tzfile(zonefile, key=tzstr)
301
302
303@pytest.fixture

Callers 5

add_tzstr_testsFunction · 0.85
test_eq_no_transitionsFunction · 0.85
test_extreme_tzstrFunction · 0.85
test_invalid_tzstrFunction · 0.85

Calls 1

_tzstr_headerFunction · 0.85

Tested by

no test coverage detected