From 87acee253addc7dc425e469fb0c06a32fadf64e4 Mon Sep 17 00:00:00 2001 From: Egor Didenko Date: Wed, 18 Sep 2024 12:52:54 -0400 Subject: [PATCH] fix: Corrected the errors on linter --- docs/django-widget.rst | 2 +- pyuploadcare/dj/conf.py | 20 +++++++++++--------- tests/dj/test_conf.py | 7 +++++-- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/docs/django-widget.rst b/docs/django-widget.rst index 43741ca..e297f25 100644 --- a/docs/django-widget.rst +++ b/docs/django-widget.rst @@ -36,7 +36,7 @@ Below is the full default configuration: "use_legacy_widget": False, "use_hosted_assets": True, "widget": { - "version": "0.36.0", + "version": "1", "variant": "regular", "build": "min", "options": {}, diff --git a/pyuploadcare/dj/conf.py b/pyuploadcare/dj/conf.py index f40cab0..39c83c4 100644 --- a/pyuploadcare/dj/conf.py +++ b/pyuploadcare/dj/conf.py @@ -131,12 +131,13 @@ def get_legacy_widget_js_url() -> str: def get_widget_js_url() -> str: widget_config = config["widget"] - filename = "file-uploader.{0}.min.js".format(widget_config["build"]).replace( - "..", "." - ) - hosted_url = "https://cdn.jsdelivr.net/npm/@uploadcare/file-uploader@{version}/web/{filename}".format( - version=widget_config["version"], filename=filename - ) + filename = "file-uploader.{0}.min.js".format( + widget_config["build"] + ).replace("..", ".") + hosted_url = ( + "https://cdn.jsdelivr.net/npm/@uploadcare/file-uploader@{version}" + + "/web/{filename}" + ).format(version=widget_config["version"], filename=filename) local_url = "uploadcare/{filename}".format(filename=filename) override_url = widget_config["override_js_url"] if override_url: @@ -152,9 +153,10 @@ def get_widget_css_url(variant: WidgetVariantType) -> str: filename = "uc-file-uploader-{0}.{1}.min.css".format( variant, widget_config["build"] ).replace("..", ".") - hosted_url = "https://cdn.jsdelivr.net/npm/@uploadcare/file-uploader@{version}/web/{filename}".format( - version=widget_config["version"], filename=filename - ) + hosted_url = ( + "https://cdn.jsdelivr.net/npm/@uploadcare/file-uploader@{version}" + + "/web/{filename}" + ).format(version=widget_config["version"], filename=filename) local_url = "uploadcare/{filename}".format(filename=filename) override_url = widget_config["override_css_url"][variant] if override_url: diff --git a/tests/dj/test_conf.py b/tests/dj/test_conf.py index 15f8168..9a3e3dc 100644 --- a/tests/dj/test_conf.py +++ b/tests/dj/test_conf.py @@ -76,7 +76,9 @@ def test_hosted_js_url(self): def test_local_js_url(self): config["use_hosted_assets"] = False - self.assertEqual(get_widget_js_url(), "uploadcare/file-uploader.min.js") + self.assertEqual( + get_widget_js_url(), "uploadcare/file-uploader.min.js" + ) def test_override_js_url(self): config["widget"]["override_js_url"] = "https://example.com/blocks.js" @@ -86,7 +88,8 @@ def test_hosted_css_url(self): config["use_hosted_assets"] = True self.assertEqual( get_widget_css_url("minimal"), - "https://cdn.jsdelivr.net/npm/@uploadcare/file-uploader@1/web/uc-file-uploader-minimal.min.css" + "https://cdn.jsdelivr.net/npm/@uploadcare/file-uploader@1" + + "/web/uc-file-uploader-minimal.min.css", ) def test_local_css_url(self):