def watch_file(cls, path, func):
"""
A classmethod that registers the given file *path* and *func* in
`ApplicationWebSocket.watched_files` and
`ApplicationWebSocket.file_update_funcs`, respectively. The given
*func* will be called (by `ApplicationWebSocket.file_checker`) whenever
the file at *path* is modified.
"""
logging.debug("watch_file('{path}', {func}())".format(
path=path, func=func.__name__))
cls.watched_files.update({path: os.stat(path).st_mtime})
cls.file_update_funcs.update({path: func})
评论列表
文章目录