|
11 | 11 | import re
|
12 | 12 | import shutil
|
13 | 13 | from pathlib import Path
|
14 |
| -import tarfile |
| 14 | +import tarfile as esatar |
15 | 15 | import os
|
16 | 16 | import configparser
|
17 | 17 | from email.message import Message
|
|
31 | 31 |
|
32 | 32 | # We do trust the ESA tar files, this is to avoid the new to Python 3.12 deprecation warning
|
33 | 33 | # https://docs.python.org/3.12/library/tarfile.html#tarfile-extraction-filter
|
34 |
| -if hasattr(tarfile, "fully_trusted_filter"): |
35 |
| - tarfile.TarFile.extraction_filter = staticmethod(tarfile.fully_trusted_filter) |
| 34 | +if hasattr(esatar, "fully_trusted_filter"): |
| 35 | + esatar.TarFile.extraction_filter = staticmethod(esatar.fully_trusted_filter) |
36 | 36 |
|
37 | 37 |
|
38 | 38 | class XMMNewtonClass(BaseQuery):
|
@@ -412,7 +412,7 @@ def get_epic_spectra(self, filename, source_number, *,
|
412 | 412 | if path != "" and os.path.exists(path):
|
413 | 413 | _path = path
|
414 | 414 | try:
|
415 |
| - with tarfile.open(filename, "r") as tar: |
| 415 | + with esatar.open(filename, "r") as tar: |
416 | 416 | ret = {}
|
417 | 417 | for member in tar.getmembers():
|
418 | 418 | paths = os.path.split(member.name)
|
@@ -558,7 +558,7 @@ def get_epic_images(self, filename, band=[], instrument=[],
|
558 | 558 | log.warning("Invalid instrument %s" % inst)
|
559 | 559 | instrument.remove(inst)
|
560 | 560 | try:
|
561 |
| - with tarfile.open(filename, "r") as tar: |
| 561 | + with esatar.open(filename, "r") as tar: |
562 | 562 | ret = {}
|
563 | 563 | for member in tar.getmembers():
|
564 | 564 | paths = os.path.split(member.name)
|
@@ -734,7 +734,7 @@ def get_epic_lightcurve(self, filename, source_number, *,
|
734 | 734 | _path = path
|
735 | 735 |
|
736 | 736 | try:
|
737 |
| - with tarfile.open(filename, "r") as tar: |
| 737 | + with esatar.open(filename, "r") as tar: |
738 | 738 | ret = {}
|
739 | 739 | for member in tar.getmembers():
|
740 | 740 | paths = os.path.split(member.name)
|
|
0 commit comments