def _save_action(extra_context=None):
    '''
    Save list of revisions revisions for active Conda environment.

    .. versionchanged:: 0.18
        Compress action revision files using ``bz2`` to save disk space.

    Parameters
    ----------
    extra_context : dict, optional
        Extra content to store in stored action revision.

    Returns
    -------
    path_helpers.path, dict
        Path to which action was written and action object, including list of
        revisions for active Conda environment.
    '''
    # Get list of revisions to Conda environment since creation.
    revisions_js = ch.conda_exec('list', '--revisions', '--json',
                                 verbose=False)
    revisions = json.loads(revisions_js)
    # Save list of revisions to `/etc/microdrop/plugins/actions/rev<rev>.json`
    # See [wheeler-microfluidics/microdrop#200][i200].
    #
    # [i200]: https://github.com/wheeler-microfluidics/microdrop/issues/200
    action = extra_context.copy() if extra_context else {}
    action['revisions'] = revisions
    action_path = (MICRODROP_CONDA_ACTIONS
                   .joinpath('rev{}.json.bz2'.format(revisions[-1]['rev'])))
    action_path.parent.makedirs_p()
    # Compress action file using bz2 to save disk space.
    with bz2.BZ2File(action_path, mode='w') as output:
        json.dump(action, output, indent=2)
    return action_path, action
def _save_action ( extra_context = None ) : revisions_js = ch . conda_exec ( 'list' , '--revisions' , '--json' , verbose = False ) revisions = json . loads ( revisions_js ) action = extra_context . copy ( ) if extra_context else { } action [ 'revisions' ] = revisions action_path = ( MICRODROP_CONDA_ACTIONS . joinpath ( 'rev{}.json.bz2' . format ( revisions [ - 1 ] [ 'rev' ] ) ) ) action_path . parent . makedirs_p ( ) with bz2 . BZ2File ( action_path , mode = 'w' ) as output : json . dump ( action , output , indent = 2 ) return action_path , action
Save list of revisions revisions for active Conda environment.

    .. versionchanged:: 0.18
        Compress action revision files using ``bz2`` to save disk space.

    Parameters
    ----------
    extra_context : dict, optional
        Extra content to store in stored action revision.

    Returns
    -------
    path_helpers.path, dict
        Path to which action was written and action object, including list of
        revisions for active Conda environment.