Coverage for /usr/local/lib/python3.11/dist-packages/pyrocko/squirrel/tool/commands/scan.py: 56%
9 statements
« prev ^ index » next coverage.py v6.5.0, created at 2023-10-04 09:52 +0000
« prev ^ index » next coverage.py v6.5.0, created at 2023-10-04 09:52 +0000
1# http://pyrocko.org - GPLv3
2#
3# The Pyrocko Developers, 21st Century
4# ---|P------/S----------~Lg----------
6'''
7Implementation of :app:`squirrel scan`.
8'''
10headline = 'Scan and index files and directories.'
13def make_subparser(subparsers):
14 return subparsers.add_parser(
15 'scan',
16 help=headline,
17 description=headline + '''
19Read and cache meta-data of all files in formats understood by Squirrel under
20selected paths. Subdirectories are recursively traversed and file formats are
21auto-detected unless a specific format is forced with the ``--format`` option.
22Modification times of files already known to Squirrel are checked by default
23and re-indexed as needed. To speed up scanning, these checks can be disabled
24with the ``--optimistic`` option. With this option, only new files are indexed
25during scanning and modifications are handled "last minute" (i.e. just before
26the actual data (e.g. waveform samples) are requested by the application).
28Usually, the contents of files given to Squirrel are made available within the
29application through a runtime selection which is discarded again when the
30application quits. Getting the cached meta-data into the runtime selection can
31be a bottleneck for application startup with large datasets. To speed up
32startup of Squirrel-based applications, persistent selections created with the
33``--persistent`` option can be used.
35After scanning, information about the current data selection is printed.
36''')
39def setup(parser):
40 parser.add_squirrel_selection_arguments()
43def run(parser, args):
44 squirrel = args.make_squirrel()
45 print(squirrel)