--- a/src/pyams_utils/list.py Wed Nov 20 19:26:23 2019 +0100
+++ b/src/pyams_utils/list.py Fri Nov 22 18:51:37 2019 +0100
@@ -20,8 +20,6 @@
iterator).
"""
-__docformat__ = 'restructuredtext'
-
from itertools import filterfalse, tee
from random import random, shuffle
@@ -31,14 +29,17 @@
from pyams_utils.interfaces.tales import ITALESExtension
+__docformat__ = 'restructuredtext'
+
+
def unique(seq, key=None):
"""Extract unique values from list, preserving order
:param iterator seq: input list
:param callable key: an identity function which is used to get 'identity' value of each element
in the list
- :return: list; a new list containing only unique elements of the original list in their initial order.
- Original list is not modified.
+ :return: list; a new list containing only unique elements of the original list in their initial
+ order. Original list is not modified.
>>> from pyams_utils.list import unique
>>> mylist = [1, 2, 3, 2, 1]
@@ -173,7 +174,8 @@
return next(values), values
-@adapter_config(name='boolean_iter', context=(Interface, Interface, Interface), provides=ITALESExtension)
+@adapter_config(name='boolean_iter', context=(Interface, Interface, Interface),
+ provides=ITALESExtension)
class IterValuesCheckerExpression(ContextRequestViewAdapter):
"""TALES expression used to handle iterators
@@ -182,6 +184,7 @@
"""
def render(self, context=None):
+ """Render TALES extension; see `ITALESExtension` interface"""
if context is None:
context = self.context
return boolean_iter(context)