geomagpy / magpy

MagPy (or GeomagPy) is a Python package for analysing and displaying geomagnetic data.
BSD 3-Clause "New" or "Revised" License
45 stars 27 forks source link

undefined @deprecate decorator #132

Closed anielsen001 closed 2 months ago

anielsen001 commented 2 months ago

I'm trying to import magpy and I'm receiving errors that the @deprecate decorator is not defined. This is the error I'm getting below. MagPyLib 1.1.7. Is this a compatibility issue of some kind? I've worked around by commenting out the decorator, I don't need relevant functionality.

iPython 3.11.7 (main, Dec  8 2023, 14:22:46) [GCC 13.2.0]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.26.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import magpy
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
Cell In[1], line 1
----> 1 import magpy

File ~/_external/magpy/magpy/__init__.py:16
     13 __all__ = ['lib','opt','stream','absolutes','transfer','database','mpplot','collector'
     14 ]
     15 from magpy.stream import *
---> 16 from magpy.absolutes import *
     17 from magpy.transfer import *
     18 from magpy.database import *

File ~/_external/magpy/magpy/absolutes.py:1539
   1533         return outline
   1535 #
   1536 #  Now import the format libraries
   1537 #
-> 1539 from magpy.lib.magpy_absformats import *
   1542 def _logfile_len(fname, logfilter):
   1543     f = open(fname,"rb")

File ~/_external/magpy/magpy/lib/magpy_absformats.py:9
      7 from magpy.stream import *
      8 # absolute data / DI
----> 9 from magpy.lib.format_abs_magpy import *
     10 import magpy.lib.format_autodif as autodif
     12 def isAbsFormat(filename, format_type):

File ~/_external/magpy/magpy/lib/format_abs_magpy.py:42
     37         return False
     38     return True
---> 42 @deprecate()
     43 # this format isn't supported by AUTODIF MK3 anymore
     44 def isAUTODIFRAW(filename):
     45     """
     46     Checks whether a file is AUTODIF format.
     47     """
     48     try:

NameError: name 'deprecate' is not defined
leonro commented 2 months ago

Seems to be a compatibility error. I will comment out the decorators until @deprecated is part of the standard libraries. Should be released soon within the warnings package. Alternatively we will write our own decorator - deprecated method. Considered for version 1.1.8

Temporary solution: 16bf1fc288234dd336028a0495a3022c747d70ee