Python typing.MutableSet() Examples

The following are 6 code examples of typing.MutableSet(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module typing , or try the search function .
Example #1
Source File: model_part.py    From neuralmonkey with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def __get_deps(
            self,
            attr: str,
            feedables: MutableSet[Feedable],
            parameterizeds: MutableSet[Parameterized]) -> None:

        attr_val = getattr(self, attr, None)

        if attr_val is None:
            return

        deps = []  # type: List[GenericModelPart]
        if isinstance(attr_val, GenericModelPart):
            deps = [attr_val]
        elif isinstance(attr_val, Iterable):
            deps = [a for a in attr_val if isinstance(a, GenericModelPart)]

        for dep in deps:
            feeds, params = dep.get_dependencies()
            feedables |= feeds
            parameterizeds |= params 
Example #2
Source File: model_part.py    From neuralmonkey with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def __get_deps(
            self,
            attr: str,
            feedables: MutableSet[Feedable],
            parameterizeds: MutableSet[Parameterized]) -> None:

        attr_val = getattr(self, attr, None)

        if attr_val is None:
            return

        deps = []  # type: List[GenericModelPart]
        if isinstance(attr_val, GenericModelPart):
            deps = [attr_val]
        elif isinstance(attr_val, Iterable):
            deps = [a for a in attr_val if isinstance(a, GenericModelPart)]

        for dep in deps:
            feeds, params = dep.get_dependencies()
            feedables |= feeds
            parameterizeds |= params 
Example #3
Source File: model_part.py    From neuralmonkey with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
def __get_deps(
            self,
            attr: str,
            feedables: MutableSet[Feedable],
            parameterizeds: MutableSet[Parameterized]) -> None:

        attr_val = getattr(self, attr, None)

        if attr_val is None:
            return

        deps = []  # type: List[GenericModelPart]
        if isinstance(attr_val, GenericModelPart):
            deps = [attr_val]
        elif isinstance(attr_val, Iterable):
            deps = [a for a in attr_val if isinstance(a, GenericModelPart)]

        for dep in deps:
            feeds, params = dep.get_dependencies()
            feedables |= feeds
            parameterizeds |= params 
Example #4
Source File: test_typing.py    From Fluid-Designer with GNU General Public License v3.0 5 votes vote down vote up
def test_mutableset(self):
        assert isinstance(set(), typing.MutableSet)
        assert not isinstance(frozenset(), typing.MutableSet) 
Example #5
Source File: transactional.py    From reactivepy with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def __init__(self, *args, **kwargs):
        super(TransactionSet, self).__init__(*args, **kwargs)

        self._inner_set: MutableSet[VT] = set() 
Example #6
Source File: test_typing.py    From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 5 votes vote down vote up
def test_mutableset(self):
        self.assertIsInstance(set(), typing.MutableSet)
        self.assertNotIsInstance(frozenset(), typing.MutableSet)