





import logging
import os

from .state import PartialState







class     __lowerCAmelCase	(   logging.LoggerAdapter):







      @staticmethod
      def        _lowercase  (   lowerCAmelCase__							)       ->						Union[str, Any]:



        '''simple docstring'''




        a__     : str  =PartialState()
        return not main_process_only or (main_process_only and state.is_main_process)







      def        _lowercase  (   self		,				lowerCAmelCase__		,				lowerCAmelCase__		,				*lowerCAmelCase__		,				**lowerCAmelCase__							)       ->						Union[str, Any]:



        '''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."							)
        a__     : Optional[int]  =kwargs.pop("main_process_only"		,				lowerCAmelCase__							)
        a__     : int  =kwargs.pop("in_order"		,				lowerCAmelCase__							)

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

          elif in_order:
            a__     : str  =PartialState()
            for i in range(state.num_processes							):
              if i == state.process_index:
                a__ ,							a__     : str  =self.process(lowerCAmelCase__		,				lowerCAmelCase__							)
                self.logger.log(lowerCAmelCase__		,				lowerCAmelCase__		,				*lowerCAmelCase__		,				**lowerCAmelCase__							)
              state.wait_for_everyone()
def 					_A	(		SCREAMING_SNAKE_CASE					:       str	,	SCREAMING_SNAKE_CASE					:       str = None						):





  """simple docstring"""



  if log_level is None:
    a__     : Optional[Any]  =os.environ.get("ACCELERATE_LOG_LEVEL"	,	SCREAMING_SNAKE_CASE						)
  a__     : List[str]  =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	,	{}						)













from maths.prime_check import is_prime
def 					_A	(		SCREAMING_SNAKE_CASE					:       int						):





  """simple docstring"""



  if not isinstance(SCREAMING_SNAKE_CASE	,	SCREAMING_SNAKE_CASE						):
    a__     : Dict  =f'''Input value of [number={number}] must be an integer'''
    raise TypeError(SCREAMING_SNAKE_CASE						)
  if is_prime(SCREAMING_SNAKE_CASE						) and is_prime(number + 2						):
    return number + 2
  else:
    return -1


if __name__ == "__main__":
     import doctest

     doctest.testmod()






