Skip to content

Commit 82f46e5

Browse files
Liam-DeVoeBoboTiG
authored andcommitted
chore: adjust Observer.schedule() path type annotation to reflect the pathlib.Path support (#1096)
Co-authored-by: Mickaël Schoentgen <[email protected]>
1 parent 5c6b7fa commit 82f46e5

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

changelog.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ Changelog
88

99
202x-xx-xx • `full history <https://github.com/gorakhargosh/watchdog/compare/v6.0.0...HEAD>`__
1010

11-
-
12-
- Thanks to our beloved contributors: @BoboTiG, @
11+
- Adjust ``Observer.schedule()`` ``path`` type annotation to reflect the ``pathlib.Path`` support. (`#1096 <https://github.com/gorakhargosh/watchdog/pull/1096>`__)
12+
- Thanks to our beloved contributors: @BoboTiG, @tybug
1313

1414
6.0.0
1515
~~~~~

src/watchdog/observers/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ def start(self) -> None:
283283
def schedule(
284284
self,
285285
event_handler: FileSystemEventHandler,
286-
path: str,
286+
path: str | Path,
287287
*,
288288
recursive: bool = False,
289289
event_filter: list[type[FileSystemEvent]] | None = None,
@@ -301,7 +301,7 @@ def schedule(
301301
:param path:
302302
Directory path that will be monitored.
303303
:type path:
304-
``str``
304+
``str`` or :class:`pathlib.Path`
305305
:param recursive:
306306
``True`` if events will be emitted for sub-directories
307307
traversed recursively; ``False`` otherwise.

src/watchdog/observers/fsevents.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import threading
1313
import time
1414
import unicodedata
15+
from pathlib import Path
1516
from typing import TYPE_CHECKING
1617

1718
import _watchdog_fsevents as _fsevents
@@ -326,7 +327,7 @@ def __init__(self, *, timeout: float = DEFAULT_OBSERVER_TIMEOUT) -> None:
326327
def schedule(
327328
self,
328329
event_handler: FileSystemEventHandler,
329-
path: str,
330+
path: str | Path,
330331
*,
331332
recursive: bool = False,
332333
follow_symlink: bool = False,

0 commit comments

Comments
 (0)