wholocks 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
wholocks/__init__.py ADDED
@@ -0,0 +1,7 @@
1
+ """wholocks —— 查询 Windows 上哪个进程正占用着文件。"""
2
+
3
+ from .core import LockHolder, LockQueryError, who_locks
4
+
5
+ __version__ = "0.1.0"
6
+
7
+ __all__ = ["LockHolder", "LockQueryError", "who_locks", "__version__"]
wholocks/__main__.py ADDED
@@ -0,0 +1,6 @@
1
+ import sys
2
+
3
+ from .cli import main
4
+
5
+ if __name__ == "__main__":
6
+ sys.exit(main())
wholocks/cli.py ADDED
@@ -0,0 +1,97 @@
1
+ """wholocks 命令行入口。"""
2
+
3
+ from __future__ import annotations
4
+
5
+ import argparse
6
+ import json
7
+ import sys
8
+ from typing import Dict, List, Optional, Sequence
9
+
10
+ from . import __version__
11
+ from .core import LockQueryError, who_locks
12
+
13
+ EXIT_OK = 0
14
+ EXIT_LOCKED = 1
15
+ EXIT_ERROR = 2
16
+
17
+
18
+ def _build_parser() -> argparse.ArgumentParser:
19
+ parser = argparse.ArgumentParser(
20
+ prog="wholocks",
21
+ description="Find out which Windows process is locking a file or directory.",
22
+ epilog="Exit codes: 0 = not locked, 1 = locked, 2 = query failed.",
23
+ )
24
+ parser.add_argument("paths", nargs="+", metavar="PATH", help="file or directory to inspect")
25
+ parser.add_argument("--json", action="store_true", help="machine-readable JSON output")
26
+ parser.add_argument("-q", "--quiet", action="store_true", help="only print locked paths")
27
+ parser.add_argument(
28
+ "--no-deep",
29
+ action="store_true",
30
+ help="for directories, only inspect files directly inside",
31
+ )
32
+ parser.add_argument(
33
+ "--max-files",
34
+ type=int,
35
+ default=20000,
36
+ metavar="N",
37
+ help="max files to scan per directory (default: 20000)",
38
+ )
39
+ parser.add_argument("-V", "--version", action="version", version="%(prog)s " + __version__)
40
+ return parser
41
+
42
+
43
+ def _print_human(results: List[Dict], quiet: bool) -> None:
44
+ for item in results:
45
+ if "error" in item:
46
+ print("%s\n error: %s" % (item["path"], item["error"]), file=sys.stderr)
47
+ continue
48
+
49
+ holders = item["holders"]
50
+ if not holders:
51
+ if not quiet:
52
+ print("%s\n not locked" % item["path"])
53
+ continue
54
+
55
+ print(item["path"])
56
+ for holder in holders:
57
+ label = holder["image"] or "PID %d" % holder["pid"]
58
+ details = []
59
+ if holder["app_name"]:
60
+ details.append(holder["app_name"])
61
+ if holder["service"]:
62
+ details.append("服务 %s" % holder["service"])
63
+ details.append(holder["type"])
64
+ print(" PID %-7d %s (%s)" % (holder["pid"], label, " · ".join(details)))
65
+ if holder["image_path"]:
66
+ print(" %14s %s" % ("", holder["image_path"]))
67
+
68
+
69
+ def main(argv: Optional[Sequence[str]] = None) -> int:
70
+ args = _build_parser().parse_args(argv)
71
+
72
+ results: List[Dict] = []
73
+ failed = False
74
+ for path in args.paths:
75
+ try:
76
+ holders = who_locks(path, deep=not args.no_deep, max_files=args.max_files)
77
+ except (FileNotFoundError, LockQueryError, OSError) as exc:
78
+ failed = True
79
+ results.append({"path": path, "error": str(exc), "holders": []})
80
+ continue
81
+ results.append({"path": path, "holders": [holder.to_dict() for holder in holders]})
82
+
83
+ locked = any(item["holders"] for item in results)
84
+ if args.json:
85
+ json.dump(
86
+ {"locked": locked, "results": results},
87
+ sys.stdout,
88
+ ensure_ascii=False,
89
+ indent=2,
90
+ )
91
+ sys.stdout.write("\n")
92
+ else:
93
+ _print_human(results, quiet=args.quiet)
94
+
95
+ if failed:
96
+ return EXIT_ERROR
97
+ return EXIT_LOCKED if locked else EXIT_OK
wholocks/core.py ADDED
@@ -0,0 +1,304 @@
1
+ """基于 Windows Restart Manager 的文件占用查询。
2
+
3
+ rstrtmgr.dll 提供的 RmStartSession / RmRegisterResources / RmGetList 三件套,
4
+ 正是 Windows 安装程序判断「谁占着文件、要不要重启」时用的同一套接口:
5
+ 不需要管理员权限,也不需要 Sysinternals。
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ import ctypes
11
+ import os
12
+ import sys
13
+ from ctypes import wintypes
14
+ from dataclasses import dataclass
15
+ from typing import Dict, List, Optional, Sequence, Tuple
16
+
17
+ CCH_RM_SESSION_KEY = 32
18
+ CCH_RM_MAX_APP_NAME = 255
19
+ CCH_RM_MAX_SVC_NAME = 63
20
+
21
+ ERROR_SUCCESS = 0
22
+ ERROR_ACCESS_DENIED = 5
23
+ ERROR_BAD_ARGUMENTS = 160
24
+ ERROR_MORE_DATA = 234
25
+
26
+ PROCESS_QUERY_LIMITED_INFORMATION = 0x1000
27
+
28
+ # RM_APP_TYPE 枚举
29
+ APP_TYPES = {
30
+ 0: "Unknown",
31
+ 1: "MainWindow",
32
+ 2: "OtherWindow",
33
+ 3: "Service",
34
+ 4: "Explorer",
35
+ 5: "Console",
36
+ 1000: "Critical",
37
+ }
38
+
39
+ _DEFAULT_MAX_FILES = 20_000
40
+ _REGISTER_BATCH = 1_000
41
+ _ERROR_MESSAGES = {
42
+ ERROR_ACCESS_DENIED: (
43
+ "access denied; querying system processes or services requires an elevated shell"
44
+ ),
45
+ ERROR_BAD_ARGUMENTS: "invalid path; the Restart Manager requires a full file path",
46
+ }
47
+
48
+
49
+ class LockQueryError(OSError):
50
+ """查询失败,例如权限不足或路径非法。"""
51
+
52
+
53
+ @dataclass(frozen=True)
54
+ class LockHolder:
55
+ """占用目标文件的一个进程。"""
56
+
57
+ pid: int
58
+ image: str
59
+ image_path: str
60
+ app_name: str
61
+ service: str
62
+ kind: str
63
+ session_id: int
64
+ restartable: bool
65
+
66
+ def to_dict(self) -> dict:
67
+ return {
68
+ "pid": self.pid,
69
+ "image": self.image,
70
+ "image_path": self.image_path,
71
+ "app_name": self.app_name,
72
+ "service": self.service,
73
+ "type": self.kind,
74
+ "session": self.session_id,
75
+ "restartable": self.restartable,
76
+ }
77
+
78
+
79
+ class _FILETIME(ctypes.Structure):
80
+ _fields_ = [
81
+ ("dwLowDateTime", wintypes.DWORD),
82
+ ("dwHighDateTime", wintypes.DWORD),
83
+ ]
84
+
85
+
86
+ class _RM_UNIQUE_PROCESS(ctypes.Structure):
87
+ _fields_ = [
88
+ ("dwProcessId", wintypes.DWORD),
89
+ ("ProcessStartTime", _FILETIME),
90
+ ]
91
+
92
+
93
+ class _RM_PROCESS_INFO(ctypes.Structure):
94
+ _fields_ = [
95
+ ("Process", _RM_UNIQUE_PROCESS),
96
+ ("strAppName", wintypes.WCHAR * (CCH_RM_MAX_APP_NAME + 1)),
97
+ ("strServiceShortName", wintypes.WCHAR * (CCH_RM_MAX_SVC_NAME + 1)),
98
+ ("ApplicationType", ctypes.c_int),
99
+ ("AppStatus", wintypes.ULONG),
100
+ ("TSSessionId", wintypes.DWORD),
101
+ ("bRestartable", wintypes.BOOL),
102
+ ]
103
+
104
+
105
+ _rm = None
106
+ _kernel32 = None
107
+
108
+
109
+ def _load_rm():
110
+ """惰性加载 rstrtmgr,避免在非 Windows 或仅导入包时就报错。"""
111
+ global _rm
112
+ if _rm is not None:
113
+ return _rm
114
+ if sys.platform != "win32":
115
+ raise OSError("wholocks only supports Windows")
116
+
117
+ rm = ctypes.WinDLL("rstrtmgr")
118
+ rm.RmStartSession.argtypes = [
119
+ ctypes.POINTER(wintypes.DWORD),
120
+ wintypes.DWORD,
121
+ wintypes.LPWSTR,
122
+ ]
123
+ rm.RmStartSession.restype = wintypes.DWORD
124
+ rm.RmRegisterResources.argtypes = [
125
+ wintypes.DWORD,
126
+ wintypes.UINT,
127
+ ctypes.POINTER(wintypes.LPCWSTR),
128
+ wintypes.UINT,
129
+ ctypes.POINTER(_RM_UNIQUE_PROCESS),
130
+ wintypes.UINT,
131
+ ctypes.POINTER(wintypes.LPCWSTR),
132
+ ]
133
+ rm.RmRegisterResources.restype = wintypes.DWORD
134
+ rm.RmGetList.argtypes = [
135
+ wintypes.DWORD,
136
+ ctypes.POINTER(wintypes.UINT),
137
+ ctypes.POINTER(wintypes.UINT),
138
+ ctypes.POINTER(_RM_PROCESS_INFO),
139
+ ctypes.POINTER(wintypes.DWORD),
140
+ ]
141
+ rm.RmGetList.restype = wintypes.DWORD
142
+ rm.RmEndSession.argtypes = [wintypes.DWORD]
143
+ rm.RmEndSession.restype = wintypes.DWORD
144
+
145
+ _rm = rm
146
+ return rm
147
+
148
+
149
+ def _load_kernel32():
150
+ global _kernel32
151
+ if _kernel32 is None:
152
+ k32 = ctypes.WinDLL("kernel32", use_last_error=True)
153
+ k32.OpenProcess.argtypes = [wintypes.DWORD, wintypes.BOOL, wintypes.DWORD]
154
+ k32.OpenProcess.restype = wintypes.HANDLE
155
+ k32.QueryFullProcessImageNameW.argtypes = [
156
+ wintypes.HANDLE,
157
+ wintypes.DWORD,
158
+ wintypes.LPWSTR,
159
+ ctypes.POINTER(wintypes.DWORD),
160
+ ]
161
+ k32.QueryFullProcessImageNameW.restype = wintypes.BOOL
162
+ k32.CloseHandle.argtypes = [wintypes.HANDLE]
163
+ k32.CloseHandle.restype = wintypes.BOOL
164
+ _kernel32 = k32
165
+ return _kernel32
166
+
167
+
168
+ def _raise_for(rc: int) -> None:
169
+ message = _ERROR_MESSAGES.get(rc, "Restart Manager returned error code %d" % rc)
170
+ raise LockQueryError(rc, message)
171
+
172
+
173
+ def _process_image(pid: int) -> str:
174
+ """取进程可执行文件完整路径;系统进程或权限不足时返回空串。"""
175
+ if not pid:
176
+ return ""
177
+ k32 = _load_kernel32()
178
+ handle = k32.OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, False, pid)
179
+ if not handle:
180
+ return ""
181
+ try:
182
+ size = wintypes.DWORD(32768)
183
+ buffer = ctypes.create_unicode_buffer(size.value)
184
+ if not k32.QueryFullProcessImageNameW(handle, 0, buffer, ctypes.byref(size)):
185
+ return ""
186
+ return buffer.value
187
+ finally:
188
+ k32.CloseHandle(handle)
189
+
190
+
191
+ def collect_files(
192
+ path: str,
193
+ *,
194
+ deep: bool = True,
195
+ max_files: int = _DEFAULT_MAX_FILES,
196
+ ) -> List[str]:
197
+ """把文件或目录展开成待检测的绝对路径列表(去重、保序)。"""
198
+ target = os.path.abspath(os.fspath(path))
199
+ if os.path.isfile(target):
200
+ return [target]
201
+ if not os.path.isdir(target):
202
+ raise FileNotFoundError("path not found: %s" % path)
203
+
204
+ files: List[str] = []
205
+ if deep:
206
+ for root, _dirs, names in os.walk(target):
207
+ for name in names:
208
+ files.append(os.path.join(root, name))
209
+ if len(files) >= max_files:
210
+ return files
211
+ else:
212
+ with os.scandir(target) as entries:
213
+ for entry in entries:
214
+ if entry.is_file():
215
+ files.append(entry.path)
216
+ if len(files) >= max_files:
217
+ break
218
+ return files
219
+
220
+
221
+ def _read_holders(rm, session: wintypes.DWORD) -> List[LockHolder]:
222
+ needed = wintypes.UINT(0)
223
+ count = wintypes.UINT(0)
224
+ reasons = wintypes.DWORD(0)
225
+ rc = rm.RmGetList(
226
+ session, ctypes.byref(needed), ctypes.byref(count), None, ctypes.byref(reasons)
227
+ )
228
+ if rc == ERROR_SUCCESS:
229
+ return []
230
+ if rc != ERROR_MORE_DATA:
231
+ _raise_for(rc)
232
+ if not needed.value:
233
+ return []
234
+
235
+ infos = (_RM_PROCESS_INFO * needed.value)()
236
+ count = wintypes.UINT(needed.value)
237
+ rc = rm.RmGetList(
238
+ session, ctypes.byref(needed), ctypes.byref(count), infos, ctypes.byref(reasons)
239
+ )
240
+ if rc != ERROR_SUCCESS:
241
+ _raise_for(rc)
242
+
243
+ holders: List[LockHolder] = []
244
+ seen = set()
245
+ for index in range(count.value):
246
+ info = infos[index]
247
+ pid = int(info.Process.dwProcessId)
248
+ service = info.strServiceShortName
249
+ app_name = info.strAppName
250
+ key: Tuple[int, str, str] = (pid, service, app_name)
251
+ if key in seen:
252
+ continue
253
+ seen.add(key)
254
+ image_path = _process_image(pid)
255
+ holders.append(
256
+ LockHolder(
257
+ pid=pid,
258
+ image=os.path.basename(image_path) if image_path else "",
259
+ image_path=image_path,
260
+ app_name=app_name,
261
+ service=service,
262
+ kind=APP_TYPES.get(int(info.ApplicationType), "Unknown"),
263
+ session_id=int(info.TSSessionId),
264
+ restartable=bool(info.bRestartable),
265
+ )
266
+ )
267
+ return holders
268
+
269
+
270
+ def _query(files: Sequence[str]) -> List[LockHolder]:
271
+ rm = _load_rm()
272
+ session = wintypes.DWORD(0)
273
+ key = ctypes.create_unicode_buffer(CCH_RM_SESSION_KEY + 1)
274
+ rc = rm.RmStartSession(ctypes.byref(session), 0, key)
275
+ if rc != ERROR_SUCCESS:
276
+ _raise_for(rc)
277
+
278
+ try:
279
+ for start in range(0, len(files), _REGISTER_BATCH):
280
+ chunk = list(files[start : start + _REGISTER_BATCH])
281
+ array = (wintypes.LPCWSTR * len(chunk))(*chunk)
282
+ rc = rm.RmRegisterResources(session, len(chunk), array, 0, None, 0, None)
283
+ if rc != ERROR_SUCCESS:
284
+ _raise_for(rc)
285
+ return _read_holders(rm, session)
286
+ finally:
287
+ rm.RmEndSession(session)
288
+
289
+
290
+ def who_locks(
291
+ path: str,
292
+ *,
293
+ deep: bool = True,
294
+ max_files: int = _DEFAULT_MAX_FILES,
295
+ ) -> List[LockHolder]:
296
+ """返回占用 ``path`` 的进程列表;未被占用时返回空列表。
297
+
298
+ ``path`` 可以是文件,也可以是目录。目录默认递归展开,
299
+ 最多检测 ``max_files`` 个文件(防止误扫整个盘)。
300
+ """
301
+ files = collect_files(path, deep=deep, max_files=max_files)
302
+ if not files:
303
+ return []
304
+ return _query(files)
wholocks/py.typed ADDED
File without changes
@@ -0,0 +1,138 @@
1
+ Metadata-Version: 2.5
2
+ Name: wholocks
3
+ Version: 0.1.0
4
+ Summary: Find out which Windows process is locking a file. No admin rights, no Sysinternals.
5
+ Project-URL: Homepage, https://github.com/Python-and-Cpp/wholocks
6
+ Project-URL: Repository, https://github.com/Python-and-Cpp/wholocks
7
+ Project-URL: Issues, https://github.com/Python-and-Cpp/wholocks/issues
8
+ Author: wholocks contributors
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Keywords: file-lock,handle,locked-file,node_modules,restart-manager,windows
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Environment :: Win32 (MS Windows)
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: System Administrators
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Operating System :: Microsoft :: Windows
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Topic :: System :: Systems Administration
25
+ Classifier: Topic :: Utilities
26
+ Classifier: Typing :: Typed
27
+ Requires-Python: >=3.9
28
+ Provides-Extra: dev
29
+ Requires-Dist: pytest>=8; extra == 'dev'
30
+ Provides-Extra: docs
31
+ Requires-Dist: pillow>=10; extra == 'docs'
32
+ Description-Content-Type: text/markdown
33
+
34
+ # wholocks
35
+
36
+ **Find out which Windows process is locking a file — no admin rights, no Sysinternals.**
37
+
38
+ ![wholocks demo](https://raw.githubusercontent.com/Python-and-Cpp/wholocks/main/docs/demo.gif)
39
+
40
+ Windows only ever says *"The process cannot access the file because it is being used by another process."*
41
+ `wholocks` tells you **which** process, so you can stop guessing and go close it.
42
+
43
+ Works on files and on whole directories (it walks the tree), and exits with `1` when something
44
+ is locked — so it drops straight into scripts, Makefiles and CI without parsing output.
45
+
46
+ ## Install
47
+
48
+ ```console
49
+ uvx wholocks path\to\file # run once, nothing installed
50
+ uv tool install wholocks # or: pipx install wholocks
51
+ pip install wholocks
52
+ ```
53
+
54
+ Requires Python 3.9+ on Windows. No runtime dependencies.
55
+
56
+ ## Usage
57
+
58
+ ```console
59
+ wholocks build\app.exe # single file
60
+ wholocks .\build # recursive directory scan
61
+ wholocks --no-deep .\build # only files directly inside
62
+ wholocks --json .\build # machine-readable output
63
+ wholocks -q .\build .\dist # quiet: print only locked paths
64
+ ```
65
+
66
+ Example output for a locked file:
67
+
68
+ ```console
69
+ $ wholocks .\dist
70
+ D:\proj\dist
71
+ PID 24916 Code.exe (Visual Studio Code · MainWindow)
72
+ C:\Users\me\AppData\Local\Programs\Microsoft VS Code\Code.exe
73
+ ```
74
+
75
+ `wholocks` reports the PID, the process image, the application name, and whether the holder is
76
+ a window, a console, a service or a critical process — enough to decide whether to close it,
77
+ restart it, or run as administrator.
78
+
79
+ ### Exit codes
80
+
81
+ | Code | Meaning |
82
+ | --- | --- |
83
+ | `0` | nothing is locking the path |
84
+ | `1` | at least one process holds the path |
85
+ | `2` | query failed (path missing, access denied, invalid arguments) |
86
+
87
+ ```powershell
88
+ if (wholocks .\dist) { Write-Host "still locked, aborting build" }
89
+ ```
90
+
91
+ ## Python API
92
+
93
+ ```python
94
+ from wholocks import who_locks
95
+
96
+ for holder in who_locks(r"C:\proj\build"):
97
+ print(holder.pid, holder.image, holder.app_name, holder.kind)
98
+
99
+ # empty list when nothing is holding it
100
+ assert who_locks(r"C:\proj\build") == []
101
+ ```
102
+
103
+ ## How it works
104
+
105
+ It calls the **Restart Manager** API (`rstrtmgr.dll`: `RmStartSession` → `RmRegisterResources`
106
+ → `RmGetList`). This is the exact API Windows installers use to decide whether a file can be
107
+ replaced or a reboot is required, so the results match what Windows itself believes.
108
+
109
+ Compared to the alternatives:
110
+
111
+ - `handle.exe` (Sysinternals) requires downloading a separate tool, usually running elevated,
112
+ and re-resolving PIDs by hand.
113
+ - `psutil` can enumerate modules and open files, but not reliably, and not without elevated
114
+ privileges for other processes.
115
+
116
+ `wholocks` is pure `ctypes`, ships nothing to download, and needs no elevation for your own
117
+ processes.
118
+
119
+ ## Limitations
120
+
121
+ - A directory is expanded into its files. A folder that is only held as some process's *working
122
+ directory* is not reported — that is a Restart Manager characteristic, not a bug.
123
+ - System processes and services may require an elevated shell; in that case `wholocks` exits with
124
+ `2` and tells you so.
125
+ - Network shares and files locked on other machines are out of scope.
126
+ - Large directories are capped by `--max-files` (default 20000) to avoid scanning an entire drive.
127
+
128
+ ## Development
129
+
130
+ ```console
131
+ uv sync --extra dev
132
+ uv run pytest -q
133
+ python scripts/make_demo.py # regenerate docs/demo.gif from a real run
134
+ ```
135
+
136
+ ## License
137
+
138
+ MIT
@@ -0,0 +1,10 @@
1
+ wholocks/__init__.py,sha256=nue6cyk_PxtyJpefb4_0MAIhS5Tp0EujzF2G9XIcptQ,226
2
+ wholocks/__main__.py,sha256=4JMK66Wj4uLZTKbF-sT3LAxOsr6buig77PmOkJCRRxw,83
3
+ wholocks/cli.py,sha256=zlGmsGZXqchdK0aFzlUduJsj1qoQFH8yuYzaOLuTOAI,3204
4
+ wholocks/core.py,sha256=NjHP-adtPBHYmTwQlRaMCExvZuDx5LPYe8ZltZb6DAQ,8877
5
+ wholocks/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ wholocks-0.1.0.dist-info/METADATA,sha256=XfwTRPk_gablg-zOa1qy3jQjBqWm0UTWOjQHNqtEw2w,4868
7
+ wholocks-0.1.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
8
+ wholocks-0.1.0.dist-info/entry_points.txt,sha256=FzSVaADQGwQhQIvpTtrudk8EhYpzukGN2msMRKEdShY,47
9
+ wholocks-0.1.0.dist-info/licenses/LICENSE,sha256=XNErKCly5n8rQca4NKn9kJWEE-hCNMiXP-2f8hJgzfI,1078
10
+ wholocks-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.33.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ wholocks = wholocks.cli:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 wholocks contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.