コード例 #1
0
ファイル: sequences.py プロジェクト: MiguelMoll/vFense
 def extend(self, objects):
     """
     Extends the list with the given `objects`.
     """
     if self.exhausted:
         self._collected_data.extend(objects)
     else:
         self._iterator = chain(self._iterator, objects)
コード例 #2
0
 def extend(self, objects):
     """
     Extends the list with the given `objects`.
     """
     if self.exhausted:
         self._collected_data.extend(objects)
     else:
         self._iterator = chain(self._iterator, objects)
コード例 #3
0
ファイル: mappings.py プロジェクト: hairesis/brownie
    def elements(self):
        """
        Iterator over the elements in the counter, repeating as many times as
        counted.

        >>> from brownie.datastructures import Counter
        >>> sorted(Counter('abcabc').elements())
        ['a', 'a', 'b', 'b', 'c', 'c']
        """
        return chain(*starmap(repeat, self.iteritems()))
コード例 #4
0
ファイル: sequences.py プロジェクト: MiguelMoll/vFense
 def __add__(self, other):
     if isinstance(other, (list, self.__class__)):
         return self.__class__(chain(self, other))
     raise TypeError("can't concatenate with non-list: {0}".format(other))
コード例 #5
0
 def symmetric_difference(self, other):
     other = self.__class__(other)
     return self.__class__(chain(self - other, other - self))
コード例 #6
0
 def __add__(self, other):
     if isinstance(other, (list, self.__class__)):
         return self.__class__(chain(self, other))
     raise TypeError("can't concatenate with non-list: {0}".format(other))
コード例 #7
0
ファイル: sets.py プロジェクト: MiguelMoll/vFense
 def symmetric_difference(self, other):
     other = self.__class__(other)
     return self.__class__(chain(self - other, other - self))
コード例 #8
0
ファイル: itools.py プロジェクト: nzralc/Django-Emlak-Sitesi
def test_chain():
    list(chain([1, 2], [3, 4])) == [1, 2, 3, 4]
    list(chain.from_iterable([[1, 2], [3, 4]])) == [1, 2, 3, 4]
コード例 #9
0
ファイル: itools.py プロジェクト: DocHoncho/brownie
def test_chain():
    Assert(list(chain([1, 2], [3, 4]))) == [1, 2, 3, 4]
    Assert(list(chain.from_iterable([[1, 2], [3, 4]]))) == [1, 2, 3, 4]
コード例 #10
0
def test_chain():
    Assert(list(chain([1, 2], [3, 4]))) == [1, 2, 3, 4]
    Assert(list(chain.from_iterable([[1, 2], [3, 4]]))) == [1, 2, 3, 4]
コード例 #11
0
ファイル: itools.py プロジェクト: MiguelMoll/vFense
def test_chain():
    list(chain([1, 2], [3, 4])) == [1, 2, 3, 4]
    list(chain.from_iterable([[1, 2], [3, 4]])) == [1, 2, 3, 4]