-
Notifications
You must be signed in to change notification settings - Fork 72
Add ignored_dirs param to InotifyTree(s) #30
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
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.