
"""simple docstring"""


import logging
import os
import sys
import threading
from logging import (
    CRITICAL,  # NOQA
    DEBUG,  # NOQA
    ERROR,  # NOQA
    FATAL,  # NOQA
    INFO,  # NOQA
    NOTSET,  # NOQA
    WARN,  # NOQA
    WARNING,  # NOQA
)
from typing import Optional

from tqdm import auto as tqdm_lib


lowerCAmelCase			=		threading.Lock()
lowerCAmelCase			=		None

lowerCAmelCase			=		{
    "debug": logging.DEBUG,
    "info": logging.INFO,
    "warning": logging.WARNING,
    "error": logging.ERROR,
    "critical": logging.CRITICAL,
}

lowerCAmelCase			=		logging.WARNING

lowerCAmelCase			=		True






def      lowerCAmelCase_     (	)     ->int:
			lowerCamelCase__			:  Any  =os.getenv('DIFFUSERS_VERBOSITY'							,					UpperCamelCase_    )
			if env_level_str:
						if env_level_str in log_levels:
									return log_levels[env_level_str]
						else:
									logging.getLogger().warning(
									    f"""Unknown option DIFFUSERS_VERBOSITY={env_level_str}, """
									    f"""has to be one of: { ', '.join(log_levels.keys()    ) }"""    )
			return _default_log_level






def      lowerCAmelCase_     (	)     ->int:
			return __name__.split('.'    )[0]






def      lowerCAmelCase_     (	)     ->Union[str, Any]:
			return logging.getLogger(_get_library_name()    )






def      lowerCAmelCase_     (	)     ->Optional[Any]:
			global _default_handler

			with _lock:
						if _default_handler:
									# This library has already configured the library root logger.
									return
						lowerCamelCase__			:  Dict  =logging.StreamHandler()  # Set sys.stderr as stream.
						lowerCamelCase__			:  List[str]  =sys.stderr.flush

						# Apply our default configuration to the library root logger.
						lowerCamelCase__			:  Optional[int]  =_get_library_root_logger()
						library_root_logger.addHandler(_default_handler    )
						library_root_logger.setLevel(_get_default_logging_level()    )
						lowerCamelCase__			:  Dict  =False






def      lowerCAmelCase_     (	)     ->Optional[Any]:
			global _default_handler

			with _lock:
						if not _default_handler:
									return

						lowerCamelCase__			:  str  =_get_library_root_logger()
						library_root_logger.removeHandler(_default_handler    )
						library_root_logger.setLevel(logging.NOTSET    )
						lowerCamelCase__			:  Dict  =None






def      lowerCAmelCase_     (	)     ->Dict:
			return log_levels






def      lowerCAmelCase_     (	snake_case_	:    Dict = None    )     ->List[str]:






			if name is None:
						lowerCamelCase__			:  Dict  =_get_library_name()

			_configure_library_root_logger()
			return logging.getLogger(UpperCamelCase_    )






def      lowerCAmelCase_     (	)     ->Optional[Any]:
			_configure_library_root_logger()
			return _get_library_root_logger().getEffectiveLevel()






def      lowerCAmelCase_     (	snake_case_	:    Optional[int]    )     ->List[Any]:
			_configure_library_root_logger()
			_get_library_root_logger().setLevel(UpperCamelCase_    )






def      lowerCAmelCase_     (	)     ->str:
			return set_verbosity(UpperCamelCase_    )






def      lowerCAmelCase_     (	)     ->Tuple:
			return set_verbosity(UpperCamelCase_    )






def      lowerCAmelCase_     (	)     ->str:
			return set_verbosity(UpperCamelCase_    )






def      lowerCAmelCase_     (	)     ->Tuple:
			return set_verbosity(UpperCamelCase_    )






def      lowerCAmelCase_     (	)     ->Dict:
			_configure_library_root_logger()

			assert _default_handler is not None
			_get_library_root_logger().removeHandler(_default_handler    )






def      lowerCAmelCase_     (	)     ->Union[str, Any]:
			_configure_library_root_logger()

			assert _default_handler is not None
			_get_library_root_logger().addHandler(_default_handler    )






def      lowerCAmelCase_     (	snake_case_	:    List[str]    )     ->str:
			_configure_library_root_logger()

			assert handler is not None
			_get_library_root_logger().addHandler(UpperCamelCase_    )






def      lowerCAmelCase_     (	snake_case_	:    Tuple    )     ->Any:
			_configure_library_root_logger()

			assert handler is not None and handler not in _get_library_root_logger().handlers
			_get_library_root_logger().removeHandler(UpperCamelCase_    )






def      lowerCAmelCase_     (	)     ->List[str]:
			_configure_library_root_logger()
			lowerCamelCase__			:  Tuple  =False






def      lowerCAmelCase_     (	)     ->Dict:
			_configure_library_root_logger()
			lowerCamelCase__			:  Tuple  =True






