prasb commited on
Commit
74e3ef4
·
verified ·
1 Parent(s): 9de51c9

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +6 -0
  2. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/PySocks-1.7.1.dist-info/INSTALLER +1 -0
  3. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/attr/__init__.py +80 -0
  4. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/attr/_cmp.py +154 -0
  5. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/attr/_compat.py +261 -0
  6. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/attr/_funcs.py +422 -0
  7. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/attr/_next_gen.py +216 -0
  8. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/attr/_version_info.py +87 -0
  9. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/attr/_version_info.pyi +9 -0
  10. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/attr/converters.pyi +13 -0
  11. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/attr/exceptions.py +94 -0
  12. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/attr/filters.py +54 -0
  13. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/attr/filters.pyi +6 -0
  14. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/attr/py.typed +0 -0
  15. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/attr/setters.py +79 -0
  16. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/attr/setters.pyi +19 -0
  17. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/attr/validators.py +561 -0
  18. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/attr/validators.pyi +78 -0
  19. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/caffe2/__init__.py +6 -0
  20. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/cffi-1.16.0.dist-info/INSTALLER +1 -0
  21. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/cffi-1.16.0.dist-info/LICENSE +26 -0
  22. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/cffi-1.16.0.dist-info/METADATA +39 -0
  23. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/cffi-1.16.0.dist-info/RECORD +50 -0
  24. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/cffi-1.16.0.dist-info/REQUESTED +0 -0
  25. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/cffi-1.16.0.dist-info/WHEEL +5 -0
  26. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/cffi-1.16.0.dist-info/direct_url.json +1 -0
  27. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/cffi-1.16.0.dist-info/entry_points.txt +2 -0
  28. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/cffi-1.16.0.dist-info/top_level.txt +2 -0
  29. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/conda_package_streaming-0.9.0.dist-info/INSTALLER +1 -0
  30. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/conda_package_streaming-0.9.0.dist-info/LICENSE +53 -0
  31. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/conda_package_streaming-0.9.0.dist-info/METADATA +123 -0
  32. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/conda_package_streaming-0.9.0.dist-info/RECORD +23 -0
  33. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/conda_package_streaming-0.9.0.dist-info/REQUESTED +0 -0
  34. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/conda_package_streaming-0.9.0.dist-info/WHEEL +4 -0
  35. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/conda_package_streaming-0.9.0.dist-info/direct_url.json +1 -0
  36. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/ema_pytorch/__init__.py +1 -0
  37. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/ema_pytorch/ema_pytorch.py +148 -0
  38. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/h5py/_conv.cpython-38-x86_64-linux-gnu.so +3 -0
  39. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/h5py/h5a.cpython-38-x86_64-linux-gnu.so +3 -0
  40. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/h5py/h5i.cpython-38-x86_64-linux-gnu.so +3 -0
  41. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/h5py/h5p.cpython-38-x86_64-linux-gnu.so +3 -0
  42. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/imageio_ffmpeg-0.4.7.dist-info/INSTALLER +1 -0
  43. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/imageio_ffmpeg-0.4.7.dist-info/LICENSE +25 -0
  44. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/imageio_ffmpeg-0.4.7.dist-info/METADATA +42 -0
  45. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/imageio_ffmpeg-0.4.7.dist-info/RECORD +19 -0
  46. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/imageio_ffmpeg-0.4.7.dist-info/REQUESTED +0 -0
  47. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/imageio_ffmpeg-0.4.7.dist-info/WHEEL +4 -0
  48. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/imageio_ffmpeg-0.4.7.dist-info/top_level.txt +1 -0
  49. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/importlib_metadata/__init__.py +1095 -0
  50. my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/importlib_metadata/_adapters.py +68 -0
.gitattributes CHANGED
@@ -273,3 +273,9 @@ my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/h5py/h5l.cp
273
  my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/torchvision.libs/libpng16.7f72a3c5.so.16 filter=lfs diff=lfs merge=lfs -text
274
  my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/h5py/_errors.cpython-38-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
275
  my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/matplotlib/_path.cpython-38-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
273
  my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/torchvision.libs/libpng16.7f72a3c5.so.16 filter=lfs diff=lfs merge=lfs -text
274
  my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/h5py/_errors.cpython-38-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
275
  my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/matplotlib/_path.cpython-38-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
