


from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available, is_vision_available


UpperCAmelCase__            =							{
    '''configuration_flava''': [
        '''FLAVA_PRETRAINED_CONFIG_ARCHIVE_MAP''',
        '''FlavaConfig''',
        '''FlavaImageCodebookConfig''',
        '''FlavaImageConfig''',
        '''FlavaMultimodalConfig''',
        '''FlavaTextConfig''',
    ],
}

try:
  if not is_vision_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  UpperCAmelCase__            =							['''FlavaFeatureExtractor''']
  UpperCAmelCase__            =							['''FlavaImageProcessor''']
  UpperCAmelCase__            =							['''FlavaProcessor''']

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  UpperCAmelCase__            =							[
      '''FLAVA_PRETRAINED_MODEL_ARCHIVE_LIST''',
      '''FlavaForPreTraining''',
      '''FlavaImageCodebook''',
      '''FlavaImageModel''',
      '''FlavaModel''',
      '''FlavaMultimodalModel''',
      '''FlavaPreTrainedModel''',
      '''FlavaTextModel''',
  ]

if TYPE_CHECKING:
  from .configuration_flava import (
      FLAVA_PRETRAINED_CONFIG_ARCHIVE_MAP,
      FlavaConfig,
      FlavaImageCodebookConfig,
      FlavaImageConfig,
      FlavaMultimodalConfig,
      FlavaTextConfig,
  )

  try:
    if not is_vision_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .feature_extraction_flava import FlavaFeatureExtractor
    from .image_processing_flava import FlavaImageProcessor
    from .processing_flava import FlavaProcessor

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_flava import (
        FLAVA_PRETRAINED_MODEL_ARCHIVE_LIST,
        FlavaForPreTraining,
        FlavaImageCodebook,
        FlavaImageModel,
        FlavaModel,
        FlavaMultimodalModel,
        FlavaPreTrainedModel,
        FlavaTextModel,
    )

else:
  import sys

  UpperCAmelCase__            =							_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)





UpperCAmelCase__            =							[
    [0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0],
    [0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0],
    [0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0],
    [0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0],
    [0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0],
]
def     UpperCAmelCase_ (							__snake_case					,						__snake_case					,						__snake_case					,						__snake_case						)					->      bool:







 """simple docstring"""


 return 0 <= row < rows and 0 <= col < cols
def     UpperCAmelCase_ (							__snake_case					,						__snake_case					,						__snake_case					,						__snake_case						)					->      int:







 """simple docstring"""


 _lowercase											=len(__snake_case						)
 _lowercase											=len(mat[0]						)
 if is_safe(__snake_case					,						__snake_case					,						__snake_case					,						__snake_case						) and (row, col) not in seen and mat[row][col] == 1:
  seen.add((row, col)						)
  return (
      1
      + depth_first_search(row + 1					,						__snake_case					,						__snake_case					,						__snake_case						)
      + depth_first_search(row - 1					,						__snake_case					,						__snake_case					,						__snake_case						)
      + depth_first_search(__snake_case					,						col + 1					,						__snake_case					,						__snake_case						)
      + depth_first_search(__snake_case					,						col - 1					,						__snake_case					,						__snake_case						)
  )
 else:
  return 0
def     UpperCAmelCase_ (							__snake_case						)					->      int:







 """simple docstring"""


 _lowercase											=set()

 _lowercase											=0
 for row, line in enumerate(__snake_case						):
  for col, item in enumerate(__snake_case						):
   if item == 1 and (row, col) not in seen:
    # Maximizing the area
    _lowercase											=max(__snake_case					,						depth_first_search(__snake_case					,						__snake_case					,						__snake_case					,						__snake_case						)						)
 return max_area


if __name__ == "__main__":
  import doctest

  print(find_max_area(matrix))  # Output -> 6
  doctest.testmod()

