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

Method get_msgids

Lib/test/test_tools/test_i18n.py:66–88  ·  view source on GitHub ↗

utility: return all msgids in .po file as a list of strings

(self, data)

Source from the content-addressed store, hash-verified

64 return headers
65
66 def get_msgids(self, data):
67 """ utility: return all msgids in .po file as a list of strings """
68 msgids = []
69 reading_msgid = False
70 cur_msgid = []
71 for line in data.split('\n'):
72 if reading_msgid:
73 if line.startswith('"'):
74 cur_msgid.append(line.strip('"'))
75 else:
76 msgids.append('\n'.join(cur_msgid))
77 cur_msgid = []
78 reading_msgid = False
79 continue
80 if line.startswith('msgid '):
81 line = line[len('msgid '):]
82 cur_msgid.append(line.strip('"'))
83 reading_msgid = True
84 else:
85 if reading_msgid:
86 msgids.append('\n'.join(cur_msgid))
87
88 return msgids
89
90 def assert_POT_equal(self, expected, actual):
91 """Check if two POT files are equal"""

Callers 1

extract_from_strMethod · 0.95

Calls 5

splitMethod · 0.45
startswithMethod · 0.45
appendMethod · 0.45
stripMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected