fix: correct some type annotations changed by ruff

Reference: commit 8723a2b6ee

These didn't need to be forward references

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
Akhil Narang 2025-12-29 17:02:17 +05:30
parent 9ff5f39c74
commit b80ef0d89e
No known key found for this signature in database
GPG key ID: 9DCC61E211BF645F
3 changed files with 7 additions and 10 deletions

View file

@ -43,9 +43,9 @@ def make_perm_log(doc, method=None):
def insert_perm_log(
doc: Document,
doc_before_save: Document = None,
for_doctype: "str" | None = None,
for_document: "str" | None = None,
fields: "list | tuple" | None = None,
for_doctype: str | None = None,
for_document: str | None = None,
fields: list | tuple | None = None,
):
if frappe.flags.in_install or frappe.flags.in_migrate:
# no need to log changes when migrating or installing app/site

View file

@ -3,10 +3,7 @@
import json
import re
from typing import (
NotRequired, # not required in 3.11+
TypedDict,
)
from typing import NotRequired, TypedDict
import frappe

View file

@ -116,7 +116,7 @@ def is_invalid_date_string(date_string: str) -> bool:
def getdate(
string_date: "DateTimeLikeObject" | None = None, parse_day_first: bool = False
string_date: DateTimeLikeObject | None = None, parse_day_first: bool = False
) -> datetime.date | None:
"""
Convert string date (yyyy-mm-dd) to datetime.date object.
@ -148,7 +148,7 @@ def getdate(
def get_datetime(
datetime_str: "DateTimeLikeObject" | None | tuple | list = None,
datetime_str: DateTimeLikeObject | None | tuple | list = None,
) -> datetime.datetime | None:
"""Return the below mentioned values based on the given `datetime_str`:
@ -373,7 +373,7 @@ def now_datetime() -> datetime.datetime:
return datetime.datetime.now(ZoneInfo(get_system_timezone())).replace(tzinfo=None)
def get_timestamp(date: "DateTimeLikeObject" | None = None) -> float:
def get_timestamp(date: DateTimeLikeObject | None = None) -> float:
"""Return the Unix timestamp (seconds since Epoch) for the given `date`.
If `date` is None, the current timestamp is returned.
"""