# Path: muninn/tools/utils.py
# def create_parser(*args, **kwargs):
#     parser = argparse.ArgumentParser(*args, parents=[version_parser], **kwargs)
#     parser.add_argument("--verbose", action="store_true", help="display debug information")
#     return parser
# 
# def parse_args_and_run(parser, func):
#     args, unused_args = version_parser.parse_known_args()
#     if args.version:
#         version(os.path.basename(sys.argv[0]))
#         sys.exit(0)
# 
#     args = parser.parse_args(unused_args)
# 
#     log_level = logging.DEBUG if args.verbose else logging.INFO
#     logging.basicConfig(level=log_level, format="%(levelname)s: %(message)s")
# 
#     try:
#         return func(args)
#     except SystemExit:
#         raise
#     except KeyboardInterrupt:
#         sys.exit(1)
#     except muninn.Error as error:
#         logging.error(error)
#         sys.exit(1)
#     except Exception:
#         log_internal_error()
#         sys.exit(1)
#     finally:
#         logging.shutdown()


import logging
import muninn
from .utils import create_parser, parse_args_and_run
#
# Copyright (C) 2014-2022 S[&]T, The Netherlands.
#

from __future__ import absolute_import, division, print_function





def pull(args):
    with muninn.open(args.archive) as archive:
        verify_hash = True if args.verify_hash else False
        verify_hash_download = True if args.verify_hash_download else False

        # find all remote products that satisfy filter
        expression = "active and is_defined(remote_url) and not is_defined(archive_path)"
        if args.expression:

# Path: muninn/tools/utils.py
# def create_parser(*args, **kwargs):
#     parser = argparse.ArgumentParser(*args, parents=[version_parser], **kwargs)
#     parser.add_argument("--verbose", action="store_true", help="display debug information")
#     return parser
# 
# def parse_args_and_run(parser, func):
#     args, unused_args = version_parser.parse_known_args()
#     if args.version:
#         version(os.path.basename(sys.argv[0]))
#         sys.exit(0)
# 
#     args = parser.parse_args(unused_args)
# 
#     log_level = logging.DEBUG if args.verbose else logging.INFO
#     logging.basicConfig(level=log_level, format="%(levelname)s: %(message)s")
# 
#     try:
#         return func(args)
#     except SystemExit:
#         raise
#     except KeyboardInterrupt:
#         sys.exit(1)
#     except muninn.Error as error:
#         logging.error(error)
#         sys.exit(1)
#     except Exception:
#         log_internal_error()
#         sys.exit(1)
#     finally:
#         logging.shutdown()


# Path: muninn/tools/pull.py
import logging
import muninn
from .utils import create_parser, parse_args_and_run

#
# Copyright (C) 2014-2022 S[&]T, The Netherlands.
#

from __future__ import absolute_import, division, print_function





def pull(args):
    with muninn.open(args.archive) as archive:
        verify_hash = True if args.verify_hash else False
        verify_hash_download = True if args.verify_hash_download else False

        # find all remote products that satisfy filter
        expression = "active and is_defined(remote_url) and not is_defined(archive_path)"
        if args.expression:

            expression = "%s and (%s)" % (expression, args.expression)