code: 
  
  
  
  '''simple docstring'''
  
  
  
  import functools
  from math import sqrt
  from time import time
  
  
  
  
  
  
  
  def _lowercase   (  __A							,*__A							,**__A       ):
  
  
  
   '''simple docstring'''
  
  
  
   __UpperCamelCase				      =  time()
   __UpperCamelCase				      =  func(*__A							,**__A       )
   __UpperCamelCase				      =  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 _lowercase   (  __A       ):
  
  
  
   '''simple docstring'''
  
  
  
   if n < 0:
    raise Exception("""n is negative"""       )
   if n == 0:
    return [0]
   __UpperCamelCase				      =  [0, 1]
   for _ in range(n - 1       ):
    fib.append(fib[-1] + fib[-2]       )
   return fib
  
  
  
  
  
  
  
  def _lowercase   (  __A       ):
  
  
  
   '''simple docstring'''
  
  
  
   def fib_recursive_term(__A       ) -> 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(__A       ) for i in range(n + 1       )]
  
  
  
  
  
  
  
  def _lowercase   (  __A       ):
  
  
  
   '''simple docstring'''
  
  
  
   @functools.cache
   def fib_recursive_term(__A       ) -> 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(__A       ) for i in range(n + 1       )]
  
  
  
  
  
  
  
  def _lowercase   (  __A       ):
  
  
  
   '''simple docstring'''
  
  
  
   if n < 0:
    raise Exception("""n is negative"""       )
   # Cache must be outside recursuive function
   # other it will reset every time it calls itself.
   __UpperCamelCase				      =  {0: 0, 1: 1, 2: 1}  # Prefilled cache
  
   def rec_fn_memoized(__A       ) -> int:
    if num in cache:
     return cache[num]
  
    __UpperCamelCase				      =  rec_fn_memoized(num - 1       ) + rec_fn_memoized(num - 2       )
    __UpperCamelCase				      =  value
    return value
  
   return [rec_fn_memoized(__A       ) for i in range(n + 1       )]
  
  
  
  
  
  
  
  def _lowercase   (  __A       ):
  
  
  
   '''simple docstring'''
  
  
  
   if n < 0:
    raise Exception("""n is negative"""       )
   if n >= 1_475:
    raise Exception("""n is too large"""       )
   __UpperCamelCase				      =  sqrt(5       )
   __UpperCamelCase				      =  (1 + sqrt_a) / 2
   return [round(phi**i / sqrt_a       ) for i in range(n + 1       )]
  
  
  if __name__ == "__main__":
   a__						:			Optional[Any]										=			3_0
   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)
  
  
  
  
  
  
style_context: 
  
  
  
  '''simple docstring'''
  
  
  
  import textwrap
  
  import pyarrow as pa
  import pytest
  
  from datasets import Features, Image
  from datasets.packaged_modules.text.text import Text
  
  from ..utils import require_pil
  
  
  
  
  
  
  
  @pytest.fixture
  def _lowercase   (  __A       ):
  
  
  
   '''simple docstring'''
  
  
  
   __UpperCamelCase				      =  tmp_path / """text.txt"""
   __UpperCamelCase				      =  textwrap.dedent(
       """\
          Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
          Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
          Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
          Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
  
          Second paragraph:
          Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
          Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
          Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
          Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
          """       )
   with open(__A							,"""w"""							,encoding="""utf-8"""       ) as f:
    f.write(__A       )
   return str(__A       )
  
  
  
  
  
  
  
  @pytest.fixture
  def _lowercase   (  __A							,__A       ):
  
  
  
   '''simple docstring'''
  
  
  
   __UpperCamelCase				      =  tmp_path / """text_with_image.txt"""
   with open(__A							,"""w"""							,encoding="""utf-8"""       ) as f:
    f.write(__A       )
   return str(__A       )
  
  
  
  
  
  
  
  @pytest.mark.parametrize("""keep_linebreaks"""							,[True, False]       )
  def _lowercase   (  __A							,__A       ):
  
  
  
   '''simple docstring'''
  
  
  
   with open(__A							,encoding="""utf-8"""       ) as f:
    __UpperCamelCase				      =  f.read().splitlines(keepends=__A       )
   __UpperCamelCase				      =  Text(keep_linebreaks=__A							,encoding="""utf-8"""       )
   __UpperCamelCase				      =  text._generate_tables([[text_file]]       )
   __UpperCamelCase				      =  pa.concat_tables([table for _, table in generator]       ).to_pydict()["""text"""]
   assert generated_content == expected_content
  
  
  
  
  
  
  
  @require_pil
  def _lowercase   (  __A       ):
  
  
  
   '''simple docstring'''
  
  
  
   with open(__A							,encoding="""utf-8"""       ) as f:
    __UpperCamelCase				      =  f.read().splitlines()[0]
   __UpperCamelCase				      =  Text(encoding="""utf-8"""							,features=Features({"""image""": Image()}       )       )
   __UpperCamelCase				      =  text._generate_tables([[text_file_with_image]]       )
   __UpperCamelCase				      =  pa.concat_tables([table for _, table in generator]       )
   assert pa_table.schema.field("""image"""       ).type == Image()()
   __UpperCamelCase				      =  pa_table.to_pydict()["""image"""]
   assert generated_content == [{"path": image_file, "bytes": None}]
  
  
  
  
  
  
  
  @pytest.mark.parametrize("""sample_by"""							,["""line""", """paragraph""", """document"""]       )
  def _lowercase   (  __A							,__A       ):
  
  
  
   '''simple docstring'''
  
  
  
   with open(__A							,encoding="""utf-8"""       ) as f:
    __UpperCamelCase				      =  f.read()
   if sample_by == "line":
    __UpperCamelCase				      =  expected_content.splitlines()
   elif sample_by == "paragraph":
    __UpperCamelCase				      =  expected_content.split("""\n\n"""       )
   elif sample_by == "document":
    __UpperCamelCase				      =  [expected_content]
   __UpperCamelCase				      =  Text(sample_by=__A							,encoding="""utf-8"""							,chunksize=100       )
   __UpperCamelCase				      =  text._generate_tables([[text_file]]       )
   __UpperCamelCase				      =  pa.concat_tables([table for _, table in generator]       ).to_pydict()["""text"""]
   assert generated_content == expected_content
  
  
  
  
  
  