Skip to content

Commit

Permalink
Revert uses of pathlib.Path to epath.Path
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 552537821
  • Loading branch information
sdenton4 authored and copybara-github committed Jul 31, 2023
1 parent 91c0bb1 commit eccffc5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions chirp/path_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@
General utilities to help with handling paths.
"""
import os
import pathlib

from etils import epath

def get_absolute_path(relative_path: os.PathLike[str] | str) -> pathlib.Path:

def get_absolute_path(relative_path: os.PathLike[str] | str) -> epath.Path:
"""Returns the absolute epath.Path associated with the relative_path.
Args:
Expand All @@ -30,5 +31,5 @@ def get_absolute_path(relative_path: os.PathLike[str] | str) -> pathlib.Path:
Returns:
The absolute path to the resource.
"""
file_path = pathlib.Path(__file__).parent / relative_path
file_path = epath.Path(__file__).parent / relative_path
return file_path
7 changes: 4 additions & 3 deletions chirp/taxonomy/namespace_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@
import dataclasses
import functools
import json
import os
import typing

from chirp import path_utils
from chirp.taxonomy import namespace

import pathlib
TAXONOMY_DATABASE_FILENAME = (
pathlib.Path(__file__).parent / "taxonomy_database.json"
TAXONOMY_DATABASE_FILENAME = os.fspath(
path_utils.get_absolute_path("taxonomy/taxonomy_database.json")
)


Expand Down

0 comments on commit eccffc5

Please sign in to comment.