metaflow 2.15.4__py2.py3-none-any.whl → 2.15.6__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. metaflow/_vendor/typeguard/_checkers.py +259 -95
  2. metaflow/_vendor/typeguard/_config.py +4 -4
  3. metaflow/_vendor/typeguard/_decorators.py +8 -12
  4. metaflow/_vendor/typeguard/_functions.py +33 -32
  5. metaflow/_vendor/typeguard/_pytest_plugin.py +40 -13
  6. metaflow/_vendor/typeguard/_suppression.py +3 -5
  7. metaflow/_vendor/typeguard/_transformer.py +84 -48
  8. metaflow/_vendor/typeguard/_union_transformer.py +1 -0
  9. metaflow/_vendor/typeguard/_utils.py +13 -9
  10. metaflow/_vendor/typing_extensions.py +1088 -500
  11. metaflow/_vendor/v3_7/__init__.py +1 -0
  12. metaflow/_vendor/v3_7/importlib_metadata/__init__.py +1063 -0
  13. metaflow/_vendor/v3_7/importlib_metadata/_adapters.py +68 -0
  14. metaflow/_vendor/v3_7/importlib_metadata/_collections.py +30 -0
  15. metaflow/_vendor/v3_7/importlib_metadata/_compat.py +71 -0
  16. metaflow/_vendor/v3_7/importlib_metadata/_functools.py +104 -0
  17. metaflow/_vendor/v3_7/importlib_metadata/_itertools.py +73 -0
  18. metaflow/_vendor/v3_7/importlib_metadata/_meta.py +48 -0
  19. metaflow/_vendor/v3_7/importlib_metadata/_text.py +99 -0
  20. metaflow/_vendor/v3_7/importlib_metadata/py.typed +0 -0
  21. metaflow/_vendor/v3_7/typeguard/__init__.py +48 -0
  22. metaflow/_vendor/v3_7/typeguard/_checkers.py +906 -0
  23. metaflow/_vendor/v3_7/typeguard/_config.py +108 -0
  24. metaflow/_vendor/v3_7/typeguard/_decorators.py +237 -0
  25. metaflow/_vendor/v3_7/typeguard/_exceptions.py +42 -0
  26. metaflow/_vendor/v3_7/typeguard/_functions.py +310 -0
  27. metaflow/_vendor/v3_7/typeguard/_importhook.py +213 -0
  28. metaflow/_vendor/v3_7/typeguard/_memo.py +48 -0
  29. metaflow/_vendor/v3_7/typeguard/_pytest_plugin.py +100 -0
  30. metaflow/_vendor/v3_7/typeguard/_suppression.py +88 -0
  31. metaflow/_vendor/v3_7/typeguard/_transformer.py +1207 -0
  32. metaflow/_vendor/v3_7/typeguard/_union_transformer.py +54 -0
  33. metaflow/_vendor/v3_7/typeguard/_utils.py +169 -0
  34. metaflow/_vendor/v3_7/typeguard/py.typed +0 -0
  35. metaflow/_vendor/v3_7/typing_extensions.py +3072 -0
  36. metaflow/_vendor/v3_7/zipp.py +329 -0
  37. metaflow/cmd/develop/stubs.py +1 -1
  38. metaflow/extension_support/__init__.py +1 -1
  39. metaflow/plugins/argo/argo_client.py +9 -2
  40. metaflow/plugins/argo/argo_workflows.py +79 -28
  41. metaflow/plugins/argo/argo_workflows_cli.py +16 -25
  42. metaflow/plugins/argo/argo_workflows_deployer_objects.py +5 -2
  43. metaflow/plugins/cards/card_modules/main.js +52 -50
  44. metaflow/plugins/metadata_providers/service.py +16 -7
  45. metaflow/plugins/pypi/utils.py +4 -0
  46. metaflow/runner/click_api.py +7 -2
  47. metaflow/runner/deployer.py +3 -2
  48. metaflow/vendor.py +1 -0
  49. metaflow/version.py +1 -1
  50. {metaflow-2.15.4.data → metaflow-2.15.6.data}/data/share/metaflow/devtools/Tiltfile +4 -4
  51. metaflow-2.15.6.dist-info/METADATA +103 -0
  52. {metaflow-2.15.4.dist-info → metaflow-2.15.6.dist-info}/RECORD +58 -32
  53. {metaflow-2.15.4.dist-info → metaflow-2.15.6.dist-info}/WHEEL +1 -1
  54. metaflow-2.15.4.dist-info/METADATA +0 -110
  55. {metaflow-2.15.4.data → metaflow-2.15.6.data}/data/share/metaflow/devtools/Makefile +0 -0
  56. {metaflow-2.15.4.data → metaflow-2.15.6.data}/data/share/metaflow/devtools/pick_services.sh +0 -0
  57. {metaflow-2.15.4.dist-info → metaflow-2.15.6.dist-info}/LICENSE +0 -0
  58. {metaflow-2.15.4.dist-info → metaflow-2.15.6.dist-info}/entry_points.txt +0 -0
  59. {metaflow-2.15.4.dist-info → metaflow-2.15.6.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,68 @@
1
+ import re
2
+ import textwrap
3
+ import email.message
4
+
5
+ from ._text import FoldedCase
6
+
7
+
8
+ class Message(email.message.Message):
9
+ multiple_use_keys = set(
10
+ map(
11
+ FoldedCase,
12
+ [
13
+ 'Classifier',
14
+ 'Obsoletes-Dist',
15
+ 'Platform',
16
+ 'Project-URL',
17
+ 'Provides-Dist',
18
+ 'Provides-Extra',
19
+ 'Requires-Dist',
20
+ 'Requires-External',
21
+ 'Supported-Platform',
22
+ 'Dynamic',
23
+ ],
24
+ )
25
+ )
26
+ """
27
+ Keys that may be indicated multiple times per PEP 566.
28
+ """
29
+
30
+ def __new__(cls, orig: email.message.Message):
31
+ res = super().__new__(cls)
32
+ vars(res).update(vars(orig))
33
+ return res
34
+
35
+ def __init__(self, *args, **kwargs):
36
+ self._headers = self._repair_headers()
37
+
38
+ # suppress spurious error from mypy
39
+ def __iter__(self):
40
+ return super().__iter__()
41
+
42
+ def _repair_headers(self):
43
+ def redent(value):
44
+ "Correct for RFC822 indentation"
45
+ if not value or '\n' not in value:
46
+ return value
47
+ return textwrap.dedent(' ' * 8 + value)
48
+
49
+ headers = [(key, redent(value)) for key, value in vars(self)['_headers']]
50
+ if self._payload:
51
+ headers.append(('Description', self.get_payload()))
52
+ return headers
53
+
54
+ @property
55
+ def json(self):
56
+ """
57
+ Convert PackageMetadata to a JSON-compatible format
58
+ per PEP 0566.
59
+ """
60
+
61
+ def transform(key):
62
+ value = self.get_all(key) if key in self.multiple_use_keys else self[key]
63
+ if key == 'Keywords':
64
+ value = re.split(r'\s+', value)
65
+ tk = key.lower().replace('-', '_')
66
+ return tk, value
67
+
68
+ return dict(map(transform, map(FoldedCase, self)))
@@ -0,0 +1,30 @@
1
+ import collections
2
+
3
+
4
+ # from jaraco.collections 3.3
5
+ class FreezableDefaultDict(collections.defaultdict):
6
+ """
7
+ Often it is desirable to prevent the mutation of
8
+ a default dict after its initial construction, such
9
+ as to prevent mutation during iteration.
10
+
11
+ >>> dd = FreezableDefaultDict(list)
12
+ >>> dd[0].append('1')
13
+ >>> dd.freeze()
14
+ >>> dd[1]
15
+ []
16
+ >>> len(dd)
17
+ 1
18
+ """
19
+
20
+ def __missing__(self, key):
21
+ return getattr(self, '_frozen', super().__missing__)(key)
22
+
23
+ def freeze(self):
24
+ self._frozen = lambda key: self.default_factory()
25
+
26
+
27
+ class Pair(collections.namedtuple('Pair', 'name value')):
28
+ @classmethod
29
+ def parse(cls, text):
30
+ return cls(*map(str.strip, text.split("=", 1)))
@@ -0,0 +1,71 @@
1
+ import sys
2
+ import platform
3
+
4
+
5
+ __all__ = ['install', 'NullFinder', 'Protocol']
6
+
7
+
8
+ try:
9
+ from typing import Protocol
10
+ except ImportError: # pragma: no cover
11
+ from metaflow._vendor.v3_7.typing_extensions import Protocol # type: ignore
12
+
13
+
14
+ def install(cls):
15
+ """
16
+ Class decorator for installation on sys.meta_path.
17
+
18
+ Adds the backport DistributionFinder to sys.meta_path and
19
+ attempts to disable the finder functionality of the stdlib
20
+ DistributionFinder.
21
+ """
22
+ sys.meta_path.append(cls())
23
+ disable_stdlib_finder()
24
+ return cls
25
+
26
+
27
+ def disable_stdlib_finder():
28
+ """
29
+ Give the backport primacy for discovering path-based distributions
30
+ by monkey-patching the stdlib O_O.
31
+
32
+ See #91 for more background for rationale on this sketchy
33
+ behavior.
34
+ """
35
+
36
+ def matches(finder):
37
+ return getattr(
38
+ finder, '__module__', None
39
+ ) == '_frozen_importlib_external' and hasattr(finder, 'find_distributions')
40
+
41
+ for finder in filter(matches, sys.meta_path): # pragma: nocover
42
+ del finder.find_distributions
43
+
44
+
45
+ class NullFinder:
46
+ """
47
+ A "Finder" (aka "MetaClassFinder") that never finds any modules,
48
+ but may find distributions.
49
+ """
50
+
51
+ @staticmethod
52
+ def find_spec(*args, **kwargs):
53
+ return None
54
+
55
+ # In Python 2, the import system requires finders
56
+ # to have a find_module() method, but this usage
57
+ # is deprecated in Python 3 in favor of find_spec().
58
+ # For the purposes of this finder (i.e. being present
59
+ # on sys.meta_path but having no other import
60
+ # system functionality), the two methods are identical.
61
+ find_module = find_spec
62
+
63
+
64
+ def pypy_partial(val):
65
+ """
66
+ Adjust for variable stacklevel on partial under PyPy.
67
+
68
+ Workaround for #327.
69
+ """
70
+ is_pypy = platform.python_implementation() == 'PyPy'
71
+ return val + is_pypy
@@ -0,0 +1,104 @@
1
+ import types
2
+ import functools
3
+
4
+
5
+ # from jaraco.functools 3.3
6
+ def method_cache(method, cache_wrapper=None):
7
+ """
8
+ Wrap lru_cache to support storing the cache data in the object instances.
9
+
10
+ Abstracts the common paradigm where the method explicitly saves an
11
+ underscore-prefixed protected property on first call and returns that
12
+ subsequently.
13
+
14
+ >>> class MyClass:
15
+ ... calls = 0
16
+ ...
17
+ ... @method_cache
18
+ ... def method(self, value):
19
+ ... self.calls += 1
20
+ ... return value
21
+
22
+ >>> a = MyClass()
23
+ >>> a.method(3)
24
+ 3
25
+ >>> for x in range(75):
26
+ ... res = a.method(x)
27
+ >>> a.calls
28
+ 75
29
+
30
+ Note that the apparent behavior will be exactly like that of lru_cache
31
+ except that the cache is stored on each instance, so values in one
32
+ instance will not flush values from another, and when an instance is
33
+ deleted, so are the cached values for that instance.
34
+
35
+ >>> b = MyClass()
36
+ >>> for x in range(35):
37
+ ... res = b.method(x)
38
+ >>> b.calls
39
+ 35
40
+ >>> a.method(0)
41
+ 0
42
+ >>> a.calls
43
+ 75
44
+
45
+ Note that if method had been decorated with ``functools.lru_cache()``,
46
+ a.calls would have been 76 (due to the cached value of 0 having been
47
+ flushed by the 'b' instance).
48
+
49
+ Clear the cache with ``.cache_clear()``
50
+
51
+ >>> a.method.cache_clear()
52
+
53
+ Same for a method that hasn't yet been called.
54
+
55
+ >>> c = MyClass()
56
+ >>> c.method.cache_clear()
57
+
58
+ Another cache wrapper may be supplied:
59
+
60
+ >>> cache = functools.lru_cache(maxsize=2)
61
+ >>> MyClass.method2 = method_cache(lambda self: 3, cache_wrapper=cache)
62
+ >>> a = MyClass()
63
+ >>> a.method2()
64
+ 3
65
+
66
+ Caution - do not subsequently wrap the method with another decorator, such
67
+ as ``@property``, which changes the semantics of the function.
68
+
69
+ See also
70
+ http://code.activestate.com/recipes/577452-a-memoize-decorator-for-instance-methods/
71
+ for another implementation and additional justification.
72
+ """
73
+ cache_wrapper = cache_wrapper or functools.lru_cache()
74
+
75
+ def wrapper(self, *args, **kwargs):
76
+ # it's the first call, replace the method with a cached, bound method
77
+ bound_method = types.MethodType(method, self)
78
+ cached_method = cache_wrapper(bound_method)
79
+ setattr(self, method.__name__, cached_method)
80
+ return cached_method(*args, **kwargs)
81
+
82
+ # Support cache clear even before cache has been created.
83
+ wrapper.cache_clear = lambda: None
84
+
85
+ return wrapper
86
+
87
+
88
+ # From jaraco.functools 3.3
89
+ def pass_none(func):
90
+ """
91
+ Wrap func so it's not called if its first param is None
92
+
93
+ >>> print_text = pass_none(print)
94
+ >>> print_text('text')
95
+ text
96
+ >>> print_text(None)
97
+ """
98
+
99
+ @functools.wraps(func)
100
+ def wrapper(param, *args, **kwargs):
101
+ if param is not None:
102
+ return func(param, *args, **kwargs)
103
+
104
+ return wrapper
@@ -0,0 +1,73 @@
1
+ from itertools import filterfalse
2
+
3
+
4
+ def unique_everseen(iterable, key=None):
5
+ "List unique elements, preserving order. Remember all elements ever seen."
6
+ # unique_everseen('AAAABBBCCDAABBB') --> A B C D
7
+ # unique_everseen('ABBCcAD', str.lower) --> A B C D
8
+ seen = set()
9
+ seen_add = seen.add
10
+ if key is None:
11
+ for element in filterfalse(seen.__contains__, iterable):
12
+ seen_add(element)
13
+ yield element
14
+ else:
15
+ for element in iterable:
16
+ k = key(element)
17
+ if k not in seen:
18
+ seen_add(k)
19
+ yield element
20
+
21
+
22
+ # copied from more_itertools 8.8
23
+ def always_iterable(obj, base_type=(str, bytes)):
24
+ """If *obj* is iterable, return an iterator over its items::
25
+
26
+ >>> obj = (1, 2, 3)
27
+ >>> list(always_iterable(obj))
28
+ [1, 2, 3]
29
+
30
+ If *obj* is not iterable, return a one-item iterable containing *obj*::
31
+
32
+ >>> obj = 1
33
+ >>> list(always_iterable(obj))
34
+ [1]
35
+
36
+ If *obj* is ``None``, return an empty iterable:
37
+
38
+ >>> obj = None
39
+ >>> list(always_iterable(None))
40
+ []
41
+
42
+ By default, binary and text strings are not considered iterable::
43
+
44
+ >>> obj = 'foo'
45
+ >>> list(always_iterable(obj))
46
+ ['foo']
47
+
48
+ If *base_type* is set, objects for which ``isinstance(obj, base_type)``
49
+ returns ``True`` won't be considered iterable.
50
+
51
+ >>> obj = {'a': 1}
52
+ >>> list(always_iterable(obj)) # Iterate over the dict's keys
53
+ ['a']
54
+ >>> list(always_iterable(obj, base_type=dict)) # Treat dicts as a unit
55
+ [{'a': 1}]
56
+
57
+ Set *base_type* to ``None`` to avoid any special handling and treat objects
58
+ Python considers iterable as iterable:
59
+
60
+ >>> obj = 'foo'
61
+ >>> list(always_iterable(obj, base_type=None))
62
+ ['f', 'o', 'o']
63
+ """
64
+ if obj is None:
65
+ return iter(())
66
+
67
+ if (base_type is not None) and isinstance(obj, base_type):
68
+ return iter((obj,))
69
+
70
+ try:
71
+ return iter(obj)
72
+ except TypeError:
73
+ return iter((obj,))
@@ -0,0 +1,48 @@
1
+ from ._compat import Protocol
2
+ from typing import Any, Dict, Iterator, List, TypeVar, Union
3
+
4
+
5
+ _T = TypeVar("_T")
6
+
7
+
8
+ class PackageMetadata(Protocol):
9
+ def __len__(self) -> int:
10
+ ... # pragma: no cover
11
+
12
+ def __contains__(self, item: str) -> bool:
13
+ ... # pragma: no cover
14
+
15
+ def __getitem__(self, key: str) -> str:
16
+ ... # pragma: no cover
17
+
18
+ def __iter__(self) -> Iterator[str]:
19
+ ... # pragma: no cover
20
+
21
+ def get_all(self, name: str, failobj: _T = ...) -> Union[List[Any], _T]:
22
+ """
23
+ Return all values associated with a possibly multi-valued key.
24
+ """
25
+
26
+ @property
27
+ def json(self) -> Dict[str, Union[str, List[str]]]:
28
+ """
29
+ A JSON-compatible form of the metadata.
30
+ """
31
+
32
+
33
+ class SimplePath(Protocol):
34
+ """
35
+ A minimal subset of pathlib.Path required by PathDistribution.
36
+ """
37
+
38
+ def joinpath(self) -> 'SimplePath':
39
+ ... # pragma: no cover
40
+
41
+ def __truediv__(self) -> 'SimplePath':
42
+ ... # pragma: no cover
43
+
44
+ def parent(self) -> 'SimplePath':
45
+ ... # pragma: no cover
46
+
47
+ def read_text(self) -> str:
48
+ ... # pragma: no cover
@@ -0,0 +1,99 @@
1
+ import re
2
+
3
+ from ._functools import method_cache
4
+
5
+
6
+ # from jaraco.text 3.5
7
+ class FoldedCase(str):
8
+ """
9
+ A case insensitive string class; behaves just like str
10
+ except compares equal when the only variation is case.
11
+
12
+ >>> s = FoldedCase('hello world')
13
+
14
+ >>> s == 'Hello World'
15
+ True
16
+
17
+ >>> 'Hello World' == s
18
+ True
19
+
20
+ >>> s != 'Hello World'
21
+ False
22
+
23
+ >>> s.index('O')
24
+ 4
25
+
26
+ >>> s.split('O')
27
+ ['hell', ' w', 'rld']
28
+
29
+ >>> sorted(map(FoldedCase, ['GAMMA', 'alpha', 'Beta']))
30
+ ['alpha', 'Beta', 'GAMMA']
31
+
32
+ Sequence membership is straightforward.
33
+
34
+ >>> "Hello World" in [s]
35
+ True
36
+ >>> s in ["Hello World"]
37
+ True
38
+
39
+ You may test for set inclusion, but candidate and elements
40
+ must both be folded.
41
+
42
+ >>> FoldedCase("Hello World") in {s}
43
+ True
44
+ >>> s in {FoldedCase("Hello World")}
45
+ True
46
+
47
+ String inclusion works as long as the FoldedCase object
48
+ is on the right.
49
+
50
+ >>> "hello" in FoldedCase("Hello World")
51
+ True
52
+
53
+ But not if the FoldedCase object is on the left:
54
+
55
+ >>> FoldedCase('hello') in 'Hello World'
56
+ False
57
+
58
+ In that case, use in_:
59
+
60
+ >>> FoldedCase('hello').in_('Hello World')
61
+ True
62
+
63
+ >>> FoldedCase('hello') > FoldedCase('Hello')
64
+ False
65
+ """
66
+
67
+ def __lt__(self, other):
68
+ return self.lower() < other.lower()
69
+
70
+ def __gt__(self, other):
71
+ return self.lower() > other.lower()
72
+
73
+ def __eq__(self, other):
74
+ return self.lower() == other.lower()
75
+
76
+ def __ne__(self, other):
77
+ return self.lower() != other.lower()
78
+
79
+ def __hash__(self):
80
+ return hash(self.lower())
81
+
82
+ def __contains__(self, other):
83
+ return super().lower().__contains__(other.lower())
84
+
85
+ def in_(self, other):
86
+ "Does self appear in other?"
87
+ return self in FoldedCase(other)
88
+
89
+ # cache lower since it's likely to be called frequently.
90
+ @method_cache
91
+ def lower(self):
92
+ return super().lower()
93
+
94
+ def index(self, sub):
95
+ return self.lower().index(sub.lower())
96
+
97
+ def split(self, splitter=' ', maxsplit=0):
98
+ pattern = re.compile(re.escape(splitter), re.I)
99
+ return pattern.split(self, maxsplit)
File without changes
@@ -0,0 +1,48 @@
1
+ import os
2
+ from typing import Any
3
+
4
+ from ._checkers import TypeCheckerCallable as TypeCheckerCallable
5
+ from ._checkers import TypeCheckLookupCallback as TypeCheckLookupCallback
6
+ from ._checkers import check_type_internal as check_type_internal
7
+ from ._checkers import checker_lookup_functions as checker_lookup_functions
8
+ from ._checkers import load_plugins as load_plugins
9
+ from ._config import CollectionCheckStrategy as CollectionCheckStrategy
10
+ from ._config import ForwardRefPolicy as ForwardRefPolicy
11
+ from ._config import TypeCheckConfiguration as TypeCheckConfiguration
12
+ from ._decorators import typechecked as typechecked
13
+ from ._decorators import typeguard_ignore as typeguard_ignore
14
+ from ._exceptions import InstrumentationWarning as InstrumentationWarning
15
+ from ._exceptions import TypeCheckError as TypeCheckError
16
+ from ._exceptions import TypeCheckWarning as TypeCheckWarning
17
+ from ._exceptions import TypeHintWarning as TypeHintWarning
18
+ from ._functions import TypeCheckFailCallback as TypeCheckFailCallback
19
+ from ._functions import check_type as check_type
20
+ from ._functions import warn_on_error as warn_on_error
21
+ from ._importhook import ImportHookManager as ImportHookManager
22
+ from ._importhook import TypeguardFinder as TypeguardFinder
23
+ from ._importhook import install_import_hook as install_import_hook
24
+ from ._memo import TypeCheckMemo as TypeCheckMemo
25
+ from ._suppression import suppress_type_checks as suppress_type_checks
26
+ from ._utils import Unset as Unset
27
+
28
+ # Re-export imports so they look like they live directly in this package
29
+ for value in list(locals().values()):
30
+ if getattr(value, "__module__", "").startswith(f"{__name__}."):
31
+ value.__module__ = __name__
32
+
33
+
34
+ config: TypeCheckConfiguration
35
+
36
+
37
+ def __getattr__(name: str) -> Any:
38
+ if name == "config":
39
+ from ._config import global_config
40
+
41
+ return global_config
42
+
43
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
44
+
45
+
46
+ # Automatically load checker lookup functions unless explicitly disabled
47
+ if "TYPEGUARD_DISABLE_PLUGIN_AUTOLOAD" not in os.environ:
48
+ load_plugins()