Skip to content

Commit 9e48e33

Browse files
committed
Merge pull request #844 from noisycomputation/fix_lint_black
Fix string comparison for lint:black in package.json
1 parent f3a513b commit 9e48e33

34 files changed

+539
-700
lines changed

Diff for: packages/dash-core-components/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
"homepage": "https://github.com/plotly/dash-core-components",
1313
"main": "dash_core_components/dash_core_components.min.js",
1414
"scripts": {
15-
"private::format:black": "black --exclude dash_core_components .",
15+
"private::format.black": "black --exclude dash_core_components .",
1616
"private::format.eslint": "eslint src tests --fix",
1717
"private::format.prettier": "prettier --config .prettierrc --write src/**/*.js tests/unit/*.js",
18-
"private::lint:black": "if [[ PYTHON_VERSION != 'py27' ]]; then black --check --exclude dash_core_components .; fi",
18+
"private::lint.black": "if [ \"$PYTHON_VERSION\" != \"py27\" ]; then black --check --exclude dash_core_components .; fi",
1919
"private::lint.eslint": "eslint src tests",
2020
"private::lint.flake8": "flake8 --exclude=dash_core_components,node_modules,venv",
2121
"private::lint.prettier": "prettier --config .prettierrc src/**/*.js tests/unit/*.js --list-different",

Diff for: packages/dash-core-components/setup.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
from setuptools import setup
22
import json
33

4-
with open('package.json') as f:
4+
with open("package.json") as f:
55
package = json.load(f)
66

77
package_name = str(package["name"].replace(" ", "_").replace("-", "_"))
88

99
setup(
10-
name='dash_core_components',
10+
name="dash_core_components",
1111
version=package["version"],
12-
author=package['author'],
13-
author_email='[email protected]',
12+
author=package["author"],
13+
author_email="[email protected]",
1414
packages=[package_name],
1515
include_package_data=True,
16-
license=package['license'],
16+
license=package["license"],
1717
description=package.get("description", package_name),
18-
install_requires=[]
18+
install_requires=[],
1919
)

Diff for: packages/dash-core-components/tests/IntegrationTests.py

+18-23
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,22 @@
1515

1616

1717
class IntegrationTests(unittest.TestCase):
18-
1918
@classmethod
2019
def setUpClass(cls):
2120
super(IntegrationTests, cls).setUpClass()
2221

2322
options = Options()
2423
capabilities = DesiredCapabilities.CHROME
25-
capabilities['loggingPrefs'] = {'browser': 'SEVERE'}
24+
capabilities["loggingPrefs"] = {"browser": "SEVERE"}
2625

27-
if 'DASH_TEST_CHROMEPATH' in os.environ:
28-
options.binary_location = os.environ['DASH_TEST_CHROMEPATH']
26+
if "DASH_TEST_CHROMEPATH" in os.environ:
27+
options.binary_location = os.environ["DASH_TEST_CHROMEPATH"]
2928

30-
cls.driver = webdriver.Chrome(options=options, desired_capabilities=capabilities)
29+
cls.driver = webdriver.Chrome(
30+
options=options, desired_capabilities=capabilities
31+
)
3132
loader = percy.ResourceLoader(
32-
webdriver=cls.driver,
33-
base_url='/assets',
34-
root_dir='tests/assets'
33+
webdriver=cls.driver, base_url="/assets", root_dir="tests/assets"
3534
)
3635
cls.percy_runner = percy.Runner(loader=loader)
3736
cls.percy_runner.initialize_build()
@@ -45,8 +44,8 @@ def setUp(self):
4544
pass
4645

4746
def tearDown(self):
48-
if platform.system() == 'Windows':
49-
requests.get('http://localhost:8050/stop')
47+
if platform.system() == "Windows":
48+
requests.get("http://localhost:8050/stop")
5049
else:
5150
self.server_process.terminate()
5251

@@ -60,8 +59,8 @@ def startServer(self, app):
6059
:type app: dash.Dash
6160
:return:
6261
"""
63-
if 'DASH_TEST_PROCESSES' in os.environ:
64-
processes = int(os.environ['DASH_TEST_PROCESSES'])
62+
if "DASH_TEST_PROCESSES" in os.environ:
63+
processes = int(os.environ["DASH_TEST_PROCESSES"])
6564
else:
6665
processes = 4
6766

@@ -76,29 +75,25 @@ def run():
7675
use_reloader=False,
7776
use_debugger=True,
7877
dev_tools_hot_reload=False,
79-
dev_tools_ui=False
78+
dev_tools_ui=False,
8079
)
8180

8281
def run_windows():
8382
app.scripts.config.serve_locally = True
8483
app.css.config.serve_locally = True
8584

86-
@app.server.route('/stop')
85+
@app.server.route("/stop")
8786
def _stop_server_windows():
88-
stopper = flask.request.environ['werkzeug.server.shutdown']
87+
stopper = flask.request.environ["werkzeug.server.shutdown"]
8988
stopper()
90-
return 'stop'
89+
return "stop"
9190

92-
app.run_server(
93-
port=8050,
94-
debug=False,
95-
threaded=True
96-
)
91+
app.run_server(port=8050, debug=False, threaded=True)
9792

9893
# Run on a separate process so that it doesn't block
9994

10095
system = platform.system()
101-
if system == 'Windows':
96+
if system == "Windows":
10297
# multiprocess can't pickle an inner func on windows (closure are not serializable by default on windows)
10398
self.server_thread = threading.Thread(target=run_windows)
10499
self.server_thread.start()
@@ -109,7 +104,7 @@ def _stop_server_windows():
109104

110105
# Visit the dash page
111106
self.driver.implicitly_wait(2)
112-
self.driver.get('http://localhost:8050')
107+
self.driver.get("http://localhost:8050")
113108

114109
def clear_log(self):
115110
entries = self.driver.get_log("browser")

Diff for: packages/dash-core-components/tests/integration/calendar/test_calendar_props.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,15 @@ def test_cdpr001_date_clearable_true_works(dash_dcc):
3131

3232
close_btn.click()
3333
start_date, end_date = dash_dcc.get_date_range("dpr")
34-
assert (
35-
not start_date and not end_date
36-
), "both start and end dates should be cleared"
34+
assert not start_date and not end_date, "both start and end dates should be cleared"
3735

3836
# DPS
3937
selected = dash_dcc.select_date_single("dps", day="1")
4038

4139
assert selected, "single date should get a value"
4240
close_btn = dash_dcc.wait_for_element("#dps button")
4341
close_btn.click()
44-
single_date, = dash_dcc.get_date_range("dps")
42+
(single_date,) = dash_dcc.get_date_range("dps")
4543
assert not single_date, "date should be cleared"
4644

4745

Diff for: packages/dash-core-components/tests/integration/calendar/test_date_picker_range.py

+35-29
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@
77

88
def test_dtpr001_initial_month_provided(dash_dcc):
99
app = dash.Dash(__name__)
10-
app.layout = html.Div([
11-
dcc.DatePickerRange(
12-
id="dps-initial-month",
13-
min_date_allowed=datetime(2010, 1, 1),
14-
max_date_allowed=datetime(2099, 12, 31),
15-
initial_visible_month=datetime(2019, 10, 28)
16-
)
17-
])
10+
app.layout = html.Div(
11+
[
12+
dcc.DatePickerRange(
13+
id="dps-initial-month",
14+
min_date_allowed=datetime(2010, 1, 1),
15+
max_date_allowed=datetime(2099, 12, 31),
16+
initial_visible_month=datetime(2019, 10, 28),
17+
)
18+
]
19+
)
1820

1921
dash_dcc.start_server(app)
2022

@@ -24,21 +26,23 @@ def test_dtpr001_initial_month_provided(dash_dcc):
2426
date_picker_start.click()
2527

2628
dash_dcc.wait_for_text_to_equal(
27-
'#dps-initial-month .CalendarMonth.CalendarMonth_1[data-visible=true] strong',
28-
'October 2019',
29-
1
29+
"#dps-initial-month .CalendarMonth.CalendarMonth_1[data-visible=true] strong",
30+
"October 2019",
31+
1,
3032
)
3133

3234

3335
def test_dtpr002_no_initial_month_min_date(dash_dcc):
3436
app = dash.Dash(__name__)
35-
app.layout = html.Div([
36-
dcc.DatePickerRange(
37-
id="dps-initial-month",
38-
min_date_allowed=datetime(2010, 1, 1),
39-
max_date_allowed=datetime(2099, 12, 31)
40-
)
41-
])
37+
app.layout = html.Div(
38+
[
39+
dcc.DatePickerRange(
40+
id="dps-initial-month",
41+
min_date_allowed=datetime(2010, 1, 1),
42+
max_date_allowed=datetime(2099, 12, 31),
43+
)
44+
]
45+
)
4246

4347
dash_dcc.start_server(app)
4448

@@ -48,20 +52,22 @@ def test_dtpr002_no_initial_month_min_date(dash_dcc):
4852
date_picker_start.click()
4953

5054
dash_dcc.wait_for_text_to_equal(
51-
'#dps-initial-month .CalendarMonth.CalendarMonth_1[data-visible=true] strong',
52-
'January 2010'
55+
"#dps-initial-month .CalendarMonth.CalendarMonth_1[data-visible=true] strong",
56+
"January 2010",
5357
)
5458

5559

5660
def test_dtpr003_no_initial_month_no_min_date_start_date(dash_dcc):
5761
app = dash.Dash(__name__)
58-
app.layout = html.Div([
59-
dcc.DatePickerRange(
60-
id="dps-initial-month",
61-
start_date=datetime(2019, 8, 13),
62-
max_date_allowed=datetime(2099, 12, 31)
63-
)
64-
])
62+
app.layout = html.Div(
63+
[
64+
dcc.DatePickerRange(
65+
id="dps-initial-month",
66+
start_date=datetime(2019, 8, 13),
67+
max_date_allowed=datetime(2099, 12, 31),
68+
)
69+
]
70+
)
6571

6672
dash_dcc.start_server(app)
6773

@@ -71,6 +77,6 @@ def test_dtpr003_no_initial_month_no_min_date_start_date(dash_dcc):
7177
date_picker_start.click()
7278

7379
dash_dcc.wait_for_text_to_equal(
74-
'#dps-initial-month .CalendarMonth.CalendarMonth_1[data-visible=true] strong',
75-
'August 2019'
80+
"#dps-initial-month .CalendarMonth.CalendarMonth_1[data-visible=true] strong",
81+
"August 2019",
7682
)

Diff for: packages/dash-core-components/tests/integration/calendar/test_date_picker_single.py

+18-23
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ def test_dtps001_simple_click(dash_dcc):
1717
id="dps",
1818
min_date_allowed=datetime(2010, 1, 1),
1919
max_date_allowed=datetime(2099, 12, 31),
20-
initial_visible_month=datetime.today().date()
21-
- timedelta(days=1),
20+
initial_visible_month=datetime.today().date() - timedelta(days=1),
2221
day_size=47,
2322
),
2423
],
@@ -65,11 +64,8 @@ def test_dtps010_local_and_session_persistence(dash_dcc):
6564
session = dash_dcc.select_date_single("dps-session", index=idx)
6665
dash_dcc.wait_for_page()
6766
assert (
68-
dash_dcc.find_element("#dps-local input").get_attribute("value")
69-
== local
70-
and dash_dcc.find_element("#dps-session input").get_attribute(
71-
"value"
72-
)
67+
dash_dcc.find_element("#dps-local input").get_attribute("value") == local
68+
and dash_dcc.find_element("#dps-session input").get_attribute("value")
7369
== session
7470
), "the date value should be consistent after refresh"
7571

@@ -90,8 +86,7 @@ def cb(clicks):
9086
id="dps-memory",
9187
min_date_allowed=datetime(2010, 1, 1),
9288
max_date_allowed=datetime(2099, 12, 31),
93-
initial_visible_month=datetime.today().date()
94-
- timedelta(days=1),
89+
initial_visible_month=datetime.today().date() - timedelta(days=1),
9590
persistence=True,
9691
persistence_type="memory",
9792
day_size=47,
@@ -100,8 +95,7 @@ def cb(clicks):
10095
id="dps-none",
10196
min_date_allowed=datetime(2010, 1, 1),
10297
max_date_allowed=datetime(2099, 12, 31),
103-
initial_visible_month=datetime.today().date()
104-
- timedelta(days=1),
98+
initial_visible_month=datetime.today().date() - timedelta(days=1),
10599
day_size=47,
106100
),
107101
]
@@ -120,28 +114,29 @@ def cb(clicks):
120114
assert dash_dcc.wait_for_text_to_equal("#out", "switched")
121115
switch.click()
122116
assert (
123-
dash_dcc.find_element("#dps-memory input").get_attribute("value")
124-
== memorized
117+
dash_dcc.find_element("#dps-memory input").get_attribute("value") == memorized
125118
)
126119
switched = dash_dcc.find_element("#dps-none input").get_attribute("value")
127120
assert switched != amnesiaed and switched == ""
128121

129122

130123
def test_dtps012_initial_month(dash_dcc):
131124
app = dash.Dash(__name__)
132-
app.layout = html.Div([
133-
dcc.DatePickerSingle(
134-
id="dps-initial-month",
135-
min_date_allowed=datetime(2010, 1, 1),
136-
max_date_allowed=datetime(2099, 12, 31)
137-
)
138-
])
125+
app.layout = html.Div(
126+
[
127+
dcc.DatePickerSingle(
128+
id="dps-initial-month",
129+
min_date_allowed=datetime(2010, 1, 1),
130+
max_date_allowed=datetime(2099, 12, 31),
131+
)
132+
]
133+
)
139134

140135
dash_dcc.start_server(app)
141136

142-
date_picker = dash_dcc.find_element('#dps-initial-month')
137+
date_picker = dash_dcc.find_element("#dps-initial-month")
143138
date_picker.click()
144139
dash_dcc.wait_for_text_to_equal(
145-
'#dps-initial-month .CalendarMonth.CalendarMonth_1[data-visible=true] strong',
146-
'January 2010'
140+
"#dps-initial-month .CalendarMonth.CalendarMonth_1[data-visible=true] strong",
141+
"January 2010",
147142
)

0 commit comments

Comments
 (0)