linq-python 0.2.2__tar.gz → 0.2.4__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.
- linq_python-0.2.4/.release-please-manifest.json +3 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/CHANGELOG.md +27 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/PKG-INFO +1 -1
- {linq_python-0.2.2 → linq_python-0.2.4}/pyproject.toml +1 -1
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/_files.py +53 -3
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/_utils/__init__.py +0 -1
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/_utils/_utils.py +3 -17
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/_version.py +1 -1
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/resources/attachments.py +8 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/resources/chats/typing.py +38 -12
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/attachment_create_params.py +4 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/attachment_retrieve_response.py +4 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/chats/sent_message.py +5 -2
- {linq_python-0.2.2 → linq_python-0.2.4}/tests/test_extract_files.py +9 -0
- linq_python-0.2.4/tests/test_files.py +148 -0
- linq_python-0.2.2/.release-please-manifest.json +0 -3
- linq_python-0.2.2/tests/test_deepcopy.py +0 -58
- linq_python-0.2.2/tests/test_files.py +0 -51
- {linq_python-0.2.2 → linq_python-0.2.4}/.gitignore +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/CONTRIBUTING.md +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/LICENSE +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/README.md +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/SECURITY.md +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/api.md +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/bin/check-release-environment +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/bin/publish-pypi +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/examples/.keep +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/release-please-config.json +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/requirements-dev.lock +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/__init__.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/_base_client.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/_client.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/_compat.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/_constants.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/_exceptions.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/_models.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/_qs.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/_resource.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/_response.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/_streaming.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/_types.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/_utils/_compat.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/_utils/_datetime_parse.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/_utils/_json.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/_utils/_logs.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/_utils/_path.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/_utils/_proxy.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/_utils/_reflection.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/_utils/_resources_proxy.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/_utils/_streams.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/_utils/_sync.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/_utils/_transform.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/_utils/_typing.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/lib/.keep +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/pagination.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/py.typed +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/resources/__init__.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/resources/capability.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/resources/chats/__init__.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/resources/chats/chats.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/resources/chats/messages.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/resources/chats/participants.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/resources/contact_card.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/resources/messages.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/resources/phone_numbers.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/resources/phonenumbers.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/resources/webhook_events.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/resources/webhook_subscriptions.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/resources/webhooks.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/__init__.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/attachment_create_response.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/capability_check_RCS_params.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/capability_check_i_message_params.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/chat.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/chat_create_params.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/chat_create_response.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/chat_created_webhook_event.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/chat_group_icon_update_failed_webhook_event.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/chat_group_icon_updated_webhook_event.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/chat_group_name_update_failed_webhook_event.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/chat_group_name_updated_webhook_event.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/chat_leave_chat_response.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/chat_list_chats_params.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/chat_send_voicememo_params.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/chat_send_voicememo_response.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/chat_typing_indicator_started_webhook_event.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/chat_typing_indicator_stopped_webhook_event.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/chat_update_params.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/chat_update_response.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/chats/__init__.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/chats/message_list_params.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/chats/message_send_params.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/chats/message_send_response.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/chats/participant_add_params.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/chats/participant_add_response.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/chats/participant_remove_params.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/chats/participant_remove_response.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/contact_card_create_params.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/contact_card_retrieve_params.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/contact_card_retrieve_response.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/contact_card_update_params.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/events_webhook_event.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/handle_check_response.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/link_part_param.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/media_part_param.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/message.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/message_add_reaction_params.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/message_add_reaction_response.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/message_content_param.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/message_delivered_webhook_event.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/message_edited_webhook_event.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/message_effect.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/message_effect_param.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/message_event_v2.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/message_failed_webhook_event.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/message_list_messages_thread_params.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/message_read_webhook_event.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/message_received_webhook_event.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/message_sent_webhook_event.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/message_update_params.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/participant_added_webhook_event.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/participant_removed_webhook_event.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/phone_number_list_response.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/phone_number_status_updated_webhook_event.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/phonenumber_list_response.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/reaction_added_webhook_event.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/reaction_event_base.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/reaction_removed_webhook_event.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/reply_to.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/reply_to_param.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/schemas_media_part_response.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/schemas_message_effect.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/schemas_text_part_response.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/set_contact_card.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/shared/__init__.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/shared/chat_handle.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/shared/link_part_response.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/shared/media_part_response.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/shared/reaction.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/shared/reaction_type.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/shared/service_type.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/shared/text_decoration.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/shared/text_part_response.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/shared_params/__init__.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/shared_params/reaction_type.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/shared_params/service_type.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/shared_params/text_decoration.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/supported_content_type.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/text_part_param.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/webhook_event_list_response.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/webhook_event_type.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/webhook_subscription.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/webhook_subscription_create_params.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/webhook_subscription_create_response.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/webhook_subscription_list_response.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq/types/webhook_subscription_update_params.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/src/linq_api_v3/lib/.keep +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/tests/__init__.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/tests/api_resources/__init__.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/tests/api_resources/chats/__init__.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/tests/api_resources/chats/test_messages.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/tests/api_resources/chats/test_participants.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/tests/api_resources/chats/test_typing.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/tests/api_resources/test_attachments.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/tests/api_resources/test_capability.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/tests/api_resources/test_chats.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/tests/api_resources/test_contact_card.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/tests/api_resources/test_messages.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/tests/api_resources/test_phone_numbers.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/tests/api_resources/test_phonenumbers.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/tests/api_resources/test_webhook_events.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/tests/api_resources/test_webhook_subscriptions.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/tests/api_resources/test_webhooks.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/tests/conftest.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/tests/sample_file.txt +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/tests/test_client.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/tests/test_models.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/tests/test_qs.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/tests/test_required_args.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/tests/test_response.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/tests/test_streaming.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/tests/test_transform.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/tests/test_utils/test_datetime_parse.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/tests/test_utils/test_json.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/tests/test_utils/test_path.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/tests/test_utils/test_proxy.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/tests/test_utils/test_typing.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/tests/utils.py +0 -0
- {linq_python-0.2.2 → linq_python-0.2.4}/uv.lock +0 -0
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.4 (2026-04-18)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.2.3...v0.2.4](https://github.com/linq-team/linq-python/compare/v0.2.3...v0.2.4)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
* ensure file data are only sent as 1 parameter ([0e5a821](https://github.com/linq-team/linq-python/commit/0e5a8217fcab667939e6a211e4f3b9abab7acfca))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Performance Improvements
|
|
13
|
+
|
|
14
|
+
* **client:** optimize file structure copying in multipart requests ([2d5ebac](https://github.com/linq-team/linq-python/commit/2d5ebacb793aa7f2f86b9e820db6e8f01b71605d))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Documentation
|
|
18
|
+
|
|
19
|
+
* **openapi:** document typing indicator behavior and limitations ([3ea2cea](https://github.com/linq-team/linq-python/commit/3ea2ceaf47fd3a340a58e7334e58375f950862fc))
|
|
20
|
+
|
|
21
|
+
## 0.2.3 (2026-04-08)
|
|
22
|
+
|
|
23
|
+
Full Changelog: [v0.2.2...v0.2.3](https://github.com/linq-team/linq-python/compare/v0.2.2...v0.2.3)
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* **api-service:** add created_at and make sent_at nullable in SentMessage ([fa68395](https://github.com/linq-team/linq-python/commit/fa683950b661507844f9d1f22c4716daf9805810))
|
|
28
|
+
* block SMS group participant changes and fix e2e test failures ([e05f1af](https://github.com/linq-team/linq-python/commit/e05f1af36a6d37d13952bdad56f16b903bfccc34))
|
|
29
|
+
|
|
3
30
|
## 0.2.2 (2026-04-08)
|
|
4
31
|
|
|
5
32
|
Full Changelog: [v0.2.1...v0.2.2](https://github.com/linq-team/linq-python/compare/v0.2.1...v0.2.2)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: linq-python
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
4
4
|
Summary: The official Python library for the linq-api-v3 API
|
|
5
5
|
Project-URL: Homepage, https://github.com/linq-team/linq-python
|
|
6
6
|
Project-URL: Repository, https://github.com/linq-team/linq-python
|
|
@@ -3,8 +3,8 @@ from __future__ import annotations
|
|
|
3
3
|
import io
|
|
4
4
|
import os
|
|
5
5
|
import pathlib
|
|
6
|
-
from typing import overload
|
|
7
|
-
from typing_extensions import TypeGuard
|
|
6
|
+
from typing import Sequence, cast, overload
|
|
7
|
+
from typing_extensions import TypeVar, TypeGuard
|
|
8
8
|
|
|
9
9
|
import anyio
|
|
10
10
|
|
|
@@ -17,7 +17,9 @@ from ._types import (
|
|
|
17
17
|
HttpxFileContent,
|
|
18
18
|
HttpxRequestFiles,
|
|
19
19
|
)
|
|
20
|
-
from ._utils import is_tuple_t, is_mapping_t, is_sequence_t
|
|
20
|
+
from ._utils import is_list, is_mapping, is_tuple_t, is_mapping_t, is_sequence_t
|
|
21
|
+
|
|
22
|
+
_T = TypeVar("_T")
|
|
21
23
|
|
|
22
24
|
|
|
23
25
|
def is_base64_file_input(obj: object) -> TypeGuard[Base64FileInput]:
|
|
@@ -121,3 +123,51 @@ async def async_read_file_content(file: FileContent) -> HttpxFileContent:
|
|
|
121
123
|
return await anyio.Path(file).read_bytes()
|
|
122
124
|
|
|
123
125
|
return file
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def deepcopy_with_paths(item: _T, paths: Sequence[Sequence[str]]) -> _T:
|
|
129
|
+
"""Copy only the containers along the given paths.
|
|
130
|
+
|
|
131
|
+
Used to guard against mutation by extract_files without copying the entire structure.
|
|
132
|
+
Only dicts and lists that lie on a path are copied; everything else
|
|
133
|
+
is returned by reference.
|
|
134
|
+
|
|
135
|
+
For example, given paths=[["foo", "files", "file"]] and the structure:
|
|
136
|
+
{
|
|
137
|
+
"foo": {
|
|
138
|
+
"bar": {"baz": {}},
|
|
139
|
+
"files": {"file": <content>}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
The root dict, "foo", and "files" are copied (they lie on the path).
|
|
143
|
+
"bar" and "baz" are returned by reference (off the path).
|
|
144
|
+
"""
|
|
145
|
+
return _deepcopy_with_paths(item, paths, 0)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
def _deepcopy_with_paths(item: _T, paths: Sequence[Sequence[str]], index: int) -> _T:
|
|
149
|
+
if not paths:
|
|
150
|
+
return item
|
|
151
|
+
if is_mapping(item):
|
|
152
|
+
key_to_paths: dict[str, list[Sequence[str]]] = {}
|
|
153
|
+
for path in paths:
|
|
154
|
+
if index < len(path):
|
|
155
|
+
key_to_paths.setdefault(path[index], []).append(path)
|
|
156
|
+
|
|
157
|
+
# if no path continues through this mapping, it won't be mutated and copying it is redundant
|
|
158
|
+
if not key_to_paths:
|
|
159
|
+
return item
|
|
160
|
+
|
|
161
|
+
result = dict(item)
|
|
162
|
+
for key, subpaths in key_to_paths.items():
|
|
163
|
+
if key in result:
|
|
164
|
+
result[key] = _deepcopy_with_paths(result[key], subpaths, index + 1)
|
|
165
|
+
return cast(_T, result)
|
|
166
|
+
if is_list(item):
|
|
167
|
+
array_paths = [path for path in paths if index < len(path) and path[index] == "<array>"]
|
|
168
|
+
|
|
169
|
+
# if no path expects a list here, nothing will be mutated inside it - return by reference
|
|
170
|
+
if not array_paths:
|
|
171
|
+
return cast(_T, item)
|
|
172
|
+
return cast(_T, [_deepcopy_with_paths(entry, array_paths, index + 1) for entry in item])
|
|
173
|
+
return item
|
|
@@ -24,7 +24,6 @@ from ._utils import (
|
|
|
24
24
|
coerce_integer as coerce_integer,
|
|
25
25
|
file_from_path as file_from_path,
|
|
26
26
|
strip_not_given as strip_not_given,
|
|
27
|
-
deepcopy_minimal as deepcopy_minimal,
|
|
28
27
|
get_async_library as get_async_library,
|
|
29
28
|
maybe_coerce_float as maybe_coerce_float,
|
|
30
29
|
get_required_header as get_required_header,
|
|
@@ -86,8 +86,9 @@ def _extract_items(
|
|
|
86
86
|
index += 1
|
|
87
87
|
if is_dict(obj):
|
|
88
88
|
try:
|
|
89
|
-
#
|
|
90
|
-
|
|
89
|
+
# Remove the field if there are no more dict keys in the path,
|
|
90
|
+
# only "<array>" traversal markers or end.
|
|
91
|
+
if all(p == "<array>" for p in path[index:]):
|
|
91
92
|
item = obj.pop(key)
|
|
92
93
|
else:
|
|
93
94
|
item = obj[key]
|
|
@@ -176,21 +177,6 @@ def is_iterable(obj: object) -> TypeGuard[Iterable[object]]:
|
|
|
176
177
|
return isinstance(obj, Iterable)
|
|
177
178
|
|
|
178
179
|
|
|
179
|
-
def deepcopy_minimal(item: _T) -> _T:
|
|
180
|
-
"""Minimal reimplementation of copy.deepcopy() that will only copy certain object types:
|
|
181
|
-
|
|
182
|
-
- mappings, e.g. `dict`
|
|
183
|
-
- list
|
|
184
|
-
|
|
185
|
-
This is done for performance reasons.
|
|
186
|
-
"""
|
|
187
|
-
if is_mapping(item):
|
|
188
|
-
return cast(_T, {k: deepcopy_minimal(v) for k, v in item.items()})
|
|
189
|
-
if is_list(item):
|
|
190
|
-
return cast(_T, [deepcopy_minimal(entry) for entry in item])
|
|
191
|
-
return item
|
|
192
|
-
|
|
193
|
-
|
|
194
180
|
# copied from https://github.com/Rapptz/RoboDanny
|
|
195
181
|
def human_join(seq: Sequence[str], *, delim: str = ", ", final: str = "or") -> str:
|
|
196
182
|
size = len(seq)
|
|
@@ -219,6 +219,10 @@ class AttachmentsResource(SyncAPIResource):
|
|
|
219
219
|
application/x-iwork-keynote-sffkey, application/epub+zip, application/zip,
|
|
220
220
|
application/x-gzip
|
|
221
221
|
|
|
222
|
+
**Transcoded on delivery:**
|
|
223
|
+
|
|
224
|
+
- `audio/x-caf` — CAF files are transcoded to `audio/mp4` for delivery.
|
|
225
|
+
|
|
222
226
|
**Deprecated (accepted but transcoded):**
|
|
223
227
|
|
|
224
228
|
- `audio/mp3` — Deprecated. Use `audio/mpeg` instead. Files sent as audio/mp3
|
|
@@ -490,6 +494,10 @@ class AsyncAttachmentsResource(AsyncAPIResource):
|
|
|
490
494
|
application/x-iwork-keynote-sffkey, application/epub+zip, application/zip,
|
|
491
495
|
application/x-gzip
|
|
492
496
|
|
|
497
|
+
**Transcoded on delivery:**
|
|
498
|
+
|
|
499
|
+
- `audio/x-caf` — CAF files are transcoded to `audio/mp4` for delivery.
|
|
500
|
+
|
|
493
501
|
**Deprecated (accepted but transcoded):**
|
|
494
502
|
|
|
495
503
|
- `audio/mp3` — Deprecated. Use `audio/mpeg` instead. Files sent as audio/mp3
|
|
@@ -71,8 +71,20 @@ class TypingResource(SyncAPIResource):
|
|
|
71
71
|
"""
|
|
72
72
|
Send a typing indicator to show that someone is typing in the chat.
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
## Behavior & Limitations
|
|
75
|
+
|
|
76
|
+
Typing indicators are best-effort signals with the following limitations:
|
|
77
|
+
|
|
78
|
+
- **Active conversations only:** The recipient must have sent or received a
|
|
79
|
+
message in this chat within the **last 5 minutes**. If the chat is inactive,
|
|
80
|
+
the request is still accepted (`204`) but the indicator will not reach the
|
|
81
|
+
recipient's device.
|
|
82
|
+
|
|
83
|
+
- **No delivery guarantee:** Even for active chats, a `204` response only
|
|
84
|
+
indicates the request was accepted for processing.
|
|
85
|
+
|
|
86
|
+
- **Group chats not supported:** Attempting to start a typing indicator in a
|
|
87
|
+
group chat will return a `403` error.
|
|
76
88
|
|
|
77
89
|
Args:
|
|
78
90
|
extra_headers: Send extra headers
|
|
@@ -108,11 +120,12 @@ class TypingResource(SyncAPIResource):
|
|
|
108
120
|
"""
|
|
109
121
|
Stop the typing indicator for the chat.
|
|
110
122
|
|
|
111
|
-
|
|
112
|
-
|
|
123
|
+
Typing indicators are automatically stopped when a message is sent, so calling
|
|
124
|
+
this endpoint after sending a message is unnecessary.
|
|
125
|
+
|
|
126
|
+
See the `POST` endpoint above for behavior details and limitations.
|
|
113
127
|
|
|
114
|
-
**Note:** Group
|
|
115
|
-
to stop a typing indicator in a group chat will return a `403` error.
|
|
128
|
+
**Note:** Group chats are not supported and will return a `403` error.
|
|
116
129
|
|
|
117
130
|
Args:
|
|
118
131
|
extra_headers: Send extra headers
|
|
@@ -187,8 +200,20 @@ class AsyncTypingResource(AsyncAPIResource):
|
|
|
187
200
|
"""
|
|
188
201
|
Send a typing indicator to show that someone is typing in the chat.
|
|
189
202
|
|
|
190
|
-
|
|
191
|
-
|
|
203
|
+
## Behavior & Limitations
|
|
204
|
+
|
|
205
|
+
Typing indicators are best-effort signals with the following limitations:
|
|
206
|
+
|
|
207
|
+
- **Active conversations only:** The recipient must have sent or received a
|
|
208
|
+
message in this chat within the **last 5 minutes**. If the chat is inactive,
|
|
209
|
+
the request is still accepted (`204`) but the indicator will not reach the
|
|
210
|
+
recipient's device.
|
|
211
|
+
|
|
212
|
+
- **No delivery guarantee:** Even for active chats, a `204` response only
|
|
213
|
+
indicates the request was accepted for processing.
|
|
214
|
+
|
|
215
|
+
- **Group chats not supported:** Attempting to start a typing indicator in a
|
|
216
|
+
group chat will return a `403` error.
|
|
192
217
|
|
|
193
218
|
Args:
|
|
194
219
|
extra_headers: Send extra headers
|
|
@@ -224,11 +249,12 @@ class AsyncTypingResource(AsyncAPIResource):
|
|
|
224
249
|
"""
|
|
225
250
|
Stop the typing indicator for the chat.
|
|
226
251
|
|
|
227
|
-
|
|
228
|
-
|
|
252
|
+
Typing indicators are automatically stopped when a message is sent, so calling
|
|
253
|
+
this endpoint after sending a message is unnecessary.
|
|
254
|
+
|
|
255
|
+
See the `POST` endpoint above for behavior details and limitations.
|
|
229
256
|
|
|
230
|
-
**Note:** Group
|
|
231
|
-
to stop a typing indicator in a group chat will return a `403` error.
|
|
257
|
+
**Note:** Group chats are not supported and will return a `403` error.
|
|
232
258
|
|
|
233
259
|
Args:
|
|
234
260
|
extra_headers: Send extra headers
|
|
@@ -34,6 +34,10 @@ class AttachmentCreateParams(TypedDict, total=False):
|
|
|
34
34
|
application/x-iwork-keynote-sffkey, application/epub+zip, application/zip,
|
|
35
35
|
application/x-gzip
|
|
36
36
|
|
|
37
|
+
**Transcoded on delivery:**
|
|
38
|
+
|
|
39
|
+
- `audio/x-caf` — CAF files are transcoded to `audio/mp4` for delivery.
|
|
40
|
+
|
|
37
41
|
**Deprecated (accepted but transcoded):**
|
|
38
42
|
|
|
39
43
|
- `audio/mp3` — Deprecated. Use `audio/mpeg` instead. Files sent as audio/mp3
|
|
@@ -38,6 +38,10 @@ class AttachmentRetrieveResponse(BaseModel):
|
|
|
38
38
|
application/x-iwork-keynote-sffkey, application/epub+zip, application/zip,
|
|
39
39
|
application/x-gzip
|
|
40
40
|
|
|
41
|
+
**Transcoded on delivery:**
|
|
42
|
+
|
|
43
|
+
- `audio/x-caf` — CAF files are transcoded to `audio/mp4` for delivery.
|
|
44
|
+
|
|
41
45
|
**Deprecated (accepted but transcoded):**
|
|
42
46
|
|
|
43
47
|
- `audio/mp3` — Deprecated. Use `audio/mpeg` instead. Files sent as audio/mp3
|
|
@@ -24,6 +24,9 @@ class SentMessage(BaseModel):
|
|
|
24
24
|
id: str
|
|
25
25
|
"""Message identifier (UUID)"""
|
|
26
26
|
|
|
27
|
+
created_at: datetime
|
|
28
|
+
"""When the message was created"""
|
|
29
|
+
|
|
27
30
|
delivery_status: Literal["pending", "queued", "sent", "delivered", "failed"]
|
|
28
31
|
"""Current delivery status of a message"""
|
|
29
32
|
|
|
@@ -33,8 +36,8 @@ class SentMessage(BaseModel):
|
|
|
33
36
|
parts: List[Part]
|
|
34
37
|
"""Message parts in order (text, media, and link)"""
|
|
35
38
|
|
|
36
|
-
sent_at: datetime
|
|
37
|
-
"""When the message was sent"""
|
|
39
|
+
sent_at: Optional[datetime] = None
|
|
40
|
+
"""When the message was actually sent (null if still queued)"""
|
|
38
41
|
|
|
39
42
|
delivered_at: Optional[datetime] = None
|
|
40
43
|
"""When the message was delivered"""
|
|
@@ -35,6 +35,15 @@ def test_multiple_files() -> None:
|
|
|
35
35
|
assert query == {"documents": [{}, {}]}
|
|
36
36
|
|
|
37
37
|
|
|
38
|
+
def test_top_level_file_array() -> None:
|
|
39
|
+
query = {"files": [b"file one", b"file two"], "title": "hello"}
|
|
40
|
+
assert extract_files(query, paths=[["files", "<array>"]]) == [
|
|
41
|
+
("files[]", b"file one"),
|
|
42
|
+
("files[]", b"file two"),
|
|
43
|
+
]
|
|
44
|
+
assert query == {"title": "hello"}
|
|
45
|
+
|
|
46
|
+
|
|
38
47
|
@pytest.mark.parametrize(
|
|
39
48
|
"query,paths,expected",
|
|
40
49
|
[
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
import anyio
|
|
4
|
+
import pytest
|
|
5
|
+
from dirty_equals import IsDict, IsList, IsBytes, IsTuple
|
|
6
|
+
|
|
7
|
+
from linq._files import to_httpx_files, deepcopy_with_paths, async_to_httpx_files
|
|
8
|
+
from linq._utils import extract_files
|
|
9
|
+
|
|
10
|
+
readme_path = Path(__file__).parent.parent.joinpath("README.md")
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def test_pathlib_includes_file_name() -> None:
|
|
14
|
+
result = to_httpx_files({"file": readme_path})
|
|
15
|
+
print(result)
|
|
16
|
+
assert result == IsDict({"file": IsTuple("README.md", IsBytes())})
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def test_tuple_input() -> None:
|
|
20
|
+
result = to_httpx_files([("file", readme_path)])
|
|
21
|
+
print(result)
|
|
22
|
+
assert result == IsList(IsTuple("file", IsTuple("README.md", IsBytes())))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@pytest.mark.asyncio
|
|
26
|
+
async def test_async_pathlib_includes_file_name() -> None:
|
|
27
|
+
result = await async_to_httpx_files({"file": readme_path})
|
|
28
|
+
print(result)
|
|
29
|
+
assert result == IsDict({"file": IsTuple("README.md", IsBytes())})
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@pytest.mark.asyncio
|
|
33
|
+
async def test_async_supports_anyio_path() -> None:
|
|
34
|
+
result = await async_to_httpx_files({"file": anyio.Path(readme_path)})
|
|
35
|
+
print(result)
|
|
36
|
+
assert result == IsDict({"file": IsTuple("README.md", IsBytes())})
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
@pytest.mark.asyncio
|
|
40
|
+
async def test_async_tuple_input() -> None:
|
|
41
|
+
result = await async_to_httpx_files([("file", readme_path)])
|
|
42
|
+
print(result)
|
|
43
|
+
assert result == IsList(IsTuple("file", IsTuple("README.md", IsBytes())))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def test_string_not_allowed() -> None:
|
|
47
|
+
with pytest.raises(TypeError, match="Expected file types input to be a FileContent type or to be a tuple"):
|
|
48
|
+
to_httpx_files(
|
|
49
|
+
{
|
|
50
|
+
"file": "foo", # type: ignore
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def assert_different_identities(obj1: object, obj2: object) -> None:
|
|
56
|
+
assert obj1 == obj2
|
|
57
|
+
assert obj1 is not obj2
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class TestDeepcopyWithPaths:
|
|
61
|
+
def test_copies_top_level_dict(self) -> None:
|
|
62
|
+
original = {"file": b"data", "other": "value"}
|
|
63
|
+
result = deepcopy_with_paths(original, [["file"]])
|
|
64
|
+
assert_different_identities(result, original)
|
|
65
|
+
|
|
66
|
+
def test_file_value_is_same_reference(self) -> None:
|
|
67
|
+
file_bytes = b"contents"
|
|
68
|
+
original = {"file": file_bytes}
|
|
69
|
+
result = deepcopy_with_paths(original, [["file"]])
|
|
70
|
+
assert_different_identities(result, original)
|
|
71
|
+
assert result["file"] is file_bytes
|
|
72
|
+
|
|
73
|
+
def test_list_popped_wholesale(self) -> None:
|
|
74
|
+
files = [b"f1", b"f2"]
|
|
75
|
+
original = {"files": files, "title": "t"}
|
|
76
|
+
result = deepcopy_with_paths(original, [["files", "<array>"]])
|
|
77
|
+
assert_different_identities(result, original)
|
|
78
|
+
result_files = result["files"]
|
|
79
|
+
assert isinstance(result_files, list)
|
|
80
|
+
assert_different_identities(result_files, files)
|
|
81
|
+
|
|
82
|
+
def test_nested_array_path_copies_list_and_elements(self) -> None:
|
|
83
|
+
elem1 = {"file": b"f1", "extra": 1}
|
|
84
|
+
elem2 = {"file": b"f2", "extra": 2}
|
|
85
|
+
original = {"items": [elem1, elem2]}
|
|
86
|
+
result = deepcopy_with_paths(original, [["items", "<array>", "file"]])
|
|
87
|
+
assert_different_identities(result, original)
|
|
88
|
+
result_items = result["items"]
|
|
89
|
+
assert isinstance(result_items, list)
|
|
90
|
+
assert_different_identities(result_items, original["items"])
|
|
91
|
+
assert_different_identities(result_items[0], elem1)
|
|
92
|
+
assert_different_identities(result_items[1], elem2)
|
|
93
|
+
|
|
94
|
+
def test_empty_paths_returns_same_object(self) -> None:
|
|
95
|
+
original = {"foo": "bar"}
|
|
96
|
+
result = deepcopy_with_paths(original, [])
|
|
97
|
+
assert result is original
|
|
98
|
+
|
|
99
|
+
def test_multiple_paths(self) -> None:
|
|
100
|
+
f1 = b"file1"
|
|
101
|
+
f2 = b"file2"
|
|
102
|
+
original = {"a": f1, "b": f2, "c": "unchanged"}
|
|
103
|
+
result = deepcopy_with_paths(original, [["a"], ["b"]])
|
|
104
|
+
assert_different_identities(result, original)
|
|
105
|
+
assert result["a"] is f1
|
|
106
|
+
assert result["b"] is f2
|
|
107
|
+
assert result["c"] is original["c"]
|
|
108
|
+
|
|
109
|
+
def test_extract_files_does_not_mutate_original_top_level(self) -> None:
|
|
110
|
+
file_bytes = b"contents"
|
|
111
|
+
original = {"file": file_bytes, "other": "value"}
|
|
112
|
+
|
|
113
|
+
copied = deepcopy_with_paths(original, [["file"]])
|
|
114
|
+
extracted = extract_files(copied, paths=[["file"]])
|
|
115
|
+
|
|
116
|
+
assert extracted == [("file", file_bytes)]
|
|
117
|
+
assert original == {"file": file_bytes, "other": "value"}
|
|
118
|
+
assert copied == {"other": "value"}
|
|
119
|
+
|
|
120
|
+
def test_extract_files_does_not_mutate_original_nested_array_path(self) -> None:
|
|
121
|
+
file1 = b"f1"
|
|
122
|
+
file2 = b"f2"
|
|
123
|
+
original = {
|
|
124
|
+
"items": [
|
|
125
|
+
{"file": file1, "extra": 1},
|
|
126
|
+
{"file": file2, "extra": 2},
|
|
127
|
+
],
|
|
128
|
+
"title": "example",
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
copied = deepcopy_with_paths(original, [["items", "<array>", "file"]])
|
|
132
|
+
extracted = extract_files(copied, paths=[["items", "<array>", "file"]])
|
|
133
|
+
|
|
134
|
+
assert extracted == [("items[][file]", file1), ("items[][file]", file2)]
|
|
135
|
+
assert original == {
|
|
136
|
+
"items": [
|
|
137
|
+
{"file": file1, "extra": 1},
|
|
138
|
+
{"file": file2, "extra": 2},
|
|
139
|
+
],
|
|
140
|
+
"title": "example",
|
|
141
|
+
}
|
|
142
|
+
assert copied == {
|
|
143
|
+
"items": [
|
|
144
|
+
{"extra": 1},
|
|
145
|
+
{"extra": 2},
|
|
146
|
+
],
|
|
147
|
+
"title": "example",
|
|
148
|
+
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
from linq._utils import deepcopy_minimal
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
def assert_different_identities(obj1: object, obj2: object) -> None:
|
|
5
|
-
assert obj1 == obj2
|
|
6
|
-
assert id(obj1) != id(obj2)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def test_simple_dict() -> None:
|
|
10
|
-
obj1 = {"foo": "bar"}
|
|
11
|
-
obj2 = deepcopy_minimal(obj1)
|
|
12
|
-
assert_different_identities(obj1, obj2)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def test_nested_dict() -> None:
|
|
16
|
-
obj1 = {"foo": {"bar": True}}
|
|
17
|
-
obj2 = deepcopy_minimal(obj1)
|
|
18
|
-
assert_different_identities(obj1, obj2)
|
|
19
|
-
assert_different_identities(obj1["foo"], obj2["foo"])
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def test_complex_nested_dict() -> None:
|
|
23
|
-
obj1 = {"foo": {"bar": [{"hello": "world"}]}}
|
|
24
|
-
obj2 = deepcopy_minimal(obj1)
|
|
25
|
-
assert_different_identities(obj1, obj2)
|
|
26
|
-
assert_different_identities(obj1["foo"], obj2["foo"])
|
|
27
|
-
assert_different_identities(obj1["foo"]["bar"], obj2["foo"]["bar"])
|
|
28
|
-
assert_different_identities(obj1["foo"]["bar"][0], obj2["foo"]["bar"][0])
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
def test_simple_list() -> None:
|
|
32
|
-
obj1 = ["a", "b", "c"]
|
|
33
|
-
obj2 = deepcopy_minimal(obj1)
|
|
34
|
-
assert_different_identities(obj1, obj2)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
def test_nested_list() -> None:
|
|
38
|
-
obj1 = ["a", [1, 2, 3]]
|
|
39
|
-
obj2 = deepcopy_minimal(obj1)
|
|
40
|
-
assert_different_identities(obj1, obj2)
|
|
41
|
-
assert_different_identities(obj1[1], obj2[1])
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
class MyObject: ...
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
def test_ignores_other_types() -> None:
|
|
48
|
-
# custom classes
|
|
49
|
-
my_obj = MyObject()
|
|
50
|
-
obj1 = {"foo": my_obj}
|
|
51
|
-
obj2 = deepcopy_minimal(obj1)
|
|
52
|
-
assert_different_identities(obj1, obj2)
|
|
53
|
-
assert obj1["foo"] is my_obj
|
|
54
|
-
|
|
55
|
-
# tuples
|
|
56
|
-
obj3 = ("a", "b")
|
|
57
|
-
obj4 = deepcopy_minimal(obj3)
|
|
58
|
-
assert obj3 is obj4
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
from pathlib import Path
|
|
2
|
-
|
|
3
|
-
import anyio
|
|
4
|
-
import pytest
|
|
5
|
-
from dirty_equals import IsDict, IsList, IsBytes, IsTuple
|
|
6
|
-
|
|
7
|
-
from linq._files import to_httpx_files, async_to_httpx_files
|
|
8
|
-
|
|
9
|
-
readme_path = Path(__file__).parent.parent.joinpath("README.md")
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def test_pathlib_includes_file_name() -> None:
|
|
13
|
-
result = to_httpx_files({"file": readme_path})
|
|
14
|
-
print(result)
|
|
15
|
-
assert result == IsDict({"file": IsTuple("README.md", IsBytes())})
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
def test_tuple_input() -> None:
|
|
19
|
-
result = to_httpx_files([("file", readme_path)])
|
|
20
|
-
print(result)
|
|
21
|
-
assert result == IsList(IsTuple("file", IsTuple("README.md", IsBytes())))
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
@pytest.mark.asyncio
|
|
25
|
-
async def test_async_pathlib_includes_file_name() -> None:
|
|
26
|
-
result = await async_to_httpx_files({"file": readme_path})
|
|
27
|
-
print(result)
|
|
28
|
-
assert result == IsDict({"file": IsTuple("README.md", IsBytes())})
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
@pytest.mark.asyncio
|
|
32
|
-
async def test_async_supports_anyio_path() -> None:
|
|
33
|
-
result = await async_to_httpx_files({"file": anyio.Path(readme_path)})
|
|
34
|
-
print(result)
|
|
35
|
-
assert result == IsDict({"file": IsTuple("README.md", IsBytes())})
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
@pytest.mark.asyncio
|
|
39
|
-
async def test_async_tuple_input() -> None:
|
|
40
|
-
result = await async_to_httpx_files([("file", readme_path)])
|
|
41
|
-
print(result)
|
|
42
|
-
assert result == IsList(IsTuple("file", IsTuple("README.md", IsBytes())))
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
def test_string_not_allowed() -> None:
|
|
46
|
-
with pytest.raises(TypeError, match="Expected file types input to be a FileContent type or to be a tuple"):
|
|
47
|
-
to_httpx_files(
|
|
48
|
-
{
|
|
49
|
-
"file": "foo", # type: ignore
|
|
50
|
-
}
|
|
51
|
-
)
|
|
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
|
|
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
|
|
File without changes
|