chore: Cleanup imports (#27320)

* chore: Added isort to pre-commit config

* chore: Sort imports with isort

* chore: Remove imports with pycln

* chore: Sort imports with isort

* chore: Fix import issues

* chore: Fix sider issues

* chore: linting

* chore: linting / sorting import

from ecommerce refactor merge

* ci: dont allow unused imports

* chore: sort / clean ecommerce imports

Co-authored-by: Ankush Menat <ankush@iwebnotes.com>
This commit is contained in:
Chillar Anand
2021-09-03 18:57:43 +05:30
committed by GitHub
parent 910b9bc3f4
commit 4b2be2999f
2103 changed files with 7844 additions and 3106 deletions

View File

@@ -1,12 +1,10 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
from erpnext.e_commerce.shopping_cart.cart import get_cart_quotation
no_cache = 1
import frappe
from erpnext.e_commerce.shopping_cart.cart import get_cart_quotation
def get_context(context):
context.body_class = "product-page"
context.update(get_cart_quotation())

View File

@@ -2,8 +2,8 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
import frappe
def get_context(context):

View File

@@ -1,9 +1,13 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import frappe
from erpnext.e_commerce.doctype.e_commerce_settings.e_commerce_settings import (
get_shopping_cart_settings,
)
from erpnext.e_commerce.doctype.item_review.item_review import get_item_reviews
from erpnext.e_commerce.doctype.website_item.website_item import check_if_user_is_customer
from erpnext.e_commerce.doctype.e_commerce_settings.e_commerce_settings import get_shopping_cart_settings
def get_context(context):
context.body_class = "product-page"

View File

@@ -1,8 +1,11 @@
from __future__ import unicode_literals
import frappe, json
import json
import frappe
import requests
def get_context(context):
context.no_cache = 1
settings = frappe.get_doc("Support Settings", "Support Settings")

View File

@@ -2,6 +2,7 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
no_cache = 1

View File

@@ -1,12 +1,17 @@
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import json
import frappe
from frappe import _
from frappe.utils import flt
import json
from erpnext.erpnext_integrations.doctype.gocardless_settings.gocardless_settings import gocardless_initialization, get_gateway_controller
from frappe.utils import get_url
from frappe.utils import flt, get_url
from erpnext.erpnext_integrations.doctype.gocardless_settings.gocardless_settings import (
get_gateway_controller,
gocardless_initialization,
)
no_cache = 1

View File

@@ -1,9 +1,14 @@
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from erpnext.erpnext_integrations.doctype.gocardless_settings.gocardless_settings import gocardless_initialization, get_gateway_controller
from erpnext.erpnext_integrations.doctype.gocardless_settings.gocardless_settings import (
get_gateway_controller,
gocardless_initialization,
)
no_cache = 1

View File

@@ -2,11 +2,12 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import flt
def get_context(context):
context.no_cache = 1
context.show_sidebar = True

View File

@@ -1,6 +1,8 @@
from __future__ import unicode_literals
import frappe
def get_context(context):
context.no_cache = True
chapter = frappe.get_doc('Chapter', frappe.form_dict.name)

View File

@@ -1,6 +1,8 @@
from __future__ import unicode_literals
import frappe
def get_context(context):
context.no_cache = True
chapter = frappe.get_doc('Chapter', frappe.form_dict.name)

View File

@@ -2,11 +2,13 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
import frappe
from frappe import _
from erpnext.e_commerce.doctype.e_commerce_settings.e_commerce_settings import show_attachments
def get_context(context):
context.no_cache = 1
context.show_sidebar = True
@@ -36,7 +38,9 @@ def get_context(context):
# check for the loyalty program of the customer
customer_loyalty_program = frappe.db.get_value("Customer", context.doc.customer, "loyalty_program")
if customer_loyalty_program:
from erpnext.accounts.doctype.loyalty_program.loyalty_program import get_loyalty_program_details_with_points
from erpnext.accounts.doctype.loyalty_program.loyalty_program import (
get_loyalty_program_details_with_points,
)
loyalty_program_details = get_loyalty_program_details_with_points(context.doc.customer, customer_loyalty_program)
context.available_loyalty_points = int(loyalty_program_details.get("loyalty_points"))

View File

@@ -2,8 +2,8 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
import frappe.website.render
page_title = "Partners"

View File

@@ -2,18 +2,18 @@
# License: GNU General Public License v3. See license.txt
import frappe
from frappe.utils import cstr, nowdate, cint
from erpnext.setup.doctype.item_group.item_group import get_item_for_list_in_html
from erpnext.e_commerce.shopping_cart.product_info import set_product_info_for_website
from frappe.utils import cint, cstr
from redisearch import AutoCompleter, Client, Query
from erpnext.e_commerce.redisearch import (
is_search_module_loaded,
WEBSITE_ITEM_CATEGORY_AUTOCOMPLETE,
WEBSITE_ITEM_INDEX,
WEBSITE_ITEM_NAME_AUTOCOMPLETE,
WEBSITE_ITEM_CATEGORY_AUTOCOMPLETE,
make_key
is_search_module_loaded,
make_key,
)
from erpnext.e_commerce.shopping_cart.product_info import set_product_info_for_website
from erpnext.setup.doctype.item_group.item_group import get_item_for_list_in_html
no_cache = 1

View File

@@ -2,8 +2,9 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
import json
def get_context(context):
project_user = frappe.db.get_value("Project User", {"parent": frappe.form_dict.project, "user": frappe.session.user} , ["user", "view_attachments"], as_dict= True)

View File

@@ -1,8 +1,9 @@
from __future__ import unicode_literals
import frappe
from frappe import _
from six import iteritems
def get_context(context):
context.no_cache = 1
party = frappe.form_dict.party

View File

@@ -2,11 +2,14 @@
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import formatdate
from erpnext.controllers.website_list_for_contact import get_customers_suppliers
def get_context(context):
context.no_cache = 1
context.show_sidebar = True

View File

@@ -1,11 +1,14 @@
from __future__ import unicode_literals
import frappe, requests
import frappe
import requests
from frappe import _
from jinja2 import utils
from html2text import html2text
from six import text_type
from frappe.utils import sanitize_html
from frappe.utils.global_search import search
from html2text import html2text
from jinja2 import utils
from six import text_type
def get_context(context):
context.no_cache = 1

View File

@@ -1,7 +1,7 @@
from __future__ import unicode_literals
import frappe
from frappe import _
def get_context(context):
context.no_cache = 1

View File

@@ -1,7 +1,7 @@
from __future__ import unicode_literals
import frappe
from frappe import _
def get_context(context):
context.no_cache = 1

View File

@@ -1,9 +1,13 @@
# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import frappe
from erpnext.utilities.product import get_price
from erpnext.e_commerce.doctype.e_commerce_settings.e_commerce_settings import (
get_shopping_cart_settings,
)
from erpnext.e_commerce.shopping_cart.cart import _set_price_list
from erpnext.e_commerce.doctype.e_commerce_settings.e_commerce_settings import get_shopping_cart_settings
from erpnext.utilities.product import get_price
def get_context(context):
is_guest = frappe.session.user == "Guest"