airbyte-cdk 6.60.0.post16.dev16484674380__py3-none-any.whl → 6.60.0.post18.dev16485197212__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.
@@ -1,6 +1,6 @@
1
1
  # Copyright (c) 2024 Airbyte, Inc., all rights reserved.
2
2
  import sys
3
- from typing import Any, Dict, Type, TypeVar
3
+ from typing import Any, Callable, Dict, Type, TypeVar
4
4
 
5
5
  import orjson
6
6
  from pydantic import ValidationError
@@ -86,7 +86,6 @@ from typing import Any, Optional, Union, overload
86
86
 
87
87
  from dateutil import parser
88
88
  from typing_extensions import Never
89
- from whenever import Instant, LocalDateTime, ZonedDateTime
90
89
 
91
90
 
92
91
  class AirbyteDateTime(datetime):
@@ -138,6 +137,18 @@ class AirbyteDateTime(datetime):
138
137
  dt.tzinfo or timezone.utc,
139
138
  )
140
139
 
140
+ @classmethod
141
+ def from_timestamp(cls, timestamp: float) -> "AirbyteDateTime":
142
+ """Creates an AirbyteDateTime from a Unix timestamp in seconds.
143
+
144
+ Args:
145
+ timestamp: A Unix timestamp in seconds (float).
146
+
147
+ Returns:
148
+ AirbyteDateTime: A new timezone-aware datetime instance (UTC).
149
+ """
150
+ return AirbyteDateTime.from_datetime(datetime.fromtimestamp(timestamp, tz=timezone.utc))
151
+
141
152
  def to_datetime(self) -> datetime:
