:py:mod:`wfexs_backend.fetchers`
================================

.. py:module:: wfexs_backend.fetchers

.. autodoc2-docstring:: wfexs_backend.fetchers
   :allowtitles:

Subpackages
-----------

.. toctree::
   :titlesonly:
   :maxdepth: 3

   wfexs_backend.fetchers.internal

Submodules
----------

.. toctree::
   :titlesonly:
   :maxdepth: 1

   wfexs_backend.fetchers.b2share
   wfexs_backend.fetchers.sftp
   wfexs_backend.fetchers.http
   wfexs_backend.fetchers.drs
   wfexs_backend.fetchers.git
   wfexs_backend.fetchers.osf_io
   wfexs_backend.fetchers.fasp
   wfexs_backend.fetchers.wiktionary
   wfexs_backend.fetchers.gs
   wfexs_backend.fetchers.s3
   wfexs_backend.fetchers.trs_files
   wfexs_backend.fetchers.file
   wfexs_backend.fetchers.doi
   wfexs_backend.fetchers.zenodo
   wfexs_backend.fetchers.pride
   wfexs_backend.fetchers.data
   wfexs_backend.fetchers.ftp
   wfexs_backend.fetchers.swh

Package Contents
----------------

Classes
~~~~~~~

.. list-table::
   :class: autosummary longtable
   :align: left

   * - :py:obj:`ProtocolFetcherReturn <wfexs_backend.fetchers.ProtocolFetcherReturn>`
     - .. autodoc2-docstring:: wfexs_backend.fetchers.ProtocolFetcherReturn
          :summary:
   * - :py:obj:`DocumentedProtocolFetcher <wfexs_backend.fetchers.DocumentedProtocolFetcher>`
     - .. autodoc2-docstring:: wfexs_backend.fetchers.DocumentedProtocolFetcher
          :summary:
   * - :py:obj:`DocumentedStatefulProtocolFetcher <wfexs_backend.fetchers.DocumentedStatefulProtocolFetcher>`
     - .. autodoc2-docstring:: wfexs_backend.fetchers.DocumentedStatefulProtocolFetcher
          :summary:
   * - :py:obj:`AbstractStatefulFetcher <wfexs_backend.fetchers.AbstractStatefulFetcher>`
     - .. autodoc2-docstring:: wfexs_backend.fetchers.AbstractStatefulFetcher
          :summary:
   * - :py:obj:`RepoType <wfexs_backend.fetchers.RepoType>`
     -
   * - :py:obj:`RepoGuessFlavor <wfexs_backend.fetchers.RepoGuessFlavor>`
     -
   * - :py:obj:`RemoteRepo <wfexs_backend.fetchers.RemoteRepo>`
     - .. autodoc2-docstring:: wfexs_backend.fetchers.RemoteRepo
          :summary:
   * - :py:obj:`AbstractRepoFetcher <wfexs_backend.fetchers.AbstractRepoFetcher>`
     -
   * - :py:obj:`AbstractStatefulStreamingFetcher <wfexs_backend.fetchers.AbstractStatefulStreamingFetcher>`
     -

Data
~~~~

.. list-table::
   :class: autosummary longtable
   :align: left

   * - :py:obj:`DEFAULT_PRIORITY <wfexs_backend.fetchers.DEFAULT_PRIORITY>`
     - .. autodoc2-docstring:: wfexs_backend.fetchers.DEFAULT_PRIORITY
          :summary:

API
~~~

.. py:class:: ProtocolFetcherReturn
   :canonical: wfexs_backend.fetchers.ProtocolFetcherReturn

   Bases: :py:obj:`typing.NamedTuple`

   .. autodoc2-docstring:: wfexs_backend.fetchers.ProtocolFetcherReturn

   .. py:attribute:: kind_or_resolved
      :canonical: wfexs_backend.fetchers.ProtocolFetcherReturn.kind_or_resolved
      :type: Union[AnyURI, ContentKind, Sequence[AnyURI]]
      :value: None

      .. autodoc2-docstring:: wfexs_backend.fetchers.ProtocolFetcherReturn.kind_or_resolved

   .. py:attribute:: metadata_array
      :canonical: wfexs_backend.fetchers.ProtocolFetcherReturn.metadata_array
      :type: Sequence[URIWithMetadata]
      :value: None

      .. autodoc2-docstring:: wfexs_backend.fetchers.ProtocolFetcherReturn.metadata_array

   .. py:attribute:: licences
      :canonical: wfexs_backend.fetchers.ProtocolFetcherReturn.licences
      :type: Optional[Tuple[URIType, ...]]
      :value: None

      .. autodoc2-docstring:: wfexs_backend.fetchers.ProtocolFetcherReturn.licences

