예제 #1
0
def gather_command_line_options(filter_disabled=None):
    """Get a sorted list of all CommandLineOption subclasses."""
    if filter_disabled is None:
        filter_disabled = not SETTINGS.COMMAND_LINE.SHOW_DISABLED_OPTIONS
    options = [opt for opt in get_inheritors(CommandLineOption)
               if not filter_disabled or opt._enabled]
    return sorted(options, key=lambda opt: opt.__name__)
예제 #2
0
def gather_command_line_options(filter_disabled=None):
    """Get a sorted list of all CommandLineOption subclasses."""
    if filter_disabled is None:
        filter_disabled = not SETTINGS.COMMAND_LINE.SHOW_DISABLED_OPTIONS
    options = [opt for opt in get_inheritors(CommandLineOption)
               if not filter_disabled or opt._enabled]
    return sorted(options, key=lambda opt: opt.__name__)
예제 #3
0
파일: test_utils.py 프로젝트: talpay/sacred
def test_get_inheritors():
    class A(object):
        pass

    class B(A):
        pass

    class C(B):
        pass

    class D(A):
        pass

    class E(object):
        pass

    assert get_inheritors(A) == {B, C, D}
예제 #4
0
def test_get_inheritors():
    class A:
        pass

    class B(A):
        pass

    class C(B):
        pass

    class D(A):
        pass

    class E:
        pass

    assert get_inheritors(A) == {B, C, D}
예제 #5
0
파일: experiment.py 프로젝트: J3rome/sacred
def gather_command_line_options(filter_disabled=None):
    """Get a sorted list of all CommandLineOption subclasses."""
    if filter_disabled is None:
        filter_disabled = not SETTINGS.COMMAND_LINE.SHOW_DISABLED_OPTIONS

    options = []
    for opt in get_inheritors(commandline_options.CommandLineOption):
        warnings.warn(
            "Subclassing `CommandLineOption` is deprecated. Please "
            "use the `sacred.cli_option` decorator and pass the function "
            "to the Experiment constructor.")
        if filter_disabled and not opt._enabled:
            continue
        options.append(opt)

    options += DEFAULT_COMMAND_LINE_OPTIONS

    return sorted(options, key=commandline_options.get_name)
예제 #6
0
def gather_command_line_options():
    """Get a sorted list of all CommandLineOption subclasses."""
    return sorted(get_inheritors(CommandLineOption), key=lambda x: x.__name__)