Did I find the right examples for you? yes no

All Samples(8)  |  Call(2)  |  Derive(2)  |  Import(4)

src/c/o/cogent-1.5.3/cogent/maths/stats/util.py   cogent(Download)
"""
from __future__ import division
from cogent.util.misc import FunctionWrapper, MappedList, MappedDict, \
    ConstraintError
from cogent.util.table import Table
class Numbers(NumbersI, MappedList):
    """Safe version of Numbers that validates on all list operations.
 
    For each item in data (which must be iterable), tests whether the item
    is a number and, if so, adds it to the Numbers.

src/p/y/pycogent-HEAD/cogent/maths/stats/util.py   pycogent(Download)
"""
from __future__ import division
from cogent.util.misc import FunctionWrapper, MappedList, MappedDict, \
    ConstraintError
from cogent.util.table import Table
class Numbers(NumbersI, MappedList):
    """Safe version of Numbers that validates on all list operations.
 
    For each item in data (which must be iterable), tests whether the item
    is a number and, if so, adds it to the Numbers.

src/c/o/cogent-1.5.3/tests/test_util/test_misc.py   cogent(Download)
from cogent.app.util import get_tmp_filename
from cogent.util.unit_test import TestCase, main
from cogent.util.misc import (iterable, max_index, min_index,
    flatten, is_iterable, is_char, is_char_or_noniterable,
    is_str_or_noniterable, not_list_tuple, list_flatten,
    def test_setitem_masks(self):
        """MappedList setitem with masks should transform input"""
        a = MappedList('12333', range(5), lambda x: int(x) + 1)
        self.assertEqual(a, [2,3,4,4,4])
        self.assertRaises(ConstraintError, a.append, 4)

src/p/y/pycogent-HEAD/tests/test_util/test_misc.py   pycogent(Download)
from cogent.app.util import get_tmp_filename
from cogent.util.unit_test import TestCase, main
from cogent.util.misc import (iterable, max_index, min_index,
    flatten, is_iterable, is_char, is_char_or_noniterable,
    is_str_or_noniterable, not_list_tuple, list_flatten,
    def test_setitem_masks(self):
        """MappedList setitem with masks should transform input"""
        a = MappedList('12333', range(5), lambda x: int(x) + 1)
        self.assertEqual(a, [2,3,4,4,4])
        self.assertRaises(ConstraintError, a.append, 4)