Docstring changes
This commit is contained in:
parent
200962ac29
commit
9372f158c2
@ -43,8 +43,6 @@ def merge_files(files):
|
|||||||
"""Parse, filter, and sort through config files to create a single
|
"""Parse, filter, and sort through config files to create a single
|
||||||
--files-from argument.
|
--files-from argument.
|
||||||
|
|
||||||
Any files included that do not exist send a warning to the log.
|
|
||||||
|
|
||||||
>>> merge_files(get_files_by_suffix('-include.conf')) # doctest: +ELLIPSIS
|
>>> merge_files(get_files_by_suffix('-include.conf')) # doctest: +ELLIPSIS
|
||||||
PosixPath('/tmp/...')
|
PosixPath('/tmp/...')
|
||||||
|
|
||||||
|
@ -19,13 +19,17 @@ METADATA_WRITE = "w"
|
|||||||
|
|
||||||
# ========== Classes ==========
|
# ========== Classes ==========
|
||||||
class Hierarchy(PathLike):
|
class Hierarchy(PathLike):
|
||||||
"""A class for organizing the backup root hierarchy.
|
"""A general class for organizing a hierarchy of data.
|
||||||
|
|
||||||
Upon creation of a Hierarchy object, it is up to the caller
|
Hierarchy objects are non-intrusive in that they do not affect
|
||||||
to call either :func:`shutil.mkdir` or a related method to create
|
the filesystem upon creation. It is up to the caller
|
||||||
|
to call either :func:`shutil.mkdir` or related method to create
|
||||||
the directory structure it emulates.
|
the directory structure it emulates.
|
||||||
|
|
||||||
For consistency, ``Hierarchy`` objects always store and return absolute paths.
|
Implementation Details
|
||||||
|
|
||||||
|
* For consistency, ``Hierarchy`` objects always store and return absolute paths
|
||||||
|
* Data for all ``Hierarchy`` objects and subclassed objects use JSON for serialization
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, dest):
|
def __init__(self, dest):
|
||||||
@ -89,7 +93,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 to 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
|
||||||
|
@ -2,6 +2,16 @@
|
|||||||
.. moduleauthor:: Eric Torres
|
.. moduleauthor:: Eric Torres
|
||||||
.. module:: rbackup.struct.repository
|
.. module:: rbackup.struct.repository
|
||||||
:synopsis: Classes for structuring a backup repository.
|
:synopsis: Classes for structuring a backup repository.
|
||||||
|
|
||||||
|
A repository is a directory that contains backup data
|
||||||
|
sequestered into snapshots and a symlink to the most
|
||||||
|
recently created snapshot.
|
||||||
|
|
||||||
|
Properties
|
||||||
|
|
||||||
|
* Each snapshot in a repository is unaware of one another,
|
||||||
|
this is the job of the repository to organize
|
||||||
|
* Has a symlink pointing to the most recently created snapshot
|
||||||
"""
|
"""
|
||||||
import datetime
|
import datetime
|
||||||
import logging
|
import logging
|
||||||
@ -26,17 +36,6 @@ VALID_SNAPSHOT_NAME = r"[\w._+-]+[^/]*"
|
|||||||
class Repository(Hierarchy):
|
class Repository(Hierarchy):
|
||||||
"""A class for interacting with a backup repository.
|
"""A class for interacting with a backup repository.
|
||||||
|
|
||||||
Repository is a mutable, stateful class for representing a
|
|
||||||
directory that contains backup data sequestered into snapshots
|
|
||||||
and a symlink to the most recently created snapshot.
|
|
||||||
|
|
||||||
Properties
|
|
||||||
|
|
||||||
* Each snapshot in a repository is unaware of one another,
|
|
||||||
this is the job of the repository to organize
|
|
||||||
* The only way snapshots are linked together is in files
|
|
||||||
that are hard-linked together
|
|
||||||
|
|
||||||
Snapshots can be accessed on a one-by-one basis through iteration.
|
Snapshots can be accessed on a one-by-one basis through iteration.
|
||||||
|
|
||||||
::
|
::
|
||||||
@ -71,6 +70,7 @@ class Repository(Hierarchy):
|
|||||||
>>> len(Repository('backup'))
|
>>> len(Repository('backup'))
|
||||||
1
|
1
|
||||||
"""
|
"""
|
||||||
|
|
||||||
"""Snapshots are serialized as their names relative to the repository
|
"""Snapshots are serialized as their names relative to the repository
|
||||||
data directory, but have their full paths during runtime.
|
data directory, but have their full paths during runtime.
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"""
|
"""
|
||||||
.. moduleauthor:: Eric Torres
|
.. moduleauthor:: Eric Torres
|
||||||
.. module:: rbackup.struct.snapshot
|
.. module:: rbackup.struct.snapshot
|
||||||
:synopsis: Classes for creating the backup hierarchy.
|
:synopsis: Class for creating the backup snapshot hierarchy.
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user