original_docstring:  Parses an ISO 8601 duration string into a python timedelta object.
          Raises a `ValueError` if a conversion was not possible.
      
docstring: Parses an ISO 8601 duration string into a python timedelta object.
  Raises a `ValueError` if a conversion was not possible.
docstring_tokens: Parses an ISO 8601 duration string into a python timedelta object . Raises a ` ValueError ` if a conversion was not possible .
code: def parse_duration(value):
      """ Parses an ISO 8601 duration string into a python timedelta object.
          Raises a `ValueError` if a conversion was not possible.
      """
  
      match = RE_ISO_8601.match(value)
      if not match:
          raise ValueError(
              "Could not parse ISO 8601 duration from '%s'." % value
          )
      match = match.groupdict()
  
      sign = -1 if "-" == match['sign'] else 1
      days = float(match['days'] or 0)
      days += float(match['months'] or 0) * 30  # ?!
      days += float(match['years'] or 0) * 365  # ?!
      fsec = float(match['seconds'] or 0)
      fsec += float(match['minutes'] or 0) * 60
      fsec += float(match['hours'] or 0) * 3600
  
      return sign * timedelta(days, fsec)
code_tokens: def parse_duration ( value ) : match = RE_ISO_8601 . match ( value ) if not match : raise ValueError ( "Could not parse ISO 8601 duration from '%s'." % value ) match = match . groupdict ( ) sign = - 1 if "-" == match [ 'sign' ] else 1 days = float ( match [ 'days' ] or 0 ) days += float ( match [ 'months' ] or 0 ) * 30 days += float ( match [ 'years' ] or 0 ) * 365 fsec = float ( match [ 'seconds' ] or 0 ) fsec += float ( match [ 'minutes' ] or 0 ) * 60 fsec += float ( match [ 'hours' ] or 0 ) * 3600 return sign * timedelta ( days , fsec )
short_docstring: Parses an ISO 8601 duration string into a python timedelta object.
short_docstring_tokens: Parses an ISO 8601 duration string into a python timedelta object .
comment: """ Parses an ISO 8601 duration string into a python timedelta object.
          Raises a `ValueError` if a conversion was not possible.
      """$SEP$# ?!$SEP$# ?!