.. py:data:: DEFAULT_PRIORITY
   :canonical: wfexs_backend.fetchers.DEFAULT_PRIORITY
   :type: Final[int]
   :value: 0

   .. autodoc2-docstring:: wfexs_backend.fetchers.DEFAULT_PRIORITY

.. py:class:: DocumentedProtocolFetcher
   :canonical: wfexs_backend.fetchers.DocumentedProtocolFetcher

   Bases: :py:obj:`typing.NamedTuple`

   .. autodoc2-docstring:: wfexs_backend.fetchers.DocumentedProtocolFetcher

   .. py:attribute:: fetcher
      :canonical: wfexs_backend.fetchers.DocumentedProtocolFetcher.fetcher
      :type: wfexs_backend.fetchers.ProtocolFetcher
      :value: None

      .. autodoc2-docstring:: wfexs_backend.fetchers.DocumentedProtocolFetcher.fetcher

   .. py:attribute:: description
      :canonical: wfexs_backend.fetchers.DocumentedProtocolFetcher.description
      :type: str
      :value: None

      .. autodoc2-docstring:: wfexs_backend.fetchers.DocumentedProtocolFetcher.description

   .. py:attribute:: priority
      :canonical: wfexs_backend.fetchers.DocumentedProtocolFetcher.priority
      :type: int
      :value: None

      .. autodoc2-docstring:: wfexs_backend.fetchers.DocumentedProtocolFetcher.priority

.. py:class:: DocumentedStatefulProtocolFetcher
   :canonical: wfexs_backend.fetchers.DocumentedStatefulProtocolFetcher

   Bases: :py:obj:`typing.NamedTuple`

   .. autodoc2-docstring:: wfexs_backend.fetchers.DocumentedStatefulProtocolFetcher

   .. py:attribute:: fetcher_class
      :canonical: wfexs_backend.fetchers.DocumentedStatefulProtocolFetcher.fetcher_class
      :type: Type[AbstractStatefulFetcher]
      :value: None

      .. autodoc2-docstring:: wfexs_backend.fetchers.DocumentedStatefulProtocolFetcher.fetcher_class

   .. py:attribute:: description
      :canonical: wfexs_backend.fetchers.DocumentedStatefulProtocolFetcher.description
      :type: Optional[str]
      :value: None

      .. autodoc2-docstring:: wfexs_backend.fetchers.DocumentedStatefulProtocolFetcher.description

   .. py:attribute:: priority
      :canonical: wfexs_backend.fetchers.DocumentedStatefulProtocolFetcher.priority
      :type: int
      :value: None

      .. autodoc2-docstring:: wfexs_backend.fetchers.DocumentedStatefulProtocolFetcher.priority

.. py:exception:: FetcherException(msg: str, code: Optional[Union[str, int]] = None, reason: Optional[str] = None)
   :canonical: wfexs_backend.fetchers.FetcherException

   Bases: :py:obj:`wfexs_backend.common.AbstractWfExSException`

   .. py:attribute:: code
      :canonical: wfexs_backend.fetchers.FetcherException.code
      :type: Optional[Union[str, int]]
      :value: None

      .. autodoc2-docstring:: wfexs_backend.fetchers.FetcherException.code

   .. py:attribute:: reason
      :canonical: wfexs_backend.fetchers.FetcherException.reason
      :type: Optional[str]
      :value: None

      .. autodoc2-docstring:: wfexs_backend.fetchers.FetcherException.reason

.. py:exception:: InvalidFetcherException(msg: str, code: Optional[Union[str, int]] = None, reason: Optional[str] = None)
   :canonical: wfexs_backend.fetchers.InvalidFetcherException

   Bases: :py:obj:`wfexs_backend.fetchers.FetcherException`

