





"""simple docstring"""



import importlib
import os
import sys


# This is required to make the module import works (when the python process is running from the root of the repo)
sys.path.append(""".""")







def 		__lowercase					(       snake_case_  :  Any						)       ->Any:



    '''simple docstring'''







    __A   :						Optional[int]									=					test_file.split(os.path.sep						)
    if components[0:2] != ["tests", "models"]:
        raise ValueError(
            '''`test_file` should start with `tests/models/` (with `/` being the OS specific path separator). Got '''
            F"""{test_file} instead."""						)
    __A   :						Optional[int]									=					components[-1]
    if not test_fn.endswith('''py'''						):
        raise ValueError(F"""`test_file` should be a python file. Got {test_fn} instead."""						)
    if not test_fn.startswith('''test_modeling_'''						):
        raise ValueError(
            F"""`test_file` should point to a file name of the form `test_modeling_*.py`. Got {test_fn} instead."""						)

    __A   :						Optional[Any]									=					components[:-1] + [test_fn.replace('''.py'''    ,''''''						)]
    __A   :						Tuple									=					'''.'''.join(snake_case_						)

    return test_module_path







def 		__lowercase					(       snake_case_  :  Optional[int]						)       ->str:



    '''simple docstring'''







    __A   :						Optional[int]									=					get_module_path(snake_case_						)
    __A   :						int									=					importlib.import_module(snake_case_						)

    return test_module







def 		__lowercase					(       snake_case_  :  str						)       ->List[Any]:



    '''simple docstring'''







    __A   :						Dict									=					[]
    __A   :						Any									=					get_test_module(snake_case_						)
    for attr in dir(snake_case_						):
        if attr.endswith('''ModelTester'''						):
            tester_classes.append(getattr(snake_case_    ,snake_case_						)						)

    # sort with class names
    return sorted(snake_case_    ,key=lambda snake_case_						: x.__name__						)







def 		__lowercase					(       snake_case_  :  int						)       ->str:



    '''simple docstring'''







    __A   :						Any									=					[]
    __A   :						Optional[int]									=					get_test_module(snake_case_						)
    for attr in dir(snake_case_						):
        __A   :						Optional[Any]									=					getattr(snake_case_    ,snake_case_						)
        # (TF/Flax)ModelTesterMixin is also an attribute in specific model test module. Let's exclude them by checking
        # `all_model_classes` is not empty (which also excludes other special classes).
        __A   :						Union[str, Any]									=					getattr(snake_case_    ,'''all_model_classes'''    ,[]						)
        if len(snake_case_						) > 0:
            test_classes.append(snake_case_						)

    # sort with class names
    return sorted(snake_case_    ,key=lambda snake_case_						: x.__name__						)







def 		__lowercase					(       snake_case_  :  List[str]						)       ->Optional[int]:



    '''simple docstring'''







    __A   :						Tuple									=					get_test_classes(snake_case_						)
    __A   :						str									=					set()
    for test_class in test_classes:
        model_classes.update(test_class.all_model_classes						)

    # sort with class names
    return sorted(snake_case_    ,key=lambda snake_case_						: x.__name__						)







def 		__lowercase					(       snake_case_  :  int						)       ->Optional[int]:



    '''simple docstring'''







    __A   :						Union[str, Any]									=					test_class()
    if hasattr(snake_case_    ,'''setUp'''						):
        test.setUp()

    __A   :						List[Any]									=					None
    if hasattr(snake_case_    ,'''model_tester'''						):
        # `(TF/Flax)ModelTesterMixin` has this attribute default to `None`. Let's skip this case.
        if test.model_tester is not None:
            __A   :						Dict									=					test.model_tester.__class__

    return model_tester







def 		__lowercase					(       snake_case_  :  List[Any]    ,snake_case_  :  int						)       ->Any:



    '''simple docstring'''







    __A   :						Tuple									=					get_test_classes(snake_case_						)

    __A   :						List[Any]									=					[]
    for test_class in test_classes:
        if model_class in test_class.all_model_classes:
            target_test_classes.append(snake_case_						)

    # sort with class names
    return sorted(snake_case_    ,key=lambda snake_case_						: x.__name__						)







def 		__lowercase					(       snake_case_  :  Union[str, Any]    ,snake_case_  :  str						)       ->int:



    '''simple docstring'''







    __A   :						Union[str, Any]									=					get_test_classes_for_model(snake_case_    ,snake_case_						)

    __A   :						Tuple									=					[]
    for test_class in test_classes:
        __A   :						Dict									=					get_model_tester_from_test_class(snake_case_						)
        if tester_class is not None:
            tester_classes.append(snake_case_						)

    # sort with class names
    return sorted(snake_case_    ,key=lambda snake_case_						: x.__name__						)







def 		__lowercase					(       snake_case_  :  int						)       ->Optional[Any]:



    '''simple docstring'''







    __A   :						Tuple									=					get_test_classes(snake_case_						)
    __A   :						int									=					{test_class: get_model_tester_from_test_class(snake_case_						) for test_class in test_classes}
    return test_tester_mapping







def 		__lowercase					(       snake_case_  :  str						)       ->Union[str, Any]:



    '''simple docstring'''







    __A   :						int									=					get_model_classes(snake_case_						)
    __A   :						Dict									=					{
        model_class: get_test_classes_for_model(snake_case_    ,snake_case_						) for model_class in model_classes
    }
    return model_test_mapping







def 		__lowercase					(       snake_case_  :  Dict						)       ->List[Any]:



    '''simple docstring'''







    __A   :						List[str]									=					get_model_classes(snake_case_						)
    __A   :						str									=					{
        model_class: get_tester_classes_for_model(snake_case_    ,snake_case_						) for model_class in model_classes
    }
    return model_to_tester_mapping







def 		__lowercase					(       snake_case_  :  str						)       ->Optional[Any]:



    '''simple docstring'''







    if isinstance(snake_case_    ,snake_case_						):
        return o
    elif isinstance(snake_case_    ,snake_case_						):
        return o.__name__
    elif isinstance(snake_case_    ,(list, tuple)						):
        return [to_json(snake_case_						) for x in o]
    elif isinstance(snake_case_    ,snake_case_						):
        return {to_json(snake_case_						): to_json(snake_case_						) for k, v in o.items()}
    else:
        return o










"""simple docstring"""



from math import factorial







def 		__lowercase					(       snake_case_  :  int    ,snake_case_  :  int						)       ->int:



    '''simple docstring'''







    if n < k or k < 0:
        raise ValueError('''Please enter positive integers for n and k where n >= k'''						)
    return factorial(snake_case_						) // (factorial(snake_case_						) * factorial(n - k						))


if __name__ == "__main__":
       print(
           """The number of five-card hands possible from a standard""",
           f'''fifty-two card deck is: {combinations(52, 5)}\n''',
       )

       print(
           """If a class of 40 students must be arranged into groups of""",
           f'''4 for group projects, there are {combinations(40, 4)} ways''',
           """to arrange them.\n""",
       )

       print(
           """If 10 teams are competing in a Formula One race, there""",
           f'''are {combinations(10, 3)} ways that first, second and''',
           """third place can be awarded.""",
       )




