Skip to content

Commit

Permalink
fix: test with only reverting finder changes
Browse files Browse the repository at this point in the history
  • Loading branch information
irtazaakram committed Feb 4, 2025
1 parent c84af05 commit ec281fe
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions openedx/core/lib/xblock_pipeline/finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from django.contrib.staticfiles.storage import FileSystemStorage
from django.core.files.storage import Storage
from django.utils import timezone
from importlib.resources import files
from pkg_resources import resource_exists, resource_filename, resource_isdir, resource_listdir
from xblock.core import XBlock

from openedx.core.lib.xblock_utils import xblock_resource_pkg
Expand Down Expand Up @@ -38,7 +38,7 @@ def path(self, name):
"""
Returns a file system filename for the specified file name.
"""
return str(files(self.module).joinpath(self.base_dir, name))
return resource_filename(self.module, os.path.join(self.base_dir, name))

def exists(self, path): # lint-amnesty, pylint: disable=arguments-differ
"""
Expand All @@ -47,22 +47,22 @@ def exists(self, path): # lint-amnesty, pylint: disable=arguments-differ
if self.base_dir is None:
return False

return os.path.exists(os.path.join(self.base_dir, path))
return resource_exists(self.module, os.path.join(self.base_dir, path))

def listdir(self, path):
"""
Lists the directories beneath the specified path.
"""
directories = []
files_p = []
for item in files(self.module).joinpath(self.base_dir, path).iterdir():
files = []
for item in resource_listdir(self.module, os.path.join(self.base_dir, path)):
__, file_extension = os.path.splitext(item)
if file_extension not in [".py", ".pyc", ".scss"]:
if files(self.module).joinpath(self.base_dir, path, item).is_dir():
if resource_isdir(self.module, os.path.join(self.base_dir, path, item)):
directories.append(item)
else:
files_p.append(item)
return directories, files_p
files.append(item)
return directories, files

def open(self, name, mode='rb'):
"""
Expand Down

0 comments on commit ec281fe

Please sign in to comment.