Skip to content

Commit eff667c

Browse files
authored
Merge pull request #411 from frappe/develop-v16
chore: add Ruff config, and update Fee Schedule total aggregration
2 parents cdcc615 + 480161e commit eff667c

4 files changed

Lines changed: 49 additions & 28 deletions

File tree

education/education/doctype/fee_schedule/fee_schedule.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ def validate_fee_components(self):
105105
if component not in fee_structure_components:
106106
frappe.msgprint(
107107
_("Fee Component {0} is not part of Fee Structure {1}").format(
108-
component, frappe.bold(getlink("Fee Structure", self.fee_structure))
108+
component,
109+
frappe.bold(getlink("Fee Structure", self.fee_structure)),
109110
),
110111
alert=True,
111112
)
@@ -115,7 +116,7 @@ def validate_total_against_fee_strucuture(self):
115116
frappe.db.get_all(
116117
"Fee Schedule",
117118
filters={"fee_structure": self.fee_structure},
118-
fields=["sum(total_amount) as total"],
119+
fields=[{"SUM": "total_amount", "as": "total"}],
119120
)[0]["total"]
120121
or 0
121122
)
@@ -277,9 +278,9 @@ def get_fees_mapped_doc(fee_schedule, doctype, student_id, customer):
277278
},
278279
},
279280
"Fee Component": {
280-
"doctype": "Sales Invoice Item"
281-
if doctype == "Sales Invoice"
282-
else "Sales Order Item",
281+
"doctype": (
282+
"Sales Invoice Item" if doctype == "Sales Invoice" else "Sales Order Item"
283+
),
283284
"field_map": {
284285
# Fee Component Field : Child doctype Field
285286
"item": "item_code",

pyproject.toml

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,56 @@
11
[project]
22
name = "education"
33
authors = [
4-
{ name = "Frappe Technologies Pvt Ltd", email = "hello@frappe.io" }
4+
{ name = "Frappe Technologies Pvt. Ltd.", email = "hello@frappe.io"}
55
]
66
description = "Education module for Frappe"
7-
readme = "README.md"
87
requires-python = ">=3.10"
8+
readme = "README.md"
99
dynamic = ["version"]
1010

1111
[build-system]
1212
requires = ["flit_core >=3.4,<4"]
1313
build-backend = "flit_core.buildapi"
1414

15+
[tool.ruff]
16+
line-length = 110
17+
target-version = "py310"
18+
19+
[tool.ruff.lint]
20+
select = [
21+
"F",
22+
"E",
23+
"W",
24+
"I",
25+
"UP",
26+
"B",
27+
"RUF",
28+
]
29+
ignore = [
30+
"B017", # assertRaises(Exception) - should be more specific
31+
"B018", # useless expression, not assigned to anything
32+
"B023", # function doesn't bind loop variable - will have last iteration's value
33+
"B904", # raise inside except without from
34+
"E101", # indentation contains mixed spaces and tabs
35+
"E402", # module level import not at top of file
36+
"E501", # line too long
37+
"E741", # ambiguous variable name
38+
"F401", # "unused" imports
39+
"F403", # can't detect undefined names from * import
40+
"F405", # can't detect undefined names from * import
41+
"F722", # syntax error in forward type annotation
42+
"W191", # indentation contains tabs
43+
"RUF001", # string contains ambiguous unicode character
44+
"UP030", # Use implicit references for positional format fields (translations)
45+
"UP031", # Use format specifiers instead of percent format
46+
"UP032", # Use f-string instead of `format` call (translations)
47+
]
48+
typing-modules = ["frappe.types.DF"]
49+
50+
[tool.ruff.format]
51+
quote-style = "double"
52+
indent-style = "tab"
53+
docstring-code-format = true
54+
1555
[tool.bench.frappe-dependencies]
16-
frappe = ">=15.0.0-dev,<16.0.0-dev"
56+
frappe = ">=16.0.0,<17.0.0"

requirements.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

setup.py

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)