Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

251: Replace pkg_resource with importlib #252

Merged
merged 1 commit into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion done/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@

from .done import DoneXBlock

__version__ = '2.3.0'
__version__ = '2.4.0'
6 changes: 3 additions & 3 deletions done/done.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import uuid

import pkg_resources
import importlib.resources
from web_fragments.fragment import Fragment
from xblock.core import XBlock
from xblock.fields import Boolean, DateTime, Float, Scope, String
Expand All @@ -26,8 +26,8 @@ def _(text):

def resource_string(path):
"""Handy helper for getting resources from our kit."""
data = pkg_resources.resource_string(__name__, path)
return data.decode("utf8")
data = importlib.resources.files(__package__).joinpath(path)
return data.read_text(encoding="utf8")


@XBlock.needs('i18n')
Expand Down