File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -343,20 +343,22 @@ def f(toks):
343343)
344344
345345
346- def parse_edtf (str , parseAll = True , fail_silently = False , debug = None ):
346+ def parse_edtf (input_string , parseAll = True , fail_silently = False , debug = None ):
347347 if debug is None :
348348 debug = DEBUG_PYPARSING
349349 try :
350- if not str :
350+ if not input_string :
351351 raise ParseException ("You must supply some input text" )
352- p = edtfParser .parseString (str .strip (), parseAll )
352+ p = edtfParser .parseString (input_string .strip (), parseAll )
353353 if p :
354354 return p [0 ]
355355 except ParseException as err :
356356 if fail_silently :
357357 return None
358358 if debug :
359359 raise
360- near_text = str [max (err .loc - 10 , 0 ) : err .loc + 10 ]
360+ near_text = ""
361+ if input_string :
362+ near_text = input_string [max (err .loc - 10 , 0 ) : err .loc + 10 ]
361363 full_msg = f"Error at position { err .loc } : Invalid input or format near '{ near_text } '. Please provide a valid EDTF string."
362364 raise EDTFParseException (full_msg ) from None
You can’t perform that action at this time.
0 commit comments