




'''simple docstring'''



# tests directory-specific settings - this file is run automatically
# by pytest before any tests are run

import doctest
import sys
import warnings
from os.path import abspath, dirname, join

import _pytest

from transformers.testing_utils import HfDoctestModule, HfDocTestParser


# allow having multiple repository checkouts and not needing to remember to rerun
# 'pip install -e .[dev]' when switching between checkouts and running tests.
UpperCamelCase_    	=				abspath(join(dirname(__file__), "src"))
sys.path.insert(1, git_repo_path)

# silence FutureWarning warnings in tests since often we can't act on them until
# they become normal warnings - i.e. the tests still need to test the current functionality
warnings.simplefilter(action="ignore", category=FutureWarning)




def   lowercase__(			__UpperCamelCase:					Any    ):

      """simple docstring"""






      config.addinivalue_line(
          'markers'      ,'is_pt_tf_cross_test: mark test to run only when PT and TF interactions are tested'    )
      config.addinivalue_line(
          'markers'      ,'is_pt_flax_cross_test: mark test to run only when PT and FLAX interactions are tested'    )
      config.addinivalue_line('markers'      ,'is_pipeline_test: mark test to run only when pipelines are tested'    )
      config.addinivalue_line('markers'      ,'is_staging_test: mark test to run only in the staging environment'    )
      config.addinivalue_line('markers'      ,'accelerate_tests: mark test that require accelerate'    )
      config.addinivalue_line('markers'      ,'tool_tests: mark the tool tests that are run on their specific schedule'    )




def   lowercase__(			__UpperCamelCase:					List[str]    ):

      """simple docstring"""






      from transformers.testing_utils import pytest_addoption_shared

      pytest_addoption_shared(__UpperCamelCase    )




def   lowercase__(			__UpperCamelCase:					Optional[int]    ):

      """simple docstring"""






      from transformers.testing_utils import pytest_terminal_summary_main

      SCREAMING_SNAKE_CASE   :      str    					=						terminalreporter.config.getoption('--make-reports'    )
      if make_reports:
            pytest_terminal_summary_main(__UpperCamelCase      ,id=__UpperCamelCase    )




def   lowercase__(			__UpperCamelCase:					Tuple      ,__UpperCamelCase:					Optional[Any]    ):

      """simple docstring"""






      if exitstatus == 5:
            SCREAMING_SNAKE_CASE   :      Any    					=						0


# Doctest custom flag to ignore output.
UpperCamelCase_    	=				doctest.register_optionflag("IGNORE_RESULT")

UpperCamelCase_    	=				doctest.OutputChecker






class 							_a				(			SCREAMING_SNAKE_CASE ):





       '''simple docstring'''






       def        UpperCamelCase_							(      self,							A,							A,							A  ):







             '''simple docstring'''







             if IGNORE_RESULT & optionflags:
                   return True
             return OutputChecker.check_output(self,							A,							A,							A  )

UpperCamelCase_    	=				CustomOutputChecker
UpperCamelCase_    	=				HfDoctestModule





UpperCamelCase_    	=				HfDocTestParser








'''simple docstring'''



import inspect
import warnings
from typing import Any, Dict, Optional, Union

from packaging import version




def   lowercase__(			*__UpperCamelCase:					Union[str, Any]      ,__UpperCamelCase:					Optional[Union[Dict, Any]] = None      ,__UpperCamelCase:					Dict=True      ,__UpperCamelCase:					List[Any]=2    ):

      """simple docstring"""






      from .. import __version__

      SCREAMING_SNAKE_CASE   :      int    					=						take_from
      SCREAMING_SNAKE_CASE   :      Optional[int]    					=						()
      if not isinstance(args[0]      ,__UpperCamelCase    ):
            SCREAMING_SNAKE_CASE   :      List[str]    					=						(args,)

      for attribute, version_name, message in args:
            if version.parse(version.parse(__UpperCamelCase    ).base_version    ) >= version.parse(__UpperCamelCase    ):
                  raise ValueError(
                      f"The deprecation tuple {(attribute, version_name, message)} should be removed since diffusers'"
                      f" version {__version__} is >= {version_name}"    )

            SCREAMING_SNAKE_CASE   :      Tuple    					=						None
            if isinstance(__UpperCamelCase      ,__UpperCamelCase    ) and attribute in deprecated_kwargs:
                  values += (deprecated_kwargs.pop(__UpperCamelCase    ),)
                  SCREAMING_SNAKE_CASE   :      Dict    					=						f"The `{attribute}` argument is deprecated and will be removed in version {version_name}."
            elif hasattr(__UpperCamelCase      ,__UpperCamelCase    ):
                  values += (getattr(__UpperCamelCase      ,__UpperCamelCase    ),)
                  SCREAMING_SNAKE_CASE   :      Optional[int]    					=						f"The `{attribute}` attribute is deprecated and will be removed in version {version_name}."
            elif deprecated_kwargs is None:
                  SCREAMING_SNAKE_CASE   :      Dict    					=						f"`{attribute}` is deprecated and will be removed in version {version_name}."

            if warning is not None:
                  SCREAMING_SNAKE_CASE   :      Dict    					=						warning + ' ' if standard_warn else ''
                  warnings.warn(warning + message      ,__UpperCamelCase      ,stacklevel=__UpperCamelCase    )

      if isinstance(__UpperCamelCase      ,__UpperCamelCase    ) and len(__UpperCamelCase    ) > 0:
            SCREAMING_SNAKE_CASE   :      Union[str, Any]    					=						inspect.getouterframes(inspect.currentframe()    )[1]
            SCREAMING_SNAKE_CASE   :      Any    					=						call_frame.filename
            SCREAMING_SNAKE_CASE   :      Tuple    					=						call_frame.lineno
            SCREAMING_SNAKE_CASE   :      Union[str, Any]    					=						call_frame.function
            SCREAMING_SNAKE_CASE					,    SCREAMING_SNAKE_CASE   :      Tuple    					=						next(iter(deprecated_kwargs.items()    )    )
            raise TypeError(f"{function} in {filename} line {line_number-1} got an unexpected keyword argument `{key}`"    )

      if len(__UpperCamelCase    ) == 0:
            return
      elif len(__UpperCamelCase    ) == 1:
            return values[0]
      return values


