Skip to content

Commit

Permalink
Update dir_path to str | PathLike[str]
Browse files Browse the repository at this point in the history
  • Loading branch information
SeoulSKY committed Jul 7, 2024
1 parent ea89863 commit c1422cb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
4 changes: 1 addition & 3 deletions examples/history.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
You can also extend the abstract class VideoHistory to create your own custom video history storage.
"""

from pathlib import Path

from pyngrok import ngrok

from ytnoti import YouTubeNotifier, Video
Expand All @@ -22,7 +20,7 @@ def main():
ngrok.set_auth_token("Your ngrok token here")

# This will create a new folder called "videoHistory" in the current directory
video_history = FileVideoHistory(dir_path=Path("./videoHistory"))
video_history = FileVideoHistory(dir_path="./videoHistory")

notifier = YouTubeNotifier(video_history=video_history)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

setup(
name="ytnoti",
version="1.1.0",
version="1.1.1",
packages=find_packages(),
author="SeoulSKY",
author_email="[email protected]",
Expand Down
5 changes: 3 additions & 2 deletions ytnoti/models/history.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import logging
from abc import ABC, abstractmethod
from collections import OrderedDict
from os import PathLike
from pathlib import Path
from threading import Lock

Expand Down Expand Up @@ -92,7 +93,7 @@ class FileVideoHistory(VideoHistory):
Represents a file-based history of videos.
"""

def __init__(self, *, dir_path: Path, num_videos: int = 100) -> None:
def __init__(self, *, dir_path: str | PathLike[str], num_videos: int = 100) -> None:
"""
Create a new FileVideoHistory instance.
Expand All @@ -102,7 +103,7 @@ def __init__(self, *, dir_path: Path, num_videos: int = 100) -> None:
"""

self._logger = logging.getLogger(self.__class__.__name__)
self._dir_path = dir_path
self._dir_path = Path(dir_path)
self._num_videos = num_videos
self._lock = Lock()

Expand Down

0 comments on commit c1422cb

Please sign in to comment.