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

Small change to hide "private task" imported from another collection #623

Open
FabriceSalvaire opened this issue Mar 2, 2019 · 1 comment

Comments

@FabriceSalvaire
Copy link

Use case (Maybe I missed something ...)

# doc.py
from .clean import flycheck as _clean_flycheck

@task(_clean_flycheck, clean_api)
def make_api(ctx):
    ....

So as to don't register doc.flycheck which are available as clean.flycheck

I propose this change in collection.py Collection.from_module

# tasks = filter(lambda x: isinstance(x, Task), vars(module).values())
tasks = [obj for name, obj in vars(module).items() if isinstance(obj, Task) and not name.startswith('_')]
@haydenflinner
Copy link
Contributor

I just merged this into my fork, you can try it out by doing pip install magicinvoke and (hopefully) without changing any of your code.

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

No branches or pull requests

2 participants