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

Method get_header

Lib/test/test_tools/test_i18n.py:55–64  ·  view source on GitHub ↗

utility: return the header of a .po file as a dictionary

(self, data)

Source from the content-addressed store, hash-verified

53 script = Path(toolsdir, 'i18n', 'pygettext.py')
54
55 def get_header(self, data):
56 """ utility: return the header of a .po file as a dictionary """
57 headers = {}
58 for line in data.split('\n'):
59 if not line or line.startswith(('#', 'msgid', 'msgstr')):
60 continue
61 line = line.strip('"')
62 key, val = line.split(':', 1)
63 headers[key] = val.strip()
64 return headers
65
66 def get_msgids(self, data):
67 """ utility: return all msgids in .po file as a list of strings """

Callers 9

test_headerMethod · 0.95
test_http_body_fileMethod · 0.45
test_http_body_pipeMethod · 0.45
test_http_body_arrayMethod · 0.45
_test_basic_authMethod · 0.45

Calls 3

splitMethod · 0.45
startswithMethod · 0.45
stripMethod · 0.45

Tested by

no test coverage detected