Skip to content

Commit

Permalink
Revert "Fix unused imports and type comparisons"
Browse files Browse the repository at this point in the history
This reverts commit b459b60.
  • Loading branch information
flodolo committed Feb 22, 2024
1 parent 5a213bb commit a6a4189
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Generated by Django 3.2.15 on 2023-02-23 16:02
from django.db import migrations
from pontoon.base.models import Project, ChangedEntityLocale
from pontoon.base.models import Project, Resource, Entity, ChangedEntityLocale


def remove_changed_entity_locale_entries_for_repository_projects(apps, schema_editor):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Generated by Django 3.2.4 on 2021-11-30 19:56

from datetime import timedelta
from datetime import datetime, timedelta
from django.db import migrations
from django.db.models import F

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Generated by Django 3.2.4 on 2021-11-30 19:56

from datetime import timedelta
from datetime import datetime, timedelta
from django.db import migrations
from django.db.models import F

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import statistics

from datetime import datetime, timedelta
from django.db import migrations
from django.db.models import F
from sacrebleu.metrics import CHRF
Expand Down
8 changes: 4 additions & 4 deletions pontoon/sync/formats/json_keyvalue.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ def __init__(self, order, key, context, source_value, value):
key=key,
context=context,
source_string=source_value,
strings=(
{None: value} if value else {}
), # No plural support in key value JSON
strings={None: value}
if value
else {}, # No plural support in key value JSON
comments=[],
fuzzy=False,
)
Expand Down Expand Up @@ -109,7 +109,7 @@ def traverse_json(self, data, function, keys=[]):
currentKey.append(key)
if isinstance(value, dict):
self.traverse_json(value, function, keys=currentKey)
elif isinstance(value, str):
elif type(value) == str:
internal_key = json.dumps(currentKey)
dot_key = ".".join(currentKey)
function(internal_key, dot_key, value)
Expand Down
6 changes: 3 additions & 3 deletions pontoon/sync/vcs/repositories.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,16 +263,16 @@ def execute(command, cwd=None, env=None):

# Make sure that we manipulate strings instead of bytes, to avoid
# compatibility errors in Python 3.
if isinstance(output, bytes):
if type(output) is bytes:
output = output.decode("utf-8")
if isinstance(error, bytes):
if type(error) is bytes:
error = error.decode("utf-8")

code = proc.returncode
return code, output, error

except OSError as error:
if isinstance(error, bytes):
if type(error) is bytes:
error = error.decode("utf-8")
return -1, "", error

Expand Down
8 changes: 7 additions & 1 deletion pontoon/translate/views.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
from django.conf import settings
from django.contrib import messages
from django.http import Http404, HttpResponseRedirect
from django.shortcuts import render
from django.shortcuts import (
get_object_or_404,
render,
)
from django.views.decorators.csrf import (
csrf_exempt,
ensure_csrf_cookie,
)

from pontoon.base.models import (
Locale,
)

from pontoon.base.utils import get_project_or_redirect, get_locale_or_redirect

Expand Down

0 comments on commit a6a4189

Please sign in to comment.