applied-ai-018 commited on
Commit
432ead4
·
verified ·
1 Parent(s): b3b0cd3

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. llmeval-env/lib/python3.10/site-packages/pip/_vendor/packaging/__about__.py +26 -0
  2. llmeval-env/lib/python3.10/site-packages/pip/_vendor/packaging/markers.py +304 -0
  3. llmeval-env/lib/python3.10/site-packages/pip/_vendor/packaging/requirements.py +146 -0
  4. llmeval-env/lib/python3.10/site-packages/pip/_vendor/packaging/tags.py +487 -0
  5. llmeval-env/lib/python3.10/site-packages/pip/_vendor/platformdirs/__init__.py +331 -0
  6. llmeval-env/lib/python3.10/site-packages/pip/_vendor/platformdirs/__main__.py +46 -0
  7. llmeval-env/lib/python3.10/site-packages/pip/_vendor/platformdirs/__pycache__/__init__.cpython-310.pyc +0 -0
  8. llmeval-env/lib/python3.10/site-packages/pip/_vendor/platformdirs/__pycache__/__main__.cpython-310.pyc +0 -0
  9. llmeval-env/lib/python3.10/site-packages/pip/_vendor/platformdirs/__pycache__/android.cpython-310.pyc +0 -0
  10. llmeval-env/lib/python3.10/site-packages/pip/_vendor/platformdirs/__pycache__/api.cpython-310.pyc +0 -0
  11. llmeval-env/lib/python3.10/site-packages/pip/_vendor/platformdirs/__pycache__/macos.cpython-310.pyc +0 -0
  12. llmeval-env/lib/python3.10/site-packages/pip/_vendor/platformdirs/__pycache__/unix.cpython-310.pyc +0 -0
  13. llmeval-env/lib/python3.10/site-packages/pip/_vendor/platformdirs/__pycache__/windows.cpython-310.pyc +0 -0
  14. llmeval-env/lib/python3.10/site-packages/pip/_vendor/platformdirs/android.py +119 -0
  15. llmeval-env/lib/python3.10/site-packages/pip/_vendor/platformdirs/api.py +156 -0
  16. llmeval-env/lib/python3.10/site-packages/pip/_vendor/platformdirs/macos.py +64 -0
  17. llmeval-env/lib/python3.10/site-packages/pip/_vendor/platformdirs/unix.py +181 -0
  18. llmeval-env/lib/python3.10/site-packages/pip/_vendor/platformdirs/version.py +4 -0
  19. llmeval-env/lib/python3.10/site-packages/pip/_vendor/platformdirs/windows.py +182 -0
  20. llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/__main__.cpython-310.pyc +0 -0
  21. llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/_emoji_codes.cpython-310.pyc +0 -0
  22. llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/_emoji_replace.cpython-310.pyc +0 -0
  23. llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/_extension.cpython-310.pyc +0 -0
  24. llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/_inspect.cpython-310.pyc +0 -0
  25. llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/_log_render.cpython-310.pyc +0 -0
  26. llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/_loop.cpython-310.pyc +0 -0
  27. llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/_lru_cache.cpython-310.pyc +0 -0
  28. llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/_palettes.cpython-310.pyc +0 -0
  29. llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/_pick.cpython-310.pyc +0 -0
  30. llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/_ratio.cpython-310.pyc +0 -0
  31. llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/_spinners.cpython-310.pyc +0 -0
  32. llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/_stack.cpython-310.pyc +0 -0
  33. llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/_timer.cpython-310.pyc +0 -0
  34. llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/_windows.cpython-310.pyc +0 -0
  35. llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/_wrap.cpython-310.pyc +0 -0
  36. llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/abc.cpython-310.pyc +0 -0
  37. llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/align.cpython-310.pyc +0 -0
  38. llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/ansi.cpython-310.pyc +0 -0
  39. llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/box.cpython-310.pyc +0 -0
  40. llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/cells.cpython-310.pyc +0 -0
  41. llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/color.cpython-310.pyc +0 -0
  42. llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/color_triplet.cpython-310.pyc +0 -0
  43. llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/columns.cpython-310.pyc +0 -0
  44. llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/console.cpython-310.pyc +0 -0
  45. llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/containers.cpython-310.pyc +0 -0
  46. llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/control.cpython-310.pyc +0 -0
  47. llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/default_styles.cpython-310.pyc +0 -0
  48. llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/diagnose.cpython-310.pyc +0 -0
  49. llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/emoji.cpython-310.pyc +0 -0
  50. llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/errors.cpython-310.pyc +0 -0
