summaryrefslogtreecommitdiff
path: root/babel/messages/pofile.py
diff options
context:
space:
mode:
authorAarni Koskela <akx@iki.fi>2023-01-25 21:51:37 +0200
committerAarni Koskela <akx@iki.fi>2023-01-25 22:34:47 +0200
commit28ea5feebed2f83262d6240354900b07d2633bce (patch)
treeec9aa25d29b7cf76b70d4b924dbc22d769cf6d60 /babel/messages/pofile.py
parentb3d33811ece8d3a3de2ffa8ad7f134b94c96d95d (diff)
downloadbabel-28ea5feebed2f83262d6240354900b07d2633bce.tar.gz
Apply some simplification fixes courtesy of Ruff
Diffstat (limited to 'babel/messages/pofile.py')
-rw-r--r--babel/messages/pofile.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/babel/messages/pofile.py b/babel/messages/pofile.py
index aef8cbf..73d8cbe 100644
--- a/babel/messages/pofile.py
+++ b/babel/messages/pofile.py
@@ -189,10 +189,7 @@ class PoFileParser:
string = tuple(string)
else:
string = self.translations[0][1].denormalize()
- if self.context:
- msgctxt = self.context.denormalize()
- else:
- msgctxt = None
+ msgctxt = self.context.denormalize() if self.context else None
message = Message(msgid, string, list(self.locations), set(self.flags),
self.auto_comments, self.user_comments, lineno=self.offset + 1,
context=msgctxt)
@@ -543,10 +540,7 @@ def write_po(
def _write_comment(comment, prefix=''):
# xgettext always wraps comments even if --no-wrap is passed;
# provide the same behaviour
- if width and width > 0:
- _width = width
- else:
- _width = 76
+ _width = width if width and width > 0 else 76
for line in wraptext(comment, _width):
_write(f"#{prefix} {line.strip()}\n")