diff --git a/docs/README.rst b/docs/README.rst --- a/docs/README.rst +++ b/docs/README.rst @@ -1,5 +1,3 @@ -.. _swh-loader-core: - Software Heritage - Loader foundations ====================================== diff --git a/docs/index.rst b/docs/index.rst --- a/docs/index.rst +++ b/docs/index.rst @@ -1,3 +1,5 @@ +.. _swh-loader-core: + .. include:: README.rst .. toctree:: @@ -16,3 +18,4 @@ cli /apidoc/swh.loader.core + /apidoc/swh.loader.package diff --git a/docs/package-loader-tutorial.rst b/docs/package-loader-tutorial.rst --- a/docs/package-loader-tutorial.rst +++ b/docs/package-loader-tutorial.rst @@ -71,7 +71,7 @@ We now have to fill some of the methods declared by -:ref:class:`swh.loader.package.PackageLoader`: in your new ``NewLoader`` class. +:class:`swh.loader.package.PackageLoader`: in your new ``NewLoader`` class. Listing versions @@ -599,7 +599,7 @@ This is done by adding them to the ``directory_extrinsic_metadata`` attribute of your ``NewPackageInfo`` object when creating it in ``get_package_info`` -as :py:cls:`swh.loader.package.loader.RawExtrinsicMetadataCore` objects:: +as :class:`swh.loader.package.loader.RawExtrinsicMetadataCore` objects:: NewPackageInfo( ..., @@ -615,7 +615,7 @@ ``format`` should be a human-readable ASCII string that unambiguously describes the format. Readers of the metadata object will have a built-in list of formats they understand, and will check if your metadata object is among them. -You should use one of the :ref:`known metadata formats ` +You should use one of the :ref:`known metadata formats ` if possible, or add yours to this list. ``metadata`` is the metadata object itself. When possible, it should be copied verbatim diff --git a/docs/vcs-loader-overview.rst b/docs/vcs-loader-overview.rst --- a/docs/vcs-loader-overview.rst +++ b/docs/vcs-loader-overview.rst @@ -90,7 +90,7 @@ Incremental loading ------------------- +------------------- Loading a repository from scratch can be costly, so ``swh-storage`` provides ways to remember what objects in the repository were already loaded, diff --git a/swh/loader/core/loader.py b/swh/loader/core/loader.py --- a/swh/loader/core/loader.py +++ b/swh/loader/core/loader.py @@ -55,6 +55,11 @@ """ + visit_date: Optional[datetime.datetime] + origin: Optional[Origin] + origin_metadata: Dict[str, Any] + loaded_snapshot_id: Optional[Sha1Git] + def __init__( self, storage: StorageInterface, @@ -77,14 +82,14 @@ _log.setLevel(logging.WARN) # possibly overridden in self.prepare method - self.visit_date: Optional[datetime.datetime] = None - self.origin: Optional[Origin] = None + self.visit_date = None + self.origin = None if not hasattr(self, "visit_type"): self.visit_type: Optional[str] = None - self.origin_metadata: Dict[str, Any] = {} - self.loaded_snapshot_id: Optional[Sha1Git] = None + self.origin_metadata = {} + self.loaded_snapshot_id = None if save_data_path: path = save_data_path diff --git a/swh/loader/core/utils.py b/swh/loader/core/utils.py --- a/swh/loader/core/utils.py +++ b/swh/loader/core/utils.py @@ -18,9 +18,9 @@ Args: dirpath (str): Path to check for dangling files pattern_check (str): A dedicated pattern to check on first - level directory (e.g `swh.loader.mercurial.`, - `swh.loader.svn.`) - log (Logger): Optional logger + level directory (e.g `swh.loader.mercurial.`, + `swh.loader.svn.`) + log (Logger): Optional logger """ if not os.path.exists(dirpath): diff --git a/swh/loader/package/loader.py b/swh/loader/package/loader.py --- a/swh/loader/package/loader.py +++ b/swh/loader/package/loader.py @@ -75,7 +75,7 @@ PartialExtID = Tuple[str, bytes] -"""The ``extid_type`` and ``extid`` fields of an :ref:py:`ExtID` object.""" +"""The ``extid_type`` and ``extid`` fields of an :class:`ExtID` object.""" @attr.s @@ -170,7 +170,7 @@ """Return the list of all published package versions. Raises: - `class:swh.loader.exception.NotFound` error when failing to read the + class:`swh.loader.exception.NotFound` error when failing to read the published package versions. Returns: