-
Notifications
You must be signed in to change notification settings - Fork 73
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
Add ignored_dirs param to InotifyTree(s) #30
base: master
Are you sure you want to change the base?
Conversation
1f28aec
to
01bfa05
Compare
@@ -227,53 +227,55 @@ def event_gen(self): | |||
|
|||
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.
|
||
|
||
class InotifyTrees(BaseTree): | ||
|
||
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 |
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...
@@ -227,53 +227,55 @@ def event_gen(self): | |||
|
|||
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=[]): | |||
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).
|
||
|
||
class InotifyTrees(BaseTree): | ||
|
||
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).
You should be able to ignore specific directories.