hammad-python 0.0.10__py3-none-any.whl → 0.0.12__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.
- hammad/__init__.py +177 -10
- hammad/_core/__init__.py +1 -0
- hammad/_core/_utils/__init__.py +4 -0
- hammad/_core/_utils/_import_utils.py +182 -0
- hammad/ai/__init__.py +59 -0
- hammad/ai/_utils.py +142 -0
- hammad/ai/completions/__init__.py +44 -0
- hammad/ai/completions/client.py +729 -0
- hammad/ai/completions/create.py +686 -0
- hammad/ai/completions/types.py +711 -0
- hammad/ai/completions/utils.py +374 -0
- hammad/ai/embeddings/__init__.py +35 -0
- hammad/ai/embeddings/client/__init__.py +1 -0
- hammad/ai/embeddings/client/base_embeddings_client.py +26 -0
- hammad/ai/embeddings/client/fastembed_text_embeddings_client.py +200 -0
- hammad/ai/embeddings/client/litellm_embeddings_client.py +288 -0
- hammad/ai/embeddings/create.py +159 -0
- hammad/ai/embeddings/types.py +69 -0
- hammad/base/__init__.py +35 -0
- hammad/base/fields.py +546 -0
- hammad/base/model.py +1078 -0
- hammad/base/utils.py +280 -0
- hammad/cache/__init__.py +48 -0
- hammad/cache/base_cache.py +181 -0
- hammad/cache/cache.py +169 -0
- hammad/cache/decorators.py +261 -0
- hammad/cache/file_cache.py +80 -0
- hammad/cache/ttl_cache.py +74 -0
- hammad/cli/__init__.py +33 -0
- hammad/cli/animations.py +604 -0
- hammad/cli/plugins.py +781 -0
- hammad/cli/styles/__init__.py +55 -0
- hammad/cli/styles/settings.py +139 -0
- hammad/cli/styles/types.py +358 -0
- hammad/cli/styles/utils.py +480 -0
- hammad/configuration/__init__.py +35 -0
- hammad/configuration/configuration.py +564 -0
- hammad/data/__init__.py +39 -0
- hammad/data/collections/__init__.py +34 -0
- hammad/data/collections/base_collection.py +58 -0
- hammad/data/collections/collection.py +452 -0
- hammad/data/collections/searchable_collection.py +556 -0
- hammad/data/collections/vector_collection.py +603 -0
- hammad/data/databases/__init__.py +21 -0
- hammad/data/databases/database.py +902 -0
- hammad/json/__init__.py +21 -0
- hammad/{utils/json → json}/converters.py +4 -1
- hammad/logging/__init__.py +35 -0
- hammad/logging/decorators.py +834 -0
- hammad/logging/logger.py +954 -0
- hammad/multimodal/__init__.py +24 -0
- hammad/multimodal/audio.py +96 -0
- hammad/multimodal/image.py +80 -0
- hammad/multithreading/__init__.py +304 -0
- hammad/pydantic/__init__.py +43 -0
- hammad/{utils/pydantic → pydantic}/converters.py +2 -1
- hammad/pydantic/models/__init__.py +28 -0
- hammad/pydantic/models/arbitrary_model.py +46 -0
- hammad/pydantic/models/cacheable_model.py +79 -0
- hammad/pydantic/models/fast_model.py +318 -0
- hammad/pydantic/models/function_model.py +176 -0
- hammad/pydantic/models/subscriptable_model.py +63 -0
- hammad/text/__init__.py +82 -0
- hammad/text/converters.py +723 -0
- hammad/{utils/markdown/formatting.py → text/markdown.py} +25 -23
- hammad/text/text.py +1066 -0
- hammad/types/__init__.py +11 -0
- hammad/types/file.py +358 -0
- hammad/{utils/typing/utils.py → typing/__init__.py} +142 -15
- hammad/web/__init__.py +43 -0
- hammad/web/http/__init__.py +1 -0
- hammad/web/http/client.py +944 -0
- hammad/web/models.py +245 -0
- hammad/web/openapi/client.py +740 -0
- hammad/web/search/__init__.py +1 -0
- hammad/web/search/client.py +988 -0
- hammad/web/utils.py +472 -0
- hammad/yaml/__init__.py +30 -0
- hammad/yaml/converters.py +19 -0
- {hammad_python-0.0.10.dist-info → hammad_python-0.0.12.dist-info}/METADATA +16 -7
- hammad_python-0.0.12.dist-info/RECORD +85 -0
- hammad/cache.py +0 -675
- hammad/database.py +0 -447
- hammad/logger.py +0 -273
- hammad/types/color.py +0 -951
- hammad/utils/markdown/__init__.py +0 -0
- hammad/utils/markdown/converters.py +0 -506
- hammad/utils/pydantic/__init__.py +0 -0
- hammad/utils/text/__init__.py +0 -0
- hammad/utils/text/converters.py +0 -229
- hammad/utils/typing/__init__.py +0 -0
- hammad_python-0.0.10.dist-info/RECORD +0 -22
- /hammad/{utils/__init__.py → py.typed} +0 -0
- /hammad/{utils/json → web/openapi}/__init__.py +0 -0
- {hammad_python-0.0.10.dist-info → hammad_python-0.0.12.dist-info}/WHEEL +0 -0
- {hammad_python-0.0.10.dist-info → hammad_python-0.0.12.dist-info}/licenses/LICENSE +0 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
"""hammad.utils.markdown
|
1
|
+
"""hammad.text.utils.markdown"""
|
2
2
|
|
3
3
|
from typing import (
|
4
4
|
List,
|
@@ -7,60 +7,62 @@ from typing import (
|
|
7
7
|
)
|
8
8
|
|
9
9
|
__all__ = (
|
10
|
-
"
|
11
|
-
"
|
12
|
-
"
|
13
|
-
"
|
14
|
-
"
|
15
|
-
"
|
16
|
-
"
|
17
|
-
"
|
18
|
-
"
|
19
|
-
"
|
20
|
-
"
|
10
|
+
"markdown_bold",
|
11
|
+
"markdown_italic",
|
12
|
+
"markdown_code",
|
13
|
+
"markdown_code_block",
|
14
|
+
"markdown_heading",
|
15
|
+
"markdown_link",
|
16
|
+
"markdown_list_item",
|
17
|
+
"markdown_table_row",
|
18
|
+
"markdown_blockquote",
|
19
|
+
"markdown_horizontal_rule",
|
20
|
+
"markdown_table",
|
21
21
|
)
|
22
22
|
|
23
23
|
|
24
|
-
def
|
24
|
+
def markdown_bold(text: str) -> str:
|
25
25
|
"""Format text as bold in Markdown."""
|
26
26
|
return f"**{text}**"
|
27
27
|
|
28
28
|
|
29
|
-
def
|
29
|
+
def markdown_italic(text: str) -> str:
|
30
30
|
"""Format text as italic in Markdown."""
|
31
31
|
return f"*{text}*"
|
32
32
|
|
33
33
|
|
34
|
-
def
|
34
|
+
def markdown_code(text: str) -> str:
|
35
35
|
"""Format text as inline code in Markdown."""
|
36
36
|
return f"`{text}`"
|
37
37
|
|
38
38
|
|
39
|
-
def
|
39
|
+
def markdown_code_block(text: str, language: str = "") -> str:
|
40
40
|
"""Format text as a code block in Markdown."""
|
41
41
|
return f"```{language}\n{text}\n```"
|
42
42
|
|
43
43
|
|
44
|
-
def
|
44
|
+
def markdown_heading(text: str, level: int = 1) -> str:
|
45
45
|
"""Format text as a heading in Markdown."""
|
46
46
|
if not 1 <= level <= 6:
|
47
47
|
level = 1
|
48
48
|
return f"{'#' * level} {text}"
|
49
49
|
|
50
50
|
|
51
|
-
def
|
51
|
+
def markdown_link(text: str, url: str) -> str:
|
52
52
|
"""Format text as a link in Markdown."""
|
53
53
|
return f"[{text}]({url})"
|
54
54
|
|
55
55
|
|
56
|
-
def
|
56
|
+
def markdown_list_item(
|
57
|
+
text: str, level: int = 0, ordered: bool = False, index: int = 1
|
58
|
+
) -> str:
|
57
59
|
"""Format text as a list item in Markdown."""
|
58
60
|
indent = " " * level
|
59
61
|
marker = f"{index}." if ordered else "-"
|
60
62
|
return f"{indent}{marker} {text}"
|
61
63
|
|
62
64
|
|
63
|
-
def
|
65
|
+
def markdown_table_row(cells: List[str], is_header: bool = False) -> str:
|
64
66
|
"""Format a table row in Markdown."""
|
65
67
|
row = "| " + " | ".join(cells) + " |"
|
66
68
|
if is_header:
|
@@ -69,19 +71,19 @@ def table_row(cells: List[str], is_header: bool = False) -> str:
|
|
69
71
|
return row
|
70
72
|
|
71
73
|
|
72
|
-
def
|
74
|
+
def markdown_blockquote(text: str, level: int = 1) -> str:
|
73
75
|
"""Format text as a blockquote in Markdown."""
|
74
76
|
prefix = ">" * level + " "
|
75
77
|
lines = text.split("\n")
|
76
78
|
return "\n".join(f"{prefix}{line}" for line in lines)
|
77
79
|
|
78
80
|
|
79
|
-
def
|
81
|
+
def markdown_horizontal_rule() -> str:
|
80
82
|
"""Create a horizontal rule in Markdown."""
|
81
83
|
return "---"
|
82
84
|
|
83
85
|
|
84
|
-
def
|
86
|
+
def markdown_table(
|
85
87
|
headers: List[str],
|
86
88
|
rows: List[List[str]],
|
87
89
|
alignment: Optional[List[Literal["left", "center", "right"]]] = None,
|