ZTWHHH commited on
Commit
c16591b
·
verified ·
1 Parent(s): 5c04d0b

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. vllm/lib/python3.10/site-packages/PyOpenGL-3.1.0.dist-info/INSTALLER +1 -0
  2. vllm/lib/python3.10/site-packages/PyOpenGL-3.1.0.dist-info/METADATA +24 -0
  3. vllm/lib/python3.10/site-packages/PyOpenGL-3.1.0.dist-info/RECORD +0 -0
  4. vllm/lib/python3.10/site-packages/PyOpenGL-3.1.0.dist-info/REQUESTED +0 -0
  5. vllm/lib/python3.10/site-packages/PyOpenGL-3.1.0.dist-info/WHEEL +5 -0
  6. vllm/lib/python3.10/site-packages/PyOpenGL-3.1.0.dist-info/top_level.txt +1 -0
  7. vllm/lib/python3.10/site-packages/async_timeout-5.0.1.dist-info/INSTALLER +1 -0
  8. vllm/lib/python3.10/site-packages/async_timeout-5.0.1.dist-info/METADATA +163 -0
  9. vllm/lib/python3.10/site-packages/async_timeout-5.0.1.dist-info/WHEEL +5 -0
  10. vllm/lib/python3.10/site-packages/async_timeout-5.0.1.dist-info/top_level.txt +1 -0
  11. vllm/lib/python3.10/site-packages/rich_toolkit/__init__.py +3 -0
  12. vllm/lib/python3.10/site-packages/rich_toolkit/__pycache__/__init__.cpython-310.pyc +0 -0
  13. vllm/lib/python3.10/site-packages/rich_toolkit/__pycache__/input.cpython-310.pyc +0 -0
  14. vllm/lib/python3.10/site-packages/rich_toolkit/__pycache__/menu.cpython-310.pyc +0 -0
  15. vllm/lib/python3.10/site-packages/rich_toolkit/__pycache__/progress.cpython-310.pyc +0 -0
  16. vllm/lib/python3.10/site-packages/rich_toolkit/__pycache__/toolkit.cpython-310.pyc +0 -0
  17. vllm/lib/python3.10/site-packages/rich_toolkit/input.py +192 -0
  18. vllm/lib/python3.10/site-packages/rich_toolkit/menu.py +302 -0
  19. vllm/lib/python3.10/site-packages/rich_toolkit/progress.py +86 -0
  20. vllm/lib/python3.10/site-packages/rich_toolkit/py.typed +0 -0
  21. vllm/lib/python3.10/site-packages/rich_toolkit/styles/__init__.py +9 -0
  22. vllm/lib/python3.10/site-packages/rich_toolkit/styles/__pycache__/__init__.cpython-310.pyc +0 -0
  23. vllm/lib/python3.10/site-packages/rich_toolkit/styles/__pycache__/base.cpython-310.pyc +0 -0
  24. vllm/lib/python3.10/site-packages/rich_toolkit/styles/__pycache__/fancy.cpython-310.pyc +0 -0
  25. vllm/lib/python3.10/site-packages/rich_toolkit/styles/__pycache__/minimal.cpython-310.pyc +0 -0
  26. vllm/lib/python3.10/site-packages/rich_toolkit/styles/__pycache__/tagged.cpython-310.pyc +0 -0
  27. vllm/lib/python3.10/site-packages/rich_toolkit/styles/base.py +144 -0
  28. vllm/lib/python3.10/site-packages/rich_toolkit/styles/fancy.py +63 -0
  29. vllm/lib/python3.10/site-packages/rich_toolkit/styles/minimal.py +59 -0
  30. vllm/lib/python3.10/site-packages/rich_toolkit/styles/tagged.py +100 -0
  31. vllm/lib/python3.10/site-packages/rich_toolkit/toolkit.py +118 -0
  32. vllm/lib/python3.10/site-packages/rich_toolkit/utils/__init__.py +0 -0
  33. vllm/lib/python3.10/site-packages/rich_toolkit/utils/__pycache__/__init__.cpython-310.pyc +0 -0
  34. vllm/lib/python3.10/site-packages/rich_toolkit/utils/__pycache__/colors.cpython-310.pyc +0 -0
  35. vllm/lib/python3.10/site-packages/rich_toolkit/utils/colors.py +14 -0
  36. vllm/lib/python3.10/site-packages/tiktoken_ext/__pycache__/openai_public.cpython-310.pyc +0 -0
  37. vllm/lib/python3.10/site-packages/tiktoken_ext/openai_public.py +127 -0
  38. vllm/lib/python3.10/site-packages/wheel/__pycache__/_setuptools_logging.cpython-310.pyc +0 -0
  39. vllm/lib/python3.10/site-packages/wheel/__pycache__/util.cpython-310.pyc +0 -0
  40. vllm/lib/python3.10/site-packages/wheel/cli/__init__.py +155 -0
  41. vllm/lib/python3.10/site-packages/wheel/cli/__pycache__/__init__.cpython-310.pyc +0 -0
  42. vllm/lib/python3.10/site-packages/wheel/cli/__pycache__/convert.cpython-310.pyc +0 -0
  43. vllm/lib/python3.10/site-packages/wheel/cli/__pycache__/pack.cpython-310.pyc +0 -0
  44. vllm/lib/python3.10/site-packages/wheel/cli/__pycache__/tags.cpython-310.pyc +0 -0
  45. vllm/lib/python3.10/site-packages/wheel/cli/__pycache__/unpack.cpython-310.pyc +0 -0
  46. vllm/lib/python3.10/site-packages/wheel/cli/convert.py +273 -0
  47. vllm/lib/python3.10/site-packages/wheel/cli/pack.py +85 -0
  48. vllm/lib/python3.10/site-packages/wheel/cli/tags.py +139 -0
  49. vllm/lib/python3.10/site-packages/wheel/cli/unpack.py +30 -0
  50. vllm/lib/python3.10/site-packages/wheel/vendored/packaging/__pycache__/__init__.cpython-310.pyc +0 -0
vllm/lib/python3.10/site-packages/PyOpenGL-3.1.0.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ pip
vllm/lib/python3.10/site-packages/PyOpenGL-3.1.0.dist-info/METADATA ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.2
2
+ Name: PyOpenGL
3
+ Version: 3.1.0
4
+ Summary: Standard OpenGL bindings for Python
5
+ Home-page: http://pyopengl.sourceforge.net
6
+ Download-URL: http://sourceforge.net/projects/pyopengl/files/PyOpenGL/
7
+ Author: Mike C. Fletcher
8
+ Author-email: mcfletch@vrplumber.com
9
+ License: BSD
10
+ Keywords: Graphics,3D,OpenGL,GLU,GLUT,GLE,GLX,EXT,ARB,Mesa,ctypes
11
+ Classifier: License :: OSI Approved :: BSD License
12
+ Classifier: Programming Language :: Python
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Topic :: Multimedia :: Graphics :: 3D Rendering
15
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
16
+ Classifier: Intended Audience :: Developers
17
+ Dynamic: author
18
+ Dynamic: author-email
19
+ Dynamic: classifier
20
+ Dynamic: download-url
21
+ Dynamic: home-page
22
+ Dynamic: keywords
23
+ Dynamic: license
24
+ Dynamic: summary
vllm/lib/python3.10/site-packages/PyOpenGL-3.1.0.dist-info/RECORD ADDED
The diff for this file is too large to render. See raw diff
 
