Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-07-29 16:07:06 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-07-29 16:07:06 +0400
commit2553cdf195a1d1bbf19bde23b8bbe58de802d1f3 (patch)
treef5f7e25465de4f99c406dbba25864b150c84b67d /release/scripts/modules/bl_i18n_utils/utils.py
parentab38e1d3795f58b5b3e9ca0377c9348ed710471a (diff)
style cleanup
Diffstat (limited to 'release/scripts/modules/bl_i18n_utils/utils.py')
-rw-r--r--release/scripts/modules/bl_i18n_utils/utils.py26
1 files changed, 12 insertions, 14 deletions
diff --git a/release/scripts/modules/bl_i18n_utils/utils.py b/release/scripts/modules/bl_i18n_utils/utils.py
index ebf0f994a7a..3e5394d85a4 100644
--- a/release/scripts/modules/bl_i18n_utils/utils.py
+++ b/release/scripts/modules/bl_i18n_utils/utils.py
@@ -40,6 +40,7 @@ def stripeol(s):
def is_tooltip(msgid):
return len(msgid) > 30
+
def parse_messages(fname):
"""
Returns a tupple (messages, states, stats).
@@ -82,7 +83,6 @@ def parse_messages(fname):
fuzzy_messages = set()
commented_messages = set()
-
def clean_vars():
nonlocal reading_msgid, reading_msgstr, reading_msgctxt, \
reading_comment, is_fuzzy, is_translated, is_commented, \
@@ -143,7 +143,6 @@ def parse_messages(fname):
clean_vars()
-
with open(fname, 'r', encoding="utf-8") as f:
for line_nr, line in enumerate(f):
line = stripeol(line)
@@ -156,7 +155,7 @@ def parse_messages(fname):
reading_ctxt = True
if line.startswith(COMMENT_PREFIX):
is_commented = True
- line = line[9+len(COMMENT_PREFIX):-1]
+ line = line[9 + len(COMMENT_PREFIX):-1]
else:
line = line[9:-1]
msgctxt_lines.append(line)
@@ -167,7 +166,7 @@ def parse_messages(fname):
reading_msgid = True
if line.startswith(COMMENT_PREFIX):
is_commented = True
- line = line[7+len(COMMENT_PREFIX):-1]
+ line = line[7 + len(COMMENT_PREFIX):-1]
else:
line = line[7:-1]
msgid_lines.append(line)
@@ -180,7 +179,7 @@ def parse_messages(fname):
reading_msgid = False
reading_msgstr = True
if line.startswith(COMMENT_PREFIX):
- line = line[8+len(COMMENT_PREFIX):-1]
+ line = line[8 + len(COMMENT_PREFIX):-1]
if not is_commented:
is_broken = True
else:
@@ -194,13 +193,13 @@ def parse_messages(fname):
elif line.startswith("#"):
if reading_msgid:
if is_commented:
- msgid_lines.append(line[1+len(COMMENT_PREFIX):-1])
+ msgid_lines.append(line[1 + len(COMMENT_PREFIX):-1])
else:
msgid_lines.append(line)
is_broken = True
elif reading_msgstr:
if is_commented:
- msgstr_lines.append(line[1+len(COMMENT_PREFIX):-1])
+ msgstr_lines.append(line[1 + len(COMMENT_PREFIX):-1])
else:
msgstr_lines.append(line)
is_broken = True
@@ -338,13 +337,13 @@ def print_stats(stats, glob_stats=None, prefix=""):
lvl = lvl_ttips = lvl_trans_ttips = lvl_ttips_in_trans = lvl_comm = 0.0
if tot_msgs > 0:
- lvl = float(trans_msgs)/float(tot_msgs)
- lvl_ttips = float(tot_ttips)/float(tot_msgs)
- lvl_comm = float(comm_msgs)/float(tot_msgs+comm_msgs)
+ lvl = float(trans_msgs) / float(tot_msgs)
+ lvl_ttips = float(tot_ttips) / float(tot_msgs)
+ lvl_comm = float(comm_msgs) / float(tot_msgs+comm_msgs)
if tot_ttips > 0:
- lvl_trans_ttips = float(trans_ttips)/float(tot_ttips)
+ lvl_trans_ttips = float(trans_ttips) / float(tot_ttips)
if trans_msgs > 0:
- lvl_ttips_in_trans = float(trans_ttips)/float(trans_msgs)
+ lvl_ttips_in_trans = float(trans_ttips) / float(trans_msgs)
if glob_stats:
glob_stats["nbr"] += 1.0
@@ -368,9 +367,8 @@ def print_stats(stats, glob_stats=None, prefix=""):
"{:>6.1%} of translated messages are tooltips ({} over {}).\n"
"".format(lvl_ttips_in_trans, trans_ttips, trans_msgs),
"{:>6.1%} of messages are commented ({} over {}).\n"
- "".format(lvl_comm, comm_msgs, comm_msgs+tot_msgs),
+ "".format(lvl_comm, comm_msgs, comm_msgs + tot_msgs),
"This translation is currently made of {} signs.\n"
"".format(nbr_trans_signs))
print(prefix.join(lines))
return 0
-