




'''simple docstring'''




import importlib
import os
import sys


# This is required to make the module import works (when the python process is running from the root of the repo)
sys.path.append('.')

def       _UpperCamelCase					( SCREAMING_SNAKE_CASE__	:					Optional[Any]				):
 '''simple docstring'''





 UpperCAmelCase__								=			test_file.split(os.path.sep				)
 if components[0:2] != ["tests", "models"]:
  raise ValueError(
      """`test_file` should start with `tests/models/` (with `/` being the OS specific path separator). Got """
      F'''{test_file} instead.'''				)
 UpperCAmelCase__								=			components[-1]
 if not test_fn.endswith("""py"""				):
  raise ValueError(F'''`test_file` should be a python file. Got {test_fn} instead.'''				)
 if not test_fn.startswith("""test_modeling_"""				):
  raise ValueError(
      F'''`test_file` should point to a file name of the form `test_modeling_*.py`. Got {test_fn} instead.'''				)

 UpperCAmelCase__								=			components[:-1] + [test_fn.replace(""".py"""				,  """"""				)]
 UpperCAmelCase__								=			'.'.join(SCREAMING_SNAKE_CASE__				)

 return test_module_path

def       _UpperCamelCase					( SCREAMING_SNAKE_CASE__	:					str				):
 '''simple docstring'''





 UpperCAmelCase__								=			get_module_path(SCREAMING_SNAKE_CASE__				)
 UpperCAmelCase__								=			importlib.import_module(SCREAMING_SNAKE_CASE__				)

 return test_module

def       _UpperCamelCase					( SCREAMING_SNAKE_CASE__	:					Optional[int]				):
 '''simple docstring'''





 UpperCAmelCase__								=			[]
 UpperCAmelCase__								=			get_test_module(SCREAMING_SNAKE_CASE__				)
 for attr in dir(SCREAMING_SNAKE_CASE__				):
  if attr.endswith("""ModelTester"""				):
   tester_classes.append(getattr(SCREAMING_SNAKE_CASE__				,  SCREAMING_SNAKE_CASE__				)				)

    # sort with class names
 return sorted(SCREAMING_SNAKE_CASE__				,  key=lambda SCREAMING_SNAKE_CASE__				: x.__name__				)

def       _UpperCamelCase					( SCREAMING_SNAKE_CASE__	:					str				):
 '''simple docstring'''





 UpperCAmelCase__								=			[]
 UpperCAmelCase__								=			get_test_module(SCREAMING_SNAKE_CASE__				)
 for attr in dir(SCREAMING_SNAKE_CASE__				):
  UpperCAmelCase__								=			getattr(SCREAMING_SNAKE_CASE__				,  SCREAMING_SNAKE_CASE__				)
  # (TF/Flax)ModelTesterMixin is also an attribute in specific model test module. Let's exclude them by checking
  # `all_model_classes` is not empty (which also excludes other special classes).
  UpperCAmelCase__								=			getattr(SCREAMING_SNAKE_CASE__				,  """all_model_classes"""				,  []				)
  if len(SCREAMING_SNAKE_CASE__				) > 0:
   test_classes.append(SCREAMING_SNAKE_CASE__				)

    # sort with class names
 return sorted(SCREAMING_SNAKE_CASE__				,  key=lambda SCREAMING_SNAKE_CASE__				: x.__name__				)

def       _UpperCamelCase					( SCREAMING_SNAKE_CASE__	:					int				):
 '''simple docstring'''





 UpperCAmelCase__								=			get_test_classes(SCREAMING_SNAKE_CASE__				)
 UpperCAmelCase__								=			set()
 for test_class in test_classes:
  model_classes.update(test_class.all_model_classes				)

 # sort with class names
 return sorted(SCREAMING_SNAKE_CASE__				,  key=lambda SCREAMING_SNAKE_CASE__				: x.__name__				)

def       _UpperCamelCase					( SCREAMING_SNAKE_CASE__	:					Optional[int]				):
 '''simple docstring'''





 UpperCAmelCase__								=			test_class()
 if hasattr(SCREAMING_SNAKE_CASE__				,  """setUp"""				):
  test.setUp()

 UpperCAmelCase__								=			None
 if hasattr(SCREAMING_SNAKE_CASE__				,  """model_tester"""				):
  # `(TF/Flax)ModelTesterMixin` has this attribute default to `None`. Let's skip this case.
  if test.model_tester is not None:
   UpperCAmelCase__								=			test.model_tester.__class__

 return model_tester

def       _UpperCamelCase					( SCREAMING_SNAKE_CASE__	:					List[Any]				,  SCREAMING_SNAKE_CASE__	:					Dict				):
 '''simple docstring'''





 UpperCAmelCase__								=			get_test_classes(SCREAMING_SNAKE_CASE__				)

 UpperCAmelCase__								=			[]
 for test_class in test_classes:
  if model_class in test_class.all_model_classes:
   target_test_classes.append(SCREAMING_SNAKE_CASE__				)

    # sort with class names
 return sorted(SCREAMING_SNAKE_CASE__				,  key=lambda SCREAMING_SNAKE_CASE__				: x.__name__				)

