def filename_metadata(filename):
from ..segments import Segment<EOL>name = Path(filename).name<EOL>try:<EOL><INDENT>obs, desc, start, dur = name.split('<STR_LIT:->')<EOL><DEDENT>except ValueError as exc:<EOL><INDENT>exc.args = ('<STR_LIT>'<EOL>'<STR_LIT:filename>'.format(name),)<EOL>raise<EOL><DEDENT>start = float(start)<EOL>dur = dur.rsplit('<STR_LIT:.>', <NUM_LIT:1>)[<NUM_LIT:0>]<EOL>while True:  <EOL><INDENT>try:<EOL><INDENT>dur = float(dur)<EOL><DEDENT>except ValueError:<EOL><INDENT>if '<STR_LIT:.>' not in dur:<EOL><INDENT>raise<EOL><DEDENT>dur = dur.rsplit('<STR_LIT:.>', <NUM_LIT:1>)[<NUM_LIT:0>]<EOL><DEDENT>else:<EOL><INDENT>break<EOL><DEDENT><DEDENT>return obs, desc, Segment(start, start+dur)<EOL>
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))