



"""simple docstring"""






import doctest
import logging
import os
import unittest
from pathlib import Path
from typing import List, Union

import transformers
from transformers.testing_utils import require_tf, require_torch, slow


lowerCAmelCase__              =							logging.getLogger()






@unittest.skip("Temporarily disable the doc tests.")
@require_torch
@require_tf
@slow
class 			__snake_case			(      unittest.TestCase):




  def 		SCREAMING_SNAKE_CASE							(					self	:		Union[str, Any]		,   __lowerCAmelCase	:		Path		,   __lowerCAmelCase	:		Union[str, None] = None		,   __lowerCAmelCase	:		Union[List[str], None] = None		,   __lowerCAmelCase	:		Union[str, List[str], None] = None		,   __lowerCAmelCase	:		bool = True		,   ):






         """simple docstring"""






         _lowerCamelCase		:							List[str]            =					[file for file in os.listdir(__lowerCAmelCase						) if os.path.isfile(os.path.join(__lowerCAmelCase		,   __lowerCAmelCase						)						)]

         if identifier is not None:
                _lowerCamelCase		:							str            =					[file for file in files if identifier in file]

         if n_identifier is not None:
                if isinstance(__lowerCAmelCase		,   __lowerCAmelCase						):
                       for n_ in n_identifier:
                              _lowerCamelCase		:							List[Any]            =					[file for file in files if n_ not in file]
                else:
                       _lowerCamelCase		:							Tuple            =					[file for file in files if n_identifier not in file]

         _lowerCamelCase		:							Tuple            =					ignore_files or []
         ignore_files.append('''__init__.py'''						)
         _lowerCamelCase		:							str            =					[file for file in files if file not in ignore_files]

         for file in files:
                # Open all files
                print('''Testing'''		,   __lowerCAmelCase						)

                if only_modules:
                       _lowerCamelCase		:							Any            =					file.split('''.'''						)[0]
                       try:
                              _lowerCamelCase		:							List[str]            =					getattr(__lowerCAmelCase		,   __lowerCAmelCase						)
                              _lowerCamelCase		:							Tuple            =					doctest.DocTestSuite(__lowerCAmelCase						)
                              _lowerCamelCase		:							str            =					unittest.TextTestRunner().run(__lowerCAmelCase						)
                              self.assertIs(len(result.failures						)		,   0						)
                       except AttributeError:
                              logger.info(f'''{module_identifier} is not a module.'''						)
                else:
                       _lowerCamelCase		:							List[str]            =					doctest.testfile(str('''..''' / directory / file						)		,   optionflags=doctest.ELLIPSIS						)
                       self.assertIs(result.failed		,   0						)




  def 		SCREAMING_SNAKE_CASE							(					self	:		List[str]						):






         """simple docstring"""






         _lowerCamelCase		:							List[str]            =					Path('''src/transformers'''						)
         _lowerCamelCase		:							List[str]            =					'''modeling'''
         _lowerCamelCase		:							Optional[int]            =					[
             '''modeling_ctrl.py''',
             '''modeling_tf_ctrl.py''',
         ]
         self.analyze_directory(__lowerCAmelCase		,   identifier=__lowerCAmelCase		,   ignore_files=__lowerCAmelCase						)




  def 		SCREAMING_SNAKE_CASE							(					self	:		int						):






         """simple docstring"""






         _lowerCamelCase		:							Optional[Any]            =					Path('''src/transformers'''						)
         _lowerCamelCase		:							Any            =					'''tokenization'''
         self.analyze_directory(__lowerCAmelCase		,   identifier=__lowerCAmelCase						)




  def 		SCREAMING_SNAKE_CASE							(					self	:		Dict						):






         """simple docstring"""






         _lowerCamelCase		:							Tuple            =					Path('''src/transformers'''						)
         _lowerCamelCase		:							Optional[Any]            =					'''configuration'''
         self.analyze_directory(__lowerCAmelCase		,   identifier=__lowerCAmelCase						)




  def 		SCREAMING_SNAKE_CASE							(					self	:		List[Any]						):






         """simple docstring"""






         _lowerCamelCase		:							Tuple            =					Path('''src/transformers'''						)
         _lowerCamelCase		:							Union[str, Any]            =					['''configuration''', '''modeling''', '''tokenization''']
         self.analyze_directory(__lowerCAmelCase		,   n_identifier=__lowerCAmelCase						)




  def 		SCREAMING_SNAKE_CASE							(					self	:		str						):






         """simple docstring"""






         _lowerCamelCase		:							int            =					Path('''docs/source'''						)
         _lowerCamelCase		:							List[Any]            =					['''favicon.ico''']
         self.analyze_directory(__lowerCAmelCase		,   ignore_files=__lowerCAmelCase		,   only_modules=__lowerCAmelCase						)






# 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.




def    a__    (		snake_case__					:							Dict     ):
  _UpperCAmelCase		:							str							=     [False] * len(snake_case__     )
  _UpperCAmelCase		:							str							=     [-1] * len(snake_case__     )

  def dfs(snake_case__					:							Dict						,   snake_case__					:							Optional[Any]     ):
    _UpperCAmelCase		:							str							=     True
    _UpperCAmelCase		:							Optional[Any]							=     c
    for u in graph[v]:
      if not visited[u]:
        dfs(snake_case__						,   1 - c     )

  for i in range(len(snake_case__     )     ):
    if not visited[i]:
      dfs(snake_case__						,   0     )

  for i in range(len(snake_case__     )     ):
    for j in graph[i]:
      if color[i] == color[j]:
        return False

  return True


# Adjacency list of graph
SCREAMING_SNAKE_CASE__					:     Optional[Any]       =     {0: [1, 3], 1: [0, 2], 2: [1, 3], 3: [0, 2], 4: []}





print(check_bipartite_dfs(graph))





