fleet-python 0.2.70__tar.gz → 0.2.71__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.
Files changed (85) hide show
  1. {fleet_python-0.2.70/fleet_python.egg-info → fleet_python-0.2.71}/PKG-INFO +1 -1
  2. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/__init__.py +1 -1
  3. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/_async/__init__.py +1 -1
  4. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/_async/base.py +1 -1
  5. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/_async/tasks.py +41 -0
  6. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/base.py +1 -1
  7. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/tasks.py +41 -0
  8. {fleet_python-0.2.70 → fleet_python-0.2.71/fleet_python.egg-info}/PKG-INFO +1 -1
  9. {fleet_python-0.2.70 → fleet_python-0.2.71}/pyproject.toml +1 -1
  10. {fleet_python-0.2.70 → fleet_python-0.2.71}/LICENSE +0 -0
  11. {fleet_python-0.2.70 → fleet_python-0.2.71}/README.md +0 -0
  12. {fleet_python-0.2.70 → fleet_python-0.2.71}/examples/diff_example.py +0 -0
  13. {fleet_python-0.2.70 → fleet_python-0.2.71}/examples/dsl_example.py +0 -0
  14. {fleet_python-0.2.70 → fleet_python-0.2.71}/examples/example.py +0 -0
  15. {fleet_python-0.2.70 → fleet_python-0.2.71}/examples/exampleResume.py +0 -0
  16. {fleet_python-0.2.70 → fleet_python-0.2.71}/examples/example_account.py +0 -0
  17. {fleet_python-0.2.70 → fleet_python-0.2.71}/examples/example_action_log.py +0 -0
  18. {fleet_python-0.2.70 → fleet_python-0.2.71}/examples/example_client.py +0 -0
  19. {fleet_python-0.2.70 → fleet_python-0.2.71}/examples/example_mcp_anthropic.py +0 -0
  20. {fleet_python-0.2.70 → fleet_python-0.2.71}/examples/example_mcp_openai.py +0 -0
  21. {fleet_python-0.2.70 → fleet_python-0.2.71}/examples/example_sync.py +0 -0
  22. {fleet_python-0.2.70 → fleet_python-0.2.71}/examples/example_task.py +0 -0
  23. {fleet_python-0.2.70 → fleet_python-0.2.71}/examples/example_tasks.py +0 -0
  24. {fleet_python-0.2.70 → fleet_python-0.2.71}/examples/example_verifier.py +0 -0
  25. {fleet_python-0.2.70 → fleet_python-0.2.71}/examples/export_tasks.py +0 -0
  26. {fleet_python-0.2.70 → fleet_python-0.2.71}/examples/gemini_example.py +0 -0
  27. {fleet_python-0.2.70 → fleet_python-0.2.71}/examples/import_tasks.py +0 -0
  28. {fleet_python-0.2.70 → fleet_python-0.2.71}/examples/json_tasks_example.py +0 -0
  29. {fleet_python-0.2.70 → fleet_python-0.2.71}/examples/nova_act_example.py +0 -0
  30. {fleet_python-0.2.70 → fleet_python-0.2.71}/examples/openai_example.py +0 -0
  31. {fleet_python-0.2.70 → fleet_python-0.2.71}/examples/openai_simple_example.py +0 -0
  32. {fleet_python-0.2.70 → fleet_python-0.2.71}/examples/query_builder_example.py +0 -0
  33. {fleet_python-0.2.70 → fleet_python-0.2.71}/examples/quickstart.py +0 -0
  34. {fleet_python-0.2.70 → fleet_python-0.2.71}/examples/test_cdp_logging.py +0 -0
  35. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/_async/client.py +0 -0
  36. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/_async/env/__init__.py +0 -0
  37. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/_async/env/client.py +0 -0
  38. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/_async/exceptions.py +0 -0
  39. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/_async/global_client.py +0 -0
  40. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/_async/instance/__init__.py +0 -0
  41. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/_async/instance/base.py +0 -0
  42. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/_async/instance/client.py +0 -0
  43. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/_async/models.py +0 -0
  44. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/_async/resources/__init__.py +0 -0
  45. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/_async/resources/base.py +0 -0
  46. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/_async/resources/browser.py +0 -0
  47. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/_async/resources/mcp.py +0 -0
  48. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/_async/resources/sqlite.py +0 -0
  49. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/_async/verifiers/__init__.py +0 -0
  50. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/_async/verifiers/bundler.py +0 -0
  51. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/_async/verifiers/verifier.py +0 -0
  52. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/client.py +0 -0
  53. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/config.py +0 -0
  54. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/env/__init__.py +0 -0
  55. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/env/client.py +0 -0
  56. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/exceptions.py +0 -0
  57. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/global_client.py +0 -0
  58. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/instance/__init__.py +0 -0
  59. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/instance/base.py +0 -0
  60. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/instance/client.py +0 -0
  61. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/instance/models.py +0 -0
  62. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/models.py +0 -0
  63. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/resources/__init__.py +0 -0
  64. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/resources/base.py +0 -0
  65. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/resources/browser.py +0 -0
  66. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/resources/mcp.py +0 -0
  67. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/resources/sqlite.py +0 -0
  68. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/types.py +0 -0
  69. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/verifiers/__init__.py +0 -0
  70. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/verifiers/bundler.py +0 -0
  71. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/verifiers/code.py +0 -0
  72. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/verifiers/db.py +0 -0
  73. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/verifiers/decorator.py +0 -0
  74. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/verifiers/parse.py +0 -0
  75. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/verifiers/sql_differ.py +0 -0
  76. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet/verifiers/verifier.py +0 -0
  77. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet_python.egg-info/SOURCES.txt +0 -0
  78. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet_python.egg-info/dependency_links.txt +0 -0
  79. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet_python.egg-info/requires.txt +0 -0
  80. {fleet_python-0.2.70 → fleet_python-0.2.71}/fleet_python.egg-info/top_level.txt +0 -0
  81. {fleet_python-0.2.70 → fleet_python-0.2.71}/scripts/fix_sync_imports.py +0 -0
  82. {fleet_python-0.2.70 → fleet_python-0.2.71}/scripts/unasync.py +0 -0
  83. {fleet_python-0.2.70 → fleet_python-0.2.71}/setup.cfg +0 -0
  84. {fleet_python-0.2.70 → fleet_python-0.2.71}/tests/__init__.py +0 -0
  85. {fleet_python-0.2.70 → fleet_python-0.2.71}/tests/test_verifier_from_string.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fleet-python
