Skip to content

Commit f9d9f1e

Browse files
committed
Update "flake8" style guide implementation
1 parent 781e218 commit f9d9f1e

File tree

5 files changed

+81
-75
lines changed

5 files changed

+81
-75
lines changed

examples/setup.cfg

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
[flake8]
2+
# W503,W504 (line break before or after binary operators)
23
exclude=recordings,temp
4+
ignore=W503,W504
35

46
[nosetests]
5-
# This is the config file for default values used during nosetest runs
67
# nocapture=1 displays print statements from output. Undo this by using: --nologcapture
78
# logging-level=INFO keeps the logs much cleaner than using DEBUG
89
nocapture=1
910
logging-level=INFO
11+
12+
[bdist_wheel]
13+
universal=1

seleniumbase/core/jqc_helper.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -240,19 +240,19 @@ def jquery_confirm_full_dialog(driver, message, buttons, options=None):
240240
},"""
241241
)
242242
b1_html = (
243-
"""formSubmit: {
244-
btnClass: 'btn-%s',
245-
text: '%s',
246-
action: function(){
247-
jqc_input = this.$content.find('.jqc_input').val();
248-
$jqc_input = this.$content.find('.jqc_input').val();
249-
jconfirm.lastInputText = jqc_input;
250-
jqc_status = '%s';
251-
$jqc_status = jqc_status;
252-
jconfirm.lastButtonText = jqc_status;
253-
}
254-
},"""
255-
)
243+
"""formSubmit: {
244+
btnClass: 'btn-%s',
245+
text: '%s',
246+
action: function(){
247+
jqc_input = this.$content.find('.jqc_input').val();
248+
$jqc_input = this.$content.find('.jqc_input').val();
249+
jconfirm.lastInputText = jqc_input;
250+
jqc_status = '%s';
251+
$jqc_status = jqc_status;
252+
jconfirm.lastButtonText = jqc_status;
253+
}
254+
},"""
255+
)
256256
one_button_trigger = ""
257257
if len(buttons) == 1:
258258
# If there's only one button, allow form submit with "Enter/Return"

seleniumbase/fixtures/base_case.py

Lines changed: 60 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -3402,34 +3402,34 @@ def __process_recorded_actions(self):
34023402
if (
34033403
(srt_actions[n][0] == "begin" or srt_actions[n][0] == "_url_")
34043404
and n > 0
3405-
and srt_actions[n-1][0] == "sk_op"
3405+
and srt_actions[n - 1][0] == "sk_op"
34063406
):
34073407
srt_actions[n][0] = "_skip"
34083408
for n in range(len(srt_actions)):
34093409
if (
34103410
(srt_actions[n][0] == "begin" or srt_actions[n][0] == "_url_")
34113411
and n > 1
3412-
and srt_actions[n-1][0] == "_skip"
3413-
and srt_actions[n-2][0] == "sk_op"
3414-
and srt_actions[n][2] == srt_actions[n-1][2]
3412+
and srt_actions[n - 1][0] == "_skip"
3413+
and srt_actions[n - 2][0] == "sk_op"
3414+
and srt_actions[n][2] == srt_actions[n - 1][2]
34153415
):
34163416
srt_actions[n][0] = "_skip"
34173417
for n in range(len(srt_actions)):
34183418
if (
34193419
(srt_actions[n][0] == "begin" or srt_actions[n][0] == "_url_")
34203420
and n > 0
34213421
and (
3422-
srt_actions[n-1][0] == "click"
3423-
or srt_actions[n-1][0] == "js_cl"
3424-
or srt_actions[n-1][0] == "js_ca"
3422+
srt_actions[n - 1][0] == "click"
3423+
or srt_actions[n - 1][0] == "js_cl"
3424+
or srt_actions[n - 1][0] == "js_ca"
34253425
)
34263426
):
3427-
url1 = srt_actions[n-1][2]
3427+
url1 = srt_actions[n - 1][2]
34283428
if (
3429-
srt_actions[n-1][0] == "js_cl"
3430-
or srt_actions[n-1][0] == "js_ca"
3429+
srt_actions[n - 1][0] == "js_cl"
3430+
or srt_actions[n - 1][0] == "js_ca"
34313431
):
3432-
url1 = srt_actions[n-1][2][0]
3432+
url1 = srt_actions[n - 1][2][0]
34333433
if url1.endswith("/#/"):
34343434
url1 = url1[:-3]
34353435
elif url1.endswith("/"):
@@ -3445,19 +3445,19 @@ def __process_recorded_actions(self):
34453445
or (len(url1) > 0
34463446
and (url2.startswith(url1) or "?search" in url1)
34473447
and (int(srt_actions[n][3]) - int(
3448-
srt_actions[n-1][3]) < 6500))
3448+
srt_actions[n - 1][3]) < 6500))
34493449
):
34503450
srt_actions[n][0] = "f_url"
34513451
for n in range(len(srt_actions)):
34523452
if (
34533453
(srt_actions[n][0] == "begin" or srt_actions[n][0] == "_url_")
34543454
and n > 0
34553455
and (
3456-
srt_actions[n-1][0] == "begin"
3457-
or srt_actions[n-1][0] == "_url_"
3456+
srt_actions[n - 1][0] == "begin"
3457+
or srt_actions[n - 1][0] == "_url_"
34583458
)
34593459
):
3460-
url1 = srt_actions[n-1][2]
3460+
url1 = srt_actions[n - 1][2]
34613461
if url1.endswith("/#/"):
34623462
url1 = url1[:-3]
34633463
elif url1.endswith("/"):
@@ -3468,64 +3468,66 @@ def __process_recorded_actions(self):
34683468
elif url2.endswith("/"):
34693469
url2 = url2[:-1]
34703470
if url1.replace("www.", "") == url2.replace("www.", ""):
3471-
srt_actions[n-1][0] = "_skip"
3471+
srt_actions[n - 1][0] = "_skip"
34723472
elif url2.startswith(url1):
34733473
srt_actions[n][0] = "f_url"
34743474
for n in range(len(srt_actions)):
34753475
if (
34763476
srt_actions[n][0] == "input"
34773477
and n > 0
3478-
and srt_actions[n-1][0] == "input"
3479-
and srt_actions[n-1][2] == ""
3478+
and srt_actions[n - 1][0] == "input"
3479+
and srt_actions[n - 1][2] == ""
34803480
):
3481-
srt_actions[n-1][0] = "_skip"
3481+
srt_actions[n - 1][0] = "_skip"
34823482
for n in range(len(srt_actions)):
34833483
if (
34843484
(srt_actions[n][0] == "begin" or srt_actions[n][0] == "_url_")
34853485
and n > 0
34863486
and (
3487-
srt_actions[n-1][0] == "click"
3488-
or srt_actions[n-1][0] == "js_cl"
3489-
or srt_actions[n-1][0] == "js_ca"
3490-
or srt_actions[n-1][0] == "input"
3487+
srt_actions[n - 1][0] == "click"
3488+
or srt_actions[n - 1][0] == "js_cl"
3489+
or srt_actions[n - 1][0] == "js_ca"
3490+
or srt_actions[n - 1][0] == "input"
3491+
)
3492+
and (
3493+
int(srt_actions[n][3]) - int(srt_actions[n - 1][3]) < 6500
34913494
)
3492-
and (int(srt_actions[n][3]) - int(srt_actions[n-1][3]) < 6500)
34933495
):
34943496
if (
3495-
srt_actions[n-1][0] == "click"
3496-
or srt_actions[n-1][0] == "js_cl"
3497-
or srt_actions[n-1][0] == "js_ca"
3497+
srt_actions[n - 1][0] == "click"
3498+
or srt_actions[n - 1][0] == "js_cl"
3499+
or srt_actions[n - 1][0] == "js_ca"
34983500
):
34993501
if (
3500-
srt_actions[n-1][1].startswith("input")
3501-
or srt_actions[n-1][1].startswith("button")
3502+
srt_actions[n - 1][1].startswith("input")
3503+
or srt_actions[n - 1][1].startswith("button")
35023504
):
35033505
srt_actions[n][0] = "f_url"
3504-
elif srt_actions[n-1][0] == "input":
3505-
if srt_actions[n-1][2].endswith("\n"):
3506+
elif srt_actions[n - 1][0] == "input":
3507+
if srt_actions[n - 1][2].endswith("\n"):
35063508
srt_actions[n][0] = "f_url"
35073509
for n in range(len(srt_actions)):
35083510
if (
35093511
srt_actions[n][0] == "cho_f"
35103512
and n > 0
3511-
and srt_actions[n-1][0] == "chfil"
3513+
and srt_actions[n - 1][0] == "chfil"
35123514
):
3513-
srt_actions[n-1][0] = "_skip"
3514-
srt_actions[n][2] = srt_actions[n-1][1][1]
3515+
srt_actions[n - 1][0] = "_skip"
3516+
srt_actions[n][2] = srt_actions[n - 1][1][1]
35153517
for n in range(len(srt_actions)):
35163518
if (
35173519
srt_actions[n][0] == "input"
35183520
and n > 0
3519-
and srt_actions[n-1][0] == "e_mfa"
3521+
and srt_actions[n - 1][0] == "e_mfa"
35203522
):
35213523
srt_actions[n][0] = "_skip"
35223524
for n in range(len(srt_actions)):
35233525
if (
35243526
(srt_actions[n][0] == "begin" or srt_actions[n][0] == "_url_")
35253527
and n > 0
35263528
and (
3527-
srt_actions[n-1][0] == "submi"
3528-
or srt_actions[n-1][0] == "e_mfa"
3529+
srt_actions[n - 1][0] == "submi"
3530+
or srt_actions[n - 1][0] == "e_mfa"
35293531
)
35303532
):
35313533
srt_actions[n][0] = "f_url"
@@ -3547,13 +3549,13 @@ def __process_recorded_actions(self):
35473549
if (
35483550
srt_actions[n][0] == "click"
35493551
and n > 0
3550-
and srt_actions[n-1][0] == "ho_cl"
3551-
and srt_actions[n-1][2] in origins
3552+
and srt_actions[n - 1][0] == "ho_cl"
3553+
and srt_actions[n - 1][2] in origins
35523554
):
3553-
srt_actions[n-1][0] = "_skip"
3555+
srt_actions[n - 1][0] = "_skip"
35543556
srt_actions[n][0] = "h_clk"
3555-
srt_actions[n][1] = srt_actions[n-1][1][0]
3556-
srt_actions[n][2] = srt_actions[n-1][1][1]
3557+
srt_actions[n][1] = srt_actions[n - 1][1][0]
3558+
srt_actions[n][2] = srt_actions[n - 1][1][1]
35573559
for n in range(len(srt_actions)):
35583560
if srt_actions[n][0] == "chfil" and srt_actions[n][2] in origins:
35593561
srt_actions[n][0] = "cho_f"
@@ -3563,9 +3565,9 @@ def __process_recorded_actions(self):
35633565
if (
35643566
srt_actions[n][0] == "sh_fc"
35653567
and n > 0
3566-
and srt_actions[n-1][0] == "sh_fc"
3568+
and srt_actions[n - 1][0] == "sh_fc"
35673569
):
3568-
srt_actions[n-1][0] = "_skip"
3570+
srt_actions[n - 1][0] = "_skip"
35693571
ext_actions = []
35703572
ext_actions.append("_url_")
35713573
ext_actions.append("js_cl")
@@ -3614,8 +3616,8 @@ def __process_recorded_actions(self):
36143616
if (
36153617
srt_actions[n][0] == "input"
36163618
and n > 0
3617-
and srt_actions[n-1][0] == "js_ty"
3618-
and srt_actions[n][2] == srt_actions[n-1][2]
3619+
and srt_actions[n - 1][0] == "js_ty"
3620+
and srt_actions[n][2] == srt_actions[n - 1][2]
36193621
):
36203622
srt_actions[n][0] = "_skip"
36213623
for n in range(len(srt_actions)):
@@ -8517,13 +8519,13 @@ def get_jqc_button_input(self, message, buttons, options=None):
85178519
new_buttons = []
85188520
for button in buttons:
85198521
if (
8520-
(type(button) is list or type(button) is tuple) and (
8521-
len(button) == 1)
8522+
(type(button) is list or type(button) is tuple)
8523+
and (len(button) == 1)
85228524
):
85238525
new_buttons.append(button[0])
85248526
elif (
8525-
(type(button) is list or type(button) is tuple) and (
8526-
len(button) > 1)
8527+
(type(button) is list or type(button) is tuple)
8528+
and (len(button) > 1)
85278529
):
85288530
new_buttons.append((button[0], str(button[1]).lower()))
85298531
else:
@@ -8587,13 +8589,13 @@ def get_jqc_text_input(self, message, button=None, options=None):
85878589
raise Exception('Expecting a string for arg: "message"!')
85888590
if button:
85898591
if (
8590-
(type(button) is list or type(button) is tuple) and (
8591-
len(button) == 1)
8592+
(type(button) is list or type(button) is tuple)
8593+
and (len(button) == 1)
85928594
):
85938595
button = (str(button[0]), "")
85948596
elif (
8595-
(type(button) is list or type(button) is tuple) and (
8596-
len(button) > 1)
8597+
(type(button) is list or type(button) is tuple)
8598+
and (len(button) > 1)
85978599
):
85988600
valid_colors = [
85998601
"blue",
@@ -8679,13 +8681,13 @@ def get_jqc_form_inputs(self, message, buttons, options=None):
86798681
new_buttons = []
86808682
for button in buttons:
86818683
if (
8682-
(type(button) is list or type(button) is tuple) and (
8683-
len(button) == 1)
8684+
(type(button) is list or type(button) is tuple)
8685+
and (len(button) == 1)
86848686
):
86858687
new_buttons.append(button[0])
86868688
elif (
8687-
(type(button) is list or type(button) is tuple) and (
8688-
len(button) > 1)
8689+
(type(button) is list or type(button) is tuple)
8690+
and (len(button) > 1)
86898691
):
86908692
new_buttons.append((button[0], str(button[1]).lower()))
86918693
else:

seleniumbase/plugins/pytest_plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ def pytest_addoption(parser):
532532
When using "--xvfb", the "--headless" option
533533
will no longer be enabled by default on Linux.
534534
Default: False. (Linux-ONLY!)""",
535-
)
535+
)
536536
parser.addoption(
537537
"--locale_code",
538538
"--locale-code",

setup.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
[flake8]
2+
# W503,W504 (line break before or after binary operators)
23
exclude=recordings,temp
4+
ignore=W503,W504
35

46
[nosetests]
5-
# This is the config file for default values used during nosetest runs
67
# nocapture=1 displays print statements from output. Undo this by using: --nologcapture
78
# logging-level=INFO keeps the logs much cleaner than using DEBUG
89
nocapture=1
910
logging-level=INFO
1011

1112
[bdist_wheel]
12-
# SeleniumBase works for both Python 2.7+ and Python 3.5+
1313
universal=1

0 commit comments

Comments
 (0)