refactor(utilities): type annotations for whitelisted methods

This commit is contained in:
diptanilsaha
2026-02-18 01:39:50 +05:30
parent c6a292f6a9
commit cac6b65dee
4 changed files with 6 additions and 4 deletions

View File

@@ -7,7 +7,9 @@ from frappe.utils import get_link_to_form, today
@frappe.whitelist()
def transaction_processing(data, from_doctype, to_doctype, args=None):
def transaction_processing(
data: str | list, from_doctype: str, to_doctype: str, args: str | frappe._dict | None = None
):
frappe.has_permission(from_doctype, "read", throw=True)
frappe.has_permission(to_doctype, "create", throw=True)

View File

@@ -36,7 +36,7 @@ def get_doctypes():
@frappe.whitelist()
def upload(select_doctype=None, rows=None):
def upload(select_doctype: str | None = None):
from frappe.utils.csvutils import read_csv_content_from_attached_file
if not select_doctype:

View File

@@ -105,7 +105,7 @@ def get_formatted_ids(video_list):
@frappe.whitelist()
def get_id_from_url(url):
def get_id_from_url(url: str):
"""
Returns video id from url
:param youtube url: String URL

View File

@@ -292,7 +292,7 @@ class TransactionBase(StatusUpdater):
)
@frappe.whitelist()
def process_item_selection(self, item_idx):
def process_item_selection(self, item_idx: int):
# Server side 'item' doc. Update this to reflect in UI
item_obj = self.get("items", {"idx": item_idx})[0]