276
+ my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/torchaudio/_torchaudio_decoder.so filter=lfs diff=lfs merge=lfs -text
277
+ my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/h5py/h5a.cpython-38-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
278
+ my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/h5py/h5p.cpython-38-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
279
+ my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/h5py/h5i.cpython-38-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
280
+ my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/h5py/_conv.cpython-38-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
281
+ my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/zstandard/_cffi.cpython-38-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/PySocks-1.7.1.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ conda
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/attr/__init__.py ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SPDX-License-Identifier: MIT
2
+
3
+ from __future__ import absolute_import, division, print_function
4
+
5
+ import sys
6
+
7
+ from functools import partial
8
+
9
+ from . import converters, exceptions, filters, setters, validators
10
+ from ._cmp import cmp_using
11
+ from ._config import get_run_validators, set_run_validators
12
+ from ._funcs import asdict, assoc, astuple, evolve, has, resolve_types
13
+ from ._make import (
14
+ NOTHING,
15
+ Attribute,
16
+ Factory,
17
+ attrib,
18
+ attrs,
19
+ fields,
20
+ fields_dict,
21
+ make_class,
22
+ validate,
23
+ )
24
+ from ._version_info import VersionInfo
25
+
26
+
27
+ __version__ = "21.4.0"
28
+ __version_info__ = VersionInfo._from_version_string(__version__)
29
+
30
+ __title__ = "attrs"
31
+ __description__ = "Classes Without Boilerplate"
32
+ __url__ = "https://www.attrs.org/"
33
+ __uri__ = __url__
34
+ __doc__ = __description__ + " <" + __uri__ + ">"
35
+
36
+ __author__ = "Hynek Schlawack"
37
+ __email__ = "hs@ox.cx"
38
+
39
+ __license__ = "MIT"
40
+ __copyright__ = "Copyright (c) 2015 Hynek Schlawack"
41
+
42
+
43
+ s = attributes = attrs
44
+ ib = attr = attrib
45
+ dataclass = partial(attrs, auto_attribs=True) # happy Easter ;)
46
+
47
+ __all__ = [
48
+ "Attribute",
49
+ "Factory",
50
+ "NOTHING",
51
+ "asdict",
52
+ "assoc",
53
+ "astuple",
54
+ "attr",
55
+ "attrib",
56
+ "attributes",
57
+ "attrs",
58
+ "cmp_using",
59
+ "converters",
60
+ "evolve",
61
+ "exceptions",
62
+ "fields",
63
+ "fields_dict",
64
+ "filters",
65
+ "get_run_validators",
66
+ "has",
67
+ "ib",
68
+ "make_class",
69
+ "resolve_types",
70
+ "s",
71
+ "set_run_validators",
72
+ "setters",
73
+ "validate",
74
+ "validators",
75
+ ]
76
+
77
+ if sys.version_info[:2] >= (3, 6):
78
+ from ._next_gen import define, field, frozen, mutable # noqa: F401
79
+
80
+ __all__.extend(("define", "field", "frozen", "mutable"))
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/attr/_cmp.py ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SPDX-License-Identifier: MIT
2
+
3
+ from __future__ import absolute_import, division, print_function
4
+
5
+ import functools
6
+
7
+ from ._compat import new_class
8
+ from ._make import _make_ne
9
+
10
+
11
+ _operation_names = {"eq": "==", "lt": "<", "le": "<=", "gt": ">", "ge": ">="}
12
+
13
+
14
+ def cmp_using(
15
+ eq=None,
16
+ lt=None,
17
+ le=None,
18
+ gt=None,
19
+ ge=None,
20
+ require_same_type=True,
21
+ class_name="Comparable",
22
+ ):
23
+ """
24
+ Create a class that can be passed into `attr.ib`'s ``eq``, ``order``, and
25
+ ``cmp`` arguments to customize field comparison.
26
+
27
+ The resulting class will have a full set of ordering methods if
28
+ at least one of ``{lt, le, gt, ge}`` and ``eq`` are provided.
29
+
30
+ :param Optional[callable] eq: `callable` used to evaluate equality
31
+ of two objects.
32
+ :param Optional[callable] lt: `callable` used to evaluate whether
33
+ one object is less than another object.
34
+ :param Optional[callable] le: `callable` used to evaluate whether
35
+ one object is less than or equal to another object.
36
+ :param Optional[callable] gt: `callable` used to evaluate whether
37
+ one object is greater than another object.
38
+ :param Optional[callable] ge: `callable` used to evaluate whether
39
+ one object is greater than or equal to another object.
40
+
41
+ :param bool require_same_type: When `True`, equality and ordering methods
42
+ will return `NotImplemented` if objects are not of the same type.
43
+
44
+ :param Optional[str] class_name: Name of class. Defaults to 'Comparable'.
45
+
46
+ See `comparison` for more details.
47
+
48
+ .. versionadded:: 21.1.0
49
+ """
50
+
51
+ body = {
52
+ "__slots__": ["value"],
53
+ "__init__": _make_init(),
54
+ "_requirements": [],
55
+ "_is_comparable_to": _is_comparable_to,
56
+ }
57
+
58
+ # Add operations.
59
+ num_order_functions = 0
60
+ has_eq_function = False
61
+
62
+ if eq is not None:
63
+ has_eq_function = True
64
+ body["__eq__"] = _make_operator("eq", eq)
65
+ body["__ne__"] = _make_ne()
66
+
67
+ if lt is not None:
68
+ num_order_functions += 1
69
+ body["__lt__"] = _make_operator("lt", lt)
70
+
71
+ if le is not None:
72
+ num_order_functions += 1
73
+ body["__le__"] = _make_operator("le", le)
74
+
75
+ if gt is not None:
76
+ num_order_functions += 1
77
+ body["__gt__"] = _make_operator("gt", gt)
78
+
79
+ if ge is not None:
80
+ num_order_functions += 1
81
+ body["__ge__"] = _make_operator("ge", ge)
82
+
83
+ type_ = new_class(class_name, (object,), {}, lambda ns: ns.update(body))
84
+
85
+ # Add same type requirement.
86
+ if require_same_type:
87
+ type_._requirements.append(_check_same_type)
88
+
89
+ # Add total ordering if at least one operation was defined.
90
+ if 0 < num_order_functions < 4:
91
+ if not has_eq_function:
92
+ # functools.total_ordering requires __eq__ to be defined,
93
+ # so raise early error here to keep a nice stack.
94
+ raise ValueError(
95
+ "eq must be define is order to complete ordering from "
96
+ "lt, le, gt, ge."
97
+ )
98
+ type_ = functools.total_ordering(type_)
99
+
100
+ return type_
101
+
102
+
103
+ def _make_init():
104
+ """
105
+ Create __init__ method.
106
+ """
107
+
108
+ def __init__(self, value):
109
+ """
110
+ Initialize object with *value*.
111
+ """
112
+ self.value = value
113
+
114
+ return __init__
115
+
116
+
117
+ def _make_operator(name, func):
118
+ """
119
+ Create operator method.
120
+ """
121
+
122
+ def method(self, other):
123
+ if not self._is_comparable_to(other):
124
+ return NotImplemented
125
+
126
+ result = func(self.value, other.value)
127
+ if result is NotImplemented:
128
+ return NotImplemented
129
+
130
+ return result
131
+
132
+ method.__name__ = "__%s__" % (name,)
133
+ method.__doc__ = "Return a %s b. Computed by attrs." % (
134
+ _operation_names[name],
135
+ )
136
+
137
+ return method
138
+
139
+
140
+ def _is_comparable_to(self, other):
141
+ """
142
+ Check whether `other` is comparable to `self`.
143
+ """
144
+ for func in self._requirements:
145
+ if not func(self, other):
146
+ return False
147
+ return True
148
+
149
+
150
+ def _check_same_type(self, other):
151
+ """
152
+ Return True if *self* and *other* are of the same type, False otherwise.
153
+ """
154
+ return other.value.__class__ is self.value.__class__
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/attr/_compat.py ADDED
@@ -0,0 +1,261 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SPDX-License-Identifier: MIT
2
+
3
+ from __future__ import absolute_import, division, print_function
4
+
5
+ import platform
6
+ import sys
7
+ import threading
8
+ import types
9
+ import warnings
10
+
11
+
12
+ PY2 = sys.version_info[0] == 2
13
+ PYPY = platform.python_implementation() == "PyPy"
14
+ PY36 = sys.version_info[:2] >= (3, 6)
15
+ HAS_F_STRINGS = PY36
16
+ PY310 = sys.version_info[:2] >= (3, 10)
17
+
18
+
19
+ if PYPY or PY36:
20
+ ordered_dict = dict
21
+ else:
22
+ from collections import OrderedDict
23
+
24
+ ordered_dict = OrderedDict
25
+
26
+
27
+ if PY2:
28
+ from collections import Mapping, Sequence
29
+
30
+ from UserDict import IterableUserDict
31
+
32
+ # We 'bundle' isclass instead of using inspect as importing inspect is
33
+ # fairly expensive (order of 10-15 ms for a modern machine in 2016)
34
+ def isclass(klass):
35
+ return isinstance(klass, (type, types.ClassType))
36
+
37
+ def new_class(name, bases, kwds, exec_body):
38
+ """
39
+ A minimal stub of types.new_class that we need for make_class.
40
+ """
41
+ ns = {}
42
+ exec_body(ns)
43
+
44
+ return type(name, bases, ns)
45
+
46
+ # TYPE is used in exceptions, repr(int) is different on Python 2 and 3.
47
+ TYPE = "type"
48
+
49
+ def iteritems(d):
50
+ return d.iteritems()
51
+
52
+ # Python 2 is bereft of a read-only dict proxy, so we make one!
53
+ class ReadOnlyDict(IterableUserDict):
54
+ """
55
+ Best-effort read-only dict wrapper.
56
+ """
57
+
58
+ def __setitem__(self, key, val):
59
+ # We gently pretend we're a Python 3 mappingproxy.
60
+ raise TypeError(
61
+ "'mappingproxy' object does not support item assignment"
62
+ )
63
+
64
+ def update(self, _):
65
+ # We gently pretend we're a Python 3 mappingproxy.
66
+ raise AttributeError(
67
+ "'mappingproxy' object has no attribute 'update'"
68
+ )
69
+
70
+ def __delitem__(self, _):
71
+ # We gently pretend we're a Python 3 mappingproxy.
72
+ raise TypeError(
73
+ "'mappingproxy' object does not support item deletion"
74
+ )
75
+
76
+ def clear(self):
77
+ # We gently pretend we're a Python 3 mappingproxy.
78
+ raise AttributeError(
79
+ "'mappingproxy' object has no attribute 'clear'"
80
+ )
81
+
82
+ def pop(self, key, default=None):
83
+ # We gently pretend we're a Python 3 mappingproxy.
84
+ raise AttributeError(
85
+ "'mappingproxy' object has no attribute 'pop'"
86
+ )
87
+
88
+ def popitem(self):
89
+ # We gently pretend we're a Python 3 mappingproxy.
90
+ raise AttributeError(
91
+ "'mappingproxy' object has no attribute 'popitem'"
92
+ )
93
+
94
+ def setdefault(self, key, default=None):
95
+ # We gently pretend we're a Python 3 mappingproxy.
96
+ raise AttributeError(
97
+ "'mappingproxy' object has no attribute 'setdefault'"
98
+ )
99
+
100
+ def __repr__(self):
101
+ # Override to be identical to the Python 3 version.
102
+ return "mappingproxy(" + repr(self.data) + ")"
103
+
104
+ def metadata_proxy(d):
105
+ res = ReadOnlyDict()
106
+ res.data.update(d) # We blocked update, so we have to do it like this.
107
+ return res
108
+
109
+ def just_warn(*args, **kw): # pragma: no cover
110
+ """
111
+ We only warn on Python 3 because we are not aware of any concrete
112
+ consequences of not setting the cell on Python 2.
113
+ """
114
+
115
+ else: # Python 3 and later.
116
+ from collections.abc import Mapping, Sequence # noqa
117
+
118
+ def just_warn(*args, **kw):
119
+ """
120
+ We only warn on Python 3 because we are not aware of any concrete
121
+ consequences of not setting the cell on Python 2.
122
+ """
123
+ warnings.warn(
124
+ "Running interpreter doesn't sufficiently support code object "
125
+ "introspection. Some features like bare super() or accessing "
126
+ "__class__ will not work with slotted classes.",
127
+ RuntimeWarning,
128
+ stacklevel=2,
129
+ )
130
+
131
+ def isclass(klass):
132
+ return isinstance(klass, type)
133
+
134
+ TYPE = "class"
135
+
136
+ def iteritems(d):
137
+ return d.items()
138
+
139
+ new_class = types.new_class
140
+
141
+ def metadata_proxy(d):
142
+ return types.MappingProxyType(dict(d))
143
+
144
+
145
+ def make_set_closure_cell():
146
+ """Return a function of two arguments (cell, value) which sets
147
+ the value stored in the closure cell `cell` to `value`.
148
+ """
149
+ # pypy makes this easy. (It also supports the logic below, but
150
+ # why not do the easy/fast thing?)
151
+ if PYPY:
152
+
153
+ def set_closure_cell(cell, value):
154
+ cell.__setstate__((value,))
155
+
156
+ return set_closure_cell
157
+
158
+ # Otherwise gotta do it the hard way.
159
+
160
+ # Create a function that will set its first cellvar to `value`.
161
+ def set_first_cellvar_to(value):
162
+ x = value
163
+ return
164
+
165
+ # This function will be eliminated as dead code, but
166
+ # not before its reference to `x` forces `x` to be
167
+ # represented as a closure cell rather than a local.
168
+ def force_x_to_be_a_cell(): # pragma: no cover
169
+ return x
170
+
171
+ try:
172
+ # Extract the code object and make sure our assumptions about
173
+ # the closure behavior are correct.
174
+ if PY2:
175
+ co = set_first_cellvar_to.func_code
176
+ else:
177
+ co = set_first_cellvar_to.__code__
178
+ if co.co_cellvars != ("x",) or co.co_freevars != ():
179
+ raise AssertionError # pragma: no cover
180
+
181
+ # Convert this code object to a code object that sets the
182
+ # function's first _freevar_ (not cellvar) to the argument.
183
+ if sys.version_info >= (3, 8):
184
+ # CPython 3.8+ has an incompatible CodeType signature
185
+ # (added a posonlyargcount argument) but also added
186
+ # CodeType.replace() to do this without counting parameters.
187
+ set_first_freevar_code = co.replace(
188
+ co_cellvars=co.co_freevars, co_freevars=co.co_cellvars
189
+ )
190
+ else:
191
+ args = [co.co_argcount]
192
+ if not PY2:
193
+ args.append(co.co_kwonlyargcount)
194
+ args.extend(
195
+ [
196
+ co.co_nlocals,
197
+ co.co_stacksize,
198
+ co.co_flags,
199
+ co.co_code,
200
+ co.co_consts,
201
+ co.co_names,
202
+ co.co_varnames,
203
+ co.co_filename,
204
+ co.co_name,
205
+ co.co_firstlineno,
206
+ co.co_lnotab,
207
+ # These two arguments are reversed:
208
+ co.co_cellvars,
209
+ co.co_freevars,
210
+ ]
211
+ )
212
+ set_first_freevar_code = types.CodeType(*args)
213
+
214
+ def set_closure_cell(cell, value):
215
+ # Create a function using the set_first_freevar_code,
216
+ # whose first closure cell is `cell`. Calling it will
217
+ # change the value of that cell.
218
+ setter = types.FunctionType(
219
+ set_first_freevar_code, {}, "setter", (), (cell,)
220
+ )
221
+ # And call it to set the cell.
222
+ setter(value)
223
+
224
+ # Make sure it works on this interpreter:
225
+ def make_func_with_cell():
226
+ x = None
227
+
228
+ def func():
229
+ return x # pragma: no cover
230
+
231
+ return func
232
+
233
+ if PY2:
234
+ cell = make_func_with_cell().func_closure[0]
235
+ else:
236
+ cell = make_func_with_cell().__closure__[0]
237
+ set_closure_cell(cell, 100)
238
+ if cell.cell_contents != 100:
239
+ raise AssertionError # pragma: no cover
240
+
241
+ except Exception:
242
+ return just_warn
243
+ else:
244
+ return set_closure_cell
245
+
246
+
247
+ set_closure_cell = make_set_closure_cell()
248
+
249
+ # Thread-local global to track attrs instances which are already being repr'd.
250
+ # This is needed because there is no other (thread-safe) way to pass info
251
+ # about the instances that are already being repr'd through the call stack
252
+ # in order to ensure we don't perform infinite recursion.
253
+ #
254
+ # For instance, if an instance contains a dict which contains that instance,
255
+ # we need to know that we're already repr'ing the outside instance from within
256
+ # the dict's repr() call.
257
+ #
258
+ # This lives here rather than in _make.py so that the functions in _make.py
259
+ # don't have a direct reference to the thread-local in their globals dict.
260
+ # If they have such a reference, it breaks cloudpickle.
261
+ repr_context = threading.local()
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/attr/_funcs.py ADDED
@@ -0,0 +1,422 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SPDX-License-Identifier: MIT
2
+
3
+ from __future__ import absolute_import, division, print_function
4
+
5
+ import copy
6
+
7
+ from ._compat import iteritems
8
+ from ._make import NOTHING, _obj_setattr, fields
9
+ from .exceptions import AttrsAttributeNotFoundError
10
+
11
+
12
+ def asdict(
13
+ inst,
14
+ recurse=True,
15
+ filter=None,
16
+ dict_factory=dict,
17
+ retain_collection_types=False,
18
+ value_serializer=None,
19
+ ):
20
+ """
21
+ Return the ``attrs`` attribute values of *inst* as a dict.
22
+
23
+ Optionally recurse into other ``attrs``-decorated classes.
24
+
25
+ :param inst: Instance of an ``attrs``-decorated class.
26
+ :param bool recurse: Recurse into classes that are also
27
+ ``attrs``-decorated.
28
+ :param callable filter: A callable whose return code determines whether an
29
+ attribute or element is included (``True``) or dropped (``False``). Is
30
+ called with the `attrs.Attribute` as the first argument and the
31
+ value as the second argument.
32
+ :param callable dict_factory: A callable to produce dictionaries from. For
33
+ example, to produce ordered dictionaries instead of normal Python
34
+ dictionaries, pass in ``collections.OrderedDict``.
35
+ :param bool retain_collection_types: Do not convert to ``list`` when
36
+ encountering an attribute whose type is ``tuple`` or ``set``. Only
37
+ meaningful if ``recurse`` is ``True``.
38
+ :param Optional[callable] value_serializer: A hook that is called for every
39
+ attribute or dict key/value. It receives the current instance, field
40
+ and value and must return the (updated) value. The hook is run *after*
41
+ the optional *filter* has been applied.
42
+
43
+ :rtype: return type of *dict_factory*
44
+
45
+ :raise attr.exceptions.NotAnAttrsClassError: If *cls* is not an ``attrs``
46
+ class.
47
+
48
+ .. versionadded:: 16.0.0 *dict_factory*
49
+ .. versionadded:: 16.1.0 *retain_collection_types*
50
+ .. versionadded:: 20.3.0 *value_serializer*
51
+ .. versionadded:: 21.3.0 If a dict has a collection for a key, it is
52
+ serialized as a tuple.
53
+ """
54
+ attrs = fields(inst.__class__)
55
+ rv = dict_factory()
56
+ for a in attrs:
57
+ v = getattr(inst, a.name)
58
+ if filter is not None and not filter(a, v):
59
+ continue
60
+
61
+ if value_serializer is not None:
62
+ v = value_serializer(inst, a, v)
63
+
64
+ if recurse is True:
65
+ if has(v.__class__):
66
+ rv[a.name] = asdict(
67
+ v,
68
+ recurse=True,
69
+ filter=filter,
70
+ dict_factory=dict_factory,
71
+ retain_collection_types=retain_collection_types,
72
+ value_serializer=value_serializer,
73
+ )
74
+ elif isinstance(v, (tuple, list, set, frozenset)):
75
+ cf = v.__class__ if retain_collection_types is True else list
76
+ rv[a.name] = cf(
77
+ [
78
+ _asdict_anything(
79
+ i,
80
+ is_key=False,
81
+ filter=filter,
82
+ dict_factory=dict_factory,
83
+ retain_collection_types=retain_collection_types,
84
+ value_serializer=value_serializer,
85
+ )
86
+ for i in v
87
+ ]
88
+ )
89
+ elif isinstance(v, dict):
90
+ df = dict_factory
91
+ rv[a.name] = df(
92
+ (
93
+ _asdict_anything(
94
+ kk,
95
+ is_key=True,
96
+ filter=filter,
97
+ dict_factory=df,
98
+ retain_collection_types=retain_collection_types,
99
+ value_serializer=value_serializer,
100
+ ),
101
+ _asdict_anything(
102
+ vv,
103
+ is_key=False,
104
+ filter=filter,
105
+ dict_factory=df,
106
+ retain_collection_types=retain_collection_types,
107
+ value_serializer=value_serializer,
108
+ ),
109
+ )
110
+ for kk, vv in iteritems(v)
111
+ )
112
+ else:
113
+ rv[a.name] = v
114
+ else:
115
+ rv[a.name] = v
116
+ return rv
117
+
118
+
119
+ def _asdict_anything(
120
+ val,
121
+ is_key,
122
+ filter,
123
+ dict_factory,
124
+ retain_collection_types,
125
+ value_serializer,
126
+ ):
127
+ """
128
+ ``asdict`` only works on attrs instances, this works on anything.
129
+ """
130
+ if getattr(val.__class__, "__attrs_attrs__", None) is not None:
131
+ # Attrs class.
132
+ rv = asdict(
133
+ val,
134
+ recurse=True,
135
+ filter=filter,
136
+ dict_factory=dict_factory,
137
+ retain_collection_types=retain_collection_types,
138
+ value_serializer=value_serializer,
139
+ )
140
+ elif isinstance(val, (tuple, list, set, frozenset)):
141
+ if retain_collection_types is True:
142
+ cf = val.__class__
143
+ elif is_key:
144
+ cf = tuple
145
+ else:
146
+ cf = list
147
+
148
+ rv = cf(
149
+ [
150
+ _asdict_anything(
151
+ i,
152
+ is_key=False,
153
+ filter=filter,
154
+ dict_factory=dict_factory,
155
+ retain_collection_types=retain_collection_types,
156
+ value_serializer=value_serializer,
157
+ )
158
+ for i in val
159
+ ]
160
+ )
161
+ elif isinstance(val, dict):
162
+ df = dict_factory
163
+ rv = df(
164
+ (
165
+ _asdict_anything(
166
+ kk,
167
+ is_key=True,
168
+ filter=filter,
169
+ dict_factory=df,
170
+ retain_collection_types=retain_collection_types,
171
+ value_serializer=value_serializer,
172
+ ),
173
+ _asdict_anything(
174
+ vv,
175
+ is_key=False,
176
+ filter=filter,
177
+ dict_factory=df,
178
+ retain_collection_types=retain_collection_types,
179
+ value_serializer=value_serializer,
180
+ ),
181
+ )
182
+ for kk, vv in iteritems(val)
183
+ )
184
+ else:
185
+ rv = val
186
+ if value_serializer is not None:
187
+ rv = value_serializer(None, None, rv)
188
+
189
+ return rv
190
+
191
+
192
+ def astuple(
193
+ inst,
194
+ recurse=True,
195
+ filter=None,
196
+ tuple_factory=tuple,
197
+ retain_collection_types=False,
198
+ ):
199
+ """
200
+ Return the ``attrs`` attribute values of *inst* as a tuple.
201
+
202
+ Optionally recurse into other ``attrs``-decorated classes.
203
+
204
+ :param inst: Instance of an ``attrs``-decorated class.
205
+ :param bool recurse: Recurse into classes that are also
206
+ ``attrs``-decorated.
207
+ :param callable filter: A callable whose return code determines whether an
208
+ attribute or element is included (``True``) or dropped (``False``). Is
209
+ called with the `attrs.Attribute` as the first argument and the
210
+ value as the second argument.
211
+ :param callable tuple_factory: A callable to produce tuples from. For
212
+ example, to produce lists instead of tuples.
213
+ :param bool retain_collection_types: Do not convert to ``list``
214
+ or ``dict`` when encountering an attribute which type is
215
+ ``tuple``, ``dict`` or ``set``. Only meaningful if ``recurse`` is
216
+ ``True``.
217
+
218
+ :rtype: return type of *tuple_factory*
219
+
220
+ :raise attr.exceptions.NotAnAttrsClassError: If *cls* is not an ``attrs``
221
+ class.
222
+
223
+ .. versionadded:: 16.2.0
224
+ """
225
+ attrs = fields(inst.__class__)
226
+ rv = []
227
+ retain = retain_collection_types # Very long. :/
228
+ for a in attrs:
229
+ v = getattr(inst, a.name)
230
+ if filter is not None and not filter(a, v):
231
+ continue
232
+ if recurse is True:
233
+ if has(v.__class__):
234
+ rv.append(
235
+ astuple(
236
+ v,
237
+ recurse=True,
238
+ filter=filter,
239
+ tuple_factory=tuple_factory,
240
+ retain_collection_types=retain,
241
+ )
242
+ )
243
+ elif isinstance(v, (tuple, list, set, frozenset)):
244
+ cf = v.__class__ if retain is True else list
245
+ rv.append(
246
+ cf(
247
+ [
248
+ astuple(
249
+ j,
250
+ recurse=True,
251
+ filter=filter,
252
+ tuple_factory=tuple_factory,
253
+ retain_collection_types=retain,
254
+ )
255
+ if has(j.__class__)
256
+ else j
257
+ for j in v
258
+ ]
259
+ )
260
+ )
261
+ elif isinstance(v, dict):
262
+ df = v.__class__ if retain is True else dict
263
+ rv.append(
264
+ df(
265
+ (
266
+ astuple(
267
+ kk,
268
+ tuple_factory=tuple_factory,
269
+ retain_collection_types=retain,
270
+ )
271
+ if has(kk.__class__)
272
+ else kk,
273
+ astuple(
274
+ vv,
275
+ tuple_factory=tuple_factory,
276
+ retain_collection_types=retain,
277
+ )
278
+ if has(vv.__class__)
279
+ else vv,
280
+ )
281
+ for kk, vv in iteritems(v)
282
+ )
283
+ )
284
+ else:
285
+ rv.append(v)
286
+ else:
287
+ rv.append(v)
288
+
289
+ return rv if tuple_factory is list else tuple_factory(rv)
290
+
291
+
292
+ def has(cls):
293
+ """
294
+ Check whether *cls* is a class with ``attrs`` attributes.
295
+
296
+ :param type cls: Class to introspect.
297
+ :raise TypeError: If *cls* is not a class.
298
+
299
+ :rtype: bool
300
+ """
301
+ return getattr(cls, "__attrs_attrs__", None) is not None
302
+
303
+
304
+ def assoc(inst, **changes):
305
+ """
306
+ Copy *inst* and apply *changes*.
307
+
308
+ :param inst: Instance of a class with ``attrs`` attributes.
309
+ :param changes: Keyword changes in the new copy.
310
+
311
+ :return: A copy of inst with *changes* incorporated.
312
+
313
+ :raise attr.exceptions.AttrsAttributeNotFoundError: If *attr_name* couldn't
314
+ be found on *cls*.
315
+ :raise attr.exceptions.NotAnAttrsClassError: If *cls* is not an ``attrs``
316
+ class.
317
+
318
+ .. deprecated:: 17.1.0
319
+ Use `attrs.evolve` instead if you can.
320
+ This function will not be removed du to the slightly different approach
321
+ compared to `attrs.evolve`.
322
+ """
323
+ import warnings
324
+
325
+ warnings.warn(
326
+ "assoc is deprecated and will be removed after 2018/01.",
327
+ DeprecationWarning,
328
+ stacklevel=2,
329
+ )
330
+ new = copy.copy(inst)
331
+ attrs = fields(inst.__class__)
332
+ for k, v in iteritems(changes):
333
+ a = getattr(attrs, k, NOTHING)
334
+ if a is NOTHING:
335
+ raise AttrsAttributeNotFoundError(
336
+ "{k} is not an attrs attribute on {cl}.".format(
337
+ k=k, cl=new.__class__
338
+ )
339
+ )
340
+ _obj_setattr(new, k, v)
341
+ return new
342
+
343
+
344
+ def evolve(inst, **changes):
345
+ """
346
+ Create a new instance, based on *inst* with *changes* applied.
347
+
348
+ :param inst: Instance of a class with ``attrs`` attributes.
349
+ :param changes: Keyword changes in the new copy.
350
+
351
+ :return: A copy of inst with *changes* incorporated.
352
+
353
+ :raise TypeError: If *attr_name* couldn't be found in the class
354
+ ``__init__``.
355
+ :raise attr.exceptions.NotAnAttrsClassError: If *cls* is not an ``attrs``
356
+ class.
357
+
358
+ .. versionadded:: 17.1.0
359
+ """
360
+ cls = inst.__class__
361
+ attrs = fields(cls)
362
+ for a in attrs:
363
+ if not a.init:
364
+ continue
365
+ attr_name = a.name # To deal with private attributes.
366
+ init_name = attr_name if attr_name[0] != "_" else attr_name[1:]
367
+ if init_name not in changes:
368
+ changes[init_name] = getattr(inst, attr_name)
369
+
370
+ return cls(**changes)
371
+
372
+
373
+ def resolve_types(cls, globalns=None, localns=None, attribs=None):
374
+ """
375
+ Resolve any strings and forward annotations in type annotations.
376
+
377
+ This is only required if you need concrete types in `Attribute`'s *type*
378
+ field. In other words, you don't need to resolve your types if you only
379
+ use them for static type checking.
380
+
381
+ With no arguments, names will be looked up in the module in which the class
382
+ was created. If this is not what you want, e.g. if the name only exists
383
+ inside a method, you may pass *globalns* or *localns* to specify other
384
+ dictionaries in which to look up these names. See the docs of
385
+ `typing.get_type_hints` for more details.
386
+
387
+ :param type cls: Class to resolve.
388
+ :param Optional[dict] globalns: Dictionary containing global variables.
389
+ :param Optional[dict] localns: Dictionary containing local variables.
390
+ :param Optional[list] attribs: List of attribs for the given class.
391
+ This is necessary when calling from inside a ``field_transformer``
392
+ since *cls* is not an ``attrs`` class yet.
393
+
394
+ :raise TypeError: If *cls* is not a class.
395
+ :raise attr.exceptions.NotAnAttrsClassError: If *cls* is not an ``attrs``
396
+ class and you didn't pass any attribs.
397
+ :raise NameError: If types cannot be resolved because of missing variables.
398
+
399
+ :returns: *cls* so you can use this function also as a class decorator.
400
+ Please note that you have to apply it **after** `attrs.define`. That
401
+ means the decorator has to come in the line **before** `attrs.define`.
402
+
403
+ .. versionadded:: 20.1.0
404
+ .. versionadded:: 21.1.0 *attribs*
405
+
406
+ """
407
+ # Since calling get_type_hints is expensive we cache whether we've
408
+ # done it already.
409
+ if getattr(cls, "__attrs_types_resolved__", None) != cls:
410
+ import typing
411
+
412
+ hints = typing.get_type_hints(cls, globalns=globalns, localns=localns)
413
+ for field in fields(cls) if attribs is None else attribs:
414
+ if field.name in hints:
415
+ # Since fields have been frozen we must work around it.
416
+ _obj_setattr(field, "type", hints[field.name])
417
+ # We store the class we resolved so that subclasses know they haven't
418
+ # been resolved.
419
+ cls.__attrs_types_resolved__ = cls
420
+
421
+ # Return the class so you can use it as a decorator too.
422
+ return cls
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/attr/_next_gen.py ADDED
@@ -0,0 +1,216 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SPDX-License-Identifier: MIT
2
+
3
+ """
4
+ These are Python 3.6+-only and keyword-only APIs that call `attr.s` and
5
+ `attr.ib` with different default values.
6
+ """
7
+
8
+
9
+ from functools import partial
10
+
11
+ from . import setters
12
+ from ._funcs import asdict as _asdict
13
+ from ._funcs import astuple as _astuple
14
+ from ._make import (
15
+ NOTHING,
16
+ _frozen_setattrs,
17
+ _ng_default_on_setattr,
18
+ attrib,
19
+ attrs,
20
+ )
21
+ from .exceptions import UnannotatedAttributeError
22
+
23
+
24
+ def define(
25
+ maybe_cls=None,
26
+ *,
27
+ these=None,
28
+ repr=None,
29
+ hash=None,
30
+ init=None,
31
+ slots=True,
32
+ frozen=False,
33
+ weakref_slot=True,
34
+ str=False,
35
+ auto_attribs=None,
36
+ kw_only=False,
37
+ cache_hash=False,
38
+ auto_exc=True,
39
+ eq=None,
40
+ order=False,
41
+ auto_detect=True,
42
+ getstate_setstate=None,
43
+ on_setattr=None,
44
+ field_transformer=None,
45
+ match_args=True,
46
+ ):
47
+ r"""
48
+ Define an ``attrs`` class.
49
+
50
+ Differences to the classic `attr.s` that it uses underneath:
51
+
52
+ - Automatically detect whether or not *auto_attribs* should be `True`
53
+ (c.f. *auto_attribs* parameter).
54
+ - If *frozen* is `False`, run converters and validators when setting an
55
+ attribute by default.
56
+ - *slots=True* (see :term:`slotted classes` for potentially surprising
57
+ behaviors)
58
+ - *auto_exc=True*
59
+ - *auto_detect=True*
60
+ - *order=False*
61
+ - *match_args=True*
62
+ - Some options that were only relevant on Python 2 or were kept around for
63
+ backwards-compatibility have been removed.
64
+
65
+ Please note that these are all defaults and you can change them as you
66
+ wish.
67
+
68
+ :param Optional[bool] auto_attribs: If set to `True` or `False`, it behaves
69
+ exactly like `attr.s`. If left `None`, `attr.s` will try to guess:
70
+
71
+ 1. If any attributes are annotated and no unannotated `attrs.fields`\ s
72
+ are found, it assumes *auto_attribs=True*.
73
+ 2. Otherwise it assumes *auto_attribs=False* and tries to collect
74
+ `attrs.fields`\ s.
75
+
76
+ For now, please refer to `attr.s` for the rest of the parameters.
77
+
78
+ .. versionadded:: 20.1.0
79
+ .. versionchanged:: 21.3.0 Converters are also run ``on_setattr``.
80
+ """
81
+
82
+ def do_it(cls, auto_attribs):
83
+ return attrs(
84
+ maybe_cls=cls,
85
+ these=these,
86
+ repr=repr,
87
+ hash=hash,
88
+ init=init,
89
+ slots=slots,
90
+ frozen=frozen,
91
+ weakref_slot=weakref_slot,
92
+ str=str,
93
+ auto_attribs=auto_attribs,
94
+ kw_only=kw_only,
95
+ cache_hash=cache_hash,
96
+ auto_exc=auto_exc,
97
+ eq=eq,
98
+ order=order,
99
+ auto_detect=auto_detect,
100
+ collect_by_mro=True,
101
+ getstate_setstate=getstate_setstate,
102
+ on_setattr=on_setattr,
103
+ field_transformer=field_transformer,
104
+ match_args=match_args,
105
+ )
106
+
107
+ def wrap(cls):
108
+ """
109
+ Making this a wrapper ensures this code runs during class creation.
110
+
111
+ We also ensure that frozen-ness of classes is inherited.
112
+ """
113
+ nonlocal frozen, on_setattr
114
+
115
+ had_on_setattr = on_setattr not in (None, setters.NO_OP)
116
+
117
+ # By default, mutable classes convert & validate on setattr.
118
+ if frozen is False and on_setattr is None:
119
+ on_setattr = _ng_default_on_setattr
120
+
121
+ # However, if we subclass a frozen class, we inherit the immutability
122
+ # and disable on_setattr.
123
+ for base_cls in cls.__bases__:
124
+ if base_cls.__setattr__ is _frozen_setattrs:
125
+ if had_on_setattr:
126
+ raise ValueError(
127
+ "Frozen classes can't use on_setattr "
128
+ "(frozen-ness was inherited)."
129
+ )
130
+
131
+ on_setattr = setters.NO_OP
132
+ break
133
+
134
+ if auto_attribs is not None:
135
+ return do_it(cls, auto_attribs)
136
+
137
+ try:
138
+ return do_it(cls, True)
139
+ except UnannotatedAttributeError:
140
+ return do_it(cls, False)
141
+
142
+ # maybe_cls's type depends on the usage of the decorator. It's a class
143
+ # if it's used as `@attrs` but ``None`` if used as `@attrs()`.
144
+ if maybe_cls is None:
145
+ return wrap
146
+ else:
147
+ return wrap(maybe_cls)
148
+
149
+
150
+ mutable = define
151
+ frozen = partial(define, frozen=True, on_setattr=None)
152
+
153
+
154
+ def field(
155
+ *,
156
+ default=NOTHING,
157
+ validator=None,
158
+ repr=True,
159
+ hash=None,
160
+ init=True,
161
+ metadata=None,
162
+ converter=None,
163
+ factory=None,
164
+ kw_only=False,
165
+ eq=None,
166
+ order=None,
167
+ on_setattr=None,
168
+ ):
169
+ """
170
+ Identical to `attr.ib`, except keyword-only and with some arguments
171
+ removed.
172
+
173
+ .. versionadded:: 20.1.0
174
+ """
175
+ return attrib(
176
+ default=default,
177
+ validator=validator,
178
+ repr=repr,
179
+ hash=hash,
180
+ init=init,
181
+ metadata=metadata,
182
+ converter=converter,
183
+ factory=factory,
184
+ kw_only=kw_only,
185
+ eq=eq,
186
+ order=order,
187
+ on_setattr=on_setattr,
188
+ )
189
+
190
+
191
+ def asdict(inst, *, recurse=True, filter=None, value_serializer=None):
192
+ """
193
+ Same as `attr.asdict`, except that collections types are always retained
194
+ and dict is always used as *dict_factory*.
195
+
196
+ .. versionadded:: 21.3.0
197
+ """
198
+ return _asdict(
199
+ inst=inst,
200
+ recurse=recurse,
201
+ filter=filter,
202
+ value_serializer=value_serializer,
203
+ retain_collection_types=True,
204
+ )
205
+
206
+
207
+ def astuple(inst, *, recurse=True, filter=None):
208
+ """
209
+ Same as `attr.astuple`, except that collections types are always retained
210
+ and `tuple` is always used as the *tuple_factory*.
211
+
212
+ .. versionadded:: 21.3.0
213
+ """
214
+ return _astuple(
215
+ inst=inst, recurse=recurse, filter=filter, retain_collection_types=True
216
+ )
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/attr/_version_info.py ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SPDX-License-Identifier: MIT
2
+
3
+ from __future__ import absolute_import, division, print_function
4
+
5
+ from functools import total_ordering
6
+
7
+ from ._funcs import astuple
8
+ from ._make import attrib, attrs
9
+
10
+
11
+ @total_ordering
12
+ @attrs(eq=False, order=False, slots=True, frozen=True)
13
+ class VersionInfo(object):
14
+ """
15
+ A version object that can be compared to tuple of length 1--4:
16
+
17
+ >>> attr.VersionInfo(19, 1, 0, "final") <= (19, 2)
18
+ True
19
+ >>> attr.VersionInfo(19, 1, 0, "final") < (19, 1, 1)
20
+ True
21
+ >>> vi = attr.VersionInfo(19, 2, 0, "final")
22
+ >>> vi < (19, 1, 1)
23
+ False
24
+ >>> vi < (19,)
25
+ False
26
+ >>> vi == (19, 2,)
27
+ True
28
+ >>> vi == (19, 2, 1)
29
+ False
30
+
31
+ .. versionadded:: 19.2
32
+ """
33
+
34
+ year = attrib(type=int)
35
+ minor = attrib(type=int)
36
+ micro = attrib(type=int)
37
+ releaselevel = attrib(type=str)
38
+
39
+ @classmethod
40
+ def _from_version_string(cls, s):
41
+ """
42
+ Parse *s* and return a _VersionInfo.
43
+ """
44
+ v = s.split(".")
45
+ if len(v) == 3:
46
+ v.append("final")
47
+
48
+ return cls(
49
+ year=int(v[0]), minor=int(v[1]), micro=int(v[2]), releaselevel=v[3]
50
+ )
51
+
52
+ def _ensure_tuple(self, other):
53
+ """
54
+ Ensure *other* is a tuple of a valid length.
55
+
56
+ Returns a possibly transformed *other* and ourselves as a tuple of
57
+ the same length as *other*.
58
+ """
59
+
60
+ if self.__class__ is other.__class__:
61
+ other = astuple(other)
62
+
63
+ if not isinstance(other, tuple):
64
+ raise NotImplementedError
65
+
66
+ if not (1 <= len(other) <= 4):
67
+ raise NotImplementedError
68
+
69
+ return astuple(self)[: len(other)], other
70
+
71
+ def __eq__(self, other):
72
+ try:
73
+ us, them = self._ensure_tuple(other)
74
+ except NotImplementedError:
75
+ return NotImplemented
76
+
77
+ return us == them
78
+
79
+ def __lt__(self, other):
80
+ try:
81
+ us, them = self._ensure_tuple(other)
82
+ except NotImplementedError:
83
+ return NotImplemented
84
+
85
+ # Since alphabetically "dev0" < "final" < "post1" < "post2", we don't
86
+ # have to do anything special with releaselevel for now.
87
+ return us < them
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/attr/_version_info.pyi ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ class VersionInfo:
2
+ @property
3
+ def year(self) -> int: ...
4
+ @property
5
+ def minor(self) -> int: ...
6
+ @property
7
+ def micro(self) -> int: ...
8
+ @property
9
+ def releaselevel(self) -> str: ...
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/attr/converters.pyi ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Callable, Optional, TypeVar, overload
2
+
3
+ from . import _ConverterType
4
+
5
+ _T = TypeVar("_T")
6
+
7
+ def pipe(*validators: _ConverterType) -> _ConverterType: ...
8
+ def optional(converter: _ConverterType) -> _ConverterType: ...
9
+ @overload
10
+ def default_if_none(default: _T) -> _ConverterType: ...
11
+ @overload
12
+ def default_if_none(*, factory: Callable[[], _T]) -> _ConverterType: ...
13
+ def to_bool(val: str) -> bool: ...
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/attr/exceptions.py ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SPDX-License-Identifier: MIT
2
+
3
+ from __future__ import absolute_import, division, print_function
4
+
5
+
6
+ class FrozenError(AttributeError):
7
+ """
8
+ A frozen/immutable instance or attribute have been attempted to be
9
+ modified.
10
+
11
+ It mirrors the behavior of ``namedtuples`` by using the same error message
12
+ and subclassing `AttributeError`.
13
+
14
+ .. versionadded:: 20.1.0
15
+ """
16
+
17
+ msg = "can't set attribute"
18
+ args = [msg]
19
+
20
+
21
+ class FrozenInstanceError(FrozenError):
22
+ """
23
+ A frozen instance has been attempted to be modified.
24
+
25
+ .. versionadded:: 16.1.0
26
+ """
27
+
28
+
29
+ class FrozenAttributeError(FrozenError):
30
+ """
31
+ A frozen attribute has been attempted to be modified.
32
+
33
+ .. versionadded:: 20.1.0
34
+ """
35
+
36
+
37
+ class AttrsAttributeNotFoundError(ValueError):
38
+ """
39
+ An ``attrs`` function couldn't find an attribute that the user asked for.
40
+
41
+ .. versionadded:: 16.2.0
42
+ """
43
+
44
+
45
+ class NotAnAttrsClassError(ValueError):
46
+ """
47
+ A non-``attrs`` class has been passed into an ``attrs`` function.
48
+
49
+ .. versionadded:: 16.2.0
50
+ """
51
+
52
+
53
+ class DefaultAlreadySetError(RuntimeError):
54
+ """
55
+ A default has been set using ``attr.ib()`` and is attempted to be reset
56
+ using the decorator.
57
+
58
+ .. versionadded:: 17.1.0
59
+ """
60
+
61
+
62
+ class UnannotatedAttributeError(RuntimeError):
63
+ """
64
+ A class with ``auto_attribs=True`` has an ``attr.ib()`` without a type
65
+ annotation.
66
+
67
+ .. versionadded:: 17.3.0
68
+ """
69
+
70
+
71
+ class PythonTooOldError(RuntimeError):
72
+ """
73
+ It was attempted to use an ``attrs`` feature that requires a newer Python
74
+ version.
75
+
76
+ .. versionadded:: 18.2.0
77
+ """
78
+
79
+
80
+ class NotCallableError(TypeError):
81
+ """
82
+ A ``attr.ib()`` requiring a callable has been set with a value
83
+ that is not callable.
84
+
85
+ .. versionadded:: 19.2.0
86
+ """
87
+
88
+ def __init__(self, msg, value):
89
+ super(TypeError, self).__init__(msg, value)
90
+ self.msg = msg
91
+ self.value = value
92
+
93
+ def __str__(self):
94
+ return str(self.msg)
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/attr/filters.py ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SPDX-License-Identifier: MIT
2
+
3
+ """
4
+ Commonly useful filters for `attr.asdict`.
5
+ """
6
+
7
+ from __future__ import absolute_import, division, print_function
8
+
9
+ from ._compat import isclass
10
+ from ._make import Attribute
11
+
12
+
13
+ def _split_what(what):
14
+ """
15
+ Returns a tuple of `frozenset`s of classes and attributes.
16
+ """
17
+ return (
18
+ frozenset(cls for cls in what if isclass(cls)),
19
+ frozenset(cls for cls in what if isinstance(cls, Attribute)),
20
+ )
21
+
22
+
23
+ def include(*what):
24
+ """
25
+ Include *what*.
26
+
27
+ :param what: What to include.
28
+ :type what: `list` of `type` or `attrs.Attribute`\\ s
29
+
30
+ :rtype: `callable`
31
+ """
32
+ cls, attrs = _split_what(what)
33
+
34
+ def include_(attribute, value):
35
+ return value.__class__ in cls or attribute in attrs
36
+
37
+ return include_
38
+
39
+
40
+ def exclude(*what):
41
+ """
42
+ Exclude *what*.
43
+
44
+ :param what: What to exclude.
45
+ :type what: `list` of classes or `attrs.Attribute`\\ s.
46
+
47
+ :rtype: `callable`
48
+ """
49
+ cls, attrs = _split_what(what)
50
+
51
+ def exclude_(attribute, value):
52
+ return value.__class__ not in cls and attribute not in attrs
53
+
54
+ return exclude_
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/attr/filters.pyi ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ from typing import Any, Union
2
+
3
+ from . import Attribute, _FilterType
4
+
5
+ def include(*what: Union[type, Attribute[Any]]) -> _FilterType[Any]: ...
6
+ def exclude(*what: Union[type, Attribute[Any]]) -> _FilterType[Any]: ...
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/attr/py.typed ADDED
File without changes
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/attr/setters.py ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SPDX-License-Identifier: MIT
2
+
3
+ """
4
+ Commonly used hooks for on_setattr.
5
+ """
6
+
7
+ from __future__ import absolute_import, division, print_function
8
+
9
+ from . import _config
10
+ from .exceptions import FrozenAttributeError
11
+
12
+
13
+ def pipe(*setters):
14
+ """
15
+ Run all *setters* and return the return value of the last one.
16
+
17
+ .. versionadded:: 20.1.0
18
+ """
19
+
20
+ def wrapped_pipe(instance, attrib, new_value):
21
+ rv = new_value
22
+
23
+ for setter in setters:
24
+ rv = setter(instance, attrib, rv)
25
+
26
+ return rv
27
+
28
+ return wrapped_pipe
29
+
30
+
31
+ def frozen(_, __, ___):
32
+ """
33
+ Prevent an attribute to be modified.
34
+
35
+ .. versionadded:: 20.1.0
36
+ """
37
+ raise FrozenAttributeError()
38
+
39
+
40
+ def validate(instance, attrib, new_value):
41
+ """
42
+ Run *attrib*'s validator on *new_value* if it has one.
43
+
44
+ .. versionadded:: 20.1.0
45
+ """
46
+ if _config._run_validators is False:
47
+ return new_value
48
+
49
+ v = attrib.validator
50
+ if not v:
51
+ return new_value
52
+
53
+ v(instance, attrib, new_value)
54
+
55
+ return new_value
56
+
57
+
58
+ def convert(instance, attrib, new_value):
59
+ """
60
+ Run *attrib*'s converter -- if it has one -- on *new_value* and return the
61
+ result.
62
+
63
+ .. versionadded:: 20.1.0
64
+ """
65
+ c = attrib.converter
66
+ if c:
67
+ return c(new_value)
68
+
69
+ return new_value
70
+
71
+
72
+ NO_OP = object()
73
+ """
74
+ Sentinel for disabling class-wide *on_setattr* hooks for certain attributes.
75
+
76
+ Does not work in `pipe` or within lists.
77
+
78
+ .. versionadded:: 20.1.0
79
+ """
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/attr/setters.pyi ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Any, NewType, NoReturn, TypeVar, cast
2
+
3
+ from . import Attribute, _OnSetAttrType
4
+
5
+ _T = TypeVar("_T")
6
+
7
+ def frozen(
8
+ instance: Any, attribute: Attribute[Any], new_value: Any
9
+ ) -> NoReturn: ...
10
+ def pipe(*setters: _OnSetAttrType) -> _OnSetAttrType: ...
11
+ def validate(instance: Any, attribute: Attribute[_T], new_value: _T) -> _T: ...
12
+
13
+ # convert is allowed to return Any, because they can be chained using pipe.
14
+ def convert(
15
+ instance: Any, attribute: Attribute[Any], new_value: Any
16
+ ) -> Any: ...
17
+
18
+ _NoOpType = NewType("_NoOpType", object)
19
+ NO_OP: _NoOpType
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/attr/validators.py ADDED
@@ -0,0 +1,561 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SPDX-License-Identifier: MIT
2
+
3
+ """
4
+ Commonly useful validators.
5
+ """
6
+
7
+ from __future__ import absolute_import, division, print_function
8
+
9
+ import operator
10
+ import re
11
+
12
+ from contextlib import contextmanager
13
+
14
+ from ._config import get_run_validators, set_run_validators
15
+ from ._make import _AndValidator, and_, attrib, attrs
16
+ from .exceptions import NotCallableError
17
+
18
+
19
+ try:
20
+ Pattern = re.Pattern
21
+ except AttributeError: # Python <3.7 lacks a Pattern type.
22
+ Pattern = type(re.compile(""))
23
+
24
+
25
+ __all__ = [
26
+ "and_",
27
+ "deep_iterable",
28
+ "deep_mapping",
29
+ "disabled",
30
+ "ge",
31
+ "get_disabled",
32
+ "gt",
33
+ "in_",
34
+ "instance_of",
35
+ "is_callable",
36
+ "le",
37
+ "lt",
38
+ "matches_re",
39
+ "max_len",
40
+ "optional",
41
+ "provides",
42
+ "set_disabled",
43
+ ]
44
+
45
+
46
+ def set_disabled(disabled):
47
+ """
48
+ Globally disable or enable running validators.
49
+
50
+ By default, they are run.
51
+
52
+ :param disabled: If ``True``, disable running all validators.
53
+ :type disabled: bool
54
+
55
+ .. warning::
56
+
57
+ This function is not thread-safe!
58
+
59
+ .. versionadded:: 21.3.0
60
+ """
61
+ set_run_validators(not disabled)
62
+
63
+
64
+ def get_disabled():
65
+ """
66
+ Return a bool indicating whether validators are currently disabled or not.
67
+
68
+ :return: ``True`` if validators are currently disabled.
69
+ :rtype: bool
70
+
71
+ .. versionadded:: 21.3.0
72
+ """
73
+ return not get_run_validators()
74
+
75
+
76
+ @contextmanager
77
+ def disabled():
78
+ """
79
+ Context manager that disables running validators within its context.
80
+
81
+ .. warning::
82
+
83
+ This context manager is not thread-safe!
84
+
85
+ .. versionadded:: 21.3.0
86
+ """
87
+ set_run_validators(False)
88
+ try:
89
+ yield
90
+ finally:
91
+ set_run_validators(True)
92
+
93
+
94
+ @attrs(repr=False, slots=True, hash=True)
95
+ class _InstanceOfValidator(object):
96
+ type = attrib()
97
+
98
+ def __call__(self, inst, attr, value):
99
+ """
100
+ We use a callable class to be able to change the ``__repr__``.
101
+ """
102
+ if not isinstance(value, self.type):
103
+ raise TypeError(
104
+ "'{name}' must be {type!r} (got {value!r} that is a "
105
+ "{actual!r}).".format(
106
+ name=attr.name,
107
+ type=self.type,
108
+ actual=value.__class__,
109
+ value=value,
110
+ ),
111
+ attr,
112
+ self.type,
113
+ value,
114
+ )
115
+
116
+ def __repr__(self):
117
+ return "<instance_of validator for type {type!r}>".format(
118
+ type=self.type
119
+ )
120
+
121
+
122
+ def instance_of(type):
123
+ """
124
+ A validator that raises a `TypeError` if the initializer is called
125
+ with a wrong type for this particular attribute (checks are performed using
126
+ `isinstance` therefore it's also valid to pass a tuple of types).
127
+
128
+ :param type: The type to check for.
129
+ :type type: type or tuple of types
130
+
131
+ :raises TypeError: With a human readable error message, the attribute
132
+ (of type `attrs.Attribute`), the expected type, and the value it
133
+ got.
134
+ """
135
+ return _InstanceOfValidator(type)
136
+
137
+
138
+ @attrs(repr=False, frozen=True, slots=True)
139
+ class _MatchesReValidator(object):
140
+ pattern = attrib()
141
+ match_func = attrib()
142
+
143
+ def __call__(self, inst, attr, value):
144
+ """
145
+ We use a callable class to be able to change the ``__repr__``.
146
+ """
147
+ if not self.match_func(value):
148
+ raise ValueError(
149
+ "'{name}' must match regex {pattern!r}"
150
+ " ({value!r} doesn't)".format(
151
+ name=attr.name, pattern=self.pattern.pattern, value=value
152
+ ),
153
+ attr,
154
+ self.pattern,
155
+ value,
156
+ )
157
+
158
+ def __repr__(self):
159
+ return "<matches_re validator for pattern {pattern!r}>".format(
160
+ pattern=self.pattern
161
+ )
162
+
163
+
164
+ def matches_re(regex, flags=0, func=None):
165
+ r"""
166
+ A validator that raises `ValueError` if the initializer is called
167
+ with a string that doesn't match *regex*.
168
+
169
+ :param regex: a regex string or precompiled pattern to match against
170
+ :param int flags: flags that will be passed to the underlying re function
171
+ (default 0)
172
+ :param callable func: which underlying `re` function to call (options
173
+ are `re.fullmatch`, `re.search`, `re.match`, default
174
+ is ``None`` which means either `re.fullmatch` or an emulation of
175
+ it on Python 2). For performance reasons, they won't be used directly
176
+ but on a pre-`re.compile`\ ed pattern.
177
+
178
+ .. versionadded:: 19.2.0
179
+ .. versionchanged:: 21.3.0 *regex* can be a pre-compiled pattern.
180
+ """
181
+ fullmatch = getattr(re, "fullmatch", None)
182
+ valid_funcs = (fullmatch, None, re.search, re.match)
183
+ if func not in valid_funcs:
184
+ raise ValueError(
185
+ "'func' must be one of {}.".format(
186
+ ", ".join(
187
+ sorted(
188
+ e and e.__name__ or "None" for e in set(valid_funcs)
189
+ )
190
+ )
191
+ )
192
+ )
193
+
194
+ if isinstance(regex, Pattern):
195
+ if flags:
196
+ raise TypeError(
197
+ "'flags' can only be used with a string pattern; "
198
+ "pass flags to re.compile() instead"
199
+ )
200
+ pattern = regex
201
+ else:
202
+ pattern = re.compile(regex, flags)
203
+
204
+ if func is re.match:
205
+ match_func = pattern.match
206
+ elif func is re.search:
207
+ match_func = pattern.search
208
+ elif fullmatch:
209
+ match_func = pattern.fullmatch
210
+ else: # Python 2 fullmatch emulation (https://bugs.python.org/issue16203)
211
+ pattern = re.compile(
212
+ r"(?:{})\Z".format(pattern.pattern), pattern.flags
213
+ )
214
+ match_func = pattern.match
215
+
216
+ return _MatchesReValidator(pattern, match_func)
217
+
218
+
219
+ @attrs(repr=False, slots=True, hash=True)
220
+ class _ProvidesValidator(object):
221
+ interface = attrib()
222
+
223
+ def __call__(self, inst, attr, value):
224
+ """
225
+ We use a callable class to be able to change the ``__repr__``.
226
+ """
227
+ if not self.interface.providedBy(value):
228
+ raise TypeError(
229
+ "'{name}' must provide {interface!r} which {value!r} "
230
+ "doesn't.".format(
231
+ name=attr.name, interface=self.interface, value=value
232
+ ),
233
+ attr,
234
+ self.interface,
235
+ value,
236
+ )
237
+
238
+ def __repr__(self):
239
+ return "<provides validator for interface {interface!r}>".format(
240
+ interface=self.interface
241
+ )
242
+
243
+
244
+ def provides(interface):
245
+ """
246
+ A validator that raises a `TypeError` if the initializer is called
247
+ with an object that does not provide the requested *interface* (checks are
248
+ performed using ``interface.providedBy(value)`` (see `zope.interface
249
+ <https://zopeinterface.readthedocs.io/en/latest/>`_).
250
+
251
+ :param interface: The interface to check for.
252
+ :type interface: ``zope.interface.Interface``
253
+
254
+ :raises TypeError: With a human readable error message, the attribute
255
+ (of type `attrs.Attribute`), the expected interface, and the
256
+ value it got.
257
+ """
258
+ return _ProvidesValidator(interface)
259
+
260
+
261
+ @attrs(repr=False, slots=True, hash=True)
262
+ class _OptionalValidator(object):
263
+ validator = attrib()
264
+
265
+ def __call__(self, inst, attr, value):
266
+ if value is None:
267
+ return
268
+
269
+ self.validator(inst, attr, value)
270
+
271
+ def __repr__(self):
272
+ return "<optional validator for {what} or None>".format(
273
+ what=repr(self.validator)
274
+ )
275
+
276
+
277
+ def optional(validator):
278
+ """
279
+ A validator that makes an attribute optional. An optional attribute is one
280
+ which can be set to ``None`` in addition to satisfying the requirements of
281
+ the sub-validator.
282
+
283
+ :param validator: A validator (or a list of validators) that is used for
284
+ non-``None`` values.
285
+ :type validator: callable or `list` of callables.
286
+
287
+ .. versionadded:: 15.1.0
288
+ .. versionchanged:: 17.1.0 *validator* can be a list of validators.
289
+ """
290
+ if isinstance(validator, list):
291
+ return _OptionalValidator(_AndValidator(validator))
292
+ return _OptionalValidator(validator)
293
+
294
+
295
+ @attrs(repr=False, slots=True, hash=True)
296
+ class _InValidator(object):
297
+ options = attrib()
298
+
299
+ def __call__(self, inst, attr, value):
300
+ try:
301
+ in_options = value in self.options
302
+ except TypeError: # e.g. `1 in "abc"`
303
+ in_options = False
304
+
305
+ if not in_options:
306
+ raise ValueError(
307
+ "'{name}' must be in {options!r} (got {value!r})".format(
308
+ name=attr.name, options=self.options, value=value
309
+ )
310
+ )
311
+
312
+ def __repr__(self):
313
+ return "<in_ validator with options {options!r}>".format(
314
+ options=self.options
315
+ )
316
+
317
+
318
+ def in_(options):
319
+ """
320
+ A validator that raises a `ValueError` if the initializer is called
321
+ with a value that does not belong in the options provided. The check is
322
+ performed using ``value in options``.
323
+
324
+ :param options: Allowed options.
325
+ :type options: list, tuple, `enum.Enum`, ...
326
+
327
+ :raises ValueError: With a human readable error message, the attribute (of
328
+ type `attrs.Attribute`), the expected options, and the value it
329
+ got.
330
+
331
+ .. versionadded:: 17.1.0
332
+ """
333
+ return _InValidator(options)
334
+
335
+
336
+ @attrs(repr=False, slots=False, hash=True)
337
+ class _IsCallableValidator(object):
338
+ def __call__(self, inst, attr, value):
339
+ """
340
+ We use a callable class to be able to change the ``__repr__``.
341
+ """
342
+ if not callable(value):
343
+ message = (
344
+ "'{name}' must be callable "
345
+ "(got {value!r} that is a {actual!r})."
346
+ )
347
+ raise NotCallableError(
348
+ msg=message.format(
349
+ name=attr.name, value=value, actual=value.__class__
350
+ ),
351
+ value=value,
352
+ )
353
+
354
+ def __repr__(self):
355
+ return "<is_callable validator>"
356
+
357
+
358
+ def is_callable():
359
+ """
360
+ A validator that raises a `attr.exceptions.NotCallableError` if the
361
+ initializer is called with a value for this particular attribute
362
+ that is not callable.
363
+
364
+ .. versionadded:: 19.1.0
365
+
366
+ :raises `attr.exceptions.NotCallableError`: With a human readable error
367
+ message containing the attribute (`attrs.Attribute`) name,
368
+ and the value it got.
369
+ """
370
+ return _IsCallableValidator()
371
+
372
+
373
+ @attrs(repr=False, slots=True, hash=True)
374
+ class _DeepIterable(object):
375
+ member_validator = attrib(validator=is_callable())
376
+ iterable_validator = attrib(
377
+ default=None, validator=optional(is_callable())
378
+ )
379
+
380
+ def __call__(self, inst, attr, value):
381
+ """
382
+ We use a callable class to be able to change the ``__repr__``.
383
+ """
384
+ if self.iterable_validator is not None:
385
+ self.iterable_validator(inst, attr, value)
386
+
387
+ for member in value:
388
+ self.member_validator(inst, attr, member)
389
+
390
+ def __repr__(self):
391
+ iterable_identifier = (
392
+ ""
393
+ if self.iterable_validator is None
394
+ else " {iterable!r}".format(iterable=self.iterable_validator)
395
+ )
396
+ return (
397
+ "<deep_iterable validator for{iterable_identifier}"
398
+ " iterables of {member!r}>"
399
+ ).format(
400
+ iterable_identifier=iterable_identifier,
401
+ member=self.member_validator,
402
+ )
403
+
404
+
405
+ def deep_iterable(member_validator, iterable_validator=None):
406
+ """
407
+ A validator that performs deep validation of an iterable.
408
+
409
+ :param member_validator: Validator to apply to iterable members
410
+ :param iterable_validator: Validator to apply to iterable itself
411
+ (optional)
412
+
413
+ .. versionadded:: 19.1.0
414
+
415
+ :raises TypeError: if any sub-validators fail
416
+ """
417
+ return _DeepIterable(member_validator, iterable_validator)
418
+
419
+
420
+ @attrs(repr=False, slots=True, hash=True)
421
+ class _DeepMapping(object):
422
+ key_validator = attrib(validator=is_callable())
423
+ value_validator = attrib(validator=is_callable())
424
+ mapping_validator = attrib(default=None, validator=optional(is_callable()))
425
+
426
+ def __call__(self, inst, attr, value):
427
+ """
428
+ We use a callable class to be able to change the ``__repr__``.
429
+ """
430
+ if self.mapping_validator is not None:
431
+ self.mapping_validator(inst, attr, value)
432
+
433
+ for key in value:
434
+ self.key_validator(inst, attr, key)
435
+ self.value_validator(inst, attr, value[key])
436
+
437
+ def __repr__(self):
438
+ return (
439
+ "<deep_mapping validator for objects mapping {key!r} to {value!r}>"
440
+ ).format(key=self.key_validator, value=self.value_validator)
441
+
442
+
443
+ def deep_mapping(key_validator, value_validator, mapping_validator=None):
444
+ """
445
+ A validator that performs deep validation of a dictionary.
446
+
447
+ :param key_validator: Validator to apply to dictionary keys
448
+ :param value_validator: Validator to apply to dictionary values
449
+ :param mapping_validator: Validator to apply to top-level mapping
450
+ attribute (optional)
451
+
452
+ .. versionadded:: 19.1.0
453
+
454
+ :raises TypeError: if any sub-validators fail
455
+ """
456
+ return _DeepMapping(key_validator, value_validator, mapping_validator)
457
+
458
+
459
+ @attrs(repr=False, frozen=True, slots=True)
460
+ class _NumberValidator(object):
461
+ bound = attrib()
462
+ compare_op = attrib()
463
+ compare_func = attrib()
464
+
465
+ def __call__(self, inst, attr, value):
466
+ """
467
+ We use a callable class to be able to change the ``__repr__``.
468
+ """
469
+ if not self.compare_func(value, self.bound):
470
+ raise ValueError(
471
+ "'{name}' must be {op} {bound}: {value}".format(
472
+ name=attr.name,
473
+ op=self.compare_op,
474
+ bound=self.bound,
475
+ value=value,
476
+ )
477
+ )
478
+
479
+ def __repr__(self):
480
+ return "<Validator for x {op} {bound}>".format(
481
+ op=self.compare_op, bound=self.bound
482
+ )
483
+
484
+
485
+ def lt(val):
486
+ """
487
+ A validator that raises `ValueError` if the initializer is called
488
+ with a number larger or equal to *val*.
489
+
490
+ :param val: Exclusive upper bound for values
491
+
492
+ .. versionadded:: 21.3.0
493
+ """
494
+ return _NumberValidator(val, "<", operator.lt)
495
+
496
+
497
+ def le(val):
498
+ """
499
+ A validator that raises `ValueError` if the initializer is called
500
+ with a number greater than *val*.
501
+
502
+ :param val: Inclusive upper bound for values
503
+
504
+ .. versionadded:: 21.3.0
505
+ """
506
+ return _NumberValidator(val, "<=", operator.le)
507
+
508
+
509
+ def ge(val):
510
+ """
511
+ A validator that raises `ValueError` if the initializer is called
512
+ with a number smaller than *val*.
513
+
514
+ :param val: Inclusive lower bound for values
515
+
516
+ .. versionadded:: 21.3.0
517
+ """
518
+ return _NumberValidator(val, ">=", operator.ge)
519
+
520
+
521
+ def gt(val):
522
+ """
523
+ A validator that raises `ValueError` if the initializer is called
524
+ with a number smaller or equal to *val*.
525
+
526
+ :param val: Exclusive lower bound for values
527
+
528
+ .. versionadded:: 21.3.0
529
+ """
530
+ return _NumberValidator(val, ">", operator.gt)
531
+
532
+
533
+ @attrs(repr=False, frozen=True, slots=True)
534
+ class _MaxLengthValidator(object):
535
+ max_length = attrib()
536
+
537
+ def __call__(self, inst, attr, value):
538
+ """
539
+ We use a callable class to be able to change the ``__repr__``.
540
+ """
541
+ if len(value) > self.max_length:
542
+ raise ValueError(
543
+ "Length of '{name}' must be <= {max}: {len}".format(
544
+ name=attr.name, max=self.max_length, len=len(value)
545
+ )
546
+ )
547
+
548
+ def __repr__(self):
549
+ return "<max_len validator for {max}>".format(max=self.max_length)
550
+
551
+
552
+ def max_len(length):
553
+ """
554
+ A validator that raises `ValueError` if the initializer is called
555
+ with a string or iterable that is longer than *length*.
556
+
557
+ :param int length: Maximum length of the string or iterable
558
+
559
+ .. versionadded:: 21.3.0
560
+ """
561
+ return _MaxLengthValidator(length)
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/attr/validators.pyi ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import (
2
+ Any,
3
+ AnyStr,
4
+ Callable,
5
+ Container,
6
+ ContextManager,
7
+ Iterable,
8
+ List,
9
+ Mapping,
10
+ Match,
11
+ Optional,
12
+ Pattern,
13
+ Tuple,
14
+ Type,
15
+ TypeVar,
16
+ Union,
17
+ overload,
18
+ )
19
+
20
+ from . import _ValidatorType
21
+
22
+ _T = TypeVar("_T")
23
+ _T1 = TypeVar("_T1")
24
+ _T2 = TypeVar("_T2")
25
+ _T3 = TypeVar("_T3")
26
+ _I = TypeVar("_I", bound=Iterable)
27
+ _K = TypeVar("_K")
28
+ _V = TypeVar("_V")
29
+ _M = TypeVar("_M", bound=Mapping)
30
+
31
+ def set_disabled(run: bool) -> None: ...
32
+ def get_disabled() -> bool: ...
33
+ def disabled() -> ContextManager[None]: ...
34
+
35
+ # To be more precise on instance_of use some overloads.
36
+ # If there are more than 3 items in the tuple then we fall back to Any
37
+ @overload
38
+ def instance_of(type: Type[_T]) -> _ValidatorType[_T]: ...
39
+ @overload
40
+ def instance_of(type: Tuple[Type[_T]]) -> _ValidatorType[_T]: ...
41
+ @overload
42
+ def instance_of(
43
+ type: Tuple[Type[_T1], Type[_T2]]
44
+ ) -> _ValidatorType[Union[_T1, _T2]]: ...
45
+ @overload
46
+ def instance_of(
47
+ type: Tuple[Type[_T1], Type[_T2], Type[_T3]]
48
+ ) -> _ValidatorType[Union[_T1, _T2, _T3]]: ...
49
+ @overload
50
+ def instance_of(type: Tuple[type, ...]) -> _ValidatorType[Any]: ...
51
+ def provides(interface: Any) -> _ValidatorType[Any]: ...
52
+ def optional(
53
+ validator: Union[_ValidatorType[_T], List[_ValidatorType[_T]]]
54
+ ) -> _ValidatorType[Optional[_T]]: ...
55
+ def in_(options: Container[_T]) -> _ValidatorType[_T]: ...
56
+ def and_(*validators: _ValidatorType[_T]) -> _ValidatorType[_T]: ...
57
+ def matches_re(
58
+ regex: Union[Pattern[AnyStr], AnyStr],
59
+ flags: int = ...,
60
+ func: Optional[
61
+ Callable[[AnyStr, AnyStr, int], Optional[Match[AnyStr]]]
62
+ ] = ...,
63
+ ) -> _ValidatorType[AnyStr]: ...
64
+ def deep_iterable(
65
+ member_validator: _ValidatorType[_T],
66
+ iterable_validator: Optional[_ValidatorType[_I]] = ...,
67
+ ) -> _ValidatorType[_I]: ...
68
+ def deep_mapping(
69
+ key_validator: _ValidatorType[_K],
70
+ value_validator: _ValidatorType[_V],
71
+ mapping_validator: Optional[_ValidatorType[_M]] = ...,
72
+ ) -> _ValidatorType[_M]: ...
73
+ def is_callable() -> _ValidatorType[_T]: ...
74
+ def lt(val: _T) -> _ValidatorType[_T]: ...
75
+ def le(val: _T) -> _ValidatorType[_T]: ...
76
+ def ge(val: _T) -> _ValidatorType[_T]: ...
77
+ def gt(val: _T) -> _ValidatorType[_T]: ...
78
+ def max_len(length: int) -> _ValidatorType[_T]: ...
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/caffe2/__init__.py ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ import warnings
2
+ from torch.onnx import _CAFFE2_ATEN_FALLBACK
3
+
4
+ if not _CAFFE2_ATEN_FALLBACK:
5
+ warnings.warn("Caffe2 support is not fully enabled in this PyTorch build. "
6
+ "Please enable Caffe2 by building PyTorch from source with `BUILD_CAFFE2=1` flag.")
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/cffi-1.16.0.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ conda
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/cffi-1.16.0.dist-info/LICENSE ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Except when otherwise stated (look for LICENSE files in directories or
3
+ information at the beginning of each file) all software and
4
+ documentation is licensed as follows:
5
+
6
+ The MIT License
7
+
8
+ Permission is hereby granted, free of charge, to any person
9
+ obtaining a copy of this software and associated documentation
10
+ files (the "Software"), to deal in the Software without
11
+ restriction, including without limitation the rights to use,
12
+ copy, modify, merge, publish, distribute, sublicense, and/or
13
+ sell copies of the Software, and to permit persons to whom the
14
+ Software is furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included
17
+ in all copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25
+ DEALINGS IN THE SOFTWARE.
26
+
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/cffi-1.16.0.dist-info/METADATA ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.1
2
+ Name: cffi
3
+ Version: 1.16.0
4
+ Summary: Foreign Function Interface for Python calling C code.
5
+ Home-page: http://cffi.readthedocs.org
6
+ Author: Armin Rigo, Maciej Fijalkowski
7
+ Author-email: python-cffi@googlegroups.com
8
+ License: MIT
9
+ Project-URL: Documentation, http://cffi.readthedocs.org/
10
+ Project-URL: Source Code, https://github.com/python-cffi/cffi
11
+ Project-URL: Issue Tracker, https://github.com/python-cffi/cffi/issues
12
+ Project-URL: Changelog, https://cffi.readthedocs.io/en/latest/whatsnew.html
13
+ Project-URL: Downloads, https://github.com/python-cffi/cffi/releases
14
+ Project-URL: Contact, https://groups.google.com/forum/#!forum/python-cffi
15
+ Classifier: Programming Language :: Python
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.8
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: Implementation :: CPython
23
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
24
+ Classifier: License :: OSI Approved :: MIT License
25
+ Requires-Python: >=3.8
26
+ License-File: LICENSE
27
+ Requires-Dist: pycparser
28
+
29
+
30
+ CFFI
31
+ ====
32
+
33
+ Foreign Function Interface for Python calling C code.
34
+ Please see the `Documentation <http://cffi.readthedocs.org/>`_.
35
+
36
+ Contact
37
+ -------
38
+
39
+ `Mailing list <https://groups.google.com/forum/#!forum/python-cffi>`_
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/cffi-1.16.0.dist-info/RECORD ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ _cffi_backend.cpython-38-x86_64-linux-gnu.so,sha256=k8cFQrH4oy1ts6EVS4EKUkjZJGfR9lsoSs_Y719K79k,214720
2
+ cffi-1.16.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
3
+ cffi-1.16.0.dist-info/LICENSE,sha256=BLgPWwd7vtaICM_rreteNSPyqMmpZJXFh72W3x6sKjM,1294
4
+ cffi-1.16.0.dist-info/METADATA,sha256=qOBI2i0qSlLOKwmzNjbJfLmrTzHV_JFS7uKbcFj_p9Y,1480
5
+ cffi-1.16.0.dist-info/RECORD,,
6
+ cffi-1.16.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ cffi-1.16.0.dist-info/WHEEL,sha256=bsTed55pnupMBzCO4birsRUZqi-B74u0toVjVzLw3F8,103
8
+ cffi-1.16.0.dist-info/direct_url.json,sha256=cjIv8WEBK7ofFwunO7vGvLOzApMHE1dj9eFRbmhE58g,64
9
+ cffi-1.16.0.dist-info/entry_points.txt,sha256=y6jTxnyeuLnL-XJcDv8uML3n6wyYiGRg8MTp_QGJ9Ho,75
10
+ cffi-1.16.0.dist-info/top_level.txt,sha256=rE7WR3rZfNKxWI9-jn6hsHCAl7MDkB-FmuQbxWjFehQ,19
11
+ cffi/__init__.py,sha256=uEnzaXlQndR9nc8ar1qk6_coNEfxfn4pA0sWPVg2MP8,513
12
+ cffi/__pycache__/__init__.cpython-38.pyc,,
13
+ cffi/__pycache__/_imp_emulation.cpython-38.pyc,,
14
+ cffi/__pycache__/_shimmed_dist_utils.cpython-38.pyc,,
15
+ cffi/__pycache__/api.cpython-38.pyc,,
16
+ cffi/__pycache__/backend_ctypes.cpython-38.pyc,,
17
+ cffi/__pycache__/cffi_opcode.cpython-38.pyc,,
18
+ cffi/__pycache__/commontypes.cpython-38.pyc,,
19
+ cffi/__pycache__/cparser.cpython-38.pyc,,
20
+ cffi/__pycache__/error.cpython-38.pyc,,
21
+ cffi/__pycache__/ffiplatform.cpython-38.pyc,,
22
+ cffi/__pycache__/lock.cpython-38.pyc,,
23
+ cffi/__pycache__/model.cpython-38.pyc,,
24
+ cffi/__pycache__/pkgconfig.cpython-38.pyc,,
25
+ cffi/__pycache__/recompiler.cpython-38.pyc,,
26
+ cffi/__pycache__/setuptools_ext.cpython-38.pyc,,
27
+ cffi/__pycache__/vengine_cpy.cpython-38.pyc,,
28
+ cffi/__pycache__/vengine_gen.cpython-38.pyc,,
29
+ cffi/__pycache__/verifier.cpython-38.pyc,,
30
+ cffi/_cffi_errors.h,sha256=zQXt7uR_m8gUW-fI2hJg0KoSkJFwXv8RGUkEDZ177dQ,3908
31
+ cffi/_cffi_include.h,sha256=tKnA1rdSoPHp23FnDL1mDGwFo-Uj6fXfA6vA6kcoEUc,14800
32
+ cffi/_embedding.h,sha256=QEmrJKlB_W2VC601CjjyfMuxtgzPQwwEKFlwMCGHbT0,18787
33
+ cffi/_imp_emulation.py,sha256=RxREG8zAbI2RPGBww90u_5fi8sWdahpdipOoPzkp7C0,2960
34
+ cffi/_shimmed_dist_utils.py,sha256=mLuEtxw4gbuA2De_gD7zEhb6Q8Wm2lBPtwC68gd9XTs,2007
35
+ cffi/api.py,sha256=wtJU0aGUC3TyYnjBIgsOIlv7drF19jV-y_srt7c8yhg,42085
36
+ cffi/backend_ctypes.py,sha256=h5ZIzLc6BFVXnGyc9xPqZWUS7qGy7yFSDqXe68Sa8z4,42454
37
+ cffi/cffi_opcode.py,sha256=v9RdD_ovA8rCtqsC95Ivki5V667rAOhGgs3fb2q9xpM,5724
38
+ cffi/commontypes.py,sha256=QS4uxCDI7JhtTyjh1hlnCA-gynmaszWxJaRRLGkJa1A,2689
39
+ cffi/cparser.py,sha256=rO_1pELRw1gI1DE1m4gi2ik5JMfpxouAACLXpRPlVEA,44231
40
+ cffi/error.py,sha256=v6xTiS4U0kvDcy4h_BDRo5v39ZQuj-IMRYLv5ETddZs,877
41
+ cffi/ffiplatform.py,sha256=avxFjdikYGJoEtmJO7ewVmwG_VEVl6EZ_WaNhZYCqv4,3584
42
+ cffi/lock.py,sha256=l9TTdwMIMpi6jDkJGnQgE9cvTIR7CAntIJr8EGHt3pY,747
43
+ cffi/model.py,sha256=RVsAb3h_u7VHWZJ-J_Z4kvB36pFyFG_MVIjPOQ8YhQ8,21790
44
+ cffi/parse_c_type.h,sha256=OdwQfwM9ktq6vlCB43exFQmxDBtj2MBNdK8LYl15tjw,5976
45
+ cffi/pkgconfig.py,sha256=LP1w7vmWvmKwyqLaU1Z243FOWGNQMrgMUZrvgFuOlco,4374
46
+ cffi/recompiler.py,sha256=oTusgKQ02YY6LXhcmWcqpIlPrG178RMXXSBseSACRgg,64601
47
+ cffi/setuptools_ext.py,sha256=-ebj79lO2_AUH-kRcaja2pKY1Z_5tloGwsJgzK8P3Cc,8871
48
+ cffi/vengine_cpy.py,sha256=nK_im1DbdIGMMgxFgeo1MndFjaB-Qlkc2ZYlSquLjs0,43351
49
+ cffi/vengine_gen.py,sha256=5dX7s1DU6pTBOMI6oTVn_8Bnmru_lj932B6b4v29Hlg,26684
50
+ cffi/verifier.py,sha256=oX8jpaohg2Qm3aHcznidAdvrVm5N4sQYG0a3Eo5mIl4,11182
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/cffi-1.16.0.dist-info/REQUESTED ADDED
File without changes
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/cffi-1.16.0.dist-info/WHEEL ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ Wheel-Version: 1.0
2
+ Generator: bdist_wheel (0.41.2)
3
+ Root-Is-Purelib: false
4
+ Tag: cp38-cp38-linux_x86_64
5
+
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/cffi-1.16.0.dist-info/direct_url.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"dir_info": {}, "url": "file:///croot/cffi_1700254295673/work"}
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/cffi-1.16.0.dist-info/entry_points.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ [distutils.setup_keywords]
2
+ cffi_modules = cffi.setuptools_ext:cffi_modules
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/cffi-1.16.0.dist-info/top_level.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ _cffi_backend
2
+ cffi
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/conda_package_streaming-0.9.0.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ conda
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/conda_package_streaming-0.9.0.dist-info/LICENSE ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2022, Anaconda, Inc.
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ 3. Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ lazy_wheel.py:
32
+
33
+ Copyright (c) 2008-present The pip developers (see
34
+ https://github.com/pypa/pip/blob/main/AUTHORS.txt file)
35
+
36
+ Permission is hereby granted, free of charge, to any person obtaining
37
+ a copy of this software and associated documentation files (the
38
+ "Software"), to deal in the Software without restriction, including
39
+ without limitation the rights to use, copy, modify, merge, publish,
40
+ distribute, sublicense, and/or sell copies of the Software, and to
41
+ permit persons to whom the Software is furnished to do so, subject to
42
+ the following conditions:
43
+
44
+ The above copyright notice and this permission notice shall be
45
+ included in all copies or substantial portions of the Software.
46
+
47
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
48
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
49
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
50
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
51
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
52
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
53
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/conda_package_streaming-0.9.0.dist-info/METADATA ADDED
@@ -0,0 +1,123 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.1
2
+ Name: conda_package_streaming
3
+ Version: 0.9.0
4
+ Summary: An efficient library to read from new and old format .conda and .tar.bz2 conda packages.
5
+ Author-email: "Anaconda, Inc. & Contributors" <conda@continuum.io>
6
+ Requires-Python: >=3.7
7
+ Description-Content-Type: text/markdown
8
+ Classifier: License :: OSI Approved :: BSD License
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Programming Language :: Python :: Implementation :: CPython
11
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
12
+ Requires-Dist: requests
13
+ Requires-Dist: zstandard >=0.15
14
+ Requires-Dist: furo ; extra == "docs"
15
+ Requires-Dist: sphinx ; extra == "docs"
16
+ Requires-Dist: myst-parser ; extra == "docs"
17
+ Requires-Dist: mdit-py-plugins>=0.3.0 ; extra == "docs"
18
+ Requires-Dist: pytest >=7 ; extra == "test"
19
+ Requires-Dist: pytest-cov ; extra == "test"
20
+ Requires-Dist: pytest-mock ; extra == "test"
21
+ Requires-Dist: boto3 ; extra == "test"
22
+ Requires-Dist: boto3-stubs[essential] ; extra == "test"
23
+ Requires-Dist: bottle ; extra == "test"
24
+ Requires-Dist: conda ; extra == "test"
25
+ Requires-Dist: conda-package-handling >=2 ; extra == "test"
26
+ Project-URL: Documentation, https://conda.github.io/conda-package-streaming/
27
+ Project-URL: Home, https://github.com/conda/conda-package-streaming
28
+ Provides-Extra: docs
29
+ Provides-Extra: test
30
+
31
+ # conda-package-streaming
32
+
33
+ [![pre-commit.ci status](https://results.pre-commit.ci/badge/github/conda/conda-package-streaming/main.svg)](https://results.pre-commit.ci/latest/github/conda/conda-package-streaming/main)
34
+
35
+ An efficient library to read from new and old format .conda and .tar.bz2 conda
36
+ packages.
37
+
38
+ Download conda metadata from packages without transferring entire file. Get
39
+ metadata from local `.tar.bz2` packages without reading entire files.
40
+
41
+ Uses enhanced pip `lazy_wheel` to fetch a file out of `.conda` with no more than
42
+ 3 range requests, but usually 2.
43
+
44
+ Uses `tar = tarfile.open(fileobj=...)` to stream remote `.tar.bz2`. Closes the
45
+ HTTP request once desired files have been seen.
46
+
47
+ # Quickstart
48
+
49
+ The basic API yields (tarfile, member) tuples from conda files as tarfile is
50
+ needed to extract member. Note the `.tar.bz2` format yields all members, not
51
+ just `info/`, from `stream_conda_info` / `stream_conda_component`, while the
52
+ `.conda` format yields members from the requested inner archive — allowing the
53
+ caller to decide when to stop reading.
54
+
55
+ From a url,
56
+ ```python
57
+ from conda_package_streaming.url import stream_conda_info
58
+ # url = (ends with .conda or .tar.bz2)
59
+ for tar, member in stream_conda_info(url):
60
+ if member.name == "info/index.json":
61
+ index_json = json.load(tar.extractfile(member))
62
+ break
63
+ ```
64
+
65
+ From s3,
66
+ ```python
67
+ client = boto3.client("s3")
68
+ from conda_package_streaming.s3 import stream_conda_info
69
+ # key = (ends with .conda or .tar.bz2)
70
+ for tar, member in stream_conda_info(client, bucket, key):
71
+ if member.name == "info/index.json":
72
+ index_json = json.load(tar.extractfile(member))
73
+ break
74
+ ```
75
+
76
+ From a filename,
77
+ ```python
78
+ from conda_package_streaming import package_streaming
79
+ # filename = (ends with .conda or .tar.bz2)
80
+ for tar, member in package_streaming.stream_conda_info(filename):
81
+ if member.name == "info/index.json":
82
+ index_json = json.load(tar.extractfile(member))
83
+ break
84
+ ```
85
+
86
+ From a file-like object,
87
+ ```python
88
+ from contextlib import closing
89
+
90
+ from conda_package_streaming.url import conda_reader_for_url
91
+ from conda_package_streaming.package_streaming import stream_conda_component
92
+ filename, conda = conda_reader_for_url(url)
93
+
94
+ # file object must be seekable for `.conda` format, but merely readable for `.tar.bz2`
95
+ with closing(conda):
96
+ for tar, member in stream_conda_component(filename, conda, component="info"):
97
+ if member.name == "info/index.json":
98
+ index_json = json.load(tar.extractfile(member))
99
+ break
100
+ ```
101
+
102
+ If you need the entire package, download it first and use the file-based APIs.
103
+ The URL-based APIs are more efficient if you only need to access package
104
+ metadata.
105
+
106
+ # Package goals
107
+
108
+ * Extract conda packages (both formats)
109
+ * Easy to install from pypi or conda
110
+ * Do the least amount of I/O possible (no temporary files, transfer partial packages)
111
+ * Open files from the network / standard HTTP / s3
112
+
113
+ * Continue using conda-package-handling to create .conda packages
114
+
115
+ # Generating documentation
116
+
117
+ Uses markdown, furo theme. Requires newer mdit-py-plugins.
118
+
119
+ `pip install conda-package-streaming[docs]`
120
+
121
+ One time:
122
+ `sphinx-apidoc -o docs .`
123
+
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/conda_package_streaming-0.9.0.dist-info/RECORD ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ conda_package_streaming-0.9.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
2
+ conda_package_streaming-0.9.0.dist-info/LICENSE,sha256=WPOScO-I9aoJgXok_DebNZN-PZhtB13xi1WqU0iqrWY,2670
3
+ conda_package_streaming-0.9.0.dist-info/METADATA,sha256=v6KAneLFl-5MMJ4Sseu_1IuzvqEbW7zO08jCUuTiNq0,4491
4
+ conda_package_streaming-0.9.0.dist-info/RECORD,,
5
+ conda_package_streaming-0.9.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ conda_package_streaming-0.9.0.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
7
+ conda_package_streaming-0.9.0.dist-info/direct_url.json,sha256=luamLXV5NvouU6jK1EUSW6FWq7xHhRDIDQzbPtPCrpg,119
8
+ conda_package_streaming/__init__.py,sha256=H9NWRZb7NbeRRPLP_V1fARmLNXranorVM-OOY-8_2ug,22
9
+ conda_package_streaming/__pycache__/__init__.cpython-311.pyc,,
10
+ conda_package_streaming/__pycache__/exceptions.cpython-311.pyc,,
11
+ conda_package_streaming/__pycache__/extract.cpython-311.pyc,,
12
+ conda_package_streaming/__pycache__/lazy_wheel.cpython-311.pyc,,
13
+ conda_package_streaming/__pycache__/package_streaming.cpython-311.pyc,,
14
+ conda_package_streaming/__pycache__/s3.cpython-311.pyc,,
15
+ conda_package_streaming/__pycache__/transmute.cpython-311.pyc,,
16
+ conda_package_streaming/__pycache__/url.cpython-311.pyc,,
17
+ conda_package_streaming/exceptions.py,sha256=7fG4CNtukkSRWAGh9Zg2DCNkhw-wNo-Oi35c2jf0VsQ,677
18
+ conda_package_streaming/extract.py,sha256=quYBuhRA4TOdCvEXFyPXZKZOuJcBvazdQfL8nQnhYuk,2538
19
+ conda_package_streaming/lazy_wheel.py,sha256=eqEtfzoQCWC8lc1wNzOtRfOTlqHnUUc4b5MllS3O1W0,9449
20
+ conda_package_streaming/package_streaming.py,sha256=ApUpvoGQ4UGXOIvOTFIkfXx0-TnWsZxGRSMNvlwCQbQ,4819
21
+ conda_package_streaming/s3.py,sha256=ygm59wSPpixvwkO4QqSgvalNUjAk1FzEXW0JNj45cgI,2286
22
+ conda_package_streaming/transmute.py,sha256=JrpmR-_lRe1Zd-RLd_Tqr9Qjc8Xq-97Xjiy54VgInlQ,5718
23
+ conda_package_streaming/url.py,sha256=WCpe8048F9hb_BgZRlNMvVyMugLNbty2MladRjvrvmo,2707
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/conda_package_streaming-0.9.0.dist-info/REQUESTED ADDED
File without changes
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/conda_package_streaming-0.9.0.dist-info/WHEEL ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ Wheel-Version: 1.0
2
+ Generator: flit 3.9.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/conda_package_streaming-0.9.0.dist-info/direct_url.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"dir_info": {}, "url": "file:///home/conda/feedstock_root/build_artifacts/conda-package-streaming_1691009212940/work"}
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/ema_pytorch/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ from ema_pytorch.ema_pytorch import EMA
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/ema_pytorch/ema_pytorch.py ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import copy
2
+ import torch
3
+ from torch import nn
4
+
5
+ def exists(val):
6
+ return val is not None
7
+
8
+ def is_float_dtype(dtype):
9
+ return any([dtype == float_dtype for float_dtype in (torch.float64, torch.float32, torch.float16, torch.bfloat16)])
10
+
11
+ def clamp(value, min_value = None, max_value = None):
12
+ assert exists(min_value) or exists(max_value)
13
+ if exists(min_value):
14
+ value = max(value, min_value)
15
+
16
+ if exists(max_value):
17
+ value = min(value, max_value)
18
+
19
+ return value
20
+
21
+ class EMA(nn.Module):
22
+ """
23
+ Implements exponential moving average shadowing for your model.
24
+
25
+ Utilizes an inverse decay schedule to manage longer term training runs.
26
+ By adjusting the power, you can control how fast EMA will ramp up to your specified beta.
27
+
28
+ @crowsonkb's notes on EMA Warmup:
29
+
30
+ If gamma=1 and power=1, implements a simple average. gamma=1, power=2/3 are
31
+ good values for models you plan to train for a million or more steps (reaches decay
32
+ factor 0.999 at 31.6K steps, 0.9999 at 1M steps), gamma=1, power=3/4 for models
33
+ you plan to train for less (reaches decay factor 0.999 at 10K steps, 0.9999 at
34
+ 215.4k steps).
35
+
36
+ Args:
37
+ inv_gamma (float): Inverse multiplicative factor of EMA warmup. Default: 1.
38
+ power (float): Exponential factor of EMA warmup. Default: 1.
39
+ min_value (float): The minimum EMA decay rate. Default: 0.
40
+ """
41
+ def __init__(
42
+ self,
43
+ model,
44
+ beta = 0.9999,
45
+ update_after_step = 100,
46
+ update_every = 10,
47
+ inv_gamma = 1.0,
48
+ power = 2 / 3,
49
+ min_value = 0.0,
50
+ param_or_buffer_names_no_ema = set(),
51
+ ):
52
+ super().__init__()
53
+ self.beta = beta
54
+ self.online_model = model
55
+
56
+ try:
57
+ self.ema_model = copy.deepcopy(model)
58
+ except:
59
+ print('Your model was not copyable. Please make sure you are not using any LazyLinear')
60
+ exit()
61
+
62
+ self.ema_model.requires_grad_(False)
63
+ self.update_every = update_every
64
+ self.update_after_step = update_after_step
65
+
66
+ self.inv_gamma = inv_gamma
67
+ self.power = power
68
+ self.min_value = min_value
69
+
70
+ assert isinstance(param_or_buffer_names_no_ema, (set, list))
71
+ self.param_or_buffer_names_no_ema = param_or_buffer_names_no_ema # parameter or buffer
72
+
73
+ self.register_buffer('initted', torch.Tensor([False]))
74
+ self.register_buffer('step', torch.tensor([0]))
75
+
76
+ def restore_ema_model_device(self):
77
+ device = self.initted.device
78
+ self.ema_model.to(device)
79
+
80
+ def copy_params_from_model_to_ema(self):
81
+ for ma_params, current_params in zip(list(self.ema_model.parameters()), list(self.online_model.parameters())):
82
+ if not is_float_dtype(current_params.dtype):
83
+ continue
84
+
85
+ ma_params.data.copy_(current_params.data)
86
+
87
+ for ma_buffers, current_buffers in zip(list(self.ema_model.buffers()), list(self.online_model.buffers())):
88
+ if not is_float_dtype(current_buffers.dtype):
89
+ continue
90
+
91
+ ma_buffers.data.copy_(current_buffers.data)
92
+
93
+ def get_current_decay(self):
94
+ epoch = clamp(self.step.item() - self.update_after_step - 1, min_value = 0.)
95
+ value = 1 - (1 + epoch / self.inv_gamma) ** - self.power
96
+
97
+ if epoch <= 0:
98
+ return 0.
99
+
100
+ return clamp(value, min_value = self.min_value, max_value = self.beta)
101
+
102
+ def update(self):
103
+ step = self.step.item()
104
+ self.step += 1
105
+
106
+ if (step % self.update_every) != 0:
107
+ return
108
+
109
+ if step <= self.update_after_step:
110
+ self.copy_params_from_model_to_ema()
111
+ return
112
+
113
+ if not self.initted.item():
114
+ self.copy_params_from_model_to_ema()
115
+ self.initted.data.copy_(torch.Tensor([True]))
116
+
117
+ self.update_moving_average(self.ema_model, self.online_model)
118
+
119
+ @torch.no_grad()
120
+ def update_moving_average(self, ma_model, current_model):
121
+ current_decay = self.get_current_decay()
122
+
123
+ for (name, current_params), (_, ma_params) in zip(list(current_model.named_parameters()), list(ma_model.named_parameters())):
124
+ if not is_float_dtype(current_params.dtype):
125
+ continue
126
+
127
+ if name in self.param_or_buffer_names_no_ema:
128
+ ma_params.data.copy_(current_params.data)
129
+ continue
130
+
131
+ difference = ma_params.data - current_params.data
132
+ difference.mul_(1.0 - current_decay)
133
+ ma_params.sub_(difference)
134
+
135
+ for (name, current_buffer), (_, ma_buffer) in zip(list(current_model.named_buffers()), list(ma_model.named_buffers())):
136
+ if not is_float_dtype(current_buffer.dtype):
137
+ continue
138
+
139
+ if name in self.param_or_buffer_names_no_ema:
140
+ ma_buffer.data.copy_(current_buffer.data)
141
+ continue
142
+
143
+ difference = ma_buffer - current_buffer
144
+ difference.mul_(1.0 - current_decay)
145
+ ma_buffer.sub_(difference)
146
+
147
+ def __call__(self, *args, **kwargs):
148
+ return self.ema_model(*args, **kwargs)
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/h5py/_conv.cpython-38-x86_64-linux-gnu.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c09e26f78982823056888fff0a4de1eee4592c7e0d761cf42614b554cb662958
3
+ size 438392
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/h5py/h5a.cpython-38-x86_64-linux-gnu.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2ef3e50ea264685a38710eacee6e8450f95e901aebd78fb070dd9f1507dbc9be
3
+ size 269232
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/h5py/h5i.cpython-38-x86_64-linux-gnu.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2d0fd9c38db14f04502128315ac680733264c0feb11363ac129254c57c5915f2
3
+ size 162200
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/h5py/h5p.cpython-38-x86_64-linux-gnu.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c79540255031ac514b109e184ffd41dda2dc6c49c19be35d447f7803c3e9b14c
3
+ size 781880
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/imageio_ffmpeg-0.4.7.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ pip
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/imageio_ffmpeg-0.4.7.dist-info/LICENSE ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ BSD 2-Clause License
2
+
3
+ Copyright (c) 2019, imageio
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ * Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ * Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
20
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
22
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
23
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/imageio_ffmpeg-0.4.7.dist-info/METADATA ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.1
2
+ Name: imageio-ffmpeg
3
+ Version: 0.4.7
4
+ Summary: FFMPEG wrapper for Python
5
+ Home-page: https://github.com/imageio/imageio-ffmpeg
6
+ Author: imageio contributors
7
+ Author-email: almar.klein@gmail.com
8
+ License: BSD-2-Clause
9
+ Download-URL: http://pypi.python.org/pypi/imageio-ffmpeg
10
+ Keywords: video ffmpeg
11
+ Platform: any
12
+ Classifier: Development Status :: 5 - Production/Stable
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Intended Audience :: Education
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: BSD License
17
+ Classifier: Operating System :: MacOS :: MacOS X
18
+ Classifier: Operating System :: Microsoft :: Windows
19
+ Classifier: Operating System :: POSIX
20
+ Classifier: Programming Language :: Python
21
+ Classifier: Programming Language :: Python :: 3
22
+ Classifier: Programming Language :: Python :: 3.5
23
+ Classifier: Programming Language :: Python :: 3.6
24
+ Classifier: Programming Language :: Python :: 3.7
25
+ Classifier: Programming Language :: Python :: 3.8
26
+ Classifier: Programming Language :: Python :: 3.9
27
+ Classifier: Programming Language :: Python :: 3.10
28
+ Provides: imageio_ffmpeg
29
+ Requires-Python: >=3.5
30
+ License-File: LICENSE
31
+
32
+ FFMPEG wrapper for Python.
33
+
34
+ Note that the platform-specific wheels contain the binary executable
35
+ of ffmpeg, which makes this package around 60 MiB in size.
36
+ I guess that's the cost for being able to read/write video files.
37
+
38
+ For Linux users: the above is not the case when installing via your
39
+ Linux package manager (if that is possible), because this package would
40
+ simply depend on ffmpeg in that case.
41
+
42
+
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/imageio_ffmpeg-0.4.7.dist-info/RECORD ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ imageio_ffmpeg-0.4.7.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
2
+ imageio_ffmpeg-0.4.7.dist-info/LICENSE,sha256=nJvpIbtQ7-Rkc86JE1sDcGHfXM3K6Xy_hKzhiw-onc4,1312
3
+ imageio_ffmpeg-0.4.7.dist-info/METADATA,sha256=c4bjBqQEz98oBzD7ZlEGtNq7afquVLkfB4O190zhsU4,1577
4
+ imageio_ffmpeg-0.4.7.dist-info/RECORD,,
5
+ imageio_ffmpeg-0.4.7.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ imageio_ffmpeg-0.4.7.dist-info/WHEEL,sha256=JG0f5q-l1tk3Qjvj5-c2Cu5nNOHyulBrZOKMxkgYopM,108
7
+ imageio_ffmpeg-0.4.7.dist-info/top_level.txt,sha256=ODQYUYYbtj9I1SjASEMY7h8Q8haLrmMNURSCn0FEB18,15
8
+ imageio_ffmpeg/__init__.py,sha256=AEGmAbioCkfhYPhDQNck7aLOyKUOZtOWOtGnoNjSAQQ,227
9
+ imageio_ffmpeg/__pycache__/__init__.cpython-38.pyc,,
10
+ imageio_ffmpeg/__pycache__/_definitions.cpython-38.pyc,,
11
+ imageio_ffmpeg/__pycache__/_io.cpython-38.pyc,,
12
+ imageio_ffmpeg/__pycache__/_parsing.cpython-38.pyc,,
13
+ imageio_ffmpeg/__pycache__/_utils.cpython-38.pyc,,
14
+ imageio_ffmpeg/_definitions.py,sha256=IOY3ZT-OEd6tAl_VFlDJ5viwCaa6I9ySQTs06oTI_kA,1609
15
+ imageio_ffmpeg/_io.py,sha256=TRNbg_-EF1pqPshxLedTxrvMq2diw5d13Nmm7_snP9Y,26824
16
+ imageio_ffmpeg/_parsing.py,sha256=EiABt33ZrJUVb9yRHLlpiG6N4BGDut-_H9GbHn89KhY,6595
17
+ imageio_ffmpeg/_utils.py,sha256=zr_xMHv6POlOkxobXIOcsXF8PcK1ifJpGzU1VdFdI30,3306
18
+ imageio_ffmpeg/binaries/README.md,sha256=sNNt-xuh6lyoc6b228wilbenlErqh1Bx2RpqrRhw530,45
19
+ imageio_ffmpeg/binaries/ffmpeg-linux64-v4.2.2,sha256=cABz2u9cI7vLGMLq5gVTpFSlIh7Bm0qIyMNnpmRnGnw,73807592
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/imageio_ffmpeg-0.4.7.dist-info/REQUESTED ADDED
File without changes
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/imageio_ffmpeg-0.4.7.dist-info/WHEEL ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ Wheel-Version: 1.0
2
+ Generator: bdist_wheel (0.37.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-manylinux2010_x86_64
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/imageio_ffmpeg-0.4.7.dist-info/top_level.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ imageio_ffmpeg
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/importlib_metadata/__init__.py ADDED
@@ -0,0 +1,1095 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import re
3
+ import abc
4
+ import csv
5
+ import sys
6
+ import zipp
7
+ import email
8
+ import pathlib
9
+ import operator
10
+ import textwrap
11
+ import warnings
12
+ import functools
13
+ import itertools
14
+ import posixpath
15
+ import collections
16
+
17
+ from . import _adapters, _meta
18
+ from ._collections import FreezableDefaultDict, Pair
19
+ from ._compat import (
20
+ NullFinder,
21
+ install,
22
+ pypy_partial,
23
+ )
24
+ from ._functools import method_cache, pass_none
25
+ from ._itertools import always_iterable, unique_everseen
26
+ from ._meta import PackageMetadata, SimplePath
27
+
28
+ from contextlib import suppress
29
+ from importlib import import_module
30
+ from importlib.abc import MetaPathFinder
31
+ from itertools import starmap
32
+ from typing import List, Mapping, Optional, Union
33
+
34
+
35
+ __all__ = [
36
+ 'Distribution',
37
+ 'DistributionFinder',
38
+ 'PackageMetadata',
39
+ 'PackageNotFoundError',
40
+ 'distribution',
41
+ 'distributions',
42
+ 'entry_points',
43
+ 'files',
44
+ 'metadata',
45
+ 'packages_distributions',
46
+ 'requires',
47
+ 'version',
48
+ ]
49
+
50
+
51
+ class PackageNotFoundError(ModuleNotFoundError):
52
+ """The package was not found."""
53
+
54
+ def __str__(self):
55
+ return f"No package metadata was found for {self.name}"
56
+
57
+ @property
58
+ def name(self):
59
+ (name,) = self.args
60
+ return name
61
+
62
+
63
+ class Sectioned:
64
+ """
65
+ A simple entry point config parser for performance
66
+
67
+ >>> for item in Sectioned.read(Sectioned._sample):
68
+ ... print(item)
69
+ Pair(name='sec1', value='# comments ignored')
70
+ Pair(name='sec1', value='a = 1')
71
+ Pair(name='sec1', value='b = 2')
72
+ Pair(name='sec2', value='a = 2')
73
+
74
+ >>> res = Sectioned.section_pairs(Sectioned._sample)
75
+ >>> item = next(res)
76
+ >>> item.name
77
+ 'sec1'
78
+ >>> item.value
79
+ Pair(name='a', value='1')
80
+ >>> item = next(res)
81
+ >>> item.value
82
+ Pair(name='b', value='2')
83
+ >>> item = next(res)
84
+ >>> item.name
85
+ 'sec2'
86
+ >>> item.value
87
+ Pair(name='a', value='2')
88
+ >>> list(res)
89
+ []
90
+ """
91
+
92
+ _sample = textwrap.dedent(
93
+ """
94
+ [sec1]
95
+ # comments ignored
96
+ a = 1
97
+ b = 2
98
+
99
+ [sec2]
100
+ a = 2
101
+ """
102
+ ).lstrip()
103
+
104
+ @classmethod
105
+ def section_pairs(cls, text):
106
+ return (
107
+ section._replace(value=Pair.parse(section.value))
108
+ for section in cls.read(text, filter_=cls.valid)
109
+ if section.name is not None
110
+ )
111
+
112
+ @staticmethod
113
+ def read(text, filter_=None):
114
+ lines = filter(filter_, map(str.strip, text.splitlines()))
115
+ name = None
116
+ for value in lines:
117
+ section_match = value.startswith('[') and value.endswith(']')
118
+ if section_match:
119
+ name = value.strip('[]')
120
+ continue
121
+ yield Pair(name, value)
122
+
123
+ @staticmethod
124
+ def valid(line):
125
+ return line and not line.startswith('#')
126
+
127
+
128
+ class DeprecatedTuple:
129
+ """
130
+ Provide subscript item access for backward compatibility.
131
+
132
+ >>> recwarn = getfixture('recwarn')
133
+ >>> ep = EntryPoint(name='name', value='value', group='group')
134
+ >>> ep[:]
135
+ ('name', 'value', 'group')
136
+ >>> ep[0]
137
+ 'name'
138
+ >>> len(recwarn)
139
+ 1
140
+ """
141
+
142
+ _warn = functools.partial(
143
+ warnings.warn,
144
+ "EntryPoint tuple interface is deprecated. Access members by name.",
145
+ DeprecationWarning,
146
+ stacklevel=pypy_partial(2),
147
+ )
148
+
149
+ def __getitem__(self, item):
150
+ self._warn()
151
+ return self._key()[item]
152
+
153
+
154
+ class EntryPoint(DeprecatedTuple):
155
+ """An entry point as defined by Python packaging conventions.
156
+
157
+ See `the packaging docs on entry points
158
+ <https://packaging.python.org/specifications/entry-points/>`_
159
+ for more information.
160
+
161
+ >>> ep = EntryPoint(
162
+ ... name=None, group=None, value='package.module:attr [extra1, extra2]')
163
+ >>> ep.module
164
+ 'package.module'
165
+ >>> ep.attr
166
+ 'attr'
167
+ >>> ep.extras
168
+ ['extra1', 'extra2']
169
+ """
170
+
171
+ pattern = re.compile(
172
+ r'(?P<module>[\w.]+)\s*'
173
+ r'(:\s*(?P<attr>[\w.]+)\s*)?'
174
+ r'((?P<extras>\[.*\])\s*)?$'
175
+ )
176
+ """
177
+ A regular expression describing the syntax for an entry point,
178
+ which might look like:
179
+
180
+ - module
181
+ - package.module
182
+ - package.module:attribute
183
+ - package.module:object.attribute
184
+ - package.module:attr [extra1, extra2]
185
+
186
+ Other combinations are possible as well.
187
+
188
+ The expression is lenient about whitespace around the ':',
189
+ following the attr, and following any extras.
190
+ """
191
+
192
+ dist: Optional['Distribution'] = None
193
+
194
+ def __init__(self, name, value, group):
195
+ vars(self).update(name=name, value=value, group=group)
196
+
197
+ def load(self):
198
+ """Load the entry point from its definition. If only a module
199
+ is indicated by the value, return that module. Otherwise,
200
+ return the named object.
201
+ """
202
+ match = self.pattern.match(self.value)
203
+ module = import_module(match.group('module'))
204
+ attrs = filter(None, (match.group('attr') or '').split('.'))
205
+ return functools.reduce(getattr, attrs, module)
206
+
207
+ @property
208
+ def module(self):
209
+ match = self.pattern.match(self.value)
210
+ return match.group('module')
211
+
212
+ @property
213
+ def attr(self):
214
+ match = self.pattern.match(self.value)
215
+ return match.group('attr')
216
+
217
+ @property
218
+ def extras(self):
219
+ match = self.pattern.match(self.value)
220
+ return re.findall(r'\w+', match.group('extras') or '')
221
+
222
+ def _for(self, dist):
223
+ vars(self).update(dist=dist)
224
+ return self
225
+
226
+ def __iter__(self):
227
+ """
228
+ Supply iter so one may construct dicts of EntryPoints by name.
229
+ """
230
+ msg = (
231
+ "Construction of dict of EntryPoints is deprecated in "
232
+ "favor of EntryPoints."
233
+ )
234
+ warnings.warn(msg, DeprecationWarning)
235
+ return iter((self.name, self))
236
+
237
+ def matches(self, **params):
238
+ """
239
+ EntryPoint matches the given parameters.
240
+
241
+ >>> ep = EntryPoint(group='foo', name='bar', value='bing:bong [extra1, extra2]')
242
+ >>> ep.matches(group='foo')
243
+ True
244
+ >>> ep.matches(name='bar', value='bing:bong [extra1, extra2]')
245
+ True
246
+ >>> ep.matches(group='foo', name='other')
247
+ False
248
+ >>> ep.matches()
249
+ True
250
+ >>> ep.matches(extras=['extra1', 'extra2'])
251
+ True
252
+ >>> ep.matches(module='bing')
253
+ True
254
+ >>> ep.matches(attr='bong')
255
+ True
256
+ """
257
+ attrs = (getattr(self, param) for param in params)
258
+ return all(map(operator.eq, params.values(), attrs))
259
+
260
+ def _key(self):
261
+ return self.name, self.value, self.group
262
+
263
+ def __lt__(self, other):
264
+ return self._key() < other._key()
265
+
266
+ def __eq__(self, other):
267
+ return self._key() == other._key()
268
+
269
+ def __setattr__(self, name, value):
270
+ raise AttributeError("EntryPoint objects are immutable.")
271
+
272
+ def __repr__(self):
273
+ return (
274
+ f'EntryPoint(name={self.name!r}, value={self.value!r}, '
275
+ f'group={self.group!r})'
276
+ )
277
+
278
+ def __hash__(self):
279
+ return hash(self._key())
280
+
281
+
282
+ class DeprecatedList(list):
283
+ """
284
+ Allow an otherwise immutable object to implement mutability
285
+ for compatibility.
286
+
287
+ >>> recwarn = getfixture('recwarn')
288
+ >>> dl = DeprecatedList(range(3))
289
+ >>> dl[0] = 1
290
+ >>> dl.append(3)
291
+ >>> del dl[3]
292
+ >>> dl.reverse()
293
+ >>> dl.sort()
294
+ >>> dl.extend([4])
295
+ >>> dl.pop(-1)
296
+ 4
297
+ >>> dl.remove(1)
298
+ >>> dl += [5]
299
+ >>> dl + [6]
300
+ [1, 2, 5, 6]
301
+ >>> dl + (6,)
302
+ [1, 2, 5, 6]
303
+ >>> dl.insert(0, 0)
304
+ >>> dl
305
+ [0, 1, 2, 5]
306
+ >>> dl == [0, 1, 2, 5]
307
+ True
308
+ >>> dl == (0, 1, 2, 5)
309
+ True
310
+ >>> len(recwarn)
311
+ 1
312
+ """
313
+
314
+ __slots__ = ()
315
+
316
+ _warn = functools.partial(
317
+ warnings.warn,
318
+ "EntryPoints list interface is deprecated. Cast to list if needed.",
319
+ DeprecationWarning,
320
+ stacklevel=pypy_partial(2),
321
+ )
322
+
323
+ def _wrap_deprecated_method(method_name: str): # type: ignore
324
+ def wrapped(self, *args, **kwargs):
325
+ self._warn()
326
+ return getattr(super(), method_name)(*args, **kwargs)
327
+
328
+ return method_name, wrapped
329
+
330
+ locals().update(
331
+ map(
332
+ _wrap_deprecated_method,
333
+ '__setitem__ __delitem__ append reverse extend pop remove '
334
+ '__iadd__ insert sort'.split(),
335
+ )
336
+ )
337
+
338
+ def __add__(self, other):
339
+ if not isinstance(other, tuple):
340
+ self._warn()
341
+ other = tuple(other)
342
+ return self.__class__(tuple(self) + other)
343
+
344
+ def __eq__(self, other):
345
+ if not isinstance(other, tuple):
346
+ self._warn()
347
+ other = tuple(other)
348
+
349
+ return tuple(self).__eq__(other)
350
+
351
+
352
+ class EntryPoints(DeprecatedList):
353
+ """
354
+ An immutable collection of selectable EntryPoint objects.
355
+ """
356
+
357
+ __slots__ = ()
358
+
359
+ def __getitem__(self, name): # -> EntryPoint:
360
+ """
361
+ Get the EntryPoint in self matching name.
362
+ """
363
+ if isinstance(name, int):
364
+ warnings.warn(
365
+ "Accessing entry points by index is deprecated. "
366
+ "Cast to tuple if needed.",
367
+ DeprecationWarning,
368
+ stacklevel=2,
369
+ )
370
+ return super().__getitem__(name)
371
+ try:
372
+ return next(iter(self.select(name=name)))
373
+ except StopIteration:
374
+ raise KeyError(name)
375
+
376
+ def select(self, **params):
377
+ """
378
+ Select entry points from self that match the
379
+ given parameters (typically group and/or name).
380
+ """
381
+ return EntryPoints(ep for ep in self if ep.matches(**params))
382
+
383
+ @property
384
+ def names(self):
385
+ """
386
+ Return the set of all names of all entry points.
387
+ """
388
+ return {ep.name for ep in self}
389
+
390
+ @property
391
+ def groups(self):
392
+ """
393
+ Return the set of all groups of all entry points.
394
+
395
+ For coverage while SelectableGroups is present.
396
+ >>> EntryPoints().groups
397
+ set()
398
+ """
399
+ return {ep.group for ep in self}
400
+
401
+ @classmethod
402
+ def _from_text_for(cls, text, dist):
403
+ return cls(ep._for(dist) for ep in cls._from_text(text))
404
+
405
+ @staticmethod
406
+ def _from_text(text):
407
+ return (
408
+ EntryPoint(name=item.value.name, value=item.value.value, group=item.name)
409
+ for item in Sectioned.section_pairs(text or '')
410
+ )
411
+
412
+
413
+ class Deprecated:
414
+ """
415
+ Compatibility add-in for mapping to indicate that
416
+ mapping behavior is deprecated.
417
+
418
+ >>> recwarn = getfixture('recwarn')
419
+ >>> class DeprecatedDict(Deprecated, dict): pass
420
+ >>> dd = DeprecatedDict(foo='bar')
421
+ >>> dd.get('baz', None)
422
+ >>> dd['foo']
423
+ 'bar'
424
+ >>> list(dd)
425
+ ['foo']
426
+ >>> list(dd.keys())
427
+ ['foo']
428
+ >>> 'foo' in dd
429
+ True
430
+ >>> list(dd.values())
431
+ ['bar']
432
+ >>> len(recwarn)
433
+ 1
434
+ """
435
+
436
+ _warn = functools.partial(
437
+ warnings.warn,
438
+ "SelectableGroups dict interface is deprecated. Use select.",
439
+ DeprecationWarning,
440
+ stacklevel=pypy_partial(2),
441
+ )
442
+
443
+ def __getitem__(self, name):
444
+ self._warn()
445
+ return super().__getitem__(name)
446
+
447
+ def get(self, name, default=None):
448
+ self._warn()
449
+ return super().get(name, default)
450
+
451
+ def __iter__(self):
452
+ self._warn()
453
+ return super().__iter__()
454
+
455
+ def __contains__(self, *args):
456
+ self._warn()
457
+ return super().__contains__(*args)
458
+
459
+ def keys(self):
460
+ self._warn()
461
+ return super().keys()
462
+
463
+ def values(self):
464
+ self._warn()
465
+ return super().values()
466
+
467
+
468
+ class SelectableGroups(Deprecated, dict):
469
+ """
470
+ A backward- and forward-compatible result from
471
+ entry_points that fully implements the dict interface.
472
+ """
473
+
474
+ @classmethod
475
+ def load(cls, eps):
476
+ by_group = operator.attrgetter('group')
477
+ ordered = sorted(eps, key=by_group)
478
+ grouped = itertools.groupby(ordered, by_group)
479
+ return cls((group, EntryPoints(eps)) for group, eps in grouped)
480
+
481
+ @property
482
+ def _all(self):
483
+ """
484
+ Reconstruct a list of all entrypoints from the groups.
485
+ """
486
+ groups = super(Deprecated, self).values()
487
+ return EntryPoints(itertools.chain.from_iterable(groups))
488
+
489
+ @property
490
+ def groups(self):
491
+ return self._all.groups
492
+
493
+ @property
494
+ def names(self):
495
+ """
496
+ for coverage:
497
+ >>> SelectableGroups().names
498
+ set()
499
+ """
500
+ return self._all.names
501
+
502
+ def select(self, **params):
503
+ if not params:
504
+ return self
505
+ return self._all.select(**params)
506
+
507
+
508
+ class PackagePath(pathlib.PurePosixPath):
509
+ """A reference to a path in a package"""
510
+
511
+ def read_text(self, encoding='utf-8'):
512
+ with self.locate().open(encoding=encoding) as stream:
513
+ return stream.read()
514
+
515
+ def read_binary(self):
516
+ with self.locate().open('rb') as stream:
517
+ return stream.read()
518
+
519
+ def locate(self):
520
+ """Return a path-like object for this path"""
521
+ return self.dist.locate_file(self)
522
+
523
+
524
+ class FileHash:
525
+ def __init__(self, spec):
526
+ self.mode, _, self.value = spec.partition('=')
527
+
528
+ def __repr__(self):
529
+ return f'<FileHash mode: {self.mode} value: {self.value}>'
530
+
531
+
532
+ class Distribution:
533
+ """A Python distribution package."""
534
+
535
+ @abc.abstractmethod
536
+ def read_text(self, filename):
537
+ """Attempt to load metadata file given by the name.
538
+
539
+ :param filename: The name of the file in the distribution info.
540
+ :return: The text if found, otherwise None.
541
+ """
542
+
543
+ @abc.abstractmethod
544
+ def locate_file(self, path):
545
+ """
546
+ Given a path to a file in this distribution, return a path
547
+ to it.
548
+ """
549
+
550
+ @classmethod
551
+ def from_name(cls, name: str):
552
+ """Return the Distribution for the given package name.
553
+
554
+ :param name: The name of the distribution package to search for.
555
+ :return: The Distribution instance (or subclass thereof) for the named
556
+ package, if found.
557
+ :raises PackageNotFoundError: When the named package's distribution
558
+ metadata cannot be found.
559
+ :raises ValueError: When an invalid value is supplied for name.
560
+ """
561
+ if not name:
562
+ raise ValueError("A distribution name is required.")
563
+ try:
564
+ return next(cls.discover(name=name))
565
+ except StopIteration:
566
+ raise PackageNotFoundError(name)
567
+
568
+ @classmethod
569
+ def discover(cls, **kwargs):
570
+ """Return an iterable of Distribution objects for all packages.
571
+
572
+ Pass a ``context`` or pass keyword arguments for constructing
573
+ a context.
574
+
575
+ :context: A ``DistributionFinder.Context`` object.
576
+ :return: Iterable of Distribution objects for all packages.
577
+ """
578
+ context = kwargs.pop('context', None)
579
+ if context and kwargs:
580
+ raise ValueError("cannot accept context and kwargs")
581
+ context = context or DistributionFinder.Context(**kwargs)
582
+ return itertools.chain.from_iterable(
583
+ resolver(context) for resolver in cls._discover_resolvers()
584
+ )
585
+
586
+ @staticmethod
587
+ def at(path):
588
+ """Return a Distribution for the indicated metadata path
589
+
590
+ :param path: a string or path-like object
591
+ :return: a concrete Distribution instance for the path
592
+ """
593
+ return PathDistribution(pathlib.Path(path))
594
+
595
+ @staticmethod
596
+ def _discover_resolvers():
597
+ """Search the meta_path for resolvers."""
598
+ declared = (
599
+ getattr(finder, 'find_distributions', None) for finder in sys.meta_path
600
+ )
601
+ return filter(None, declared)
602
+
603
+ @property
604
+ def metadata(self) -> _meta.PackageMetadata:
605
+ """Return the parsed metadata for this Distribution.
606
+
607
+ The returned object will have keys that name the various bits of
608
+ metadata. See PEP 566 for details.
609
+ """
610
+ text = (
611
+ self.read_text('METADATA')
612
+ or self.read_text('PKG-INFO')
613
+ # This last clause is here to support old egg-info files. Its
614
+ # effect is to just end up using the PathDistribution's self._path
615
+ # (which points to the egg-info file) attribute unchanged.
616
+ or self.read_text('')
617
+ )
618
+ return _adapters.Message(email.message_from_string(text))
619
+
620
+ @property
621
+ def name(self):
622
+ """Return the 'Name' metadata for the distribution package."""
623
+ return self.metadata['Name']
624
+
625
+ @property
626
+ def _normalized_name(self):
627
+ """Return a normalized version of the name."""
628
+ return Prepared.normalize(self.name)
629
+
630
+ @property
631
+ def version(self):
632
+ """Return the 'Version' metadata for the distribution package."""
633
+ return self.metadata['Version']
634
+
635
+ @property
636
+ def entry_points(self):
637
+ return EntryPoints._from_text_for(self.read_text('entry_points.txt'), self)
638
+
639
+ @property
640
+ def files(self):
641
+ """Files in this distribution.
642
+
643
+ :return: List of PackagePath for this distribution or None
644
+
645
+ Result is `None` if the metadata file that enumerates files
646
+ (i.e. RECORD for dist-info or SOURCES.txt for egg-info) is
647
+ missing.
648
+ Result may be empty if the metadata exists but is empty.
649
+ """
650
+
651
+ def make_file(name, hash=None, size_str=None):
652
+ result = PackagePath(name)
653
+ result.hash = FileHash(hash) if hash else None
654
+ result.size = int(size_str) if size_str else None
655
+ result.dist = self
656
+ return result
657
+
658
+ @pass_none
659
+ def make_files(lines):
660
+ return list(starmap(make_file, csv.reader(lines)))
661
+
662
+ return make_files(self._read_files_distinfo() or self._read_files_egginfo())
663
+
664
+ def _read_files_distinfo(self):
665
+ """
666
+ Read the lines of RECORD
667
+ """
668
+ text = self.read_text('RECORD')
669
+ return text and text.splitlines()
670
+
671
+ def _read_files_egginfo(self):
672
+ """
673
+ SOURCES.txt might contain literal commas, so wrap each line
674
+ in quotes.
675
+ """
676
+ text = self.read_text('SOURCES.txt')
677
+ return text and map('"{}"'.format, text.splitlines())
678
+
679
+ @property
680
+ def requires(self):
681
+ """Generated requirements specified for this Distribution"""
682
+ reqs = self._read_dist_info_reqs() or self._read_egg_info_reqs()
683
+ return reqs and list(reqs)
684
+
685
+ def _read_dist_info_reqs(self):
686
+ return self.metadata.get_all('Requires-Dist')
687
+
688
+ def _read_egg_info_reqs(self):
689
+ source = self.read_text('requires.txt')
690
+ return pass_none(self._deps_from_requires_text)(source)
691
+
692
+ @classmethod
693
+ def _deps_from_requires_text(cls, source):
694
+ return cls._convert_egg_info_reqs_to_simple_reqs(Sectioned.read(source))
695
+
696
+ @staticmethod
697
+ def _convert_egg_info_reqs_to_simple_reqs(sections):
698
+ """
699
+ Historically, setuptools would solicit and store 'extra'
700
+ requirements, including those with environment markers,
701
+ in separate sections. More modern tools expect each
702
+ dependency to be defined separately, with any relevant
703
+ extras and environment markers attached directly to that
704
+ requirement. This method converts the former to the
705
+ latter. See _test_deps_from_requires_text for an example.
706
+ """
707
+
708
+ def make_condition(name):
709
+ return name and f'extra == "{name}"'
710
+
711
+ def quoted_marker(section):
712
+ section = section or ''
713
+ extra, sep, markers = section.partition(':')
714
+ if extra and markers:
715
+ markers = f'({markers})'
716
+ conditions = list(filter(None, [markers, make_condition(extra)]))
717
+ return '; ' + ' and '.join(conditions) if conditions else ''
718
+
719
+ def url_req_space(req):
720
+ """
721
+ PEP 508 requires a space between the url_spec and the quoted_marker.
722
+ Ref python/importlib_metadata#357.
723
+ """
724
+ # '@' is uniquely indicative of a url_req.
725
+ return ' ' * ('@' in req)
726
+
727
+ for section in sections:
728
+ space = url_req_space(section.value)
729
+ yield section.value + space + quoted_marker(section.name)
730
+
731
+
732
+ class DistributionFinder(MetaPathFinder):
733
+ """
734
+ A MetaPathFinder capable of discovering installed distributions.
735
+ """
736
+
737
+ class Context:
738
+ """
739
+ Keyword arguments presented by the caller to
740
+ ``distributions()`` or ``Distribution.discover()``
741
+ to narrow the scope of a search for distributions
742
+ in all DistributionFinders.
743
+
744
+ Each DistributionFinder may expect any parameters
745
+ and should attempt to honor the canonical
746
+ parameters defined below when appropriate.
747
+ """
748
+
749
+ name = None
750
+ """
751
+ Specific name for which a distribution finder should match.
752
+ A name of ``None`` matches all distributions.
753
+ """
754
+
755
+ def __init__(self, **kwargs):
756
+ vars(self).update(kwargs)
757
+
758
+ @property
759
+ def path(self):
760
+ """
761
+ The sequence of directory path that a distribution finder
762
+ should search.
763
+
764
+ Typically refers to Python installed package paths such as
765
+ "site-packages" directories and defaults to ``sys.path``.
766
+ """
767
+ return vars(self).get('path', sys.path)
768
+
769
+ @abc.abstractmethod
770
+ def find_distributions(self, context=Context()):
771
+ """
772
+ Find distributions.
773
+
774
+ Return an iterable of all Distribution instances capable of
775
+ loading the metadata for packages matching the ``context``,
776
+ a DistributionFinder.Context instance.
777
+ """
778
+
779
+
780
+ class FastPath:
781
+ """
782
+ Micro-optimized class for searching a path for
783
+ children.
784
+
785
+ >>> FastPath('').children()
786
+ ['...']
787
+ """
788
+
789
+ @functools.lru_cache() # type: ignore
790
+ def __new__(cls, root):
791
+ return super().__new__(cls)
792
+
793
+ def __init__(self, root):
794
+ self.root = root
795
+
796
+ def joinpath(self, child):
797
+ return pathlib.Path(self.root, child)
798
+
799
+ def children(self):
800
+ with suppress(Exception):
801
+ return os.listdir(self.root or '.')
802
+ with suppress(Exception):
803
+ return self.zip_children()
804
+ return []
805
+
806
+ def zip_children(self):
807
+ zip_path = zipp.Path(self.root)
808
+ names = zip_path.root.namelist()
809
+ self.joinpath = zip_path.joinpath
810
+
811
+ return dict.fromkeys(child.split(posixpath.sep, 1)[0] for child in names)
812
+
813
+ def search(self, name):
814
+ return self.lookup(self.mtime).search(name)
815
+
816
+ @property
817
+ def mtime(self):
818
+ with suppress(OSError):
819
+ return os.stat(self.root).st_mtime
820
+ self.lookup.cache_clear()
821
+
822
+ @method_cache
823
+ def lookup(self, mtime):
824
+ return Lookup(self)
825
+
826
+
827
+ class Lookup:
828
+ def __init__(self, path: FastPath):
829
+ base = os.path.basename(path.root).lower()
830
+ base_is_egg = base.endswith(".egg")
831
+ self.infos = FreezableDefaultDict(list)
832
+ self.eggs = FreezableDefaultDict(list)
833
+
834
+ for child in path.children():
835
+ low = child.lower()
836
+ if low.endswith((".dist-info", ".egg-info")):
837
+ # rpartition is faster than splitext and suitable for this purpose.
838
+ name = low.rpartition(".")[0].partition("-")[0]
839
+ normalized = Prepared.normalize(name)
840
+ self.infos[normalized].append(path.joinpath(child))
841
+ elif base_is_egg and low == "egg-info":
842
+ name = base.rpartition(".")[0].partition("-")[0]
843
+ legacy_normalized = Prepared.legacy_normalize(name)
844
+ self.eggs[legacy_normalized].append(path.joinpath(child))
845
+
846
+ self.infos.freeze()
847
+ self.eggs.freeze()
848
+
849
+ def search(self, prepared):
850
+ infos = (
851
+ self.infos[prepared.normalized]
852
+ if prepared
853
+ else itertools.chain.from_iterable(self.infos.values())
854
+ )
855
+ eggs = (
856
+ self.eggs[prepared.legacy_normalized]
857
+ if prepared
858
+ else itertools.chain.from_iterable(self.eggs.values())
859
+ )
860
+ return itertools.chain(infos, eggs)
861
+
862
+
863
+ class Prepared:
864
+ """
865
+ A prepared search for metadata on a possibly-named package.
866
+ """
867
+
868
+ normalized = None
869
+ legacy_normalized = None
870
+
871
+ def __init__(self, name):
872
+ self.name = name
873
+ if name is None:
874
+ return
875
+ self.normalized = self.normalize(name)
876
+ self.legacy_normalized = self.legacy_normalize(name)
877
+
878
+ @staticmethod
879
+ def normalize(name):
880
+ """
881
+ PEP 503 normalization plus dashes as underscores.
882
+ """
883
+ return re.sub(r"[-_.]+", "-", name).lower().replace('-', '_')
884
+
885
+ @staticmethod
886
+ def legacy_normalize(name):
887
+ """
888
+ Normalize the package name as found in the convention in
889
+ older packaging tools versions and specs.
890
+ """
891
+ return name.lower().replace('-', '_')
892
+
893
+ def __bool__(self):
894
+ return bool(self.name)
895
+
896
+
897
+ @install
898
+ class MetadataPathFinder(NullFinder, DistributionFinder):
899
+ """A degenerate finder for distribution packages on the file system.
900
+
901
+ This finder supplies only a find_distributions() method for versions
902
+ of Python that do not have a PathFinder find_distributions().
903
+ """
904
+
905
+ def find_distributions(self, context=DistributionFinder.Context()):
906
+ """
907
+ Find distributions.
908
+
909
+ Return an iterable of all Distribution instances capable of
910
+ loading the metadata for packages matching ``context.name``
911
+ (or all names if ``None`` indicated) along the paths in the list
912
+ of directories ``context.path``.
913
+ """
914
+ found = self._search_paths(context.name, context.path)
915
+ return map(PathDistribution, found)
916
+
917
+ @classmethod
918
+ def _search_paths(cls, name, paths):
919
+ """Find metadata directories in paths heuristically."""
920
+ prepared = Prepared(name)
921
+ return itertools.chain.from_iterable(
922
+ path.search(prepared) for path in map(FastPath, paths)
923
+ )
924
+
925
+ def invalidate_caches(cls):
926
+ FastPath.__new__.cache_clear()
927
+
928
+
929
+ class PathDistribution(Distribution):
930
+ def __init__(self, path: SimplePath):
931
+ """Construct a distribution.
932
+
933
+ :param path: SimplePath indicating the metadata directory.
934
+ """
935
+ self._path = path
936
+
937
+ def read_text(self, filename):
938
+ with suppress(
939
+ FileNotFoundError,
940
+ IsADirectoryError,
941
+ KeyError,
942
+ NotADirectoryError,
943
+ PermissionError,
944
+ ):
945
+ return self._path.joinpath(filename).read_text(encoding='utf-8')
946
+
947
+ read_text.__doc__ = Distribution.read_text.__doc__
948
+
949
+ def locate_file(self, path):
950
+ return self._path.parent / path
951
+
952
+ @property
953
+ def _normalized_name(self):
954
+ """
955
+ Performance optimization: where possible, resolve the
956
+ normalized name from the file system path.
957
+ """
958
+ stem = os.path.basename(str(self._path))
959
+ return (
960
+ pass_none(Prepared.normalize)(self._name_from_stem(stem))
961
+ or super()._normalized_name
962
+ )
963
+
964
+ @staticmethod
965
+ def _name_from_stem(stem):
966
+ """
967
+ >>> PathDistribution._name_from_stem('foo-3.0.egg-info')
968
+ 'foo'
969
+ >>> PathDistribution._name_from_stem('CherryPy-3.0.dist-info')
970
+ 'CherryPy'
971
+ >>> PathDistribution._name_from_stem('face.egg-info')
972
+ 'face'
973
+ >>> PathDistribution._name_from_stem('foo.bar')
974
+ """
975
+ filename, ext = os.path.splitext(stem)
976
+ if ext not in ('.dist-info', '.egg-info'):
977
+ return
978
+ name, sep, rest = filename.partition('-')
979
+ return name
980
+
981
+
982
+ def distribution(distribution_name):
983
+ """Get the ``Distribution`` instance for the named package.
984
+
985
+ :param distribution_name: The name of the distribution package as a string.
986
+ :return: A ``Distribution`` instance (or subclass thereof).
987
+ """
988
+ return Distribution.from_name(distribution_name)
989
+
990
+
991
+ def distributions(**kwargs):
992
+ """Get all ``Distribution`` instances in the current environment.
993
+
994
+ :return: An iterable of ``Distribution`` instances.
995
+ """
996
+ return Distribution.discover(**kwargs)
997
+
998
+
999
+ def metadata(distribution_name) -> _meta.PackageMetadata:
1000
+ """Get the metadata for the named package.
1001
+
1002
+ :param distribution_name: The name of the distribution package to query.
1003
+ :return: A PackageMetadata containing the parsed metadata.
1004
+ """
1005
+ return Distribution.from_name(distribution_name).metadata
1006
+
1007
+
1008
+ def version(distribution_name):
1009
+ """Get the version string for the named package.
1010
+
1011
+ :param distribution_name: The name of the distribution package to query.
1012
+ :return: The version string for the package as defined in the package's
1013
+ "Version" metadata key.
1014
+ """
1015
+ return distribution(distribution_name).version
1016
+
1017
+
1018
+ _unique = functools.partial(
1019
+ unique_everseen,
1020
+ key=operator.attrgetter('_normalized_name'),
1021
+ )
1022
+ """
1023
+ Wrapper for ``distributions`` to return unique distributions by name.
1024
+ """
1025
+
1026
+
1027
+ def entry_points(**params) -> Union[EntryPoints, SelectableGroups]:
1028
+ """Return EntryPoint objects for all installed packages.
1029
+
1030
+ Pass selection parameters (group or name) to filter the
1031
+ result to entry points matching those properties (see
1032
+ EntryPoints.select()).
1033
+
1034
+ For compatibility, returns ``SelectableGroups`` object unless
1035
+ selection parameters are supplied. In the future, this function
1036
+ will return ``EntryPoints`` instead of ``SelectableGroups``
1037
+ even when no selection parameters are supplied.
1038
+
1039
+ For maximum future compatibility, pass selection parameters
1040
+ or invoke ``.select`` with parameters on the result.
1041
+
1042
+ :return: EntryPoints or SelectableGroups for all installed packages.
1043
+ """
1044
+ eps = itertools.chain.from_iterable(
1045
+ dist.entry_points for dist in _unique(distributions())
1046
+ )
1047
+ return SelectableGroups.load(eps).select(**params)
1048
+
1049
+
1050
+ def files(distribution_name):
1051
+ """Return a list of files for the named package.
1052
+
1053
+ :param distribution_name: The name of the distribution package to query.
1054
+ :return: List of files composing the distribution.
1055
+ """
1056
+ return distribution(distribution_name).files
1057
+
1058
+
1059
+ def requires(distribution_name):
1060
+ """
1061
+ Return a list of requirements for the named package.
1062
+
1063
+ :return: An iterator of requirements, suitable for
1064
+ packaging.requirement.Requirement.
1065
+ """
1066
+ return distribution(distribution_name).requires
1067
+
1068
+
1069
+ def packages_distributions() -> Mapping[str, List[str]]:
1070
+ """
1071
+ Return a mapping of top-level packages to their
1072
+ distributions.
1073
+
1074
+ >>> import collections.abc
1075
+ >>> pkgs = packages_distributions()
1076
+ >>> all(isinstance(dist, collections.abc.Sequence) for dist in pkgs.values())
1077
+ True
1078
+ """
1079
+ pkg_to_dist = collections.defaultdict(list)
1080
+ for dist in distributions():
1081
+ for pkg in _top_level_declared(dist) or _top_level_inferred(dist):
1082
+ pkg_to_dist[pkg].append(dist.metadata['Name'])
1083
+ return dict(pkg_to_dist)
1084
+
1085
+
1086
+ def _top_level_declared(dist):
1087
+ return (dist.read_text('top_level.txt') or '').split()
1088
+
1089
+
1090
+ def _top_level_inferred(dist):
1091
+ return {
1092
+ f.parts[0] if len(f.parts) > 1 else f.with_suffix('').name
1093
+ for f in always_iterable(dist.files)
1094
+ if f.suffix == ".py"
1095
+ }
my_container_sandbox/workspace/anaconda3/lib/python3.8/site-packages/importlib_metadata/_adapters.py ADDED
@@ -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)))