Skip to content

Commit

Permalink
Making new cleanup_saved_downloads part of the public API
Browse files Browse the repository at this point in the history
  • Loading branch information
bsipocz committed Apr 29, 2022
1 parent d910c7a commit fec0444
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 6 deletions.
2 changes: 2 additions & 0 deletions astroquery/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@
from .commons import *
from .process_asyncs import async_to_sync
from .docstr_chompers import prepend_docstr_nosections
from .cleanup_downloads import cleanup_saved_downloads

4 changes: 3 additions & 1 deletion astroquery/utils/cleanup_downloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@
import os
import shutil

__all__ = ['cleanup_saved_downloads']


def cleanup_saved_downloads(names):
""" Function to clean up save files.
Parameters
----------
names : str or list of str
Files or directories to clean up. Wildcards are excepted.
Files or directories to clean up. Wildcards are accepted.
"""

if isinstance(names, str):
Expand Down
2 changes: 1 addition & 1 deletion docs/cadc/cadc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -661,5 +661,5 @@ Reference/API

.. testcleanup::

>>> from astroquery.utils.cleanup_downloads import cleanup_saved_downloads
>>> from astroquery.utils import cleanup_saved_downloads
>>> cleanup_saved_downloads(['my_observations.xml', 'test_output_noauth.xml'])
2 changes: 1 addition & 1 deletion docs/esa/hsa/hsa.rst
Original file line number Diff line number Diff line change
Expand Up @@ -244,5 +244,5 @@ Reference/API

.. testcleanup::

>>> from astroquery.utils.cleanup_downloads import cleanup_saved_downloads
>>> from astroquery.utils import cleanup_saved_downloads
>>> cleanup_saved_downloads(['1342195355*', 'results.csv'])
2 changes: 1 addition & 1 deletion docs/ipac/irsa/sha/sha.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,5 +103,5 @@ Reference/API

.. testcleanup::

>>> from astroquery.utils.cleanup_downloads import cleanup_saved_downloads
>>> from astroquery.utils import cleanup_saved_downloads
>>> cleanup_saved_downloads(['sha_tmp'])
2 changes: 1 addition & 1 deletion docs/mast/mast.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1263,6 +1263,6 @@ Reference/API

.. testcleanup::

>>> from astroquery.utils.cleanup_downloads import cleanup_saved_downloads
>>> from astroquery.utils import cleanup_saved_downloads
>>> cleanup_saved_downloads(['mastDownload*', 'tess-*', 'lwp13058*', '3dhst*'])

2 changes: 1 addition & 1 deletion docs/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,4 @@ Narrative documentation should also be tested, the ``doctest-remote-data`` direc
to mark code snippets that relies on remote data access.

If any of the examples include saving data files locally, use the ``testcleanup`` directive and the
`~astroquery.utils.cleanup_downloads.cleanup_saved_downloads` function at the end of the narrative documentation.
`~astroquery.utils.cleanup_saved_downloads` function at the end of the narrative documentation.

0 comments on commit fec0444

Please sign in to comment.