46 lines
951 B
Python
46 lines
951 B
Python
__all__ = (
|
|
"EntryCommandNotImplementedError",
|
|
"Entry",
|
|
)
|
|
|
|
|
|
import logging
|
|
from pathlib import Path
|
|
from typing import Optional
|
|
|
|
logger = logging.getLogger("entry")
|
|
|
|
|
|
class EntryCommandNotImplementedError(NotImplementedError):
|
|
pass
|
|
|
|
|
|
class Entry:
|
|
_logger = logger
|
|
|
|
def __init__(self, entry_type: str, basepath: Path):
|
|
self._type = entry_type
|
|
self._basepath = basepath
|
|
|
|
def setup(self):
|
|
raise EntryCommandNotImplementedError("setup")
|
|
|
|
def lint(self):
|
|
raise EntryCommandNotImplementedError("lint")
|
|
|
|
def format(self):
|
|
raise EntryCommandNotImplementedError("format")
|
|
|
|
def test(self):
|
|
raise EntryCommandNotImplementedError("test")
|
|
|
|
def show(self):
|
|
self._logger.info(f"{self}")
|
|
|
|
def __repr__(self):
|
|
return f"{self._type} {str(self._basepath)}"
|
|
|
|
@classmethod
|
|
def detect(cls, basepath: Path) -> Optional["Entry"]:
|
|
raise NotImplemented
|