code: def filename_metadata(filename):
      
      from ..segments import Segment
      name = Path(filename).name
      try:
          obs, desc, start, dur = name.split('-')
      except ValueError as exc:
          exc.args = ('Failed to parse {!r} as LIGO-T050017-compatible '
                      'filename'.format(name),)
          raise
      start = float(start)
      dur = dur.rsplit('.', 1)[0]
      while True:  # recursively remove extension components
          try:
              dur = float(dur)
          except ValueError:
              if '.' not in dur:
                  raise
              dur = dur.rsplit('.', 1)[0]
          else:
              break
      return obs, desc, Segment(start, start+dur)
docs: Return metadata parsed from a filename following LIGO-T050017
  
      This method is lenient with regards to integers in the GPS start time of
      the file, as opposed to `gwdatafind.utils.filename_metadata`, which is
      strict.
  
      Parameters
      ----------
      filename : `str`
          the path name of a file
  
      Returns
      -------
      obs : `str`
          the observatory metadata
  
      tag : `str`
          the file tag
  
      segment : `gwpy.segments.Segment`
          the GPS ``[float, float)`` interval for this file
  
      Notes
      -----
      `LIGO-T050017 <https://dcc.ligo.org/LIGO-T050017>`__ declares a
      file naming convention that includes documenting the GPS start integer
      and integer duration of a file, see that document for more details.
  
      Examples
      --------
      >>> from gwpy.io.cache import filename_metadata
      >>> filename_metadata("A-B-0-1.txt")
      ('A', 'B', Segment(0, 1))
      >>> filename_metadata("A-B-0.456-1.345.txt")
      ("A", "B", Segment(0.456, 1.801))