remove CHECKS feature, not needed

This commit is contained in:
Nick Sweeting 2024-10-09 18:06:00 -07:00
parent de7ab65f11
commit 04d2316800
No known key found for this signature in database
8 changed files with 9 additions and 114 deletions

View file

@ -1,44 +0,0 @@
__package__ = "abx.archivebox"
from typing import List
from django.core.checks import Warning, Tags, register
import abx
from .base_hook import BaseHook, HookType
class BaseCheck(BaseHook):
hook_type: HookType = "CHECK"
tag: str = Tags.database
@staticmethod
def check(settings, logger) -> List[Warning]:
"""Override this method to implement your custom runtime check."""
errors = []
# if not hasattr(settings, 'SOME_KEY'):
# errors.extend(Error(
# 'Missing settings.SOME_KEY after django_setup(), did SOME_KEY get loaded?',
# id='core.C001',
# hint='Make sure to run django_setup() is able to load settings.SOME_KEY.',
# ))
# logger.debug('[√] Loaded settings.PLUGINS succesfully.')
return errors
@abx.hookimpl
def get_CHECKS(self):
return [self]
@abx.hookimpl
def register_checks(self):
"""Tell django that this check exists so it can be run automatically by django."""
def run_check(**kwargs):
from django.conf import settings
import logging
return self.check(settings, logging.getLogger("checks"))
run_check.__name__ = self.id
run_check.tags = [self.tag]
register(self.tag)(run_check)

View file

@ -17,10 +17,6 @@ def get_EXTRACTORS():
def get_REPLAYERS():
return {}
@hookspec
def get_CHECKS():
return {}
@hookspec
def get_ADMINDATAVIEWS():
return {}

View file

@ -13,7 +13,6 @@ if TYPE_CHECKING:
from .base_binary import BaseBinary, BaseBinProvider
from .base_extractor import BaseExtractor
from .base_replayer import BaseReplayer
from .base_check import BaseCheck
from .base_queue import BaseQueue
from .base_admindataview import BaseAdminDataView
from .base_searchbackend import BaseSearchBackend
@ -79,13 +78,6 @@ def get_REPLAYERS() -> Dict[str, 'BaseReplayer']:
for replayer in plugin_replayers
})
def get_CHECKS() -> Dict[str, 'BaseCheck']:
return benedict({
check.id: check
for plugin_checks in pm.hook.get_CHECKS()
for check in plugin_checks
})
def get_ADMINDATAVIEWS() -> Dict[str, 'BaseAdminDataView']:
return benedict({
admin_dataview.id: admin_dataview