Skip to content

fabric.main.is_task_module should use isinstance #718

@kmike

Description

@kmike

fabric.main.is_task_module is currently defined like this:

def is_task_module(a):
    """
    Determine if the provided value is a task module
    """
    #return (type(a) is types.ModuleType and
    #        any(map(is_task_object, vars(a).values())))
    if type(a) is types.ModuleType and a not in _seen:
        # Flag module as seen
        _seen.add(a)
        # Signal that we need to check it out
        return True

What's the purpose of type(a) is types.ModuleType? It would be great if isinstance(a, types.ModuleType) is sufficient.

I was trying to use types.ModuleType subclass and fabric fails to discover tasks in this case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions