本文整理汇总了Python中pyinotify.Notifier.rm_watch方法的典型用法代码示例。如果您正苦于以下问题:Python Notifier.rm_watch方法的具体用法?Python Notifier.rm_watch怎么用?Python Notifier.rm_watch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyinotify.Notifier
的用法示例。
在下文中一共展示了Notifier.rm_watch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: WatchManager
# 需要导入模块: from pyinotify import Notifier [as 别名]
# 或者: from pyinotify.Notifier import rm_watch [as 别名]
class WatchManager(watchdir):
path = os.path.abspath(watchdir) #path = list() ##(str or list of str): ## Path(s) to watch, the path can either be a file or a directory.
add_watch(path, mask, proc_fun=None, rec=False, auto_add=False) = dict() #=> dict
mask(int) = int(mask) #Bitmask of events.
proc_func(ProcessEvent) = proc_func ### Processing object (must be callable). Will be called if provided, otherwise, notifier.default_proc_funcwill be called.
rec(bool) = bool(rec) ###### Recursively add watches on the given path and on all its subdirectories.
auto_add(bool) = bool(auto_add) # Automatically add watches on newly created directories in the watch's path.
update_watch(wd, mask=None, proc_func=None, rec=False, auto_add=False) = update_watch #=> dict
#Update existing watch(s). All these parameters are updatable.
rm_watch(wd, rec=False) = dict() #=> dict #Remove watch(s).
get_wd(path) #=> int #Return the watch descriptor associated to path.
get_path(wd) #=> str #Return the path associated to wd, if wd is invalid, None is returned.
return os.path.abspath(wd)
ra = notifier.add_watch('/a-dir', mask)
if ra['/a-dir'] > 0: print "added"
#update_watch wd (or list of wds) {wd1: success, wd2: success, ...}
#Where success is True if the op on wdx succeeded, False otherwise.
ru = notifier.update_watch(ra['/a-dir'], new_mask)
if ru['/a-dir']: print "updated"
#rm_watch wd (or list of wds) {wd1: success, wd2: success, ...}
#Where success is True if the op on wdx succeeded, False otherwise.
rr = notifier.rm_watch(ra['/a-dir'])
if rr['/a-dir']: print "deleted"