






'''simple docstring'''
import unittest

from transformers import MODEL_FOR_VISUAL_QUESTION_ANSWERING_MAPPING, is_vision_available
from transformers.pipelines import pipeline
from transformers.testing_utils import (
    is_pipeline_test,
    nested_simplify,
    require_tf,
    require_torch,
    require_vision,
    slow,
)

from .test_pipelines_common import ANY


if is_vision_available():
     from PIL import Image
else:






     class        __SCREAMING_SNAKE_CASE :




      @staticmethod
      def        __magic_name__		( *__lowercase		:							Any   , **__lowercase		:							Optional[Any] )		->  Dict:
            pass






@is_pipeline_test
@require_torch
@require_vision
class        __SCREAMING_SNAKE_CASE (     unittest.TestCase			):
 snake_case_												=							MODEL_FOR_VISUAL_QUESTION_ANSWERING_MAPPING




 def        __magic_name__		( self		:							Dict   , __lowercase		:							Any   , __lowercase		:							List[str]   , __lowercase		:							List[Any] )		->  List[str]:
       SCREAMING_SNAKE_CASE__       :			str													=pipeline('''visual-question-answering'''   , model='''hf-internal-testing/tiny-vilt-random-vqa''' )
       SCREAMING_SNAKE_CASE__       :			Optional[int]													=[
           {
               '''image''': Image.open('''./tests/fixtures/tests_samples/COCO/000000039769.png''' ),
               '''question''': '''How many cats are there?''',
           },
           {
               '''image''': '''./tests/fixtures/tests_samples/COCO/000000039769.png''',
               '''question''': '''How many cats are there?''',
           },
       ]
       return vqa_pipeline, examples




 def        __magic_name__		( self		:							Tuple   , __lowercase		:							Optional[Any]   , __lowercase		:							Optional[Any] )		->  Any:
       SCREAMING_SNAKE_CASE__       :			Optional[int]													=vqa_pipeline(__lowercase   , top_k=1 )
       self.assertEqual(
           __lowercase   , [
               [{'''score''': ANY(__lowercase ), '''answer''': ANY(__lowercase )}],
               [{'''score''': ANY(__lowercase ), '''answer''': ANY(__lowercase )}],
           ]   , )




 @require_torch
 def        __magic_name__		( self		:							List[str] )		->  int:
       SCREAMING_SNAKE_CASE__       :			str													=pipeline('''visual-question-answering'''   , model='''hf-internal-testing/tiny-vilt-random-vqa''' )
       SCREAMING_SNAKE_CASE__       :			Optional[int]													='''./tests/fixtures/tests_samples/COCO/000000039769.png'''
       SCREAMING_SNAKE_CASE__       :			Any													='''How many cats are there?'''

       SCREAMING_SNAKE_CASE__       :			Any													=vqa_pipeline(image=__lowercase   , question='''How many cats are there?'''   , top_k=2 )
       self.assertEqual(
           __lowercase   , [{'''score''': ANY(__lowercase ), '''answer''': ANY(__lowercase )}, {'''score''': ANY(__lowercase ), '''answer''': ANY(__lowercase )}] )

       SCREAMING_SNAKE_CASE__       :			List[Any]													=vqa_pipeline({'''image''': image, '''question''': question}   , top_k=2 )
       self.assertEqual(
           __lowercase   , [{'''score''': ANY(__lowercase ), '''answer''': ANY(__lowercase )}, {'''score''': ANY(__lowercase ), '''answer''': ANY(__lowercase )}] )




 @slow
 @require_torch
 def        __magic_name__		( self		:							Union[str, Any] )		->  str:
       SCREAMING_SNAKE_CASE__       :			Dict													=pipeline('''visual-question-answering'''   , model='''dandelin/vilt-b32-finetuned-vqa''' )
       SCREAMING_SNAKE_CASE__       :			int													='''./tests/fixtures/tests_samples/COCO/000000039769.png'''
       SCREAMING_SNAKE_CASE__       :			Optional[Any]													='''How many cats are there?'''

       SCREAMING_SNAKE_CASE__       :			Dict													=vqa_pipeline(image=__lowercase   , question=__lowercase   , top_k=2 )
       self.assertEqual(
           nested_simplify(__lowercase   , decimals=4 )   , [{'''score''': 0.8799, '''answer''': '''2'''}, {'''score''': 0.296, '''answer''': '''1'''}] )

       SCREAMING_SNAKE_CASE__       :			str													=vqa_pipeline({'''image''': image, '''question''': question}   , top_k=2 )
       self.assertEqual(
           nested_simplify(__lowercase   , decimals=4 )   , [{'''score''': 0.8799, '''answer''': '''2'''}, {'''score''': 0.296, '''answer''': '''1'''}] )

       SCREAMING_SNAKE_CASE__       :			Optional[Any]													=vqa_pipeline(
           [{'''image''': image, '''question''': question}, {'''image''': image, '''question''': question}]   , top_k=2 )
       self.assertEqual(
           nested_simplify(__lowercase   , decimals=4 )   , [[{'''score''': 0.8799, '''answer''': '''2'''}, {'''score''': 0.296, '''answer''': '''1'''}]] * 2   , )




 @require_tf
 @unittest.skip('''Visual question answering not implemented in TF''' )
 def        __magic_name__		( self		:							Union[str, Any] )		->  Optional[int]:
       pass







'''simple docstring'''
def 	_a(					UpperCamelCase__			:  Optional[Any]=2_8_1_2_3							):




      '''simple docstring'''






      SCREAMING_SNAKE_CASE__       :			List[Any]													=[1] * (limit + 1)

      for i in range(2,		int(limit**0.5							) + 1							):
            sum_divs[i * i] += i
            for k in range(i + 1,		limit // i + 1							):
                  sum_divs[k * i] += k + i

      SCREAMING_SNAKE_CASE__       :			List[str]													=set()
      SCREAMING_SNAKE_CASE__       :			str													=0

      for n in range(1,		limit + 1							):
            if sum_divs[n] > n:
                  abundants.add(UpperCamelCase__							)

            if not any((n - a in abundants) for a in abundants							):
                  res += n

      return res


if __name__ == "__main__":
  print(solution())