Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions weblate/formats/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@
# Did we get file or filename?
if not hasattr(storefile, "read"):
with open(storefile, "rb") as handle:
store = self.convertfile(handle, template_store)

Check failure on line 156 in weblate/formats/convert.py

View workflow job for this annotation

GitHub Actions / mypy

Need type annotation for "store"
else:
store = self.convertfile(storefile, template_store)
# Adjust store to have translations
Expand Down Expand Up @@ -205,7 +205,7 @@
return True

def add_unit(self, unit: TranslationUnit) -> None:
self.store.addunit(unit.unit)

Check failure on line 208 in weblate/formats/convert.py

View workflow job for this annotation

GitHub Actions / mypy

Argument 1 to "addunit" of "TranslationStore" has incompatible type "TranslationUnit | BaseItem | None"; expected "TranslationUnit"

@classmethod
def get_class(cls) -> None:
Expand Down Expand Up @@ -303,7 +303,7 @@
def save_content(self, handle) -> None:
"""Store content to file."""
converter = po2html()
templatename = self.template_store.storefile

Check failure on line 306 in weblate/formats/convert.py

View workflow job for this annotation

GitHub Actions / mypy

Item "None" of "TranslationFormat | None" has no attribute "storefile"
if hasattr(templatename, "name"):
templatename = templatename.name
with open(templatename, "rb") as templatefile:
Expand Down Expand Up @@ -346,7 +346,7 @@
converter = MarkdownTranslator(
inputstore=self.store, includefuzzy=True, outputthreshold=None, maxlength=80
)
templatename = self.template_store.storefile

Check failure on line 349 in weblate/formats/convert.py

View workflow job for this annotation

GitHub Actions / mypy

Item "None" of "TranslationFormat | None" has no attribute "storefile"
if hasattr(templatename, "name"):
templatename = templatename.name
with open(templatename, "rb") as templatefile:
Expand Down Expand Up @@ -402,12 +402,12 @@

def save_content(self, handle) -> None:
"""Store content to file."""
templatename = self.template_store.storefile

Check failure on line 405 in weblate/formats/convert.py

View workflow job for this annotation

GitHub Actions / mypy

Item "None" of "TranslationFormat | None" has no attribute "storefile"
if hasattr(templatename, "name"):
templatename = templatename.name
# This is workaround for weird fuzzy handling in translate-toolkit
for unit in self.all_units:
if any(state == "translated" for state in unit.get_xliff_states()):

Check failure on line 410 in weblate/formats/convert.py

View workflow job for this annotation

GitHub Actions / mypy

"TranslationUnit" has no attribute "get_xliff_states"
unit.set_state(STATE_APPROVED)

with open(templatename, "rb") as templatefile:
Expand Down Expand Up @@ -460,7 +460,7 @@

def save_content(self, handle) -> None:
"""Store content to file."""
templatename = self.template_store.storefile

Check failure on line 463 in weblate/formats/convert.py

View workflow job for this annotation

GitHub Actions / mypy

Item "None" of "TranslationFormat | None" has no attribute "storefile"
if hasattr(templatename, "name"):
templatename = templatename.name
with ZipFile(templatename, "r") as template_zip:
Expand Down Expand Up @@ -528,13 +528,13 @@
sublang = "SUBLANG_DEFAULT"

# Keep existing language tags
storage = self.store.rcfile

Check failure on line 531 in weblate/formats/convert.py

View workflow job for this annotation

GitHub Actions / mypy

"TranslationStore" has no attribute "rcfile"
if storage.lang:
lang = storage.lang
if storage.sublang:
sublang = storage.sublang

templatename = self.template_store.storefile

Check failure on line 537 in weblate/formats/convert.py

View workflow job for this annotation

GitHub Actions / mypy

Item "None" of "TranslationFormat | None" has no attribute "storefile"
if hasattr(templatename, "name"):
templatename = templatename.name
encoding = "utf-8"
Expand Down Expand Up @@ -582,7 +582,7 @@

def save_content(self, handle) -> None:
"""Store content to file."""
templatename = self.template_store.storefile

Check failure on line 585 in weblate/formats/convert.py

View workflow job for this annotation

GitHub Actions / mypy

Item "None" of "TranslationFormat | None" has no attribute "storefile"
if hasattr(templatename, "name"):
templatename = templatename.name
with open(templatename, "rb") as templatefile:
Expand All @@ -590,6 +590,7 @@
input_file=self.store,
output_file=None,
template_file=templatefile,
flavour=self.flavour,
)
outputstring = converter.merge_stores()
handle.write(outputstring.encode("utf-8"))
Expand Down
Loading