





'''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


lowercase__						:      Dict	=    logging.getLogger()
@unittest.skip('Temporarily disable the doc tests.'			)
@require_torch
@require_tf
@slow
class     __lowerCAmelCase					(   unittest.TestCase			):






       """simple docstring"""





       def 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	,			)   ->					str:

            '''simple docstring'''




            _UpperCamelCase       =	[file for file in os.listdir(lowerCAmelCase__					) if os.path.isfile(os.path.join(lowerCAmelCase__	,			lowerCAmelCase__					)					)]

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

            if n_identifier is not None:
                 if isinstance(lowerCAmelCase__	,			lowerCAmelCase__					):
                      for n_ in n_identifier:
                           _UpperCamelCase       =	[file for file in files if n_ not in file]
                 else:
                      _UpperCamelCase       =	[file for file in files if n_identifier not in file]

            _UpperCamelCase       =	ignore_files or []
            ignore_files.append('''__init__.py'''					)
            _UpperCamelCase       =	[file for file in files if file not in ignore_files]

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

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





       def snake_case__						(							self       :		Union[str, Any]					)   ->					Optional[int]:

            '''simple docstring'''




            _UpperCamelCase       =	Path('''src/transformers'''					)
            _UpperCamelCase       =	'''modeling'''
            _UpperCamelCase       =	[
                '''modeling_ctrl.py''',
                '''modeling_tf_ctrl.py''',
            ]
            self.analyze_directory(lowerCAmelCase__	,			identifier=lowerCAmelCase__	,			ignore_files=lowerCAmelCase__					)





       def snake_case__						(							self       :		Optional[Any]					)   ->					Any:

            '''simple docstring'''




            _UpperCamelCase       =	Path('''src/transformers'''					)
            _UpperCamelCase       =	'''tokenization'''
            self.analyze_directory(lowerCAmelCase__	,			identifier=lowerCAmelCase__					)





       def snake_case__						(							self       :		List[str]					)   ->					int:

            '''simple docstring'''




            _UpperCamelCase       =	Path('''src/transformers'''					)
            _UpperCamelCase       =	'''configuration'''
            self.analyze_directory(lowerCAmelCase__	,			identifier=lowerCAmelCase__					)





       def snake_case__						(							self       :		List[Any]					)   ->					Any:

            '''simple docstring'''




            _UpperCamelCase       =	Path('''src/transformers'''					)
            _UpperCamelCase       =	['''configuration''', '''modeling''', '''tokenization''']
            self.analyze_directory(lowerCAmelCase__	,			n_identifier=lowerCAmelCase__					)







       def snake_case__						(							self       :		List[str]					)   ->					Any:

            '''simple docstring'''




            _UpperCamelCase       =	Path('''docs/source'''					)
            _UpperCamelCase       =	['''favicon.ico''']
            self.analyze_directory(lowerCAmelCase__	,			ignore_files=lowerCAmelCase__	,			only_modules=lowerCAmelCase__					)










'''simple docstring'''

def  a__    (    lowercase :					int, lowercase :					int, lowercase :					list[list[int]]				)		->		int:





     """simple docstring"""

     def update_area_of_max_square(lowercase :					int, lowercase :					int				) -> int:
          # BASE CASE
          if row >= rows or col >= cols:
               return 0

          _UpperCamelCase       =	update_area_of_max_square(lowercase, col + 1				)
          _UpperCamelCase       =	update_area_of_max_square(row + 1, col + 1				)
          _UpperCamelCase       =	update_area_of_max_square(row + 1, lowercase				)

          if mat[row][col]:
               _UpperCamelCase       =	1 + min([right, diagonal, down]				)
               _UpperCamelCase       =	max(largest_square_area[0], lowercase				)
               return sub_problem_sol
          else:
               return 0

     _UpperCamelCase       =	[0]
     update_area_of_max_square(0, 0				)
     return largest_square_area[0]







def  a__    (    lowercase :					int, lowercase :					int, lowercase :					list[list[int]]				)		->		int:





     """simple docstring"""

     def update_area_of_max_square_using_dp_array(
         lowercase :					int, lowercase :					int, lowercase :					list[list[int]]				) -> int:
          if row >= rows or col >= cols:
               return 0
          if dp_array[row][col] != -1:
               return dp_array[row][col]

          _UpperCamelCase       =	update_area_of_max_square_using_dp_array(lowercase, col + 1, lowercase				)
          _UpperCamelCase       =	update_area_of_max_square_using_dp_array(row + 1, col + 1, lowercase				)
          _UpperCamelCase       =	update_area_of_max_square_using_dp_array(row + 1, lowercase, lowercase				)

          if mat[row][col]:
               _UpperCamelCase       =	1 + min([right, diagonal, down]				)
               _UpperCamelCase       =	max(largest_square_area[0], lowercase				)
               _UpperCamelCase       =	sub_problem_sol
               return sub_problem_sol
          else:
               return 0

     _UpperCamelCase       =	[0]
     _UpperCamelCase       =	[[-1] * cols for _ in range(lowercase				)]
     update_area_of_max_square_using_dp_array(0, 0, lowercase				)

     return largest_square_area[0]







def  a__    (    lowercase :					int, lowercase :					int, lowercase :					list[list[int]]				)		->		int:





     """simple docstring"""

     _UpperCamelCase       =	[[0] * (cols + 1) for _ in range(rows + 1				)]
     _UpperCamelCase       =	0
     for row in range(rows - 1, -1, -1				):
          for col in range(cols - 1, -1, -1				):
               _UpperCamelCase       =	dp_array[row][col + 1]
               _UpperCamelCase       =	dp_array[row + 1][col + 1]
               _UpperCamelCase       =	dp_array[row + 1][col]

               if mat[row][col] == 1:
                    _UpperCamelCase       =	1 + min(lowercase, lowercase, lowercase				)
                    _UpperCamelCase       =	max(dp_array[row][col], lowercase				)
               else:
                    _UpperCamelCase       =	0

     return largest_square_area







def  a__    (    lowercase :					int, lowercase :					int, lowercase :					list[list[int]]				)		->		int:





     """simple docstring"""

     _UpperCamelCase       =	[0] * (cols + 1)
     _UpperCamelCase       =	[0] * (cols + 1)
     _UpperCamelCase       =	0
     for row in range(rows - 1, -1, -1				):
          for col in range(cols - 1, -1, -1				):
               _UpperCamelCase       =	current_row[col + 1]
               _UpperCamelCase       =	next_row[col + 1]
               _UpperCamelCase       =	next_row[col]

               if mat[row][col] == 1:
                    _UpperCamelCase       =	1 + min(lowercase, lowercase, lowercase				)
                    _UpperCamelCase       =	max(current_row[col], lowercase				)
               else:
                    _UpperCamelCase       =	0
          _UpperCamelCase       =	current_row

     return largest_square_area


if __name__ == "__main__":
   import doctest

   doctest.testmod()
   print(largest_square_area_in_matrix_bottom_up(2, 2, [[1, 1], [1, 1]]))



