imap-agent-cli 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.
imap_agent_cli/mime.py ADDED
@@ -0,0 +1,319 @@
1
+ from __future__ import annotations
2
+
3
+ import hashlib
4
+ import html
5
+ import mimetypes
6
+ import os
7
+ import re
8
+ import shutil
9
+ from email import policy
10
+ from email.headerregistry import Address
11
+ from email.message import EmailMessage, Message
12
+ from email.parser import BytesParser
13
+ from email.utils import getaddresses, make_msgid
14
+ from pathlib import Path
15
+ from typing import Any, Iterable
16
+
17
+ from .errors import AppError
18
+ from .models import AttachmentInfo
19
+
20
+
21
+ BODY_FORMATS = {"html", "markdown", "plain", "raw-html", "metadata"}
22
+
23
+
24
+ def parse_message(raw: bytes) -> EmailMessage:
25
+ parsed = BytesParser(policy=policy.default).parsebytes(raw)
26
+ if not isinstance(parsed, EmailMessage):
27
+ raise AppError("server_error", "Parsed message was not an EmailMessage.")
28
+ return parsed
29
+
30
+
31
+ def addresses(header_values: Iterable[str | None]) -> list[dict[str, str]]:
32
+ raw = [value for value in header_values if value]
33
+ return [{"name": name, "email": email} for name, email in getaddresses(raw)]
34
+
35
+
36
+ def message_headers(message: Message) -> dict[str, Any]:
37
+ return {
38
+ "subject": str(message.get("subject", "")),
39
+ "from": addresses(message.get_all("from", [])),
40
+ "to": addresses(message.get_all("to", [])),
41
+ "cc": addresses(message.get_all("cc", [])),
42
+ "bcc": addresses(message.get_all("bcc", [])),
43
+ "reply_to": addresses(message.get_all("reply-to", [])),
44
+ }
45
+
46
+
47
+ def _part_payload_text(part: Message) -> str:
48
+ payload = part.get_payload(decode=True)
49
+ if payload is None:
50
+ value = part.get_payload()
51
+ return value if isinstance(value, str) else ""
52
+ charset = part.get_content_charset() or "utf-8"
53
+ return payload.decode(charset, errors="replace")
54
+
55
+
56
+ def _body_parts(message: EmailMessage) -> tuple[str | None, str | None]:
57
+ plain: str | None = None
58
+ html_body: str | None = None
59
+ if message.is_multipart():
60
+ for part in message.walk():
61
+ if part.is_multipart():
62
+ continue
63
+ disposition = (part.get_content_disposition() or "").lower()
64
+ if disposition == "attachment":
65
+ continue
66
+ ctype = part.get_content_type().lower()
67
+ if ctype == "text/plain" and plain is None:
68
+ plain = _part_payload_text(part)
69
+ elif ctype == "text/html" and html_body is None:
70
+ html_body = _part_payload_text(part)
71
+ else:
72
+ ctype = message.get_content_type().lower()
73
+ if ctype == "text/html":
74
+ html_body = _part_payload_text(message)
75
+ elif ctype == "text/plain":
76
+ plain = _part_payload_text(message)
77
+ return plain, html_body
78
+
79
+
80
+ def sanitize_html(value: str) -> str:
81
+ try:
82
+ import bleach
83
+ except ImportError:
84
+ return html.escape(value)
85
+ allowed_tags = {
86
+ "a",
87
+ "abbr",
88
+ "b",
89
+ "blockquote",
90
+ "br",
91
+ "code",
92
+ "div",
93
+ "em",
94
+ "h1",
95
+ "h2",
96
+ "h3",
97
+ "h4",
98
+ "h5",
99
+ "h6",
100
+ "hr",
101
+ "i",
102
+ "li",
103
+ "ol",
104
+ "p",
105
+ "pre",
106
+ "span",
107
+ "strong",
108
+ "table",
109
+ "tbody",
110
+ "td",
111
+ "th",
112
+ "thead",
113
+ "tr",
114
+ "u",
115
+ "ul",
116
+ }
117
+ allowed_attrs = {
118
+ "a": ["href", "title"],
119
+ "abbr": ["title"],
120
+ "td": ["colspan", "rowspan"],
121
+ "th": ["colspan", "rowspan"],
122
+ }
123
+ cleaned = bleach.clean(
124
+ value,
125
+ tags=allowed_tags,
126
+ attributes=allowed_attrs,
127
+ protocols={"http", "https", "mailto"},
128
+ strip=True,
129
+ )
130
+ return bleach.linkify(cleaned)
131
+
132
+
133
+ def html_to_plain(value: str) -> str:
134
+ try:
135
+ from bs4 import BeautifulSoup
136
+ except ImportError:
137
+ return re.sub(r"<[^>]+>", " ", value)
138
+ soup = BeautifulSoup(value, "html.parser")
139
+ for tag in soup(["script", "style", "iframe", "object"]):
140
+ tag.decompose()
141
+ return soup.get_text("\n", strip=True)
142
+
143
+
144
+ def html_to_markdown(value: str) -> str:
145
+ try:
146
+ from markdownify import markdownify
147
+ except ImportError:
148
+ return html_to_plain(value)
149
+ return markdownify(sanitize_html(value), heading_style="ATX")
150
+
151
+
152
+ def render_body(message: EmailMessage, body_format: str, max_chars: int) -> dict[str, Any]:
153
+ if body_format not in BODY_FORMATS:
154
+ raise AppError("invalid_request", f"unsupported body format '{body_format}'.")
155
+ if body_format == "metadata":
156
+ return {"format": "metadata", "content": "", "sanitized": False, "truncated": False, "max_chars": max_chars}
157
+ plain, html_body = _body_parts(message)
158
+ sanitized = False
159
+ if body_format == "html":
160
+ if html_body is not None:
161
+ content = sanitize_html(html_body)
162
+ sanitized = True
163
+ else:
164
+ content = plain or ""
165
+ elif body_format == "raw-html":
166
+ content = html_body if html_body is not None else (plain or "")
167
+ elif body_format == "markdown":
168
+ content = html_to_markdown(html_body) if html_body is not None else (plain or "")
169
+ sanitized = html_body is not None
170
+ else:
171
+ content = plain if plain is not None else html_to_plain(html_body or "")
172
+ truncated = len(content) > max_chars
173
+ if truncated:
174
+ content = content[:max_chars]
175
+ return {
176
+ "format": body_format,
177
+ "content": content,
178
+ "sanitized": sanitized,
179
+ "truncated": truncated,
180
+ "max_chars": max_chars,
181
+ }
182
+
183
+
184
+ def attachment_infos(message: EmailMessage) -> list[AttachmentInfo]:
185
+ infos: list[AttachmentInfo] = []
186
+ index = 1
187
+ for part in message.walk():
188
+ if part.is_multipart():
189
+ continue
190
+ filename = part.get_filename()
191
+ disposition = (part.get_content_disposition() or "").lower()
192
+ content_id = part.get("content-id")
193
+ is_attachment = disposition == "attachment" or bool(filename)
194
+ is_inline = disposition == "inline"
195
+ if not is_attachment and not is_inline:
196
+ continue
197
+ payload = part.get_payload(decode=True) or b""
198
+ infos.append(
199
+ AttachmentInfo(
200
+ part_id=str(index),
201
+ filename=filename or f"part-{index}",
202
+ content_type=part.get_content_type(),
203
+ size_bytes=len(payload),
204
+ content_id=content_id.strip("<>") if content_id else None,
205
+ inline=is_inline,
206
+ )
207
+ )
208
+ index += 1
209
+ return infos
210
+
211
+
212
+ def safe_filename(filename: str) -> str:
213
+ base = os.path.basename(filename).strip().replace("\x00", "")
214
+ base = re.sub(r"[^A-Za-z0-9._ -]+", "_", base)
215
+ base = base.strip(" .")
216
+ return base or "attachment"
217
+
218
+
219
+ def save_attachments(
220
+ message: EmailMessage,
221
+ output_dir: Path,
222
+ *,
223
+ part_id: str | None = None,
224
+ all_parts: bool = False,
225
+ include_inline: bool = False,
226
+ overwrite: bool = False,
227
+ ) -> list[dict[str, Any]]:
228
+ output_dir.mkdir(parents=True, exist_ok=True)
229
+ saved: list[dict[str, Any]] = []
230
+ index = 1
231
+ for part in message.walk():
232
+ if part.is_multipart():
233
+ continue
234
+ filename = part.get_filename()
235
+ disposition = (part.get_content_disposition() or "").lower()
236
+ is_inline = disposition == "inline"
237
+ is_attachment = disposition == "attachment" or bool(filename)
238
+ if not is_attachment and not (include_inline and is_inline):
239
+ continue
240
+ current_id = str(index)
241
+ index += 1
242
+ if not all_parts and current_id != part_id:
243
+ continue
244
+ if is_inline and not include_inline:
245
+ continue
246
+ payload = part.get_payload(decode=True) or b""
247
+ target = output_dir / safe_filename(filename or f"part-{current_id}")
248
+ if target.exists() and not overwrite:
249
+ raise AppError("invalid_request", f"refusing to overwrite existing file: {target}")
250
+ target.write_bytes(payload)
251
+ saved.append(
252
+ {
253
+ "part_id": current_id,
254
+ "path": str(target.resolve()),
255
+ "filename": target.name,
256
+ "content_type": part.get_content_type(),
257
+ "size_bytes": len(payload),
258
+ "sha256": hashlib.sha256(payload).hexdigest(),
259
+ "inline": is_inline,
260
+ }
261
+ )
262
+ if not saved:
263
+ raise AppError("attachment_not_found", "no matching attachment was found.")
264
+ return saved
265
+
266
+
267
+ def _set_addresses(message: EmailMessage, header: str, values: list[str]) -> None:
268
+ if values:
269
+ message[header] = ", ".join(values)
270
+
271
+
272
+ def create_draft_message(
273
+ *,
274
+ sender: str,
275
+ to: list[str],
276
+ cc: list[str] | None,
277
+ bcc: list[str] | None,
278
+ subject: str,
279
+ body: str,
280
+ body_format: str,
281
+ attachments: list[Path] | None = None,
282
+ in_reply_to: str | None = None,
283
+ references: str | None = None,
284
+ ) -> EmailMessage:
285
+ message = EmailMessage()
286
+ message["Message-ID"] = make_msgid()
287
+ message["From"] = sender
288
+ _set_addresses(message, "To", to)
289
+ _set_addresses(message, "Cc", cc or [])
290
+ _set_addresses(message, "Bcc", bcc or [])
291
+ message["Subject"] = subject
292
+ if in_reply_to:
293
+ message["In-Reply-To"] = in_reply_to
294
+ if references:
295
+ message["References"] = references
296
+ if body_format == "html":
297
+ message.set_content(html_to_plain(body))
298
+ message.add_alternative(body, subtype="html")
299
+ elif body_format == "markdown":
300
+ message.set_content(body)
301
+ elif body_format == "plain":
302
+ message.set_content(body)
303
+ else:
304
+ raise AppError("invalid_request", "draft body format must be html, markdown, or plain.")
305
+ for attachment in attachments or []:
306
+ ctype, _ = mimetypes.guess_type(str(attachment))
307
+ maintype, subtype = (ctype or "application/octet-stream").split("/", 1)
308
+ message.add_attachment(
309
+ attachment.read_bytes(),
310
+ maintype=maintype,
311
+ subtype=subtype,
312
+ filename=attachment.name,
313
+ )
314
+ return message
315
+
316
+
317
+ def copy_attachment(src: Path, dest: Path) -> None:
318
+ dest.parent.mkdir(parents=True, exist_ok=True)
319
+ shutil.copyfile(src, dest)
@@ -0,0 +1,50 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass, field
4
+ from pathlib import Path
5
+
6
+
7
+ @dataclass(frozen=True)
8
+ class Defaults:
9
+ profile: str = "default"
10
+ format: str = "json"
11
+ default_folder: str = "INBOX"
12
+ max_results: int = 25
13
+ max_body_chars: int = 12000
14
+ connect_timeout_seconds: int = 15
15
+ read_timeout_seconds: int = 30
16
+ body_format: str = "html"
17
+ include_attachments: bool = False
18
+ exclude_special_folders_from_all: tuple[str, ...] = ("junk", "spam")
19
+
20
+
21
+ @dataclass(frozen=True)
22
+ class Profile:
23
+ name: str
24
+ host: str
25
+ port: int = 993
26
+ username: str = ""
27
+ password: str | None = None
28
+ password_env: str = "IMAP_AGENT_CLI_PASSWORD"
29
+ tls: bool = True
30
+ ssl_mode: str = "required"
31
+ drafts_folder: str = ""
32
+ connect_timeout_seconds: int = 15
33
+ read_timeout_seconds: int = 30
34
+
35
+
36
+ @dataclass(frozen=True)
37
+ class Config:
38
+ defaults: Defaults = field(default_factory=Defaults)
39
+ profiles: dict[str, Profile] = field(default_factory=dict)
40
+ path: Path | None = None
41
+
42
+
43
+ @dataclass(frozen=True)
44
+ class AttachmentInfo:
45
+ part_id: str
46
+ filename: str
47
+ content_type: str
48
+ size_bytes: int | None
49
+ content_id: str | None
50
+ inline: bool
@@ -0,0 +1,39 @@
1
+ from __future__ import annotations
2
+
3
+ import json
4
+ import sys
5
+ from dataclasses import asdict, is_dataclass
6
+ from datetime import date, datetime
7
+ from pathlib import Path
8
+ from typing import Any
9
+
10
+ from .errors import AppError
11
+
12
+
13
+ def _default(value: Any) -> Any:
14
+ if is_dataclass(value):
15
+ return asdict(value)
16
+ if isinstance(value, (datetime, date)):
17
+ return value.isoformat()
18
+ if isinstance(value, Path):
19
+ return str(value)
20
+ if isinstance(value, bytes):
21
+ return value.decode("utf-8", errors="replace")
22
+ raise TypeError(f"{type(value).__name__} is not JSON serializable")
23
+
24
+
25
+ def write_json(payload: Any) -> None:
26
+ sys.stdout.write(json.dumps(payload, default=_default, ensure_ascii=False, indent=2))
27
+ sys.stdout.write("\n")
28
+
29
+
30
+ def write_error(error: AppError) -> None:
31
+ payload = {
32
+ "error": {
33
+ "code": error.code,
34
+ "message": error.message,
35
+ "retryable": error.retryable,
36
+ }
37
+ }
38
+ sys.stderr.write(json.dumps(payload, ensure_ascii=False))
39
+ sys.stderr.write("\n")
@@ -0,0 +1,30 @@
1
+ from __future__ import annotations
2
+
3
+ from datetime import date
4
+ from typing import Any
5
+
6
+ from .errors import AppError
7
+
8
+
9
+ def parse_date(value: str | None, name: str) -> date | None:
10
+ if not value:
11
+ return None
12
+ try:
13
+ return date.fromisoformat(value)
14
+ except ValueError as exc:
15
+ raise AppError("invalid_request", f"{name} must be YYYY-MM-DD.") from exc
16
+
17
+
18
+ def build_criteria(*, subject: str | None, sender: str | None, since: str | None, before: str | None) -> list[Any]:
19
+ criteria: list[Any] = []
20
+ if subject:
21
+ criteria.extend(["SUBJECT", subject])
22
+ if sender:
23
+ criteria.extend(["FROM", sender])
24
+ since_date = parse_date(since, "--since")
25
+ before_date = parse_date(before, "--before")
26
+ if since_date:
27
+ criteria.extend(["SINCE", since_date])
28
+ if before_date:
29
+ criteria.extend(["BEFORE", before_date])
30
+ return criteria or ["ALL"]
@@ -0,0 +1,164 @@
1
+ Metadata-Version: 2.4
2
+ Name: imap-agent-cli
3
+ Version: 0.1.0
4
+ Summary: Agent-first IMAP CLI for safe email search, read, attachment download, and draft creation
5
+ Project-URL: Homepage, https://github.com/pseudosavant/imap-agent-cli
6
+ Project-URL: Repository, https://github.com/pseudosavant/imap-agent-cli
7
+ Project-URL: Issues, https://github.com/pseudosavant/imap-agent-cli/issues
8
+ Author: Paul
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: agent,cli,drafts,email,imap
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Communications :: Email
22
+ Classifier: Topic :: Communications :: Email :: Post-Office :: IMAP
23
+ Classifier: Topic :: Utilities
24
+ Requires-Python: >=3.11
25
+ Requires-Dist: beautifulsoup4>=4.12.0
26
+ Requires-Dist: bleach>=6.2.0
27
+ Requires-Dist: imapclient>=3.0.0
28
+ Requires-Dist: markdownify>=0.14.0
29
+ Provides-Extra: test
30
+ Requires-Dist: pymap>=0.36.0; extra == 'test'
31
+ Requires-Dist: pytest>=8.0.0; extra == 'test'
32
+ Description-Content-Type: text/markdown
33
+
34
+ # imap-agent-cli
35
+
36
+ `imap-agent-cli` is an agent-first IMAP CLI for safe email search, read, attachment download, and draft creation.
37
+
38
+ It can inspect mailboxes and append messages to Drafts. It cannot send email, delete messages, move messages, archive messages, change labels, alter flags, or mark messages read/unread.
39
+
40
+ ## Status
41
+
42
+ This repo is under active development. The behavior target is defined in [`spec.md`](./spec.md).
43
+
44
+ ## Quick Start
45
+
46
+ Single-profile env-var setup:
47
+
48
+ ```text
49
+ IMAP_AGENT_CLI_HOST=imap.example.com
50
+ IMAP_AGENT_CLI_PORT=993
51
+ IMAP_AGENT_CLI_USERNAME=me@example.com
52
+ IMAP_AGENT_CLI_PASSWORD=...
53
+ IMAP_AGENT_CLI_TLS=true
54
+ ```
55
+
56
+ Local development:
57
+
58
+ ```text
59
+ uv run ./imap_agent_cli.py --help
60
+ uv run ./imap_agent_cli.py folders
61
+ uv run ./imap_agent_cli.py search --subject invoice
62
+ ```
63
+
64
+ Packaged execution:
65
+
66
+ ```text
67
+ uvx imap-agent-cli --help
68
+ ```
69
+
70
+ ## Examples
71
+
72
+ ```text
73
+ imap-agent-cli folders
74
+ imap-agent-cli search --folder INBOX --subject "invoice" --max-results 10
75
+ imap-agent-cli read --folder INBOX --uid 12345 --body-format html
76
+ imap-agent-cli attachments --folder INBOX --uid 12345
77
+ imap-agent-cli attachments download --folder INBOX --uid 12345 --part-id 2 --output-dir C:\tmp\email-attachments
78
+ imap-agent-cli draft create --to person@example.com --subject "Hello" --body "Draft only."
79
+ imap-agent-cli draft reply --folder INBOX --uid 12345 --body "Thanks. I will review this."
80
+ ```
81
+
82
+ All command payloads are JSON on stdout. Diagnostics and errors go to stderr.
83
+
84
+ ## Config
85
+
86
+ Create a starter config:
87
+
88
+ ```text
89
+ imap-agent-cli config init
90
+ ```
91
+
92
+ Add a named profile:
93
+
94
+ ```text
95
+ imap-agent-cli config add-profile work --host imap.example.com --port 993 --username me@example.com --password-env IMAP_AGENT_CLI_WORK_PASSWORD
96
+ imap-agent-cli config set-default-profile work
97
+ ```
98
+
99
+ Config path:
100
+
101
+ ```text
102
+ ~/.imap-agent-cli/config.toml
103
+ ```
104
+
105
+ Secrets should stay in environment variables, not the config file.
106
+
107
+ ## Safety Boundary
108
+
109
+ Allowed:
110
+
111
+ - list folders
112
+ - search messages
113
+ - read messages with no-seen fetch behavior
114
+ - list/download attachments only when requested
115
+ - append new messages to Drafts
116
+
117
+ Not allowed:
118
+
119
+ - send
120
+ - delete
121
+ - move
122
+ - archive
123
+ - flag/star
124
+ - mark read/unread
125
+ - create/delete/rename folders
126
+
127
+ ## Testing
128
+
129
+ No-network unit tests:
130
+
131
+ ```text
132
+ python -m unittest discover -v
133
+ ```
134
+
135
+ Package build:
136
+
137
+ ```text
138
+ uv build --no-sources
139
+ ```
140
+
141
+ The spec targets `pymap` for future local IMAP integration tests on Windows without Docker.
142
+
143
+ Opt-in local IMAP integration test:
144
+
145
+ ```text
146
+ $env:IMAP_AGENT_CLI_TEST_PYMAP = "1"
147
+ uv run --extra test python -m unittest tests.test_pymap_integration -v
148
+ ```
149
+
150
+ The integration test starts `pymap dict --demo-data` locally and logs in with `demouser` / `demopass`.
151
+
152
+ ## Publishing
153
+
154
+ The GitHub Actions workflow is `.github/workflows/publish.yml`.
155
+
156
+ PyPI Trusted Publishing values:
157
+
158
+ ```text
159
+ Project: imap-agent-cli
160
+ Owner: pseudosavant
161
+ Repository: imap-agent-cli
162
+ Workflow: publish.yml
163
+ Environment: pypi
164
+ ```
@@ -0,0 +1,14 @@
1
+ imap_agent_cli/__init__.py,sha256=3CKD-Oy1m7buiht67UbWXl63n91U5jgvgb-b653pJpE,51
2
+ imap_agent_cli/cli.py,sha256=gu10GIZn7XbnIH1TsdHdvg4vvQnFBv8969n-ZVucIJE,16868
3
+ imap_agent_cli/config.py,sha256=_dj1CBeHCWxahXhtM0ws_mPzt-_tA5zLw-FIEFCTTxE,10747
4
+ imap_agent_cli/errors.py,sha256=PPdOcHz3oMjFXFMOYrOeHxcOmX25TrBvlu_Q13D8x1c,495
5
+ imap_agent_cli/imap_client.py,sha256=p7zPcYMXuZfQ7KZrgi-BwFNCql2x8yJ6Vyhiz13qvak,11380
6
+ imap_agent_cli/mime.py,sha256=7fxlG-JquVPV3TWOtVf-ThDigw5GF53XUPgF6pEQgIg,10116
7
+ imap_agent_cli/models.py,sha256=o68emsugmRNsqImYjmxntJ-XHlYAcRno2kt5KLqaP4I,1216
8
+ imap_agent_cli/render.py,sha256=8KxUNbDvNj6xir9hOrmD-w48zAyINhSD2fy6aTNs7uM,1058
9
+ imap_agent_cli/search.py,sha256=6sbVviu2nLdgIiC8ONViVy1c6T6RSC-E-zxtwbXlMSM,905
10
+ imap_agent_cli-0.1.0.dist-info/METADATA,sha256=1_N0uyUsvLn7U4nr2uqSYpw5H9uB8yzcAqicxgxGX40,4270
11
+ imap_agent_cli-0.1.0.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
12
+ imap_agent_cli-0.1.0.dist-info/entry_points.txt,sha256=5KCl2yztf4gYsXa4VeKlJcKOZkoZ4feSlDfqBsKQgMo,59
13
+ imap_agent_cli-0.1.0.dist-info/licenses/LICENSE,sha256=zGoYTIMLHXHfn4BCncvY2ibPNStrFU_8Vyw8XpcMUiE,1061
14
+ imap_agent_cli-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.30.1
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ imap-agent-cli = imap_agent_cli.cli:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Paul
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.