Skip to content

Commit

Permalink
update get_relative_path with Pathlib
Browse files Browse the repository at this point in the history
Signed-off-by: Asish Kumar <[email protected]>
  • Loading branch information
officialasishkumar committed Aug 9, 2024
1 parent c905e03 commit 1488fdb
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions benchmarks/benchmark_base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import functools
from copy import deepcopy
from os.path import dirname, join, realpath
from pathlib import Path

import numpy as np
Expand All @@ -27,14 +26,13 @@ class BenchmarkBase:
timeout = 600

@staticmethod
def get_relative_path(partial_path: str):
path = dirname(realpath(__file__))
targets = Path(partial_path).parts
def get_relative_path(partial_path: str) -> str:
path = Path(__file__).resolve().parent

for target in targets:
path = join(path, target)
for target in Path(partial_path).parts:
path = path / target

return path
return str(path)

def get_absolute_path(self, partial_path):
partial_path = "../" + partial_path
Expand Down

0 comments on commit 1488fdb

Please sign in to comment.