
import logging
import os

from .state import PartialState



class    a_ (			logging.LoggerAdapter    ):






			@staticmethod
			def    UpperCamelCase_				(      __UpperCamelCase  ):
									_lowercase					       =					PartialState()
									return not main_process_only or (main_process_only and state.is_main_process)






			def    UpperCamelCase_				(      self				,			__UpperCamelCase				,			__UpperCamelCase				,			*__UpperCamelCase				,			**__UpperCamelCase  ):




									if PartialState._shared_state == {}:
															raise RuntimeError(
															    """You must initialize the accelerate state by calling either `PartialState()` or `Accelerator()` before using the logging utility."""  )
									_lowercase					       =					kwargs.pop("""main_process_only"""				,			lowerCAmelCase__  )
									_lowercase					       =					kwargs.pop("""in_order"""				,			lowerCAmelCase__  )

									if self.isEnabledFor(lowerCAmelCase__  ):
															if self._should_log(lowerCAmelCase__  ):
																					_lowercase       ,						_lowercase					       =					self.process(lowerCAmelCase__				,			lowerCAmelCase__  )
																					self.logger.log(lowerCAmelCase__				,			lowerCAmelCase__				,			*lowerCAmelCase__				,			**lowerCAmelCase__  )

															elif in_order:
																					_lowercase					       =					PartialState()
																					for i in range(state.num_processes  ):
																											if i == state.process_index:
																																	_lowercase       ,						_lowercase					       =					self.process(lowerCAmelCase__				,			lowerCAmelCase__  )
																																	self.logger.log(lowerCAmelCase__				,			lowerCAmelCase__				,			*lowerCAmelCase__				,			**lowerCAmelCase__  )
																											state.wait_for_everyone()







def 	UpperCamelCase__  (     SCREAMING_SNAKE_CASE_	:	str		,   SCREAMING_SNAKE_CASE_	:	str = None       )  ->     int:

						if log_level is None:
												_lowercase					       =					os.environ.get("""ACCELERATE_LOG_LEVEL"""		,   SCREAMING_SNAKE_CASE_       )
						_lowercase					       =					logging.getLogger(SCREAMING_SNAKE_CASE_       )
						if log_level is not None:
												logger.setLevel(log_level.upper()       )
												logger.root.setLevel(log_level.upper()       )
						return MultiProcessAdapter(SCREAMING_SNAKE_CASE_		,   {}       )






'''simple docstring'''

from __future__ import annotations







def    a__							(							lowercase   :	list,   lowercase   :	int )						->						List[Any]:





     """simple docstring"""

     if len(lowercase ) <= 1 or n <= 1:
          return

     insert_next(lowercase,   n - 1 )
     rec_insertion_sort(lowercase,   n - 1 )







def    a__							(							lowercase   :	list,   lowercase   :	int )						->						Optional[Any]:





     """simple docstring"""

     if index >= len(lowercase ) or collection[index - 1] <= collection[index]:
          return

     # Swaps adjacent elements since they are not in ascending order
     _UpperCamelCase       ,							_UpperCamelCase							       =			(
         collection[index],
         collection[index - 1],
     )

     insert_next(lowercase,   index + 1 )


if __name__ == "__main__":
   lowercase__		:     str			=							input('Enter integers separated by spaces: ')
   lowercase__		:     list[int]			=							[int(num) for num in numbers.split()]
   rec_insertion_sort(number_list, len(number_list))
   print(number_list)



