




import os
import tempfile
import unittest

from transformers.models.marian.convert_marian_tatoeba_to_pytorch import DEFAULT_REPO, TatoebaConverter
from transformers.testing_utils import slow
from transformers.utils import cached_property






@unittest.skipUnless(os.path.exists(_lowercase	)    ,			'Tatoeba directory does not exist.'	)
class  _lowerCAmelCase     (  unittest.TestCase	):

      @cached_property
      def 	__magic_name__(   self		):
        lowerCAmelCase__				:  Tuple		       =     tempfile.mkdtemp()
        return TatoebaConverter(save_dir=__A		)

      @slow
      def 	__magic_name__(   self		):
        self.resolver.convert_models(['''heb-eng''']		)







      @slow
      def 	__magic_name__(   self		):
        lowerCAmelCase__				:  List[Any]		       =     self.resolver.write_model_card('''opus-mt-he-en'''      ,				dry_run=__A		)
        assert mmeta["long_pair"] == "heb-eng"







def      __lowerCAmelCase			(					UpperCamelCase      )     ->	bool:
  if not isinstance(UpperCamelCase	,      UpperCamelCase      ):
    raise ValueError('''Input series is not valid, valid series - [2, 4, 6]'''      )
  if len(UpperCamelCase      ) == 0:
    raise ValueError('''Input list must be a non empty list'''      )
  if len(UpperCamelCase      ) == 1:
    return True
  lowerCAmelCase__				:  Tuple		       =     series[1] - series[0]
  for index in range(len(UpperCamelCase      ) - 1      ):
    if series[index + 1] - series[index] != common_diff:
      return False
  return True



def      __lowerCAmelCase			(					UpperCamelCase      )     ->	float:
  if not isinstance(UpperCamelCase	,      UpperCamelCase      ):
    raise ValueError('''Input series is not valid, valid series - [2, 4, 6]'''      )
  if len(UpperCamelCase      ) == 0:
    raise ValueError('''Input list must be a non empty list'''      )
  lowerCAmelCase__				:  int		       =     0
  for val in series:
    answer += val
  return answer / len(UpperCamelCase      )


if __name__ == "__main__":
     import doctest

     doctest.testmod()

