Skip to content
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

Don't explicitly break py2 support #962

Merged
merged 3 commits into from
Feb 24, 2022
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions metaflow/extension_support.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import print_function

import importlib
import json
import os
Expand Down
3 changes: 2 additions & 1 deletion metaflow/plugins/cards/card_datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
19 changes: 9 additions & 10 deletions metaflow/plugins/cards/card_modules/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
6 changes: 2 additions & 4 deletions metaflow/plugins/cards/card_modules/renderer_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
7 changes: 3 additions & 4 deletions metaflow/plugins/cards/component_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 doesnt have an id, the card without an id is considered to be default editable.
- [x] If we cant resolve a single default editable card through the above rules, `current.card`.append calls show a warning but the call doesnt 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):
Expand Down