Add ignored_dirs param to InotifyTree(s)#30
Conversation
1f28aec to
01bfa05
Compare
| class InotifyTree(BaseTree): | ||
| def __init__(self, path, mask=inotify.constants.IN_ALL_EVENTS, | ||
| block_duration_s=_DEFAULT_EPOLL_BLOCK_DURATION_S): | ||
| block_duration_s=_DEFAULT_EPOLL_BLOCK_DURATION_S, ignored_dirs=[]): |
There was a problem hiding this comment.
You probably don't want to use a mutable object for the default value of an argument. See here for more information.
There was a problem hiding this comment.
Doesn't matter. We're not changing anything.
|
|
||
| def __init__(self, paths, mask=inotify.constants.IN_ALL_EVENTS, | ||
| block_duration_s=_DEFAULT_EPOLL_BLOCK_DURATION_S): | ||
| block_duration_s=_DEFAULT_EPOLL_BLOCK_DURATION_S, ignored_dirs=[]): |
There was a problem hiding this comment.
Same story as here: https://github.com/dsoprea/PyInotify/pull/30/files#r191511879
|
This is useful. Please fix the conflicts and account for the refactor to |
|
You probably should prefer using an ignore function instead of an ignore list, as |
Elias481
left a comment
There was a problem hiding this comment.
The add_watch called from (_)BaseTree's event_gen should also ignore the configured directories (for consitency).
But anyway, should not be done on outdated base...
| def __init__(self, path, mask=inotify.constants.IN_ALL_EVENTS, | ||
| block_duration_s=_DEFAULT_EPOLL_BLOCK_DURATION_S): | ||
| block_duration_s=_DEFAULT_EPOLL_BLOCK_DURATION_S, ignored_dirs=[]): | ||
| super(InotifyTree, self).__init__(mask=mask, block_duration_s=block_duration_s) |
There was a problem hiding this comment.
You should push ignored_dirs down to (_)BaseTree's init and store it on object from there as it needs to be referenced there (line 216).
| def __init__(self, paths, mask=inotify.constants.IN_ALL_EVENTS, | ||
| block_duration_s=_DEFAULT_EPOLL_BLOCK_DURATION_S): | ||
| block_duration_s=_DEFAULT_EPOLL_BLOCK_DURATION_S, ignored_dirs=[]): | ||
| super(InotifyTrees, self).__init__(mask=mask, block_duration_s=block_duration_s) |
There was a problem hiding this comment.
You should push ignored_dirs down to (_)BaseTree's init and store it on object from there as it needs to be referenced there (line 216).
|
Too much erroneous reengineering. Removed comments, renamed objects, removed properties, and did irrelevant reformatting. It caused a lot of conflicts for what should've been a simple change. Sorry for the delay. |
You should be able to ignore specific directories.