forked from hans/Nominatim
add type annotations for command line functions
This commit is contained in:
@@ -8,8 +8,10 @@
|
||||
Implementation of the 'admin' subcommand.
|
||||
"""
|
||||
import logging
|
||||
import argparse
|
||||
|
||||
from nominatim.tools.exec_utils import run_legacy_script
|
||||
from nominatim.clicmd.args import NominatimArgs
|
||||
|
||||
# Do not repeat documentation of subcommand classes.
|
||||
# pylint: disable=C0111
|
||||
@@ -23,8 +25,7 @@ class AdminFuncs:
|
||||
Analyse and maintain the database.
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def add_args(parser):
|
||||
def add_args(self, parser: argparse.ArgumentParser) -> None:
|
||||
group = parser.add_argument_group('Admin tasks')
|
||||
objs = group.add_mutually_exclusive_group(required=True)
|
||||
objs.add_argument('--warm', action='store_true',
|
||||
@@ -49,10 +50,9 @@ class AdminFuncs:
|
||||
mgroup.add_argument('--place-id', type=int,
|
||||
help='Analyse indexing of the given Nominatim object')
|
||||
|
||||
@staticmethod
|
||||
def run(args):
|
||||
def run(self, args: NominatimArgs) -> int:
|
||||
if args.warm:
|
||||
return AdminFuncs._warm(args)
|
||||
return self._warm(args)
|
||||
|
||||
if args.check_database:
|
||||
LOG.warning('Checking database')
|
||||
@@ -73,8 +73,7 @@ class AdminFuncs:
|
||||
return 1
|
||||
|
||||
|
||||
@staticmethod
|
||||
def _warm(args):
|
||||
def _warm(self, args: NominatimArgs) -> int:
|
||||
LOG.warning('Warming database caches')
|
||||
params = ['warm.php']
|
||||
if args.target == 'reverse':
|
||||
|
||||
Reference in New Issue
Block a user