Skip to content

Commit baaebd4

Browse files
committed
flake8 corrections
1 parent d975584 commit baaebd4

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

dash_auth/basic_auth.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,27 @@ def __init__(
1818
:param app: Dash app
1919
:param username_password_list: username:password list, either as a
2020
list of tuples or a dict
21-
:param auth_func: python function accepting two string arguments (username, password)
22-
and returning a boolean (True if the user has access otherwise False).
21+
:param auth_func: python function accepting two string
22+
arguments (username, password) and returning a
23+
boolean (True if the user has access otherwise False).
2324
"""
2425
Auth.__init__(self, app)
2526
self._auth_func = auth_func
2627
if self._auth_func is not None:
2728
if username_password_list is not None:
28-
raise ValueError("BasicAuth can only use authorization function (auth_func kwarg) "
29-
"or username_password_list, it cannot use both.")
29+
raise ValueError("BasicAuth can only use authorization "
30+
"function (auth_func kwarg) or "
31+
"username_password_list, it cannot use both.")
3032
else:
3133
if username_password_list is None:
32-
raise ValueError("BasicAuth requires username/password map or user-defined authorization function.")
34+
raise ValueError("BasicAuth requires username/password map "
35+
"or user-defined authorization function.")
3336
else:
3437
self._users = (
3538
username_password_list
3639
if isinstance(username_password_list, dict)
3740
else {k: v for k, v in username_password_list}
3841
)
39-
4042

4143
def is_authorized(self):
4244
header = flask.request.headers.get('Authorization', None)

usage.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
'hello': 'world'
77
}
88

9+
910
# Authorization function defined by developer
1011
# (can be used instead of VALID_USERNAME_PASSWORD_PAIRS [Example 2 below])
1112
def authorization_function(username, password):
@@ -14,6 +15,7 @@ def authorization_function(username, password):
1415
else:
1516
return False
1617

18+
1719
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
1820
app = Dash(__name__, external_stylesheets=external_stylesheets)
1921

0 commit comments

Comments
 (0)