From 26a5fff3c10f30852bfdf226f8a419f742400c2d Mon Sep 17 00:00:00 2001 From: stevejpurves Date: Tue, 20 Feb 2024 21:17:53 +0000 Subject: [PATCH] pre-commit fixes --- binderhub/app.py | 2 +- binderhub/repoproviders.py | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/binderhub/app.py b/binderhub/app.py index 59c502a84..37beb58b2 100644 --- a/binderhub/app.py +++ b/binderhub/app.py @@ -56,7 +56,6 @@ from .ratelimit import RateLimiter from .registry import DockerRegistry from .repoproviders import ( - MecaRepoProvider, DataverseProvider, FigshareProvider, GistRepoProvider, @@ -64,6 +63,7 @@ GitLabRepoProvider, GitRepoProvider, HydroshareProvider, + MecaRepoProvider, RepoProvider, ZenodoProvider, ) diff --git a/binderhub/repoproviders.py b/binderhub/repoproviders.py index af48e943e..d3df12b91 100644 --- a/binderhub/repoproviders.py +++ b/binderhub/repoproviders.py @@ -15,10 +15,11 @@ import time import urllib.parse from datetime import datetime, timedelta, timezone -from urllib.parse import urlparse, urlunparse from hashlib import md5 +from urllib.parse import unquote, urlparse, urlunparse import escapism +import validators as val from prometheus_client import Gauge from tornado.httpclient import AsyncHTTPClient, HTTPError, HTTPRequest from tornado.httputil import url_concat @@ -325,7 +326,9 @@ def get_hashed_slug(self, url, changes_with_content): stripped_url = urlunparse( (parsed_url.scheme, parsed_url.netloc, parsed_url.path, "", "", "") ) - return "meca-" + md5(f"{stripped_url}-{changes_with_content}".encode()).hexdigest() + return ( + "meca-" + md5(f"{stripped_url}-{changes_with_content}".encode()).hexdigest() + ) async def get_resolved_ref(self): # Check the URL is reachable