def       _UpperCamelCase					( SCREAMING_SNAKE_CASE__	:					Dict				,  SCREAMING_SNAKE_CASE__	:					str				):
 '''simple docstring'''





 UpperCAmelCase__								=			get_test_classes_for_model(SCREAMING_SNAKE_CASE__				,  SCREAMING_SNAKE_CASE__				)

 UpperCAmelCase__								=			[]
 for test_class in test_classes:
  UpperCAmelCase__								=			get_model_tester_from_test_class(SCREAMING_SNAKE_CASE__				)
  if tester_class is not None:
   tester_classes.append(SCREAMING_SNAKE_CASE__				)

    # sort with class names
 return sorted(SCREAMING_SNAKE_CASE__				,  key=lambda SCREAMING_SNAKE_CASE__				: x.__name__				)

def       _UpperCamelCase					( SCREAMING_SNAKE_CASE__	:					List[str]				):
 '''simple docstring'''





 UpperCAmelCase__								=			get_test_classes(SCREAMING_SNAKE_CASE__				)
 UpperCAmelCase__								=			{test_class: get_model_tester_from_test_class(SCREAMING_SNAKE_CASE__				) for test_class in test_classes}
 return test_tester_mapping

def       _UpperCamelCase					( SCREAMING_SNAKE_CASE__	:					Optional[int]				):
 '''simple docstring'''





 UpperCAmelCase__								=			get_model_classes(SCREAMING_SNAKE_CASE__				)
 UpperCAmelCase__								=			{
     model_class: get_test_classes_for_model(SCREAMING_SNAKE_CASE__				,  SCREAMING_SNAKE_CASE__				) for model_class in model_classes
 }
 return model_test_mapping

def       _UpperCamelCase					( SCREAMING_SNAKE_CASE__	:					Optional[Any]				):
 '''simple docstring'''





 UpperCAmelCase__								=			get_model_classes(SCREAMING_SNAKE_CASE__				)
 UpperCAmelCase__								=			{
     model_class: get_tester_classes_for_model(SCREAMING_SNAKE_CASE__				,  SCREAMING_SNAKE_CASE__				) for model_class in model_classes
 }
 return model_to_tester_mapping







def       _UpperCamelCase					( SCREAMING_SNAKE_CASE__	:					int				):
 '''simple docstring'''





 if isinstance(SCREAMING_SNAKE_CASE__				,  SCREAMING_SNAKE_CASE__				):
  return o
 elif isinstance(SCREAMING_SNAKE_CASE__				,  SCREAMING_SNAKE_CASE__				):
  return o.__name__
 elif isinstance(SCREAMING_SNAKE_CASE__				,  (list, tuple)				):
  return [to_json(SCREAMING_SNAKE_CASE__				) for x in o]
 elif isinstance(SCREAMING_SNAKE_CASE__				,  SCREAMING_SNAKE_CASE__				):
  return {to_json(SCREAMING_SNAKE_CASE__				): to_json(SCREAMING_SNAKE_CASE__				) for k, v in o.items()}
 else:
  return o







from __future__ import annotations







def  _SCREAMING_SNAKE_CASE				(   a					,						a					,						a  )      ->      float:
					if days_between_payments <= 0:
										raise ValueError('days_between_payments must be > 0'  )
					if daily_interest_rate < 0:
										raise ValueError('daily_interest_rate must be >= 0'  )
					if principal <= 0:
										raise ValueError('principal must be > 0'  )
					return principal * daily_interest_rate * days_between_payments







def  _SCREAMING_SNAKE_CASE				(   a					,						a					,						a					,						)      ->      float:
					if number_of_compounding_periods <= 0:
										raise ValueError('number_of_compounding_periods must be > 0'  )
					if nominal_annual_interest_rate_percentage < 0:
										raise ValueError('nominal_annual_interest_rate_percentage must be >= 0'  )
					if principal <= 0:
										raise ValueError('principal must be > 0'  )

					return principal * (
					    (1 + nominal_annual_interest_rate_percentage) ** number_of_compounding_periods
					    - 1
					)







def  _SCREAMING_SNAKE_CASE				(   a					,						a					,						a					,						)      ->      float:
					if number_of_years <= 0:
										raise ValueError('number_of_years must be > 0'  )
					if nominal_annual_percentage_rate < 0:
										raise ValueError('nominal_annual_percentage_rate must be >= 0'  )
					if principal <= 0:
										raise ValueError('principal must be > 0'  )

					return compound_interest(
					    a					,						nominal_annual_percentage_rate / 3_65					,						number_of_years * 3_65  )


if __name__ == "__main__":
				import doctest

				doctest.testmod()




