ci: flake8 issues

This commit is contained in:
Jannat Patel
2022-11-04 12:43:15 +05:30
parent 33065c0ed3
commit cca42dca49
63 changed files with 12919 additions and 12795 deletions

View File

@@ -9,7 +9,7 @@ root = true
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_style = tab
trim_trailing_whitespace = true
# Python

37
.flake8 Normal file
View File

@@ -0,0 +1,37 @@
[flake8]
ignore =
E121,
E126,
E127,
E128,
E203,
E225,
E226,
E231,
E241,
E251,
E261,
E265,
E302,
E303,
E305,
E402,
E501,
E741,
W291,
W292,
W293,
W391,
W503,
W504,
F403,
B007,
B950,
W191,
E124, # closing bracket, irritating while writing QB code
E131, # continuation line unaligned for hanging indent
E123, # closing bracket does not match indentation of opening bracket's line
E101, # ensured by use of black
max-line-length = 200
exclude=.github/helper/semgrep_rules

74
.github/helper/flake8.conf vendored Normal file
View File

@@ -0,0 +1,74 @@
[flake8]
ignore =
B001,
B007,
B009,
B010,
B950,
E101,
E111,
E114,
E116,
E117,
E121,
E122,
E123,
E124,
E125,
E126,
E127,
E128,
E131,
E201,
E202,
E203,
E211,
E221,
E222,
E223,
E224,
E225,
E226,
E228,
E231,
E241,
E242,
E251,
E261,
E262,
E265,
E266,
E271,
E272,
E273,
E274,
E301,
E302,
E303,
E305,
E306,
E402,
E501,
E502,
E701,
E702,
E703,
E741,
F401,
F403,
F405,
W191,
W291,
W292,
W293,
W391,
W503,
W504,
E711,
E129,
F841,
E713,
E712,
max-line-length = 200

View File

@@ -15,7 +15,7 @@ from lms.lms.md import find_macros, markdown_to_html
RE_SLUG_NOTALLOWED = re.compile("[^a-z0-9]+")
def slugify(title, used_slugs=[]):
def slugify(title, used_slugs):
"""Converts title to a slug.
If a list of used slugs is specified, it will make sure the generated slug
@@ -28,6 +28,9 @@ def slugify(title, used_slugs=[]):
>>> slugify("Hello World!", ['hello-world', 'hello-world-2'])
'hello-world-3'
"""
if not used_slugs:
used_slugs = []
slug = RE_SLUG_NOTALLOWED.sub("-", title.lower()).strip("-")
used_slugs = set(used_slugs)

View File

@@ -9,7 +9,9 @@
: typeof define === "function" && define.amd
? define(factory)
: ((global =
typeof globalThis !== "undefined" ? globalThis : global || self),
typeof globalThis !== "undefined"
? globalThis
: global || self),
(global.html2canvas = factory()));
})(this, function () {
"use strict";
@@ -5906,7 +5908,8 @@
? parseColor(
context,
getComputedStyle(
iframe.contentWindow.document.documentElement
iframe.contentWindow.document
.documentElement
).backgroundColor
)
: COLORS.TRANSPARENT;
@@ -8168,14 +8171,18 @@
bounds.left +
Math.min(
bottomWidth,
bounds.width - (borderLeftWidth + paddingLeft)
bounds.width -
(borderLeftWidth + paddingLeft)
),
bounds.top +
Math.min(
rightHeight,
bounds.height + borderTopWidth + paddingTop
),
Math.max(0, brh - (borderRightWidth + paddingRight)),
Math.max(
0,
brh - (borderRightWidth + paddingRight)
),
brv - (borderBottomWidth + paddingBottom),
CORNER.BOTTOM_RIGHT
)

View File

@@ -56,7 +56,10 @@ class Widget:
'<div>Hello, World!</div>'
"""
def __init__(self, name, widget_globals={}):
def __init__(self, name, widget_globals):
if not widget_globals:
widget_globals = {}
self.widget_globals = widget_globals
self.name = name

View File

@@ -17,7 +17,7 @@ def get_context(context):
try:
context.member = frappe.get_doc("User", {"username": username})
except:
except Exception:
context.template = "www/404.html"
return