
"""simple docstring"""
from argparse import ArgumentParser

from .env import EnvironmentCommand

def  lowercase     ():
						__lowerCAmelCase     =  ArgumentParser("""Diffusers CLI tool""" ,    usage="""diffusers-cli <command> [<args>]"""						)
						__lowerCAmelCase     =  parser.add_subparsers(help="""diffusers-cli command helpers"""						)

						# Register commands
						EnvironmentCommand.register_subcommand(_lowerCAmelCase						)

						# Let's go
						__lowerCAmelCase     =  parser.parse_args()

						if not hasattr(_lowerCAmelCase ,    """func"""						):
												parser.print_help()
												exit(1						)

						# Run
						__lowerCAmelCase     =  args.func(_lowerCAmelCase						)
						service.run()


if __name__ == "__main__":
			main()


"""simple docstring"""




import operator



def     __magic_name__		(					UpperCamelCase     :		list							,		UpperCamelCase     :		bool = False							,		UpperCamelCase     :		list | None = None     )     ->						list:
    a__		=			operator.lt if reverse else operator.gt
    a__		=			solution or []

    if not arr:
        return solution

    a__		=			[arr.pop(0     )]
    for i, item in enumerate(UpperCamelCase     ):
        if _operator(UpperCamelCase							,		sublist[-1]     ):
            sublist.append(UpperCamelCase     )
            arr.pop(UpperCamelCase     )

    #  merging sublist into solution list
    if not solution:
        solution.extend(UpperCamelCase     )
    else:
        while sublist:
            a__		=			sublist.pop(0     )
            for i, xx in enumerate(UpperCamelCase     ):
                if not _operator(UpperCamelCase							,		UpperCamelCase     ):
                    solution.insert(UpperCamelCase							,		UpperCamelCase     )
                    break
            else:
                solution.append(UpperCamelCase     )

    strand_sort(UpperCamelCase							,		UpperCamelCase							,		UpperCamelCase     )
    return solution


if __name__ == "__main__":
    assert strand_sort([4, 3, 5, 1, 2]) == [1, 2, 3, 4, 5]
    assert strand_sort([4, 3, 5, 1, 2], reverse=True) == [5, 4, 3, 2, 1]


