# Copyright (C) 2015 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


class ImmutableDict(dict):
  def __setitem__(self, key, value):
    raise RuntimeError("Cannot modify ImmutableDict")

  def __delitem__(self, key):
    raise RuntimeError("Cannot modify ImmutableDict")

  def copy_with(self, key, value):
    new_dict = ImmutableDict(self)
    dict.__setitem__(new_dict, key, value)
    return new_dict
