コード例 #1
0
ファイル: TypedTuple.py プロジェクト: willingc/abjad
 def __init__(self, items=None, item_class=None):
     TypedCollection.__init__(self, 
         item_class=item_class, 
         items=items,
         )
     items = items or []
     self._collection = tuple(
         self._item_callable(item) for item in items)
コード例 #2
0
ファイル: TypedTuple.py プロジェクト: jdavancens/abjad
 def __init__(self, items=None, item_class=None):
     TypedCollection.__init__(
         self,
         item_class=item_class,
         items=items,
     )
     items = items or []
     self._collection = tuple(self._item_coercer(item) for item in items)
コード例 #3
0
ファイル: TypedCounter.py プロジェクト: quesebifurcan/abjad
 def __init__(self, items=None, item_class=None, **kwargs):
     TypedCollection.__init__(
         self,
         item_class=item_class,
         items=items,
     )
     self._collection = collections.Counter()
     self.update(items, **kwargs)
コード例 #4
0
 def __init__(self, items=None, item_class=None):
     TypedCollection.__init__(
         self,
         item_class=item_class,
         items=items,
         )
     items = items or []
     items = [self._item_coercer(_) for _ in items]
     self._collection = frozenset(items)
コード例 #5
0
ファイル: TypedFrozenset.py プロジェクト: adorsk/abjad
 def __init__(self, tokens=None, item_class=None, custom_identifier=None):
     TypedCollection.__init__(self, 
         item_class=item_class, 
         custom_identifier=custom_identifier,
         tokens=tokens,
         )
     tokens = tokens or []
     self._collection = frozenset(self._item_callable(token) 
         for token in tokens)
コード例 #6
0
ファイル: TypedTuple.py プロジェクト: Alwnikrotikz/abjad
 def __init__(self, tokens=None, item_class=None, name=None):
     TypedCollection.__init__(self, 
         item_class=item_class, 
         name=name,
         tokens=tokens,
         )
     tokens = tokens or []
     self._collection = tuple(self._item_callable(token) 
         for token in tokens)
コード例 #7
0
 def __init__(self, items=None, item_class=None):
     TypedCollection.__init__(
         self,
         item_class=item_class,
         items=items,
     )
     items = items or []
     items = [self._item_coercer(_) for _ in items]
     self._collection = frozenset(items)
コード例 #8
0
ファイル: TypedList.py プロジェクト: jonathanmarmor/abjad
 def __init__(self, tokens=None, item_class=None, keep_sorted=None, custom_identifier=None):
     TypedCollection.__init__(self, item_class=item_class, custom_identifier=custom_identifier, tokens=tokens)
     self._collection = []
     if keep_sorted:
         self._keep_sorted = True
     else:
         self._keep_sorted = None
     tokens = tokens or []
     items = []
     for token in tokens:
         items.append(self._item_callable(token))
     self.extend(items)
コード例 #9
0
ファイル: TypedCounter.py プロジェクト: jefftrevino/abjad
 def __init__(
     self,
     items=None,
     item_class=None,
     **kwargs
     ):
     TypedCollection.__init__(
         self,
         item_class=item_class,
         items=items,
         )
     self._collection = collections.Counter()
     self.update(items, **kwargs)
コード例 #10
0
ファイル: TypedOrderedDict.py プロジェクト: jefftrevino/abjad
 def __init__(self, items=None, item_class=None):
     TypedCollection.__init__(self, item_class=item_class, items=items)
     if isinstance(items, collections.Mapping):
         items = items.items()
     items = items or []
     the_items = []
     for item in items:
         assert len(item) == 2, repr(item)
         key = item[0]
         value = self._item_coercer(item[1])
         the_item = (key, value)
         the_items.append(the_item)
     self._collection = collections.OrderedDict(items)
コード例 #11
0
ファイル: TypedCounter.py プロジェクト: adorsk/abjad
 def __init__(
     self, 
     tokens=None, 
     item_class=None, 
     custom_identifier=None, 
     **kwargs
     ):
     TypedCollection.__init__(self,
         item_class=item_class,
         custom_identifier=custom_identifier,
         tokens=tokens,
         )
     self._collection = collections.Counter()
     self.update(tokens, **kwargs)
コード例 #12
0
ファイル: TypedOrderedDict.py プロジェクト: willingc/abjad
 def __init__(self, items=None, item_class=None):
     TypedCollection.__init__(
         self,
         item_class=item_class,
         items=items,
         )
     items = items or []
     the_items = []
     for item in items:
         assert len(item) == 2, repr(item)
         key = item[0]
         value = self._item_callable(item[1])
         the_item = (key, value)
         the_items.append(the_item)
     self._collection = collections.OrderedDict(items)
コード例 #13
0
 def __init__(self, tokens=None, item_class=None):
     TypedCollection.__init__(
         self,
         item_class=item_class,
         tokens=tokens,
         )
     tokens = tokens or []
     items = []
     for token in tokens:
         assert len(token) == 2, repr(token)
         key = token[0]
         value = self._item_callable(token[1])
         item = (key, value)
         items.append(item)
     self._collection = collections.OrderedDict(items)
コード例 #14
0
ファイル: TypedList.py プロジェクト: Alwnikrotikz/abjad
 def __init__(self, tokens=None, item_class=None, name=None):
     TypedCollection.__init__(self, 
         item_class=item_class, 
         name=name,
         tokens=tokens,
         )
     self._collection = []
     if isinstance(tokens, type(self)):
         for token in tokens:
             self.append(self._item_callable(token))
     else:
         tokens = tokens or []
         items = []
         for token in tokens:
             items.append(self._item_callable(token))
         self.extend(items)
コード例 #15
0
 def __init__(self, items=None, item_class=None):
     TypedCollection.__init__(
         self,
         item_class=item_class,
         items=items,
     )
     if isinstance(items, collections.Mapping):
         items = items.items()
     items = items or []
     the_items = []
     for item in items:
         assert len(item) == 2, repr(item)
         key = item[0]
         value = self._item_coercer(item[1])
         the_item = (key, value)
         the_items.append(the_item)
     self._collection = collections.OrderedDict(items)
コード例 #16
0
ファイル: TypedList.py プロジェクト: quesebifurcan/abjad
 def __init__(
     self,
     items=None,
     item_class=None,
     keep_sorted=False,
 ):
     TypedCollection.__init__(
         self,
         item_class=item_class,
         items=items,
     )
     self._collection = []
     assert isinstance(keep_sorted, bool), repr(keep_sorted)
     self._keep_sorted = keep_sorted
     items = items or []
     the_items = []
     for item in items:
         the_items.append(self._item_coercer(item))
     self.extend(the_items)
コード例 #17
0
ファイル: TypedList.py プロジェクト: gkthiruvathukal/abjad
 def __init__(
     self,
     items=None,
     item_class=None,
     keep_sorted=False,
     ):
     TypedCollection.__init__(
         self,
         item_class=item_class,
         items=items,
         )
     self._collection = []
     assert isinstance(keep_sorted, bool), repr(keep_sorted)
     self._keep_sorted = keep_sorted
     items = items or []
     the_items = []
     for item in items:
         the_items.append(self._item_coercer(item))
     self.extend(the_items)
コード例 #18
0
ファイル: TypedCounter.py プロジェクト: Alwnikrotikz/abjad
 def __init__(self, tokens=None, item_class=None, name=None, **kwargs):
     TypedCollection.__init__(self, item_class=item_class, name=name, tokens=tokens)
     self._collection = collections.Counter()
     self.update(tokens, **kwargs)