original_docstring: 
      Locate the repository directory from a template reference. This is the main parser
      for determining the source of the context and calls the succeeding parsing
      functions. The parsing order has the following order of precedence.
  
      If the template wasn't given then use the file in that parent directory.
      If the template refers to a zip file or zip url, download / unzip as the context.
      If the template refers to a repository URL, clone it.
      If the template refers to a file, use that as the context.
      
docstring: Locate the repository directory from a template reference. This is the main parser
  for determining the source of the context and calls the succeeding parsing
  functions. The parsing order has the following order of precedence.
  
  If the template wasn't given then use the file in that parent directory.
  If the template refers to a zip file or zip url, download / unzip as the context.
  If the template refers to a repository URL, clone it.
  If the template refers to a file, use that as the context.
docstring_tokens: Locate the repository directory from a template reference . This is the main parser for determining the source of the context and calls the succeeding parsing functions . The parsing order has the following order of precedence . If the template wasn ' t given then use the file in that parent directory . If the template refers to a zip file or zip url download / unzip as the context . If the template refers to a repository URL clone it . If the template refers to a file use that as the context .
code: def update_source(context: 'Context'):
      """
      Locate the repository directory from a template reference. This is the main parser
      for determining the source of the context and calls the succeeding parsing
      functions. The parsing order has the following order of precedence.
  
      If the template wasn't given then use the file in that parent directory.
      If the template refers to a zip file or zip url, download / unzip as the context.
      If the template refers to a repository URL, clone it.
      If the template refers to a file, use that as the context.
      """
      args, kwargs, flags = unpack_args_kwargs_string(context.input_string)
  
      first_arg = args[0]
      # Remove first args it will be consumed and no longer relevant
      args.pop(0)
  
      # Zipfile
      if first_arg.lower().endswith('.zip'):
          unzipped_dir = unzip(
              zip_uri=first_arg,
              clone_to_dir=settings.tackle_dir,
              no_input=context.no_input,
              password=context.password,  # TODO: RM - Should prompt?
          )
          import_local_provider_source(context, unzipped_dir)
      # Repo
      elif is_repo_url(first_arg):
          provider_dir = get_repo_source(first_arg, context.version)
          import_local_provider_source(context, provider_dir)
      # Directory
      elif is_directory_with_tackle(first_arg):
          # Special case where the input is a path to a directory. Need to override some
          # settings that would normally get populated by zip / repo refs
          context.input_file = os.path.basename(find_tackle_file(first_arg))
          context.input_dir = Path(first_arg).absolute()
  
          # Load the base file into input_dict
          extract_base_file(context)
      # File
      elif is_file(first_arg):
          context.input_file = os.path.basename(first_arg)
          context.input_dir = Path(first_arg).parent.absolute()
          extract_base_file(context)
      # Search in parent
      else:
          # Lastly we check if there is a key in the parent that matches the arg. This is
          # basically the fallback logic but need to raise error right away if the key
          # does not exist so we don't have to catch it with context later.
          tackle_file = find_nearest_tackle_file()
          if tackle_file is None:
              raise UnknownSourceException(f"Could not find source = {first_arg}")
  
          context.input_file = os.path.basename(tackle_file)
          context.input_dir = Path(tackle_file).parent.absolute()
          extract_base_file(context)
  
          if first_arg not in context.input_dict:
              raise UnknownSourceException(
                  f"Could not find source = {first_arg} or as "
                  f"key in parent tackle file."
              )
          args.insert(0, first_arg)
  
      context.calling_directory = Path('.').absolute()
  
      # We always change directory into the source that is being called. Needs to be this
      # or would be very confusing if writing a provider to always refer to it's own path.
      with work_in(context.input_dir):
          # Main parsing logic
          run_source(context, args, kwargs, flags)
code_tokens: def update_source ( context : 'Context' ) : args , kwargs , flags = unpack_args_kwargs_string ( context . input_string ) first_arg = args [ 0 ] args . pop ( 0 ) if first_arg . lower ( ) . endswith ( '.zip' ) : unzipped_dir = unzip ( zip_uri = first_arg , clone_to_dir = settings . tackle_dir , no_input = context . no_input , password = context . password , ) import_local_provider_source ( context , unzipped_dir ) elif is_repo_url ( first_arg ) : provider_dir = get_repo_source ( first_arg , context . version ) import_local_provider_source ( context , provider_dir ) elif is_directory_with_tackle ( first_arg ) : context . input_file = os . path . basename ( find_tackle_file ( first_arg ) ) context . input_dir = Path ( first_arg ) . absolute ( ) extract_base_file ( context ) elif is_file ( first_arg ) : context . input_file = os . path . basename ( first_arg ) context . input_dir = Path ( first_arg ) . parent . absolute ( ) extract_base_file ( context ) else : tackle_file = find_nearest_tackle_file ( ) if tackle_file is None : raise UnknownSourceException ( f"Could not find source = {first_arg}" ) context . input_file = os . path . basename ( tackle_file ) context . input_dir = Path ( tackle_file ) . parent . absolute ( ) extract_base_file ( context ) if first_arg not in context . input_dict : raise UnknownSourceException ( f"Could not find source = {first_arg} or as " f"key in parent tackle file." ) args . insert ( 0 , first_arg ) context . calling_directory = Path ( '.' ) . absolute ( ) with work_in ( context . input_dir ) : run_source ( context , args , kwargs , flags )
short_docstring: Locate the repository directory from a template reference.
short_docstring_tokens: Locate the repository directory from a template reference .
comment: """
      Locate the repository directory from a template reference. This is the main parser
      for determining the source of the context and calls the succeeding parsing
      functions. The parsing order has the following order of precedence.
  
      If the template wasn't given then use the file in that parent directory.
      If the template refers to a zip file or zip url, download / unzip as the context.
      If the template refers to a repository URL, clone it.
      If the template refers to a file, use that as the context.
      """$SEP$# Remove first args it will be consumed and no longer relevant$SEP$# Zipfile$SEP$# TODO: RM - Should prompt?$SEP$# Repo$SEP$# Directory$SEP$# Special case where the input is a path to a directory. Need to override some$SEP$# settings that would normally get populated by zip / repo refs$SEP$# Load the base file into input_dict$SEP$# File$SEP$# Search in parent$SEP$# Lastly we check if there is a key in the parent that matches the arg. This is$SEP$# basically the fallback logic but need to raise error right away if the key$SEP$# does not exist so we don't have to catch it with context later.$SEP$# We always change directory into the source that is being called. Needs to be this$SEP$# or would be very confusing if writing a provider to always refer to it's own path.$SEP$# Main parsing logic