From 94fab1b3207da7dfb4890eb09e2f3e1320daf2bb Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Sun, 12 Mar 2023 15:48:37 +0000 Subject: [PATCH] Cast ``url_for()`` output to ``str`` Starlette 0.26.0 has changed the return type of `HTTPConnection.url_for()` from `str` to `URL`, which breaks the Galaxy package mypy tests: ``` mypy . --enable-incomplete-feature=Unpack galaxy/webapps/galaxy/api/__init__.py:180: error: Incompatible types in assignment (expression has type "str", variable has type "URL") [assignment] url = f"{url}?{urlencode(query_params)}" ^ Found 1 error in 1 file (checked 255 source files) ``` --- lib/galaxy/webapps/galaxy/api/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/webapps/galaxy/api/__init__.py b/lib/galaxy/webapps/galaxy/api/__init__.py index 04fbcbd9b02..c6723c58b26 100644 --- a/lib/galaxy/webapps/galaxy/api/__init__.py +++ b/lib/galaxy/webapps/galaxy/api/__init__.py @@ -173,7 +173,7 @@ class UrlBuilder: query_params = path_params.pop("query_params", None) try: if qualified: - url = self.request.url_for(name, **path_params) + url = str(self.request.url_for(name, **path_params)) else: url = self.request.app.url_path_for(name, **path_params) if query_params: