


'''simple docstring'''







from collections import deque
def 				lowerCAmelCase__	(    lowerCamelCase					:      List[str]       ):
       _A					:     Tuple     = len(__lowerCAmelCase       )
       _A					:     str     = deque()
       _A					:     List[str]     = [False for _ in range(__lowerCAmelCase       )]
       _A					:     List[Any]     = [-1 for _ in range(__lowerCAmelCase       )]
       _A					:     List[Any]     = index_of[:]

       def strong_connect(lowerCamelCase					:      Tuple  ,lowerCamelCase					:      int  ,lowerCamelCase					:      Optional[Any]       ):
              _A					:     Optional[Any]     = index  # the number when this node is seen
              _A					:     str     = index  # lowest rank node reachable from here
              index += 1
              stack.append(__lowerCAmelCase       )
              _A					:     Any     = True

              for w in g[v]:
                     if index_of[w] == -1:
                            _A					:     str     = strong_connect(__lowerCAmelCase  ,__lowerCAmelCase  ,__lowerCAmelCase       )
                            _A					:     Optional[Any]     = (
                                lowlink_of[w] if lowlink_of[w] < lowlink_of[v] else lowlink_of[v]
                            )
                     elif on_stack[w]:
                            _A					:     Tuple     = (
                                lowlink_of[w] if lowlink_of[w] < lowlink_of[v] else lowlink_of[v]
                            )

              if lowlink_of[v] == index_of[v]:
                     _A					:     Optional[int]     = []
                     _A					:     Tuple     = stack.pop()
                     _A					:     Dict     = False
                     component.append(__lowerCAmelCase       )
                     while w != v:
                            _A					:     Optional[int]     = stack.pop()
                            _A					:     Any     = False
                            component.append(__lowerCAmelCase       )
                     components.append(__lowerCAmelCase       )
              return index

       _A					:     Any     = []
       for v in range(__lowerCAmelCase       ):
              if index_of[v] == -1:
                     strong_connect(__lowerCAmelCase  ,0  ,__lowerCAmelCase       )

       return components
def 				lowerCAmelCase__	(    lowerCamelCase					:      List[Any]  ,lowerCamelCase					:      str       ):
       _A					:     List[Any]     = [[] for _ in range(__lowerCAmelCase       )]
       for u, v in edges:
              g[u].append(__lowerCAmelCase       )
       return g


if __name__ == "__main__":
   # Test
   A				:					List[str]    						=			7
   A				:					List[Any]    						=			[0, 0, 1, 2, 3, 3, 4, 4, 6]
   A				:					Optional[int]    						=			[1, 3, 2, 0, 1, 4, 5, 6, 5]
   A				:					List[Any]    						=			[(u, v) for u, v in zip(source, target)]
   A				:					Any    						=			create_graph(n_vertices, edges)

   assert [[5], [6], [4], [3, 2, 1, 0]] == tarjan(g)










'''simple docstring'''







from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


A				:					List[str]    						=			{
    '''configuration_electra''': ['''ELECTRA_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ElectraConfig''', '''ElectraOnnxConfig'''],
    '''tokenization_electra''': ['''ElectraTokenizer'''],
}

try:
   if not is_tokenizers_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   A				:					int    						=			['''ElectraTokenizerFast''']

try:
   if not is_torch_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   A				:					List[str]    						=			[
       '''ELECTRA_PRETRAINED_MODEL_ARCHIVE_LIST''',
       '''ElectraForCausalLM''',
       '''ElectraForMaskedLM''',
       '''ElectraForMultipleChoice''',
       '''ElectraForPreTraining''',
       '''ElectraForQuestionAnswering''',
       '''ElectraForSequenceClassification''',
       '''ElectraForTokenClassification''',
       '''ElectraModel''',
       '''ElectraPreTrainedModel''',
       '''load_tf_weights_in_electra''',
   ]

try:
   if not is_tf_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   A				:					Dict    						=			[
       '''TF_ELECTRA_PRETRAINED_MODEL_ARCHIVE_LIST''',
       '''TFElectraForMaskedLM''',
       '''TFElectraForMultipleChoice''',
       '''TFElectraForPreTraining''',
       '''TFElectraForQuestionAnswering''',
       '''TFElectraForSequenceClassification''',
       '''TFElectraForTokenClassification''',
       '''TFElectraModel''',
       '''TFElectraPreTrainedModel''',
   ]

try:
   if not is_flax_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   A				:					List[Any]    						=			[
       '''FlaxElectraForCausalLM''',
       '''FlaxElectraForMaskedLM''',
       '''FlaxElectraForMultipleChoice''',
       '''FlaxElectraForPreTraining''',
       '''FlaxElectraForQuestionAnswering''',
       '''FlaxElectraForSequenceClassification''',
       '''FlaxElectraForTokenClassification''',
       '''FlaxElectraModel''',
       '''FlaxElectraPreTrainedModel''',
   ]


if TYPE_CHECKING:
   from .configuration_electra import ELECTRA_PRETRAINED_CONFIG_ARCHIVE_MAP, ElectraConfig, ElectraOnnxConfig
   from .tokenization_electra import ElectraTokenizer

   try:
      if not is_tokenizers_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .tokenization_electra_fast import ElectraTokenizerFast

   try:
      if not is_torch_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_electra import (
          ELECTRA_PRETRAINED_MODEL_ARCHIVE_LIST,
          ElectraForCausalLM,
          ElectraForMaskedLM,
          ElectraForMultipleChoice,
          ElectraForPreTraining,
          ElectraForQuestionAnswering,
          ElectraForSequenceClassification,
          ElectraForTokenClassification,
          ElectraModel,
          ElectraPreTrainedModel,
          load_tf_weights_in_electra,
      )

   try:
      if not is_tf_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_tf_electra import (
          TF_ELECTRA_PRETRAINED_MODEL_ARCHIVE_LIST,
          TFElectraForMaskedLM,
          TFElectraForMultipleChoice,
          TFElectraForPreTraining,
          TFElectraForQuestionAnswering,
          TFElectraForSequenceClassification,
          TFElectraForTokenClassification,
          TFElectraModel,
          TFElectraPreTrainedModel,
      )

   try:
      if not is_flax_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_flax_electra import (
          FlaxElectraForCausalLM,
          FlaxElectraForMaskedLM,
          FlaxElectraForMultipleChoice,
          FlaxElectraForPreTraining,
          FlaxElectraForQuestionAnswering,
          FlaxElectraForSequenceClassification,
          FlaxElectraForTokenClassification,
          FlaxElectraModel,
          FlaxElectraPreTrainedModel,
      )

else:
   import sys

   A				:					Tuple    						=			_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)






