Skip to content

Commit

Permalink
Merge pull request #1607 from cuthbertLab/unregister-sub-converter
Browse files Browse the repository at this point in the history
substitute deprecation for removal: converter.py
  • Loading branch information
mscuthbert committed Jun 14, 2023
2 parents d1263d4 + 9abb557 commit 31ff0aa
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 3 deletions.
27 changes: 27 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Read the Docs configuration file for music21
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.11"

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: documentation/source/conf.py

# Optionally build your docs in additional formats such as PDF and ePub
# formats:
# - pdf
# - epub

# Optional but recommended, declare the Python requirements required
# to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
# python:
# install:
# - requirements: docs/requirements.txt
2 changes: 1 addition & 1 deletion music21/common/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def runningInNotebook() -> bool:
return False


@deprecated
@deprecated('v9', 'v10', 'use runningInNotebook() instead')
def runningUnderIPython() -> bool: # pragma: no cover
'''
DEPRECATED in v9: use runningInNotebook() instead
Expand Down
25 changes: 23 additions & 2 deletions music21/converter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ def registerSubConverter(newSubConverter: type[subConverters.SubConverter]) -> N
'''
_registeredSubConverters.appendleft(newSubConverter)

@common.deprecated
@common.deprecated('v9', 'v10', 'use unregisterSubconverter with capital C')
def registerSubconverter(
newSubConverter: type[subConverters.SubConverter]
) -> None: # pragma: no cover
Expand Down Expand Up @@ -488,7 +488,7 @@ def unregisterSubConverter(
f'Could not remove {removeSubConverter!r} from registered subConverters')


@common.deprecated
@common.deprecated('v9', 'v10', 'use unregisterSubConverter with capital C')
def unregisterSubconverter(
newSubConverter: type[subConverters.SubConverter]
) -> None: # pragma: no cover
Expand Down Expand Up @@ -807,6 +807,13 @@ def parseURL(

# -----------------------------------------------------------------------#
# SubConverters
@common.deprecated('v9', 'v10', 'use subConvertersList with capital C')
def subconvertersList(
self,
converterType: t.Literal['any', 'input', 'output'] = 'any'
) -> list[type[subConverters.SubConverter]]: # pragma: no cover
return self.subConvertersList(converterType)

@staticmethod
def subConvertersList(
converterType: t.Literal['any', 'input', 'output'] = 'any'
Expand Down Expand Up @@ -938,6 +945,10 @@ def subConvertersList(

return filteredSubConvertersList

@common.deprecated('v9', 'v10', 'use defaultSubConverters with capital C')
def defaultSubconverters(self) -> list[type[subConverters.SubConverter]]: # pragma: no cover
return self.defaultSubConverters()

@staticmethod
def defaultSubConverters() -> list[type[subConverters.SubConverter]]:
'''
Expand Down Expand Up @@ -982,6 +993,12 @@ def defaultSubConverters() -> list[type[subConverters.SubConverter]]:
defaultSubConverters.append(possibleSubConverter)
return defaultSubConverters

@common.deprecated('v9', 'v10', 'use getSubConverterFormats with capital C')
def getSubconverterFormats(
self
) -> dict[str, type[subConverters.SubConverter]]: # pragma: no cover
return self.getSubConverterFormats()

@staticmethod
def getSubConverterFormats() -> dict[str, type[subConverters.SubConverter]]:
'''
Expand Down Expand Up @@ -1055,6 +1072,10 @@ def getSubConverterFromFormat(
subConverterClass = scf[converterFormat]
return subConverterClass()

@common.deprecated('v9', 'v10', 'use setSubConverterFromFormat with capital C')
def setSubconverterFromFormat(self, converterFormat: str): # pragma: no cover
self.setSubConverterFromFormat(converterFormat)

def setSubConverterFromFormat(self, converterFormat: str):
'''
sets the .subConverter according to the format of `converterFormat`:
Expand Down

0 comments on commit 31ff0aa

Please sign in to comment.