Skip to content

Commit

Permalink
Faster and more concise way of adding headers (#5213)
Browse files Browse the repository at this point in the history
* Faster and more concise way of adding headers

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fixed issue with the last line

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
AryazE and pre-commit-ci[bot] committed Mar 18, 2024
1 parent d7922d5 commit d9bfc8a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions translate/storage/poheader.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,10 +460,12 @@ def makeheader(self, **kwargs):
headerpo._store = self
headerpo.markfuzzy()
headeritems = self.makeheaderdict(**kwargs)
headervalue = ""
for key, value in headeritems.items():
if value is None:
continue
headervalue += f"{key}: {value}\n"
headervalue = "".join(
[
f"{key}: {value}\n"
for key, value in headeritems.items()
if value is not None
]
)
headerpo.target = headervalue
return headerpo

0 comments on commit d9bfc8a

Please sign in to comment.