From 7b1519f82e389824b034d54bf1de3af9c7ec62a8 Mon Sep 17 00:00:00 2001 From: Tim McCormack Date: Mon, 30 Sep 2024 14:16:05 +0000 Subject: [PATCH] style: Fix some lint issues that had been amnestied Several now-irrelevant lint-disables and one legit one that was easy to fix. --- .../djangoapps/contentserver/test/test_contentserver.py | 1 - openedx/core/djangoapps/contentserver/views.py | 7 ++----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/openedx/core/djangoapps/contentserver/test/test_contentserver.py b/openedx/core/djangoapps/contentserver/test/test_contentserver.py index 02899334eed4..4c0180c402e9 100644 --- a/openedx/core/djangoapps/contentserver/test/test_contentserver.py +++ b/openedx/core/djangoapps/contentserver/test/test_contentserver.py @@ -246,7 +246,6 @@ def test_range_request_multiple_ranges(self): """ first_byte = self.length_unlocked / 4 last_byte = self.length_unlocked / 2 - # lint-amnesty, pylint: disable=bad-option-value, unicode-format-string resp = self.client.get(self.url_unlocked, HTTP_RANGE='bytes={first}-{last}, -100'.format( first=first_byte, last=last_byte)) diff --git a/openedx/core/djangoapps/contentserver/views.py b/openedx/core/djangoapps/contentserver/views.py index 49bb0897d9b9..3a267f085222 100644 --- a/openedx/core/djangoapps/contentserver/views.py +++ b/openedx/core/djangoapps/contentserver/views.py @@ -66,7 +66,7 @@ def process_request(request): """Process the given request""" asset_path = request.path - if is_asset_request(request): # lint-amnesty, pylint: disable=too-many-nested-blocks + if is_asset_request(request): # Make sure we can convert this request into a location. if AssetLocator.CANONICAL_NAMESPACE in asset_path: asset_path = asset_path.replace('block/', 'block@', 1) @@ -294,10 +294,7 @@ def load_asset_from_location(location): content = get_cached_content(location) if content is None: # Not in cache, so just try and load it from the asset manager. - try: - content = AssetManager.find(location, as_stream=True) - except (ItemNotFoundError, NotFoundError): # lint-amnesty, pylint: disable=try-except-raise - raise + content = AssetManager.find(location, as_stream=True) # Now that we fetched it, let's go ahead and try to cache it. We cap this at 1MB # because it's the default for memcached and also we don't want to do too much