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

[docs] Add typing info to quick start #1082

Merged
merged 4 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ Adrian Tejn Kern <[email protected]>
Andrew Schaaf <[email protected]>
Danilo de Jesus da Silva Bellini <[email protected]>
David LaPalomento <[email protected]>
dvogel <[email protected]>
Filip Noetzel <[email protected]>
Gary van der Merwe <[email protected]>
gfxmonk <[email protected]>
Gora Khargosh <[email protected]>
Hannu Valtonen <[email protected]>
Jesse Printz <[email protected]>
Expand All @@ -25,6 +27,7 @@ Malthe Borch <[email protected]>
Martin Kreichgauer <[email protected]>
Martin Kreichgauer <[email protected]>
Mike Lundy <[email protected]>
Nicholas Hairs <[email protected]>
Raymond Hettinger <[email protected]>
Roman Ovchinnikov <[email protected]>
Rotem Yaari <[email protected]>
Expand All @@ -43,9 +46,6 @@ Todd Whiteman <[email protected]>
Will McGugan <[email protected]>
Yesudeep Mangalapilly <[email protected]>
Yesudeep Mangalapilly <[email protected]>
dvogel <[email protected]>
gfxmonk <[email protected]>


We would like to thank these individuals for ideas:
---------------------------------------------------
Expand Down
19 changes: 19 additions & 0 deletions docs/source/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,22 @@ file system changes and simply print them to the console::
observer.join()

To stop the program, press Control-C.

Typing
------
If you are using type annotations it is important to note that
`watchdog.observers.Observer` is not actually a class; it is a variable that
hold the "best" observer class available on your platform.

In order to correctly type your own code your should use
`watchdog.observers.api.BaseObserver`. For example:

from watchdog.observers import Observer
BoboTiG marked this conversation as resolved.
Show resolved Hide resolved
from watchdog.observers.api import BaseObserver

def my_func(o: BaseObserver) -> None:
# Do something with o
return
BoboTiG marked this conversation as resolved.
Show resolved Hide resolved

observer: BaseObserver = Observer()
my_func(observer)