Skip to content

Very minor: Better documentation comment on DeferredError. #469

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

Merged
merged 4 commits into from
Nov 11, 2018
Merged
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
10 changes: 9 additions & 1 deletion src/sagemaker/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,18 @@ def download_file(bucket_name, path, target, sagemaker_session):


class DeferredError(object):
"""Stores an exception and raises it at a later time anytime this
"""Stores an exception and raises it at a later time if this
object is accessed in any way. Useful to allow soft-dependencies on imports,
so that the ImportError can be raised again later if code actually
relies on the missing library.

Example::

try:
import obscurelib
except ImportError as e:
logging.warning("Failed to import obscurelib. Obscure features will not work.")
obscurelib = DeferredError(e)
"""

def __init__(self, exception):
Expand Down