Skip to content

Commit

Permalink
Re-applied migration to importlib_resources
Browse files Browse the repository at this point in the history
  • Loading branch information
sveinbjornt committed Aug 28, 2024
1 parent ae20d6e commit 83bba3d
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/icegrams/ngrams.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,10 @@

# Make sure that the trigrams.bin file is
# unpacked and ready for use
import pkg_resources
import importlib.resources as importlib_resources

# Note: the resource path below should NOT use os.path.join()
BINARY_FILENAME = pkg_resources.resource_filename( # type: ignore
__name__, "resources/trigrams.bin"
)
ref = importlib_resources.files("icegrams").joinpath("resources/trigrams.bin")
BINARY_FILENAME = str(ref)

ffi: Any = cast(Any, ffi) # type: ignore
trie_cffi: Any = cast(Any, trie_cffi) # type: ignore
Expand Down

0 comments on commit 83bba3d

Please sign in to comment.