3
- Version: 0.2.70
3
+ Version: 0.2.71
4
4
  Summary: Python SDK for Fleet environments
5
5
  Author-email: Fleet AI <nic@fleet.so>
6
6
  License: Apache-2.0
@@ -73,7 +73,7 @@ from . import env
73
73
  from . import global_client as _global_client
74
74
  from ._async import global_client as _async_global_client
75
75
 
76
- __version__ = "0.2.70"
76
+ __version__ = "0.2.71"
77
77
 
78
78
  __all__ = [
79
79
  # Core classes
@@ -44,7 +44,7 @@ from ..types import VerifierFunction
44
44
  from .. import env
45
45
  from . import global_client as _async_global_client
46
46
 
47
- __version__ = "0.2.70"
47
+ __version__ = "0.2.71"
48
48
 
49
49
  __all__ = [
50
50
  # Core classes
@@ -25,7 +25,7 @@ from .exceptions import (
25
25
  try:
26
26
  from .. import __version__
27
27
  except ImportError:
28
- __version__ = "0.2.70"
28
+ __version__ = "0.2.71"
29
29
 
30
30
  logger = logging.getLogger(__name__)
31
31
 
@@ -296,6 +296,8 @@ def verifier_from_string(
296
296
  try:
297
297
  import inspect
298
298
  import re
299
+ import json
300
+ import string
299
301
  from .verifiers.verifier import AsyncVerifierFunction
300
302
  from fleet.verifiers.code import TASK_SUCCESSFUL_SCORE, TASK_FAILED_SCORE
301
303
  from fleet.verifiers.db import IgnoreConfig
@@ -307,12 +309,51 @@ def verifier_from_string(
307
309
  cleaned_code = re.sub(r"from fleet import.*verifier.*\n", "", cleaned_code)
308
310
  cleaned_code = re.sub(r"import.*verifier.*\n", "", cleaned_code)
309
311
 
312
+ # Define helper functions for verifier execution
313
+ _TRANSLATOR = str.maketrans(string.punctuation, " " * len(string.punctuation))
314
+
315
+ def _normalize_text(value: str) -> str:
316
+ text = value.lower().translate(_TRANSLATOR)
317
+ return "".join(text.split())
318
+
319
+ def _stringify_content(content: Any) -> str:
320
+ if isinstance(content, (dict, list)):
321
+ return json.dumps(content, sort_keys=True)
322
+ return str(content)
323
+
324
+ def normalized_contains(target: str, blob: Any) -> bool:
325
+ normalized_target = _normalize_text(target)
326
+ normalized_blob = _normalize_text(_stringify_content(blob))
327
+ return normalized_target in normalized_blob
328
+
329
+ def extract_numbers(text: str) -> list:
330
+ cleaned_text = text.replace(',', '')
331
+ pattern = r'-?\d+\.?\d*'
332
+ matches = re.findall(pattern, cleaned_text)
333
+ return [float(num) for num in matches]
334
+
335
+ def contains_number(text: str, target_number) -> bool:
336
+ numbers = extract_numbers(text)
337
+ try:
338
+ if isinstance(target_number, str):
339
+ target_number = target_number.replace(',', '')
340
+ target = float(target_number)
341
+ except (ValueError, AttributeError):
342
+ return False
343
+ return target in numbers
344
+
310
345
  # Create a local namespace for executing the code
311
346
  local_namespace = {
312
347
  "TASK_SUCCESSFUL_SCORE": TASK_SUCCESSFUL_SCORE,
313
348
  "TASK_FAILED_SCORE": TASK_FAILED_SCORE,
314
349
  "IgnoreConfig": IgnoreConfig,
315
350
  "Environment": object, # Add Environment type if needed
351
+ "normalized_contains": normalized_contains,
352
+ "extract_numbers": extract_numbers,
353
+ "contains_number": contains_number,
354
+ "json": json,
355
+ "re": re,
356
+ "string": string,
316
357
  }
317
358
 
318
359
  # Execute the cleaned verifier code in the namespace
@@ -25,7 +25,7 @@ from .exceptions import (
25
25
  try:
26
26
  from . import __version__
27
27
  except ImportError:
28
- __version__ = "0.2.70"
28
+ __version__ = "0.2.71"
29
29
 
30
30
  logger = logging.getLogger(__name__)
31
31
 
@@ -289,6 +289,8 @@ def verifier_from_string(
289
289
  try:
290
290
  import inspect
291
291
  import re
292
+ import json
293
+ import string
292
294
  from .verifiers import SyncVerifierFunction
293
295
  from .verifiers.code import TASK_SUCCESSFUL_SCORE, TASK_FAILED_SCORE
294
296
  from .verifiers.db import IgnoreConfig
@@ -300,6 +302,39 @@ def verifier_from_string(
300
302
  cleaned_code = re.sub(r"from fleet import.*verifier.*\n", "", cleaned_code)
301
303
  cleaned_code = re.sub(r"import.*verifier.*\n", "", cleaned_code)
302
304
 
305
+ # Define helper functions for verifier execution
306
+ _TRANSLATOR = str.maketrans(string.punctuation, " " * len(string.punctuation))
307
+
308
+ def _normalize_text(value: str) -> str:
309
+ text = value.lower().translate(_TRANSLATOR)
310
+ return "".join(text.split())
311
+
312
+ def _stringify_content(content: Any) -> str:
313
+ if isinstance(content, (dict, list)):
314
+ return json.dumps(content, sort_keys=True)
315
+ return str(content)
316
+
317
+ def normalized_contains(target: str, blob: Any) -> bool:
318
+ normalized_target = _normalize_text(target)
319
+ normalized_blob = _normalize_text(_stringify_content(blob))
320
+ return normalized_target in normalized_blob
321
+
322
+ def extract_numbers(text: str) -> list:
323
+ cleaned_text = text.replace(',', '')
324
+ pattern = r'-?\d+\.?\d*'
325
+ matches = re.findall(pattern, cleaned_text)
326
+ return [float(num) for num in matches]
327
+
328
+ def contains_number(text: str, target_number) -> bool:
329
+ numbers = extract_numbers(text)
330
+ try:
331
+ if isinstance(target_number, str):
332
+ target_number = target_number.replace(',', '')
333
+ target = float(target_number)
334
+ except (ValueError, AttributeError):
335
+ return False
336
+ return target in numbers
337
+
303
338
  # Create a globals namespace with all required imports
304
339
  exec_globals = globals().copy()
305
340
  exec_globals.update(
@@ -308,6 +343,12 @@ def verifier_from_string(
308
343
  "TASK_FAILED_SCORE": TASK_FAILED_SCORE,
309
344
  "IgnoreConfig": IgnoreConfig,
310
345
  "Environment": object, # Add Environment type if needed
346
+ "normalized_contains": normalized_contains,
347
+ "extract_numbers": extract_numbers,
348
+ "contains_number": contains_number,
349
+ "json": json,
350
+ "re": re,
351
+ "string": string,
311
352
  }
312
353
  )
313
354
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fleet-python
3
- Version: 0.2.70
3
+ Version: 0.2.71
4
4
  Summary: Python SDK for Fleet environments
5
5
  Author-email: Fleet AI <nic@fleet.so>
6
6
  License: Apache-2.0
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "fleet-python"
7
- version = "0.2.70"
7
+ version = "0.2.71"
8
8
  description = "Python SDK for Fleet environments"
9
9
  authors = [
10
10
  {name = "Fleet AI", email = "nic@fleet.so"},
File without changes
File without changes
File without changes