docstr: Apply the defined default remote provider to the given path and return the updated _IOFile.
  Asserts that default remote provider is defined.
docstr_tok: ["Apply","the","defined","default","remote","provider","to","the","given","path","and","return","the","updated","_IOFile",".","Asserts","that","default","remote","provider","is","defined","."]
code: def apply_default_storage(self, path):
      """Apply the defined default remote provider to the given path and return the updated _IOFile.
      Asserts that default remote provider is defined.
      """
      from snakemake.storage import flag_with_storage_object
  
      def is_annotated_callable(value):
          if isinstance(value, AnnotatedString):
              return bool(value.callable)
  
      provider = self.workflow.storage_settings.default_storage_provider
  
      if (
          provider is None
          or is_flagged(path, "storage_object")
          or is_flagged(path, "local")
          or is_flagged(path, "sourcecache_entry")
          or is_annotated_callable(path)
      ):
          # no default remote needed
          return path
  
      # This will convert any AnnotatedString to str
      prefix = self.workflow.storage_settings.default_storage_prefix
      if prefix and not prefix.endswith("/"):
          prefix = f"{prefix}/"
      query = f"{prefix}{os.path.normpath(path)}"
      storage_object = self.workflow.storage_registry.default_storage_provider.object(
          query
      )
      validation_res = storage_object.is_valid_query()
      if not validation_res:
          raise WorkflowError(
              f"Error applying default storage provider {provider}. "
              "Make sure to provide a valid --default-storage-prefix "
              "(see https://snakemake.github.io/snakemake-plugin-catalog/plugins/"
              "storage/{provider}.html). {validation_res}",
          )
      return flag_with_storage_object(path, storage_object)
  
file_path: snakemake/snakemake/path_modifier.py
imports: import os
  from snakemake.exceptions import WorkflowError
  from snakemake.io import is_callable, is_flagged, AnnotatedString, flag, get_flag_value
label_desc: Use image node_id 4 for calling the PathModifier obj's underlying member method code with example usage: obj.apply_default_storage(path) and returns: flag_with_storage_object, path, bool