Coverage for /usr/local/lib/python3.11/dist-packages/pyrocko/squirrel/tool/commands/remove.py: 65%
20 statements
« prev ^ index » next coverage.py v6.5.0, created at 2023-10-06 06:59 +0000
« prev ^ index » next coverage.py v6.5.0, created at 2023-10-06 06:59 +0000
1# http://pyrocko.org - GPLv3
2#
3# The Pyrocko Developers, 21st Century
4# ---|P------/S----------~Lg----------
6'''
7Implementation of :app:`squirrel remove`.
8'''
10import logging
12from ..common import SquirrelCommand
14logger = logging.getLogger('psq.cli.remove')
16headline = 'Remove entries from selection or database.'
18description = '''%s
20Allows selective removal of cached metadata from Squirrel's database.
22Currently only removal of waveform promises is supported.
23''' % headline
26class Promises(SquirrelCommand):
28 def make_subparser(self, subparsers):
29 return subparsers.add_parser(
30 'promises',
31 help='Remove all waveform promises in the selection.',
32 description='Remove all waveform promises in the selection.')
34 def setup(self, parser):
35 parser.add_squirrel_selection_arguments()
37 def run(self, parser, args):
38 s = args.make_squirrel()
39 s.remove_waveform_promises(from_database='global')
42def make_subparser(subparsers):
43 return subparsers.add_parser(
44 'remove',
45 help=headline,
46 subcommands=[Promises()],
47 description=description)
50def setup(parser):
51 pass
54def run(parser, args):
55 parser.print_help()