mirror of
https://github.com/open-thought/reasoning-gym.git
synced 2026-04-19 12:58:07 +00:00
refactor: Replace deprecated open_text() with files() API
This commit is contained in:
parent
102d4dae00
commit
c05a938ab7
1 changed files with 2 additions and 4 deletions
|
|
@ -18,8 +18,7 @@ def get_data_file_path(filename: str) -> Path:
|
|||
>>> with open(path) as f:
|
||||
... content = f.read()
|
||||
"""
|
||||
with resources.path('reasoning_gym.data', filename) as data_path:
|
||||
return data_path
|
||||
return resources.files('reasoning_gym.data').joinpath(filename)
|
||||
|
||||
def read_data_file(filename: str) -> str:
|
||||
"""Read the contents of a data file in the package.
|
||||
|
|
@ -33,7 +32,6 @@ def read_data_file(filename: str) -> str:
|
|||
Example:
|
||||
>>> content = read_data_file("pg19362.txt")
|
||||
"""
|
||||
with resources.open_text('reasoning_gym.data', filename) as f:
|
||||
return f.read()
|
||||
return resources.files('reasoning_gym.data').joinpath(filename).read_text()
|
||||
|
||||
__all__ = ['get_data_file_path', 'read_data_file']
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue