Skip to content

Commit cf20b58

Browse files
committed
Fixed all linting issues
1 parent d961e7b commit cf20b58

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

python_gpt_po/po_translator.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,28 +30,28 @@ def disable_fuzzy_translations(po_file_path):
3030
# Read the file content
3131
with open(po_file_path, 'r', encoding='utf-8') as file:
3232
content = file.read()
33-
33+
3434
# Remove fuzzy markers from the content
3535
content = content.replace('#, fuzzy\n', '')
36-
36+
3737
# Write the updated content back to the file
3838
with open(po_file_path, 'w', encoding='utf-8') as file:
3939
file.write(content)
40-
40+
4141
# Load the .po file and remove fuzzy flags from entries
4242
po_file = polib.pofile(po_file_path)
4343
fuzzy_entries = [entry for entry in po_file if 'fuzzy' in entry.flags]
4444
for entry in fuzzy_entries:
4545
entry.flags.remove('fuzzy')
46-
46+
4747
# Remove 'Fuzzy' from the metadata if present
4848
if po_file.metadata:
4949
po_file.metadata.pop('Fuzzy', None)
50-
50+
5151
# Save the updated .po file
5252
po_file.save(po_file_path)
5353
logging.info("Fuzzy translations disabled in file: %s", po_file_path)
54-
54+
5555
except Exception as e:
5656
logging.error("Error while disabling fuzzy translations in file %s: %s", po_file_path, e)
5757

@@ -76,7 +76,7 @@ def log_translation_status(po_file_path, original_texts, translations):
7676
"""Logs the status of translations for a .po file."""
7777
total = len(original_texts)
7878
translated = sum(1 for t in translations if t)
79-
79+
8080
# Log a warning if there are untranslated texts
8181
if translated < total:
8282
logging.warning(
@@ -233,7 +233,7 @@ def get_translation_prompt(target_language, is_bulk):
233233
@retry(stop=stop_after_attempt(3), wait=wait_fixed(2))
234234
def perform_translation(self, texts, target_language, is_bulk=False):
235235
"""Performs the actual translation using the OpenAI API."""
236-
logging.info(f"Performing translation to: {target_language}") # Log the target language
236+
logging.debug("Performing translation to: %s", target_language) # Log the target language
237237
prompt = self.get_translation_prompt(target_language, is_bulk)
238238
message = {
239239
"role": "user",

0 commit comments

Comments
 (0)