From 0da9dd8aaafd393898bfdc2062d7d5b3fb52fc7c Mon Sep 17 00:00:00 2001 From: Exequiel Arona Date: Thu, 25 Apr 2024 13:17:12 -0300 Subject: [PATCH] fix: linter --- frappe/gettext/extractors/custom_fields.py | 8 ++++++-- frappe/gettext/extractors/customizations.py | 11 +++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/frappe/gettext/extractors/custom_fields.py b/frappe/gettext/extractors/custom_fields.py index b4a8dcdb85..2cf902f934 100644 --- a/frappe/gettext/extractors/custom_fields.py +++ b/frappe/gettext/extractors/custom_fields.py @@ -8,6 +8,7 @@ EXCLUDE_SELECT_OPTIONS = [ "minimum_password_score", ] + def extract(fileobj, *args, **kwargs): """ Extract messages from DocType JSON files. To be used to babel extractor @@ -15,7 +16,7 @@ def extract(fileobj, *args, **kwargs): :rtype: `iterator` """ data = json.load(fileobj) - + if not isinstance(data, list): return @@ -37,7 +38,10 @@ def extract(fileobj, *args, **kwargs): if description := field.get("description"): messages.append( - (description, f"Description of the '{_label}' ({fieldtype}) Custom Field in DocType '{doctype}'") + ( + description, + f"Description of the '{_label}' ({fieldtype}) Custom Field in DocType '{doctype}'", + ) ) if message := field.get("options"): diff --git a/frappe/gettext/extractors/customizations.py b/frappe/gettext/extractors/customizations.py index 7ca814cbb9..7425a5e518 100644 --- a/frappe/gettext/extractors/customizations.py +++ b/frappe/gettext/extractors/customizations.py @@ -8,6 +8,7 @@ EXCLUDE_SELECT_OPTIONS = [ "minimum_password_score", ] + def extract(fileobj, *args, **kwargs): """ Extract messages from DocType JSON files. To be used to babel extractor @@ -37,7 +38,10 @@ def extract(fileobj, *args, **kwargs): if description := field.get("description"): messages.append( - (description, f"Description of the '{_label}' ({fieldtype}) field in Customization of DocType '{doctype}'") + ( + description, + f"Description of the '{_label}' ({fieldtype}) field in Customization of DocType '{doctype}'", + ) ) if message := field.get("options"): @@ -59,7 +63,10 @@ def extract(fileobj, *args, **kwargs): ) elif fieldtype == "HTML": messages.append( - (message, f"Content of the '{_label}' ({fieldtype}) field in Customization of DocType '{doctype}'") + ( + message, + f"Content of the '{_label}' ({fieldtype}) field in Customization of DocType '{doctype}'", + ) ) # By using "pgettext" as the function name we can supply the doctype as context