Coverage for /usr/local/lib/python3.11/dist-packages/pyrocko/dataset/util.py: 100%
11 statements
« prev ^ index » next coverage.py v6.5.0, created at 2023-10-06 15:01 +0000
« 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----------
6'''
7Registry for dataset download progress notifications.
8'''
10DOWNLOAD_CALLBACK = None
13def set_download_callback(callback):
14 global DOWNLOAD_CALLBACK
16 if not callable(callback):
17 raise AttributeError('Callback has to be a function')
18 DOWNLOAD_CALLBACK = callback
21def get_download_callback(context_str):
22 if not DOWNLOAD_CALLBACK:
23 return None
25 def callback(args):
26 return DOWNLOAD_CALLBACK(context_str, args)
28 return callback