feat: enable automatic type annotations (backport #38452) (#38454)

feat: enable automatic type annotations (#38452)

(cherry picked from commit 63313eef6f)

Co-authored-by: Ankush Menat <ankush@frappe.io>
This commit is contained in:
mergify[bot]
2023-11-30 14:43:16 +05:30
committed by GitHub
parent 7f4d2b707a
commit 5e6a4d257e
485 changed files with 12920 additions and 0 deletions

View File

@@ -8,6 +8,24 @@ from frappe.website.utils import delete_page_cache
class Homepage(Document):
# begin: auto-generated types
# This code is auto-generated. Do not modify anything in this block.
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from frappe.types import DF
company: DF.Link
description: DF.Text
hero_image: DF.AttachImage | None
hero_section: DF.Link | None
hero_section_based_on: DF.Literal["Default", "Slideshow", "Homepage Section"]
slideshow: DF.Link | None
tag_line: DF.Data
title: DF.Data | None
# end: auto-generated types
def validate(self):
if not self.description:
self.description = frappe._("This is an example website auto-generated from ERPNext")

View File

@@ -7,6 +7,25 @@ from frappe.utils import cint
class HomepageSection(Document):
# begin: auto-generated types
# This code is auto-generated. Do not modify anything in this block.
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from frappe.types import DF
from erpnext.portal.doctype.homepage_section_card.homepage_section_card import (
HomepageSectionCard,
)
no_of_columns: DF.Literal["1", "2", "3", "4", "6"]
section_based_on: DF.Literal["Cards", "Custom HTML"]
section_cards: DF.Table[HomepageSectionCard]
section_html: DF.Code | None
section_order: DF.Int
# end: auto-generated types
@property
def column_value(self):
return cint(12 / cint(self.no_of_columns or 3))

View File

@@ -6,4 +6,22 @@ from frappe.model.document import Document
class HomepageSectionCard(Document):
# begin: auto-generated types
# This code is auto-generated. Do not modify anything in this block.
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from frappe.types import DF
content: DF.Text | None
image: DF.AttachImage | None
parent: DF.Data
parentfield: DF.Data
parenttype: DF.Data
route: DF.Data | None
subtitle: DF.Data | None
title: DF.Data
# end: auto-generated types
pass

View File

@@ -6,4 +6,18 @@ from frappe.model.document import Document
class WebsiteAttribute(Document):
# begin: auto-generated types
# This code is auto-generated. Do not modify anything in this block.
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from frappe.types import DF
attribute: DF.Link
parent: DF.Data
parentfield: DF.Data
parenttype: DF.Data
# end: auto-generated types
pass

View File

@@ -6,4 +6,18 @@ from frappe.model.document import Document
class WebsiteFilterField(Document):
# begin: auto-generated types
# This code is auto-generated. Do not modify anything in this block.
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from frappe.types import DF
fieldname: DF.Autocomplete | None
parent: DF.Data
parentfield: DF.Data
parenttype: DF.Data
# end: auto-generated types
pass