Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: replace os.path with pathlib.Path in helper.py #261

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions pywhat/helper.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""Helper utilities"""
import collections.abc
import os.path
import re
from enum import Enum, auto
from functools import lru_cache
from pathlib import Path

try:
import orjson as json
Expand Down Expand Up @@ -33,7 +33,7 @@ class InvalidTag(Exception):

@lru_cache()
def read_json(path: str):
fullpath = os.path.join(os.path.dirname(os.path.abspath(__file__)), "Data/" + path)
fullpath = Path(__file__).resolve().parent / "Data" / path
with open(fullpath, "rb") as myfile:
return json.loads(myfile.read())

Expand Down