142
153
  """Converts this AirbyteDateTime to a standard datetime object.
143
154
 
@@ -400,8 +411,7 @@ def ab_datetime_parse(dt_str: str | int) -> AirbyteDateTime:
400
411
  raise ValueError("Timestamp cannot be negative")
401
412
  if len(str(abs(timestamp))) > 10:
402
413
  raise ValueError("Timestamp value too large")
403
- instant = Instant.from_timestamp(timestamp)
404
- return AirbyteDateTime.from_datetime(instant.py_datetime())
414
+ return AirbyteDateTime.from_timestamp(timestamp)
405
415
 
406
416
  if not isinstance(dt_str, str):
407
417
  raise ValueError(
@@ -414,8 +424,7 @@ def ab_datetime_parse(dt_str: str | int) -> AirbyteDateTime:
414
424
  year, month, day = map(int, dt_str.split("-"))
415
425
  if not (1 <= month <= 12 and 1 <= day <= 31):
416
426
  raise ValueError(f"Invalid date format: {dt_str}")
417
- instant = Instant.from_utc(year, month, day, 0, 0, 0)
418
- return AirbyteDateTime.from_datetime(instant.py_datetime())
427
+ return AirbyteDateTime(year, month, day, 0, 0, 0)
419
428
  except (ValueError, TypeError):
420
429
  raise ValueError(f"Invalid date format: {dt_str}")
421
430
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: airbyte-cdk
3
- Version: 6.60.0.post16.dev16484674380
3
+ Version: 6.60.0.post18.dev16485197212
4
4
  Summary: A framework for writing Airbyte Connectors.
5
5
  Home-page: https://airbyte.com
6
6
  License: MIT
@@ -50,7 +50,7 @@ airbyte_cdk/manifest_migrations/migrations/registry.yaml,sha256=F-hdapvl_vZnsI7C
50
50
  airbyte_cdk/manifest_migrations/migrations_registry.py,sha256=zly2fwaOxDukqC7eowzrDlvhA2v71FjW74kDzvRXhSY,2619
51
51
  airbyte_cdk/models/__init__.py,sha256=Et9wJWs5VOWynGbb-3aJRhsdAHAiLkNNLxdwqJAuqkw,2114
52
52
  airbyte_cdk/models/airbyte_protocol.py,sha256=R1G1lvnBDRCZDa9_9Mgy5OEeyMXbvGWsDOnwQkImRKA,266
53
- airbyte_cdk/models/airbyte_protocol_serializers.py,sha256=4lJUZrnoLypM3BFagf4R64XyhRbsMfUffZ_1nHCDNKQ,4503
53
+ airbyte_cdk/models/airbyte_protocol_serializers.py,sha256=EhzK0EnY-G8SApmdzx1c9x6VGr6q9Tb6ysbjGiUf0AA,4513
54
54
  airbyte_cdk/models/connector_metadata.py,sha256=BD6CO8c3mHavxRJAcwP29sHtNNVLVSNFNQLgHOVxrwA,3229
55
55
  airbyte_cdk/models/well_known_types.py,sha256=EquepbisGPuCSrs_D7YVVnMR9-ShhUr21wnFz3COiJs,156
56
56
  airbyte_cdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -411,7 +411,7 @@ airbyte_cdk/utils/analytics_message.py,sha256=bi3uugQ2NjecnwTnz63iD5D1M8ZR8mXPbd
411
411
  airbyte_cdk/utils/connector_paths.py,sha256=MXj0RBi3HpuvQTWH6-vc62BZZ3XguHMq0CVIkjhS3qs,8779
412
412
  airbyte_cdk/utils/constants.py,sha256=QzCi7j5SqpI5I06uRvQ8FC73JVJi7rXaRnR3E_gro5c,108
413
413
  airbyte_cdk/utils/datetime_format_inferrer.py,sha256=Ne2cpk7Tx3eZDEW2Q3O7jnNOY9g-w-AUMt3Ltvwg1tY,3989
414
- airbyte_cdk/utils/datetime_helpers.py,sha256=8mqzZ67Or2PBp7tLtrhh6XFv4wFzYsjCL_DOQJRaftI,17751
414
+ airbyte_cdk/utils/datetime_helpers.py,sha256=PwQq8LBpM9ZfTNZovUQGuk4D5JHXdrHP21afvdoo34Q,17980
415
415
  airbyte_cdk/utils/docker.py,sha256=ub6xurQHw6qIhzgDO3V9sXOG1jkZyDGbOSSDjcazEHo,17989
416
416
  airbyte_cdk/utils/event_timing.py,sha256=aiuFmPU80buLlNdKq4fDTEqqhEIelHPF6AalFGwY8as,2557
417
417
  airbyte_cdk/utils/is_cloud_environment.py,sha256=DayV32Irh-SdnJ0MnjvstwCJ66_l5oEsd8l85rZtHoc,574
@@ -424,9 +424,9 @@ airbyte_cdk/utils/slice_hasher.py,sha256=EDxgROHDbfG-QKQb59m7h_7crN1tRiawdf5uU7G
424
424
  airbyte_cdk/utils/spec_schema_transformations.py,sha256=-5HTuNsnDBAhj-oLeQXwpTGA0HdcjFOf2zTEMUTTg_Y,816
425
425
  airbyte_cdk/utils/stream_status_utils.py,sha256=ZmBoiy5HVbUEHAMrUONxZvxnvfV9CesmQJLDTAIWnWw,1171
426
426
  airbyte_cdk/utils/traced_exception.py,sha256=C8uIBuCL_E4WnBAOPSxBicD06JAldoN9fGsQDp463OY,6292
427
- airbyte_cdk-6.60.0.post16.dev16484674380.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
428
- airbyte_cdk-6.60.0.post16.dev16484674380.dist-info/LICENSE_SHORT,sha256=aqF6D1NcESmpn-cqsxBtszTEnHKnlsp8L4x9wAh3Nxg,55
429
- airbyte_cdk-6.60.0.post16.dev16484674380.dist-info/METADATA,sha256=GDM0HugwhrNDrv8RkxuytvPw9-hRyp2tROFfiSJEvog,6512
430
- airbyte_cdk-6.60.0.post16.dev16484674380.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
431
- airbyte_cdk-6.60.0.post16.dev16484674380.dist-info/entry_points.txt,sha256=AKWbEkHfpzzk9nF9tqBUaw1MbvTM4mGtEzmZQm0ZWvM,139
432
- airbyte_cdk-6.60.0.post16.dev16484674380.dist-info/RECORD,,
427
+ airbyte_cdk-6.60.0.post18.dev16485197212.dist-info/LICENSE.txt,sha256=Wfe61S4BaGPj404v8lrAbvhjYR68SHlkzeYrg3_bbuM,1051
428
+ airbyte_cdk-6.60.0.post18.dev16485197212.dist-info/LICENSE_SHORT,sha256=aqF6D1NcESmpn-cqsxBtszTEnHKnlsp8L4x9wAh3Nxg,55
429
+ airbyte_cdk-6.60.0.post18.dev16485197212.dist-info/METADATA,sha256=-vLPb3dsjRJz1xEk0o_jzuA6foZzyc2-LsbNHcloru0,6512
430
+ airbyte_cdk-6.60.0.post18.dev16485197212.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
431
+ airbyte_cdk-6.60.0.post18.dev16485197212.dist-info/entry_points.txt,sha256=AKWbEkHfpzzk9nF9tqBUaw1MbvTM4mGtEzmZQm0ZWvM,139
432
+ airbyte_cdk-6.60.0.post18.dev16485197212.dist-info/RECORD,,