exa-py 1.1.3__tar.gz → 1.1.5__tar.gz
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.
Potentially problematic release.
This version of exa-py might be problematic. Click here for more details.
- {exa_py-1.1.3 → exa_py-1.1.5}/PKG-INFO +1 -1
- {exa_py-1.1.3 → exa_py-1.1.5}/exa_py/api.py +25 -6
- {exa_py-1.1.3 → exa_py-1.1.5}/exa_py.egg-info/PKG-INFO +1 -1
- {exa_py-1.1.3 → exa_py-1.1.5}/setup.py +1 -1
- {exa_py-1.1.3 → exa_py-1.1.5}/README.md +0 -0
- {exa_py-1.1.3 → exa_py-1.1.5}/exa_py/__init__.py +0 -0
- {exa_py-1.1.3 → exa_py-1.1.5}/exa_py/py.typed +0 -0
- {exa_py-1.1.3 → exa_py-1.1.5}/exa_py/utils.py +0 -0
- {exa_py-1.1.3 → exa_py-1.1.5}/exa_py.egg-info/SOURCES.txt +0 -0
- {exa_py-1.1.3 → exa_py-1.1.5}/exa_py.egg-info/dependency_links.txt +0 -0
- {exa_py-1.1.3 → exa_py-1.1.5}/exa_py.egg-info/requires.txt +0 -0
- {exa_py-1.1.3 → exa_py-1.1.5}/exa_py.egg-info/top_level.txt +0 -0
- {exa_py-1.1.3 → exa_py-1.1.5}/pyproject.toml +0 -0
- {exa_py-1.1.3 → exa_py-1.1.5}/setup.cfg +0 -0
|
@@ -136,17 +136,17 @@ CONTENTS_OPTIONS_TYPES = {
|
|
|
136
136
|
"highlights": [dict, bool],
|
|
137
137
|
"summary": [dict, bool],
|
|
138
138
|
"metadata": [dict, bool],
|
|
139
|
-
|
|
139
|
+
"livecrawl_timeout": [int],
|
|
140
|
+
"livecrawl": [LIVECRAWL_OPTIONS],
|
|
141
|
+
"filter_empty_results": [bool],
|
|
140
142
|
}
|
|
141
143
|
|
|
142
144
|
# the livecrawl options
|
|
143
145
|
LIVECRAWL_OPTIONS = Literal["always", "fallback", "never"]
|
|
144
|
-
CONTENTS_OPTIONS_TYPES["livecrawl_timeout"] = [int]
|
|
145
|
-
CONTENTS_OPTIONS_TYPES["livecrawl"] = [LIVECRAWL_OPTIONS]
|
|
146
|
-
|
|
147
|
-
if is_beta:
|
|
148
|
-
CONTENTS_OPTIONS_TYPES["filter_empty_results"] = [bool]
|
|
149
146
|
|
|
147
|
+
# FOR BETA OPTIONS
|
|
148
|
+
# if is_beta:
|
|
149
|
+
|
|
150
150
|
|
|
151
151
|
def validate_search_options(
|
|
152
152
|
options: Dict[str, Optional[object]], expected: dict
|
|
@@ -168,6 +168,25 @@ def validate_search_options(
|
|
|
168
168
|
f"Invalid type for option '{key}': Expected one of {expected[key]}, got {type(value)}"
|
|
169
169
|
)
|
|
170
170
|
|
|
171
|
+
def is_instance_or_subclass(obj, class_or_tuple):
|
|
172
|
+
if isinstance(class_or_tuple, tuple):
|
|
173
|
+
return any(is_instance_or_subclass(obj, cls) for cls in class_or_tuple)
|
|
174
|
+
|
|
175
|
+
if get_origin(class_or_tuple) is Literal:
|
|
176
|
+
return obj in get_args(class_or_tuple)
|
|
177
|
+
|
|
178
|
+
if get_origin(class_or_tuple) is not None:
|
|
179
|
+
# Handle subscripted generics
|
|
180
|
+
origin = get_origin(class_or_tuple)
|
|
181
|
+
args = get_args(class_or_tuple)
|
|
182
|
+
|
|
183
|
+
if origin is list:
|
|
184
|
+
return isinstance(obj, list) and all(isinstance(item, args[0]) for item in obj)
|
|
185
|
+
elif origin is dict:
|
|
186
|
+
return isinstance(obj, dict) and all(isinstance(k, args[0]) and isinstance(v, args[1]) for k, v in obj.items())
|
|
187
|
+
# Add more cases for other generic types as needed
|
|
188
|
+
|
|
189
|
+
return isinstance(obj, class_or_tuple)
|
|
171
190
|
|
|
172
191
|
class TextContentsOptions(TypedDict, total=False):
|
|
173
192
|
"""A class representing the options that you can specify when requesting text
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|