vllm/lib/python3.10/site-packages/PyOpenGL-3.1.0.dist-info/REQUESTED ADDED
File without changes
vllm/lib/python3.10/site-packages/PyOpenGL-3.1.0.dist-info/WHEEL ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (75.8.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
vllm/lib/python3.10/site-packages/PyOpenGL-3.1.0.dist-info/top_level.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ OpenGL
vllm/lib/python3.10/site-packages/async_timeout-5.0.1.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ pip
vllm/lib/python3.10/site-packages/async_timeout-5.0.1.dist-info/METADATA ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.1
2
+ Name: async-timeout
3
+ Version: 5.0.1
4
+ Summary: Timeout context manager for asyncio programs
5
+ Home-page: https://github.com/aio-libs/async-timeout
6
+ Author: Andrew Svetlov <andrew.svetlov@gmail.com>
7
+ Author-email: andrew.svetlov@gmail.com
8
+ License: Apache 2
9
+ Project-URL: Chat: Gitter, https://gitter.im/aio-libs/Lobby
10
+ Project-URL: CI: GitHub Actions, https://github.com/aio-libs/async-timeout/actions
11
+ Project-URL: Coverage: codecov, https://codecov.io/github/aio-libs/async-timeout
12
+ Project-URL: GitHub: issues, https://github.com/aio-libs/async-timeout/issues
13
+ Project-URL: GitHub: repo, https://github.com/aio-libs/async-timeout
14
+ Classifier: Development Status :: 5 - Production/Stable
15
+ Classifier: Topic :: Software Development :: Libraries
16
+ Classifier: Framework :: AsyncIO
17
+ Classifier: Intended Audience :: Developers
18
+ Classifier: License :: OSI Approved :: Apache Software License
19
+ Classifier: Programming Language :: Python
20
+ Classifier: Programming Language :: Python :: 3
21
+ Classifier: Programming Language :: Python :: 3 :: Only
22
+ Requires-Python: >=3.8
23
+ Description-Content-Type: text/x-rst
24
+ License-File: LICENSE
25
+
26
+ async-timeout
27
+ =============
28
+ .. image:: https://travis-ci.com/aio-libs/async-timeout.svg?branch=master
29
+ :target: https://travis-ci.com/aio-libs/async-timeout
30
+ .. image:: https://codecov.io/gh/aio-libs/async-timeout/branch/master/graph/badge.svg
31
+ :target: https://codecov.io/gh/aio-libs/async-timeout
32
+ .. image:: https://img.shields.io/pypi/v/async-timeout.svg
33
+ :target: https://pypi.python.org/pypi/async-timeout
34
+ .. image:: https://badges.gitter.im/Join%20Chat.svg
35
+ :target: https://gitter.im/aio-libs/Lobby
36
+ :alt: Chat on Gitter
37
+
38
+ asyncio-compatible timeout context manager.
39
+
40
+
41
+
42
+ DEPRECATED
43
+ ----------
44
+
45
+ This library has effectively been upstreamed into Python 3.11+.
46
+
47
+ Therefore this library is considered deprecated and no longer actively supported.
48
+
49
+ Version 5.0+ provides dual-mode when executed on Python 3.11+:
50
+ ``asyncio_timeout.Timeout`` is fully compatible with ``asyncio.Timeout`` *and* old
51
+ versions of the library.
52
+
53
+ Anyway, using upstream is highly recommended. ``asyncio_timeout`` exists only for the
54
+ sake of backward compatibility, easy supporting both old and new Python by the same
55
+ code, and easy misgration.
56
+
57
+ If rescheduling API is not important and only ``async with timeout(...): ...`` functionality is required,
58
+ a user could apply conditional import::
59
+
60
+ if sys.version_info >= (3, 11):
61
+ from asyncio import timeout, timeout_at
62
+ else:
63
+ from async_timeout import timeout, timeout_at
64
+
65
+
66
+ Usage example
67
+ -------------
68
+
69
+
70
+ The context manager is useful in cases when you want to apply timeout
71
+ logic around block of code or in cases when ``asyncio.wait_for()`` is
72
+ not suitable. Also it's much faster than ``asyncio.wait_for()``
73
+ because ``timeout`` doesn't create a new task.
74
+
75
+ The ``timeout(delay, *, loop=None)`` call returns a context manager
76
+ that cancels a block on *timeout* expiring::
77
+
78
+ from async_timeout import timeout
79
+ async with timeout(1.5):
80
+ await inner()
81
+
82
+ 1. If ``inner()`` is executed faster than in ``1.5`` seconds nothing
83
+ happens.
84
+ 2. Otherwise ``inner()`` is cancelled internally by sending
85
+ ``asyncio.CancelledError`` into but ``asyncio.TimeoutError`` is
86
+ raised outside of context manager scope.
87
+
88
+ *timeout* parameter could be ``None`` for skipping timeout functionality.
89
+
90
+
91
+ Alternatively, ``timeout_at(when)`` can be used for scheduling
92
+ at the absolute time::
93
+
94
+ loop = asyncio.get_event_loop()
95
+ now = loop.time()
96
+
97
+ async with timeout_at(now + 1.5):
98
+ await inner()
99
+
100
+
101
+ Please note: it is not POSIX time but a time with
102
+ undefined starting base, e.g. the time of the system power on.
103
+
104
+
105
+ Context manager has ``.expired()`` / ``.expired`` for check if timeout happens
106
+ exactly in context manager::
107
+
108
+ async with timeout(1.5) as cm:
109
+ await inner()
110
+ print(cm.expired()) # recommended api
111
+ print(cm.expired) # compatible api
112
+
113
+ The property is ``True`` if ``inner()`` execution is cancelled by
114
+ timeout context manager.
115
+
116
+ If ``inner()`` call explicitly raises ``TimeoutError`` ``cm.expired``
117
+ is ``False``.
118
+
119
+ The scheduled deadline time is available as ``.when()`` / ``.deadline``::
120
+
121
+ async with timeout(1.5) as cm:
122
+ cm.when() # recommended api
123
+ cm.deadline # compatible api
124
+
125
+ Not finished yet timeout can be rescheduled by ``shift()``
126
+ or ``update()`` methods::
127
+
128
+ async with timeout(1.5) as cm:
129
+ # recommended api
130
+ cm.reschedule(cm.when() + 1) # add another second on waiting
131
+ # compatible api
132
+ cm.shift(1) # add another second on waiting
133
+ cm.update(loop.time() + 5) # reschedule to now+5 seconds
134
+
135
+ Rescheduling is forbidden if the timeout is expired or after exit from ``async with``
136
+ code block.
137
+
138
+
139
+ Disable scheduled timeout::
140
+
141
+ async with timeout(1.5) as cm:
142
+ cm.reschedule(None) # recommended api
143
+ cm.reject() # compatible api
144
+
145
+
146
+
147
+ Installation
148
+ ------------
149
+
150
+ ::
151
+
152
+ $ pip install async-timeout
153
+
154
+ The library is Python 3 only!
155
+
156
+
157
+
158
+ Authors and License
159
+ -------------------
160
+
161
+ The module is written by Andrew Svetlov.
162
+
163
+ It's *Apache 2* licensed and freely available.
vllm/lib/python3.10/site-packages/async_timeout-5.0.1.dist-info/WHEEL ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (75.3.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
vllm/lib/python3.10/site-packages/async_timeout-5.0.1.dist-info/top_level.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ async_timeout
vllm/lib/python3.10/site-packages/rich_toolkit/__init__.py ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ from .toolkit import RichToolkit, RichToolkitTheme
2
+
3
+ __all__ = ["RichToolkit", "RichToolkitTheme"]
vllm/lib/python3.10/site-packages/rich_toolkit/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (261 Bytes). View file
 
vllm/lib/python3.10/site-packages/rich_toolkit/__pycache__/input.cpython-310.pyc ADDED
Binary file (5.97 kB). View file
 
vllm/lib/python3.10/site-packages/rich_toolkit/__pycache__/menu.cpython-310.pyc ADDED
Binary file (7.58 kB). View file
 
vllm/lib/python3.10/site-packages/rich_toolkit/__pycache__/progress.cpython-310.pyc ADDED
Binary file (2.47 kB). View file
 
vllm/lib/python3.10/site-packages/rich_toolkit/__pycache__/toolkit.cpython-310.pyc ADDED
Binary file (4.06 kB). View file
 
vllm/lib/python3.10/site-packages/rich_toolkit/input.py ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import string
2
+ from typing import Any, Optional, Tuple
3
+ from abc import ABC, abstractmethod
4
+
5
+ import click
6
+ from rich.console import Console, Group, RenderableType
7
+ from rich.control import Control
8
+ from rich.live_render import LiveRender
9
+
10
+ from rich_toolkit.styles.base import BaseStyle
11
+
12
+
13
+ class TextInputHandler:
14
+ DOWN_KEY = "\x1b[B"
15
+ UP_KEY = "\x1b[A"
16
+ LEFT_KEY = "\x1b[D"
17
+ RIGHT_KEY = "\x1b[C"
18
+ BACKSPACE_KEY = "\x7f"
19
+ DELETE_KEY = "\x1b[3~"
20
+
21
+ def __init__(self, cursor_offset: int = 0):
22
+ self.text = ""
23
+ self.cursor_position = 0
24
+ self._cursor_offset = cursor_offset
25
+
26
+ def _move_cursor_left(self) -> None:
27
+ self.cursor_position = max(0, self.cursor_position - 1)
28
+
29
+ def _move_cursor_right(self) -> None:
30
+ self.cursor_position = min(len(self.text), self.cursor_position + 1)
31
+
32
+ def _insert_char(self, char: str) -> None:
33
+ self.text = (
34
+ self.text[: self.cursor_position] + char + self.text[self.cursor_position :]
35
+ )
36
+ self._move_cursor_right()
37
+
38
+ def _delete_char(self) -> None:
39
+ if self.cursor_position == 0:
40
+ return
41
+
42
+ self.text = (
43
+ self.text[: self.cursor_position - 1] + self.text[self.cursor_position :]
44
+ )
45
+ self._move_cursor_left()
46
+
47
+ def _delete_forward(self) -> None:
48
+ if self.cursor_position == len(self.text):
49
+ return
50
+
51
+ self.text = (
52
+ self.text[: self.cursor_position] + self.text[self.cursor_position + 1 :]
53
+ )
54
+
55
+ def update_text(self, text: str) -> None:
56
+ if text == self.BACKSPACE_KEY:
57
+ self._delete_char()
58
+ elif text == self.DELETE_KEY:
59
+ self._delete_forward()
60
+ elif text == self.LEFT_KEY:
61
+ self._move_cursor_left()
62
+ elif text == self.RIGHT_KEY:
63
+ self.cursor_position = min(len(self.text), self.cursor_position + 1)
64
+ elif text in (self.UP_KEY, self.DOWN_KEY):
65
+ pass
66
+ else:
67
+ for char in text:
68
+ if char in string.printable:
69
+ self._insert_char(char)
70
+
71
+ def fix_cursor(self) -> Tuple[Control, ...]:
72
+ return (Control.move_to_column(self._cursor_offset + self.cursor_position),)
73
+
74
+
75
+ class LiveInput(ABC, TextInputHandler):
76
+ def __init__(
77
+ self,
78
+ console: Console,
79
+ style: Optional[BaseStyle] = None,
80
+ cursor_offset: int = 0,
81
+ **metadata: Any,
82
+ ):
83
+ self.console = console
84
+ self._live_render = LiveRender("")
85
+
86
+ if style is None:
87
+ self._live_render = LiveRender("")
88
+ else:
89
+ self._live_render = style.decorate_class(LiveRender, **metadata)("")
90
+
91
+ self._padding_bottom = 1
92
+
93
+ super().__init__(cursor_offset=cursor_offset)
94
+
95
+ @abstractmethod
96
+ def render_result(self) -> RenderableType:
97
+ raise NotImplementedError
98
+
99
+ @abstractmethod
100
+ def render_input(self) -> RenderableType:
101
+ raise NotImplementedError
102
+
103
+ @property
104
+ def should_show_cursor(self) -> bool:
105
+ return True
106
+
107
+ def position_cursor(self) -> Tuple[Control, ...]:
108
+ return (self._live_render.position_cursor(),)
109
+
110
+ def _refresh(self, show_result: bool = False) -> None:
111
+ renderable = self.render_result() if show_result else self.render_input()
112
+
113
+ self._live_render.set_renderable(renderable)
114
+
115
+ self._render(show_result)
116
+
117
+ def _render(self, show_result: bool = False) -> None:
118
+ after = self.fix_cursor() if not show_result else ()
119
+
120
+ self.console.print(
121
+ Control.show_cursor(self.should_show_cursor),
122
+ *self.position_cursor(),
123
+ self._live_render,
124
+ *after,
125
+ )
126
+
127
+
128
+ class Input(LiveInput):
129
+ def __init__(
130
+ self,
131
+ console: Console,
132
+ title: str,
133
+ style: Optional[BaseStyle] = None,
134
+ default: str = "",
135
+ cursor_offset: int = 0,
136
+ password: bool = False,
137
+ **metadata: Any,
138
+ ):
139
+ self.title = title
140
+ self.default = default
141
+ self.password = password
142
+
143
+ self.console = console
144
+ self.style = style
145
+
146
+ super().__init__(
147
+ console=console, style=style, cursor_offset=cursor_offset, **metadata
148
+ )
149
+
150
+ def render_result(self) -> RenderableType:
151
+ if self.password:
152
+ return self.title
153
+
154
+ return self.title + " [result]" + (self.text or self.default)
155
+
156
+ def render_input(self) -> Group:
157
+ text = self.text
158
+
159
+ if self.password:
160
+ text = "*" * len(self.text)
161
+
162
+ # if there's no default value, add a space to keep the cursor visible
163
+ # and, most importantly, in the right place
164
+ default = self.default or " "
165
+
166
+ text = f"[text]{text}[/]" if self.text else f"[placeholder]{default }[/]"
167
+
168
+ return Group(self.title, text)
169
+
170
+ def ask(self) -> str:
171
+ self._refresh()
172
+
173
+ while True:
174
+ try:
175
+ key = click.getchar()
176
+
177
+ if key == "\r":
178
+ break
179
+
180
+ self.update_text(key)
181
+
182
+ except KeyboardInterrupt:
183
+ exit()
184
+
185
+ self._refresh()
186
+
187
+ self._refresh(show_result=True)
188
+
189
+ for _ in range(self._padding_bottom):
190
+ self.console.print()
191
+
192
+ return self.text or self.default
vllm/lib/python3.10/site-packages/rich_toolkit/menu.py ADDED
@@ -0,0 +1,302 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Generic, List, Optional, Tuple, TypeVar, cast
2
+
3
+ import click
4
+ from rich import get_console
5
+ from rich.console import Console, Group, RenderableType
6
+ from rich.control import Control
7
+ from rich.segment import ControlType
8
+ from rich.text import Text
9
+ from rich.live_render import LiveRender
10
+ from typing_extensions import Any, Literal, TypedDict
11
+
12
+ from .styles.base import BaseStyle
13
+ from .input import TextInputHandler, LiveInput
14
+
15
+ ReturnValue = TypeVar("ReturnValue")
16
+
17
+
18
+ class Option(TypedDict, Generic[ReturnValue]):
19
+ name: str
20
+ value: ReturnValue
21
+
22
+
23
+ class Menu(Generic[ReturnValue], LiveInput):
24
+ DOWN_KEYS = [TextInputHandler.DOWN_KEY, "j"]
25
+ UP_KEYS = [TextInputHandler.UP_KEY, "k"]
26
+ LEFT_KEYS = [TextInputHandler.LEFT_KEY, "h"]
27
+ RIGHT_KEYS = [TextInputHandler.RIGHT_KEY, "l"]
28
+
29
+ current_selection_char = "●"
30
+ selection_char = "○"
31
+ filter_prompt = "Filter: "
32
+
33
+ def __init__(
34
+ self,
35
+ title: str,
36
+ options: List[Option[ReturnValue]],
37
+ inline: bool = False,
38
+ allow_filtering: bool = False,
39
+ *,
40
+ style: Optional[BaseStyle] = None,
41
+ console: Optional[Console] = None,
42
+ cursor_offset: int = 0,
43
+ **metadata: Any,
44
+ ):
45
+ self.console = console or get_console()
46
+
47
+ self.title = Text.from_markup(title)
48
+ self.inline = inline
49
+ self.allow_filtering = allow_filtering
50
+
51
+ self.selected = 0
52
+
53
+ self.metadata = metadata
54
+ self.style = style
55
+
56
+ self._options = options
57
+
58
+ self._padding_bottom = 1
59
+
60
+ cursor_offset = cursor_offset + len(self.filter_prompt)
61
+
62
+ super().__init__(
63
+ console=self.console,
64
+ style=self.style,
65
+ cursor_offset=cursor_offset,
66
+ **metadata,
67
+ )
68
+
69
+ def get_key(self) -> Optional[str]:
70
+ char = click.getchar()
71
+
72
+ if char == "\r":
73
+ return "enter"
74
+
75
+ if self.allow_filtering:
76
+ left_keys, right_keys = [[self.LEFT_KEY], [self.RIGHT_KEY]]
77
+ down_keys, up_keys = [[self.DOWN_KEY], [self.UP_KEY]]
78
+ else:
79
+ left_keys, right_keys = self.LEFT_KEYS, self.RIGHT_KEYS
80
+ down_keys, up_keys = self.DOWN_KEYS, self.UP_KEYS
81
+
82
+ next_keys, prev_keys = (
83
+ (right_keys, left_keys) if self.inline else (down_keys, up_keys)
84
+ )
85
+
86
+ if char in next_keys:
87
+ return "next"
88
+ if char in prev_keys:
89
+ return "prev"
90
+
91
+ if self.allow_filtering:
92
+ return char
93
+
94
+ return None
95
+
96
+ @property
97
+ def options(self) -> List[Option[ReturnValue]]:
98
+ if self.allow_filtering:
99
+ return [
100
+ option
101
+ for option in self._options
102
+ if self.text.lower() in option["name"].lower()
103
+ ]
104
+
105
+ return self._options
106
+
107
+ def _update_selection(self, key: Literal["next", "prev"]) -> None:
108
+ if key == "next":
109
+ self.selected += 1
110
+ elif key == "prev":
111
+ self.selected -= 1
112
+
113
+ if self.selected < 0:
114
+ self.selected = len(self.options) - 1
115
+
116
+ if self.selected >= len(self.options):
117
+ self.selected = 0
118
+
119
+ def render_input(self) -> RenderableType:
120
+ menu = Text(justify="left")
121
+
122
+ selected_prefix = Text(self.current_selection_char + " ")
123
+ not_selected_prefix = Text(self.selection_char + " ")
124
+
125
+ separator = Text("\t" if self.inline else "\n")
126
+
127
+ for id_, option in enumerate(self.options):
128
+ if id_ == self.selected:
129
+ prefix = selected_prefix
130
+ style = self.console.get_style("selected")
131
+ else:
132
+ prefix = not_selected_prefix
133
+ style = self.console.get_style("text")
134
+
135
+ menu.append(Text.assemble(prefix, option["name"], separator, style=style))
136
+
137
+ # TODO: inline is not wrapped (maybe that's good?)
138
+
139
+ if not self.options:
140
+ # menu.append("No results found", style=self.console.get_style("text"))
141
+ menu = Text("No results found\n\n", style=self.console.get_style("text"))
142
+
143
+ h = 0
144
+ if self._live_render._shape is not None:
145
+ _, h = self._live_render._shape
146
+
147
+ filter = (
148
+ [
149
+ Text.assemble(
150
+ (self.filter_prompt, self.console.get_style("text")),
151
+ (self.text, self.console.get_style("text")),
152
+ "\n",
153
+ )
154
+ ]
155
+ if self.allow_filtering
156
+ else []
157
+ )
158
+
159
+ return Group(self.title, *filter, *menu)
160
+
161
+ def render_result(self) -> RenderableType:
162
+ result_text = Text()
163
+
164
+ result_text.append(self.title)
165
+ result_text.append(" ")
166
+ result_text.append(
167
+ self.options[self.selected]["name"],
168
+ style=self.console.get_style("result"),
169
+ )
170
+
171
+ return result_text
172
+
173
+ def update_text(self, text: str) -> None:
174
+ current_selection: Optional[str] = None
175
+
176
+ if self.options:
177
+ current_selection = self.options[self.selected]["name"]
178
+
179
+ super().update_text(text)
180
+
181
+ if current_selection:
182
+ matching_index = next(
183
+ (
184
+ index
185
+ for index, option in enumerate(self.options)
186
+ if option["name"] == current_selection
187
+ ),
188
+ 0,
189
+ )
190
+
191
+ self.selected = matching_index
192
+
193
+ def _handle_enter(self) -> bool:
194
+ if self.allow_filtering and self.text and len(self.options) == 0:
195
+ return False
196
+
197
+ return True
198
+
199
+ def reposition_cursor(self) -> Control:
200
+ if self.allow_filtering:
201
+ if self._live_render._shape is None:
202
+ return Control()
203
+
204
+ _, height = self._live_render._shape
205
+
206
+ move_down = height - 2
207
+
208
+ return Control(
209
+ (ControlType.CURSOR_DOWN, move_down),
210
+ ControlType.CARRIAGE_RETURN,
211
+ (ControlType.ERASE_IN_LINE, 2),
212
+ *(
213
+ (
214
+ (ControlType.CURSOR_UP, 1),
215
+ (ControlType.ERASE_IN_LINE, 2),
216
+ )
217
+ * (height - 1)
218
+ ),
219
+ )
220
+
221
+ return self._live_render.position_cursor()
222
+
223
+ def position_cursor(self) -> Tuple[Control, ...]:
224
+ """Positions the cursor at the end of the menu.
225
+
226
+ It moves the cursor up based on the size of the menu when filtering
227
+ is enabled. It does by taking into account the size of the menu
228
+ and the fact that we moved the cursor up in the previous render.
229
+
230
+ We use the shape of the menu to calculate the number of times we
231
+ need to move the cursor up, we do this because the options are
232
+ dynamic and we need the current size* of the menu to calculate
233
+ the correct position of the cursor.
234
+
235
+ * Current size means the previous size of the menu, but I say
236
+ current because we haven't rendered the updated menu yet :)
237
+ """
238
+ original = super().position_cursor()
239
+
240
+ if self._live_render._shape is None or not self.allow_filtering:
241
+ return original
242
+
243
+ _, height = self._live_render._shape
244
+
245
+ move_down = height - 2
246
+
247
+ return (
248
+ Control(
249
+ (ControlType.CURSOR_DOWN, move_down),
250
+ ),
251
+ *original,
252
+ )
253
+
254
+ def fix_cursor(self) -> Tuple[Control, ...]:
255
+ """Fixes the position of cursor after rendering the menu.
256
+
257
+ It moves the cursor up based on the size of the menu, but
258
+ only if allow_filtering is enabled. (We don't show the cursor
259
+ when filtering is disabled.)
260
+ """
261
+ move_cursor = ()
262
+
263
+ if self.allow_filtering:
264
+ height = len(self.options) + 1 if self.options else 2
265
+
266
+ move_cursor = (Control((ControlType.CURSOR_UP, height)),)
267
+
268
+ return (*super().fix_cursor(), *move_cursor)
269
+
270
+ @property
271
+ def should_show_cursor(self) -> bool:
272
+ return self.allow_filtering
273
+
274
+ def ask(self) -> ReturnValue:
275
+ self._refresh()
276
+
277
+ while True:
278
+ try:
279
+ key = self.get_key()
280
+
281
+ if key == "enter":
282
+ if self._handle_enter():
283
+ break
284
+
285
+ elif key is not None:
286
+ if key in ["next", "prev"]:
287
+ key = cast(Literal["next", "prev"], key)
288
+ self._update_selection(key)
289
+ else:
290
+ self.update_text(key)
291
+
292
+ except KeyboardInterrupt:
293
+ exit()
294
+
295
+ self._refresh()
296
+
297
+ self._refresh(show_result=True)
298
+
299
+ for _ in range(self._padding_bottom):
300
+ self.console.print()
301
+
302
+ return self.options[self.selected]["value"]
vllm/lib/python3.10/site-packages/rich_toolkit/progress.py ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import List, Optional
2
+
3
+ from rich.console import Console
4
+ from rich.live import Live
5
+ from typing_extensions import Any, Literal
6
+
7
+ from .styles.base import BaseStyle
8
+
9
+
10
+ class Progress(Live):
11
+ def __init__(
12
+ self,
13
+ title: str,
14
+ style: Optional[BaseStyle] = None,
15
+ console: Optional[Console] = None,
16
+ transient: bool = False,
17
+ transient_on_error: bool = False,
18
+ inline_logs: bool = False,
19
+ lines_to_show: int = -1,
20
+ ) -> None:
21
+ self.current_message = title
22
+ self.style = style
23
+ self.is_error = False
24
+ self._transient_on_error = transient_on_error
25
+ self._inline_logs = inline_logs
26
+ self._lines_to_show = lines_to_show
27
+
28
+ self.logs: List[str] = []
29
+
30
+ super().__init__(console=console, refresh_per_second=8, transient=transient)
31
+
32
+ # TODO: remove this once rich uses "Self"
33
+ def __enter__(self) -> "Progress":
34
+ self.start(refresh=self._renderable is not None)
35
+
36
+ return self
37
+
38
+ def get_renderable(self) -> Any:
39
+ current_message = self.current_message
40
+
41
+ if not self.style:
42
+ return current_message
43
+
44
+ animation_status: Literal["started", "stopped", "error"] = (
45
+ "started" if self._started else "stopped"
46
+ )
47
+
48
+ if self.is_error:
49
+ animation_status = "error"
50
+
51
+ content = current_message
52
+
53
+ if self._inline_logs:
54
+ lines_to_show = (
55
+ self.logs[-self._lines_to_show :]
56
+ if self._lines_to_show > 0
57
+ else self.logs
58
+ )
59
+
60
+ content = "\n".join(
61
+ [
62
+ self.style.decorate_progress_log_line(
63
+ line,
64
+ index=index,
65
+ max_lines=self._lines_to_show,
66
+ total_lines=len(lines_to_show),
67
+ )
68
+ for index, line in enumerate(lines_to_show)
69
+ ]
70
+ )
71
+
72
+ return self.style.with_decoration(
73
+ content,
74
+ animation_status=animation_status,
75
+ )
76
+
77
+ def log(self, text: str) -> None:
78
+ if self._inline_logs:
79
+ self.logs.append(text)
80
+ else:
81
+ self.current_message = text
82
+
83
+ def set_error(self, text: str) -> None:
84
+ self.current_message = text
85
+ self.is_error = True
86
+ self.transient = self._transient_on_error
vllm/lib/python3.10/site-packages/rich_toolkit/py.typed ADDED
File without changes
vllm/lib/python3.10/site-packages/rich_toolkit/styles/__init__.py ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ from .fancy import FancyStyle
2
+ from .tagged import TaggedStyle
3
+ from .minimal import MinimalStyle
4
+
5
+ __all__ = [
6
+ "FancyStyle",
7
+ "TaggedStyle",
8
+ "MinimalStyle",
9
+ ]
vllm/lib/python3.10/site-packages/rich_toolkit/styles/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (331 Bytes). View file
 
vllm/lib/python3.10/site-packages/rich_toolkit/styles/__pycache__/base.cpython-310.pyc ADDED
Binary file (4.7 kB). View file
 
vllm/lib/python3.10/site-packages/rich_toolkit/styles/__pycache__/fancy.cpython-310.pyc ADDED
Binary file (1.91 kB). View file
 
vllm/lib/python3.10/site-packages/rich_toolkit/styles/__pycache__/minimal.cpython-310.pyc ADDED
Binary file (1.86 kB). View file
 
vllm/lib/python3.10/site-packages/rich_toolkit/styles/__pycache__/tagged.cpython-310.pyc ADDED
Binary file (2.73 kB). View file
 
vllm/lib/python3.10/site-packages/rich_toolkit/styles/base.py ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from abc import ABC, abstractmethod
2
+ from typing import Any, Generator, Iterable, List, Type, TypeVar
3
+
4
+ from rich.color import Color
5
+ from rich.console import (
6
+ Console,
7
+ ConsoleOptions,
8
+ ConsoleRenderable,
9
+ RenderableType,
10
+ RenderResult,
11
+ )
12
+ from rich.segment import Segment
13
+ from rich.text import Text
14
+ from typing_extensions import Literal
15
+
16
+ from rich_toolkit.utils.colors import lighten
17
+
18
+ ConsoleRenderableClass = TypeVar(
19
+ "ConsoleRenderableClass", bound=Type[ConsoleRenderable]
20
+ )
21
+
22
+
23
+ ANIMATION_STATUS = Literal["started", "stopped", "error", "no_animation"]
24
+
25
+
26
+ class BaseStyle(ABC):
27
+ result_color: Color
28
+ decoration_size: int
29
+
30
+ def __init__(self) -> None:
31
+ self.padding = 2
32
+ self.cursor_offset = 0
33
+
34
+ self._animation_counter = 0
35
+ self.decoration_size = 2
36
+
37
+ def empty_line(self) -> Text:
38
+ return Text(" ")
39
+
40
+ def with_decoration(
41
+ self,
42
+ *renderables: RenderableType,
43
+ animation_status: ANIMATION_STATUS = "no_animation",
44
+ **metadata: Any,
45
+ ) -> ConsoleRenderable:
46
+ class WithDecoration:
47
+ @staticmethod
48
+ def __rich_console__(
49
+ console: Console, options: ConsoleOptions
50
+ ) -> RenderResult:
51
+ for content in renderables:
52
+ # our styles are potentially adding some paddings on the left
53
+ # and right sides, so we need to adjust the max_width to
54
+ # make sure that rich takes that into account
55
+ options = options.update(
56
+ max_width=console.width - self.decoration_size
57
+ )
58
+
59
+ lines = console.render_lines(content, options, pad=False)
60
+
61
+ for line in Segment.split_lines(
62
+ self.decorate(
63
+ lines=lines,
64
+ console=console,
65
+ animation_status=animation_status,
66
+ **metadata,
67
+ )
68
+ ):
69
+ yield from line
70
+ yield Segment.line()
71
+
72
+ return WithDecoration()
73
+
74
+ def decorate_class(
75
+ self, klass: ConsoleRenderableClass, **metadata: Any
76
+ ) -> ConsoleRenderableClass:
77
+ style = self
78
+
79
+ class Decorated(klass): # type: ignore[valid-type,misc]
80
+ def __rich_console__(
81
+ self, console: Console, options: ConsoleOptions
82
+ ) -> RenderResult:
83
+ lines = Segment.split_lines(super().__rich_console__(console, options)) # type: ignore
84
+
85
+ yield from style.decorate(lines=lines, console=console, **metadata)
86
+
87
+ return Decorated # type: ignore
88
+
89
+ def decorate_progress_log_line(
90
+ self, line: str, index: int, max_lines: int = -1, total_lines: int = -1
91
+ ) -> str:
92
+ if max_lines == -1:
93
+ return line
94
+
95
+ # Adjust minimum brightness based on number of lines
96
+ # Fewer lines = higher minimum brightness
97
+ min_brightness = max(0.4, 1.0 - (total_lines / max_lines) * 0.6)
98
+ brightness_range = 1.0 - min_brightness
99
+
100
+ # Calculate brightness based on position in the sequence
101
+ brightness_pct = (index / total_lines) * brightness_range + min_brightness
102
+
103
+ # Apply brightness to RGB values
104
+ r = g = b = int(255 * brightness_pct)
105
+
106
+ color = f"#{r:02x}{g:02x}{b:02x}"
107
+
108
+ return f"[{color}]" + line
109
+
110
+ @abstractmethod
111
+ def decorate(
112
+ self,
113
+ console: Console,
114
+ lines: Iterable[List[Segment]],
115
+ animation_status: ANIMATION_STATUS = "no_animation",
116
+ **kwargs: Any,
117
+ ) -> Generator[Segment, None, None]:
118
+ raise NotImplementedError()
119
+
120
+ def _get_animation_colors(
121
+ self,
122
+ console: Console,
123
+ steps: int = 5,
124
+ animation_status: ANIMATION_STATUS = "started",
125
+ **metadata: Any,
126
+ ) -> List[Color]:
127
+ animated = animation_status == "started"
128
+
129
+ if animation_status == "error":
130
+ base_color = console.get_style("error").color
131
+
132
+ if base_color is None:
133
+ base_color = Color.parse("red")
134
+
135
+ else:
136
+ base_color = console.get_style("progress").bgcolor
137
+
138
+ if not base_color:
139
+ base_color = Color.parse("white")
140
+
141
+ if animated and base_color.triplet is not None:
142
+ return [lighten(base_color, 0.1 * i) for i in range(0, steps)]
143
+
144
+ return [base_color] * steps
vllm/lib/python3.10/site-packages/rich_toolkit/styles/fancy.py ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Any, Generator, Iterable, List
2
+
3
+ from rich._loop import loop_first_last
4
+ from rich.console import (
5
+ Console,
6
+ )
7
+ from rich.segment import Segment
8
+ from rich.style import Style
9
+ from rich.text import Text
10
+
11
+
12
+ from .base import ANIMATION_STATUS, BaseStyle
13
+
14
+
15
+ class FancyStyle(BaseStyle):
16
+ def __init__(self, *args, **kwargs) -> None:
17
+ super().__init__(*args, **kwargs)
18
+
19
+ self.cursor_offset = 2
20
+ self.decoration_size = 2
21
+
22
+ def decorate(
23
+ self,
24
+ console: Console,
25
+ lines: Iterable[List[Segment]],
26
+ animation_status: ANIMATION_STATUS = "no_animation",
27
+ **metadata: Any,
28
+ ) -> Generator[Segment, None, None]:
29
+ if animation_status != "no_animation":
30
+ colors = self._get_animation_colors(
31
+ console, animation_status=animation_status, **metadata
32
+ )
33
+
34
+ self._animation_counter += 1
35
+
36
+ color_index = self._animation_counter % len(colors)
37
+
38
+ for first, last, line in loop_first_last(lines):
39
+ if first:
40
+ yield Segment("◆ ", style=Style(color=colors[color_index]))
41
+ else:
42
+ yield Segment("│ ")
43
+ yield from line
44
+ yield Segment.line()
45
+
46
+ return
47
+
48
+ for first, last, line in loop_first_last(lines):
49
+ if first:
50
+ decoration = "┌ " if metadata.get("title", False) else "◆ "
51
+ elif last:
52
+ decoration = "└ "
53
+ else:
54
+ decoration = "│ "
55
+
56
+ yield Segment(decoration)
57
+ yield from line
58
+
59
+ if not last:
60
+ yield Segment.line()
61
+
62
+ def empty_line(self) -> Text:
63
+ return Text("│")
vllm/lib/python3.10/site-packages/rich_toolkit/styles/minimal.py ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Any, Generator, Iterable, List
2
+
3
+ from rich._loop import loop_first_last
4
+ from rich.console import (
5
+ Console,
6
+ )
7
+ from rich.segment import Segment
8
+ from rich.style import Style
9
+ from rich.text import Text
10
+
11
+
12
+ from .base import ANIMATION_STATUS, BaseStyle
13
+
14
+
15
+ class MinimalStyle(BaseStyle):
16
+ def __init__(self, *args, **kwargs) -> None:
17
+ super().__init__(*args, **kwargs)
18
+
19
+ self.cursor_offset = 2
20
+ self.decoration_size = 2
21
+
22
+ def decorate(
23
+ self,
24
+ console: Console,
25
+ lines: Iterable[List[Segment]],
26
+ animation_status: ANIMATION_STATUS = "no_animation",
27
+ **metadata: Any,
28
+ ) -> Generator[Segment, None, None]:
29
+ if animation_status != "no_animation":
30
+ block = "●"
31
+ colors = self._get_animation_colors(
32
+ console, animation_status=animation_status, **metadata
33
+ )
34
+
35
+ self._animation_counter += 1
36
+
37
+ color_index = self._animation_counter % len(colors)
38
+
39
+ for first, last, line in loop_first_last(lines):
40
+ if first:
41
+ yield Segment(f"{block} ", style=Style(color=colors[color_index]))
42
+ else:
43
+ yield Segment(" " * 2)
44
+ yield from line
45
+ yield Segment.line()
46
+
47
+ return
48
+
49
+ for first, last, line in loop_first_last(lines):
50
+ decoration = " " * 2
51
+
52
+ yield Segment(decoration)
53
+ yield from line
54
+
55
+ if not last:
56
+ yield Segment.line()
57
+
58
+ def empty_line(self) -> Text:
59
+ return Text("")
vllm/lib/python3.10/site-packages/rich_toolkit/styles/tagged.py ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Any, Generator, Iterable, List
2
+
3
+ from rich._loop import loop_first_last
4
+ from rich.console import Console
5
+ from rich.segment import Segment
6
+ from rich.style import Style
7
+
8
+ from .base import ANIMATION_STATUS, BaseStyle
9
+
10
+
11
+ class TaggedStyle(BaseStyle):
12
+ def __init__(self, *args, **kwargs) -> None:
13
+ self.tag_width = kwargs.pop("tag_width", 14)
14
+
15
+ super().__init__(*args, **kwargs)
16
+
17
+ self.padding = 2
18
+ self.cursor_offset = self.tag_width + self.padding
19
+ self.decoration_size = self.tag_width + self.padding
20
+
21
+ def _render_tag(
22
+ self,
23
+ text: str,
24
+ console: Console,
25
+ **metadata: Any,
26
+ ) -> Generator[Segment, None, None]:
27
+ style_name = "tag.title" if metadata.get("title", False) else "tag"
28
+
29
+ style = console.get_style(style_name)
30
+
31
+ if text:
32
+ text = f" {text} "
33
+
34
+ left_padding = self.tag_width - len(text)
35
+ left_padding = max(0, left_padding)
36
+
37
+ yield Segment(" " * left_padding)
38
+ yield Segment(text, style=style)
39
+ yield Segment(" " * self.padding)
40
+
41
+ def decorate(
42
+ self,
43
+ console: Console,
44
+ lines: Iterable[List[Segment]],
45
+ animation_status: ANIMATION_STATUS = "no_animation",
46
+ **metadata: Any,
47
+ ) -> Generator[Segment, None, None]:
48
+ if animation_status != "no_animation":
49
+ yield from self.decorate_with_animation(
50
+ lines=lines,
51
+ console=console,
52
+ animation_status=animation_status,
53
+ **metadata,
54
+ )
55
+
56
+ return
57
+
58
+ tag = metadata.get("tag", "")
59
+
60
+ for first, last, line in loop_first_last(lines):
61
+ text = tag if first else ""
62
+ yield from self._render_tag(text, console=console, **metadata)
63
+ yield from line
64
+
65
+ if not last:
66
+ yield Segment.line()
67
+
68
+ def decorate_with_animation(
69
+ self,
70
+ console: Console,
71
+ lines: Iterable[List[Segment]],
72
+ animation_status: ANIMATION_STATUS = "no_animation",
73
+ **metadata: Any,
74
+ ) -> Generator[Segment, None, None]:
75
+ block = "█"
76
+ block_length = 5
77
+ colors = self._get_animation_colors(
78
+ console, steps=block_length, animation_status=animation_status, **metadata
79
+ )
80
+
81
+ left_padding = self.tag_width - block_length
82
+ left_padding = max(0, left_padding)
83
+
84
+ self._animation_counter += 1
85
+
86
+ for first, _, line in loop_first_last(lines):
87
+ if first:
88
+ yield Segment(" " * left_padding)
89
+
90
+ for j in range(block_length):
91
+ color_index = (j + self._animation_counter) % len(colors)
92
+ yield Segment(block, style=Style(color=colors[color_index]))
93
+
94
+ else:
95
+ yield Segment(" " * self.tag_width)
96
+
97
+ yield Segment(" " * self.padding)
98
+
99
+ yield from line
100
+ yield Segment.line()
vllm/lib/python3.10/site-packages/rich_toolkit/toolkit.py ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import Any, Dict, List, Union
2
+
3
+ from rich.console import Console, RenderableType
4
+ from rich.theme import Theme
5
+
6
+ from .styles.base import BaseStyle
7
+ from .input import Input
8
+ from .menu import Menu, Option, ReturnValue
9
+ from .progress import Progress
10
+
11
+
12
+ class RichToolkitTheme:
13
+ def __init__(self, style: BaseStyle, theme: Dict[str, str]) -> None:
14
+ self.style = style
15
+ self.rich_theme = Theme(theme)
16
+
17
+
18
+ class RichToolkit:
19
+ def __init__(
20
+ self,
21
+ theme: RichToolkitTheme,
22
+ handle_keyboard_interrupts: bool = True,
23
+ ) -> None:
24
+ self.console = Console(theme=theme.rich_theme)
25
+ self.theme = theme
26
+ self.handle_keyboard_interrupts = handle_keyboard_interrupts
27
+
28
+ def __enter__(self):
29
+ self.console.print()
30
+ return self
31
+
32
+ def __exit__(
33
+ self, exc_type: Any, exc_value: Any, traceback: Any
34
+ ) -> Union[bool, None]:
35
+ if self.handle_keyboard_interrupts and exc_type is KeyboardInterrupt:
36
+ # we want to handle keyboard interrupts gracefully, instead of showing a traceback
37
+ # or any other error message
38
+ return True
39
+
40
+ self.console.print()
41
+
42
+ def print_title(self, title: str, **metadata: Any) -> None:
43
+ self.console.print(
44
+ self.theme.style.with_decoration(title, title=True, **metadata)
45
+ )
46
+
47
+ def print(self, *renderables: RenderableType, **metadata: Any) -> None:
48
+ self.console.print(self.theme.style.with_decoration(*renderables, **metadata))
49
+
50
+ def print_as_string(self, *renderables: RenderableType, **metadata: Any) -> str:
51
+ with self.console.capture() as capture:
52
+ self.print(*renderables, **metadata)
53
+
54
+ return capture.get().rstrip()
55
+
56
+ def print_line(self) -> None:
57
+ self.console.print(self.theme.style.empty_line())
58
+
59
+ def confirm(self, title: str, **metadata: Any) -> bool:
60
+ return self.ask(
61
+ title=title,
62
+ options=[
63
+ Option({"value": True, "name": "Yes"}),
64
+ Option({"value": False, "name": "No"}),
65
+ ],
66
+ inline=True,
67
+ **metadata,
68
+ )
69
+
70
+ def ask(
71
+ self,
72
+ title: str,
73
+ options: List[Option[ReturnValue]],
74
+ inline: bool = False,
75
+ allow_filtering: bool = False,
76
+ **metadata: Any,
77
+ ) -> ReturnValue:
78
+ return Menu(
79
+ title=title,
80
+ options=options,
81
+ console=self.console,
82
+ style=self.theme.style,
83
+ inline=inline,
84
+ allow_filtering=allow_filtering,
85
+ cursor_offset=self.theme.style.cursor_offset,
86
+ **metadata,
87
+ ).ask()
88
+
89
+ def input(
90
+ self, title: str, default: str = "", password: bool = False, **metadata: Any
91
+ ) -> str:
92
+ return Input(
93
+ console=self.console,
94
+ style=self.theme.style,
95
+ title=title,
96
+ default=default,
97
+ cursor_offset=self.theme.style.cursor_offset,
98
+ password=password,
99
+ **metadata,
100
+ ).ask()
101
+
102
+ def progress(
103
+ self,
104
+ title: str,
105
+ transient: bool = False,
106
+ transient_on_error: bool = False,
107
+ inline_logs: bool = False,
108
+ lines_to_show: int = -1,
109
+ ) -> Progress:
110
+ return Progress(
111
+ title=title,
112
+ console=self.console,
113
+ style=self.theme.style,
114
+ transient=transient,
115
+ transient_on_error=transient_on_error,
116
+ inline_logs=inline_logs,
117
+ lines_to_show=lines_to_show,
118
+ )
vllm/lib/python3.10/site-packages/rich_toolkit/utils/__init__.py ADDED
File without changes
vllm/lib/python3.10/site-packages/rich_toolkit/utils/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (168 Bytes). View file
 
vllm/lib/python3.10/site-packages/rich_toolkit/utils/__pycache__/colors.cpython-310.pyc ADDED
Binary file (569 Bytes). View file
 
vllm/lib/python3.10/site-packages/rich_toolkit/utils/colors.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from rich.color import Color
2
+ from rich.color_triplet import ColorTriplet
3
+
4
+
5
+ def lighten(color: Color, amount: float) -> Color:
6
+ assert color.triplet
7
+
8
+ r, g, b = color.triplet
9
+
10
+ r = int(r + (255 - r) * amount)
11
+ g = int(g + (255 - g) * amount)
12
+ b = int(b + (255 - b) * amount)
13
+
14
+ return Color.from_triplet(ColorTriplet(r, g, b))
vllm/lib/python3.10/site-packages/tiktoken_ext/__pycache__/openai_public.cpython-310.pyc ADDED
Binary file (3.22 kB). View file
 
vllm/lib/python3.10/site-packages/tiktoken_ext/openai_public.py ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from tiktoken.load import data_gym_to_mergeable_bpe_ranks, load_tiktoken_bpe
2
+
3
+ ENDOFTEXT = "<|endoftext|>"
4
+ FIM_PREFIX = "<|fim_prefix|>"
5
+ FIM_MIDDLE = "<|fim_middle|>"
6
+ FIM_SUFFIX = "<|fim_suffix|>"
7
+ ENDOFPROMPT = "<|endofprompt|>"
8
+
9
+
10
+ def gpt2():
11
+ mergeable_ranks = data_gym_to_mergeable_bpe_ranks(
12
+ vocab_bpe_file="https://openaipublic.blob.core.windows.net/gpt-2/encodings/main/vocab.bpe",
13
+ encoder_json_file="https://openaipublic.blob.core.windows.net/gpt-2/encodings/main/encoder.json",
14
+ vocab_bpe_hash="1ce1664773c50f3e0cc8842619a93edc4624525b728b188a9e0be33b7726adc5",
15
+ encoder_json_hash="196139668be63f3b5d6574427317ae82f612a97c5d1cdaf36ed2256dbf636783",
16
+ )
17
+ return {
18
+ "name": "gpt2",
19
+ "explicit_n_vocab": 50257,
20
+ # The pattern in the original GPT-2 release is:
21
+ # r"""'s|'t|'re|'ve|'m|'ll|'d| ?[\p{L}]+| ?[\p{N}]+| ?[^\s\p{L}\p{N}]+|\s+(?!\S)|\s+"""
22
+ # This is equivalent, but executes faster:
23
+ "pat_str": r"""'(?:[sdmt]|ll|ve|re)| ?\p{L}+| ?\p{N}+| ?[^\s\p{L}\p{N}]+|\s+(?!\S)|\s+""",
24
+ "mergeable_ranks": mergeable_ranks,
25
+ "special_tokens": {ENDOFTEXT: 50256},
26
+ }
27
+
28
+
29
+ def r50k_base():
30
+ mergeable_ranks = load_tiktoken_bpe(
31
+ "https://openaipublic.blob.core.windows.net/encodings/r50k_base.tiktoken",
32
+ expected_hash="306cd27f03c1a714eca7108e03d66b7dc042abe8c258b44c199a7ed9838dd930",
33
+ )
34
+ return {
35
+ "name": "r50k_base",
36
+ "explicit_n_vocab": 50257,
37
+ "pat_str": r"""'(?:[sdmt]|ll|ve|re)| ?\p{L}+| ?\p{N}+| ?[^\s\p{L}\p{N}]+|\s+(?!\S)|\s+""",
38
+ "mergeable_ranks": mergeable_ranks,
39
+ "special_tokens": {ENDOFTEXT: 50256},
40
+ }
41
+
42
+
43
+ def p50k_base():
44
+ mergeable_ranks = load_tiktoken_bpe(
45
+ "https://openaipublic.blob.core.windows.net/encodings/p50k_base.tiktoken",
46
+ expected_hash="94b5ca7dff4d00767bc256fdd1b27e5b17361d7b8a5f968547f9f23eb70d2069",
47
+ )
48
+ return {
49
+ "name": "p50k_base",
50
+ "explicit_n_vocab": 50281,
51
+ "pat_str": r"""'(?:[sdmt]|ll|ve|re)| ?\p{L}+| ?\p{N}+| ?[^\s\p{L}\p{N}]+|\s+(?!\S)|\s+""",
52
+ "mergeable_ranks": mergeable_ranks,
53
+ "special_tokens": {ENDOFTEXT: 50256},
54
+ }
55
+
56
+
57
+ def p50k_edit():
58
+ mergeable_ranks = load_tiktoken_bpe(
59
+ "https://openaipublic.blob.core.windows.net/encodings/p50k_base.tiktoken",
60
+ expected_hash="94b5ca7dff4d00767bc256fdd1b27e5b17361d7b8a5f968547f9f23eb70d2069",
61
+ )
62
+ special_tokens = {ENDOFTEXT: 50256, FIM_PREFIX: 50281, FIM_MIDDLE: 50282, FIM_SUFFIX: 50283}
63
+ return {
64
+ "name": "p50k_edit",
65
+ "pat_str": r"""'(?:[sdmt]|ll|ve|re)| ?\p{L}+| ?\p{N}+| ?[^\s\p{L}\p{N}]+|\s+(?!\S)|\s+""",
66
+ "mergeable_ranks": mergeable_ranks,
67
+ "special_tokens": special_tokens,
68
+ }
69
+
70
+
71
+ def cl100k_base():
72
+ mergeable_ranks = load_tiktoken_bpe(
73
+ "https://openaipublic.blob.core.windows.net/encodings/cl100k_base.tiktoken",
74
+ expected_hash="223921b76ee99bde995b7ff738513eef100fb51d18c93597a113bcffe865b2a7",
75
+ )
76
+ special_tokens = {
77
+ ENDOFTEXT: 100257,
78
+ FIM_PREFIX: 100258,
79
+ FIM_MIDDLE: 100259,
80
+ FIM_SUFFIX: 100260,
81
+ ENDOFPROMPT: 100276,
82
+ }
83
+ return {
84
+ "name": "cl100k_base",
85
+ "pat_str": r"""'(?i:[sdmt]|ll|ve|re)|[^\r\n\p{L}\p{N}]?+\p{L}+|\p{N}{1,3}| ?[^\s\p{L}\p{N}]++[\r\n]*|\s*[\r\n]|\s+(?!\S)|\s+""",
86
+ "mergeable_ranks": mergeable_ranks,
87
+ "special_tokens": special_tokens,
88
+ }
89
+
90
+
91
+ def o200k_base():
92
+ mergeable_ranks = load_tiktoken_bpe(
93
+ "https://openaipublic.blob.core.windows.net/encodings/o200k_base.tiktoken",
94
+ expected_hash="446a9538cb6c348e3516120d7c08b09f57c36495e2acfffe59a5bf8b0cfb1a2d",
95
+ )
96
+ special_tokens = {
97
+ ENDOFTEXT: 199999,
98
+ ENDOFPROMPT: 200018,
99
+ }
100
+ # This regex could be made more efficient
101
+ pat_str = "|".join(
102
+ [
103
+ r"""[^\r\n\p{L}\p{N}]?[\p{Lu}\p{Lt}\p{Lm}\p{Lo}\p{M}]*[\p{Ll}\p{Lm}\p{Lo}\p{M}]+(?i:'s|'t|'re|'ve|'m|'ll|'d)?""",
104
+ r"""[^\r\n\p{L}\p{N}]?[\p{Lu}\p{Lt}\p{Lm}\p{Lo}\p{M}]+[\p{Ll}\p{Lm}\p{Lo}\p{M}]*(?i:'s|'t|'re|'ve|'m|'ll|'d)?""",
105
+ r"""\p{N}{1,3}""",
106
+ r""" ?[^\s\p{L}\p{N}]+[\r\n/]*""",
107
+ r"""\s*[\r\n]+""",
108
+ r"""\s+(?!\S)""",
109
+ r"""\s+""",
110
+ ]
111
+ )
112
+ return {
113
+ "name": "o200k_base",
114
+ "pat_str": pat_str,
115
+ "mergeable_ranks": mergeable_ranks,
116
+ "special_tokens": special_tokens,
117
+ }
118
+
119
+
120
+ ENCODING_CONSTRUCTORS = {
121
+ "gpt2": gpt2,
122
+ "r50k_base": r50k_base,
123
+ "p50k_base": p50k_base,
124
+ "p50k_edit": p50k_edit,
125
+ "cl100k_base": cl100k_base,
126
+ "o200k_base": o200k_base,
127
+ }
vllm/lib/python3.10/site-packages/wheel/__pycache__/_setuptools_logging.cpython-310.pyc ADDED
Binary file (1.01 kB). View file
 
vllm/lib/python3.10/site-packages/wheel/__pycache__/util.cpython-310.pyc ADDED
Binary file (864 Bytes). View file
 
vllm/lib/python3.10/site-packages/wheel/cli/__init__.py ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Wheel command-line utility.
3
+ """
4
+
5
+ from __future__ import annotations
6
+
7
+ import argparse
8
+ import os
9
+ import sys
10
+ from argparse import ArgumentTypeError
11
+
12
+
13
+ class WheelError(Exception):
14
+ pass
15
+
16
+
17
+ def unpack_f(args: argparse.Namespace) -> None:
18
+ from .unpack import unpack
19
+
20
+ unpack(args.wheelfile, args.dest)
21
+
22
+
23
+ def pack_f(args: argparse.Namespace) -> None:
24
+ from .pack import pack
25
+
26
+ pack(args.directory, args.dest_dir, args.build_number)
27
+
28
+
29
+ def convert_f(args: argparse.Namespace) -> None:
30
+ from .convert import convert
31
+
32
+ convert(args.files, args.dest_dir, args.verbose)
33
+
34
+
35
+ def tags_f(args: argparse.Namespace) -> None:
36
+ from .tags import tags
37
+
38
+ names = (
39
+ tags(
40
+ wheel,
41
+ args.python_tag,
42
+ args.abi_tag,
43
+ args.platform_tag,
44
+ args.build,
45
+ args.remove,
46
+ )
47
+ for wheel in args.wheel
48
+ )
49
+
50
+ for name in names:
51
+ print(name)
52
+
53
+
54
+ def version_f(args: argparse.Namespace) -> None:
55
+ from .. import __version__
56
+
57
+ print(f"wheel {__version__}")
58
+
59
+
60
+ def parse_build_tag(build_tag: str) -> str:
61
+ if build_tag and not build_tag[0].isdigit():
62
+ raise ArgumentTypeError("build tag must begin with a digit")
63
+ elif "-" in build_tag:
64
+ raise ArgumentTypeError("invalid character ('-') in build tag")
65
+
66
+ return build_tag
67
+
68
+
69
+ TAGS_HELP = """\
70
+ Make a new wheel with given tags. Any tags unspecified will remain the same.
71
+ Starting the tags with a "+" will append to the existing tags. Starting with a
72
+ "-" will remove a tag (use --option=-TAG syntax). Multiple tags can be
73
+ separated by ".". The original file will remain unless --remove is given. The
74
+ output filename(s) will be displayed on stdout for further processing.
75
+ """
76
+
77
+
78
+ def parser():
79
+ p = argparse.ArgumentParser()
80
+ s = p.add_subparsers(help="commands")
81
+
82
+ unpack_parser = s.add_parser("unpack", help="Unpack wheel")
83
+ unpack_parser.add_argument(
84
+ "--dest", "-d", help="Destination directory", default="."
85
+ )
86
+ unpack_parser.add_argument("wheelfile", help="Wheel file")
87
+ unpack_parser.set_defaults(func=unpack_f)
88
+
89
+ repack_parser = s.add_parser("pack", help="Repack wheel")
90
+ repack_parser.add_argument("directory", help="Root directory of the unpacked wheel")
91
+ repack_parser.add_argument(
92
+ "--dest-dir",
93
+ "-d",
94
+ default=os.path.curdir,
95
+ help="Directory to store the wheel (default %(default)s)",
96
+ )
97
+ repack_parser.add_argument(
98
+ "--build-number", help="Build tag to use in the wheel name"
99
+ )
100
+ repack_parser.set_defaults(func=pack_f)
101
+
102
+ convert_parser = s.add_parser("convert", help="Convert egg or wininst to wheel")
103
+ convert_parser.add_argument("files", nargs="*", help="Files to convert")
104
+ convert_parser.add_argument(
105
+ "--dest-dir",
106
+ "-d",
107
+ default=os.path.curdir,
108
+ help="Directory to store wheels (default %(default)s)",
109
+ )
110
+ convert_parser.add_argument("--verbose", "-v", action="store_true")
111
+ convert_parser.set_defaults(func=convert_f)
112
+
113
+ tags_parser = s.add_parser(
114
+ "tags", help="Add or replace the tags on a wheel", description=TAGS_HELP
115
+ )
116
+ tags_parser.add_argument("wheel", nargs="*", help="Existing wheel(s) to retag")
117
+ tags_parser.add_argument(
118
+ "--remove",
119
+ action="store_true",
120
+ help="Remove the original files, keeping only the renamed ones",
121
+ )
122
+ tags_parser.add_argument(
123
+ "--python-tag", metavar="TAG", help="Specify an interpreter tag(s)"
124
+ )
125
+ tags_parser.add_argument("--abi-tag", metavar="TAG", help="Specify an ABI tag(s)")
126
+ tags_parser.add_argument(
127
+ "--platform-tag", metavar="TAG", help="Specify a platform tag(s)"
128
+ )
129
+ tags_parser.add_argument(
130
+ "--build", type=parse_build_tag, metavar="BUILD", help="Specify a build tag"
131
+ )
132
+ tags_parser.set_defaults(func=tags_f)
133
+
134
+ version_parser = s.add_parser("version", help="Print version and exit")
135
+ version_parser.set_defaults(func=version_f)
136
+
137
+ help_parser = s.add_parser("help", help="Show this help")
138
+ help_parser.set_defaults(func=lambda args: p.print_help())
139
+
140
+ return p
141
+
142
+
143
+ def main():
144
+ p = parser()
145
+ args = p.parse_args()
146
+ if not hasattr(args, "func"):
147
+ p.print_help()
148
+ else:
149
+ try:
150
+ args.func(args)
151
+ return 0
152
+ except WheelError as e:
153
+ print(e, file=sys.stderr)
154
+
155
+ return 1
vllm/lib/python3.10/site-packages/wheel/cli/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (4.58 kB). View file
 
vllm/lib/python3.10/site-packages/wheel/cli/__pycache__/convert.cpython-310.pyc ADDED
Binary file (6.52 kB). View file
 
vllm/lib/python3.10/site-packages/wheel/cli/__pycache__/pack.cpython-310.pyc ADDED
Binary file (3.1 kB). View file
 
vllm/lib/python3.10/site-packages/wheel/cli/__pycache__/tags.cpython-310.pyc ADDED
Binary file (3.85 kB). View file
 
vllm/lib/python3.10/site-packages/wheel/cli/__pycache__/unpack.cpython-310.pyc ADDED
Binary file (1.1 kB). View file
 
vllm/lib/python3.10/site-packages/wheel/cli/convert.py ADDED
@@ -0,0 +1,273 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import os.path
4
+ import re
5
+ import shutil
6
+ import tempfile
7
+ import zipfile
8
+ from glob import iglob
9
+
10
+ from .._bdist_wheel import bdist_wheel
11
+ from ..wheelfile import WheelFile
12
+ from . import WheelError
13
+
14
+ try:
15
+ from setuptools import Distribution
16
+ except ImportError:
17
+ from distutils.dist import Distribution
18
+
19
+ egg_info_re = re.compile(
20
+ r"""
21
+ (?P<name>.+?)-(?P<ver>.+?)
22
+ (-(?P<pyver>py\d\.\d+)
23
+ (-(?P<arch>.+?))?
24
+ )?.egg$""",
25
+ re.VERBOSE,
26
+ )
27
+
28
+
29
+ class _bdist_wheel_tag(bdist_wheel):
30
+ # allow the client to override the default generated wheel tag
31
+ # The default bdist_wheel implementation uses python and abi tags
32
+ # of the running python process. This is not suitable for
33
+ # generating/repackaging prebuild binaries.
34
+
35
+ full_tag_supplied = False
36
+ full_tag = None # None or a (pytag, soabitag, plattag) triple
37
+
38
+ def get_tag(self):
39
+ if self.full_tag_supplied and self.full_tag is not None:
40
+ return self.full_tag
41
+ else:
42
+ return bdist_wheel.get_tag(self)
43
+
44
+
45
+ def egg2wheel(egg_path: str, dest_dir: str) -> None:
46
+ filename = os.path.basename(egg_path)
47
+ match = egg_info_re.match(filename)
48
+ if not match:
49
+ raise WheelError(f"Invalid egg file name: {filename}")
50
+
51
+ egg_info = match.groupdict()
52
+ dir = tempfile.mkdtemp(suffix="_e2w")
53
+ if os.path.isfile(egg_path):
54
+ # assume we have a bdist_egg otherwise
55
+ with zipfile.ZipFile(egg_path) as egg:
56
+ egg.extractall(dir)
57
+ else:
58
+ # support buildout-style installed eggs directories
59
+ for pth in os.listdir(egg_path):
60
+ src = os.path.join(egg_path, pth)
61
+ if os.path.isfile(src):
62
+ shutil.copy2(src, dir)
63
+ else:
64
+ shutil.copytree(src, os.path.join(dir, pth))
65
+
66
+ pyver = egg_info["pyver"]
67
+ if pyver:
68
+ pyver = egg_info["pyver"] = pyver.replace(".", "")
69
+
70
+ arch = (egg_info["arch"] or "any").replace(".", "_").replace("-", "_")
71
+
72
+ # assume all binary eggs are for CPython
73
+ abi = "cp" + pyver[2:] if arch != "any" else "none"
74
+
75
+ root_is_purelib = egg_info["arch"] is None
76
+ if root_is_purelib:
77
+ bw = bdist_wheel(Distribution())
78
+ else:
79
+ bw = _bdist_wheel_tag(Distribution())
80
+
81
+ bw.root_is_pure = root_is_purelib
82
+ bw.python_tag = pyver
83
+ bw.plat_name_supplied = True
84
+ bw.plat_name = egg_info["arch"] or "any"
85
+ if not root_is_purelib:
86
+ bw.full_tag_supplied = True
87
+ bw.full_tag = (pyver, abi, arch)
88
+
89
+ dist_info_dir = os.path.join(dir, "{name}-{ver}.dist-info".format(**egg_info))
90
+ bw.egg2dist(os.path.join(dir, "EGG-INFO"), dist_info_dir)
91
+ bw.write_wheelfile(dist_info_dir, generator="egg2wheel")
92
+ wheel_name = "{name}-{ver}-{pyver}-{}-{}.whl".format(abi, arch, **egg_info)
93
+ with WheelFile(os.path.join(dest_dir, wheel_name), "w") as wf:
94
+ wf.write_files(dir)
95
+
96
+ shutil.rmtree(dir)
97
+
98
+
99
+ def parse_wininst_info(wininfo_name: str, egginfo_name: str | None):
100
+ """Extract metadata from filenames.
101
+
102
+ Extracts the 4 metadataitems needed (name, version, pyversion, arch) from
103
+ the installer filename and the name of the egg-info directory embedded in
104
+ the zipfile (if any).
105
+
106
+ The egginfo filename has the format::
107
+
108
+ name-ver(-pyver)(-arch).egg-info
109
+
110
+ The installer filename has the format::
111
+
112
+ name-ver.arch(-pyver).exe
113
+
114
+ Some things to note:
115
+
116
+ 1. The installer filename is not definitive. An installer can be renamed
117
+ and work perfectly well as an installer. So more reliable data should
118
+ be used whenever possible.
119
+ 2. The egg-info data should be preferred for the name and version, because
120
+ these come straight from the distutils metadata, and are mandatory.
121
+ 3. The pyver from the egg-info data should be ignored, as it is
122
+ constructed from the version of Python used to build the installer,
123
+ which is irrelevant - the installer filename is correct here (even to
124
+ the point that when it's not there, any version is implied).
125
+ 4. The architecture must be taken from the installer filename, as it is
126
+ not included in the egg-info data.
127
+ 5. Architecture-neutral installers still have an architecture because the
128
+ installer format itself (being executable) is architecture-specific. We
129
+ should therefore ignore the architecture if the content is pure-python.
130
+ """
131
+
132
+ egginfo = None
133
+ if egginfo_name:
134
+ egginfo = egg_info_re.search(egginfo_name)
135
+ if not egginfo:
136
+ raise ValueError(f"Egg info filename {egginfo_name} is not valid")
137
+
138
+ # Parse the wininst filename
139
+ # 1. Distribution name (up to the first '-')
140
+ w_name, sep, rest = wininfo_name.partition("-")
141
+ if not sep:
142
+ raise ValueError(f"Installer filename {wininfo_name} is not valid")
143
+
144
+ # Strip '.exe'
145
+ rest = rest[:-4]
146
+ # 2. Python version (from the last '-', must start with 'py')
147
+ rest2, sep, w_pyver = rest.rpartition("-")
148
+ if sep and w_pyver.startswith("py"):
149
+ rest = rest2
150
+ w_pyver = w_pyver.replace(".", "")
151
+ else:
152
+ # Not version specific - use py2.py3. While it is possible that
153
+ # pure-Python code is not compatible with both Python 2 and 3, there
154
+ # is no way of knowing from the wininst format, so we assume the best
155
+ # here (the user can always manually rename the wheel to be more
156
+ # restrictive if needed).
157
+ w_pyver = "py2.py3"
158
+ # 3. Version and architecture
159
+ w_ver, sep, w_arch = rest.rpartition(".")
160
+ if not sep:
161
+ raise ValueError(f"Installer filename {wininfo_name} is not valid")
162
+
163
+ if egginfo:
164
+ w_name = egginfo.group("name")
165
+ w_ver = egginfo.group("ver")
166
+
167
+ return {"name": w_name, "ver": w_ver, "arch": w_arch, "pyver": w_pyver}
168
+
169
+
170
+ def wininst2wheel(path: str, dest_dir: str) -> None:
171
+ with zipfile.ZipFile(path) as bdw:
172
+ # Search for egg-info in the archive
173
+ egginfo_name = None
174
+ for filename in bdw.namelist():
175
+ if ".egg-info" in filename:
176
+ egginfo_name = filename
177
+ break
178
+
179
+ info = parse_wininst_info(os.path.basename(path), egginfo_name)
180
+
181
+ root_is_purelib = True
182
+ for zipinfo in bdw.infolist():
183
+ if zipinfo.filename.startswith("PLATLIB"):
184
+ root_is_purelib = False
185
+ break
186
+ if root_is_purelib:
187
+ paths = {"purelib": ""}
188
+ else:
189
+ paths = {"platlib": ""}
190
+
191
+ dist_info = "{name}-{ver}".format(**info)
192
+ datadir = f"{dist_info}.data/"
193
+
194
+ # rewrite paths to trick ZipFile into extracting an egg
195
+ # XXX grab wininst .ini - between .exe, padding, and first zip file.
196
+ members: list[str] = []
197
+ egginfo_name = ""
198
+ for zipinfo in bdw.infolist():
199
+ key, basename = zipinfo.filename.split("/", 1)
200
+ key = key.lower()
201
+ basepath = paths.get(key, None)
202
+ if basepath is None:
203
+ basepath = datadir + key.lower() + "/"
204
+ oldname = zipinfo.filename
205
+ newname = basepath + basename
206
+ zipinfo.filename = newname
207
+ del bdw.NameToInfo[oldname]
208
+ bdw.NameToInfo[newname] = zipinfo
209
+ # Collect member names, but omit '' (from an entry like "PLATLIB/"
210
+ if newname:
211
+ members.append(newname)
212
+ # Remember egg-info name for the egg2dist call below
213
+ if not egginfo_name:
214
+ if newname.endswith(".egg-info"):
215
+ egginfo_name = newname
216
+ elif ".egg-info/" in newname:
217
+ egginfo_name, sep, _ = newname.rpartition("/")
218
+ dir = tempfile.mkdtemp(suffix="_b2w")
219
+ bdw.extractall(dir, members)
220
+
221
+ # egg2wheel
222
+ abi = "none"
223
+ pyver = info["pyver"]
224
+ arch = (info["arch"] or "any").replace(".", "_").replace("-", "_")
225
+ # Wininst installers always have arch even if they are not
226
+ # architecture-specific (because the format itself is).
227
+ # So, assume the content is architecture-neutral if root is purelib.
228
+ if root_is_purelib:
229
+ arch = "any"
230
+ # If the installer is architecture-specific, it's almost certainly also
231
+ # CPython-specific.
232
+ if arch != "any":
233
+ pyver = pyver.replace("py", "cp")
234
+ wheel_name = "-".join((dist_info, pyver, abi, arch))
235
+ if root_is_purelib:
236
+ bw = bdist_wheel(Distribution())
237
+ else:
238
+ bw = _bdist_wheel_tag(Distribution())
239
+
240
+ bw.root_is_pure = root_is_purelib
241
+ bw.python_tag = pyver
242
+ bw.plat_name_supplied = True
243
+ bw.plat_name = info["arch"] or "any"
244
+
245
+ if not root_is_purelib:
246
+ bw.full_tag_supplied = True
247
+ bw.full_tag = (pyver, abi, arch)
248
+
249
+ dist_info_dir = os.path.join(dir, f"{dist_info}.dist-info")
250
+ bw.egg2dist(os.path.join(dir, egginfo_name), dist_info_dir)
251
+ bw.write_wheelfile(dist_info_dir, generator="wininst2wheel")
252
+
253
+ wheel_path = os.path.join(dest_dir, wheel_name)
254
+ with WheelFile(wheel_path, "w") as wf:
255
+ wf.write_files(dir)
256
+
257
+ shutil.rmtree(dir)
258
+
259
+
260
+ def convert(files: list[str], dest_dir: str, verbose: bool) -> None:
261
+ for pat in files:
262
+ for installer in iglob(pat):
263
+ if os.path.splitext(installer)[1] == ".egg":
264
+ conv = egg2wheel
265
+ else:
266
+ conv = wininst2wheel
267
+
268
+ if verbose:
269
+ print(f"{installer}... ", flush=True)
270
+
271
+ conv(installer, dest_dir)
272
+ if verbose:
273
+ print("OK")
vllm/lib/python3.10/site-packages/wheel/cli/pack.py ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import email.policy
4
+ import os.path
5
+ import re
6
+ from email.generator import BytesGenerator
7
+ from email.parser import BytesParser
8
+
9
+ from wheel.cli import WheelError
10
+ from wheel.wheelfile import WheelFile
11
+
12
+ DIST_INFO_RE = re.compile(r"^(?P<namever>(?P<name>.+?)-(?P<ver>\d.*?))\.dist-info$")
13
+
14
+
15
+ def pack(directory: str, dest_dir: str, build_number: str | None) -> None:
16
+ """Repack a previously unpacked wheel directory into a new wheel file.
17
+
18
+ The .dist-info/WHEEL file must contain one or more tags so that the target
19
+ wheel file name can be determined.
20
+
21
+ :param directory: The unpacked wheel directory
22
+ :param dest_dir: Destination directory (defaults to the current directory)
23
+ """
24
+ # Find the .dist-info directory
25
+ dist_info_dirs = [
26
+ fn
27
+ for fn in os.listdir(directory)
28
+ if os.path.isdir(os.path.join(directory, fn)) and DIST_INFO_RE.match(fn)
29
+ ]
30
+ if len(dist_info_dirs) > 1:
31
+ raise WheelError(f"Multiple .dist-info directories found in {directory}")
32
+ elif not dist_info_dirs:
33
+ raise WheelError(f"No .dist-info directories found in {directory}")
34
+
35
+ # Determine the target wheel filename
36
+ dist_info_dir = dist_info_dirs[0]
37
+ name_version = DIST_INFO_RE.match(dist_info_dir).group("namever")
38
+
39
+ # Read the tags and the existing build number from .dist-info/WHEEL
40
+ wheel_file_path = os.path.join(directory, dist_info_dir, "WHEEL")
41
+ with open(wheel_file_path, "rb") as f:
42
+ info = BytesParser(policy=email.policy.compat32).parse(f)
43
+ tags: list[str] = info.get_all("Tag", [])
44
+ existing_build_number = info.get("Build")
45
+
46
+ if not tags:
47
+ raise WheelError(
48
+ f"No tags present in {dist_info_dir}/WHEEL; cannot determine target "
49
+ f"wheel filename"
50
+ )
51
+
52
+ # Set the wheel file name and add/replace/remove the Build tag in .dist-info/WHEEL
53
+ build_number = build_number if build_number is not None else existing_build_number
54
+ if build_number is not None:
55
+ del info["Build"]
56
+ if build_number:
57
+ info["Build"] = build_number
58
+ name_version += "-" + build_number
59
+
60
+ if build_number != existing_build_number:
61
+ with open(wheel_file_path, "wb") as f:
62
+ BytesGenerator(f, maxheaderlen=0).flatten(info)
63
+
64
+ # Reassemble the tags for the wheel file
65
+ tagline = compute_tagline(tags)
66
+
67
+ # Repack the wheel
68
+ wheel_path = os.path.join(dest_dir, f"{name_version}-{tagline}.whl")
69
+ with WheelFile(wheel_path, "w") as wf:
70
+ print(f"Repacking wheel as {wheel_path}...", end="", flush=True)
71
+ wf.write_files(directory)
72
+
73
+ print("OK")
74
+
75
+
76
+ def compute_tagline(tags: list[str]) -> str:
77
+ """Compute a tagline from a list of tags.
78
+
79
+ :param tags: A list of tags
80
+ :return: A tagline
81
+ """
82
+ impls = sorted({tag.split("-")[0] for tag in tags})
83
+ abivers = sorted({tag.split("-")[1] for tag in tags})
84
+ platforms = sorted({tag.split("-")[2] for tag in tags})
85
+ return "-".join([".".join(impls), ".".join(abivers), ".".join(platforms)])
vllm/lib/python3.10/site-packages/wheel/cli/tags.py ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import email.policy
4
+ import itertools
5
+ import os
6
+ from collections.abc import Iterable
7
+ from email.parser import BytesParser
8
+
9
+ from ..wheelfile import WheelFile
10
+
11
+
12
+ def _compute_tags(original_tags: Iterable[str], new_tags: str | None) -> set[str]:
13
+ """Add or replace tags. Supports dot-separated tags"""
14
+ if new_tags is None:
15
+ return set(original_tags)
16
+
17
+ if new_tags.startswith("+"):
18
+ return {*original_tags, *new_tags[1:].split(".")}
19
+
20
+ if new_tags.startswith("-"):
21
+ return set(original_tags) - set(new_tags[1:].split("."))
22
+
23
+ return set(new_tags.split("."))
24
+
25
+
26
+ def tags(
27
+ wheel: str,
28
+ python_tags: str | None = None,
29
+ abi_tags: str | None = None,
30
+ platform_tags: str | None = None,
31
+ build_tag: str | None = None,
32
+ remove: bool = False,
33
+ ) -> str:
34
+ """Change the tags on a wheel file.
35
+
36
+ The tags are left unchanged if they are not specified. To specify "none",
37
+ use ["none"]. To append to the previous tags, a tag should start with a
38
+ "+". If a tag starts with "-", it will be removed from existing tags.
39
+ Processing is done left to right.
40
+
41
+ :param wheel: The paths to the wheels
42
+ :param python_tags: The Python tags to set
43
+ :param abi_tags: The ABI tags to set
44
+ :param platform_tags: The platform tags to set
45
+ :param build_tag: The build tag to set
46
+ :param remove: Remove the original wheel
47
+ """
48
+ with WheelFile(wheel, "r") as f:
49
+ assert f.filename, f"{f.filename} must be available"
50
+
51
+ wheel_info = f.read(f.dist_info_path + "/WHEEL")
52
+ info = BytesParser(policy=email.policy.compat32).parsebytes(wheel_info)
53
+
54
+ original_wheel_name = os.path.basename(f.filename)
55
+ namever = f.parsed_filename.group("namever")
56
+ build = f.parsed_filename.group("build")
57
+ original_python_tags = f.parsed_filename.group("pyver").split(".")
58
+ original_abi_tags = f.parsed_filename.group("abi").split(".")
59
+ original_plat_tags = f.parsed_filename.group("plat").split(".")
60
+
61
+ tags: list[str] = info.get_all("Tag", [])
62
+ existing_build_tag = info.get("Build")
63
+
64
+ impls = {tag.split("-")[0] for tag in tags}
65
+ abivers = {tag.split("-")[1] for tag in tags}
66
+ platforms = {tag.split("-")[2] for tag in tags}
67
+
68
+ if impls != set(original_python_tags):
69
+ msg = f"Wheel internal tags {impls!r} != filename tags {original_python_tags!r}"
70
+ raise AssertionError(msg)
71
+
72
+ if abivers != set(original_abi_tags):
73
+ msg = f"Wheel internal tags {abivers!r} != filename tags {original_abi_tags!r}"
74
+ raise AssertionError(msg)
75
+
76
+ if platforms != set(original_plat_tags):
77
+ msg = (
78
+ f"Wheel internal tags {platforms!r} != filename tags {original_plat_tags!r}"
79
+ )
80
+ raise AssertionError(msg)
81
+
82
+ if existing_build_tag != build:
83
+ msg = (
84
+ f"Incorrect filename '{build}' "
85
+ f"& *.dist-info/WHEEL '{existing_build_tag}' build numbers"
86
+ )
87
+ raise AssertionError(msg)
88
+
89
+ # Start changing as needed
90
+ if build_tag is not None:
91
+ build = build_tag
92
+
93
+ final_python_tags = sorted(_compute_tags(original_python_tags, python_tags))
94
+ final_abi_tags = sorted(_compute_tags(original_abi_tags, abi_tags))
95
+ final_plat_tags = sorted(_compute_tags(original_plat_tags, platform_tags))
96
+
97
+ final_tags = [
98
+ namever,
99
+ ".".join(final_python_tags),
100
+ ".".join(final_abi_tags),
101
+ ".".join(final_plat_tags),
102
+ ]
103
+ if build:
104
+ final_tags.insert(1, build)
105
+
106
+ final_wheel_name = "-".join(final_tags) + ".whl"
107
+
108
+ if original_wheel_name != final_wheel_name:
109
+ del info["Tag"], info["Build"]
110
+ for a, b, c in itertools.product(
111
+ final_python_tags, final_abi_tags, final_plat_tags
112
+ ):
113
+ info["Tag"] = f"{a}-{b}-{c}"
114
+ if build:
115
+ info["Build"] = build
116
+
117
+ original_wheel_path = os.path.join(
118
+ os.path.dirname(f.filename), original_wheel_name
119
+ )
120
+ final_wheel_path = os.path.join(os.path.dirname(f.filename), final_wheel_name)
121
+
122
+ with WheelFile(original_wheel_path, "r") as fin, WheelFile(
123
+ final_wheel_path, "w"
124
+ ) as fout:
125
+ fout.comment = fin.comment # preserve the comment
126
+ for item in fin.infolist():
127
+ if item.is_dir():
128
+ continue
129
+ if item.filename == f.dist_info_path + "/RECORD":
130
+ continue
131
+ if item.filename == f.dist_info_path + "/WHEEL":
132
+ fout.writestr(item, info.as_bytes())
133
+ else:
134
+ fout.writestr(item, fin.read(item))
135
+
136
+ if remove:
137
+ os.remove(original_wheel_path)
138
+
139
+ return final_wheel_name
vllm/lib/python3.10/site-packages/wheel/cli/unpack.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ from pathlib import Path
4
+
5
+ from ..wheelfile import WheelFile
6
+
7
+
8
+ def unpack(path: str, dest: str = ".") -> None:
9
+ """Unpack a wheel.
10
+
11
+ Wheel content will be unpacked to {dest}/{name}-{ver}, where {name}
12
+ is the package name and {ver} its version.
13
+
14
+ :param path: The path to the wheel.
15
+ :param dest: Destination directory (default to current directory).
16
+ """
17
+ with WheelFile(path) as wf:
18
+ namever = wf.parsed_filename.group("namever")
19
+ destination = Path(dest) / namever
20
+ print(f"Unpacking to: {destination}...", end="", flush=True)
21
+ for zinfo in wf.filelist:
22
+ wf.extract(zinfo, destination)
23
+
24
+ # Set permissions to the same values as they were set in the archive
25
+ # We have to do this manually due to
26
+ # https://github.com/python/cpython/issues/59999
27
+ permissions = zinfo.external_attr >> 16 & 0o777
28
+ destination.joinpath(zinfo.filename).chmod(permissions)
29
+
30
+ print("OK")
vllm/lib/python3.10/site-packages/wheel/vendored/packaging/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (174 Bytes). View file