qgreenland/util/cleanup.py
def cleanup_cli(**kwargs):  # noqa: C901
    """Clean up input, WIP, and/or output data created by QGreenland.

    By default, clean up the compiled (but not zipped) datapackage.
    """
    _validate_ambiguous_command(kwargs)

    if kwargs['dry_run']:
        print('WARNING: In DRY RUN mode. Nothing will be deleted.')
        print()

    if wip_patterns := kwargs['delete_wips_by_pattern']:
        for p in wip_patterns:
            print_and_run(
                f'rm -rf {TaskType.WIP.value}/{p}',
                dry_run=kwargs['dry_run']
            )
    if inp_patterns := kwargs['delete_inputs_by_pattern']:
        for p in inp_patterns:
            print_and_run(
                f'rm -rf {INPUT_DIR}/{p}',
                dry_run=kwargs['dry_run']
            )

    if kwargs['delete_all_input']:
        print_and_run(
            f'rm -rf {INPUT_DIR}/*',
            dry_run=kwargs['dry_run']
        )

    if kwargs['delete_all_wip']:
        print_and_run(
            f'rm -rf {TaskType.WIP.value}/*',
            dry_run=kwargs['dry_run']
        )

    if kwargs['delete_compiled']:
        print_and_run(
            f'rm -rf {TaskType.FINAL.value}/*',
            dry_run=kwargs['dry_run']
        )
        # The triggerfile tells Luigi tasks to zip the compiled data. Can't do
        # that if we just deleted it!
        if os.path.isfile(ZIP_TRIGGERFILE):
            print_and_run(
                f'rm {ZIP_TRIGGERFILE}',
                dry_run=kwargs['dry_run']
            )

    if kwargs['delete_all_releases']:
        print_and_run(
            f'rm -rf {RELEASES_DIR}/*',
            dry_run=kwargs['dry_run']
        )
Clean up input, WIP, and/or output data created by QGreenland.

    By default, clean up the compiled (but not zipped) datapackage.
    
Clean up input, WIP, and/or output data created by QGreenland.
By default, clean up the compiled (but not zipped) datapackage.
Clean up input WIP and / or output data created by QGreenland . By default clean up the compiled ( but not zipped ) datapackage .
def cleanup_cli(**kwargs):  
    _validate_ambiguous_command(kwargs)
    if kwargs['dry_run']:
        print('WARNING: In DRY RUN mode. Nothing will be deleted.')
        print()
    if wip_patterns := kwargs['delete_wips_by_pattern']:
        for p in wip_patterns:
            print_and_run(
                f'rm -rf {TaskType.WIP.value}/{p}',
                dry_run=kwargs['dry_run']
            )
    if inp_patterns := kwargs['delete_inputs_by_pattern']:
        for p in inp_patterns:
            print_and_run(
                f'rm -rf {INPUT_DIR}/{p}',
                dry_run=kwargs['dry_run']
            )
    if kwargs['delete_all_input']:
        print_and_run(
            f'rm -rf {INPUT_DIR}/*',
            dry_run=kwargs['dry_run']
        )
    if kwargs['delete_all_wip']:
        print_and_run(
            f'rm -rf {TaskType.WIP.value}/*',
            dry_run=kwargs['dry_run']
        )
    if kwargs['delete_compiled']:
        print_and_run(
            f'rm -rf {TaskType.FINAL.value}/*',
            dry_run=kwargs['dry_run']
        )
        if os.path.isfile(ZIP_TRIGGERFILE):
            print_and_run(
                f'rm {ZIP_TRIGGERFILE}',
                dry_run=kwargs['dry_run']
            )
    if kwargs['delete_all_releases']:
        print_and_run(
            f'rm -rf {RELEASES_DIR}/*',
            dry_run=kwargs['dry_run']
        )
def cleanup_cli ( ** kwargs ) : _validate_ambiguous_command ( kwargs ) if kwargs [ 'dry_run' ] : print ( 'WARNING: In DRY RUN mode. Nothing will be deleted.' ) print ( ) if wip_patterns := kwargs [ 'delete_wips_by_pattern' ] : for p in wip_patterns : print_and_run ( f'rm -rf {TaskType.WIP.value}/{p}' , dry_run = kwargs [ 'dry_run' ] ) if inp_patterns := kwargs [ 'delete_inputs_by_pattern' ] : for p in inp_patterns : print_and_run ( f'rm -rf {INPUT_DIR}/{p}' , dry_run = kwargs [ 'dry_run' ] ) if kwargs [ 'delete_all_input' ] : print_and_run ( f'rm -rf {INPUT_DIR}/*' , dry_run = kwargs [ 'dry_run' ] ) if kwargs [ 'delete_all_wip' ] : print_and_run ( f'rm -rf {TaskType.WIP.value}/*' , dry_run = kwargs [ 'dry_run' ] ) if kwargs [ 'delete_compiled' ] : print_and_run ( f'rm -rf {TaskType.FINAL.value}/*' , dry_run = kwargs [ 'dry_run' ] ) if os . path . isfile ( ZIP_TRIGGERFILE ) : print_and_run ( f'rm {ZIP_TRIGGERFILE}' , dry_run = kwargs [ 'dry_run' ] ) if kwargs [ 'delete_all_releases' ] : print_and_run ( f'rm -rf {RELEASES_DIR}/*' , dry_run = kwargs [ 'dry_run' ] )
Clean up input, WIP, and/or output data created by QGreenland.
Clean up input WIP and / or output data created by QGreenland .
# noqa: C901 """Clean up input, WIP, and/or output data created by QGreenland.

    By default, clean up the compiled (but not zipped) datapackage.
    """ # The triggerfile tells Luigi tasks to zip the compiled data. Can't do # that if we just deleted it!