Skip to content

Conversation

@Larivact
Copy link

You should be able to ignore specific directories.

@dsoprea dsoprea force-pushed the master branch 7 times, most recently from 1f28aec to 01bfa05 Compare December 1, 2017 17:44
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=[]):
Copy link

@blag blag May 29, 2018

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.

Copy link
Owner

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=[]):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dsoprea
Copy link
Owner

dsoprea commented Jul 7, 2018

This is useful. Please fix the conflicts and account for the refactor to os.walk, and we'll get it merged.

@xaf
Copy link
Contributor

xaf commented Jul 29, 2018

You probably should prefer using an ignore function instead of an ignore list, as shutil.copytree does.

@Larivact
Copy link
Author

@dsoprea What "refactor to os.walk"? Do you mean #48? How am I supposed to account for an unfinished pull request?

Copy link

@Elias481 Elias481 left a 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)

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)

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).

@dsoprea
Copy link
Owner

dsoprea commented Jul 7, 2025

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.

@dsoprea dsoprea closed this Jul 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants