_exc.py 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. # -*- coding: utf-8 -*-
  2. # Copyright 2018 Joshua Bronson. All Rights Reserved.
  3. #
  4. # This Source Code Form is subject to the terms of the Mozilla Public
  5. # License, v. 2.0. If a copy of the MPL was not distributed with this
  6. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
  7. """Provides all bidict exceptions."""
  8. class BidictException(Exception):
  9. """Base class for bidict exceptions."""
  10. class DuplicationError(BidictException):
  11. """Base class for exceptions raised when uniqueness is violated
  12. as per the RAISE duplication policy.
  13. """
  14. class KeyDuplicationError(DuplicationError):
  15. """Raised when a given key is not unique."""
  16. class ValueDuplicationError(DuplicationError):
  17. """Raised when a given value is not unique."""
  18. class KeyAndValueDuplicationError(KeyDuplicationError, ValueDuplicationError):
  19. """Raised when a given item's key and value are not unique.
  20. That is, its key duplicates that of another item,
  21. and its value duplicates that of a different other item.
  22. """