hammad-python 0.0.13__py3-none-any.whl → 0.0.15__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.
Files changed (87) hide show
  1. hammad_python-0.0.15.dist-info/METADATA +184 -0
  2. hammad_python-0.0.15.dist-info/RECORD +4 -0
  3. hammad/__init__.py +0 -180
  4. hammad/_core/__init__.py +0 -1
  5. hammad/_core/_utils/__init__.py +0 -4
  6. hammad/_core/_utils/_import_utils.py +0 -182
  7. hammad/ai/__init__.py +0 -59
  8. hammad/ai/_utils.py +0 -142
  9. hammad/ai/completions/__init__.py +0 -44
  10. hammad/ai/completions/client.py +0 -729
  11. hammad/ai/completions/create.py +0 -686
  12. hammad/ai/completions/types.py +0 -711
  13. hammad/ai/completions/utils.py +0 -374
  14. hammad/ai/embeddings/__init__.py +0 -35
  15. hammad/ai/embeddings/client/__init__.py +0 -1
  16. hammad/ai/embeddings/client/base_embeddings_client.py +0 -26
  17. hammad/ai/embeddings/client/fastembed_text_embeddings_client.py +0 -200
  18. hammad/ai/embeddings/client/litellm_embeddings_client.py +0 -288
  19. hammad/ai/embeddings/create.py +0 -159
  20. hammad/ai/embeddings/types.py +0 -69
  21. hammad/base/__init__.py +0 -35
  22. hammad/base/fields.py +0 -546
  23. hammad/base/model.py +0 -1078
  24. hammad/base/utils.py +0 -280
  25. hammad/cache/__init__.py +0 -48
  26. hammad/cache/base_cache.py +0 -181
  27. hammad/cache/cache.py +0 -169
  28. hammad/cache/decorators.py +0 -261
  29. hammad/cache/file_cache.py +0 -80
  30. hammad/cache/ttl_cache.py +0 -74
  31. hammad/cli/__init__.py +0 -33
  32. hammad/cli/animations.py +0 -604
  33. hammad/cli/plugins.py +0 -781
  34. hammad/cli/styles/__init__.py +0 -55
  35. hammad/cli/styles/settings.py +0 -139
  36. hammad/cli/styles/types.py +0 -358
  37. hammad/cli/styles/utils.py +0 -480
  38. hammad/configuration/__init__.py +0 -35
  39. hammad/configuration/configuration.py +0 -564
  40. hammad/data/__init__.py +0 -39
  41. hammad/data/collections/__init__.py +0 -34
  42. hammad/data/collections/base_collection.py +0 -58
  43. hammad/data/collections/collection.py +0 -452
  44. hammad/data/collections/searchable_collection.py +0 -556
  45. hammad/data/collections/vector_collection.py +0 -603
  46. hammad/data/databases/__init__.py +0 -21
  47. hammad/data/databases/database.py +0 -902
  48. hammad/json/__init__.py +0 -21
  49. hammad/json/converters.py +0 -152
  50. hammad/logging/__init__.py +0 -35
  51. hammad/logging/decorators.py +0 -834
  52. hammad/logging/logger.py +0 -954
  53. hammad/multimodal/__init__.py +0 -24
  54. hammad/multimodal/audio.py +0 -96
  55. hammad/multimodal/image.py +0 -80
  56. hammad/multithreading/__init__.py +0 -304
  57. hammad/py.typed +0 -0
  58. hammad/pydantic/__init__.py +0 -43
  59. hammad/pydantic/converters.py +0 -623
  60. hammad/pydantic/models/__init__.py +0 -28
  61. hammad/pydantic/models/arbitrary_model.py +0 -46
  62. hammad/pydantic/models/cacheable_model.py +0 -79
  63. hammad/pydantic/models/fast_model.py +0 -318
  64. hammad/pydantic/models/function_model.py +0 -176
  65. hammad/pydantic/models/subscriptable_model.py +0 -63
  66. hammad/text/__init__.py +0 -82
  67. hammad/text/converters.py +0 -723
  68. hammad/text/markdown.py +0 -131
  69. hammad/text/text.py +0 -1066
  70. hammad/types/__init__.py +0 -11
  71. hammad/types/file.py +0 -358
  72. hammad/typing/__init__.py +0 -407
  73. hammad/web/__init__.py +0 -43
  74. hammad/web/http/__init__.py +0 -1
  75. hammad/web/http/client.py +0 -944
  76. hammad/web/models.py +0 -245
  77. hammad/web/openapi/__init__.py +0 -0
  78. hammad/web/openapi/client.py +0 -740
  79. hammad/web/search/__init__.py +0 -1
  80. hammad/web/search/client.py +0 -988
  81. hammad/web/utils.py +0 -472
  82. hammad/yaml/__init__.py +0 -30
  83. hammad/yaml/converters.py +0 -19
  84. hammad_python-0.0.13.dist-info/METADATA +0 -38
  85. hammad_python-0.0.13.dist-info/RECORD +0 -85
  86. {hammad_python-0.0.13.dist-info → hammad_python-0.0.15.dist-info}/WHEEL +0 -0
  87. {hammad_python-0.0.13.dist-info → hammad_python-0.0.15.dist-info}/licenses/LICENSE +0 -0