llmeval-env/lib/python3.10/site-packages/pip/_vendor/packaging/__about__.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file is dual licensed under the terms of the Apache License, Version
2
+ # 2.0, and the BSD License. See the LICENSE file in the root of this repository
3
+ # for complete details.
4
+
5
+ __all__ = [
6
+ "__title__",
7
+ "__summary__",
8
+ "__uri__",
9
+ "__version__",
10
+ "__author__",
11
+ "__email__",
12
+ "__license__",
13
+ "__copyright__",
14
+ ]
15
+
16
+ __title__ = "packaging"
17
+ __summary__ = "Core utilities for Python packages"
18
+ __uri__ = "https://github.com/pypa/packaging"
19
+
20
+ __version__ = "21.3"
21
+
22
+ __author__ = "Donald Stufft and individual contributors"
23
+ __email__ = "[email protected]"
24
+
25
+ __license__ = "BSD-2-Clause or Apache-2.0"
26
+ __copyright__ = "2014-2019 %s" % __author__
llmeval-env/lib/python3.10/site-packages/pip/_vendor/packaging/markers.py ADDED
@@ -0,0 +1,304 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file is dual licensed under the terms of the Apache License, Version
2
+ # 2.0, and the BSD License. See the LICENSE file in the root of this repository
3
+ # for complete details.
4
+
5
+ import operator
6
+ import os
7
+ import platform
8
+ import sys
9
+ from typing import Any, Callable, Dict, List, Optional, Tuple, Union
10
+
11
+ from pip._vendor.pyparsing import ( # noqa: N817
12
+ Forward,
13
+ Group,
14
+ Literal as L,
15
+ ParseException,
16
+ ParseResults,
17
+ QuotedString,
18
+ ZeroOrMore,
19
+ stringEnd,
20
+ stringStart,
21
+ )
22
+
23
+ from .specifiers import InvalidSpecifier, Specifier
24
+
25
+ __all__ = [
26
+ "InvalidMarker",
27
+ "UndefinedComparison",
28
+ "UndefinedEnvironmentName",
29
+ "Marker",
30
+ "default_environment",
31
+ ]
32
+
33
+ Operator = Callable[[str, str], bool]
34
+
35
+
36
+ class InvalidMarker(ValueError):
37
+ """
38
+ An invalid marker was found, users should refer to PEP 508.
39
+ """
40
+
41
+
42
+ class UndefinedComparison(ValueError):
43
+ """
44
+ An invalid operation was attempted on a value that doesn't support it.
45
+ """
46
+
47
+
48
+ class UndefinedEnvironmentName(ValueError):
49
+ """
50
+ A name was attempted to be used that does not exist inside of the
51
+ environment.
52
+ """
53
+
54
+
55
+ class Node:
56
+ def __init__(self, value: Any) -> None:
57
+ self.value = value
58
+
59
+ def __str__(self) -> str:
60
+ return str(self.value)
61
+
62
+ def __repr__(self) -> str:
63
+ return f"<{self.__class__.__name__}('{self}')>"
64
+
65
+ def serialize(self) -> str:
66
+ raise NotImplementedError
67
+
68
+
69
+ class Variable(Node):
70
+ def serialize(self) -> str:
71
+ return str(self)
72
+
73
+
74
+ class Value(Node):
75
+ def serialize(self) -> str:
76
+ return f'"{self}"'
77
+
78
+
79
+ class Op(Node):
80
+ def serialize(self) -> str:
81
+ return str(self)
82
+
83
+
84
+ VARIABLE = (
85
+ L("implementation_version")
86
+ | L("platform_python_implementation")
87
+ | L("implementation_name")
88
+ | L("python_full_version")
89
+ | L("platform_release")
90
+ | L("platform_version")
91
+ | L("platform_machine")
92
+ | L("platform_system")
93
+ | L("python_version")
94
+ | L("sys_platform")
95
+ | L("os_name")
96
+ | L("os.name") # PEP-345
97
+ | L("sys.platform") # PEP-345
98
+ | L("platform.version") # PEP-345
99
+ | L("platform.machine") # PEP-345
100
+ | L("platform.python_implementation") # PEP-345
101
+ | L("python_implementation") # undocumented setuptools legacy
102
+ | L("extra") # PEP-508
103
+ )
104
+ ALIASES = {
105
+ "os.name": "os_name",
106
+ "sys.platform": "sys_platform",
107
+ "platform.version": "platform_version",
108
+ "platform.machine": "platform_machine",
109
+ "platform.python_implementation": "platform_python_implementation",
110
+ "python_implementation": "platform_python_implementation",
111
+ }
112
+ VARIABLE.setParseAction(lambda s, l, t: Variable(ALIASES.get(t[0], t[0])))
113
+
114
+ VERSION_CMP = (
115
+ L("===") | L("==") | L(">=") | L("<=") | L("!=") | L("~=") | L(">") | L("<")
116
+ )
117
+
118
+ MARKER_OP = VERSION_CMP | L("not in") | L("in")
119
+ MARKER_OP.setParseAction(lambda s, l, t: Op(t[0]))
120
+
121
+ MARKER_VALUE = QuotedString("'") | QuotedString('"')
122
+ MARKER_VALUE.setParseAction(lambda s, l, t: Value(t[0]))
123
+
124
+ BOOLOP = L("and") | L("or")
125
+
126
+ MARKER_VAR = VARIABLE | MARKER_VALUE
127
+
128
+ MARKER_ITEM = Group(MARKER_VAR + MARKER_OP + MARKER_VAR)
129
+ MARKER_ITEM.setParseAction(lambda s, l, t: tuple(t[0]))
130
+
131
+ LPAREN = L("(").suppress()
132
+ RPAREN = L(")").suppress()
133
+
134
+ MARKER_EXPR = Forward()
135
+ MARKER_ATOM = MARKER_ITEM | Group(LPAREN + MARKER_EXPR + RPAREN)
136
+ MARKER_EXPR << MARKER_ATOM + ZeroOrMore(BOOLOP + MARKER_EXPR)
137
+
138
+ MARKER = stringStart + MARKER_EXPR + stringEnd
139
+
140
+
141
+ def _coerce_parse_result(results: Union[ParseResults, List[Any]]) -> List[Any]:
142
+ if isinstance(results, ParseResults):
143
+ return [_coerce_parse_result(i) for i in results]
144
+ else:
145
+ return results
146
+
147
+
148
+ def _format_marker(
149
+ marker: Union[List[str], Tuple[Node, ...], str], first: Optional[bool] = True
150
+ ) -> str:
151
+
152
+ assert isinstance(marker, (list, tuple, str))
153
+
154
+ # Sometimes we have a structure like [[...]] which is a single item list
155
+ # where the single item is itself it's own list. In that case we want skip
156
+ # the rest of this function so that we don't get extraneous () on the
157
+ # outside.
158
+ if (
159
+ isinstance(marker, list)
160
+ and len(marker) == 1
161
+ and isinstance(marker[0], (list, tuple))
162
+ ):
163
+ return _format_marker(marker[0])
164
+
165
+ if isinstance(marker, list):
166
+ inner = (_format_marker(m, first=False) for m in marker)
167
+ if first:
168
+ return " ".join(inner)
169
+ else:
170
+ return "(" + " ".join(inner) + ")"
171
+ elif isinstance(marker, tuple):
172
+ return " ".join([m.serialize() for m in marker])
173
+ else:
174
+ return marker
175
+
176
+
177
+ _operators: Dict[str, Operator] = {
178
+ "in": lambda lhs, rhs: lhs in rhs,
179
+ "not in": lambda lhs, rhs: lhs not in rhs,
180
+ "<": operator.lt,
181
+ "<=": operator.le,
182
+ "==": operator.eq,
183
+ "!=": operator.ne,
184
+ ">=": operator.ge,
185
+ ">": operator.gt,
186
+ }
187
+
188
+
189
+ def _eval_op(lhs: str, op: Op, rhs: str) -> bool:
190
+ try:
191
+ spec = Specifier("".join([op.serialize(), rhs]))
192
+ except InvalidSpecifier:
193
+ pass
194
+ else:
195
+ return spec.contains(lhs)
196
+
197
+ oper: Optional[Operator] = _operators.get(op.serialize())
198
+ if oper is None:
199
+ raise UndefinedComparison(f"Undefined {op!r} on {lhs!r} and {rhs!r}.")
200
+
201
+ return oper(lhs, rhs)
202
+
203
+
204
+ class Undefined:
205
+ pass
206
+
207
+
208
+ _undefined = Undefined()
209
+
210
+
211
+ def _get_env(environment: Dict[str, str], name: str) -> str:
212
+ value: Union[str, Undefined] = environment.get(name, _undefined)
213
+
214
+ if isinstance(value, Undefined):
215
+ raise UndefinedEnvironmentName(
216
+ f"{name!r} does not exist in evaluation environment."
217
+ )
218
+
219
+ return value
220
+
221
+
222
+ def _evaluate_markers(markers: List[Any], environment: Dict[str, str]) -> bool:
223
+ groups: List[List[bool]] = [[]]
224
+
225
+ for marker in markers:
226
+ assert isinstance(marker, (list, tuple, str))
227
+
228
+ if isinstance(marker, list):
229
+ groups[-1].append(_evaluate_markers(marker, environment))
230
+ elif isinstance(marker, tuple):
231
+ lhs, op, rhs = marker
232
+
233
+ if isinstance(lhs, Variable):
234
+ lhs_value = _get_env(environment, lhs.value)
235
+ rhs_value = rhs.value
236
+ else:
237
+ lhs_value = lhs.value
238
+ rhs_value = _get_env(environment, rhs.value)
239
+
240
+ groups[-1].append(_eval_op(lhs_value, op, rhs_value))
241
+ else:
242
+ assert marker in ["and", "or"]
243
+ if marker == "or":
244
+ groups.append([])
245
+
246
+ return any(all(item) for item in groups)
247
+
248
+
249
+ def format_full_version(info: "sys._version_info") -> str:
250
+ version = "{0.major}.{0.minor}.{0.micro}".format(info)
251
+ kind = info.releaselevel
252
+ if kind != "final":
253
+ version += kind[0] + str(info.serial)
254
+ return version
255
+
256
+
257
+ def default_environment() -> Dict[str, str]:
258
+ iver = format_full_version(sys.implementation.version)
259
+ implementation_name = sys.implementation.name
260
+ return {
261
+ "implementation_name": implementation_name,
262
+ "implementation_version": iver,
263
+ "os_name": os.name,
264
+ "platform_machine": platform.machine(),
265
+ "platform_release": platform.release(),
266
+ "platform_system": platform.system(),
267
+ "platform_version": platform.version(),
268
+ "python_full_version": platform.python_version(),
269
+ "platform_python_implementation": platform.python_implementation(),
270
+ "python_version": ".".join(platform.python_version_tuple()[:2]),
271
+ "sys_platform": sys.platform,
272
+ }
273
+
274
+
275
+ class Marker:
276
+ def __init__(self, marker: str) -> None:
277
+ try:
278
+ self._markers = _coerce_parse_result(MARKER.parseString(marker))
279
+ except ParseException as e:
280
+ raise InvalidMarker(
281
+ f"Invalid marker: {marker!r}, parse error at "
282
+ f"{marker[e.loc : e.loc + 8]!r}"
283
+ )
284
+
285
+ def __str__(self) -> str:
286
+ return _format_marker(self._markers)
287
+
288
+ def __repr__(self) -> str:
289
+ return f"<Marker('{self}')>"
290
+
291
+ def evaluate(self, environment: Optional[Dict[str, str]] = None) -> bool:
292
+ """Evaluate a marker.
293
+
294
+ Return the boolean from evaluating the given marker against the
295
+ environment. environment is an optional argument to override all or
296
+ part of the determined environment.
297
+
298
+ The environment is determined from the current Python process.
299
+ """
300
+ current_environment = default_environment()
301
+ if environment is not None:
302
+ current_environment.update(environment)
303
+
304
+ return _evaluate_markers(self._markers, current_environment)
llmeval-env/lib/python3.10/site-packages/pip/_vendor/packaging/requirements.py ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file is dual licensed under the terms of the Apache License, Version
2
+ # 2.0, and the BSD License. See the LICENSE file in the root of this repository
3
+ # for complete details.
4
+
5
+ import re
6
+ import string
7
+ import urllib.parse
8
+ from typing import List, Optional as TOptional, Set
9
+
10
+ from pip._vendor.pyparsing import ( # noqa
11
+ Combine,
12
+ Literal as L,
13
+ Optional,
14
+ ParseException,
15
+ Regex,
16
+ Word,
17
+ ZeroOrMore,
18
+ originalTextFor,
19
+ stringEnd,
20
+ stringStart,
21
+ )
22
+
23
+ from .markers import MARKER_EXPR, Marker
24
+ from .specifiers import LegacySpecifier, Specifier, SpecifierSet
25
+
26
+
27
+ class InvalidRequirement(ValueError):
28
+ """
29
+ An invalid requirement was found, users should refer to PEP 508.
30
+ """
31
+
32
+
33
+ ALPHANUM = Word(string.ascii_letters + string.digits)
34
+
35
+ LBRACKET = L("[").suppress()
36
+ RBRACKET = L("]").suppress()
37
+ LPAREN = L("(").suppress()
38
+ RPAREN = L(")").suppress()
39
+ COMMA = L(",").suppress()
40
+ SEMICOLON = L(";").suppress()
41
+ AT = L("@").suppress()
42
+
43
+ PUNCTUATION = Word("-_.")
44
+ IDENTIFIER_END = ALPHANUM | (ZeroOrMore(PUNCTUATION) + ALPHANUM)
45
+ IDENTIFIER = Combine(ALPHANUM + ZeroOrMore(IDENTIFIER_END))
46
+
47
+ NAME = IDENTIFIER("name")
48
+ EXTRA = IDENTIFIER
49
+
50
+ URI = Regex(r"[^ ]+")("url")
51
+ URL = AT + URI
52
+
53
+ EXTRAS_LIST = EXTRA + ZeroOrMore(COMMA + EXTRA)
54
+ EXTRAS = (LBRACKET + Optional(EXTRAS_LIST) + RBRACKET)("extras")
55
+
56
+ VERSION_PEP440 = Regex(Specifier._regex_str, re.VERBOSE | re.IGNORECASE)
57
+ VERSION_LEGACY = Regex(LegacySpecifier._regex_str, re.VERBOSE | re.IGNORECASE)
58
+
59
+ VERSION_ONE = VERSION_PEP440 ^ VERSION_LEGACY
60
+ VERSION_MANY = Combine(
61
+ VERSION_ONE + ZeroOrMore(COMMA + VERSION_ONE), joinString=",", adjacent=False
62
+ )("_raw_spec")
63
+ _VERSION_SPEC = Optional((LPAREN + VERSION_MANY + RPAREN) | VERSION_MANY)
64
+ _VERSION_SPEC.setParseAction(lambda s, l, t: t._raw_spec or "")
65
+
66
+ VERSION_SPEC = originalTextFor(_VERSION_SPEC)("specifier")
67
+ VERSION_SPEC.setParseAction(lambda s, l, t: t[1])
68
+
69
+ MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker")
70
+ MARKER_EXPR.setParseAction(
71
+ lambda s, l, t: Marker(s[t._original_start : t._original_end])
72
+ )
73
+ MARKER_SEPARATOR = SEMICOLON
74
+ MARKER = MARKER_SEPARATOR + MARKER_EXPR
75
+
76
+ VERSION_AND_MARKER = VERSION_SPEC + Optional(MARKER)
77
+ URL_AND_MARKER = URL + Optional(MARKER)
78
+
79
+ NAMED_REQUIREMENT = NAME + Optional(EXTRAS) + (URL_AND_MARKER | VERSION_AND_MARKER)
80
+
81
+ REQUIREMENT = stringStart + NAMED_REQUIREMENT + stringEnd
82
+ # pyparsing isn't thread safe during initialization, so we do it eagerly, see
83
+ # issue #104
84
+ REQUIREMENT.parseString("x[]")
85
+
86
+
87
+ class Requirement:
88
+ """Parse a requirement.
89
+
90
+ Parse a given requirement string into its parts, such as name, specifier,
91
+ URL, and extras. Raises InvalidRequirement on a badly-formed requirement
92
+ string.
93
+ """
94
+
95
+ # TODO: Can we test whether something is contained within a requirement?
96
+ # If so how do we do that? Do we need to test against the _name_ of
97
+ # the thing as well as the version? What about the markers?
98
+ # TODO: Can we normalize the name and extra name?
99
+
100
+ def __init__(self, requirement_string: str) -> None:
101
+ try:
102
+ req = REQUIREMENT.parseString(requirement_string)
103
+ except ParseException as e:
104
+ raise InvalidRequirement(
105
+ f'Parse error at "{ requirement_string[e.loc : e.loc + 8]!r}": {e.msg}'
106
+ )
107
+
108
+ self.name: str = req.name
109
+ if req.url:
110
+ parsed_url = urllib.parse.urlparse(req.url)
111
+ if parsed_url.scheme == "file":
112
+ if urllib.parse.urlunparse(parsed_url) != req.url:
113
+ raise InvalidRequirement("Invalid URL given")
114
+ elif not (parsed_url.scheme and parsed_url.netloc) or (
115
+ not parsed_url.scheme and not parsed_url.netloc
116
+ ):
117
+ raise InvalidRequirement(f"Invalid URL: {req.url}")
118
+ self.url: TOptional[str] = req.url
119
+ else:
120
+ self.url = None
121
+ self.extras: Set[str] = set(req.extras.asList() if req.extras else [])
122
+ self.specifier: SpecifierSet = SpecifierSet(req.specifier)
123
+ self.marker: TOptional[Marker] = req.marker if req.marker else None
124
+
125
+ def __str__(self) -> str:
126
+ parts: List[str] = [self.name]
127
+
128
+ if self.extras:
129
+ formatted_extras = ",".join(sorted(self.extras))
130
+ parts.append(f"[{formatted_extras}]")
131
+
132
+ if self.specifier:
133
+ parts.append(str(self.specifier))
134
+
135
+ if self.url:
136
+ parts.append(f"@ {self.url}")
137
+ if self.marker:
138
+ parts.append(" ")
139
+
140
+ if self.marker:
141
+ parts.append(f"; {self.marker}")
142
+
143
+ return "".join(parts)
144
+
145
+ def __repr__(self) -> str:
146
+ return f"<Requirement('{self}')>"
llmeval-env/lib/python3.10/site-packages/pip/_vendor/packaging/tags.py ADDED
@@ -0,0 +1,487 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file is dual licensed under the terms of the Apache License, Version
2
+ # 2.0, and the BSD License. See the LICENSE file in the root of this repository
3
+ # for complete details.
4
+
5
+ import logging
6
+ import platform
7
+ import sys
8
+ import sysconfig
9
+ from importlib.machinery import EXTENSION_SUFFIXES
10
+ from typing import (
11
+ Dict,
12
+ FrozenSet,
13
+ Iterable,
14
+ Iterator,
15
+ List,
16
+ Optional,
17
+ Sequence,
18
+ Tuple,
19
+ Union,
20
+ cast,
21
+ )
22
+
23
+ from . import _manylinux, _musllinux
24
+
25
+ logger = logging.getLogger(__name__)
26
+
27
+ PythonVersion = Sequence[int]
28
+ MacVersion = Tuple[int, int]
29
+
30
+ INTERPRETER_SHORT_NAMES: Dict[str, str] = {
31
+ "python": "py", # Generic.
32
+ "cpython": "cp",
33
+ "pypy": "pp",
34
+ "ironpython": "ip",
35
+ "jython": "jy",
36
+ }
37
+
38
+
39
+ _32_BIT_INTERPRETER = sys.maxsize <= 2 ** 32
40
+
41
+
42
+ class Tag:
43
+ """
44
+ A representation of the tag triple for a wheel.
45
+
46
+ Instances are considered immutable and thus are hashable. Equality checking
47
+ is also supported.
48
+ """
49
+
50
+ __slots__ = ["_interpreter", "_abi", "_platform", "_hash"]
51
+
52
+ def __init__(self, interpreter: str, abi: str, platform: str) -> None:
53
+ self._interpreter = interpreter.lower()
54
+ self._abi = abi.lower()
55
+ self._platform = platform.lower()
56
+ # The __hash__ of every single element in a Set[Tag] will be evaluated each time
57
+ # that a set calls its `.disjoint()` method, which may be called hundreds of
58
+ # times when scanning a page of links for packages with tags matching that
59
+ # Set[Tag]. Pre-computing the value here produces significant speedups for
60
+ # downstream consumers.
61
+ self._hash = hash((self._interpreter, self._abi, self._platform))
62
+
63
+ @property
64
+ def interpreter(self) -> str:
65
+ return self._interpreter
66
+
67
+ @property
68
+ def abi(self) -> str:
69
+ return self._abi
70
+
71
+ @property
72
+ def platform(self) -> str:
73
+ return self._platform
74
+
75
+ def __eq__(self, other: object) -> bool:
76
+ if not isinstance(other, Tag):
77
+ return NotImplemented
78
+
79
+ return (
80
+ (self._hash == other._hash) # Short-circuit ASAP for perf reasons.
81
+ and (self._platform == other._platform)
82
+ and (self._abi == other._abi)
83
+ and (self._interpreter == other._interpreter)
84
+ )
85
+
86
+ def __hash__(self) -> int:
87
+ return self._hash
88
+
89
+ def __str__(self) -> str:
90
+ return f"{self._interpreter}-{self._abi}-{self._platform}"
91
+
92
+ def __repr__(self) -> str:
93
+ return f"<{self} @ {id(self)}>"
94
+
95
+
96
+ def parse_tag(tag: str) -> FrozenSet[Tag]:
97
+ """
98
+ Parses the provided tag (e.g. `py3-none-any`) into a frozenset of Tag instances.
99
+
100
+ Returning a set is required due to the possibility that the tag is a
101
+ compressed tag set.
102
+ """
103
+ tags = set()
104
+ interpreters, abis, platforms = tag.split("-")
105
+ for interpreter in interpreters.split("."):
106
+ for abi in abis.split("."):
107
+ for platform_ in platforms.split("."):
108
+ tags.add(Tag(interpreter, abi, platform_))
109
+ return frozenset(tags)
110
+
111
+
112
+ def _get_config_var(name: str, warn: bool = False) -> Union[int, str, None]:
113
+ value = sysconfig.get_config_var(name)
114
+ if value is None and warn:
115
+ logger.debug(
116
+ "Config variable '%s' is unset, Python ABI tag may be incorrect", name
117
+ )
118
+ return value
119
+
120
+
121
+ def _normalize_string(string: str) -> str:
122
+ return string.replace(".", "_").replace("-", "_")
123
+
124
+
125
+ def _abi3_applies(python_version: PythonVersion) -> bool:
126
+ """
127
+ Determine if the Python version supports abi3.
128
+
129
+ PEP 384 was first implemented in Python 3.2.
130
+ """
131
+ return len(python_version) > 1 and tuple(python_version) >= (3, 2)
132
+
133
+
134
+ def _cpython_abis(py_version: PythonVersion, warn: bool = False) -> List[str]:
135
+ py_version = tuple(py_version) # To allow for version comparison.
136
+ abis = []
137
+ version = _version_nodot(py_version[:2])
138
+ debug = pymalloc = ucs4 = ""
139
+ with_debug = _get_config_var("Py_DEBUG", warn)
140
+ has_refcount = hasattr(sys, "gettotalrefcount")
141
+ # Windows doesn't set Py_DEBUG, so checking for support of debug-compiled
142
+ # extension modules is the best option.
143
+ # https://github.com/pypa/pip/issues/3383#issuecomment-173267692
144
+ has_ext = "_d.pyd" in EXTENSION_SUFFIXES
145
+ if with_debug or (with_debug is None and (has_refcount or has_ext)):
146
+ debug = "d"
147
+ if py_version < (3, 8):
148
+ with_pymalloc = _get_config_var("WITH_PYMALLOC", warn)
149
+ if with_pymalloc or with_pymalloc is None:
150
+ pymalloc = "m"
151
+ if py_version < (3, 3):
152
+ unicode_size = _get_config_var("Py_UNICODE_SIZE", warn)
153
+ if unicode_size == 4 or (
154
+ unicode_size is None and sys.maxunicode == 0x10FFFF
155
+ ):
156
+ ucs4 = "u"
157
+ elif debug:
158
+ # Debug builds can also load "normal" extension modules.
159
+ # We can also assume no UCS-4 or pymalloc requirement.
160
+ abis.append(f"cp{version}")
161
+ abis.insert(
162
+ 0,
163
+ "cp{version}{debug}{pymalloc}{ucs4}".format(
164
+ version=version, debug=debug, pymalloc=pymalloc, ucs4=ucs4
165
+ ),
166
+ )
167
+ return abis
168
+
169
+
170
+ def cpython_tags(
171
+ python_version: Optional[PythonVersion] = None,
172
+ abis: Optional[Iterable[str]] = None,
173
+ platforms: Optional[Iterable[str]] = None,
174
+ *,
175
+ warn: bool = False,
176
+ ) -> Iterator[Tag]:
177
+ """
178
+ Yields the tags for a CPython interpreter.
179
+
180
+ The tags consist of:
181
+ - cp<python_version>-<abi>-<platform>
182
+ - cp<python_version>-abi3-<platform>
183
+ - cp<python_version>-none-<platform>
184
+ - cp<less than python_version>-abi3-<platform> # Older Python versions down to 3.2.
185
+
186
+ If python_version only specifies a major version then user-provided ABIs and
187
+ the 'none' ABItag will be used.
188
+
189
+ If 'abi3' or 'none' are specified in 'abis' then they will be yielded at
190
+ their normal position and not at the beginning.
191
+ """
192
+ if not python_version:
193
+ python_version = sys.version_info[:2]
194
+
195
+ interpreter = f"cp{_version_nodot(python_version[:2])}"
196
+
197
+ if abis is None:
198
+ if len(python_version) > 1:
199
+ abis = _cpython_abis(python_version, warn)
200
+ else:
201
+ abis = []
202
+ abis = list(abis)
203
+ # 'abi3' and 'none' are explicitly handled later.
204
+ for explicit_abi in ("abi3", "none"):
205
+ try:
206
+ abis.remove(explicit_abi)
207
+ except ValueError:
208
+ pass
209
+
210
+ platforms = list(platforms or platform_tags())
211
+ for abi in abis:
212
+ for platform_ in platforms:
213
+ yield Tag(interpreter, abi, platform_)
214
+ if _abi3_applies(python_version):
215
+ yield from (Tag(interpreter, "abi3", platform_) for platform_ in platforms)
216
+ yield from (Tag(interpreter, "none", platform_) for platform_ in platforms)
217
+
218
+ if _abi3_applies(python_version):
219
+ for minor_version in range(python_version[1] - 1, 1, -1):
220
+ for platform_ in platforms:
221
+ interpreter = "cp{version}".format(
222
+ version=_version_nodot((python_version[0], minor_version))
223
+ )
224
+ yield Tag(interpreter, "abi3", platform_)
225
+
226
+
227
+ def _generic_abi() -> Iterator[str]:
228
+ abi = sysconfig.get_config_var("SOABI")
229
+ if abi:
230
+ yield _normalize_string(abi)
231
+
232
+
233
+ def generic_tags(
234
+ interpreter: Optional[str] = None,
235
+ abis: Optional[Iterable[str]] = None,
236
+ platforms: Optional[Iterable[str]] = None,
237
+ *,
238
+ warn: bool = False,
239
+ ) -> Iterator[Tag]:
240
+ """
241
+ Yields the tags for a generic interpreter.
242
+
243
+ The tags consist of:
244
+ - <interpreter>-<abi>-<platform>
245
+
246
+ The "none" ABI will be added if it was not explicitly provided.
247
+ """
248
+ if not interpreter:
249
+ interp_name = interpreter_name()
250
+ interp_version = interpreter_version(warn=warn)
251
+ interpreter = "".join([interp_name, interp_version])
252
+ if abis is None:
253
+ abis = _generic_abi()
254
+ platforms = list(platforms or platform_tags())
255
+ abis = list(abis)
256
+ if "none" not in abis:
257
+ abis.append("none")
258
+ for abi in abis:
259
+ for platform_ in platforms:
260
+ yield Tag(interpreter, abi, platform_)
261
+
262
+
263
+ def _py_interpreter_range(py_version: PythonVersion) -> Iterator[str]:
264
+ """
265
+ Yields Python versions in descending order.
266
+
267
+ After the latest version, the major-only version will be yielded, and then
268
+ all previous versions of that major version.
269
+ """
270
+ if len(py_version) > 1:
271
+ yield f"py{_version_nodot(py_version[:2])}"
272
+ yield f"py{py_version[0]}"
273
+ if len(py_version) > 1:
274
+ for minor in range(py_version[1] - 1, -1, -1):
275
+ yield f"py{_version_nodot((py_version[0], minor))}"
276
+
277
+
278
+ def compatible_tags(
279
+ python_version: Optional[PythonVersion] = None,
280
+ interpreter: Optional[str] = None,
281
+ platforms: Optional[Iterable[str]] = None,
282
+ ) -> Iterator[Tag]:
283
+ """
284
+ Yields the sequence of tags that are compatible with a specific version of Python.
285
+
286
+ The tags consist of:
287
+ - py*-none-<platform>
288
+ - <interpreter>-none-any # ... if `interpreter` is provided.
289
+ - py*-none-any
290
+ """
291
+ if not python_version:
292
+ python_version = sys.version_info[:2]
293
+ platforms = list(platforms or platform_tags())
294
+ for version in _py_interpreter_range(python_version):
295
+ for platform_ in platforms:
296
+ yield Tag(version, "none", platform_)
297
+ if interpreter:
298
+ yield Tag(interpreter, "none", "any")
299
+ for version in _py_interpreter_range(python_version):
300
+ yield Tag(version, "none", "any")
301
+
302
+
303
+ def _mac_arch(arch: str, is_32bit: bool = _32_BIT_INTERPRETER) -> str:
304
+ if not is_32bit:
305
+ return arch
306
+
307
+ if arch.startswith("ppc"):
308
+ return "ppc"
309
+
310
+ return "i386"
311
+
312
+
313
+ def _mac_binary_formats(version: MacVersion, cpu_arch: str) -> List[str]:
314
+ formats = [cpu_arch]
315
+ if cpu_arch == "x86_64":
316
+ if version < (10, 4):
317
+ return []
318
+ formats.extend(["intel", "fat64", "fat32"])
319
+
320
+ elif cpu_arch == "i386":
321
+ if version < (10, 4):
322
+ return []
323
+ formats.extend(["intel", "fat32", "fat"])
324
+
325
+ elif cpu_arch == "ppc64":
326
+ # TODO: Need to care about 32-bit PPC for ppc64 through 10.2?
327
+ if version > (10, 5) or version < (10, 4):
328
+ return []
329
+ formats.append("fat64")
330
+
331
+ elif cpu_arch == "ppc":
332
+ if version > (10, 6):
333
+ return []
334
+ formats.extend(["fat32", "fat"])
335
+
336
+ if cpu_arch in {"arm64", "x86_64"}:
337
+ formats.append("universal2")
338
+
339
+ if cpu_arch in {"x86_64", "i386", "ppc64", "ppc", "intel"}:
340
+ formats.append("universal")
341
+
342
+ return formats
343
+
344
+
345
+ def mac_platforms(
346
+ version: Optional[MacVersion] = None, arch: Optional[str] = None
347
+ ) -> Iterator[str]:
348
+ """
349
+ Yields the platform tags for a macOS system.
350
+
351
+ The `version` parameter is a two-item tuple specifying the macOS version to
352
+ generate platform tags for. The `arch` parameter is the CPU architecture to
353
+ generate platform tags for. Both parameters default to the appropriate value
354
+ for the current system.
355
+ """
356
+ version_str, _, cpu_arch = platform.mac_ver()
357
+ if version is None:
358
+ version = cast("MacVersion", tuple(map(int, version_str.split(".")[:2])))
359
+ else:
360
+ version = version
361
+ if arch is None:
362
+ arch = _mac_arch(cpu_arch)
363
+ else:
364
+ arch = arch
365
+
366
+ if (10, 0) <= version and version < (11, 0):
367
+ # Prior to Mac OS 11, each yearly release of Mac OS bumped the
368
+ # "minor" version number. The major version was always 10.
369
+ for minor_version in range(version[1], -1, -1):
370
+ compat_version = 10, minor_version
371
+ binary_formats = _mac_binary_formats(compat_version, arch)
372
+ for binary_format in binary_formats:
373
+ yield "macosx_{major}_{minor}_{binary_format}".format(
374
+ major=10, minor=minor_version, binary_format=binary_format
375
+ )
376
+
377
+ if version >= (11, 0):
378
+ # Starting with Mac OS 11, each yearly release bumps the major version
379
+ # number. The minor versions are now the midyear updates.
380
+ for major_version in range(version[0], 10, -1):
381
+ compat_version = major_version, 0
382
+ binary_formats = _mac_binary_formats(compat_version, arch)
383
+ for binary_format in binary_formats:
384
+ yield "macosx_{major}_{minor}_{binary_format}".format(
385
+ major=major_version, minor=0, binary_format=binary_format
386
+ )
387
+
388
+ if version >= (11, 0):
389
+ # Mac OS 11 on x86_64 is compatible with binaries from previous releases.
390
+ # Arm64 support was introduced in 11.0, so no Arm binaries from previous
391
+ # releases exist.
392
+ #
393
+ # However, the "universal2" binary format can have a
394
+ # macOS version earlier than 11.0 when the x86_64 part of the binary supports
395
+ # that version of macOS.
396
+ if arch == "x86_64":
397
+ for minor_version in range(16, 3, -1):
398
+ compat_version = 10, minor_version
399
+ binary_formats = _mac_binary_formats(compat_version, arch)
400
+ for binary_format in binary_formats:
401
+ yield "macosx_{major}_{minor}_{binary_format}".format(
402
+ major=compat_version[0],
403
+ minor=compat_version[1],
404
+ binary_format=binary_format,
405
+ )
406
+ else:
407
+ for minor_version in range(16, 3, -1):
408
+ compat_version = 10, minor_version
409
+ binary_format = "universal2"
410
+ yield "macosx_{major}_{minor}_{binary_format}".format(
411
+ major=compat_version[0],
412
+ minor=compat_version[1],
413
+ binary_format=binary_format,
414
+ )
415
+
416
+
417
+ def _linux_platforms(is_32bit: bool = _32_BIT_INTERPRETER) -> Iterator[str]:
418
+ linux = _normalize_string(sysconfig.get_platform())
419
+ if is_32bit:
420
+ if linux == "linux_x86_64":
421
+ linux = "linux_i686"
422
+ elif linux == "linux_aarch64":
423
+ linux = "linux_armv7l"
424
+ _, arch = linux.split("_", 1)
425
+ yield from _manylinux.platform_tags(linux, arch)
426
+ yield from _musllinux.platform_tags(arch)
427
+ yield linux
428
+
429
+
430
+ def _generic_platforms() -> Iterator[str]:
431
+ yield _normalize_string(sysconfig.get_platform())
432
+
433
+
434
+ def platform_tags() -> Iterator[str]:
435
+ """
436
+ Provides the platform tags for this installation.
437
+ """
438
+ if platform.system() == "Darwin":
439
+ return mac_platforms()
440
+ elif platform.system() == "Linux":
441
+ return _linux_platforms()
442
+ else:
443
+ return _generic_platforms()
444
+
445
+
446
+ def interpreter_name() -> str:
447
+ """
448
+ Returns the name of the running interpreter.
449
+ """
450
+ name = sys.implementation.name
451
+ return INTERPRETER_SHORT_NAMES.get(name) or name
452
+
453
+
454
+ def interpreter_version(*, warn: bool = False) -> str:
455
+ """
456
+ Returns the version of the running interpreter.
457
+ """
458
+ version = _get_config_var("py_version_nodot", warn=warn)
459
+ if version:
460
+ version = str(version)
461
+ else:
462
+ version = _version_nodot(sys.version_info[:2])
463
+ return version
464
+
465
+
466
+ def _version_nodot(version: PythonVersion) -> str:
467
+ return "".join(map(str, version))
468
+
469
+
470
+ def sys_tags(*, warn: bool = False) -> Iterator[Tag]:
471
+ """
472
+ Returns the sequence of tag triples for the running interpreter.
473
+
474
+ The order of the sequence corresponds to priority order for the
475
+ interpreter, from most to least important.
476
+ """
477
+
478
+ interp_name = interpreter_name()
479
+ if interp_name == "cp":
480
+ yield from cpython_tags(warn=warn)
481
+ else:
482
+ yield from generic_tags()
483
+
484
+ if interp_name == "pp":
485
+ yield from compatible_tags(interpreter="pp3")
486
+ else:
487
+ yield from compatible_tags()
llmeval-env/lib/python3.10/site-packages/pip/_vendor/platformdirs/__init__.py ADDED
@@ -0,0 +1,331 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Utilities for determining application-specific dirs. See <https://github.com/platformdirs/platformdirs> for details and
3
+ usage.
4
+ """
5
+ from __future__ import annotations
6
+
7
+ import importlib
8
+ import os
9
+ import sys
10
+ from pathlib import Path
11
+ from typing import TYPE_CHECKING
12
+
13
+ if TYPE_CHECKING:
14
+ from pip._vendor.typing_extensions import Literal # pragma: no cover
15
+
16
+ from .api import PlatformDirsABC
17
+ from .version import __version__, __version_info__
18
+
19
+
20
+ def _set_platform_dir_class() -> type[PlatformDirsABC]:
21
+ if os.getenv("ANDROID_DATA") == "/data" and os.getenv("ANDROID_ROOT") == "/system":
22
+ module, name = "pip._vendor.platformdirs.android", "Android"
23
+ elif sys.platform == "win32":
24
+ module, name = "pip._vendor.platformdirs.windows", "Windows"
25
+ elif sys.platform == "darwin":
26
+ module, name = "pip._vendor.platformdirs.macos", "MacOS"
27
+ else:
28
+ module, name = "pip._vendor.platformdirs.unix", "Unix"
29
+ result: type[PlatformDirsABC] = getattr(importlib.import_module(module), name)
30
+ return result
31
+
32
+
33
+ PlatformDirs = _set_platform_dir_class() #: Currently active platform
34
+ AppDirs = PlatformDirs #: Backwards compatibility with appdirs
35
+
36
+
37
+ def user_data_dir(
38
+ appname: str | None = None,
39
+ appauthor: str | None | Literal[False] = None,
40
+ version: str | None = None,
41
+ roaming: bool = False,
42
+ ) -> str:
43
+ """
44
+ :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
45
+ :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
46
+ :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
47
+ :param roaming: See `roaming <platformdirs.api.PlatformDirsABC.version>`.
48
+ :returns: data directory tied to the user
49
+ """
50
+ return PlatformDirs(appname=appname, appauthor=appauthor, version=version, roaming=roaming).user_data_dir
51
+
52
+
53
+ def site_data_dir(
54
+ appname: str | None = None,
55
+ appauthor: str | None | Literal[False] = None,
56
+ version: str | None = None,
57
+ multipath: bool = False,
58
+ ) -> str:
59
+ """
60
+ :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
61
+ :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
62
+ :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
63
+ :param multipath: See `roaming <platformdirs.api.PlatformDirsABC.multipath>`.
64
+ :returns: data directory shared by users
65
+ """
66
+ return PlatformDirs(appname=appname, appauthor=appauthor, version=version, multipath=multipath).site_data_dir
67
+
68
+
69
+ def user_config_dir(
70
+ appname: str | None = None,
71
+ appauthor: str | None | Literal[False] = None,
72
+ version: str | None = None,
73
+ roaming: bool = False,
74
+ ) -> str:
75
+ """
76
+ :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
77
+ :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
78
+ :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
79
+ :param roaming: See `roaming <platformdirs.api.PlatformDirsABC.version>`.
80
+ :returns: config directory tied to the user
81
+ """
82
+ return PlatformDirs(appname=appname, appauthor=appauthor, version=version, roaming=roaming).user_config_dir
83
+
84
+
85
+ def site_config_dir(
86
+ appname: str | None = None,
87
+ appauthor: str | None | Literal[False] = None,
88
+ version: str | None = None,
89
+ multipath: bool = False,
90
+ ) -> str:
91
+ """
92
+ :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
93
+ :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
94
+ :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
95
+ :param multipath: See `roaming <platformdirs.api.PlatformDirsABC.multipath>`.
96
+ :returns: config directory shared by the users
97
+ """
98
+ return PlatformDirs(appname=appname, appauthor=appauthor, version=version, multipath=multipath).site_config_dir
99
+
100
+
101
+ def user_cache_dir(
102
+ appname: str | None = None,
103
+ appauthor: str | None | Literal[False] = None,
104
+ version: str | None = None,
105
+ opinion: bool = True,
106
+ ) -> str:
107
+ """
108
+ :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
109
+ :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
110
+ :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
111
+ :param opinion: See `roaming <platformdirs.api.PlatformDirsABC.opinion>`.
112
+ :returns: cache directory tied to the user
113
+ """
114
+ return PlatformDirs(appname=appname, appauthor=appauthor, version=version, opinion=opinion).user_cache_dir
115
+
116
+
117
+ def user_state_dir(
118
+ appname: str | None = None,
119
+ appauthor: str | None | Literal[False] = None,
120
+ version: str | None = None,
121
+ roaming: bool = False,
122
+ ) -> str:
123
+ """
124
+ :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
125
+ :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
126
+ :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
127
+ :param roaming: See `roaming <platformdirs.api.PlatformDirsABC.version>`.
128
+ :returns: state directory tied to the user
129
+ """
130
+ return PlatformDirs(appname=appname, appauthor=appauthor, version=version, roaming=roaming).user_state_dir
131
+
132
+
133
+ def user_log_dir(
134
+ appname: str | None = None,
135
+ appauthor: str | None | Literal[False] = None,
136
+ version: str | None = None,
137
+ opinion: bool = True,
138
+ ) -> str:
139
+ """
140
+ :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
141
+ :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
142
+ :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
143
+ :param opinion: See `roaming <platformdirs.api.PlatformDirsABC.opinion>`.
144
+ :returns: log directory tied to the user
145
+ """
146
+ return PlatformDirs(appname=appname, appauthor=appauthor, version=version, opinion=opinion).user_log_dir
147
+
148
+
149
+ def user_documents_dir() -> str:
150
+ """
151
+ :returns: documents directory tied to the user
152
+ """
153
+ return PlatformDirs().user_documents_dir
154
+
155
+
156
+ def user_runtime_dir(
157
+ appname: str | None = None,
158
+ appauthor: str | None | Literal[False] = None,
159
+ version: str | None = None,
160
+ opinion: bool = True,
161
+ ) -> str:
162
+ """
163
+ :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
164
+ :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
165
+ :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
166
+ :param opinion: See `opinion <platformdirs.api.PlatformDirsABC.opinion>`.
167
+ :returns: runtime directory tied to the user
168
+ """
169
+ return PlatformDirs(appname=appname, appauthor=appauthor, version=version, opinion=opinion).user_runtime_dir
170
+
171
+
172
+ def user_data_path(
173
+ appname: str | None = None,
174
+ appauthor: str | None | Literal[False] = None,
175
+ version: str | None = None,
176
+ roaming: bool = False,
177
+ ) -> Path:
178
+ """
179
+ :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
180
+ :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
181
+ :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
182
+ :param roaming: See `roaming <platformdirs.api.PlatformDirsABC.version>`.
183
+ :returns: data path tied to the user
184
+ """
185
+ return PlatformDirs(appname=appname, appauthor=appauthor, version=version, roaming=roaming).user_data_path
186
+
187
+
188
+ def site_data_path(
189
+ appname: str | None = None,
190
+ appauthor: str | None | Literal[False] = None,
191
+ version: str | None = None,
192
+ multipath: bool = False,
193
+ ) -> Path:
194
+ """
195
+ :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
196
+ :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
197
+ :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
198
+ :param multipath: See `multipath <platformdirs.api.PlatformDirsABC.multipath>`.
199
+ :returns: data path shared by users
200
+ """
201
+ return PlatformDirs(appname=appname, appauthor=appauthor, version=version, multipath=multipath).site_data_path
202
+
203
+
204
+ def user_config_path(
205
+ appname: str | None = None,
206
+ appauthor: str | None | Literal[False] = None,
207
+ version: str | None = None,
208
+ roaming: bool = False,
209
+ ) -> Path:
210
+ """
211
+ :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
212
+ :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
213
+ :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
214
+ :param roaming: See `roaming <platformdirs.api.PlatformDirsABC.version>`.
215
+ :returns: config path tied to the user
216
+ """
217
+ return PlatformDirs(appname=appname, appauthor=appauthor, version=version, roaming=roaming).user_config_path
218
+
219
+
220
+ def site_config_path(
221
+ appname: str | None = None,
222
+ appauthor: str | None | Literal[False] = None,
223
+ version: str | None = None,
224
+ multipath: bool = False,
225
+ ) -> Path:
226
+ """
227
+ :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
228
+ :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
229
+ :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
230
+ :param multipath: See `roaming <platformdirs.api.PlatformDirsABC.multipath>`.
231
+ :returns: config path shared by the users
232
+ """
233
+ return PlatformDirs(appname=appname, appauthor=appauthor, version=version, multipath=multipath).site_config_path
234
+
235
+
236
+ def user_cache_path(
237
+ appname: str | None = None,
238
+ appauthor: str | None | Literal[False] = None,
239
+ version: str | None = None,
240
+ opinion: bool = True,
241
+ ) -> Path:
242
+ """
243
+ :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
244
+ :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
245
+ :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
246
+ :param opinion: See `roaming <platformdirs.api.PlatformDirsABC.opinion>`.
247
+ :returns: cache path tied to the user
248
+ """
249
+ return PlatformDirs(appname=appname, appauthor=appauthor, version=version, opinion=opinion).user_cache_path
250
+
251
+
252
+ def user_state_path(
253
+ appname: str | None = None,
254
+ appauthor: str | None | Literal[False] = None,
255
+ version: str | None = None,
256
+ roaming: bool = False,
257
+ ) -> Path:
258
+ """
259
+ :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
260
+ :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
261
+ :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
262
+ :param roaming: See `roaming <platformdirs.api.PlatformDirsABC.version>`.
263
+ :returns: state path tied to the user
264
+ """
265
+ return PlatformDirs(appname=appname, appauthor=appauthor, version=version, roaming=roaming).user_state_path
266
+
267
+
268
+ def user_log_path(
269
+ appname: str | None = None,
270
+ appauthor: str | None | Literal[False] = None,
271
+ version: str | None = None,
272
+ opinion: bool = True,
273
+ ) -> Path:
274
+ """
275
+ :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
276
+ :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
277
+ :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
278
+ :param opinion: See `roaming <platformdirs.api.PlatformDirsABC.opinion>`.
279
+ :returns: log path tied to the user
280
+ """
281
+ return PlatformDirs(appname=appname, appauthor=appauthor, version=version, opinion=opinion).user_log_path
282
+
283
+
284
+ def user_documents_path() -> Path:
285
+ """
286
+ :returns: documents path tied to the user
287
+ """
288
+ return PlatformDirs().user_documents_path
289
+
290
+
291
+ def user_runtime_path(
292
+ appname: str | None = None,
293
+ appauthor: str | None | Literal[False] = None,
294
+ version: str | None = None,
295
+ opinion: bool = True,
296
+ ) -> Path:
297
+ """
298
+ :param appname: See `appname <platformdirs.api.PlatformDirsABC.appname>`.
299
+ :param appauthor: See `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`.
300
+ :param version: See `version <platformdirs.api.PlatformDirsABC.version>`.
301
+ :param opinion: See `opinion <platformdirs.api.PlatformDirsABC.opinion>`.
302
+ :returns: runtime path tied to the user
303
+ """
304
+ return PlatformDirs(appname=appname, appauthor=appauthor, version=version, opinion=opinion).user_runtime_path
305
+
306
+
307
+ __all__ = [
308
+ "__version__",
309
+ "__version_info__",
310
+ "PlatformDirs",
311
+ "AppDirs",
312
+ "PlatformDirsABC",
313
+ "user_data_dir",
314
+ "user_config_dir",
315
+ "user_cache_dir",
316
+ "user_state_dir",
317
+ "user_log_dir",
318
+ "user_documents_dir",
319
+ "user_runtime_dir",
320
+ "site_data_dir",
321
+ "site_config_dir",
322
+ "user_data_path",
323
+ "user_config_path",
324
+ "user_cache_path",
325
+ "user_state_path",
326
+ "user_log_path",
327
+ "user_documents_path",
328
+ "user_runtime_path",
329
+ "site_data_path",
330
+ "site_config_path",
331
+ ]
llmeval-env/lib/python3.10/site-packages/pip/_vendor/platformdirs/__main__.py ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ from pip._vendor.platformdirs import PlatformDirs, __version__
4
+
5
+ PROPS = (
6
+ "user_data_dir",
7
+ "user_config_dir",
8
+ "user_cache_dir",
9
+ "user_state_dir",
10
+ "user_log_dir",
11
+ "user_documents_dir",
12
+ "user_runtime_dir",
13
+ "site_data_dir",
14
+ "site_config_dir",
15
+ )
16
+
17
+
18
+ def main() -> None:
19
+ app_name = "MyApp"
20
+ app_author = "MyCompany"
21
+
22
+ print(f"-- platformdirs {__version__} --")
23
+
24
+ print("-- app dirs (with optional 'version')")
25
+ dirs = PlatformDirs(app_name, app_author, version="1.0")
26
+ for prop in PROPS:
27
+ print(f"{prop}: {getattr(dirs, prop)}")
28
+
29
+ print("\n-- app dirs (without optional 'version')")
30
+ dirs = PlatformDirs(app_name, app_author)
31
+ for prop in PROPS:
32
+ print(f"{prop}: {getattr(dirs, prop)}")
33
+
34
+ print("\n-- app dirs (without optional 'appauthor')")
35
+ dirs = PlatformDirs(app_name)
36
+ for prop in PROPS:
37
+ print(f"{prop}: {getattr(dirs, prop)}")
38
+
39
+ print("\n-- app dirs (with disabled 'appauthor')")
40
+ dirs = PlatformDirs(app_name, appauthor=False)
41
+ for prop in PROPS:
42
+ print(f"{prop}: {getattr(dirs, prop)}")
43
+
44
+
45
+ if __name__ == "__main__":
46
+ main()
llmeval-env/lib/python3.10/site-packages/pip/_vendor/platformdirs/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (10.5 kB). View file
 
llmeval-env/lib/python3.10/site-packages/pip/_vendor/platformdirs/__pycache__/__main__.cpython-310.pyc ADDED
Binary file (1.24 kB). View file
 
llmeval-env/lib/python3.10/site-packages/pip/_vendor/platformdirs/__pycache__/android.cpython-310.pyc ADDED
Binary file (4.27 kB). View file
 
llmeval-env/lib/python3.10/site-packages/pip/_vendor/platformdirs/__pycache__/api.cpython-310.pyc ADDED
Binary file (5.2 kB). View file
 
llmeval-env/lib/python3.10/site-packages/pip/_vendor/platformdirs/__pycache__/macos.cpython-310.pyc ADDED
Binary file (3.19 kB). View file
 
llmeval-env/lib/python3.10/site-packages/pip/_vendor/platformdirs/__pycache__/unix.cpython-310.pyc ADDED
Binary file (6.89 kB). View file
 
llmeval-env/lib/python3.10/site-packages/pip/_vendor/platformdirs/__pycache__/windows.cpython-310.pyc ADDED
Binary file (6.44 kB). View file
 
llmeval-env/lib/python3.10/site-packages/pip/_vendor/platformdirs/android.py ADDED
@@ -0,0 +1,119 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import os
4
+ import re
5
+ import sys
6
+ from functools import lru_cache
7
+
8
+ from .api import PlatformDirsABC
9
+
10
+
11
+ class Android(PlatformDirsABC):
12
+ """
13
+ Follows the guidance `from here <https://android.stackexchange.com/a/216132>`_. Makes use of the
14
+ `appname <platformdirs.api.PlatformDirsABC.appname>` and
15
+ `version <platformdirs.api.PlatformDirsABC.version>`.
16
+ """
17
+
18
+ @property
19
+ def user_data_dir(self) -> str:
20
+ """:return: data directory tied to the user, e.g. ``/data/user/<userid>/<packagename>/files/<AppName>``"""
21
+ return self._append_app_name_and_version(_android_folder(), "files")
22
+
23
+ @property
24
+ def site_data_dir(self) -> str:
25
+ """:return: data directory shared by users, same as `user_data_dir`"""
26
+ return self.user_data_dir
27
+
28
+ @property
29
+ def user_config_dir(self) -> str:
30
+ """
31
+ :return: config directory tied to the user, e.g. ``/data/user/<userid>/<packagename>/shared_prefs/<AppName>``
32
+ """
33
+ return self._append_app_name_and_version(_android_folder(), "shared_prefs")
34
+
35
+ @property
36
+ def site_config_dir(self) -> str:
37
+ """:return: config directory shared by the users, same as `user_config_dir`"""
38
+ return self.user_config_dir
39
+
40
+ @property
41
+ def user_cache_dir(self) -> str:
42
+ """:return: cache directory tied to the user, e.g. e.g. ``/data/user/<userid>/<packagename>/cache/<AppName>``"""
43
+ return self._append_app_name_and_version(_android_folder(), "cache")
44
+
45
+ @property
46
+ def user_state_dir(self) -> str:
47
+ """:return: state directory tied to the user, same as `user_data_dir`"""
48
+ return self.user_data_dir
49
+
50
+ @property
51
+ def user_log_dir(self) -> str:
52
+ """
53
+ :return: log directory tied to the user, same as `user_cache_dir` if not opinionated else ``log`` in it,
54
+ e.g. ``/data/user/<userid>/<packagename>/cache/<AppName>/log``
55
+ """
56
+ path = self.user_cache_dir
57
+ if self.opinion:
58
+ path = os.path.join(path, "log")
59
+ return path
60
+
61
+ @property
62
+ def user_documents_dir(self) -> str:
63
+ """
64
+ :return: documents directory tied to the user e.g. ``/storage/emulated/0/Documents``
65
+ """
66
+ return _android_documents_folder()
67
+
68
+ @property
69
+ def user_runtime_dir(self) -> str:
70
+ """
71
+ :return: runtime directory tied to the user, same as `user_cache_dir` if not opinionated else ``tmp`` in it,
72
+ e.g. ``/data/user/<userid>/<packagename>/cache/<AppName>/tmp``
73
+ """
74
+ path = self.user_cache_dir
75
+ if self.opinion:
76
+ path = os.path.join(path, "tmp")
77
+ return path
78
+
79
+
80
+ @lru_cache(maxsize=1)
81
+ def _android_folder() -> str:
82
+ """:return: base folder for the Android OS"""
83
+ try:
84
+ # First try to get path to android app via pyjnius
85
+ from jnius import autoclass
86
+
87
+ Context = autoclass("android.content.Context") # noqa: N806
88
+ result: str = Context.getFilesDir().getParentFile().getAbsolutePath()
89
+ except Exception:
90
+ # if fails find an android folder looking path on the sys.path
91
+ pattern = re.compile(r"/data/(data|user/\d+)/(.+)/files")
92
+ for path in sys.path:
93
+ if pattern.match(path):
94
+ result = path.split("/files")[0]
95
+ break
96
+ else:
97
+ raise OSError("Cannot find path to android app folder")
98
+ return result
99
+
100
+
101
+ @lru_cache(maxsize=1)
102
+ def _android_documents_folder() -> str:
103
+ """:return: documents folder for the Android OS"""
104
+ # Get directories with pyjnius
105
+ try:
106
+ from jnius import autoclass
107
+
108
+ Context = autoclass("android.content.Context") # noqa: N806
109
+ Environment = autoclass("android.os.Environment") # noqa: N806
110
+ documents_dir: str = Context.getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS).getAbsolutePath()
111
+ except Exception:
112
+ documents_dir = "/storage/emulated/0/Documents"
113
+
114
+ return documents_dir
115
+
116
+
117
+ __all__ = [
118
+ "Android",
119
+ ]
llmeval-env/lib/python3.10/site-packages/pip/_vendor/platformdirs/api.py ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import os
4
+ import sys
5
+ from abc import ABC, abstractmethod
6
+ from pathlib import Path
7
+
8
+ if sys.version_info >= (3, 8): # pragma: no branch
9
+ from typing import Literal # pragma: no cover
10
+
11
+
12
+ class PlatformDirsABC(ABC):
13
+ """
14
+ Abstract base class for platform directories.
15
+ """
16
+
17
+ def __init__(
18
+ self,
19
+ appname: str | None = None,
20
+ appauthor: str | None | Literal[False] = None,
21
+ version: str | None = None,
22
+ roaming: bool = False,
23
+ multipath: bool = False,
24
+ opinion: bool = True,
25
+ ):
26
+ """
27
+ Create a new platform directory.
28
+
29
+ :param appname: See `appname`.
30
+ :param appauthor: See `appauthor`.
31
+ :param version: See `version`.
32
+ :param roaming: See `roaming`.
33
+ :param multipath: See `multipath`.
34
+ :param opinion: See `opinion`.
35
+ """
36
+ self.appname = appname #: The name of application.
37
+ self.appauthor = appauthor
38
+ """
39
+ The name of the app author or distributing body for this application. Typically, it is the owning company name.
40
+ Defaults to `appname`. You may pass ``False`` to disable it.
41
+ """
42
+ self.version = version
43
+ """
44
+ An optional version path element to append to the path. You might want to use this if you want multiple versions
45
+ of your app to be able to run independently. If used, this would typically be ``<major>.<minor>``.
46
+ """
47
+ self.roaming = roaming
48
+ """
49
+ Whether to use the roaming appdata directory on Windows. That means that for users on a Windows network setup
50
+ for roaming profiles, this user data will be synced on login (see
51
+ `here <http://technet.microsoft.com/en-us/library/cc766489(WS.10).aspx>`_).
52
+ """
53
+ self.multipath = multipath
54
+ """
55
+ An optional parameter only applicable to Unix/Linux which indicates that the entire list of data dirs should be
56
+ returned. By default, the first item would only be returned.
57
+ """
58
+ self.opinion = opinion #: A flag to indicating to use opinionated values.
59
+
60
+ def _append_app_name_and_version(self, *base: str) -> str:
61
+ params = list(base[1:])
62
+ if self.appname:
63
+ params.append(self.appname)
64
+ if self.version:
65
+ params.append(self.version)
66
+ return os.path.join(base[0], *params)
67
+
68
+ @property
69
+ @abstractmethod
70
+ def user_data_dir(self) -> str:
71
+ """:return: data directory tied to the user"""
72
+
73
+ @property
74
+ @abstractmethod
75
+ def site_data_dir(self) -> str:
76
+ """:return: data directory shared by users"""
77
+
78
+ @property
79
+ @abstractmethod
80
+ def user_config_dir(self) -> str:
81
+ """:return: config directory tied to the user"""
82
+
83
+ @property
84
+ @abstractmethod
85
+ def site_config_dir(self) -> str:
86
+ """:return: config directory shared by the users"""
87
+
88
+ @property
89
+ @abstractmethod
90
+ def user_cache_dir(self) -> str:
91
+ """:return: cache directory tied to the user"""
92
+
93
+ @property
94
+ @abstractmethod
95
+ def user_state_dir(self) -> str:
96
+ """:return: state directory tied to the user"""
97
+
98
+ @property
99
+ @abstractmethod
100
+ def user_log_dir(self) -> str:
101
+ """:return: log directory tied to the user"""
102
+
103
+ @property
104
+ @abstractmethod
105
+ def user_documents_dir(self) -> str:
106
+ """:return: documents directory tied to the user"""
107
+
108
+ @property
109
+ @abstractmethod
110
+ def user_runtime_dir(self) -> str:
111
+ """:return: runtime directory tied to the user"""
112
+
113
+ @property
114
+ def user_data_path(self) -> Path:
115
+ """:return: data path tied to the user"""
116
+ return Path(self.user_data_dir)
117
+
118
+ @property
119
+ def site_data_path(self) -> Path:
120
+ """:return: data path shared by users"""
121
+ return Path(self.site_data_dir)
122
+
123
+ @property
124
+ def user_config_path(self) -> Path:
125
+ """:return: config path tied to the user"""
126
+ return Path(self.user_config_dir)
127
+
128
+ @property
129
+ def site_config_path(self) -> Path:
130
+ """:return: config path shared by the users"""
131
+ return Path(self.site_config_dir)
132
+
133
+ @property
134
+ def user_cache_path(self) -> Path:
135
+ """:return: cache path tied to the user"""
136
+ return Path(self.user_cache_dir)
137
+
138
+ @property
139
+ def user_state_path(self) -> Path:
140
+ """:return: state path tied to the user"""
141
+ return Path(self.user_state_dir)
142
+
143
+ @property
144
+ def user_log_path(self) -> Path:
145
+ """:return: log path tied to the user"""
146
+ return Path(self.user_log_dir)
147
+
148
+ @property
149
+ def user_documents_path(self) -> Path:
150
+ """:return: documents path tied to the user"""
151
+ return Path(self.user_documents_dir)
152
+
153
+ @property
154
+ def user_runtime_path(self) -> Path:
155
+ """:return: runtime path tied to the user"""
156
+ return Path(self.user_runtime_dir)
llmeval-env/lib/python3.10/site-packages/pip/_vendor/platformdirs/macos.py ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import os
4
+
5
+ from .api import PlatformDirsABC
6
+
7
+
8
+ class MacOS(PlatformDirsABC):
9
+ """
10
+ Platform directories for the macOS operating system. Follows the guidance from `Apple documentation
11
+ <https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/MacOSXDirectories/MacOSXDirectories.html>`_.
12
+ Makes use of the `appname <platformdirs.api.PlatformDirsABC.appname>` and
13
+ `version <platformdirs.api.PlatformDirsABC.version>`.
14
+ """
15
+
16
+ @property
17
+ def user_data_dir(self) -> str:
18
+ """:return: data directory tied to the user, e.g. ``~/Library/Application Support/$appname/$version``"""
19
+ return self._append_app_name_and_version(os.path.expanduser("~/Library/Application Support/"))
20
+
21
+ @property
22
+ def site_data_dir(self) -> str:
23
+ """:return: data directory shared by users, e.g. ``/Library/Application Support/$appname/$version``"""
24
+ return self._append_app_name_and_version("/Library/Application Support")
25
+
26
+ @property
27
+ def user_config_dir(self) -> str:
28
+ """:return: config directory tied to the user, e.g. ``~/Library/Preferences/$appname/$version``"""
29
+ return self._append_app_name_and_version(os.path.expanduser("~/Library/Preferences/"))
30
+
31
+ @property
32
+ def site_config_dir(self) -> str:
33
+ """:return: config directory shared by the users, e.g. ``/Library/Preferences/$appname``"""
34
+ return self._append_app_name_and_version("/Library/Preferences")
35
+
36
+ @property
37
+ def user_cache_dir(self) -> str:
38
+ """:return: cache directory tied to the user, e.g. ``~/Library/Caches/$appname/$version``"""
39
+ return self._append_app_name_and_version(os.path.expanduser("~/Library/Caches"))
40
+
41
+ @property
42
+ def user_state_dir(self) -> str:
43
+ """:return: state directory tied to the user, same as `user_data_dir`"""
44
+ return self.user_data_dir
45
+
46
+ @property
47
+ def user_log_dir(self) -> str:
48
+ """:return: log directory tied to the user, e.g. ``~/Library/Logs/$appname/$version``"""
49
+ return self._append_app_name_and_version(os.path.expanduser("~/Library/Logs"))
50
+
51
+ @property
52
+ def user_documents_dir(self) -> str:
53
+ """:return: documents directory tied to the user, e.g. ``~/Documents``"""
54
+ return os.path.expanduser("~/Documents")
55
+
56
+ @property
57
+ def user_runtime_dir(self) -> str:
58
+ """:return: runtime directory tied to the user, e.g. ``~/Library/Caches/TemporaryItems/$appname/$version``"""
59
+ return self._append_app_name_and_version(os.path.expanduser("~/Library/Caches/TemporaryItems"))
60
+
61
+
62
+ __all__ = [
63
+ "MacOS",
64
+ ]
llmeval-env/lib/python3.10/site-packages/pip/_vendor/platformdirs/unix.py ADDED
@@ -0,0 +1,181 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import os
4
+ import sys
5
+ from configparser import ConfigParser
6
+ from pathlib import Path
7
+
8
+ from .api import PlatformDirsABC
9
+
10
+ if sys.platform.startswith("linux"): # pragma: no branch # no op check, only to please the type checker
11
+ from os import getuid
12
+ else:
13
+
14
+ def getuid() -> int:
15
+ raise RuntimeError("should only be used on Linux")
16
+
17
+
18
+ class Unix(PlatformDirsABC):
19
+ """
20
+ On Unix/Linux, we follow the
21
+ `XDG Basedir Spec <https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html>`_. The spec allows
22
+ overriding directories with environment variables. The examples show are the default values, alongside the name of
23
+ the environment variable that overrides them. Makes use of the
24
+ `appname <platformdirs.api.PlatformDirsABC.appname>`,
25
+ `version <platformdirs.api.PlatformDirsABC.version>`,
26
+ `multipath <platformdirs.api.PlatformDirsABC.multipath>`,
27
+ `opinion <platformdirs.api.PlatformDirsABC.opinion>`.
28
+ """
29
+
30
+ @property
31
+ def user_data_dir(self) -> str:
32
+ """
33
+ :return: data directory tied to the user, e.g. ``~/.local/share/$appname/$version`` or
34
+ ``$XDG_DATA_HOME/$appname/$version``
35
+ """
36
+ path = os.environ.get("XDG_DATA_HOME", "")
37
+ if not path.strip():
38
+ path = os.path.expanduser("~/.local/share")
39
+ return self._append_app_name_and_version(path)
40
+
41
+ @property
42
+ def site_data_dir(self) -> str:
43
+ """
44
+ :return: data directories shared by users (if `multipath <platformdirs.api.PlatformDirsABC.multipath>` is
45
+ enabled and ``XDG_DATA_DIR`` is set and a multi path the response is also a multi path separated by the OS
46
+ path separator), e.g. ``/usr/local/share/$appname/$version`` or ``/usr/share/$appname/$version``
47
+ """
48
+ # XDG default for $XDG_DATA_DIRS; only first, if multipath is False
49
+ path = os.environ.get("XDG_DATA_DIRS", "")
50
+ if not path.strip():
51
+ path = f"/usr/local/share{os.pathsep}/usr/share"
52
+ return self._with_multi_path(path)
53
+
54
+ def _with_multi_path(self, path: str) -> str:
55
+ path_list = path.split(os.pathsep)
56
+ if not self.multipath:
57
+ path_list = path_list[0:1]
58
+ path_list = [self._append_app_name_and_version(os.path.expanduser(p)) for p in path_list]
59
+ return os.pathsep.join(path_list)
60
+
61
+ @property
62
+ def user_config_dir(self) -> str:
63
+ """
64
+ :return: config directory tied to the user, e.g. ``~/.config/$appname/$version`` or
65
+ ``$XDG_CONFIG_HOME/$appname/$version``
66
+ """
67
+ path = os.environ.get("XDG_CONFIG_HOME", "")
68
+ if not path.strip():
69
+ path = os.path.expanduser("~/.config")
70
+ return self._append_app_name_and_version(path)
71
+
72
+ @property
73
+ def site_config_dir(self) -> str:
74
+ """
75
+ :return: config directories shared by users (if `multipath <platformdirs.api.PlatformDirsABC.multipath>`
76
+ is enabled and ``XDG_DATA_DIR`` is set and a multi path the response is also a multi path separated by the OS
77
+ path separator), e.g. ``/etc/xdg/$appname/$version``
78
+ """
79
+ # XDG default for $XDG_CONFIG_DIRS only first, if multipath is False
80
+ path = os.environ.get("XDG_CONFIG_DIRS", "")
81
+ if not path.strip():
82
+ path = "/etc/xdg"
83
+ return self._with_multi_path(path)
84
+
85
+ @property
86
+ def user_cache_dir(self) -> str:
87
+ """
88
+ :return: cache directory tied to the user, e.g. ``~/.cache/$appname/$version`` or
89
+ ``~/$XDG_CACHE_HOME/$appname/$version``
90
+ """
91
+ path = os.environ.get("XDG_CACHE_HOME", "")
92
+ if not path.strip():
93
+ path = os.path.expanduser("~/.cache")
94
+ return self._append_app_name_and_version(path)
95
+
96
+ @property
97
+ def user_state_dir(self) -> str:
98
+ """
99
+ :return: state directory tied to the user, e.g. ``~/.local/state/$appname/$version`` or
100
+ ``$XDG_STATE_HOME/$appname/$version``
101
+ """
102
+ path = os.environ.get("XDG_STATE_HOME", "")
103
+ if not path.strip():
104
+ path = os.path.expanduser("~/.local/state")
105
+ return self._append_app_name_and_version(path)
106
+
107
+ @property
108
+ def user_log_dir(self) -> str:
109
+ """
110
+ :return: log directory tied to the user, same as `user_data_dir` if not opinionated else ``log`` in it
111
+ """
112
+ path = self.user_cache_dir
113
+ if self.opinion:
114
+ path = os.path.join(path, "log")
115
+ return path
116
+
117
+ @property
118
+ def user_documents_dir(self) -> str:
119
+ """
120
+ :return: documents directory tied to the user, e.g. ``~/Documents``
121
+ """
122
+ documents_dir = _get_user_dirs_folder("XDG_DOCUMENTS_DIR")
123
+ if documents_dir is None:
124
+ documents_dir = os.environ.get("XDG_DOCUMENTS_DIR", "").strip()
125
+ if not documents_dir:
126
+ documents_dir = os.path.expanduser("~/Documents")
127
+
128
+ return documents_dir
129
+
130
+ @property
131
+ def user_runtime_dir(self) -> str:
132
+ """
133
+ :return: runtime directory tied to the user, e.g. ``/run/user/$(id -u)/$appname/$version`` or
134
+ ``$XDG_RUNTIME_DIR/$appname/$version``
135
+ """
136
+ path = os.environ.get("XDG_RUNTIME_DIR", "")
137
+ if not path.strip():
138
+ path = f"/run/user/{getuid()}"
139
+ return self._append_app_name_and_version(path)
140
+
141
+ @property
142
+ def site_data_path(self) -> Path:
143
+ """:return: data path shared by users. Only return first item, even if ``multipath`` is set to ``True``"""
144
+ return self._first_item_as_path_if_multipath(self.site_data_dir)
145
+
146
+ @property
147
+ def site_config_path(self) -> Path:
148
+ """:return: config path shared by the users. Only return first item, even if ``multipath`` is set to ``True``"""
149
+ return self._first_item_as_path_if_multipath(self.site_config_dir)
150
+
151
+ def _first_item_as_path_if_multipath(self, directory: str) -> Path:
152
+ if self.multipath:
153
+ # If multipath is True, the first path is returned.
154
+ directory = directory.split(os.pathsep)[0]
155
+ return Path(directory)
156
+
157
+
158
+ def _get_user_dirs_folder(key: str) -> str | None:
159
+ """Return directory from user-dirs.dirs config file. See https://freedesktop.org/wiki/Software/xdg-user-dirs/"""
160
+ user_dirs_config_path = os.path.join(Unix().user_config_dir, "user-dirs.dirs")
161
+ if os.path.exists(user_dirs_config_path):
162
+ parser = ConfigParser()
163
+
164
+ with open(user_dirs_config_path) as stream:
165
+ # Add fake section header, so ConfigParser doesn't complain
166
+ parser.read_string(f"[top]\n{stream.read()}")
167
+
168
+ if key not in parser["top"]:
169
+ return None
170
+
171
+ path = parser["top"][key].strip('"')
172
+ # Handle relative home paths
173
+ path = path.replace("$HOME", os.path.expanduser("~"))
174
+ return path
175
+
176
+ return None
177
+
178
+
179
+ __all__ = [
180
+ "Unix",
181
+ ]
llmeval-env/lib/python3.10/site-packages/pip/_vendor/platformdirs/version.py ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ """ Version information """
2
+
3
+ __version__ = "2.4.1"
4
+ __version_info__ = (2, 4, 1)
llmeval-env/lib/python3.10/site-packages/pip/_vendor/platformdirs/windows.py ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import ctypes
4
+ import os
5
+ from functools import lru_cache
6
+ from typing import Callable
7
+
8
+ from .api import PlatformDirsABC
9
+
10
+
11
+ class Windows(PlatformDirsABC):
12
+ """`MSDN on where to store app data files
13
+ <http://support.microsoft.com/default.aspx?scid=kb;en-us;310294#XSLTH3194121123120121120120>`_.
14
+ Makes use of the
15
+ `appname <platformdirs.api.PlatformDirsABC.appname>`,
16
+ `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`,
17
+ `version <platformdirs.api.PlatformDirsABC.version>`,
18
+ `roaming <platformdirs.api.PlatformDirsABC.roaming>`,
19
+ `opinion <platformdirs.api.PlatformDirsABC.opinion>`."""
20
+
21
+ @property
22
+ def user_data_dir(self) -> str:
23
+ """
24
+ :return: data directory tied to the user, e.g.
25
+ ``%USERPROFILE%\\AppData\\Local\\$appauthor\\$appname`` (not roaming) or
26
+ ``%USERPROFILE%\\AppData\\Roaming\\$appauthor\\$appname`` (roaming)
27
+ """
28
+ const = "CSIDL_APPDATA" if self.roaming else "CSIDL_LOCAL_APPDATA"
29
+ path = os.path.normpath(get_win_folder(const))
30
+ return self._append_parts(path)
31
+
32
+ def _append_parts(self, path: str, *, opinion_value: str | None = None) -> str:
33
+ params = []
34
+ if self.appname:
35
+ if self.appauthor is not False:
36
+ author = self.appauthor or self.appname
37
+ params.append(author)
38
+ params.append(self.appname)
39
+ if opinion_value is not None and self.opinion:
40
+ params.append(opinion_value)
41
+ if self.version:
42
+ params.append(self.version)
43
+ return os.path.join(path, *params)
44
+
45
+ @property
46
+ def site_data_dir(self) -> str:
47
+ """:return: data directory shared by users, e.g. ``C:\\ProgramData\\$appauthor\\$appname``"""
48
+ path = os.path.normpath(get_win_folder("CSIDL_COMMON_APPDATA"))
49
+ return self._append_parts(path)
50
+
51
+ @property
52
+ def user_config_dir(self) -> str:
53
+ """:return: config directory tied to the user, same as `user_data_dir`"""
54
+ return self.user_data_dir
55
+
56
+ @property
57
+ def site_config_dir(self) -> str:
58
+ """:return: config directory shared by the users, same as `site_data_dir`"""
59
+ return self.site_data_dir
60
+
61
+ @property
62
+ def user_cache_dir(self) -> str:
63
+ """
64
+ :return: cache directory tied to the user (if opinionated with ``Cache`` folder within ``$appname``) e.g.
65
+ ``%USERPROFILE%\\AppData\\Local\\$appauthor\\$appname\\Cache\\$version``
66
+ """
67
+ path = os.path.normpath(get_win_folder("CSIDL_LOCAL_APPDATA"))
68
+ return self._append_parts(path, opinion_value="Cache")
69
+
70
+ @property
71
+ def user_state_dir(self) -> str:
72
+ """:return: state directory tied to the user, same as `user_data_dir`"""
73
+ return self.user_data_dir
74
+
75
+ @property
76
+ def user_log_dir(self) -> str:
77
+ """
78
+ :return: log directory tied to the user, same as `user_data_dir` if not opinionated else ``Logs`` in it
79
+ """
80
+ path = self.user_data_dir
81
+ if self.opinion:
82
+ path = os.path.join(path, "Logs")
83
+ return path
84
+
85
+ @property
86
+ def user_documents_dir(self) -> str:
87
+ """
88
+ :return: documents directory tied to the user e.g. ``%USERPROFILE%\\Documents``
89
+ """
90
+ return os.path.normpath(get_win_folder("CSIDL_PERSONAL"))
91
+
92
+ @property
93
+ def user_runtime_dir(self) -> str:
94
+ """
95
+ :return: runtime directory tied to the user, e.g.
96
+ ``%USERPROFILE%\\AppData\\Local\\Temp\\$appauthor\\$appname``
97
+ """
98
+ path = os.path.normpath(os.path.join(get_win_folder("CSIDL_LOCAL_APPDATA"), "Temp"))
99
+ return self._append_parts(path)
100
+
101
+
102
+ def get_win_folder_from_env_vars(csidl_name: str) -> str:
103
+ """Get folder from environment variables."""
104
+ if csidl_name == "CSIDL_PERSONAL": # does not have an environment name
105
+ return os.path.join(os.path.normpath(os.environ["USERPROFILE"]), "Documents")
106
+
107
+ env_var_name = {
108
+ "CSIDL_APPDATA": "APPDATA",
109
+ "CSIDL_COMMON_APPDATA": "ALLUSERSPROFILE",
110
+ "CSIDL_LOCAL_APPDATA": "LOCALAPPDATA",
111
+ }.get(csidl_name)
112
+ if env_var_name is None:
113
+ raise ValueError(f"Unknown CSIDL name: {csidl_name}")
114
+ result = os.environ.get(env_var_name)
115
+ if result is None:
116
+ raise ValueError(f"Unset environment variable: {env_var_name}")
117
+ return result
118
+
119
+
120
+ def get_win_folder_from_registry(csidl_name: str) -> str:
121
+ """Get folder from the registry.
122
+
123
+ This is a fallback technique at best. I'm not sure if using the
124
+ registry for this guarantees us the correct answer for all CSIDL_*
125
+ names.
126
+ """
127
+ shell_folder_name = {
128
+ "CSIDL_APPDATA": "AppData",
129
+ "CSIDL_COMMON_APPDATA": "Common AppData",
130
+ "CSIDL_LOCAL_APPDATA": "Local AppData",
131
+ "CSIDL_PERSONAL": "Personal",
132
+ }.get(csidl_name)
133
+ if shell_folder_name is None:
134
+ raise ValueError(f"Unknown CSIDL name: {csidl_name}")
135
+
136
+ import winreg
137
+
138
+ key = winreg.OpenKey(winreg.HKEY_CURRENT_USER, r"Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders")
139
+ directory, _ = winreg.QueryValueEx(key, shell_folder_name)
140
+ return str(directory)
141
+
142
+
143
+ def get_win_folder_via_ctypes(csidl_name: str) -> str:
144
+ """Get folder with ctypes."""
145
+ csidl_const = {
146
+ "CSIDL_APPDATA": 26,
147
+ "CSIDL_COMMON_APPDATA": 35,
148
+ "CSIDL_LOCAL_APPDATA": 28,
149
+ "CSIDL_PERSONAL": 5,
150
+ }.get(csidl_name)
151
+ if csidl_const is None:
152
+ raise ValueError(f"Unknown CSIDL name: {csidl_name}")
153
+
154
+ buf = ctypes.create_unicode_buffer(1024)
155
+ windll = getattr(ctypes, "windll") # noqa: B009 # using getattr to avoid false positive with mypy type checker
156
+ windll.shell32.SHGetFolderPathW(None, csidl_const, None, 0, buf)
157
+
158
+ # Downgrade to short path name if it has highbit chars.
159
+ if any(ord(c) > 255 for c in buf):
160
+ buf2 = ctypes.create_unicode_buffer(1024)
161
+ if windll.kernel32.GetShortPathNameW(buf.value, buf2, 1024):
162
+ buf = buf2
163
+
164
+ return buf.value
165
+
166
+
167
+ def _pick_get_win_folder() -> Callable[[str], str]:
168
+ if hasattr(ctypes, "windll"):
169
+ return get_win_folder_via_ctypes
170
+ try:
171
+ import winreg # noqa: F401
172
+ except ImportError:
173
+ return get_win_folder_from_env_vars
174
+ else:
175
+ return get_win_folder_from_registry
176
+
177
+
178
+ get_win_folder = lru_cache(maxsize=None)(_pick_get_win_folder())
179
+
180
+ __all__ = [
181
+ "Windows",
182
+ ]
llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/__main__.cpython-310.pyc ADDED
Binary file (7.33 kB). View file
 
llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/_emoji_codes.cpython-310.pyc ADDED
Binary file (360 kB). View file
 
llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/_emoji_replace.cpython-310.pyc ADDED
Binary file (1.2 kB). View file
 
llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/_extension.cpython-310.pyc ADDED
Binary file (496 Bytes). View file
 
llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/_inspect.cpython-310.pyc ADDED
Binary file (6.61 kB). View file
 
llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/_log_render.cpython-310.pyc ADDED
Binary file (2.64 kB). View file
 
llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/_loop.cpython-310.pyc ADDED
Binary file (1.29 kB). View file
 
llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/_lru_cache.cpython-310.pyc ADDED
Binary file (1.58 kB). View file
 
llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/_palettes.cpython-310.pyc ADDED
Binary file (5.1 kB). View file
 
llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/_pick.cpython-310.pyc ADDED
Binary file (641 Bytes). View file
 
llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/_ratio.cpython-310.pyc ADDED
Binary file (5.16 kB). View file
 
llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/_spinners.cpython-310.pyc ADDED
Binary file (15.2 kB). View file
 
llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/_stack.cpython-310.pyc ADDED
Binary file (839 Bytes). View file
 
llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/_timer.cpython-310.pyc ADDED
Binary file (688 Bytes). View file
 
llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/_windows.cpython-310.pyc ADDED
Binary file (1.88 kB). View file
 
llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/_wrap.cpython-310.pyc ADDED
Binary file (1.52 kB). View file
 
llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/abc.cpython-310.pyc ADDED
Binary file (1.32 kB). View file
 
llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/align.cpython-310.pyc ADDED
Binary file (7.97 kB). View file
 
llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/ansi.cpython-310.pyc ADDED
Binary file (6.02 kB). View file
 
llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/box.cpython-310.pyc ADDED
Binary file (7.76 kB). View file
 
llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/cells.cpython-310.pyc ADDED
Binary file (3.5 kB). View file
 
llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/color.cpython-310.pyc ADDED
Binary file (16.8 kB). View file
 
llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/color_triplet.cpython-310.pyc ADDED
Binary file (1.44 kB). View file
 
llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/columns.cpython-310.pyc ADDED
Binary file (6.2 kB). View file
 
llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/console.cpython-310.pyc ADDED
Binary file (70.4 kB). View file
 
llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/containers.cpython-310.pyc ADDED
Binary file (6.49 kB). View file
 
llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/control.cpython-310.pyc ADDED
Binary file (6.83 kB). View file
 
llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/default_styles.cpython-310.pyc ADDED
Binary file (6.03 kB). View file
 
llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/diagnose.cpython-310.pyc ADDED
Binary file (356 Bytes). View file
 
llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/emoji.cpython-310.pyc ADDED
Binary file (3.27 kB). View file
 
llmeval-env/lib/python3.10/site-packages/pip/_vendor/rich/__pycache__/errors.cpython-310.pyc ADDED
Binary file (1.53 kB). View file