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 15:01 +0000

1# http://pyrocko.org - GPLv3 

2# 

3# The Pyrocko Developers, 21st Century 

4# ---|P------/S----------~Lg---------- 

5 

6''' 

7Implementation of :app:`squirrel remove`. 

8''' 

9 

10import logging 

11 

12from ..common import SquirrelCommand 

13 

14logger = logging.getLogger('psq.cli.remove') 

15 

16headline = 'Remove entries from selection or database.' 

17 

18description = '''%s 

19 

20Allows selective removal of cached metadata from Squirrel's database. 

21 

22Currently only removal of waveform promises is supported. 

23''' % headline 

24 

25 

26class Promises(SquirrelCommand): 

27 

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.') 

33 

34 def setup(self, parser): 

35 parser.add_squirrel_selection_arguments() 

36 

37 def run(self, parser, args): 

38 s = args.make_squirrel() 

39 s.remove_waveform_promises(from_database='global') 

40 

41 

42def make_subparser(subparsers): 

43 return subparsers.add_parser( 

44 'remove', 

45 help=headline, 

46 subcommands=[Promises()], 

47 description=description) 

48 

49 

50def setup(parser): 

51 pass 

52 

53 

54def run(parser, args): 

55 parser.print_help()