sagemaker.core.deprecations#

Module for deprecation abstractions.

Functions

deprecated([sdk_version])

Decorator for raising deprecated warning for a feature in sagemaker>=2

deprecated_class(cls, name)

Returns a class based on super class with a deprecation warning.

deprecated_deserialize(instance, name)

Modifies a deserializer instance deserialize method.

deprecated_function(func, name)

Wrap a function with a deprecation warning.

deprecated_serialize(instance, name)

Modifies a serializer instance serialize method.

deprecation_warn(name, date[, msg])

Raise a warning for soon to be deprecated feature in sagemaker>=2

deprecation_warn_base(msg)

Raise a warning for soon to be deprecated feature in sagemaker>=2

deprecation_warning(date[, msg])

Decorator for raising deprecation warning for a feature in sagemaker>=2

removed_arg(name, arg)

Checks if the deprecated argument is populated.

removed_function(name)

A no-op deprecated function factory.

removed_kwargs(name, kwargs)

Checks if the deprecated argument is in kwargs

removed_warning(phrase[, sdk_version])

Raise a warning for a no-op in sagemaker>=2

renamed_kwargs(old_name, new_name, value, kwargs)

Checks if the deprecated argument is in kwargs

renamed_warning(phrase)

Raise a warning for a rename in sagemaker>=2

sagemaker.core.deprecations.deprecated(sdk_version=None)[source]#

Decorator for raising deprecated warning for a feature in sagemaker>=2

Parameters:

sdk_version (str) – the sdk version of removal of support.

Usage:

@deprecated() def sample_function():

print(“xxxx….”)

@deprecated(sdk_version=”2.66”) class SampleClass():

def __init__(self):

print(“xxxx….”)

sagemaker.core.deprecations.deprecated_class(cls, name)[source]#

Returns a class based on super class with a deprecation warning.

Parameters:
  • cls – The class to derive with a deprecation warning on __init__

  • name – The name of the class.

Returns:

The modified class.

sagemaker.core.deprecations.deprecated_deserialize(instance, name)[source]#

Modifies a deserializer instance deserialize method.

Parameters:
  • instance – Instance to modify deserialize method.

  • name – The name that has been deprecated.

Returns:

The modified instance

sagemaker.core.deprecations.deprecated_function(func, name)[source]#

Wrap a function with a deprecation warning.

Parameters:
  • func – Function to wrap in a deprecation warning.

  • name – The name that has been deprecated.

Returns:

The modified function

sagemaker.core.deprecations.deprecated_serialize(instance, name)[source]#

Modifies a serializer instance serialize method.

Parameters:
  • instance – Instance to modify serialize method.

  • name – The name that has been deprecated.

Returns:

The modified instance

sagemaker.core.deprecations.deprecation_warn(name, date, msg=None)[source]#

Raise a warning for soon to be deprecated feature in sagemaker>=2

Parameters:
  • name (str) – Name of the feature

  • date (str) – the date when the feature will be deprecated

  • msg (str) – the prefix phrase of the warning message.

sagemaker.core.deprecations.deprecation_warn_base(msg)[source]#

Raise a warning for soon to be deprecated feature in sagemaker>=2

Parameters:

msg (str) – the warning message.

sagemaker.core.deprecations.deprecation_warning(date, msg=None)[source]#

Decorator for raising deprecation warning for a feature in sagemaker>=2

Parameters:
  • date (str) – the date when the feature will be deprecated

  • msg (str) – the prefix phrase of the warning message.

Usage:

@deprecation_warning(msg=”message”, date=”date”) def sample_function():

print(“xxxx….”)

@deprecation_warning(msg=”message”, date=”date”) class SampleClass():

def __init__(self):

print(“xxxx….”)

sagemaker.core.deprecations.removed_arg(name, arg)[source]#

Checks if the deprecated argument is populated.

Raises warning, if not None.

Parameters:
  • name – name of deprecated argument

  • arg – the argument to check

sagemaker.core.deprecations.removed_function(name)[source]#

A no-op deprecated function factory.

sagemaker.core.deprecations.removed_kwargs(name, kwargs)[source]#

Checks if the deprecated argument is in kwargs

Raises warning, if present.

Parameters:
  • name – name of deprecated argument

  • kwargs – keyword arguments dict

sagemaker.core.deprecations.removed_warning(phrase, sdk_version=None)[source]#

Raise a warning for a no-op in sagemaker>=2

Parameters:
  • phrase – the prefix phrase of the warning message.

  • sdk_version – the sdk version of removal of support.

sagemaker.core.deprecations.renamed_kwargs(old_name, new_name, value, kwargs)[source]#

Checks if the deprecated argument is in kwargs

Raises warning, if present.

Parameters:
  • old_name – name of deprecated argument

  • new_name – name of the new argument

  • value – value associated with new name, if supplied

  • kwargs – keyword arguments dict

Returns:

value of the keyword argument, if present

sagemaker.core.deprecations.renamed_warning(phrase)[source]#

Raise a warning for a rename in sagemaker>=2

Parameters:

phrase – the prefix phrase of the warning message.