
"""simple docstring"""







import operator
def    __lowerCAmelCase    (_UpperCamelCase	,  _UpperCamelCase = False	,  _UpperCamelCase = None		):
	__lowerCAmelCase      :						Tuple						      =				operator.lt if reverse else operator.gt
	__lowerCAmelCase      :						Any						      =				solution or []

	if not arr:
		return solution

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

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

	strand_sort(a__	,  a__	,  a__		)
	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]

"""simple docstring"""







lowerCamelCase__        =		"""0.21.0"""

from .accelerator import Accelerator
from .big_modeling import (
    cpu_offload,
    cpu_offload_with_hook,
    disk_offload,
    dispatch_model,
    init_empty_weights,
    init_on_device,
    load_checkpoint_and_dispatch,
)
from .data_loader import skip_first_batches
from .launchers import debug_launcher, notebook_launcher
from .state import PartialState
from .utils import (
    DeepSpeedPlugin,
    DistributedDataParallelKwargs,
    DistributedType,
    FullyShardedDataParallelPlugin,
    GradScalerKwargs,
    InitProcessGroupKwargs,
    find_executable_batch_size,
    infer_auto_device_map,
    is_rich_available,
    load_checkpoint_in_model,
    synchronize_rng_states,
)


if is_rich_available():
							from .utils import rich