Caught by PyCharm.
Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHG04e0e0e73892: polib: drop an unused local function
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
hg-reviewers |
Caught by PyCharm.
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | i18n/polib.py (12 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
b11a5da8322b | 73e04983bb5c | Matt Harbison | Dec 27 2019, 1:50 PM |
Status | Author | Revision | |
---|---|---|---|
Closed | mharbison72 | ||
Closed | mharbison72 | ||
Closed | mharbison72 | ||
Closed | mharbison72 | ||
Closed | mharbison72 | ||
Closed | mharbison72 | ||
Closed | mharbison72 | ||
Closed | mharbison72 | ||
Closed | mharbison72 | ||
Closed | mharbison72 | ||
Closed | mharbison72 | ||
Closed | mharbison72 | ||
Closed | mharbison72 | ||
Closed | mharbison72 | ||
Closed | mharbison72 |
def to_binary(self): | def to_binary(self): | ||||
""" | """ | ||||
Return the binary representation of the file. | Return the binary representation of the file. | ||||
""" | """ | ||||
offsets = [] | offsets = [] | ||||
entries = self.translated_entries() | entries = self.translated_entries() | ||||
# the keys are sorted in the .mo file | |||||
def cmp(_self, other): | |||||
# msgfmt compares entries with msgctxt if it exists | |||||
self_msgid = _self.msgctxt and _self.msgctxt or _self.msgid | |||||
other_msgid = other.msgctxt and other.msgctxt or other.msgid | |||||
if self_msgid > other_msgid: | |||||
return 1 | |||||
elif self_msgid < other_msgid: | |||||
return -1 | |||||
else: | |||||
return 0 | |||||
# add metadata entry | # add metadata entry | ||||
entries.sort(key=lambda o: o.msgctxt or o.msgid) | entries.sort(key=lambda o: o.msgctxt or o.msgid) | ||||
mentry = self.metadata_as_entry() | mentry = self.metadata_as_entry() | ||||
# mentry.msgstr = mentry.msgstr.replace('\\n', '').lstrip() | # mentry.msgstr = mentry.msgstr.replace('\\n', '').lstrip() | ||||
entries = [mentry] + entries | entries = [mentry] + entries | ||||
entries_len = len(entries) | entries_len = len(entries) | ||||
ids, strs = b(''), b('') | ids, strs = b(''), b('') | ||||
for e in entries: | for e in entries: |