Funktionierender Prototyp des Serious Games zur Vermittlung von Wissen zu Software-Engineering-Arbeitsmodellen.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

numbers.py 1.6KB

1 year ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. ##############################################################################
  2. # Copyright (c) 2020 Zope Foundation and Contributors.
  3. # All Rights Reserved.
  4. #
  5. # This software is subject to the provisions of the Zope Public License,
  6. # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
  7. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
  8. # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  9. # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
  10. # FOR A PARTICULAR PURPOSE.
  11. ##############################################################################
  12. """
  13. Interface definitions paralleling the abstract base classes defined in
  14. :mod:`numbers`.
  15. After this module is imported, the standard library types will declare
  16. that they implement the appropriate interface.
  17. .. versionadded:: 5.0.0
  18. """
  19. import numbers as abc
  20. from zope.interface.common import ABCInterface
  21. from zope.interface.common import optional
  22. # pylint:disable=inherit-non-class,
  23. # pylint:disable=no-self-argument,no-method-argument
  24. # pylint:disable=unexpected-special-method-signature
  25. # pylint:disable=no-value-for-parameter
  26. class INumber(ABCInterface):
  27. abc = abc.Number
  28. class IComplex(INumber):
  29. abc = abc.Complex
  30. @optional
  31. def __complex__():
  32. """
  33. Rarely implemented, even in builtin types.
  34. """
  35. class IReal(IComplex):
  36. abc = abc.Real
  37. @optional
  38. def __complex__():
  39. """
  40. Rarely implemented, even in builtin types.
  41. """
  42. __floor__ = __ceil__ = __complex__
  43. class IRational(IReal):
  44. abc = abc.Rational
  45. class IIntegral(IRational):
  46. abc = abc.Integral