HEX
Server: Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/8.4.25
System: Windows NT DESKTOP-4TAV2RJ 10.0 build 19045 (Windows 10) AMD64
User: fred (0)
PHP: 8.4.25
Disabled: NONE
Upload Files
File: C:/Users/fred/anaconda3/Lib/site-packages/conda_build/cli/actions.py
# Copyright (C) 2014 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
import argparse


class KeyValueAction(argparse.Action):
    def __call__(self, parser, namespace, items, option_string=None):
        setattr(namespace, self.dest, dict())

        for item in items:
            key, value = item.split("=")
            if key in getattr(namespace, self.dest):
                raise KeyError(
                    f"Key {key} cannot be overwritten. "
                    "It's likely that the key you've used "
                    "is already in use by conda-build."
                )
            getattr(namespace, self.dest)[key] = value