mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-08 10:34:10 +00:00
update back pre-commit hook
specify minimum target_version as py36 results in some churn
This commit is contained in:
@@ -4,7 +4,7 @@ repos:
|
|||||||
hooks:
|
hooks:
|
||||||
- id: reorder-python-imports
|
- id: reorder-python-imports
|
||||||
- repo: https://github.com/psf/black
|
- repo: https://github.com/psf/black
|
||||||
rev: 19.10b0
|
rev: 20.8b1
|
||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: black
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
|
@@ -101,7 +101,10 @@ class Authenticator(LoggingConfigurable):
|
|||||||
"""
|
"""
|
||||||
).tag(config=True)
|
).tag(config=True)
|
||||||
|
|
||||||
whitelist = Set(help="Deprecated, use `Authenticator.allowed_users`", config=True,)
|
whitelist = Set(
|
||||||
|
help="Deprecated, use `Authenticator.allowed_users`",
|
||||||
|
config=True,
|
||||||
|
)
|
||||||
|
|
||||||
allowed_users = Set(
|
allowed_users = Set(
|
||||||
help="""
|
help="""
|
||||||
@@ -715,7 +718,9 @@ for _old_name, _new_name, _version in [
|
|||||||
("check_blacklist", "check_blocked_users", "1.2"),
|
("check_blacklist", "check_blocked_users", "1.2"),
|
||||||
]:
|
]:
|
||||||
setattr(
|
setattr(
|
||||||
Authenticator, _old_name, _deprecated_method(_old_name, _new_name, _version),
|
Authenticator,
|
||||||
|
_old_name,
|
||||||
|
_deprecated_method(_old_name, _new_name, _version),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -778,7 +783,9 @@ class LocalAuthenticator(Authenticator):
|
|||||||
"""
|
"""
|
||||||
).tag(config=True)
|
).tag(config=True)
|
||||||
|
|
||||||
group_whitelist = Set(help="""DEPRECATED: use allowed_groups""",).tag(config=True)
|
group_whitelist = Set(
|
||||||
|
help="""DEPRECATED: use allowed_groups""",
|
||||||
|
).tag(config=True)
|
||||||
|
|
||||||
allowed_groups = Set(
|
allowed_groups = Set(
|
||||||
help="""
|
help="""
|
||||||
|
@@ -489,7 +489,7 @@ class BaseHandler(RequestHandler):
|
|||||||
self.clear_cookie(
|
self.clear_cookie(
|
||||||
'jupyterhub-services',
|
'jupyterhub-services',
|
||||||
path=url_path_join(self.base_url, 'services'),
|
path=url_path_join(self.base_url, 'services'),
|
||||||
**kwargs
|
**kwargs,
|
||||||
)
|
)
|
||||||
# Reset _jupyterhub_user
|
# Reset _jupyterhub_user
|
||||||
self._jupyterhub_user = None
|
self._jupyterhub_user = None
|
||||||
@@ -1485,10 +1485,14 @@ class UserUrlHandler(BaseHandler):
|
|||||||
|
|
||||||
# if request is expecting JSON, assume it's an API request and fail with 503
|
# if request is expecting JSON, assume it's an API request and fail with 503
|
||||||
# because it won't like the redirect to the pending page
|
# because it won't like the redirect to the pending page
|
||||||
if get_accepted_mimetype(
|
if (
|
||||||
self.request.headers.get('Accept', ''),
|
get_accepted_mimetype(
|
||||||
choices=['application/json', 'text/html'],
|
self.request.headers.get('Accept', ''),
|
||||||
) == 'application/json' or 'api' in user_path.split('/'):
|
choices=['application/json', 'text/html'],
|
||||||
|
)
|
||||||
|
== 'application/json'
|
||||||
|
or 'api' in user_path.split('/')
|
||||||
|
):
|
||||||
self._fail_api_request(user_name, server_name)
|
self._fail_api_request(user_name, server_name)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@@ -256,7 +256,7 @@ class JupyterHubRequestValidator(RequestValidator):
|
|||||||
self.db.commit()
|
self.db.commit()
|
||||||
|
|
||||||
def get_authorization_code_scopes(self, client_id, code, redirect_uri, request):
|
def get_authorization_code_scopes(self, client_id, code, redirect_uri, request):
|
||||||
""" Extracts scopes from saved authorization code.
|
"""Extracts scopes from saved authorization code.
|
||||||
The scopes returned by this method is used to route token requests
|
The scopes returned by this method is used to route token requests
|
||||||
based on scopes passed to Authorization Code requests.
|
based on scopes passed to Authorization Code requests.
|
||||||
With that the token endpoint knows when to include OpenIDConnect
|
With that the token endpoint knows when to include OpenIDConnect
|
||||||
|
@@ -107,14 +107,14 @@ class Pagination(Configurable):
|
|||||||
|
|
||||||
def calculate_pages_window(self):
|
def calculate_pages_window(self):
|
||||||
"""Calculates the set of pages to render later in links() method.
|
"""Calculates the set of pages to render later in links() method.
|
||||||
It returns the list of pages to render via links for the pagination
|
It returns the list of pages to render via links for the pagination
|
||||||
By default, as we've observed in other applications, we're going to render
|
By default, as we've observed in other applications, we're going to render
|
||||||
only a finite and predefined number of pages, avoiding visual fatigue related
|
only a finite and predefined number of pages, avoiding visual fatigue related
|
||||||
to a long list of pages. By default, we render 7 pages plus some inactive links with the characters '...'
|
to a long list of pages. By default, we render 7 pages plus some inactive links with the characters '...'
|
||||||
to point out that there are other pages that aren't explicitly rendered.
|
to point out that there are other pages that aren't explicitly rendered.
|
||||||
The primary way of work is to provide current webpage and 5 next pages, the last 2 ones
|
The primary way of work is to provide current webpage and 5 next pages, the last 2 ones
|
||||||
(in case the current page + 5 does not overflow the total lenght of pages) and the first one for reference.
|
(in case the current page + 5 does not overflow the total lenght of pages) and the first one for reference.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
before_page = 2
|
before_page = 2
|
||||||
after_page = 2
|
after_page = 2
|
||||||
@@ -158,9 +158,9 @@ class Pagination(Configurable):
|
|||||||
@property
|
@property
|
||||||
def links(self):
|
def links(self):
|
||||||
"""Get the links for the pagination.
|
"""Get the links for the pagination.
|
||||||
Getting the input from calculate_pages_window(), generates the HTML code
|
Getting the input from calculate_pages_window(), generates the HTML code
|
||||||
for the pages to render, plus the arrows to go onwards and backwards (if needed).
|
for the pages to render, plus the arrows to go onwards and backwards (if needed).
|
||||||
"""
|
"""
|
||||||
if self.total_pages == 1:
|
if self.total_pages == 1:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
@@ -216,7 +216,7 @@ def admin_user(app, username):
|
|||||||
class MockServiceSpawner(jupyterhub.services.service._ServiceSpawner):
|
class MockServiceSpawner(jupyterhub.services.service._ServiceSpawner):
|
||||||
"""mock services for testing.
|
"""mock services for testing.
|
||||||
|
|
||||||
Shorter intervals, etc.
|
Shorter intervals, etc.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
poll_interval = 1
|
poll_interval = 1
|
||||||
|
@@ -182,7 +182,8 @@ async def test_get_users(app):
|
|||||||
|
|
||||||
@mark.user
|
@mark.user
|
||||||
@mark.parametrize(
|
@mark.parametrize(
|
||||||
"state", ("inactive", "active", "ready", "invalid"),
|
"state",
|
||||||
|
("inactive", "active", "ready", "invalid"),
|
||||||
)
|
)
|
||||||
async def test_get_users_state_filter(app, state):
|
async def test_get_users_state_filter(app, state):
|
||||||
db = app.db
|
db = app.db
|
||||||
|
@@ -265,7 +265,8 @@ async def test_spawn_with_query_arguments(app):
|
|||||||
next_url = ujoin(app.base_url, 'user/jones/tree')
|
next_url = ujoin(app.base_url, 'user/jones/tree')
|
||||||
r = await async_requests.get(
|
r = await async_requests.get(
|
||||||
url_concat(
|
url_concat(
|
||||||
ujoin(base_url, 'spawn'), {'next': next_url, 'energy': '510keV'},
|
ujoin(base_url, 'spawn'),
|
||||||
|
{'next': next_url, 'energy': '510keV'},
|
||||||
),
|
),
|
||||||
cookies=cookies,
|
cookies=cookies,
|
||||||
)
|
)
|
||||||
|
@@ -258,8 +258,7 @@ async def test_shell_cmd(db, tmpdir, request):
|
|||||||
|
|
||||||
|
|
||||||
def test_inherit_overwrite():
|
def test_inherit_overwrite():
|
||||||
"""On 3.6+ we check things are overwritten at import time
|
"""On 3.6+ we check things are overwritten at import time"""
|
||||||
"""
|
|
||||||
if sys.version_info >= (3, 6):
|
if sys.version_info >= (3, 6):
|
||||||
with pytest.raises(NotImplementedError):
|
with pytest.raises(NotImplementedError):
|
||||||
|
|
||||||
|
@@ -75,8 +75,7 @@ def can_connect(ip, port):
|
|||||||
|
|
||||||
|
|
||||||
def make_ssl_context(keyfile, certfile, cafile=None, verify=True, check_hostname=True):
|
def make_ssl_context(keyfile, certfile, cafile=None, verify=True, check_hostname=True):
|
||||||
"""Setup context for starting an https server or making requests over ssl.
|
"""Setup context for starting an https server or making requests over ssl."""
|
||||||
"""
|
|
||||||
if not keyfile or not certfile:
|
if not keyfile or not certfile:
|
||||||
return None
|
return None
|
||||||
purpose = ssl.Purpose.SERVER_AUTH if verify else ssl.Purpose.CLIENT_AUTH
|
purpose = ssl.Purpose.SERVER_AUTH if verify else ssl.Purpose.CLIENT_AUTH
|
||||||
@@ -96,7 +95,7 @@ async def exponential_backoff(
|
|||||||
timeout=10,
|
timeout=10,
|
||||||
timeout_tolerance=0.1,
|
timeout_tolerance=0.1,
|
||||||
*args,
|
*args,
|
||||||
**kwargs
|
**kwargs,
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Exponentially backoff until `pass_func` is true.
|
Exponentially backoff until `pass_func` is true.
|
||||||
|
@@ -1,2 +1,7 @@
|
|||||||
[tool.black]
|
[tool.black]
|
||||||
skip-string-normalization = true
|
skip-string-normalization = true
|
||||||
|
target_version = [
|
||||||
|
"py36",
|
||||||
|
"py37",
|
||||||
|
"py38",
|
||||||
|
]
|
||||||
|
Reference in New Issue
Block a user