本文整理汇总了Python中music21.common.wrapWeakref函数的典型用法代码示例。如果您正苦于以下问题:Python wrapWeakref函数的具体用法?Python wrapWeakref怎么用?Python wrapWeakref使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wrapWeakref函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: testWeakref
def testWeakref(self):
from music21 import note
n = note.Note()
idStored = id(n)
wn = common.wrapWeakref(n)
n2 = common.unwrapWeakref(n)
self.assertEqual(id(n), id(n2))
开发者ID:jamesdoherty,项目名称:music21,代码行数:8,代码来源:spanners.py
示例2: setContainer
def setContainer(self, container):
# container is the Stream that contains
if container is None:
self._containerId = None
self._container = None
else:
self._containerId = id(container)
self._container = common.wrapWeakref(container)
开发者ID:Grahack,项目名称:music21,代码行数:8,代码来源:derivation.py
示例3: client
def client(self, client):
# client is the Stream that this derivation lives on
if client is None:
self._clientId = None
self._client = None
else:
self._clientId = id(client)
self._client = common.wrapWeakref(client)
开发者ID:ABC-B,项目名称:music21,代码行数:8,代码来源:derivation.py
示例4: wrapWeakref
def wrapWeakref(self):
'''Wrap all stored objects with weakrefs.
'''
if not common.isWeakref(self._container):
# update id in case it has changed
self._containerId = id(self._container)
post = common.wrapWeakref(self._container)
self._container = post
开发者ID:chrislehrich,项目名称:music21,代码行数:8,代码来源:derivation.py
示例5: add
def add(self, spanner, component):
"""Add a spanner and one or more component references.
The `spanner` is the object represent the connections, such as a Slur or GroupBracket.
The `component` is one or more (a list) objects, such as Note or Part.
If the spanner already exists, the component will be added to the components list.
>>> from music21 import *
>>> class TestMock(object): pass
>>> tm1 = TestMock()
>>> n1 = note.Note('c2')
>>> n2 = note.Note('g3')
>>> sp1 = Spanners()
>>> sp1.add(tm1, [n1, n2])
>>> len(sp1)
1
"""
idSpanner = id(spanner)
if idSpanner not in self.keys():
self._storage[idSpanner] = (common.wrapWeakref(spanner), [])
self._idRef[idSpanner] = [] # just a list
refPair = self._storage[idSpanner]
idList = self._idRef[idSpanner]
# presently this does not look for redundant entries
# store component as weak ref
if common.isListLike(component):
bundle = component
else: # just append one
bundle = [component]
for sub in bundle: # permit a lost of spanners
refPair[1].append(common.wrapWeakref(sub))
idList.append(id(sub))
开发者ID:jamesdoherty,项目名称:music21,代码行数:38,代码来源:spanners.py
示例6: client
def client(self, client):
# client is the Stream that this status lives on
self._client = common.wrapWeakref(client)
开发者ID:Aminor7,项目名称:music21,代码行数:3,代码来源:streamStatus.py
示例7: __setstate__
def __setstate__(self, state):
SlottedObject.__setstate__(self, state)
self._client = common.wrapWeakref(self._client)
开发者ID:Aminor7,项目名称:music21,代码行数:3,代码来源:streamStatus.py
示例8: __init__
def __init__(self, parent, stateInfo):
self.affectedTokens = []
self.parent = common.wrapWeakref(parent)
self.stateInfo = stateInfo
开发者ID:00gavin,项目名称:music21,代码行数:4,代码来源:tinyNotation.py
示例9: client
def client(self, referent):
self._client = common.wrapWeakref(referent)
开发者ID:cuthbertLab,项目名称:music21,代码行数:2,代码来源:axis.py
示例10: __setstate__
def __setstate__(self, state):
common.SlottedObject.__setstate__(self, state)
if WEAKREF_ACTIVE:
self.siteWeakref = common.wrapWeakref(self.siteWeakref)
开发者ID:05565,项目名称:music21,代码行数:4,代码来源:sites.py
示例11: _setParent
def _setParent(self, parent):
if parent is not None:
if hasattr(parent, 'classes') and 'NotRest' in parent.classes:
self._parent = common.wrapWeakref(parent)
else:
self._parent = None
开发者ID:msampaio,项目名称:music21,代码行数:6,代码来源:volume.py
示例12: element
def element(self, expr):
self._source = common.wrapWeakref(expr)
开发者ID:blakme,项目名称:music21,代码行数:2,代码来源:timespanTree.py
示例13: corpus
def corpus(self, newCorpus):
self._corpus = common.wrapWeakref(newCorpus)
开发者ID:sbrother,项目名称:music21,代码行数:2,代码来源:bundles.py
示例14: _setAndWrapSite
def _setAndWrapSite(self, site):
if WEAKREF_ACTIVE:
self.siteWeakref = common.wrapWeakref(site)
else:
self.siteWeakref = site
开发者ID:spyamine,项目名称:music21,代码行数:5,代码来源:sites.py
示例15: _setParent
def _setParent(self, parent):
self._parent = common.wrapWeakref(parent)
开发者ID:matyastr,项目名称:msps,代码行数:2,代码来源:clercqTemperley.py
示例16: client
def client(self, client):
if client is not None:
if hasattr(client, 'classes') and 'NotRest' in client.classes:
self._client = common.wrapWeakref(client)
else:
self._client = None
开发者ID:willingc,项目名称:music21,代码行数:6,代码来源:volume.py
示例17: _setAndWrapSite
def _setAndWrapSite(self, site):
self.siteWeakref = common.wrapWeakref(site)
开发者ID:ifitz,项目名称:music21,代码行数:2,代码来源:sites.py
注:本文中的music21.common.wrapWeakref函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论