





'''simple docstring'''


from packaging import version

from .import_utils import is_accelerate_available


if is_accelerate_available():
 import accelerate
def 							UpperCAmelCase_  (						__lowerCamelCase : Dict			):
   if not is_accelerate_available():
      return method
   lowercase_      :Optional[int]         =			version.parse(accelerate.__version__			).base_version
   if version.parse(__lowerCamelCase			) < version.parse("0.17.0"			):
      return method

   def wrapper(self : Optional[int]     ,*__lowerCamelCase : str     ,**__lowerCamelCase : Optional[Any]			):
      if hasattr(self     ,"_hf_hook"			) and hasattr(self._hf_hook     ,"pre_forward"			):
         self._hf_hook.pre_forward(self			)
      return method(self     ,*__lowerCamelCase     ,**__lowerCamelCase			)

   return wrapper









'''simple docstring'''


def 							UpperCAmelCase_  (						__lowerCamelCase : str     ,__lowerCamelCase : str			):
   lowercase_      :Optional[Any]         =			len(__lowerCamelCase			)
   lowercase_      :List[Any]         =			[]
   for i in range(len(__lowerCamelCase			) - pat_len + 1			):
      lowercase_      :Dict         =			True
      for j in range(__lowerCamelCase			):
         if s[i + j] != pattern[j]:
            lowercase_      :int         =			False
            break
      if match_found:
         position.append(__lowerCamelCase			)
   return position


if __name__ == "__main__":
 assert naive_pattern_search('''ABCDEFG''', '''DE''') == [3]
 print(naive_pattern_search('''ABAAABCDBBABCDDEBCABC''', '''ABC'''))


