Did I find the right examples for you? yes no

All Samples(20)  |  Call(8)  |  Derive(6)  |  Import(6)

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 Freqs(FreqsI, MappedDict):
    """Holds a frequency distribution, i.e. a set of category -> count pairs.
 
    Class data:
        ValueMask: function that transforms values before they are entered.
class NumberFreqs(NumberFreqsI, MappedDict):
    """Class holding freqs where both keys and values are numbers.
 
    Mean, variance etc. assume that the data are frequencies of other
    numbers rather than treating each key as a separate category.

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 Freqs(FreqsI, MappedDict):
    """Holds a frequency distribution, i.e. a set of category -> count pairs.
 
    Class data:
        ValueMask: function that transforms values before they are entered.
class NumberFreqs(NumberFreqsI, MappedDict):
    """Class holding freqs where both keys and values are numbers.
 
    Mean, variance etc. assume that the data are frequencies of other
    numbers rather than treating each key as a separate category.

src/c/o/cogent-1.5.3/cogent/app/parameters.py   cogent(Download)
its subclasses
"""
from cogent.util.misc import MappedDict, FunctionWrapper
from copy import deepcopy
 
class Parameters(MappedDict):
    """Parameters is a dictionary of Parameter objects.
 
    Parameters provides a mask that lets the user lookup and access parameters
        by its synonyms.

src/p/y/pycogent-HEAD/cogent/app/parameters.py   pycogent(Download)
its subclasses
"""
from cogent.util.misc import MappedDict, FunctionWrapper
from copy import deepcopy
 
class Parameters(MappedDict):
    """Parameters is a dictionary of Parameter objects.
 
    Parameters provides a mask that lets the user lookup and access parameters
        by its synonyms.

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):
        """MappedDict setitem should work only if key in constraint"""
        key_mask = str
        val_mask = lambda x: int(x) + 3
        d = MappedDict({1:4, 2:6}, '123', key_mask, val_mask)
    def test_getitem(self):
        """MappedDict getitem should automatically map key."""
        key_mask = str
        d = MappedDict({}, '123', key_mask)
        self.assertEqual(d, {})
    def test_get(self):
        """MappedDict get should automatically map key."""
        key_mask = str
        d = MappedDict({}, '123', key_mask)
        self.assertEqual(d, {})
    def test_has_key(self):
        """MappedDict has_key should automatically map key."""
        key_mask = str
        d = MappedDict({}, '123', key_mask)
        self.assertEqual(d, {})

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):
        """MappedDict setitem should work only if key in constraint"""
        key_mask = str
        val_mask = lambda x: int(x) + 3
        d = MappedDict({1:4, 2:6}, '123', key_mask, val_mask)
    def test_getitem(self):
        """MappedDict getitem should automatically map key."""
        key_mask = str
        d = MappedDict({}, '123', key_mask)
        self.assertEqual(d, {})
    def test_get(self):
        """MappedDict get should automatically map key."""
        key_mask = str
        d = MappedDict({}, '123', key_mask)
        self.assertEqual(d, {})
    def test_has_key(self):
        """MappedDict has_key should automatically map key."""
        key_mask = str
        d = MappedDict({}, '123', key_mask)
        self.assertEqual(d, {})