.. py:exception:: FetcherInstanceException(msg: str, code: Optional[Union[str, int]] = None, reason: Optional[str] = None)
   :canonical: wfexs_backend.fetchers.FetcherInstanceException

   Bases: :py:obj:`wfexs_backend.fetchers.FetcherException`

.. py:class:: AbstractStatefulFetcher(progs: wfexs_backend.common.ProgsMapping = dict(), setup_block: Optional[Mapping[str, Any]] = None)
   :canonical: wfexs_backend.fetchers.AbstractStatefulFetcher

   Bases: :py:obj:`abc.ABC`

   .. autodoc2-docstring:: wfexs_backend.fetchers.AbstractStatefulFetcher

   .. rubric:: Initialization

   .. autodoc2-docstring:: wfexs_backend.fetchers.AbstractStatefulFetcher.__init__

   .. py:attribute:: PRIORITY
      :canonical: wfexs_backend.fetchers.AbstractStatefulFetcher.PRIORITY
      :type: ClassVar[int]
      :value: None

      .. autodoc2-docstring:: wfexs_backend.fetchers.AbstractStatefulFetcher.PRIORITY

   .. py:attribute:: ENABLED
      :canonical: wfexs_backend.fetchers.AbstractStatefulFetcher.ENABLED
      :type: ClassVar[bool]
      :value: True

      .. autodoc2-docstring:: wfexs_backend.fetchers.AbstractStatefulFetcher.ENABLED

   .. py:method:: fetch(remote_file: wfexs_backend.common.URIType, cachedFilename: wfexs_backend.common.PathLikePath, secContext: Optional[SecurityContextConfig] = None) -> wfexs_backend.fetchers.ProtocolFetcherReturn
      :canonical: wfexs_backend.fetchers.AbstractStatefulFetcher.fetch
      :abstractmethod:

      .. autodoc2-docstring:: wfexs_backend.fetchers.AbstractStatefulFetcher.fetch

   .. py:property:: description
      :canonical: wfexs_backend.fetchers.AbstractStatefulFetcher.description
      :abstractmethod:
      :type: str

      .. autodoc2-docstring:: wfexs_backend.fetchers.AbstractStatefulFetcher.description

   .. py:method:: GetSchemeHandlers() -> Mapping[str, DocumentedStatefulProtocolFetcher]
      :canonical: wfexs_backend.fetchers.AbstractStatefulFetcher.GetSchemeHandlers
      :abstractmethod:
      :classmethod:

      .. autodoc2-docstring:: wfexs_backend.fetchers.AbstractStatefulFetcher.GetSchemeHandlers

   .. py:method:: GetNeededPrograms() -> Sequence[SymbolicName]
      :canonical: wfexs_backend.fetchers.AbstractStatefulFetcher.GetNeededPrograms
      :abstractmethod:
      :classmethod:

      .. autodoc2-docstring:: wfexs_backend.fetchers.AbstractStatefulFetcher.GetNeededPrograms

   .. py:method:: ParseAndRemoveCredentials(remote_file: wfexs_backend.common.URIType) -> Tuple[parse.ParseResult, URIType]
      :canonical: wfexs_backend.fetchers.AbstractStatefulFetcher.ParseAndRemoveCredentials
      :staticmethod:

      .. autodoc2-docstring:: wfexs_backend.fetchers.AbstractStatefulFetcher.ParseAndRemoveCredentials

.. py:exception:: RepoGuessException(msg: str, code: Optional[Union[str, int]] = None, reason: Optional[str] = None)
   :canonical: wfexs_backend.fetchers.RepoGuessException

   Bases: :py:obj:`wfexs_backend.fetchers.FetcherException`

