diff --git a/education/education/doctype/fee_schedule/fee_schedule.py b/education/education/doctype/fee_schedule/fee_schedule.py index 890c2b0e..c8291e59 100644 --- a/education/education/doctype/fee_schedule/fee_schedule.py +++ b/education/education/doctype/fee_schedule/fee_schedule.py @@ -105,7 +105,8 @@ def validate_fee_components(self): if component not in fee_structure_components: frappe.msgprint( _("Fee Component {0} is not part of Fee Structure {1}").format( - component, frappe.bold(getlink("Fee Structure", self.fee_structure)) + component, + frappe.bold(getlink("Fee Structure", self.fee_structure)), ), alert=True, ) @@ -115,7 +116,7 @@ def validate_total_against_fee_strucuture(self): frappe.db.get_all( "Fee Schedule", filters={"fee_structure": self.fee_structure}, - fields=["sum(total_amount) as total"], + fields=[{"SUM": "total_amount", "as": "total"}], )[0]["total"] or 0 ) @@ -277,9 +278,9 @@ def get_fees_mapped_doc(fee_schedule, doctype, student_id, customer): }, }, "Fee Component": { - "doctype": "Sales Invoice Item" - if doctype == "Sales Invoice" - else "Sales Order Item", + "doctype": ( + "Sales Invoice Item" if doctype == "Sales Invoice" else "Sales Order Item" + ), "field_map": { # Fee Component Field : Child doctype Field "item": "item_code", diff --git a/pyproject.toml b/pyproject.toml index f7495cf2..3f46c647 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,16 +1,56 @@ [project] name = "education" authors = [ - { name = "Frappe Technologies Pvt Ltd", email = "hello@frappe.io" } + { name = "Frappe Technologies Pvt. Ltd.", email = "hello@frappe.io"} ] description = "Education module for Frappe" -readme = "README.md" requires-python = ">=3.10" +readme = "README.md" dynamic = ["version"] [build-system] requires = ["flit_core >=3.4,<4"] build-backend = "flit_core.buildapi" +[tool.ruff] +line-length = 110 +target-version = "py310" + +[tool.ruff.lint] +select = [ + "F", + "E", + "W", + "I", + "UP", + "B", + "RUF", +] +ignore = [ + "B017", # assertRaises(Exception) - should be more specific + "B018", # useless expression, not assigned to anything + "B023", # function doesn't bind loop variable - will have last iteration's value + "B904", # raise inside except without from + "E101", # indentation contains mixed spaces and tabs + "E402", # module level import not at top of file + "E501", # line too long + "E741", # ambiguous variable name + "F401", # "unused" imports + "F403", # can't detect undefined names from * import + "F405", # can't detect undefined names from * import + "F722", # syntax error in forward type annotation + "W191", # indentation contains tabs + "RUF001", # string contains ambiguous unicode character + "UP030", # Use implicit references for positional format fields (translations) + "UP031", # Use format specifiers instead of percent format + "UP032", # Use f-string instead of `format` call (translations) +] +typing-modules = ["frappe.types.DF"] + +[tool.ruff.format] +quote-style = "double" +indent-style = "tab" +docstring-code-format = true + [tool.bench.frappe-dependencies] -frappe = ">=15.0.0-dev,<16.0.0-dev" +frappe = ">=16.0.0,<17.0.0" \ No newline at end of file diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 7668191f..00000000 --- a/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -# frappe -- https://github.com/frappe/frappe is installed via 'bench init' \ No newline at end of file diff --git a/setup.py b/setup.py deleted file mode 100644 index defc035b..00000000 --- a/setup.py +++ /dev/null @@ -1,19 +0,0 @@ -from setuptools import setup, find_packages - -with open("requirements.txt") as f: - install_requires = f.read().strip().split("\n") - -# get version from __version__ variable in education/__init__.py -from education import __version__ as version - -setup( - name="education", - version=version, - description="Education", - author="Frappe Technologies Pvt. Ltd.", - author_email="hello@frappe.io", - packages=find_packages(), - zip_safe=False, - include_package_data=True, - install_requires=install_requires, -)