def      lowerCAmelCase_     (	)     ->Dict:
			lowerCamelCase__			:  Optional[int]  =_get_library_root_logger().handlers

			for handler in handlers:
						lowerCamelCase__			:  List[Any]  =logging.Formatter('[%(levelname)s|%(filename)s:%(lineno)s] %(asctime)s >> %(message)s'    )
						handler.setFormatter(UpperCamelCase_    )






def      lowerCAmelCase_     (	)     ->Union[str, Any]:
			lowerCamelCase__			:  Optional[Any]  =_get_library_root_logger().handlers

			for handler in handlers:
						handler.setFormatter(UpperCamelCase_    )






def      lowerCAmelCase_     (	self	:    Dict							,					*snake_case_	:    List[str]							,					**snake_case_	:    Optional[Any]    )     ->List[str]:
			lowerCamelCase__			:  List[Any]  =os.getenv('DIFFUSERS_NO_ADVISORY_WARNINGS'							,					UpperCamelCase_    )
			if no_advisory_warnings:
						return
			self.warning(*UpperCamelCase_							,					**UpperCamelCase_    )


lowerCAmelCase			=		warning_advice

class 					A_			:



							"""simple docstring"""






							def __init__(						self						:List[Any]  ,							*lowerCamelCase_						:Any  ,							**lowerCamelCase_						:Optional[int] ):  # pylint: disable=unused-argument





										"""simple docstring"""

										lowerCamelCase__			:  Any  =args[0] if args else None





							def __iter__(						self						:Tuple ):





										"""simple docstring"""

										return iter(self._iterator )





							def __getattr__(						self						:Dict  ,							lowerCamelCase_						:str ):





										"""simple docstring"""

										def empty_fn(*lowerCamelCase_						:Optional[int]  ,							**lowerCamelCase_						:str ):  # pylint: disable=unused-argument
													return

										return empty_fn





							def __enter__(						self						:str ):





										"""simple docstring"""

										return self





							def __exit__(						self						:List[str]  ,							lowerCamelCase_						:Optional[Any]  ,							lowerCamelCase_						:Dict  ,							lowerCamelCase_						:Union[str, Any] ):





										"""simple docstring"""

										return






class 					A_			:



							"""simple docstring"""






							def __call__(						self						:int  ,							*lowerCamelCase_						:Dict  ,							**lowerCamelCase_						:int ):





										"""simple docstring"""

										if _tqdm_active:
													return tqdm_lib.tqdm(*__snake_case  ,							**__snake_case )
										else:
													return EmptyTqdm(*__snake_case  ,							**__snake_case )





							def    UpperCAmelCase__							(						self						:str  ,							*lowerCamelCase_						:Tuple  ,							**lowerCamelCase_						:Tuple ):





										"""simple docstring"""

										lowerCamelCase__			:  str  =None
										if _tqdm_active:
													return tqdm_lib.tqdm.set_lock(*__snake_case  ,							**__snake_case )





							def    UpperCAmelCase__							(						self						:Optional[Any] ):





										"""simple docstring"""

										if _tqdm_active:
													return tqdm_lib.tqdm.get_lock()






lowerCAmelCase			=		_tqdm_cls()






def      lowerCAmelCase_     (	)     ->Union[str, Any]:
			global _tqdm_active
			return bool(_tqdm_active    )






def      lowerCAmelCase_     (	)     ->List[Any]:
			global _tqdm_active
			lowerCamelCase__			:  str  =True






def      lowerCAmelCase_     (	)     ->Optional[int]:
			global _tqdm_active
			lowerCamelCase__			:  List[str]  =False








"""simple docstring"""


# A Bipartite Graph is a graph whose vertices can be divided into two independent sets,
# U and V such that every edge (u, v) either connects a vertex from U to V or a vertex
# from V to U. In other words, for every edge (u, v), either u belongs to U and v to V,
# or u belongs to V and v to U. We can also say that there is no edge that connects
# vertices of same set.
from queue import Queue






def      lowerCAmelCase_     (	snake_case_	:    List[Any]    )     ->Optional[int]:
			lowerCamelCase__			:  Optional[int]  =Queue()
			lowerCamelCase__			:  Any  =[False] * len(snake_case_    )
			lowerCamelCase__			:  Optional[Any]  =[-1] * len(snake_case_    )

			def bfs():
						while not queue.empty():
									lowerCamelCase__			:  List[Any]  =queue.get()
									lowerCamelCase__			:  int  =True

									for neighbour in graph[u]:
												if neighbour == u:
															return False

												if color[neighbour] == -1:
															lowerCamelCase__			:  Union[str, Any]  =1 - color[u]
															queue.put(snake_case_    )

												elif color[neighbour] == color[u]:
															return False

						return True

			for i in range(len(snake_case_    )    ):
						if not visited[i]:
									queue.put(snake_case_    )
									lowerCamelCase__			:  Tuple  =0
									if bfs() is False:
												return False

			return True


if __name__ == "__main__":
							# Adjacency List of graph
							print(check_bipartite({0: [1, 3], 1: [0, 2], 2: [1, 3], 3: [0, 2]}))