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.

_flatten.py 1.0KB

1234567891011121314151617181920212223242526272829303132333435
  1. ##############################################################################
  2. #
  3. # Copyright (c) 2002 Zope Foundation and Contributors.
  4. # All Rights Reserved.
  5. #
  6. # This software is subject to the provisions of the Zope Public License,
  7. # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
  8. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
  9. # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  10. # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
  11. # FOR A PARTICULAR PURPOSE.
  12. #
  13. ##############################################################################
  14. """Adapter-style interface registry
  15. See Adapter class.
  16. """
  17. from zope.interface import Declaration
  18. def _flatten(implements, include_None=0):
  19. try:
  20. r = implements.flattened()
  21. except AttributeError:
  22. if implements is None:
  23. r=()
  24. else:
  25. r = Declaration(implements).flattened()
  26. if not include_None:
  27. return r
  28. r = list(r)
  29. r.append(None)
  30. return r