Skip to content
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

PatternMatchingEventHandler behavior #412

Open
BoboTiG opened this issue Jul 21, 2017 · 0 comments
Open

PatternMatchingEventHandler behavior #412

BoboTiG opened this issue Jul 21, 2017 · 0 comments

Comments

@BoboTiG
Copy link
Collaborator

BoboTiG commented Jul 21, 2017

I was trying to ignore several patterns using the PatternMatchingEventHandler class. In the dispatch method, we have that behavior:

...
if match_any_paths(paths, **kwargs):
    self.on_any_event(event)
   ...

It means that if I want to ignore .tmp files and if I rename a file from test.txt to test.tmp, then the event handler will still take into account that change. That is because we filter on all paths and if one is not ignored, then it considers the event as a one.

I think, if I understand correctly, the this is not the desired behavior.

On the other hand, if we check the dispatch method of RegexMatchingEventHandler:

...
if any(r.match(p) for r in self.ignore_regexes for p in paths):
    return

if any(r.match(p) for r in self.regexes for p in paths):
    self.on_any_event(event)
   ...

Clearly, here, if one of the paths is ignored, then we stop now. That is the wanted behavior.

So, should I send a PR to fix PatternMatchingEventHandler behavior? Perhaps I misunderstand how to use that class or its purpose, let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant