codekingpro commited on
Commit
6f8edd3
·
verified ·
1 Parent(s): f85fe83

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. micromamba_root/envs/hf_sync/Lib/site-packages/httpx-0.28.1.dist-info/licenses/LICENSE.md +12 -0
  2. micromamba_root/envs/hf_sync/Lib/site-packages/httpx/__pycache__/_api.cpython-314.pyc +0 -0
  3. micromamba_root/envs/hf_sync/Lib/site-packages/httpx/_transports/__init__.py +15 -0
  4. micromamba_root/envs/hf_sync/Lib/site-packages/httpx/_transports/asgi.py +187 -0
  5. micromamba_root/envs/hf_sync/Lib/site-packages/httpx/_transports/base.py +86 -0
  6. micromamba_root/envs/hf_sync/Lib/site-packages/httpx/_transports/default.py +406 -0
  7. micromamba_root/envs/hf_sync/Lib/site-packages/httpx/_transports/mock.py +43 -0
  8. micromamba_root/envs/hf_sync/Lib/site-packages/httpx/_transports/wsgi.py +149 -0
  9. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub-1.14.0.dist-info/licenses/LICENSE +201 -0
  10. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/__init__.cpython-314.pyc +0 -0
  11. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/_buckets.cpython-314.pyc +0 -0
  12. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/_commit_api.cpython-314.pyc +0 -0
  13. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/_commit_scheduler.cpython-314.pyc +0 -0
  14. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/_dataset_viewer.cpython-314.pyc +0 -0
  15. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/_eval_results.cpython-314.pyc +0 -0
  16. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/_inference_endpoints.cpython-314.pyc +0 -0
  17. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/_jobs_api.cpython-314.pyc +0 -0
  18. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/_local_folder.cpython-314.pyc +0 -0
  19. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/_login.cpython-314.pyc +0 -0
  20. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/_oauth.cpython-314.pyc +0 -0
  21. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/_snapshot_download.cpython-314.pyc +0 -0
  22. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/_space_api.cpython-314.pyc +0 -0
  23. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/_tensorboard_logger.cpython-314.pyc +0 -0
  24. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/_upload_large_folder.cpython-314.pyc +0 -0
  25. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/_webhooks_payload.cpython-314.pyc +0 -0
  26. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/_webhooks_server.cpython-314.pyc +0 -0
  27. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/community.cpython-314.pyc +0 -0
  28. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/constants.cpython-314.pyc +0 -0
  29. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/dataclasses.cpython-314.pyc +0 -0
  30. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/errors.cpython-314.pyc +0 -0
  31. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/fastai_utils.cpython-314.pyc +0 -0
  32. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/file_download.cpython-314.pyc +0 -0
  33. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/hf_file_system.cpython-314.pyc +0 -0
  34. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/hub_mixin.cpython-314.pyc +0 -0
  35. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/lfs.cpython-314.pyc +0 -0
  36. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/repocard.cpython-314.pyc +0 -0
  37. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/repocard_data.cpython-314.pyc +0 -0
  38. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/_hot_reload/__init__.py +13 -0
  39. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/_hot_reload/__pycache__/__init__.cpython-314.pyc +0 -0
  40. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/_hot_reload/__pycache__/client.cpython-314.pyc +0 -0
  41. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/_hot_reload/__pycache__/sse_client.cpython-314.pyc +0 -0
  42. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/_hot_reload/__pycache__/types.cpython-314.pyc +0 -0
  43. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/_hot_reload/client.py +130 -0
  44. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/_hot_reload/sse_client.py +144 -0
  45. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/_hot_reload/types.py +121 -0
  46. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/cli/__init__.py +13 -0
  47. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/cli/__pycache__/__init__.cpython-314.pyc +0 -0
  48. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/cli/__pycache__/_cli_utils.cpython-314.pyc +0 -0
  49. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/cli/__pycache__/_errors.cpython-314.pyc +0 -0
  50. micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/cli/__pycache__/_file_listing.cpython-314.pyc +0 -0
micromamba_root/envs/hf_sync/Lib/site-packages/httpx-0.28.1.dist-info/licenses/LICENSE.md ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright © 2019, [Encode OSS Ltd](https://www.encode.io/).
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5
+
6
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7
+
8
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9
+
10
+ * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11
+
12
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
micromamba_root/envs/hf_sync/Lib/site-packages/httpx/__pycache__/_api.cpython-314.pyc ADDED
Binary file (11.5 kB). View file
 
micromamba_root/envs/hf_sync/Lib/site-packages/httpx/_transports/__init__.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from .asgi import *
2
+ from .base import *
3
+ from .default import *
4
+ from .mock import *
5
+ from .wsgi import *
6
+
7
+ __all__ = [
8
+ "ASGITransport",
9
+ "AsyncBaseTransport",
10
+ "BaseTransport",
11
+ "AsyncHTTPTransport",
12
+ "HTTPTransport",
13
+ "MockTransport",
14
+ "WSGITransport",
15
+ ]
micromamba_root/envs/hf_sync/Lib/site-packages/httpx/_transports/asgi.py ADDED
@@ -0,0 +1,187 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import typing
4
+
5
+ from .._models import Request, Response
6
+ from .._types import AsyncByteStream
7
+ from .base import AsyncBaseTransport
8
+
9
+ if typing.TYPE_CHECKING: # pragma: no cover
10
+ import asyncio
11
+
12
+ import trio
13
+
14
+ Event = typing.Union[asyncio.Event, trio.Event]
15
+
16
+
17
+ _Message = typing.MutableMapping[str, typing.Any]
18
+ _Receive = typing.Callable[[], typing.Awaitable[_Message]]
19
+ _Send = typing.Callable[
20
+ [typing.MutableMapping[str, typing.Any]], typing.Awaitable[None]
21
+ ]
22
+ _ASGIApp = typing.Callable[
23
+ [typing.MutableMapping[str, typing.Any], _Receive, _Send], typing.Awaitable[None]
24
+ ]
25
+
26
+ __all__ = ["ASGITransport"]
27
+
28
+
29
+ def is_running_trio() -> bool:
30
+ try:
31
+ # sniffio is a dependency of trio.
32
+
33
+ # See https://github.com/python-trio/trio/issues/2802
34
+ import sniffio
35
+
36
+ if sniffio.current_async_library() == "trio":
37
+ return True
38
+ except ImportError: # pragma: nocover
39
+ pass
40
+
41
+ return False
42
+
43
+
44
+ def create_event() -> Event:
45
+ if is_running_trio():
46
+ import trio
47
+
48
+ return trio.Event()
49
+
50
+ import asyncio
51
+
52
+ return asyncio.Event()
53
+
54
+
55
+ class ASGIResponseStream(AsyncByteStream):
56
+ def __init__(self, body: list[bytes]) -> None:
57
+ self._body = body
58
+
59
+ async def __aiter__(self) -> typing.AsyncIterator[bytes]:
60
+ yield b"".join(self._body)
61
+
62
+
63
+ class ASGITransport(AsyncBaseTransport):
64
+ """
65
+ A custom AsyncTransport that handles sending requests directly to an ASGI app.
66
+
67
+ ```python
68
+ transport = httpx.ASGITransport(
69
+ app=app,
70
+ root_path="/submount",
71
+ client=("1.2.3.4", 123)
72
+ )
73
+ client = httpx.AsyncClient(transport=transport)
74
+ ```
75
+
76
+ Arguments:
77
+
78
+ * `app` - The ASGI application.
79
+ * `raise_app_exceptions` - Boolean indicating if exceptions in the application
80
+ should be raised. Default to `True`. Can be set to `False` for use cases
81
+ such as testing the content of a client 500 response.
82
+ * `root_path` - The root path on which the ASGI application should be mounted.
83
+ * `client` - A two-tuple indicating the client IP and port of incoming requests.
84
+ ```
85
+ """
86
+
87
+ def __init__(
88
+ self,
89
+ app: _ASGIApp,
90
+ raise_app_exceptions: bool = True,
91
+ root_path: str = "",
92
+ client: tuple[str, int] = ("127.0.0.1", 123),
93
+ ) -> None:
94
+ self.app = app
95
+ self.raise_app_exceptions = raise_app_exceptions
96
+ self.root_path = root_path
97
+ self.client = client
98
+
99
+ async def handle_async_request(
100
+ self,
101
+ request: Request,
102
+ ) -> Response:
103
+ assert isinstance(request.stream, AsyncByteStream)
104
+
105
+ # ASGI scope.
106
+ scope = {
107
+ "type": "http",
108
+ "asgi": {"version": "3.0"},
109
+ "http_version": "1.1",
110
+ "method": request.method,
111
+ "headers": [(k.lower(), v) for (k, v) in request.headers.raw],
112
+ "scheme": request.url.scheme,
113
+ "path": request.url.path,
114
+ "raw_path": request.url.raw_path.split(b"?")[0],
115
+ "query_string": request.url.query,
116
+ "server": (request.url.host, request.url.port),
117
+ "client": self.client,
118
+ "root_path": self.root_path,
119
+ }
120
+
121
+ # Request.
122
+ request_body_chunks = request.stream.__aiter__()
123
+ request_complete = False
124
+
125
+ # Response.
126
+ status_code = None
127
+ response_headers = None
128
+ body_parts = []
129
+ response_started = False
130
+ response_complete = create_event()
131
+
132
+ # ASGI callables.
133
+
134
+ async def receive() -> dict[str, typing.Any]:
135
+ nonlocal request_complete
136
+
137
+ if request_complete:
138
+ await response_complete.wait()
139
+ return {"type": "http.disconnect"}
140
+
141
+ try:
142
+ body = await request_body_chunks.__anext__()
143
+ except StopAsyncIteration:
144
+ request_complete = True
145
+ return {"type": "http.request", "body": b"", "more_body": False}
146
+ return {"type": "http.request", "body": body, "more_body": True}
147
+
148
+ async def send(message: typing.MutableMapping[str, typing.Any]) -> None:
149
+ nonlocal status_code, response_headers, response_started
150
+
151
+ if message["type"] == "http.response.start":
152
+ assert not response_started
153
+
154
+ status_code = message["status"]
155
+ response_headers = message.get("headers", [])
156
+ response_started = True
157
+
158
+ elif message["type"] == "http.response.body":
159
+ assert not response_complete.is_set()
160
+ body = message.get("body", b"")
161
+ more_body = message.get("more_body", False)
162
+
163
+ if body and request.method != "HEAD":
164
+ body_parts.append(body)
165
+
166
+ if not more_body:
167
+ response_complete.set()
168
+
169
+ try:
170
+ await self.app(scope, receive, send)
171
+ except Exception: # noqa: PIE-786
172
+ if self.raise_app_exceptions:
173
+ raise
174
+
175
+ response_complete.set()
176
+ if status_code is None:
177
+ status_code = 500
178
+ if response_headers is None:
179
+ response_headers = {}
180
+
181
+ assert response_complete.is_set()
182
+ assert status_code is not None
183
+ assert response_headers is not None
184
+
185
+ stream = ASGIResponseStream(body_parts)
186
+
187
+ return Response(status_code, headers=response_headers, stream=stream)
micromamba_root/envs/hf_sync/Lib/site-packages/httpx/_transports/base.py ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import typing
4
+ from types import TracebackType
5
+
6
+ from .._models import Request, Response
7
+
8
+ T = typing.TypeVar("T", bound="BaseTransport")
9
+ A = typing.TypeVar("A", bound="AsyncBaseTransport")
10
+
11
+ __all__ = ["AsyncBaseTransport", "BaseTransport"]
12
+
13
+
14
+ class BaseTransport:
15
+ def __enter__(self: T) -> T:
16
+ return self
17
+
18
+ def __exit__(
19
+ self,
20
+ exc_type: type[BaseException] | None = None,
21
+ exc_value: BaseException | None = None,
22
+ traceback: TracebackType | None = None,
23
+ ) -> None:
24
+ self.close()
25
+
26
+ def handle_request(self, request: Request) -> Response:
27
+ """
28
+ Send a single HTTP request and return a response.
29
+
30
+ Developers shouldn't typically ever need to call into this API directly,
31
+ since the Client class provides all the higher level user-facing API
32
+ niceties.
33
+
34
+ In order to properly release any network resources, the response
35
+ stream should *either* be consumed immediately, with a call to
36
+ `response.stream.read()`, or else the `handle_request` call should
37
+ be followed with a try/finally block to ensuring the stream is
38
+ always closed.
39
+
40
+ Example usage:
41
+
42
+ with httpx.HTTPTransport() as transport:
43
+ req = httpx.Request(
44
+ method=b"GET",
45
+ url=(b"https", b"www.example.com", 443, b"/"),
46
+ headers=[(b"Host", b"www.example.com")],
47
+ )
48
+ resp = transport.handle_request(req)
49
+ body = resp.stream.read()
50
+ print(resp.status_code, resp.headers, body)
51
+
52
+
53
+ Takes a `Request` instance as the only argument.
54
+
55
+ Returns a `Response` instance.
56
+ """
57
+ raise NotImplementedError(
58
+ "The 'handle_request' method must be implemented."
59
+ ) # pragma: no cover
60
+
61
+ def close(self) -> None:
62
+ pass
63
+
64
+
65
+ class AsyncBaseTransport:
66
+ async def __aenter__(self: A) -> A:
67
+ return self
68
+
69
+ async def __aexit__(
70
+ self,
71
+ exc_type: type[BaseException] | None = None,
72
+ exc_value: BaseException | None = None,
73
+ traceback: TracebackType | None = None,
74
+ ) -> None:
75
+ await self.aclose()
76
+
77
+ async def handle_async_request(
78
+ self,
79
+ request: Request,
80
+ ) -> Response:
81
+ raise NotImplementedError(
82
+ "The 'handle_async_request' method must be implemented."
83
+ ) # pragma: no cover
84
+
85
+ async def aclose(self) -> None:
86
+ pass
micromamba_root/envs/hf_sync/Lib/site-packages/httpx/_transports/default.py ADDED
@@ -0,0 +1,406 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Custom transports, with nicely configured defaults.
3
+
4
+ The following additional keyword arguments are currently supported by httpcore...
5
+
6
+ * uds: str
7
+ * local_address: str
8
+ * retries: int
9
+
10
+ Example usages...
11
+
12
+ # Disable HTTP/2 on a single specific domain.
13
+ mounts = {
14
+ "all://": httpx.HTTPTransport(http2=True),
15
+ "all://*example.org": httpx.HTTPTransport()
16
+ }
17
+
18
+ # Using advanced httpcore configuration, with connection retries.
19
+ transport = httpx.HTTPTransport(retries=1)
20
+ client = httpx.Client(transport=transport)
21
+
22
+ # Using advanced httpcore configuration, with unix domain sockets.
23
+ transport = httpx.HTTPTransport(uds="socket.uds")
24
+ client = httpx.Client(transport=transport)
25
+ """
26
+
27
+ from __future__ import annotations
28
+
29
+ import contextlib
30
+ import typing
31
+ from types import TracebackType
32
+
33
+ if typing.TYPE_CHECKING:
34
+ import ssl # pragma: no cover
35
+
36
+ import httpx # pragma: no cover
37
+
38
+ from .._config import DEFAULT_LIMITS, Limits, Proxy, create_ssl_context
39
+ from .._exceptions import (
40
+ ConnectError,
41
+ ConnectTimeout,
42
+ LocalProtocolError,
43
+ NetworkError,
44
+ PoolTimeout,
45
+ ProtocolError,
46
+ ProxyError,
47
+ ReadError,
48
+ ReadTimeout,
49
+ RemoteProtocolError,
50
+ TimeoutException,
51
+ UnsupportedProtocol,
52
+ WriteError,
53
+ WriteTimeout,
54
+ )
55
+ from .._models import Request, Response
56
+ from .._types import AsyncByteStream, CertTypes, ProxyTypes, SyncByteStream
57
+ from .._urls import URL
58
+ from .base import AsyncBaseTransport, BaseTransport
59
+
60
+ T = typing.TypeVar("T", bound="HTTPTransport")
61
+ A = typing.TypeVar("A", bound="AsyncHTTPTransport")
62
+
63
+ SOCKET_OPTION = typing.Union[
64
+ typing.Tuple[int, int, int],
65
+ typing.Tuple[int, int, typing.Union[bytes, bytearray]],
66
+ typing.Tuple[int, int, None, int],
67
+ ]
68
+
69
+ __all__ = ["AsyncHTTPTransport", "HTTPTransport"]
70
+
71
+ HTTPCORE_EXC_MAP: dict[type[Exception], type[httpx.HTTPError]] = {}
72
+
73
+
74
+ def _load_httpcore_exceptions() -> dict[type[Exception], type[httpx.HTTPError]]:
75
+ import httpcore
76
+
77
+ return {
78
+ httpcore.TimeoutException: TimeoutException,
79
+ httpcore.ConnectTimeout: ConnectTimeout,
80
+ httpcore.ReadTimeout: ReadTimeout,
81
+ httpcore.WriteTimeout: WriteTimeout,
82
+ httpcore.PoolTimeout: PoolTimeout,
83
+ httpcore.NetworkError: NetworkError,
84
+ httpcore.ConnectError: ConnectError,
85
+ httpcore.ReadError: ReadError,
86
+ httpcore.WriteError: WriteError,
87
+ httpcore.ProxyError: ProxyError,
88
+ httpcore.UnsupportedProtocol: UnsupportedProtocol,
89
+ httpcore.ProtocolError: ProtocolError,
90
+ httpcore.LocalProtocolError: LocalProtocolError,
91
+ httpcore.RemoteProtocolError: RemoteProtocolError,
92
+ }
93
+
94
+
95
+ @contextlib.contextmanager
96
+ def map_httpcore_exceptions() -> typing.Iterator[None]:
97
+ global HTTPCORE_EXC_MAP
98
+ if len(HTTPCORE_EXC_MAP) == 0:
99
+ HTTPCORE_EXC_MAP = _load_httpcore_exceptions()
100
+ try:
101
+ yield
102
+ except Exception as exc:
103
+ mapped_exc = None
104
+
105
+ for from_exc, to_exc in HTTPCORE_EXC_MAP.items():
106
+ if not isinstance(exc, from_exc):
107
+ continue
108
+ # We want to map to the most specific exception we can find.
109
+ # Eg if `exc` is an `httpcore.ReadTimeout`, we want to map to
110
+ # `httpx.ReadTimeout`, not just `httpx.TimeoutException`.
111
+ if mapped_exc is None or issubclass(to_exc, mapped_exc):
112
+ mapped_exc = to_exc
113
+
114
+ if mapped_exc is None: # pragma: no cover
115
+ raise
116
+
117
+ message = str(exc)
118
+ raise mapped_exc(message) from exc
119
+
120
+
121
+ class ResponseStream(SyncByteStream):
122
+ def __init__(self, httpcore_stream: typing.Iterable[bytes]) -> None:
123
+ self._httpcore_stream = httpcore_stream
124
+
125
+ def __iter__(self) -> typing.Iterator[bytes]:
126
+ with map_httpcore_exceptions():
127
+ for part in self._httpcore_stream:
128
+ yield part
129
+
130
+ def close(self) -> None:
131
+ if hasattr(self._httpcore_stream, "close"):
132
+ self._httpcore_stream.close()
133
+
134
+
135
+ class HTTPTransport(BaseTransport):
136
+ def __init__(
137
+ self,
138
+ verify: ssl.SSLContext | str | bool = True,
139
+ cert: CertTypes | None = None,
140
+ trust_env: bool = True,
141
+ http1: bool = True,
142
+ http2: bool = False,
143
+ limits: Limits = DEFAULT_LIMITS,
144
+ proxy: ProxyTypes | None = None,
145
+ uds: str | None = None,
146
+ local_address: str | None = None,
147
+ retries: int = 0,
148
+ socket_options: typing.Iterable[SOCKET_OPTION] | None = None,
149
+ ) -> None:
150
+ import httpcore
151
+
152
+ proxy = Proxy(url=proxy) if isinstance(proxy, (str, URL)) else proxy
153
+ ssl_context = create_ssl_context(verify=verify, cert=cert, trust_env=trust_env)
154
+
155
+ if proxy is None:
156
+ self._pool = httpcore.ConnectionPool(
157
+ ssl_context=ssl_context,
158
+ max_connections=limits.max_connections,
159
+ max_keepalive_connections=limits.max_keepalive_connections,
160
+ keepalive_expiry=limits.keepalive_expiry,
161
+ http1=http1,
162
+ http2=http2,
163
+ uds=uds,
164
+ local_address=local_address,
165
+ retries=retries,
166
+ socket_options=socket_options,
167
+ )
168
+ elif proxy.url.scheme in ("http", "https"):
169
+ self._pool = httpcore.HTTPProxy(
170
+ proxy_url=httpcore.URL(
171
+ scheme=proxy.url.raw_scheme,
172
+ host=proxy.url.raw_host,
173
+ port=proxy.url.port,
174
+ target=proxy.url.raw_path,
175
+ ),
176
+ proxy_auth=proxy.raw_auth,
177
+ proxy_headers=proxy.headers.raw,
178
+ ssl_context=ssl_context,
179
+ proxy_ssl_context=proxy.ssl_context,
180
+ max_connections=limits.max_connections,
181
+ max_keepalive_connections=limits.max_keepalive_connections,
182
+ keepalive_expiry=limits.keepalive_expiry,
183
+ http1=http1,
184
+ http2=http2,
185
+ socket_options=socket_options,
186
+ )
187
+ elif proxy.url.scheme in ("socks5", "socks5h"):
188
+ try:
189
+ import socksio # noqa
190
+ except ImportError: # pragma: no cover
191
+ raise ImportError(
192
+ "Using SOCKS proxy, but the 'socksio' package is not installed. "
193
+ "Make sure to install httpx using `pip install httpx[socks]`."
194
+ ) from None
195
+
196
+ self._pool = httpcore.SOCKSProxy(
197
+ proxy_url=httpcore.URL(
198
+ scheme=proxy.url.raw_scheme,
199
+ host=proxy.url.raw_host,
200
+ port=proxy.url.port,
201
+ target=proxy.url.raw_path,
202
+ ),
203
+ proxy_auth=proxy.raw_auth,
204
+ ssl_context=ssl_context,
205
+ max_connections=limits.max_connections,
206
+ max_keepalive_connections=limits.max_keepalive_connections,
207
+ keepalive_expiry=limits.keepalive_expiry,
208
+ http1=http1,
209
+ http2=http2,
210
+ )
211
+ else: # pragma: no cover
212
+ raise ValueError(
213
+ "Proxy protocol must be either 'http', 'https', 'socks5', or 'socks5h',"
214
+ f" but got {proxy.url.scheme!r}."
215
+ )
216
+
217
+ def __enter__(self: T) -> T: # Use generics for subclass support.
218
+ self._pool.__enter__()
219
+ return self
220
+
221
+ def __exit__(
222
+ self,
223
+ exc_type: type[BaseException] | None = None,
224
+ exc_value: BaseException | None = None,
225
+ traceback: TracebackType | None = None,
226
+ ) -> None:
227
+ with map_httpcore_exceptions():
228
+ self._pool.__exit__(exc_type, exc_value, traceback)
229
+
230
+ def handle_request(
231
+ self,
232
+ request: Request,
233
+ ) -> Response:
234
+ assert isinstance(request.stream, SyncByteStream)
235
+ import httpcore
236
+
237
+ req = httpcore.Request(
238
+ method=request.method,
239
+ url=httpcore.URL(
240
+ scheme=request.url.raw_scheme,
241
+ host=request.url.raw_host,
242
+ port=request.url.port,
243
+ target=request.url.raw_path,
244
+ ),
245
+ headers=request.headers.raw,
246
+ content=request.stream,
247
+ extensions=request.extensions,
248
+ )
249
+ with map_httpcore_exceptions():
250
+ resp = self._pool.handle_request(req)
251
+
252
+ assert isinstance(resp.stream, typing.Iterable)
253
+
254
+ return Response(
255
+ status_code=resp.status,
256
+ headers=resp.headers,
257
+ stream=ResponseStream(resp.stream),
258
+ extensions=resp.extensions,
259
+ )
260
+
261
+ def close(self) -> None:
262
+ self._pool.close()
263
+
264
+
265
+ class AsyncResponseStream(AsyncByteStream):
266
+ def __init__(self, httpcore_stream: typing.AsyncIterable[bytes]) -> None:
267
+ self._httpcore_stream = httpcore_stream
268
+
269
+ async def __aiter__(self) -> typing.AsyncIterator[bytes]:
270
+ with map_httpcore_exceptions():
271
+ async for part in self._httpcore_stream:
272
+ yield part
273
+
274
+ async def aclose(self) -> None:
275
+ if hasattr(self._httpcore_stream, "aclose"):
276
+ await self._httpcore_stream.aclose()
277
+
278
+
279
+ class AsyncHTTPTransport(AsyncBaseTransport):
280
+ def __init__(
281
+ self,
282
+ verify: ssl.SSLContext | str | bool = True,
283
+ cert: CertTypes | None = None,
284
+ trust_env: bool = True,
285
+ http1: bool = True,
286
+ http2: bool = False,
287
+ limits: Limits = DEFAULT_LIMITS,
288
+ proxy: ProxyTypes | None = None,
289
+ uds: str | None = None,
290
+ local_address: str | None = None,
291
+ retries: int = 0,
292
+ socket_options: typing.Iterable[SOCKET_OPTION] | None = None,
293
+ ) -> None:
294
+ import httpcore
295
+
296
+ proxy = Proxy(url=proxy) if isinstance(proxy, (str, URL)) else proxy
297
+ ssl_context = create_ssl_context(verify=verify, cert=cert, trust_env=trust_env)
298
+
299
+ if proxy is None:
300
+ self._pool = httpcore.AsyncConnectionPool(
301
+ ssl_context=ssl_context,
302
+ max_connections=limits.max_connections,
303
+ max_keepalive_connections=limits.max_keepalive_connections,
304
+ keepalive_expiry=limits.keepalive_expiry,
305
+ http1=http1,
306
+ http2=http2,
307
+ uds=uds,
308
+ local_address=local_address,
309
+ retries=retries,
310
+ socket_options=socket_options,
311
+ )
312
+ elif proxy.url.scheme in ("http", "https"):
313
+ self._pool = httpcore.AsyncHTTPProxy(
314
+ proxy_url=httpcore.URL(
315
+ scheme=proxy.url.raw_scheme,
316
+ host=proxy.url.raw_host,
317
+ port=proxy.url.port,
318
+ target=proxy.url.raw_path,
319
+ ),
320
+ proxy_auth=proxy.raw_auth,
321
+ proxy_headers=proxy.headers.raw,
322
+ proxy_ssl_context=proxy.ssl_context,
323
+ ssl_context=ssl_context,
324
+ max_connections=limits.max_connections,
325
+ max_keepalive_connections=limits.max_keepalive_connections,
326
+ keepalive_expiry=limits.keepalive_expiry,
327
+ http1=http1,
328
+ http2=http2,
329
+ socket_options=socket_options,
330
+ )
331
+ elif proxy.url.scheme in ("socks5", "socks5h"):
332
+ try:
333
+ import socksio # noqa
334
+ except ImportError: # pragma: no cover
335
+ raise ImportError(
336
+ "Using SOCKS proxy, but the 'socksio' package is not installed. "
337
+ "Make sure to install httpx using `pip install httpx[socks]`."
338
+ ) from None
339
+
340
+ self._pool = httpcore.AsyncSOCKSProxy(
341
+ proxy_url=httpcore.URL(
342
+ scheme=proxy.url.raw_scheme,
343
+ host=proxy.url.raw_host,
344
+ port=proxy.url.port,
345
+ target=proxy.url.raw_path,
346
+ ),
347
+ proxy_auth=proxy.raw_auth,
348
+ ssl_context=ssl_context,
349
+ max_connections=limits.max_connections,
350
+ max_keepalive_connections=limits.max_keepalive_connections,
351
+ keepalive_expiry=limits.keepalive_expiry,
352
+ http1=http1,
353
+ http2=http2,
354
+ )
355
+ else: # pragma: no cover
356
+ raise ValueError(
357
+ "Proxy protocol must be either 'http', 'https', 'socks5', or 'socks5h',"
358
+ " but got {proxy.url.scheme!r}."
359
+ )
360
+
361
+ async def __aenter__(self: A) -> A: # Use generics for subclass support.
362
+ await self._pool.__aenter__()
363
+ return self
364
+
365
+ async def __aexit__(
366
+ self,
367
+ exc_type: type[BaseException] | None = None,
368
+ exc_value: BaseException | None = None,
369
+ traceback: TracebackType | None = None,
370
+ ) -> None:
371
+ with map_httpcore_exceptions():
372
+ await self._pool.__aexit__(exc_type, exc_value, traceback)
373
+
374
+ async def handle_async_request(
375
+ self,
376
+ request: Request,
377
+ ) -> Response:
378
+ assert isinstance(request.stream, AsyncByteStream)
379
+ import httpcore
380
+
381
+ req = httpcore.Request(
382
+ method=request.method,
383
+ url=httpcore.URL(
384
+ scheme=request.url.raw_scheme,
385
+ host=request.url.raw_host,
386
+ port=request.url.port,
387
+ target=request.url.raw_path,
388
+ ),
389
+ headers=request.headers.raw,
390
+ content=request.stream,
391
+ extensions=request.extensions,
392
+ )
393
+ with map_httpcore_exceptions():
394
+ resp = await self._pool.handle_async_request(req)
395
+
396
+ assert isinstance(resp.stream, typing.AsyncIterable)
397
+
398
+ return Response(
399
+ status_code=resp.status,
400
+ headers=resp.headers,
401
+ stream=AsyncResponseStream(resp.stream),
402
+ extensions=resp.extensions,
403
+ )
404
+
405
+ async def aclose(self) -> None:
406
+ await self._pool.aclose()
micromamba_root/envs/hf_sync/Lib/site-packages/httpx/_transports/mock.py ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import typing
4
+
5
+ from .._models import Request, Response
6
+ from .base import AsyncBaseTransport, BaseTransport
7
+
8
+ SyncHandler = typing.Callable[[Request], Response]
9
+ AsyncHandler = typing.Callable[[Request], typing.Coroutine[None, None, Response]]
10
+
11
+
12
+ __all__ = ["MockTransport"]
13
+
14
+
15
+ class MockTransport(AsyncBaseTransport, BaseTransport):
16
+ def __init__(self, handler: SyncHandler | AsyncHandler) -> None:
17
+ self.handler = handler
18
+
19
+ def handle_request(
20
+ self,
21
+ request: Request,
22
+ ) -> Response:
23
+ request.read()
24
+ response = self.handler(request)
25
+ if not isinstance(response, Response): # pragma: no cover
26
+ raise TypeError("Cannot use an async handler in a sync Client")
27
+ return response
28
+
29
+ async def handle_async_request(
30
+ self,
31
+ request: Request,
32
+ ) -> Response:
33
+ await request.aread()
34
+ response = self.handler(request)
35
+
36
+ # Allow handler to *optionally* be an `async` function.
37
+ # If it is, then the `response` variable need to be awaited to actually
38
+ # return the result.
39
+
40
+ if not isinstance(response, Response):
41
+ response = await response
42
+
43
+ return response
micromamba_root/envs/hf_sync/Lib/site-packages/httpx/_transports/wsgi.py ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import io
4
+ import itertools
5
+ import sys
6
+ import typing
7
+
8
+ from .._models import Request, Response
9
+ from .._types import SyncByteStream
10
+ from .base import BaseTransport
11
+
12
+ if typing.TYPE_CHECKING:
13
+ from _typeshed import OptExcInfo # pragma: no cover
14
+ from _typeshed.wsgi import WSGIApplication # pragma: no cover
15
+
16
+ _T = typing.TypeVar("_T")
17
+
18
+
19
+ __all__ = ["WSGITransport"]
20
+
21
+
22
+ def _skip_leading_empty_chunks(body: typing.Iterable[_T]) -> typing.Iterable[_T]:
23
+ body = iter(body)
24
+ for chunk in body:
25
+ if chunk:
26
+ return itertools.chain([chunk], body)
27
+ return []
28
+
29
+
30
+ class WSGIByteStream(SyncByteStream):
31
+ def __init__(self, result: typing.Iterable[bytes]) -> None:
32
+ self._close = getattr(result, "close", None)
33
+ self._result = _skip_leading_empty_chunks(result)
34
+
35
+ def __iter__(self) -> typing.Iterator[bytes]:
36
+ for part in self._result:
37
+ yield part
38
+
39
+ def close(self) -> None:
40
+ if self._close is not None:
41
+ self._close()
42
+
43
+
44
+ class WSGITransport(BaseTransport):
45
+ """
46
+ A custom transport that handles sending requests directly to an WSGI app.
47
+ The simplest way to use this functionality is to use the `app` argument.
48
+
49
+ ```
50
+ client = httpx.Client(app=app)
51
+ ```
52
+
53
+ Alternatively, you can setup the transport instance explicitly.
54
+ This allows you to include any additional configuration arguments specific
55
+ to the WSGITransport class:
56
+
57
+ ```
58
+ transport = httpx.WSGITransport(
59
+ app=app,
60
+ script_name="/submount",
61
+ remote_addr="1.2.3.4"
62
+ )
63
+ client = httpx.Client(transport=transport)
64
+ ```
65
+
66
+ Arguments:
67
+
68
+ * `app` - The WSGI application.
69
+ * `raise_app_exceptions` - Boolean indicating if exceptions in the application
70
+ should be raised. Default to `True`. Can be set to `False` for use cases
71
+ such as testing the content of a client 500 response.
72
+ * `script_name` - The root path on which the WSGI application should be mounted.
73
+ * `remote_addr` - A string indicating the client IP of incoming requests.
74
+ ```
75
+ """
76
+
77
+ def __init__(
78
+ self,
79
+ app: WSGIApplication,
80
+ raise_app_exceptions: bool = True,
81
+ script_name: str = "",
82
+ remote_addr: str = "127.0.0.1",
83
+ wsgi_errors: typing.TextIO | None = None,
84
+ ) -> None:
85
+ self.app = app
86
+ self.raise_app_exceptions = raise_app_exceptions
87
+ self.script_name = script_name
88
+ self.remote_addr = remote_addr
89
+ self.wsgi_errors = wsgi_errors
90
+
91
+ def handle_request(self, request: Request) -> Response:
92
+ request.read()
93
+ wsgi_input = io.BytesIO(request.content)
94
+
95
+ port = request.url.port or {"http": 80, "https": 443}[request.url.scheme]
96
+ environ = {
97
+ "wsgi.version": (1, 0),
98
+ "wsgi.url_scheme": request.url.scheme,
99
+ "wsgi.input": wsgi_input,
100
+ "wsgi.errors": self.wsgi_errors or sys.stderr,
101
+ "wsgi.multithread": True,
102
+ "wsgi.multiprocess": False,
103
+ "wsgi.run_once": False,
104
+ "REQUEST_METHOD": request.method,
105
+ "SCRIPT_NAME": self.script_name,
106
+ "PATH_INFO": request.url.path,
107
+ "QUERY_STRING": request.url.query.decode("ascii"),
108
+ "SERVER_NAME": request.url.host,
109
+ "SERVER_PORT": str(port),
110
+ "SERVER_PROTOCOL": "HTTP/1.1",
111
+ "REMOTE_ADDR": self.remote_addr,
112
+ }
113
+ for header_key, header_value in request.headers.raw:
114
+ key = header_key.decode("ascii").upper().replace("-", "_")
115
+ if key not in ("CONTENT_TYPE", "CONTENT_LENGTH"):
116
+ key = "HTTP_" + key
117
+ environ[key] = header_value.decode("ascii")
118
+
119
+ seen_status = None
120
+ seen_response_headers = None
121
+ seen_exc_info = None
122
+
123
+ def start_response(
124
+ status: str,
125
+ response_headers: list[tuple[str, str]],
126
+ exc_info: OptExcInfo | None = None,
127
+ ) -> typing.Callable[[bytes], typing.Any]:
128
+ nonlocal seen_status, seen_response_headers, seen_exc_info
129
+ seen_status = status
130
+ seen_response_headers = response_headers
131
+ seen_exc_info = exc_info
132
+ return lambda _: None
133
+
134
+ result = self.app(environ, start_response)
135
+
136
+ stream = WSGIByteStream(result)
137
+
138
+ assert seen_status is not None
139
+ assert seen_response_headers is not None
140
+ if seen_exc_info and seen_exc_info[0] and self.raise_app_exceptions:
141
+ raise seen_exc_info[1]
142
+
143
+ status_code = int(seen_status.split()[0])
144
+ headers = [
145
+ (key.encode("ascii"), value.encode("ascii"))
146
+ for key, value in seen_response_headers
147
+ ]
148
+
149
+ return Response(status_code, headers=headers, stream=stream)
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub-1.14.0.dist-info/licenses/LICENSE ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/__init__.cpython-314.pyc ADDED
Binary file (40.2 kB). View file
 
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/_buckets.cpython-314.pyc ADDED
Binary file (56.2 kB). View file
 
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/_commit_api.cpython-314.pyc ADDED
Binary file (47.4 kB). View file
 
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/_commit_scheduler.cpython-314.pyc ADDED
Binary file (21.3 kB). View file
 
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/_dataset_viewer.cpython-314.pyc ADDED
Binary file (10.4 kB). View file
 
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/_eval_results.cpython-314.pyc ADDED
Binary file (9.8 kB). View file
 
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/_inference_endpoints.cpython-314.pyc ADDED
Binary file (22.2 kB). View file
 
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/_jobs_api.cpython-314.pyc ADDED
Binary file (22.8 kB). View file
 
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/_local_folder.cpython-314.pyc ADDED
Binary file (24.2 kB). View file
 
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/_login.cpython-314.pyc ADDED
Binary file (22.5 kB). View file
 
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/_oauth.cpython-314.pyc ADDED
Binary file (24 kB). View file
 
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/_snapshot_download.cpython-314.pyc ADDED
Binary file (23.8 kB). View file
 
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/_space_api.cpython-314.pyc ADDED
Binary file (18.1 kB). View file
 
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/_tensorboard_logger.cpython-314.pyc ADDED
Binary file (8.96 kB). View file
 
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/_upload_large_folder.cpython-314.pyc ADDED
Binary file (43.3 kB). View file
 
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/_webhooks_payload.cpython-314.pyc ADDED
Binary file (7.57 kB). View file
 
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/_webhooks_server.cpython-314.pyc ADDED
Binary file (19.8 kB). View file
 
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/community.cpython-314.pyc ADDED
Binary file (17.7 kB). View file
 
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/constants.cpython-314.pyc ADDED
Binary file (13.3 kB). View file
 
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/dataclasses.cpython-314.pyc ADDED
Binary file (34.5 kB). View file
 
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/errors.cpython-314.pyc ADDED
Binary file (24.1 kB). View file
 
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/fastai_utils.cpython-314.pyc ADDED
Binary file (19 kB). View file
 
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/file_download.cpython-314.pyc ADDED
Binary file (82.7 kB). View file
 
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/hf_file_system.cpython-314.pyc ADDED
Binary file (73.3 kB). View file
 
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/hub_mixin.cpython-314.pyc ADDED
Binary file (41.4 kB). View file
 
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/lfs.cpython-314.pyc ADDED
Binary file (19.8 kB). View file
 
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/repocard.cpython-314.pyc ADDED
Binary file (36.9 kB). View file
 
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/__pycache__/repocard_data.cpython-314.pyc ADDED
Binary file (39.8 kB). View file
 
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/_hot_reload/__init__.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2026 The HuggingFace Team. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/_hot_reload/__pycache__/__init__.cpython-314.pyc ADDED
Binary file (156 Bytes). View file
 
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/_hot_reload/__pycache__/client.cpython-314.pyc ADDED
Binary file (7.15 kB). View file
 
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/_hot_reload/__pycache__/sse_client.cpython-314.pyc ADDED
Binary file (6.07 kB). View file
 
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/_hot_reload/__pycache__/types.cpython-314.pyc ADDED
Binary file (8.7 kB). View file
 
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/_hot_reload/client.py ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2026 The HuggingFace Team. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+
16
+ import json
17
+ import time
18
+ from collections import deque
19
+ from collections.abc import Iterator
20
+ from typing import Literal, TypedDict
21
+
22
+ import httpx
23
+
24
+ from ..utils._headers import build_hf_headers
25
+ from ..utils._http import hf_raise_for_status
26
+ from .sse_client import SSEClient
27
+ from .types import ApiGetReloadEventSourceData, ApiGetReloadRequest
28
+
29
+
30
+ HOT_RELOADING_PORT = 7887
31
+ CLIENT_TIMEOUT = 20
32
+
33
+
34
+ class MultiReplicaStreamWarning(TypedDict):
35
+ kind: Literal["warning"]
36
+ message: str
37
+
38
+
39
+ class MultiReplicaStreamEvent(TypedDict):
40
+ kind: Literal["event"]
41
+ event: ApiGetReloadEventSourceData
42
+
43
+
44
+ class MultiReplicaStreamReplicaHash(TypedDict):
45
+ kind: Literal["replicaHash"]
46
+ hash: str
47
+
48
+
49
+ class MultiReplicaStreamFullMatch(TypedDict):
50
+ kind: Literal["fullMatch"]
51
+
52
+
53
+ class ReloadClient:
54
+ def __init__(
55
+ self,
56
+ *,
57
+ host: str,
58
+ subdomain: str,
59
+ replica_hash: str,
60
+ token: str | None,
61
+ ):
62
+ base_host = host.replace(subdomain, f"{subdomain}--{HOT_RELOADING_PORT}")
63
+ self.replica_hash = replica_hash
64
+ self.client = httpx.Client(
65
+ base_url=f"{base_host}/--replicas/+{replica_hash}",
66
+ headers=build_hf_headers(token=token),
67
+ timeout=CLIENT_TIMEOUT,
68
+ )
69
+
70
+ def get_reload(self, reload_id: str) -> Iterator[ApiGetReloadEventSourceData] | int:
71
+ req = ApiGetReloadRequest(reloadId=reload_id)
72
+ with self.client.stream("POST", "/get-reload", json=req) as res:
73
+ if res.status_code != 200:
74
+ return res.status_code
75
+ hf_raise_for_status(res)
76
+ for event in SSEClient(res.iter_bytes()).events():
77
+ if event.event == "message":
78
+ yield json.loads(event.data)
79
+ return None
80
+
81
+
82
+ def multi_replica_reload_events(
83
+ commit_sha: str,
84
+ host: str,
85
+ subdomain: str,
86
+ replica_hashes: list[str],
87
+ token: str | None,
88
+ max_retries: int = 10,
89
+ ) -> Iterator[
90
+ MultiReplicaStreamWarning | MultiReplicaStreamEvent | MultiReplicaStreamReplicaHash | MultiReplicaStreamFullMatch
91
+ ]:
92
+ clients = [
93
+ ReloadClient(
94
+ host=host,
95
+ subdomain=subdomain,
96
+ replica_hash=hash,
97
+ token=token,
98
+ )
99
+ for hash in replica_hashes
100
+ ]
101
+
102
+ first_client_events: dict[int, ApiGetReloadEventSourceData] = {}
103
+ for client_index, client in enumerate(clients):
104
+ if len(clients) > 1:
105
+ yield {"kind": "replicaHash", "hash": client.replica_hash}
106
+
107
+ retries = 0
108
+ while isinstance((events := client.get_reload(commit_sha)), int):
109
+ if (retries := retries + 1) > max_retries:
110
+ raise Exception("Too many retries reached")
111
+ if (status_code := events) not in (200, 204):
112
+ raise Exception(f"Unexpected {status_code=} on `ReloadClient.get_reload`")
113
+ subject = "reloadId" if status_code == 204 else "replica"
114
+ yield {"kind": "warning", "message": f"Retrying on unexpected {subject} not found"}
115
+ time.sleep(2)
116
+
117
+ full_match = True
118
+ replay: deque[ApiGetReloadEventSourceData] = deque()
119
+ for event_index, event in enumerate(events):
120
+ if client_index == 0:
121
+ first_client_events[event_index] = event
122
+ elif full_match := full_match and first_client_events.get(event_index) == event:
123
+ replay.append(event)
124
+ continue
125
+ while replay:
126
+ yield {"kind": "event", "event": replay.popleft()}
127
+ yield {"kind": "event", "event": event}
128
+
129
+ if client_index > 0 and full_match:
130
+ yield {"kind": "fullMatch"}
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/_hot_reload/sse_client.py ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Vendored file: Server Side Events (SSE) client for Python.
3
+
4
+ Source:
5
+ - Author: Maxime Petazzoni <maxime.petazzoni@bulix.org>
6
+ - Repository: https://github.com/mpetazzoni/sseclient
7
+ - File: https://github.com/mpetazzoni/sseclient/blob/main/sseclient/__init__.py
8
+
9
+ License:
10
+ - Apache-2.0 (from upstream project)
11
+
12
+ Provides a generator of SSE received through an existing HTTP response.
13
+ """
14
+
15
+ import logging
16
+
17
+ __author__ = 'Maxime Petazzoni <maxime.petazzoni@bulix.org>'
18
+ __email__ = 'maxime.petazzoni@bulix.org'
19
+ __all__ = ['SSEClient']
20
+
21
+ _FIELD_SEPARATOR = ':'
22
+
23
+
24
+ class SSEClient:
25
+ """Implementation of a SSE client.
26
+
27
+ See http://www.w3.org/TR/2009/WD-eventsource-20091029/ for the
28
+ specification.
29
+ """
30
+
31
+ def __init__(self, event_source, char_enc='utf-8'):
32
+ """Initialize the SSE client over an existing, ready to consume
33
+ event source.
34
+
35
+ The event source is expected to be a binary stream and have a close()
36
+ method. That would usually be something that implements
37
+ io.BinaryIOBase, like an httplib or urllib3 HTTPResponse object.
38
+ """
39
+ self._logger = logging.getLogger(self.__class__.__module__)
40
+ self._logger.debug('Initialized SSE client from event source %s',
41
+ event_source)
42
+ self._event_source = event_source
43
+ self._char_enc = char_enc
44
+
45
+ def _read(self):
46
+ """Read the incoming event source stream and yield event chunks.
47
+
48
+ Unfortunately it is possible for some servers to decide to break an
49
+ event into multiple HTTP chunks in the response. It is thus necessary
50
+ to correctly stitch together consecutive response chunks and find the
51
+ SSE delimiter (empty new line) to yield full, correct event chunks."""
52
+ data = b''
53
+ for chunk in self._event_source:
54
+ for line in chunk.splitlines(True):
55
+ data += line
56
+ if data.endswith((b'\r\r', b'\n\n', b'\r\n\r\n')):
57
+ yield data
58
+ data = b''
59
+ if data:
60
+ yield data
61
+
62
+ def events(self):
63
+ for chunk in self._read():
64
+ event = Event()
65
+ # Split before decoding so splitlines() only uses \r and \n
66
+ for line in chunk.splitlines():
67
+ # Decode the line.
68
+ line = line.decode(self._char_enc)
69
+
70
+ # Lines starting with a separator are comments and are to be
71
+ # ignored.
72
+ if not line.strip() or line.startswith(_FIELD_SEPARATOR):
73
+ continue
74
+
75
+ data = line.split(_FIELD_SEPARATOR, 1)
76
+ field = data[0]
77
+
78
+ # Ignore unknown fields.
79
+ if field not in event.__dict__:
80
+ self._logger.debug('Saw invalid field %s while parsing '
81
+ 'Server Side Event', field)
82
+ continue
83
+
84
+ if len(data) > 1:
85
+ # From the spec:
86
+ # "If value starts with a single U+0020 SPACE character,
87
+ # remove it from value."
88
+ if data[1].startswith(' '):
89
+ value = data[1][1:]
90
+ else:
91
+ value = data[1]
92
+ else:
93
+ # If no value is present after the separator,
94
+ # assume an empty value.
95
+ value = ''
96
+
97
+ # The data field may come over multiple lines and their values
98
+ # are concatenated with each other.
99
+ if field == 'data':
100
+ event.__dict__[field] += value + '\n'
101
+ else:
102
+ event.__dict__[field] = value
103
+
104
+ # Events with no data are not dispatched.
105
+ if not event.data:
106
+ continue
107
+
108
+ # If the data field ends with a newline, remove it.
109
+ if event.data.endswith('\n'):
110
+ event.data = event.data[0:-1]
111
+
112
+ # Empty event names default to 'message'
113
+ event.event = event.event or 'message'
114
+
115
+ # Dispatch the event
116
+ self._logger.debug('Dispatching %s...', event)
117
+ yield event
118
+
119
+ def close(self):
120
+ """Manually close the event source stream."""
121
+ self._event_source.close()
122
+
123
+
124
+ class Event:
125
+ """Representation of an event from the event stream."""
126
+
127
+ def __init__(self, id=None, event='message', data='', retry=None):
128
+ self.id = id
129
+ self.event = event
130
+ self.data = data
131
+ self.retry = retry
132
+
133
+ def __str__(self):
134
+ s = f'{self.event} event'
135
+ if self.id:
136
+ s += f' #{self.id}'
137
+ if self.data:
138
+ s += ', {} byte{}'.format(len(self.data),
139
+ 's' if len(self.data) else '')
140
+ else:
141
+ s += ', no data'
142
+ if self.retry:
143
+ s += f', retry in {self.retry}ms'
144
+ return s
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/_hot_reload/types.py ADDED
@@ -0,0 +1,121 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2026 The HuggingFace Team. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+
16
+ from typing import Literal, TypedDict
17
+
18
+ from typing_extensions import NotRequired
19
+
20
+
21
+ class ReloadRegion(TypedDict):
22
+ startLine: int
23
+ startCol: int
24
+ endLine: int
25
+ endCol: int
26
+
27
+
28
+ class ReloadOperationObject(TypedDict):
29
+ kind: Literal["add", "update", "delete"]
30
+ region: ReloadRegion
31
+ objectType: str
32
+ objectName: str
33
+
34
+
35
+ class ReloadOperationRun(TypedDict):
36
+ kind: Literal["run"]
37
+ region: ReloadRegion
38
+ codeLines: str
39
+ stdout: NotRequired[str]
40
+ stderr: NotRequired[str]
41
+
42
+
43
+ class ReloadOperationException(TypedDict):
44
+ kind: Literal["exception"]
45
+ region: ReloadRegion
46
+ traceback: str
47
+
48
+
49
+ class ReloadOperationError(TypedDict):
50
+ kind: Literal["error"]
51
+ traceback: str
52
+
53
+
54
+ class ReloadOperationUI(TypedDict):
55
+ kind: Literal["ui"]
56
+ updated: bool
57
+
58
+
59
+ class ReloadOperationFile(TypedDict):
60
+ kind: Literal["file"]
61
+ created: bool
62
+
63
+
64
+ class ApiCreateReloadRequest(TypedDict):
65
+ filepath: str
66
+ contents: str
67
+ reloadId: NotRequired[str]
68
+
69
+
70
+ class ApiCreateReloadResponseSuccess(TypedDict):
71
+ status: Literal["created"]
72
+ reloadId: str
73
+
74
+
75
+ class ApiCreateReloadResponseError(TypedDict):
76
+ status: Literal["alreadyReloading", "fileNotFound"]
77
+
78
+
79
+ class ApiCreateReloadResponse(TypedDict):
80
+ res: ApiCreateReloadResponseError | ApiCreateReloadResponseSuccess
81
+
82
+
83
+ class ApiGetReloadRequest(TypedDict):
84
+ reloadId: str
85
+
86
+
87
+ class ApiGetReloadEventSourceData(TypedDict):
88
+ data: (
89
+ ReloadOperationError
90
+ | ReloadOperationException
91
+ | ReloadOperationObject
92
+ | ReloadOperationRun
93
+ | ReloadOperationUI
94
+ | ReloadOperationFile
95
+ )
96
+
97
+
98
+ class ApiGetStatusRequest(TypedDict):
99
+ revision: str
100
+
101
+
102
+ class ApiGetStatusResponse(TypedDict):
103
+ reloading: bool
104
+ uncommited: list[str]
105
+
106
+
107
+ class ApiFetchContentsRequest(TypedDict):
108
+ filepath: str
109
+
110
+
111
+ class ApiFetchContentsResponseError(TypedDict):
112
+ status: Literal["fileNotFound"]
113
+
114
+
115
+ class ApiFetchContentsResponseSuccess(TypedDict):
116
+ status: Literal["ok"]
117
+ contents: str
118
+
119
+
120
+ class ApiFetchContentsResponse(TypedDict):
121
+ res: ApiFetchContentsResponseError | ApiFetchContentsResponseSuccess
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/cli/__init__.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright 2025 The HuggingFace Team. All rights reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/cli/__pycache__/__init__.cpython-314.pyc ADDED
Binary file (148 Bytes). View file
 
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/cli/__pycache__/_cli_utils.cpython-314.pyc ADDED
Binary file (66.8 kB). View file
 
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/cli/__pycache__/_errors.cpython-314.pyc ADDED
Binary file (6.97 kB). View file
 
micromamba_root/envs/hf_sync/Lib/site-packages/huggingface_hub/cli/__pycache__/_file_listing.cpython-314.pyc ADDED
Binary file (10.7 kB). View file