Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faster deepcopy from reduce_ex #1464

Merged
merged 9 commits into from
Oct 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dist/dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
1. update the VERSION in _version.py and the single test cases in base.py.
2. run `corpus.corpora.CoreCorpus().cacheMetadata()`.
for a major change run corpus.corpora.CoreCorpus().rebuildMetadataCache()
(40 min on MacPro) -- either of these MAY change a lot of tests in corpus, metadata, etc.
so don't skip the next step!
(20 min on IntelMacbook Air) -- either of these MAY change a
lot of tests in corpus, metadata, etc. so don't skip the next step!
3. run test/warningMultiprocessTest.py for lowest and highest Py version -- fix all warnings!
4. run test/testLint.py and fix any lint errors (covered now by CI)
5. commit and then check test/testSingleCoreAll.py or wait for results on GitHub Actions
Expand Down
2 changes: 1 addition & 1 deletion music21/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
'''
from __future__ import annotations

__version__ = '9.0.0a4'
__version__ = '9.0.0a5'


def get_version_tuple(vv):
Expand Down
3 changes: 3 additions & 0 deletions music21/abcFormat/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3439,6 +3439,9 @@ def readstr(self, strSrc: str, number: int | None = None) -> ABCHandler:

# ------------------------------------------------------------------------------
class Test(unittest.TestCase):
def testCopyAndDeepcopy(self):
from music21.test.commonTest import testCopyAll
testCopyAll(self, globals())

def testTokenization(self):
from music21.abcFormat import testFiles
Expand Down
4 changes: 4 additions & 0 deletions music21/alpha/analysis/fixer.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,10 @@ def __init__(self, changes, midiStream, omrStream):
super().__init__(changes, midiStream, omrStream, recognizer)

class Test(unittest.TestCase):
def testCopyAndDeepcopy(self):
from music21.test.commonTest import testCopyAll
testCopyAll(self, globals())

def measuresEqual(self, m1, m2):
'''
Returns a tuple of (True/False, reason)
Expand Down
3 changes: 3 additions & 0 deletions music21/alpha/analysis/hasher.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,9 @@ def __new__(cls, tupEls):


class Test(unittest.TestCase):
def testCopyAndDeepcopy(self):
from music21.test.commonTest import testCopyAll
testCopyAll(self, globals())

def _approximatelyEqual(self, a, b, sig_fig=2):
'''
Expand Down
4 changes: 4 additions & 0 deletions music21/alpha/analysis/ornamentRecognizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,10 @@ def __init__(
self.isInverted = isInverted

class Test(unittest.TestCase):
def testCopyAndDeepcopy(self):
from music21.test.commonTest import testCopyAll
testCopyAll(self, globals())

def testRecognizeTurn(self):
# set up experiment
testConditions = []
Expand Down
3 changes: 3 additions & 0 deletions music21/alpha/analysis/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,9 @@ def findConsecutiveScale(source, targetScale, degreesRequired=5,

# ------------------------------------------------------------------------------
class Test(unittest.TestCase):
def testCopyAndDeepcopy(self):
from music21.test.commonTest import testCopyAll
testCopyAll(self, globals())

def testFindConsecutiveScaleA(self):
sc = scale.MajorScale('a4')
Expand Down
3 changes: 3 additions & 0 deletions music21/analysis/discrete.py
Original file line number Diff line number Diff line change
Expand Up @@ -1413,6 +1413,9 @@ def analysisClassFromMethodName(method: str) -> type[DiscreteAnalysis] | None:


class Test(unittest.TestCase):
def testCopyAndDeepcopy(self):
from music21.test.commonTest import testCopyAll
testCopyAll(self, globals())

def testKeyAnalysisKrumhansl(self):
from music21 import converter
Expand Down
3 changes: 3 additions & 0 deletions music21/analysis/reduction.py
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,9 @@ def getGraphHorizontalBarWeightedData(self):

# ------------------------------------------------------------------------------
class Test(unittest.TestCase):
def testCopyAndDeepcopy(self):
from music21.test.commonTest import testCopyAll
testCopyAll(self, globals())

def testExtractionA(self):
from music21 import analysis
Expand Down
14 changes: 6 additions & 8 deletions music21/analysis/transposition.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,11 @@
from music21 import chord
from music21 import common
from music21 import environment
from music21 import exceptions21
from music21 import pitch

environLocal = environment.Environment('analysis.transposition')


class TranspositionException(exceptions21.Music21Exception):
pass


class TranspositionChecker:
'''
Given a list of pitches, checks for the number of distinct transpositions.
Expand Down Expand Up @@ -55,14 +50,14 @@ class TranspositionChecker:
'''
def __init__(self, pitches: Iterable[pitch.Pitch] = ()):
if not pitches:
raise TranspositionException(
raise TypeError(
'Must have at least one element in list'
)
if not common.isIterable(pitches):
raise TranspositionException('Must be a list or tuple')
raise TypeError('Must be a list or tuple')
# p0 = pitches[0]
# if not isinstance(p0, pitch.Pitch):
# raise TranspositionException('List must have pitch objects')
# raise TypeError('List must have pitch objects')
self.pitches: Iterable[pitch.Pitch] = pitches
self.allTranspositions: list = []
self.allNormalOrders: list = []
Expand Down Expand Up @@ -191,6 +186,9 @@ def getPitchesOfDistinctTranspositions(self):

# ------------------------------------------------------------------------------
class Test(unittest.TestCase):
def testCopyAndDeepcopy(self):
from music21.test.commonTest import testCopyAll
testCopyAll(self, globals())

def testConstructTranspositionChecker(self):
p = [pitch.Pitch('D#')]
Expand Down
6 changes: 3 additions & 3 deletions music21/analysis/windowed.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,6 @@ def process(self,


# -----------------------------------------------------------------------------
class TestExternal(unittest.TestCase):
pass


class TestMockProcessor:

Expand All @@ -363,6 +360,9 @@ def process(self, subStream):


class Test(unittest.TestCase):
def testCopyAndDeepcopy(self):
from music21.test.commonTest import testCopyAll
testCopyAll(self, globals())

def testBasic(self):
from music21 import corpus
Expand Down
4 changes: 4 additions & 0 deletions music21/articulations.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,10 @@ class HandbellIndication(TechnicalIndication):

# ------------------------------------------------------------------------------
class Test(unittest.TestCase):
def testCopyAndDeepcopy(self):
from music21.test.commonTest import testCopyAll
testCopyAll(self, globals())


def testBasic(self):
a = FretBend()
Expand Down
3 changes: 3 additions & 0 deletions music21/bar.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,9 @@ def getTextExpression(self, prefix='', postfix='x'):

# ------------------------------------------------------------------------------
class Test(unittest.TestCase):
def testCopyAndDeepcopy(self):
from music21.test.commonTest import testCopyAll
testCopyAll(self, globals())

def testSortOrder(self):
from music21 import stream
Expand Down
Loading