Skip to content

Commit

Permalink
Replace deprecated pkg_resources.resource_filename with importlib_res…
Browse files Browse the repository at this point in the history
…ources.files
  • Loading branch information
e-pavlica authored and georgkrause committed Feb 27, 2024
1 parent c4a368b commit 84f2b31
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions language_data/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@
Used for locating a file in the data directory.
"""

from pkg_resources import resource_filename
DATA_ROOT = resource_filename('language_data', 'data')
import os

from importlib.resources import files

def data_filename(filename):
"""
Given a relative filename, get the full path to that file in the data
directory.
"""
return os.path.join(DATA_ROOT, filename)
return files('language_data') / 'data' / filename

0 comments on commit 84f2b31

Please sign in to comment.