The InstalledCode and PortableCode have been introduced already some time ago as the refactored version of the legacy Code class. The latter has been deprecated for that reason, but for backwards compatibility reasons, the new implementations still need to keep the legacy class as a base class. Unfortunately, this meant that the deprecation warning was also shown when users instantiated an instance of the new classes, which would be confusing.
The deprecation warning had already been moved from module level to the constructor of the Code class to prevent it from showing merely upon import of the aiida.orm package. As a final work around, the new classes define the _EMIT_CODE_DEPRECATION_WARNING class attribute which is checked in the Code constructor such that when set, the deprecation warning is skipped.
The
InstalledCode
andPortableCode
have been introduced already some time ago as the refactored version of the legacyCode
class. The latter has been deprecated for that reason, but for backwards compatibility reasons, the new implementations still need to keep the legacy class as a base class. Unfortunately, this meant that the deprecation warning was also shown when users instantiated an instance of the new classes, which would be confusing.The deprecation warning had already been moved from module level to the constructor of the
Code
class to prevent it from showing merely upon import of theaiida.orm
package. As a final work around, the new classes define the_EMIT_CODE_DEPRECATION_WARNING
class attribute which is checked in theCode
constructor such that when set, the deprecation warning is skipped.