Renamed names#
Renamed public names (DESIGN D17).
Every rename of a public name is one Rename in RENAMES. While its alias
is active, the old name still works and warns with PyTESDeprecationWarning; once
the alias is retired, the old name raises an error that gives the new one. The entry is
never deleted, so that the error keeps pointing to the new name.
The kinds of names covered:
"object": a class or function, by its full dotted path. The module that held the old name sets__getattr__ = module_getattr(__name__)."option": the name of a model option, checked bypytes.BaseModel.process_options().
Variable and parameter names are not covered yet (DESIGN §3): PyBaMM looks them up itself.
To silence the warnings, filter PyTESDeprecationWarning; to find old names in your
own code, turn it into an error (python -W error::DeprecationWarning).
- exception pytes.deprecation.PyTESDeprecationWarning[source]#
Bases:
DeprecationWarningA PyTES name was renamed; the old name still works, but will stop working
- class pytes.deprecation.Rename(kind: str, old: str, new: str, finding: str, renamed_in: str, removed_in: str, alias: bool = True)[source]#
Bases:
objectA renamed public name.
- Parameters:
kind (
str) –"object"or"option"(seepytes.deprecation).old (
str) – The old name; for an object, its full dotted path.new (
str) – The new name; for an object, its full dotted path.finding (
str) – The entry indocs/design/findings.mdthat logs the rename, e.g."F-050".renamed_in (
str) – The release that renamed it.removed_in (
str) – The release from which the old name no longer works. Equal torenamed_infor a rename without an alias.alias (
bool, optional) – Whether the old name still works, with a warning (default). Set to False when a release reachesremoved_in; the tests fail until then.
- property message#
What happened to the old name and what to use instead
- pytes.deprecation.RENAMES = (Rename(kind='option', old='storage', new='storage along flow path', finding='F-050', renamed_in='0.1.0a3', removed_in='0.1.0a3', alias=False), Rename(kind='object', old='pytes.experiments.step.ConstantInputs', new='pytes.experiments.step.Inlet', finding='F-054', renamed_in='0.1.0a3', removed_in='0.2.0', alias=True), Rename(kind='object', old='pytes.experiments.step.ConstantPower', new='pytes.experiments.step.Power', finding='F-054', renamed_in='0.1.0a3', removed_in='0.2.0', alias=True), Rename(kind='object', old='pytes.submodels.LedgerWallCoupling', new='pytes.submodels.WallCoupling', finding='F-054', renamed_in='0.1.0a3', removed_in='0.2.0', alias=True), Rename(kind='object', old='pytes.submodels.coupling.LedgerWallCoupling', new='pytes.submodels.coupling.WallCoupling', finding='F-054', renamed_in='0.1.0a3', removed_in='0.2.0', alias=True), Rename(kind='object', old='pytes.submodels.FinPCMCoupling', new='pytes.submodels.FinStorageCoupling', finding='F-054', renamed_in='0.1.0a3', removed_in='0.2.0', alias=True), Rename(kind='object', old='pytes.submodels.coupling.FinPCMCoupling', new='pytes.submodels.coupling.FinStorageCoupling', finding='F-054', renamed_in='0.1.0a3', removed_in='0.2.0', alias=True))#
Every renamed public name, oldest first