diff --git a/metaflow/extension_support.py b/metaflow/extension_support.py index b6d04935570..d6040b328e9 100644 --- a/metaflow/extension_support.py +++ b/metaflow/extension_support.py @@ -1,3 +1,5 @@ +from __future__ import print_function + import importlib import json import os diff --git a/metaflow/plugins/cards/card_datastore.py b/metaflow/plugins/cards/card_datastore.py index a31c26425ad..5065d4a7523 100644 --- a/metaflow/plugins/cards/card_datastore.py +++ b/metaflow/plugins/cards/card_datastore.py @@ -26,7 +26,8 @@ def path_spec_resolver(pathspec): splits = pathspec.split("/") - return (*splits, *[None] * (4 - len(splits))) + splits.extend([None] * (4 - len(splits))) + return tuple(splits) def is_file_present(path): diff --git a/metaflow/plugins/cards/card_modules/__init__.py b/metaflow/plugins/cards/card_modules/__init__.py index cd1e3105d60..3a1f0fac116 100644 --- a/metaflow/plugins/cards/card_modules/__init__.py +++ b/metaflow/plugins/cards/card_modules/__init__.py @@ -97,16 +97,15 @@ def _load_external_cards(): def _get_external_card_package_paths(): pkg_iter = _get_external_card_packages(with_paths=True) - if pkg_iter is None: - return None - for ( - mf_extension_parent_path, - relative_path_to_module, - _, - ) in pkg_iter: - module_pth = os.path.join(mf_extension_parent_path, relative_path_to_module) - arcname = relative_path_to_module - yield module_pth, arcname + if pkg_iter is not None: + for ( + mf_extension_parent_path, + relative_path_to_module, + _, + ) in pkg_iter: + module_pth = os.path.join(mf_extension_parent_path, relative_path_to_module) + arcname = relative_path_to_module + yield module_pth, arcname MF_EXTERNAL_CARDS = _load_external_cards() diff --git a/metaflow/plugins/cards/card_modules/renderer_tools.py b/metaflow/plugins/cards/card_modules/renderer_tools.py index 4f4e33e00e6..b930d1253c9 100644 --- a/metaflow/plugins/cards/card_modules/renderer_tools.py +++ b/metaflow/plugins/cards/card_modules/renderer_tools.py @@ -6,7 +6,7 @@ def _render_component_safely( - component, render_func, *args, return_error_component=True, **kwargs + component, render_func, return_error_component, *args, **kwargs ): rendered_obj = None try: @@ -42,8 +42,6 @@ def render_safely(func): """ # expects a renderer func def ret_func(self, *args, **kwargs): - return _render_component_safely( - self, func, *args, return_error_component=True, **kwargs - ) + return _render_component_safely(self, func, True, *args, **kwargs) return ret_func diff --git a/metaflow/plugins/cards/component_serializer.py b/metaflow/plugins/cards/component_serializer.py index 1d2ec7dd487..c120f229e00 100644 --- a/metaflow/plugins/cards/component_serializer.py +++ b/metaflow/plugins/cards/component_serializer.py @@ -35,12 +35,11 @@ class CardComponentCollector: - [x] Classes with `ALLOW_USER_COMPONENTS=False` are never default editable. - [x] The user can specify an `id` argument to a card, in which case the card is editable through `current.card[id].append`. - [x] A card with an id can be also default editable, if there are no other cards that are eligible to be default editable. - - [x] If multiple default-editable cards exist but only one card doesn’t have an id, the card without an id is considered to be default editable. - - [x] If we can’t resolve a single default editable card through the above rules, `current.card`.append calls show a warning but the call doesn’t fail. + - [x] If multiple default-editable cards exist but only one card doesn't have an id, the card without an id is considered to be default editable. + - [x] If we can't resolve a single default editable card through the above rules, `current.card`.append calls show a warning but the call doesn't fail. - [x] A card that is not default editable can be still edited through: - [x] its `current.card['myid']` - - [x] by looking it up by its type, e.g. `current.card.get(type=’pytorch’)`. - + - [x] by looking it up by its type, e.g. `current.card.get(type='pytorch')`. """ def __init__(self, logger=None):