style: Fix E201, E202, E401, E701

reported by sider: https://sider.review/gh/repos/1864194/pulls/13344?statuses#issues
This commit is contained in:
Gavin D'souza 2021-05-27 12:48:01 +05:30
parent eca30667d2
commit 793b5638d3
6 changed files with 39 additions and 23 deletions

View file

@ -2,6 +2,7 @@
# MIT License. See license.txt
import json
from collections import defaultdict
import frappe
import frappe.desk.form.load
import frappe.desk.form.meta
@ -9,6 +10,7 @@ from frappe import _
from frappe.model.meta import is_single
from frappe.modules import load_doctype_module
@frappe.whitelist()
def get_submitted_linked_docs(doctype, name, docs=None, visited=None):
"""
@ -200,7 +202,8 @@ def get_linked_docs(doctype, name, linkinfo=None, for_doctype=None):
else:
link_fieldnames = link.get("fieldname")
if link_fieldnames:
if isinstance(link_fieldnames, str): link_fieldnames = [link_fieldnames]
if isinstance(link_fieldnames, str):
link_fieldnames = [link_fieldnames]
or_filters = [[dt, fieldname, '=', name] for fieldname in link_fieldnames]
# dynamic link
if link.get("doctype_fieldname"):

View file

@ -1,14 +1,15 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
import io
import os
# metadata
import frappe, os, io
from frappe.model.meta import Meta
from frappe.modules import scrub, get_module_path, load_doctype_module
from frappe.utils import get_html_format
from frappe.translate import make_dict_from_messages, extract_messages_from_code
from frappe.model.utils import render_include
import frappe
from frappe.build import scrub_html_template
from frappe.model.meta import Meta
from frappe.model.utils import render_include
from frappe.modules import get_module_path, load_doctype_module, scrub
from frappe.translate import extract_messages_from_code, make_dict_from_messages
from frappe.utils import get_html_format
def get_meta(doctype, cached=True):

View file

@ -1,17 +1,15 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
import frappe, copy
import copy
import frappe
import frappe.share
from frappe import _, msgprint
from frappe.utils import cint
import frappe.share
rights = ("select", "read", "write", "create", "delete", "submit", "cancel", "amend",
"print", "email", "report", "import", "export", "set_user_permissions", "share")
# TODO:
# optimize: meta.get_link_map (check if the doctype link exists for the given permission type)
def check_admin_or_system_manager(user=None):
if not user: user = frappe.session.user

View file

@ -1,12 +1,14 @@
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
import io
import unittest
import frappe.utils.pdf as pdfgen
import frappe, io
from PyPDF2 import PdfFileReader
#class TestPdfBorders(unittest.TestCase):
import frappe
import frappe.utils.pdf as pdfgen
class TestPdf(unittest.TestCase):
@property
def html(self):

View file

@ -7,12 +7,19 @@
Translation tools for frappe
"""
import frappe, os, re, io, json
from frappe.model.utils import render_include, InvalidIncludePath
from frappe.utils import strip, strip_html_tags, is_html
import itertools, operator
import io
import itertools
import json
import operator
import os
import re
from csv import reader
import frappe
from frappe.model.utils import InvalidIncludePath, render_include
from frappe.utils import is_html, strip, strip_html_tags
def guess_language(lang_list=None):
"""Set `frappe.local.lang` from HTTP headers at beginning of request"""
user_preferred_language = frappe.request.cookies.get('preferred_language')
@ -606,7 +613,7 @@ def read_csv_file(path):
with io.open(path, mode='r', encoding='utf-8', newline='') as msgfile:
data = reader(msgfile)
newdata = [[ val for val in row ] for row in data]
newdata = [[val for val in row] for row in data]
return newdata

View file

@ -1,6 +1,11 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
import redis, frappe, re, pickle
import pickle
import re
import redis
import frappe
from frappe.utils import cstr