calmlens 0.1.1__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.
calmlens/__init__.py ADDED
@@ -0,0 +1,71 @@
1
+ """CalmLens's server-side Python SDK.
2
+
3
+ >>> from calmlens import CalmLensServerClient
4
+ >>> client = CalmLensServerClient() # reads CALMLENS_API_KEY and CALMLENS_PROJECT_ID
5
+ """
6
+ from . import error_codes
7
+ from ._version import __version__
8
+ from .client import (DEFAULT_CONNECT_TIMEOUT, DEFAULT_MAX_RETRIES, DEFAULT_TIMEOUT, USER_AGENT, CalmLensServerClient,
9
+ CDNResponse, Transport, TransportResponse)
10
+ from .errors import (CalmLensAPIError, CalmLensError, CalmLensTimeoutError, CalmLensTransportError,
11
+ CalmLensValidationError, WebhookVerificationError)
12
+ from .types import (
13
+ AgeRange, Asset, AssetContent, AssetContentRemovalReason, AssetContentStatus, AssetIdOptions, AssetModeration,
14
+ AssetModerationAction, AssetModerationStatus, AssetPage, AssetProcessing, AssetProcessingStatus,
15
+ AssetReviewerAction, AssetSearchMatch, AssetSearchMatchField, AssetSearchResponse, AssetType, AssetUrlOptions, BinaryData, BoundingBox, CategoryResult, CdnResource, CdnTransform,
16
+ Checksums, ClassificationCategories, ClassificationCategory, ClassificationLabel, ClassificationReport, Content,
17
+ CreateFolderOptions, CustomTransform, DetectedFace, DetectedPerson, EnsureLensesOptions,
18
+ EvaluatedCategoryResult, EvaluatedFaceDetectionResult, EvaluatedPersonDetectionResult, EvaluatedQualifierResult,
19
+ Event, EventAsset, EventAssetContent, EventAssetModeration, EventAssetProcessing, EventFact, EventFactKey, EventFactValue, EventSeverity, EventType, EventsPage, ExtractedText,
20
+ FaceDetectionFeatureOptions, FaceDetectionResult, FlaggedContentPolicy, Folder, FolderIdOptions, ImageData,
21
+ ImageTransform, ImageTransformBorder, ImageTransformGravityPoint, ImageTransformOptions, ImageTransformTrim,
22
+ ImageTransformTrimBorder, InlineExtractedText, Lens, LensDefinition, LensTransform, LensType, Likelihood,
23
+ ListAssetsOptions, ListChildrenOptions, ListEventsOptions, MediaClassificationReport, MediaClassificationSegment,
24
+ MediaSegmentSource, MetadataItem, ModerateTextOptions, ModerationAction, ModerationQualifier, MoveAssetOptions,
25
+ MoveFolderOptions, NotEvaluatedCategoryResult, NotEvaluatedFeatureResult, NotEvaluatedQualifierResult,
26
+ NotEvaluatedReason, OcrFeatureOptions, Ordering, PartContent, PartialCategoryResult,
27
+ PersonDetectionFeatureOptions, PersonDetectionResult, PreviewImage, ProcessingFeatureResults,
28
+ ProcessingFeatureStage, ProcessingFeatures, ProcessingOptions, QualifierResult, QualifierResults, SafetyHold,
29
+ SafetyHoldReason, SearchAssetsOptions, SearchMode, SemanticStatus, ServeInit, ServeOptions, SignedUrl,
30
+ SignedUploadToken, SignedUrlOptions, SignUploadTokenOptions, StoredExtractedText, SubmitAssetOptions,
31
+ UpdateAssetOptions, UpdateFolderOptions,
32
+ UploadPartOptions, Visibility, WaitForDecisionOptions, WebhookEventData, WebhookEventPayload,
33
+ )
34
+ from .webhooks import (WEBHOOK_DELIVERY_HEADER, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_SIGNATURE_TOLERANCE_SECONDS,
35
+ WEBHOOK_TIMESTAMP_HEADER, parse_webhook_event, create_webhook_headers,
36
+ create_webhook_signature_header, to_webhook_event_payload, verify_webhook_signature)
37
+
38
+ __all__ = [
39
+ "__version__", "error_codes", "USER_AGENT", "DEFAULT_TIMEOUT", "DEFAULT_CONNECT_TIMEOUT", "DEFAULT_MAX_RETRIES",
40
+ "CalmLensServerClient", "CDNResponse", "Transport", "TransportResponse",
41
+ "CalmLensError", "CalmLensAPIError", "CalmLensTransportError", "CalmLensTimeoutError", "CalmLensValidationError",
42
+ "WebhookVerificationError",
43
+ "verify_webhook_signature", "parse_webhook_event", "to_webhook_event_payload", "create_webhook_signature_header",
44
+ "create_webhook_headers", "WEBHOOK_DELIVERY_HEADER", "WEBHOOK_SIGNATURE_HEADER", "WEBHOOK_TIMESTAMP_HEADER",
45
+ "WEBHOOK_SIGNATURE_TOLERANCE_SECONDS",
46
+ "AgeRange", "Asset", "AssetContent", "AssetContentRemovalReason", "AssetContentStatus", "AssetIdOptions",
47
+ "AssetModeration", "AssetModerationAction", "AssetModerationStatus", "AssetPage", "AssetProcessing",
48
+ "AssetProcessingStatus", "AssetReviewerAction", "AssetSearchMatch", "AssetSearchMatchField",
49
+ "AssetSearchResponse", "AssetType", "AssetUrlOptions", "BinaryData", "BoundingBox",
50
+ "CategoryResult", "CdnResource", "CdnTransform", "Checksums", "ClassificationCategories",
51
+ "ClassificationCategory", "ClassificationLabel", "ClassificationReport", "Content", "CreateFolderOptions",
52
+ "CustomTransform", "DetectedFace", "DetectedPerson", "EnsureLensesOptions",
53
+ "EvaluatedCategoryResult", "EvaluatedFaceDetectionResult", "EvaluatedPersonDetectionResult",
54
+ "EvaluatedQualifierResult", "Event", "EventAsset", "EventAssetContent", "EventAssetModeration",
55
+ "EventAssetProcessing", "EventFact", "EventFactKey", "EventFactValue",
56
+ "EventSeverity", "EventType", "EventsPage", "ExtractedText", "FaceDetectionFeatureOptions",
57
+ "FaceDetectionResult", "FlaggedContentPolicy", "Folder", "FolderIdOptions", "ImageData", "ImageTransform",
58
+ "ImageTransformBorder", "ImageTransformGravityPoint", "ImageTransformOptions", "ImageTransformTrim",
59
+ "ImageTransformTrimBorder", "InlineExtractedText", "Lens", "LensDefinition", "LensTransform", "LensType",
60
+ "Likelihood", "ListAssetsOptions", "ListChildrenOptions", "ListEventsOptions", "MediaClassificationReport",
61
+ "MediaClassificationSegment", "MediaSegmentSource", "MetadataItem", "ModerateTextOptions", "ModerationAction",
62
+ "ModerationQualifier", "MoveAssetOptions", "MoveFolderOptions", "NotEvaluatedCategoryResult",
63
+ "NotEvaluatedFeatureResult", "NotEvaluatedQualifierResult", "NotEvaluatedReason", "OcrFeatureOptions",
64
+ "Ordering", "PartContent", "PartialCategoryResult", "PersonDetectionFeatureOptions", "PersonDetectionResult",
65
+ "PreviewImage", "ProcessingFeatureResults", "ProcessingFeatureStage", "ProcessingFeatures", "ProcessingOptions",
66
+ "QualifierResult", "QualifierResults", "SafetyHold", "SafetyHoldReason", "SearchAssetsOptions", "SearchMode",
67
+ "SemanticStatus", "ServeInit", "ServeOptions", "SignedUrl", "SignedUploadToken", "SignedUrlOptions", "SignUploadTokenOptions",
68
+ "StoredExtractedText",
69
+ "SubmitAssetOptions", "UpdateAssetOptions", "UpdateFolderOptions", "UploadPartOptions", "Visibility",
70
+ "WaitForDecisionOptions", "WebhookEventData", "WebhookEventPayload",
71
+ ]
calmlens/_version.py ADDED
@@ -0,0 +1,23 @@
1
+ """The SDK version, read from the installed package metadata (``pyproject.toml``)."""
2
+ from __future__ import annotations
3
+
4
+ import re
5
+ from importlib import metadata
6
+ from pathlib import Path
7
+
8
+
9
+ def _read_version() -> str:
10
+ # A source checkout (PYTHONPATH=python) has no installed metadata, or may
11
+ # have an older install's; its pyproject.toml is the source of truth there.
12
+ manifest = Path(__file__).resolve().parent.parent / "pyproject.toml"
13
+ if manifest.is_file():
14
+ found = re.search(r'^\[project\][^[]*?^version\s*=\s*"([^"]+)"', manifest.read_text("utf-8"), re.M | re.S)
15
+ if found:
16
+ return found.group(1)
17
+ try:
18
+ return metadata.version("calmlens")
19
+ except metadata.PackageNotFoundError:
20
+ return "0.0.0"
21
+
22
+
23
+ __version__ = _read_version()