

"""simple docstring"""

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


# allow having multiple repository checkouts and not needing to remember to rerun
# 'pip install -e .[dev]' when switching between checkouts and running tests.
UpperCamelCase__ :    List[Any] 					=							abspath(join(dirname(dirname(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       snake_case__	(       lowerCAmelCase   :		Any		):
					from diffusers.utils.testing_utils import pytest_addoption_shared

					pytest_addoption_shared(lowerCAmelCase		)




def       snake_case__	(       lowerCAmelCase   :		Union[str, Any]		):
					from diffusers.utils.testing_utils import pytest_terminal_summary_main

					__snake_case          =	terminalreporter.config.getoption("""--make-reports"""		)
					if make_reports:
										pytest_terminal_summary_main(lowerCAmelCase				,					id=lowerCAmelCase		)








"""simple docstring"""

import functools
from math import sqrt
from time import time




def       snake_case__	(       lowerCAmelCase   :		int				,					*lowerCAmelCase   :		str				,					**lowerCAmelCase   :		List[Any]		):
					__snake_case          =	time()
					__snake_case          =	func(*lowerCAmelCase				,					**lowerCAmelCase		)
					__snake_case          =	time()
					if int(end - start		) > 0:
										print(F'''{func.__name__} runtime: {(end - start):0.4f} s'''		)
					else:
										print(F'''{func.__name__} runtime: {(end - start) * 1_000:0.4f} ms'''		)
					return output




def       snake_case__	(       lowerCAmelCase   :		int		):
					if n < 0:
										raise Exception("""n is negative"""		)
					if n == 0:
										return [0]
					__snake_case          =	[0, 1]
					for _ in range(n - 1		):
										fib.append(fib[-1] + fib[-2]		)
					return fib




def       snake_case__	(       lowerCAmelCase   :		int		):

					def fib_recursive_term(lowerCAmelCase   :		int		) -> int:
										if i < 0:
															raise Exception("""n is negative"""		)
										if i < 2:
															return i
										return fib_recursive_term(i - 1		) + fib_recursive_term(i - 2		)

					if n < 0:
										raise Exception("""n is negative"""		)
					return [fib_recursive_term(lowerCAmelCase		) for i in range(n + 1		)]




def       snake_case__	(       lowerCAmelCase   :		int		):

					@functools.cache
					def fib_recursive_term(lowerCAmelCase   :		int		) -> int:
										if i < 0:
															raise Exception("""n is negative"""		)
										if i < 2:
															return i
										return fib_recursive_term(i - 1		) + fib_recursive_term(i - 2		)

					if n < 0:
										raise Exception("""n is negative"""		)
					return [fib_recursive_term(lowerCAmelCase		) for i in range(n + 1		)]




def       snake_case__	(       lowerCAmelCase   :		int		):
					if n < 0:
										raise Exception("""n is negative"""		)
					# Cache must be outside recursuive function
					# other it will reset every time it calls itself.
					__snake_case          =	{0: 0, 1: 1, 2: 1}  # Prefilled cache

					def rec_fn_memoized(lowerCAmelCase   :		int		) -> int:
										if num in cache:
															return cache[num]

										__snake_case          =	rec_fn_memoized(num - 1		) + rec_fn_memoized(num - 2		)
										__snake_case          =	value
										return value

					return [rec_fn_memoized(lowerCAmelCase		) for i in range(n + 1		)]




def       snake_case__	(       lowerCAmelCase   :		int		):
					if n < 0:
										raise Exception("""n is negative"""		)
					if n >= 1_475:
										raise Exception("""n is too large"""		)
					__snake_case          =	sqrt(5		)
					__snake_case          =	(1 + sqrt_a) / 2
					return [round(phi**i / sqrt_a		) for i in range(n + 1		)]


if __name__ == "__main__":
		UpperCamelCase__ :    Optional[Any] 					=							30
		time_func(fib_iterative, num)
		time_func(fib_recursive, num)  # Around 3s runtime
		time_func(fib_recursive_cached, num)  # Around 0ms runtime
		time_func(fib_memoization, num)
		time_func(fib_binet, num)


