Skip to content

Commit

Permalink
Ensure ObservedWatch.path is a string (fix gorakhargosh#651)
Browse files Browse the repository at this point in the history
  • Loading branch information
rec committed Apr 28, 2020
1 parent 077d5b1 commit 55c6737
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/watchdog/observers/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
from watchdog.utils import BaseThread
from watchdog.utils.compat import queue
from watchdog.utils.bricks import SkipRepeatsQueue
try:
from pathlib import Path as _PATH_CLASSES
except ImportError:
_PATH_CLASSES = ()

DEFAULT_EMITTER_TIMEOUT = 1 # in seconds.
DEFAULT_OBSERVER_TIMEOUT = 1 # in seconds.
Expand All @@ -40,13 +44,16 @@ class ObservedWatch(object):
"""An scheduled watch.
:param path:
Path string.
Path string. # TODO: this comment is not true
:param recursive:
``True`` if watch is recursive; ``False`` otherwise.
"""

def __init__(self, path, recursive):
self._path = path
if isinstance(path, _PATH_CLASSES):
self._path = str(path)
else:
self._path = path
self._is_recursive = recursive

@property
Expand Down

0 comments on commit 55c6737

Please sign in to comment.