style: Fix few deepsource issues

This commit is contained in:
Suraj Shetty 2020-05-03 19:31:20 +05:30
parent ca6e910743
commit afe31ac7c0
2 changed files with 5 additions and 7 deletions

View file

@ -6,7 +6,6 @@ from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe.utils import strip_html_tags, is_html
from frappe.integrations.utils import make_post_request
from frappe.translate import get_translator_url
import json
@ -65,7 +64,6 @@ def create_translations(translation_map, language):
doc.insert()
translation_map_to_send[source_id].name = doc.name
params = {
'language': language,
'contributor_email': frappe.session.user,

View file

@ -255,7 +255,7 @@ def get_user_translations(lang):
key = translation.source_text
value = translation.translated_text
if translation.context:
key+= ':' + translation.context
key += ':' + translation.context
out[key] = value
frappe.cache().hset('lang_user_translations', lang, out)
@ -504,14 +504,14 @@ def get_messages_from_file(path):
# To avoid duplicate scan
if path in set(frappe.flags.scanned_files):
return []
else:
frappe.flags.scanned_files.append(path)
frappe.flags.scanned_files.append(path)
apps_path = get_bench_dir()
if os.path.exists(path):
with open(path, 'r') as sourcefile:
data = [(os.path.relpath(path, apps_path),
message, context, line) for line, message, context in extract_messages_from_code(sourcefile.read())]
data = [(os.path.relpath(path, apps_path), message, context, line) \
for line, message, context in extract_messages_from_code(sourcefile.read())]
return data
else:
# print "Translate: {0} missing".format(os.path.abspath(path))