.. py:class:: RepoType(*args, **kwds)
   :canonical: wfexs_backend.fetchers.RepoType

   Bases: :py:obj:`enum.Enum`

   .. py:attribute:: Git
      :canonical: wfexs_backend.fetchers.RepoType.Git
      :value: 'git'

      .. autodoc2-docstring:: wfexs_backend.fetchers.RepoType.Git

   .. py:attribute:: Raw
      :canonical: wfexs_backend.fetchers.RepoType.Raw
      :value: 'raw'

      .. autodoc2-docstring:: wfexs_backend.fetchers.RepoType.Raw

   .. py:attribute:: Other
      :canonical: wfexs_backend.fetchers.RepoType.Other
      :value: 'other'

      .. autodoc2-docstring:: wfexs_backend.fetchers.RepoType.Other

   .. py:attribute:: SoftwareHeritage
      :canonical: wfexs_backend.fetchers.RepoType.SoftwareHeritage
      :value: 'swh'

      .. autodoc2-docstring:: wfexs_backend.fetchers.RepoType.SoftwareHeritage

   .. py:attribute:: TRS
      :canonical: wfexs_backend.fetchers.RepoType.TRS
      :value: 'trs'

      .. autodoc2-docstring:: wfexs_backend.fetchers.RepoType.TRS

   .. py:method:: _undeprecate_table() -> Mapping[str, str]
      :canonical: wfexs_backend.fetchers.RepoType._undeprecate_table
      :classmethod:

      .. autodoc2-docstring:: wfexs_backend.fetchers.RepoType._undeprecate_table

.. py:class:: RepoGuessFlavor(*args, **kwds)
   :canonical: wfexs_backend.fetchers.RepoGuessFlavor

   Bases: :py:obj:`enum.Enum`

   .. py:attribute:: GitHub
      :canonical: wfexs_backend.fetchers.RepoGuessFlavor.GitHub
      :value: 'github'

      .. autodoc2-docstring:: wfexs_backend.fetchers.RepoGuessFlavor.GitHub

   .. py:attribute:: GitLab
      :canonical: wfexs_backend.fetchers.RepoGuessFlavor.GitLab
      :value: 'gitlab'

      .. autodoc2-docstring:: wfexs_backend.fetchers.RepoGuessFlavor.GitLab

   .. py:attribute:: BitBucket
      :canonical: wfexs_backend.fetchers.RepoGuessFlavor.BitBucket
      :value: 'bitbucket'

      .. autodoc2-docstring:: wfexs_backend.fetchers.RepoGuessFlavor.BitBucket

.. py:class:: RemoteRepo
   :canonical: wfexs_backend.fetchers.RemoteRepo

   Bases: :py:obj:`typing.NamedTuple`

   .. autodoc2-docstring:: wfexs_backend.fetchers.RemoteRepo

   .. py:attribute:: repo_url
      :canonical: wfexs_backend.fetchers.RemoteRepo.repo_url
      :type: wfexs_backend.common.RepoURL
      :value: None

      .. autodoc2-docstring:: wfexs_backend.fetchers.RemoteRepo.repo_url

   .. py:attribute:: tag
      :canonical: wfexs_backend.fetchers.RemoteRepo.tag
      :type: Optional[RepoTag]
      :value: None

      .. autodoc2-docstring:: wfexs_backend.fetchers.RemoteRepo.tag

   .. py:attribute:: rel_path
      :canonical: wfexs_backend.fetchers.RemoteRepo.rel_path
      :type: Optional[RelPath]
      :value: None

      .. autodoc2-docstring:: wfexs_backend.fetchers.RemoteRepo.rel_path

   .. py:attribute:: repo_type
      :canonical: wfexs_backend.fetchers.RemoteRepo.repo_type
      :type: Optional[RepoType]
      :value: None

      .. autodoc2-docstring:: wfexs_backend.fetchers.RemoteRepo.repo_type

   .. py:attribute:: web_url
      :canonical: wfexs_backend.fetchers.RemoteRepo.web_url
      :type: Optional[URIType]
      :value: None

      .. autodoc2-docstring:: wfexs_backend.fetchers.RemoteRepo.web_url

   .. py:attribute:: guess_flavor
      :canonical: wfexs_backend.fetchers.RemoteRepo.guess_flavor
      :type: Optional[RepoGuessFlavor]
      :value: None

      .. autodoc2-docstring:: wfexs_backend.fetchers.RemoteRepo.guess_flavor

   .. py:attribute:: checkout
      :canonical: wfexs_backend.fetchers.RemoteRepo.checkout
      :type: Optional[RepoTag]
      :value: None

      .. autodoc2-docstring:: wfexs_backend.fetchers.RemoteRepo.checkout

   .. py:method:: gen_repo_desc() -> Optional[RepoDesc]
      :canonical: wfexs_backend.fetchers.RemoteRepo.gen_repo_desc

      .. autodoc2-docstring:: wfexs_backend.fetchers.RemoteRepo.gen_repo_desc

   .. py:method:: get_checkout() -> wfexs_backend.common.RepoTag
      :canonical: wfexs_backend.fetchers.RemoteRepo.get_checkout

      .. autodoc2-docstring:: wfexs_backend.fetchers.RemoteRepo.get_checkout

