def decode_filename(pathname):
    data = DataFileData()
    pathname = os.path.abspath(pathname)
    dirname, fname = os.path.split(pathname)
    fname, ext = os.path.splitext(fname)
    nameparts = fname.split("+")
    data.directory = dirname
    data.name = nameparts[0]
    offset = 1
    try:
        mt = timelib.strptime_mutable(nameparts[offset], "%Y%m%d%H%M%S")
    except:
        mt = timelib.localtime_mutable(os.path.getmtime(pathname))
    else:
        offset += 1
    mt.set_format("%a, %d %b %Y %H:%M:%S %Z")
    data.timestamp = mt
    for part in nameparts[offset:]:
        mo = _STATE_RE.match(part)
        if mo:
            data[mo.group(1)] = _STATEMAP[mo.group(2)]
        else:
            mo = _OTHERDATA_RE.match(part)
            if mo:
                valuestring = mo.group(2)
                try:
                    value = eval(valuestring, {}, {})
                    if type(value) is str:
                        value = value.lower()
                except:
                    value = valuestring
                data[mo.group(1)] = value
            else:
                print("name component not matched: %r" % (part,), file=sys.stderr)
    return data
Decode a metadata encoded file name.
dataset/ETHPy150Open kdart/pycopia/QA/pycopia/datafile.py/decode_filename