doku2git: Modify Change
to be an ABC
Engineering aside, this further reduces warnings from PyCharm.
This commit is contained in:
parent
e0092a365b
commit
2534979044
24
doku2git.py
24
doku2git.py
@ -5,6 +5,7 @@
|
|||||||
from typing import List, Dict, Iterable, Callable, Generator
|
from typing import List, Dict, Iterable, Callable, Generator
|
||||||
from operator import attrgetter
|
from operator import attrgetter
|
||||||
|
|
||||||
|
import abc
|
||||||
import os.path
|
import os.path
|
||||||
import os
|
import os
|
||||||
import collections
|
import collections
|
||||||
@ -57,7 +58,7 @@ class User(object):
|
|||||||
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
class Change(object):
|
class Change(abc.ABC):
|
||||||
"""
|
"""
|
||||||
The base class for all change records in the Dokuwiki instance.
|
The base class for all change records in the Dokuwiki instance.
|
||||||
|
|
||||||
@ -88,6 +89,25 @@ class Change(object):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f'{self.user}@{self.timestamp}:{self.page} "{self.description}"'
|
return f'{self.user}@{self.timestamp}:{self.page} "{self.description}"'
|
||||||
|
|
||||||
|
@abc.abstractmethod
|
||||||
|
def _update(self, _src, _dst: str) -> Generator[str, None, None]:
|
||||||
|
"""
|
||||||
|
Yield the commands required to unpack this change.
|
||||||
|
:param _src: The Dokuwiki instance this change belongs to.
|
||||||
|
:param _dst: The absolute path to the root of the git repository
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
|
@abc.abstractmethod
|
||||||
|
def _attic(self, _src) -> str:
|
||||||
|
"""
|
||||||
|
Find the path to the history data within the Dokuwiki directories.
|
||||||
|
:param _src: The Dokuwiki instance this change belongs to.
|
||||||
|
:return: The relative path from the root of Dokuwiki to the data.
|
||||||
|
"""
|
||||||
|
pass
|
||||||
|
|
||||||
def _delete(self, _src: str, _dst: str) -> Generator[str, None, None]:
|
def _delete(self, _src: str, _dst: str) -> Generator[str, None, None]:
|
||||||
"""
|
"""
|
||||||
Generates the required commands to delete a given page
|
Generates the required commands to delete a given page
|
||||||
@ -243,7 +263,7 @@ class MediaChange(Change):
|
|||||||
f'{basename}.{self.timestamp}{extension}'
|
f'{basename}.{self.timestamp}{extension}'
|
||||||
)
|
)
|
||||||
|
|
||||||
def _update(self, src: str, dst: str) -> Generator[str, None, None]:
|
def _update(self, src, dst: str) -> Generator[str, None, None]:
|
||||||
"""
|
"""
|
||||||
Yields the commands required to unpack this one change.
|
Yields the commands required to unpack this one change.
|
||||||
:param src: The Dokuwiki instance this change belongs to.
|
:param src: The Dokuwiki instance this change belongs to.
|
||||||
|
Loading…
Reference in New Issue
Block a user