Skip to content

Commit

Permalink
chore: replaces the deprecated pkg_resources with importlib
Browse files Browse the repository at this point in the history
  • Loading branch information
beingfaisal committed Sep 20, 2024
1 parent ccb38ea commit b553101
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions crowdsourcehinter/crowdsourcehinter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@
import logging
import random

import pkg_resources
import six.moves.html_parser
import six.moves.urllib.error
import six.moves.urllib.parse
import six.moves.urllib.request
from web_fragments.fragment import Fragment
from xblock.core import XBlock
from xblock.fields import Scope, Dict, List, String
try:
from xblock.utils.resources import ResourceLoader
except ModuleNotFoundError: # For backward compatibility with releases older than Quince.
from xblockutils.resources import ResourceLoader

resource_loader = ResourceLoader(__name__)
log = logging.getLogger(__name__)
html_parser = six.moves.html_parser.HTMLParser()

Expand Down Expand Up @@ -442,8 +446,7 @@ def resource_string(self, path):
"""
This function is used to get the path of static resources.
"""
data = pkg_resources.resource_string(__name__, path)
return data.decode("utf8")
return resource_loader.load_unicode(path)

def get_user_is_staff(self):
"""
Expand Down

0 comments on commit b553101

Please sign in to comment.