• Jérémy Bobbio's avatar
    Use lazy extraction instead of explicit bracketing · 303aee94
    Jérémy Bobbio authored
    Previously, code requiring access to file content had to be explicitly
    bracketed using get_content() for files to be extracted and then deleted.
    Such construction is problematic for parallel processing as a file might be
    processed be multiple operations currently (e.g. multiple files being extracted
    from a unique archive at the same time).
    We thus removes the get_content() context and @needs_content decorator to
    prefer lazy path initialization: actual content will be made available through
    the path property. The extraction will happen then if necessary.
    The extracted file should normally be deleted when Python garbage collector
    reclaims the object. As a safety net, we still have a global registry of all
    temporary files and directories and remove them on exit.
sqlite.py 1.33 KB