ionelmc / python-hunter

Hunter is a flexible code tracing toolkit.
https://python-hunter.readthedocs.io/
BSD 2-Clause "Simplified" License
796 stars 46 forks source link

exclude and include at the same time #39

Closed ctrngk closed 6 years ago

ctrngk commented 6 years ago

for example, I want to include scrapy framework, which works very well, but not able to exclude scrapy/cmdline.py at the same time.

PYTHONHUNTER='~Q(module_in=["cmdline"]), Q(module_startswith=["scrapy"])' scrapy list
ctrngk commented 6 years ago

The above bash command still print unnecessary lines /site-packages/scrapy/cmdline.py: ...

ctrngk commented 6 years ago

I am an idiot.

PYTHONHUNTER='~Q(module="scrapy.cmdline"), Q(module_startswith=["scrapy"])' scrapy list

Problem solved.

ionelmc commented 6 years ago

You could also do this to find the right expression, without having to trace stuff:

>>> Q(module_has='qwe')({'module': 'asdf.qwe'})
True

Anyway, feel free to make documentation improvements requests (or even PR) - I am pretty much clueless as to what new users need, having everything in my head already ...