


import logging
import os

from .state import PartialState

class 						__a (							logging.LoggerAdapter     ):
		@staticmethod
		def       UpperCAmelCase__							(     _SCREAMING_SNAKE_CASE		)					->			int:




									"""simple docstring"""





									_UpperCAmelCase											=     PartialState()
									return not main_process_only or (main_process_only and state.is_main_process)






		def       UpperCAmelCase__							(     self     ,       _SCREAMING_SNAKE_CASE     ,       _SCREAMING_SNAKE_CASE     ,       *_SCREAMING_SNAKE_CASE     ,       **_SCREAMING_SNAKE_CASE		)					->			Tuple:




									"""simple docstring"""





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

									if self.isEnabledFor(__snake_case		):
																if self._should_log(__snake_case		):
																							_UpperCAmelCase						,			_UpperCAmelCase											=     self.process(__snake_case     ,       __snake_case		)
																							self.logger.log(__snake_case     ,       __snake_case     ,       *__snake_case     ,       **__snake_case		)

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



def 			lowerCAmelCase__					(     a__:						Union[str, Any]     ,    a__:						List[Any] = None			)    ->						Optional[Any]:


							'''simple docstring'''





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







'''simple docstring'''






def   UpperCamelCase__ (						lowerCAmelCase    ):





      """simple docstring"""


      if divisor % 5 == 0 or divisor % 2 == 0:
            return 0
      _lowerCAmelCase					=				1
      _lowerCAmelCase					=				1
      while repunit:
            _lowerCAmelCase					=				(10 * repunit + 1) % divisor
            repunit_index += 1
      return repunit_index
def   UpperCamelCase__ (						lowerCAmelCase = 1_00_00_00    ):





      """simple docstring"""


      _lowerCAmelCase					=				limit - 1
      if divisor % 2 == 0:
            divisor += 1
      while least_divisible_repunit(lowerCAmelCase    ) <= limit:
            divisor += 2
      return divisor


if __name__ == "__main__":
      print(F"""{solution() = }""")






