2828
2929from diffpy .srfit .exceptions import ParseError
3030from diffpy .srfit .fitbase .profileparser import ProfileParser
31+ from diffpy .utils ._deprecator import build_deprecation_message , deprecated
32+
33+ removal_verison = "4.0.0"
34+ base = "diffpy.srfit.pdf.pdfparser.PDFParser"
35+ new_base = "diffpy.srfit.fitbase.ProfileParser"
36+
37+ parseFile_dep_msg = build_deprecation_message (
38+ base ,
39+ "parseFile" ,
40+ "parse_file" ,
41+ removal_version = removal_verison ,
42+ new_base = new_base ,
43+ )
3144
3245
3346class PDFParser (ProfileParser ):
@@ -106,6 +119,11 @@ class PDFParser(ProfileParser):
106119
107120 _format = "PDF"
108121
122+ # Marking this function as deprecated because PDFParser.parseFile calls it
123+ # so when people use PDFParser.parseFile, they will get a
124+ # warning that it is deprecated and they should use
125+ # ProfileParser.parse_file instead.
126+ @deprecated (parseFile_dep_msg )
109127 def parseString (self , patstring ):
110128 """Parse a string and set the _x, _y, _dx, _dy and _meta
111129 variables.
@@ -121,6 +139,7 @@ def parseString(self, patstring):
121139
122140 Raises ParseError if the string cannot be parsed
123141 """
142+
124143 # useful regex patterns:
125144 rx = {"f" : r"[-+]?(\d+(\.\d*)?|\d*\.\d+)([eE][-+]?\d+)?" }
126145 # find where does the data start
0 commit comments