.. py:class:: AbstractRepoFetcher(progs: wfexs_backend.common.ProgsMapping = dict(), setup_block: Optional[Mapping[str, Any]] = None)
   :canonical: wfexs_backend.fetchers.AbstractRepoFetcher

   Bases: :py:obj:`wfexs_backend.fetchers.AbstractStatefulFetcher`

   .. py:attribute:: PRIORITY
      :canonical: wfexs_backend.fetchers.AbstractRepoFetcher.PRIORITY
      :type: ClassVar[int]
      :value: None

      .. autodoc2-docstring:: wfexs_backend.fetchers.AbstractRepoFetcher.PRIORITY

   .. py:method:: materialize_repo(repoURL: wfexs_backend.common.RepoURL, repoTag: Optional[RepoTag] = None, repo_tag_destdir: Optional[PathLikePath] = None, base_repo_destdir: Optional[PathLikePath] = None, doUpdate: Optional[bool] = True) -> Tuple[pathlib.Path, RemoteRepo, Sequence[URIWithMetadata]]
      :canonical: wfexs_backend.fetchers.AbstractRepoFetcher.materialize_repo
      :abstractmethod:

      .. autodoc2-docstring:: wfexs_backend.fetchers.AbstractRepoFetcher.materialize_repo

   .. py:method:: build_pid_from_repo(remote_repo: wfexs_backend.fetchers.RemoteRepo) -> Optional[str]
      :canonical: wfexs_backend.fetchers.AbstractRepoFetcher.build_pid_from_repo
      :abstractmethod:

      .. autodoc2-docstring:: wfexs_backend.fetchers.AbstractRepoFetcher.build_pid_from_repo

   .. py:method:: GuessRepoParams(orig_wf_url: Union[URIType, parse.ParseResult], logger: Optional[logging.Logger] = None, fail_ok: bool = False) -> Optional[RemoteRepo]
      :canonical: wfexs_backend.fetchers.AbstractRepoFetcher.GuessRepoParams
      :abstractmethod:
      :classmethod:

      .. autodoc2-docstring:: wfexs_backend.fetchers.AbstractRepoFetcher.GuessRepoParams

.. py:class:: AbstractStatefulStreamingFetcher(progs: wfexs_backend.common.ProgsMapping = dict(), setup_block: Optional[Mapping[str, Any]] = None)
   :canonical: wfexs_backend.fetchers.AbstractStatefulStreamingFetcher

   Bases: :py:obj:`wfexs_backend.fetchers.AbstractStatefulFetcher`

   .. py:method:: fetch(remote_file: wfexs_backend.common.URIType, cachedFilename: wfexs_backend.common.PathLikePath, secContext: Optional[SecurityContextConfig] = None) -> wfexs_backend.fetchers.ProtocolFetcherReturn
      :canonical: wfexs_backend.fetchers.AbstractStatefulStreamingFetcher.fetch

   .. py:method:: streamfetch(remote_file: wfexs_backend.common.URIType, dest_stream: IO[bytes], secContext: Optional[SecurityContextConfig] = None) -> wfexs_backend.fetchers.ProtocolFetcherReturn
      :canonical: wfexs_backend.fetchers.AbstractStatefulStreamingFetcher.streamfetch
      :abstractmethod:

      .. autodoc2-docstring:: wfexs_backend.fetchers.AbstractStatefulStreamingFetcher.streamfetch
