Rewrite docstrings to explain things more clearly
This commit is contained in:
parent
fcc406bda7
commit
5c42f2b53f
@ -1,7 +1,7 @@
|
|||||||
"""
|
"""
|
||||||
.. moduleauthor:: Eric Torres
|
.. moduleauthor:: Eric Torres
|
||||||
.. module:: rbackup.struct.hierarchy
|
.. module:: rbackup.struct.hierarchy
|
||||||
:synopsis: Classes for creating the backup hierarchy.
|
:synopsis: Related functionality for creating the backup hierarchy.
|
||||||
"""
|
"""
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
@ -27,14 +27,14 @@ class Hierarchy(PathLike):
|
|||||||
|
|
||||||
**Implementation Details**
|
**Implementation Details**
|
||||||
|
|
||||||
* For consistency, ``Hierarchy`` objects always store and return absolute paths
|
* Data for all ``Hierarchy`` objects and subclassed objects use ``JSON`` for serialization
|
||||||
* Data for all ``Hierarchy`` objects and subclassed objects use JSON for serialization
|
|
||||||
* ``Hierarchy`` objects create their directories upon instantiation
|
* ``Hierarchy`` objects create their directories upon instantiation
|
||||||
* This may result in a ``PermissionError``
|
|
||||||
|
* Reading metadata without the proper permissions may result in a ``PermissionError``
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, dest):
|
def __init__(self, dest):
|
||||||
"""Default constructor for the Hierarchy class.
|
"""Default constructor for the ``Hierarchy`` class.
|
||||||
|
|
||||||
:param dest: the root directory of the backup hierarchy
|
:param dest: the root directory of the backup hierarchy
|
||||||
:type dest: str or path-like object
|
:type dest: str or path-like object
|
||||||
@ -53,6 +53,7 @@ class Hierarchy(PathLike):
|
|||||||
return str(self._path)
|
return str(self._path)
|
||||||
|
|
||||||
def __hash__(self):
|
def __hash__(self):
|
||||||
|
# We want to use this Hierarchy's path because it never changes
|
||||||
return hash(self._path)
|
return hash(self._path)
|
||||||
|
|
||||||
def __ne__(self, other):
|
def __ne__(self, other):
|
||||||
@ -125,7 +126,7 @@ class Hierarchy(PathLike):
|
|||||||
def write_metadata(self, attr):
|
def write_metadata(self, attr):
|
||||||
"""Write this repository's metadata to its metadata file.
|
"""Write this repository's metadata to its metadata file.
|
||||||
|
|
||||||
.. note:: This write operation is atomic to the caller.
|
.. note:: This write operation is atomic from the perspective of the caller
|
||||||
|
|
||||||
:param attr: class data to write to file
|
:param attr: class data to write to file
|
||||||
:type attr: any type
|
:type attr: any type
|
||||||
|
Loading…
x
Reference in New Issue
Block a user