hammad/json/__init__.py DELETED
@@ -1,21 +0,0 @@
1
- """hammad.utils.json"""
2
-
3
- from typing import TYPE_CHECKING
4
- from .._core._utils._import_utils import _auto_create_getattr_loader
5
-
6
- if TYPE_CHECKING:
7
- from .converters import (
8
- convert_to_json_schema,
9
- encode_json,
10
- decode_json,
11
- )
12
-
13
- __all__ = ("convert_to_json_schema", "encode_json", "decode_json")
14
-
15
-
16
- __getattr__ = _auto_create_getattr_loader(__all__)
17
-
18
-
19
- def __dir__() -> list[str]:
20
- """Get the attributes of the json module."""
21
- return list(__all__)
hammad/json/converters.py DELETED
@@ -1,152 +0,0 @@
1
- """hammad.utils.json.utils
2
-
3
- Contains various utility functions used when working with JSON data."""
4
-
5
- import dataclasses
6
- from typing import Any
7
- import msgspec
8
- from msgspec.json import encode as encode_json, decode as decode_json
9
-
10
- from ..typing import get_type_description, inspection
11
-
12
- __all__ = (
13
- "SchemaError",
14
- "convert_to_json_schema",
15
- "encode",
16
- "decode",
17
- )
18
-
19
-
20
- class SchemaError(Exception):
21
- """An exception raised when a schema utility raises an error."""
22
-
23
-
24
- def convert_to_json_schema(t: Any) -> dict:
25
- """Converts various objects, types, and interfaces into
26
- a JSON schema.
27
-
28
- Args:
29
- t: The object, type, or interface to convert to a JSON schema.
30
-
31
- Returns:
32
- A JSON schema as a dictionary.
33
- """
34
- from dataclasses import is_dataclass, fields as dataclass_fields
35
- import inspect
36
- from typing import get_type_hints
37
-
38
- schema = {"type": "object", "properties": {}}
39
-
40
- # Handle msgspec Struct
41
- try:
42
- if isinstance(t, type) and issubclass(t, msgspec.Struct):
43
- struct_info = msgspec.structs.fields(t)
44
- for field in struct_info:
45
- field_type = field.type
46
- field_schema = {
47
- "type": get_type_description(field_type),
48
- "description": f"Field of type {get_type_description(field_type)}",
49
- }
50
- if field.default is not msgspec.NODEFAULT:
51
- field_schema["default"] = field.default
52
- schema["properties"][field.name] = field_schema
53
- return schema
54
- except (ImportError, AttributeError):
55
- pass
56
-
57
- # Handle Pydantic models
58
- try:
59
- from pydantic import BaseModel
60
-
61
- if isinstance(t, type) and issubclass(t, BaseModel):
62
- pydantic_schema = (
63
- t.model_json_schema() if hasattr(t, "model_json_schema") else t.schema()
64
- )
65
- return pydantic_schema
66
- except ImportError:
67
- pass
68
-
69
- # Handle dataclasses
70
- if is_dataclass(t):
71
- if isinstance(t, type):
72
- # Class-level dataclass
73
- for field in dataclass_fields(t):
74
- field_type = field.type
75
- field_schema = {
76
- "type": get_type_description(field_type),
77
- "description": f"Field of type {get_type_description(field_type)}",
78
- }
79
- if field.default is not dataclasses.MISSING:
80
- field_schema["default"] = field.default
81
- elif field.default_factory is not dataclasses.MISSING:
82
- field_schema["default"] = "factory function"
83
- schema["properties"][field.name] = field_schema
84
- else:
85
- # Instance-level dataclass
86
- for field in dataclass_fields(t):
87
- field_type = field.type
88
- field_schema = {
89
- "type": get_type_description(field_type),
90
- "description": f"Field of type {get_type_description(field_type)}",
91
- "value": getattr(t, field.name, None),
92
- }
93
- schema["properties"][field.name] = field_schema
94
- return schema
95
-
96
- # Handle regular classes with type hints (including abstract classes)
97
- if inspect.isclass(t):
98
- try:
99
- type_hints = get_type_hints(t)
100
- for name, type_hint in type_hints.items():
101
- schema["properties"][name] = {
102
- "type": get_type_description(type_hint),
103
- "description": f"Field of type {get_type_description(type_hint)}",
104
- }
105
- except (NameError, AttributeError):
106
- pass
107
- return schema
108
-
109
- # Handle dictionary
110
- if isinstance(t, dict):
111
- for key, value in t.items():
112
- schema["properties"][key] = {
113
- "type": type(value).__name__,
114
- "description": f"Field of type {type(value).__name__}",
115
- "example": value,
116
- }
117
- return schema
118
-
119
- # Handle basic types and type hints
120
- origin = inspection.get_origin(t)
121
- if origin is not None:
122
- args = inspection.get_args(t)
123
- if origin is list and args:
124
- return {"type": "array", "items": {"type": get_type_description(args[0])}}
125
- elif origin is dict and len(args) == 2:
126
- return {
127
- "type": "object",
128
- "additionalProperties": {"type": get_type_description(args[1])},
129
- "description": f"Object with {get_type_description(args[0])} keys",
130
- }
131
- elif origin is tuple and args:
132
- return {
133
- "type": "array",
134
- "items": [{"type": get_type_description(arg)} for arg in args],
135
- "minItems": len(args),
136
- "maxItems": len(args),
137
- }
138
- elif inspection.is_union_type(t):
139
- if inspection.is_optional_type(t):
140
- non_none_args = [arg for arg in args if arg is not type(None)]
141
- if non_none_args:
142
- return {
143
- "type": get_type_description(non_none_args[0]),
144
- "nullable": True,
145
- }
146
- else:
147
- return {"anyOf": [{"type": get_type_description(arg)} for arg in args]}
148
- elif inspection.is_literal_type(t) and args:
149
- return {"enum": list(args)}
150
-
151
- # Default to string representation of type
152
- return {"type": get_type_description(t)}
@@ -1,35 +0,0 @@
1
- """hammad.logging"""
2
-
3
- from typing import TYPE_CHECKING
4
- from .._core._utils._import_utils import _auto_create_getattr_loader
5
-
6
- if TYPE_CHECKING:
7
- from .logger import Logger, create_logger, create_logger_level, LoggerLevelName
8
- from .decorators import (
9
- trace_function,
10
- trace_cls,
11
- trace,
12
- trace_http,
13
- install_trace_http,
14
- )
15
-
16
-
17
- __all__ = (
18
- "Logger",
19
- "LoggerLevelName",
20
- "create_logger",
21
- "create_logger_level",
22
- "trace_function",
23
- "trace_cls",
24
- "trace",
25
- "trace_http",
26
- "install_trace_http",
27
- )
28
-
29
-
30
- __getattr__ = _auto_create_getattr_loader(__all__)
31
-
32
-
33
- def __dir__() -> list[str]:
34
- """Get the attributes of the logging module."""
35
- return list(__all__)