Skip to content

Commit

Permalink
refactor s*
Browse files Browse the repository at this point in the history
Summary: The logic of parutil.get_file_path can be replaced with python implementation via importlib. Thus we wont need to support proprietary code: easier to open source, less prone to bugs, less dependencies in buck targets, etc .

Reviewed By: markisaa

Differential Revision: D62052032

fbshipit-source-id: acd6fa2d4b4e0a15b4e5a1635582cf3b335afe7d
  • Loading branch information
annakukliansky authored and facebook-github-bot committed Sep 6, 2024
1 parent 463049d commit 36d56af
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
5 changes: 3 additions & 2 deletions hot3d/data_loaders/tests/test_AriaDataProvider.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import importlib.resources
import os
import unittest
from pathlib import Path
Expand All @@ -23,9 +24,9 @@


try:
from libfb.py import parutil

data_path = Path(parutil.get_file_path("test_data/", pkg=__package__))
data_path = Path(str(importlib.resources.files(__package__).joinpath("test_data/")))

except ImportError:

data_path = Path(__file__).parent
Expand Down
9 changes: 7 additions & 2 deletions hot3d/data_loaders/tests/test_HandBox2dDataProvider.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import importlib.resources
import os
import unittest
from pathlib import Path
Expand All @@ -22,9 +23,13 @@


try:
from libfb.py import parutil

data_path = Path(parutil.get_file_path("test_data/", pkg=__package__))
data_path = Path(
importlib.resources.files(__package__).joinpath(
"test_data/",
)
)

except ImportError:
data_path = Path(__file__).parent

Expand Down
9 changes: 7 additions & 2 deletions hot3d/data_loaders/tests/test_ObjectBox2dDataProvider.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import importlib.resources
import os
import unittest
from pathlib import Path
Expand All @@ -22,9 +23,13 @@


try:
from libfb.py import parutil

data_path = Path(parutil.get_file_path("test_data/", pkg=__package__))
data_path = Path(
importlib.resources.files(__package__).joinpath(
"test_data/",
)
)

except ImportError:
data_path = Path(__file__).parent

Expand Down

0 comments on commit 36d56af

Please sign in to comment.